Conversation
Solution is based on `jsdom-jscore` to provide the DOM handler, plus some heavy mocking to workaround missing Node.js packages/modules.
|
In Gutenberg we import it using |
|
I need to setup everything locally and spend some time investigating |
|
Thanks for having a look @gziolo !
I did give it a try utilizing babel and the transformation steps in Metro but had no success in the time frame I devoted to it. To move things forward I resorted to the "prebuilt" grammar parser. Besides, we can always try again in the future, and we should to make sure the parser stays up-to-date.
Nice! Feel free to ping me to give a hand.
Good to know! Let's wait for the extra pass before we merge, after you try it locally. Thanks! 🙇 |
Fair enough, it's okey as a temporary solution, but we should try to bring it closer to what web does in the near future. I hope we will tackle it somehow as part of publishing |
Oh, you mean we cannot package and publish the |
Webpack does it atm, so not quite sure how this fits into the whole flow. Distribution files for packages are generated with Babel. |
|
Fixed conflicts with base branch with f8d875f. |
|
Testing steps:
|
|
Otherwise, everything looks and works as expected. Let's focus on bringing a compiled version of the parser inside Gutenberg. |
At gutenberg/blocks/api/post-grammar-parser-pre-generated.js
Done! Thanks for the review @gziolo , will merge now! |
This PR introduces the usage of the Gutenberg grammar + block attributes parser.
Instead of having the hardcoded blocks list be constructed by manually calling
createBlock(), this PR uses the GB Parser to construct the blocks from html snippets, just like those will be found on a real post.