fakerpress icon indicating copy to clipboard operation
fakerpress copied to clipboard

Option for generating block editor-aware content

Open cbirdsong opened this issue 4 years ago • 3 comments

Fakerpress currently generates blocks of basic HTML, which show up in the block editor as "Classic Editor" blocks. It would be great if the content it generated was native to the block editor and used stock blocks and block options (align, color, drop cap, etc).

cbirdsong avatar May 13 '21 13:05 cbirdsong

I was hoping for this functionality too, but I also happen to know how difficult this would be to pull off. The PHP side of WordPress does not include any way to easily "render" blocks to the HTML format that is stored in the database. There are ways to get it to sort-of work using render_block(), but if you aren't feeding the results from parse_blocks() to it the output will often not work correctly. You can't just feed the function some expected block attributes and expect it to actually render the HTML. Currently the client-side JavaScript in the block editor is responsible for creating the commented HTML that is stored in the database. I'm not sure what the solution to this problem would be but it would future-proof this plugin tremendously.

cr0ybot avatar Sep 08 '24 20:09 cr0ybot

This is 100% in the roadmap. But I am waiting for Block Editor to be bit more stable on how certain blocks behave. So that we have a stable "API" for generating the randomness.

bordoni avatar Nov 05 '24 15:11 bordoni

This plugin converts classic content to blocks server-side, though I haven't dug into how it works: https://github.com/10up/convert-to-blocks

cbirdsong avatar Nov 05 '24 22:11 cbirdsong