slate editor constructor includes:
// Run `onChange` on the passed-in value because we need to ensure that it
// is normalized, and queue the resulting change.
const change = props.value.change()
stack.run('onChange', change, this)
this.queueChange(change)
this.state.value = change.value
While this is great in general, when dealing with big, complex documents, the normalization of the all document can be very long (a few seconds).
It would be awesome if we can add an option prop that disable the initial value validation/normalisation.
Obviously, in this case, the responsibility of ensuring the supplied value it valid moves to the developer.
Please let me know if you'll accept a PR with this feature.
Would definitely appreciate this option, as mentioned normalization can hang the browser window for a few seconds. If I can guarantee that the content was previously saved out of Slate then this step seems like it could be skipped for a better user experience.
I'm definitely open to this. I'm not sure exactly how to best implement it so that it's easy to have this option though...
This is supported now in the latest slate/slate-react with the { normalize: false } option to the Editor or <Editor>:
<Editor
options={{ normalize: false }}
/>
Is this documented anywhere on https://docs.slatejs.org/ I couldn't really find anything relevant when searching for "normalize".
Also, is there a utility function to normalize a document, ideally without a whole editor instance e.g. for passing a normalized document to the editor while normalize: false is set?
Most helpful comment
Is this documented anywhere on https://docs.slatejs.org/ I couldn't really find anything relevant when searching for "normalize".
Also, is there a utility function to normalize a document, ideally without a whole editor instance e.g. for passing a normalized document to the editor while
normalize: falseis set?