Skip to content

Commit c1db3f6

Browse files
authored
Merge pull request #283 from magento-obsessive-owls/MC-19192
MC-19192: Backport Page Builder TinyMCE Performance Fix
2 parents d1d4a49 + 7075101 commit c1db3f6

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

app/code/Magento/PageBuilder/view/adminhtml/templates/stage/render.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'map': {
2020
'*': {
2121
'text': 'Magento_PageBuilder/js/master-format/render/requirejs/text',
22+
'Magento_PageBuilder/js/events': 'Magento_PageBuilder/js/master-format/render/events',
2223
}
2324
},
2425
});

app/code/Magento/PageBuilder/view/adminhtml/web/js/master-format/render/events.js

Lines changed: 24 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/js/wysiwyg/tinymce4.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/**
7+
* The frame does not need to create or observe events, however the app will naturally attempt to. So let's stop that!
8+
*/
9+
export default {
10+
on() {
11+
return this;
12+
},
13+
off() {
14+
return this;
15+
},
16+
trigger() {
17+
return this;
18+
},
19+
};

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/wysiwyg/tinymce4.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ export default class Wysiwyg implements WysiwygInterface {
5555
*/
5656
private fieldName: string;
5757

58+
/**
59+
* Create a debounce to save the content into the data store
60+
*/
61+
private saveContentDebounce = _.debounce(
62+
this.saveContentFromWysiwygToDataStore.bind(this),
63+
500,
64+
);
65+
5866
/**
5967
* @param {String} contentTypeId The ID in the registry of the content type.
6068
* @param {String} elementId The ID of the editor element in the DOM.
@@ -148,8 +156,7 @@ export default class Wysiwyg implements WysiwygInterface {
148156
* Called for the onChangeContent event
149157
*/
150158
private onChangeContent() {
151-
const saveContent = _.debounce(this.saveContentFromWysiwygToDataStore.bind(this), 100);
152-
saveContent();
159+
this.saveContentDebounce();
153160
this.invertInlineEditorToAccommodateOffscreenToolbar();
154161
}
155162

0 commit comments

Comments
 (0)