fix: correct regex for identifying end of tag in insertTag function

This commit is contained in:
newtextdoc1111
2025-05-04 23:34:26 +09:00
parent 078cd123e4
commit 6bb3acc825
+1 -1
View File
@@ -655,7 +655,7 @@ function insertTag(inputElement, tagToInsert) {
// Find the end of the word/tag at the cursor position, stopping at comma, newline, or end of string.
// Match non-whitespace, non-comma, non-newline characters.
const currentWordEndMatch = text.substring(cursorPos).match(/^([^\s,\n]*)/);
const currentWordEndMatch = text.substring(cursorPos).match(/^([^\s]*[,\n]{1})/);
// currentWordEnd is the position *after* the matched word part.
// const currentWordEnd = currentWordEndMatch ? cursorPos + currentWordEndMatch[1].length : cursorPos;
let currentWordEnd = cursorPos;