Skip to content

Commit a1a685e

Browse files
committed
#557: User access Row action panel with 2+ level nesting - CR fix, reverted label
1 parent 62f4ef2 commit a1a685e

File tree

6 files changed

+86
-25
lines changed

6 files changed

+86
-25
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/content-type/_preview.less

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189

190190
.pagebuilder-content-type-affordance {
191191
border: 15px solid @color-gray98;
192-
box-shadow: 0 0 0 1px rgba(197, 197, 197, 0.34); //#ebebeb
192+
box-shadow: 0 0 0 1px rgba(197, 197, 197, 0.34); // #ebebeb
193193
padding: 0;
194194

195195
&:before {
@@ -198,19 +198,13 @@
198198

199199
> .pagebuilder-content-type.type-container.pagebuilder-row {
200200
box-shadow: none;
201-
}
202-
203-
> .pagebuilder-display-label {
204-
background-color: @color-gray98;
205-
color: @color-pagebuilder-silver;
206-
line-height: 13px;
207-
padding: 1px 0 0;
208-
transform: translate(-50%, -15px);
209-
}
210201

211-
&.pagebuilder-content-type-hidden {
212202
> .pagebuilder-display-label {
213-
z-index: initial;
203+
background-color: @color-gray98;
204+
color: @color-pagebuilder-silver;
205+
line-height: 13px;
206+
padding: 1px 0 0;
207+
transform: translate(-50%, -15px);
214208
}
215209
}
216210
}

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/row/preview.js

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/row/contained/preview.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99
ko-style="data.main.style"
1010
css="data.main.css">
1111
<div class="pagebuilder-content-type pagebuilder-content-type-affordance"
12-
ko-style="Object.keys(data.inner.style()).filter(key => key.startsWith('margin')).reduce((obj, key) => {obj[key] = data.inner.style()[key];return obj;}, {});"
12+
ko-style="getStyle('inner', ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])"
1313
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
14-
<div class="pagebuilder-display-label"
15-
text="function () { return displayLabel().toUpperCase(); }()"></div>
1614
<div class="pagebuilder-content-type no-system-border type-container pagebuilder-row children-min-height"
1715
attr="data.inner.attributes"
18-
ko-style="Object.keys(data.inner.style()).filter(key => !key.startsWith('margin')).reduce((obj, key) => {obj[key] = data.inner.style()[key];return obj;}, {});"
16+
ko-style="getStyleWithout('inner', ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])"
1917
css="Object.assign(data.inner.css(), {
2018
'empty-container': contentType.children().length == 0,
2119
'jarallax': data.inner.attributes()['data-enable-parallax'] == 1 || data.inner.attributes()['data-background-type'] == 'video'
@@ -35,6 +33,8 @@
3533
<div class="pagebuilder-drop-indicator"></div>
3634
</if>
3735
</div>
36+
<div class="pagebuilder-display-label"
37+
text="function () { return displayLabel().toUpperCase(); }()"></div>
3838
<div class="pagebuilder-empty-container empty-placeholder"
3939
css="placeholderCss()"
4040
translate="'Drag content types or columns here'"/>

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/row/full-bleed/preview.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
-->
77

88
<div class="pagebuilder-content-type pagebuilder-content-type-affordance"
9-
ko-style="Object.keys(data.main.style()).filter(key => key.startsWith('margin')).reduce((obj, key) => {obj[key] = data.main.style()[key];return obj;}, {});"
9+
ko-style="getStyle('main', ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])"
1010
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
11-
<div class="pagebuilder-display-label"
12-
text="function () { return displayLabel().toUpperCase(); }()"></div>
1311
<div class="pagebuilder-content-type type-container no-system-border pagebuilder-row children-min-height"
1412
attr="data.main.attributes"
15-
ko-style="Object.keys(data.main.style()).filter(key => !key.startsWith('margin')).reduce((obj, key) => {obj[key] = data.main.style()[key];return obj;}, {});"
13+
ko-style="getStyleWithout('main', ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])"
1614
css="Object.assign(data.main.css(), {
1715
'empty-container': contentType.children().length == 0,
1816
'jarallax': data.main.attributes()['data-enable-parallax'] == 1 || data.main.attributes()['data-background-type'] == 'video'
@@ -32,6 +30,8 @@
3230
<div class="pagebuilder-drop-indicator"></div>
3331
</if>
3432
</div>
33+
<div class="pagebuilder-display-label"
34+
text="function () { return displayLabel().toUpperCase(); }()"></div>
3535
<div class="pagebuilder-empty-container empty-placeholder"
3636
css="placeholderCss()"
3737
translate="'Drag content types or columns here'"/>

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/row/full-width/preview.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
-->
77

88
<div class="pagebuilder-content-type pagebuilder-content-type-affordance"
9-
ko-style="Object.keys(data.main.style()).filter(key => key.startsWith('margin')).reduce((obj, key) => {obj[key] = data.main.style()[key];return obj;}, {});"
9+
ko-style="getStyle('main', ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])"
1010
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
11-
<div class="pagebuilder-display-label"
12-
text="function () { return displayLabel().toUpperCase(); }()"></div>
13-
<div class="pagebuilder-content-type type-container no-system-border pagebuilder-row children-min-height"
11+
<div class="pagebuilder-content-type pagebuilder-row type-container no-system-border children-min-height"
1412
attr="data.main.attributes"
15-
ko-style="Object.keys(data.main.style()).filter(key => !key.startsWith('margin')).reduce((obj, key) => {obj[key] = data.main.style()[key];return obj;}, {});"
13+
ko-style="getStyleWithout('main', ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])"
1614
css="Object.assign(data.main.css(), {
1715
'empty-container': contentType.children().length == 0,
1816
'jarallax': data.main.attributes()['data-enable-parallax'] == 1 || data.main.attributes()['data-background-type'] == 'video'
@@ -32,6 +30,8 @@
3230
<div class="pagebuilder-drop-indicator"></div>
3331
</if>
3432
</div>
33+
<div class="pagebuilder-display-label"
34+
text="function () { return displayLabel().toUpperCase(); }()"></div>
3535
<div class="pagebuilder-empty-container empty-placeholder"
3636
css="placeholderCss()"
3737
translate="'Drag content types or columns here'"/>

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/row/preview.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,37 @@ export default class Preview extends PreviewCollection {
209209
jarallax(this.element, "destroy");
210210
}
211211
}
212+
213+
/**
214+
* Return selected element styles
215+
*
216+
* @param {String} element
217+
* @param {Array} styleProperties
218+
*/
219+
public getStyle(element: String, styleProperties: Array<string>) {
220+
let stylesObject = (element === 'main' ? this.data.main.style() : this.data.inner.style());
221+
222+
return styleProperties.reduce((obj, key) => ({ ...obj, [key]: stylesObject[key] }), {});
223+
}
224+
225+
226+
/**
227+
* Return element styles without selected
228+
*
229+
* @param {String} element
230+
* @param {Array} styleProperties
231+
*/
232+
public getStyleWithout(element: String, styleProperties: Array<string>) {
233+
let stylesObject = (element === 'main' ? this.data.main.style() : this.data.inner.style());
234+
235+
return Object.keys(stylesObject)
236+
.filter(key => !styleProperties.includes(key))
237+
.reduce((obj, key) => {
238+
return {
239+
...obj,
240+
[key]: stylesObject[key]
241+
};
242+
}, {});
243+
}
244+
212245
}

0 commit comments

Comments
 (0)