-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Double-Clicking Node Jumps Cursor to Relevant Text (#634)
* Basic jump to line in editor * Move mobile tab state into zustand * Toggle tab if necessary before focusing
- Loading branch information
1 parent
8d823f6
commit af6b2f9
Showing
6 changed files
with
73 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { create } from "zustand"; | ||
import { persist } from "zustand/middleware"; | ||
|
||
export type MobileEditorTab = "text" | "graph"; | ||
|
||
export type MobileStore = { | ||
tab: MobileEditorTab; | ||
toggleTab: () => void; | ||
}; | ||
|
||
/** | ||
* Stores client-side state related to the editor. | ||
*/ | ||
export const useMobileStore = create<MobileStore>()( | ||
persist( | ||
(set) => ({ | ||
tab: "text", | ||
toggleTab: () => | ||
set((state) => ({ | ||
tab: state.tab === "text" ? "graph" : "text", | ||
})), | ||
}), | ||
{ | ||
name: "ff-mobile-store", | ||
} | ||
) | ||
); |