Skip to content

Commit

Permalink
persist menu state (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew authored Aug 21, 2023
1 parent a305173 commit e3a59fb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/prong-editor/src/lib/popover-menu/PopoverState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ export interface PopoverMenuState {
menuContents: MenuRow[];
hasProjectionContent: boolean;
}

export const popoverMenuState: PopoverMenuState = {
// menuState: "preFirstUse",
menuState: "monocleOpen",
// menuState: "preFirstUse","monocleOpen"
menuState:
(localStorage.getItem("popoverMenuState") as popOverSMState) ||
"monocleOpen",
targetNode: null,
highlightNode: null,
targetedTypings: [],
Expand Down Expand Up @@ -71,6 +74,7 @@ function handleSimpleUpdate(
didUpdate = true;
const newMenuState = PopoverStateMachine(state.menuState, effect.value);
newState = simpleSet("menuState", newMenuState, state);
localStorage.setItem("popoverMenuState", newState.menuState);
}
if (effect.is(setRouting)) {
didUpdate = true;
Expand Down

0 comments on commit e3a59fb

Please sign in to comment.