mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 16:56:34 +01:00
moving components to its own directory
This commit is contained in:
19
src/public/app/components/shortcut_component.js
Normal file
19
src/public/app/components/shortcut_component.js
Normal file
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user