mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Return null for empty content, rather than adding a dummy block
This commit is contained in:
parent
e690e95503
commit
5928662b95
@ -85,8 +85,8 @@ class ContentstateConverter():
|
||||
self.html_to_contentstate_handler.feed(html)
|
||||
|
||||
if not self.html_to_contentstate_handler.contentstate.blocks:
|
||||
# add an empty paragraph block to make contentstate valid
|
||||
self.html_to_contentstate_handler.add_block(Block('unstyled', depth=0))
|
||||
# Draftail does not accept an empty block list as valid, but does accept 'null' as meaning "no content"
|
||||
return 'null'
|
||||
|
||||
return self.html_to_contentstate_handler.contentstate.as_json(indent=4, separators=(',', ': '))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user