diff --git a/front/src/components/Write/PreviewPaged.jsx b/front/src/components/Write/PreviewPaged.jsx index e5506caef..e0aa6465f 100644 --- a/front/src/components/Write/PreviewPaged.jsx +++ b/front/src/components/Write/PreviewPaged.jsx @@ -19,7 +19,7 @@ export default function Preview ({ preview, yaml }) { useEffect(() => { if (html && isLoading) { - const [metadata] = YAML.loadAll(yaml) + const [metadata = {}] = YAML.loadAll(yaml) const render = compileTemplate(template) const base64Stylesheet = `data:text/css;base64,${btoa(stylesheet)}` diff --git a/front/src/components/Write/yamleditor/YamlEditor.jsx b/front/src/components/Write/yamleditor/YamlEditor.jsx index 2cce60ed7..c3fa7e899 100644 --- a/front/src/components/Write/yamleditor/YamlEditor.jsx +++ b/front/src/components/Write/yamleditor/YamlEditor.jsx @@ -3,7 +3,7 @@ import Form from '../../Form' import YAML from 'js-yaml' export default function YamlEditor ({ yaml, basicMode, onChange }) { - const [parsed] = YAML.loadAll(yaml) + const [parsed = {}] = YAML.loadAll(yaml) // we convert YYYY/MM/DD dates into ISO YYYY-MM-DD if (parsed.date) {