From e800d0b3433728e427b8cf91845f2e4ce195b2f3 Mon Sep 17 00:00:00 2001 From: oeyoews Date: Wed, 24 Jul 2024 13:30:39 +0800 Subject: [PATCH] fix: remove el-panel --- entrypoints/sidepanel/Sidepanel.vue | 518 +++++++++---------- entrypoints/sidepanel/components/Actions.vue | 32 +- hooks/useToggle.ts | 15 + package.json | 2 +- utils/icons/index.ts | 1 + 5 files changed, 290 insertions(+), 278 deletions(-) create mode 100644 hooks/useToggle.ts diff --git a/entrypoints/sidepanel/Sidepanel.vue b/entrypoints/sidepanel/Sidepanel.vue index db0e01c..320d350 100644 --- a/entrypoints/sidepanel/Sidepanel.vue +++ b/entrypoints/sidepanel/Sidepanel.vue @@ -4,7 +4,7 @@ import 'element-plus/theme-chalk/dark/css-vars.css'; import 'element-plus/es/components/notification/style/css'; import 'element-plus/es/components/message-box/style/css'; import GridBg from '@/components/GridBg.vue'; -import Actions from './components/Actions.vue'; +import Actions, { type ICommand } from './components/Actions.vue'; import Info from './components/Info.vue'; import { formattime } from '@/utils/formattime'; import * as utils from '@/utils/utils'; @@ -32,6 +32,7 @@ import { import { useContent } from '@/hooks/useContent'; const isHome = ref(true); +const isRead = ref(true); const { loading, html, md, link, faviconUrl, title, getContent } = useContent(); const { isDarkMode, toggleDark } = useDarkMode(); @@ -253,32 +254,27 @@ async function saveAuth(option: { username: string; password: string }) { } } -const handleCommand = async (cmd: string, components: any, e: MouseEvent) => { - switch (cmd) { - case 'journal': - addJournal(); - break; - case 'info': +const handleCommand = async (cmd: ICommand, components: any, e: MouseEvent) => { + const actions: Record = { + tiddlywiki: () => { + isHome.value = !isHome.value; + }, + journal: addJournal, + info: () => { infoDialogStatus.value = !infoDialogStatus.value; - break; - case 'setup': + }, + setup: () => { setupDialogStatus.value = true; - break; - case 'copy': - copyMd(md.value); - break; - case 'download': - saveMarkdown(md.value, title.value!); - break; - case 'refresh': - getContent({ tip: true }); - break; - case 'darkmode': - await toggleDark(e); - break; - default: - break; - } + }, + copy: () => copyMd(md.value), + download: () => saveMarkdown(md.value, title.value!), + refresh: () => getContent({ tip: true }), + darkmode: () => toggleDark(e), + edit: () => { + isRead.value = !isRead.value; + }, + }; + actions[cmd](e); }; // const onGoHome = () => { @@ -302,13 +298,6 @@ const handleCommand = async (cmd: string, components: any, e: MouseEvent) => { class="backdrop-blur-sm z-[999] flex justify-end items-center inset-x-0 gap-1 p-2 px-6" v-if="isHome"> - 进入太微 {
- - - - +
+
+ + + + + + +
+ +
+
+ + + + +
+
+
+
+
+ + + +
+ + +
+ + + +
-
- - - - - - +

登录

+
+ + + + + + + + + + 保存 + + +
+
-
-
- - - diff --git a/entrypoints/sidepanel/components/Actions.vue b/entrypoints/sidepanel/components/Actions.vue index 4dd5939..4a0ef3c 100644 --- a/entrypoints/sidepanel/components/Actions.vue +++ b/entrypoints/sidepanel/components/Actions.vue @@ -1,5 +1,6 @@