@wordpress/block-editor 9.3.0 → 9.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 +6 -0
- package/README.md +1 -8
- package/build/components/block-list/block-invalid-warning.native.js +54 -6
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block.js +2 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -1
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +4 -3
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/layout.js +20 -5
- package/build/components/block-list/layout.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +5 -2
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-lock/modal.js +37 -7
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/mover-description.js +95 -32
- package/build/components/block-mover/mover-description.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +8 -26
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +3 -8
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-popover/inbetween.js +1 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +1 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +21 -5
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-edit-visually-button.js +70 -0
- package/build/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
- package/build/components/block-settings-menu/block-mode-toggle.js +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +6 -2
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +5 -2
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/index.js +7 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +8 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +15 -15
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -7
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +65 -23
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/border-radius-control/index.js +2 -0
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/colors/with-colors.js +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +46 -39
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +7 -3
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/components.js +145 -0
- package/build/components/duotone/components.js.map +1 -0
- package/build/components/duotone/index.js +40 -0
- package/build/components/duotone/index.js.map +1 -0
- package/build/components/duotone/utils.js +38 -0
- package/build/components/duotone/utils.js.map +1 -0
- package/build/components/duotone-control/index.js +17 -5
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/iframe/index.js +19 -6
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/cropper.js +4 -3
- package/build/components/image-editor/cropper.js.map +1 -1
- package/build/components/image-editor/index.js +3 -1
- package/build/components/image-editor/index.js.map +1 -1
- package/build/components/index.js +14 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +30 -16
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/index.js +3 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/preview-panel.js +8 -8
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +5 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +21 -0
- package/build/components/inserter/utils.native.js.map +1 -1
- package/build/components/inserter-list-item/index.js +5 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +15 -7
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js +1 -7
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/media-placeholder/index.js +14 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +4 -4
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +6 -13
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/observe-typing/index.js +22 -8
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +3 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +61 -12
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +2 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +36 -16
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +4 -13
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +20 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/url-popover/index.js +2 -1
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +34 -2
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +3 -47
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +1 -3
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +1 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/elements/index.js +11 -3
- package/build/elements/index.js.map +1 -1
- package/build/hooks/aria-label.js +71 -0
- package/build/hooks/aria-label.js.map +1 -0
- package/build/hooks/color.js +2 -4
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/duotone.js +33 -160
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +11 -7
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +59 -18
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +41 -31
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +5 -3
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +7 -7
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +42 -38
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +35 -37
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/utils.js +35 -3
- package/build/layouts/utils.js.map +1 -1
- package/build/store/actions.js +24 -31
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +0 -4
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +23 -12
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/selection.js +34 -0
- package/build/utils/selection.js.map +1 -0
- package/build-module/components/block-list/block-invalid-warning.native.js +50 -6
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block.js +2 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -1
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/layout.js +19 -4
- package/build-module/components/block-list/layout.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +5 -2
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-lock/modal.js +39 -8
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/mover-description.js +97 -33
- package/build-module/components/block-mover/mover-description.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +9 -27
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +3 -8
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +20 -5
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-edit-visually-button.js +56 -0
- package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
- package/build-module/components/block-settings-menu/block-mode-toggle.js +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +6 -5
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +6 -3
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +7 -4
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +7 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +8 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +15 -14
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -7
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +67 -25
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +2 -0
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/colors/with-colors.js +2 -2
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +47 -40
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +8 -4
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +1 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/duotone/components.js +130 -0
- package/build-module/components/duotone/components.js.map +1 -0
- package/build-module/components/duotone/index.js +3 -0
- package/build-module/components/duotone/index.js.map +1 -0
- package/build-module/components/duotone/utils.js +30 -0
- package/build-module/components/duotone/utils.js.map +1 -0
- package/build-module/components/duotone-control/index.js +18 -6
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +19 -6
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +4 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/index.js +3 -1
- package/build-module/components/image-editor/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/inserter/block-types-tab.native.js +31 -15
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +9 -9
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +6 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +6 -3
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +19 -0
- package/build-module/components/inserter/utils.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +4 -1
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +16 -8
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -6
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +14 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +5 -3
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +7 -13
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +22 -8
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +2 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +58 -12
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +37 -18
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +3 -11
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +20 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/url-popover/index.js +2 -1
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +35 -3
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +3 -45
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +1 -3
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/elements/index.js +7 -1
- package/build-module/elements/index.js.map +1 -1
- package/build-module/hooks/aria-label.js +59 -0
- package/build-module/hooks/aria-label.js.map +1 -0
- package/build-module/hooks/color.js +2 -3
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/duotone.js +22 -140
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +60 -19
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +44 -35
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +5 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +43 -35
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +35 -38
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/layouts/utils.js +33 -3
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/store/actions.js +14 -20
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +0 -4
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +23 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/selection.js +24 -0
- package/build-module/utils/selection.js.map +1 -0
- package/build-style/style-rtl.css +43 -13
- package/build-style/style.css +43 -13
- package/package.json +28 -28
- package/src/components/block-draggable/test/helpers.native.js +3 -3
- package/src/components/block-list/block-invalid-warning.native.js +42 -7
- package/src/components/block-list/block.js +2 -2
- package/src/components/block-list/block.native.js +1 -0
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/layout.js +15 -3
- package/src/components/block-list/style.scss +2 -2
- package/src/components/block-list/use-block-props/use-block-class-names.js +5 -1
- package/src/components/block-lock/modal.js +47 -9
- package/src/components/block-lock/style.scss +10 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- package/src/components/block-mover/mover-description.js +131 -48
- package/src/components/block-mover/test/mover-description.js +55 -3
- package/src/components/block-pattern-setup/index.js +5 -25
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -9
- package/src/components/block-pattern-setup/style.scss +4 -2
- package/src/components/block-popover/inbetween.js +1 -1
- package/src/components/block-popover/index.js +1 -1
- package/src/components/block-preview/auto.js +17 -3
- package/src/components/block-settings-menu/block-edit-visually-button.js +52 -0
- package/src/components/block-settings-menu/block-mode-toggle.js +1 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +7 -3
- package/src/components/block-settings-menu/index.js +15 -11
- package/src/components/block-settings-menu-controls/index.js +5 -4
- package/src/components/block-styles/preview.native.js +1 -0
- package/src/components/block-switcher/index.js +7 -1
- package/src/components/block-title/index.js +3 -2
- package/src/components/block-title/use-block-display-title.js +20 -12
- package/src/components/block-tools/block-contextual-toolbar.js +3 -1
- package/src/components/block-tools/block-selection-button.js +0 -5
- package/src/components/block-tools/index.js +4 -1
- package/src/components/block-types-list/index.native.js +76 -24
- package/src/components/block-types-list/style.native.scss +18 -0
- package/src/components/border-radius-control/index.js +2 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -4
- package/src/components/colors/test/__snapshots__/with-colors.js.snap +1 -1
- package/src/components/colors/test/with-colors.js +1 -1
- package/src/components/colors/with-colors.js +2 -2
- package/src/components/colors-gradients/control.js +78 -65
- package/src/components/colors-gradients/dropdown.js +9 -2
- package/src/components/colors-gradients/style.scss +11 -8
- package/src/components/colors-gradients/test/control.js +16 -23
- package/src/components/date-format-picker/index.js +1 -0
- package/src/components/duotone/components.js +133 -0
- package/src/components/duotone/index.js +7 -0
- package/src/components/duotone/utils.js +25 -0
- package/src/components/duotone-control/index.js +12 -7
- package/src/components/duotone-control/style.scss +5 -0
- package/src/components/iframe/index.js +25 -6
- package/src/components/image-editor/cropper.js +9 -3
- package/src/components/image-editor/index.js +2 -0
- package/src/components/index.js +1 -0
- package/src/components/inserter/block-types-tab.native.js +42 -21
- package/src/components/inserter/index.js +3 -5
- package/src/components/inserter/preview-panel.js +6 -14
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -2
- package/src/components/inserter/search-results.native.js +4 -2
- package/src/components/inserter/style.scss +1 -1
- package/src/components/inserter/test/block-types-tab.native.js +2 -0
- package/src/components/inserter/test/utils.native.js +37 -0
- package/src/components/inserter/utils.native.js +11 -0
- package/src/components/inserter-list-item/index.js +4 -1
- package/src/components/link-control/index.js +1 -0
- package/src/components/link-control/test/fixtures/index.js +3 -4
- package/src/components/link-control/test/index.js +64 -73
- package/src/components/list-view/block-select-button.js +29 -14
- package/src/components/list-view/branch.js +1 -6
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/style.scss +18 -4
- package/src/components/media-placeholder/index.js +20 -0
- package/src/components/media-placeholder/index.native.js +9 -5
- package/src/components/media-replace-flow/index.js +5 -14
- package/src/components/media-replace-flow/test/index.js +14 -4
- package/src/components/media-upload/README.md +8 -0
- package/src/components/observe-typing/index.js +17 -14
- package/src/components/publish-date-time-picker/index.js +2 -0
- package/src/components/responsive-block-control/README.md +3 -1
- package/src/components/responsive-block-control/test/index.js +1 -2
- package/src/components/rich-text/format-toolbar-container.js +63 -14
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-format-types.js +38 -17
- package/src/components/rich-text/use-input-rules.js +6 -15
- package/src/components/rich-text/use-paste-handler.js +17 -5
- package/src/components/url-popover/index.js +1 -0
- package/src/components/url-popover/test/__snapshots__/index.js.snap +3 -0
- package/src/components/writing-flow/use-arrow-nav.js +32 -1
- package/src/components/writing-flow/use-multi-selection.js +1 -48
- package/src/components/writing-flow/use-selection-observer.js +2 -3
- package/src/components/writing-flow/use-tab-nav.js +1 -1
- package/src/elements/index.js +8 -1
- package/src/elements/test/index.js +18 -0
- package/src/hooks/aria-label.js +67 -0
- package/src/hooks/color.js +10 -3
- package/src/hooks/duotone.js +18 -139
- package/src/hooks/index.js +2 -1
- package/src/hooks/layout.js +77 -29
- package/src/hooks/style.js +46 -39
- package/src/hooks/utils.js +7 -3
- package/src/index.js +1 -1
- package/src/layouts/flex.js +49 -43
- package/src/layouts/flow.js +35 -34
- package/src/layouts/test/flex.js +21 -0
- package/src/layouts/test/flow.js +21 -0
- package/src/layouts/test/utils.js +138 -0
- package/src/layouts/utils.js +44 -3
- package/src/store/actions.js +17 -31
- package/src/store/index.js +0 -4
- package/src/store/reducer.js +24 -11
- package/src/store/selectors.js +3 -4
- package/src/store/test/reducer.js +138 -10
- package/src/store/test/selectors.js +3 -6
- package/src/utils/selection.js +26 -0
- package/src/utils/test/selection.js +39 -0
- package/tsconfig.json +2 -1
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
FlexItem,
|
|
11
11
|
Icon,
|
|
12
12
|
Modal,
|
|
13
|
+
ToggleControl,
|
|
13
14
|
} from '@wordpress/components';
|
|
14
15
|
import { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';
|
|
15
16
|
import { useInstanceId } from '@wordpress/compose';
|
|
@@ -23,20 +24,41 @@ import useBlockLock from './use-block-lock';
|
|
|
23
24
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
24
25
|
import { store as blockEditorStore } from '../../store';
|
|
25
26
|
|
|
27
|
+
function getTemplateLockValue( lock ) {
|
|
28
|
+
// Prevents all operations.
|
|
29
|
+
if ( lock.remove && lock.move ) {
|
|
30
|
+
return 'all';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Prevents inserting or removing blocks, but allows moving existing blocks.
|
|
34
|
+
if ( lock.remove && ! lock.move ) {
|
|
35
|
+
return 'insert';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
export default function BlockLockModal( { clientId, onClose } ) {
|
|
27
42
|
const [ lock, setLock ] = useState( { move: false, remove: false } );
|
|
28
43
|
const { canEdit, canMove, canRemove } = useBlockLock( clientId );
|
|
29
|
-
const { isReusable } = useSelect(
|
|
44
|
+
const { isReusable, templateLock, hasTemplateLock } = useSelect(
|
|
30
45
|
( select ) => {
|
|
31
|
-
const { getBlockName } =
|
|
46
|
+
const { getBlockName, getBlockAttributes } =
|
|
47
|
+
select( blockEditorStore );
|
|
32
48
|
const blockName = getBlockName( clientId );
|
|
49
|
+
const blockType = getBlockType( blockName );
|
|
33
50
|
|
|
34
51
|
return {
|
|
35
|
-
isReusable: isReusableBlock(
|
|
52
|
+
isReusable: isReusableBlock( blockType ),
|
|
53
|
+
templateLock: getBlockAttributes( clientId )?.templateLock,
|
|
54
|
+
hasTemplateLock: !! blockType?.attributes?.templateLock,
|
|
36
55
|
};
|
|
37
56
|
},
|
|
38
57
|
[ clientId ]
|
|
39
58
|
);
|
|
59
|
+
const [ applyTemplateLock, setApplyTemplateLock ] = useState(
|
|
60
|
+
!! templateLock
|
|
61
|
+
);
|
|
40
62
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
41
63
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
42
64
|
const instanceId = useInstanceId(
|
|
@@ -66,18 +88,23 @@ export default function BlockLockModal( { clientId, onClose } ) {
|
|
|
66
88
|
closeLabel={ __( 'Close' ) }
|
|
67
89
|
onRequestClose={ onClose }
|
|
68
90
|
>
|
|
91
|
+
<p>
|
|
92
|
+
{ __(
|
|
93
|
+
'Choose specific attributes to restrict or lock all available options.'
|
|
94
|
+
) }
|
|
95
|
+
</p>
|
|
69
96
|
<form
|
|
70
97
|
onSubmit={ ( event ) => {
|
|
71
98
|
event.preventDefault();
|
|
72
|
-
updateBlockAttributes( [ clientId ], {
|
|
99
|
+
updateBlockAttributes( [ clientId ], {
|
|
100
|
+
lock,
|
|
101
|
+
templateLock: applyTemplateLock
|
|
102
|
+
? getTemplateLockValue( lock )
|
|
103
|
+
: undefined,
|
|
104
|
+
} );
|
|
73
105
|
onClose();
|
|
74
106
|
} }
|
|
75
107
|
>
|
|
76
|
-
<p>
|
|
77
|
-
{ __(
|
|
78
|
-
'Choose specific attributes to restrict or lock all available options.'
|
|
79
|
-
) }
|
|
80
|
-
</p>
|
|
81
108
|
<div
|
|
82
109
|
role="group"
|
|
83
110
|
aria-labelledby={ instanceId }
|
|
@@ -171,6 +198,17 @@ export default function BlockLockModal( { clientId, onClose } ) {
|
|
|
171
198
|
/>
|
|
172
199
|
</li>
|
|
173
200
|
</ul>
|
|
201
|
+
{ hasTemplateLock && (
|
|
202
|
+
<ToggleControl
|
|
203
|
+
className="block-editor-block-lock-modal__template-lock"
|
|
204
|
+
label={ __( 'Apply to all blocks inside' ) }
|
|
205
|
+
checked={ applyTemplateLock }
|
|
206
|
+
disabled={ lock.move && ! lock.remove }
|
|
207
|
+
onChange={ () =>
|
|
208
|
+
setApplyTemplateLock( ! applyTemplateLock )
|
|
209
|
+
}
|
|
210
|
+
/>
|
|
211
|
+
) }
|
|
174
212
|
</div>
|
|
175
213
|
<Flex
|
|
176
214
|
className="block-editor-block-lock-modal__actions"
|
|
@@ -53,6 +53,16 @@
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.block-editor-block-lock-modal__template-lock {
|
|
57
|
+
border-top: $border-width solid $gray-300;
|
|
58
|
+
margin-top: $grid-unit-20;
|
|
59
|
+
padding: $grid-unit-15 0;
|
|
60
|
+
|
|
61
|
+
.components-base-control__field {
|
|
62
|
+
margin: 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
56
66
|
.block-editor-block-lock-modal__actions {
|
|
57
67
|
margin-top: $grid-unit-30;
|
|
58
68
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Platform, findNodeHandle } from 'react-native';
|
|
5
|
-
import { partial, first, castArray, last,
|
|
5
|
+
import { partial, first, castArray, last, every } from 'lodash';
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
@@ -202,7 +202,7 @@ const BlockActionsMenu = ( {
|
|
|
202
202
|
},
|
|
203
203
|
};
|
|
204
204
|
|
|
205
|
-
const options =
|
|
205
|
+
const options = [
|
|
206
206
|
wrapBlockMover && allOptions.backwardButton,
|
|
207
207
|
wrapBlockMover && allOptions.forwardButton,
|
|
208
208
|
wrapBlockSettings && allOptions.settings,
|
|
@@ -215,7 +215,7 @@ const BlockActionsMenu = ( {
|
|
|
215
215
|
canDuplicate && allOptions.duplicateButton,
|
|
216
216
|
isReusableBlockType && allOptions.convertToRegularBlocks,
|
|
217
217
|
! isLocked && allOptions.delete,
|
|
218
|
-
] );
|
|
218
|
+
].filter( Boolean );
|
|
219
219
|
|
|
220
220
|
// End early if there are no options to show.
|
|
221
221
|
if ( ! options.length ) {
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __,
|
|
4
|
+
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
const getMovementDirection = ( moveDirection, orientation ) => {
|
|
7
|
+
if ( moveDirection === 'up' ) {
|
|
8
|
+
if ( orientation === 'horizontal' ) {
|
|
9
|
+
return isRTL() ? 'right' : 'left';
|
|
10
|
+
}
|
|
11
|
+
return 'up';
|
|
12
|
+
} else if ( moveDirection === 'down' ) {
|
|
13
|
+
if ( orientation === 'horizontal' ) {
|
|
14
|
+
return isRTL() ? 'left' : 'right';
|
|
15
|
+
}
|
|
16
|
+
return 'down';
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
5
20
|
|
|
6
21
|
/**
|
|
7
22
|
* Return a label for the block movement controls depending on block position.
|
|
@@ -30,28 +45,14 @@ export function getBlockMoverDescription(
|
|
|
30
45
|
) {
|
|
31
46
|
const position = firstIndex + 1;
|
|
32
47
|
|
|
33
|
-
const getMovementDirection = ( moveDirection ) => {
|
|
34
|
-
if ( moveDirection === 'up' ) {
|
|
35
|
-
if ( orientation === 'horizontal' ) {
|
|
36
|
-
return isRTL() ? 'right' : 'left';
|
|
37
|
-
}
|
|
38
|
-
return 'up';
|
|
39
|
-
} else if ( moveDirection === 'down' ) {
|
|
40
|
-
if ( orientation === 'horizontal' ) {
|
|
41
|
-
return isRTL() ? 'left' : 'right';
|
|
42
|
-
}
|
|
43
|
-
return 'down';
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
48
|
if ( selectedCount > 1 ) {
|
|
49
49
|
return getMultiBlockMoverDescription(
|
|
50
50
|
selectedCount,
|
|
51
51
|
firstIndex,
|
|
52
52
|
isFirst,
|
|
53
53
|
isLast,
|
|
54
|
-
dir
|
|
54
|
+
dir,
|
|
55
|
+
orientation
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -65,7 +66,7 @@ export function getBlockMoverDescription(
|
|
|
65
66
|
|
|
66
67
|
if ( dir > 0 && ! isLast ) {
|
|
67
68
|
// Moving down.
|
|
68
|
-
const movementDirection = getMovementDirection( 'down' );
|
|
69
|
+
const movementDirection = getMovementDirection( 'down', orientation );
|
|
69
70
|
|
|
70
71
|
if ( movementDirection === 'down' ) {
|
|
71
72
|
return sprintf(
|
|
@@ -106,7 +107,7 @@ export function getBlockMoverDescription(
|
|
|
106
107
|
|
|
107
108
|
if ( dir > 0 && isLast ) {
|
|
108
109
|
// Moving down, and is the last item.
|
|
109
|
-
const movementDirection = getMovementDirection( 'down' );
|
|
110
|
+
const movementDirection = getMovementDirection( 'down', orientation );
|
|
110
111
|
|
|
111
112
|
if ( movementDirection === 'down' ) {
|
|
112
113
|
return sprintf(
|
|
@@ -141,7 +142,7 @@ export function getBlockMoverDescription(
|
|
|
141
142
|
|
|
142
143
|
if ( dir < 0 && ! isFirst ) {
|
|
143
144
|
// Moving up.
|
|
144
|
-
const movementDirection = getMovementDirection( 'up' );
|
|
145
|
+
const movementDirection = getMovementDirection( 'up', orientation );
|
|
145
146
|
|
|
146
147
|
if ( movementDirection === 'up' ) {
|
|
147
148
|
return sprintf(
|
|
@@ -180,7 +181,7 @@ export function getBlockMoverDescription(
|
|
|
180
181
|
|
|
181
182
|
if ( dir < 0 && isFirst ) {
|
|
182
183
|
// Moving up, and is the first item.
|
|
183
|
-
const movementDirection = getMovementDirection( 'up' );
|
|
184
|
+
const movementDirection = getMovementDirection( 'up', orientation );
|
|
184
185
|
|
|
185
186
|
if ( movementDirection === 'up' ) {
|
|
186
187
|
return sprintf(
|
|
@@ -223,6 +224,8 @@ export function getBlockMoverDescription(
|
|
|
223
224
|
* @param {boolean} isLast This is the last block.
|
|
224
225
|
* @param {number} dir Direction of movement (> 0 is considered to be going
|
|
225
226
|
* down, < 0 is up).
|
|
227
|
+
* @param {string} orientation The orientation of the block movers, vertical or
|
|
228
|
+
* horizontal.
|
|
226
229
|
*
|
|
227
230
|
* @return {string} Label for the block movement controls.
|
|
228
231
|
*/
|
|
@@ -231,43 +234,123 @@ export function getMultiBlockMoverDescription(
|
|
|
231
234
|
firstIndex,
|
|
232
235
|
isFirst,
|
|
233
236
|
isLast,
|
|
234
|
-
dir
|
|
237
|
+
dir,
|
|
238
|
+
orientation
|
|
235
239
|
) {
|
|
236
240
|
const position = firstIndex + 1;
|
|
237
241
|
|
|
238
|
-
if (
|
|
239
|
-
|
|
242
|
+
if ( isFirst && isLast ) {
|
|
243
|
+
// All blocks are selected
|
|
244
|
+
return __( 'All blocks are selected, and cannot be moved' );
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if ( dir > 0 && ! isLast ) {
|
|
248
|
+
// moving down
|
|
249
|
+
const movementDirection = getMovementDirection( 'down', orientation );
|
|
250
|
+
|
|
251
|
+
if ( movementDirection === 'down' ) {
|
|
252
|
+
return sprintf(
|
|
253
|
+
// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
|
254
|
+
__( 'Move %1$d blocks from position %2$d down by one place' ),
|
|
255
|
+
selectedCount,
|
|
256
|
+
position
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if ( movementDirection === 'left' ) {
|
|
261
|
+
return sprintf(
|
|
262
|
+
// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
|
263
|
+
__( 'Move %1$d blocks from position %2$d left by one place' ),
|
|
264
|
+
selectedCount,
|
|
265
|
+
position
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if ( movementDirection === 'right' ) {
|
|
270
|
+
return sprintf(
|
|
271
|
+
// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
|
272
|
+
__( 'Move %1$d blocks from position %2$d right by one place' ),
|
|
273
|
+
selectedCount,
|
|
274
|
+
position
|
|
275
|
+
);
|
|
276
|
+
}
|
|
240
277
|
}
|
|
241
278
|
|
|
242
279
|
if ( dir > 0 && isLast ) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
280
|
+
// moving down, and the selected blocks are the last item
|
|
281
|
+
const movementDirection = getMovementDirection( 'down', orientation );
|
|
282
|
+
|
|
283
|
+
if ( movementDirection === 'down' ) {
|
|
284
|
+
return __(
|
|
285
|
+
'Blocks cannot be moved down as they are already at the bottom'
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if ( movementDirection === 'left' ) {
|
|
290
|
+
return __(
|
|
291
|
+
'Blocks cannot be moved left as they are already are at the leftmost position'
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if ( movementDirection === 'right' ) {
|
|
296
|
+
return __(
|
|
297
|
+
'Blocks cannot be moved right as they are already are at the rightmost position'
|
|
298
|
+
);
|
|
299
|
+
}
|
|
246
300
|
}
|
|
247
301
|
|
|
248
302
|
if ( dir < 0 && ! isFirst ) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
303
|
+
// moving up
|
|
304
|
+
const movementDirection = getMovementDirection( 'up', orientation );
|
|
305
|
+
|
|
306
|
+
if ( movementDirection === 'up' ) {
|
|
307
|
+
return sprintf(
|
|
308
|
+
// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
|
309
|
+
__( 'Move %1$d blocks from position %2$d up by one place' ),
|
|
310
|
+
selectedCount,
|
|
311
|
+
position
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if ( movementDirection === 'left' ) {
|
|
316
|
+
return sprintf(
|
|
317
|
+
// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
|
318
|
+
__( 'Move %1$d blocks from position %2$d left by one place' ),
|
|
319
|
+
selectedCount,
|
|
320
|
+
position
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if ( movementDirection === 'right' ) {
|
|
325
|
+
return sprintf(
|
|
326
|
+
// translators: 1: Number of selected blocks, 2: Position of selected blocks
|
|
327
|
+
__( 'Move %1$d blocks from position %2$d right by one place' ),
|
|
328
|
+
selectedCount,
|
|
329
|
+
position
|
|
330
|
+
);
|
|
331
|
+
}
|
|
259
332
|
}
|
|
260
333
|
|
|
261
|
-
if ( dir
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
)
|
|
334
|
+
if ( dir < 0 && isFirst ) {
|
|
335
|
+
// moving up, and the selected blocks are the first item
|
|
336
|
+
const movementDirection = getMovementDirection( 'up', orientation );
|
|
337
|
+
|
|
338
|
+
if ( movementDirection === 'up' ) {
|
|
339
|
+
return __(
|
|
340
|
+
'Blocks cannot be moved up as they are already at the top'
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if ( movementDirection === 'left' ) {
|
|
345
|
+
return __(
|
|
346
|
+
'Blocks cannot be moved left as they are already are at the leftmost position'
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if ( movementDirection === 'right' ) {
|
|
351
|
+
return __(
|
|
352
|
+
'Blocks cannot be moved right as they are already are at the rightmost position'
|
|
353
|
+
);
|
|
354
|
+
}
|
|
272
355
|
}
|
|
273
356
|
}
|
|
@@ -183,9 +183,7 @@ describe( 'block mover', () => {
|
|
|
183
183
|
true,
|
|
184
184
|
negativeDirection
|
|
185
185
|
)
|
|
186
|
-
).toBe(
|
|
187
|
-
'Blocks cannot be moved up as they are already at the top'
|
|
188
|
-
);
|
|
186
|
+
).toBe( 'All blocks are selected, and cannot be moved' );
|
|
189
187
|
} );
|
|
190
188
|
|
|
191
189
|
it( 'generates a title for a selection of blocks at the bottom', () => {
|
|
@@ -201,5 +199,59 @@ describe( 'block mover', () => {
|
|
|
201
199
|
'Blocks cannot be moved down as they are already at the bottom'
|
|
202
200
|
);
|
|
203
201
|
} );
|
|
202
|
+
|
|
203
|
+
it( 'indicates that blocks can be moved left when the orientation is horizontal and the direction is negative', () => {
|
|
204
|
+
expect(
|
|
205
|
+
getMultiBlockMoverDescription(
|
|
206
|
+
4,
|
|
207
|
+
1,
|
|
208
|
+
false,
|
|
209
|
+
true,
|
|
210
|
+
negativeDirection,
|
|
211
|
+
'horizontal'
|
|
212
|
+
)
|
|
213
|
+
).toBe( 'Move 4 blocks from position 2 left by one place' );
|
|
214
|
+
} );
|
|
215
|
+
|
|
216
|
+
it( 'indicates that blocks can be moved right when the orientation is horizontal and the direction is positive', () => {
|
|
217
|
+
expect(
|
|
218
|
+
getMultiBlockMoverDescription(
|
|
219
|
+
4,
|
|
220
|
+
0,
|
|
221
|
+
true,
|
|
222
|
+
false,
|
|
223
|
+
positiveDirection,
|
|
224
|
+
'horizontal'
|
|
225
|
+
)
|
|
226
|
+
).toBe( 'Move 4 blocks from position 1 right by one place' );
|
|
227
|
+
} );
|
|
228
|
+
|
|
229
|
+
it( 'indicates that blocks cannot be moved left when the orientation is horizontal and a selection of blocks at the left', () => {
|
|
230
|
+
expect(
|
|
231
|
+
getMultiBlockMoverDescription(
|
|
232
|
+
4,
|
|
233
|
+
1,
|
|
234
|
+
true,
|
|
235
|
+
true,
|
|
236
|
+
negativeDirection,
|
|
237
|
+
'horizontal'
|
|
238
|
+
)
|
|
239
|
+
).toBe( 'All blocks are selected, and cannot be moved' );
|
|
240
|
+
} );
|
|
241
|
+
|
|
242
|
+
it( 'indicates that blocks cannot be moved right when the orientation is horizontal and the block is the last block', () => {
|
|
243
|
+
expect(
|
|
244
|
+
getMultiBlockMoverDescription(
|
|
245
|
+
4,
|
|
246
|
+
2,
|
|
247
|
+
false,
|
|
248
|
+
true,
|
|
249
|
+
positiveDirection,
|
|
250
|
+
'horizontal'
|
|
251
|
+
)
|
|
252
|
+
).toBe(
|
|
253
|
+
'Blocks cannot be moved right as they are already are at the rightmost position'
|
|
254
|
+
);
|
|
255
|
+
} );
|
|
204
256
|
} );
|
|
205
257
|
} );
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
|
|
13
13
|
import { useState } from '@wordpress/element';
|
|
14
|
-
import { useInstanceId
|
|
14
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -28,7 +28,6 @@ const SetupContent = ( {
|
|
|
28
28
|
activeSlide,
|
|
29
29
|
patterns,
|
|
30
30
|
onBlockPatternSelect,
|
|
31
|
-
height,
|
|
32
31
|
} ) => {
|
|
33
32
|
const composite = useCompositeState();
|
|
34
33
|
const containerClass = 'block-editor-block-pattern-setup__container';
|
|
@@ -39,10 +38,7 @@ const SetupContent = ( {
|
|
|
39
38
|
[ activeSlide + 1, 'next-slide' ],
|
|
40
39
|
] );
|
|
41
40
|
return (
|
|
42
|
-
<div
|
|
43
|
-
className="block-editor-block-pattern-setup__carousel"
|
|
44
|
-
style={ { height } }
|
|
45
|
-
>
|
|
41
|
+
<div className="block-editor-block-pattern-setup__carousel">
|
|
46
42
|
<div className={ containerClass }>
|
|
47
43
|
<ul className="carousel-container">
|
|
48
44
|
{ patterns.map( ( pattern, index ) => (
|
|
@@ -50,7 +46,6 @@ const SetupContent = ( {
|
|
|
50
46
|
className={ slideClass.get( index ) || '' }
|
|
51
47
|
key={ pattern.name }
|
|
52
48
|
pattern={ pattern }
|
|
53
|
-
minHeight={ height }
|
|
54
49
|
/>
|
|
55
50
|
) ) }
|
|
56
51
|
</ul>
|
|
@@ -59,10 +54,7 @@ const SetupContent = ( {
|
|
|
59
54
|
);
|
|
60
55
|
}
|
|
61
56
|
return (
|
|
62
|
-
<div
|
|
63
|
-
style={ { height } }
|
|
64
|
-
className="block-editor-block-pattern-setup__grid"
|
|
65
|
-
>
|
|
57
|
+
<div className="block-editor-block-pattern-setup__grid">
|
|
66
58
|
<Composite
|
|
67
59
|
{ ...composite }
|
|
68
60
|
role="listbox"
|
|
@@ -145,19 +137,15 @@ const BlockPatternSetup = ( {
|
|
|
145
137
|
clientId,
|
|
146
138
|
blockName,
|
|
147
139
|
filterPatternsFn,
|
|
148
|
-
startBlankComponent = null,
|
|
149
140
|
onBlockPatternSelect,
|
|
150
141
|
} ) => {
|
|
151
142
|
const [ viewMode, setViewMode ] = useState( VIEWMODES.carousel );
|
|
152
143
|
const [ activeSlide, setActiveSlide ] = useState( 0 );
|
|
153
|
-
const [ showBlank, setShowBlank ] = useState( false );
|
|
154
144
|
const { replaceBlock } = useDispatch( blockEditorStore );
|
|
155
145
|
const patterns = usePatternsSetup( clientId, blockName, filterPatternsFn );
|
|
156
|
-
const [ contentResizeListener, { height: contentHeight } ] =
|
|
157
|
-
useResizeObserver();
|
|
158
146
|
|
|
159
|
-
if ( ! patterns?.length
|
|
160
|
-
return
|
|
147
|
+
if ( ! patterns?.length ) {
|
|
148
|
+
return null;
|
|
161
149
|
}
|
|
162
150
|
|
|
163
151
|
const onBlockPatternSelectDefault = ( blocks ) => {
|
|
@@ -166,14 +154,8 @@ const BlockPatternSetup = ( {
|
|
|
166
154
|
};
|
|
167
155
|
const onPatternSelectCallback =
|
|
168
156
|
onBlockPatternSelect || onBlockPatternSelectDefault;
|
|
169
|
-
const onStartBlank = startBlankComponent
|
|
170
|
-
? () => {
|
|
171
|
-
setShowBlank( true );
|
|
172
|
-
}
|
|
173
|
-
: undefined;
|
|
174
157
|
return (
|
|
175
158
|
<>
|
|
176
|
-
{ contentResizeListener }
|
|
177
159
|
<div
|
|
178
160
|
className={ `block-editor-block-pattern-setup view-mode-${ viewMode }` }
|
|
179
161
|
>
|
|
@@ -182,7 +164,6 @@ const BlockPatternSetup = ( {
|
|
|
182
164
|
activeSlide={ activeSlide }
|
|
183
165
|
patterns={ patterns }
|
|
184
166
|
onBlockPatternSelect={ onPatternSelectCallback }
|
|
185
|
-
height={ contentHeight - 2 * 60 }
|
|
186
167
|
/>
|
|
187
168
|
<SetupToolbar
|
|
188
169
|
viewMode={ viewMode }
|
|
@@ -200,7 +181,6 @@ const BlockPatternSetup = ( {
|
|
|
200
181
|
patterns[ activeSlide ].blocks
|
|
201
182
|
);
|
|
202
183
|
} }
|
|
203
|
-
onStartBlank={ onStartBlank }
|
|
204
184
|
/>
|
|
205
185
|
</div>
|
|
206
186
|
</>
|
|
@@ -15,11 +15,8 @@ import {
|
|
|
15
15
|
*/
|
|
16
16
|
import { VIEWMODES } from './constants';
|
|
17
17
|
|
|
18
|
-
const Actions = ( {
|
|
18
|
+
const Actions = ( { onBlockPatternSelect } ) => (
|
|
19
19
|
<div className="block-editor-block-pattern-setup__actions">
|
|
20
|
-
{ onStartBlank && (
|
|
21
|
-
<Button onClick={ onStartBlank }>{ __( 'Start blank' ) }</Button>
|
|
22
|
-
) }
|
|
23
20
|
<Button variant="primary" onClick={ onBlockPatternSelect }>
|
|
24
21
|
{ __( 'Choose' ) }
|
|
25
22
|
</Button>
|
|
@@ -56,7 +53,6 @@ const SetupToolbar = ( {
|
|
|
56
53
|
activeSlide,
|
|
57
54
|
totalSlides,
|
|
58
55
|
onBlockPatternSelect,
|
|
59
|
-
onStartBlank,
|
|
60
56
|
} ) => {
|
|
61
57
|
const isCarouselView = viewMode === VIEWMODES.carousel;
|
|
62
58
|
const displayControls = (
|
|
@@ -87,10 +83,7 @@ const SetupToolbar = ( {
|
|
|
87
83
|
) }
|
|
88
84
|
{ displayControls }
|
|
89
85
|
{ isCarouselView && (
|
|
90
|
-
<Actions
|
|
91
|
-
onBlockPatternSelect={ onBlockPatternSelect }
|
|
92
|
-
onStartBlank={ onStartBlank }
|
|
93
|
-
/>
|
|
86
|
+
<Actions onBlockPatternSelect={ onBlockPatternSelect } />
|
|
94
87
|
) }
|
|
95
88
|
</div>
|
|
96
89
|
);
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
display: block;
|
|
18
18
|
width: 100%;
|
|
19
19
|
padding: $grid-unit-40;
|
|
20
|
+
padding-bottom: 0;
|
|
21
|
+
padding-top: 0;
|
|
20
22
|
column-count: 2;
|
|
21
23
|
|
|
22
24
|
@include break-huge() {
|
|
@@ -53,8 +55,9 @@
|
|
|
53
55
|
text-align: left;
|
|
54
56
|
margin: 0;
|
|
55
57
|
color: $gray-900;
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 0;
|
|
56
60
|
// Block UI appearance.
|
|
57
|
-
border-radius: $radius-block-ui $radius-block-ui 0 0;
|
|
58
61
|
background-color: $white;
|
|
59
62
|
display: flex;
|
|
60
63
|
flex-direction: row;
|
|
@@ -129,5 +132,4 @@
|
|
|
129
132
|
.block-editor-block-pattern-setup__carousel,
|
|
130
133
|
.block-editor-block-pattern-setup__grid {
|
|
131
134
|
width: 100%;
|
|
132
|
-
overflow-y: auto;
|
|
133
135
|
}
|
|
@@ -172,7 +172,7 @@ function BlockPopoverInbetween( {
|
|
|
172
172
|
getAnchorRect={ getAnchorRect }
|
|
173
173
|
focusOnMount={ false }
|
|
174
174
|
// Render in the old slot if needed for backward compatibility,
|
|
175
|
-
// otherwise render in place (not in the
|
|
175
|
+
// otherwise render in place (not in the default popover slot).
|
|
176
176
|
__unstableSlotName={ __unstablePopoverSlot || null }
|
|
177
177
|
// Forces a remount of the popover when its position changes
|
|
178
178
|
// This makes sure the popover doesn't animate from its previous position.
|
|
@@ -57,7 +57,7 @@ export default function BlockPopover( {
|
|
|
57
57
|
focusOnMount={ false }
|
|
58
58
|
anchorRef={ anchorRef }
|
|
59
59
|
// Render in the old slot if needed for backward compatibility,
|
|
60
|
-
// otherwise render in place (not in the
|
|
60
|
+
// otherwise render in place (not in the default popover slot).
|
|
61
61
|
__unstableSlotName={ __unstablePopoverSlot || null }
|
|
62
62
|
// Observe movement for block animations (especially horizontal).
|
|
63
63
|
__unstableObserveElement={ selectedElement }
|