| | |
| | | |
| | | type NoteEditorContextProviderProps = { |
| | | value: string |
| | | children: React.JSX.Element | string | (React.JSX.Element | string)[] |
| | | children: JSX.Element | string | (JSX.Element | string)[] |
| | | } |
| | | export const NoteEditorContextProvider = memo(({ |
| | | value, |
| | | children, |
| | | }: NoteEditorContextProviderProps) => { |
| | | const storeRef = useRef<NoteEditorStore | undefined>(undefined) |
| | | const storeRef = useRef<NoteEditorStore>() |
| | | |
| | | if (!storeRef.current) |
| | | storeRef.current = createNoteEditorStore() |
| | |
| | | try { |
| | | initialValue = JSON.parse(value) |
| | | } |
| | | catch { |
| | | catch (e) { |
| | | |
| | | } |
| | | |