From 1eaab8a88c3038eebd5f4116acd994d64560d683 Mon Sep 17 00:00:00 2001 From: newtextdoc1111 Date: Sat, 10 May 2025 03:59:17 +0900 Subject: [PATCH] refactor: Remove redundant tag existence check in insertTagToTextArea function --- web/js/autocomplete.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/web/js/autocomplete.js b/web/js/autocomplete.js index 28e098b..606b737 100644 --- a/web/js/autocomplete.js +++ b/web/js/autocomplete.js @@ -184,18 +184,6 @@ function insertTagToTextArea(inputElement, tagToInsert) { const text = inputElement.value; const cursorPos = inputElement.selectionStart; - // First check if the tag exists anywhere in the textarea and select it if found - const tagPositions = findAllTagPositions(text); - for (const { start, end, tag } of tagPositions) { - const existingTag = tag.trim(); - if (existingTag === normalizeTagToInsert(tagToInsert)) { - // Tag already exists, select it and exit - inputElement.focus(); - inputElement.setSelectionRange(start, end); - return; - } - } - // Find the current tag boundaries const lastComma = text.lastIndexOf(',', cursorPos - 1); const lastNewLine = text.lastIndexOf('\n', cursorPos - 1);