From 7c22b96604de74c3f3a845ffb266558568c1c93b Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 7 Jan 2015 13:36:12 +0100 Subject: [PATCH] [FIX] summernote lib: When we edit a text in a existing link (with the modal) a link is created into the previous link --- .../website/static/lib/summernote/src/js/editing/Editor.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/website/static/lib/summernote/src/js/editing/Editor.js b/addons/website/static/lib/summernote/src/js/editing/Editor.js index 31674a8035a..8db8bd31a4b 100644 --- a/addons/website/static/lib/summernote/src/js/editing/Editor.js +++ b/addons/website/static/lib/summernote/src/js/editing/Editor.js @@ -334,10 +334,13 @@ define([ } rng = rng.deleteContents(); + var anchor = dom.ancestor(rng.sc, dom.isAnchor); // Create a new link when there is no anchor on range. - var anchor = rng.insertNode($('' + linkText + '')[0], true); - $(anchor).attr({ + if (!anchor) { + anchor = rng.insertNode($('' + linkText + '')[0], true); + } + $(anchor).html(linkText).attr({ 'href': linkUrl, 'target': isNewWindow ? '_blank' : null, 'class': className