getting rid of attributes like data-note-path in favor of the whole nav state in URLs

This commit is contained in:
zadam
2023-05-07 21:18:21 +02:00
parent 291f0e79d9
commit f85209a72f
16 changed files with 96 additions and 133 deletions

View File

@@ -9,6 +9,7 @@ import TabManager from "./tab_manager.js";
import treeService from "../services/tree.js";
import Component from "./component.js";
import keyboardActionsService from "../services/keyboard_actions.js";
import linkService from "../services/link.js";
import MobileScreenSwitcherExecutor from "./mobile_screen_switcher.js";
import MainTreeExecutors from "./main_tree_executors.js";
import toast from "../services/toast.js";
@@ -158,14 +159,9 @@ $(window).on('beforeunload', () => {
});
$(window).on('hashchange', function() {
if (treeService.isNotePathInAddress()) {
const {notePath, ntxId, viewScope} = treeService.parseNavigationStateFromAddress();
if (!notePath && !ntxId) {
console.log(`Invalid hash value "${document.location.hash}", ignoring.`);
return;
}
const {notePath, ntxId, viewScope} = linkService.parseNavigationStateFromUrl(window.location.href);
if (notePath || ntxId) {
appContext.tabManager.switchToNoteContext(ntxId, notePath, viewScope);
}
});