Skip to content

Build your personal knowledge base with Trilium Notes

fixed & improved history navigation - context menu now indicates current, "future" and "past" items

zadamc3b44b9a917d
diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js
index efce7eee72..4bb696fb2f 100644
--- a/src/public/javascripts/services/entrypoints.js
+++ b/src/public/javascripts/services/entrypoints.js
@@ -136,11 +136,27 @@ export default class Entrypoints extends Component {
}
backInNoteHistoryCommand() {
- window.history.back();
+ if (utils.isElectron()) {
+ const webContents = require('electron').remote.getCurrentWebContents();
+ const activeIndex = parseInt(webContents.getActiveIndex());
+
+ webContents.goToIndex(activeIndex - 1);
+ }
+ else {
+ window.history.back();
+ }
}
forwardInNoteHistoryCommand() {
- window.history.forward();
+ if (utils.isElectron()) {
+ const webContents = require('electron').remote.getCurrentWebContents();
+ const activeIndex = parseInt(webContents.getActiveIndex());
+
+ webContents.goToIndex(activeIndex + 1);
+ }
+ else {
+ window.history.forward();
+ }
}
async searchForResultsCommand({searchText}) {
diff --git a/src/public/javascripts/widgets/history_navigation.js b/src/public/javascripts/widgets/history_navigation.js
index f939d1e06a..15c924620d 100644
--- a/src/public/javascripts/widgets/history_navigation.js
+++ b/src/public/javascripts/widgets/history_navigation.js
@@ -58,6 +58,8 @@ export default class HistoryNavigationWidget extends BasicWidget {
async showContextMenu(e) {
let items = [];
+ const activeIndex = this.webContents.getActiveIndex();
+
for (const idx in this.webContents.history) {
const url = this.webContents.history[idx];
const [_, notePathWithTab] = url.split('#');
@@ -68,7 +70,8 @@ export default class HistoryNavigationWidget extends BasicWidget {
items.push({
title,
idx,
- uiIcon: "empty"
+ uiIcon: idx == activeIndex ? "radio-circle-marked" : // compare with type coercion!
+ (idx < activeIndex ? "left-arrow-alt" : "right-arrow-alt")
});
}