Skip to content

Commit 7ba0eef

Browse files
Merge pull request #35 from magento-commerce/imported-magento-magento2-page-builder-716
[Page Builder] Regression fixes
2 parents ceedbe3 + 8fa9d88 commit 7ba0eef

File tree

11 files changed

+45
-16
lines changed

11 files changed

+45
-16
lines changed

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderStageSection/PageBuilderStageSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<element name="contentTypeContainer" type="button" selector="(//div[contains(@class, &quot;pagebuilder-content-type&quot;) and contains(@class, &quot;pagebuilder-{{arg1}}&quot;)])[{{arg2}}]/descendant::div[contains(@class, &quot;element-children&quot;)]" parameterized="true"/>
4444
<element name="contentTypeInsideContainerStage" type="button" selector="(//div[contains(@class, &quot;{{arg1}}-container&quot;)])[{{arg2}}]//div[contains(@class,&quot;pagebuilder-content-type-wrapper&quot;)][{{arg3}}]//div[contains(@class,&quot;pagebuilder-{{arg4}}&quot;)][{{arg5}}]" parameterized="true"/>
4545
<element name="contentTypePreviewInStage" type="button" selector="div.pagebuilder-{{arg1}}.pagebuilder-content-type" parameterized="true"/>
46-
<element name="computedHeightOnStage" type="text" selector="return parseInt(window.getComputedStyle(document.querySelector('.pagebuilder-{{arg1}}:nth-of-type({{arg2}})')).height)" parameterized="true"/>
47-
<element name="computedWidthOnStage" type="text" selector="return parseInt(window.getComputedStyle(document.querySelector('.pagebuilder-{{arg1}}:nth-of-type({{arg2}})')).width)" parameterized="true"/>
46+
<element name="computedHeightOnStage" type="text" selector="return parseInt(window.getComputedStyle(document.querySelectorAll('.pagebuilder-{{arg1}}')[{{arg2}}-1]).height)" parameterized="true"/>
47+
<element name="computedWidthOnStage" type="text" selector="return parseInt(window.getComputedStyle(document.querySelectorAll('.pagebuilder-{{arg1}}')[{{arg2}}-1]).width)" parameterized="true"/>
4848
<element name="uploadImageInput" type="button" selector="//div[contains(@class,'pagebuilder-image-uploader-container')]//input[@name='background_image']"/>
4949
<element name="onHoverUploadImageButton" type="button" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-{{arg1}}')])[{{arg2}}]//label[text()='Upload Image']" parameterized="true"/>
5050
<element name="onHoverSelectFromGalleryButton" type="button" selector="(//div[contains(@class,'pagebuilder-content-type') and contains(@class,'pagebuilder-{{arg1}}')])[{{arg2}}]//ul[contains(@class,'pagebuilder-options-links')]//label[text()='Select from Gallery']" parameterized="true"/>

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/content-type/column-group/_mobile.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
.pagebuilder-content-type {
1111
.pagebuilder-column-group {
1212
> .element-children {
13-
display: block;
13+
flex-wrap: wrap;
1414
}
1515
}
1616

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
}
1313

1414
.mobile-viewport .pagebuilder-mobile-only {
15-
display: block !important;
15+
display: inline !important;
1616
}

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/form/element/_mobile.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
.admin__fieldset .admin__field.admin__field-min-height-mobile,
1010
.admin__fieldset .admin__field.admin__field-min-height-mobile-with-notice {
1111
.admin__field-control._with-tooltip {
12-
.admin__control-addon {
13-
max-width: inherit;
14-
}
1512

1613
.admin__field-tooltip {
1714
margin-left: 19px;
@@ -69,7 +66,6 @@
6966

7067
.admin__fieldset .admin__field.admin__field-min-height-mobile {
7168
.admin__field-control._with-tooltip {
72-
display: flex;
7369
width: 17.9rem;
7470
}
7571
}

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/observable-updater/html.js

Lines changed: 6 additions & 1 deletion
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/js/utils/editor.js

Lines changed: 13 additions & 1 deletion
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<div class="pagebuilder-affordance-row pagebuilder-content-type pagebuilder-content-type-affordance"
1212
ko-style="getStyle(data.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(); }()"/>
1416
<div class="pagebuilder-content-type no-system-border type-container pagebuilder-row children-min-height"
1517
attr="data.inner.attributes"
1618
ko-style="Object.assign({}, getStyleWithout(data.inner, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight']), {backgroundImage: getBackgroundImage()})"
@@ -37,7 +39,5 @@
3739
css="placeholderCss()"
3840
translate="'Drag content types or columns here'"/>
3941
</div>
40-
<div class="pagebuilder-display-label"
41-
text="function () { return displayLabel().toUpperCase(); }()"/>
4242
</div>
4343
</div>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<div class="pagebuilder-affordance-row pagebuilder-content-type pagebuilder-content-type-affordance"
99
ko-style="getStyle(data.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(); }()"/>
1113
<div class="pagebuilder-content-type type-container no-system-border pagebuilder-row children-min-height"
1214
attr="data.main.attributes"
1315
ko-style="Object.assign({}, getStyleWithout(data.main, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight']), {backgroundImage: getBackgroundImage()})"
@@ -34,6 +36,4 @@
3436
css="placeholderCss()"
3537
translate="'Drag content types or columns here'"/>
3638
</div>
37-
<div class="pagebuilder-display-label"
38-
text="function () { return displayLabel().toUpperCase(); }()"/>
3939
</div>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<div class="pagebuilder-affordance-row pagebuilder-content-type pagebuilder-content-type-affordance"
99
ko-style="getStyle(data.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(); }()"/>
1113
<div class="pagebuilder-content-type pagebuilder-row type-container no-system-border children-min-height"
1214
attr="data.main.attributes"
1315
ko-style="Object.assign({}, getStyleWithout(data.main, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight']), {backgroundImage: getBackgroundImage()})"
@@ -34,6 +36,4 @@
3436
css="placeholderCss()"
3537
translate="'Drag content types or columns here'"/>
3638
</div>
37-
<div class="pagebuilder-display-label"
38-
text="function () { return displayLabel().toUpperCase(); }()"/>
3939
</div>

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/observable-updater/html.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {ContentTypeConfigAppearanceElementInterface} from "../../content-type-co
88
import ConverterPool from "../../converter/converter-pool";
99
import {DataObject} from "../../data-store";
1010
import { replaceWithDataSrc } from "../../utils/directives";
11+
import {processInlineStyles} from "../../utils/editor";
1112
import {get} from "../../utils/object";
1213

1314
/**
@@ -41,5 +42,10 @@ export default function generate(
4142
value = replaceWithDataSrc(value);
4243
}
4344

45+
// Process all desktop styles that left unprocessed after migrating from inline styles.
46+
if (typeof value === "string") {
47+
value = processInlineStyles(value);
48+
}
49+
4450
return value;
4551
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/utils/editor.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ export function createDoubleClickEvent(): Event {
350350
}
351351
}
352352

353+
/**
354+
* Replace all desktop styles that left unprocessed back to style element to prevent data corruption.
355+
*/
356+
export function processInlineStyles(html: string) {
357+
const name = Config.getConfig("defaultViewport");
358+
const searchPattern = new RegExp(`data-${name}-style=`, "g");
359+
360+
return html.replace(searchPattern, "style=");
361+
}
362+
353363
/**
354364
* Move the end point of a range to handle tables
355365
*

0 commit comments

Comments
 (0)