Skip to content
Permalink
Browse files
  • Loading branch information
pjeby committed May 20, 2021
1 parent 42af29a commit e8063c1ea7b24f0ede602163f24610aa988f7731
Showing with 25 additions and 5 deletions.
  1. +12 −2 main.js
  2. +1 −1 manifest.json
  3. +11 −1 src/History.js
  4. +1 −1 versions.json
14 main.js

Large diffs are not rendered by default.

@@ -1,7 +1,7 @@
{
"id": "pane-relief",
"name": "Pane Relief",
"version": "0.0.4",
"version": "0.0.5",
"minAppVersion": "0.11.13",
"description": "Per-pane history, hotkeys for pane movement + navigation, and more",
"author": "PJ Eby",
@@ -52,7 +52,15 @@ class History {
}
}

replaceState(state, title, url){ this.stack[this.pos] = state; }
replaceState(state, title, url){
const old = this.stack[this.pos];
if (old?.state && state.state !== old.state && fileOf(old) !== fileOf(state)) {
// replaceState was erroneously called with a new file for the same leaf;
// force a pushState instead (fixes the issue reported here: https://forum.obsidian.md/t/18518)
return this.pushState(state, title, url);
}
this.stack[this.pos] = state;
}

pushState(state, title, url) {
this.stack.splice(0, this.pos, state);
@@ -62,6 +70,8 @@ class History {
}
}

function fileOf(stateObj) { return JSON.parse(stateObj).state?.file; }

export function installHistory(plugin) {

const app = plugin.app;
@@ -1,4 +1,4 @@
{
"0.0.4": "0.11.13",
"0.0.5": "0.11.13",
"0.0.3": "0.11.3"
}

0 comments on commit e8063c1

Please sign in to comment.