From de7248b7ce6cad2cff9354f13aa51edca3fd8a43 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 4 Jan 2025 22:43:51 +0200 Subject: [PATCH] feat(mobile): add back/forward buttons to launch bar --- .../app/widgets/buttons/history_navigation.js | 20 +++++++------------ src/services/hidden_subtree.ts | 8 +++++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/public/app/widgets/buttons/history_navigation.js b/src/public/app/widgets/buttons/history_navigation.js index 8347c0db6..bb320a84c 100644 --- a/src/public/app/widgets/buttons/history_navigation.js +++ b/src/public/app/widgets/buttons/history_navigation.js @@ -16,23 +16,17 @@ export default class HistoryNavigationButton extends ButtonFromNoteWidget { .class("launcher-button"); } - isEnabled() { - return super.isEnabled() && utils.isElectron(); - } - doRender() { super.doRender(); - if (!utils.isElectron()) { - return; + if (utils.isElectron()) { + this.webContents = utils.dynamicRequire('@electron/remote').getCurrentWebContents(); + + // without this, the history is preserved across frontend reloads + this.webContents.clearHistory(); + + this.refresh(); } - - this.webContents = utils.dynamicRequire('@electron/remote').getCurrentWebContents(); - - // without this, the history is preserved across frontend reloads - this.webContents.clearHistory(); - - this.refresh(); } async showContextMenu(e) { diff --git a/src/services/hidden_subtree.ts b/src/services/hidden_subtree.ts index a82b53235..740462111 100644 --- a/src/services/hidden_subtree.ts +++ b/src/services/hidden_subtree.ts @@ -277,7 +277,13 @@ function buildHiddenSubtreeDefinition(): Item { icon: 'bx-show', isExpanded: true, attributes: [ { type: 'label', name: 'docName', value: 'launchbar_intro' } ], - children: [] + children: [ + { id: '_lbMobileBackInHistory', title: t("hidden-subtree.go-to-previous-note-title"), type: 'launcher', builtinWidget: 'backInHistoryButton', icon: 'bx bxs-chevron-left', + attributes: [ { type: 'label', name: 'docName', value: 'launchbar_history_navigation' } ]}, + { id: '_lbMobileForwardInHistory', title: t("hidden-subtree.go-to-next-note-title"), type: 'launcher', builtinWidget: 'forwardInHistoryButton', icon: 'bx bxs-chevron-right', + attributes: [ { type: 'label', name: 'docName', value: 'launchbar_history_navigation' } ]}, + { id: '_lbMobileSpacerEnd', title: t("hidden-subtree.spacer-title"), type: 'launcher', builtinWidget: 'spacer', baseSize: "0", growthFactor: "1" }, + ] } ] },