WIP updates to RichText

This commit is contained in:
Jarrod Flesch
2020-06-10 16:40:02 -04:00
parent 4c7be4d8f7
commit 25b3795cbb
56 changed files with 806 additions and 1251 deletions

View File

@@ -62,7 +62,13 @@ const optionsToValidatorMap = {
return Boolean(value);
},
richText: (value) => {
if (value) return true;
//! Need better way to share an empty text node
//! it is used here and in field-types/RichText
const emptyRichTextNode = [{
children: [{ text: '' }],
}];
const blankSlateJSNode = JSON.stringify(emptyRichTextNode);
if (value && JSON.stringify(value) !== blankSlateJSNode) return true;
return 'This field is required.';
},
code: (value) => {