Skip to content

Commit a0f5829

Browse files
committed
Prevent backspace action when cursor is at the start of the prompt field
1 parent aef49f4 commit a0f5829

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • packages/ui/src/components/editor/panel/prompts/PromptField/hooks/use-handlers

packages/ui/src/components/editor/panel/prompts/PromptField/hooks/use-handlers/handle-key-down.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ export const create_handle_key_down = (
314314
return
315315
}
316316

317+
if (selection?.isCollapsed && refs.raw_caret_pos_ref.current === 0) {
318+
e.preventDefault()
319+
return
320+
}
321+
317322
if (e.ctrlKey || e.metaKey) {
318323
e.preventDefault()
319324
const raw_pos = refs.raw_caret_pos_ref.current

0 commit comments

Comments
 (0)