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

fix onChange

parent f89c7012
No related branches found
No related tags found
1 merge request!430Hhmi issues
...@@ -48,16 +48,16 @@ const Wax = forwardRef((props, ref) => { ...@@ -48,16 +48,16 @@ const Wax = forwardRef((props, ref) => {
} = props; } = props;
if (!application) return null; if (!application) return null;
const WaxOnchange = onChange || (v => true);
const finalOnChange = content => { const finalOnChange = content => {
if (!onChange) return;
const { schema } = application.schema; const { schema } = application.schema;
helpers.alterNotesSchema(schema); helpers.alterNotesSchema(schema);
if (targetFormat === 'JSON') { if (targetFormat === 'JSON') {
WaxOnchange(content); onChange(content);
} else { } else {
const serialize = serializer(schema); const serialize = serializer(schema);
WaxOnchange(serialize(content)); onChange(serialize(content));
} }
helpers.revertNotesSchema(schema); helpers.revertNotesSchema(schema);
}; };
...@@ -74,7 +74,7 @@ const Wax = forwardRef((props, ref) => { ...@@ -74,7 +74,7 @@ const Wax = forwardRef((props, ref) => {
customValues={customValues} customValues={customValues}
debug={debug} debug={debug}
fileUpload={fileUpload} fileUpload={fileUpload}
onChange={finalOnChange || (v => true)} onChange={finalOnChange || (() => true)}
placeholder={placeholder} placeholder={placeholder}
readonly={readonly} readonly={readonly}
ref={ref} ref={ref}
......
...@@ -156,7 +156,6 @@ const WaxView = forwardRef((props, ref) => { ...@@ -156,7 +156,6 @@ const WaxView = forwardRef((props, ref) => {
const docContent = const docContent =
targetFormat === 'JSON' ? state.doc.toJSON() : state.doc.content; targetFormat === 'JSON' ? state.doc.toJSON() : state.doc.content;
if (!previousDoc.eq(view.state.doc) || tr.getMeta('forceUpdate')) if (!previousDoc.eq(view.state.doc) || tr.getMeta('forceUpdate'))
props.onChange(docContent); props.onChange(docContent);
}; };
......
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