mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
20 lines
691 B
JavaScript
20 lines
691 B
JavaScript
import appContext from "./app_context.js";
|
|
import shortcutService from "../services/shortcuts.js";
|
|
import server from "../services/server.js";
|
|
import Component from "./component.js";
|
|
|
|
export default class ShortcutComponent extends Component {
|
|
constructor() {
|
|
server.get('keyboard-shortcuts-for-notes').then(shortcutAttributes => {
|
|
for (const attr in shortcutAttributes) {
|
|
bindNoteShortcutHandler(attr);
|
|
}
|
|
}
|
|
|
|
bindNoteShortcutHandler(attr) {
|
|
const handler = async () => appContext.tabManager.getActiveContext().setNote(attr.noteId);
|
|
|
|
shortcutService.bindGlobalShortcut(attr.value, handler, attr.attributeId);
|
|
}
|
|
}
|