You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An embeddable link used after a list gets rendered as a paragraph rather than getting embedded. In the code below, the first embed is rendered as a paragraph, the second one is rendered correctly as an iframe.
It seems that the way List blocks are implemented the list stays open while the parser looks for list items, the logic in the Embed block's tryStart fails because it checks if it is in a Document block, which it isn't (the List block is still open) so it will get identified as a Paragraph block instead.
Great catch! You're right, that List block is open during the tryStart() method and only gets closed afterward, when we try to add the newly-parsed child to an open block. This means we can't accurately determine what block the Embed will get added to during the tryStart() method.
Furthermore, the decision of whether a parent block should contain a child block is intended to be decided by the parent, not the child. This complicates things because unlike every other block, Embed is only intended to work at the root level of the Document.
We could check whether the parent is either a Document (which we want) or a ListBlock (which we know won't accept the Embed as a child), but relying on assumed behavior of ListBlock feels like too much of a hack.
Instead, I think it would be better to allow the Embed to be parsed regardless of the parent container and then leverage our EmbedProcessor to replace it with a Paragraph if the parent block isn't the Document. This would avoid any hacks since processors always have an accurate picture of which block is the parent.
Version(s) affected
2.3.3
Description
An embeddable link used after a list gets rendered as a paragraph rather than getting embedded. In the code below, the first embed is rendered as a paragraph, the second one is rendered correctly as an iframe.
How to reproduce
The text was updated successfully, but these errors were encountered: