Skip to content

Commit

Permalink
Fix TinyMCE edit link when link contains html
Browse files Browse the repository at this point in the history
  • Loading branch information
satrun77 committed Aug 20, 2024
1 parent e9f6b53 commit 1f2d69e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion client/src/legacy/TinyMCE_sslink.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ const plugin = {

// Callback for opening the edit link dialog form
function openLinkDialog() {
const node = tinymce.activeEditor.selection.getNode();
// Find "a" node, issue https://github.com/silverstripe/silverstripe-cms/issues/2439
let node = tinymce.activeEditor.selection.getNode();
if (node.nodeName !== 'A') {
let count = 0;
while (count < 10 && node.parentNode && node.nodeName !== 'A') {
node = node.parentNode;
count += 1;
}
}

const href = node.getAttribute('href');

if (href) {
Expand Down

0 comments on commit 1f2d69e

Please sign in to comment.