-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
List/quote: unwrap inner block when pressing Backspace at start #45075
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createBlock } from '@wordpress/blocks'; | ||
|
||
const transforms = { | ||
to: [ | ||
{ | ||
type: 'block', | ||
blocks: [ 'core/paragraph' ], | ||
transform: ( attributes ) => | ||
createBlock( 'core/paragraph', attributes ), | ||
}, | ||
], | ||
}; | ||
|
||
export default transforms; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,17 +114,6 @@ const transforms = { | |
); | ||
}, | ||
} ) ), | ||
{ | ||
type: 'block', | ||
blocks: [ '*' ], | ||
transform: ( _attributes, childBlocks ) => { | ||
return getListContentFlat( childBlocks ).map( ( content ) => | ||
createBlock( 'core/paragraph', { | ||
content, | ||
} ) | ||
); | ||
}, | ||
}, | ||
Comment on lines
-117
to
-127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking my assumptions here: this bit that we removed — i.e. the Unwrap transform — was functionally equivalent to the Transform to Paragraph transform, right? So we don't lose anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it was a hackier way of doing list item to paragraph. It wasn't great because '*' should mean unwrap, while this is unwrapping and converting it to paragraphs. |
||
], | ||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A high-level comment stating the goal of the function and its general algorithm would be greatly appreciated. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done