[BUGFIX] Keep update button in linkbrowser for RTE CKEditor on edit 37/58737/3
authorJoerg Kummer <typo3@enobe.de>
Sat, 27 Oct 2018 18:21:42 +0000 (20:21 +0200)
committerBenni Mack <benni@typo3.org>
Sun, 28 Oct 2018 12:50:30 +0000 (13:50 +0100)
This patch moves the current value of the link into the parameter array
for the linkbrowser to keep the value in all linked actions inside the
linkbrowser for the RTE CKEditor.

This keeps the update button in the page linkhandler,
if an existing page link will be edited.

Resolves: #83545
Releases: master, 8.7
Change-Id: Ia9217057e45a5d94668bb5ac2f111198da9a69d1
Reviewed-on: https://review.typo3.org/58737
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php
typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Plugins/typo3link.js

index 2326368..c2155d1 100644 (file)
@@ -131,7 +131,7 @@ class BrowseLinksController extends AbstractLinkBrowserController
 
         $this->siteUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
 
-        $this->currentLinkParts = $queryParameters['curUrl'] ?? [];
+        $this->currentLinkParts = $queryParameters['P']['curUrl'] ?? [];
         $this->editorId = $queryParameters['editorId'];
         $this->contentsLanguage = $queryParameters['contentsLanguage'];
         $this->RTEtsConfigParams = $queryParameters['RTEtsConfigParams'] ?? null;
@@ -561,9 +561,9 @@ class BrowseLinksController extends AbstractLinkBrowserController
     {
         return [
             'act' => $overrides['act'] ?? $this->displayedLinkHandlerId,
+            'P' => $overrides['P'] ?? $this->parameters,
             'editorId' => $this->editorId,
-            'contentsLanguage' => $this->contentsLanguage,
-            'P' => $this->parameters
+            'contentsLanguage' => $this->contentsLanguage
         ];
     }
 }
index 5cfa2e4..bd29c8b 100644 (file)
       element = CKEDITOR.plugins.link.getSelectedLink(editor);
     }
     if (element) {
-      additionalParameters = '&curUrl[url]=' + encodeURIComponent(element.getAttribute('href'));
+      additionalParameters = '&P[curUrl][url]=' + encodeURIComponent(element.getAttribute('href'));
       var i = 0,
         attributeNames = ["target", "class", "title", "rel"];
       for (i = 0; i < attributeNames.length; ++i) {
         if (element.getAttribute(attributeNames[i])) {
-          additionalParameters += '&curUrl[' + attributeNames[i] + ']=';
+          additionalParameters += '&P[curUrl][' + attributeNames[i] + ']=';
           additionalParameters += encodeURIComponent(element.getAttribute(attributeNames[i]));
         }
       }
@@ -71,7 +71,7 @@
       var additionalAttributes = getAdditionalAttributes(editor);
       for (i = additionalAttributes.length; --i >= 0;) {
         if (element.hasAttribute(additionalAttributes[i])) {
-          additionalParameters += '&curUrl[' + additionalAttributes[i] + ']=';
+          additionalParameters += '&P[curUrl][' + additionalAttributes[i] + ']=';
           additionalParameters += encodeURIComponent(element.getAttribute(additionalAttributes[i]));
         }
       }