Skip to content
Snippets Groups Projects
Commit cfe399b4 authored by chris's avatar chris
Browse files

set initial value

parent 62c37b20
No related branches found
No related tags found
1 merge request!289Pm node views portals
...@@ -52,11 +52,6 @@ const Editoria = () => { ...@@ -52,11 +52,6 @@ const Editoria = () => {
key = 'editoriaMobile'; key = 'editoriaMobile';
} }
const initialValue = {
type: 'doc',
content: [],
};
const EditoriaComponent = useMemo( const EditoriaComponent = useMemo(
() => ( () => (
<> <>
...@@ -67,11 +62,11 @@ const Editoria = () => { ...@@ -67,11 +62,11 @@ const Editoria = () => {
autoFocus autoFocus
placeholder="Type Something..." placeholder="Type Something..."
fileUpload={file => renderImage(file)} fileUpload={file => renderImage(file)}
value={initialValue} value=""
targetFormat="JSON" targetFormat="JSON"
// readonly // readonly
layout={layout} layout={layout}
onChange={source => console.log(source)} // onChange={source => console.log(source)}
user={user} user={user}
/> />
</> </>
......
...@@ -72,8 +72,6 @@ const Wax = props => { ...@@ -72,8 +72,6 @@ const Wax = props => {
// const { schema } = application.schema; // const { schema } = application.schema;
const WaxOnchange = onChange || (v => true); const WaxOnchange = onChange || (v => true);
const editorContent = value || '';
finalPlugins = defaultPlugins.concat([ finalPlugins = defaultPlugins.concat([
createPlaceholder(placeholder), createPlaceholder(placeholder),
...application.getPlugins(), ...application.getPlugins(),
...@@ -85,8 +83,13 @@ const Wax = props => { ...@@ -85,8 +83,13 @@ const Wax = props => {
}; };
if (targetFormat === 'JSON') { if (targetFormat === 'JSON') {
const editorContent = value || {
type: 'doc',
content: [],
};
WaxOptions.doc = schema.nodeFromJSON(editorContent); WaxOptions.doc = schema.nodeFromJSON(editorContent);
} else { } else {
const editorContent = value || '';
const parse = parser(schema); const parse = parser(schema);
WaxOptions.doc = parse(editorContent); WaxOptions.doc = parse(editorContent);
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment