[BUGFIX] EXT:form - fix page drag & drop 55/53955/2
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 7 Sep 2017 13:29:54 +0000 (15:29 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 7 Sep 2017 15:50:26 +0000 (17:50 +0200)
Fix JavaScript errors on page drag & drop within the form editor

Resolves: #82337
Releases: master, 8.7
Change-Id: I6e67b05a68273f1ad2d6f851ed5dfa4781d7d5bb
Reviewed-on: https://review.typo3.org/53955
Reviewed-by: Daniel Lorenz <daniel.lorenz@extco.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/TreeComponent.js

index 03a4512..1d58a73 100644 (file)
@@ -317,6 +317,10 @@ define(['jquery',
                 isAllowed: function (placeholder, placeholderParent, currentItem) {
                     var formElementIdentifierPath, formElementTypeDefinition, targetFormElementIdentifierPath, targetFormElementTypeDefinition;
 
+                    if (typeof placeholderParent === 'undefined') {
+                        return true;
+                    }
+
                     formElementIdentifierPath = getTreeNodeIdentifierPathWithinDomElement($(currentItem));
                     targetFormElementIdentifierPath = getTreeNodeIdentifierPathWithinDomElement($(placeholderParent));
 
@@ -324,6 +328,13 @@ define(['jquery',
                     targetFormElementTypeDefinition = getFormElementDefinition(targetFormElementIdentifierPath);
 
                     if (
+                        targetFormElementTypeDefinition['_isTopLevelFormElement']
+                        && !targetFormElementTypeDefinition['_isCompositeFormElement']
+                    ) {
+                        return false;
+                    }
+
+                    if (
                         formElementTypeDefinition['_isGridContainerFormElement']
                         && (
                             getFormEditorApp().findEnclosingGridContainerFormElement(targetFormElementIdentifierPath)