Skip to content

Commit 48e3f1b

Browse files
committed
Clear active text selection when a warning occurs in the PromptField
- when showing warning, remove potential text selection
1 parent fb6b259 commit 48e3f1b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎packages/ui/src/components/editor/panel/prompts/PromptField/PromptField.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
156156
useEffect(() => {
157157
if (props.warning && input_ref.current) {
158158
input_ref.current.blur()
159+
const selection = window.getSelection()
160+
if (selection) {
161+
selection.removeAllRanges()
162+
}
159163
}
160164
}, [props.warning])
161165

0 commit comments

Comments
 (0)