From 6bf65ccd2b95c2a5baeef535339acb81b2a56f69 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 8 May 2022 22:26:10 +0200 Subject: [PATCH] fix regression with editorjs: content not loaded --- CHANGELOG.md | 1 + src/core/Resources/assets/js/modules/editorjs.js | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcf9243..3f44a38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### Fixed * fix the mail notifier * fix sitemap: navigation with several domains +* fix regression with editorjs: content not loaded ## [1.14.1] - 2022-04-30 ### Added diff --git a/src/core/Resources/assets/js/modules/editorjs.js b/src/core/Resources/assets/js/modules/editorjs.js index b7fd984..cd9f331 100644 --- a/src/core/Resources/assets/js/modules/editorjs.js +++ b/src/core/Resources/assets/js/modules/editorjs.js @@ -147,21 +147,17 @@ const doInitEditor = () => { editorContainer.attr('id', id) element.hide() - let data = [] + let data = {time: null, blocks: []}; try { const value = JSON.parse(element.val()) - if (Array.isArray(value)) { + if (value.time && Array.isArray(value.blocks)) { data = value } } catch (e) { } - if (!Array.isArray(data)) { - data = [] - } - const editor = new EditorJS(buildConfiguration({ holder: id, data: data,