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 370907b commit e59b45d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/src/legacy/TinyMCE_sslink-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,17 @@ jQuery.entwine('ss', ($) => {

getOriginalAttributes() {
const editor = this.getElement().getEditor();
const node = $(editor.getSelectedNode());

// Find "a" node, issue https://github.com/silverstripe/silverstripe-cms/issues/2439
let linkNode = editor.getSelectedNode();
if (linkNode.nodeName !== 'A') {
let count = 0;
while (count < 10 && linkNode.parentNode && linkNode.nodeName !== 'A') {
linkNode = linkNode.parentNode;
count +=1;
}
}
const node = $(linkNode);

// Get href
const hrefParts = (node.attr('href') || '').split('#');
Expand Down

0 comments on commit e59b45d

Please sign in to comment.