mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
fix Ask SurfSense: pre-fill with initialText and cursor positioning
This commit is contained in:
parent
f36e5f8287
commit
9f13da3fd1
3 changed files with 24 additions and 15 deletions
|
|
@ -306,6 +306,18 @@ const Composer: FC = () => {
|
|||
const aui = useAui();
|
||||
const hasAutoFocusedRef = useRef(false);
|
||||
|
||||
const [quickAskInitialText, setQuickAskInitialText] = useState<string | undefined>();
|
||||
useEffect(() => {
|
||||
if (!window.electronAPI) return;
|
||||
if (sessionStorage.getItem("quickAskAutoSubmit") === "false") {
|
||||
const text = sessionStorage.getItem("quickAskInitialText");
|
||||
if (text) {
|
||||
setQuickAskInitialText(text);
|
||||
sessionStorage.removeItem("quickAskInitialText");
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
const isThreadEmpty = useAuiState(({ thread }) => thread.isEmpty);
|
||||
const isThreadRunning = useAuiState(({ thread }) => thread.isRunning);
|
||||
|
||||
|
|
@ -512,6 +524,7 @@ const Composer: FC = () => {
|
|||
onDocumentRemove={handleDocumentRemove}
|
||||
onSubmit={handleSubmit}
|
||||
onKeyDown={handleKeyDown}
|
||||
initialText={quickAskInitialText}
|
||||
className="min-h-[24px]"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue