Skip to content

Commit 3b76a73

Browse files
PB-166: Page Builder doesn't implement destroy method
1 parent b236e3e commit 3b76a73

File tree

7 files changed

+33
-7
lines changed

7 files changed

+33
-7
lines changed

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

Lines changed: 1 addition & 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/content-type/row/preview.js

Lines changed: 3 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/form/element/wysiwyg.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ define([
209209
this.transition(true);
210210
}.bind(this));
211211
}.bind(this));
212+
},
213+
214+
/** @inheritdoc */
215+
destroy: function () {
216+
this._super();
217+
this.pageBuilder.destroy();
212218
}
213219
});
214220
});

app/code/Magento/PageBuilder/view/adminhtml/web/js/page-builder.js

Lines changed: 9 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/ts/js/content-type.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export default class ContentType<P extends Preview = Preview, M extends Master =
4747
public destroy(): void {
4848
const params = {
4949
contentType: this,
50-
index: (this.parentContentType as ContentTypeCollectionInterface)
51-
.getChildren()
52-
.indexOf(this),
50+
index: this.parentContentType ?
51+
(this.parentContentType as ContentTypeCollectionInterface).getChildren().indexOf(this) :
52+
null,
5353
parentContentType: this.parentContentType,
5454
stageId: this.stageId,
5555
};

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export default class Preview extends PreviewCollection {
151151
*/
152152
public destroy(): void {
153153
super.destroy();
154-
jarallax(this.element, "destroy");
154+
155+
if (this.element) {
156+
jarallax(this.element, "destroy");
157+
}
155158
}
156159
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/page-builder.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ export default class PageBuilder implements PageBuilderInterface {
5252
this.initListeners();
5353
}
5454

55+
/**
56+
* Destroy rootContainer instance.
57+
*/
58+
public destroy() {
59+
this.stage.rootContainer.destroy();
60+
}
61+
5562
/**
5663
* Init listeners.
5764
*/

0 commit comments

Comments
 (0)