diff --git a/src/rich_text_editor/model/RichTextEditor.js b/src/rich_text_editor/model/RichTextEditor.js index c87738f40..d8d1a74da 100644 --- a/src/rich_text_editor/model/RichTextEditor.js +++ b/src/rich_text_editor/model/RichTextEditor.js @@ -37,8 +37,14 @@ const defActions = { style: 'font-size:1.4rem;padding:0 4px 2px;', title: 'Link' }, - result: rte => - rte.insertHTML(`${rte.selection()}`) + result: rte => { + const nextSibling = rte.selection().anchorNode.nextSibling; + if (nextSibling && nextSibling.nodeName == 'A') { + rte.exec('unlink'); + } else { + rte.insertHTML(`${rte.selection()}`); + } + } } };