[BUGFIX] RTE LinkHandler handle required classes 72/45172/3
authorAndreas Allacher <andreas@allacher.com>
Mon, 7 Dec 2015 17:22:46 +0000 (18:22 +0100)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Fri, 11 Dec 2015 22:05:25 +0000 (23:05 +0100)
RTE LinkHandler now also handles
RTE.classes.<class>.requires correctly.

Change-Id: I8f50018f522dd9f0b885af7192c003f7fda325b7
Resolves: #71985
Releases: master
Reviewed-on: https://review.typo3.org/45172
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Link.js

index 9c8869f..ac3166a 100644 (file)
@@ -215,6 +215,14 @@ class BrowseLinksController extends AbstractLinkBrowserController
             return;
         }
 
+        if (!empty($this->currentLinkParts['class'])) {
+            // remove required classes
+            $currentClasses = GeneralUtility::trimExplode(' ', $this->currentLinkParts['class'], true);
+            if (count($currentClasses) > 1) {
+                $this->currentLinkParts['class'] = end($currentClasses);
+            }
+        }
+
         if (empty($this->currentLinkParts['data-htmlarea-external'])) {
             // strip siteUrl prefix except for external and mail links
             if (strpos($this->currentLinkParts['url'], 'mailto:') === false) {
index 7e1f4e8..54a9690 100644 (file)
@@ -321,14 +321,13 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/Plugin/Plugin',
                                        }
                                        if (cur_target.trim()) node.target = cur_target.trim();
                                                else node.removeAttribute('target');
-                                       if (cur_class.trim()) {
-                                               node.className = cur_class.trim();
+                                       if (!UserAgent.isOpera) {
+                                               node.removeAttribute('class');
                                        } else {
-                                               if (!UserAgent.isOpera) {
-                                                       node.removeAttribute('class');
-                                               } else {
-                                                       node.className = '';
-                                               }
+                                               node.className = '';
+                                       }
+                                       if (cur_class.trim()) {
+                                               Dom.addClass(node, cur_class.trim());
                                        }
                                        if (cur_title.trim()) {
                                                node.title = cur_title.trim();