diff --git a/src/chrome/background.ts b/src/chrome/background.ts
index 6798602..0d2bed5 100644
--- a/src/chrome/background.ts
+++ b/src/chrome/background.ts
@@ -101,6 +101,9 @@ chrome.action.onClicked.addListener(async (tab) => {
tabId: tab.id!,
})
} else {
+ chrome.sidePanel.setOptions({
+ enabled: false,
+ })
chrome.sidePanel.setPanelBehavior({
openPanelOnActionClick: false,
})
diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 7c4dbe1..86357b0 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -16,6 +16,7 @@ const Header = (props: {
const curInfo = useAppSelector(state => state.env.curInfo)
const fold = useAppSelector(state => state.env.fold)
const uploadedTranscript = useAppSelector(state => state.env.uploadedTranscript)
+ const envData = useAppSelector(state => state.env.envData)
const upload = useCallback(() => {
const input = document.createElement('input')
@@ -76,7 +77,11 @@ const Header = (props: {
upload()
}, [upload])
- return
+ return
{
+ if (!envData.sidePanel) {
+ foldCallback()
+ }
+ }}>
字幕列表
@@ -91,7 +96,7 @@ const Header = (props: {
{infos?.map((item: any) => )}
}
-
+ {!envData.sidePanel && }
}
diff --git a/src/messaging/ExtensionMessage.ts b/src/messaging/ExtensionMessage.ts
index 2d9b12b..92e7538 100644
--- a/src/messaging/ExtensionMessage.ts
+++ b/src/messaging/ExtensionMessage.ts
@@ -113,7 +113,6 @@ class ExtensionMessage {
}
broadcastMessageExact = async (tabIds: number[], target: string, method: string, params?: any) => {
- //遍历portIdToPort
const targetType = target === MESSAGE_TARGET_INJECT ? 'inject' : 'app'
let resp: MessageResult | undefined
for (const portContext of this.portIdToPort.values()) {
diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx
index 3ee2f76..32a0832 100644
--- a/src/pages/MainPage.tsx
+++ b/src/pages/MainPage.tsx
@@ -22,7 +22,7 @@ function App() {
const foldCallback = useCallback(() => {
dispatch(setFold(!fold))
sendInject(MESSAGE_TO_INJECT_FOLD, {fold: !fold})
- }, [dispatch, fold])
+ }, [dispatch, fold, sendInject])
// handle event
eventBus.useSubscription((event: any) => {