import BasicWidget from "./basic_widget.js"; import utils from "../services/utils.js"; import keyboardActionService from "../services/keyboard_actions.js"; import contextMenu from "../services/context_menu.js"; import treeService from "../services/tree.js"; import appContext from "../services/app_context.js"; const TPL = `
`; export default class HistoryNavigationWidget extends BasicWidget { doRender() { if (utils.isElectron()) { this.$widget = $(TPL); const contextMenuHandler = e => { e.preventDefault(); if (this.webContents.history.length < 2) { return; } this.showContextMenu(e); }; this.$backInHistory = this.$widget.find("[data-trigger-command='backInNoteHistory']"); this.$backInHistory.on('contextmenu', contextMenuHandler); this.$forwardInHistory = this.$widget.find("[data-trigger-command='forwardInNoteHistory']"); this.$forwardInHistory.on('contextmenu', contextMenuHandler); const electron = utils.dynamicRequire('electron'); this.webContents = electron.remote.getCurrentWindow().webContents; // without this the history is preserved across frontend reloads this.webContents.clearHistory(); this.refresh(); } else { this.$widget = $("