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

Hide disabled blocks from shortcut inserter #7336

Merged
merged 1 commit into from
Jun 18, 2018

Conversation

Soean
Copy link
Member

@Soean Soean commented Jun 17, 2018

Description

This PR hides blocks with isDisabled attribute from the shortcut inserter. For example if blocks with multiple: false are already inserted. There are only 3 Items so it does't make sense to just disable the button.
Fixes #3968

Screenshots

juni-17-2018 13-33-01

@Soean Soean added the [Feature] Inserter The main way to insert blocks using the + button in the editing interface label Jun 17, 2018
@Soean Soean changed the title Hide disabled items from shortcut inserter Hide disabled blocks from shortcut inserter Jun 17, 2018
@danielbachhuber danielbachhuber added this to the 3.1 milestone Jun 18, 2018
@danielbachhuber danielbachhuber merged commit feedac6 into master Jun 18, 2018
@danielbachhuber danielbachhuber deleted the update/inserter-with-shortcuts branch June 18, 2018 12:22
const itemsWithoutDefaultBlock = filter( items, ( item ) =>
item.name !== getDefaultBlockName() || ! isEmpty( item.initialAttributes )
).slice( 0, 3 );
const itemsWithoutDefaultBlock = filter( items, ( item ) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function name still accurate? It's now doing more than just checking whether the block is the default block. To be fair, it wasn't even very accurate previously, because it was referring to the "unchanged default block", which is logic duplicated with wp.blocks.isUnmodifiedDefaultBlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants