return;
}
- const cursorPoint = selectionRange[0].offset - 1;
+ const cursorPoint = selectionRange[0].offset;
const nodeText = node.getTextContent();
const rTrimText = nodeText.slice(0, cursorPoint);
const priorSpaceIndex = rTrimText.lastIndexOf(' ');
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);