This commit is contained in:
fantasticit 2022-07-14 22:43:11 +08:00
parent 7978fe1178
commit f28c4cc301
2 changed files with 4 additions and 1 deletions

View File

@ -136,7 +136,6 @@ export const DocumentExporter: React.FC<IProps> = ({ document, render }) => {
); );
useEffect(() => { useEffect(() => {
console.log('doc', editor, document);
const c = safeJSONParse(document && document.content); const c = safeJSONParse(document && document.content);
const json = c.default || c; const json = c.default || c;
editor.commands.setContent(json); editor.commands.setContent(json);

View File

@ -37,6 +37,10 @@ function fixNode(doc) {
}; };
} }
}); });
if (!node.content || !node.content.length) {
node.content = [{ attrs: {}, type: 'paragraph' }];
}
} }
if (node.content) { if (node.content) {