Unable to change content of Slate component when providing new initialValue, editor content remains same as it was #5645
Unanswered
VatsalDave2102
asked this question in
Q&A
Replies: 1 comment 2 replies
-
initialValue is the value that you use at initialisation of your slate instance. You need to use the onChange event to store the modifications. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Im trying to make a text editor app in which user can have multiple editors like notion, i have made the text editor using Slate.js, React, TypeScript. Currently I only have one editor and im storing it's content in localStorage.
I have also implemented a sidebar which displays editors, when user selects any editor, the currentEditor state changes but the content in Slate editor does not change. Although the title gets changed which means
currentEditor
state is changing but im unable to change content of editor even after passing new editor's value.Earlier i was using a custom hook. Now i have shifted to Redux Toolkit to manage editors.
Attaching my code for reference:
App.tsx
:Editor.tsx
:NavigationSidebar.tsx
:editorSlice
reducers:I want to know that do we have to initialize a new slate editor every time the user changes or only change the editor's
initialValue
prop by passingcurrentEditor.value
or do we have to use routing to change theinitialValue
ofSlate
. Also, can anyone make me understand why this is not working?Beta Was this translation helpful? Give feedback.
All reactions