diff --git a/src/main.ts b/src/main.ts index 4070232..876fbf9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -55,7 +55,7 @@ import { notifyNtfy } from './api'; import t from './i18n'; import './main.scss'; import { NotifyUtil } from './utils/notify'; -// import { editorUtil } from './utils/editor'; +import { editorUtil } from './utils/editor'; export const OpenUrl = ref('https://baidu.com'); const media = window.matchMedia('(prefers-color-scheme: dark)'); @@ -318,7 +318,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin { override async onload(): Promise { await this.pluginDataIO.load(); - // editorUtil.init(this); + editorUtil.init(this); NotifyUtil.init(this); this.setupUI(); this.setupCommands(); @@ -508,14 +508,6 @@ export default class AwesomeBrainManagerPlugin extends Plugin { }, }); - this.addCommand({ - id: 'query-baidu', - name: t.command['query-baidu'] || '百度一下', - editorCallback: (editor: Editor, view: MarkdownView) => { - this.openBrowser(`https://baidu.com/s?wd=${editor.getSelection()}`) - }, - }); - this.addCommand({ id: 'query-openai', name: t.command['query-openai'], @@ -591,7 +583,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin { this.registerView(POMODORO_HISTORY_VIEW, leaf => new PomodoroHistoryView(leaf, this)); this.registerView(BROWSER_VIEW, leaf => new BrowserView(leaf, this, OpenUrl)); - // editorUtil.addTags(JSON.parse(SETTINGS.customTag.value)); + editorUtil.addTags(JSON.parse(SETTINGS.customTag.value)); // 左侧菜单,使用自定义图标 this.addRibbonIcon('settings-2', 'Awesome Brain Manager', event => { @@ -629,7 +621,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin { // Remove listener when we unload this.register(() => media.removeEventListener('change', callback)); this.registerDomEvent(activeDocument, 'mouseup', async (e: MouseEvent) => { - // editorUtil.changeToolbarPopover(e, SETTINGS.toolbar); + editorUtil.changeToolbarPopover(e, SETTINGS.toolbar); }); this.registerDomEvent(activeDocument, 'click', async (e: MouseEvent) => { toggleMouseClickEffects(e, SETTINGS.clickString); @@ -653,7 +645,7 @@ export default class AwesomeBrainManagerPlugin extends Plugin { } override async onunload(): Promise { - // editorUtil.unloadCustomViewContainer(); + editorUtil.unloadCustomViewContainer(); toggleBlast('0'); this.app.workspace.detachLeavesOfType(POMODORO_HISTORY_VIEW); this.style.detach(); diff --git a/src/settings.ts b/src/settings.ts index e68ffb0..0452724 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -6,7 +6,7 @@ import type { PluginDataIO } from './data'; import { toggleCursorEffects } from './render/CursorEffects'; import { toggleBlast } from './render/Blast'; import t from './i18n'; -// import { editorUtil } from './utils/editor'; +import { editorUtil } from './utils/editor'; class Settings { settings: SettingTabModel = new SettingTabModel(); @@ -105,7 +105,7 @@ class Settings { .desc('Customized label configuration') .text(JSON.stringify(defaultTag)) .onAnyValueChanged(context => { - // editorUtil.addTags(JSON.parse(SETTINGS.customTag.value)); + editorUtil.addTags(JSON.parse(SETTINGS.customTag.value)); }) .build(new RawSerde()); diff --git a/src/stores/editor.ts b/src/stores/editor.ts index 9446218..543950c 100644 --- a/src/stores/editor.ts +++ b/src/stores/editor.ts @@ -1,8 +1,9 @@ import { defineStore } from 'pinia'; + import { reactive, ref } from 'vue'; import type { EditorState } from '../types/types'; -export const useEditorStore = defineStore('pomodoro', () => { +export const useEditorStore = defineStore('editor', () => { const totalTask = ref(0); const editorState: EditorState = reactive({ diff --git a/src/stores/index.ts b/src/stores/index.ts index cf8b326..518ab97 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -1,11 +1,4 @@ -import { createApp } from 'vue'; import { createPinia } from 'pinia'; -import { usePomodoroStore } from '@/stores/pomodoro'; -import { useEditorStore } from '@/stores/editor'; - -import CustomViewContainer from '../ui/CustomViewContainer.vue'; - -const customViewVueApp = createApp(CustomViewContainer); - -customViewVueApp.use(createPinia()) -export { usePomodoroStore, useEditorStore, customViewVueApp }; +import { useEditorStore } from './editor'; +export default createPinia(); +export { useEditorStore }; diff --git a/src/ui/Toolbar.vue b/src/ui/Toolbar.vue index f22400f..91b7263 100644 --- a/src/ui/Toolbar.vue +++ b/src/ui/Toolbar.vue @@ -59,7 +59,7 @@