-
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
Reusable blocks: Add UI for bulk deleting blocks #9588
Changes from 1 commit
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 |
---|---|---|
|
@@ -22,10 +22,7 @@ import scrollIntoView from 'dom-scroll-into-view'; | |
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Component, findDOMNode, createRef } from '@wordpress/element'; | ||
import { | ||
withSpokenMessages, | ||
PanelBody, | ||
} from '@wordpress/components'; | ||
import { withSpokenMessages, PanelBody, IconButton } from '@wordpress/components'; | ||
import { getCategories, isReusableBlock } from '@wordpress/blocks'; | ||
import { withDispatch, withSelect } from '@wordpress/data'; | ||
import { withInstanceId, compose, withSafeTimeout } from '@wordpress/compose'; | ||
|
@@ -281,13 +278,20 @@ export class InserterMenu extends Component { | |
|
||
{ !! reusableItems.length && ( | ||
<PanelBody | ||
className="editor-inserter__reusable-blocks-panel" | ||
title={ __( 'Reusable' ) } | ||
opened={ isPanelOpen( 'reusable' ) } | ||
onToggle={ this.onTogglePanel( 'reusable' ) } | ||
icon="controls-repeat" | ||
ref={ this.bindPanel( 'reusable' ) } | ||
> | ||
<BlockTypesList items={ reusableItems } onSelect={ onSelect } onHover={ this.onHover } /> | ||
<IconButton | ||
className="editor-inserter__manage-reusable-blocks" | ||
icon="admin-generic" | ||
label={ __( 'Manage Blocks' ) } | ||
href="edit.php?post_type=wp_block" | ||
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. For a later PR. We use links to target WP Admin pages (here, revisions, I'm probably missing other links too). The thing is. These links only work in WP context. We need to find a way to add these links in an "augmented" manner. Keeping the packages WP links free. 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, let's make sure we make an issue for this. 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. |
||
/> | ||
</PanelBody> | ||
) } | ||
{ isEmpty( suggestedItems ) && isEmpty( reusableItems ) && isEmpty( itemsPerCategory ) && ( | ||
|
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.
Was chatting to @azaozz about this. In the medium term, we should patch Core to add a filter here:
https://github.com/WordPress/WordPress/blob/master/wp-admin/edit.php#L352
This would allow us to remove this hacky way of hiding the Add New button and improve how
gutenberg_replace_default_add_new_button
works.