mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fixed history navigation buttons
This commit is contained in:
		| @@ -39,8 +39,6 @@ class NoteContext extends Component { | ||||
|     async setNote(inputNotePath, triggerSwitchEvent = true) { | ||||
|         const resolvedNotePath = await this.getResolvedNotePath(inputNotePath); | ||||
|  | ||||
|         console.log("EEEEEE", inputNotePath, resolvedNotePath); | ||||
|  | ||||
|         if (!resolvedNotePath) { | ||||
|             return; | ||||
|         } | ||||
|   | ||||
| @@ -87,5 +87,6 @@ export default class AbstractButtonWidget extends NoteContextAwareWidget { | ||||
|  | ||||
|     onContextMenu(handler) { | ||||
|         this.settings.onContextMenu = handler; | ||||
|         return this; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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)); | ||||
|     } | ||||
| } | ||||
| @@ -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)); | ||||
|     } | ||||
| } | ||||
| @@ -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(); | ||||
|     } | ||||
| @@ -3,14 +3,13 @@ import SpacerWidget from "../spacer.js"; | ||||
| import BookmarkButtons from "../bookmark_buttons.js"; | ||||
| import ProtectedSessionStatusWidget from "../buttons/protected_session_status.js"; | ||||
| import SyncStatusWidget from "../sync_status.js"; | ||||
| import BackInHistoryButtonWidget from "../buttons/history/history_back.js"; | ||||
| import ForwardInHistoryButtonWidget from "../buttons/history/history_forward.js"; | ||||
| import BasicWidget from "../basic_widget.js"; | ||||
| import NoteLauncher from "../buttons/launcher/note_launcher.js"; | ||||
| import ScriptLauncher from "../buttons/launcher/script_launcher.js"; | ||||
| import CommandButtonWidget from "../buttons/command_button.js"; | ||||
| import utils from "../../services/utils.js"; | ||||
| import TodayLauncher from "../buttons/launcher/today_launcher.js"; | ||||
| import HistoryNavigationButton from "../buttons/history_navigation.js"; | ||||
|  | ||||
| export default class LauncherWidget extends BasicWidget { | ||||
|     constructor() { | ||||
| @@ -66,8 +65,8 @@ export default class LauncherWidget extends BasicWidget { | ||||
|  | ||||
|     initCommandLauncherWidget(note) { | ||||
|         return new CommandButtonWidget() | ||||
|             .title(note.title) | ||||
|             .icon(note.getIcon()) | ||||
|             .title(() => note.title) | ||||
|             .icon(() => note.getIcon()) | ||||
|             .command(() => note.getLabelValue("command")); | ||||
|     } | ||||
|  | ||||
| @@ -99,9 +98,9 @@ export default class LauncherWidget extends BasicWidget { | ||||
|         } else if (builtinWidget === 'syncStatus') { | ||||
|             return new SyncStatusWidget(); | ||||
|         } else if (builtinWidget === 'backInHistoryButton') { | ||||
|             return new BackInHistoryButtonWidget(); | ||||
|             return new HistoryNavigationButton(note, "backInNoteHistory"); | ||||
|         } else if (builtinWidget === 'forwardInHistoryButton') { | ||||
|             return new ForwardInHistoryButtonWidget(); | ||||
|             return new HistoryNavigationButton(note, "forwardInNoteHistory"); | ||||
|         } else if (builtinWidget === 'todayInJournal') { | ||||
|             return new TodayLauncher(note); | ||||
|         } else { | ||||
|   | ||||
| @@ -167,8 +167,8 @@ const HIDDEN_SUBTREE_DEFINITION = { | ||||
|                     isExpanded: true, | ||||
|                     attributes: [ { type: 'label', name: 'docName', value: 'launchbar_intro' } ], | ||||
|                     children: [ | ||||
|                         { id: '_lbBackInHistory', title: 'Back in History', type: 'launcher', builtinWidget: 'backInHistoryButton', icon: 'bx bxs-left-arrow-square' }, | ||||
|                         { id: '_lbForwardInHistory', title: 'Forward in History', type: 'launcher', builtinWidget: 'forwardInHistoryButton', icon: 'bx bxs-right-arrow-square' }, | ||||
|                         { id: '_lbBackInHistory', title: 'Go to Previous Note', type: 'launcher', builtinWidget: 'backInHistoryButton', icon: 'bx bxs-left-arrow-square' }, | ||||
|                         { id: '_lbForwardInHistory', title: 'Go to Next Note', type: 'launcher', builtinWidget: 'forwardInHistoryButton', icon: 'bx bxs-right-arrow-square' }, | ||||
|                         { id: '_lbBackendLog', title: 'Backend Log', type: 'launcher', targetNoteId: '_backendLog', icon: 'bx bx-terminal' }, | ||||
|                     ] | ||||
|                 }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user