[BUGFIX] Streamline backend module menu and viewport initialization 27/57527/2
authorOliver Hader <oliver@typo3.org>
Tue, 10 Jul 2018 10:46:31 +0000 (12:46 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 18 Jul 2018 18:42:57 +0000 (20:42 +0200)
ModuleMenu and Viewport initialization need to be defered to ensure
that DOM is available in order to apply further behavior in mentioned
client implementation. Besides that, property 'iframe' is extended by
a JavaScript getter - otherwise directly assigning another property of
an undefined object will fail.

Resolves: #80312
Releases: master, 8.7
Change-Id: I9581a7f2164050f73683928b8f2ebe1d69a6d5e7
Reviewed-on: https://review.typo3.org/57527
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js
typo3/sysext/backend/Resources/Public/JavaScript/Viewport.js

index d6326db..c7c4365 100644 (file)
@@ -355,7 +355,7 @@ require(
 
     };
     // start the module menu app
-    TYPO3.ModuleMenu.App.initialize();
+    $(document).ready(function() { TYPO3.ModuleMenu.App.initialize(); });
     return TYPO3.ModuleMenu;
   }
 );
index 578ab57..f486028 100644 (file)
@@ -124,7 +124,9 @@ define(
       ContentContainer: {
         // @deprecated since TYPO3 v8, will be removed in v9.
         // Use top.TYPO3.Backend.ContentContainer.get() instead of top.TYPO3.Backend.ContentContainer.iframe
-        'iframe': $('.t3js-scaffold-content-module-iframe')[0].contentWindow,
+        get 'iframe'() {
+          return ContentContainer.get();
+        },
         get: function() {
           return $('.t3js-scaffold-content-module-iframe')[0].contentWindow;
         },
@@ -168,7 +170,7 @@ define(
     };
 
     // start the module menu app
-    TYPO3.Backend.initialize();
+    $(document).ready(function() { TYPO3.Backend.initialize(); });
     return TYPO3.Backend;
   }
 );