@wordpress/block-editor 11.3.6 → 11.5.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 +3 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-popover/inbetween.js +10 -33
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +2 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -0
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +107 -0
- package/build/components/child-layout-control/index.js.map +1 -0
- package/build/components/colors-gradients/control.js +6 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +3 -3
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +0 -3
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +594 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +142 -45
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +38 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +434 -0
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +7 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +17 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -11
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +23 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +9 -15
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +4 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +4 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +38 -9
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/link-control/index.js +55 -28
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +72 -30
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +53 -0
- package/build/components/link-control/settings.js.map +1 -0
- package/build/components/list-view/block.js +4 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/expander.js +2 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/index.js +6 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +5 -10
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +3 -2
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +1 -0
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +7 -3
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +24 -4
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +2 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -0
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +9 -45
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-delete.js +73 -0
- package/build/components/rich-text/use-delete.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +14 -6
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/url-input/index.js +2 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +4 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/align.js +3 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/dimensions.js +78 -190
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +94 -25
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +2 -76
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +3 -51
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +0 -201
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +14 -5
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js +0 -42
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/margin.js +7 -163
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +7 -163
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/typography.js +98 -128
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +75 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +1 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +24 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +53 -47
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +22 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +36 -3
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +10 -33
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -0
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +98 -0
- package/build-module/components/child-layout-control/index.js.map +1 -0
- package/build-module/components/colors-gradients/control.js +6 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -4
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +2 -1
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +574 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +138 -46
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +415 -0
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +7 -3
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +17 -11
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-size-control/index.js +7 -12
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +9 -15
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +3 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +3 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +39 -9
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/link-control/index.js +56 -28
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +68 -30
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +44 -0
- package/build-module/components/link-control/settings.js.map +1 -0
- package/build-module/components/list-view/block.js +4 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/expander.js +2 -1
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/index.js +6 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +5 -10
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +3 -2
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +1 -0
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +7 -3
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +27 -7
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +2 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -0
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -45
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-delete.js +62 -0
- package/build-module/components/rich-text/use-delete.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +14 -6
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +4 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/align.js +3 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/dimensions.js +81 -187
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +86 -24
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -69
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +6 -47
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +0 -182
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +14 -5
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js +0 -38
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/margin.js +4 -143
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +4 -143
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/typography.js +97 -123
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +70 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +1 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +24 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +53 -45
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +36 -3
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +54 -64
- package/build-style/style.css +54 -64
- package/package.json +31 -31
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +0 -9
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/block-popover/inbetween.js +21 -53
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-styles/index.js +5 -1
- package/src/components/block-types-list/index.native.js +2 -0
- package/src/components/child-layout-control/index.js +106 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +3 -0
- package/src/components/date-format-picker/index.js +6 -8
- package/src/components/date-format-picker/style.scss +0 -5
- package/src/components/font-appearance-control/index.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +627 -0
- package/src/components/global-styles/hooks.js +229 -66
- package/src/components/global-styles/index.js +9 -0
- package/src/components/global-styles/typography-panel.js +428 -0
- package/src/components/global-styles/use-global-styles-output.js +10 -5
- package/src/components/global-styles/utils.js +2 -0
- package/src/components/iframe/index.js +20 -18
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
- package/src/components/image-size-control/index.js +10 -12
- package/src/components/image-size-control/style.scss +3 -21
- package/src/components/index.native.js +5 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/block-patterns-tab.js +9 -23
- package/src/components/inserter/block-types-tab.native.js +2 -0
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
- package/src/components/inserter/search-results.native.js +2 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/src/components/inspector-controls/fill.js +32 -8
- package/src/components/link-control/index.js +69 -34
- package/src/components/link-control/settings-drawer.js +85 -29
- package/src/components/link-control/settings.js +42 -0
- package/src/components/link-control/style.scss +63 -37
- package/src/components/link-control/test/index.js +347 -9
- package/src/components/list-view/block.js +7 -1
- package/src/components/list-view/expander.js +1 -0
- package/src/components/list-view/index.js +5 -0
- package/src/components/media-replace-flow/style.scss +7 -9
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/off-canvas-editor/appender.js +13 -16
- package/src/components/off-canvas-editor/block-contents.js +2 -1
- package/src/components/off-canvas-editor/branch.js +1 -0
- package/src/components/off-canvas-editor/index.js +8 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +52 -15
- package/src/components/off-canvas-editor/link-ui.js +2 -0
- package/src/components/responsive-block-control/index.js +1 -0
- package/src/components/rich-text/index.js +8 -46
- package/src/components/rich-text/use-delete.js +59 -0
- package/src/components/rich-text/use-input-rules.js +13 -5
- package/src/components/url-input/index.js +3 -2
- package/src/components/url-popover/stories/index.js +1 -0
- package/src/components/writing-flow/use-selection-observer.js +5 -1
- package/src/hooks/align.js +1 -1
- package/src/hooks/dimensions.js +97 -269
- package/src/hooks/duotone.js +100 -30
- package/src/hooks/font-family.js +0 -58
- package/src/hooks/font-size.js +1 -36
- package/src/hooks/gap.js +0 -201
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +19 -6
- package/src/hooks/line-height.js +0 -33
- package/src/hooks/margin.js +1 -164
- package/src/hooks/padding.js +1 -163
- package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
- package/src/hooks/test/duotone.js +102 -0
- package/src/hooks/typography.js +112 -213
- package/src/hooks/utils.js +90 -0
- package/src/layouts/flex.js +1 -0
- package/src/store/actions.js +12 -4
- package/src/store/reducer.js +68 -43
- package/src/store/selectors.js +20 -1
- package/src/store/test/actions.js +4 -2
- package/src/utils/parse-css-unit-to-px.js +35 -5
- package/src/utils/test/parse-css-unit-to-px.js +12 -0
- package/build/hooks/child-layout.js +0 -213
- package/build/hooks/child-layout.js.map +0 -1
- package/build/hooks/font-appearance.js +0 -188
- package/build/hooks/font-appearance.js.map +0 -1
- package/build/hooks/letter-spacing.js +0 -129
- package/build/hooks/letter-spacing.js.map +0 -1
- package/build/hooks/min-height.js +0 -139
- package/build/hooks/min-height.js.map +0 -1
- package/build/hooks/text-decoration.js +0 -130
- package/build/hooks/text-decoration.js.map +0 -1
- package/build/hooks/text-transform.js +0 -130
- package/build/hooks/text-transform.js.map +0 -1
- package/build-module/hooks/child-layout.js +0 -193
- package/build-module/hooks/child-layout.js.map +0 -1
- package/build-module/hooks/font-appearance.js +0 -161
- package/build-module/hooks/font-appearance.js.map +0 -1
- package/build-module/hooks/letter-spacing.js +0 -107
- package/build-module/hooks/letter-spacing.js.map +0 -1
- package/build-module/hooks/min-height.js +0 -116
- package/build-module/hooks/min-height.js.map +0 -1
- package/build-module/hooks/text-decoration.js +0 -108
- package/build-module/hooks/text-decoration.js.map +0 -1
- package/build-module/hooks/text-transform.js +0 -108
- package/build-module/hooks/text-transform.js.map +0 -1
- package/src/hooks/child-layout.js +0 -195
- package/src/hooks/font-appearance.js +0 -146
- package/src/hooks/letter-spacing.js +0 -101
- package/src/hooks/min-height.js +0 -104
- package/src/hooks/text-decoration.js +0 -102
- package/src/hooks/text-transform.js +0 -101
|
@@ -174,6 +174,11 @@ function ListView(
|
|
|
174
174
|
[ isMounted.current, draggedClientIds, expandedState, expand, collapse ]
|
|
175
175
|
);
|
|
176
176
|
|
|
177
|
+
// If there are no blocks to show, do not render the list view.
|
|
178
|
+
if ( ! clientIdsTree.length ) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
|
|
177
182
|
return (
|
|
178
183
|
<AsyncModeProvider value={ true }>
|
|
179
184
|
<ListViewDropIndicator
|
|
@@ -23,24 +23,22 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.block-editor-link-control {
|
|
26
|
-
width:
|
|
26
|
+
width: 300px; // Hardcoded width avoids resizing of control when switching between preview/edit.
|
|
27
27
|
|
|
28
28
|
.block-editor-url-input {
|
|
29
29
|
padding: 0; // Cancel unnecessary default 1px padding in this case.
|
|
30
30
|
margin: 0; // Reset default LinkControl margins.
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.block-editor-link-control__search-item-title {
|
|
38
|
-
max-width: 180px;
|
|
33
|
+
.block-editor-link-control__search-item-title,
|
|
34
|
+
.block-editor-link-control__search-item-info {
|
|
35
|
+
max-width: 200px;
|
|
39
36
|
white-space: nowrap;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
.block-editor-link-
|
|
43
|
-
|
|
39
|
+
.block-editor-link-control__tools {
|
|
40
|
+
justify-content: flex-end;
|
|
41
|
+
padding: $grid-unit-20 var(--wp-admin-border-width-focus) var(--wp-admin-border-width-focus);
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
.block-editor-link-control__search-item.is-current {
|
|
@@ -15,26 +15,23 @@ import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
|
15
15
|
import Inserter from '../inserter';
|
|
16
16
|
|
|
17
17
|
export const Appender = forwardRef(
|
|
18
|
-
( { nestingLevel, blockCount, ...props }, ref ) => {
|
|
18
|
+
( { nestingLevel, blockCount, clientId, ...props }, ref ) => {
|
|
19
19
|
const [ insertedBlock, setInsertedBlock ] = useState( null );
|
|
20
20
|
|
|
21
21
|
const instanceId = useInstanceId( Appender );
|
|
22
|
-
const { hideInserter
|
|
23
|
-
|
|
24
|
-
getTemplateLock,
|
|
25
|
-
|
|
26
|
-
getSelectedBlockClientId,
|
|
27
|
-
} = select( blockEditorStore );
|
|
22
|
+
const { hideInserter } = useSelect(
|
|
23
|
+
( select ) => {
|
|
24
|
+
const { getTemplateLock, __unstableGetEditorMode } =
|
|
25
|
+
select( blockEditorStore );
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [] );
|
|
27
|
+
return {
|
|
28
|
+
hideInserter:
|
|
29
|
+
!! getTemplateLock( clientId ) ||
|
|
30
|
+
__unstableGetEditorMode() === 'zoom-out',
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
[ clientId ]
|
|
34
|
+
);
|
|
38
35
|
|
|
39
36
|
const blockTitle = useBlockDisplayTitle( {
|
|
40
37
|
clientId,
|
|
@@ -73,7 +73,7 @@ const ListViewBlockContents = forwardRef(
|
|
|
73
73
|
setInsertedBlockAttributes,
|
|
74
74
|
} = useInsertedBlock( lastInsertedBlockClientId );
|
|
75
75
|
|
|
76
|
-
const hasExistingLinkValue = insertedBlockAttributes?.
|
|
76
|
+
const hasExistingLinkValue = insertedBlockAttributes?.url;
|
|
77
77
|
|
|
78
78
|
useEffect( () => {
|
|
79
79
|
if (
|
|
@@ -121,6 +121,7 @@ const ListViewBlockContents = forwardRef(
|
|
|
121
121
|
);
|
|
122
122
|
setIsLinkUIOpen( false );
|
|
123
123
|
} }
|
|
124
|
+
onCancel={ () => setIsLinkUIOpen( false ) }
|
|
124
125
|
/>
|
|
125
126
|
) }
|
|
126
127
|
<BlockDraggable clientIds={ draggableClientIds }>
|
|
@@ -80,9 +80,10 @@ function OffCanvasEditor(
|
|
|
80
80
|
const { clientIdsTree, draggedClientIds, selectedClientIds } =
|
|
81
81
|
useListViewClientIds( blocks );
|
|
82
82
|
|
|
83
|
-
const { visibleBlockCount, shouldShowInnerBlocks } = useSelect(
|
|
83
|
+
const { visibleBlockCount, shouldShowInnerBlocks, parentId } = useSelect(
|
|
84
84
|
( select ) => {
|
|
85
85
|
const {
|
|
86
|
+
getBlockRootClientId,
|
|
86
87
|
getGlobalBlockCount,
|
|
87
88
|
getClientIdsOfDescendants,
|
|
88
89
|
__unstableGetEditorMode,
|
|
@@ -94,9 +95,13 @@ function OffCanvasEditor(
|
|
|
94
95
|
return {
|
|
95
96
|
visibleBlockCount: getGlobalBlockCount() - draggedBlockCount,
|
|
96
97
|
shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',
|
|
98
|
+
parentId:
|
|
99
|
+
blocks.length > 0
|
|
100
|
+
? getBlockRootClientId( blocks[ 0 ].clientId )
|
|
101
|
+
: undefined,
|
|
97
102
|
};
|
|
98
103
|
},
|
|
99
|
-
[ draggedClientIds ]
|
|
104
|
+
[ draggedClientIds, blocks ]
|
|
100
105
|
);
|
|
101
106
|
|
|
102
107
|
const { updateBlockSelection } = useBlockSelection();
|
|
@@ -227,6 +232,7 @@ function OffCanvasEditor(
|
|
|
227
232
|
>
|
|
228
233
|
<ListViewContext.Provider value={ contextValue }>
|
|
229
234
|
<ListViewBranch
|
|
235
|
+
parentId={ parentId }
|
|
230
236
|
blocks={ clientIdsTree }
|
|
231
237
|
selectBlock={ selectEditorBlock }
|
|
232
238
|
showBlockMovers={ showBlockMovers }
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
addSubmenu,
|
|
7
|
+
chevronUp,
|
|
8
|
+
chevronDown,
|
|
9
|
+
moreVertical,
|
|
10
|
+
} from '@wordpress/icons';
|
|
6
11
|
import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
|
|
7
|
-
import { useDispatch } from '@wordpress/data';
|
|
12
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
13
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
14
|
|
|
10
15
|
/**
|
|
@@ -85,14 +90,24 @@ function AddSubmenuItem( { block, onClose } ) {
|
|
|
85
90
|
export default function LeafMoreMenu( props ) {
|
|
86
91
|
const { clientId, block } = props;
|
|
87
92
|
|
|
88
|
-
const { removeBlocks } =
|
|
93
|
+
const { moveBlocksDown, moveBlocksUp, removeBlocks } =
|
|
94
|
+
useDispatch( blockEditorStore );
|
|
89
95
|
|
|
90
|
-
const
|
|
96
|
+
const removeLabel = sprintf(
|
|
91
97
|
/* translators: %s: block name */
|
|
92
98
|
__( 'Remove %s' ),
|
|
93
99
|
BlockTitle( { clientId, maximumLength: 25 } )
|
|
94
100
|
);
|
|
95
101
|
|
|
102
|
+
const rootClientId = useSelect(
|
|
103
|
+
( select ) => {
|
|
104
|
+
const { getBlockRootClientId } = select( blockEditorStore );
|
|
105
|
+
|
|
106
|
+
return getBlockRootClientId( clientId );
|
|
107
|
+
},
|
|
108
|
+
[ clientId ]
|
|
109
|
+
);
|
|
110
|
+
|
|
96
111
|
return (
|
|
97
112
|
<DropdownMenu
|
|
98
113
|
icon={ moreVertical }
|
|
@@ -103,17 +118,39 @@ export default function LeafMoreMenu( props ) {
|
|
|
103
118
|
{ ...props }
|
|
104
119
|
>
|
|
105
120
|
{ ( { onClose } ) => (
|
|
106
|
-
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
121
|
+
<>
|
|
122
|
+
<MenuGroup>
|
|
123
|
+
<MenuItem
|
|
124
|
+
icon={ chevronUp }
|
|
125
|
+
onClick={ () => {
|
|
126
|
+
moveBlocksUp( [ clientId ], rootClientId );
|
|
127
|
+
onClose();
|
|
128
|
+
} }
|
|
129
|
+
>
|
|
130
|
+
{ __( 'Move up' ) }
|
|
131
|
+
</MenuItem>
|
|
132
|
+
<MenuItem
|
|
133
|
+
icon={ chevronDown }
|
|
134
|
+
onClick={ () => {
|
|
135
|
+
moveBlocksDown( [ clientId ], rootClientId );
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
>
|
|
139
|
+
{ __( 'Move down' ) }
|
|
140
|
+
</MenuItem>
|
|
141
|
+
<AddSubmenuItem block={ block } onClose={ onClose } />
|
|
142
|
+
</MenuGroup>
|
|
143
|
+
<MenuGroup>
|
|
144
|
+
<MenuItem
|
|
145
|
+
onClick={ () => {
|
|
146
|
+
removeBlocks( [ clientId ], false );
|
|
147
|
+
onClose();
|
|
148
|
+
} }
|
|
149
|
+
>
|
|
150
|
+
{ removeLabel }
|
|
151
|
+
</MenuItem>
|
|
152
|
+
</MenuGroup>
|
|
153
|
+
</>
|
|
117
154
|
) }
|
|
118
155
|
</DropdownMenu>
|
|
119
156
|
);
|
|
@@ -137,6 +137,7 @@ export function LinkUI( props ) {
|
|
|
137
137
|
placement="bottom"
|
|
138
138
|
onClose={ props.onClose }
|
|
139
139
|
anchor={ props.anchor }
|
|
140
|
+
__unstableSlotName={ '__unstable-block-tools-after' }
|
|
140
141
|
shift
|
|
141
142
|
>
|
|
142
143
|
<LinkControl
|
|
@@ -151,6 +152,7 @@ export function LinkUI( props ) {
|
|
|
151
152
|
suggestionsQuery={ getSuggestionsQuery( type, kind ) }
|
|
152
153
|
onChange={ props.onChange }
|
|
153
154
|
onRemove={ props.onRemove }
|
|
155
|
+
onCancel={ props.onCancel }
|
|
154
156
|
renderControlBottom={
|
|
155
157
|
! url
|
|
156
158
|
? () => (
|
|
@@ -92,6 +92,7 @@ function ResponsiveBlockControl( props ) {
|
|
|
92
92
|
|
|
93
93
|
<div className="block-editor-responsive-block-control__inner">
|
|
94
94
|
<ToggleControl
|
|
95
|
+
__nextHasNoMarginBottom
|
|
95
96
|
className="block-editor-responsive-block-control__toggle"
|
|
96
97
|
label={ toggleControlLabel }
|
|
97
98
|
checked={ ! isResponsive }
|
|
@@ -19,12 +19,9 @@ import { useInstanceId, useMergeRefs } from '@wordpress/compose';
|
|
|
19
19
|
import {
|
|
20
20
|
__unstableUseRichText as useRichText,
|
|
21
21
|
__unstableCreateElement,
|
|
22
|
-
isEmpty,
|
|
23
|
-
isCollapsed,
|
|
24
22
|
removeFormat,
|
|
25
23
|
} from '@wordpress/rich-text';
|
|
26
24
|
import deprecated from '@wordpress/deprecated';
|
|
27
|
-
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
28
25
|
import { Popover } from '@wordpress/components';
|
|
29
26
|
|
|
30
27
|
/**
|
|
@@ -39,6 +36,7 @@ import { useMarkPersistent } from './use-mark-persistent';
|
|
|
39
36
|
import { usePasteHandler } from './use-paste-handler';
|
|
40
37
|
import { useBeforeInputRules } from './use-before-input-rules';
|
|
41
38
|
import { useInputRules } from './use-input-rules';
|
|
39
|
+
import { useDelete } from './use-delete';
|
|
42
40
|
import { useEnter } from './use-enter';
|
|
43
41
|
import { useFormatTypes } from './use-format-types';
|
|
44
42
|
import { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';
|
|
@@ -110,7 +108,6 @@ function RichTextWrapper(
|
|
|
110
108
|
__unstableEmbedURLOnPaste,
|
|
111
109
|
__unstableDisableFormats: disableFormats,
|
|
112
110
|
disableLineBreaks,
|
|
113
|
-
unstableOnFocus,
|
|
114
111
|
__unstableAllowPrefixTransformations,
|
|
115
112
|
...props
|
|
116
113
|
},
|
|
@@ -281,6 +278,7 @@ function RichTextWrapper(
|
|
|
281
278
|
|
|
282
279
|
const {
|
|
283
280
|
value,
|
|
281
|
+
getValue,
|
|
284
282
|
onChange,
|
|
285
283
|
ref: richTextRef,
|
|
286
284
|
} = useRichText( {
|
|
@@ -316,45 +314,6 @@ function RichTextWrapper(
|
|
|
316
314
|
const keyboardShortcuts = useRef( new Set() );
|
|
317
315
|
const inputEvents = useRef( new Set() );
|
|
318
316
|
|
|
319
|
-
function onKeyDown( event ) {
|
|
320
|
-
const { keyCode } = event;
|
|
321
|
-
|
|
322
|
-
if ( event.defaultPrevented ) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if ( keyCode === DELETE || keyCode === BACKSPACE ) {
|
|
327
|
-
const { start, end, text } = value;
|
|
328
|
-
const isReverse = keyCode === BACKSPACE;
|
|
329
|
-
const hasActiveFormats =
|
|
330
|
-
value.activeFormats && !! value.activeFormats.length;
|
|
331
|
-
|
|
332
|
-
// Only process delete if the key press occurs at an uncollapsed edge.
|
|
333
|
-
if (
|
|
334
|
-
! isCollapsed( value ) ||
|
|
335
|
-
hasActiveFormats ||
|
|
336
|
-
( isReverse && start !== 0 ) ||
|
|
337
|
-
( ! isReverse && end !== text.length )
|
|
338
|
-
) {
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if ( onMerge ) {
|
|
343
|
-
onMerge( ! isReverse );
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// Only handle remove on Backspace. This serves dual-purpose of being
|
|
347
|
-
// an intentional user interaction distinguishing between Backspace and
|
|
348
|
-
// Delete to remove the empty field, but also to avoid merge & remove
|
|
349
|
-
// causing destruction of two fields (merge, then removed merged).
|
|
350
|
-
if ( onRemove && isEmpty( value ) && isReverse ) {
|
|
351
|
-
onRemove( ! isReverse );
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
event.preventDefault();
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
317
|
function onFocus() {
|
|
359
318
|
anchorRef.current?.focus();
|
|
360
319
|
}
|
|
@@ -401,7 +360,7 @@ function RichTextWrapper(
|
|
|
401
360
|
richTextRef,
|
|
402
361
|
useBeforeInputRules( { value, onChange } ),
|
|
403
362
|
useInputRules( {
|
|
404
|
-
|
|
363
|
+
getValue,
|
|
405
364
|
onChange,
|
|
406
365
|
__unstableAllowPrefixTransformations,
|
|
407
366
|
formatTypes,
|
|
@@ -428,6 +387,11 @@ function RichTextWrapper(
|
|
|
428
387
|
preserveWhiteSpace,
|
|
429
388
|
pastePlainText,
|
|
430
389
|
} ),
|
|
390
|
+
useDelete( {
|
|
391
|
+
value,
|
|
392
|
+
onMerge,
|
|
393
|
+
onRemove,
|
|
394
|
+
} ),
|
|
431
395
|
useEnter( {
|
|
432
396
|
removeEditorOnlyFormats,
|
|
433
397
|
value,
|
|
@@ -449,8 +413,6 @@ function RichTextWrapper(
|
|
|
449
413
|
props.className,
|
|
450
414
|
'rich-text'
|
|
451
415
|
) }
|
|
452
|
-
onFocus={ unstableOnFocus }
|
|
453
|
-
onKeyDown={ onKeyDown }
|
|
454
416
|
/>
|
|
455
417
|
</>
|
|
456
418
|
);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef } from '@wordpress/element';
|
|
5
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
6
|
+
import { DELETE, BACKSPACE } from '@wordpress/keycodes';
|
|
7
|
+
import { isCollapsed, isEmpty } from '@wordpress/rich-text';
|
|
8
|
+
|
|
9
|
+
export function useDelete( props ) {
|
|
10
|
+
const propsRef = useRef( props );
|
|
11
|
+
propsRef.current = props;
|
|
12
|
+
return useRefEffect( ( element ) => {
|
|
13
|
+
function onKeyDown( event ) {
|
|
14
|
+
const { keyCode } = event;
|
|
15
|
+
|
|
16
|
+
if ( event.defaultPrevented ) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { value, onMerge, onRemove } = propsRef.current;
|
|
21
|
+
|
|
22
|
+
if ( keyCode === DELETE || keyCode === BACKSPACE ) {
|
|
23
|
+
const { start, end, text } = value;
|
|
24
|
+
const isReverse = keyCode === BACKSPACE;
|
|
25
|
+
const hasActiveFormats =
|
|
26
|
+
value.activeFormats && !! value.activeFormats.length;
|
|
27
|
+
|
|
28
|
+
// Only process delete if the key press occurs at an uncollapsed edge.
|
|
29
|
+
if (
|
|
30
|
+
! isCollapsed( value ) ||
|
|
31
|
+
hasActiveFormats ||
|
|
32
|
+
( isReverse && start !== 0 ) ||
|
|
33
|
+
( ! isReverse && end !== text.length )
|
|
34
|
+
) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ( onMerge ) {
|
|
39
|
+
onMerge( ! isReverse );
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Only handle remove on Backspace. This serves dual-purpose of being
|
|
43
|
+
// an intentional user interaction distinguishing between Backspace and
|
|
44
|
+
// Delete to remove the empty field, but also to avoid merge & remove
|
|
45
|
+
// causing destruction of two fields (merge, then removed merged).
|
|
46
|
+
if ( onRemove && isEmpty( value ) && isReverse ) {
|
|
47
|
+
onRemove( ! isReverse );
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
element.addEventListener( 'keydown', onKeyDown );
|
|
55
|
+
return () => {
|
|
56
|
+
element.removeEventListener( 'keydown', onKeyDown );
|
|
57
|
+
};
|
|
58
|
+
}, [] );
|
|
59
|
+
}
|
|
@@ -29,7 +29,7 @@ function findSelection( blocks ) {
|
|
|
29
29
|
blocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[
|
|
30
30
|
attributeKey
|
|
31
31
|
].replace( START_OF_SELECTED_AREA, '' );
|
|
32
|
-
return blocks[ i ].clientId;
|
|
32
|
+
return [ blocks[ i ].clientId, attributeKey, 0, 0 ];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const nestedSelection = findSelection( blocks[ i ].innerBlocks );
|
|
@@ -38,6 +38,8 @@ function findSelection( blocks ) {
|
|
|
38
38
|
return nestedSelection;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
return [];
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export function useInputRules( props ) {
|
|
@@ -49,12 +51,15 @@ export function useInputRules( props ) {
|
|
|
49
51
|
propsRef.current = props;
|
|
50
52
|
return useRefEffect( ( element ) => {
|
|
51
53
|
function inputRule() {
|
|
52
|
-
const {
|
|
54
|
+
const { getValue, onReplace, selectionChange } = propsRef.current;
|
|
53
55
|
|
|
54
56
|
if ( ! onReplace ) {
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
// We must use getValue() here because value may be update
|
|
61
|
+
// asynchronously.
|
|
62
|
+
const value = getValue();
|
|
58
63
|
const { start, text } = value;
|
|
59
64
|
const characterBefore = text.slice( start - 1, start );
|
|
60
65
|
|
|
@@ -83,15 +88,17 @@ export function useInputRules( props ) {
|
|
|
83
88
|
} );
|
|
84
89
|
const block = transformation.transform( content );
|
|
85
90
|
|
|
86
|
-
selectionChange( findSelection( [ block ] ) );
|
|
91
|
+
selectionChange( ...findSelection( [ block ] ) );
|
|
87
92
|
onReplace( [ block ] );
|
|
88
93
|
__unstableMarkAutomaticChange();
|
|
94
|
+
|
|
95
|
+
return true;
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
function onInput( event ) {
|
|
92
99
|
const { inputType, type } = event;
|
|
93
100
|
const {
|
|
94
|
-
|
|
101
|
+
getValue,
|
|
95
102
|
onChange,
|
|
96
103
|
__unstableAllowPrefixTransformations,
|
|
97
104
|
formatTypes,
|
|
@@ -103,9 +110,10 @@ export function useInputRules( props ) {
|
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
if ( __unstableAllowPrefixTransformations && inputRule ) {
|
|
106
|
-
inputRule();
|
|
113
|
+
if ( inputRule() ) return;
|
|
107
114
|
}
|
|
108
115
|
|
|
116
|
+
const value = getValue();
|
|
109
117
|
const transformed = formatTypes.reduce(
|
|
110
118
|
( accumlator, { __unstableInputRule } ) => {
|
|
111
119
|
if ( __unstableInputRule ) {
|
|
@@ -468,7 +468,7 @@ class URLInput extends Component {
|
|
|
468
468
|
'aria-label': label ? undefined : __( 'URL' ), // Ensure input always has an accessible label
|
|
469
469
|
'aria-expanded': showSuggestions,
|
|
470
470
|
'aria-autocomplete': 'list',
|
|
471
|
-
'aria-
|
|
471
|
+
'aria-owns': suggestionsListboxId,
|
|
472
472
|
'aria-activedescendant':
|
|
473
473
|
selectedSuggestion !== null
|
|
474
474
|
? `${ suggestionOptionIdPrefix }-${ selectedSuggestion }`
|
|
@@ -531,7 +531,8 @@ class URLInput extends Component {
|
|
|
531
531
|
tabIndex: '-1',
|
|
532
532
|
id: `${ suggestionOptionIdPrefix }-${ index }`,
|
|
533
533
|
ref: this.bindSuggestionNode( index ),
|
|
534
|
-
'aria-selected':
|
|
534
|
+
'aria-selected':
|
|
535
|
+
index === selectedSuggestion ? true : undefined,
|
|
535
536
|
};
|
|
536
537
|
};
|
|
537
538
|
|
|
@@ -72,7 +72,11 @@ function findDepth( a, b ) {
|
|
|
72
72
|
* @param {boolean} value `contentEditable` value (true or false)
|
|
73
73
|
*/
|
|
74
74
|
function setContentEditableWrapper( node, value ) {
|
|
75
|
-
|
|
75
|
+
// Since we are calling this on every selection change, check if the value
|
|
76
|
+
// needs to be updated first because it trigger the browser to recalculate
|
|
77
|
+
// style.
|
|
78
|
+
if ( node.contentEditable !== String( value ) )
|
|
79
|
+
node.contentEditable = value;
|
|
76
80
|
// Firefox doesn't automatically move focus.
|
|
77
81
|
if ( value ) node.focus();
|
|
78
82
|
}
|
package/src/hooks/align.js
CHANGED
|
@@ -119,7 +119,7 @@ export function addAttribute( settings ) {
|
|
|
119
119
|
*/
|
|
120
120
|
export const withToolbarControls = createHigherOrderComponent(
|
|
121
121
|
( BlockEdit ) => ( props ) => {
|
|
122
|
-
const blockEdit = <BlockEdit { ...props } />;
|
|
122
|
+
const blockEdit = <BlockEdit key="edit" { ...props } />;
|
|
123
123
|
const { name: blockName } = props;
|
|
124
124
|
// Compute the block valid alignments by taking into account,
|
|
125
125
|
// if the theme supports wide alignments or not and the layout's
|