This commit is contained in:
IndieKKY
2024-10-05 21:17:26 +08:00
parent 4f03e75b6d
commit c71e8e2eab
4 changed files with 11 additions and 4 deletions

View File

@@ -101,6 +101,9 @@ chrome.action.onClicked.addListener(async (tab) => {
tabId: tab.id!,
})
} else {
chrome.sidePanel.setOptions({
enabled: false,
})
chrome.sidePanel.setPanelBehavior({
openPanelOnActionClick: false,
})

View File

@@ -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 <div className='rounded-[6px] bg-[#f1f2f3] dark:bg-base-100 h-[44px] flex justify-between items-center cursor-pointer' onClick={foldCallback}>
return <div className='rounded-[6px] bg-[#f1f2f3] dark:bg-base-100 h-[44px] flex justify-between items-center cursor-pointer' onClick={() => {
if (!envData.sidePanel) {
foldCallback()
}
}}>
<div className='shrink-0 flex items-center'>
<span className='shrink-0 text-[15px] font-medium pl-[16px] pr-[14px]'></span>
<MoreBtn placement={'right-start'}/>
@@ -91,7 +96,7 @@ const Header = (props: {
{infos?.map((item: any) => <option key={item.id} value={item.subtitle_url}>{item.lan_doc}</option>)}
<option key='upload' value='upload'>(vtt/srt)</option>
</select>}
<IoIosArrowUp className={classNames('shrink-0 desc transform ease-in duration-300', fold?'rotate-180':'')}/>
{!envData.sidePanel && <IoIosArrowUp className={classNames('shrink-0 desc transform ease-in duration-300', fold?'rotate-180':'')}/>}
</div>
</div>
}

View File

@@ -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()) {

View File

@@ -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) => {