@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
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
.block-editor-block-patterns-list__item {
|
|
20
20
|
height: 100%;
|
|
21
|
+
// This is derived from the top padding set on
|
|
22
|
+
// `.block-editor-block-patterns-explorer__list`
|
|
23
|
+
scroll-margin-top: $grid-unit-30;
|
|
24
|
+
// This is derived from the bottom padding set on
|
|
25
|
+
// `.block-editor-block-patterns-explorer__list` and
|
|
26
|
+
// the bottom margin set on `...__list-item` above
|
|
27
|
+
scroll-margin-bottom: ($grid-unit-40 + $grid-unit-30);
|
|
21
28
|
|
|
22
29
|
.block-editor-block-preview__container {
|
|
23
30
|
display: flex;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Button,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { __, _n } from '@wordpress/i18n';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -48,22 +48,15 @@ export function BlockRemovalWarningModal( { rules } ) {
|
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<Modal
|
|
51
|
-
title={ __( '
|
|
51
|
+
title={ __( 'Be careful!' ) }
|
|
52
52
|
onRequestClose={ clearBlockRemovalPrompt }
|
|
53
53
|
>
|
|
54
|
-
{ blockNamesForPrompt.length === 1 ? (
|
|
55
|
-
<p>{ rules[ blockNamesForPrompt[ 0 ] ] }</p>
|
|
56
|
-
) : (
|
|
57
|
-
<ul style={ { listStyleType: 'disc', paddingLeft: '1rem' } }>
|
|
58
|
-
{ blockNamesForPrompt.map( ( name ) => (
|
|
59
|
-
<li key={ name }>{ rules[ name ] }</li>
|
|
60
|
-
) ) }
|
|
61
|
-
</ul>
|
|
62
|
-
) }
|
|
63
54
|
<p>
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
{ _n(
|
|
56
|
+
'Post or page content will not be displayed if you delete this block.',
|
|
57
|
+
'Post or page content will not be displayed if you delete these blocks.',
|
|
58
|
+
blockNamesForPrompt.length
|
|
59
|
+
) }
|
|
67
60
|
</p>
|
|
68
61
|
<HStack justify="right">
|
|
69
62
|
<Button variant="tertiary" onClick={ clearBlockRemovalPrompt }>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
__experimentalVStack as VStack,
|
|
7
|
+
Button,
|
|
8
|
+
TextControl,
|
|
9
|
+
Modal,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
12
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
14
|
+
import { speak } from '@wordpress/a11y';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import isEmptyString from './is-empty-string';
|
|
20
|
+
|
|
21
|
+
export default function BlockRenameModal( {
|
|
22
|
+
blockName,
|
|
23
|
+
originalBlockName,
|
|
24
|
+
onClose,
|
|
25
|
+
onSave,
|
|
26
|
+
} ) {
|
|
27
|
+
const [ editedBlockName, setEditedBlockName ] = useState( blockName );
|
|
28
|
+
|
|
29
|
+
const nameHasChanged = editedBlockName !== blockName;
|
|
30
|
+
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
31
|
+
const nameIsEmpty = isEmptyString( editedBlockName );
|
|
32
|
+
|
|
33
|
+
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
34
|
+
|
|
35
|
+
const autoSelectInputText = ( event ) => event.target.select();
|
|
36
|
+
|
|
37
|
+
const dialogDescription = useInstanceId(
|
|
38
|
+
BlockRenameModal,
|
|
39
|
+
`block-editor-rename-modal__description`
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const handleSubmit = () => {
|
|
43
|
+
const message =
|
|
44
|
+
nameIsOriginal || nameIsEmpty
|
|
45
|
+
? sprintf(
|
|
46
|
+
/* translators: %s: new name/label for the block */
|
|
47
|
+
__( 'Block name reset to: "%s".' ),
|
|
48
|
+
editedBlockName
|
|
49
|
+
)
|
|
50
|
+
: sprintf(
|
|
51
|
+
/* translators: %s: new name/label for the block */
|
|
52
|
+
__( 'Block name changed to: "%s".' ),
|
|
53
|
+
editedBlockName
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Must be assertive to immediately announce change.
|
|
57
|
+
speak( message, 'assertive' );
|
|
58
|
+
onSave( editedBlockName );
|
|
59
|
+
|
|
60
|
+
// Immediate close avoids ability to hit save multiple times.
|
|
61
|
+
onClose();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Modal
|
|
66
|
+
title={ __( 'Rename' ) }
|
|
67
|
+
onRequestClose={ onClose }
|
|
68
|
+
overlayClassName="block-editor-block-rename-modal"
|
|
69
|
+
aria={ {
|
|
70
|
+
describedby: dialogDescription,
|
|
71
|
+
} }
|
|
72
|
+
focusOnMount="firstContentElement"
|
|
73
|
+
>
|
|
74
|
+
<p id={ dialogDescription }>
|
|
75
|
+
{ __( 'Enter a custom name for this block.' ) }
|
|
76
|
+
</p>
|
|
77
|
+
<form
|
|
78
|
+
onSubmit={ ( e ) => {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
|
|
81
|
+
if ( ! isNameValid ) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
handleSubmit();
|
|
86
|
+
} }
|
|
87
|
+
>
|
|
88
|
+
<VStack spacing="3">
|
|
89
|
+
<TextControl
|
|
90
|
+
__nextHasNoMarginBottom
|
|
91
|
+
__next40pxDefaultSize
|
|
92
|
+
value={ editedBlockName }
|
|
93
|
+
label={ __( 'Block name' ) }
|
|
94
|
+
hideLabelFromVision={ true }
|
|
95
|
+
placeholder={ originalBlockName }
|
|
96
|
+
onChange={ setEditedBlockName }
|
|
97
|
+
onFocus={ autoSelectInputText }
|
|
98
|
+
/>
|
|
99
|
+
<HStack justify="right">
|
|
100
|
+
<Button
|
|
101
|
+
__next40pxDefaultSize
|
|
102
|
+
variant="tertiary"
|
|
103
|
+
onClick={ onClose }
|
|
104
|
+
>
|
|
105
|
+
{ __( 'Cancel' ) }
|
|
106
|
+
</Button>
|
|
107
|
+
|
|
108
|
+
<Button
|
|
109
|
+
__next40pxDefaultSize
|
|
110
|
+
aria-disabled={ ! isNameValid }
|
|
111
|
+
variant="primary"
|
|
112
|
+
type="submit"
|
|
113
|
+
>
|
|
114
|
+
{ __( 'Save' ) }
|
|
115
|
+
</Button>
|
|
116
|
+
</HStack>
|
|
117
|
+
</VStack>
|
|
118
|
+
</form>
|
|
119
|
+
</Modal>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { MenuItem } from '@wordpress/components';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as blockEditorStore } from '../../store';
|
|
13
|
+
import { useBlockDisplayInformation } from '..';
|
|
14
|
+
import isEmptyString from './is-empty-string';
|
|
15
|
+
import BlockRenameModal from './modal';
|
|
16
|
+
|
|
17
|
+
export default function BlockRenameControl( { clientId } ) {
|
|
18
|
+
const [ renamingBlock, setRenamingBlock ] = useState( false );
|
|
19
|
+
|
|
20
|
+
const { metadata } = useSelect(
|
|
21
|
+
( select ) => {
|
|
22
|
+
const { getBlockAttributes } = select( blockEditorStore );
|
|
23
|
+
|
|
24
|
+
const _metadata = getBlockAttributes( clientId )?.metadata;
|
|
25
|
+
return {
|
|
26
|
+
metadata: _metadata,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
[ clientId ]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
33
|
+
|
|
34
|
+
const customName = metadata?.name;
|
|
35
|
+
|
|
36
|
+
function onChange( newName ) {
|
|
37
|
+
updateBlockAttributes( [ clientId ], {
|
|
38
|
+
metadata: {
|
|
39
|
+
...( metadata && metadata ),
|
|
40
|
+
name: newName,
|
|
41
|
+
},
|
|
42
|
+
} );
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<MenuItem
|
|
50
|
+
onClick={ () => {
|
|
51
|
+
setRenamingBlock( true );
|
|
52
|
+
} }
|
|
53
|
+
aria-expanded={ renamingBlock }
|
|
54
|
+
aria-haspopup="dialog"
|
|
55
|
+
>
|
|
56
|
+
{ __( 'Rename' ) }
|
|
57
|
+
</MenuItem>
|
|
58
|
+
{ renamingBlock && (
|
|
59
|
+
<BlockRenameModal
|
|
60
|
+
blockName={ customName || '' }
|
|
61
|
+
originalBlockName={ blockInformation?.title }
|
|
62
|
+
onClose={ () => setRenamingBlock( false ) }
|
|
63
|
+
onSave={ ( newName ) => {
|
|
64
|
+
// If the new value is the block's original name (e.g. `Group`)
|
|
65
|
+
// or it is an empty string then assume the intent is to reset
|
|
66
|
+
// the value. Therefore reset the metadata.
|
|
67
|
+
if (
|
|
68
|
+
newName === blockInformation?.title ||
|
|
69
|
+
isEmptyString( newName )
|
|
70
|
+
) {
|
|
71
|
+
newName = undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onChange( newName );
|
|
75
|
+
} }
|
|
76
|
+
/>
|
|
77
|
+
) }
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
InspectorControls,
|
|
6
|
-
useMultipleOriginColorsAndGradients,
|
|
7
|
-
} from '@wordpress/block-editor';
|
|
8
4
|
import {
|
|
9
5
|
BottomSheet,
|
|
10
6
|
ColorSettings,
|
|
11
7
|
FocalPointSettingsPanel,
|
|
12
|
-
ImageLinkDestinationsScreen,
|
|
13
8
|
LinkPickerScreen,
|
|
14
9
|
} from '@wordpress/components';
|
|
15
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -18,6 +13,9 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
18
13
|
* Internal dependencies
|
|
19
14
|
*/
|
|
20
15
|
import styles from './container.native.scss';
|
|
16
|
+
import InspectorControls from '../inspector-controls';
|
|
17
|
+
import ImageLinkDestinationsScreen from '../image-link-destinations';
|
|
18
|
+
import useMultipleOriginColorsAndGradients from '../colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
21
19
|
|
|
22
20
|
export const blockSettingsScreens = {
|
|
23
21
|
settings: 'Settings',
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
store as keyboardShortcutsStore,
|
|
21
21
|
__unstableUseShortcutEventMatch,
|
|
22
22
|
} from '@wordpress/keyboard-shortcuts';
|
|
23
|
-
import { pipe, useCopyToClipboard } from '@wordpress/compose';
|
|
23
|
+
import { pipe, useCopyToClipboard, useViewportMatch } from '@wordpress/compose';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
@@ -47,6 +47,38 @@ function CopyMenuItem( { blocks, onCopy, label } ) {
|
|
|
47
47
|
return <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
function ParentSelectorMenuItem( { parentClientId, parentBlockType } ) {
|
|
51
|
+
const isSmallViewport = useViewportMatch( 'medium', '<' );
|
|
52
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
53
|
+
|
|
54
|
+
// Allows highlighting the parent block outline when focusing or hovering
|
|
55
|
+
// the parent block selector within the child.
|
|
56
|
+
const menuItemRef = useRef();
|
|
57
|
+
const gesturesProps = useShowHoveredOrFocusedGestures( {
|
|
58
|
+
ref: menuItemRef,
|
|
59
|
+
highlightParent: true,
|
|
60
|
+
} );
|
|
61
|
+
|
|
62
|
+
if ( ! isSmallViewport ) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<MenuItem
|
|
68
|
+
{ ...gesturesProps }
|
|
69
|
+
ref={ menuItemRef }
|
|
70
|
+
icon={ <BlockIcon icon={ parentBlockType.icon } /> }
|
|
71
|
+
onClick={ () => selectBlock( parentClientId ) }
|
|
72
|
+
>
|
|
73
|
+
{ sprintf(
|
|
74
|
+
/* translators: %s: Name of the block's parent. */
|
|
75
|
+
__( 'Select parent block (%s)' ),
|
|
76
|
+
parentBlockType.title
|
|
77
|
+
) }
|
|
78
|
+
</MenuItem>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
50
82
|
export function BlockSettingsDropdown( {
|
|
51
83
|
block,
|
|
52
84
|
clientIds,
|
|
@@ -132,8 +164,6 @@ export function BlockSettingsDropdown( {
|
|
|
132
164
|
};
|
|
133
165
|
}, [] );
|
|
134
166
|
const isMatch = __unstableUseShortcutEventMatch();
|
|
135
|
-
|
|
136
|
-
const { selectBlock } = useDispatch( blockEditorStore );
|
|
137
167
|
const hasSelectedBlocks = selectedBlockClientIds.length > 0;
|
|
138
168
|
|
|
139
169
|
const updateSelectionAfterDuplicate = useCallback(
|
|
@@ -175,14 +205,6 @@ export function BlockSettingsDropdown( {
|
|
|
175
205
|
const removeBlockLabel =
|
|
176
206
|
count === 1 ? __( 'Delete' ) : __( 'Delete blocks' );
|
|
177
207
|
|
|
178
|
-
// Allows highlighting the parent block outline when focusing or hovering
|
|
179
|
-
// the parent block selector within the child.
|
|
180
|
-
const selectParentButtonRef = useRef();
|
|
181
|
-
const showParentOutlineGestures = useShowHoveredOrFocusedGestures( {
|
|
182
|
-
ref: selectParentButtonRef,
|
|
183
|
-
highlightParent: true,
|
|
184
|
-
} );
|
|
185
|
-
|
|
186
208
|
// This can occur when the selected block (the parent)
|
|
187
209
|
// displays child blocks within a List View.
|
|
188
210
|
const parentBlockIsSelected =
|
|
@@ -297,30 +319,12 @@ export function BlockSettingsDropdown( {
|
|
|
297
319
|
/>
|
|
298
320
|
{ ! parentBlockIsSelected &&
|
|
299
321
|
!! firstParentClientId && (
|
|
300
|
-
<
|
|
301
|
-
{
|
|
302
|
-
|
|
303
|
-
icon={
|
|
304
|
-
<BlockIcon
|
|
305
|
-
icon={
|
|
306
|
-
parentBlockType.icon
|
|
307
|
-
}
|
|
308
|
-
/>
|
|
309
|
-
}
|
|
310
|
-
onClick={ () =>
|
|
311
|
-
selectBlock(
|
|
312
|
-
firstParentClientId
|
|
313
|
-
)
|
|
322
|
+
<ParentSelectorMenuItem
|
|
323
|
+
parentClientId={
|
|
324
|
+
firstParentClientId
|
|
314
325
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
/* translators: %s: Name of the block's parent. */
|
|
318
|
-
__(
|
|
319
|
-
'Select parent block (%s)'
|
|
320
|
-
),
|
|
321
|
-
parentBlockType.title
|
|
322
|
-
) }
|
|
323
|
-
</MenuItem>
|
|
326
|
+
parentBlockType={ parentBlockType }
|
|
327
|
+
/>
|
|
324
328
|
) }
|
|
325
329
|
{ count === 1 && (
|
|
326
330
|
<BlockHTMLConvertButton
|
|
@@ -22,6 +22,8 @@ import { BlockLockMenuItem, useBlockLock } from '../block-lock';
|
|
|
22
22
|
import { store as blockEditorStore } from '../../store';
|
|
23
23
|
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
24
24
|
|
|
25
|
+
import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
26
|
+
|
|
25
27
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
26
28
|
|
|
27
29
|
const BlockSettingsMenuControlsSlot = ( {
|
|
@@ -44,7 +46,9 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
44
46
|
);
|
|
45
47
|
|
|
46
48
|
const { canLock } = useBlockLock( selectedClientIds[ 0 ] );
|
|
49
|
+
const { canRename } = useBlockRename( selectedBlocks[ 0 ] );
|
|
47
50
|
const showLockButton = selectedClientIds.length === 1 && canLock;
|
|
51
|
+
const showRenameButton = selectedClientIds.length === 1 && canRename;
|
|
48
52
|
|
|
49
53
|
// Check if current selection of blocks is Groupable or Ungroupable
|
|
50
54
|
// and pass this props down to ConvertToGroupButton.
|
|
@@ -84,6 +88,11 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
84
88
|
clientId={ selectedClientIds[ 0 ] }
|
|
85
89
|
/>
|
|
86
90
|
) }
|
|
91
|
+
{ showRenameButton && (
|
|
92
|
+
<BlockRenameControl
|
|
93
|
+
clientId={ selectedClientIds[ 0 ] }
|
|
94
|
+
/>
|
|
95
|
+
) }
|
|
87
96
|
{ fills }
|
|
88
97
|
{ fillProps?.canMove && ! fillProps?.onlyBlock && (
|
|
89
98
|
<MenuItem
|
|
@@ -19,14 +19,16 @@ import StylePreview from './preview';
|
|
|
19
19
|
import containerStyles from './style.scss';
|
|
20
20
|
import { store as blockEditorStore } from '../../store';
|
|
21
21
|
|
|
22
|
+
const EMPTY_ARRAY = [];
|
|
23
|
+
|
|
22
24
|
function BlockStyles( { clientId, url } ) {
|
|
23
25
|
const selector = ( select ) => {
|
|
24
26
|
const { getBlock } = select( blockEditorStore );
|
|
25
27
|
const { getBlockStyles } = select( blocksStore );
|
|
26
28
|
const block = getBlock( clientId );
|
|
27
29
|
return {
|
|
28
|
-
styles: getBlockStyles( block
|
|
29
|
-
className: block
|
|
30
|
+
styles: getBlockStyles( block?.name ) || EMPTY_ARRAY,
|
|
31
|
+
className: block?.attributes?.className || '',
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
|
|
@@ -12,17 +12,6 @@
|
|
|
12
12
|
display: block;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// Overrides for InserterPreviewPanel.
|
|
16
|
-
.block-editor-inserter__preview-container {
|
|
17
|
-
left: auto;
|
|
18
|
-
right: auto;
|
|
19
|
-
top: auto;
|
|
20
|
-
position: static;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.block-editor-block-card__title.block-editor-block-card__title {
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
26
15
|
.block-editor-block-icon {
|
|
27
16
|
display: none;
|
|
28
17
|
}
|
|
@@ -25,7 +25,9 @@ exports[`BlockSwitcherDropdownMenu should render disabled block switcher with mu
|
|
|
25
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
26
26
|
>
|
|
27
27
|
<path
|
|
28
|
-
|
|
28
|
+
clip-rule="evenodd"
|
|
29
|
+
d="M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"
|
|
30
|
+
fill-rule="evenodd"
|
|
29
31
|
/>
|
|
30
32
|
</svg>
|
|
31
33
|
</span>
|
|
@@ -212,10 +212,7 @@ const BlockActionsMenu = ( {
|
|
|
212
212
|
},
|
|
213
213
|
convertToRegularBlocks: {
|
|
214
214
|
id: 'convertToRegularBlocksOption',
|
|
215
|
-
label:
|
|
216
|
-
innerBlockCount > 1
|
|
217
|
-
? __( 'Detach patterns' )
|
|
218
|
-
: __( 'Detach pattern' ),
|
|
215
|
+
label: __( 'Detach' ),
|
|
219
216
|
value: 'convertToRegularBlocksOption',
|
|
220
217
|
onSelect: () => {
|
|
221
218
|
/* translators: %s: name of the synced block */
|