From cd61ae702c58831a7c519f8e68c2e0620f887091 Mon Sep 17 00:00:00 2001 From: purocean Date: Tue, 29 Nov 2022 11:31:40 +0800 Subject: [PATCH] refactor: remove `ctx.command` --- help/PLUGIN.md | 6 +- help/PLUGIN_ZH-CN.md | 9 +- src/renderer/components/ActionBar.vue | 3 +- src/renderer/components/ControlCenter.vue | 7 +- .../components/DefaultPreviewerRender.ce.vue | 4 +- src/renderer/components/DocHistory.vue | 5 +- src/renderer/components/FileTabs.vue | 11 +- src/renderer/components/Filter.vue | 5 +- src/renderer/components/SearchPanel.vue | 5 +- src/renderer/context/index.ts | 2 - src/renderer/core/action.ts | 232 ++++++++++++++-- src/renderer/core/command.ts | 259 ------------------ src/renderer/embed/index.html | 4 +- src/renderer/plugins/control-center.ts | 12 +- src/renderer/plugins/copy-content.tsx | 4 +- src/renderer/plugins/copy-text.ts | 5 +- .../plugins/document-history-stack.ts | 12 +- src/renderer/plugins/editor-attachment.ts | 8 +- src/renderer/plugins/editor-markdown.ts | 6 +- src/renderer/plugins/editor-paste.ts | 2 +- src/renderer/plugins/electron-zoom.ts | 12 +- src/renderer/plugins/image-localization.ts | 10 +- src/renderer/plugins/markdown-code-copy.ts | 2 +- src/renderer/plugins/markdown-code-run.ts | 7 +- src/renderer/plugins/markdown-table.ts | 2 +- src/renderer/plugins/markdown-toc.ts | 3 +- src/renderer/plugins/status-bar-history.ts | 2 +- src/renderer/plugins/status-bar-navigation.ts | 2 +- .../plugins/status-bar-presentation.ts | 2 +- .../plugins/status-bar-repository-switch.ts | 4 +- src/renderer/plugins/status-bar-terminal.ts | 2 +- src/renderer/plugins/status-bar-view.ts | 11 +- src/renderer/plugins/switch-todo.ts | 2 +- src/renderer/services/editor.ts | 5 +- src/renderer/services/layout.ts | 11 +- src/renderer/services/view.ts | 13 +- src/renderer/services/workbench.ts | 5 +- src/renderer/types.ts | 1 + 38 files changed, 297 insertions(+), 400 deletions(-) delete mode 100644 src/renderer/core/command.ts diff --git a/help/PLUGIN.md b/help/PLUGIN.md index d7141074..17a4b2f7 100644 --- a/help/PLUGIN.md +++ b/help/PLUGIN.md @@ -50,7 +50,6 @@ Yank Note has some concepts that are the basis for supporting the entire plug-in 1. Hook 1. Action -1. Command ### Hook @@ -78,13 +77,10 @@ For internal hook types, please refer to [Api Document](https://yn-api-doc.verce ### Action -Yank Note has an Action Center [`ctx.action`](https://yn-api-doc.vercel.app/modules/renderer_core_action.html), which provides action management and operation。 +Yank Note has an Action Center [`ctx.action`](https://yn-api-doc.vercel.app/modules/renderer_core_action.html), which provides action and keyboard shortcuts management and operation。 For internal action, please refer to [Api Document](https://yn-api-doc.vercel.app/modules/renderer_types.html#BuildInActions) -### Command -Yank Note has a Command Center [`ctx.command`](https://yn-api-doc.vercel.app/modules/renderer_core_command.html), which is mainly responsible for the management and operation of shortcut keys. - ## Plug-In Capabilities As you can see from the above, the functions of the plug-in are all implemented through the modules of `ctx`. diff --git a/help/PLUGIN_ZH-CN.md b/help/PLUGIN_ZH-CN.md index 5da25bed..f54b5b1f 100644 --- a/help/PLUGIN_ZH-CN.md +++ b/help/PLUGIN_ZH-CN.md @@ -50,7 +50,6 @@ Yank Note 有一些概念,是支撑整个插件体系的基础: 1. Hook 钩子 1. Action 动作 -1. Command 命令 ### Hook 钩子 @@ -60,7 +59,7 @@ Yank Note 在执行一些操作的时候,会触发一些钩子调用。 调用 `triggerHook` 时候附加选项 `{ breakable: true }`,表明这个钩子调用是可中断的。 -下面的内部钩子调用是可中断的 +如下面的内部钩子调用是可中断的 - `ACTION_AFTER_RUN` - `ACTION_BEFORE_RUN` @@ -76,14 +75,10 @@ Yank Note 在执行一些操作的时候,会触发一些钩子调用。 ### Action 动作 -Yank Note 有一个 Action 中心 [`ctx.action`](https://yn-api-doc.vercel.app/modules/renderer_core_action.html),提供动作的管理和运行。 +Yank Note 有一个 Action 中心 [`ctx.action`](https://yn-api-doc.vercel.app/modules/renderer_core_action.html),提供动作和快捷键的管理和运行。 内部 Action 可以参考 [Api 文档](https://yn-api-doc.vercel.app/modules/renderer_types.html#BuildInActions) -### Command 命令 - -Yank Note 有一个 Command 中心 [`ctx.command`](https://yn-api-doc.vercel.app/modules/renderer_core_command.html),主要负责快捷键相关的管理和运行。 - ## 插件能力 从上面可以看到,插件的功能都是通过 `ctx` 下面挂载的模块来实现。 diff --git a/src/renderer/components/ActionBar.vue b/src/renderer/components/ActionBar.vue index 4a32813b..2ca35291 100644 --- a/src/renderer/components/ActionBar.vue +++ b/src/renderer/components/ActionBar.vue @@ -36,13 +36,12 @@