diff --git a/screenshots/preview_github_rightclickmenu.jpg b/screenshots/preview_github_rightclickmenu.jpg index ae2ad50..76d7431 100644 Binary files a/screenshots/preview_github_rightclickmenu.jpg and b/screenshots/preview_github_rightclickmenu.jpg differ diff --git a/screenshots/preview_google_floatingwindow_conversationbranch.jpg b/screenshots/preview_google_floatingwindow_conversationbranch.jpg index 5fbcf84..d4e6aa7 100644 Binary files a/screenshots/preview_google_floatingwindow_conversationbranch.jpg and b/screenshots/preview_google_floatingwindow_conversationbranch.jpg differ diff --git a/screenshots/preview_independentpanel.jpg b/screenshots/preview_independentpanel.jpg index 6f8441b..417701e 100644 Binary files a/screenshots/preview_independentpanel.jpg and b/screenshots/preview_independentpanel.jpg differ diff --git a/screenshots/preview_reddit_selectiontools.jpg b/screenshots/preview_reddit_selectiontools.jpg index ce34d2c..d3a8068 100644 Binary files a/screenshots/preview_reddit_selectiontools.jpg and b/screenshots/preview_reddit_selectiontools.jpg differ diff --git a/src/components/ConversationCard/index.jsx b/src/components/ConversationCard/index.jsx index ec98a74..1f14dba 100644 --- a/src/components/ConversationCard/index.jsx +++ b/src/components/ConversationCard/index.jsx @@ -382,6 +382,7 @@ function ConversationCard(props) { updateAnswer(e, false, 'error') } }} + port={port} /> ) diff --git a/src/components/InputBox/index.jsx b/src/components/InputBox/index.jsx index 89e8e5c..df1ca8e 100644 --- a/src/components/InputBox/index.jsx +++ b/src/components/InputBox/index.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import { updateRefHeight } from '../../utils' import { useTranslation } from 'react-i18next' -export function InputBox({ onSubmit, enabled }) { +export function InputBox({ onSubmit, enabled, port }) { const { t } = useTranslation() const [value, setValue] = useState('') const inputRef = useRef(null) @@ -16,37 +16,64 @@ export function InputBox({ onSubmit, enabled }) { if (enabled) inputRef.current.focus() }, [enabled]) - const onKeyDown = (e) => { + const handleKeyDownOrClick = (e) => { e.stopPropagation() - if (e.keyCode === 13 && e.shiftKey === false) { - e.preventDefault() - if (!value) return - onSubmit(value) - setValue('') + if (e.type === 'click' || (e.keyCode === 13 && e.shiftKey === false)) { + if (enabled) { + e.preventDefault() + if (!value) return + onSubmit(value) + setValue('') + } else { + e.preventDefault() + port.postMessage({ stop: true }) + } } } return ( -