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

Paragraph block can't be transform into Quote block #44452

Closed
fluiddot opened this issue Sep 26, 2022 · 3 comments · Fixed by #48792
Closed

Paragraph block can't be transform into Quote block #44452

fluiddot opened this issue Sep 26, 2022 · 3 comments · Fixed by #48792
Assignees
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@fluiddot
Copy link
Contributor

Description

The Paragraph block in the web version can be transformed into a Quote block, however, this option is not available in the native version.

Step-by-step reproduction instructions

  1. Add a Paragraph block.
  2. Type some text.
  3. Tap on the "..." button to open the block settings.
  4. Tap on "Transform block..." option.
  5. Observe that the option for Quote is not displayed.

Expected behaviour

The Paragraph block can be transformed into a Quote block.

Actual behaviour

The Paragraph block CAN'T be transformed into a Quote block.

Screenshots or screen recording (optional)

Web version Native version
Screenshot 2022-09-26 at 10 23 06

WordPress information

  • WordPress version: N/A
  • Gutenberg version: N/A
  • Are all plugins except Gutenberg deactivated? N/A
  • Are you using a default theme (e.g. Twenty Twenty-One)? N/A

Device information

  • Device: iPhone 11
  • Operating system: iOS 15.4.1
  • WordPress app version: WordPress-iOS 20.7.0.4
@fluiddot fluiddot added [Type] Bug An existing feature does not function as intended Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Priority] High Used to indicate top priority items that need quick attention labels Sep 26, 2022
@fluiddot
Copy link
Contributor Author

I debugged this issue and found that was introduced when Quote V2 was introduced, specifically when the transforms logic was updated due to using inner blocks (reference). In Quote V1, we had a from transform for core/paragraph block, now that block is transformed using the wildcard from transform:

{
type: 'block',
isMultiBlock: true,
blocks: [ '*' ],
isMatch: ( {}, blocks ) => {
// When a single block is selected make the tranformation
// available only to specific blocks that make sense.
if ( blocks.length === 1 ) {
return [
'core/paragraph',
'core/heading',
'core/list',
'core/pullquote',
].includes( blocks[ 0 ].name );
}
return ! blocks.some( ( { name } ) => name === 'core/quote' );
},
__experimentalConvert: ( blocks ) =>
createBlock(
'core/quote',
{},
blocks.map( ( block ) =>
createBlock(
block.name,
block.attributes,
block.innerBlocks
)
)
),
},

The problem is that when we introduced the block transformation feature in the native version, we explicitly disabled support for wildcard block transform (reference). Nevertheless, it's not clear to me why we decided to do this based on the original PR and issue 🤔.

I tried enabling support for wildcard block transform, by removing this part, and now I can transform the Paragraph block to the Quote block. However, this also enables other transformations like Paragraph block => Group block that were originally disabled. As far as I tested, all transformations work as expected and match the web version's behavior, so I'm wondering what exactly prevented us to enable all transformations ❓.

Following the original issue, I see some comments about not supporting all transformations (comment reference) because some of them could be confusing to the user (e.g. Paragraph block => Columns block). However, I haven't found any technical argument that discouraged enabling all transformations, apart from not including the blocks that are unsupported in the native version. Being this said, maybe this is good timing to enable all missing transformations to users, wdyt?

cc @iamthomasbishop as was involved in the original issue's discussion.

@SiobhyB
Copy link
Contributor

SiobhyB commented Sep 27, 2022

However, I haven't found any technical argument that discouraged enabling all transformations, apart from not including the blocks that are unsupported in the native version. Being this said, maybe this is good timing to enable all missing transformations to users, wdyt?

I agree that enabling the missing transformations seems like a good path, so that we're matched up to the web as closely as possible. I think users would expect the functionality to work the same across platforms.

If we feel that some transforms are illogical or confusing, I think it'd be best to open issues for wider community discussion, rather than diverging in the apps.

@fluiddot
Copy link
Contributor Author

I agree that enabling the missing transformations seems like a good path, so that we're matched up to the web as closely as possible. I think users would expect the functionality to work the same across platforms.

My only concern about this change is that we'd need to check all transform combinations in case there are any unsupported or lead to errors. Apart from this, I agree that this seems like a good path.

If we feel that some transforms are illogical or confusing, I think it'd be best to open issues for wider community discussion, rather than diverging in the apps.

Good point! I think we haven't reviewed the UX of transforming blocks since the original change was released. But definitely, if we identified some transform confusing we should open the discussion to the Gutenberg community and collect feedback there instead disabling the features in the app 👍 .

@fluiddot fluiddot self-assigned this Sep 28, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 6, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants