@wordpress/block-editor 12.16.0 → 12.17.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 +2 -0
- package/LICENSE.md +1 -1
- package/README.md +3 -6
- package/build/components/block-canvas/index.js +0 -2
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +6 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-draggable/index.js +76 -6
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +0 -6
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build/components/block-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block.js +245 -102
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +46 -20
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +3 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/private-block-context.js +14 -0
- package/build/components/block-list/private-block-context.js.map +1 -0
- package/build/components/block-list/use-block-props/index.js +33 -96
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build/components/block-lock/toolbar.js +15 -27
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +2 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +4 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +1 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +0 -2
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +29 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +1 -1
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/utils.js +10 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -2
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -2
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +1 -4
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +192 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +7 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +7 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +22 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/height-control/index.js +6 -2
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +61 -22
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +18 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +10 -14
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +1 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +14 -28
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/tabs.js +21 -21
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +1 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +34 -23
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +57 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +19 -0
- package/build/components/media-upload-progress/constants.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +42 -17
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +9 -14
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +8 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +7 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.js +17 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +16 -24
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +2 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +9 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +14 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +51 -22
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +100 -92
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +8 -11
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/index.js +0 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +15 -4
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +73 -27
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +185 -20
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/border.js +5 -10
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +13 -11
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +1 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +9 -1
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +4 -9
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +7 -3
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +1 -1
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +4 -3
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +5 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +4 -9
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +43 -18
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +44 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -4
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +0 -16
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +51 -5
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +12 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -13
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +12 -0
- package/build/store/undo-ignore.js.map +1 -0
- package/build/store/utils.js +1 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/get-px-from-css-unit.js +16 -0
- package/build/utils/get-px-from-css-unit.js.map +1 -0
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/object.js +0 -38
- package/build/utils/object.js.map +1 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
- package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-module/components/block-canvas/index.js +0 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +6 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/index.js +76 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -7
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block.js +249 -106
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +48 -22
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +6 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -0
- package/build-module/components/block-list/use-block-props/index.js +34 -97
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +16 -28
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +5 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +1 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +30 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +1 -1
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +9 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +3 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -5
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +7 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +3 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +15 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/height-control/index.js +6 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +2 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +62 -23
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +18 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +3 -7
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -28
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/tabs.js +22 -22
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +2 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +2 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +35 -24
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +58 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-upload-progress/constants.js +7 -0
- package/build-module/components/media-upload-progress/constants.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +37 -8
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +9 -14
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +6 -1
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +7 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.js +17 -7
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +16 -23
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +2 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +9 -6
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +14 -18
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +51 -23
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +102 -94
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +8 -11
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +0 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +15 -4
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +73 -27
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +181 -19
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +2 -8
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +11 -9
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +1 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +7 -1
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -7
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +6 -2
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +1 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +5 -4
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +6 -4
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +1 -7
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +43 -17
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +9 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +43 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -4
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +49 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/undo-ignore.js +5 -0
- package/build-module/store/undo-ignore.js.map +1 -0
- package/build-module/store/utils.js +2 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +9 -0
- package/build-module/utils/get-px-from-css-unit.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/object.js +0 -37
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +51 -8
- package/build-style/style.css +51 -8
- package/package.json +31 -31
- package/src/components/alignment-control/README.md +0 -5
- package/src/components/block-alignment-control/README.md +0 -5
- package/src/components/block-alignment-matrix-control/README.md +0 -10
- package/src/components/block-breadcrumb/README.md +0 -5
- package/src/components/block-canvas/index.js +0 -2
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +0 -5
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +1 -1
- package/src/components/block-draggable/draggable-chip.js +11 -1
- package/src/components/block-draggable/index.js +116 -4
- package/src/components/block-draggable/index.native.js +0 -5
- package/src/components/block-draggable/style.scss +35 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -7
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +290 -119
- package/src/components/block-list/block.native.js +55 -21
- package/src/components/block-list/content.scss +14 -10
- package/src/components/block-list/index.native.js +3 -5
- package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
- package/src/components/block-list/use-block-props/index.js +32 -128
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
- package/src/components/block-lock/toolbar.js +15 -34
- package/src/components/block-mover/README.md +0 -5
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-parent-selector/README.md +0 -5
- package/src/components/block-patterns-list/README.md +0 -5
- package/src/components/block-patterns-list/index.js +8 -5
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +1 -2
- package/src/components/block-tools/block-toolbar-popover.js +4 -10
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-transforms/README.md +0 -5
- package/src/components/block-variation-transforms/index.js +49 -3
- package/src/components/border-radius-control/linked-button.js +1 -1
- package/src/components/caption/README.md +0 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
- package/src/components/colors/utils.js +8 -1
- package/src/components/colors/with-colors.js +3 -1
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/font-sizes/utils.js +7 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/dimensions-panel.js +4 -3
- package/src/components/global-styles/effects-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +2 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +3 -0
- package/src/components/global-styles/image-settings-panel.js +6 -0
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
- package/src/components/global-styles/typography-panel.js +2 -1
- package/src/components/global-styles/use-global-styles-output.js +9 -5
- package/src/components/global-styles/utils.js +7 -0
- package/src/components/height-control/README.md +2 -7
- package/src/components/height-control/index.js +4 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/index.js +68 -29
- package/src/components/inner-blocks/index.native.js +19 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
- package/src/components/inserter/block-patterns-tab/utils.js +11 -12
- package/src/components/inserter/hooks/use-block-types-state.js +9 -11
- package/src/components/inserter/hooks/use-patterns-state.js +2 -2
- package/src/components/inserter/index.js +0 -1
- package/src/components/inserter/library.js +2 -8
- package/src/components/inserter/menu.js +13 -31
- package/src/components/inserter/style.scss +6 -4
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-draggable-blocks/index.js +2 -2
- package/src/components/inserter-list-item/index.js +6 -6
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +39 -28
- package/src/components/inspector-controls-tabs/style.scss +3 -2
- package/src/components/letter-spacing-control/README.md +0 -5
- package/src/components/line-height-control/README.md +0 -5
- package/src/components/list-view/README.md +0 -5
- package/src/components/list-view/block-select-button.js +4 -0
- package/src/components/list-view/block.js +73 -2
- package/src/components/list-view/style.scss +6 -0
- package/src/components/media-upload-progress/constants.js +6 -0
- package/src/components/media-upload-progress/index.native.js +66 -14
- package/src/components/media-upload-progress/test/index.native.js +2 -2
- package/src/components/multi-selection-inspector/README.md +0 -5
- package/src/components/navigable-toolbar/index.js +13 -11
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +20 -17
- package/src/components/provider/use-block-sync.js +6 -0
- package/src/components/rich-text/index.js +18 -6
- package/src/components/rich-text/native/index.native.js +16 -24
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/rich-text/native/test/index.native.js +72 -5
- package/src/components/rich-text/use-input-rules.js +2 -2
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/text-decoration-control/README.md +40 -0
- package/src/components/text-transform-control/README.md +0 -4
- package/src/components/ungroup-button/README.md +0 -5
- package/src/components/unit-control/README.md +0 -4
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-commands/index.js +18 -21
- package/src/components/use-block-drop-zone/index.js +85 -34
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +7 -23
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +0 -4
- package/src/components/use-settings/README.md +0 -4
- package/src/components/writing-flow/index.js +0 -1
- package/src/components/writing-flow/use-drag-selection.js +18 -4
- package/src/components/writing-flow/use-selection-observer.js +99 -37
- package/src/components/writing-flow/use-tab-nav.js +7 -7
- package/src/hooks/align.js +1 -5
- package/src/hooks/anchor.js +1 -5
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +253 -21
- package/src/hooks/border.js +2 -13
- package/src/hooks/color.js +19 -14
- package/src/hooks/custom-class-name.js +1 -5
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +1 -7
- package/src/hooks/font-family.js +4 -7
- package/src/hooks/font-size.js +1 -6
- package/src/hooks/index.js +19 -3
- package/src/hooks/index.native.js +17 -4
- package/src/hooks/layout.js +5 -2
- package/src/hooks/style.js +1 -6
- package/src/hooks/test/anchor.js +4 -9
- package/src/hooks/test/custom-class-name.js +3 -8
- package/src/hooks/test/style.js +4 -14
- package/src/hooks/typography.js +1 -7
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +60 -2
- package/src/private-apis.js +2 -4
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +44 -4
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +16 -5
- package/src/store/selectors.js +5 -13
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +0 -35
- package/src/utils/test/object.js +1 -96
- package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
- package/build/components/block-list/block-list-block-context.js +0 -14
- package/build/components/block-list/block-list-block-context.js.map +0 -1
- package/build/utils/parse-css-unit-to-px.js +0 -302
- package/build/utils/parse-css-unit-to-px.js.map +0 -1
- package/build/utils/use-should-contextual-toolbar-show.js +0 -63
- package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/build-module/components/block-list/block-list-block-context.js +0 -6
- package/build-module/components/block-list/block-list-block-context.js.map +0 -1
- package/build-module/utils/parse-css-unit-to-px.js +0 -294
- package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/src/utils/parse-css-unit-to-px.js +0 -329
- package/src/utils/test/parse-css-unit-to-px.js +0 -172
- package/src/utils/use-should-contextual-toolbar-show.js +0 -85
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useLayoutEffect, useMemo, useState } from '@wordpress/element';
|
|
5
|
-
import {
|
|
5
|
+
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
6
6
|
import deprecated from '@wordpress/deprecated';
|
|
7
7
|
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
8
8
|
|
|
@@ -32,6 +32,7 @@ function useShallowMemo( value ) {
|
|
|
32
32
|
* came from props.
|
|
33
33
|
*
|
|
34
34
|
* @param {string} clientId The client ID of the block to update.
|
|
35
|
+
* @param {string} parentLock
|
|
35
36
|
* @param {string[]} allowedBlocks An array of block names which are permitted
|
|
36
37
|
* in inner blocks.
|
|
37
38
|
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
|
|
@@ -53,6 +54,7 @@ function useShallowMemo( value ) {
|
|
|
53
54
|
*/
|
|
54
55
|
export default function useNestedSettingsUpdate(
|
|
55
56
|
clientId,
|
|
57
|
+
parentLock,
|
|
56
58
|
allowedBlocks,
|
|
57
59
|
prioritizedInserterBlocks,
|
|
58
60
|
defaultBlock,
|
|
@@ -64,21 +66,12 @@ export default function useNestedSettingsUpdate(
|
|
|
64
66
|
orientation,
|
|
65
67
|
layout
|
|
66
68
|
) {
|
|
69
|
+
// Instead of adding a useSelect mapping here, please add to the useSelect
|
|
70
|
+
// mapping in InnerBlocks! Every subscription impacts performance.
|
|
71
|
+
|
|
67
72
|
const { updateBlockListSettings } = useDispatch( blockEditorStore );
|
|
68
73
|
const registry = useRegistry();
|
|
69
74
|
|
|
70
|
-
const { parentLock } = useSelect(
|
|
71
|
-
( select ) => {
|
|
72
|
-
const rootClientId =
|
|
73
|
-
select( blockEditorStore ).getBlockRootClientId( clientId );
|
|
74
|
-
return {
|
|
75
|
-
parentLock:
|
|
76
|
-
select( blockEditorStore ).getTemplateLock( rootClientId ),
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
[ clientId ]
|
|
80
|
-
);
|
|
81
|
-
|
|
82
75
|
// Implementors often pass a new array on every render,
|
|
83
76
|
// and the contents of the arrays are just strings, so the entire array
|
|
84
77
|
// can be passed as dependencies but We need to include the length of the array,
|
|
@@ -18,7 +18,7 @@ import { searchItems } from '../search-items';
|
|
|
18
18
|
import BlockPatternsPaging from '../../block-patterns-paging';
|
|
19
19
|
import usePatternsPaging from '../hooks/use-patterns-paging';
|
|
20
20
|
import {
|
|
21
|
-
|
|
21
|
+
INSERTER_PATTERN_TYPES,
|
|
22
22
|
allPatternsCategory,
|
|
23
23
|
myPatternsCategory,
|
|
24
24
|
} from '../block-patterns-tab/utils';
|
|
@@ -73,7 +73,7 @@ function PatternList( { searchValue, selectedCategory, patternCategories } ) {
|
|
|
73
73
|
}
|
|
74
74
|
if (
|
|
75
75
|
selectedCategory === myPatternsCategory.name &&
|
|
76
|
-
pattern.type ===
|
|
76
|
+
pattern.type === INSERTER_PATTERN_TYPES.user
|
|
77
77
|
) {
|
|
78
78
|
return true;
|
|
79
79
|
}
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
isPatternFiltered,
|
|
31
31
|
allPatternsCategory,
|
|
32
32
|
myPatternsCategory,
|
|
33
|
-
|
|
33
|
+
INSERTER_PATTERN_TYPES,
|
|
34
34
|
} from './utils';
|
|
35
35
|
|
|
36
36
|
const noop = () => {};
|
|
@@ -70,27 +70,27 @@ export function PatternCategoryPreviews( {
|
|
|
70
70
|
if ( category.name === allPatternsCategory.name ) {
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
|
+
|
|
73
74
|
if (
|
|
74
75
|
category.name === myPatternsCategory.name &&
|
|
75
|
-
pattern.type ===
|
|
76
|
+
pattern.type === INSERTER_PATTERN_TYPES.user
|
|
76
77
|
) {
|
|
77
78
|
return true;
|
|
78
79
|
}
|
|
79
|
-
if ( category.name !== 'uncategorized' ) {
|
|
80
|
-
return pattern.categories?.includes( category.name );
|
|
81
|
-
}
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
if ( category.name === 'uncategorized' ) {
|
|
82
|
+
// The uncategorized category should show all the patterns without any category...
|
|
83
|
+
if ( ! pattern.categories ) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ...or with no available category.
|
|
88
|
+
return ! pattern.categories.some( ( catName ) =>
|
|
89
|
+
availableCategories.some( ( c ) => c.name === catName )
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
92
|
|
|
93
|
-
return
|
|
93
|
+
return pattern.categories?.includes( category.name );
|
|
94
94
|
} ),
|
|
95
95
|
[
|
|
96
96
|
allPatterns,
|
|
@@ -16,11 +16,13 @@ import { useMemo, createInterpolateElement } from '@wordpress/element';
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
import {
|
|
20
|
+
myPatternsCategory,
|
|
21
|
+
INSERTER_SYNC_TYPES,
|
|
22
|
+
INSERTER_PATTERN_TYPES,
|
|
23
|
+
} from './utils';
|
|
23
24
|
|
|
25
|
+
const getShouldDisableSyncFilter = ( sourceFilter ) => sourceFilter !== 'all';
|
|
24
26
|
const getShouldDisableNonUserSources = ( category ) => {
|
|
25
27
|
return category.name === myPatternsCategory.name;
|
|
26
28
|
};
|
|
@@ -39,7 +41,7 @@ export function PatternsFilter( {
|
|
|
39
41
|
// this filter themselves.
|
|
40
42
|
const currentPatternSourceFilter =
|
|
41
43
|
category.name === myPatternsCategory.name
|
|
42
|
-
?
|
|
44
|
+
? INSERTER_PATTERN_TYPES.user
|
|
43
45
|
: patternSourceFilter;
|
|
44
46
|
|
|
45
47
|
// We need to disable the sync filter option if the source filter is not 'all' or 'user'
|
|
@@ -56,11 +58,11 @@ export function PatternsFilter( {
|
|
|
56
58
|
const patternSyncMenuOptions = useMemo(
|
|
57
59
|
() => [
|
|
58
60
|
{
|
|
59
|
-
value:
|
|
61
|
+
value: 'all',
|
|
60
62
|
label: _x( 'All', 'Option that shows all patterns' ),
|
|
61
63
|
},
|
|
62
64
|
{
|
|
63
|
-
value:
|
|
65
|
+
value: INSERTER_SYNC_TYPES.full,
|
|
64
66
|
label: _x(
|
|
65
67
|
'Synced',
|
|
66
68
|
'Option that shows all synchronized patterns'
|
|
@@ -68,7 +70,7 @@ export function PatternsFilter( {
|
|
|
68
70
|
disabled: shouldDisableSyncFilter,
|
|
69
71
|
},
|
|
70
72
|
{
|
|
71
|
-
value:
|
|
73
|
+
value: INSERTER_SYNC_TYPES.unsynced,
|
|
72
74
|
label: _x(
|
|
73
75
|
'Not synced',
|
|
74
76
|
'Option that shows all patterns that are not synchronized'
|
|
@@ -82,22 +84,22 @@ export function PatternsFilter( {
|
|
|
82
84
|
const patternSourceMenuOptions = useMemo(
|
|
83
85
|
() => [
|
|
84
86
|
{
|
|
85
|
-
value:
|
|
87
|
+
value: 'all',
|
|
86
88
|
label: __( 'All' ),
|
|
87
89
|
disabled: shouldDisableNonUserSources,
|
|
88
90
|
},
|
|
89
91
|
{
|
|
90
|
-
value:
|
|
92
|
+
value: INSERTER_PATTERN_TYPES.directory,
|
|
91
93
|
label: __( 'Pattern Directory' ),
|
|
92
94
|
disabled: shouldDisableNonUserSources,
|
|
93
95
|
},
|
|
94
96
|
{
|
|
95
|
-
value:
|
|
97
|
+
value: INSERTER_PATTERN_TYPES.theme,
|
|
96
98
|
label: __( 'Theme & Plugins' ),
|
|
97
99
|
disabled: shouldDisableNonUserSources,
|
|
98
100
|
},
|
|
99
101
|
{
|
|
100
|
-
value:
|
|
102
|
+
value: INSERTER_PATTERN_TYPES.user,
|
|
101
103
|
label: __( 'User' ),
|
|
102
104
|
},
|
|
103
105
|
],
|
|
@@ -107,7 +109,7 @@ export function PatternsFilter( {
|
|
|
107
109
|
function handleSetSourceFilterChange( newSourceFilter ) {
|
|
108
110
|
setPatternSourceFilter( newSourceFilter );
|
|
109
111
|
if ( getShouldDisableSyncFilter( newSourceFilter ) ) {
|
|
110
|
-
setPatternSyncFilter(
|
|
112
|
+
setPatternSyncFilter( 'all' );
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useMemo
|
|
4
|
+
import { useMemo } from '@wordpress/element';
|
|
5
5
|
import { _x, _n, sprintf } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
import { speak } from '@wordpress/a11y';
|
|
@@ -14,9 +14,19 @@ import {
|
|
|
14
14
|
isPatternFiltered,
|
|
15
15
|
allPatternsCategory,
|
|
16
16
|
myPatternsCategory,
|
|
17
|
-
|
|
17
|
+
INSERTER_PATTERN_TYPES,
|
|
18
18
|
} from './utils';
|
|
19
19
|
|
|
20
|
+
function hasRegisteredCategory( pattern, allCategories ) {
|
|
21
|
+
if ( ! pattern.categories || ! pattern.categories.length ) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return pattern.categories.some( ( cat ) =>
|
|
26
|
+
allCategories.some( ( category ) => category.name === cat )
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
|
|
21
31
|
const [ patterns, allCategories ] = usePatternsState(
|
|
22
32
|
undefined,
|
|
@@ -34,19 +44,6 @@ export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
|
|
|
34
44
|
[ sourceFilter, patterns ]
|
|
35
45
|
);
|
|
36
46
|
|
|
37
|
-
const hasRegisteredCategory = useCallback(
|
|
38
|
-
( pattern ) => {
|
|
39
|
-
if ( ! pattern.categories || ! pattern.categories.length ) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return pattern.categories.some( ( cat ) =>
|
|
44
|
-
allCategories.some( ( category ) => category.name === cat )
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
[ allCategories ]
|
|
48
|
-
);
|
|
49
|
-
|
|
50
47
|
// Remove any empty categories.
|
|
51
48
|
const populatedCategories = useMemo( () => {
|
|
52
49
|
const categories = allCategories
|
|
@@ -59,7 +56,7 @@ export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
|
|
|
59
56
|
|
|
60
57
|
if (
|
|
61
58
|
filteredPatterns.some(
|
|
62
|
-
( pattern ) => ! hasRegisteredCategory( pattern )
|
|
59
|
+
( pattern ) => ! hasRegisteredCategory( pattern, allCategories )
|
|
63
60
|
) &&
|
|
64
61
|
! categories.find(
|
|
65
62
|
( category ) => category.name === 'uncategorized'
|
|
@@ -72,7 +69,7 @@ export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
|
|
|
72
69
|
}
|
|
73
70
|
if (
|
|
74
71
|
filteredPatterns.some(
|
|
75
|
-
( pattern ) => pattern.type ===
|
|
72
|
+
( pattern ) => pattern.type === INSERTER_PATTERN_TYPES.user
|
|
76
73
|
)
|
|
77
74
|
) {
|
|
78
75
|
categories.unshift( myPatternsCategory );
|
|
@@ -95,7 +92,7 @@ export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
|
|
|
95
92
|
)
|
|
96
93
|
);
|
|
97
94
|
return categories;
|
|
98
|
-
}, [ allCategories, filteredPatterns
|
|
95
|
+
}, [ allCategories, filteredPatterns ] );
|
|
99
96
|
|
|
100
97
|
return populatedCategories;
|
|
101
98
|
}
|
|
@@ -4,17 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
all: 'all',
|
|
9
|
-
synced: 'synced',
|
|
10
|
-
unsynced: 'unsynced',
|
|
7
|
+
export const INSERTER_PATTERN_TYPES = {
|
|
11
8
|
user: 'user',
|
|
12
9
|
theme: 'theme',
|
|
13
10
|
directory: 'directory',
|
|
14
11
|
};
|
|
15
12
|
|
|
16
|
-
export const
|
|
17
|
-
all: 'all',
|
|
13
|
+
export const INSERTER_SYNC_TYPES = {
|
|
18
14
|
full: 'fully',
|
|
19
15
|
unsynced: 'unsynced',
|
|
20
16
|
};
|
|
@@ -38,7 +34,7 @@ export function isPatternFiltered( pattern, sourceFilter, syncFilter ) {
|
|
|
38
34
|
// If theme source selected, filter out user created patterns and those from
|
|
39
35
|
// the core patterns directory.
|
|
40
36
|
if (
|
|
41
|
-
sourceFilter ===
|
|
37
|
+
sourceFilter === INSERTER_PATTERN_TYPES.theme &&
|
|
42
38
|
( isUserPattern || isDirectoryPattern )
|
|
43
39
|
) {
|
|
44
40
|
return true;
|
|
@@ -47,7 +43,7 @@ export function isPatternFiltered( pattern, sourceFilter, syncFilter ) {
|
|
|
47
43
|
// If the directory source is selected, filter out user created patterns
|
|
48
44
|
// and those bundled with the theme.
|
|
49
45
|
if (
|
|
50
|
-
sourceFilter ===
|
|
46
|
+
sourceFilter === INSERTER_PATTERN_TYPES.directory &&
|
|
51
47
|
( isUserPattern || ! isDirectoryPattern )
|
|
52
48
|
) {
|
|
53
49
|
return true;
|
|
@@ -55,19 +51,22 @@ export function isPatternFiltered( pattern, sourceFilter, syncFilter ) {
|
|
|
55
51
|
|
|
56
52
|
// If user source selected, filter out theme patterns.
|
|
57
53
|
if (
|
|
58
|
-
sourceFilter ===
|
|
59
|
-
pattern.type !==
|
|
54
|
+
sourceFilter === INSERTER_PATTERN_TYPES.user &&
|
|
55
|
+
pattern.type !== INSERTER_PATTERN_TYPES.user
|
|
60
56
|
) {
|
|
61
57
|
return true;
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
// Filter by sync status.
|
|
65
|
-
if (
|
|
61
|
+
if (
|
|
62
|
+
syncFilter === INSERTER_SYNC_TYPES.full &&
|
|
63
|
+
pattern.syncStatus !== ''
|
|
64
|
+
) {
|
|
66
65
|
return true;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
if (
|
|
70
|
-
syncFilter ===
|
|
69
|
+
syncFilter === INSERTER_SYNC_TYPES.unsynced &&
|
|
71
70
|
pattern.syncStatus !== 'unsynced' &&
|
|
72
71
|
isUserPattern
|
|
73
72
|
) {
|
|
@@ -23,20 +23,18 @@ import { store as blockEditorStore } from '../../../store';
|
|
|
23
23
|
* @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
|
|
24
24
|
*/
|
|
25
25
|
const useBlockTypesState = ( rootClientId, onInsert ) => {
|
|
26
|
-
const
|
|
27
|
-
( select ) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
categories: getCategories(),
|
|
33
|
-
collections: getCollections(),
|
|
34
|
-
items: getInserterItems( rootClientId ),
|
|
35
|
-
};
|
|
36
|
-
},
|
|
26
|
+
const [ items ] = useSelect(
|
|
27
|
+
( select ) => [
|
|
28
|
+
select( blockEditorStore ).getInserterItems( rootClientId ),
|
|
29
|
+
],
|
|
37
30
|
[ rootClientId ]
|
|
38
31
|
);
|
|
39
32
|
|
|
33
|
+
const [ categories, collections ] = useSelect( ( select ) => {
|
|
34
|
+
const { getCategories, getCollections } = select( blocksStore );
|
|
35
|
+
return [ getCategories(), getCollections() ];
|
|
36
|
+
}, [] );
|
|
37
|
+
|
|
40
38
|
const onSelectItem = useCallback(
|
|
41
39
|
(
|
|
42
40
|
{ name, initialAttributes, innerBlocks, syncStatus, content },
|
|
@@ -11,7 +11,7 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { store as blockEditorStore } from '../../../store';
|
|
14
|
-
import {
|
|
14
|
+
import { INSERTER_PATTERN_TYPES } from '../block-patterns-tab/utils';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Retrieves the block patterns inserter state.
|
|
@@ -58,7 +58,7 @@ const usePatternsState = ( onInsert, rootClientId ) => {
|
|
|
58
58
|
const onClickPattern = useCallback(
|
|
59
59
|
( pattern, blocks ) => {
|
|
60
60
|
const patternBlocks =
|
|
61
|
-
pattern.type ===
|
|
61
|
+
pattern.type === INSERTER_PATTERN_TYPES.user &&
|
|
62
62
|
pattern.syncStatus !== 'unsynced'
|
|
63
63
|
? [ createBlock( 'core/block', { ref: pattern.id } ) ]
|
|
64
64
|
: blocks;
|
|
@@ -26,18 +26,13 @@ function InserterLibrary(
|
|
|
26
26
|
},
|
|
27
27
|
ref
|
|
28
28
|
) {
|
|
29
|
-
const { destinationRootClientId
|
|
29
|
+
const { destinationRootClientId } = useSelect(
|
|
30
30
|
( select ) => {
|
|
31
|
-
const { getBlockRootClientId
|
|
32
|
-
select( blockEditorStore );
|
|
33
|
-
|
|
31
|
+
const { getBlockRootClientId } = select( blockEditorStore );
|
|
34
32
|
const _rootClientId =
|
|
35
33
|
rootClientId || getBlockRootClientId( clientId ) || undefined;
|
|
36
34
|
return {
|
|
37
35
|
destinationRootClientId: _rootClientId,
|
|
38
|
-
prioritizePatterns:
|
|
39
|
-
getSettings().__experimentalPreferPatternsOnRoot &&
|
|
40
|
-
! _rootClientId,
|
|
41
36
|
};
|
|
42
37
|
},
|
|
43
38
|
[ clientId, rootClientId ]
|
|
@@ -54,7 +49,6 @@ function InserterLibrary(
|
|
|
54
49
|
__experimentalInsertionIndex={ __experimentalInsertionIndex }
|
|
55
50
|
__experimentalFilterValue={ __experimentalFilterValue }
|
|
56
51
|
shouldFocusBlock={ shouldFocusBlock }
|
|
57
|
-
prioritizePatterns={ prioritizePatterns }
|
|
58
52
|
ref={ ref }
|
|
59
53
|
/>
|
|
60
54
|
);
|
|
@@ -45,7 +45,6 @@ function InserterMenu(
|
|
|
45
45
|
showMostUsedBlocks,
|
|
46
46
|
__experimentalFilterValue = '',
|
|
47
47
|
shouldFocusBlock = true,
|
|
48
|
-
prioritizePatterns,
|
|
49
48
|
},
|
|
50
49
|
ref
|
|
51
50
|
) {
|
|
@@ -67,26 +66,18 @@ function InserterMenu(
|
|
|
67
66
|
insertionIndex: __experimentalInsertionIndex,
|
|
68
67
|
shouldFocusBlock,
|
|
69
68
|
} );
|
|
70
|
-
const { showPatterns
|
|
69
|
+
const { showPatterns } = useSelect(
|
|
71
70
|
( select ) => {
|
|
72
|
-
const { hasAllowedPatterns
|
|
73
|
-
select( blockEditorStore )
|
|
74
|
-
);
|
|
71
|
+
const { hasAllowedPatterns } = unlock( select( blockEditorStore ) );
|
|
75
72
|
return {
|
|
76
73
|
showPatterns: hasAllowedPatterns( destinationRootClientId ),
|
|
77
|
-
inserterItems: getInserterItems( destinationRootClientId ),
|
|
78
74
|
};
|
|
79
75
|
},
|
|
80
76
|
[ destinationRootClientId ]
|
|
81
77
|
);
|
|
82
|
-
const hasReusableBlocks = useMemo( () => {
|
|
83
|
-
return inserterItems.some(
|
|
84
|
-
( { category } ) => category === 'reusable'
|
|
85
|
-
);
|
|
86
|
-
}, [ inserterItems ] );
|
|
87
78
|
|
|
88
79
|
const mediaCategories = useMediaCategories( destinationRootClientId );
|
|
89
|
-
const showMedia =
|
|
80
|
+
const showMedia = mediaCategories.length > 0;
|
|
90
81
|
|
|
91
82
|
const onInsert = useCallback(
|
|
92
83
|
( blocks, meta, shouldForceFocusBlock ) => {
|
|
@@ -191,17 +182,13 @@ function InserterMenu(
|
|
|
191
182
|
]
|
|
192
183
|
);
|
|
193
184
|
|
|
194
|
-
const
|
|
195
|
-
(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return mediaTab;
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
[ blocksTab, patternsTab, mediaTab ]
|
|
185
|
+
const inserterTabsContents = useMemo(
|
|
186
|
+
() => ( {
|
|
187
|
+
blocks: blocksTab,
|
|
188
|
+
patterns: patternsTab,
|
|
189
|
+
media: mediaTab,
|
|
190
|
+
} ),
|
|
191
|
+
[ blocksTab, mediaTab, patternsTab ]
|
|
205
192
|
);
|
|
206
193
|
|
|
207
194
|
const searchRef = useRef();
|
|
@@ -215,9 +202,7 @@ function InserterMenu(
|
|
|
215
202
|
selectedTab === 'patterns' &&
|
|
216
203
|
! delayedFilterValue &&
|
|
217
204
|
selectedPatternCategory;
|
|
218
|
-
const showAsTabs =
|
|
219
|
-
! delayedFilterValue &&
|
|
220
|
-
( showPatterns || hasReusableBlocks || showMedia );
|
|
205
|
+
const showAsTabs = ! delayedFilterValue && ( showPatterns || showMedia );
|
|
221
206
|
const showMediaPanel =
|
|
222
207
|
selectedTab === 'media' &&
|
|
223
208
|
! delayedFilterValue &&
|
|
@@ -271,13 +256,10 @@ function InserterMenu(
|
|
|
271
256
|
{ showAsTabs && (
|
|
272
257
|
<InserterTabs
|
|
273
258
|
showPatterns={ showPatterns }
|
|
274
|
-
showReusableBlocks={ hasReusableBlocks }
|
|
275
259
|
showMedia={ showMedia }
|
|
276
|
-
prioritizePatterns={ prioritizePatterns }
|
|
277
260
|
onSelect={ handleSetSelectedTab }
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
</InserterTabs>
|
|
261
|
+
tabsContents={ inserterTabsContents }
|
|
262
|
+
/>
|
|
281
263
|
) }
|
|
282
264
|
{ ! delayedFilterValue && ! showAsTabs && (
|
|
283
265
|
<div className="block-editor-inserter__no-tab-container">
|
|
@@ -22,6 +22,8 @@ $block-inserter-tabs-height: 44px;
|
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
height: 100%;
|
|
24
24
|
gap: $grid-unit-20;
|
|
25
|
+
overflow-y: hidden;
|
|
26
|
+
|
|
25
27
|
&.show-as-tabs {
|
|
26
28
|
gap: 0;
|
|
27
29
|
}
|
|
@@ -61,7 +63,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
61
63
|
.block-editor-inserter__popover .block-editor-inserter__menu {
|
|
62
64
|
margin: -$grid-unit-15;
|
|
63
65
|
|
|
64
|
-
.block-editor-inserter__tabs
|
|
66
|
+
.block-editor-inserter__tabs div[role="tablist"] {
|
|
65
67
|
top: $grid-unit-10 + $grid-unit-20 + $grid-unit-60 - $grid-unit-15;
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -118,10 +120,10 @@ $block-inserter-tabs-height: 44px;
|
|
|
118
120
|
flex-direction: column;
|
|
119
121
|
overflow: hidden;
|
|
120
122
|
|
|
121
|
-
|
|
123
|
+
div[role="tablist"] {
|
|
122
124
|
border-bottom: $border-width solid $gray-300;
|
|
123
125
|
|
|
124
|
-
|
|
126
|
+
button[role="tab"] {
|
|
125
127
|
flex-grow: 1;
|
|
126
128
|
margin-bottom: -$border-width;
|
|
127
129
|
&[id$="reusable"] {
|
|
@@ -133,7 +135,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
div[role="tabpanel"] {
|
|
137
139
|
display: flex;
|
|
138
140
|
flex-grow: 1;
|
|
139
141
|
flex-direction: column;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { TabPanel } from '@wordpress/components';
|
|
4
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { unlock } from '../../lock-unlock';
|
|
11
|
+
|
|
12
|
+
const { Tabs } = unlock( componentsPrivateApis );
|
|
13
|
+
|
|
8
14
|
const blocksTab = {
|
|
9
15
|
name: 'blocks',
|
|
10
16
|
/* translators: Blocks tab title in the block inserter. */
|
|
@@ -23,35 +29,38 @@ const mediaTab = {
|
|
|
23
29
|
};
|
|
24
30
|
|
|
25
31
|
function InserterTabs( {
|
|
26
|
-
children,
|
|
27
32
|
showPatterns = false,
|
|
28
33
|
showMedia = false,
|
|
29
34
|
onSelect,
|
|
30
|
-
|
|
35
|
+
tabsContents,
|
|
31
36
|
} ) {
|
|
32
|
-
const tabs =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
tempTabs.push( blocksTab );
|
|
38
|
-
if ( ! prioritizePatterns && showPatterns ) {
|
|
39
|
-
tempTabs.push( patternsTab );
|
|
40
|
-
}
|
|
41
|
-
if ( showMedia ) {
|
|
42
|
-
tempTabs.push( mediaTab );
|
|
43
|
-
}
|
|
44
|
-
return tempTabs;
|
|
45
|
-
}, [ prioritizePatterns, showPatterns, showMedia ] );
|
|
37
|
+
const tabs = [
|
|
38
|
+
blocksTab,
|
|
39
|
+
showPatterns && patternsTab,
|
|
40
|
+
showMedia && mediaTab,
|
|
41
|
+
].filter( Boolean );
|
|
46
42
|
|
|
47
43
|
return (
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
<div className="block-editor-inserter__tabs">
|
|
45
|
+
<Tabs onSelect={ onSelect }>
|
|
46
|
+
<Tabs.TabList>
|
|
47
|
+
{ tabs.map( ( tab ) => (
|
|
48
|
+
<Tabs.Tab key={ tab.name } tabId={ tab.name }>
|
|
49
|
+
{ tab.title }
|
|
50
|
+
</Tabs.Tab>
|
|
51
|
+
) ) }
|
|
52
|
+
</Tabs.TabList>
|
|
53
|
+
{ tabs.map( ( tab ) => (
|
|
54
|
+
<Tabs.TabPanel
|
|
55
|
+
key={ tab.name }
|
|
56
|
+
tabId={ tab.name }
|
|
57
|
+
focusable={ false }
|
|
58
|
+
>
|
|
59
|
+
{ tabsContents[ tab.name ] }
|
|
60
|
+
</Tabs.TabPanel>
|
|
61
|
+
) ) }
|
|
62
|
+
</Tabs>
|
|
63
|
+
</div>
|
|
55
64
|
);
|
|
56
65
|
}
|
|
57
66
|
|
|
@@ -12,7 +12,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import BlockDraggableChip from '../block-draggable/draggable-chip';
|
|
15
|
-
import {
|
|
15
|
+
import { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
|
|
16
16
|
|
|
17
17
|
const InserterDraggableBlocks = ( {
|
|
18
18
|
isEnabled,
|
|
@@ -42,7 +42,7 @@ const InserterDraggableBlocks = ( {
|
|
|
42
42
|
transferData={ transferData }
|
|
43
43
|
onDragStart={ ( event ) => {
|
|
44
44
|
const parsedBlocks =
|
|
45
|
-
pattern?.type ===
|
|
45
|
+
pattern?.type === INSERTER_PATTERN_TYPES.user &&
|
|
46
46
|
pattern?.syncStatus !== 'unsynced'
|
|
47
47
|
? [ createBlock( 'core/block', { ref: pattern.id } ) ]
|
|
48
48
|
: blocks;
|