@wordpress/block-editor 12.16.0 → 12.16.1-next.79a6196f.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/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 +21 -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 +3 -2
- 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 +33 -15
- 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 -4
- 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 +48 -5
- 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 +17 -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 +22 -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 +3 -2
- 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 +35 -17
- 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 -5
- 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 +47 -5
- 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 +16 -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 +23 -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 +5 -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 +47 -14
- 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 -5
- 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 +76 -6
- 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 +16 -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/hooks/custom-fields.js +0 -106
- package/build/hooks/custom-fields.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/hooks/custom-fields.js +0 -99
- package/build-module/hooks/custom-fields.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/hooks/custom-fields.js +0 -115
- 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
|
@@ -8,22 +8,15 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { useContext } from '@wordpress/element';
|
|
10
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
12
|
-
__unstableGetBlockProps as getBlockProps,
|
|
13
|
-
getBlockType,
|
|
14
|
-
isReusableBlock,
|
|
15
|
-
getBlockDefaultClassName,
|
|
16
|
-
store as blocksStore,
|
|
17
|
-
} from '@wordpress/blocks';
|
|
11
|
+
import { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';
|
|
18
12
|
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
19
|
-
import { useSelect } from '@wordpress/data';
|
|
20
13
|
import warning from '@wordpress/warning';
|
|
21
14
|
|
|
22
15
|
/**
|
|
23
16
|
* Internal dependencies
|
|
24
17
|
*/
|
|
25
18
|
import useMovingAnimation from '../../use-moving-animation';
|
|
26
|
-
import {
|
|
19
|
+
import { PrivateBlockContext } from '../private-block-context';
|
|
27
20
|
import { useFocusFirstElement } from './use-focus-first-element';
|
|
28
21
|
import { useIsHovered } from './use-is-hovered';
|
|
29
22
|
import { useBlockEditContext } from '../../block-edit/context';
|
|
@@ -32,14 +25,6 @@ import { useEventHandlers } from './use-selected-block-event-handlers';
|
|
|
32
25
|
import { useNavModeExit } from './use-nav-mode-exit';
|
|
33
26
|
import { useBlockRefProvider } from './use-block-refs';
|
|
34
27
|
import { useIntersectionObserver } from './use-intersection-observer';
|
|
35
|
-
import { store as blockEditorStore } from '../../../store';
|
|
36
|
-
import { unlock } from '../../../lock-unlock';
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* If the block count exceeds the threshold, we disable the reordering animation
|
|
40
|
-
* to avoid laginess.
|
|
41
|
-
*/
|
|
42
|
-
const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
43
28
|
|
|
44
29
|
/**
|
|
45
30
|
* This hook is used to lightly mark an element as a block element. The element
|
|
@@ -89,119 +74,30 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
89
74
|
className,
|
|
90
75
|
wrapperProps = {},
|
|
91
76
|
isAligned,
|
|
92
|
-
} = useContext( BlockListBlockContext );
|
|
93
|
-
const {
|
|
94
77
|
index,
|
|
95
78
|
mode,
|
|
96
79
|
name,
|
|
97
80
|
blockApiVersion,
|
|
98
81
|
blockTitle,
|
|
99
82
|
isSelected,
|
|
100
|
-
isPartOfSelection,
|
|
101
|
-
adjustScrolling,
|
|
102
|
-
enableAnimation,
|
|
103
83
|
isSubtreeDisabled,
|
|
104
84
|
isOutlineEnabled,
|
|
105
85
|
hasOverlay,
|
|
106
86
|
initialPosition,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
isBlockSubtreeDisabled,
|
|
122
|
-
getSettings,
|
|
123
|
-
isBlockHighlighted,
|
|
124
|
-
__unstableIsFullySelected,
|
|
125
|
-
__unstableSelectionHasUnmergeableBlock,
|
|
126
|
-
isBlockBeingDragged,
|
|
127
|
-
hasSelectedInnerBlock,
|
|
128
|
-
hasBlockMovingClientId,
|
|
129
|
-
canInsertBlockType,
|
|
130
|
-
getBlockRootClientId,
|
|
131
|
-
__unstableHasActiveBlockOverlayActive,
|
|
132
|
-
__unstableGetEditorMode,
|
|
133
|
-
getSelectedBlocksInitialCaretPosition,
|
|
134
|
-
} = unlock( select( blockEditorStore ) );
|
|
135
|
-
const { getActiveBlockVariation } = select( blocksStore );
|
|
136
|
-
const _isSelected = isBlockSelected( clientId );
|
|
137
|
-
const isPartOfMultiSelection =
|
|
138
|
-
isBlockMultiSelected( clientId ) ||
|
|
139
|
-
isAncestorMultiSelected( clientId );
|
|
140
|
-
const blockName = getBlockName( clientId );
|
|
141
|
-
const blockType = getBlockType( blockName );
|
|
142
|
-
const attributes = getBlockAttributes( clientId );
|
|
143
|
-
const match = getActiveBlockVariation( blockName, attributes );
|
|
144
|
-
const { outlineMode } = getSettings();
|
|
145
|
-
const isMultiSelected = isBlockMultiSelected( clientId );
|
|
146
|
-
const checkDeep = true;
|
|
147
|
-
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
|
|
148
|
-
clientId,
|
|
149
|
-
checkDeep
|
|
150
|
-
);
|
|
151
|
-
const typing = isTyping();
|
|
152
|
-
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
153
|
-
const movingClientId = hasBlockMovingClientId();
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
index: getBlockIndex( clientId ),
|
|
157
|
-
mode: getBlockMode( clientId ),
|
|
158
|
-
name: blockName,
|
|
159
|
-
blockApiVersion: blockType?.apiVersion || 1,
|
|
160
|
-
blockTitle: match?.title || blockType?.title,
|
|
161
|
-
isSelected: _isSelected,
|
|
162
|
-
isPartOfSelection: _isSelected || isPartOfMultiSelection,
|
|
163
|
-
adjustScrolling:
|
|
164
|
-
_isSelected || isFirstMultiSelectedBlock( clientId ),
|
|
165
|
-
enableAnimation:
|
|
166
|
-
! typing &&
|
|
167
|
-
getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
|
|
168
|
-
isSubtreeDisabled: isBlockSubtreeDisabled( clientId ),
|
|
169
|
-
isOutlineEnabled: outlineMode,
|
|
170
|
-
hasOverlay: __unstableHasActiveBlockOverlayActive( clientId ),
|
|
171
|
-
initialPosition:
|
|
172
|
-
_isSelected && __unstableGetEditorMode() === 'edit'
|
|
173
|
-
? getSelectedBlocksInitialCaretPosition()
|
|
174
|
-
: undefined,
|
|
175
|
-
classNames: classnames(
|
|
176
|
-
{
|
|
177
|
-
'is-selected': _isSelected,
|
|
178
|
-
'is-highlighted': isBlockHighlighted( clientId ),
|
|
179
|
-
'is-multi-selected': isMultiSelected,
|
|
180
|
-
'is-partially-selected':
|
|
181
|
-
isMultiSelected &&
|
|
182
|
-
! __unstableIsFullySelected() &&
|
|
183
|
-
! __unstableSelectionHasUnmergeableBlock(),
|
|
184
|
-
'is-reusable': isReusableBlock( blockType ),
|
|
185
|
-
'is-dragging': isBlockBeingDragged( clientId ),
|
|
186
|
-
'has-child-selected': isAncestorOfSelectedBlock,
|
|
187
|
-
'remove-outline': _isSelected && outlineMode && typing,
|
|
188
|
-
'is-block-moving-mode': !! movingClientId,
|
|
189
|
-
'can-insert-moving-block':
|
|
190
|
-
movingClientId &&
|
|
191
|
-
canInsertBlockType(
|
|
192
|
-
getBlockName( movingClientId ),
|
|
193
|
-
getBlockRootClientId( clientId )
|
|
194
|
-
),
|
|
195
|
-
},
|
|
196
|
-
hasLightBlockWrapper ? attributes.className : undefined,
|
|
197
|
-
hasLightBlockWrapper
|
|
198
|
-
? getBlockDefaultClassName( blockName )
|
|
199
|
-
: undefined
|
|
200
|
-
),
|
|
201
|
-
};
|
|
202
|
-
},
|
|
203
|
-
[ clientId ]
|
|
204
|
-
);
|
|
87
|
+
blockEditingMode,
|
|
88
|
+
isHighlighted,
|
|
89
|
+
isMultiSelected,
|
|
90
|
+
isPartiallySelected,
|
|
91
|
+
isReusable,
|
|
92
|
+
isDragging,
|
|
93
|
+
hasChildSelected,
|
|
94
|
+
removeOutline,
|
|
95
|
+
isBlockMovingMode,
|
|
96
|
+
canInsertMovingBlock,
|
|
97
|
+
isEditingDisabled,
|
|
98
|
+
isTemporarilyEditingAsBlocks,
|
|
99
|
+
defaultClassName,
|
|
100
|
+
} = useContext( PrivateBlockContext );
|
|
205
101
|
|
|
206
102
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
207
103
|
const blockLabel = sprintf( __( 'Block: %s' ), blockTitle );
|
|
@@ -215,12 +111,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
215
111
|
useNavModeExit( clientId ),
|
|
216
112
|
useIsHovered( { isEnabled: isOutlineEnabled } ),
|
|
217
113
|
useIntersectionObserver(),
|
|
218
|
-
useMovingAnimation( {
|
|
219
|
-
isSelected: isPartOfSelection,
|
|
220
|
-
adjustScrolling,
|
|
221
|
-
enableAnimation,
|
|
222
|
-
triggerAnimationOnChange: index,
|
|
223
|
-
} ),
|
|
114
|
+
useMovingAnimation( { triggerAnimationOnChange: index, clientId } ),
|
|
224
115
|
useDisabled( { isDisabled: ! hasOverlay } ),
|
|
225
116
|
] );
|
|
226
117
|
|
|
@@ -233,7 +124,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
233
124
|
}
|
|
234
125
|
|
|
235
126
|
return {
|
|
236
|
-
tabIndex: 0,
|
|
127
|
+
tabIndex: blockEditingMode === 'disabled' ? -1 : 0,
|
|
237
128
|
...wrapperProps,
|
|
238
129
|
...props,
|
|
239
130
|
ref: mergedRefs,
|
|
@@ -250,11 +141,24 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
250
141
|
// The wp-block className is important for editor styles.
|
|
251
142
|
'wp-block': ! isAligned,
|
|
252
143
|
'has-block-overlay': hasOverlay,
|
|
144
|
+
'is-selected': isSelected,
|
|
145
|
+
'is-highlighted': isHighlighted,
|
|
146
|
+
'is-multi-selected': isMultiSelected,
|
|
147
|
+
'is-partially-selected': isPartiallySelected,
|
|
148
|
+
'is-reusable': isReusable,
|
|
149
|
+
'is-dragging': isDragging,
|
|
150
|
+
'has-child-selected': hasChildSelected,
|
|
151
|
+
'remove-outline': removeOutline,
|
|
152
|
+
'is-block-moving-mode': isBlockMovingMode,
|
|
153
|
+
'can-insert-moving-block': canInsertMovingBlock,
|
|
154
|
+
'is-editing-disabled': isEditingDisabled,
|
|
155
|
+
'is-content-locked-temporarily-editing-as-blocks':
|
|
156
|
+
isTemporarilyEditingAsBlocks,
|
|
253
157
|
},
|
|
254
158
|
className,
|
|
255
159
|
props.className,
|
|
256
160
|
wrapperProps.className,
|
|
257
|
-
|
|
161
|
+
defaultClassName
|
|
258
162
|
),
|
|
259
163
|
style: { ...wrapperProps.style, ...props.style },
|
|
260
164
|
};
|
|
@@ -28,6 +28,7 @@ export function useInBetweenInserter() {
|
|
|
28
28
|
getTemplateLock,
|
|
29
29
|
__unstableIsWithinBlockOverlay,
|
|
30
30
|
getBlockEditingMode,
|
|
31
|
+
getBlockName,
|
|
31
32
|
} = useSelect( blockEditorStore );
|
|
32
33
|
const { showInsertionPoint, hideInsertionPoint } =
|
|
33
34
|
useDispatch( blockEditorStore );
|
|
@@ -75,7 +76,9 @@ export function useInBetweenInserter() {
|
|
|
75
76
|
|
|
76
77
|
if (
|
|
77
78
|
getTemplateLock( rootClientId ) ||
|
|
78
|
-
getBlockEditingMode( rootClientId ) === 'disabled'
|
|
79
|
+
getBlockEditingMode( rootClientId ) === 'disabled' ||
|
|
80
|
+
( getBlockName( rootClientId ) === 'core/block' &&
|
|
81
|
+
window.__experimentalPatternPartialSyncing )
|
|
79
82
|
) {
|
|
80
83
|
return;
|
|
81
84
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEffect } from '@wordpress/element';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useBlockListContext } from './block-list-context';
|
|
11
|
+
import { store as blockEditorStore } from '../../store';
|
|
12
|
+
|
|
13
|
+
const useScrollUponInsertion = ( {
|
|
14
|
+
clientId,
|
|
15
|
+
isSelected,
|
|
16
|
+
isLayoutCalculated,
|
|
17
|
+
elementRef,
|
|
18
|
+
} ) => {
|
|
19
|
+
const { scrollRef } = useBlockListContext();
|
|
20
|
+
const wasBlockJustInserted = useSelect(
|
|
21
|
+
( select ) =>
|
|
22
|
+
!! select( blockEditorStore ).wasBlockJustInserted(
|
|
23
|
+
clientId,
|
|
24
|
+
'inserter_menu'
|
|
25
|
+
),
|
|
26
|
+
[ clientId ]
|
|
27
|
+
);
|
|
28
|
+
useEffect( () => {
|
|
29
|
+
const lastScrollTo = scrollRef?.lastScrollTo.current;
|
|
30
|
+
const alreadyScrolledTo = lastScrollTo?.clientId === clientId;
|
|
31
|
+
if (
|
|
32
|
+
alreadyScrolledTo ||
|
|
33
|
+
! isSelected ||
|
|
34
|
+
! scrollRef ||
|
|
35
|
+
! wasBlockJustInserted ||
|
|
36
|
+
! isLayoutCalculated
|
|
37
|
+
) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
scrollRef.scrollToElement( elementRef );
|
|
41
|
+
lastScrollTo.clientId = clientId;
|
|
42
|
+
}, [
|
|
43
|
+
isSelected,
|
|
44
|
+
scrollRef,
|
|
45
|
+
wasBlockJustInserted,
|
|
46
|
+
elementRef,
|
|
47
|
+
isLayoutCalculated,
|
|
48
|
+
clientId,
|
|
49
|
+
] );
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default useScrollUponInsertion;
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
6
|
-
import { focus } from '@wordpress/dom';
|
|
7
6
|
import { useReducer, useRef, useEffect } from '@wordpress/element';
|
|
8
|
-
import { lock } from '@wordpress/icons';
|
|
7
|
+
import { lock, unlock } from '@wordpress/icons';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
@@ -13,55 +12,45 @@ import { lock } from '@wordpress/icons';
|
|
|
13
12
|
import BlockLockModal from './modal';
|
|
14
13
|
import useBlockLock from './use-block-lock';
|
|
15
14
|
|
|
16
|
-
export default function BlockLockToolbar( { clientId
|
|
17
|
-
const {
|
|
15
|
+
export default function BlockLockToolbar( { clientId } ) {
|
|
16
|
+
const { canLock, isLocked } = useBlockLock( clientId );
|
|
18
17
|
|
|
19
18
|
const [ isModalOpen, toggleModal ] = useReducer(
|
|
20
19
|
( isActive ) => ! isActive,
|
|
21
20
|
false
|
|
22
21
|
);
|
|
23
22
|
|
|
24
|
-
const
|
|
25
|
-
const isFirstRender = useRef( true );
|
|
23
|
+
const hasLockButtonShown = useRef( false );
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// See https://github.com/WordPress/gutenberg/issues/51447
|
|
25
|
+
// If the block lock button has been shown, we don't want to remove it
|
|
26
|
+
// from the toolbar until the toolbar is rendered again without it.
|
|
27
|
+
// Removing it beforehand can cause focus loss issues, such as when
|
|
28
|
+
// unlocking the block from the modal. It needs to return focus from
|
|
29
|
+
// whence it came, and to do that, we need to leave the button in the toolbar.
|
|
33
30
|
useEffect( () => {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if ( ! isModalOpen && shouldHideBlockLockUI ) {
|
|
40
|
-
focus.focusable
|
|
41
|
-
.find( wrapperRef.current, {
|
|
42
|
-
sequential: false,
|
|
43
|
-
} )
|
|
44
|
-
.find(
|
|
45
|
-
( element ) =>
|
|
46
|
-
element.tagName === 'BUTTON' &&
|
|
47
|
-
element !== lockButtonRef.current
|
|
48
|
-
)
|
|
49
|
-
?.focus();
|
|
31
|
+
if ( isLocked ) {
|
|
32
|
+
hasLockButtonShown.current = true;
|
|
50
33
|
}
|
|
51
|
-
|
|
52
|
-
}, [ isModalOpen, shouldHideBlockLockUI, wrapperRef ] );
|
|
34
|
+
}, [ isLocked ] );
|
|
53
35
|
|
|
54
|
-
if (
|
|
36
|
+
if ( ! isLocked && ! hasLockButtonShown.current ) {
|
|
55
37
|
return null;
|
|
56
38
|
}
|
|
57
39
|
|
|
40
|
+
let label = isLocked ? __( 'Unlock' ) : __( 'Lock' );
|
|
41
|
+
|
|
42
|
+
if ( ! canLock && isLocked ) {
|
|
43
|
+
label = __( 'Locked' );
|
|
44
|
+
}
|
|
45
|
+
|
|
58
46
|
return (
|
|
59
47
|
<>
|
|
60
48
|
<ToolbarGroup className="block-editor-block-lock-toolbar">
|
|
61
49
|
<ToolbarButton
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
accessibleWhenDisabled
|
|
51
|
+
disabled={ ! canLock }
|
|
52
|
+
icon={ isLocked ? lock : unlock }
|
|
53
|
+
label={ label }
|
|
65
54
|
onClick={ toggleModal }
|
|
66
55
|
aria-expanded={ isModalOpen }
|
|
67
56
|
aria-haspopup="dialog"
|
|
@@ -4,11 +4,6 @@ Block movers allow moving blocks inside the editor using up and down buttons.
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Development guidelines](#development-guidelines)
|
|
10
|
-
2. [Related components](#related-components)
|
|
11
|
-
|
|
12
7
|
## Development guidelines
|
|
13
8
|
|
|
14
9
|
### Usage
|
|
@@ -64,7 +64,7 @@ function BlockMover( { clientIds, hideDragHandle } ) {
|
|
|
64
64
|
} ) }
|
|
65
65
|
>
|
|
66
66
|
{ ! hideDragHandle && (
|
|
67
|
-
<BlockDraggable clientIds={ clientIds }>
|
|
67
|
+
<BlockDraggable clientIds={ clientIds } fadeWhenDisabled>
|
|
68
68
|
{ ( draggableProps ) => (
|
|
69
69
|
<Button
|
|
70
70
|
icon={ dragHandle }
|
|
@@ -8,11 +8,6 @@ In practice the BlockParentSelector component renders a <ToolbarButton /> compon
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
## Table of contents
|
|
12
|
-
|
|
13
|
-
1. [Development guidelines](#development-guidelines)
|
|
14
|
-
2. [Related components](#related-components)
|
|
15
|
-
|
|
16
11
|
## Development guidelines
|
|
17
12
|
|
|
18
13
|
### Usage
|
|
@@ -6,11 +6,6 @@ For more infos about blocks patterns, read [this](https://make.wordpress.org/cor
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
2. [Related components](#related-components)
|
|
13
|
-
|
|
14
9
|
## Development guidelines
|
|
15
10
|
|
|
16
11
|
### Usage
|
|
@@ -24,7 +24,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
24
24
|
import BlockPreview from '../block-preview';
|
|
25
25
|
import InserterDraggableBlocks from '../inserter-draggable-blocks';
|
|
26
26
|
import BlockPatternsPaging from '../block-patterns-paging';
|
|
27
|
-
import {
|
|
27
|
+
import { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
CompositeV2: Composite,
|
|
@@ -78,7 +78,8 @@ function BlockPattern( {
|
|
|
78
78
|
>
|
|
79
79
|
<WithToolTip
|
|
80
80
|
showTooltip={
|
|
81
|
-
showTooltip &&
|
|
81
|
+
showTooltip &&
|
|
82
|
+
! pattern.type !== INSERTER_PATTERN_TYPES.user
|
|
82
83
|
}
|
|
83
84
|
title={ pattern.title }
|
|
84
85
|
>
|
|
@@ -97,7 +98,7 @@ function BlockPattern( {
|
|
|
97
98
|
{
|
|
98
99
|
'block-editor-block-patterns-list__list-item-synced':
|
|
99
100
|
pattern.type ===
|
|
100
|
-
|
|
101
|
+
INSERTER_PATTERN_TYPES.user &&
|
|
101
102
|
! pattern.syncStatus,
|
|
102
103
|
}
|
|
103
104
|
) }
|
|
@@ -122,7 +123,8 @@ function BlockPattern( {
|
|
|
122
123
|
/>
|
|
123
124
|
|
|
124
125
|
<HStack className="block-editor-patterns__pattern-details">
|
|
125
|
-
{ pattern.type ===
|
|
126
|
+
{ pattern.type ===
|
|
127
|
+
INSERTER_PATTERN_TYPES.user &&
|
|
126
128
|
! pattern.syncStatus && (
|
|
127
129
|
<div className="block-editor-patterns__pattern-icon-wrapper">
|
|
128
130
|
<Icon
|
|
@@ -132,7 +134,8 @@ function BlockPattern( {
|
|
|
132
134
|
</div>
|
|
133
135
|
) }
|
|
134
136
|
{ ( ! showTooltip ||
|
|
135
|
-
pattern.type ===
|
|
137
|
+
pattern.type ===
|
|
138
|
+
INSERTER_PATTERN_TYPES.user ) && (
|
|
136
139
|
<div className="block-editor-block-patterns-list__item-title">
|
|
137
140
|
{ pattern.title }
|
|
138
141
|
</div>
|
|
@@ -138,11 +138,14 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
138
138
|
const hasPossibleBlockVariationTransformations =
|
|
139
139
|
!! blockVariationTransformations?.length;
|
|
140
140
|
const hasPatternTransformation = !! patterns?.length && canRemove;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
const hasBlockOrBlockVariationTransforms =
|
|
142
|
+
hasPossibleBlockTransformations ||
|
|
143
|
+
hasPossibleBlockVariationTransformations;
|
|
144
|
+
const showDropdown =
|
|
145
|
+
hasBlockStyles ||
|
|
146
|
+
hasBlockOrBlockVariationTransforms ||
|
|
147
|
+
hasPatternTransformation;
|
|
148
|
+
if ( ! showDropdown ) {
|
|
146
149
|
return (
|
|
147
150
|
<ToolbarGroup>
|
|
148
151
|
<ToolbarButton
|
|
@@ -180,13 +183,6 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
180
183
|
blocks.length
|
|
181
184
|
);
|
|
182
185
|
|
|
183
|
-
const hasBlockOrBlockVariationTransforms =
|
|
184
|
-
hasPossibleBlockTransformations ||
|
|
185
|
-
hasPossibleBlockVariationTransformations;
|
|
186
|
-
const showDropDown =
|
|
187
|
-
hasBlockStyles ||
|
|
188
|
-
hasBlockOrBlockVariationTransforms ||
|
|
189
|
-
hasPatternTransformation;
|
|
190
186
|
return (
|
|
191
187
|
<ToolbarGroup>
|
|
192
188
|
<ToolbarItem>
|
|
@@ -218,54 +214,48 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
218
214
|
} }
|
|
219
215
|
menuProps={ { orientation: 'both' } }
|
|
220
216
|
>
|
|
221
|
-
{ ( { onClose } ) =>
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
217
|
+
{ ( { onClose } ) => (
|
|
218
|
+
<div className="block-editor-block-switcher__container">
|
|
219
|
+
{ hasPatternTransformation && (
|
|
220
|
+
<PatternTransformationsMenu
|
|
221
|
+
blocks={ blocks }
|
|
222
|
+
patterns={ patterns }
|
|
223
|
+
onSelect={ ( transformedBlocks ) => {
|
|
224
|
+
onPatternTransform(
|
|
229
225
|
transformedBlocks
|
|
230
|
-
)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
onSwitch={ onClose }
|
|
264
|
-
/>
|
|
265
|
-
) }
|
|
266
|
-
</div>
|
|
267
|
-
)
|
|
268
|
-
}
|
|
226
|
+
);
|
|
227
|
+
onClose();
|
|
228
|
+
} }
|
|
229
|
+
/>
|
|
230
|
+
) }
|
|
231
|
+
{ hasBlockOrBlockVariationTransforms && (
|
|
232
|
+
<BlockTransformationsMenu
|
|
233
|
+
className="block-editor-block-switcher__transforms__menugroup"
|
|
234
|
+
possibleBlockTransformations={
|
|
235
|
+
possibleBlockTransformations
|
|
236
|
+
}
|
|
237
|
+
possibleBlockVariationTransformations={
|
|
238
|
+
blockVariationTransformations
|
|
239
|
+
}
|
|
240
|
+
blocks={ blocks }
|
|
241
|
+
onSelect={ ( name ) => {
|
|
242
|
+
onBlockTransform( name );
|
|
243
|
+
onClose();
|
|
244
|
+
} }
|
|
245
|
+
onSelectVariation={ ( name ) => {
|
|
246
|
+
onBlockVariationTransform( name );
|
|
247
|
+
onClose();
|
|
248
|
+
} }
|
|
249
|
+
/>
|
|
250
|
+
) }
|
|
251
|
+
{ hasBlockStyles && (
|
|
252
|
+
<BlockStylesMenu
|
|
253
|
+
hoveredBlock={ blocks[ 0 ] }
|
|
254
|
+
onSwitch={ onClose }
|
|
255
|
+
/>
|
|
256
|
+
) }
|
|
257
|
+
</div>
|
|
258
|
+
) }
|
|
269
259
|
</DropdownMenu>
|
|
270
260
|
) }
|
|
271
261
|
</ToolbarItem>
|
|
@@ -6,11 +6,6 @@ The `BlockToolbar` component is used to render a toolbar that serves as a wrappe
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
2. [Related components](#related-components)
|
|
13
|
-
|
|
14
9
|
## Development guidelines
|
|
15
10
|
|
|
16
11
|
### Usage
|
|
@@ -175,8 +175,7 @@ export function PrivateBlockToolbar( {
|
|
|
175
175
|
<BlockSwitcher clientIds={ blockClientIds } />
|
|
176
176
|
{ ! isMultiToolbar && (
|
|
177
177
|
<BlockLockToolbar
|
|
178
|
-
clientId={
|
|
179
|
-
wrapperRef={ toolbarWrapperRef }
|
|
178
|
+
clientId={ blockClientId }
|
|
180
179
|
/>
|
|
181
180
|
) }
|
|
182
181
|
<BlockMover
|
|
@@ -38,16 +38,10 @@ export default function BlockToolbarPopover( {
|
|
|
38
38
|
const { stopTyping } = useDispatch( blockEditorStore );
|
|
39
39
|
const isToolbarForced = useRef( false );
|
|
40
40
|
|
|
41
|
-
useShortcut(
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
stopTyping( true );
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
isDisabled: false,
|
|
49
|
-
}
|
|
50
|
-
);
|
|
41
|
+
useShortcut( 'core/block-editor/focus-toolbar', () => {
|
|
42
|
+
isToolbarForced.current = true;
|
|
43
|
+
stopTyping( true );
|
|
44
|
+
} );
|
|
51
45
|
|
|
52
46
|
useEffect( () => {
|
|
53
47
|
isToolbarForced.current = false;
|
|
@@ -10,11 +10,6 @@ This component is present in the block insertion tab, the reusable blocks tab an
|
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
13
|
-
## Table of contents
|
|
14
|
-
|
|
15
|
-
1. [Development guidelines](#development-guidelines)
|
|
16
|
-
2. [Related components](#related-components)
|
|
17
|
-
|
|
18
13
|
## Development guidelines
|
|
19
14
|
|
|
20
15
|
### Usage
|