diff --git a/src/Hyperlink.js b/src/Hyperlink.js index a8d4142..7411d2e 100644 --- a/src/Hyperlink.js +++ b/src/Hyperlink.js @@ -315,10 +315,11 @@ export default class Hyperlink { let anchorTag = this.selection.findParentTag('A'); if (anchorTag) { this.selection.expandToTag(anchorTag); - }else{ - document.execCommand(this.commandLink, false, link); - anchorTag = this.selection.findParentTag('A'); } + + document.execCommand(this.commandLink, false, link) + anchorTag = this.selection.findParentTag(`A`) + if(anchorTag) { if(!!target) { anchorTag['target'] = target;