silverstripe / silverstripe-cms

Silverstripe CMS - this is a module for Silverstripe Framework rather than a standalone app. Use https://github.com/silverstripe/silverstripe-installer/ to set this up.
http://silverstripe.org/
BSD 3-Clause "New" or "Revised" License
516 stars 333 forks source link

Fix TinyMCE edit link when link contains html #2993

Closed satrun77 closed 3 months ago

satrun77 commented 3 months ago

Description

If you have a link in tinymce like <a href=""><span>Title</span></a>, then you can edit the link. The HTML inside the link tag can be any tag.

The issue is that the selected node is the inside HTML tag instead of the link tag.

I'm not 100% keen on the solution using while but this is legacy code, so might be ok! Alternative code is welcomed :)

This PR is needed for https://github.com/silverstripe/silverstripe-admin/pull/1814

Manual testing steps

  1. Install fresh CMS
  2. Edit a page
  3. Add a link (internal or external)
  4. Edit HTML code in TinyMCE, add any HTML tags inside the link
  5. Close the HTML code view in TInyMCE
  6. Try to edit the link, it won't show the popup form.

Issues

Pull request checklist

satrun77 commented 3 months ago

No longer needed! The fix in https://github.com/silverstripe/silverstripe-admin/pull/1814 fixes the issue