@wordpress/block-editor 12.15.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 +2 -0
- package/README.md +9 -4
- 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 +14 -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-patterns-list/index.js +1 -1
- 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/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- 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-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/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.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/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.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/index.native.js +8 -0
- package/build/components/index.native.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/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/navigable-toolbar/index.js +2 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -62
- 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 +9 -16
- 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 +7 -34
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +5 -1
- 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/use-block-drop-zone/index.js +70 -8
- package/build/components/use-block-drop-zone/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 +14 -0
- 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 +18 -22
- 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 +24 -38
- 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 -14
- 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 +16 -101
- 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/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 -60
- 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-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 +14 -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-patterns-list/index.js +1 -1
- 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/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- 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-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/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.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/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.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/index.native.js +1 -0
- package/build-module/components/index.native.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/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/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 -62
- 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 +10 -18
- 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 +7 -34
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +5 -1
- 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/use-block-drop-zone/index.js +69 -8
- package/build-module/components/use-block-drop-zone/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 +13 -1
- 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 +17 -21
- 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 +20 -39
- 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 -14
- 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 +13 -98
- 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/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 -53
- 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-style/style-rtl.css +113 -293
- package/build-style/style.css +113 -293
- 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 +18 -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-patterns-list/index.js +1 -1
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- 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/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.native.js +2 -1
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- 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/index.native.js +1 -0
- package/src/components/inner-blocks/README.md +13 -2
- 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/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/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +2 -2
- package/src/components/preview-options/index.js +6 -86
- 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 +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +7 -48
- package/src/components/rich-text/use-input-rules.js +6 -1
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/use-block-drop-zone/index.js +114 -14
- 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 +15 -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 +23 -37
- 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 +20 -47
- 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 -14
- package/src/hooks/index.native.js +6 -3
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +13 -102
- 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/align.js +1 -178
- package/src/hooks/typography.js +20 -16
- package/src/hooks/utils.js +187 -6
- 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 -69
- package/src/store/utils.js +74 -0
- package/src/style.scss +0 -2
- package/src/utils/object.js +18 -69
- package/src/utils/selection.js +9 -2
- 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-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/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/test/color.js +0 -112
|
@@ -8,7 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { useContext } from '@wordpress/element';
|
|
10
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
-
import { __unstableGetBlockProps as getBlockProps, getBlockType, store as blocksStore } from '@wordpress/blocks';
|
|
11
|
+
import { __unstableGetBlockProps as getBlockProps, getBlockType, isReusableBlock, getBlockDefaultClassName, store as blocksStore } from '@wordpress/blocks';
|
|
12
12
|
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import warning from '@wordpress/warning';
|
|
@@ -21,17 +21,12 @@ import { BlockListBlockContext } from '../block-list-block-context';
|
|
|
21
21
|
import { useFocusFirstElement } from './use-focus-first-element';
|
|
22
22
|
import { useIsHovered } from './use-is-hovered';
|
|
23
23
|
import { useBlockEditContext } from '../../block-edit/context';
|
|
24
|
-
import { useBlockClassNames } from './use-block-class-names';
|
|
25
|
-
import { useBlockDefaultClassName } from './use-block-default-class-name';
|
|
26
|
-
import { useBlockCustomClassName } from './use-block-custom-class-name';
|
|
27
|
-
import { useBlockMovingModeClassNames } from './use-block-moving-mode-class-names';
|
|
28
24
|
import { useFocusHandler } from './use-focus-handler';
|
|
29
25
|
import { useEventHandlers } from './use-selected-block-event-handlers';
|
|
30
26
|
import { useNavModeExit } from './use-nav-mode-exit';
|
|
31
27
|
import { useBlockRefProvider } from './use-block-refs';
|
|
32
28
|
import { useIntersectionObserver } from './use-intersection-observer';
|
|
33
29
|
import { store as blockEditorStore } from '../../../store';
|
|
34
|
-
import useBlockOverlayActive from '../../block-content-overlay';
|
|
35
30
|
import { unlock } from '../../../lock-unlock';
|
|
36
31
|
|
|
37
32
|
/**
|
|
@@ -97,10 +92,15 @@ export function useBlockProps(props = {}, {
|
|
|
97
92
|
name,
|
|
98
93
|
blockApiVersion,
|
|
99
94
|
blockTitle,
|
|
95
|
+
isSelected,
|
|
100
96
|
isPartOfSelection,
|
|
101
97
|
adjustScrolling,
|
|
102
98
|
enableAnimation,
|
|
103
|
-
isSubtreeDisabled
|
|
99
|
+
isSubtreeDisabled,
|
|
100
|
+
isOutlineEnabled,
|
|
101
|
+
hasOverlay,
|
|
102
|
+
initialPosition,
|
|
103
|
+
classNames
|
|
104
104
|
} = useSelect(select => {
|
|
105
105
|
const {
|
|
106
106
|
getBlockAttributes,
|
|
@@ -113,35 +113,79 @@ export function useBlockProps(props = {}, {
|
|
|
113
113
|
isBlockMultiSelected,
|
|
114
114
|
isAncestorMultiSelected,
|
|
115
115
|
isFirstMultiSelectedBlock,
|
|
116
|
-
isBlockSubtreeDisabled
|
|
116
|
+
isBlockSubtreeDisabled,
|
|
117
|
+
getSettings,
|
|
118
|
+
isBlockHighlighted,
|
|
119
|
+
__unstableIsFullySelected,
|
|
120
|
+
__unstableSelectionHasUnmergeableBlock,
|
|
121
|
+
isBlockBeingDragged,
|
|
122
|
+
hasSelectedInnerBlock,
|
|
123
|
+
hasBlockMovingClientId,
|
|
124
|
+
canInsertBlockType,
|
|
125
|
+
getBlockRootClientId,
|
|
126
|
+
__unstableHasActiveBlockOverlayActive,
|
|
127
|
+
__unstableGetEditorMode,
|
|
128
|
+
getSelectedBlocksInitialCaretPosition
|
|
117
129
|
} = unlock(select(blockEditorStore));
|
|
118
130
|
const {
|
|
119
131
|
getActiveBlockVariation
|
|
120
132
|
} = select(blocksStore);
|
|
121
|
-
const
|
|
133
|
+
const _isSelected = isBlockSelected(clientId);
|
|
122
134
|
const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
|
|
123
135
|
const blockName = getBlockName(clientId);
|
|
124
136
|
const blockType = getBlockType(blockName);
|
|
125
137
|
const attributes = getBlockAttributes(clientId);
|
|
126
138
|
const match = getActiveBlockVariation(blockName, attributes);
|
|
139
|
+
const {
|
|
140
|
+
outlineMode
|
|
141
|
+
} = getSettings();
|
|
142
|
+
const isMultiSelected = isBlockMultiSelected(clientId);
|
|
143
|
+
const checkDeep = true;
|
|
144
|
+
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
|
|
145
|
+
const typing = isTyping();
|
|
146
|
+
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
147
|
+
const movingClientId = hasBlockMovingClientId();
|
|
127
148
|
return {
|
|
128
149
|
index: getBlockIndex(clientId),
|
|
129
150
|
mode: getBlockMode(clientId),
|
|
130
151
|
name: blockName,
|
|
131
152
|
blockApiVersion: blockType?.apiVersion || 1,
|
|
132
153
|
blockTitle: match?.title || blockType?.title,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
154
|
+
isSelected: _isSelected,
|
|
155
|
+
isPartOfSelection: _isSelected || isPartOfMultiSelection,
|
|
156
|
+
adjustScrolling: _isSelected || isFirstMultiSelectedBlock(clientId),
|
|
157
|
+
enableAnimation: !typing && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,
|
|
158
|
+
isSubtreeDisabled: isBlockSubtreeDisabled(clientId),
|
|
159
|
+
isOutlineEnabled: outlineMode,
|
|
160
|
+
hasOverlay: __unstableHasActiveBlockOverlayActive(clientId),
|
|
161
|
+
initialPosition: _isSelected && __unstableGetEditorMode() === 'edit' ? getSelectedBlocksInitialCaretPosition() : undefined,
|
|
162
|
+
classNames: classnames({
|
|
163
|
+
'is-selected': _isSelected,
|
|
164
|
+
'is-highlighted': isBlockHighlighted(clientId),
|
|
165
|
+
'is-multi-selected': isMultiSelected,
|
|
166
|
+
'is-partially-selected': isMultiSelected && !__unstableIsFullySelected() && !__unstableSelectionHasUnmergeableBlock(),
|
|
167
|
+
'is-reusable': isReusableBlock(blockType),
|
|
168
|
+
'is-dragging': isBlockBeingDragged(clientId),
|
|
169
|
+
'has-child-selected': isAncestorOfSelectedBlock,
|
|
170
|
+
'remove-outline': _isSelected && outlineMode && typing,
|
|
171
|
+
'is-block-moving-mode': !!movingClientId,
|
|
172
|
+
'can-insert-moving-block': movingClientId && canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId))
|
|
173
|
+
}, hasLightBlockWrapper ? attributes.className : undefined, hasLightBlockWrapper ? getBlockDefaultClassName(blockName) : undefined)
|
|
137
174
|
};
|
|
138
175
|
}, [clientId]);
|
|
139
|
-
const hasOverlay = useBlockOverlayActive(clientId);
|
|
140
176
|
|
|
141
177
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
142
178
|
const blockLabel = sprintf(__('Block: %s'), blockTitle);
|
|
143
179
|
const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : '';
|
|
144
|
-
const mergedRefs = useMergeRefs([props.ref, useFocusFirstElement(
|
|
180
|
+
const mergedRefs = useMergeRefs([props.ref, useFocusFirstElement({
|
|
181
|
+
clientId,
|
|
182
|
+
initialPosition
|
|
183
|
+
}), useBlockRefProvider(clientId), useFocusHandler(clientId), useEventHandlers({
|
|
184
|
+
clientId,
|
|
185
|
+
isSelected
|
|
186
|
+
}), useNavModeExit(clientId), useIsHovered({
|
|
187
|
+
isEnabled: isOutlineEnabled
|
|
188
|
+
}), useIntersectionObserver(), useMovingAnimation({
|
|
145
189
|
isSelected: isPartOfSelection,
|
|
146
190
|
adjustScrolling,
|
|
147
191
|
enableAnimation,
|
|
@@ -166,12 +210,11 @@ export function useBlockProps(props = {}, {
|
|
|
166
210
|
'data-type': name,
|
|
167
211
|
'data-title': blockTitle,
|
|
168
212
|
inert: isSubtreeDisabled ? 'true' : undefined,
|
|
169
|
-
className: classnames(
|
|
170
|
-
|
|
171
|
-
classnames('block-editor-block-list__block', {
|
|
213
|
+
className: classnames('block-editor-block-list__block', {
|
|
214
|
+
// The wp-block className is important for editor styles.
|
|
172
215
|
'wp-block': !isAligned,
|
|
173
216
|
'has-block-overlay': hasOverlay
|
|
174
|
-
}
|
|
217
|
+
}, className, props.className, wrapperProps.className, classNames),
|
|
175
218
|
style: {
|
|
176
219
|
...wrapperProps.style,
|
|
177
220
|
...props.style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","getBlockType","store","blocksStore","useMergeRefs","useDisabled","useSelect","warning","useMovingAnimation","BlockListBlockContext","useFocusFirstElement","useIsHovered","useBlockEditContext","useBlockClassNames","useBlockDefaultClassName","useBlockCustomClassName","useBlockMovingModeClassNames","useFocusHandler","useEventHandlers","useNavModeExit","useBlockRefProvider","useIntersectionObserver","blockEditorStore","useBlockOverlayActive","unlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","getActiveBlockVariation","isSelected","isPartOfMultiSelection","blockName","blockType","attributes","match","apiVersion","title","hasOverlay","blockLabel","htmlSuffix","mergedRefs","ref","triggerAnimationOnChange","isDisabled","blockEditContext","SCRIPT_DEBUG","tabIndex","id","role","inert","undefined","style","save"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__unstableGetBlockProps as getBlockProps,\n\tgetBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { BlockListBlockContext } from '../block-list-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useBlockClassNames } from './use-block-class-names';\nimport { useBlockDefaultClassName } from './use-block-default-class-name';\nimport { useBlockCustomClassName } from './use-block-custom-class-name';\nimport { useBlockMovingModeClassNames } from './use-block-moving-mode-class-names';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { store as blockEditorStore } from '../../../store';\nimport useBlockOverlayActive from '../../block-content-overlay';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t} = useContext( BlockListBlockContext );\n\tconst {\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisTyping,\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisAncestorMultiSelected,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst isPartOfMultiSelection =\n\t\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\t\tisAncestorMultiSelected( clientId );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\n\t\t\treturn {\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tname: blockName,\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisPartOfSelection: isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\tisSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! isTyping() &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasOverlay = useBlockOverlayActive( clientId );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( clientId ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( clientId ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered(),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( {\n\t\t\tisSelected: isPartOfSelection,\n\t\t\tadjustScrolling,\n\t\t\tenableAnimation,\n\t\t\ttriggerAnimationOnChange: index,\n\t\t} ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t// The wp-block className is important for editor styles.\n\t\t\tclassnames( 'block-editor-block-list__block', {\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t} ),\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tuseBlockClassNames( clientId ),\n\t\t\tuseBlockDefaultClassName( clientId ),\n\t\t\tuseBlockCustomClassName( clientId ),\n\t\t\tuseBlockMovingModeClassNames( clientId )\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,uBAAuB,IAAIC,aAAa,EACxCC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,4BAA4B;AAC3D,SAASC,qBAAqB,QAAQ,6BAA6B;AACnE,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,wBAAwB,QAAQ,gCAAgC;AACzE,SAASC,uBAAuB,QAAQ,+BAA+B;AACvE,SAASC,4BAA4B,QAAQ,qCAAqC;AAClF,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,gBAAgB,QAAQ,qCAAqC;AACtE,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASnB,KAAK,IAAIoB,g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AK;MAAE,GAAGlD,KAAK,CAACkD;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACAnD,aAAa,CAACoD,IAAI,GAAG9E,aAAa"}
|
|
1
|
+
{"version":3,"names":["classnames","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","getBlockType","isReusableBlock","getBlockDefaultClassName","store","blocksStore","useMergeRefs","useDisabled","useSelect","warning","useMovingAnimation","BlockListBlockContext","useFocusFirstElement","useIsHovered","useBlockEditContext","useFocusHandler","useEventHandlers","useNavModeExit","useBlockRefProvider","useIntersectionObserver","blockEditorStore","unlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","classNames","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","getSettings","isBlockHighlighted","__unstableIsFullySelected","__unstableSelectionHasUnmergeableBlock","isBlockBeingDragged","hasSelectedInnerBlock","hasBlockMovingClientId","canInsertBlockType","getBlockRootClientId","__unstableHasActiveBlockOverlayActive","__unstableGetEditorMode","getSelectedBlocksInitialCaretPosition","getActiveBlockVariation","_isSelected","isPartOfMultiSelection","blockName","blockType","attributes","match","outlineMode","isMultiSelected","checkDeep","isAncestorOfSelectedBlock","typing","hasLightBlockWrapper","apiVersion","movingClientId","title","undefined","blockLabel","htmlSuffix","mergedRefs","ref","isEnabled","triggerAnimationOnChange","isDisabled","blockEditContext","SCRIPT_DEBUG","tabIndex","id","role","inert","style","save"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__unstableGetBlockProps as getBlockProps,\n\tgetBlockType,\n\tisReusableBlock,\n\tgetBlockDefaultClassName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { BlockListBlockContext } from '../block-list-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t} = useContext( BlockListBlockContext );\n\tconst {\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tclassNames,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisTyping,\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisAncestorMultiSelected,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t\tgetSettings,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\t__unstableIsFullySelected,\n\t\t\t\t__unstableSelectionHasUnmergeableBlock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\thasBlockMovingClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\t__unstableHasActiveBlockOverlayActive,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetSelectedBlocksInitialCaretPosition,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\tconst _isSelected = isBlockSelected( clientId );\n\t\t\tconst isPartOfMultiSelection =\n\t\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\t\tisAncestorMultiSelected( clientId );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isMultiSelected = isBlockMultiSelected( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\tconst typing = isTyping();\n\t\t\tconst hasLightBlockWrapper = blockType?.apiVersion > 1;\n\t\t\tconst movingClientId = hasBlockMovingClientId();\n\n\t\t\treturn {\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tname: blockName,\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisSelected: _isSelected,\n\t\t\t\tisPartOfSelection: _isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\t_isSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! typing &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t\tisOutlineEnabled: outlineMode,\n\t\t\t\thasOverlay: __unstableHasActiveBlockOverlayActive( clientId ),\n\t\t\t\tinitialPosition:\n\t\t\t\t\t_isSelected && __unstableGetEditorMode() === 'edit'\n\t\t\t\t\t\t? getSelectedBlocksInitialCaretPosition()\n\t\t\t\t\t\t: undefined,\n\t\t\t\tclassNames: classnames(\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-selected': _isSelected,\n\t\t\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t\t\t'is-partially-selected':\n\t\t\t\t\t\t\tisMultiSelected &&\n\t\t\t\t\t\t\t! __unstableIsFullySelected() &&\n\t\t\t\t\t\t\t! __unstableSelectionHasUnmergeableBlock(),\n\t\t\t\t\t\t'is-reusable': isReusableBlock( blockType ),\n\t\t\t\t\t\t'is-dragging': isBlockBeingDragged( clientId ),\n\t\t\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t\t\t'remove-outline': _isSelected && outlineMode && typing,\n\t\t\t\t\t\t'is-block-moving-mode': !! movingClientId,\n\t\t\t\t\t\t'can-insert-moving-block':\n\t\t\t\t\t\t\tmovingClientId &&\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tgetBlockName( movingClientId ),\n\t\t\t\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\thasLightBlockWrapper ? attributes.className : undefined,\n\t\t\t\t\thasLightBlockWrapper\n\t\t\t\t\t\t? getBlockDefaultClassName( blockName )\n\t\t\t\t\t\t: undefined\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered( { isEnabled: isOutlineEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( {\n\t\t\tisSelected: isPartOfSelection,\n\t\t\tadjustScrolling,\n\t\t\tenableAnimation,\n\t\t\ttriggerAnimationOnChange: index,\n\t\t} ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tclassNames\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,uBAAuB,IAAIC,aAAa,EACxCC,YAAY,EACZC,eAAe,EACfC,wBAAwB,EACxBC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,4BAA4B;A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K;IACRgE,GAAG,EAAED,UAAU;IACfQ,EAAE,EAAG,SAASrE,QAAU,GAAG4D,UAAY,EAAC;IACxCU,IAAI,EAAE,UAAU;IAChB,YAAY,EAAEX,UAAU;IACxB,YAAY,EAAE3D,QAAQ;IACtB,WAAW,EAAEM,IAAI;IACjB,YAAY,EAAEE,UAAU;IACxB+D,KAAK,EAAE1D,iBAAiB,GAAG,MAAM,GAAG6C,SAAS;IAC7CzD,SAAS,EAAEhC,UAAU,CACpB,gCAAgC,EAChC;MACC;MACA,UAAU,EAAE,CAAEkC,SAAS;MACvB,mBAAmB,EAAEY;IACtB,CAAC,EACDd,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtBgB,UACD,CAAC;IACDuD,KAAK,EAAE;MAAE,GAAGtE,YAAY,CAACsE,KAAK;MAAE,GAAG1E,KAAK,CAAC0E;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA3E,aAAa,CAAC4E,IAAI,GAAGnG,aAAa"}
|
|
@@ -13,33 +13,6 @@ import { store as blockEditorStore } from '../../../store';
|
|
|
13
13
|
|
|
14
14
|
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Returns the initial position if the block needs to be focussed, `undefined`
|
|
18
|
-
* otherwise. The initial position is either 0 (start) or -1 (end).
|
|
19
|
-
*
|
|
20
|
-
* @param {string} clientId Block client ID.
|
|
21
|
-
*
|
|
22
|
-
* @return {number} The initial position, either 0 (start) or -1 (end).
|
|
23
|
-
*/
|
|
24
|
-
function useInitialPosition(clientId) {
|
|
25
|
-
return useSelect(select => {
|
|
26
|
-
const {
|
|
27
|
-
getSelectedBlocksInitialCaretPosition,
|
|
28
|
-
__unstableGetEditorMode,
|
|
29
|
-
isBlockSelected
|
|
30
|
-
} = select(blockEditorStore);
|
|
31
|
-
if (!isBlockSelected(clientId)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (__unstableGetEditorMode() !== 'edit') {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// If there's no initial position, return 0 to focus the start.
|
|
39
|
-
return getSelectedBlocksInitialCaretPosition();
|
|
40
|
-
}, [clientId]);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
16
|
/**
|
|
44
17
|
* Transitions focus to the block or inner tabbable when the block becomes
|
|
45
18
|
* selected and an initial position is set.
|
|
@@ -48,9 +21,11 @@ function useInitialPosition(clientId) {
|
|
|
48
21
|
*
|
|
49
22
|
* @return {RefObject} React ref with the block element.
|
|
50
23
|
*/
|
|
51
|
-
export function useFocusFirstElement(
|
|
24
|
+
export function useFocusFirstElement({
|
|
25
|
+
clientId,
|
|
26
|
+
initialPosition
|
|
27
|
+
}) {
|
|
52
28
|
const ref = useRef();
|
|
53
|
-
const initialPosition = useInitialPosition(clientId);
|
|
54
29
|
const {
|
|
55
30
|
isBlockSelected,
|
|
56
31
|
isMultiSelecting
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","focus","isFormElement","isTextField","placeCaretAtHorizontalEdge","useSelect","isInsideRootBlock","store","blockEditorStore","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","focus","isFormElement","isTextField","placeCaretAtHorizontalEdge","useSelect","isInsideRootBlock","store","blockEditorStore","useFocusFirstElement","clientId","initialPosition","ref","isBlockSelected","isMultiSelecting","undefined","current","ownerDocument","activeElement","textInputs","tabbable","find","filter","node","isReverse","target","length","getAttribute","focusElement","findNext"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tfocus,\n\tisFormElement,\n\tisTextField,\n\tplaceCaretAtHorizontalEdge,\n} from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * Transitions focus to the block or inner tabbable when the block becomes\n * selected and an initial position is set.\n *\n * @param {string} clientId Block client ID.\n *\n * @return {RefObject} React ref with the block element.\n */\nexport function useFocusFirstElement( { clientId, initialPosition } ) {\n\tconst ref = useRef();\n\tconst { isBlockSelected, isMultiSelecting } = useSelect( blockEditorStore );\n\n\tuseEffect( () => {\n\t\t// Check if the block is still selected at the time this effect runs.\n\t\tif ( ! isBlockSelected( clientId ) || isMultiSelecting() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( initialPosition === undefined || initialPosition === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\n\t\t// Do not focus the block if it already contains the active element.\n\t\tif ( isInsideRootBlock( ref.current, ownerDocument.activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Find all tabbables within node.\n\t\tconst textInputs = focus.tabbable\n\t\t\t.find( ref.current )\n\t\t\t.filter( ( node ) => isTextField( node ) );\n\n\t\t// If reversed (e.g. merge via backspace), use the last in the set of\n\t\t// tabbables.\n\t\tconst isReverse = -1 === initialPosition;\n\t\tconst target =\n\t\t\ttextInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current;\n\n\t\tif ( ! isInsideRootBlock( ref.current, target ) ) {\n\t\t\tref.current.focus();\n\t\t\treturn;\n\t\t}\n\n\t\t// Check to see if element is focussable before a generic caret insert.\n\t\tif ( ! ref.current.getAttribute( 'contenteditable' ) ) {\n\t\t\tconst focusElement = focus.tabbable.findNext( ref.current );\n\t\t\t// Make sure focusElement is valid, contained in the same block, and a form field.\n\t\t\tif (\n\t\t\t\tfocusElement &&\n\t\t\t\tisInsideRootBlock( ref.current, focusElement ) &&\n\t\t\t\tisFormElement( focusElement )\n\t\t\t) {\n\t\t\t\tfocusElement.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tplaceCaretAtHorizontalEdge( target, isReverse );\n\t}, [ initialPosition, clientId ] );\n\n\treturn ref;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SACCC,KAAK,EACLC,aAAa,EACbC,WAAW,EACXC,0BAA0B,QACpB,gBAAgB;AACvB,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;;AAE1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAgB,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAGZ,MAAM,CAAC,CAAC;EACpB,MAAM;IAAEa,eAAe;IAAEC;EAAiB,CAAC,GAAGT,SAAS,CAAEG,gBAAiB,CAAC;EAE3ET,SAAS,CAAE,MAAM;IAChB;IACA,IAAK,CAAEc,eAAe,CAAEH,QAAS,CAAC,IAAII,gBAAgB,CAAC,CAAC,EAAG;MAC1D;IACD;IAEA,IAAKH,eAAe,KAAKI,SAAS,IAAIJ,eAAe,KAAK,IAAI,EAAG;MAChE;IACD;IAEA,IAAK,CAAEC,GAAG,CAACI,OAAO,EAAG;MACpB;IACD;IAEA,MAAM;MAAEC;IAAc,CAAC,GAAGL,GAAG,CAACI,OAAO;;IAErC;IACA,IAAKV,iBAAiB,CAAEM,GAAG,CAACI,OAAO,EAAEC,aAAa,CAACC,aAAc,CAAC,EAAG;MACpE;IACD;;IAEA;IACA,MAAMC,UAAU,GAAGlB,KAAK,CAACmB,QAAQ,CAC/BC,IAAI,CAAET,GAAG,CAACI,OAAQ,CAAC,CACnBM,MAAM,CAAIC,IAAI,IAAMpB,WAAW,CAAEoB,IAAK,CAAE,CAAC;;IAE3C;IACA;IACA,MAAMC,SAAS,GAAG,CAAC,CAAC,KAAKb,eAAe;IACxC,MAAMc,MAAM,GACXN,UAAU,CAAEK,SAAS,GAAGL,UAAU,CAACO,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE,IAAId,GAAG,CAACI,OAAO;IAEnE,IAAK,CAAEV,iBAAiB,CAAEM,GAAG,CAACI,OAAO,EAAES,MAAO,CAAC,EAAG;MACjDb,GAAG,CAACI,OAAO,CAACf,KAAK,CAAC,CAAC;MACnB;IACD;;IAEA;IACA,IAAK,CAAEW,GAAG,CAACI,OAAO,CAACW,YAAY,CAAE,iBAAkB,CAAC,EAAG;MACtD,MAAMC,YAAY,GAAG3B,KAAK,CAACmB,QAAQ,CAACS,QAAQ,CAAEjB,GAAG,CAACI,OAAQ,CAAC;MAC3D;MACA,IACCY,YAAY,IACZtB,iBAAiB,CAAEM,GAAG,CAACI,OAAO,EAAEY,YAAa,CAAC,IAC9C1B,aAAa,CAAE0B,YAAa,CAAC,EAC5B;QACDA,YAAY,CAAC3B,KAAK,CAAC,CAAC;QACpB;MACD;IACD;IAEAG,0BAA0B,CAAEqB,MAAM,EAAED,SAAU,CAAC;EAChD,CAAC,EAAE,CAAEb,eAAe,EAAED,QAAQ,CAAG,CAAC;EAElC,OAAOE,GAAG;AACX"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
4
|
import { useRefEffect } from '@wordpress/compose';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { store as blockEditorStore } from '../../../store';
|
|
11
5
|
function listener(event) {
|
|
12
6
|
if (event.defaultPrevented) {
|
|
13
7
|
return;
|
|
@@ -17,17 +11,13 @@ function listener(event) {
|
|
|
17
11
|
event.currentTarget.classList[action]('is-hovered');
|
|
18
12
|
}
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
/*
|
|
21
15
|
* Adds `is-hovered` class when the block is hovered and in navigation or
|
|
22
16
|
* outline mode.
|
|
23
17
|
*/
|
|
24
|
-
export function useIsHovered(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
getSettings
|
|
28
|
-
} = select(blockEditorStore);
|
|
29
|
-
return getSettings().outlineMode;
|
|
30
|
-
}, []);
|
|
18
|
+
export function useIsHovered({
|
|
19
|
+
isEnabled
|
|
20
|
+
}) {
|
|
31
21
|
return useRefEffect(node => {
|
|
32
22
|
if (isEnabled) {
|
|
33
23
|
node.addEventListener('mouseout', listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useRefEffect","listener","event","defaultPrevented","action","type","preventDefault","currentTarget","classList","useIsHovered","isEnabled","node","addEventListener","removeEventListener","remove"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-is-hovered.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\nfunction listener( event ) {\n\tif ( event.defaultPrevented ) {\n\t\treturn;\n\t}\n\n\tconst action = event.type === 'mouseover' ? 'add' : 'remove';\n\n\tevent.preventDefault();\n\tevent.currentTarget.classList[ action ]( 'is-hovered' );\n}\n\n/*\n * Adds `is-hovered` class when the block is hovered and in navigation or\n * outline mode.\n */\nexport function useIsHovered( { isEnabled } ) {\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isEnabled ) {\n\t\t\t\tnode.addEventListener( 'mouseout', listener );\n\t\t\t\tnode.addEventListener( 'mouseover', listener );\n\n\t\t\t\treturn () => {\n\t\t\t\t\tnode.removeEventListener( 'mouseout', listener );\n\t\t\t\t\tnode.removeEventListener( 'mouseover', listener );\n\n\t\t\t\t\t// Remove class in case it lingers.\n\t\t\t\t\tnode.classList.remove( 'is-hovered' );\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AAEjD,SAASC,QAAQA,CAAEC,KAAK,EAAG;EAC1B,IAAKA,KAAK,CAACC,gBAAgB,EAAG;IAC7B;EACD;EAEA,MAAMC,MAAM,GAAGF,KAAK,CAACG,IAAI,KAAK,WAAW,GAAG,KAAK,GAAG,QAAQ;EAE5DH,KAAK,CAACI,cAAc,CAAC,CAAC;EACtBJ,KAAK,CAACK,aAAa,CAACC,SAAS,CAAEJ,MAAM,CAAE,CAAE,YAAa,CAAC;AACxD;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASK,YAAYA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC7C,OAAOV,YAAY,CAChBW,IAAI,IAAM;IACX,IAAKD,SAAS,EAAG;MAChBC,IAAI,CAACC,gBAAgB,CAAE,UAAU,EAAEX,QAAS,CAAC;MAC7CU,IAAI,CAACC,gBAAgB,CAAE,WAAW,EAAEX,QAAS,CAAC;MAE9C,OAAO,MAAM;QACZU,IAAI,CAACE,mBAAmB,CAAE,UAAU,EAAEZ,QAAS,CAAC;QAChDU,IAAI,CAACE,mBAAmB,CAAE,WAAW,EAAEZ,QAAS,CAAC;;QAEjD;QACAU,IAAI,CAACH,SAAS,CAACM,MAAM,CAAE,YAAa,CAAC;MACtC,CAAC;IACF;EACD,CAAC,EACD,CAAEJ,SAAS,CACZ,CAAC;AACF"}
|
package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js
CHANGED
|
@@ -19,8 +19,10 @@ import { store as blockEditorStore } from '../../../store';
|
|
|
19
19
|
*
|
|
20
20
|
* @param {string} clientId Block client ID.
|
|
21
21
|
*/
|
|
22
|
-
export function useEventHandlers(
|
|
23
|
-
|
|
22
|
+
export function useEventHandlers({
|
|
23
|
+
clientId,
|
|
24
|
+
isSelected
|
|
25
|
+
}) {
|
|
24
26
|
const {
|
|
25
27
|
getBlockRootClientId,
|
|
26
28
|
getBlockIndex
|
package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isTextField","ENTER","BACKSPACE","DELETE","useSelect","useDispatch","useRefEffect","store","blockEditorStore","useEventHandlers","clientId","isSelected","
|
|
1
|
+
{"version":3,"names":["isTextField","ENTER","BACKSPACE","DELETE","useSelect","useDispatch","useRefEffect","store","blockEditorStore","useEventHandlers","clientId","isSelected","getBlockRootClientId","getBlockIndex","insertDefaultBlock","removeBlock","node","onKeyDown","event","keyCode","target","preventDefault","onDragStart","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-selected-block-event-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { isTextField } from '@wordpress/dom';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Adds block behaviour:\n * - Removes the block on BACKSPACE.\n * - Inserts a default block on ENTER.\n * - Disables dragging of block contents.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useEventHandlers( { clientId, isSelected } ) {\n\tconst { getBlockRootClientId, getBlockIndex } =\n\t\tuseSelect( blockEditorStore );\n\tconst { insertDefaultBlock, removeBlock } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! isSelected ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Interprets keydown event intent to remove or insert after block if\n\t\t\t * key event occurs on wrapper node. This can occur when the block has\n\t\t\t * no text fields of its own, particularly after initial insertion, to\n\t\t\t * allow for easy deletion and continuous writing flow to add additional\n\t\t\t * content.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event Keydown event.\n\t\t\t */\n\t\t\tfunction onKeyDown( event ) {\n\t\t\t\tconst { keyCode, target } = event;\n\n\t\t\t\tif (\n\t\t\t\t\tkeyCode !== ENTER &&\n\t\t\t\t\tkeyCode !== BACKSPACE &&\n\t\t\t\t\tkeyCode !== DELETE\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( target !== node || isTextField( target ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( keyCode === ENTER ) {\n\t\t\t\t\tinsertDefaultBlock(\n\t\t\t\t\t\t{},\n\t\t\t\t\t\tgetBlockRootClientId( clientId ),\n\t\t\t\t\t\tgetBlockIndex( clientId ) + 1\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tremoveBlock( clientId );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Prevents default dragging behavior within a block. To do: we must\n\t\t\t * handle this in the future and clean up the drag target.\n\t\t\t *\n\t\t\t * @param {DragEvent} event Drag event.\n\t\t\t */\n\t\t\tfunction onDragStart( event ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\t\tnode.addEventListener( 'dragstart', onDragStart );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\t\tnode.removeEventListener( 'dragstart', onDragStart );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclientId,\n\t\t\tisSelected,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockIndex,\n\t\t\tinsertDefaultBlock,\n\t\t\tremoveBlock,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,KAAK,EAAEC,SAAS,EAAEC,MAAM,QAAQ,qBAAqB;AAC9D,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAI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MACZN,IAAI,CAACQ,mBAAmB,CAAE,SAAS,EAAEP,SAAU,CAAC;MAChDD,IAAI,CAACQ,mBAAmB,CAAE,WAAW,EAAEF,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACCZ,QAAQ,EACRC,UAAU,EACVC,oBAAoB,EACpBC,aAAa,EACbC,kBAAkB,EAClBC,WAAW,CAEb,CAAC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useEffect","useState","forwardRef","VisuallyHidden","Tooltip","privateApis","componentsPrivateApis","__experimentalHStack","HStack","useInstanceId","__","Icon","symbol","unlock","BlockPreview","InserterDraggableBlocks","BlockPatternsPaging","PATTERN_TYPES","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","WithToolTip","showTooltip","title","children","createElement","text","Fragment","BlockPattern","id","isDraggable","pattern","onClick","onHover","isDragging","setIsDragging","blocks","viewportWidth","instanceId","descriptionId","isEnabled","isPattern","draggable","onDragStart","onDragEnd","className","event","type","user","render","role","description","undefined","syncStatus","onMouseEnter","onMouseLeave","icon","BlockPatternPlaceholder","BlockPatternsList","blockPatterns","shownPatterns","onClickPattern","orientation","label","showTitlesAsTooltip","pagingProps","ref","compositeStore","setActiveId","store","map","isShown","includes","key","name"],"sources":["@wordpress/block-editor/src/components/block-patterns-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState, forwardRef } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\tTooltip,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn <Tooltip text={ title }>{ children }</Tooltip>;\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTooltip,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ blocks }\n\t\t\tisPattern={ !! pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={\n\t\t\t\t\t\t\tshowTooltip && ! pattern.type !== PATTERN_TYPES.user\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CompositeItem\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tPATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<HStack className=\"block-editor-patterns__pattern-details\">\n\t\t\t\t\t\t\t\t{ pattern.type === PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ( ! showTooltip ||\n\t\t\t\t\t\t\t\t\tpattern.type === PATTERN_TYPES.user ) && (\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-block-patterns-list__item-title\">\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</CompositeItem>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tshownPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tlabel = __( 'Block patterns' ),\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst compositeStore = useCompositeStore( { orientation } );\n\tconst { setActiveId } = compositeStore;\n\n\tuseEffect( () => {\n\t\t// We reset the active composite item whenever the\n\t\t// available patterns change, to make sure that\n\t\t// focus is put back to the start.\n\t\tsetActiveId( undefined );\n\t}, [ setActiveId, shownPatterns, blockPatterns ] );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => {\n\t\t\t\tconst isShown = shownPatterns.includes( pattern );\n\t\t\t\treturn isShown ? (\n\t\t\t\t\t<BlockPattern\n\t\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\t\tonClick={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockPatternPlaceholder key={ pattern.name } />\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,oBAAoB;AACpE,SACCC,cAAc,EACdC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,EACpCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;;AAE/C;AACA;AACA;A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AK,GAETP,aAAa,CAACW,GAAG,CAAIvC,OAAO,IAAM;IACnC,MAAMwC,OAAO,GAAGX,aAAa,CAACY,QAAQ,CAAEzC,OAAQ,CAAC;IACjD,OAAOwC,OAAO,GACb9C,aAAA,CAACG,YAAY;MACZ6C,GAAG,EAAG1C,OAAO,CAAC2C,IAAM;MACpB7C,EAAE,EAAGE,OAAO,CAAC2C,IAAM;MACnB3C,OAAO,EAAGA,OAAS;MACnBC,OAAO,EAAG6B,cAAgB;MAC1B5B,OAAO,EAAGA,OAAS;MACnBH,WAAW,EAAGA,WAAa;MAC3BR,WAAW,EAAG0C;IAAqB,CACnC,CAAC,GAEFvC,aAAA,CAACgC,uBAAuB;MAACgB,GAAG,EAAG1C,OAAO,CAAC2C;IAAM,CAAE,CAC/C;EACF,CAAE,CAAC,EACDT,WAAW,IAAIxC,aAAA,CAACZ,mBAAmB;IAAA,GAAMoD;EAAW,CAAI,CAChD,CAAC;AAEd;AAEA,eAAelE,UAAU,CAAE2D,iBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"names":["classnames","useEffect","useState","forwardRef","VisuallyHidden","Tooltip","privateApis","componentsPrivateApis","__experimentalHStack","HStack","useInstanceId","__","Icon","symbol","unlock","BlockPreview","InserterDraggableBlocks","BlockPatternsPaging","PATTERN_TYPES","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","WithToolTip","showTooltip","title","children","createElement","text","Fragment","BlockPattern","id","isDraggable","pattern","onClick","onHover","isDragging","setIsDragging","blocks","viewportWidth","instanceId","descriptionId","isEnabled","draggable","onDragStart","onDragEnd","className","event","type","user","render","role","description","undefined","syncStatus","onMouseEnter","onMouseLeave","icon","BlockPatternPlaceholder","BlockPatternsList","blockPatterns","shownPatterns","onClickPattern","orientation","label","showTitlesAsTooltip","pagingProps","ref","compositeStore","setActiveId","store","map","isShown","includes","key","name"],"sources":["@wordpress/block-editor/src/components/block-patterns-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState, forwardRef } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\tTooltip,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn <Tooltip text={ title }>{ children }</Tooltip>;\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTooltip,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ blocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={\n\t\t\t\t\t\t\tshowTooltip && ! pattern.type !== PATTERN_TYPES.user\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CompositeItem\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tPATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<HStack className=\"block-editor-patterns__pattern-details\">\n\t\t\t\t\t\t\t\t{ pattern.type === PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ( ! showTooltip ||\n\t\t\t\t\t\t\t\t\tpattern.type === PATTERN_TYPES.user ) && (\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-block-patterns-list__item-title\">\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</CompositeItem>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tshownPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tlabel = __( 'Block patterns' ),\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst compositeStore = useCompositeStore( { orientation } );\n\tconst { setActiveId } = compositeStore;\n\n\tuseEffect( () => {\n\t\t// We reset the active composite item whenever the\n\t\t// available patterns change, to make sure that\n\t\t// focus is put back to the start.\n\t\tsetActiveId( undefined );\n\t}, [ setActiveId, shownPatterns, blockPatterns ] );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => {\n\t\t\t\tconst isShown = shownPatterns.includes( pattern );\n\t\t\t\treturn isShown ? (\n\t\t\t\t\t<BlockPattern\n\t\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\t\tonClick={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockPatternPlaceholder key={ pattern.name } />\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],"mappings":";AAA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MAAM;IAAEM;EAAY,CAAC,GAAGD,cAAc;EAEtCrE,SAAS,CAAE,MAAM;IAChB;IACA;IACA;IACAsE,WAAW,CAAEhB,SAAU,CAAC;EACzB,CAAC,EAAE,CAAEgB,WAAW,EAAER,aAAa,EAAED,aAAa,CAAG,CAAC;EAElD,OACCjC,aAAA,CAACT,SAAS;IACToD,KAAK,EAAGF,cAAgB;IACxBjB,IAAI,EAAC,SAAS;IACdL,SAAS,EAAC,kCAAkC;IAC5C,cAAakB,KAAO;IACpBG,GAAG,EAAGA;EAAK,GAETP,aAAa,CAACW,GAAG,CAAItC,OAAO,IAAM;IACnC,MAAMuC,OAAO,GAAGX,aAAa,CAACY,QAAQ,CAAExC,OAAQ,CAAC;IACjD,OAAOuC,OAAO,GACb7C,aAAA,CAACG,YAAY;MACZ4C,GAAG,EAAGzC,OAAO,CAAC0C,IAAM;MACpB5C,EAAE,EAAGE,OAAO,CAAC0C,IAAM;MACnB1C,OAAO,EAAGA,OAAS;MACnBC,OAAO,EAAG4B,cAAgB;MAC1B3B,OAAO,EAAGA,OAAS;MACnBH,WAAW,EAAGA,WAAa;MAC3BR,WAAW,EAAGyC;IAAqB,CACnC,CAAC,GAEFtC,aAAA,CAAC+B,uBAAuB;MAACgB,GAAG,EAAGzC,OAAO,CAAC0C;IAAM,CAAE,CAC/C;EACF,CAAE,CAAC,EACDT,WAAW,IAAIvC,aAAA,CAACZ,mBAAmB;IAAA,GAAMmD;EAAW,CAAI,CAChD,CAAC;AAEd;AAEA,eAAejE,UAAU,CAAE0D,iBAAkB,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { createElement } from "react";
|
|
|
5
5
|
import { useEffect } from '@wordpress/element';
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { Modal, Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { __, _n } from '@wordpress/i18n';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
@@ -42,16 +42,9 @@ export function BlockRemovalWarningModal({
|
|
|
42
42
|
clearBlockRemovalPrompt();
|
|
43
43
|
};
|
|
44
44
|
return createElement(Modal, {
|
|
45
|
-
title: __('
|
|
45
|
+
title: __('Be careful!'),
|
|
46
46
|
onRequestClose: clearBlockRemovalPrompt
|
|
47
|
-
},
|
|
48
|
-
style: {
|
|
49
|
-
listStyleType: 'disc',
|
|
50
|
-
paddingLeft: '1rem'
|
|
51
|
-
}
|
|
52
|
-
}, blockNamesForPrompt.map(name => createElement("li", {
|
|
53
|
-
key: name
|
|
54
|
-
}, rules[name]))), createElement("p", null, blockNamesForPrompt.length > 1 ? __('Removing these blocks is not advised.') : __('Removing this block is not advised.')), createElement(HStack, {
|
|
47
|
+
}, createElement("p", null, _n('Post or page content will not be displayed if you delete this block.', 'Post or page content will not be displayed if you delete these blocks.', blockNamesForPrompt.length)), createElement(HStack, {
|
|
55
48
|
justify: "right"
|
|
56
49
|
}, createElement(Button, {
|
|
57
50
|
variant: "tertiary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useDispatch","useSelect","Modal","Button","__experimentalHStack","HStack","__","store","blockEditorStore","unlock","BlockRemovalWarningModal","rules","clientIds","selectPrevious","blockNamesForPrompt","select","getRemovalPromptData","clearBlockRemovalPrompt","setBlockRemovalRules","privateRemoveBlocks","onConfirmRemoval","createElement","title","onRequestClose","length","
|
|
1
|
+
{"version":3,"names":["useEffect","useDispatch","useSelect","Modal","Button","__experimentalHStack","HStack","__","_n","store","blockEditorStore","unlock","BlockRemovalWarningModal","rules","clientIds","selectPrevious","blockNamesForPrompt","select","getRemovalPromptData","clearBlockRemovalPrompt","setBlockRemovalRules","privateRemoveBlocks","onConfirmRemoval","createElement","title","onRequestClose","length","justify","variant","onClick"],"sources":["@wordpress/block-editor/src/components/block-removal-warning-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function BlockRemovalWarningModal( { rules } ) {\n\tconst { clientIds, selectPrevious, blockNamesForPrompt } = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getRemovalPromptData()\n\t);\n\n\tconst {\n\t\tclearBlockRemovalPrompt,\n\t\tsetBlockRemovalRules,\n\t\tprivateRemoveBlocks,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\t// Load block removal rules, simultaneously signalling that the block\n\t// removal prompt is in place.\n\tuseEffect( () => {\n\t\tsetBlockRemovalRules( rules );\n\t\treturn () => {\n\t\t\tsetBlockRemovalRules();\n\t\t};\n\t}, [ rules, setBlockRemovalRules ] );\n\n\tif ( ! blockNamesForPrompt ) {\n\t\treturn;\n\t}\n\n\tconst onConfirmRemoval = () => {\n\t\tprivateRemoveBlocks( clientIds, selectPrevious, /* force */ true );\n\t\tclearBlockRemovalPrompt();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Be careful!' ) }\n\t\t\tonRequestClose={ clearBlockRemovalPrompt }\n\t\t>\n\t\t\t<p>\n\t\t\t\t{ _n(\n\t\t\t\t\t'Post or page content will not be displayed if you delete this block.',\n\t\t\t\t\t'Post or page content will not be displayed if you delete these blocks.',\n\t\t\t\t\tblockNamesForPrompt.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<HStack justify=\"right\">\n\t\t\t\t<Button variant=\"tertiary\" onClick={ clearBlockRemovalPrompt }>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t\t<Button variant=\"primary\" onClick={ onConfirmRemoval }>\n\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t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E,CACH,sEAAsE,EACtE,wEAAwE,EACxEQ,mBAAmB,CAACU,MACrB,CACE,CAAC,EACJH,aAAA,CAACjB,MAAM;IAACqB,OAAO,EAAC;EAAO,GACtBJ,aAAA,CAACnB,MAAM;IAACwB,OAAO,EAAC,UAAU;IAACC,OAAO,EAAGV;EAAyB,GAC3DZ,EAAE,CAAE,QAAS,CACR,CAAC,EACTgB,aAAA,CAACnB,MAAM;IAACwB,OAAO,EAAC,SAAS;IAACC,OAAO,EAAGP;EAAkB,GACnDf,EAAE,CAAE,QAAS,CACR,CACD,CACF,CAAC;AAEV"}
|
|
@@ -59,6 +59,7 @@ export default function BlockRenameModal({
|
|
|
59
59
|
spacing: "3"
|
|
60
60
|
}, createElement(TextControl, {
|
|
61
61
|
__nextHasNoMarginBottom: true,
|
|
62
|
+
__next40pxDefaultSize: true,
|
|
62
63
|
value: editedBlockName,
|
|
63
64
|
label: __('Block name'),
|
|
64
65
|
hideLabelFromVision: true,
|
|
@@ -68,9 +69,11 @@ export default function BlockRenameModal({
|
|
|
68
69
|
}), createElement(HStack, {
|
|
69
70
|
justify: "right"
|
|
70
71
|
}, createElement(Button, {
|
|
72
|
+
__next40pxDefaultSize: true,
|
|
71
73
|
variant: "tertiary",
|
|
72
74
|
onClick: onClose
|
|
73
75
|
}, __('Cancel')), createElement(Button, {
|
|
76
|
+
__next40pxDefaultSize: true,
|
|
74
77
|
"aria-disabled": !isNameValid,
|
|
75
78
|
variant: "primary",
|
|
76
79
|
type: "submit"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useInstanceId","__","sprintf","useState","speak","isEmptyString","BlockRenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","message","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type"],"sources":["@wordpress/block-editor/src/components/block-rename/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport isEmptyString from './is-empty-string';\n\nexport default function BlockRenameModal( {\n\tblockName,\n\toriginalBlockName,\n\tonClose,\n\tonSave,\n} ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = isEmptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tBlockRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button
|
|
1
|
+
{"version":3,"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useInstanceId","__","sprintf","useState","speak","isEmptyString","BlockRenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","message","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","__next40pxDefaultSize","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type"],"sources":["@wordpress/block-editor/src/components/block-rename/modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport isEmptyString from './is-empty-string';\n\nexport default function BlockRenameModal( {\n\tblockName,\n\toriginalBlockName,\n\tonClose,\n\tonSave,\n} ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = isEmptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tBlockRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9B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AS;IAC1BkB,gBAAgB,EAAC,iCAAiC;IAClDC,IAAI,EAAG;MACNC,WAAW,EAAER;IACd,CAAG;IACHS,YAAY,EAAC;EAAqB,GAElCN,aAAA;IAAGO,EAAE,EAAGV;EAAmB,GACxBpB,EAAE,CAAE,qCAAsC,CAC1C,CAAC,EACJuB,aAAA;IACCQ,QAAQ,EAAKC,CAAC,IAAM;MACnBA,CAAC,CAACC,cAAc,CAAC,CAAC;MAElB,IAAK,CAAElB,WAAW,EAAG;QACpB;MACD;MAEAM,YAAY,CAAC,CAAC;IACf;EAAG,GAEHE,aAAA,CAAC5B,MAAM;IAACuC,OAAO,EAAC;EAAG,GAClBX,aAAA,CAAC1B,WAAW;IACXsC,uBAAuB;IACvBC,qBAAqB;IACrBC,KAAK,EAAG3B,eAAiB;IACzB4B,KAAK,EAAGtC,EAAE,CAAE,YAAa,CAAG;IAC5BuC,mBAAmB,EAAG,IAAM;IAC5BC,WAAW,EAAGjC,iBAAmB;IACjCkC,QAAQ,EAAG9B,kBAAoB;IAC/B+B,OAAO,EAAG1B;EAAqB,CAC/B,CAAC,EACFO,aAAA,CAAC9B,MAAM;IAACkD,OAAO,EAAC;EAAO,GACtBpB,aAAA,CAAC3B,MAAM;IACNwC,qBAAqB;IACrBQ,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGrC;EAAS,GAEjBR,EAAE,CAAE,QAAS,CACR,CAAC,EAETuB,aAAA,CAAC3B,MAAM;IACNwC,qBAAqB;IACrB,iBAAgB,CAAErB,WAAa;IAC/B6B,OAAO,EAAC,SAAS;IACjBE,IAAI,EAAC;EAAQ,GAEX9C,EAAE,CAAE,MAAO,CACN,CACD,CACD,CACH,CACA,CAAC;AAEV"}
|
|
@@ -2,14 +2,16 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { BottomSheet, ColorSettings, FocalPointSettingsPanel, ImageLinkDestinationsScreen, LinkPickerScreen } from '@wordpress/components';
|
|
5
|
+
import { BottomSheet, ColorSettings, FocalPointSettingsPanel, LinkPickerScreen } from '@wordpress/components';
|
|
7
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
11
|
import styles from './container.native.scss';
|
|
12
|
+
import InspectorControls from '../inspector-controls';
|
|
13
|
+
import ImageLinkDestinationsScreen from '../image-link-destinations';
|
|
14
|
+
import useMultipleOriginColorsAndGradients from '../colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
13
15
|
export const blockSettingsScreens = {
|
|
14
16
|
settings: 'Settings',
|
|
15
17
|
color: 'Color',
|