mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixed & improved history navigation - context menu now indicates current, "future" and "past" items
This commit is contained in:
parent
8a9875ecfa
commit
c3b44b9a91
@ -136,12 +136,28 @@ export default class Entrypoints extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
backInNoteHistoryCommand() {
|
backInNoteHistoryCommand() {
|
||||||
|
if (utils.isElectron()) {
|
||||||
|
const webContents = require('electron').remote.getCurrentWebContents();
|
||||||
|
const activeIndex = parseInt(webContents.getActiveIndex());
|
||||||
|
|
||||||
|
webContents.goToIndex(activeIndex - 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
forwardInNoteHistoryCommand() {
|
forwardInNoteHistoryCommand() {
|
||||||
|
if (utils.isElectron()) {
|
||||||
|
const webContents = require('electron').remote.getCurrentWebContents();
|
||||||
|
const activeIndex = parseInt(webContents.getActiveIndex());
|
||||||
|
|
||||||
|
webContents.goToIndex(activeIndex + 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
window.history.forward();
|
window.history.forward();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async searchForResultsCommand({searchText}) {
|
async searchForResultsCommand({searchText}) {
|
||||||
const response = await server.get('search/' + encodeURIComponent(searchText));
|
const response = await server.get('search/' + encodeURIComponent(searchText));
|
||||||
|
@ -58,6 +58,8 @@ export default class HistoryNavigationWidget extends BasicWidget {
|
|||||||
async showContextMenu(e) {
|
async showContextMenu(e) {
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
|
const activeIndex = this.webContents.getActiveIndex();
|
||||||
|
|
||||||
for (const idx in this.webContents.history) {
|
for (const idx in this.webContents.history) {
|
||||||
const url = this.webContents.history[idx];
|
const url = this.webContents.history[idx];
|
||||||
const [_, notePathWithTab] = url.split('#');
|
const [_, notePathWithTab] = url.split('#');
|
||||||
@ -68,7 +70,8 @@ export default class HistoryNavigationWidget extends BasicWidget {
|
|||||||
items.push({
|
items.push({
|
||||||
title,
|
title,
|
||||||
idx,
|
idx,
|
||||||
uiIcon: "empty"
|
uiIcon: idx == activeIndex ? "radio-circle-marked" : // compare with type coercion!
|
||||||
|
(idx < activeIndex ? "left-arrow-alt" : "right-arrow-alt")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user