Skip to content

Commit c6d6438

Browse files
committed
MC-4014: PageBuilder Performance Is Bad With Minimal Content
- Support all slide appearances
1 parent 38196b7 commit c6d6438

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

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

Lines changed: 9 additions & 7 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/slide/collage-centered/preview.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
attr="data.content.attributes"
2323
ko-style="data.content.style"
2424
css="data.content.css"
25-
event="mousedown: stopEvent"
26-
afterRender="initWysiwyg">
25+
event="mousedown: stopEvent, click: activateEditor"
26+
contenteditable="true"
27+
afterRender="afterRenderWysiwyg">
2728
<div html="data.content.html"></div>
2829
</div>
2930
<div if="!data.content.html() && isWysiwygSupported()"

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/slide/collage-left/preview.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
attr="data.content.attributes"
2525
ko-style="data.content.style"
2626
css="data.content.css"
27-
event="mousedown: stopEvent"
28-
afterRender="initWysiwyg">
27+
event="mousedown: stopEvent, click: activateEditor"
28+
contenteditable="true"
29+
afterRender="afterRenderWysiwyg">
2930
<div html="data.content.html"></div>
3031
</div>
3132
<div if="!data.content.html() && isWysiwygSupported()"

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/slide/collage-right/preview.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
attr="data.content.attributes"
2323
ko-style="data.content.style"
2424
css="data.content.css"
25-
event="mousedown: stopEvent"
26-
afterRender="initWysiwyg">
25+
event="mousedown: stopEvent, click: activateEditor"
26+
contenteditable="true"
27+
afterRender="afterRenderWysiwyg">
2728
<div html="data.content.html"></div>
2829
</div>
2930
<div if="!data.content.html() && isWysiwygSupported()"

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,14 @@ export default class Preview extends BasePreview {
401401
* @returns {HTMLElement}
402402
*/
403403
private findTextNode(element: HTMLElement, text: string): HTMLElement {
404-
const textSearch = $(element).find(":contains(\"" + text.trim() + "\")");
405-
if (textSearch.length > 0) {
406-
// Search for the #text node within the element for the new range
407-
return textSearch.last().contents().filter(function() {
408-
return this.nodeType === Node.TEXT_NODE && text === this.nodeValue;
409-
})[0];
404+
if (text && text.trim().length > 0) {
405+
const textSearch = $(element).find(":contains(\"" + text.trim() + "\")");
406+
if (textSearch.length > 0) {
407+
// Search for the #text node within the element for the new range
408+
return textSearch.last().contents().filter(function() {
409+
return this.nodeType === Node.TEXT_NODE && text === this.nodeValue;
410+
})[0];
411+
}
410412
}
411413
}
412414
}

0 commit comments

Comments
 (0)