-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
NUX: Make tips appear inline #16582
NUX: Make tips appear inline #16582
Changes from all commits
18ab2e9
f45b046
51baead
bdd6473
609a09c
b1270ca
7333838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import { __ } from '@wordpress/i18n'; | |
import { getBlockType, getUnregisteredTypeHandlerName } from '@wordpress/blocks'; | ||
import { PanelBody } from '@wordpress/components'; | ||
import { withSelect } from '@wordpress/data'; | ||
import { __experimentalInlineTip as InlineTip } from '@wordpress/nux'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -27,6 +28,7 @@ const BlockInspector = ( { | |
selectedBlockClientId, | ||
selectedBlockName, | ||
showNoBlockSelectedMessage = true, | ||
enableTips, | ||
} ) => { | ||
if ( count > 1 ) { | ||
return <MultiSelectionInspector />; | ||
|
@@ -51,6 +53,11 @@ const BlockInspector = ( { | |
|
||
return ( | ||
<> | ||
{ enableTips && ( | ||
<InlineTip tipId="core/editor.blockInspector" className="block-editor-block-inspector__tip"> | ||
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. Should it be |
||
{ __( 'The block tab contains additional settings for the selected block.' ) } | ||
</InlineTip> | ||
) } | ||
<div className="editor-block-inspector__card block-editor-block-inspector__card"> | ||
<BlockIcon icon={ blockType.icon } showColors /> | ||
<div className="editor-block-inspector__card-content block-editor-block-inspector__card-content"> | ||
|
@@ -91,18 +98,20 @@ const BlockInspector = ( { | |
|
||
export default withSelect( | ||
( select ) => { | ||
const { getSelectedBlockClientId, getSelectedBlockCount, getBlockName } = select( 'core/block-editor' ); | ||
const { getSelectedBlockClientId, getSelectedBlockCount, getBlockName, getSettings } = select( 'core/block-editor' ); | ||
const { getBlockStyles } = select( 'core/blocks' ); | ||
const selectedBlockClientId = getSelectedBlockClientId(); | ||
const selectedBlockName = selectedBlockClientId && getBlockName( selectedBlockClientId ); | ||
const blockType = selectedBlockClientId && getBlockType( selectedBlockName ); | ||
const blockStyles = selectedBlockClientId && getBlockStyles( selectedBlockName ); | ||
const { __experimentalEnableTips: enableTips } = getSettings(); | ||
return { | ||
count: getSelectedBlockCount(), | ||
hasBlockStyles: blockStyles && blockStyles.length > 0, | ||
selectedBlockName, | ||
selectedBlockClientId, | ||
blockType, | ||
enableTips, | ||
}; | ||
} | ||
)( BlockInspector ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,14 @@ function Notice( { | |
actions = [], | ||
__unstableHTML, | ||
} ) { | ||
const classes = classnames( className, 'components-notice', 'is-' + status, { | ||
'is-dismissible': isDismissible, | ||
} ); | ||
const classes = classnames( | ||
className, | ||
'components-notice', | ||
status ? 'is-' + status : undefined, | ||
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. It's really minor, and I don't care so much if it gets merged without it, but I notice this has changed and I think it could go in the object below. Also wondering if status should be kebabbed for ultra safety:
|
||
{ | ||
'is-dismissible': isDismissible, | ||
} | ||
); | ||
|
||
if ( __unstableHTML ) { | ||
children = <RawHTML>{ children }</RawHTML>; | ||
|
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.
I don't know why
npm run docs:build
has replaced the__
with**
😕