Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 336272a

Browse files
committed
fix default value for the text editor
1 parent 76d8ab9 commit 336272a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

draftjs-web/src/App.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ function App() {
7878
};
7979

8080
const setDefaultValue = html => {
81-
if (html) {
82-
setEditorState(stateFromHTML(html));
81+
try {
82+
if (html) {
83+
setEditorState(EditorState.createWithContent(stateFromHTML(html)));
84+
}
85+
} catch (e) {
86+
console.error(e);
8387
}
8488
};
8589

0 commit comments

Comments
 (0)