e.preventDefault();
}
+ // used to determine if selection needs to be restored later as
+ // Safari sometimes discards the selection when setting markers
+ var hasSelectedText = this.selection.is();
+
this.selection.save();
// close tooltip
// WoltLab END
// build link
+ if (hasSelectedText) this.selection.restore();
+
var link = this.link.buildLinkFromElement($el);
+ if (hasSelectedText) this.selection.save();
+
// if link cut & paste inside editor browser added self host to a link
link.url = this.link.removeSelfHostFromUrl(link.url);