@wordpress/block-editor 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +2 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +55 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +14 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +11 -6
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/iframe/index.js +13 -95
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +93 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +13 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +8 -5
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +6 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +21 -26
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +57 -45
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +5 -1
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +21 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +56 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +14 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +12 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +12 -95
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +85 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +13 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +8 -5
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +21 -27
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +58 -46
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +5 -1
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +21 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +3 -3
- package/build-style/content.css +3 -3
- package/build-style/default-editor-styles-rtl.css +3 -3
- package/build-style/default-editor-styles.css +3 -3
- package/build-style/style-rtl.css +35 -11
- package/build-style/style.css +35 -11
- package/package.json +29 -29
- package/src/components/alignment-control/test/index.js +2 -0
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-alignment-control/test/index.js +2 -0
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +77 -4
- package/src/components/block-inspector/style.scss +7 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +15 -6
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +3 -2
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-variation-picker/index.js +5 -1
- package/src/components/block-vertical-alignment-control/test/index.js +2 -0
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +4 -4
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/iframe/index.js +8 -103
- package/src/components/iframe/use-compatibility-styles.js +95 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +15 -2
- package/src/components/inserter/media-tab/hooks.js +5 -4
- package/src/components/inserter/quick-inserter.js +3 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +2 -0
- package/src/components/link-control/test/index.js +18 -4
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/style.scss +1 -7
- package/src/components/media-replace-flow/test/index.js +2 -0
- package/src/components/off-canvas-editor/appender.js +30 -25
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +93 -76
- package/src/components/off-canvas-editor/index.js +9 -0
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/test/index.js +21 -5
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/hooks/border.js +0 -1
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +13 -6
- package/src/store/selectors.js +2 -3
- package/src/utils/pasting.js +3 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -143,18 +143,31 @@ class Inserter extends Component {
|
|
|
143
143
|
// Feel free to make them stable after a few releases.
|
|
144
144
|
__experimentalIsQuick: isQuick,
|
|
145
145
|
prioritizePatterns,
|
|
146
|
+
onSelectOrClose,
|
|
147
|
+
selectBlockOnInsert,
|
|
146
148
|
} = this.props;
|
|
147
149
|
|
|
148
150
|
if ( isQuick ) {
|
|
149
151
|
return (
|
|
150
152
|
<QuickInserter
|
|
151
|
-
onSelect={ () => {
|
|
153
|
+
onSelect={ ( blocks ) => {
|
|
154
|
+
const firstBlock =
|
|
155
|
+
Array.isArray( blocks ) && blocks?.length
|
|
156
|
+
? blocks[ 0 ]
|
|
157
|
+
: blocks;
|
|
158
|
+
if (
|
|
159
|
+
onSelectOrClose &&
|
|
160
|
+
typeof onSelectOrClose === 'function'
|
|
161
|
+
) {
|
|
162
|
+
onSelectOrClose( firstBlock );
|
|
163
|
+
}
|
|
152
164
|
onClose();
|
|
153
165
|
} }
|
|
154
166
|
rootClientId={ rootClientId }
|
|
155
167
|
clientId={ clientId }
|
|
156
168
|
isAppender={ isAppender }
|
|
157
169
|
prioritizePatterns={ prioritizePatterns }
|
|
170
|
+
selectBlockOnInsert={ selectBlockOnInsert }
|
|
158
171
|
/>
|
|
159
172
|
);
|
|
160
173
|
}
|
|
@@ -380,7 +393,7 @@ export default compose( [
|
|
|
380
393
|
|
|
381
394
|
if ( onSelectOrClose ) {
|
|
382
395
|
onSelectOrClose( {
|
|
383
|
-
|
|
396
|
+
clientId: blockToInsert?.clientId,
|
|
384
397
|
} );
|
|
385
398
|
}
|
|
386
399
|
|
|
@@ -66,14 +66,15 @@ export function useMediaCategories( rootClientId ) {
|
|
|
66
66
|
per_page: 1,
|
|
67
67
|
_fields: [ 'id' ],
|
|
68
68
|
};
|
|
69
|
-
const [ image, video, audio ] = await Promise.
|
|
69
|
+
const [ image, video, audio ] = await Promise.allSettled( [
|
|
70
70
|
fetchMedia( { ...query, media_type: 'image' } ),
|
|
71
71
|
fetchMedia( { ...query, media_type: 'video' } ),
|
|
72
72
|
fetchMedia( { ...query, media_type: 'audio' } ),
|
|
73
73
|
] );
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const
|
|
74
|
+
// The `value` property is only present if the promise's status is "fulfilled".
|
|
75
|
+
const showImage = canInsertImage && !! image.value?.length;
|
|
76
|
+
const showVideo = canInsertVideo && !! video.value?.length;
|
|
77
|
+
const showAudio = canInsertAudio && !! audio.value?.length;
|
|
77
78
|
setCategories(
|
|
78
79
|
MEDIA_CATEGORIES.filter(
|
|
79
80
|
( { mediaType } ) =>
|
|
@@ -31,6 +31,7 @@ export default function QuickInserter( {
|
|
|
31
31
|
clientId,
|
|
32
32
|
isAppender,
|
|
33
33
|
prioritizePatterns,
|
|
34
|
+
selectBlockOnInsert,
|
|
34
35
|
} ) {
|
|
35
36
|
const [ filterValue, setFilterValue ] = useState( '' );
|
|
36
37
|
const [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {
|
|
@@ -38,6 +39,7 @@ export default function QuickInserter( {
|
|
|
38
39
|
rootClientId,
|
|
39
40
|
clientId,
|
|
40
41
|
isAppender,
|
|
42
|
+
selectBlockOnInsert,
|
|
41
43
|
} );
|
|
42
44
|
const [ blockTypes ] = useBlockTypesState(
|
|
43
45
|
destinationRootClientId,
|
|
@@ -121,6 +123,7 @@ export default function QuickInserter( {
|
|
|
121
123
|
maxBlockTypes={ SHOWN_BLOCK_TYPES }
|
|
122
124
|
isDraggable={ false }
|
|
123
125
|
prioritizePatterns={ prioritizePatterns }
|
|
126
|
+
selectBlockOnInsert={ selectBlockOnInsert }
|
|
124
127
|
/>
|
|
125
128
|
</div>
|
|
126
129
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import removeAccents from 'remove-accents';
|
|
5
|
-
import { find } from 'lodash';
|
|
6
5
|
import { noCase } from 'change-case';
|
|
7
6
|
|
|
8
7
|
// Default search helpers.
|
|
@@ -88,7 +87,7 @@ export const searchBlockItems = (
|
|
|
88
87
|
|
|
89
88
|
const config = {
|
|
90
89
|
getCategory: ( item ) =>
|
|
91
|
-
find(
|
|
90
|
+
categories.find( ( { slug } ) => slug === item.category )?.title,
|
|
92
91
|
getCollection: ( item ) =>
|
|
93
92
|
collections[ item.name.split( '/' )[ 0 ] ]?.title,
|
|
94
93
|
};
|
|
@@ -50,6 +50,7 @@ function InserterSearchResults( {
|
|
|
50
50
|
isDraggable = true,
|
|
51
51
|
shouldFocusBlock = true,
|
|
52
52
|
prioritizePatterns,
|
|
53
|
+
selectBlockOnInsert,
|
|
53
54
|
} ) {
|
|
54
55
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
55
56
|
|
|
@@ -60,6 +61,7 @@ function InserterSearchResults( {
|
|
|
60
61
|
isAppender,
|
|
61
62
|
insertionIndex: __experimentalInsertionIndex,
|
|
62
63
|
shouldFocusBlock,
|
|
64
|
+
selectBlockOnInsert,
|
|
63
65
|
} );
|
|
64
66
|
const [
|
|
65
67
|
blockTypes,
|
|
@@ -376,9 +376,15 @@ describe( 'Searching for a link', () => {
|
|
|
376
376
|
const searchResults = await screen.findByRole( 'listbox', {
|
|
377
377
|
name: /Search results for.*/,
|
|
378
378
|
} );
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
379
|
+
|
|
380
|
+
const searchResultTextHighlightElements = within( searchResults )
|
|
381
|
+
.getAllByRole( 'option' )
|
|
382
|
+
// TODO: Change to `getByRole( 'mark' )` when officially supported by
|
|
383
|
+
// WAI-ARIA 1.3 - see https://w3c.github.io/aria/#mark
|
|
384
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
385
|
+
.map( ( searchResult ) => searchResult.querySelector( 'mark' ) )
|
|
386
|
+
.flat()
|
|
387
|
+
.filter( Boolean );
|
|
382
388
|
|
|
383
389
|
// Given we're mocking out the results we should always have 4 mark elements.
|
|
384
390
|
expect( searchResultTextHighlightElements ).toHaveLength( 4 );
|
|
@@ -1092,6 +1098,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1092
1098
|
|
|
1093
1099
|
// Check human readable error notice is perceivable.
|
|
1094
1100
|
expect( errorNotice ).toBeVisible();
|
|
1101
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1095
1102
|
expect( errorNotice.parentElement ).toHaveClass(
|
|
1096
1103
|
'block-editor-link-control__search-error'
|
|
1097
1104
|
);
|
|
@@ -1324,7 +1331,8 @@ describe( 'Selecting links', () => {
|
|
|
1324
1331
|
} );
|
|
1325
1332
|
|
|
1326
1333
|
// Make sure focus is retained after submission.
|
|
1327
|
-
|
|
1334
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1335
|
+
expect( container.firstChild ).toHaveFocus();
|
|
1328
1336
|
|
|
1329
1337
|
expect( currentLink ).toBeVisible();
|
|
1330
1338
|
expect(
|
|
@@ -1594,11 +1602,13 @@ describe( 'Rich link previews', () => {
|
|
|
1594
1602
|
await waitFor( () => expect( linkPreview ).toHaveClass( 'is-rich' ) );
|
|
1595
1603
|
|
|
1596
1604
|
// Todo: refactor to use user-facing queries.
|
|
1605
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1597
1606
|
const hasRichImagePreview = linkPreview.querySelector(
|
|
1598
1607
|
'.block-editor-link-control__search-item-image'
|
|
1599
1608
|
);
|
|
1600
1609
|
|
|
1601
1610
|
// Todo: refactor to use user-facing queries.
|
|
1611
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1602
1612
|
const hasRichDescriptionPreview = linkPreview.querySelector(
|
|
1603
1613
|
'.block-editor-link-control__search-item-description'
|
|
1604
1614
|
);
|
|
@@ -1646,11 +1656,14 @@ describe( 'Rich link previews', () => {
|
|
|
1646
1656
|
|
|
1647
1657
|
await waitFor( () => expect( linkPreview ).toHaveClass( 'is-rich' ) );
|
|
1648
1658
|
|
|
1659
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1649
1660
|
const iconPreview = linkPreview.querySelector(
|
|
1650
1661
|
`.block-editor-link-control__search-item-icon`
|
|
1651
1662
|
);
|
|
1652
1663
|
|
|
1664
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1653
1665
|
const fallBackIcon = iconPreview.querySelector( 'svg' );
|
|
1666
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1654
1667
|
const richIcon = iconPreview.querySelector( 'img' );
|
|
1655
1668
|
|
|
1656
1669
|
expect( fallBackIcon ).toBeVisible();
|
|
@@ -1680,6 +1693,7 @@ describe( 'Rich link previews', () => {
|
|
|
1680
1693
|
expect( linkPreview ).toHaveClass( 'is-rich' )
|
|
1681
1694
|
);
|
|
1682
1695
|
|
|
1696
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
1683
1697
|
const missingDataItem = linkPreview.querySelector(
|
|
1684
1698
|
`.block-editor-link-control__search-item-${ dataItem }`
|
|
1685
1699
|
);
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__experimentalTruncate as Truncate,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { forwardRef } from '@wordpress/element';
|
|
15
|
-
import { Icon, lock } from '@wordpress/icons';
|
|
15
|
+
import { Icon, lockSmall as lock } from '@wordpress/icons';
|
|
16
16
|
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -176,9 +176,8 @@
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
.block-editor-block-icon {
|
|
179
|
-
align-self: flex-start;
|
|
180
179
|
margin-right: $grid-unit-10;
|
|
181
|
-
|
|
180
|
+
flex: 0 0 $icon-size;
|
|
182
181
|
}
|
|
183
182
|
|
|
184
183
|
.block-editor-list-view-block__menu-cell,
|
|
@@ -319,11 +318,6 @@
|
|
|
319
318
|
|
|
320
319
|
.block-editor-list-view-block-select-button__lock {
|
|
321
320
|
line-height: 0;
|
|
322
|
-
width: 24px;
|
|
323
|
-
min-width: 24px;
|
|
324
|
-
margin-left: auto;
|
|
325
|
-
padding: 0;
|
|
326
|
-
vertical-align: middle;
|
|
327
321
|
}
|
|
328
322
|
}
|
|
329
323
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { forwardRef, useState } from '@wordpress/element';
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -10,9 +10,15 @@ import { store as blockEditorStore } from '../../store';
|
|
|
10
10
|
import Inserter from '../inserter';
|
|
11
11
|
import { LinkUI } from './link-ui';
|
|
12
12
|
import { updateAttributes } from './update-attributes';
|
|
13
|
+
import { useInsertedBlock } from './use-inserted-block';
|
|
14
|
+
|
|
15
|
+
const BLOCKS_WITH_LINK_UI_SUPPORT = [
|
|
16
|
+
'core/navigation-link',
|
|
17
|
+
'core/navigation-submenu',
|
|
18
|
+
];
|
|
13
19
|
|
|
14
20
|
export const Appender = forwardRef( ( props, ref ) => {
|
|
15
|
-
const [
|
|
21
|
+
const [ insertedBlockClientId, setInsertedBlockClientId ] = useState();
|
|
16
22
|
|
|
17
23
|
const { hideInserter, clientId } = useSelect( ( select ) => {
|
|
18
24
|
const {
|
|
@@ -31,40 +37,39 @@ export const Appender = forwardRef( ( props, ref ) => {
|
|
|
31
37
|
};
|
|
32
38
|
}, [] );
|
|
33
39
|
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
insertedBlockAttributes: getBlockAttributes( insertedBlock ),
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
[ insertedBlock ]
|
|
43
|
-
);
|
|
40
|
+
const {
|
|
41
|
+
insertedBlockAttributes,
|
|
42
|
+
insertedBlockName,
|
|
43
|
+
setInsertedBlockAttributes,
|
|
44
|
+
} = useInsertedBlock( insertedBlockClientId );
|
|
44
45
|
|
|
45
|
-
const
|
|
46
|
+
const maybeSetInsertedBlockOnInsertion = ( _insertedBlock ) => {
|
|
47
|
+
if ( ! _insertedBlock?.clientId ) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
updateBlockAttributes( insertedBlockClientId, _updatedAttributes );
|
|
50
|
-
};
|
|
51
|
+
setInsertedBlockClientId( _insertedBlock?.clientId );
|
|
52
|
+
};
|
|
51
53
|
|
|
52
54
|
let maybeLinkUI;
|
|
53
55
|
|
|
54
|
-
if (
|
|
56
|
+
if (
|
|
57
|
+
insertedBlockClientId &&
|
|
58
|
+
BLOCKS_WITH_LINK_UI_SUPPORT?.includes( insertedBlockName )
|
|
59
|
+
) {
|
|
55
60
|
maybeLinkUI = (
|
|
56
61
|
<LinkUI
|
|
57
|
-
clientId={
|
|
62
|
+
clientId={ insertedBlockClientId }
|
|
58
63
|
link={ insertedBlockAttributes }
|
|
59
|
-
onClose={ () =>
|
|
64
|
+
onClose={ () => setInsertedBlockClientId( null ) }
|
|
60
65
|
hasCreateSuggestion={ false }
|
|
61
66
|
onChange={ ( updatedValue ) => {
|
|
62
67
|
updateAttributes(
|
|
63
68
|
updatedValue,
|
|
64
|
-
|
|
69
|
+
setInsertedBlockAttributes,
|
|
65
70
|
insertedBlockAttributes
|
|
66
71
|
);
|
|
67
|
-
|
|
72
|
+
setInsertedBlockClientId( null );
|
|
68
73
|
} }
|
|
69
74
|
/>
|
|
70
75
|
);
|
|
@@ -77,15 +82,15 @@ export const Appender = forwardRef( ( props, ref ) => {
|
|
|
77
82
|
return (
|
|
78
83
|
<div className="offcanvas-editor__appender">
|
|
79
84
|
{ maybeLinkUI }
|
|
85
|
+
|
|
80
86
|
<Inserter
|
|
81
87
|
ref={ ref }
|
|
82
88
|
rootClientId={ clientId }
|
|
83
89
|
position="bottom right"
|
|
84
90
|
isAppender={ true }
|
|
85
91
|
selectBlockOnInsert={ false }
|
|
86
|
-
onSelectOrClose={
|
|
87
|
-
|
|
88
|
-
} }
|
|
92
|
+
onSelectOrClose={ maybeSetInsertedBlockOnInsertion }
|
|
93
|
+
__experimentalIsQuick
|
|
89
94
|
{ ...props }
|
|
90
95
|
/>
|
|
91
96
|
</div>
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__experimentalTruncate as Truncate,
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { forwardRef } from '@wordpress/element';
|
|
15
|
-
import { Icon, lock } from '@wordpress/icons';
|
|
15
|
+
import { Icon, lockSmall as lock } from '@wordpress/icons';
|
|
16
16
|
import { SPACE, ENTER } from '@wordpress/keycodes';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -79,7 +79,11 @@ function ListViewBlockSelectButton(
|
|
|
79
79
|
aria-hidden={ true }
|
|
80
80
|
>
|
|
81
81
|
<ListViewExpander onClick={ onToggleExpanded } />
|
|
82
|
-
<BlockIcon
|
|
82
|
+
<BlockIcon
|
|
83
|
+
icon={ blockInformation?.icon }
|
|
84
|
+
showColors
|
|
85
|
+
context="list-view"
|
|
86
|
+
/>
|
|
83
87
|
<HStack
|
|
84
88
|
alignment="center"
|
|
85
89
|
className="block-editor-list-view-block-select-button__label-wrapper"
|
|
@@ -42,7 +42,7 @@ import useBlockDisplayInformation from '../use-block-display-information';
|
|
|
42
42
|
import { useBlockLock } from '../block-lock';
|
|
43
43
|
|
|
44
44
|
function ListViewBlock( {
|
|
45
|
-
block,
|
|
45
|
+
block: { clientId },
|
|
46
46
|
isDragged,
|
|
47
47
|
isSelected,
|
|
48
48
|
isBranchSelected,
|
|
@@ -60,7 +60,6 @@ function ListViewBlock( {
|
|
|
60
60
|
} ) {
|
|
61
61
|
const cellRef = useRef( null );
|
|
62
62
|
const [ isHovered, setIsHovered ] = useState( false );
|
|
63
|
-
const { clientId, attributes } = block;
|
|
64
63
|
|
|
65
64
|
const { isLocked, isContentLocked } = useBlockLock( clientId );
|
|
66
65
|
const forceSelectionContentLock = useSelect(
|
|
@@ -87,24 +86,77 @@ function ListViewBlock( {
|
|
|
87
86
|
( isSelected &&
|
|
88
87
|
selectedClientIds[ selectedClientIds.length - 1 ] === clientId );
|
|
89
88
|
|
|
90
|
-
const { replaceBlock, toggleBlockHighlight } =
|
|
89
|
+
const { insertBlock, replaceBlock, toggleBlockHighlight } =
|
|
91
90
|
useDispatch( blockEditorStore );
|
|
92
91
|
|
|
93
92
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
94
|
-
const
|
|
95
|
-
( select ) => select( blockEditorStore ).
|
|
93
|
+
const block = useSelect(
|
|
94
|
+
( select ) => select( blockEditorStore ).getBlock( clientId ),
|
|
96
95
|
[ clientId ]
|
|
97
96
|
);
|
|
98
97
|
|
|
98
|
+
// If ListView has experimental features related to the Persistent List View,
|
|
99
|
+
// only focus the selected list item on mount; otherwise the list would always
|
|
100
|
+
// try to steal the focus from the editor canvas.
|
|
101
|
+
useEffect( () => {
|
|
102
|
+
if ( ! isTreeGridMounted && isSelected ) {
|
|
103
|
+
cellRef.current.focus();
|
|
104
|
+
}
|
|
105
|
+
}, [] );
|
|
106
|
+
|
|
107
|
+
const onMouseEnter = useCallback( () => {
|
|
108
|
+
setIsHovered( true );
|
|
109
|
+
toggleBlockHighlight( clientId, true );
|
|
110
|
+
}, [ clientId, setIsHovered, toggleBlockHighlight ] );
|
|
111
|
+
const onMouseLeave = useCallback( () => {
|
|
112
|
+
setIsHovered( false );
|
|
113
|
+
toggleBlockHighlight( clientId, false );
|
|
114
|
+
}, [ clientId, setIsHovered, toggleBlockHighlight ] );
|
|
115
|
+
|
|
116
|
+
const selectEditorBlock = useCallback(
|
|
117
|
+
( event ) => {
|
|
118
|
+
selectBlock( event, clientId );
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
},
|
|
121
|
+
[ clientId, selectBlock ]
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const updateSelection = useCallback(
|
|
125
|
+
( newClientId ) => {
|
|
126
|
+
selectBlock( undefined, newClientId );
|
|
127
|
+
},
|
|
128
|
+
[ selectBlock ]
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const { isTreeGridMounted, expand, collapse } = useListViewContext();
|
|
132
|
+
|
|
133
|
+
const toggleExpanded = useCallback(
|
|
134
|
+
( event ) => {
|
|
135
|
+
// Prevent shift+click from opening link in a new window when toggling.
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
event.stopPropagation();
|
|
138
|
+
if ( isExpanded === true ) {
|
|
139
|
+
collapse( clientId );
|
|
140
|
+
} else if ( isExpanded === false ) {
|
|
141
|
+
expand( clientId );
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
[ clientId, expand, collapse, isExpanded ]
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const instanceId = useInstanceId( ListViewBlock );
|
|
148
|
+
|
|
149
|
+
if ( ! block ) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
99
153
|
// When a block hides its toolbar it also hides the block settings menu,
|
|
100
154
|
// since that menu is part of the toolbar in the editor canvas.
|
|
101
155
|
// List View respects this by also hiding the block settings menu.
|
|
102
|
-
const showBlockActions =
|
|
103
|
-
|
|
104
|
-
'__experimentalToolbar',
|
|
105
|
-
|
|
106
|
-
);
|
|
107
|
-
const instanceId = useInstanceId( ListViewBlock );
|
|
156
|
+
const showBlockActions =
|
|
157
|
+
!! block &&
|
|
158
|
+
hasBlockSupport( block.name, '__experimentalToolbar', true );
|
|
159
|
+
|
|
108
160
|
const descriptionId = `list-view-block-select-button__${ instanceId }`;
|
|
109
161
|
const blockPositionDescription = getBlockPositionDescription(
|
|
110
162
|
position,
|
|
@@ -143,9 +195,7 @@ function ListViewBlock( {
|
|
|
143
195
|
)
|
|
144
196
|
: __( 'Edit' );
|
|
145
197
|
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
const isEditable = block.name !== 'core/page-list-item';
|
|
198
|
+
const isEditable = !! block && block.name !== 'core/page-list-item';
|
|
149
199
|
const hasSiblings = siblingBlockCount > 0;
|
|
150
200
|
const hasRenderedMovers = showBlockMovers && hasSiblings;
|
|
151
201
|
const moverCellClassName = classnames(
|
|
@@ -163,53 +213,6 @@ function ListViewBlock( {
|
|
|
163
213
|
{ 'is-visible': isHovered || isFirstSelectedBlock }
|
|
164
214
|
);
|
|
165
215
|
|
|
166
|
-
// If ListView has experimental features related to the Persistent List View,
|
|
167
|
-
// only focus the selected list item on mount; otherwise the list would always
|
|
168
|
-
// try to steal the focus from the editor canvas.
|
|
169
|
-
useEffect( () => {
|
|
170
|
-
if ( ! isTreeGridMounted && isSelected ) {
|
|
171
|
-
cellRef.current.focus();
|
|
172
|
-
}
|
|
173
|
-
}, [] );
|
|
174
|
-
|
|
175
|
-
const onMouseEnter = useCallback( () => {
|
|
176
|
-
setIsHovered( true );
|
|
177
|
-
toggleBlockHighlight( clientId, true );
|
|
178
|
-
}, [ clientId, setIsHovered, toggleBlockHighlight ] );
|
|
179
|
-
const onMouseLeave = useCallback( () => {
|
|
180
|
-
setIsHovered( false );
|
|
181
|
-
toggleBlockHighlight( clientId, false );
|
|
182
|
-
}, [ clientId, setIsHovered, toggleBlockHighlight ] );
|
|
183
|
-
|
|
184
|
-
const selectEditorBlock = useCallback(
|
|
185
|
-
( event ) => {
|
|
186
|
-
selectBlock( event, clientId );
|
|
187
|
-
event.preventDefault();
|
|
188
|
-
},
|
|
189
|
-
[ clientId, selectBlock ]
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
const updateSelection = useCallback(
|
|
193
|
-
( newClientId ) => {
|
|
194
|
-
selectBlock( undefined, newClientId );
|
|
195
|
-
},
|
|
196
|
-
[ selectBlock ]
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
const toggleExpanded = useCallback(
|
|
200
|
-
( event ) => {
|
|
201
|
-
// Prevent shift+click from opening link in a new window when toggling.
|
|
202
|
-
event.preventDefault();
|
|
203
|
-
event.stopPropagation();
|
|
204
|
-
if ( isExpanded === true ) {
|
|
205
|
-
collapse( clientId );
|
|
206
|
-
} else if ( isExpanded === false ) {
|
|
207
|
-
expand( clientId );
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
[ clientId, expand, collapse, isExpanded ]
|
|
211
|
-
);
|
|
212
|
-
|
|
213
216
|
let colSpan;
|
|
214
217
|
if ( hasRenderedMovers ) {
|
|
215
218
|
colSpan = 2;
|
|
@@ -369,24 +372,38 @@ function ListViewBlock( {
|
|
|
369
372
|
const newLink = createBlock(
|
|
370
373
|
'core/navigation-link'
|
|
371
374
|
);
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
375
|
+
if (
|
|
376
|
+
block.name ===
|
|
377
|
+
'core/navigation-submenu'
|
|
378
|
+
) {
|
|
379
|
+
const updateSelectionOnInsert = false;
|
|
380
|
+
insertBlock(
|
|
381
|
+
newLink,
|
|
382
|
+
block.innerBlocks.length,
|
|
383
|
+
clientId,
|
|
384
|
+
updateSelectionOnInsert
|
|
385
|
+
);
|
|
386
|
+
} else {
|
|
387
|
+
// Convert to a submenu if the block currently isn't one.
|
|
388
|
+
const newSubmenu = createBlock(
|
|
389
|
+
'core/navigation-submenu',
|
|
390
|
+
block.attributes,
|
|
391
|
+
block.innerBlocks
|
|
392
|
+
? [
|
|
393
|
+
...block.innerBlocks,
|
|
394
|
+
newLink,
|
|
395
|
+
]
|
|
396
|
+
: [ newLink ]
|
|
397
|
+
);
|
|
398
|
+
replaceBlock(
|
|
399
|
+
clientId,
|
|
400
|
+
newSubmenu
|
|
401
|
+
);
|
|
402
|
+
}
|
|
386
403
|
onClose();
|
|
387
404
|
} }
|
|
388
405
|
>
|
|
389
|
-
{ __( 'Add
|
|
406
|
+
{ __( 'Add submenu item' ) }
|
|
390
407
|
</MenuItem>
|
|
391
408
|
) }
|
|
392
409
|
</BlockSettingsDropdown>
|
|
@@ -231,6 +231,15 @@ function __ExperimentalOffCanvasEditor(
|
|
|
231
231
|
<Appender { ...treeGridCellProps } />
|
|
232
232
|
) }
|
|
233
233
|
</TreeGridCell>
|
|
234
|
+
{ ! clientIdsTree.length && (
|
|
235
|
+
<TreeGridCell withoutGridItem>
|
|
236
|
+
<div className="offcanvas-editor-list-view-is-empty">
|
|
237
|
+
{ __(
|
|
238
|
+
'Your menu is currently empty. Add your first menu item to get started.'
|
|
239
|
+
) }
|
|
240
|
+
</div>
|
|
241
|
+
</TreeGridCell>
|
|
242
|
+
) }
|
|
234
243
|
</TreeGridRow>
|
|
235
244
|
</ListViewContext.Provider>
|
|
236
245
|
</TreeGrid>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.offcanvas-editor__appender .block-editor-inserter__toggle {
|
|
2
2
|
background-color: #1e1e1e;
|
|
3
3
|
color: #fff;
|
|
4
|
-
margin: $grid-unit-10 0 0
|
|
4
|
+
margin: $grid-unit-10 0 0 24px;
|
|
5
5
|
border-radius: 2px;
|
|
6
6
|
height: 24px;
|
|
7
7
|
min-width: 24px;
|
|
@@ -24,3 +24,7 @@
|
|
|
24
24
|
// sidebar width - tab panel padding
|
|
25
25
|
max-width: $sidebar-width - (2 * $grid-unit-20);
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
.offcanvas-editor-list-view-is-empty {
|
|
29
|
+
margin-left: $grid-unit-20;
|
|
30
|
+
}
|