]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/services/auto-links.ts
ZIP Imports: Added API examples, finished testing
[bookstack] / resources / js / wysiwyg / services / auto-links.ts
index 1c3b1c73010c750f121ca0e81c05ce6c9965d198..62cd459940c0471f03c985a7c3276a4cec1b79e0 100644 (file)
@@ -43,7 +43,7 @@ function handlePotentialLinkEvent(node: TextNode, selection: BaseSelection, edit
         linkNode.append(new TextNode(textSegment));
 
         const splits = node.splitText(startIndex, cursorPoint);
-        const targetIndex = splits.length === 3 ? 1 : 0;
+        const targetIndex = startIndex > 0 ? 1 : 0;
         const targetText = splits[targetIndex];
         if (targetText) {
             targetText.replace(linkNode);