@wordpress/block-editor 12.0.0 → 12.2.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 +6 -0
- package/README.md +1 -1
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +6 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-controls/slot.js +12 -4
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +10 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/index.js +11 -7
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-editing-mode/index.js +84 -0
- package/build/components/block-editing-mode/index.js.map +1 -0
- package/build/components/block-list/block-invalid-warning.native.js +15 -7
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-block-context.js +15 -0
- package/build/components/block-list/block-list-block-context.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +15 -2
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +158 -195
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +57 -0
- package/build/components/block-list/block-outline.native.js.map +1 -0
- package/build/components/block-list/block.js +29 -37
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +347 -311
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +260 -357
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +4 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -5
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +15 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +8 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +15 -4
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +1 -2
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +8 -0
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +125 -0
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build/components/block-switcher/index.js +34 -12
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +22 -65
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +3 -8
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +7 -2
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.native.js +87 -3
- package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +86 -0
- package/build/components/global-styles/advanced-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +4 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +9 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +24 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +27 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +30 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +14 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +24 -8
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +7 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +19 -6
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +5 -0
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -6
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/line-height-control/index.js +7 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +9 -8
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/appender.js +6 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +9 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +25 -29
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -3
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +43 -22
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +27 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +163 -11
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +68 -7
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/preview-options/index.js +6 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +0 -2
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +25 -15
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +8 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +13 -7
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/align.js +4 -8
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/behaviors.js +115 -0
- package/build/hooks/behaviors.js.map +1 -0
- package/build/hooks/border.js +1 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -12
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +0 -30
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +5 -9
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -11
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-editor-wrapper-styles.native.js +255 -0
- package/build/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build/hooks/use-typography-props.js +14 -10
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/index.native.js +31 -0
- package/build/index.native.js.map +1 -0
- package/build/private-apis.js +4 -7
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +46 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +88 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +36 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +28 -18
- package/build/store/selectors.js.map +1 -1
- package/build/utils/order-inserter-block-items.js +41 -0
- package/build/utils/order-inserter-block-items.js.map +1 -0
- package/build/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-module/autocompleters/block.js +12 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +5 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-controls/slot.js +11 -4
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +9 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/index.js +10 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +2 -2
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +72 -0
- package/build-module/components/block-editing-mode/index.js.map +1 -0
- package/build-module/components/block-list/block-invalid-warning.native.js +16 -8
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-block-context.js +6 -0
- package/build-module/components/block-list/block-list-block-context.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +13 -2
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +160 -190
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +44 -0
- package/build-module/components/block-list/block-outline.native.js.map +1 -0
- package/build-module/components/block-list/block.js +26 -34
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +345 -310
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +263 -355
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +4 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +6 -5
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +15 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +8 -9
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +13 -5
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +1 -2
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build-module/components/block-switcher/index.js +33 -12
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +22 -65
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +3 -7
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +3 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +7 -2
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
- package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +74 -0
- package/build-module/components/global-styles/advanced-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +5 -2
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -8
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -1
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +25 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +25 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +24 -8
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +7 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +16 -6
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +4 -0
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -7
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/line-height-control/index.js +7 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +9 -8
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -2
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +9 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +24 -29
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +44 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +160 -11
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +66 -7
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +7 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +0 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +25 -16
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +8 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/align.js +4 -7
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/behaviors.js +97 -0
- package/build-module/hooks/behaviors.js.map +1 -0
- package/build-module/hooks/border.js +1 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +8 -11
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +0 -28
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -7
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -11
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-editor-wrapper-styles.native.js +242 -0
- package/build-module/hooks/use-editor-wrapper-styles.native.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +14 -10
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/index.native.js +6 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/private-apis.js +3 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +42 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +79 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +34 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +26 -17
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/order-inserter-block-items.js +32 -0
- package/build-module/utils/order-inserter-block-items.js.map +1 -0
- package/build-module/utils/use-should-contextual-toolbar-show.js +16 -12
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +1 -1
- package/build-style/content-rtl.css +32 -14
- package/build-style/content.css +32 -14
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +56 -77
- package/build-style/style.css +57 -77
- package/package.json +32 -31
- package/src/autocompleters/block.js +15 -7
- package/src/components/block-breadcrumb/index.js +11 -3
- package/src/components/block-breadcrumb/style.scss +2 -1
- package/src/components/block-controls/slot.js +8 -4
- package/src/components/block-controls/slot.native.js +6 -1
- package/src/components/block-draggable/index.js +10 -6
- package/src/components/block-draggable/use-scroll-when-dragging.js +8 -2
- package/src/components/block-editing-mode/index.js +71 -0
- package/src/components/block-list/block-invalid-warning.native.js +17 -9
- package/src/components/block-list/block-list-block-context.js +6 -0
- package/src/components/block-list/block-list-item-cell.native.js +10 -1
- package/src/components/block-list/block-list-item.native.js +180 -208
- package/src/components/block-list/block-outline.native.js +58 -0
- package/src/components/block-list/block.js +38 -56
- package/src/components/block-list/block.native.js +531 -501
- package/src/components/block-list/content.scss +5 -6
- package/src/components/block-list/index.native.js +324 -382
- package/src/components/block-list/insertion-point.native.js +2 -2
- package/src/components/block-list/test/block-invalid-warning.native.js +48 -0
- package/src/components/block-list/test/index.native.js +205 -0
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +7 -3
- package/src/components/block-list-appender/index.js +22 -4
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +26 -1
- package/src/components/block-mover/style.scss +1 -0
- package/src/components/block-pattern-setup/style.scss +1 -4
- package/src/components/block-patterns-list/style.scss +1 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +10 -17
- package/src/components/block-settings-menu-controls/index.js +24 -4
- package/src/components/block-styles/preview-panel.js +1 -3
- package/src/components/block-styles/style.scss +4 -4
- package/src/components/block-switcher/block-transformations-menu.js +12 -0
- package/src/components/block-switcher/block-variation-transformations.js +115 -0
- package/src/components/block-switcher/index.js +38 -5
- package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
- package/src/components/block-switcher/style.scss +6 -5
- package/src/components/block-toolbar/index.js +10 -11
- package/src/components/block-tools/block-contextual-toolbar.js +32 -67
- package/src/components/block-tools/insertion-point.js +23 -9
- package/src/components/block-tools/selected-block-popover.js +3 -5
- package/src/components/block-tools/style.scss +8 -0
- package/src/components/button-block-appender/content.scss +22 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +16 -2
- package/src/components/convert-to-group-buttons/index.js +9 -2
- package/src/components/convert-to-group-buttons/index.native.js +79 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
- package/src/components/global-styles/advanced-panel.js +82 -0
- package/src/components/global-styles/color-panel.js +6 -1
- package/src/components/global-styles/dimensions-panel.js +9 -8
- package/src/components/global-styles/hooks.js +1 -5
- package/src/components/global-styles/index.js +6 -1
- package/src/components/global-styles/style.scss +17 -0
- package/src/components/global-styles/test/utils.js +57 -1
- package/src/components/global-styles/typography-panel.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +21 -3
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/iframe/index.js +22 -12
- package/src/components/image-editor/use-save-image.js +20 -9
- package/src/components/inner-blocks/README.md +5 -0
- package/src/components/inner-blocks/index.js +2 -0
- package/src/components/inner-blocks/index.native.js +16 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
- package/src/components/inserter/index.js +1 -9
- package/src/components/inserter/quick-inserter.js +0 -2
- package/src/components/inserter/search-results.js +32 -6
- package/src/components/inserter-draggable-blocks/index.js +4 -0
- package/src/components/inspector-controls/fill.js +1 -1
- package/src/components/inspector-controls/fill.native.js +1 -1
- package/src/components/inspector-controls/slot.js +4 -9
- package/src/components/inspector-controls/slot.native.js +1 -1
- package/src/components/line-height-control/index.js +7 -2
- package/src/components/line-height-control/stories/index.js +1 -1
- package/src/components/link-control/test/index.js +42 -0
- package/src/components/link-control/use-internal-input-value.js +8 -7
- package/src/components/list-view/appender.js +3 -2
- package/src/components/list-view/block-contents.js +32 -20
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +34 -37
- package/src/components/list-view/branch.js +1 -7
- package/src/components/list-view/index.js +42 -17
- package/src/components/list-view/style.scss +7 -7
- package/src/components/list-view/test/use-list-view-drop-zone.js +88 -12
- package/src/components/list-view/use-list-view-client-ids.js +21 -4
- package/src/components/list-view/use-list-view-drop-zone.js +194 -11
- package/src/components/media-placeholder/index.js +74 -1
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/preview-options/index.js +9 -2
- package/src/components/publish-date-time-picker/index.js +0 -2
- package/src/components/spacing-sizes-control/spacing-input-control.js +1 -0
- package/src/components/url-input/README.md +6 -0
- package/src/components/url-input/index.js +2 -2
- package/src/components/use-block-drop-zone/index.js +31 -17
- package/src/components/use-resize-canvas/index.js +9 -1
- package/src/components/writing-flow/test/index.js +15 -0
- package/src/components/writing-flow/use-arrow-nav.js +17 -4
- package/src/hooks/align.js +5 -12
- package/src/hooks/behaviors.js +104 -0
- package/src/hooks/border.js +2 -1
- package/src/hooks/color.js +2 -1
- package/src/hooks/content-lock-ui.js +3 -15
- package/src/hooks/dimensions.js +0 -40
- package/src/hooks/duotone.js +4 -11
- package/src/hooks/index.js +1 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.js +14 -20
- package/src/hooks/position.js +2 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/use-editor-wrapper-styles.native.js +282 -0
- package/src/hooks/test/use-typography-props.js +47 -2
- package/src/hooks/use-editor-wrapper-styles.native.js +250 -0
- package/src/hooks/use-editor-wrapper-styles.native.scss +11 -0
- package/src/hooks/use-typography-props.js +10 -11
- package/src/index.native.js +6 -0
- package/src/private-apis.js +2 -4
- package/src/store/private-actions.js +39 -0
- package/src/store/private-selectors.js +95 -0
- package/src/store/reducer.js +27 -0
- package/src/store/selectors.js +25 -15
- package/src/store/test/private-actions.js +32 -1
- package/src/store/test/private-selectors.js +158 -0
- package/src/store/test/reducer.js +48 -0
- package/src/style.scss +0 -3
- package/src/utils/order-inserter-block-items.js +26 -0
- package/src/utils/use-should-contextual-toolbar-show.js +19 -9
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/block-list-compact.native.js +0 -75
- package/build/components/block-list/block-list-compact.native.js.map +0 -1
- package/build/components/off-canvas-editor/appender.js +0 -125
- package/build/components/off-canvas-editor/appender.js.map +0 -1
- package/build/components/off-canvas-editor/block-contents.js +0 -141
- package/build/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build/components/off-canvas-editor/block-select-button.js +0 -126
- package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build/components/off-canvas-editor/block.js +0 -297
- package/build/components/off-canvas-editor/block.js.map +0 -1
- package/build/components/off-canvas-editor/branch.js +0 -197
- package/build/components/off-canvas-editor/branch.js.map +0 -1
- package/build/components/off-canvas-editor/context.js +0 -19
- package/build/components/off-canvas-editor/context.js.map +0 -1
- package/build/components/off-canvas-editor/drop-indicator.js +0 -118
- package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build/components/off-canvas-editor/expander.js +0 -41
- package/build/components/off-canvas-editor/expander.js.map +0 -1
- package/build/components/off-canvas-editor/index.js +0 -236
- package/build/components/off-canvas-editor/index.js.map +0 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +0 -146
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build/components/off-canvas-editor/leaf.js +0 -60
- package/build/components/off-canvas-editor/leaf.js.map +0 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -186
- package/build/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build/components/off-canvas-editor/update-attributes.js +0 -108
- package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build/components/off-canvas-editor/use-block-selection.js +0 -139
- package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
- package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
- package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build/components/off-canvas-editor/utils.js +0 -60
- package/build/components/off-canvas-editor/utils.js.map +0 -1
- package/build-module/components/block-list/block-list-compact.native.js +0 -60
- package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
- package/build-module/components/off-canvas-editor/appender.js +0 -108
- package/build-module/components/off-canvas-editor/appender.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-contents.js +0 -121
- package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
- package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build-module/components/off-canvas-editor/block.js +0 -273
- package/build-module/components/off-canvas-editor/block.js.map +0 -1
- package/build-module/components/off-canvas-editor/branch.js +0 -179
- package/build-module/components/off-canvas-editor/branch.js.map +0 -1
- package/build-module/components/off-canvas-editor/context.js +0 -7
- package/build-module/components/off-canvas-editor/context.js.map +0 -1
- package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
- package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build-module/components/off-canvas-editor/expander.js +0 -32
- package/build-module/components/off-canvas-editor/expander.js.map +0 -1
- package/build-module/components/off-canvas-editor/index.js +0 -213
- package/build-module/components/off-canvas-editor/index.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -128
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf.js +0 -45
- package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -166
- package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
- package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
- package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build-module/components/off-canvas-editor/utils.js +0 -44
- package/build-module/components/off-canvas-editor/utils.js.map +0 -1
- package/src/components/block-list/block-list-compact.native.js +0 -63
- package/src/components/off-canvas-editor/README.md +0 -5
- package/src/components/off-canvas-editor/appender.js +0 -124
- package/src/components/off-canvas-editor/block-contents.js +0 -156
- package/src/components/off-canvas-editor/block-select-button.js +0 -128
- package/src/components/off-canvas-editor/block.js +0 -347
- package/src/components/off-canvas-editor/branch.js +0 -238
- package/src/components/off-canvas-editor/context.js +0 -8
- package/src/components/off-canvas-editor/drop-indicator.js +0 -126
- package/src/components/off-canvas-editor/expander.js +0 -26
- package/src/components/off-canvas-editor/index.js +0 -271
- package/src/components/off-canvas-editor/leaf-more-menu.js +0 -157
- package/src/components/off-canvas-editor/leaf.js +0 -52
- package/src/components/off-canvas-editor/link-ui.js +0 -167
- package/src/components/off-canvas-editor/style.scss +0 -34
- package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
- package/src/components/off-canvas-editor/test/utils.js +0 -50
- package/src/components/off-canvas-editor/update-attributes.js +0 -99
- package/src/components/off-canvas-editor/use-block-selection.js +0 -169
- package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
- package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
- package/src/components/off-canvas-editor/utils.js +0 -58
|
@@ -1 +1,79 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
|
+
import { switchToBlockType } from '@wordpress/blocks';
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as blockEditorStore } from '../../store';
|
|
13
|
+
import useConvertToGroupButtonProps from './use-convert-to-group-button-props';
|
|
14
|
+
|
|
15
|
+
function useConvertToGroupButtons( {
|
|
16
|
+
clientIds,
|
|
17
|
+
onUngroup,
|
|
18
|
+
blocksSelection,
|
|
19
|
+
groupingBlockName,
|
|
20
|
+
} ) {
|
|
21
|
+
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
22
|
+
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
23
|
+
const onConvertToGroup = () => {
|
|
24
|
+
// Activate the `transform` on the Grouping Block which does the conversion.
|
|
25
|
+
const newBlocks = switchToBlockType(
|
|
26
|
+
blocksSelection,
|
|
27
|
+
groupingBlockName
|
|
28
|
+
);
|
|
29
|
+
if ( newBlocks ) {
|
|
30
|
+
replaceBlocks( clientIds, newBlocks );
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const onConvertFromGroup = () => {
|
|
35
|
+
let innerBlocks = blocksSelection[ 0 ].innerBlocks;
|
|
36
|
+
if ( ! innerBlocks.length ) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if ( onUngroup ) {
|
|
40
|
+
innerBlocks = onUngroup(
|
|
41
|
+
blocksSelection[ 0 ].attributes,
|
|
42
|
+
blocksSelection[ 0 ].innerBlocks
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
replaceBlocks( clientIds, innerBlocks );
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
group: {
|
|
50
|
+
id: 'groupButtonOption',
|
|
51
|
+
label: _x( 'Group', 'verb' ),
|
|
52
|
+
value: 'groupButtonOption',
|
|
53
|
+
onSelect: () => {
|
|
54
|
+
onConvertToGroup();
|
|
55
|
+
createSuccessNotice(
|
|
56
|
+
// translators: displayed right after the block is grouped
|
|
57
|
+
__( 'Block grouped' )
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
ungroup: {
|
|
62
|
+
id: 'ungroupButtonOption',
|
|
63
|
+
label: _x(
|
|
64
|
+
'Ungroup',
|
|
65
|
+
'Ungrouping blocks from within a grouping block back into individual blocks within the Editor'
|
|
66
|
+
),
|
|
67
|
+
value: 'ungroupButtonOption',
|
|
68
|
+
onSelect: () => {
|
|
69
|
+
onConvertFromGroup();
|
|
70
|
+
createSuccessNotice(
|
|
71
|
+
// translators: displayed right after the block is ungrouped.
|
|
72
|
+
__( 'Block ungrouped' )
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { useConvertToGroupButtons, useConvertToGroupButtonProps };
|
|
@@ -31,13 +31,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
31
31
|
* @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`.
|
|
32
32
|
*/
|
|
33
33
|
export default function useConvertToGroupButtonProps( selectedClientIds ) {
|
|
34
|
-
|
|
35
|
-
clientIds,
|
|
36
|
-
isGroupable,
|
|
37
|
-
isUngroupable,
|
|
38
|
-
blocksSelection,
|
|
39
|
-
groupingBlockName,
|
|
40
|
-
} = useSelect(
|
|
34
|
+
return useSelect(
|
|
41
35
|
( select ) => {
|
|
42
36
|
const {
|
|
43
37
|
getBlockRootClientId,
|
|
@@ -45,54 +39,54 @@ export default function useConvertToGroupButtonProps( selectedClientIds ) {
|
|
|
45
39
|
canInsertBlockType,
|
|
46
40
|
getSelectedBlockClientIds,
|
|
47
41
|
} = select( blockEditorStore );
|
|
48
|
-
const { getGroupingBlockName } =
|
|
49
|
-
|
|
50
|
-
const
|
|
42
|
+
const { getGroupingBlockName, getBlockType } =
|
|
43
|
+
select( blocksStore );
|
|
44
|
+
const clientIds = selectedClientIds?.length
|
|
51
45
|
? selectedClientIds
|
|
52
46
|
: getSelectedBlockClientIds();
|
|
53
|
-
const
|
|
47
|
+
const groupingBlockName = getGroupingBlockName();
|
|
54
48
|
|
|
55
|
-
const rootClientId =
|
|
56
|
-
? getBlockRootClientId(
|
|
49
|
+
const rootClientId = clientIds?.length
|
|
50
|
+
? getBlockRootClientId( clientIds[ 0 ] )
|
|
57
51
|
: undefined;
|
|
58
52
|
|
|
59
53
|
const groupingBlockAvailable = canInsertBlockType(
|
|
60
|
-
|
|
54
|
+
groupingBlockName,
|
|
61
55
|
rootClientId
|
|
62
56
|
);
|
|
63
57
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
const blocksSelection = getBlocksByClientId( clientIds );
|
|
59
|
+
const isSingleBlockSelected = blocksSelection.length === 1;
|
|
60
|
+
const [ firstSelectedBlock ] = blocksSelection;
|
|
61
|
+
// A block is ungroupable if it is a single grouping block with inner blocks.
|
|
62
|
+
// If a block has an `ungroup` transform, it is also ungroupable, without the
|
|
63
|
+
// requirement of being the default grouping block.
|
|
64
|
+
// Do we have a single grouping Block selected and does that group have inner blocks?
|
|
65
|
+
const isUngroupable =
|
|
66
|
+
isSingleBlockSelected &&
|
|
67
|
+
( firstSelectedBlock.name === groupingBlockName ||
|
|
68
|
+
getBlockType( firstSelectedBlock.name )?.transforms
|
|
69
|
+
?.ungroup ) &&
|
|
70
|
+
!! firstSelectedBlock.innerBlocks.length;
|
|
69
71
|
|
|
70
72
|
// Do we have
|
|
71
73
|
// 1. Grouping block available to be inserted?
|
|
72
74
|
// 2. One or more blocks selected
|
|
73
|
-
const
|
|
74
|
-
groupingBlockAvailable &&
|
|
75
|
+
const isGroupable =
|
|
76
|
+
groupingBlockAvailable && blocksSelection.length;
|
|
75
77
|
|
|
76
|
-
// Do we have a single Group Block selected and does that group have inner blocks?
|
|
77
|
-
const _isUngroupable =
|
|
78
|
-
isSingleGroupingBlock &&
|
|
79
|
-
!! _blocksSelection[ 0 ].innerBlocks.length;
|
|
80
78
|
return {
|
|
81
|
-
clientIds
|
|
82
|
-
isGroupable
|
|
83
|
-
isUngroupable
|
|
84
|
-
blocksSelection
|
|
85
|
-
groupingBlockName
|
|
79
|
+
clientIds,
|
|
80
|
+
isGroupable,
|
|
81
|
+
isUngroupable,
|
|
82
|
+
blocksSelection,
|
|
83
|
+
groupingBlockName,
|
|
84
|
+
onUngroup:
|
|
85
|
+
isUngroupable &&
|
|
86
|
+
getBlockType( firstSelectedBlock.name )?.transforms
|
|
87
|
+
?.ungroup,
|
|
86
88
|
};
|
|
87
89
|
},
|
|
88
90
|
[ selectedClientIds ]
|
|
89
91
|
);
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
clientIds,
|
|
93
|
-
isGroupable,
|
|
94
|
-
isUngroupable,
|
|
95
|
-
blocksSelection,
|
|
96
|
-
groupingBlockName,
|
|
97
|
-
};
|
|
98
92
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
TextareaControl,
|
|
6
|
+
Tooltip,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { Icon, info } from '@wordpress/icons';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { default as transformStyles } from '../../utils/transform-styles';
|
|
17
|
+
|
|
18
|
+
export default function AdvancedPanel( {
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
inheritedValue = value,
|
|
22
|
+
} ) {
|
|
23
|
+
// Custom CSS
|
|
24
|
+
const [ cssError, setCSSError ] = useState( null );
|
|
25
|
+
const customCSS = inheritedValue?.css;
|
|
26
|
+
function handleOnChange( newValue ) {
|
|
27
|
+
onChange( {
|
|
28
|
+
...value,
|
|
29
|
+
css: newValue,
|
|
30
|
+
} );
|
|
31
|
+
if ( cssError ) {
|
|
32
|
+
const [ transformed ] = transformStyles(
|
|
33
|
+
[ { css: value } ],
|
|
34
|
+
'.editor-styles-wrapper'
|
|
35
|
+
);
|
|
36
|
+
if ( transformed ) {
|
|
37
|
+
setCSSError( null );
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function handleOnBlur( event ) {
|
|
42
|
+
if ( ! event?.target?.value ) {
|
|
43
|
+
setCSSError( null );
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const [ transformed ] = transformStyles(
|
|
48
|
+
[ { css: event.target.value } ],
|
|
49
|
+
'.editor-styles-wrapper'
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
setCSSError(
|
|
53
|
+
transformed === null
|
|
54
|
+
? __( 'There is an error with your CSS structure.' )
|
|
55
|
+
: null
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<VStack spacing={ 3 }>
|
|
61
|
+
<TextareaControl
|
|
62
|
+
label={ __( 'Additional CSS' ) }
|
|
63
|
+
__nextHasNoMarginBottom
|
|
64
|
+
value={ customCSS }
|
|
65
|
+
onChange={ ( newValue ) => handleOnChange( newValue ) }
|
|
66
|
+
onBlur={ handleOnBlur }
|
|
67
|
+
className="block-editor-global-styles-advanced-panel__custom-css-input"
|
|
68
|
+
spellCheck={ false }
|
|
69
|
+
/>
|
|
70
|
+
{ cssError && (
|
|
71
|
+
<Tooltip text={ cssError }>
|
|
72
|
+
<div className="block-editor-global-styles-advanced-panel__custom-css-validation-wrapper">
|
|
73
|
+
<Icon
|
|
74
|
+
icon={ info }
|
|
75
|
+
className="block-editor-global-styles-advanced-panel__custom-css-validation-icon"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</Tooltip>
|
|
79
|
+
) }
|
|
80
|
+
</VStack>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
Button,
|
|
21
21
|
} from '@wordpress/components';
|
|
22
22
|
import { useCallback } from '@wordpress/element';
|
|
23
|
-
import { __ } from '@wordpress/i18n';
|
|
23
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Internal dependencies
|
|
@@ -230,6 +230,11 @@ function ColorPanelDropdown( {
|
|
|
230
230
|
{ 'is-open': isOpen }
|
|
231
231
|
),
|
|
232
232
|
'aria-expanded': isOpen,
|
|
233
|
+
'aria-label': sprintf(
|
|
234
|
+
/* translators: %s is the type of color property, e.g., "background" */
|
|
235
|
+
__( 'Color %s styles' ),
|
|
236
|
+
label
|
|
237
|
+
),
|
|
233
238
|
};
|
|
234
239
|
|
|
235
240
|
return (
|
|
@@ -103,8 +103,9 @@ function useHasSpacingPresets( settings ) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
function filterValuesBySides( values, sides ) {
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
// If no custom side configuration, all sides are opted into by default.
|
|
107
|
+
// Without any values, we have nothing to filter either.
|
|
108
|
+
if ( ! sides || ! values ) {
|
|
108
109
|
return values;
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -184,12 +185,12 @@ function DimensionsToolsPanel( {
|
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
const DEFAULT_CONTROLS = {
|
|
187
|
-
contentSize:
|
|
188
|
-
wideSize:
|
|
189
|
-
padding:
|
|
190
|
-
margin:
|
|
191
|
-
blockGap:
|
|
192
|
-
minHeight:
|
|
188
|
+
contentSize: true,
|
|
189
|
+
wideSize: true,
|
|
190
|
+
padding: true,
|
|
191
|
+
margin: true,
|
|
192
|
+
blockGap: true,
|
|
193
|
+
minHeight: true,
|
|
193
194
|
childLayout: true,
|
|
194
195
|
};
|
|
195
196
|
|
|
@@ -181,11 +181,7 @@ export function useGlobalStyle(
|
|
|
181
181
|
let rawResult, result;
|
|
182
182
|
switch ( source ) {
|
|
183
183
|
case 'all':
|
|
184
|
-
rawResult =
|
|
185
|
-
// The styles.css path is allowed to be empty, so don't revert to base if undefined.
|
|
186
|
-
finalPath === 'styles.css'
|
|
187
|
-
? get( userConfig, finalPath )
|
|
188
|
-
: get( mergedConfig, finalPath );
|
|
184
|
+
rawResult = get( mergedConfig, finalPath );
|
|
189
185
|
result = shouldDecodeEncode
|
|
190
186
|
? getValueFromVariable( mergedConfig, blockName, rawResult )
|
|
191
187
|
: rawResult;
|
|
@@ -5,7 +5,10 @@ export {
|
|
|
5
5
|
useSettingsForBlockElement,
|
|
6
6
|
} from './hooks';
|
|
7
7
|
export { getBlockCSSSelector } from './get-block-css-selector';
|
|
8
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
useGlobalStylesOutput,
|
|
10
|
+
useGlobalStylesOutputWithConfig,
|
|
11
|
+
} from './use-global-styles-output';
|
|
9
12
|
export { GlobalStylesContext } from './context';
|
|
10
13
|
export {
|
|
11
14
|
default as TypographyPanel,
|
|
@@ -19,3 +22,5 @@ export { default as BorderPanel, useHasBorderPanel } from './border-panel';
|
|
|
19
22
|
export { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
20
23
|
export { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';
|
|
21
24
|
export { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';
|
|
25
|
+
export { default as AdvancedPanel } from './advanced-panel';
|
|
26
|
+
export { areGlobalStyleConfigsEqual } from './utils';
|
|
@@ -41,3 +41,20 @@
|
|
|
41
41
|
height: 24px;
|
|
42
42
|
width: 24px;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
.block-editor-global-styles-advanced-panel__custom-css-input textarea {
|
|
46
|
+
font-family: $editor_html_font;
|
|
47
|
+
// CSS input is always LTR regardless of language.
|
|
48
|
+
/*rtl:ignore*/
|
|
49
|
+
direction: ltr;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
|
|
53
|
+
position: absolute;
|
|
54
|
+
bottom: $grid-unit-20;
|
|
55
|
+
right: $grid-unit * 3;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.block-editor-global-styles-advanced-panel__custom-css-validation-icon {
|
|
59
|
+
fill: $alert-red;
|
|
60
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
areGlobalStyleConfigsEqual,
|
|
6
|
+
getPresetVariableFromValue,
|
|
7
|
+
getValueFromVariable,
|
|
8
|
+
} from '../utils';
|
|
5
9
|
|
|
6
10
|
describe( 'editor utils', () => {
|
|
7
11
|
const themeJson = {
|
|
@@ -203,4 +207,56 @@ describe( 'editor utils', () => {
|
|
|
203
207
|
} );
|
|
204
208
|
} );
|
|
205
209
|
} );
|
|
210
|
+
|
|
211
|
+
describe( 'areGlobalStyleConfigsEqual', () => {
|
|
212
|
+
test.each( [
|
|
213
|
+
{ original: null, variation: null, expected: true },
|
|
214
|
+
{ original: {}, variation: {}, expected: true },
|
|
215
|
+
{ original: {}, variation: undefined, expected: false },
|
|
216
|
+
{
|
|
217
|
+
original: {
|
|
218
|
+
styles: {
|
|
219
|
+
color: { text: 'var(--wp--preset--color--red)' },
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
variation: {
|
|
223
|
+
styles: {
|
|
224
|
+
color: { text: 'var(--wp--preset--color--blue)' },
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
expected: false,
|
|
228
|
+
},
|
|
229
|
+
{ original: {}, variation: undefined, expected: false },
|
|
230
|
+
{
|
|
231
|
+
original: {
|
|
232
|
+
styles: {
|
|
233
|
+
color: { text: 'var(--wp--preset--color--red)' },
|
|
234
|
+
},
|
|
235
|
+
settings: {
|
|
236
|
+
typography: {
|
|
237
|
+
fontSize: true,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
variation: {
|
|
242
|
+
styles: {
|
|
243
|
+
color: { text: 'var(--wp--preset--color--red)' },
|
|
244
|
+
},
|
|
245
|
+
settings: {
|
|
246
|
+
typography: {
|
|
247
|
+
fontSize: true,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
expected: true,
|
|
252
|
+
},
|
|
253
|
+
] )(
|
|
254
|
+
'.areGlobalStyleConfigsEqual( $original, $variation )',
|
|
255
|
+
( { original, variation, expected } ) => {
|
|
256
|
+
expect(
|
|
257
|
+
areGlobalStyleConfigsEqual( original, variation )
|
|
258
|
+
).toBe( expected );
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
} );
|
|
206
262
|
} );
|
|
@@ -238,7 +238,7 @@ export default function TypographyPanel( {
|
|
|
238
238
|
)
|
|
239
239
|
);
|
|
240
240
|
};
|
|
241
|
-
const hasLineHeight = () =>
|
|
241
|
+
const hasLineHeight = () => value?.typography?.lineHeight !== undefined;
|
|
242
242
|
const resetLineHeight = () => setLineHeight( undefined );
|
|
243
243
|
|
|
244
244
|
// Letter Spacing
|
|
@@ -1106,9 +1106,17 @@ const processCSSNesting = ( css, blockSelector ) => {
|
|
|
1106
1106
|
return processedCSS;
|
|
1107
1107
|
};
|
|
1108
1108
|
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1109
|
+
/**
|
|
1110
|
+
* Returns the global styles output using a global styles configuration.
|
|
1111
|
+
* If wishing to generate global styles and settings based on the
|
|
1112
|
+
* global styles config loaded in the editor context, use `useGlobalStylesOutput()`.
|
|
1113
|
+
* The use case for a custom config is to generate bespoke styles
|
|
1114
|
+
* and settings for previews, or other out-of-editor experiences.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {Object} mergedConfig Global styles configuration.
|
|
1117
|
+
* @return {Array} Array of stylesheets and settings.
|
|
1118
|
+
*/
|
|
1119
|
+
export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
1112
1120
|
const [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );
|
|
1113
1121
|
const hasBlockGapSupport = blockGap !== null;
|
|
1114
1122
|
const hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
|
|
@@ -1190,3 +1198,13 @@ export function useGlobalStylesOutput() {
|
|
|
1190
1198
|
disableLayoutStyles,
|
|
1191
1199
|
] );
|
|
1192
1200
|
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Returns the global styles output based on the current state of global styles config loaded in the editor context.
|
|
1204
|
+
*
|
|
1205
|
+
* @return {Array} Array of stylesheets and settings.
|
|
1206
|
+
*/
|
|
1207
|
+
export function useGlobalStylesOutput() {
|
|
1208
|
+
const { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
1209
|
+
return useGlobalStylesOutputWithConfig( mergedConfig );
|
|
1210
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { get } from 'lodash';
|
|
5
|
+
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -376,3 +377,29 @@ export function scopeSelector( scope, selector ) {
|
|
|
376
377
|
|
|
377
378
|
return selectorsScoped.join( ', ' );
|
|
378
379
|
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Compares global style variations according to their styles and settings properties.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```js
|
|
386
|
+
* const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };
|
|
387
|
+
* const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };
|
|
388
|
+
* const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );
|
|
389
|
+
* // false
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @param {Object} original A global styles object.
|
|
393
|
+
* @param {Object} variation A global styles object.
|
|
394
|
+
*
|
|
395
|
+
* @return {boolean} Whether `original` and `variation` match.
|
|
396
|
+
*/
|
|
397
|
+
export function areGlobalStyleConfigsEqual( original, variation ) {
|
|
398
|
+
if ( typeof original !== 'object' || typeof variation !== 'object' ) {
|
|
399
|
+
return original === variation;
|
|
400
|
+
}
|
|
401
|
+
return (
|
|
402
|
+
fastDeepEqual( original?.styles, variation?.styles ) &&
|
|
403
|
+
fastDeepEqual( original?.settings, variation?.settings )
|
|
404
|
+
);
|
|
405
|
+
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useMemo,
|
|
14
14
|
useReducer,
|
|
15
15
|
renderToString,
|
|
16
|
+
useEffect,
|
|
16
17
|
} from '@wordpress/element';
|
|
17
18
|
import { __ } from '@wordpress/i18n';
|
|
18
19
|
import {
|
|
@@ -243,10 +244,16 @@ function Iframe( {
|
|
|
243
244
|
// Correct doctype is required to enable rendering in standards
|
|
244
245
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
245
246
|
// content.
|
|
246
|
-
const
|
|
247
|
-
|
|
247
|
+
const src = useMemo( () => {
|
|
248
|
+
const html = '<!doctype html>' + renderToString( styleAssets );
|
|
249
|
+
const blob = new window.Blob( [ html ], { type: 'text/html' } );
|
|
250
|
+
return URL.createObjectURL( blob );
|
|
248
251
|
}, [] );
|
|
249
252
|
|
|
253
|
+
useEffect( () => () => {
|
|
254
|
+
URL.revokeObjectURL( src );
|
|
255
|
+
} );
|
|
256
|
+
|
|
250
257
|
// We need to counter the margin created by scaling the iframe. If the scale
|
|
251
258
|
// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the
|
|
252
259
|
// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
|
|
@@ -260,15 +267,18 @@ function Iframe( {
|
|
|
260
267
|
style={ {
|
|
261
268
|
...props.style,
|
|
262
269
|
height: expand ? contentHeight : props.style?.height,
|
|
263
|
-
marginTop:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
marginTop:
|
|
271
|
+
scale !== 1
|
|
272
|
+
? -marginFromScaling + frameSize
|
|
273
|
+
: props.style?.marginTop,
|
|
274
|
+
marginBottom:
|
|
275
|
+
scale !== 1
|
|
276
|
+
? -marginFromScaling + frameSize
|
|
277
|
+
: props.style?.marginBottom,
|
|
278
|
+
transform:
|
|
279
|
+
scale !== 1
|
|
280
|
+
? `scale( ${ scale } )`
|
|
281
|
+
: props.style?.transform,
|
|
272
282
|
transition: 'all .3s',
|
|
273
283
|
} }
|
|
274
284
|
ref={ useMergeRefs( [ ref, setRef ] ) }
|
|
@@ -276,7 +286,7 @@ function Iframe( {
|
|
|
276
286
|
// Correct doctype is required to enable rendering in standards
|
|
277
287
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
278
288
|
// content.
|
|
279
|
-
|
|
289
|
+
src={ src }
|
|
280
290
|
title={ __( 'Editor canvas' ) }
|
|
281
291
|
>
|
|
282
292
|
{ iframeDocument &&
|
|
@@ -32,24 +32,35 @@ export default function useSaveImage( {
|
|
|
32
32
|
const apply = useCallback( () => {
|
|
33
33
|
setIsInProgress( true );
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const modifiers = [];
|
|
36
|
+
|
|
37
|
+
if ( rotation > 0 ) {
|
|
38
|
+
modifiers.push( {
|
|
39
|
+
type: 'rotate',
|
|
40
|
+
args: {
|
|
41
|
+
angle: rotation,
|
|
42
|
+
},
|
|
43
|
+
} );
|
|
44
|
+
}
|
|
36
45
|
|
|
37
46
|
// The crop script may return some very small, sub-pixel values when the image was not cropped.
|
|
38
47
|
// Crop only when the new size has changed by more than 0.1%.
|
|
39
48
|
if ( crop.width < 99.9 || crop.height < 99.9 ) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
modifiers.push( {
|
|
50
|
+
type: 'crop',
|
|
51
|
+
args: {
|
|
52
|
+
left: crop.x,
|
|
53
|
+
top: crop.y,
|
|
54
|
+
width: crop.width,
|
|
55
|
+
height: crop.height,
|
|
56
|
+
},
|
|
57
|
+
} );
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
attrs.src = url;
|
|
48
|
-
|
|
49
60
|
apiFetch( {
|
|
50
61
|
path: `/wp/v2/media/${ id }/edit`,
|
|
51
62
|
method: 'POST',
|
|
52
|
-
data:
|
|
63
|
+
data: { src: url, modifiers },
|
|
53
64
|
} )
|
|
54
65
|
.then( ( response ) => {
|
|
55
66
|
onSaveImage( {
|
|
@@ -180,3 +180,8 @@ For example, a button block, deeply nested in several levels of block `X` that u
|
|
|
180
180
|
|
|
181
181
|
- **Type:** `Function`
|
|
182
182
|
- **Default:** - `undefined`. The placeholder is an optional function that can be passed in to be a rendered component placed in front of the appender. This can be used to represent an example state prior to any blocks being placed. See the Social Links for an implementation example.
|
|
183
|
+
|
|
184
|
+
### `prioritizedInserterBlocks`
|
|
185
|
+
|
|
186
|
+
- **Type:** `Array`
|
|
187
|
+
- **Default:** - `undefined`. Determines which block types should be shown in the block inserter. For example, when inserting a block within the Navigation block we specify `core/navigation-link` and `core/navigation-link/page` as these are the most commonly used inner blocks. `prioritizedInserterBlocks` takes an array of the form {blockName}/{variationName}, where {variationName} is optional.
|
|
@@ -45,6 +45,7 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
45
45
|
const {
|
|
46
46
|
clientId,
|
|
47
47
|
allowedBlocks,
|
|
48
|
+
prioritizedInserterBlocks,
|
|
48
49
|
__experimentalDefaultBlock,
|
|
49
50
|
__experimentalDirectInsert,
|
|
50
51
|
template,
|
|
@@ -62,6 +63,7 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
62
63
|
useNestedSettingsUpdate(
|
|
63
64
|
clientId,
|
|
64
65
|
allowedBlocks,
|
|
66
|
+
prioritizedInserterBlocks,
|
|
65
67
|
__experimentalDefaultBlock,
|
|
66
68
|
__experimentalDirectInsert,
|
|
67
69
|
templateLock,
|