+
+ { __(
+ 'Blocks are the basis of all content within the editor.' +
+ 'This library contains blocks for text, headings, images, lists and more!'
+ ) }
+
+
+ { __( 'Hover over a block in the inserter for more details.' ) }
+
{ __(
- 'Blocks are the basis of all content within the editor.' +
+ 'Blocks are the basis of all content within the editor. ' +
'This library contains blocks for text, headings, images, lists and more!'
) }
+
+
+ { __(
+ 'You can quickly insert blocks by typing "/" in the editor.'
+ ) }
-
- { __( 'Hover over a block in the inserter for more details.' ) }
-
) }
From a521e76136eed30f3af43b5fe28089c21647ad82 Mon Sep 17 00:00:00 2001
From: Riad Benguella
Date: Thu, 1 Aug 2019 14:49:44 +0100
Subject: [PATCH 04/14] Move the inserter help panel toggle to the options
modal
---
packages/block-editor/README.md | 1 +
.../src/components/inserter/menu.js | 25 +++----------------
.../src/components/inserter/style.scss | 19 --------------
packages/block-editor/src/store/defaults.js | 2 ++
.../src/components/options-modal/index.js | 2 ++
.../options-modal/options/enable-feature.js | 24 ++++++++++++++++++
.../components/options-modal/options/index.js | 1 +
packages/edit-post/src/editor.js | 5 ++++
packages/edit-post/src/store/defaults.js | 1 +
.../editor/src/components/provider/index.js | 1 +
10 files changed, 41 insertions(+), 40 deletions(-)
create mode 100644 packages/edit-post/src/components/options-modal/options/enable-feature.js
diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md
index 1d230d45fc3a23..a5a5ed24f0014f 100644
--- a/packages/block-editor/README.md
+++ b/packages/block-editor/README.md
@@ -387,6 +387,7 @@ 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
+ showInserterHelpPanel boolean Whether or not the inserter help panel is shown
**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.
**experimentalEnableLegacyWidgetBlock boolean Whether the user has enabled the Legacy Widget Block
\_\_experimentalEnableMenuBlock boolean Whether the user has enabled the Menu Block
diff --git a/packages/block-editor/src/components/inserter/menu.js b/packages/block-editor/src/components/inserter/menu.js
index d4c0b2408b96c4..7d67be31cc0612 100644
--- a/packages/block-editor/src/components/inserter/menu.js
+++ b/packages/block-editor/src/components/inserter/menu.js
@@ -24,7 +24,6 @@ import { __, _n, _x, sprintf } from '@wordpress/i18n';
import { Component, createRef } from '@wordpress/element';
import {
PanelBody,
- ToggleControl,
withSpokenMessages,
Notice,
} from '@wordpress/components';
@@ -109,11 +108,9 @@ export class InserterMenu extends Component {
reusableItems: [],
itemsPerCategory: {},
openPanels: [ 'suggested' ],
- showHelpPanel: true,
};
this.onChangeSearchInput = this.onChangeSearchInput.bind( this );
this.onHover = this.onHover.bind( this );
- this.onToggleHelpPanel = this.onToggleHelpPanel.bind( this );
this.panels = {};
this.inserterResults = createRef();
}
@@ -134,13 +131,6 @@ export class InserterMenu extends Component {
this.filter( event.target.value );
}
- onToggleHelpPanel() {
- this.setState( ( state ) => ( {
- showHelpPanel: ! state.showHelpPanel,
- hoveredItem: null,
- } ) );
- }
-
onHover( item ) {
if ( ! item ) {
return;
@@ -266,7 +256,7 @@ export class InserterMenu extends Component {
}
render() {
- const { instanceId, onSelect, rootClientId } = this.props;
+ const { instanceId, onSelect, rootClientId, showInserterHelpPanel } = this.props;
const {
childItems,
hoveredItem,
@@ -274,7 +264,6 @@ export class InserterMenu extends Component {
openPanels,
reusableItems,
suggestedItems,
- showHelpPanel,
} = this.state;
const isPanelOpen = ( panel ) => openPanels.indexOf( panel ) !== -1;
@@ -370,15 +359,7 @@ export class InserterMenu extends Component {
) }
-
{ hoveredItem && (
<>
@@ -425,6 +406,7 @@ export default compose(
getBlockName,
getBlockRootClientId,
getBlockSelectionEnd,
+ getSettings,
} = select( 'core/block-editor' );
const {
getChildBlockNames,
@@ -442,6 +424,7 @@ export default compose(
return {
rootChildBlocks: getChildBlockNames( destinationRootBlockName ),
items: getInserterItems( destinationRootClientId ),
+ showInserterHelpPanel: getSettings().showInserterHelpPanel,
destinationRootClientId,
};
} ),
diff --git a/packages/block-editor/src/components/inserter/style.scss b/packages/block-editor/src/components/inserter/style.scss
index 7b46bcae7aed79..5a97fba8c7d3f3 100644
--- a/packages/block-editor/src/components/inserter/style.scss
+++ b/packages/block-editor/src/components/inserter/style.scss
@@ -130,25 +130,6 @@ $block-inserter-search-height: 38px;
}
}
-.block-editor-inserter__menu-footer {
- display: none;
- justify-content: flex-end;
- padding: 15px 10px;
- border-top: $border-width solid $light-gray-500;
-
- @include break-medium {
- display: flex;
- }
-
- .components-base-control__field {
- margin: 0;
- flex-direction: row-reverse;
- label {
- margin-right: 10px;
- }
- }
-}
-
.block-editor-inserter__menu-help-panel {
display: none;
border: $border-width solid $light-gray-500;
diff --git a/packages/block-editor/src/store/defaults.js b/packages/block-editor/src/store/defaults.js
index 885a8b79f7fb06..2e7cb1f59cb78e 100644
--- a/packages/block-editor/src/store/defaults.js
+++ b/packages/block-editor/src/store/defaults.js
@@ -27,6 +27,7 @@ export const PREFERENCES_DEFAULTS = {
* bodyPlaceholder string Empty post placeholder
* titlePlaceholder string Empty title placeholder
* codeEditingEnabled string Whether or not the user can switch to the code editor
+ * showInserterHelpPanel boolean Whether or not the inserter help panel is shown
* __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.
* __experimentalEnableLegacyWidgetBlock boolean Whether the user has enabled the Legacy Widget Block
* __experimentalEnableMenuBlock boolean Whether the user has enabled the Menu Block
@@ -145,6 +146,7 @@ export const SETTINGS_DEFAULTS = {
availableLegacyWidgets: {},
hasPermissionsToManageWidgets: false,
+ showInserterHelpPanel: true,
__experimentalCanUserUseUnfilteredHTML: false,
__experimentalEnableLegacyWidgetBlock: false,
__experimentalEnableMenuBlock: false,
diff --git a/packages/edit-post/src/components/options-modal/index.js b/packages/edit-post/src/components/options-modal/index.js
index bb3f613539062f..1cfe8326327554 100644
--- a/packages/edit-post/src/components/options-modal/index.js
+++ b/packages/edit-post/src/components/options-modal/index.js
@@ -27,6 +27,7 @@ import {
EnablePublishSidebarOption,
EnableTipsOption,
EnablePanelOption,
+ EnableFeature,
} from './options';
import MetaBoxesSection from './meta-boxes-section';
@@ -47,6 +48,7 @@ export function OptionsModal( { isModalActive, isViewable, closeModal } ) {
+
diff --git a/packages/edit-post/src/components/options-modal/options/enable-feature.js b/packages/edit-post/src/components/options-modal/options/enable-feature.js
new file mode 100644
index 00000000000000..a0b79eddef3a55
--- /dev/null
+++ b/packages/edit-post/src/components/options-modal/options/enable-feature.js
@@ -0,0 +1,24 @@
+/**
+ * WordPress dependencies
+ */
+import { compose } from '@wordpress/compose';
+import { withSelect, withDispatch } from '@wordpress/data';
+
+/**
+ * Internal dependencies
+ */
+import BaseOption from './base';
+
+export default compose(
+ withSelect( ( select, { feature } ) => ( {
+ isChecked: select( 'core/edit-post' ).isFeatureActive( feature ),
+ } ) ),
+ withDispatch( ( dispatch, { feature } ) => {
+ const { toggleFeature } = dispatch( 'core/edit-post' );
+ return {
+ onChange() {
+ toggleFeature( feature );
+ },
+ };
+ } )
+)( BaseOption );
diff --git a/packages/edit-post/src/components/options-modal/options/index.js b/packages/edit-post/src/components/options-modal/options/index.js
index e1263f9f684741..8684b680377054 100644
--- a/packages/edit-post/src/components/options-modal/options/index.js
+++ b/packages/edit-post/src/components/options-modal/options/index.js
@@ -3,3 +3,4 @@ export { default as EnablePanelOption } from './enable-panel';
export { default as EnablePluginDocumentSettingPanelOption } from './enable-plugin-document-setting-panel';
export { default as EnablePublishSidebarOption } from './enable-publish-sidebar';
export { default as EnableTipsOption } from './enable-tips';
+export { default as EnableFeature } from './enable-feature';
diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js
index 70a29b54466a1d..c093446be3596f 100644
--- a/packages/edit-post/src/editor.js
+++ b/packages/edit-post/src/editor.js
@@ -36,6 +36,7 @@ class Editor extends Component {
getEditorSettings(
settings,
hasFixedToolbar,
+ showInserterHelpPanel,
focusMode,
hiddenBlockTypes,
blockTypes,
@@ -44,6 +45,7 @@ class Editor extends Component {
...settings,
hasFixedToolbar,
focusMode,
+ showInserterHelpPanel,
};
// Omit hidden block types if exists and non-empty.
@@ -77,6 +79,7 @@ class Editor extends Component {
onError,
hiddenBlockTypes,
blockTypes,
+ showInserterHelpPanel,
...props
} = this.props;
@@ -87,6 +90,7 @@ class Editor extends Component {
const editorSettings = this.getEditorSettings(
settings,
hasFixedToolbar,
+ showInserterHelpPanel,
focusMode,
hiddenBlockTypes,
blockTypes,
@@ -125,6 +129,7 @@ export default withSelect( ( select, { postId, postType } ) => {
const { getBlockTypes } = select( 'core/blocks' );
return {
+ showInserterHelpPanel: isFeatureActive( 'showInserterHelpPanel' ),
hasFixedToolbar: isFeatureActive( 'fixedToolbar' ),
focusMode: isFeatureActive( 'focusMode' ),
post: getEntityRecord( 'postType', postType, postId ),
diff --git a/packages/edit-post/src/store/defaults.js b/packages/edit-post/src/store/defaults.js
index 9cfc6506fece04..a161e4f4a6ef9b 100644
--- a/packages/edit-post/src/store/defaults.js
+++ b/packages/edit-post/src/store/defaults.js
@@ -8,6 +8,7 @@ export const PREFERENCES_DEFAULTS = {
},
features: {
fixedToolbar: false,
+ showInserterHelpPanel: true,
},
pinnedPluginItems: {},
hiddenBlockTypes: [],
diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js
index b11341e1a33f0f..4ed53cb23e4dfa 100644
--- a/packages/editor/src/components/provider/index.js
+++ b/packages/editor/src/components/provider/index.js
@@ -101,6 +101,7 @@ class EditorProvider extends Component {
'titlePlaceholder',
'__experimentalEnableLegacyWidgetBlock',
'__experimentalEnableMenuBlock',
+ 'showInserterHelpPanel',
] ),
__experimentalReusableBlocks: reusableBlocks,
__experimentalMediaUpload: hasUploadPermissions ? mediaUpload : undefined,
From c0315dfb053596babf1a2d2a110848f9a9c3cde7 Mon Sep 17 00:00:00 2001
From: Kjell Reigstad
Date: Fri, 2 Aug 2019 15:51:24 -0400
Subject: [PATCH 05/14] Update default content, spacing.
---
.../src/components/inserter/menu.js | 27 +++++++++++++------
.../src/components/inserter/style.scss | 8 ++++++
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/packages/block-editor/src/components/inserter/menu.js b/packages/block-editor/src/components/inserter/menu.js
index 7d67be31cc0612..c40c5d667cc04b 100644
--- a/packages/block-editor/src/components/inserter/menu.js
+++ b/packages/block-editor/src/components/inserter/menu.js
@@ -377,16 +377,27 @@ export class InserterMenu extends Component {
) }
{ ! hoveredItem && (
-
Content Blocks
-
- { __(
- 'Blocks are the basis of all content within the editor. ' +
- 'This library contains blocks for text, headings, images, lists and more!'
- ) }
-
+
+
Content Blocks
+
+ { __(
+ 'Welcome to the wonderful world of blocks! Blocks are the basis of all content within the editor. '
+ ) }
+
+
+ { __(
+ 'There are blocks available for all kinds of content: you can insert text, headings, images, lists, videos, tables, and lots more!'
+ ) }
+
+
+ { __(
+ 'Browse through the library to learn more about what each block does.'
+ ) }
+
+
{ __(
- 'You can quickly insert blocks by typing "/" in the editor.'
+ 'While writing, you can press "/" to quickly insert new blocks.'
) }
{ __(
- 'There are blocks available for all kinds of content: you can insert text, headings, images, lists, videos, tables, and lots more!'
+ 'There are blocks available for all kinds of content: insert text, headings, images, lists, videos, tables, and lots more.'
) }
From a942d0a7326d48354ce4f3ce2639123a8063a7a1 Mon Sep 17 00:00:00 2001
From: Kjell Reigstad
Date: Wed, 7 Aug 2019 14:49:42 -0400
Subject: [PATCH 08/14] Try a lighter version of Tips.
---
packages/components/src/tip/index.js | 3 +--
packages/components/src/tip/style.scss | 9 +++------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/packages/components/src/tip/index.js b/packages/components/src/tip/index.js
index fc4cd465b5735a..1672283d426f61 100644
--- a/packages/components/src/tip/index.js
+++ b/packages/components/src/tip/index.js
@@ -7,8 +7,7 @@ function Tip( props ) {
return (