Skip to content
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

Add Block Transform to transform Embed blocks into Paragraph blocks. #17413


Copy link

commented Sep 12, 2019


Fixes #15102 by providing a block transform to transform Embeds into Paragraphs.

Ref: #15102 (comment)

How has this been tested?

Pasting a URL into the Paragraph block automatically converts into an Embed blocks. After that, now, I'm able to transform the same Embed block into a Paragraph block. Performing an Undo action brings the Embed block back.

While working on this, I found a bug that none of the transformations of core/embed block were applied to core-embed/common/* and core-embed/others/* blocks. So I've fixed that as well.


Types of changes

While converting the Embed into Paragraph, if the caption is present, then I'm using that as the text for the link in the Paragraph. That seemed like a sensible behaviour without the data loss for the user. Happy to defer on someone who's more close to this.


  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
} );
} ],

This comment has been minimized.

Copy link

desaiuditd Sep 12, 2019

Author Contributor

Not sure if this is a breaking change or not. Simply changed the schema of JSON to make it consistent with other transforms.

Same for Speaker Deck block.

transforms: {
from: concat( get( transforms, 'from', [] ), get( embedSettings, 'transforms.from', [] ) ).filter( Boolean ),
to: concat( get( transforms, 'to', [] ), get( embedSettings, '', [] ) ).filter( Boolean ),

This comment has been minimized.

Copy link

desaiuditd Sep 12, 2019

Author Contributor

Basically, apply combined transformations of core/embed as well as other core-embed/common/*

Same for core-embed/other/*

@desaiuditd desaiuditd requested review from gziolo, nerrad and ntwb as code owners Sep 12, 2019

desaiuditd added 2 commits Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.