Issue Bug Closed

#99077TYPO3 11.5.18 regression: Commit 551f540fc3 caused link browser changes to no longer be saved

Leonie Philine 11/14/22, 03:52 updated 12/06/22, 21:41

Description

Change introducing the regression: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76404

Steps to reproduce:
- Set an RTE link to a page
- Save
- Use the RTE link browser to make the link point to a different page
- Save
- Verify the link was not changed

Expected:
- Link is expected to be set to the newly selected page

Actual result:
- Link still points to the previously linked page. -> Changing the link’s target page with the link browser is no longer possible since https://github.com/typo3/typo3/commit/551f540fc3 .

What is happening:
- this.CKEditor.extractSelectedHtml(true) extracts the old link, including the <a> tag, where it was intended to extract only its contents.
- The entire old link (instead of only its contents) is inserted as innerHTML into the new link: linkElement.setHtml(originalLinkText);
- This results in two nested links, e.g. <a href="t3://page?uid=2"><a data-cke-saved-href="t3://page?uid=1" href="t3://page?uid=1">Link text</a></a>, where pid 2 is the newly selected page, and pid 1 is the original link. See attached image before-save.png.
- The result is saved and cleaned – only the old <a data-cke-saved-href="t3://page?uid=1" href="t3://page?uid=1">Link text</a> remains after saving. See attached image after-save.png.

Downgrading from TYPO3 11.5.18 to TYPO3 11.5.17 makes it work again.

Note that there is no error message of any kind, so users will save their work and move on – unaware that the link target pages were not actually changed!

Reviews 1