-
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
Add new Insert Before/After menu items and shortcuts #8909
Conversation
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.
Screenshot:
Love it. Works as intended.
Might want a code sanity check by @noisysocks, but otherwise, ship it!
Great - I still need to do a bit of work on the template locking side of things. I'll do that first and then get a code review |
afd1b99
to
88d49f8
Compare
Ready for review now :) |
…ts and should not be possible when template locking is active
- Add full-stops - Remove comment that no longer seems relevant (component is not a DropDown)
699775b
to
e57f842
Compare
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.
Code looks fab, and everything works great in my testing!
I tested template locking using this custom post type:
register_post_type( 'test_type', array(
'label' => 'Test',
'public' => true,
'show_in_rest' => true,
'template_lock' => 'insert',
'template' => array(
array( 'core/image' ),
array( 'core/quote' ),
array( 'core/image' ),
),
) );
And this custom block:
registerBlockType( 'test/block', {
title: 'Test block',
category: 'common',
save: () => null,
edit() {
return (
<wp.editor.InnerBlocks
templateLock="insert"
template={ [ [ 'core/image' ], [ 'core/image' ] ] }
/>
);
},
} );
Great job 👍👍👌:shipit:
lastSelectedIndex, | ||
isLocked, | ||
canDuplicate, | ||
} = props; |
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.
Nit: you could put newlines into these function arguments if you don't want props
in the scope.
withDispatch( ( dispatch, {
clientIds,
rootClientId,
// etc.
} ) ) {
// etc.
}
removeBlocks( clientIds ); | ||
if ( ! isLocked ) { | ||
removeBlocks( clientIds ); | ||
} |
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.
Nice, a sneaky bug fix!
Nice one! |
Description
Closes #7297
Adds the following keyboard shortcuts for those actions:
How has this been tested?
Screenshots
MenuItems
Shortcut Help
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: