Skip to content

Commit

Permalink
BlockEditor: Do not show InlineTips by default
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Aug 2, 2019
1 parent bdd6473 commit 609a09c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 13 deletions.
3 changes: 2 additions & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ The default editor settings
bodyPlaceholder string Empty post placeholder
titlePlaceholder string Empty title placeholder
codeEditingEnabled string Whether or not the user can switch to the code editor
\_\_experimentalCanUserUseUnfilteredHTML string Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
**experimentalCanUserUseUnfilteredHTML string Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
**experimentalEnableTips boolean Whether or not tips aimed at new users should appear in the UI.

<a name="SkipToSelectedBlock" href="#SkipToSelectedBlock">#</a> **SkipToSelectedBlock**

Expand Down
13 changes: 9 additions & 4 deletions packages/block-editor/src/components/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const BlockInspector = ( {
selectedBlockClientId,
selectedBlockName,
showNoBlockSelectedMessage = true,
enableTips,
} ) => {
if ( count > 1 ) {
return <MultiSelectionInspector />;
Expand All @@ -52,9 +53,11 @@ const BlockInspector = ( {

return (
<>
<InlineTip tipId="core/editor.blockInspector" className="block-editor-block-inspector__tip">
{ __( 'The block tab contains additional settings for the selected block.' ) }
</InlineTip>
{ enableTips && (
<InlineTip tipId="core/editor.blockInspector" className="block-editor-block-inspector__tip">
{ __( '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">
Expand Down Expand Up @@ -95,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 );
21 changes: 13 additions & 8 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class InserterMenu extends Component {
}

render() {
const { instanceId, onSelect, rootClientId } = this.props;
const { instanceId, onSelect, rootClientId, enableTips } = this.props;
const {
childItems,
hoveredItem,
Expand Down Expand Up @@ -291,13 +291,15 @@ export class InserterMenu extends Component {
aria-label={ __( 'Available block types' ) }
>

<InlineTip tipId="core/editor.inserter" className="block-editor-inserter__tip">
{ __( 'There are Blocks for most types of content: text, headings, images, lists, and lots more!' ) }
{ ' ' }
<ExternalLink href="https://wordpress.org/support/article/wordpress-editor/#blocks">
{ __( 'Learn more' ) }
</ExternalLink>
</InlineTip>
{ enableTips && (
<InlineTip tipId="core/editor.inserter" className="block-editor-inserter__tip">
{ __( 'There are Blocks for most types of content: text, headings, images, lists, and lots more!' ) }
{ ' ' }
<ExternalLink href="https://wordpress.org/support/article/wordpress-editor/#blocks">
{ __( 'Learn more' ) }
</ExternalLink>
</InlineTip>
) }

<ChildBlocks
rootClientId={ rootClientId }
Expand Down Expand Up @@ -375,6 +377,7 @@ export default compose(
getBlockName,
getBlockRootClientId,
getBlockSelectionEnd,
getSettings,
} = select( 'core/block-editor' );
const {
getChildBlockNames,
Expand All @@ -388,11 +391,13 @@ export default compose(
}
}
const destinationRootBlockName = getBlockName( destinationRootClientId );
const { __experimentalEnableTips: enableTips } = getSettings();

return {
rootChildBlocks: getChildBlockNames( destinationRootBlockName ),
items: getInserterItems( destinationRootClientId ),
destinationRootClientId,
enableTips,
};
} ),
withDispatch( ( dispatch, ownProps, { select } ) => {
Expand Down
6 changes: 6 additions & 0 deletions packages/block-editor/src/store/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ export const PREFERENCES_DEFAULTS = {
* titlePlaceholder string Empty title placeholder
* codeEditingEnabled string Whether or not the user can switch to the code editor
* __experimentalCanUserUseUnfilteredHTML string Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
* __experimentalEnableTips boolean Whether or not tips aimed at new users should appear in the UI.
*/
export const SETTINGS_DEFAULTS = {
alignWide: false,

colors: [
{
name: __( 'Pale pink' ),
Expand Down Expand Up @@ -142,7 +144,11 @@ export const SETTINGS_DEFAULTS = {
allowedMimeTypes: null,

availableLegacyWidgets: {},

hasPermissionsToManageWidgets: false,

__experimentalCanUserUseUnfilteredHTML: false,

__experimentalEnableTips: false,
};

1 change: 1 addition & 0 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class EditorProvider extends Component {
__experimentalMediaUpload: hasUploadPermissions ? mediaUpload : undefined,
__experimentalFetchLinkSuggestions: fetchLinkSuggestions,
__experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML,
__experimentalEnableTips: true,
};
}

Expand Down

0 comments on commit 609a09c

Please sign in to comment.