Merge pull request #1946 from cesaryuan/fix-selection

fix: remove selection range when user blured
This commit is contained in:
Yifei Zhang 2023-06-14 15:42:24 +08:00 committed by GitHub
commit 590bd8e4bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -185,7 +185,12 @@ function ContextPromptItem(props: {
className={chatStyle["context-content"]}
rows={focusingInput ? 5 : 1}
onFocus={() => setFocusingInput(true)}
onBlur={() => setFocusingInput(false)}
onBlur={() => {
setFocusingInput(false);
// If the selection is not removed when the user loses focus, some
// extensions like "Translate" will always display a floating bar
window?.getSelection()?.removeAllRanges();
}}
onInput={(e) =>
props.update({
...props.prompt,