We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1bd9750 commit 01fc2e5Copy full SHA for 01fc2e5
angular-draft-js/draft-js.component.ts
@@ -52,12 +52,16 @@ export class DraftHtmlBase extends DraftBase {
52
53
const blocksFromHTML = convertFromHTML(html);
54
55
- if (!blocksFromHTML) { return emptyState; }
+ let contentBlocks, entityMap;
56
57
- const state = ContentState.createFromBlockArray(
58
- blocksFromHTML.contentBlocks,
59
- blocksFromHTML.entityMap,
60
- );
+ try {
+ contentBlocks = blocksFromHTML.contentBlocks;
+ entityMap = blocksFromHTML.entityMap;
+ } catch (e) {
61
+ return emptyState;
62
+ }
63
+
64
+ const state = ContentState.createFromBlockArray(contentBlocks, entityMap);
65
return EditorState.createWithContent(state, this.editorProps.decorator);
66
}
67
0 commit comments