Skip to content

Commit 5be7853

Browse files
committed
MC-4217: Performance of show/hide Slider on stage is very slow
- Ensure element is present before trying to init WYSIWYG - Ensure selection is present before attempting to restore
1 parent 8fb532e commit 5be7853

File tree

2 files changed

+4
-4
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 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/ts/js/content-type/slide/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export default class Preview extends BasePreview {
159159
element.focus();
160160
};
161161

162-
if (!this.wysiwyg) {
162+
if (this.element && !this.wysiwyg) {
163163
const selection = this.saveSelection();
164164
this.element.removeAttribute("contenteditable");
165165
_.defer(() => {
@@ -375,7 +375,7 @@ export default class Preview extends BasePreview {
375375
* @param {Selection} selection
376376
*/
377377
private restoreSelection(element: HTMLElement, selection: Selection) {
378-
if (window.getSelection) {
378+
if (selection && window.getSelection) {
379379
// Find the original container that had the selection
380380
const startContainerParent = $(element).find("[data-startContainer]");
381381
startContainerParent.removeAttr("data-startContainer");

0 commit comments

Comments
 (0)