mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
cbad03815d
commit
bd89dd67e1
3 changed files with 58 additions and 2 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue