[TASK] Simplify RTEhtmlarea javascript inclusion 51/49551/3
authorBenni Mack <benni@typo3.org>
Tue, 23 Aug 2016 09:50:58 +0000 (11:50 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Tue, 23 Aug 2016 12:23:40 +0000 (14:23 +0200)
Since the removal of ExtJS within the RTE,
the JavaScript can be simplified.

Resolves: #77600
Releases: master
Change-Id: I7188476664e5e4d0028b0bc47c0c71c915d26e17
Reviewed-on: https://review.typo3.org/49551
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Form/FormResultCompiler.php
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/NameSpace/NameSpace.js [deleted file]

index 59cbd4f..75de9b5 100644 (file)
@@ -234,12 +234,6 @@ class FormResultCompiler
         // Load tree stuff here
         $pageRenderer->addInlineLanguageLabelFile('EXT:lang/locallang_csh_corebe.xlf', 'tcatree');
         $pageRenderer->addJsFile($backendRelPath . 'Resources/Public/JavaScript/notifications.js');
-        if (ExtensionManagementUtility::isLoaded('rtehtmlarea')) {
-            // This js addition is hackish ... it will always load this file even if not RTE
-            // is added here. But this simplifies RTE initialization a lot and is thus kept for now.
-            $pageRenderer->addJsFile(ExtensionManagementUtility::extRelPath('rtehtmlarea') . 'Resources/Public/JavaScript/HTMLArea/NameSpace/NameSpace.js');
-        }
-
         $beUserAuth = $this->getBackendUserAuthentication();
 
         // define the window size of the element browser etc.
index abae565..2aff7c1 100644 (file)
@@ -643,11 +643,12 @@ class RichTextElement extends AbstractFormElement
         $backendUser = $this->getBackendUserAuthentication();
 
         $jsArray = array();
+        $jsArray[] = 'var HTMLArea = HTMLArea || {};';
         $jsArray[] = 'if (typeof configureEditorInstance === "undefined") {';
         $jsArray[] = ' configureEditorInstance = new Object();';
         $jsArray[] = '}';
         $jsArray[] = 'configureEditorInstance[' . GeneralUtility::quoteJSvalue($this->domIdentifier) . '] = function() {';
-        $jsArray[] = 'if (typeof RTEarea === "undefined" || typeof HTMLArea === "undefined") {';
+        $jsArray[] = 'if (typeof RTEarea === "undefined") {';
         $jsArray[] = ' window.setTimeout("configureEditorInstance[' . GeneralUtility::quoteJSvalue($this->domIdentifier) . ']();", 40);';
         $jsArray[] = '} else {';
         $jsArray[] = 'editornumber = ' . GeneralUtility::quoteJSvalue($this->domIdentifier) . ';';
@@ -993,11 +994,7 @@ class RichTextElement extends AbstractFormElement
                 $labelArray[$pluginId] = $newLabels;
             }
         }
-        $javaScriptString = 'TYPO3.jQuery(function() {';
-        $javaScriptString .= 'HTMLArea.I18N = new Object();' . LF;
-        $javaScriptString .= 'HTMLArea.I18N = ' . json_encode($labelArray);
-        $javaScriptString .= '});';
-        $this->resultArray['additionalJavaScriptPost'][] = $javaScriptString;
+        $this->resultArray['additionalJavaScriptPost'][] = 'HTMLArea.I18N = ' . json_encode($labelArray);
     }
 
     /**
diff --git a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/NameSpace/NameSpace.js b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/NameSpace/NameSpace.js
deleted file mode 100644 (file)
index a8a7b8e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Establish namespace
- */
-var HTMLArea = HTMLArea || {};
-HTMLArea.jQuery = TYPO3.jQuery;
-HTMLArea.CSS = {};