@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/store/reducer.js
CHANGED
|
@@ -283,6 +283,7 @@ const withBlockTree =
|
|
|
283
283
|
false
|
|
284
284
|
);
|
|
285
285
|
break;
|
|
286
|
+
case 'SYNC_DERIVED_BLOCK_ATTRIBUTES':
|
|
286
287
|
case 'UPDATE_BLOCK_ATTRIBUTES': {
|
|
287
288
|
newState.tree = new Map( newState.tree );
|
|
288
289
|
action.clientIds.forEach( ( clientId ) => {
|
|
@@ -456,6 +457,12 @@ function withPersistentBlockChange( reducer ) {
|
|
|
456
457
|
return ( state, action ) => {
|
|
457
458
|
let nextState = reducer( state, action );
|
|
458
459
|
|
|
460
|
+
if ( action.type === 'SYNC_DERIVED_BLOCK_ATTRIBUTES' ) {
|
|
461
|
+
return nextState.isPersistentChange
|
|
462
|
+
? { ...nextState, isPersistentChange: false }
|
|
463
|
+
: nextState;
|
|
464
|
+
}
|
|
465
|
+
|
|
459
466
|
const isExplicitPersistentChange =
|
|
460
467
|
action.type === 'MARK_LAST_CHANGE_AS_PERSISTENT' ||
|
|
461
468
|
markNextChangeAsNotPersistent;
|
|
@@ -860,6 +867,7 @@ export const blocks = pipe(
|
|
|
860
867
|
return newState;
|
|
861
868
|
}
|
|
862
869
|
|
|
870
|
+
case 'SYNC_DERIVED_BLOCK_ATTRIBUTES':
|
|
863
871
|
case 'UPDATE_BLOCK_ATTRIBUTES': {
|
|
864
872
|
// Avoid a state change if none of the block IDs are known.
|
|
865
873
|
if ( action.clientIds.every( ( id ) => ! state.get( id ) ) ) {
|
package/src/store/selectors.js
CHANGED
|
@@ -26,6 +26,11 @@ import { createRegistrySelector } from '@wordpress/data';
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
+
import {
|
|
30
|
+
getUserPatterns,
|
|
31
|
+
checkAllowListRecursive,
|
|
32
|
+
checkAllowList,
|
|
33
|
+
} from './utils';
|
|
29
34
|
import { orderBy } from '../utils/sorting';
|
|
30
35
|
|
|
31
36
|
/**
|
|
@@ -1480,22 +1485,6 @@ export function getTemplateLock( state, rootClientId ) {
|
|
|
1480
1485
|
return getBlockListSettings( state, rootClientId )?.templateLock ?? false;
|
|
1481
1486
|
}
|
|
1482
1487
|
|
|
1483
|
-
const checkAllowList = ( list, item, defaultResult = null ) => {
|
|
1484
|
-
if ( typeof list === 'boolean' ) {
|
|
1485
|
-
return list;
|
|
1486
|
-
}
|
|
1487
|
-
if ( Array.isArray( list ) ) {
|
|
1488
|
-
// TODO: when there is a canonical way to detect that we are editing a post
|
|
1489
|
-
// the following check should be changed to something like:
|
|
1490
|
-
// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
|
|
1491
|
-
if ( list.includes( 'core/post-content' ) && item === null ) {
|
|
1492
|
-
return true;
|
|
1493
|
-
}
|
|
1494
|
-
return list.includes( item );
|
|
1495
|
-
}
|
|
1496
|
-
return defaultResult;
|
|
1497
|
-
};
|
|
1498
|
-
|
|
1499
1488
|
/**
|
|
1500
1489
|
* Determines if the given block type is allowed to be inserted into the block list.
|
|
1501
1490
|
* This function is not exported and not memoized because using a memoized selector
|
|
@@ -2248,57 +2237,6 @@ export const __experimentalGetDirectInsertBlock = createSelector(
|
|
|
2248
2237
|
]
|
|
2249
2238
|
);
|
|
2250
2239
|
|
|
2251
|
-
const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
|
|
2252
|
-
if ( typeof allowedBlockTypes === 'boolean' ) {
|
|
2253
|
-
return allowedBlockTypes;
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
const blocksQueue = [ ...blocks ];
|
|
2257
|
-
while ( blocksQueue.length > 0 ) {
|
|
2258
|
-
const block = blocksQueue.shift();
|
|
2259
|
-
|
|
2260
|
-
const isAllowed = checkAllowList(
|
|
2261
|
-
allowedBlockTypes,
|
|
2262
|
-
block.name || block.blockName,
|
|
2263
|
-
true
|
|
2264
|
-
);
|
|
2265
|
-
if ( ! isAllowed ) {
|
|
2266
|
-
return false;
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
block.innerBlocks?.forEach( ( innerBlock ) => {
|
|
2270
|
-
blocksQueue.push( innerBlock );
|
|
2271
|
-
} );
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
return true;
|
|
2275
|
-
};
|
|
2276
|
-
|
|
2277
|
-
function getUserPatterns( state ) {
|
|
2278
|
-
const userPatterns =
|
|
2279
|
-
state?.settings?.__experimentalReusableBlocks ?? EMPTY_ARRAY;
|
|
2280
|
-
const userPatternCategories =
|
|
2281
|
-
state?.settings?.__experimentalUserPatternCategories ?? [];
|
|
2282
|
-
const categories = new Map();
|
|
2283
|
-
userPatternCategories.forEach( ( userCategory ) =>
|
|
2284
|
-
categories.set( userCategory.id, userCategory )
|
|
2285
|
-
);
|
|
2286
|
-
return userPatterns.map( ( userPattern ) => {
|
|
2287
|
-
return {
|
|
2288
|
-
name: `core/block/${ userPattern.id }`,
|
|
2289
|
-
id: userPattern.id,
|
|
2290
|
-
title: userPattern.title.raw,
|
|
2291
|
-
categories: userPattern.wp_pattern_category.map( ( catId ) =>
|
|
2292
|
-
categories && categories.get( catId )
|
|
2293
|
-
? categories.get( catId ).slug
|
|
2294
|
-
: catId
|
|
2295
|
-
),
|
|
2296
|
-
content: userPattern.content.raw,
|
|
2297
|
-
syncStatus: userPattern.wp_pattern_sync_status,
|
|
2298
|
-
};
|
|
2299
|
-
} );
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
2240
|
export const __experimentalUserPatternCategories = createSelector(
|
|
2303
2241
|
( state ) => {
|
|
2304
2242
|
return state?.settings?.__experimentalUserPatternCategories;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
|
|
5
|
+
|
|
6
|
+
const EMPTY_ARRAY = [];
|
|
7
|
+
|
|
8
|
+
export function getUserPatterns( state ) {
|
|
9
|
+
const userPatterns =
|
|
10
|
+
state?.settings?.__experimentalReusableBlocks ?? EMPTY_ARRAY;
|
|
11
|
+
const userPatternCategories =
|
|
12
|
+
state?.settings?.__experimentalUserPatternCategories ?? [];
|
|
13
|
+
const categories = new Map();
|
|
14
|
+
userPatternCategories.forEach( ( userCategory ) =>
|
|
15
|
+
categories.set( userCategory.id, userCategory )
|
|
16
|
+
);
|
|
17
|
+
return userPatterns.map( ( userPattern ) => {
|
|
18
|
+
return {
|
|
19
|
+
name: `core/block/${ userPattern.id }`,
|
|
20
|
+
id: userPattern.id,
|
|
21
|
+
type: PATTERN_TYPES.user,
|
|
22
|
+
title: userPattern.title.raw,
|
|
23
|
+
categories: userPattern.wp_pattern_category.map( ( catId ) =>
|
|
24
|
+
categories && categories.get( catId )
|
|
25
|
+
? categories.get( catId ).slug
|
|
26
|
+
: catId
|
|
27
|
+
),
|
|
28
|
+
content: userPattern.content.raw,
|
|
29
|
+
syncStatus: userPattern.wp_pattern_sync_status,
|
|
30
|
+
};
|
|
31
|
+
} );
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const checkAllowList = ( list, item, defaultResult = null ) => {
|
|
35
|
+
if ( typeof list === 'boolean' ) {
|
|
36
|
+
return list;
|
|
37
|
+
}
|
|
38
|
+
if ( Array.isArray( list ) ) {
|
|
39
|
+
// TODO: when there is a canonical way to detect that we are editing a post
|
|
40
|
+
// the following check should be changed to something like:
|
|
41
|
+
// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
|
|
42
|
+
if ( list.includes( 'core/post-content' ) && item === null ) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return list.includes( item );
|
|
46
|
+
}
|
|
47
|
+
return defaultResult;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {
|
|
51
|
+
if ( typeof allowedBlockTypes === 'boolean' ) {
|
|
52
|
+
return allowedBlockTypes;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const blocksQueue = [ ...blocks ];
|
|
56
|
+
while ( blocksQueue.length > 0 ) {
|
|
57
|
+
const block = blocksQueue.shift();
|
|
58
|
+
|
|
59
|
+
const isAllowed = checkAllowList(
|
|
60
|
+
allowedBlockTypes,
|
|
61
|
+
block.name || block.blockName,
|
|
62
|
+
true
|
|
63
|
+
);
|
|
64
|
+
if ( ! isAllowed ) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
block.innerBlocks?.forEach( ( innerBlock ) => {
|
|
69
|
+
blocksQueue.push( innerBlock );
|
|
70
|
+
} );
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return true;
|
|
74
|
+
};
|
package/src/style.scss
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
@import "./components/block-draggable/style.scss";
|
|
11
11
|
@import "./components/block-mover/style.scss";
|
|
12
12
|
@import "./components/block-navigation/style.scss";
|
|
13
|
-
@import "./components/block-parent-selector/style.scss";
|
|
14
13
|
@import "./components/block-patterns-list/style.scss";
|
|
15
14
|
@import "./components/block-patterns-paging/style.scss";
|
|
16
15
|
@import "./components/block-popover/style.scss";
|
|
17
16
|
@import "./components/block-preview/style.scss";
|
|
17
|
+
@import "./components/block-rename/style.scss";
|
|
18
18
|
@import "./components/block-settings-menu/style.scss";
|
|
19
19
|
@import "./components/block-styles/style.scss";
|
|
20
20
|
@import "./components/block-switcher/style.scss";
|
|
@@ -56,11 +56,9 @@
|
|
|
56
56
|
@import "./hooks/padding.scss";
|
|
57
57
|
@import "./hooks/position.scss";
|
|
58
58
|
@import "./hooks/typography.scss";
|
|
59
|
-
@import "./hooks/block-rename-ui.scss";
|
|
60
59
|
|
|
61
60
|
@import "./components/block-toolbar/style.scss";
|
|
62
61
|
@import "./components/inserter/style.scss";
|
|
63
|
-
@import "./components/preview-options/style.scss";
|
|
64
62
|
@import "./components/spacing-sizes-control/style.scss";
|
|
65
63
|
|
|
66
64
|
@include wordpress-admin-schemes();
|
package/src/utils/object.js
CHANGED
|
@@ -2,28 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { paramCase } from 'change-case';
|
|
5
|
-
import memoize from 'memize';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Converts a path to an array of its fragments.
|
|
9
|
-
* Supports strings, numbers and arrays:
|
|
10
|
-
*
|
|
11
|
-
* 'foo' => [ 'foo' ]
|
|
12
|
-
* 2 => [ '2' ]
|
|
13
|
-
* [ 'foo', 'bar' ] => [ 'foo', 'bar' ]
|
|
14
|
-
*
|
|
15
|
-
* @param {string|number|Array} path Path
|
|
16
|
-
* @return {Array} Normalized path.
|
|
17
|
-
*/
|
|
18
|
-
function normalizePath( path ) {
|
|
19
|
-
if ( Array.isArray( path ) ) {
|
|
20
|
-
return path;
|
|
21
|
-
} else if ( typeof path === 'number' ) {
|
|
22
|
-
return [ path.toString() ];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return [ path ];
|
|
26
|
-
}
|
|
27
5
|
|
|
28
6
|
/**
|
|
29
7
|
* Converts any string to kebab case.
|
|
@@ -55,33 +33,6 @@ export function kebabCase( str ) {
|
|
|
55
33
|
} );
|
|
56
34
|
}
|
|
57
35
|
|
|
58
|
-
/**
|
|
59
|
-
* Clones an object.
|
|
60
|
-
* Arrays are also cloned as arrays.
|
|
61
|
-
* Non-object values are returned unchanged.
|
|
62
|
-
*
|
|
63
|
-
* @param {*} object Object to clone.
|
|
64
|
-
* @return {*} Cloned object, or original literal non-object value.
|
|
65
|
-
*/
|
|
66
|
-
function cloneObject( object ) {
|
|
67
|
-
if ( Array.isArray( object ) ) {
|
|
68
|
-
return object.map( cloneObject );
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if ( object && typeof object === 'object' ) {
|
|
72
|
-
return {
|
|
73
|
-
...Object.fromEntries(
|
|
74
|
-
Object.entries( object ).map( ( [ key, value ] ) => [
|
|
75
|
-
key,
|
|
76
|
-
cloneObject( value ),
|
|
77
|
-
] )
|
|
78
|
-
),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return object;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
36
|
/**
|
|
86
37
|
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
|
|
87
38
|
* new object. Treats nullish initial values as empty objects. Clones any
|
|
@@ -93,27 +44,25 @@ function cloneObject( object ) {
|
|
|
93
44
|
* @return {Object} Cloned object with the new value set.
|
|
94
45
|
*/
|
|
95
46
|
export function setImmutably( object, path, value ) {
|
|
96
|
-
|
|
97
|
-
|
|
47
|
+
// Normalize path
|
|
48
|
+
path = Array.isArray( path ) ? [ ...path ] : [ path ];
|
|
98
49
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if ( Number.isInteger( path[ i + 1 ] ) ) {
|
|
102
|
-
acc[ key ] = [];
|
|
103
|
-
} else {
|
|
104
|
-
acc[ key ] = {};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if ( i === normalizedPath.length - 1 ) {
|
|
108
|
-
acc[ key ] = value;
|
|
109
|
-
}
|
|
110
|
-
return acc[ key ];
|
|
111
|
-
}, newObject );
|
|
50
|
+
// Shallowly clone the base of the object
|
|
51
|
+
object = Array.isArray( object ) ? [ ...object ] : { ...object };
|
|
112
52
|
|
|
113
|
-
|
|
114
|
-
|
|
53
|
+
const leaf = path.pop();
|
|
54
|
+
|
|
55
|
+
// Traverse object from root to leaf, shallowly cloning at each level
|
|
56
|
+
let prev = object;
|
|
57
|
+
for ( const key of path ) {
|
|
58
|
+
const lvl = prev[ key ];
|
|
59
|
+
prev = prev[ key ] = Array.isArray( lvl ) ? [ ...lvl ] : { ...lvl };
|
|
60
|
+
}
|
|
115
61
|
|
|
116
|
-
|
|
62
|
+
prev[ leaf ] = value;
|
|
63
|
+
|
|
64
|
+
return object;
|
|
65
|
+
}
|
|
117
66
|
|
|
118
67
|
/**
|
|
119
68
|
* Helper util to return a value from a certain path of the object.
|
|
@@ -128,9 +77,9 @@ const stringToPath = memoize( ( path ) => path.split( '.' ) );
|
|
|
128
77
|
* @return {*} Value of the object property at the specified path.
|
|
129
78
|
*/
|
|
130
79
|
export const getValueFromObjectPath = ( object, path, defaultValue ) => {
|
|
131
|
-
const
|
|
80
|
+
const arrayPath = Array.isArray( path ) ? path : path.split( '.' );
|
|
132
81
|
let value = object;
|
|
133
|
-
|
|
82
|
+
arrayPath.forEach( ( fieldName ) => {
|
|
134
83
|
value = value?.[ fieldName ];
|
|
135
84
|
} );
|
|
136
85
|
return value ?? defaultValue;
|
package/src/utils/selection.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { RichTextData } from '@wordpress/rich-text';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* A robust way to retain selection position through various
|
|
3
8
|
* transforms is to insert a special character at the position and
|
|
@@ -19,8 +24,10 @@ export function retrieveSelectedAttribute( blockAttributes ) {
|
|
|
19
24
|
return Object.keys( blockAttributes ).find( ( name ) => {
|
|
20
25
|
const value = blockAttributes[ name ];
|
|
21
26
|
return (
|
|
22
|
-
typeof value === 'string' &&
|
|
23
|
-
|
|
27
|
+
( typeof value === 'string' || value instanceof RichTextData ) &&
|
|
28
|
+
// To do: refactor this to use rich text's selection instead, so we
|
|
29
|
+
// no longer have to use on this hack inserting a special character.
|
|
30
|
+
value.toString().indexOf( START_OF_SELECTED_AREA ) !== -1
|
|
24
31
|
);
|
|
25
32
|
} );
|
|
26
33
|
}
|
|
@@ -4,6 +4,55 @@
|
|
|
4
4
|
import transformStyles from '../transform-styles';
|
|
5
5
|
|
|
6
6
|
describe( 'transformStyles', () => {
|
|
7
|
+
describe( 'error handling', () => {
|
|
8
|
+
beforeEach( () => {
|
|
9
|
+
// Intentionally suppress the expected console errors and warnings to reduce
|
|
10
|
+
// noise in the test output.
|
|
11
|
+
jest.spyOn( console, 'warn' ).mockImplementation( jest.fn() );
|
|
12
|
+
} );
|
|
13
|
+
|
|
14
|
+
it( 'should not throw error in case of invalid css', () => {
|
|
15
|
+
const run = () =>
|
|
16
|
+
transformStyles(
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
css: 'h1 { color: red;', // invalid CSS
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'.my-namespace'
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect( run ).not.toThrow();
|
|
26
|
+
expect( console ).toHaveWarned();
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'should warn invalid css in the console', () => {
|
|
30
|
+
const run = () =>
|
|
31
|
+
transformStyles(
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
css: 'h1 { color: red; }', // valid CSS
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
css: 'h1 { color: red;', // invalid CSS
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
'.my-namespace'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const [ validCSS, invalidCSS ] = run();
|
|
44
|
+
|
|
45
|
+
expect( validCSS ).toBe( '.my-namespace h1 { color: red; }' );
|
|
46
|
+
expect( invalidCSS ).toBe( null );
|
|
47
|
+
|
|
48
|
+
expect( console ).toHaveWarnedWith(
|
|
49
|
+
'wp.blockEditor.transformStyles Failed to transform CSS.',
|
|
50
|
+
'<css input>:1:1: Unclosed block\n> 1 | h1 { color: red;\n | ^'
|
|
51
|
+
// ^^^^ In PostCSS, a tab is equal four spaces
|
|
52
|
+
);
|
|
53
|
+
} );
|
|
54
|
+
} );
|
|
55
|
+
|
|
7
56
|
describe( 'selector wrap', () => {
|
|
8
57
|
it( 'should wrap regular selectors', () => {
|
|
9
58
|
const input = `h1 { color: red; }`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import postcss from 'postcss';
|
|
4
|
+
import postcss, { CssSyntaxError } from 'postcss';
|
|
5
5
|
import wrap from 'postcss-prefixwrap';
|
|
6
6
|
import rebaseUrl from 'postcss-urlrebase';
|
|
7
7
|
|
|
@@ -19,18 +19,44 @@ import rebaseUrl from 'postcss-urlrebase';
|
|
|
19
19
|
*/
|
|
20
20
|
const transformStyles = ( styles, wrapperSelector = '' ) => {
|
|
21
21
|
return styles.map( ( { css, ignoredSelectors = [], baseURL } ) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
// When there is no wrapper selector or base URL, there is no need
|
|
23
|
+
// to transform the CSS. This is most cases because in the default
|
|
24
|
+
// iframed editor, no wrapping is needed, and not many styles
|
|
25
|
+
// provide a base URL.
|
|
26
|
+
if ( ! wrapperSelector && ! baseURL ) {
|
|
27
|
+
return css;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
return postcss(
|
|
32
|
+
[
|
|
33
|
+
wrapperSelector &&
|
|
34
|
+
wrap( wrapperSelector, {
|
|
35
|
+
ignoredSelectors: [
|
|
36
|
+
...ignoredSelectors,
|
|
37
|
+
wrapperSelector,
|
|
38
|
+
],
|
|
39
|
+
} ),
|
|
40
|
+
baseURL && rebaseUrl( { rootUrl: baseURL } ),
|
|
41
|
+
].filter( Boolean )
|
|
42
|
+
).process( css, {} ).css; // use sync PostCSS API
|
|
43
|
+
} catch ( error ) {
|
|
44
|
+
if ( error instanceof CssSyntaxError ) {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.warn(
|
|
47
|
+
'wp.blockEditor.transformStyles Failed to transform CSS.',
|
|
48
|
+
error.message + '\n' + error.showSourceCode( false )
|
|
49
|
+
);
|
|
50
|
+
} else {
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.warn(
|
|
53
|
+
'wp.blockEditor.transformStyles Failed to transform CSS.',
|
|
54
|
+
error
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
34
60
|
} );
|
|
35
61
|
};
|
|
36
62
|
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useBlockClassNames = useBlockClassNames;
|
|
8
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
var _blocks = require("@wordpress/blocks");
|
|
11
|
-
var _store = require("../../../store");
|
|
12
|
-
/**
|
|
13
|
-
* External dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns the class names used for the different states of the block.
|
|
26
|
-
*
|
|
27
|
-
* @param {string} clientId The block client ID.
|
|
28
|
-
*
|
|
29
|
-
* @return {string} The class names.
|
|
30
|
-
*/
|
|
31
|
-
function useBlockClassNames(clientId) {
|
|
32
|
-
return (0, _data.useSelect)(select => {
|
|
33
|
-
const {
|
|
34
|
-
isBlockBeingDragged,
|
|
35
|
-
isBlockHighlighted,
|
|
36
|
-
isBlockSelected,
|
|
37
|
-
isBlockMultiSelected,
|
|
38
|
-
getBlockName,
|
|
39
|
-
getSettings,
|
|
40
|
-
hasSelectedInnerBlock,
|
|
41
|
-
isTyping,
|
|
42
|
-
__unstableIsFullySelected,
|
|
43
|
-
__unstableSelectionHasUnmergeableBlock
|
|
44
|
-
} = select(_store.store);
|
|
45
|
-
const {
|
|
46
|
-
outlineMode
|
|
47
|
-
} = getSettings();
|
|
48
|
-
const isDragging = isBlockBeingDragged(clientId);
|
|
49
|
-
const isSelected = isBlockSelected(clientId);
|
|
50
|
-
const name = getBlockName(clientId);
|
|
51
|
-
const checkDeep = true;
|
|
52
|
-
// "ancestor" is the more appropriate label due to "deep" check.
|
|
53
|
-
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
|
|
54
|
-
const isMultiSelected = isBlockMultiSelected(clientId);
|
|
55
|
-
return (0, _classnames.default)({
|
|
56
|
-
'is-selected': isSelected,
|
|
57
|
-
'is-highlighted': isBlockHighlighted(clientId),
|
|
58
|
-
'is-multi-selected': isMultiSelected,
|
|
59
|
-
'is-partially-selected': isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
|
|
60
|
-
'is-reusable': (0, _blocks.isReusableBlock)((0, _blocks.getBlockType)(name)),
|
|
61
|
-
'is-dragging': isDragging,
|
|
62
|
-
'has-child-selected': isAncestorOfSelectedBlock,
|
|
63
|
-
'remove-outline': isSelected && outlineMode && isTyping()
|
|
64
|
-
});
|
|
65
|
-
}, [clientId]);
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=use-block-class-names.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_blocks","_store","useBlockClassNames","clientId","useSelect","select","isBlockBeingDragged","isBlockHighlighted","isBlockSelected","isBlockMultiSelected","getBlockName","getSettings","hasSelectedInnerBlock","isTyping","__unstableIsFullySelected","__unstableSelectionHasUnmergeableBlock","blockEditorStore","outlineMode","isDragging","isSelected","name","checkDeep","isAncestorOfSelectedBlock","isMultiSelected","classnames","isReusableBlock","getBlockType"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-class-names.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isReusableBlock, getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the class names used for the different states of the block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The class names.\n */\nexport function useBlockClassNames( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tisTyping,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isDragging = isBlockBeingDragged( clientId );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst name = getBlockName( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\t// \"ancestor\" is the more appropriate label due to \"deep\" check.\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\treturn classnames( {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected':\n\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\t'is-reusable': isReusableBlock( getBlockType( name ) ),\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t'remove-outline': isSelected && outlineMode && isTyping(),\n\t\t\t} );\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,kBAAkBA,CAAEC,QAAQ,EAAG;EAC9C,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAM;IACb,MAAM;MACLC,mBAAmB;MACnBC,kBAAkB;MAClBC,eAAe;MACfC,oBAAoB;MACpBC,YAAY;MACZC,WAAW;MACXC,qBAAqB;MACrBC,QAAQ;MACRC,yBAAyB;MACzBC;IACD,CAAC,GAAGV,MAAM,CAAEW,YAAiB,CAAC;IAC9B,MAAM;MAAEC;IAAY,CAAC,GAAGN,WAAW,CAAC,CAAC;IACrC,MAAMO,UAAU,GAAGZ,mBAAmB,CAAEH,QAAS,CAAC;IAClD,MAAMgB,UAAU,GAAGX,eAAe,CAAEL,QAAS,CAAC;IAC9C,MAAMiB,IAAI,GAAGV,YAAY,CAAEP,QAAS,CAAC;IACrC,MAAMkB,SAAS,GAAG,IAAI;IACtB;IACA,MAAMC,yBAAyB,GAAGV,qBAAqB,CACtDT,QAAQ,EACRkB,SACD,CAAC;IACD,MAAME,eAAe,GAAGd,oBAAoB,CAAEN,QAAS,CAAC;IACxD,OAAO,IAAAqB,mBAAU,EAAE;MAClB,aAAa,EAAEL,UAAU;MACzB,gBAAgB,EAAEZ,kBAAkB,CAAEJ,QAAS,CAAC;MAChD,mBAAmB,EAAEoB,eAAe;MACpC,uBAAuB,EACtBA,eAAe,IACf,CAAET,yBAAyB,CAAC,CAAC,IAC7B,CAAEC,sCAAsC,CAAC,CAAC;MAC3C,aAAa,EAAE,IAAAU,uBAAe,EAAE,IAAAC,oBAAY,EAAEN,IAAK,CAAE,CAAC;MACtD,aAAa,EAAEF,UAAU;MACzB,oBAAoB,EAAEI,yBAAyB;MAC/C,gBAAgB,EAAEH,UAAU,IAAIF,WAAW,IAAIJ,QAAQ,CAAC;IACzD,CAAE,CAAC;EACJ,CAAC,EACD,CAAEV,QAAQ,CACX,CAAC;AACF"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useBlockCustomClassName = useBlockCustomClassName;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _blocks = require("@wordpress/blocks");
|
|
9
|
-
var _store = require("../../../store");
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Returns the custom class name if the block is a light block.
|
|
20
|
-
*
|
|
21
|
-
* @param {string} clientId The block client ID.
|
|
22
|
-
*
|
|
23
|
-
* @return {string} The custom class name.
|
|
24
|
-
*/
|
|
25
|
-
function useBlockCustomClassName(clientId) {
|
|
26
|
-
// It's good for this to be a separate selector because it will be executed
|
|
27
|
-
// on every attribute change, while the other selectors are not re-evaluated
|
|
28
|
-
// as much.
|
|
29
|
-
return (0, _data.useSelect)(select => {
|
|
30
|
-
const {
|
|
31
|
-
getBlockName,
|
|
32
|
-
getBlockAttributes
|
|
33
|
-
} = select(_store.store);
|
|
34
|
-
const attributes = getBlockAttributes(clientId);
|
|
35
|
-
if (!attributes?.className) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const blockType = (0, _blocks.getBlockType)(getBlockName(clientId));
|
|
39
|
-
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
40
|
-
if (!hasLightBlockWrapper) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
return attributes.className;
|
|
44
|
-
}, [clientId]);
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=use-block-custom-class-name.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_store","useBlockCustomClassName","clientId","useSelect","select","getBlockName","getBlockAttributes","blockEditorStore","attributes","className","blockType","getBlockType","hasLightBlockWrapper","apiVersion"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-custom-class-name.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the custom class name if the block is a light block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The custom class name.\n */\nexport function useBlockCustomClassName( clientId ) {\n\t// It's good for this to be a separate selector because it will be executed\n\t// on every attribute change, while the other selectors are not re-evaluated\n\t// as much.\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\n\t\t\tif ( ! attributes?.className ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst blockType = getBlockType( getBlockName( clientId ) );\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\n\t\t\tif ( ! hasLightBlockWrapper ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn attributes.className;\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,uBAAuBA,CAAEC,QAAQ,EAAG;EACnD;EACA;EACA;EACA,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAM;IACb,MAAM;MAAEC,YAAY;MAAEC;IAAmB,CAAC,GACzCF,MAAM,CAAEG,YAAiB,CAAC;IAC3B,MAAMC,UAAU,GAAGF,kBAAkB,CAAEJ,QAAS,CAAC;IAEjD,IAAK,CAAEM,UAAU,EAAEC,SAAS,EAAG;MAC9B;IACD;IAEA,MAAMC,SAAS,GAAG,IAAAC,oBAAY,EAAEN,YAAY,CAAEH,QAAS,CAAE,CAAC;IAC1D,MAAMU,oBAAoB,GAAGF,SAAS,EAAEG,UAAU,GAAG,CAAC;IAEtD,IAAK,CAAED,oBAAoB,EAAG;MAC7B;IACD;IAEA,OAAOJ,UAAU,CAACC,SAAS;EAC5B,CAAC,EACD,CAAEP,QAAQ,CACX,CAAC;AACF"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useBlockDefaultClassName = useBlockDefaultClassName;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _blocks = require("@wordpress/blocks");
|
|
9
|
-
var _store = require("../../../store");
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Returns the default class name if the block is a light block and it supports
|
|
20
|
-
* `className`.
|
|
21
|
-
*
|
|
22
|
-
* @param {string} clientId The block client ID.
|
|
23
|
-
*
|
|
24
|
-
* @return {string} The class name, e.g. `wp-block-paragraph`.
|
|
25
|
-
*/
|
|
26
|
-
function useBlockDefaultClassName(clientId) {
|
|
27
|
-
return (0, _data.useSelect)(select => {
|
|
28
|
-
const name = select(_store.store).getBlockName(clientId);
|
|
29
|
-
const blockType = (0, _blocks.getBlockType)(name);
|
|
30
|
-
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
31
|
-
if (!hasLightBlockWrapper) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
return (0, _blocks.getBlockDefaultClassName)(name);
|
|
35
|
-
}, [clientId]);
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=use-block-default-class-name.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_store","useBlockDefaultClassName","clientId","useSelect","select","name","blockEditorStore","getBlockName","blockType","getBlockType","hasLightBlockWrapper","apiVersion","getBlockDefaultClassName"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-default-class-name.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType, getBlockDefaultClassName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the default class name if the block is a light block and it supports\n * `className`.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The class name, e.g. `wp-block-paragraph`.\n */\nexport function useBlockDefaultClassName( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst name = select( blockEditorStore ).getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( name );\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\n\t\t\tif ( ! hasLightBlockWrapper ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn getBlockDefaultClassName( name );\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,wBAAwBA,CAAEC,QAAQ,EAAG;EACpD,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAM;IACb,MAAMC,IAAI,GAAGD,MAAM,CAAEE,YAAiB,CAAC,CAACC,YAAY,CAAEL,QAAS,CAAC;IAChE,MAAMM,SAAS,GAAG,IAAAC,oBAAY,EAAEJ,IAAK,CAAC;IACtC,MAAMK,oBAAoB,GAAGF,SAAS,EAAEG,UAAU,GAAG,CAAC;IAEtD,IAAK,CAAED,oBAAoB,EAAG;MAC7B;IACD;IAEA,OAAO,IAAAE,gCAAwB,EAAEP,IAAK,CAAC;EACxC,CAAC,EACD,CAAEH,QAAQ,CACX,CAAC;AACF"}
|