From 902133c0ef1ead493cbcab528af53991af9128c0 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <ben@bnf.dev> Date: Fri, 22 Sep 2023 09:22:18 +0200 Subject: [PATCH] [BUGFIX] Preserve allowedClasses (non classesAnchor) in link-browser RTE link classes that are configured via `buttons.link.properties.class.allowedClasses` are selectable in all link types in the link browser. Specific classes can be limited to specific link types with a separate configuration option `classesAnchor.{id}.type|class`. When such limits are active, classes that are *not* configured to associated/limited to a specfic type, remain listed and available for *all* link types. When an existing link with such type of globally allowed class is opened its value was cleared because it was not defined in the set of limits. This was an inconsistency as the link class was still selectable, but the selection was removed upon reoping such link. Such values are now preserved. Resolves: #102005 Releases: main, 12.4, 11.5 Change-Id: I0ad4273819f1d5a8e06f587b94fefb4598a07c13 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81168 Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Benjamin Franzke <ben@bnf.dev> Tested-by: Benjamin Kott <benjamin.kott@outlook.com> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by: Benjamin Franzke <ben@bnf.dev> --- .../Classes/Controller/BrowseLinksController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php index b02feb4d449d..df8e9b3c842b 100644 --- a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php +++ b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php @@ -167,8 +167,10 @@ class BrowseLinksController extends AbstractLinkBrowserController } else { unset($this->linkAttributeValues['class']); } - if (isset($classesAnchor[$this->displayedLinkHandlerId]) - && !in_array($linkClass, $classesAnchor[$this->displayedLinkHandlerId], true) + if ( + in_array($linkClass, $classesAnchor['all']) && + isset($classesAnchor[$this->displayedLinkHandlerId]) && + !in_array($linkClass, $classesAnchor[$this->displayedLinkHandlerId], true) ) { unset($this->linkAttributeValues['class']); } -- GitLab