diff options
Diffstat (limited to 'extension/react-app')
-rw-r--r-- | extension/react-app/src/components/ComboBox.tsx | 7 | ||||
-rw-r--r-- | extension/react-app/src/tabs/gui.tsx | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 4dab8bcd..e6632360 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -293,8 +293,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { event.key === "Enter" && (!downshiftProps.isOpen || items.length === 0) ) { - downshiftProps.setInputValue(""); - const value = event.currentTarget.value; + const value = downshiftProps.inputValue; if (value !== "") { setPositionInHistory(history.length + 1); setHistory([...history, value]); @@ -302,10 +301,6 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { // Prevent Downshift's default 'Enter' behavior. (event.nativeEvent as any).preventDownshiftDefault = true; - // cmd+enter to /edit - if (event.metaKey) { - event.currentTarget.value = `/edit ${event.currentTarget.value}`; - } if (props.onEnter) props.onEnter(event); } else if (event.key === "Tab" && items.length > 0) { downshiftProps.setInputValue(items[0].name); diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx index 1ea70dd2..e1ecec9e 100644 --- a/extension/react-app/src/tabs/gui.tsx +++ b/extension/react-app/src/tabs/gui.tsx @@ -217,9 +217,13 @@ function GUI(props: GUIProps) { [client] ); - const onMainTextInput = () => { + const onMainTextInput = (event?: any) => { if (mainTextInputRef.current) { - const input = (mainTextInputRef.current as any).inputValue; + let input = (mainTextInputRef.current as any).inputValue; + // cmd+enter to /edit + if (event?.metaKey) { + input = `/edit ${input}`; + } (mainTextInputRef.current as any).setInputValue(""); if (!client) return; @@ -352,7 +356,7 @@ function GUI(props: GUIProps) { // } ref={mainTextInputRef} onEnter={(e) => { - onMainTextInput(); + onMainTextInput(e); e.stopPropagation(); e.preventDefault(); }} |