Skip to content

Commit f3b2659

Browse files
committed
Refactor ghost text acceptance on ArrowRight key press to use the dedicated on_accept_ghost_text handler
1 parent fba01d2 commit f3b2659

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -758,16 +758,7 @@ export const use_handlers = (
758758

759759
if (is_before_ghost) {
760760
e.preventDefault()
761-
762-
// Remove ghost text by replacing with empty text node or just removing it
763-
if (ghost_node.parentNode) {
764-
ghost_node.parentNode.removeChild(ghost_node)
765-
}
766-
767-
// Move caret one position to the right in the actual text
768-
const current_pos = get_caret_position_from_div(input_ref.current)
769-
set_caret_position_for_div(input_ref.current, current_pos + 1)
770-
761+
on_accept_ghost_text()
771762
return
772763
}
773764
}

0 commit comments

Comments
 (0)