mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 16:55:50 +01:00
launchbar WIP
This commit is contained in:
42
src/public/app/widgets/containers/shortcut_container.js
Normal file
42
src/public/app/widgets/containers/shortcut_container.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import FlexContainer from "./flex_container.js";
|
||||
import froca from "../../services/froca.js";
|
||||
import ButtonWidget from "../buttons/button_widget.js";
|
||||
|
||||
export default class ShortcutContainer extends FlexContainer {
|
||||
constructor() {
|
||||
super('column');
|
||||
|
||||
this.id('shortcut-container');
|
||||
this.css('height', '100%');
|
||||
this.filling();
|
||||
|
||||
this.load();
|
||||
}
|
||||
|
||||
async load() {
|
||||
this.children = [];
|
||||
|
||||
const visibleShortcutsRoot = await froca.getNote('lb_visibleshortcuts');
|
||||
|
||||
console.log(await visibleShortcutsRoot.getChildNotes());
|
||||
|
||||
for (const shortcut of await visibleShortcutsRoot.getChildNotes()) {
|
||||
this.child(new ButtonWidget()
|
||||
.icon(shortcut.getLabelValue("iconClass"))
|
||||
.title(shortcut.title)
|
||||
.command(shortcut.getLabelValue("command")));
|
||||
}
|
||||
|
||||
this.$widget.empty();
|
||||
this.renderChildren();
|
||||
|
||||
this.handleEventInChildren('initialRenderComplete');
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({loadResults}) {
|
||||
if (loadResults.getNotes().find(note => note.noteId.startsWith("lb_"))
|
||||
|| loadResults.getBranches().find(branch => branch.branchId.startsWith("lb_"))) {
|
||||
this.load();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user