From 74e9061d6a3835cf6cf1179832316c9b6b91547b Mon Sep 17 00:00:00 2001 From: oeyoews Date: Sun, 14 Jul 2024 10:45:08 +0800 Subject: [PATCH] fix: update allow_url --- components.d.ts | 1 - entrypoints/background/index.ts | 62 +++++++++++++++-------------- entrypoints/sidepanel/Sidepanel.vue | 4 +- package.json | 2 +- wxt.config.ts | 2 +- 5 files changed, 37 insertions(+), 34 deletions(-) diff --git a/components.d.ts b/components.d.ts index 2a0a546..1ad9d44 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,7 +7,6 @@ export {} declare module 'vue' { export interface GlobalComponents { - ElBacktop: typeof import('element-plus/es')['ElBacktop'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] diff --git a/entrypoints/background/index.ts b/entrypoints/background/index.ts index a3e0e5b..6b13e1d 100644 --- a/entrypoints/background/index.ts +++ b/entrypoints/background/index.ts @@ -124,38 +124,40 @@ export default defineBackground(() => { } }); - browser.tabs.onUpdated.addListener((tabId, info, tab) => { - if (!tab.url) return; - const url = new URL(tab.url); - const domains = [ - 'https://www.google.com', - 'https://www.bing.com', - 'https://baidu.com', - ]; + setTimeout(() => { + browser.tabs.onUpdated.addListener((tabId, info, tab) => { + if (!tab.url) return; + const url = new URL(tab.url); + const domains = [ + 'https://www.google.com', + 'https://www.bing.com', + 'https://baidu.com', + ]; - // 部分页面不开启侧边栏 - if (!domains.includes(url.origin) && !tab.url?.startsWith('chrome://')) { - chrome.sidePanel.setOptions({ - tabId, - path: pages.sidePanelPage, - enabled: true, - }); - } else { - chrome.sidePanel.setOptions({ - tabId, - enabled: false, - }); - return; - } + // 部分页面不开启侧边栏 + if (!domains.includes(url.origin) && !tab.url?.startsWith('chrome://')) { + chrome.sidePanel.setOptions({ + tabId, + path: pages.sidePanelPage, + enabled: true, + }); + } else { + chrome.sidePanel.setOptions({ + tabId, + enabled: false, + }); + return; + } - // 页面路由发生变化通知侧边栏前端页面更新 - if (info.status === 'complete') { - chrome.tabs.sendMessage(tabId, { - type: 'routeUpdate', - data: tab.url, - }); - } - }); + // 页面路由发生变化通知侧边栏前端页面更新 + if (info.status === 'complete') { + chrome.tabs.sendMessage(tabId, { + type: 'routeUpdate', + data: tab.url, + }); + } + }); + }, 1000); chrome.contextMenus.onClicked.addListener((info, tab) => { const { menuItemId } = info; diff --git a/entrypoints/sidepanel/Sidepanel.vue b/entrypoints/sidepanel/Sidepanel.vue index 093a616..78a8517 100644 --- a/entrypoints/sidepanel/Sidepanel.vue +++ b/entrypoints/sidepanel/Sidepanel.vue @@ -420,7 +420,9 @@ const toggleInfoDialog = () => { Tiddlers --> - + diff --git a/package.json b/package.json index ecc4654..5be33ef 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "usewiki2", "description": "Convert HTML to Markdown, and save to your computer, support nodejs tiddlywiki", "private": true, - "version": "4.5.5", + "version": "4.5.6", "type": "module", "scripts": { "dev": "wxt --mode development", diff --git a/wxt.config.ts b/wxt.config.ts index b0b1981..4493fd5 100644 --- a/wxt.config.ts +++ b/wxt.config.ts @@ -68,7 +68,7 @@ export default defineConfig({ 'activeTab', 'contextMenus', 'storage', - '', + // '', 'tabs', 'scripting', ],