Skip to content

Commit

Permalink
[BUGFIX] Preserve allowedClasses (non classesAnchor) in link-browser
Browse files Browse the repository at this point in the history
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/+/81212
Tested-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
  • Loading branch information
bnf committed Sep 25, 2023
1 parent afd8d91 commit 75c1777
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -167,8 +167,10 @@ protected function renderLinkAttributeFields(ViewInterface $view): string
} 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']);
}
Expand Down

0 comments on commit 75c1777

Please sign in to comment.