Skip to content

Commit 518f5e9

Browse files
committed
Prevent triggering hash sign click handler when typing double hash symbols
1 parent 9e4d553 commit 518f5e9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/ui/src/components/editor/panel/PromptField/hooks/use-handlers.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,15 @@ export const use_handlers = (
438438
props.on_at_sign_click()
439439
}
440440
} else if (char_before_caret == '#') {
441-
props.on_hash_sign_click()
441+
let is_after_hash = false
442+
if (caret_position > 1) {
443+
const char_before_hash = new_display_value.charAt(caret_position - 2)
444+
is_after_hash = char_before_hash == '#'
445+
}
446+
447+
if (!is_after_hash) {
448+
props.on_hash_sign_click()
449+
}
442450
}
443451

444452
set_history_index(-1)

0 commit comments

Comments
 (0)