Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Blocks] Preserve source markup in invalid blocks
Previously we have been re-generating a block's save content when we fail to properly validate that block. While this can work in many cases it breaks down quickly because of the invalidly-parsed attributes. Consider a list block whose `<ul>` tag has been removed. The block will fail to validate and then also fail to read the content of the list items because the CSS selector used to source the attribute won't work. The attribute for the list's content will be empty and `getSaveContent` will return an empty list, this despite the fact that the contents were largely fine in the post HTML when loaded. In this patch we're threading a new property into the block node called `sourceMarkup` whose purpose is to preserve the original HTML in a post so that we can choose to preserve that on save instead of corrupting or losing content through the HTML re-generation. With `sourceMarkup` we get a less-processed version of the source to relay into save which should eliminate a common point of frustration: saving a post erases content.
- Loading branch information