Issue Bug Closed

#86240rte link wizard selected class is not set if multiple classes

Marco von Arx 09/13/18, 10:33 updated 04/23/19, 23:19

Description

If in the ckeditor configuration file a class is added to the selectbox in the “link browser”, which contains more than one class, it will not be automatically selected in the “link browser”.
Screenshots: Steps to reproduce:
  1. Add the following lines to the ckeditor configuration file:
    buttons:
    link:
    properties:
    class:
    allowedClasses:
    – ‘btn btn-braun’
    – ‘btn btn-weiss’
    – ‘btn btn-phone’
    – ‘btn btn-mail’
  2. Open Typo3-Backend and create a new link in a content element.
  3. Select one of the classes in the “Link-Browser” and save.
  4. Open the link browser again and the previous selected class will not be automatically selected.

after some searching I identified the possible cause in file

 TYPO3\CMS\RteCKEditor\Controller\BrowseLinksController
 line 185ff

 // Only keep last class value (others are automatically added again by required option)
 // https://review.typo3.org/#/c/29643
 $currentClasses = GeneralUtility::trimExplode(' ', $this->currentLinkParts['class'], true);
 if (count($currentClasses) > 1) {
     $this->currentLinkParts['class'] = end($currentClasses);
 } 

if we remove this line the select box is set to right value

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.