From cfe399b4ff0edb0dc679dc646ea0b7b172330e7c Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Fri, 2 Apr 2021 00:46:45 +0300 Subject: [PATCH] set initial value --- editors/editoria/src/Editoria.js | 9 ++------- wax-prosemirror-core/src/Wax.js | 7 +++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/editors/editoria/src/Editoria.js b/editors/editoria/src/Editoria.js index f652c315b..148a228be 100644 --- a/editors/editoria/src/Editoria.js +++ b/editors/editoria/src/Editoria.js @@ -52,11 +52,6 @@ const Editoria = () => { key = 'editoriaMobile'; } - const initialValue = { - type: 'doc', - content: [], - }; - const EditoriaComponent = useMemo( () => ( <> @@ -67,11 +62,11 @@ const Editoria = () => { autoFocus placeholder="Type Something..." fileUpload={file => renderImage(file)} - value={initialValue} + value="" targetFormat="JSON" // readonly layout={layout} - onChange={source => console.log(source)} + // onChange={source => console.log(source)} user={user} /> </> diff --git a/wax-prosemirror-core/src/Wax.js b/wax-prosemirror-core/src/Wax.js index 396eaca1c..fc15ccd02 100644 --- a/wax-prosemirror-core/src/Wax.js +++ b/wax-prosemirror-core/src/Wax.js @@ -72,8 +72,6 @@ const Wax = props => { // const { schema } = application.schema; const WaxOnchange = onChange || (v => true); - const editorContent = value || ''; - finalPlugins = defaultPlugins.concat([ createPlaceholder(placeholder), ...application.getPlugins(), @@ -85,8 +83,13 @@ const Wax = props => { }; if (targetFormat === 'JSON') { + const editorContent = value || { + type: 'doc', + content: [], + }; WaxOptions.doc = schema.nodeFromJSON(editorContent); } else { + const editorContent = value || ''; const parse = parser(schema); WaxOptions.doc = parse(editorContent); } -- GitLab