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

Consider allowing shortcode content to be imported as InnerBlocks #6020

Closed
greatislander opened this issue Apr 5, 2018 · 5 comments
Closed
Labels
Needs Testing Needs further testing to be confirmed. [Type] Enhancement A suggestion for improvement.

Comments

@greatislander
Copy link
Contributor

Issue Overview

A helpful addition to the block transform API would be the ability to convert the text content of a shortcode to InnerBlocks within a nested block.

As a generic example, given a shortcode like this:

[section]

Here is some inner content.

<ol>
  <li>List Item</li>
</ol>

[/section]

Converting to a section block (see #4900) could transform the shortcode’s content into inner blocks within the new section block.

Expected Behavior

There is a path for transforming shortcode content into InnerBlocks.

Current Behavior

Shortcode content (source: 'text') can only be used as an attribute, and as far as I can tell attributes cannot be used to populate InnerBlocks.

Possible Solution

A transform from object could support an innerBlocks property, like so:

transforms: {
	from: [
		{
			type: 'shortcode',
			tag: 'section',
			attributes: {
				...
			},
			innerBlocks: {
				type: 'array',
				source: 'text',
			},
		},
	],
},

The block transform API would then attempt to convert the shortcode content into blocks which would populate the new block's InnerBlocks.

Related Issues and/or PRs

@greatislander
Copy link
Contributor Author

May be fixed by #5932.

@danielbachhuber danielbachhuber added the [Type] Enhancement A suggestion for improvement. label Apr 10, 2018
@mtias mtias added the Needs Testing Needs further testing to be confirmed. label Jul 18, 2018
@mcsf
Copy link
Contributor

mcsf commented Jul 18, 2018

@greatislander, since 5932 was merged and some time has passed, what's the status of this?

@greatislander
Copy link
Contributor Author

@mcsf I will take a look and get back to you. Thanks.

@mtias
Copy link
Member

mtias commented Oct 7, 2018

Going to close this for now, please reopen if there's further information.

@mtias mtias closed this as completed Oct 7, 2018
@greatislander
Copy link
Contributor Author

As far as I can tell this is still not possible. I've checked current Block API docs, transforms docs, and looked through the block library. Can this be opened for reconsideration in a future release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Testing Needs further testing to be confirmed. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants