Skip to content

Commit

Permalink
feat: added validation for slate-blocks in FormValidation
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Oct 18, 2023
1 parent d7e4589 commit dc54b1c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/helpers/FormValidation/FormValidationHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const customValidationMessages = defineMessages({
export const blocksFieldIsEmpty = (field) => {
return (
filter(field?.blocks, (block) => {
if (block?.['@type'] === 'slate') {
return !!block?.plaintext?.trim()?.length;
}
if (block?.['@type'] === 'text') {
return !!block?.text?.blocks?.filter((block) => !!block.text.trim())
?.length;
Expand Down

0 comments on commit dc54b1c

Please sign in to comment.