@wordpress/block-editor 12.4.0 → 12.6.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 +4 -0
- package/README.md +1 -0
- package/build/components/block-draggable/index.js +6 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +2 -2
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +25 -13
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +14 -18
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block.native.js +21 -42
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.native.js +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +8 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +15 -25
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -2
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +10 -11
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build/components/block-toolbar/index.js +12 -8
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +62 -3
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +7 -11
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/global-styles/color-panel.js +22 -16
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +13 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +4 -8
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +15 -25
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +52 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +12 -18
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +6 -6
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +36 -48
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +5 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +3 -1
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +7 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +9 -3
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +2 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +21 -32
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +2 -21
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +82 -0
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build/components/inserter/reusable-blocks-tab.js +6 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +9 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/link-control/constants.js +1 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/index.js +21 -16
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +5 -21
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -4
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +13 -30
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/appender.js +2 -6
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -2
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +65 -31
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +5 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- package/build/components/rich-text/content.js +0 -36
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +118 -0
- package/build/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/single.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/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +7 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +49 -8
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-setting/index.js +5 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -27
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +70 -0
- package/build/components/writing-mode-control/index.js.map +1 -0
- package/build/hooks/behaviors.js +25 -20
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +5 -9
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +16 -3
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -0
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +196 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +10 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +46 -40
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +8 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +22 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +52 -23
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +38 -2
- package/build/utils/object.js.map +1 -1
- package/build-module/components/block-draggable/index.js +6 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +2 -2
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +27 -10
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +14 -18
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +24 -43
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +3 -3
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +7 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +17 -24
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +3 -3
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +13 -13
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +12 -8
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +60 -4
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +22 -16
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +13 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +4 -8
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +14 -24
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +51 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +13 -18
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +5 -5
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +37 -49
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +5 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +3 -1
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +7 -33
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +22 -33
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +2 -21
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +67 -0
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +9 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/link-control/constants.js +1 -1
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/index.js +21 -16
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +7 -20
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -4
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +14 -28
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -6
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +66 -33
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +5 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- package/build-module/components/rich-text/content.js +1 -36
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +105 -0
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/single.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/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +7 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +50 -8
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-setting/index.js +5 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +8 -26
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +57 -0
- package/build-module/components/writing-mode-control/index.js.map +1 -0
- package/build-module/hooks/behaviors.js +26 -20
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +6 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +11 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +2 -0
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +193 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +10 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +45 -36
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +5 -5
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -9
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +49 -21
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +34 -2
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +4 -0
- package/build-style/content.css +4 -0
- package/build-style/style-rtl.css +137 -129
- package/build-style/style.css +137 -129
- package/package.json +33 -32
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-controls/README.md +89 -0
- package/src/components/block-draggable/index.js +13 -4
- package/src/components/block-draggable/index.native.js +7 -3
- package/src/components/block-draggable/style.scss +1 -0
- package/src/components/block-draggable/test/index.native.js +0 -54
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
- package/src/components/block-heading-level-dropdown/index.native.js +8 -4
- package/src/components/block-inspector/style.scss +2 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- package/src/components/block-list/block.native.js +24 -38
- package/src/components/block-list/block.native.scss +18 -40
- package/src/components/block-list/style.native.scss +3 -3
- package/src/components/block-lock/toolbar.js +34 -6
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
- package/src/components/block-parent-selector/index.js +13 -8
- package/src/components/block-removal-warning-modal/index.js +17 -33
- package/src/components/block-settings/button.native.js +12 -6
- package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +19 -18
- package/src/components/block-toolbar/index.js +11 -9
- package/src/components/block-toolbar/index.native.js +86 -6
- package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
- package/src/components/block-toolbar/test/index.native.js +42 -0
- package/src/components/block-tools/block-contextual-toolbar.js +5 -11
- package/src/components/block-tools/style.scss +73 -26
- package/src/components/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/colors-gradients/control.js +3 -2
- package/src/components/default-block-appender/content.scss +11 -0
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/font-family/README.md +71 -0
- package/src/components/global-styles/color-panel.js +24 -17
- package/src/components/global-styles/dimensions-panel.js +8 -2
- package/src/components/global-styles/filters-panel.js +2 -2
- package/src/components/global-styles/get-block-css-selector.js +5 -9
- package/src/components/global-styles/hooks.js +22 -26
- package/src/components/global-styles/typography-panel.js +57 -5
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +15 -6
- package/src/components/iframe/index.js +30 -56
- package/src/components/iframe/use-compatibility-styles.js +5 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/index.js +1 -0
- package/src/components/inner-blocks/README.md +10 -0
- package/src/components/inner-blocks/index.js +4 -0
- package/src/components/inner-blocks/index.native.js +4 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
- package/src/components/inserter/block-patterns-tab.js +8 -56
- package/src/components/inserter/hooks/use-block-types-state.js +3 -4
- package/src/components/inserter/hooks/use-patterns-state.js +35 -19
- package/src/components/inserter/index.js +2 -3
- package/src/components/inserter/index.native.js +17 -36
- package/src/components/inserter/media-tab/hooks.js +2 -22
- package/src/components/inserter/reusable-block-rename-hint.js +69 -0
- package/src/components/inserter/reusable-blocks-tab.js +5 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/inserter/style.scss +28 -0
- package/src/components/inserter/tabs.native.js +5 -1
- package/src/components/inserter-draggable-blocks/index.js +13 -2
- package/src/components/link-control/constants.js +1 -1
- package/src/components/link-control/index.js +36 -29
- package/src/components/link-control/search-create-button.js +8 -26
- package/src/components/link-control/search-input.js +4 -3
- package/src/components/link-control/search-item.js +21 -43
- package/src/components/link-control/search-results.js +48 -46
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +58 -123
- package/src/components/link-control/test/index.js +161 -123
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/style.scss +1 -2
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/panel-color-settings/README.md +98 -0
- package/src/components/preview-options/README.md +18 -17
- package/src/components/preview-options/index.js +2 -2
- package/src/components/provider/index.js +9 -2
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/recursion-provider/README.md +101 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- package/src/components/rich-text/content.js +1 -46
- package/src/components/rich-text/get-rich-text-values.js +105 -0
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/text-transform-control/README.md +44 -0
- package/src/components/url-input/index.js +2 -0
- package/src/components/use-block-display-information/index.js +12 -5
- package/src/components/use-block-drop-zone/index.native.js +65 -28
- package/src/components/use-setting/index.js +8 -8
- package/src/components/writing-flow/use-tab-nav.js +10 -33
- package/src/components/writing-mode-control/index.js +68 -0
- package/src/components/writing-mode-control/style.scss +18 -0
- package/src/hooks/behaviors.js +25 -16
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/supports.js +7 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/utils.js +8 -7
- package/src/private-apis.js +13 -1
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +195 -3
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +10 -0
- package/src/store/private-actions.js +39 -39
- package/src/store/private-selectors.js +5 -8
- package/src/store/reducer.js +22 -9
- package/src/store/selectors.js +87 -25
- package/src/store/test/actions.js +114 -0
- package/src/store/test/private-actions.js +56 -0
- package/src/store/test/private-selectors.js +5 -5
- package/src/store/test/reducer.js +14 -7
- package/src/store/test/selectors.js +1 -1
- package/src/utils/object.js +32 -2
- package/src/utils/test/object.js +36 -0
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build/components/block-mobile-toolbar/index.native.js +0 -135
- package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
- package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.native.js +0 -127
- package/src/components/block-mobile-toolbar/style.native.scss +0 -16
- /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
|
@@ -1,23 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useCallback } from '@wordpress/element';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
10
|
+
import BlockActionsMenu from './block-toolbar-menu';
|
|
9
11
|
import BlockControls from '../block-controls';
|
|
12
|
+
import BlockMover from '../block-mover';
|
|
10
13
|
import UngroupButton from '../ungroup-button';
|
|
14
|
+
import { BlockSettingsButton } from '../block-settings';
|
|
11
15
|
import { store as blockEditorStore } from '../../store';
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const REMOVE_EMPY_PARENT_BLOCKS = [
|
|
18
|
+
'core/buttons',
|
|
19
|
+
'core/columns',
|
|
20
|
+
'core/social-links',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export default function BlockToolbar( { anchorNodeRef } ) {
|
|
24
|
+
const {
|
|
25
|
+
rootClientId,
|
|
26
|
+
blockClientId,
|
|
27
|
+
isSelected,
|
|
28
|
+
isValidAndVisual,
|
|
29
|
+
isStackedHorizontally,
|
|
30
|
+
parentBlockName,
|
|
31
|
+
parentNumberOfInnerBlocks,
|
|
32
|
+
} = useSelect( ( select ) => {
|
|
33
|
+
const {
|
|
34
|
+
getBlockListSettings,
|
|
35
|
+
getBlockMode,
|
|
36
|
+
getBlockName,
|
|
37
|
+
getBlockCount,
|
|
38
|
+
getBlockRootClientId,
|
|
39
|
+
getSelectedBlockClientIds,
|
|
40
|
+
isBlockValid,
|
|
41
|
+
} = select( blockEditorStore );
|
|
17
42
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
43
|
+
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
|
|
44
|
+
const blockRootClientId = getBlockRootClientId( selectedBlockClientId );
|
|
45
|
+
const blockListSettings = getBlockListSettings( blockRootClientId );
|
|
46
|
+
const orientation = blockListSettings?.orientation;
|
|
47
|
+
const isBlockStackedHorizontally = orientation === 'horizontal';
|
|
48
|
+
const parentName = getBlockName( blockRootClientId );
|
|
49
|
+
const numberOfInnerBlocks = getBlockCount( blockRootClientId );
|
|
18
50
|
|
|
19
51
|
return {
|
|
52
|
+
rootClientId: blockRootClientId,
|
|
53
|
+
blockClientId: selectedBlockClientId,
|
|
20
54
|
isSelected: selectedBlockClientIds.length > 0,
|
|
55
|
+
isStackedHorizontally: isBlockStackedHorizontally,
|
|
56
|
+
parentBlockName: parentName,
|
|
57
|
+
parentNumberOfInnerBlocks: numberOfInnerBlocks,
|
|
21
58
|
isValidAndVisual:
|
|
22
59
|
selectedBlockClientIds.length === 1
|
|
23
60
|
? isBlockValid( selectedBlockClientIds[ 0 ] ) &&
|
|
@@ -26,6 +63,28 @@ export default function BlockToolbar() {
|
|
|
26
63
|
};
|
|
27
64
|
}, [] );
|
|
28
65
|
|
|
66
|
+
const { removeBlock } = useDispatch( blockEditorStore );
|
|
67
|
+
const onRemove = useCallback( () => {
|
|
68
|
+
// Temp: remove parent block for specific cases where they don't
|
|
69
|
+
// have inner blocks, ideally we should match the behavior as in
|
|
70
|
+
// the Web editor and show a placeholder instead of removing the parent.
|
|
71
|
+
if (
|
|
72
|
+
REMOVE_EMPY_PARENT_BLOCKS.includes( parentBlockName ) &&
|
|
73
|
+
parentNumberOfInnerBlocks === 1
|
|
74
|
+
) {
|
|
75
|
+
removeBlock( rootClientId );
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
removeBlock( blockClientId );
|
|
80
|
+
}, [
|
|
81
|
+
blockClientId,
|
|
82
|
+
parentBlockName,
|
|
83
|
+
parentNumberOfInnerBlocks,
|
|
84
|
+
removeBlock,
|
|
85
|
+
rootClientId,
|
|
86
|
+
] );
|
|
87
|
+
|
|
29
88
|
if ( ! isSelected ) {
|
|
30
89
|
return null;
|
|
31
90
|
}
|
|
@@ -34,11 +93,32 @@ export default function BlockToolbar() {
|
|
|
34
93
|
<>
|
|
35
94
|
{ isValidAndVisual && (
|
|
36
95
|
<>
|
|
37
|
-
<
|
|
96
|
+
<BlockSettingsButton.Slot>
|
|
97
|
+
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|
|
98
|
+
{ ( fills = [ null ] ) => {
|
|
99
|
+
if ( ! fills?.length > 0 ) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return fills[ 0 ];
|
|
103
|
+
} }
|
|
104
|
+
</BlockSettingsButton.Slot>
|
|
38
105
|
<BlockControls.Slot group="block" />
|
|
39
106
|
<BlockControls.Slot />
|
|
40
107
|
<BlockControls.Slot group="inline" />
|
|
41
108
|
<BlockControls.Slot group="other" />
|
|
109
|
+
<UngroupButton />
|
|
110
|
+
|
|
111
|
+
<BlockMover
|
|
112
|
+
clientIds={ [ blockClientId ] }
|
|
113
|
+
isStackedHorizontally={ isStackedHorizontally }
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<BlockActionsMenu
|
|
117
|
+
clientId={ blockClientId }
|
|
118
|
+
isStackedHorizontally={ isStackedHorizontally }
|
|
119
|
+
onDelete={ onRemove }
|
|
120
|
+
anchorNodeRef={ anchorNodeRef }
|
|
121
|
+
/>
|
|
42
122
|
</>
|
|
43
123
|
) }
|
|
44
124
|
</>
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
within,
|
|
10
10
|
getEditorHtml,
|
|
11
11
|
typeInRichText,
|
|
12
|
+
openBlockActionsMenu,
|
|
12
13
|
} from 'test/helpers';
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -36,15 +37,14 @@ describe( 'Block Actions Menu', () => {
|
|
|
36
37
|
<p></p>
|
|
37
38
|
<!-- /wp:paragraph -->`,
|
|
38
39
|
} );
|
|
39
|
-
const {
|
|
40
|
+
const { getByRole } = screen;
|
|
40
41
|
|
|
41
42
|
// Get block
|
|
42
43
|
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
43
44
|
fireEvent.press( paragraphBlock );
|
|
44
45
|
|
|
45
46
|
// Open block actions menu
|
|
46
|
-
|
|
47
|
-
fireEvent.press( blockActionsButton );
|
|
47
|
+
await openBlockActionsMenu( screen );
|
|
48
48
|
|
|
49
49
|
// Get Picker title
|
|
50
50
|
const pickerHeader = getByRole( 'header' );
|
|
@@ -56,10 +56,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
56
56
|
|
|
57
57
|
describe( 'moving blocks', () => {
|
|
58
58
|
it( 'moves blocks up and down', async () => {
|
|
59
|
-
const screen = await initializeEditor(
|
|
60
|
-
|
|
61
|
-
} );
|
|
62
|
-
const { getByLabelText, getByTestId } = screen;
|
|
59
|
+
const screen = await initializeEditor();
|
|
60
|
+
const { getByLabelText } = screen;
|
|
63
61
|
|
|
64
62
|
// Add Paragraph block
|
|
65
63
|
await addBlock( screen, 'Paragraph' );
|
|
@@ -85,16 +83,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
85
83
|
} );
|
|
86
84
|
fireEvent.press( spacerBlock );
|
|
87
85
|
|
|
88
|
-
// Open block actions menu
|
|
89
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
90
|
-
|
|
91
|
-
// Get block actions modal
|
|
92
|
-
let blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
93
|
-
|
|
94
86
|
// Tap on the Move Down button
|
|
95
|
-
fireEvent.press(
|
|
96
|
-
within( blockActionsMenu ).getByLabelText( 'Move block down' )
|
|
97
|
-
);
|
|
87
|
+
fireEvent.press( getByLabelText( /Move block down/ ) );
|
|
98
88
|
|
|
99
89
|
// Get Heading block
|
|
100
90
|
const headingBlock = await getBlock( screen, 'Heading', {
|
|
@@ -102,25 +92,15 @@ describe( 'Block Actions Menu', () => {
|
|
|
102
92
|
} );
|
|
103
93
|
fireEvent.press( headingBlock );
|
|
104
94
|
|
|
105
|
-
// Open block actions menu
|
|
106
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
107
|
-
|
|
108
|
-
// Get block actions modal
|
|
109
|
-
blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
110
|
-
|
|
111
95
|
// Tap on the Move Up button
|
|
112
|
-
fireEvent.press(
|
|
113
|
-
within( blockActionsMenu ).getByLabelText( 'Move block up' )
|
|
114
|
-
);
|
|
96
|
+
fireEvent.press( getByLabelText( /Move block up/ ) );
|
|
115
97
|
|
|
116
98
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
117
99
|
} );
|
|
118
100
|
|
|
119
101
|
it( 'disables the Move Up button for the first block', async () => {
|
|
120
|
-
const screen = await initializeEditor(
|
|
121
|
-
|
|
122
|
-
} );
|
|
123
|
-
const { getByLabelText, getByTestId } = screen;
|
|
102
|
+
const screen = await initializeEditor();
|
|
103
|
+
const { getByLabelText } = screen;
|
|
124
104
|
|
|
125
105
|
// Add Paragraph block
|
|
126
106
|
await addBlock( screen, 'Paragraph' );
|
|
@@ -144,15 +124,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
144
124
|
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
145
125
|
fireEvent.press( paragraphBlock );
|
|
146
126
|
|
|
147
|
-
// Open block actions menu
|
|
148
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
149
|
-
|
|
150
|
-
// Get block actions modal
|
|
151
|
-
const blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
152
|
-
|
|
153
127
|
// Get the Move Up button
|
|
154
|
-
const upButton =
|
|
155
|
-
within( blockActionsMenu ).getByLabelText( 'Move block up' );
|
|
128
|
+
const upButton = getByLabelText( /Move block up/ );
|
|
156
129
|
const isUpButtonDisabled =
|
|
157
130
|
upButton.props.accessibilityState?.disabled;
|
|
158
131
|
expect( isUpButtonDisabled ).toBe( true );
|
|
@@ -167,7 +140,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
167
140
|
const screen = await initializeEditor( {
|
|
168
141
|
screenWidth: 100,
|
|
169
142
|
} );
|
|
170
|
-
const { getByLabelText
|
|
143
|
+
const { getByLabelText } = screen;
|
|
171
144
|
|
|
172
145
|
// Add Paragraph block
|
|
173
146
|
await addBlock( screen, 'Paragraph' );
|
|
@@ -193,15 +166,8 @@ describe( 'Block Actions Menu', () => {
|
|
|
193
166
|
} );
|
|
194
167
|
fireEvent.press( headingBlock );
|
|
195
168
|
|
|
196
|
-
// Open block actions menu
|
|
197
|
-
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
198
|
-
|
|
199
|
-
// Get block actions modal
|
|
200
|
-
const blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
201
|
-
|
|
202
169
|
// Get the Move Down button
|
|
203
|
-
const downButton =
|
|
204
|
-
within( blockActionsMenu ).getByLabelText( 'Move block down' );
|
|
170
|
+
const downButton = getByLabelText( /Move block down/ );
|
|
205
171
|
const isDownButtonDisabled =
|
|
206
172
|
downButton.props.accessibilityState?.disabled;
|
|
207
173
|
expect( isDownButtonDisabled ).toBe( true );
|
|
@@ -243,7 +209,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
243
209
|
fireEvent.press( headingBlock );
|
|
244
210
|
|
|
245
211
|
// Open block actions menu
|
|
246
|
-
|
|
212
|
+
await openBlockActionsMenu( screen );
|
|
247
213
|
|
|
248
214
|
// Tap on the Copy button
|
|
249
215
|
fireEvent.press( getByLabelText( /Copy/ ) );
|
|
@@ -253,7 +219,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
253
219
|
fireEvent.press( paragraphBlock );
|
|
254
220
|
|
|
255
221
|
// Open block actions menu
|
|
256
|
-
|
|
222
|
+
await openBlockActionsMenu( screen );
|
|
257
223
|
|
|
258
224
|
// Tap on the Paste block after button
|
|
259
225
|
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
@@ -290,7 +256,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
290
256
|
fireEvent.press( headingBlock );
|
|
291
257
|
|
|
292
258
|
// Open block actions menu
|
|
293
|
-
|
|
259
|
+
await openBlockActionsMenu( screen );
|
|
294
260
|
|
|
295
261
|
// Tap on the Copy button
|
|
296
262
|
fireEvent.press( getByLabelText( /Copy/ ) );
|
|
@@ -300,7 +266,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
300
266
|
fireEvent.press( paragraphBlock );
|
|
301
267
|
|
|
302
268
|
// Open block actions menu
|
|
303
|
-
|
|
269
|
+
await openBlockActionsMenu( screen );
|
|
304
270
|
|
|
305
271
|
// Tap on the Past block after button
|
|
306
272
|
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
@@ -335,7 +301,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
335
301
|
fireEvent.press( paragraphBlock );
|
|
336
302
|
|
|
337
303
|
// Open block actions menu
|
|
338
|
-
|
|
304
|
+
await openBlockActionsMenu( screen );
|
|
339
305
|
|
|
340
306
|
// Tap on the Cut button
|
|
341
307
|
fireEvent.press( getByLabelText( /Cut block/ ) );
|
|
@@ -346,7 +312,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
346
312
|
fireEvent.press( headingBlock );
|
|
347
313
|
|
|
348
314
|
// Open block actions menu
|
|
349
|
-
|
|
315
|
+
await openBlockActionsMenu( screen );
|
|
350
316
|
|
|
351
317
|
// Tap on the Cut button
|
|
352
318
|
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
@@ -383,7 +349,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
383
349
|
fireEvent.press( spacerBlock );
|
|
384
350
|
|
|
385
351
|
// Open block actions menu
|
|
386
|
-
|
|
352
|
+
await openBlockActionsMenu( screen );
|
|
387
353
|
|
|
388
354
|
// Tap on the Duplicate button
|
|
389
355
|
fireEvent.press( getByLabelText( /Duplicate block/ ) );
|
|
@@ -418,7 +384,7 @@ describe( 'Block Actions Menu', () => {
|
|
|
418
384
|
fireEvent.press( paragraphBlock );
|
|
419
385
|
|
|
420
386
|
// Open block actions menu
|
|
421
|
-
|
|
387
|
+
await openBlockActionsMenu( screen );
|
|
422
388
|
|
|
423
389
|
// Tap on the Transform block button
|
|
424
390
|
fireEvent.press( getByLabelText( /Transform block…/ ) );
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
fireEvent,
|
|
7
|
+
getBlock,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
setupCoreBlocks,
|
|
10
|
+
} from 'test/helpers';
|
|
11
|
+
|
|
12
|
+
setupCoreBlocks();
|
|
13
|
+
|
|
14
|
+
describe( 'Block Toolbar', () => {
|
|
15
|
+
it( "doesn't render the block settings button if there aren't any settings for the current selected block", async () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const screen = await initializeEditor();
|
|
18
|
+
await addBlock( screen, 'Image' );
|
|
19
|
+
|
|
20
|
+
// Act
|
|
21
|
+
fireEvent(
|
|
22
|
+
screen.getByTestId( 'media-options-picker' ),
|
|
23
|
+
'backdropPress'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Assert
|
|
27
|
+
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeNull();
|
|
28
|
+
} );
|
|
29
|
+
|
|
30
|
+
it( 'renders the block settings button for the current selected block', async () => {
|
|
31
|
+
// Arrange
|
|
32
|
+
const screen = await initializeEditor();
|
|
33
|
+
await addBlock( screen, 'Paragraph' );
|
|
34
|
+
|
|
35
|
+
// Act
|
|
36
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
37
|
+
fireEvent.press( paragraphBlock );
|
|
38
|
+
|
|
39
|
+
// Assert
|
|
40
|
+
expect( screen.queryByLabelText( 'Open Settings' ) ).toBeVisible();
|
|
41
|
+
} );
|
|
42
|
+
} );
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
ToolbarButton,
|
|
16
16
|
ToolbarGroup,
|
|
17
17
|
} from '@wordpress/components';
|
|
18
|
-
import {
|
|
18
|
+
import { next, previous } from '@wordpress/icons';
|
|
19
19
|
import { useViewportMatch } from '@wordpress/compose';
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -24,7 +24,6 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
24
24
|
import NavigableToolbar from '../navigable-toolbar';
|
|
25
25
|
import BlockToolbar from '../block-toolbar';
|
|
26
26
|
import { store as blockEditorStore } from '../../store';
|
|
27
|
-
import BlockIcon from '../block-icon';
|
|
28
27
|
import { unlock } from '../../lock-unlock';
|
|
29
28
|
|
|
30
29
|
function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
@@ -57,6 +56,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
57
56
|
hasParents: parents.length,
|
|
58
57
|
showParentSelector:
|
|
59
58
|
parentBlockType &&
|
|
59
|
+
getBlockEditingMode( firstParentClientId ) === 'default' &&
|
|
60
60
|
hasBlockSupport(
|
|
61
61
|
parentBlockType,
|
|
62
62
|
'__experimentalParentSelector',
|
|
@@ -93,6 +93,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
93
93
|
aria-label={ __( 'Block tools' ) }
|
|
94
94
|
{ ...props }
|
|
95
95
|
>
|
|
96
|
+
{ ! isCollapsed && <BlockToolbar hideDragHandle={ isFixed } /> }
|
|
96
97
|
{ isFixed && isLargeViewport && blockType && (
|
|
97
98
|
<ToolbarGroup
|
|
98
99
|
className={
|
|
@@ -104,13 +105,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
104
105
|
<ToolbarItem
|
|
105
106
|
as={ ToolbarButton }
|
|
106
107
|
ref={ toolbarButtonRef }
|
|
107
|
-
icon={
|
|
108
|
-
isCollapsed ? (
|
|
109
|
-
<BlockIcon icon={ blockType.icon } />
|
|
110
|
-
) : (
|
|
111
|
-
levelUp
|
|
112
|
-
)
|
|
113
|
-
}
|
|
108
|
+
icon={ isCollapsed ? next : previous }
|
|
114
109
|
onClick={ () => {
|
|
115
110
|
setIsCollapsed( ( collapsed ) => ! collapsed );
|
|
116
111
|
toolbarButtonRef.current.focus();
|
|
@@ -118,12 +113,11 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
118
113
|
label={
|
|
119
114
|
isCollapsed
|
|
120
115
|
? __( 'Show block tools' )
|
|
121
|
-
: __( '
|
|
116
|
+
: __( 'Hide block tools' )
|
|
122
117
|
}
|
|
123
118
|
/>
|
|
124
119
|
</ToolbarGroup>
|
|
125
120
|
) }
|
|
126
|
-
{ ! isCollapsed && <BlockToolbar hideDragHandle={ isFixed } /> }
|
|
127
121
|
</NavigableToolbar>
|
|
128
122
|
);
|
|
129
123
|
}
|
|
@@ -121,17 +121,21 @@
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
&:has(.block-editor-block-toolbar:empty) {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
124
128
|
// on desktop and tablet viewports the toolbar is fixed
|
|
125
129
|
// on top of interface header
|
|
126
130
|
|
|
127
131
|
@include break-medium() {
|
|
128
132
|
&.is-fixed {
|
|
129
133
|
|
|
130
|
-
// leave room for block inserter
|
|
131
|
-
margin-left: $grid-unit-80;
|
|
134
|
+
// leave room for block inserter, undo and redo, list view
|
|
135
|
+
margin-left: $grid-unit-80 * 3 - 2 * $grid-unit + $grid-unit-05;
|
|
132
136
|
// position on top of interface header
|
|
133
137
|
position: fixed;
|
|
134
|
-
top: $admin-bar-height + $grid-unit;
|
|
138
|
+
top: $admin-bar-height + $grid-unit - $border-width;
|
|
135
139
|
// Don't fill up when empty
|
|
136
140
|
min-height: initial;
|
|
137
141
|
// remove the border
|
|
@@ -141,32 +145,63 @@
|
|
|
141
145
|
|
|
142
146
|
&.is-collapsed {
|
|
143
147
|
width: initial;
|
|
144
|
-
margin-left: $grid-unit-80 * 3 + $grid-unit-30;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
.is-fullscreen-mode & {
|
|
148
|
-
// leave room for block inserter
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
// leave room for block inserter, undo and redo, list view
|
|
152
|
+
// and some margin left
|
|
153
|
+
margin-left: $grid-unit-80 * 4 - 2 * $grid-unit;
|
|
154
|
+
top: $grid-unit - $border-width;
|
|
151
155
|
&.is-collapsed {
|
|
152
156
|
width: initial;
|
|
153
|
-
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
& > .block-editor-block-toolbar.is-showing-movers {
|
|
161
|
+
flex-grow: initial;
|
|
162
|
+
width: initial;
|
|
163
|
+
|
|
164
|
+
// Add a border as separator in the block toolbar.
|
|
165
|
+
&::before {
|
|
166
|
+
content: "";
|
|
167
|
+
width: $border-width;
|
|
168
|
+
height: 3 * $grid-unit;
|
|
169
|
+
margin-top: $grid-unit + $grid-unit-05;
|
|
170
|
+
margin-right: 0;
|
|
171
|
+
background-color: $gray-300;
|
|
172
|
+
position: relative;
|
|
173
|
+
left: math.div(-$grid-unit-05, 2);
|
|
174
|
+
top: -1px;
|
|
154
175
|
}
|
|
155
176
|
}
|
|
156
177
|
|
|
157
178
|
& > .block-editor-block-toolbar__group-collapse-fixed-toolbar {
|
|
158
179
|
border: none;
|
|
159
180
|
|
|
181
|
+
.show-icon-labels & {
|
|
182
|
+
.components-button.has-icon {
|
|
183
|
+
// Hide the button icons when labels are set to display...
|
|
184
|
+
svg {
|
|
185
|
+
display: none;
|
|
186
|
+
}
|
|
187
|
+
// ... and display labels.
|
|
188
|
+
&::after {
|
|
189
|
+
content: attr(aria-label);
|
|
190
|
+
font-size: $helptext-font-size;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
160
195
|
// Add a border as separator in the block toolbar.
|
|
161
|
-
&::
|
|
196
|
+
&::before {
|
|
162
197
|
content: "";
|
|
163
198
|
width: $border-width;
|
|
164
|
-
height:
|
|
199
|
+
height: 3 * $grid-unit;
|
|
165
200
|
margin-top: $grid-unit + $grid-unit-05;
|
|
166
|
-
margin-
|
|
201
|
+
margin-right: $grid-unit-10;
|
|
167
202
|
background-color: $gray-300;
|
|
168
|
-
position:
|
|
169
|
-
left:
|
|
203
|
+
position: relative;
|
|
204
|
+
left: 0;
|
|
170
205
|
top: -1px;
|
|
171
206
|
}
|
|
172
207
|
}
|
|
@@ -174,6 +209,21 @@
|
|
|
174
209
|
& > .block-editor-block-toolbar__group-expand-fixed-toolbar {
|
|
175
210
|
border: none;
|
|
176
211
|
|
|
212
|
+
.show-icon-labels & {
|
|
213
|
+
width: $grid-unit-80 * 4;
|
|
214
|
+
.components-button.has-icon {
|
|
215
|
+
// Hide the button icons when labels are set to display...
|
|
216
|
+
svg {
|
|
217
|
+
display: none;
|
|
218
|
+
}
|
|
219
|
+
// ... and display labels.
|
|
220
|
+
&::after {
|
|
221
|
+
content: attr(aria-label);
|
|
222
|
+
font-size: $helptext-font-size;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
177
227
|
// Add a border as separator in the block toolbar.
|
|
178
228
|
&::before {
|
|
179
229
|
content: "";
|
|
@@ -182,27 +232,20 @@
|
|
|
182
232
|
margin-bottom: $grid-unit + $grid-unit-05;
|
|
183
233
|
background-color: $gray-300;
|
|
184
234
|
position: relative;
|
|
185
|
-
left: -
|
|
186
|
-
height:
|
|
235
|
+
left: -8px;
|
|
236
|
+
height: 3 * $grid-unit;
|
|
237
|
+
top: -1px;
|
|
187
238
|
}
|
|
188
239
|
}
|
|
189
240
|
|
|
190
241
|
.show-icon-labels & {
|
|
191
242
|
|
|
192
|
-
margin-left: $grid-unit-80;
|
|
193
|
-
|
|
194
|
-
&.is-collapsed {
|
|
195
|
-
margin-left: $grid-unit-80 * 6;
|
|
196
|
-
}
|
|
243
|
+
margin-left: $grid-unit-80 + 2 * $grid-unit; // inserter and margin ;
|
|
197
244
|
|
|
198
245
|
.is-fullscreen-mode & {
|
|
199
|
-
margin-left: $grid-unit
|
|
200
|
-
&.is-collapsed {
|
|
201
|
-
margin-left: $grid-unit-80 * 7;
|
|
202
|
-
}
|
|
246
|
+
margin-left: $grid-unit * 18; // site hub, inserter and margin
|
|
203
247
|
}
|
|
204
248
|
|
|
205
|
-
|
|
206
249
|
.block-editor-block-parent-selector .block-editor-block-parent-selector__button::after {
|
|
207
250
|
left: 0;
|
|
208
251
|
}
|
|
@@ -230,12 +273,14 @@
|
|
|
230
273
|
}
|
|
231
274
|
|
|
232
275
|
&.is-fixed .block-editor-block-parent-selector {
|
|
276
|
+
|
|
233
277
|
.block-editor-block-parent-selector__button {
|
|
234
278
|
position: relative;
|
|
235
279
|
top: -1px;
|
|
236
280
|
border: 0;
|
|
237
281
|
padding-right: 6px;
|
|
238
282
|
padding-left: 6px;
|
|
283
|
+
|
|
239
284
|
&::after {
|
|
240
285
|
content: "\00B7";
|
|
241
286
|
font-size: 16px;
|
|
@@ -277,7 +322,9 @@
|
|
|
277
322
|
// for the block inserter the publish button
|
|
278
323
|
@include break-large() {
|
|
279
324
|
&.is-fixed {
|
|
280
|
-
|
|
325
|
+
// the combined with of the tools at the right of the header and the margin left
|
|
326
|
+
// of the toolbar which includes four buttons
|
|
327
|
+
width: calc(100% - 240px - #{4 * $grid-unit-80});
|
|
281
328
|
}
|
|
282
329
|
}
|
|
283
330
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
## Caption
|
|
2
|
+
|
|
3
|
+
The `Caption` component renders the [caption part](https://wordpress.org/documentation/article/gallery-block/#caption) of some blocks (image, gallery...).
|
|
4
|
+
|
|
5
|
+
This component encapsulates the "caption" behaviour and styles over a `<RichText>` so it can be used in other components such as the `BlockCaption` component.
|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
1. [Development guidelines](#development-guidelines)
|
|
10
|
+
2. [Related components](#related-components)
|
|
11
|
+
|
|
12
|
+
## Development guidelines
|
|
13
|
+
|
|
14
|
+
### Usage
|
|
15
|
+
|
|
16
|
+
Renders a Caption area:
|
|
17
|
+
|
|
18
|
+
```jsx
|
|
19
|
+
import { Caption } from '@wordpress/block-editor';
|
|
20
|
+
const BlockCaption = ( {
|
|
21
|
+
onBlur,
|
|
22
|
+
onChange,
|
|
23
|
+
onFocus,
|
|
24
|
+
isSelected,
|
|
25
|
+
shouldDisplay,
|
|
26
|
+
text,
|
|
27
|
+
insertBlocksAfter,
|
|
28
|
+
} ) => (
|
|
29
|
+
<View >
|
|
30
|
+
<Caption
|
|
31
|
+
isSelected={ isSelected }
|
|
32
|
+
onBlur={ onBlur }
|
|
33
|
+
onChange={ onChange }
|
|
34
|
+
onFocus={ onFocus }
|
|
35
|
+
shouldDisplay={ shouldDisplay }
|
|
36
|
+
value={ text }
|
|
37
|
+
insertBlocksAfter={ insertBlocksAfter }
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Props
|
|
44
|
+
|
|
45
|
+
The properties `isSelected`, `onBlur`, `onChange`, `onFocus`, `shouldDisplay`, `value`, `insertBlocksAfter` of this component are passed directly to their related props of its inner `<RichText>` component ([see detailed info about the RichText component's props](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md)).
|
|
46
|
+
|
|
47
|
+
## Related components
|
|
48
|
+
|
|
49
|
+
Caption components is mostly used by the [`BlockCaption`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-caption) component.
|
|
@@ -6,6 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
9
10
|
import {
|
|
10
11
|
BaseControl,
|
|
11
12
|
__experimentalVStack as VStack,
|
|
@@ -28,12 +29,12 @@ const colorsAndGradientKeys = [
|
|
|
28
29
|
|
|
29
30
|
const TAB_COLOR = {
|
|
30
31
|
name: 'color',
|
|
31
|
-
title: 'Solid',
|
|
32
|
+
title: __( 'Solid' ),
|
|
32
33
|
value: 'color',
|
|
33
34
|
};
|
|
34
35
|
const TAB_GRADIENT = {
|
|
35
36
|
name: 'gradient',
|
|
36
|
-
title: 'Gradient',
|
|
37
|
+
title: __( 'Gradient' ),
|
|
37
38
|
value: 'gradient',
|
|
38
39
|
};
|
|
39
40
|
|