Closed loicteixeira closed 3 years ago
@loicteixeira I've done the work in Draftail (#40) and the exporter (#36) to support this, and updated those two here – will leave the Django changes to you if you have the time.
I have re-added a default value of {}
within this project (https://github.com/springload/wagtaildraftail/pull/42/commits/bb4b68ff9cd9c88985e58070b59184985afabe80) so that we can finish this later on.
Note that nothing needs to happen for the exporter, it will handle None
or {}
just the same.
Sorry I didn't get time to look into this before my break.
Basically, the block use a custom form field to handle the '{}'
string as empty.
Now that draftail
returns None
, this is not needed anymore. This can probably use the same formfield
as the parent class, so there is no need for the form and validator linked above in the issue.
FWIW, it looks like DraftailTextBlock
and DraftailTextField
don't use the same underlying form field and this should be updated to the same (but potentially removing the overwrite on the block should do the trick).
Currently, the default value is an empty dict which is basically an invalid content state. Therefore, the editor should return
None
which clearly state the lack of content.springload/draftail
dependency for this package.springload/draftjs_exporter
dependency for this package.