Skip to content

Commit 3d91865

Browse files
fix(navigation): exit header/footer mode on bookmark navigation failure
1 parent ad808d1 commit 3d91865

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/super-editor/src/editors/v1/core/presentation-editor/PresentationEditor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6020,6 +6020,8 @@ export class PresentationEditor extends EventEmitter {
60206020

60216021
if (!this.#editor) return false;
60226022

6023+
let enteredHeaderFooter = false;
6024+
60236025
try {
60246026
if (story.storyType === 'headerFooterSlot' || story.storyType === 'headerFooterPart') {
60256027
const region = this.#findHeaderFooterRegionForStory(story);
@@ -6028,6 +6030,7 @@ export class PresentationEditor extends EventEmitter {
60286030
this.#scrollPageIntoView(region.pageIndex);
60296031
await this.#waitForPageMount(region.pageIndex, { timeout: PresentationEditor.ANCHOR_NAV_TIMEOUT_MS });
60306032
this.#activateHeaderFooterRegion(region);
6033+
enteredHeaderFooter = true;
60316034

60326035
const activeEditor = await this.#waitForHeaderFooterEditor(PresentationEditor.ANCHOR_NAV_TIMEOUT_MS);
60336036
if (!activeEditor?.commands?.setTextSelection) return false;
@@ -6047,6 +6050,7 @@ export class PresentationEditor extends EventEmitter {
60476050
runtime.editor.view?.focus?.();
60486051
return true;
60496052
} catch (error) {
6053+
if (enteredHeaderFooter) this.#exitHeaderFooterMode();
60506054
console.error('[PresentationEditor] navigateTo bookmark failed:', error);
60516055
this.emit('error', {
60526056
error,

0 commit comments

Comments
 (0)