Open
Description
openedon Jul 31, 2024
Let's slowly try to auto convert classic content to blocks.
Ideas from @mtias: let's start small, don't do it for post types without revisions, maybe opt-in for non-exact conversions.
To do list:
- Auto convert a post on load if it meets the following conditions: (I think some work from Freeform: autoconvert on mount (opt-in) #62442 could be reused)
- The whole post is freeform (no blocks present)
- The post supports revisions
- The resulting blocks (excluding block delimiters) matches with the original content exactly. We could use the existing
isEquivalentHTML
to compare the content without whitespace.
- See what content fails and improve the raw handler. For example:
- Match
div
elements togroup
(use a raw transform in block.json). Maybe even include other tags because the group block supports a custom tag name. Also match class name etc. - Store other kinds of attributes present on other blocks such as
id
on a paragraph etc. - Improve rich text content handling (there are existing PRs such as Convert to blocks: upgrade and remove spans if possible #62659, Raw handling: fix too aggressive indented list removal #62622, Raw handling: preserve class #60331, Raw handling: preserve empty paragraphs #59476). I think @saulyz has a lot more cases that need to be resolved.
- The philosophy of the raw handler is to preserve content as well as possible (except for useless things such as spans without attributes). This is in contract to the paste handler, where we only want to preserve semantic content.
- Match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment