Emptying editor does not allow "Save" and leaves artifacts.
If an editor field is used once, it cannot be returned to NULL or "".
If all content is deleted from the field, Save does not light up. And if edits are made elsewhere to bring up Save, that empty field does not save. The text from the prior state will still be there, rather than "" or NULL.
The only way to empty a field is to directly edit the database.
I got the same issue, if i remove everything, the last block will be kept
Original
Remove everything
Press save and reload
Some times i will keep line 1, sometime it will keep more
Dunno if this will solve all the issues mentioned above, but I got it to save in an empty state by removing if (newData.blocks.length) {} from admin/src/components/editorjs (line 54 in my fork of the repo). Not entirely sure why that if statement is there to begin with, but hope this helps someone.
Dunno if this will solve all the issues mentioned above, but I got it to save in an empty state by removing
if (newData.blocks.length) {}from admin/src/components/editorjs (line 54 in my fork of the repo). Not entirely sure why that if statement is there to begin with, but hope this helps someone.
Thanks,
I found this PR can fix the issue https://github.com/melishev/strapi-plugin-react-editorjs/pull/41
Hey i already fixed this in my PR. Please merge it, im already using in production :)
https://github.com/melishev/strapi-plugin-react-editorjs/pull/41
I thought the check for blocks was not needed, just forward the change event and resave
onChange={(api) => {
api.saver.save().then((res) => {
onChange({target: {name, value: JSON.stringify(res)}});
});
}}
For more info test the PR info for the following usecase
- Can you save if you have content then remove it all, then resave?
@melishev Could you accept this PR, ill have some time soon to complete dark mode
#41 this branch really works but it needed a minor fix.
If the text field is a required field, it should have given a "required field" warning when the text is deleted.
#59 With the fix I made here, we can overcome this problem without any problems.
#41 this branch really works but it needed a minor fix.
If the text field is a required field, it should have given a "required field" warning when the text is deleted.
#59 With the fix I made here, we can overcome this problem without any problems.
Any advance on this?