Repository navigation
Apply keyboard shortcut conversions between paragraphs and headings to all editor instances - #47972
Conversation
| name: `core/block-editor/transform-heading-to-paragraph`, | ||
| name: `core/edit-post/transform-heading-to-paragraph`, |
There was a problem hiding this comment.
I think the namespace should be unified.
|
Size Change: +1.01 kB (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
| const textAlign = | ||
| blockName === 'core/paragraph' ? 'align' : 'textAlign'; | ||
| const destinationTextAlign = | ||
| destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign'; | ||
|
|
||
| replaceBlocks( | ||
| currentClientId, | ||
| createBlock( destinationBlockName, { | ||
| level, | ||
| content: currentContent, | ||
| align: currentAlign, | ||
| content: attributes.content, | ||
| ...{ [ destinationTextAlign ]: attributes[ textAlign ] }, |
There was a problem hiding this comment.
Heading block and paragraph block have different property name for text alignment:
- Heading Block:
textAlign - Paragraph Block:
align
Therefore, property name and value must be properly mapped.
|
Flaky tests detected in f7e0a41. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4229265049
|
…o all editor instances
33cfa17 to
54dff7d
Compare
af6efee to
2c8ea0b
Compare
draganescu
left a comment
There was a problem hiding this comment.
I think this is a great default functionality to have across all editors. Its kinda weird that it has to be spelled out three different times but 🤷🏻
Follow-up on: #44681
What?
This PR adds conversion keyboard shortcuts between paragraphs and headings to all editors, in addition to the post editor.
How?
In addition to adding shortcuts, the following actions have been taken:
Testing Instructions
In the post/edit-site/edit-widgets/customize-widgets, check the following: