An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/13277
Vanessabd89dd67e1ea
diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.tsindex 4ad2d4fbd3..b2f14f9044 100644--- a/app/src/config/keymap.ts+++ b/app/src/config/keymap.ts@@ -54,6 +54,24 @@ export const keymap = {<input data-key="plugin${Constants.ZWSP}${item.name}${Constants.ZWSP}${command.langKey}" data-value="${command.customHotkey}" data-default="${command.hotkey}" class="b3-text-field fn__none" value="${keyValue}" spellcheck="false"></label>`;});+ item.updateProtyleToolbar([]).forEach(toolbarItem => {+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {+ return+ }+ const dockKeymap = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name];+ const keyValue = updateHotkeyTip(dockKeymap.custom);+ commandHTML += `<label class="b3-list-item b3-list-item--narrow b3-list-item--hide-action">+ <span class="b3-list-item__text">${toolbarItem.tip||window.siyuan.languages[toolbarItem.lang]}</span>+ <span data-type="reset" class="b3-list-item__action b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.reset}">+ <svg><use xlink:href="#iconUndo"></use></svg>+ </span>+ <span data-type="clear" class="b3-list-item__action b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.remove}">+ <svg><use xlink:href="#iconTrashcan"></use></svg>+ </span>+ <span data-type="update" class="config-keymap__key">${keyValue}</span>+ <input data-key="plugin${Constants.ZWSP}${item.name}${Constants.ZWSP}${toolbarItem.name}" data-value="${dockKeymap.custom}" data-default="${dockKeymap.default}" class="b3-text-field fn__none" value="${keyValue}" spellcheck="false">+</label>`;+ })Object.keys(item.docks).forEach(key => {const dockConfig = item.docks[key].config;if (!dockConfig.hotkey) {diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.tsindex 42af4c850d..54214d5f84 100644--- a/app/src/plugin/index.ts+++ b/app/src/plugin/index.ts@@ -15,6 +15,7 @@ import {hasClosestByAttribute} from "../protyle/util/hasClosest";import {BlockPanel} from "../block/Panel";import {Setting} from "./Setting";import {clearOBG} from "../layout/dock/util";+import {Constants} from "../constants";export class Plugin {private app: App;@@ -75,6 +76,29 @@ export class Plugin {value: options.name,writable: false,});++ this.updateProtyleToolbar([]).forEach(toolbarItem => {+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {+ return+ }+ if (!window.siyuan.config.keymap.plugin) {+ window.siyuan.config.keymap.plugin = {};+ }+ if (!window.siyuan.config.keymap.plugin[options.name]) {+ window.siyuan.config.keymap.plugin[options.name] = {+ [toolbarItem.name]: {+ default: toolbarItem.hotkey,+ custom: toolbarItem.hotkey,+ }+ };+ }+ if (!window.siyuan.config.keymap.plugin[options.name][toolbarItem.name]) {+ window.siyuan.config.keymap.plugin[options.name][toolbarItem.name] = {+ default: toolbarItem.hotkey,+ custom: toolbarItem.hotkey,+ }+ }+ })}public onload() {diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex e363576586..44d7df389e 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -69,7 +69,14 @@ export class Toolbar {/// #endifthis.toolbarHeight = 29;protyle.app.plugins.forEach(item => {- options.toolbar = toolbarKeyToMenu(item.updateProtyleToolbar(options.toolbar));+ const pluginToolbar = item.updateProtyleToolbar(options.toolbar)+ pluginToolbar.forEach(toolbarItem => {+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {+ return+ }+ toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;+ })+ options.toolbar = toolbarKeyToMenu(pluginToolbar);});options.toolbar.forEach((menuItem: IMenuItem) => {const itemElement = this.genItem(protyle, menuItem);@@ -81,7 +88,14 @@ export class Toolbar {this.element.innerHTML = "";protyle.options.toolbar = toolbarKeyToMenu(Constants.PROTYLE_TOOLBAR);protyle.app.plugins.forEach(item => {- protyle.options.toolbar = toolbarKeyToMenu(item.updateProtyleToolbar(protyle.options.toolbar));+ const pluginToolbar = item.updateProtyleToolbar(protyle.options.toolbar)+ pluginToolbar.forEach(toolbarItem => {+ if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {+ return+ }+ toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;+ })+ protyle.options.toolbar = toolbarKeyToMenu(pluginToolbar);});protyle.options.toolbar.forEach((menuItem: IMenuItem) => {const itemElement = this.genItem(protyle, menuItem);