I am trying to write a validator that will check to see if the value is "<p></p>↵"... and if it is, display the required message. However, I can't seem to target the ↵ no matter what I try. I've tried to use trim() as well, but haven't had any luck.
export const isRichTextImageEditorRequired = (value) => value &&
(!/(\r\n|\n|\r)/.test(value) || isEmpty(value)) ?
'This field is required' : undefined;
try
if (convertToRaw(editorState.getCurrentContent()).blocks.length === 1 & convertToRaw(editorState.getCurrentContent()).blocks[0].text === '') {
console.log("field required"); }
this is case empty <p></p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With