documentatie

This commit is contained in:
2026-09-03 17:24:56 +02:00
parent e971dfe942
commit 42fcea9af8
14 changed files with 135 additions and 16 deletions
@@ -14,10 +14,12 @@ export class CmapNavigationController {
this.location = locationObject;
}
/** Open a stored CMap through the central hash-navigation contract. */
open(slug) {
return this.navigateToHash(this.cmapRoute(slug));
}
/** Remember the active separate-submap root before following a linked CMap. */
openLinked(record) {
if (!record?.cmapSlug) return false;
this.rememberContext();
@@ -25,6 +27,7 @@ export class CmapNavigationController {
return true;
}
/** Return to a source CMap when present, otherwise leave one inline submap level. */
openParent() {
const source = this.getParentMap();
if (source?.slug) {
@@ -39,6 +42,7 @@ export class CmapNavigationController {
return this.storage.requestTransition(action);
}
/** Store the active separate-submap context in the current browser history entry. */
rememberContext() {
const editor = this.getEditor();
const current = this.getCurrentMap();
@@ -50,6 +54,10 @@ export class CmapNavigationController {
} }, "", this.location.href);
}
/**
* Restore a remembered separate-submap root after browser navigation.
* post : A consumed context is removed from history state to prevent repeated restoration.
*/
async restoreContext(slug) {
const context = this.history.state?.cmapContext;
if (!context || context.mapSlug !== slug) return false;