From f4afd9361fcb0e9c7f944522653f7bd17a10d5c4 Mon Sep 17 00:00:00 2001 From: oeyoews Date: Fri, 22 Mar 2024 23:46:28 +0800 Subject: [PATCH] feat: support save to tiddlywiki --- entrypoints/background.ts | 5 +- entrypoints/content.ts | 1 - entrypoints/popup/Popup.vue | 97 +++++++++++++++++++++++++++++++++++-- package.json | 3 ++ pnpm-lock.yaml | 76 +++++++++++++++++++++++++++++ 5 files changed, 173 insertions(+), 9 deletions(-) diff --git a/entrypoints/background.ts b/entrypoints/background.ts index 14c91e2..4664b2e 100644 --- a/entrypoints/background.ts +++ b/entrypoints/background.ts @@ -1,6 +1,4 @@ export default defineBackground(() => { - console.log('Hello background!', { id: browser.runtime.id }); - browser.runtime.onInstalled.addListener(async ({ reason }) => { if (reason !== 'install') return; @@ -13,14 +11,13 @@ export default defineBackground(() => { chrome.runtime.onInstalled.addListener(function () { chrome.contextMenus.create({ id: 'tiddlywiki', - title: '添加到 TiddlyWiki(Ctrl+Shift+F)', + title: '添加到 TiddlyWiki(WIP)', contexts: ['all'], }); }); chrome.commands.onCommand.addListener(function (command) { if (command === 'addtiddlywiki') { - console.log('yu '); // 处理快捷键被触发时的逻辑 } }); diff --git a/entrypoints/content.ts b/entrypoints/content.ts index 9fb7cd3..c82ba63 100644 --- a/entrypoints/content.ts +++ b/entrypoints/content.ts @@ -11,7 +11,6 @@ export default defineContentScript({ } chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { - console.log(request.info); sendResponse(getDoc()); }); }, diff --git a/entrypoints/popup/Popup.vue b/entrypoints/popup/Popup.vue index 263fe60..fd2dd7b 100644 --- a/entrypoints/popup/Popup.vue +++ b/entrypoints/popup/Popup.vue @@ -1,21 +1,30 @@