[BUGFIX] Fix JS errors in page module 94/34194/2
authorBenjamin Mack <benni@typo3.org>
Sat, 15 Nov 2014 09:33:44 +0000 (10:33 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 15 Nov 2014 09:54:44 +0000 (10:54 +0100)
Due to the introduction of the fontawesome
icons drag&drop was not possible anymore
with ExtJS throwing errors in the page module
when starting to drag.

The intermediate fix is to make sure that
no errors are thrown in page module.

The correct fix is to define proper CSS
classes to address the elements,
but not via icon classes.

Releases: master
Resolves: #62969
Change-Id: I67b86f2b38054093b8755d6f9f65d868b3ccff76
Reviewed-on: http://review.typo3.org/34194
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/cms/layout/js/typo3pageModule.js

index a8bdfd4..c9229ea 100644 (file)
@@ -37,9 +37,14 @@ TYPO3.Components.PageModule = {
                                this.el.addClass('active-drag');
 
                                // Add css class for the drag shadow
-                               this.el.child('.t3-page-ce-dragitem').addClass('dragitem-shadow');
+                               if (this.el.child('.t3-icon-ce-dragitem')) {
+                                       this.el.child('.t3-page-ce-dragitem').addClass('dragitem-shadow');
+                               }
+
                                // Hide create new element button
-                               this.el.child('.t3-icon-document-new').addClass('drag-start');
+                               if (this.el.child('.t3-icon-document-new')) {
+                                       this.el.child('.t3-icon-document-new').addClass('drag-start');
+                               }
 
                                // Cache the original XY Coordinates of the element, we'll use this later.
                                this.originalXY = this.el.getXY();
@@ -94,9 +99,13 @@ TYPO3.Components.PageModule = {
                                // Remove css class to define inactive state
                                this.el.removeClass('active-drag');
                                // Remove dragitem-shadow after dragging
-                               this.el.child('.t3-page-ce-dragitem').removeClass('dragitem-shadow');
+                               if (this.el.child('.t3-page-ce-dragitem')) {
+                                       this.el.child('.t3-page-ce-dragitem').removeClass('dragitem-shadow');
+                               }
                                // Show create new element button again
-                               this.el.child('.t3-icon-document-new').removeClass('drag-start');
+                               if (this.el.child('.t3-icon-document-new')) {
+                                       this.el.child('.t3-icon-document-new').removeClass('drag-start');
+                               }
                        },
 
                        // Called upon successful drop of an element on a DDTarget with the same