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

Projects
None yet
3 participants
@Soean
Member

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 changed the title from Hide disabled items from shortcut inserter to 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

2 checks passed

codecov/project 46.68% remains the same compared to ae117ef
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@danielbachhuber danielbachhuber deleted the update/inserter-with-shortcuts branch Jun 18, 2018

const itemsWithoutDefaultBlock = filter( items, ( item ) =>
item.name !== getDefaultBlockName() || ! isEmpty( item.initialAttributes )
).slice( 0, 3 );
const itemsWithoutDefaultBlock = filter( items, ( item ) => {

This comment has been minimized.

@aduth

aduth Jun 18, 2018

Member

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