-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown block proof of concept #109
Comments
Looking good @etoledom 🎉 The only thing I'm "tripping" over is the |
@hypest , the What I did was just to port it to mobile. Unless I misunderstood you? 🙄 |
I understood that as a sign of creating a new block type, instead of nativizing (that's what I refer to as porting, sorry if it wasn't clear) an already implemented one on the web. |
Right, sorry! I see how that can be confusing. I just edited that part of the text to avoid confusion in futures references :)
|
…-version Update AztecEditor-iOS dependency as 1.4.1
My impression is that this ticket/exploration is not relevant anymore but, can you confirm @etoledom? We can close it if so. |
Yes, most of this is already outdated. Still we would need to set the freeform content handler to handle raw html at some point. 👍 |
I've been playing around with displaying unknown/unsupported blocks from an html source and I made it work. This is no more than a proof of concept and is quite badly coded, so I'm not sending a PR just yet. 😆
All my next statements are based on what I "think" and have learned so far, but of course they can be completely wrong, please help me with that!
Expected behavior
By inspecting the web version, the
freeform
block is used for unknown types (setUnknownTypeHandlerName( freeform.name );
), beingfreeform
the classic editor.This handle raw html or anything that is not a registered Gutenberg block.
Based on that, we could rethink the expected behavior in this way:
Aztec
based block (our version of "classic editor").To achieve this, we can follow this steps:
Freeform
block from web into mobile, as an Aztec based block (just like theparagraph
block).Freeform
block withsetUnknownTypeHandlerName
.Freeform
block will display content that "seems to be" a Gutenberg block, and show the "unknown" UI instead.In this way we don't need to register a new
Unknown
block (at least not yet), and we follow closely how the web version is implemented.For the first and second steps requite sending a PR to
gutenberg
. Since the second step is really simple, I'd send both together.The last step feels a bit "hacky", but it's quite a simple way to get the expected behavior without loosing the block data, and easily converting from html to blocks and vice versa.
Q: Why not to use the paragraph block instead of declaring a new Aztec based block?
A: Because it mess up the real
paragraph
blocks, making the system think that they areunknown
.Q: How did you declared the Freeform block?
A: It was a copy-paste from
paragraph/edit.native.js
tofreeform/edit.native.js
. I'm sure there's a better way 😆This is how it looks when parsing raw html (it is represented as a
freeform
block)This is loading and unknown Gutenberg block, it shows a custom UI.
The text was updated successfully, but these errors were encountered: