@wordpress/block-editor 12.14.0 → 12.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +10 -5
- package/build/components/block-canvas/index.js +22 -6
- 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-controls/hook.js +3 -23
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-list/block.js +28 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +16 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +61 -18
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +25 -16
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +37 -20
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/index.js +28 -0
- package/build/components/block-rename/index.js.map +1 -0
- package/build/components/block-rename/is-empty-string.js +10 -0
- package/build/components/block-rename/is-empty-string.js.map +1 -0
- package/build/components/block-rename/modal.js +90 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +74 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +17 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +7 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +89 -27
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +86 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.js +6 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/date-format-picker/index.js +8 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +1 -1
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +22 -20
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +9 -3
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +20 -31
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- package/build/components/image-size-control/index.js +0 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +8 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +29 -31
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.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 +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +3 -4
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +14 -7
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -6
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +24 -23
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +5 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/inspector-controls/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +2 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -60
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +2 -30
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +10 -17
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +41 -37
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +35 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- 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/use-block-drop-zone/index.js +74 -9
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +2 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +1 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +16 -2
- package/build/components/use-settings/index.js.map +1 -1
- package/build/hooks/align.js +20 -68
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +13 -29
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +28 -31
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +38 -0
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +58 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +76 -89
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +12 -29
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-fields.js +64 -73
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/dimensions.js +21 -17
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +16 -25
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -119
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +25 -15
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +10 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +29 -108
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +51 -88
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +34 -14
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +154 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +4 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +8 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +34 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +8 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +10 -58
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +66 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/object.js +21 -61
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.js.map +1 -1
- package/build/utils/transform-styles/index.js +26 -6
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +23 -7
- 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-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-list/block.js +29 -10
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +16 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +62 -19
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +24 -15
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +37 -20
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/index.js +4 -0
- package/build-module/components/block-rename/index.js.map +1 -0
- package/build-module/components/block-rename/is-empty-string.js +4 -0
- package/build-module/components/block-rename/is-empty-string.js.map +1 -0
- package/build-module/components/block-rename/modal.js +82 -0
- package/build-module/components/block-rename/modal.js.map +1 -0
- package/build-module/components/block-rename/rename-control.js +66 -0
- package/build-module/components/block-rename/rename-control.js.map +1 -0
- package/build-module/components/block-rename/use-block-rename.js +10 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +7 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +88 -25
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +76 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.js +6 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +8 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -1
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +23 -21
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +10 -4
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +20 -31
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- package/build-module/components/image-size-control/index.js +0 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +30 -32
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.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 +4 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +2 -2
- 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 +3 -4
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +13 -8
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +25 -23
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +6 -5
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +2 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +6 -60
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -32
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +11 -19
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +41 -37
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +36 -3
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- 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/use-block-drop-zone/index.js +73 -9
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +2 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +1 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +15 -3
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/hooks/align.js +19 -66
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +11 -26
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +26 -28
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +36 -0
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +57 -78
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +74 -86
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +11 -27
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-fields.js +60 -74
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/dimensions.js +21 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +14 -23
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +49 -119
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +18 -15
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +5 -3
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +26 -105
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +51 -84
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +33 -12
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +149 -6
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +4 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +7 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +33 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +8 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -51
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +56 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/object.js +21 -60
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +24 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +123 -298
- package/build-style/style.css +123 -298
- package/package.json +31 -31
- package/src/components/block-canvas/index.js +31 -17
- package/src/components/block-caption/README.md +2 -2
- package/src/components/block-card/index.js +5 -3
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block.js +39 -5
- package/src/components/block-list/block.native.js +20 -4
- package/src/components/block-list/use-block-props/index.js +74 -21
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- package/src/components/block-parent-selector/index.js +1 -1
- package/src/components/block-pattern-setup/index.js +38 -22
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
- package/src/components/block-pattern-setup/style.scss +4 -1
- package/src/components/block-patterns-list/README.md +4 -4
- package/src/components/block-patterns-list/index.js +61 -35
- package/src/components/block-patterns-list/style.scss +7 -0
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/index.js +3 -0
- package/src/components/block-rename/is-empty-string.js +3 -0
- package/src/components/block-rename/modal.js +121 -0
- package/src/components/block-rename/rename-control.js +80 -0
- package/src/components/block-rename/use-block-rename.js +10 -0
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
- package/src/components/block-toolbar/index.js +180 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +90 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/index.js +5 -4
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/button-block-appender/content.scss +2 -2
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/date-format-picker/index.js +7 -0
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- package/src/components/editable-text/README.md +0 -36
- package/src/components/global-styles/advanced-panel.js +1 -1
- package/src/components/global-styles/color-panel.js +34 -25
- package/src/components/global-styles/filters-panel.js +8 -4
- package/src/components/global-styles/typography-panel.js +23 -43
- package/src/components/image-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +0 -6
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/README.md +13 -2
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +5 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +7 -3
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +6 -1
- package/src/components/inserter/block-patterns-tab/utils.js +6 -4
- package/src/components/inserter/hooks/use-patterns-state.js +3 -1
- package/src/components/inserter/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +16 -8
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +15 -17
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- package/src/components/inserter-listbox/index.js +11 -7
- package/src/components/inserter-listbox/item.js +11 -12
- package/src/components/inserter-listbox/row.js +6 -12
- package/src/components/inspector-controls/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
- package/src/components/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +2 -2
- package/src/components/plain-text/README.md +0 -28
- package/src/components/preview-options/index.js +6 -84
- package/src/components/rich-text/README.md +0 -58
- package/src/components/rich-text/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +5 -46
- package/src/components/rich-text/index.native.js +9 -26
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +52 -50
- package/src/components/rich-text/use-input-rules.js +36 -3
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/url-input/README.md +1 -74
- package/src/components/use-block-drop-zone/index.js +118 -15
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-on-block-drop/index.js +2 -1
- package/src/components/use-resize-canvas/README.md +3 -3
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/index.js +17 -3
- package/src/components/use-settings/test/index.js +1 -1
- package/src/hooks/align.js +15 -76
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +13 -33
- package/src/hooks/background.js +28 -23
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +33 -0
- package/src/hooks/border.js +67 -118
- package/src/hooks/color.js +100 -132
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +8 -40
- package/src/hooks/custom-fields.js +70 -94
- package/src/hooks/dimensions.js +20 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +10 -29
- package/src/hooks/font-size.js +66 -162
- package/src/hooks/index.js +42 -15
- package/src/hooks/index.native.js +6 -3
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +25 -110
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +117 -187
- package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
- package/src/hooks/test/align.js +1 -178
- package/src/hooks/typography.js +20 -16
- package/src/hooks/utils.js +187 -6
- package/src/layouts/constrained.js +57 -50
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +8 -0
- package/src/store/private-selectors.js +45 -0
- package/src/store/reducer.js +8 -0
- package/src/store/selectors.js +5 -67
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -3
- package/src/utils/object.js +18 -69
- package/src/utils/selection.js +9 -2
- package/src/utils/test/transform-styles.js +49 -0
- package/src/utils/transform-styles/index.js +39 -13
- package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/block-rename-ui.js +0 -167
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -159
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/block-rename-ui.js +0 -228
- package/src/hooks/test/color.js +0 -112
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
package/src/hooks/color.js
CHANGED
|
@@ -9,7 +9,8 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { addFilter } from '@wordpress/hooks';
|
|
10
10
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
11
11
|
import { useMemo, Platform, useCallback } from '@wordpress/element';
|
|
12
|
-
import {
|
|
12
|
+
import { pure } from '@wordpress/compose';
|
|
13
|
+
import { useSelect } from '@wordpress/data';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
cleanEmptyObject,
|
|
24
25
|
transformStyles,
|
|
25
26
|
shouldSkipSerialization,
|
|
26
|
-
useBlockSettings,
|
|
27
27
|
} from './utils';
|
|
28
28
|
import { useSettings } from '../components/use-settings';
|
|
29
29
|
import InspectorControls from '../components/inspector-controls';
|
|
@@ -32,11 +32,12 @@ import {
|
|
|
32
32
|
default as StylesColorPanel,
|
|
33
33
|
} from '../components/global-styles/color-panel';
|
|
34
34
|
import BlockColorContrastChecker from './contrast-checker';
|
|
35
|
+
import { store as blockEditorStore } from '../store';
|
|
35
36
|
|
|
36
37
|
export const COLOR_SUPPORT_KEY = 'color';
|
|
37
38
|
|
|
38
|
-
const hasColorSupport = (
|
|
39
|
-
const colorSupport = getBlockSupport(
|
|
39
|
+
const hasColorSupport = ( blockNameOrType ) => {
|
|
40
|
+
const colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );
|
|
40
41
|
return (
|
|
41
42
|
colorSupport &&
|
|
42
43
|
( colorSupport.link === true ||
|
|
@@ -60,8 +61,8 @@ const hasLinkColorSupport = ( blockType ) => {
|
|
|
60
61
|
);
|
|
61
62
|
};
|
|
62
63
|
|
|
63
|
-
const hasGradientSupport = (
|
|
64
|
-
const colorSupport = getBlockSupport(
|
|
64
|
+
const hasGradientSupport = ( blockNameOrType ) => {
|
|
65
|
+
const colorSupport = getBlockSupport( blockNameOrType, COLOR_SUPPORT_KEY );
|
|
65
66
|
|
|
66
67
|
return (
|
|
67
68
|
colorSupport !== null &&
|
|
@@ -125,27 +126,31 @@ function addAttributes( settings ) {
|
|
|
125
126
|
/**
|
|
126
127
|
* Override props assigned to save component to inject colors classnames.
|
|
127
128
|
*
|
|
128
|
-
* @param {Object}
|
|
129
|
-
* @param {Object}
|
|
130
|
-
* @param {Object}
|
|
129
|
+
* @param {Object} props Additional props applied to save element.
|
|
130
|
+
* @param {Object|string} blockNameOrType Block type.
|
|
131
|
+
* @param {Object} attributes Block attributes.
|
|
131
132
|
*
|
|
132
133
|
* @return {Object} Filtered props applied to save element.
|
|
133
134
|
*/
|
|
134
|
-
export function addSaveProps( props,
|
|
135
|
+
export function addSaveProps( props, blockNameOrType, attributes ) {
|
|
135
136
|
if (
|
|
136
|
-
! hasColorSupport(
|
|
137
|
-
shouldSkipSerialization(
|
|
137
|
+
! hasColorSupport( blockNameOrType ) ||
|
|
138
|
+
shouldSkipSerialization( blockNameOrType, COLOR_SUPPORT_KEY )
|
|
138
139
|
) {
|
|
139
140
|
return props;
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
const hasGradient = hasGradientSupport(
|
|
143
|
+
const hasGradient = hasGradientSupport( blockNameOrType );
|
|
143
144
|
|
|
144
145
|
// I'd have preferred to avoid the "style" attribute usage here
|
|
145
146
|
const { backgroundColor, textColor, gradient, style } = attributes;
|
|
146
147
|
|
|
147
148
|
const shouldSerialize = ( feature ) =>
|
|
148
|
-
! shouldSkipSerialization(
|
|
149
|
+
! shouldSkipSerialization(
|
|
150
|
+
blockNameOrType,
|
|
151
|
+
COLOR_SUPPORT_KEY,
|
|
152
|
+
feature
|
|
153
|
+
);
|
|
149
154
|
|
|
150
155
|
// Primary color classes must come before the `has-text-color`,
|
|
151
156
|
// `has-background` and `has-link-color` classes to maintain backwards
|
|
@@ -191,33 +196,6 @@ export function addSaveProps( props, blockType, attributes ) {
|
|
|
191
196
|
return props;
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
/**
|
|
195
|
-
* Filters registered block settings to extend the block edit wrapper
|
|
196
|
-
* to apply the desired styles and classnames properly.
|
|
197
|
-
*
|
|
198
|
-
* @param {Object} settings Original block settings.
|
|
199
|
-
*
|
|
200
|
-
* @return {Object} Filtered block settings.
|
|
201
|
-
*/
|
|
202
|
-
export function addEditProps( settings ) {
|
|
203
|
-
if (
|
|
204
|
-
! hasColorSupport( settings ) ||
|
|
205
|
-
shouldSkipSerialization( settings, COLOR_SUPPORT_KEY )
|
|
206
|
-
) {
|
|
207
|
-
return settings;
|
|
208
|
-
}
|
|
209
|
-
const existingGetEditWrapperProps = settings.getEditWrapperProps;
|
|
210
|
-
settings.getEditWrapperProps = ( attributes ) => {
|
|
211
|
-
let props = {};
|
|
212
|
-
if ( existingGetEditWrapperProps ) {
|
|
213
|
-
props = existingGetEditWrapperProps( attributes );
|
|
214
|
-
}
|
|
215
|
-
return addSaveProps( props, settings, attributes );
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
return settings;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
199
|
function styleToAttributes( style ) {
|
|
222
200
|
const textColorValue = style?.color?.text;
|
|
223
201
|
const textColorSlug = textColorValue?.startsWith( 'var:preset|color|' )
|
|
@@ -289,23 +267,25 @@ function ColorInspectorControl( { children, resetAllFilter } ) {
|
|
|
289
267
|
);
|
|
290
268
|
}
|
|
291
269
|
|
|
292
|
-
|
|
293
|
-
const { clientId, name, attributes, setAttributes } = props;
|
|
294
|
-
const settings = useBlockSettings( name );
|
|
270
|
+
function ColorEditPure( { clientId, name, setAttributes, settings } ) {
|
|
295
271
|
const isEnabled = useHasColorPanel( settings );
|
|
272
|
+
function selector( select ) {
|
|
273
|
+
const { style, textColor, backgroundColor, gradient } =
|
|
274
|
+
select( blockEditorStore ).getBlockAttributes( clientId ) || {};
|
|
275
|
+
return { style, textColor, backgroundColor, gradient };
|
|
276
|
+
}
|
|
277
|
+
const { style, textColor, backgroundColor, gradient } = useSelect(
|
|
278
|
+
selector,
|
|
279
|
+
[ clientId ]
|
|
280
|
+
);
|
|
296
281
|
const value = useMemo( () => {
|
|
297
282
|
return attributesToStyle( {
|
|
298
|
-
style
|
|
299
|
-
textColor
|
|
300
|
-
backgroundColor
|
|
301
|
-
gradient
|
|
283
|
+
style,
|
|
284
|
+
textColor,
|
|
285
|
+
backgroundColor,
|
|
286
|
+
gradient,
|
|
302
287
|
} );
|
|
303
|
-
}, [
|
|
304
|
-
attributes.style,
|
|
305
|
-
attributes.textColor,
|
|
306
|
-
attributes.backgroundColor,
|
|
307
|
-
attributes.gradient,
|
|
308
|
-
] );
|
|
288
|
+
}, [ style, textColor, backgroundColor, gradient ] );
|
|
309
289
|
|
|
310
290
|
const onChange = ( newStyle ) => {
|
|
311
291
|
setAttributes( styleToAttributes( newStyle ) );
|
|
@@ -315,7 +295,7 @@ export function ColorEdit( props ) {
|
|
|
315
295
|
return null;
|
|
316
296
|
}
|
|
317
297
|
|
|
318
|
-
const defaultControls = getBlockSupport(
|
|
298
|
+
const defaultControls = getBlockSupport( name, [
|
|
319
299
|
COLOR_SUPPORT_KEY,
|
|
320
300
|
'__experimentalDefaultControls',
|
|
321
301
|
] );
|
|
@@ -328,7 +308,7 @@ export function ColorEdit( props ) {
|
|
|
328
308
|
// Deactivating it requires `enableContrastChecker` to have
|
|
329
309
|
// an explicit value of `false`.
|
|
330
310
|
false !==
|
|
331
|
-
getBlockSupport(
|
|
311
|
+
getBlockSupport( name, [
|
|
332
312
|
COLOR_SUPPORT_KEY,
|
|
333
313
|
'enableContrastChecker',
|
|
334
314
|
] );
|
|
@@ -343,7 +323,7 @@ export function ColorEdit( props ) {
|
|
|
343
323
|
defaultControls={ defaultControls }
|
|
344
324
|
enableContrastChecker={
|
|
345
325
|
false !==
|
|
346
|
-
getBlockSupport(
|
|
326
|
+
getBlockSupport( name, [
|
|
347
327
|
COLOR_SUPPORT_KEY,
|
|
348
328
|
'enableContrastChecker',
|
|
349
329
|
] )
|
|
@@ -356,72 +336,72 @@ export function ColorEdit( props ) {
|
|
|
356
336
|
);
|
|
357
337
|
}
|
|
358
338
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
339
|
+
// We don't want block controls to re-render when typing inside a block. `pure`
|
|
340
|
+
// will prevent re-renders unless props change, so only pass the needed props
|
|
341
|
+
// and not the whole attributes object.
|
|
342
|
+
export const ColorEdit = pure( ColorEditPure );
|
|
343
|
+
|
|
344
|
+
function useBlockProps( {
|
|
345
|
+
name,
|
|
346
|
+
backgroundColor,
|
|
347
|
+
textColor,
|
|
348
|
+
gradient,
|
|
349
|
+
style,
|
|
350
|
+
} ) {
|
|
351
|
+
const [ userPalette, themePalette, defaultPalette ] = useSettings(
|
|
352
|
+
'color.palette.custom',
|
|
353
|
+
'color.palette.theme',
|
|
354
|
+
'color.palette.default'
|
|
355
|
+
);
|
|
376
356
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (
|
|
394
|
-
textColor &&
|
|
395
|
-
! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )
|
|
396
|
-
) {
|
|
397
|
-
extraStyles.color = getColorObjectByAttributeValues(
|
|
398
|
-
colors,
|
|
399
|
-
textColor
|
|
400
|
-
)?.color;
|
|
401
|
-
}
|
|
402
|
-
if (
|
|
403
|
-
backgroundColor &&
|
|
404
|
-
! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )
|
|
405
|
-
) {
|
|
406
|
-
extraStyles.backgroundColor = getColorObjectByAttributeValues(
|
|
407
|
-
colors,
|
|
408
|
-
backgroundColor
|
|
409
|
-
)?.color;
|
|
410
|
-
}
|
|
357
|
+
const colors = useMemo(
|
|
358
|
+
() => [
|
|
359
|
+
...( userPalette || [] ),
|
|
360
|
+
...( themePalette || [] ),
|
|
361
|
+
...( defaultPalette || [] ),
|
|
362
|
+
],
|
|
363
|
+
[ userPalette, themePalette, defaultPalette ]
|
|
364
|
+
);
|
|
365
|
+
if (
|
|
366
|
+
! hasColorSupport( name ) ||
|
|
367
|
+
shouldSkipSerialization( name, COLOR_SUPPORT_KEY )
|
|
368
|
+
) {
|
|
369
|
+
return {};
|
|
370
|
+
}
|
|
371
|
+
const extraStyles = {};
|
|
411
372
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
373
|
+
if (
|
|
374
|
+
textColor &&
|
|
375
|
+
! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'text' )
|
|
376
|
+
) {
|
|
377
|
+
extraStyles.color = getColorObjectByAttributeValues(
|
|
378
|
+
colors,
|
|
379
|
+
textColor
|
|
380
|
+
)?.color;
|
|
381
|
+
}
|
|
382
|
+
if (
|
|
383
|
+
backgroundColor &&
|
|
384
|
+
! shouldSkipSerialization( name, COLOR_SUPPORT_KEY, 'background' )
|
|
385
|
+
) {
|
|
386
|
+
extraStyles.backgroundColor = getColorObjectByAttributeValues(
|
|
387
|
+
colors,
|
|
388
|
+
backgroundColor
|
|
389
|
+
)?.color;
|
|
390
|
+
}
|
|
420
391
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
392
|
+
return addSaveProps( { style: extraStyles }, name, {
|
|
393
|
+
textColor,
|
|
394
|
+
backgroundColor,
|
|
395
|
+
gradient,
|
|
396
|
+
style,
|
|
397
|
+
} );
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export default {
|
|
401
|
+
useBlockProps,
|
|
402
|
+
attributeKeys: [ 'backgroundColor', 'textColor', 'gradient', 'style' ],
|
|
403
|
+
hasSupport: hasColorSupport,
|
|
404
|
+
};
|
|
425
405
|
|
|
426
406
|
const MIGRATION_PATHS = {
|
|
427
407
|
linkColor: [ [ 'style', 'elements', 'link', 'color', 'text' ] ],
|
|
@@ -463,18 +443,6 @@ addFilter(
|
|
|
463
443
|
addSaveProps
|
|
464
444
|
);
|
|
465
445
|
|
|
466
|
-
addFilter(
|
|
467
|
-
'blocks.registerBlockType',
|
|
468
|
-
'core/color/addEditProps',
|
|
469
|
-
addEditProps
|
|
470
|
-
);
|
|
471
|
-
|
|
472
|
-
addFilter(
|
|
473
|
-
'editor.BlockListBlock',
|
|
474
|
-
'core/color/with-color-palette-styles',
|
|
475
|
-
withColorPaletteStyles
|
|
476
|
-
);
|
|
477
|
-
|
|
478
446
|
addFilter(
|
|
479
447
|
'blocks.switchToBlockType.transformedBlock',
|
|
480
448
|
'core/color/addTransforms',
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { ToolbarButton, MenuItem } from '@wordpress/components';
|
|
5
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
6
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
|
-
import { addFilter } from '@wordpress/hooks';
|
|
8
6
|
import { __ } from '@wordpress/i18n';
|
|
9
7
|
import { useEffect, useRef, useCallback } from '@wordpress/element';
|
|
10
8
|
|
|
@@ -37,129 +35,119 @@ function StopEditingAsBlocksOnOutsideSelect( {
|
|
|
37
35
|
return null;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
[ props.clientId ]
|
|
63
|
-
);
|
|
38
|
+
function ContentLockControlsPure( { clientId, isSelected } ) {
|
|
39
|
+
const { getBlockListSettings, getSettings } = useSelect( blockEditorStore );
|
|
40
|
+
const focusModeToRevert = useRef();
|
|
41
|
+
const { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(
|
|
42
|
+
( select ) => {
|
|
43
|
+
const {
|
|
44
|
+
__unstableGetContentLockingParent,
|
|
45
|
+
getTemplateLock,
|
|
46
|
+
__unstableGetTemporarilyEditingAsBlocks,
|
|
47
|
+
} = select( blockEditorStore );
|
|
48
|
+
return {
|
|
49
|
+
templateLock: getTemplateLock( clientId ),
|
|
50
|
+
isLockedByParent:
|
|
51
|
+
!! __unstableGetContentLockingParent( clientId ),
|
|
52
|
+
isEditingAsBlocks:
|
|
53
|
+
__unstableGetTemporarilyEditingAsBlocks() === clientId,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
[ clientId ]
|
|
57
|
+
);
|
|
64
58
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
updateBlockAttributes,
|
|
75
|
-
} = useDispatch( blockEditorStore );
|
|
59
|
+
const {
|
|
60
|
+
updateSettings,
|
|
61
|
+
updateBlockListSettings,
|
|
62
|
+
__unstableSetTemporarilyEditingAsBlocks,
|
|
63
|
+
} = useDispatch( blockEditorStore );
|
|
64
|
+
const isContentLocked =
|
|
65
|
+
! isLockedByParent && templateLock === 'contentOnly';
|
|
66
|
+
const { __unstableMarkNextChangeAsNotPersistent, updateBlockAttributes } =
|
|
67
|
+
useDispatch( blockEditorStore );
|
|
76
68
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
69
|
+
const stopEditingAsBlock = useCallback( () => {
|
|
70
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
71
|
+
updateBlockAttributes( clientId, {
|
|
72
|
+
templateLock: 'contentOnly',
|
|
73
|
+
} );
|
|
74
|
+
updateBlockListSettings( clientId, {
|
|
75
|
+
...getBlockListSettings( clientId ),
|
|
76
|
+
templateLock: 'contentOnly',
|
|
77
|
+
} );
|
|
78
|
+
updateSettings( { focusMode: focusModeToRevert.current } );
|
|
79
|
+
__unstableSetTemporarilyEditingAsBlocks();
|
|
80
|
+
}, [
|
|
81
|
+
clientId,
|
|
82
|
+
updateSettings,
|
|
83
|
+
updateBlockListSettings,
|
|
84
|
+
getBlockListSettings,
|
|
85
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
86
|
+
updateBlockAttributes,
|
|
87
|
+
__unstableSetTemporarilyEditingAsBlocks,
|
|
88
|
+
] );
|
|
97
89
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
if ( ! isContentLocked && ! isEditingAsBlocks ) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
101
93
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
const showStopEditingAsBlocks = isEditingAsBlocks && ! isContentLocked;
|
|
95
|
+
const showStartEditingAsBlocks =
|
|
96
|
+
! isEditingAsBlocks && isContentLocked && isSelected;
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
</>
|
|
156
|
-
);
|
|
157
|
-
},
|
|
158
|
-
'withContentLockControls'
|
|
159
|
-
);
|
|
98
|
+
return (
|
|
99
|
+
<>
|
|
100
|
+
{ showStopEditingAsBlocks && (
|
|
101
|
+
<>
|
|
102
|
+
<StopEditingAsBlocksOnOutsideSelect
|
|
103
|
+
clientId={ clientId }
|
|
104
|
+
stopEditingAsBlock={ stopEditingAsBlock }
|
|
105
|
+
/>
|
|
106
|
+
<BlockControls group="other">
|
|
107
|
+
<ToolbarButton
|
|
108
|
+
onClick={ () => {
|
|
109
|
+
stopEditingAsBlock();
|
|
110
|
+
} }
|
|
111
|
+
>
|
|
112
|
+
{ __( 'Done' ) }
|
|
113
|
+
</ToolbarButton>
|
|
114
|
+
</BlockControls>
|
|
115
|
+
</>
|
|
116
|
+
) }
|
|
117
|
+
{ showStartEditingAsBlocks && (
|
|
118
|
+
<BlockSettingsMenuControls>
|
|
119
|
+
{ ( { onClose } ) => (
|
|
120
|
+
<MenuItem
|
|
121
|
+
onClick={ () => {
|
|
122
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
123
|
+
updateBlockAttributes( clientId, {
|
|
124
|
+
templateLock: undefined,
|
|
125
|
+
} );
|
|
126
|
+
updateBlockListSettings( clientId, {
|
|
127
|
+
...getBlockListSettings( clientId ),
|
|
128
|
+
templateLock: false,
|
|
129
|
+
} );
|
|
130
|
+
focusModeToRevert.current =
|
|
131
|
+
getSettings().focusMode;
|
|
132
|
+
updateSettings( { focusMode: true } );
|
|
133
|
+
__unstableSetTemporarilyEditingAsBlocks(
|
|
134
|
+
clientId
|
|
135
|
+
);
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
>
|
|
139
|
+
{ __( 'Modify' ) }
|
|
140
|
+
</MenuItem>
|
|
141
|
+
) }
|
|
142
|
+
</BlockSettingsMenuControls>
|
|
143
|
+
) }
|
|
144
|
+
</>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
160
147
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
export default {
|
|
149
|
+
edit: ContentLockControlsPure,
|
|
150
|
+
hasSupport() {
|
|
151
|
+
return true;
|
|
152
|
+
},
|
|
153
|
+
};
|
|
@@ -10,7 +10,6 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
10
10
|
import { TextControl } from '@wordpress/components';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
13
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
@@ -39,7 +38,7 @@ export function addAttribute( settings ) {
|
|
|
39
38
|
return settings;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
function
|
|
41
|
+
function CustomClassNameControlsPure( { className, setAttributes } ) {
|
|
43
42
|
const blockEditingMode = useBlockEditingMode();
|
|
44
43
|
if ( blockEditingMode !== 'default' ) {
|
|
45
44
|
return null;
|
|
@@ -52,7 +51,7 @@ function CustomClassNameControls( { attributes, setAttributes } ) {
|
|
|
52
51
|
__next40pxDefaultSize
|
|
53
52
|
autoComplete="off"
|
|
54
53
|
label={ __( 'Additional CSS class(es)' ) }
|
|
55
|
-
value={
|
|
54
|
+
value={ className || '' }
|
|
56
55
|
onChange={ ( nextValue ) => {
|
|
57
56
|
setAttributes( {
|
|
58
57
|
className: nextValue !== '' ? nextValue : undefined,
|
|
@@ -64,39 +63,13 @@ function CustomClassNameControls( { attributes, setAttributes } ) {
|
|
|
64
63
|
);
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* @param {Component} BlockEdit Original component.
|
|
73
|
-
*
|
|
74
|
-
* @return {Component} Wrapped component.
|
|
75
|
-
*/
|
|
76
|
-
export const withCustomClassNameControls = createHigherOrderComponent(
|
|
77
|
-
( BlockEdit ) => {
|
|
78
|
-
return ( props ) => {
|
|
79
|
-
const hasCustomClassName = hasBlockSupport(
|
|
80
|
-
props.name,
|
|
81
|
-
'customClassName',
|
|
82
|
-
true
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
<BlockEdit { ...props } />
|
|
88
|
-
{ hasCustomClassName && props.isSelected && (
|
|
89
|
-
<CustomClassNameControls
|
|
90
|
-
attributes={ props.attributes }
|
|
91
|
-
setAttributes={ props.setAttributes }
|
|
92
|
-
/>
|
|
93
|
-
) }
|
|
94
|
-
</>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
66
|
+
export default {
|
|
67
|
+
edit: CustomClassNameControlsPure,
|
|
68
|
+
attributeKeys: [ 'className' ],
|
|
69
|
+
hasSupport( name ) {
|
|
70
|
+
return hasBlockSupport( name, 'customClassName', true );
|
|
97
71
|
},
|
|
98
|
-
|
|
99
|
-
);
|
|
72
|
+
};
|
|
100
73
|
|
|
101
74
|
/**
|
|
102
75
|
* Override props assigned to save component to inject the className, if block
|
|
@@ -167,11 +140,6 @@ addFilter(
|
|
|
167
140
|
'core/editor/custom-class-name/attribute',
|
|
168
141
|
addAttribute
|
|
169
142
|
);
|
|
170
|
-
addFilter(
|
|
171
|
-
'editor.BlockEdit',
|
|
172
|
-
'core/editor/custom-class-name/with-inspector-controls',
|
|
173
|
-
withCustomClassNameControls
|
|
174
|
-
);
|
|
175
143
|
addFilter(
|
|
176
144
|
'blocks.getSaveContent.extraProps',
|
|
177
145
|
'core/editor/custom-class-name/save-props',
|