[FIX] web_editor: fix icon link edition

X-original-commit: 8bb7610e8893cad692cf9ad2f5a89a503a6175ef
This commit is contained in:
Sébastien Geelen (sge)
2021-04-30 08:06:31 +00:00
parent d08db821bc
commit d54959bd9d
@@ -177,10 +177,10 @@ const Link = Widget.extend({
*/
getOrCreateLink: function (editable) {
const doc = editable.ownerDocument;
const range = getDeepRange(editable, {splitText: true, select: true, correctTripleClick: true});
this.needLabel = this.needLabel || false;
let link = getInSelection(doc, 'a');
const $link = $(link);
const range = getDeepRange(editable, {splitText: true, select: true, correctTripleClick: true});
if (link && (!$link.has(range.startContainer).length || !$link.has(range.endContainer).length)) {
// Expand the current link to include the whole selection.
let before = link.previousSibling;