Преглед на файлове

Merge pull request #1946 from cesaryuan/fix-selection

fix: remove selection range when user blured
Yifei Zhang преди 1 година
родител
ревизия
590bd8e4bb
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      app/components/mask.tsx

+ 6 - 1
app/components/mask.tsx

@@ -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,