[FIX] summernote lib: When we edit a text in a existing link (with the modal) a link is created into the previous link

This commit is contained in:
Christophe Matthieu
2015-01-08 11:01:43 +01:00
parent fdeff171cd
commit 7c22b96604
@@ -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($('<A>' + linkText + '</A>')[0], true);
$(anchor).attr({
if (!anchor) {
anchor = rng.insertNode($('<A>' + linkText + '</A>')[0], true);
}
$(anchor).html(linkText).attr({
'href': linkUrl,
'target': isNewWindow ? '_blank' : null,
'class': className