mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-30 21:59:46 +02:00
feat(web): wire Composer to pre-fill clipboard content from Electron tray
This commit is contained in:
parent
5ab534511c
commit
c78f0e78aa
1 changed files with 11 additions and 0 deletions
|
|
@ -314,6 +314,16 @@ const Composer: FC = () => {
|
||||||
const composerRuntime = useComposerRuntime();
|
const composerRuntime = useComposerRuntime();
|
||||||
const hasAutoFocusedRef = useRef(false);
|
const hasAutoFocusedRef = useRef(false);
|
||||||
|
|
||||||
|
// Clipboard content from Electron tray (pre-filled into composer)
|
||||||
|
const [clipboardText, setClipboardText] = useState<string | undefined>();
|
||||||
|
useEffect(() => {
|
||||||
|
const api = (window as { electronAPI?: { getClipboardContent?: () => Promise<string> } }).electronAPI;
|
||||||
|
if (!api?.getClipboardContent) return;
|
||||||
|
api.getClipboardContent().then((text) => {
|
||||||
|
if (text) setClipboardText(text);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
const isThreadEmpty = useAssistantState(({ thread }) => thread.isEmpty);
|
const isThreadEmpty = useAssistantState(({ thread }) => thread.isEmpty);
|
||||||
const isThreadRunning = useAssistantState(({ thread }) => thread.isRunning);
|
const isThreadRunning = useAssistantState(({ thread }) => thread.isRunning);
|
||||||
|
|
||||||
|
|
@ -520,6 +530,7 @@ const Composer: FC = () => {
|
||||||
onDocumentRemove={handleDocumentRemove}
|
onDocumentRemove={handleDocumentRemove}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
|
initialText={clipboardText}
|
||||||
className="min-h-[24px]"
|
className="min-h-[24px]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue