Browse Source

added unlink functionality in RTE

pull/1437/head
tabaliov 8 years ago
parent
commit
9861a4c0d5
  1. 10
      src/rich_text_editor/model/RichTextEditor.js

10
src/rich_text_editor/model/RichTextEditor.js

@ -37,8 +37,14 @@ const defActions = {
style: 'font-size:1.4rem;padding:0 4px 2px;', style: 'font-size:1.4rem;padding:0 4px 2px;',
title: 'Link' title: 'Link'
}, },
result: rte => result: rte => {
rte.insertHTML(`<a class="link" href="">${rte.selection()}</a>`) const nextSibling = rte.selection().anchorNode.nextSibling;
if (nextSibling && nextSibling.nodeName == 'A') {
rte.exec('unlink');
} else {
rte.insertHTML(`<a class="link" href="">${rte.selection()}</a>`);
}
}
} }
}; };

Loading…
Cancel
Save