From 7467865ce3f514272aa676573ee11f4b54f492f7 Mon Sep 17 00:00:00 2001 From: moshangqi <2509678669@qq.com> Date: Fri, 22 Dec 2023 12:51:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=E5=AF=BC=E8=87=B4=E7=9A=84=E9=93=BE=E6=8E=A5=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SuperSideBar/impl/ClipAssistant/index.tsx | 19 ++----------------- src/isomorphic/event/clipAssistant.ts | 2 -- src/pages/sidePanel/app.tsx | 2 +- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/components/SuperSideBar/impl/ClipAssistant/index.tsx b/src/components/SuperSideBar/impl/ClipAssistant/index.tsx index 8befa6f1..78ac0720 100644 --- a/src/components/SuperSideBar/impl/ClipAssistant/index.tsx +++ b/src/components/SuperSideBar/impl/ClipAssistant/index.tsx @@ -174,7 +174,6 @@ function ClipContent() { const onClipPage = async () => { const html = await backgroundBridge.clip.clipPage(); - console.log(html); await addLinkWhenEmpty(); editorRef.current?.appendContent(html); editorRef.current?.insertBreakLine(); @@ -263,39 +262,25 @@ function ClipContent() { }, [selectSavePosition]); useEffect(() => { - const onStartSelectArea = () => { - const div = document.querySelector(`#${ClipSelectAreaId}`); - (div as HTMLDivElement)?.click(); - }; const onStartScreenOcr = () => { const div = document.querySelector(`#${ClipScreenOcrId}`); (div as HTMLDivElement)?.click(); }; - const onStartCollectLink = () => { - const div = document.querySelector(`#${ClipCollectLinkId}`); - (div as HTMLDivElement)?.click(); - }; + const onMessage = (e: any) => { if (e.data.key !== ClipAssistantMessageKey) { return; } switch (e.data.action) { case ClipAssistantMessageActions.addContent: { + addLinkWhenEmpty(); editorRef.current?.appendContent(e.data?.data); break; } - case ClipAssistantMessageActions.startSelectArea: { - onStartSelectArea(); - break; - } case ClipAssistantMessageActions.startScreenOcr: { onStartScreenOcr(); break; } - case ClipAssistantMessageActions.startCollectLink: { - onStartCollectLink(); - break; - } default: { break; } diff --git a/src/isomorphic/event/clipAssistant.ts b/src/isomorphic/event/clipAssistant.ts index faf1d53d..2728da73 100644 --- a/src/isomorphic/event/clipAssistant.ts +++ b/src/isomorphic/event/clipAssistant.ts @@ -15,7 +15,5 @@ export enum ClipAssistantMessageActions { */ ready = 'ready', addContent = 'addContent', - startSelectArea = 'startSelectArea', startScreenOcr = 'startScreenOcr', - startCollectLink = 'startCollectLink', } diff --git a/src/pages/sidePanel/app.tsx b/src/pages/sidePanel/app.tsx index e4504997..a09b41b6 100644 --- a/src/pages/sidePanel/app.tsx +++ b/src/pages/sidePanel/app.tsx @@ -26,7 +26,7 @@ declare const Tracert: any; const MiniWidth = 416; function App() { - const [sidePanelIsReady, setSidePanelIsReady] = useState(true); + const [sidePanelIsReady, setSidePanelIsReady] = useState(false); const { forceUpdate } = useForceUpdate(); const disableRef = useRef(window.innerWidth < MiniWidth);