melishev / strapi-plugin-react-editorjs

📝 Plugin for Strapi Headless CMS, hiding the standard WYSIWYG editor on Editor.js
https://www.npmjs.com/package/strapi-plugin-react-editorjs
MIT License
171 stars 80 forks source link

hotfix: empty editor and required field fix when onChange event is triggered #59

Closed TunahanTuna closed 2 years ago

TunahanTuna commented 2 years ago

onChange event was not triggering when the editor was empty.

To solve this problem I changed the newData.blocks.lengthcondition to !newData.blocks.length

If condition is met, newData is made null.

I returned the newData unchanged in cases where this condition is not met.

So now we can trigger the onChange event when the editor is empty.

The newData = nullstatement can also provide control when text input is required.

melishev commented 2 years ago

:tada: This PR is included in version 2.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: