Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bensonz committed Nov 15, 2023
1 parent b4526fc commit ad96d1b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/src/ui/editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ export default function Editor({
}
}, [editor, defaultValue, content, hydrated, disableLocalStorage]);

useEffect(() => {
if (!editor) return;
// update the editor content if the default value changes,
// since this editor is managed internally, need a way to update it.
editor.commands.setContent(defaultValue);
},[defaultValue]);

return (
<NovelContext.Provider
value={{
Expand Down

0 comments on commit ad96d1b

Please sign in to comment.