Skip to content

Commit 8e03f94

Browse files
committed
MAGETWO-92405: Pagebuilder - Uncaught Jquery error on Drag and Drop on second load of Product Description
- Validate sortable is enabled before attempting to set option
1 parent bc3ca0c commit 8e03f94

File tree

2 files changed

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

2 files changed

+17
-5
lines changed

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

Lines changed: 10 additions & 3 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/column-group/preview.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,14 +684,17 @@ export default class Preview extends PreviewCollection {
684684
* @param {GroupPositionCache} groupPosition
685685
*/
686686
private onDroppingMouseMove(event: JQuery.Event, group: JQuery<HTMLElement>, groupPosition: GroupPositionCache) {
687+
const elementChildrenParent = group.parents(".element-children");
687688
// Only initiate this process if we're within the group by a buffer to allow for sortable to function correctly
688689
if (
689690
this.dropOverElement &&
690691
event.pageY > groupPosition.top + 20 &&
691692
event.pageY < (groupPosition.top + groupPosition.outerHeight) - 20
692693
) {
693694
// Disable the parent sortable instance
694-
group.parents(".element-children").sortable("option", "disabled", true);
695+
if (elementChildrenParent.data("sortable")) {
696+
elementChildrenParent.sortable("option", "disabled", true);
697+
}
695698

696699
const currentX = event.pageX - groupPosition.left;
697700
this.dropPosition = this.dropPositions.find((position) => {
@@ -708,7 +711,9 @@ export default class Preview extends PreviewCollection {
708711
}
709712
} else if (this.dropOverElement) {
710713
// Re-enable the parent sortable instance
711-
group.parents(".element-children").sortable("option", "disabled", false);
714+
if (elementChildrenParent.data("sortable")) {
715+
elementChildrenParent.sortable("option", "disabled", false);
716+
}
712717
this.dropPosition = null;
713718
this.dropPlaceholder.removeClass("left right");
714719
}

0 commit comments

Comments
 (0)