Saved data validation
Let see what happens if we create several Blocks of Simple Image, left them empty and save the Editor:
saved data will be following:
To skip empty or wrongly filled Blocks we can provide
validate method. It will accept the saved Block's data returned by our
save method, check it for correctness and returns a
boolean value of validation result.
lets see what we got with saving now:
As you can see, all empty Image Blocks was skipped due to our validation method. You can add any validation logic here.
In the next guide we will consider how to change a Block view: when user pastes an URL, we will show the Image and Caption elements