-
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 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 | ||
---|---|---|---|---|
|
@@ -9,13 +9,14 @@ | |||
position: relative; | ||||
overflow: hidden; | ||||
text-indent: 4px; | ||||
border-radius: $radius-round-rectangle; | ||||
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. Does this change make the following line redundant now (for
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. Also, I don't understand why it's IconButton which applies hover and active button styles (and the associated border radius), rather than the underlying Button ? See related comment at #7534 (comment) 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, that makes this rule redundant. And I don't have a good answer to your question, other than this is how we got to where we are today. I very much appreciate the effort you are putting in #9702 — would you like help with that? Do you want to remove the redundant rule in the header as part of that PR, or would you like me to create a quick fixup here? 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. 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. Created PR here: #10021 |
||||
|
||||
.dashicon { | ||||
display: inline-block; | ||||
flex: 0 0 auto; | ||||
} | ||||
|
||||
// Ensure that even SVG icons that don't include the .dashicon class are colored | ||||
// Ensure that even SVG icons that don't include the .dashicon class are colored. | ||||
svg { | ||||
fill: currentColor; | ||||
outline: none; | ||||
|
@@ -33,5 +34,4 @@ | |||
&:disabled:focus { | ||||
box-shadow: none; | ||||
} | ||||
|
||||
} |
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 All Reusable 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.