fixed history navigation buttons

This commit is contained in:
zadam
2022-12-23 20:17:04 +01:00
parent e1d20b8ff8
commit e5e0add1a2
7 changed files with 25 additions and 43 deletions

View File

@@ -87,5 +87,6 @@ export default class AbstractButtonWidget extends NoteContextAwareWidget {
onContextMenu(handler) {
this.settings.onContextMenu = handler;
return this;
}
}

View File

@@ -1,14 +0,0 @@
import AbstractHistoryNavigationWidget from "./abstract_history.js";
export default class BackInHistoryButtonWidget extends AbstractHistoryNavigationWidget {
constructor() {
super();
this.icon('bx-left-arrow-circle')
.title("Go to previous note.")
.command("backInNoteHistory")
.titlePlacement("right")
.buttonNoteIdProvider(() => 'lbBackInHistory')
.onContextMenu(e => this.showContextMenu(e));
}
}

View File

@@ -1,14 +0,0 @@
import AbstractHistoryNavigationWidget from "./abstract_history.js";
export default class ForwardInHistoryButtonWidget extends AbstractHistoryNavigationWidget {
constructor() {
super();
this.icon('bx-left-arrow-circle')
.title("Go to next note.")
.command("forwardInNoteHistory")
.titlePlacement("right")
.buttonNoteIdProvider(() => 'lbForwardInHistory')
.onContextMenu(e => this.showContextMenu(e));
}
}

View File

@@ -1,9 +1,21 @@
import utils from "../../../services/utils.js";
import contextMenu from "../../../menus/context_menu.js";
import treeService from "../../../services/tree.js";
import ButtonFromNoteWidget from "../button_from_note.js";
import utils from "../../services/utils.js";
import contextMenu from "../../menus/context_menu.js";
import treeService from "../../services/tree.js";
import ButtonFromNoteWidget from "./button_from_note.js";
export default class HistoryNavigationButton extends ButtonFromNoteWidget {
constructor(launcherNote, command) {
super();
this.title(() => launcherNote.title)
.icon(() => launcherNote.getIcon())
.command(() => command)
.titlePlacement("right")
.buttonNoteIdProvider(() => launcherNote.noteId)
.onContextMenu(e => this.showContextMenu(e))
.class("launcher-button");
}
export default class AbstractHistoryNavigationWidget extends ButtonFromNoteWidget {
isEnabled() {
return super.isEnabled() && utils.isElectron();
}