@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
package/src/hooks/utils.js
CHANGED
|
@@ -174,6 +174,8 @@ export function useStyleOverride( { id, css, assets, __unstableType } = {} ) {
|
|
|
174
174
|
*/
|
|
175
175
|
export function useBlockSettings( name, parentLayout ) {
|
|
176
176
|
const [
|
|
177
|
+
backgroundImage,
|
|
178
|
+
backgroundSize,
|
|
177
179
|
fontFamilies,
|
|
178
180
|
fontSizes,
|
|
179
181
|
customFontSize,
|
|
@@ -217,6 +219,8 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
217
219
|
isHeadingEnabled,
|
|
218
220
|
isButtonEnabled,
|
|
219
221
|
] = useSettings(
|
|
222
|
+
'background.backgroundImage',
|
|
223
|
+
'background.backgroundSize',
|
|
220
224
|
'typography.fontFamilies',
|
|
221
225
|
'typography.fontSizes',
|
|
222
226
|
'typography.customFontSize',
|
|
@@ -263,6 +267,10 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
263
267
|
|
|
264
268
|
const rawSettings = useMemo( () => {
|
|
265
269
|
return {
|
|
270
|
+
background: {
|
|
271
|
+
backgroundImage,
|
|
272
|
+
backgroundSize,
|
|
273
|
+
},
|
|
266
274
|
color: {
|
|
267
275
|
palette: {
|
|
268
276
|
custom: customColors,
|
|
@@ -330,6 +338,8 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
330
338
|
parentLayout,
|
|
331
339
|
};
|
|
332
340
|
}, [
|
|
341
|
+
backgroundImage,
|
|
342
|
+
backgroundSize,
|
|
333
343
|
fontFamilies,
|
|
334
344
|
fontSizes,
|
|
335
345
|
customFontSize,
|
|
@@ -418,12 +428,14 @@ export function createBlockEditFilter( features ) {
|
|
|
418
428
|
neededProps[ key ] = props.attributes[ key ];
|
|
419
429
|
}
|
|
420
430
|
}
|
|
431
|
+
|
|
421
432
|
return (
|
|
422
433
|
<Edit
|
|
423
434
|
// We can use the index because the array length
|
|
424
435
|
// is fixed per page load right now.
|
|
425
436
|
key={ i }
|
|
426
437
|
name={ props.name }
|
|
438
|
+
isSelected={ props.isSelected }
|
|
427
439
|
clientId={ props.clientId }
|
|
428
440
|
setAttributes={ props.setAttributes }
|
|
429
441
|
__unstableParentLayout={
|
|
@@ -488,10 +500,10 @@ export function createBlockListBlockFilter( features ) {
|
|
|
488
500
|
}
|
|
489
501
|
|
|
490
502
|
if (
|
|
491
|
-
! hasSupport( props.name ) ||
|
|
492
503
|
// Skip rendering if none of the needed attributes are
|
|
493
504
|
// set.
|
|
494
|
-
! Object.keys( neededProps ).length
|
|
505
|
+
! Object.keys( neededProps ).length ||
|
|
506
|
+
! hasSupport( props.name )
|
|
495
507
|
) {
|
|
496
508
|
return null;
|
|
497
509
|
}
|
|
@@ -543,3 +555,49 @@ export function createBlockListBlockFilter( features ) {
|
|
|
543
555
|
withBlockListBlockHooks
|
|
544
556
|
);
|
|
545
557
|
}
|
|
558
|
+
|
|
559
|
+
export function createBlockSaveFilter( features ) {
|
|
560
|
+
function extraPropsFromHooks( props, name, attributes ) {
|
|
561
|
+
return features.reduce( ( accu, feature ) => {
|
|
562
|
+
const { hasSupport, attributeKeys = [], addSaveProps } = feature;
|
|
563
|
+
|
|
564
|
+
const neededAttributes = {};
|
|
565
|
+
for ( const key of attributeKeys ) {
|
|
566
|
+
if ( attributes[ key ] ) {
|
|
567
|
+
neededAttributes[ key ] = attributes[ key ];
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if (
|
|
572
|
+
// Skip rendering if none of the needed attributes are
|
|
573
|
+
// set.
|
|
574
|
+
! Object.keys( neededAttributes ).length ||
|
|
575
|
+
! hasSupport( name )
|
|
576
|
+
) {
|
|
577
|
+
return accu;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return addSaveProps( accu, name, neededAttributes );
|
|
581
|
+
}, props );
|
|
582
|
+
}
|
|
583
|
+
addFilter(
|
|
584
|
+
'blocks.getSaveContent.extraProps',
|
|
585
|
+
'core/editor/hooks',
|
|
586
|
+
extraPropsFromHooks,
|
|
587
|
+
0
|
|
588
|
+
);
|
|
589
|
+
addFilter(
|
|
590
|
+
'blocks.getSaveContent.extraProps',
|
|
591
|
+
'core/editor/hooks',
|
|
592
|
+
( props ) => {
|
|
593
|
+
// Previously we had a filter deleting the className if it was an empty
|
|
594
|
+
// string. That filter is no longer running, so now we need to delete it
|
|
595
|
+
// here.
|
|
596
|
+
if ( props.hasOwnProperty( 'className' ) && ! props.className ) {
|
|
597
|
+
delete props.className;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return props;
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
package/src/private-apis.js
CHANGED
|
@@ -5,12 +5,11 @@ import * as globalStyles from './components/global-styles';
|
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
7
|
import { getRichTextValues } from './components/rich-text/get-rich-text-values';
|
|
8
|
-
import { kebabCase } from './utils/object';
|
|
9
8
|
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
10
9
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
11
10
|
import { PrivateListView } from './components/list-view';
|
|
12
11
|
import BlockInfo from './components/block-info-slot-fill';
|
|
13
|
-
import {
|
|
12
|
+
import { useCanBlockToolbarBeFocused } from './utils/use-can-block-toolbar-be-focused';
|
|
14
13
|
import { cleanEmptyObject, useStyleOverride } from './hooks/utils';
|
|
15
14
|
import BlockQuickNavigation from './components/block-quick-navigation';
|
|
16
15
|
import { LayoutStyle } from './components/block-list/layout';
|
|
@@ -36,12 +35,11 @@ lock( privateApis, {
|
|
|
36
35
|
ExperimentalBlockEditorProvider,
|
|
37
36
|
getDuotoneFilter,
|
|
38
37
|
getRichTextValues,
|
|
39
|
-
kebabCase,
|
|
40
38
|
PrivateInserter,
|
|
41
39
|
PrivateListView,
|
|
42
40
|
ResizableBoxPopover,
|
|
43
41
|
BlockInfo,
|
|
44
|
-
|
|
42
|
+
useCanBlockToolbarBeFocused,
|
|
45
43
|
cleanEmptyObject,
|
|
46
44
|
useStyleOverride,
|
|
47
45
|
BlockQuickNavigation,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as globalStyles from './components/global-styles';
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
-
import { kebabCase } from './utils/object';
|
|
7
6
|
import { lock } from './lock-unlock';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -12,6 +11,5 @@ import { lock } from './lock-unlock';
|
|
|
12
11
|
export const privateApis = {};
|
|
13
12
|
lock( privateApis, {
|
|
14
13
|
...globalStyles,
|
|
15
|
-
kebabCase,
|
|
16
14
|
ExperimentalBlockEditorProvider,
|
|
17
15
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -1919,18 +1919,3 @@ export function unsetBlockEditingMode( clientId = '' ) {
|
|
|
1919
1919
|
clientId,
|
|
1920
1920
|
};
|
|
1921
1921
|
}
|
|
1922
|
-
|
|
1923
|
-
/**
|
|
1924
|
-
* Action that sets the element that had focus when focus leaves the editor canvas.
|
|
1925
|
-
*
|
|
1926
|
-
* @param {Object} lastFocus The last focused element.
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
1929
|
-
* @return {Object} Action object.
|
|
1930
|
-
*/
|
|
1931
|
-
export function setLastFocus( lastFocus = null ) {
|
|
1932
|
-
return {
|
|
1933
|
-
type: 'LAST_FOCUS',
|
|
1934
|
-
lastFocus,
|
|
1935
|
-
};
|
|
1936
|
-
}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Platform } from '@wordpress/element';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { undoIgnoreBlocks } from './undo-ignore';
|
|
10
|
+
|
|
6
11
|
const castArray = ( maybeArray ) =>
|
|
7
12
|
Array.isArray( maybeArray ) ? maybeArray : [ maybeArray ];
|
|
8
13
|
|
|
@@ -291,10 +296,45 @@ export function deleteStyleOverride( id ) {
|
|
|
291
296
|
};
|
|
292
297
|
}
|
|
293
298
|
|
|
294
|
-
|
|
299
|
+
/**
|
|
300
|
+
* A higher-order action that mark every change inside a callback as "non-persistent"
|
|
301
|
+
* and ignore pushing to the undo history stack. It's primarily used for synchronized
|
|
302
|
+
* derived updates from the block editor without affecting the undo history.
|
|
303
|
+
*
|
|
304
|
+
* @param {() => void} callback The synchronous callback to derive updates.
|
|
305
|
+
*/
|
|
306
|
+
export function syncDerivedUpdates( callback ) {
|
|
307
|
+
return ( { dispatch, select, registry } ) => {
|
|
308
|
+
registry.batch( () => {
|
|
309
|
+
// Mark every change in the `callback` as non-persistent.
|
|
310
|
+
dispatch( {
|
|
311
|
+
type: 'SET_EXPLICIT_PERSISTENT',
|
|
312
|
+
isPersistentChange: false,
|
|
313
|
+
} );
|
|
314
|
+
callback();
|
|
315
|
+
dispatch( {
|
|
316
|
+
type: 'SET_EXPLICIT_PERSISTENT',
|
|
317
|
+
isPersistentChange: undefined,
|
|
318
|
+
} );
|
|
319
|
+
|
|
320
|
+
// Ignore pushing undo stack for the updated blocks.
|
|
321
|
+
const updatedBlocks = select.getBlocks();
|
|
322
|
+
undoIgnoreBlocks.add( updatedBlocks );
|
|
323
|
+
} );
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Action that sets the element that had focus when focus leaves the editor canvas.
|
|
329
|
+
*
|
|
330
|
+
* @param {Object} lastFocus The last focused element.
|
|
331
|
+
*
|
|
332
|
+
*
|
|
333
|
+
* @return {Object} Action object.
|
|
334
|
+
*/
|
|
335
|
+
export function setLastFocus( lastFocus = null ) {
|
|
295
336
|
return {
|
|
296
|
-
type: '
|
|
297
|
-
|
|
298
|
-
attributes,
|
|
337
|
+
type: 'LAST_FOCUS',
|
|
338
|
+
lastFocus,
|
|
299
339
|
};
|
|
300
340
|
}
|
|
@@ -281,3 +281,14 @@ export const hasAllowedPatterns = createSelector(
|
|
|
281
281
|
),
|
|
282
282
|
]
|
|
283
283
|
);
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Returns the element of the last element that had focus when focus left the editor canvas.
|
|
287
|
+
*
|
|
288
|
+
* @param {Object} state Block editor state.
|
|
289
|
+
*
|
|
290
|
+
* @return {Object} Element.
|
|
291
|
+
*/
|
|
292
|
+
export function getLastFocus( state ) {
|
|
293
|
+
return state.lastFocus;
|
|
294
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -453,14 +453,25 @@ const withBlockTree =
|
|
|
453
453
|
function withPersistentBlockChange( reducer ) {
|
|
454
454
|
let lastAction;
|
|
455
455
|
let markNextChangeAsNotPersistent = false;
|
|
456
|
+
let explicitPersistent;
|
|
456
457
|
|
|
457
458
|
return ( state, action ) => {
|
|
458
459
|
let nextState = reducer( state, action );
|
|
459
460
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
let nextIsPersistentChange;
|
|
462
|
+
if ( action.type === 'SET_EXPLICIT_PERSISTENT' ) {
|
|
463
|
+
explicitPersistent = action.isPersistentChange;
|
|
464
|
+
nextIsPersistentChange = state.isPersistentChange ?? true;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
if ( explicitPersistent !== undefined ) {
|
|
468
|
+
nextIsPersistentChange = explicitPersistent;
|
|
469
|
+
return nextIsPersistentChange === nextState.isPersistentChange
|
|
470
|
+
? nextState
|
|
471
|
+
: {
|
|
472
|
+
...nextState,
|
|
473
|
+
isPersistentChange: nextIsPersistentChange,
|
|
474
|
+
};
|
|
464
475
|
}
|
|
465
476
|
|
|
466
477
|
const isExplicitPersistentChange =
|
|
@@ -473,7 +484,7 @@ function withPersistentBlockChange( reducer ) {
|
|
|
473
484
|
markNextChangeAsNotPersistent =
|
|
474
485
|
action.type === 'MARK_NEXT_CHANGE_AS_NOT_PERSISTENT';
|
|
475
486
|
|
|
476
|
-
|
|
487
|
+
nextIsPersistentChange = state?.isPersistentChange ?? true;
|
|
477
488
|
if ( state.isPersistentChange === nextIsPersistentChange ) {
|
|
478
489
|
return state;
|
|
479
490
|
}
|
package/src/store/selectors.js
CHANGED
|
@@ -2742,8 +2742,11 @@ export const __unstableGetContentLockingParent = createSelector(
|
|
|
2742
2742
|
while ( state.blocks.parents.has( current ) ) {
|
|
2743
2743
|
current = state.blocks.parents.get( current );
|
|
2744
2744
|
if (
|
|
2745
|
-
current &&
|
|
2746
|
-
|
|
2745
|
+
( current &&
|
|
2746
|
+
getBlockName( state, current ) === 'core/block' &&
|
|
2747
|
+
window.__experimentalPatternPartialSyncing ) ||
|
|
2748
|
+
( current &&
|
|
2749
|
+
getTemplateLock( state, current ) === 'contentOnly' )
|
|
2747
2750
|
) {
|
|
2748
2751
|
result = current;
|
|
2749
2752
|
}
|
|
@@ -2943,14 +2946,3 @@ export const isGroupable = createRegistrySelector(
|
|
|
2943
2946
|
);
|
|
2944
2947
|
}
|
|
2945
2948
|
);
|
|
2946
|
-
|
|
2947
|
-
/**
|
|
2948
|
-
* Returns the element of the last element that had focus when focus left the editor canvas.
|
|
2949
|
-
*
|
|
2950
|
-
* @param {Object} state Block editor state.
|
|
2951
|
-
*
|
|
2952
|
-
* @return {Object} Element.
|
|
2953
|
-
*/
|
|
2954
|
-
export function getLastFocus( state ) {
|
|
2955
|
-
return state.lastFocus;
|
|
2956
|
-
}
|
package/src/store/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
|
|
5
5
|
|
|
6
6
|
const EMPTY_ARRAY = [];
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ export function getUserPatterns( state ) {
|
|
|
18
18
|
return {
|
|
19
19
|
name: `core/block/${ userPattern.id }`,
|
|
20
20
|
id: userPattern.id,
|
|
21
|
-
type:
|
|
21
|
+
type: INSERTER_PATTERN_TYPES.user,
|
|
22
22
|
title: userPattern.title.raw,
|
|
23
23
|
categories: userPattern.wp_pattern_category.map( ( catId ) =>
|
|
24
24
|
categories && categories.get( catId )
|
package/src/style.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import "./autocompleters/style.scss";
|
|
2
2
|
@import "./components/block-alignment-control/style.scss";
|
|
3
|
+
@import "./components/block-canvas/style.scss";
|
|
3
4
|
@import "./components/block-icon/style.scss";
|
|
4
5
|
@import "./components/block-inspector/style.scss";
|
|
5
6
|
@import "./components/block-tools/style.scss";
|
package/src/utils/index.js
CHANGED
package/src/utils/object.js
CHANGED
|
@@ -1,38 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { paramCase } from 'change-case';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Converts any string to kebab case.
|
|
8
|
-
* Backwards compatible with Lodash's `_.kebabCase()`.
|
|
9
|
-
* Backwards compatible with `_wp_to_kebab_case()`.
|
|
10
|
-
*
|
|
11
|
-
* @see https://lodash.com/docs/4.17.15#kebabCase
|
|
12
|
-
* @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/
|
|
13
|
-
*
|
|
14
|
-
* @param {string} str String to convert.
|
|
15
|
-
* @return {string} Kebab-cased string
|
|
16
|
-
*/
|
|
17
|
-
export function kebabCase( str ) {
|
|
18
|
-
let input = str;
|
|
19
|
-
if ( typeof str !== 'string' ) {
|
|
20
|
-
input = str?.toString?.() ?? '';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970
|
|
24
|
-
input = input.replace( /['\u2019]/, '' );
|
|
25
|
-
|
|
26
|
-
return paramCase( input, {
|
|
27
|
-
splitRegexp: [
|
|
28
|
-
/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar
|
|
29
|
-
/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar
|
|
30
|
-
/([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3
|
|
31
|
-
/([A-Z])([A-Z][a-z])/g, // FOOBar => foo-bar
|
|
32
|
-
],
|
|
33
|
-
} );
|
|
34
|
-
}
|
|
35
|
-
|
|
36
1
|
/**
|
|
37
2
|
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
|
|
38
3
|
* new object. Treats nullish initial values as empty objects. Clones any
|
package/src/utils/test/object.js
CHANGED
|
@@ -1,102 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
describe( 'kebabCase', () => {
|
|
7
|
-
it( 'separates lowercase letters, followed by uppercase letters', () => {
|
|
8
|
-
expect( kebabCase( 'fooBar' ) ).toEqual( 'foo-bar' );
|
|
9
|
-
} );
|
|
10
|
-
|
|
11
|
-
it( 'separates numbers, followed by uppercase letters', () => {
|
|
12
|
-
expect( kebabCase( '123FOO' ) ).toEqual( '123-foo' );
|
|
13
|
-
} );
|
|
14
|
-
|
|
15
|
-
it( 'separates numbers, followed by lowercase characters', () => {
|
|
16
|
-
expect( kebabCase( '123bar' ) ).toEqual( '123-bar' );
|
|
17
|
-
} );
|
|
18
|
-
|
|
19
|
-
it( 'separates uppercase letters, followed by numbers', () => {
|
|
20
|
-
expect( kebabCase( 'FOO123' ) ).toEqual( 'foo-123' );
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
|
-
it( 'separates lowercase letters, followed by numbers', () => {
|
|
24
|
-
expect( kebabCase( 'foo123' ) ).toEqual( 'foo-123' );
|
|
25
|
-
} );
|
|
26
|
-
|
|
27
|
-
it( 'separates uppercase groups from capitalized groups', () => {
|
|
28
|
-
expect( kebabCase( 'FOOBar' ) ).toEqual( 'foo-bar' );
|
|
29
|
-
} );
|
|
30
|
-
|
|
31
|
-
it( 'removes any non-dash special characters', () => {
|
|
32
|
-
expect(
|
|
33
|
-
kebabCase( 'foo±§!@#$%^&*()-_=+/?.>,<\\|{}[]`~\'";:bar' )
|
|
34
|
-
).toEqual( 'foo-bar' );
|
|
35
|
-
} );
|
|
36
|
-
|
|
37
|
-
it( 'removes any spacing characters', () => {
|
|
38
|
-
expect( kebabCase( ' foo \t \n \r \f \v bar ' ) ).toEqual( 'foo-bar' );
|
|
39
|
-
} );
|
|
40
|
-
|
|
41
|
-
it( 'groups multiple dashes into a single one', () => {
|
|
42
|
-
expect( kebabCase( 'foo---bar' ) ).toEqual( 'foo-bar' );
|
|
43
|
-
} );
|
|
44
|
-
|
|
45
|
-
it( 'returns an empty string unchanged', () => {
|
|
46
|
-
expect( kebabCase( '' ) ).toEqual( '' );
|
|
47
|
-
} );
|
|
48
|
-
|
|
49
|
-
it( 'returns an existing kebab case string unchanged', () => {
|
|
50
|
-
expect( kebabCase( 'foo-123-bar' ) ).toEqual( 'foo-123-bar' );
|
|
51
|
-
} );
|
|
52
|
-
|
|
53
|
-
it( 'returns an empty string if any nullish type is passed', () => {
|
|
54
|
-
expect( kebabCase( undefined ) ).toEqual( '' );
|
|
55
|
-
expect( kebabCase( null ) ).toEqual( '' );
|
|
56
|
-
} );
|
|
57
|
-
|
|
58
|
-
it( 'converts any unexpected non-nullish type to a string', () => {
|
|
59
|
-
expect( kebabCase( 12345 ) ).toEqual( '12345' );
|
|
60
|
-
expect( kebabCase( [] ) ).toEqual( '' );
|
|
61
|
-
expect( kebabCase( {} ) ).toEqual( 'object-object' );
|
|
62
|
-
} );
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Should cover all test cases of `_wp_to_kebab_case()`.
|
|
66
|
-
*
|
|
67
|
-
* @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/
|
|
68
|
-
* @see https://github.com/WordPress/wordpress-develop/blob/76376fdbc3dc0b3261de377dffc350677345e7ba/tests/phpunit/tests/functions/wpToKebabCase.php#L35-L62
|
|
69
|
-
*/
|
|
70
|
-
it.each( [
|
|
71
|
-
[ 'white', 'white' ],
|
|
72
|
-
[ 'white+black', 'white-black' ],
|
|
73
|
-
[ 'white:black', 'white-black' ],
|
|
74
|
-
[ 'white*black', 'white-black' ],
|
|
75
|
-
[ 'white.black', 'white-black' ],
|
|
76
|
-
[ 'white black', 'white-black' ],
|
|
77
|
-
[ 'white black', 'white-black' ],
|
|
78
|
-
[ 'white-to-black', 'white-to-black' ],
|
|
79
|
-
[ 'white2white', 'white-2-white' ],
|
|
80
|
-
[ 'white2nd', 'white-2nd' ],
|
|
81
|
-
[ 'white2ndcolor', 'white-2-ndcolor' ],
|
|
82
|
-
[ 'white2ndColor', 'white-2nd-color' ],
|
|
83
|
-
[ 'white2nd_color', 'white-2nd-color' ],
|
|
84
|
-
[ 'white23color', 'white-23-color' ],
|
|
85
|
-
[ 'white23', 'white-23' ],
|
|
86
|
-
[ '23color', '23-color' ],
|
|
87
|
-
[ 'white4th', 'white-4th' ],
|
|
88
|
-
[ 'font2xl', 'font-2-xl' ],
|
|
89
|
-
[ 'whiteToWhite', 'white-to-white' ],
|
|
90
|
-
[ 'whiteTOwhite', 'white-t-owhite' ],
|
|
91
|
-
[ 'WHITEtoWHITE', 'whit-eto-white' ],
|
|
92
|
-
[ 42, '42' ],
|
|
93
|
-
[ "i've done", 'ive-done' ],
|
|
94
|
-
[ '#ffffff', 'ffffff' ],
|
|
95
|
-
[ '$ffffff', 'ffffff' ],
|
|
96
|
-
] )( 'converts %s properly to %s', ( input, expected ) => {
|
|
97
|
-
expect( kebabCase( input ) ).toEqual( expected );
|
|
98
|
-
} );
|
|
99
|
-
} );
|
|
4
|
+
import { setImmutably } from '../object';
|
|
100
5
|
|
|
101
6
|
describe( 'setImmutably', () => {
|
|
102
7
|
describe( 'handling falsy values properly', () => {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as blockEditorStore } from '../store';
|
|
11
|
+
import { unlock } from '../lock-unlock';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if the block toolbar should be able to receive focus.
|
|
15
|
+
*
|
|
16
|
+
* @return {boolean} Whether the block toolbar should be able to receive focus
|
|
17
|
+
*/
|
|
18
|
+
export function useCanBlockToolbarBeFocused() {
|
|
19
|
+
return useSelect( ( select ) => {
|
|
20
|
+
const {
|
|
21
|
+
__unstableGetEditorMode,
|
|
22
|
+
getBlock,
|
|
23
|
+
getSettings,
|
|
24
|
+
getSelectedBlockClientId,
|
|
25
|
+
getFirstMultiSelectedBlockClientId,
|
|
26
|
+
} = unlock( select( blockEditorStore ) );
|
|
27
|
+
|
|
28
|
+
const selectedBlockId =
|
|
29
|
+
getFirstMultiSelectedBlockClientId() || getSelectedBlockClientId();
|
|
30
|
+
const isEmptyDefaultBlock = isUnmodifiedDefaultBlock(
|
|
31
|
+
getBlock( selectedBlockId ) || {}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Fixed Toolbar can be focused when:
|
|
35
|
+
// - a block is selected
|
|
36
|
+
// - fixed toolbar is on
|
|
37
|
+
// Block Toolbar Popover can be focused when:
|
|
38
|
+
// - a block is selected
|
|
39
|
+
// - we are in edit mode
|
|
40
|
+
// - it is not an empty default block
|
|
41
|
+
return (
|
|
42
|
+
!! selectedBlockId &&
|
|
43
|
+
( getSettings().hasFixedToolbar ||
|
|
44
|
+
( __unstableGetEditorMode() === 'edit' &&
|
|
45
|
+
! isEmptyDefaultBlock ) )
|
|
46
|
+
);
|
|
47
|
+
}, [] );
|
|
48
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BlockListBlockContext = void 0;
|
|
7
|
-
var _element = require("@wordpress/element");
|
|
8
|
-
/**
|
|
9
|
-
* WordPress dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const BlockListBlockContext = (0, _element.createContext)(null);
|
|
13
|
-
exports.BlockListBlockContext = BlockListBlockContext;
|
|
14
|
-
//# sourceMappingURL=block-list-block-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","BlockListBlockContext","createContext","exports"],"sources":["@wordpress/block-editor/src/components/block-list/block-list-block-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const BlockListBlockContext = createContext( null );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,qBAAqB,GAAG,IAAAC,sBAAa,EAAE,IAAK,CAAC;AAACC,OAAA,CAAAF,qBAAA,GAAAA,qBAAA"}
|