@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
|
@@ -13,6 +13,7 @@ import { useCallback } from '@wordpress/element';
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
|
+
import { mergeOrigins, hasMergedOrigins } from '../use-settings';
|
|
16
17
|
import FontFamilyControl from '../font-family';
|
|
17
18
|
import FontAppearanceControl from '../font-appearance-control';
|
|
18
19
|
import LineHeightControl from '../line-height-control';
|
|
@@ -51,25 +52,14 @@ export function useHasTypographyPanel( settings ) {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function useHasFontSizeControl( settings ) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.concat( fontSizesPerOrigin?.theme ?? [] )
|
|
59
|
-
.concat( fontSizesPerOrigin.default ?? [] );
|
|
60
|
-
return !! fontSizes?.length || ! disableCustomFontSizes;
|
|
55
|
+
return (
|
|
56
|
+
hasMergedOrigins( settings?.typography?.fontSizes ) ||
|
|
57
|
+
settings?.typography?.customFontSize
|
|
58
|
+
);
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
function useHasFontFamilyControl( settings ) {
|
|
64
|
-
|
|
65
|
-
const fontFamilies = []
|
|
66
|
-
.concat( fontFamiliesPerOrigin?.custom ?? [] )
|
|
67
|
-
.concat( fontFamiliesPerOrigin?.theme ?? [] )
|
|
68
|
-
.concat( fontFamiliesPerOrigin?.default ?? [] )
|
|
69
|
-
.sort( ( a, b ) =>
|
|
70
|
-
( a?.name || a?.slug )?.localeCompare( b?.name || a?.slug )
|
|
71
|
-
);
|
|
72
|
-
return !! fontFamilies?.length;
|
|
62
|
+
return hasMergedOrigins( settings?.typography?.fontFamilies );
|
|
73
63
|
}
|
|
74
64
|
|
|
75
65
|
function useHasLineHeightControl( settings ) {
|
|
@@ -77,18 +67,14 @@ function useHasLineHeightControl( settings ) {
|
|
|
77
67
|
}
|
|
78
68
|
|
|
79
69
|
function useHasAppearanceControl( settings ) {
|
|
80
|
-
|
|
81
|
-
const hasFontWeights = settings?.typography?.fontWeight;
|
|
82
|
-
return hasFontStyles || hasFontWeights;
|
|
70
|
+
return settings?.typography?.fontStyle || settings?.typography?.fontWeight;
|
|
83
71
|
}
|
|
84
72
|
|
|
85
73
|
function useAppearanceControlLabel( settings ) {
|
|
86
|
-
|
|
87
|
-
const hasFontWeights = settings?.typography?.fontWeight;
|
|
88
|
-
if ( ! hasFontStyles ) {
|
|
74
|
+
if ( ! settings?.typography?.fontStyle ) {
|
|
89
75
|
return __( 'Font weight' );
|
|
90
76
|
}
|
|
91
|
-
if ( !
|
|
77
|
+
if ( ! settings?.typography?.fontWeight ) {
|
|
92
78
|
return __( 'Font style' );
|
|
93
79
|
}
|
|
94
80
|
return __( 'Appearance' );
|
|
@@ -115,18 +101,15 @@ function useHasTextColumnsControl( settings ) {
|
|
|
115
101
|
}
|
|
116
102
|
|
|
117
103
|
function getUniqueFontSizesBySlug( settings ) {
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
.
|
|
123
|
-
|
|
124
|
-
return fontSizes.reduce( ( acc, currentSize ) => {
|
|
125
|
-
if ( ! acc.some( ( { slug } ) => slug === currentSize.slug ) ) {
|
|
126
|
-
acc.push( currentSize );
|
|
104
|
+
const fontSizes = settings?.typography?.fontSizes;
|
|
105
|
+
const mergedFontSizes = fontSizes ? mergeOrigins( fontSizes ) : [];
|
|
106
|
+
const uniqueSizes = [];
|
|
107
|
+
for ( const currentSize of mergedFontSizes ) {
|
|
108
|
+
if ( ! uniqueSizes.some( ( { slug } ) => slug === currentSize.slug ) ) {
|
|
109
|
+
uniqueSizes.push( currentSize );
|
|
127
110
|
}
|
|
128
|
-
|
|
129
|
-
|
|
111
|
+
}
|
|
112
|
+
return uniqueSizes;
|
|
130
113
|
}
|
|
131
114
|
|
|
132
115
|
function TypographyToolsPanel( {
|
|
@@ -178,14 +161,11 @@ export default function TypographyPanel( {
|
|
|
178
161
|
|
|
179
162
|
// Font Family
|
|
180
163
|
const hasFontFamilyEnabled = useHasFontFamilyControl( settings );
|
|
181
|
-
const
|
|
182
|
-
const
|
|
183
|
-
.concat( fontFamiliesPerOrigin?.custom ?? [] )
|
|
184
|
-
.concat( fontFamiliesPerOrigin?.theme ?? [] )
|
|
185
|
-
.concat( fontFamiliesPerOrigin?.default ?? [] );
|
|
164
|
+
const fontFamilies = settings?.typography?.fontFamilies;
|
|
165
|
+
const mergedFontFamilies = fontFamilies ? mergeOrigins( fontFamilies ) : [];
|
|
186
166
|
const fontFamily = decodeValue( inheritedValue?.typography?.fontFamily );
|
|
187
167
|
const setFontFamily = ( newValue ) => {
|
|
188
|
-
const slug =
|
|
168
|
+
const slug = mergedFontFamilies?.find(
|
|
189
169
|
( { fontFamily: f } ) => f === newValue
|
|
190
170
|
)?.slug;
|
|
191
171
|
onChange(
|
|
@@ -204,7 +184,7 @@ export default function TypographyPanel( {
|
|
|
204
184
|
// Font Size
|
|
205
185
|
const hasFontSizeEnabled = useHasFontSizeControl( settings );
|
|
206
186
|
const disableCustomFontSizes = ! settings?.typography?.customFontSize;
|
|
207
|
-
const
|
|
187
|
+
const mergedFontSizes = getUniqueFontSizesBySlug( settings );
|
|
208
188
|
|
|
209
189
|
const fontSize = decodeValue( inheritedValue?.typography?.fontSize );
|
|
210
190
|
const setFontSize = ( newValue, metadata ) => {
|
|
@@ -368,7 +348,7 @@ export default function TypographyPanel( {
|
|
|
368
348
|
panelId={ panelId }
|
|
369
349
|
>
|
|
370
350
|
<FontFamilyControl
|
|
371
|
-
fontFamilies={
|
|
351
|
+
fontFamilies={ mergedFontFamilies }
|
|
372
352
|
value={ fontFamily }
|
|
373
353
|
onChange={ setFontFamily }
|
|
374
354
|
size="__unstable-large"
|
|
@@ -387,7 +367,7 @@ export default function TypographyPanel( {
|
|
|
387
367
|
<FontSizePicker
|
|
388
368
|
value={ fontSize }
|
|
389
369
|
onChange={ setFontSize }
|
|
390
|
-
fontSizes={
|
|
370
|
+
fontSizes={ mergedFontSizes }
|
|
391
371
|
disableCustomFontSizes={ disableCustomFontSizes }
|
|
392
372
|
withReset={ false }
|
|
393
373
|
withSlider
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
5
|
+
import { StyleSheet } from 'react-native';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { Icon, check, chevronRight } from '@wordpress/icons';
|
|
12
|
+
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
13
|
+
import { BottomSheet, PanelBody } from '@wordpress/components';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import styles from './style.native.scss';
|
|
19
|
+
import { blockSettingsScreens } from '../block-settings';
|
|
20
|
+
|
|
21
|
+
const LINK_DESTINATION_NONE = 'none';
|
|
22
|
+
const LINK_DESTINATION_MEDIA = 'media';
|
|
23
|
+
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
24
|
+
const LINK_DESTINATION_CUSTOM = 'custom';
|
|
25
|
+
|
|
26
|
+
function LinkDestination( {
|
|
27
|
+
children,
|
|
28
|
+
isSelected,
|
|
29
|
+
label,
|
|
30
|
+
onPress,
|
|
31
|
+
value,
|
|
32
|
+
valueStyle,
|
|
33
|
+
} ) {
|
|
34
|
+
const optionIcon = usePreferredColorSchemeStyle(
|
|
35
|
+
styles.optionIcon,
|
|
36
|
+
styles.optionIconDark
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<BottomSheet.Cell
|
|
41
|
+
icon={ check }
|
|
42
|
+
iconStyle={ StyleSheet.flatten( [
|
|
43
|
+
optionIcon,
|
|
44
|
+
! isSelected && styles.unselectedOptionIcon,
|
|
45
|
+
] ) }
|
|
46
|
+
label={ label }
|
|
47
|
+
leftAlign
|
|
48
|
+
onPress={ onPress }
|
|
49
|
+
value={ value }
|
|
50
|
+
valueStyle={ valueStyle }
|
|
51
|
+
separatorType="leftMargin"
|
|
52
|
+
>
|
|
53
|
+
{ children }
|
|
54
|
+
</BottomSheet.Cell>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function ImageLinkDestinationsScreen( props ) {
|
|
59
|
+
const navigation = useNavigation();
|
|
60
|
+
const route = useRoute();
|
|
61
|
+
const { url = '' } = props;
|
|
62
|
+
const {
|
|
63
|
+
inputValue = url,
|
|
64
|
+
imageUrl,
|
|
65
|
+
attachmentPageUrl,
|
|
66
|
+
linkDestination,
|
|
67
|
+
} = route.params || {};
|
|
68
|
+
|
|
69
|
+
function goToLinkPicker() {
|
|
70
|
+
navigation.navigate( blockSettingsScreens.linkPicker, {
|
|
71
|
+
inputValue:
|
|
72
|
+
linkDestination === LINK_DESTINATION_CUSTOM ? inputValue : '',
|
|
73
|
+
} );
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const setLinkDestination = ( newLinkDestination ) => () => {
|
|
77
|
+
let newUrl;
|
|
78
|
+
switch ( newLinkDestination ) {
|
|
79
|
+
case LINK_DESTINATION_MEDIA:
|
|
80
|
+
newUrl = imageUrl;
|
|
81
|
+
break;
|
|
82
|
+
case LINK_DESTINATION_ATTACHMENT:
|
|
83
|
+
newUrl = attachmentPageUrl;
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
newUrl = '';
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
navigation.navigate( blockSettingsScreens.settings, {
|
|
91
|
+
// The `inputValue` name is reused from LinkPicker, as it helps avoid
|
|
92
|
+
// bugs from stale values remaining in the React Navigation route
|
|
93
|
+
// parameters.
|
|
94
|
+
inputValue: newUrl,
|
|
95
|
+
// Clear link text value that may be set from LinkPicker.
|
|
96
|
+
text: '',
|
|
97
|
+
} );
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<BottomSheet.NavBar>
|
|
103
|
+
<BottomSheet.NavBar.BackButton onPress={ navigation.goBack } />
|
|
104
|
+
<BottomSheet.NavBar.Heading>
|
|
105
|
+
{ __( 'Link To' ) }
|
|
106
|
+
</BottomSheet.NavBar.Heading>
|
|
107
|
+
</BottomSheet.NavBar>
|
|
108
|
+
<PanelBody>
|
|
109
|
+
<LinkDestination
|
|
110
|
+
isSelected={ linkDestination === LINK_DESTINATION_NONE }
|
|
111
|
+
label={ __( 'None' ) }
|
|
112
|
+
onPress={ setLinkDestination( LINK_DESTINATION_NONE ) }
|
|
113
|
+
/>
|
|
114
|
+
<LinkDestination
|
|
115
|
+
isSelected={ linkDestination === LINK_DESTINATION_MEDIA }
|
|
116
|
+
label={ __( 'Media File' ) }
|
|
117
|
+
onPress={ setLinkDestination( LINK_DESTINATION_MEDIA ) }
|
|
118
|
+
/>
|
|
119
|
+
{ !! attachmentPageUrl && (
|
|
120
|
+
<LinkDestination
|
|
121
|
+
isSelected={
|
|
122
|
+
linkDestination === LINK_DESTINATION_ATTACHMENT
|
|
123
|
+
}
|
|
124
|
+
label={ __( 'Attachment Page' ) }
|
|
125
|
+
onPress={ setLinkDestination(
|
|
126
|
+
LINK_DESTINATION_ATTACHMENT
|
|
127
|
+
) }
|
|
128
|
+
/>
|
|
129
|
+
) }
|
|
130
|
+
<LinkDestination
|
|
131
|
+
isSelected={ linkDestination === LINK_DESTINATION_CUSTOM }
|
|
132
|
+
label={ __( 'Custom URL' ) }
|
|
133
|
+
onPress={ goToLinkPicker }
|
|
134
|
+
value={
|
|
135
|
+
linkDestination === LINK_DESTINATION_CUSTOM
|
|
136
|
+
? inputValue
|
|
137
|
+
: ''
|
|
138
|
+
}
|
|
139
|
+
valueStyle={
|
|
140
|
+
linkDestination === LINK_DESTINATION_CUSTOM
|
|
141
|
+
? undefined
|
|
142
|
+
: styles.placeholderTextColor
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
<Icon icon={ chevronRight }></Icon>
|
|
146
|
+
</LinkDestination>
|
|
147
|
+
</PanelBody>
|
|
148
|
+
</>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default ImageLinkDestinationsScreen;
|
|
@@ -90,6 +90,7 @@ export { default as BlockStyles } from './block-styles';
|
|
|
90
90
|
export { default as DefaultBlockAppender } from './default-block-appender';
|
|
91
91
|
export { default as __unstableEditorStyles } from './editor-styles';
|
|
92
92
|
export { default as Inserter } from './inserter';
|
|
93
|
+
export { default as InserterButton } from './inserter-button';
|
|
93
94
|
export { useBlockProps } from './block-list/use-block-props';
|
|
94
95
|
export { default as FloatingToolbar } from './floating-toolbar';
|
|
95
96
|
|
|
@@ -188,8 +188,19 @@ For example, a button block, deeply nested in several levels of block `X` that u
|
|
|
188
188
|
|
|
189
189
|
### `defaultBlock`
|
|
190
190
|
|
|
191
|
-
- **Type:** `
|
|
192
|
-
- **Default:** - `undefined
|
|
191
|
+
- **Type:** `Object`
|
|
192
|
+
- **Default:** - `undefined`
|
|
193
|
+
|
|
194
|
+
Determines which block type should be inserted by default and any attributes that should be set by default when the block is inserted. Takes an object in the form of `{ name: blockname, attributes: {blockAttributes} }`.
|
|
195
|
+
|
|
196
|
+
```jsx
|
|
197
|
+
const DEFAULT_BLOCK = { name: 'core/paragraph', attributes: { content: 'Lorem ipsum...' } };
|
|
198
|
+
...
|
|
199
|
+
<InnerBlocks
|
|
200
|
+
defaultBlock={ DEFAULT_BLOCK }
|
|
201
|
+
directInsert={ true }
|
|
202
|
+
/>
|
|
203
|
+
```
|
|
193
204
|
|
|
194
205
|
### `directInsert`
|
|
195
206
|
|
|
@@ -5,12 +5,12 @@ import { useRef, useEffect } from '@wordpress/element';
|
|
|
5
5
|
import { Spinner, SearchControl } from '@wordpress/components';
|
|
6
6
|
import { focus } from '@wordpress/dom';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { useDebouncedInput } from '@wordpress/compose';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
12
13
|
import MediaList from './media-list';
|
|
13
|
-
import useDebouncedInput from '../hooks/use-debounced-input';
|
|
14
14
|
import { useMediaResults } from './hooks';
|
|
15
15
|
import InserterNoResults from '../no-results';
|
|
16
16
|
|
|
@@ -14,13 +14,15 @@ import {
|
|
|
14
14
|
useImperativeHandle,
|
|
15
15
|
useRef,
|
|
16
16
|
} from '@wordpress/element';
|
|
17
|
-
import { VisuallyHidden, SearchControl } from '@wordpress/components';
|
|
17
|
+
import { VisuallyHidden, SearchControl, Popover } from '@wordpress/components';
|
|
18
18
|
import { __ } from '@wordpress/i18n';
|
|
19
19
|
import { useSelect } from '@wordpress/data';
|
|
20
|
+
import { useDebouncedInput } from '@wordpress/compose';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
23
24
|
*/
|
|
25
|
+
import { unlock } from '../../lock-unlock';
|
|
24
26
|
import Tips from './tips';
|
|
25
27
|
import InserterPreviewPanel from './preview-panel';
|
|
26
28
|
import BlockTypesTab from './block-types-tab';
|
|
@@ -28,7 +30,6 @@ import BlockPatternsTab from './block-patterns-tab';
|
|
|
28
30
|
import { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel';
|
|
29
31
|
import { MediaTab, MediaCategoryDialog, useMediaCategories } from './media-tab';
|
|
30
32
|
import InserterSearchResults from './search-results';
|
|
31
|
-
import useDebouncedInput from './hooks/use-debounced-input';
|
|
32
33
|
import useInsertionPoint from './hooks/use-insertion-point';
|
|
33
34
|
import InserterTabs from './tabs';
|
|
34
35
|
import { store as blockEditorStore } from '../../store';
|
|
@@ -68,12 +69,11 @@ function InserterMenu(
|
|
|
68
69
|
} );
|
|
69
70
|
const { showPatterns, inserterItems } = useSelect(
|
|
70
71
|
( select ) => {
|
|
71
|
-
const {
|
|
72
|
-
select( blockEditorStore )
|
|
72
|
+
const { hasAllowedPatterns, getInserterItems } = unlock(
|
|
73
|
+
select( blockEditorStore )
|
|
74
|
+
);
|
|
73
75
|
return {
|
|
74
|
-
showPatterns:
|
|
75
|
-
destinationRootClientId
|
|
76
|
-
).length,
|
|
76
|
+
showPatterns: hasAllowedPatterns( destinationRootClientId ),
|
|
77
77
|
inserterItems: getInserterItems( destinationRootClientId ),
|
|
78
78
|
};
|
|
79
79
|
},
|
|
@@ -293,7 +293,15 @@ function InserterMenu(
|
|
|
293
293
|
/>
|
|
294
294
|
) }
|
|
295
295
|
{ showInserterHelpPanel && hoveredItem && (
|
|
296
|
-
<
|
|
296
|
+
<Popover
|
|
297
|
+
className="block-editor-inserter__preview-container__popover"
|
|
298
|
+
placement="right-start"
|
|
299
|
+
offset={ 16 }
|
|
300
|
+
focusOnMount={ false }
|
|
301
|
+
animate={ false }
|
|
302
|
+
>
|
|
303
|
+
<InserterPreviewPanel item={ hoveredItem } />
|
|
304
|
+
</Popover>
|
|
297
305
|
) }
|
|
298
306
|
{ showPatternPanel && (
|
|
299
307
|
<PatternCategoryPreviewPanel
|
|
@@ -40,13 +40,13 @@ function InserterPreviewPanel( { item } ) {
|
|
|
40
40
|
blocks={ blocks }
|
|
41
41
|
viewportWidth={ example?.viewportWidth ?? 500 }
|
|
42
42
|
additionalStyles={ [
|
|
43
|
-
{ css: 'body { padding:
|
|
43
|
+
{ css: 'body { padding: 24px; }' },
|
|
44
44
|
] }
|
|
45
45
|
/>
|
|
46
46
|
</div>
|
|
47
47
|
) : (
|
|
48
48
|
<div className="block-editor-inserter__preview-content-missing">
|
|
49
|
-
{ __( 'No
|
|
49
|
+
{ __( 'No preview available.' ) }
|
|
50
50
|
</div>
|
|
51
51
|
) }
|
|
52
52
|
</div>
|
|
@@ -214,15 +214,14 @@ $block-inserter-tabs-height: 44px;
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
.block-editor-inserter__preview-container__popover {
|
|
218
|
+
top: $grid-unit-20 !important;
|
|
219
|
+
}
|
|
220
|
+
|
|
217
221
|
.block-editor-inserter__preview-container {
|
|
218
222
|
display: none;
|
|
219
|
-
width:
|
|
220
|
-
|
|
221
|
-
border-radius: $radius-block-ui;
|
|
222
|
-
border: $border-width solid $gray-300;
|
|
223
|
-
position: absolute;
|
|
224
|
-
top: $grid-unit-20;
|
|
225
|
-
left: calc(100% + #{$grid-unit-20});
|
|
223
|
+
width: $sidebar-width;
|
|
224
|
+
padding: $grid-unit-20;
|
|
226
225
|
max-height: calc(100% - #{$grid-unit-40});
|
|
227
226
|
overflow-y: hidden;
|
|
228
227
|
|
|
@@ -230,12 +229,14 @@ $block-inserter-tabs-height: 44px;
|
|
|
230
229
|
display: block;
|
|
231
230
|
}
|
|
232
231
|
|
|
233
|
-
.block-editor-block-
|
|
234
|
-
|
|
232
|
+
.block-editor-block-preview__container {
|
|
233
|
+
height: 100%;
|
|
235
234
|
}
|
|
236
235
|
|
|
237
|
-
.block-editor-block-
|
|
238
|
-
|
|
236
|
+
.block-editor-block-card {
|
|
237
|
+
padding-left: 0;
|
|
238
|
+
padding-right: 0;
|
|
239
|
+
padding-bottom: $grid-unit-05;
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
|
|
@@ -271,15 +272,11 @@ $block-inserter-tabs-height: 44px;
|
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
274
|
|
|
274
|
-
.block-editor-inserter__block-patterns-tabs-container
|
|
275
|
-
.block-editor-block-patterns-explorer__sidebar {
|
|
275
|
+
.block-editor-inserter__block-patterns-tabs-container {
|
|
276
276
|
height: 100%;
|
|
277
277
|
nav {
|
|
278
278
|
height: 100%;
|
|
279
279
|
}
|
|
280
|
-
.block-editor-block-patterns__source-filter select.components-select-control__input {
|
|
281
|
-
height: 40px;
|
|
282
|
-
}
|
|
283
280
|
}
|
|
284
281
|
|
|
285
282
|
.block-editor-inserter__block-patterns-tabs {
|
|
@@ -366,6 +363,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
366
363
|
min-height: $grid-unit-60 * 3;
|
|
367
364
|
color: $gray-700;
|
|
368
365
|
background: $gray-100;
|
|
366
|
+
border-radius: $radius-block-ui;
|
|
369
367
|
}
|
|
370
368
|
|
|
371
369
|
.block-editor-inserter__tips {
|
|
@@ -447,7 +445,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
447
445
|
.block-editor-block-patterns-explorer {
|
|
448
446
|
&__sidebar {
|
|
449
447
|
position: absolute;
|
|
450
|
-
top: $header-height + $grid-unit-
|
|
448
|
+
top: $header-height + $grid-unit-15;
|
|
451
449
|
left: 0;
|
|
452
450
|
bottom: 0;
|
|
453
451
|
width: $sidebar-width;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# InserterButton
|
|
2
|
+
|
|
3
|
+
InserterButton is a type of button component.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
function render() {
|
|
9
|
+
return (
|
|
10
|
+
<View>
|
|
11
|
+
<Text>Some rendered content here</Text>
|
|
12
|
+
<InserterButton
|
|
13
|
+
item={ { title: 'Short Text', icon: <SVG></SVG> } }
|
|
14
|
+
onSelect={ function ( item ) {
|
|
15
|
+
console.log( 'selected' );
|
|
16
|
+
} }
|
|
17
|
+
/>
|
|
18
|
+
</View>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
_Note:_
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
### `maxWidth`
|
|
28
|
+
|
|
29
|
+
- **Type:** `String`
|
|
30
|
+
- **Default:** `undefined`
|
|
31
|
+
|
|
32
|
+
The max-width of the button.
|
|
33
|
+
|
|
34
|
+
### `itemWidth`
|
|
35
|
+
|
|
36
|
+
- **Type:** `String`
|
|
37
|
+
- **Default:** `undefined`
|
|
38
|
+
|
|
39
|
+
The button width.
|
|
40
|
+
|
|
41
|
+
### `onSelect`
|
|
42
|
+
|
|
43
|
+
- **Type:** `Function`
|
|
44
|
+
- **Required** `true`
|
|
45
|
+
|
|
46
|
+
The function that is called once the InserterButton has been selected.
|
|
47
|
+
|
|
48
|
+
### `item`
|
|
49
|
+
|
|
50
|
+
- **Type:** `Object`
|
|
51
|
+
- **Required** `true`
|
|
52
|
+
|
|
53
|
+
The object that gets selected.
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
<InserterButton
|
|
58
|
+
item={ item }
|
|
59
|
+
itemWidth={ itemWidth }
|
|
60
|
+
maxWidth={ maxWidth }
|
|
61
|
+
onSelect={ onSelect }
|
|
62
|
+
/>
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { View, TouchableHighlight, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Component } from '@wordpress/element';
|
|
10
|
+
import { Icon } from '@wordpress/components';
|
|
11
|
+
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
12
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { BlockIcon } from '../block-icon';
|
|
18
|
+
import styles from './style.scss';
|
|
19
|
+
import sparkles from './sparkles';
|
|
20
|
+
class MenuItem extends Component {
|
|
21
|
+
constructor() {
|
|
22
|
+
super( ...arguments );
|
|
23
|
+
|
|
24
|
+
this.onPress = this.onPress.bind( this );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
onPress() {
|
|
28
|
+
const { onSelect, item } = this.props;
|
|
29
|
+
onSelect( item );
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const { getStylesFromColorScheme, item, itemWidth, maxWidth } =
|
|
34
|
+
this.props;
|
|
35
|
+
|
|
36
|
+
const modalIconWrapperStyle = getStylesFromColorScheme(
|
|
37
|
+
styles.modalIconWrapper,
|
|
38
|
+
styles.modalIconWrapperDark
|
|
39
|
+
);
|
|
40
|
+
const modalIconStyle = styles.modalIcon;
|
|
41
|
+
const modalItemLabelStyle = getStylesFromColorScheme(
|
|
42
|
+
styles.modalItemLabel,
|
|
43
|
+
styles.modalItemLabelDark
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const clipboardBlockStyles = getStylesFromColorScheme(
|
|
47
|
+
styles.clipboardBlock,
|
|
48
|
+
styles.clipboardBlockDark
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const isClipboardBlock = item.id === 'clipboard';
|
|
52
|
+
const blockTitle = isClipboardBlock ? __( 'Copied block' ) : item.title;
|
|
53
|
+
const blockIsNew = item.isNew === true;
|
|
54
|
+
const accessibilityLabelFormat = blockIsNew
|
|
55
|
+
? // translators: Newly available block name. %s: The localized block name
|
|
56
|
+
__( '%s block, newly available' )
|
|
57
|
+
: // translators: Block name. %s: The localized block name
|
|
58
|
+
__( '%s block' );
|
|
59
|
+
const accessibilityLabel = sprintf(
|
|
60
|
+
accessibilityLabelFormat,
|
|
61
|
+
item.title
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<TouchableHighlight
|
|
66
|
+
style={ [
|
|
67
|
+
styles.touchableArea,
|
|
68
|
+
item.isDisabled ? styles.disabled : null,
|
|
69
|
+
] }
|
|
70
|
+
underlayColor="transparent"
|
|
71
|
+
activeOpacity={ 0.5 }
|
|
72
|
+
accessibilityRole="button"
|
|
73
|
+
accessibilityLabel={ accessibilityLabel }
|
|
74
|
+
onPress={ this.onPress }
|
|
75
|
+
disabled={ item.isDisabled }
|
|
76
|
+
>
|
|
77
|
+
<View style={ [ styles.modalItem, { width: maxWidth } ] }>
|
|
78
|
+
<View
|
|
79
|
+
style={ [
|
|
80
|
+
modalIconWrapperStyle,
|
|
81
|
+
itemWidth && {
|
|
82
|
+
width: itemWidth,
|
|
83
|
+
},
|
|
84
|
+
isClipboardBlock && clipboardBlockStyles,
|
|
85
|
+
] }
|
|
86
|
+
>
|
|
87
|
+
{ blockIsNew && (
|
|
88
|
+
<Icon
|
|
89
|
+
icon={ sparkles }
|
|
90
|
+
style={ styles.newIndicator }
|
|
91
|
+
/>
|
|
92
|
+
) }
|
|
93
|
+
<View style={ modalIconStyle }>
|
|
94
|
+
<BlockIcon
|
|
95
|
+
icon={ item.icon }
|
|
96
|
+
size={ modalIconStyle.width }
|
|
97
|
+
/>
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
<Text numberOfLines={ 3 } style={ modalItemLabelStyle }>
|
|
101
|
+
{ blockTitle }
|
|
102
|
+
</Text>
|
|
103
|
+
</View>
|
|
104
|
+
</TouchableHighlight>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const InserterButton = withPreferredColorScheme( MenuItem );
|
|
110
|
+
|
|
111
|
+
InserterButton.Styles = {
|
|
112
|
+
modalItem: styles.modalItem,
|
|
113
|
+
modalIconWrapper: styles.modalIconWrapper,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default InserterButton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { SVG, Path } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
const sparkles = (
|
|
7
|
+
<SVG viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<Path
|
|
9
|
+
d="M10 11c-1.588-.479-4-.91-4-.91s2-.241 4-.454c1.8-.191 3.365-.502 4-3.181C14.635 3.775 15 1 15 1s.365 2.775 1 5.455c.635 2.679 2 2.969 4 3.181 2 .213 4 .455 4 .455s-2.412.43-4 .909c-1.588.479-3 1-4 4.546-.746 2.643-.893 4.948-1 5.454-.107-.506-.167-2.5-1-5.454C13 12 11.588 11.479 10 11zM7.333 3.5C6.803 3.333 6 3.182 6 3.182s.667-.085 1.333-.16c.6-.066 1.122-.175 1.334-1.113C8.878.971 9 0 9 0s.122.971.333 1.91c.212.937.667 1.038 1.334 1.113.666.074 1.333.159 1.333.159s-.804.15-1.333.318c-.53.167-1 .35-1.334 1.59C9.085 6.017 9.036 6.824 9 7c-.036-.177-.056-.875-.333-1.91-.334-1.24-.804-1.423-1.334-1.59zM2.444 18C1.474 17.713 0 17.454 0 17.454s1.222-.145 2.444-.272c1.1-.115 2.057-.302 2.445-1.91C5.277 13.666 5.5 12 5.5 12s.223 1.665.611 3.273c.388 1.607 1.222 1.781 2.445 1.909 1.222.127 2.444.273 2.444.273s-1.474.258-2.444.545c-.971.287-1.834.6-2.445 2.727-.456 1.586-.546 2.97-.611 3.273-.065-.304-.102-1.5-.611-3.273C4.278 18.6 3.415 18.287 2.444 18z"
|
|
10
|
+
fill="#F0C930"
|
|
11
|
+
/>
|
|
12
|
+
</SVG>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export default sparkles;
|