mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +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 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 isThreadRunning = useAssistantState(({ thread }) => thread.isRunning);
|
||||
|
||||
|
|
@ -520,6 +530,7 @@ const Composer: FC = () => {
|
|||
onDocumentRemove={handleDocumentRemove}
|
||||
onSubmit={handleSubmit}
|
||||
onKeyDown={handleKeyDown}
|
||||
initialText={clipboardText}
|
||||
className="min-h-[24px]"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue