@wordpress/block-editor 9.0.0 → 9.3.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 +10 -0
- package/README.md +1 -0
- package/build/autocompleters/block.js +3 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +4 -13
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +4 -82
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-context/index.js.map +1 -1
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +65 -0
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +488 -0
- package/build/components/block-draggable/index.native.js.map +1 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build/components/block-list/block-list-context.native.js +195 -0
- package/build/components/block-list/block-list-context.native.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +67 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build/components/block-list/block-list-item.native.js +12 -9
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +27 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +34 -32
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +75 -23
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -4
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +10 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.native.js +17 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-popover/inbetween.js +19 -8
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +5 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-selection-clearer/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +3 -7
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +6 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +6 -3
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +3 -7
- package/build/components/block-styles/menu-items.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-toolbar/utils.js +5 -8
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -0
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -29
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +16 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +10 -3
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +122 -41
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +22 -5
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/copy-handler/index.js +17 -1
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/iframe/index.js +51 -50
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +3 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +31 -13
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/no-results.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +1 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +56 -0
- package/build/components/inspector-popover-header/index.js.map +1 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/constants.js +11 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/index.js +4 -4
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -3
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +5 -3
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +4 -3
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +3 -7
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +4 -4
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +0 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +1 -7
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -6
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +20 -7
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +10 -4
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +62 -7
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +4 -0
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +5 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +53 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -0
- package/build/components/rich-text/embed-handler-picker.native.js +4 -8
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +5 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +3 -7
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +18 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +167 -0
- package/build/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build/components/use-display-block-controls/index.native.js.map +1 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.native.js +95 -0
- package/build/components/use-on-block-drop/index.native.js.map +1 -0
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/warning/index.js +6 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +12 -12
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-input.js +15 -0
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/elements/index.js +9 -0
- package/build/elements/index.js.map +1 -0
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -7
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +14 -7
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color-panel.native.js.map +1 -1
- package/build/hooks/color.js +8 -88
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +14 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +38 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +14 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +6 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +5 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +14 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +17 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +30 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/autocompleters/block.js +4 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +3 -11
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +3 -78
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-context/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +51 -0
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +453 -0
- package/build-module/components/block-draggable/index.native.js.map +1 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build-module/components/block-list/block-list-context.native.js +179 -0
- package/build-module/components/block-list/block-list-context.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item.native.js +12 -9
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +26 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +35 -33
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +72 -23
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -5
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +9 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +18 -5
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -1
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +19 -8
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +5 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-selection-clearer/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -5
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +9 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +5 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +3 -5
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/utils.js +3 -5
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -0
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +2 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +13 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +11 -4
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +124 -43
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/copy-handler/index.js +18 -2
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/iframe/index.js +52 -51
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +4 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +4 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -5
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +2 -2
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +46 -0
- package/build-module/components/inspector-popover-header/index.js.map +1 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/constants.js +5 -0
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -2
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +3 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -4
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +2 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +5 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +0 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -6
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +22 -9
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +8 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +63 -8
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -0
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +4 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +40 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js +3 -5
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +5 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -5
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +15 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +148 -0
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build-module/components/use-display-block-controls/index.native.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.native.js +83 -0
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/warning/index.js +6 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +12 -11
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +15 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/elements/index.js +2 -0
- package/build-module/elements/index.js.map +1 -0
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -7
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +11 -6
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color-panel.native.js.map +1 -1
- package/build-module/hooks/color.js +8 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +14 -4
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +39 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +15 -14
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +6 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +4 -2
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +12 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +25 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +79 -197
- package/build-style/style.css +79 -197
- package/package.json +30 -30
- package/src/autocompleters/block.js +2 -1
- package/src/components/block-actions/index.js +2 -3
- package/src/components/block-alignment-control/ui.js +4 -6
- package/src/components/block-alignment-matrix-control/index.js +3 -9
- package/src/components/block-breadcrumb/index.js +2 -5
- package/src/components/block-compare/test/block-view.js +2 -1
- package/src/components/block-content-overlay/index.js +10 -100
- package/src/components/block-content-overlay/style.scss +2 -11
- package/src/components/block-context/index.js +4 -4
- package/src/components/block-controls/hook.js +2 -3
- package/src/components/block-draggable/draggable-chip.native.js +49 -0
- package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
- package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
- package/src/components/block-draggable/index.js +6 -13
- package/src/components/block-draggable/index.native.js +454 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
- package/src/components/block-draggable/test/helpers.native.js +183 -0
- package/src/components/block-draggable/test/index.native.js +493 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-edit/test/edit.js +2 -1
- package/src/components/block-list/block-list-context.native.js +175 -0
- package/src/components/block-list/block-list-item-cell.native.js +49 -0
- package/src/components/block-list/block-list-item.native.js +11 -23
- package/src/components/block-list/block-selection-button.native.js +2 -3
- package/src/components/block-list/block.js +8 -10
- package/src/components/block-list/block.native.js +47 -23
- package/src/components/block-list/index.js +46 -47
- package/src/components/block-list/index.native.js +63 -31
- package/src/components/block-list/test/block-list-context.native.js +245 -0
- package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
- package/src/components/block-list/use-block-props/index.js +16 -8
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +2 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -3
- package/src/components/block-list/use-in-between-inserter.js +3 -4
- package/src/components/block-list-appender/index.js +2 -5
- package/src/components/block-list-appender/index.native.js +2 -3
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
- package/src/components/block-mobile-toolbar/index.native.js +9 -1
- package/src/components/block-mover/button.js +2 -3
- package/src/components/block-mover/index.native.js +26 -12
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -0
- package/src/components/block-parent-selector/index.js +2 -3
- package/src/components/block-pattern-setup/index.js +3 -5
- package/src/components/block-popover/inbetween.js +21 -8
- package/src/components/block-popover/index.js +2 -16
- package/src/components/block-popover/style.scss +1 -0
- package/src/components/block-preview/auto.js +4 -8
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-selection-clearer/index.js +2 -3
- package/src/components/block-settings-menu/block-mode-toggle.js +4 -8
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -9
- package/src/components/block-styles/index.js +3 -1
- package/src/components/block-styles/menu-items.js +2 -5
- package/src/components/block-switcher/block-transformations-menu.js +2 -4
- package/src/components/block-switcher/style.scss +2 -39
- package/src/components/block-toolbar/index.native.js +2 -5
- package/src/components/block-toolbar/utils.js +3 -11
- package/src/components/block-tools/block-contextual-toolbar.js +2 -5
- package/src/components/block-tools/block-selection-button.js +1 -0
- package/src/components/block-tools/index.js +2 -3
- package/src/components/block-tools/selected-block-popover.js +1 -36
- package/src/components/block-tools/style.scss +1 -12
- package/src/components/block-types-list/index.native.js +2 -4
- package/src/components/block-variation-transforms/index.js +10 -8
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +3 -2
- package/src/components/color-palette/test/control.js +2 -1
- package/src/components/color-style-selector/index.js +27 -28
- package/src/components/colors/test/with-colors.js +14 -14
- package/src/components/colors/with-colors.js +8 -12
- package/src/components/colors-gradients/dropdown.js +135 -62
- package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
- package/src/components/colors-gradients/style.scss +52 -50
- package/src/components/colors-gradients/test/control.js +10 -10
- package/src/components/convert-to-group-buttons/toolbar.js +32 -19
- package/src/components/copy-handler/README.md +7 -2
- package/src/components/copy-handler/index.js +26 -6
- package/src/components/default-block-appender/index.js +4 -6
- package/src/components/default-block-appender/index.native.js +4 -9
- package/src/components/default-style-picker/index.js +20 -21
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/font-sizes/with-font-sizes.js +2 -3
- package/src/components/iframe/index.js +62 -54
- package/src/components/image-editor/aspect-ratio-dropdown.js +2 -6
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/image-size-control/index.js +4 -7
- package/src/components/index.js +4 -2
- package/src/components/inner-blocks/use-inner-block-template-sync.js +2 -3
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -9
- package/src/components/inserter/block-types-tab.native.js +2 -3
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -3
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/hooks/use-patterns-state.js +4 -5
- package/src/components/inserter/index.js +4 -6
- package/src/components/inserter/index.native.js +7 -12
- package/src/components/inserter/library.js +2 -5
- package/src/components/inserter/menu.js +14 -19
- package/src/components/inserter/menu.native.js +8 -6
- package/src/components/inserter/no-results.native.js +2 -1
- package/src/components/inserter/quick-inserter.js +2 -3
- package/src/components/inserter/search-items.js +6 -6
- package/src/components/inserter/search-results.native.js +4 -6
- package/src/components/inserter/style.scss +2 -1
- package/src/components/inspector-popover-header/README.md +76 -0
- package/src/components/inspector-popover-header/index.js +56 -0
- package/src/components/inspector-popover-header/style.scss +16 -0
- package/src/components/line-height-control/index.js +1 -2
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/index.js +4 -4
- package/src/components/link-control/search-create-button.js +4 -2
- package/src/components/link-control/search-input.js +3 -1
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/settings-drawer.js +2 -5
- package/src/components/link-control/test/fixtures/index.js +3 -4
- package/src/components/link-control/test/index.js +24 -36
- package/src/components/link-control/use-search-handler.js +13 -7
- package/src/components/list-view/block-contents.js +2 -4
- package/src/components/list-view/branch.js +22 -23
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/index.js +4 -8
- package/src/components/list-view/style.scss +2 -1
- package/src/components/list-view/use-block-selection.js +5 -5
- package/src/components/list-view/use-list-view-drop-zone.js +2 -1
- package/src/components/list-view/utils.js +1 -6
- package/src/components/media-placeholder/index.js +2 -3
- package/src/components/media-replace-flow/index.js +77 -48
- package/src/components/media-upload/index.native.js +6 -2
- package/src/components/media-upload/test/index.native.js +31 -6
- package/src/components/navigable-toolbar/index.js +13 -4
- package/src/components/panel-color-settings/test/index.js +2 -1
- package/src/components/plain-text/index.native.js +60 -8
- package/src/components/preview-options/index.js +4 -0
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/provider/use-block-sync.js +5 -2
- package/src/components/publish-date-time-picker/README.md +52 -0
- package/src/components/publish-date-time-picker/index.js +39 -0
- package/src/components/responsive-block-control/test/index.js +3 -2
- package/src/components/rich-text/embed-handler-picker.native.js +2 -5
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +10 -5
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/rich-text/use-format-types.js +16 -16
- package/src/components/rich-text/use-mark-persistent.js +2 -3
- package/src/components/skip-to-selected-block/index.js +2 -3
- package/src/components/ungroup-button/index.native.js +4 -8
- package/src/components/url-input/index.js +24 -21
- package/src/components/use-block-display-information/index.js +4 -6
- package/src/components/use-block-drop-zone/index.js +2 -3
- package/src/components/use-block-drop-zone/index.native.js +171 -0
- package/src/components/use-block-drop-zone/test/index.js +22 -23
- package/src/components/use-display-block-controls/index.native.js +2 -3
- package/src/components/use-no-recursive-renders/test/use-no-recursive-renders.js +2 -3
- package/src/components/use-on-block-drop/index.js +2 -5
- package/src/components/use-on-block-drop/index.native.js +115 -0
- package/src/components/use-setting/index.js +8 -6
- package/src/components/warning/index.js +47 -42
- package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
- package/src/components/warning/test/index.js +1 -1
- package/src/components/writing-flow/test/index.js +22 -4
- package/src/components/writing-flow/use-arrow-nav.js +22 -10
- package/src/components/writing-flow/use-click-selection.js +2 -5
- package/src/components/writing-flow/use-drag-selection.js +6 -9
- package/src/components/writing-flow/use-input.js +12 -0
- package/src/components/writing-flow/use-multi-selection.js +2 -4
- package/src/components/writing-flow/use-select-all.js +2 -5
- package/src/components/writing-flow/use-selection-observer.js +4 -6
- package/src/components/writing-flow/use-tab-nav.js +2 -5
- package/src/elements/index.js +1 -0
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +2 -11
- package/src/hooks/border.scss +0 -48
- package/src/hooks/color-panel.js +17 -13
- package/src/hooks/color-panel.native.js +2 -2
- package/src/hooks/color.js +7 -76
- package/src/hooks/color.scss +5 -58
- package/src/hooks/dimensions.js +11 -3
- package/src/hooks/font-family.js +4 -2
- package/src/hooks/gap.js +2 -3
- package/src/hooks/layout.js +54 -4
- package/src/hooks/style.js +25 -39
- package/src/hooks/test/align.js +2 -1
- package/src/hooks/test/generated-class-name.js +2 -5
- package/src/hooks/test/utils.js +2 -5
- package/src/hooks/typography.js +2 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +11 -3
- package/src/store/actions.js +784 -728
- package/src/store/reducer.js +202 -178
- package/src/store/selectors.js +82 -54
- package/src/store/test/actions.js +2 -1
- package/src/store/test/reducer.js +8 -1
- package/src/store/test/selectors.js +17 -21
- package/src/style.scss +1 -1
- package/src/utils/pasting.js +3 -3
- package/src/utils/transform-styles/transforms/wrap.js +30 -28
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors/color-panel.js +0 -82
- package/build/components/colors/color-panel.js.map +0 -1
- package/build/components/colors/color-panel.native.js +0 -11
- package/build/components/colors/color-panel.native.js.map +0 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/colors/color-panel.js +0 -70
- package/build-module/components/colors/color-panel.js.map +0 -1
- package/build-module/components/colors/color-panel.native.js +0 -4
- package/build-module/components/colors/color-panel.native.js.map +0 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/colors/color-panel.js +0 -91
- package/src/components/colors/color-panel.native.js +0 -3
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { AsyncModeProvider, useSelect } from '@wordpress/data';
|
|
9
|
+
import { AsyncModeProvider, useSelect, useDispatch } from '@wordpress/data';
|
|
10
10
|
import { useViewportMatch, useMergeRefs } from '@wordpress/compose';
|
|
11
11
|
import { createContext, useState, useMemo } from '@wordpress/element';
|
|
12
12
|
|
|
@@ -36,9 +36,8 @@ function Root( { className, ...settings } ) {
|
|
|
36
36
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
37
37
|
const { isOutlineMode, isFocusMode, isNavigationMode } = useSelect(
|
|
38
38
|
( select ) => {
|
|
39
|
-
const { getSettings, isNavigationMode: _isNavigationMode } =
|
|
40
|
-
blockEditorStore
|
|
41
|
-
);
|
|
39
|
+
const { getSettings, isNavigationMode: _isNavigationMode } =
|
|
40
|
+
select( blockEditorStore );
|
|
42
41
|
const { outlineMode, focusMode } = getSettings();
|
|
43
42
|
return {
|
|
44
43
|
isOutlineMode: outlineMode,
|
|
@@ -48,6 +47,23 @@ function Root( { className, ...settings } ) {
|
|
|
48
47
|
},
|
|
49
48
|
[]
|
|
50
49
|
);
|
|
50
|
+
const { setBlockVisibility } = useDispatch( blockEditorStore );
|
|
51
|
+
const intersectionObserver = useMemo( () => {
|
|
52
|
+
const { IntersectionObserver: Observer } = window;
|
|
53
|
+
|
|
54
|
+
if ( ! Observer ) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return new Observer( ( entries ) => {
|
|
59
|
+
const updates = {};
|
|
60
|
+
for ( const entry of entries ) {
|
|
61
|
+
const clientId = entry.target.getAttribute( 'data-block' );
|
|
62
|
+
updates[ clientId ] = entry.isIntersecting;
|
|
63
|
+
}
|
|
64
|
+
setBlockVisibility( updates );
|
|
65
|
+
} );
|
|
66
|
+
}, [] );
|
|
51
67
|
const innerBlocksProps = useInnerBlocksProps(
|
|
52
68
|
{
|
|
53
69
|
ref: useMergeRefs( [
|
|
@@ -65,7 +81,9 @@ function Root( { className, ...settings } ) {
|
|
|
65
81
|
);
|
|
66
82
|
return (
|
|
67
83
|
<elementContext.Provider value={ element }>
|
|
68
|
-
<
|
|
84
|
+
<IntersectionObserver.Provider value={ intersectionObserver }>
|
|
85
|
+
<div { ...innerBlocksProps } />
|
|
86
|
+
</IntersectionObserver.Provider>
|
|
69
87
|
</elementContext.Provider>
|
|
70
88
|
);
|
|
71
89
|
}
|
|
@@ -90,34 +108,17 @@ function Items( {
|
|
|
90
108
|
__experimentalAppenderTagName,
|
|
91
109
|
__experimentalLayout: layout = defaultLayout,
|
|
92
110
|
} ) {
|
|
93
|
-
const
|
|
94
|
-
const intersectionObserver = useMemo( () => {
|
|
95
|
-
const { IntersectionObserver: Observer } = window;
|
|
96
|
-
|
|
97
|
-
if ( ! Observer ) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return new Observer( ( entries ) => {
|
|
102
|
-
setIntersectingBlocks( ( oldIntersectingBlocks ) => {
|
|
103
|
-
const newIntersectingBlocks = new Set( oldIntersectingBlocks );
|
|
104
|
-
for ( const entry of entries ) {
|
|
105
|
-
const clientId = entry.target.getAttribute( 'data-block' );
|
|
106
|
-
const action = entry.isIntersecting ? 'add' : 'delete';
|
|
107
|
-
newIntersectingBlocks[ action ]( clientId );
|
|
108
|
-
}
|
|
109
|
-
return newIntersectingBlocks;
|
|
110
|
-
} );
|
|
111
|
-
} );
|
|
112
|
-
}, [ setIntersectingBlocks ] );
|
|
113
|
-
const { order, selectedBlocks } = useSelect(
|
|
111
|
+
const { order, selectedBlocks, visibleBlocks } = useSelect(
|
|
114
112
|
( select ) => {
|
|
115
|
-
const {
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
const {
|
|
114
|
+
getBlockOrder,
|
|
115
|
+
getSelectedBlockClientIds,
|
|
116
|
+
__unstableGetVisibleBlocks,
|
|
117
|
+
} = select( blockEditorStore );
|
|
118
118
|
return {
|
|
119
119
|
order: getBlockOrder( rootClientId ),
|
|
120
120
|
selectedBlocks: getSelectedBlockClientIds(),
|
|
121
|
+
visibleBlocks: __unstableGetVisibleBlocks(),
|
|
121
122
|
};
|
|
122
123
|
},
|
|
123
124
|
[ rootClientId ]
|
|
@@ -125,24 +126,22 @@ function Items( {
|
|
|
125
126
|
|
|
126
127
|
return (
|
|
127
128
|
<LayoutProvider value={ layout }>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
) ) }
|
|
145
|
-
</IntersectionObserver.Provider>
|
|
129
|
+
{ order.map( ( clientId ) => (
|
|
130
|
+
<AsyncModeProvider
|
|
131
|
+
key={ clientId }
|
|
132
|
+
value={
|
|
133
|
+
// Only provide data asynchronously if the block is
|
|
134
|
+
// not visible and not selected.
|
|
135
|
+
! visibleBlocks.has( clientId ) &&
|
|
136
|
+
! selectedBlocks.includes( clientId )
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
<BlockListBlock
|
|
140
|
+
rootClientId={ rootClientId }
|
|
141
|
+
clientId={ clientId }
|
|
142
|
+
/>
|
|
143
|
+
</AsyncModeProvider>
|
|
144
|
+
) ) }
|
|
146
145
|
{ order.length < 1 && placeholder }
|
|
147
146
|
<BlockListAppender
|
|
148
147
|
tagName={ __experimentalAppenderTagName }
|
|
@@ -25,10 +25,15 @@ import { __ } from '@wordpress/i18n';
|
|
|
25
25
|
import styles from './style.scss';
|
|
26
26
|
import BlockListAppender from '../block-list-appender';
|
|
27
27
|
import BlockListItem from './block-list-item';
|
|
28
|
+
import BlockListItemCell from './block-list-item-cell';
|
|
29
|
+
import {
|
|
30
|
+
BlockListProvider,
|
|
31
|
+
BlockListConsumer,
|
|
32
|
+
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
33
|
+
} from './block-list-context';
|
|
34
|
+
import { BlockDraggableWrapper } from '../block-draggable';
|
|
28
35
|
import { store as blockEditorStore } from '../../store';
|
|
29
36
|
|
|
30
|
-
const BlockListContext = createContext();
|
|
31
|
-
|
|
32
37
|
export const OnCaretVerticalPositionChange = createContext();
|
|
33
38
|
|
|
34
39
|
const stylesMemo = {};
|
|
@@ -65,19 +70,18 @@ export class BlockList extends Component {
|
|
|
65
70
|
};
|
|
66
71
|
this.renderItem = this.renderItem.bind( this );
|
|
67
72
|
this.renderBlockListFooter = this.renderBlockListFooter.bind( this );
|
|
68
|
-
this.onCaretVerticalPositionChange =
|
|
69
|
-
this
|
|
70
|
-
);
|
|
73
|
+
this.onCaretVerticalPositionChange =
|
|
74
|
+
this.onCaretVerticalPositionChange.bind( this );
|
|
71
75
|
this.scrollViewInnerRef = this.scrollViewInnerRef.bind( this );
|
|
72
76
|
this.addBlockToEndOfPost = this.addBlockToEndOfPost.bind( this );
|
|
73
|
-
this.shouldFlatListPreventAutomaticScroll =
|
|
74
|
-
this
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this
|
|
78
|
-
);
|
|
77
|
+
this.shouldFlatListPreventAutomaticScroll =
|
|
78
|
+
this.shouldFlatListPreventAutomaticScroll.bind( this );
|
|
79
|
+
this.shouldShowInnerBlockAppender =
|
|
80
|
+
this.shouldShowInnerBlockAppender.bind( this );
|
|
79
81
|
this.renderEmptyList = this.renderEmptyList.bind( this );
|
|
80
82
|
this.getExtraData = this.getExtraData.bind( this );
|
|
83
|
+
this.getCellRendererComponent =
|
|
84
|
+
this.getCellRendererComponent.bind( this );
|
|
81
85
|
|
|
82
86
|
this.onLayout = this.onLayout.bind( this );
|
|
83
87
|
|
|
@@ -154,6 +158,18 @@ export class BlockList extends Component {
|
|
|
154
158
|
return this.extraData;
|
|
155
159
|
}
|
|
156
160
|
|
|
161
|
+
getCellRendererComponent( { children, item, onLayout } ) {
|
|
162
|
+
const { rootClientId } = this.props;
|
|
163
|
+
return (
|
|
164
|
+
<BlockListItemCell
|
|
165
|
+
children={ children }
|
|
166
|
+
clientId={ item }
|
|
167
|
+
onLayout={ onLayout }
|
|
168
|
+
rootClientId={ rootClientId }
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
157
173
|
onLayout( { nativeEvent } ) {
|
|
158
174
|
const { layout } = nativeEvent;
|
|
159
175
|
const { blockWidth } = this.state;
|
|
@@ -170,20 +186,27 @@ export class BlockList extends Component {
|
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
render() {
|
|
173
|
-
const { isRootList } = this.props;
|
|
189
|
+
const { isRootList, isRTL } = this.props;
|
|
174
190
|
// Use of Context to propagate the main scroll ref to its children e.g InnerBlocks.
|
|
175
191
|
const blockList = isRootList ? (
|
|
176
|
-
<
|
|
177
|
-
{
|
|
178
|
-
|
|
192
|
+
<BlockListProvider
|
|
193
|
+
value={ {
|
|
194
|
+
...DEFAULT_BLOCK_LIST_CONTEXT,
|
|
195
|
+
scrollRef: this.scrollViewRef,
|
|
196
|
+
} }
|
|
197
|
+
>
|
|
198
|
+
<BlockDraggableWrapper isRTL={ isRTL }>
|
|
199
|
+
{ ( { onScroll } ) => this.renderList( { onScroll } ) }
|
|
200
|
+
</BlockDraggableWrapper>
|
|
201
|
+
</BlockListProvider>
|
|
179
202
|
) : (
|
|
180
|
-
<
|
|
181
|
-
{ (
|
|
203
|
+
<BlockListConsumer>
|
|
204
|
+
{ ( { scrollRef } ) =>
|
|
182
205
|
this.renderList( {
|
|
183
|
-
parentScrollRef:
|
|
206
|
+
parentScrollRef: scrollRef,
|
|
184
207
|
} )
|
|
185
208
|
}
|
|
186
|
-
</
|
|
209
|
+
</BlockListConsumer>
|
|
187
210
|
);
|
|
188
211
|
|
|
189
212
|
return (
|
|
@@ -212,14 +235,10 @@ export class BlockList extends Component {
|
|
|
212
235
|
contentResizeMode,
|
|
213
236
|
blockWidth,
|
|
214
237
|
} = this.props;
|
|
215
|
-
const { parentScrollRef } = extraProps;
|
|
238
|
+
const { parentScrollRef, onScroll } = extraProps;
|
|
216
239
|
|
|
217
|
-
const {
|
|
218
|
-
|
|
219
|
-
blockBorder,
|
|
220
|
-
headerToolbar,
|
|
221
|
-
floatingToolbar,
|
|
222
|
-
} = styles;
|
|
240
|
+
const { blockToolbar, blockBorder, headerToolbar, floatingToolbar } =
|
|
241
|
+
styles;
|
|
223
242
|
|
|
224
243
|
const containerStyle = {
|
|
225
244
|
flex: isRootList ? 1 : 0,
|
|
@@ -279,6 +298,7 @@ export class BlockList extends Component {
|
|
|
279
298
|
data={ blockClientIds }
|
|
280
299
|
keyExtractor={ identity }
|
|
281
300
|
renderItem={ this.renderItem }
|
|
301
|
+
CellRendererComponent={ this.getCellRendererComponent }
|
|
282
302
|
shouldPreventAutomaticScroll={
|
|
283
303
|
this.shouldFlatListPreventAutomaticScroll
|
|
284
304
|
}
|
|
@@ -286,6 +306,7 @@ export class BlockList extends Component {
|
|
|
286
306
|
ListHeaderComponent={ header }
|
|
287
307
|
ListEmptyComponent={ ! isReadOnly && this.renderEmptyList }
|
|
288
308
|
ListFooterComponent={ this.renderBlockListFooter }
|
|
309
|
+
onScroll={ onScroll }
|
|
289
310
|
/>
|
|
290
311
|
{ this.shouldShowInnerBlockAppender() && (
|
|
291
312
|
<View
|
|
@@ -321,6 +342,15 @@ export class BlockList extends Component {
|
|
|
321
342
|
gridProperties,
|
|
322
343
|
} = this.props;
|
|
323
344
|
const { blockWidth } = this.state;
|
|
345
|
+
|
|
346
|
+
// Extracting the grid item properties here to avoid
|
|
347
|
+
// re-renders in the blockListItem component.
|
|
348
|
+
const isGridItem = !! gridProperties;
|
|
349
|
+
const gridItemProps = gridProperties && {
|
|
350
|
+
numOfColumns: gridProperties.numColumns,
|
|
351
|
+
tileCount: blockClientIds.length,
|
|
352
|
+
tileIndex: blockClientIds.indexOf( clientId ),
|
|
353
|
+
};
|
|
324
354
|
return (
|
|
325
355
|
<BlockListItem
|
|
326
356
|
isStackedHorizontally={ isStackedHorizontally }
|
|
@@ -337,8 +367,8 @@ export class BlockList extends Component {
|
|
|
337
367
|
this.shouldShowInnerBlockAppender
|
|
338
368
|
}
|
|
339
369
|
blockWidth={ blockWidth }
|
|
340
|
-
|
|
341
|
-
|
|
370
|
+
isGridItem={ isGridItem }
|
|
371
|
+
{ ...gridItemProps }
|
|
342
372
|
/>
|
|
343
373
|
);
|
|
344
374
|
}
|
|
@@ -401,6 +431,8 @@ export default compose( [
|
|
|
401
431
|
|
|
402
432
|
const isFloatingToolbarVisible =
|
|
403
433
|
!! selectedBlockClientId && hasRootInnerBlocks;
|
|
434
|
+
const isRTL = getSettings().isRTL;
|
|
435
|
+
|
|
404
436
|
return {
|
|
405
437
|
blockClientIds,
|
|
406
438
|
blockCount,
|
|
@@ -411,13 +443,13 @@ export default compose( [
|
|
|
411
443
|
isFloatingToolbarVisible,
|
|
412
444
|
isStackedHorizontally,
|
|
413
445
|
maxWidth,
|
|
446
|
+
isRTL,
|
|
414
447
|
};
|
|
415
448
|
}
|
|
416
449
|
),
|
|
417
450
|
withDispatch( ( dispatch ) => {
|
|
418
|
-
const { insertBlock, replaceBlock, clearSelectedBlock } =
|
|
419
|
-
blockEditorStore
|
|
420
|
-
);
|
|
451
|
+
const { insertBlock, replaceBlock, clearSelectedBlock } =
|
|
452
|
+
dispatch( blockEditorStore );
|
|
421
453
|
|
|
422
454
|
return {
|
|
423
455
|
clearSelectedBlock,
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { cloneDeep } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_BLOCK_LIST_CONTEXT,
|
|
11
|
+
deleteBlockLayoutByClientId,
|
|
12
|
+
} from '../block-list-context.native';
|
|
13
|
+
import {
|
|
14
|
+
BLOCKS_LAYOUTS_DATA,
|
|
15
|
+
DEEP_NESTED_ID,
|
|
16
|
+
GROUP_BLOCK_LAYOUT_DATA,
|
|
17
|
+
NESTED_WITH_INNER_BLOCKS_ID,
|
|
18
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
19
|
+
ROOT_LEVEL_ID,
|
|
20
|
+
} from './fixtures/block-list-context.native';
|
|
21
|
+
|
|
22
|
+
describe( 'findBlockLayoutByClientId', () => {
|
|
23
|
+
it( "finds a block's layout data at root level", () => {
|
|
24
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
25
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
26
|
+
|
|
27
|
+
const blockRootLevel = findBlockLayoutByClientId(
|
|
28
|
+
currentBlockLayouts,
|
|
29
|
+
ROOT_LEVEL_ID
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect( blockRootLevel ).toEqual(
|
|
33
|
+
expect.objectContaining( { clientId: ROOT_LEVEL_ID } )
|
|
34
|
+
);
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( "finds a nested block's layout data with inner blocks", () => {
|
|
38
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
39
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
40
|
+
|
|
41
|
+
const nestedBlock = findBlockLayoutByClientId(
|
|
42
|
+
currentBlockLayouts,
|
|
43
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect( nestedBlock ).toEqual(
|
|
47
|
+
expect.objectContaining( { clientId: NESTED_WITH_INNER_BLOCKS_ID } )
|
|
48
|
+
);
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
it( "finds a deep nested block's layout data", () => {
|
|
52
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
53
|
+
const currentBlockLayouts = BLOCKS_LAYOUTS_DATA;
|
|
54
|
+
|
|
55
|
+
const deepNestedBlock = findBlockLayoutByClientId(
|
|
56
|
+
currentBlockLayouts,
|
|
57
|
+
DEEP_NESTED_ID
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect( deepNestedBlock ).toEqual(
|
|
61
|
+
expect.objectContaining( { clientId: DEEP_NESTED_ID } )
|
|
62
|
+
);
|
|
63
|
+
} );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
describe( 'deleteBlockLayoutByClientId', () => {
|
|
67
|
+
it( "deletes a block's layout data at root level", () => {
|
|
68
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
69
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
70
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
71
|
+
defaultBlockLayouts,
|
|
72
|
+
ROOT_LEVEL_ID
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
76
|
+
currentBlockLayouts,
|
|
77
|
+
ROOT_LEVEL_ID
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
expect( findDeletedBlock ).toBeNull();
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
it( "deletes a nested block's layout data with inner blocks", () => {
|
|
84
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
85
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
86
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
87
|
+
defaultBlockLayouts,
|
|
88
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
92
|
+
currentBlockLayouts,
|
|
93
|
+
NESTED_WITH_INNER_BLOCKS_ID
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
expect( findDeletedBlock ).toBeNull();
|
|
97
|
+
} );
|
|
98
|
+
|
|
99
|
+
it( "deletes a deep nested block's layout data", () => {
|
|
100
|
+
const { findBlockLayoutByClientId } = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
101
|
+
const defaultBlockLayouts = cloneDeep( BLOCKS_LAYOUTS_DATA );
|
|
102
|
+
const currentBlockLayouts = deleteBlockLayoutByClientId(
|
|
103
|
+
defaultBlockLayouts,
|
|
104
|
+
DEEP_NESTED_ID
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
108
|
+
currentBlockLayouts,
|
|
109
|
+
DEEP_NESTED_ID
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect( findDeletedBlock ).toBeNull();
|
|
113
|
+
} );
|
|
114
|
+
} );
|
|
115
|
+
|
|
116
|
+
describe( 'updateBlocksLayouts', () => {
|
|
117
|
+
it( "adds a new block's layout data at root level with an empty object", () => {
|
|
118
|
+
const {
|
|
119
|
+
blocksLayouts,
|
|
120
|
+
findBlockLayoutByClientId,
|
|
121
|
+
updateBlocksLayouts,
|
|
122
|
+
} = DEFAULT_BLOCK_LIST_CONTEXT;
|
|
123
|
+
const currentBlockLayouts = cloneDeep( blocksLayouts );
|
|
124
|
+
const BLOCK_CLIENT_ID = PARAGRAPH_BLOCK_LAYOUT_DATA.clientId;
|
|
125
|
+
|
|
126
|
+
updateBlocksLayouts( currentBlockLayouts, PARAGRAPH_BLOCK_LAYOUT_DATA );
|
|
127
|
+
|
|
128
|
+
const findAddedBlock = findBlockLayoutByClientId(
|
|
129
|
+
currentBlockLayouts.current,
|
|
130
|
+
BLOCK_CLIENT_ID
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
expect( findAddedBlock ).toEqual(
|
|
134
|
+
expect.objectContaining( {
|
|
135
|
+
clientId: BLOCK_CLIENT_ID,
|
|
136
|
+
rootClientId: undefined,
|
|
137
|
+
} )
|
|
138
|
+
);
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
it( "adds a new block's layout data at root level with inner blocks", () => {
|
|
142
|
+
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
143
|
+
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
144
|
+
const currentBlockLayouts = {
|
|
145
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
146
|
+
};
|
|
147
|
+
const PARENT_BLOCK_CLIENT_ID = GROUP_BLOCK_LAYOUT_DATA.clientId;
|
|
148
|
+
|
|
149
|
+
// Add parent block
|
|
150
|
+
updateBlocksLayouts( currentBlockLayouts, GROUP_BLOCK_LAYOUT_DATA );
|
|
151
|
+
|
|
152
|
+
const findAddedParentBlock = findBlockLayoutByClientId(
|
|
153
|
+
currentBlockLayouts.current,
|
|
154
|
+
PARENT_BLOCK_CLIENT_ID
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
expect( findAddedParentBlock ).toEqual(
|
|
158
|
+
expect.objectContaining( { clientId: PARENT_BLOCK_CLIENT_ID } )
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
// Add inner block to it's parent
|
|
162
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
163
|
+
...PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
164
|
+
rootClientId: PARENT_BLOCK_CLIENT_ID,
|
|
165
|
+
} );
|
|
166
|
+
|
|
167
|
+
const findAddedInnerBlock = findBlockLayoutByClientId(
|
|
168
|
+
currentBlockLayouts.current,
|
|
169
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA.clientId
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
expect( findAddedInnerBlock ).toEqual(
|
|
173
|
+
expect.objectContaining( {
|
|
174
|
+
clientId: PARAGRAPH_BLOCK_LAYOUT_DATA.clientId,
|
|
175
|
+
rootClientId: PARENT_BLOCK_CLIENT_ID,
|
|
176
|
+
} )
|
|
177
|
+
);
|
|
178
|
+
} );
|
|
179
|
+
|
|
180
|
+
it( "adds a new block's layout data at deep level", () => {
|
|
181
|
+
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
182
|
+
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
183
|
+
const currentBlockLayouts = {
|
|
184
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Add block layout data to it's parents inner blocks
|
|
188
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
189
|
+
...PARAGRAPH_BLOCK_LAYOUT_DATA,
|
|
190
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
191
|
+
} );
|
|
192
|
+
|
|
193
|
+
const findAddedInnerBlock = findBlockLayoutByClientId(
|
|
194
|
+
currentBlockLayouts.current,
|
|
195
|
+
PARAGRAPH_BLOCK_LAYOUT_DATA.clientId
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
expect( findAddedInnerBlock ).toEqual(
|
|
199
|
+
expect.objectContaining( {
|
|
200
|
+
clientId: PARAGRAPH_BLOCK_LAYOUT_DATA.clientId,
|
|
201
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
202
|
+
} )
|
|
203
|
+
);
|
|
204
|
+
} );
|
|
205
|
+
|
|
206
|
+
it( "deletes a block's layout data at root level", () => {
|
|
207
|
+
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
208
|
+
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
209
|
+
const currentBlockLayouts = {
|
|
210
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
214
|
+
shouldRemove: true,
|
|
215
|
+
clientId: ROOT_LEVEL_ID,
|
|
216
|
+
} );
|
|
217
|
+
|
|
218
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
219
|
+
currentBlockLayouts.current,
|
|
220
|
+
ROOT_LEVEL_ID
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
expect( findDeletedBlock ).toBeNull();
|
|
224
|
+
} );
|
|
225
|
+
|
|
226
|
+
it( "deletes a block's layout data at a deep level", () => {
|
|
227
|
+
const { findBlockLayoutByClientId, updateBlocksLayouts } =
|
|
228
|
+
DEFAULT_BLOCK_LIST_CONTEXT;
|
|
229
|
+
const currentBlockLayouts = {
|
|
230
|
+
current: cloneDeep( BLOCKS_LAYOUTS_DATA ),
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
updateBlocksLayouts( currentBlockLayouts, {
|
|
234
|
+
shouldRemove: true,
|
|
235
|
+
clientId: DEEP_NESTED_ID,
|
|
236
|
+
} );
|
|
237
|
+
|
|
238
|
+
const findDeletedBlock = findBlockLayoutByClientId(
|
|
239
|
+
currentBlockLayouts.current,
|
|
240
|
+
DEEP_NESTED_ID
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
expect( findDeletedBlock ).toBeNull();
|
|
244
|
+
} );
|
|
245
|
+
} );
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const ROOT_LEVEL_ID = 'e59528f8-fb35-4ec1-aec6-5a065c236fa1';
|
|
2
|
+
export const ROOT_LEVEL_WITH_INNER_BLOCKS_ID =
|
|
3
|
+
'72a9220f-4c3d-4b00-bae1-4506513f63d8';
|
|
4
|
+
export const NESTED_WITH_INNER_BLOCKS_ID =
|
|
5
|
+
'9f3d1f1e-df85-485d-af63-dc8cb1b93cbc';
|
|
6
|
+
export const DEEP_NESTED_ID = 'abec845a-e4de-43fb-96f7-80dc3d51ad7a';
|
|
7
|
+
|
|
8
|
+
export const BLOCKS_LAYOUTS_DATA = {
|
|
9
|
+
[ ROOT_LEVEL_ID ]: {
|
|
10
|
+
clientId: ROOT_LEVEL_ID,
|
|
11
|
+
width: 390,
|
|
12
|
+
height: 54,
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 83,
|
|
15
|
+
innerBlocks: {},
|
|
16
|
+
},
|
|
17
|
+
[ ROOT_LEVEL_WITH_INNER_BLOCKS_ID ]: {
|
|
18
|
+
clientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
19
|
+
width: 390,
|
|
20
|
+
height: 386,
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 137,
|
|
23
|
+
innerBlocks: {
|
|
24
|
+
'62839858-48b0-44ed-b834-1343a1357e54': {
|
|
25
|
+
clientId: '62839858-48b0-44ed-b834-1343a1357e54',
|
|
26
|
+
rootClientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
27
|
+
width: 390,
|
|
28
|
+
height: 54,
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
innerBlocks: {},
|
|
32
|
+
},
|
|
33
|
+
[ NESTED_WITH_INNER_BLOCKS_ID ]: {
|
|
34
|
+
clientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
35
|
+
rootClientId: ROOT_LEVEL_WITH_INNER_BLOCKS_ID,
|
|
36
|
+
width: 390,
|
|
37
|
+
height: 332,
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 54,
|
|
40
|
+
innerBlocks: {
|
|
41
|
+
'435d62a4-afa7-457c-a894-b04390d7b447': {
|
|
42
|
+
clientId: '435d62a4-afa7-457c-a894-b04390d7b447',
|
|
43
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
44
|
+
width: 358,
|
|
45
|
+
height: 54,
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
innerBlocks: {},
|
|
49
|
+
},
|
|
50
|
+
[ DEEP_NESTED_ID ]: {
|
|
51
|
+
clientId: DEEP_NESTED_ID,
|
|
52
|
+
rootClientId: NESTED_WITH_INNER_BLOCKS_ID,
|
|
53
|
+
width: 358,
|
|
54
|
+
height: 98,
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 54,
|
|
57
|
+
innerBlocks: {},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PARAGRAPH_BLOCK_LAYOUT_DATA = {
|
|
66
|
+
clientId: '22dda04f-4718-45b2-8cd2-36cedb9eae4d',
|
|
67
|
+
width: 390,
|
|
68
|
+
height: 98,
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 83,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const GROUP_BLOCK_LAYOUT_DATA = {
|
|
74
|
+
clientId: 'e18249d9-ec06-4f54-b71e-6ec59be5213e',
|
|
75
|
+
width: 390,
|
|
76
|
+
height: 164,
|
|
77
|
+
x: 0,
|
|
78
|
+
y: 83,
|
|
79
|
+
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__unstableGetBlockProps as getBlockProps,
|
|
13
13
|
getBlockType,
|
|
14
14
|
} from '@wordpress/blocks';
|
|
15
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
15
|
+
import { useMergeRefs, useDisabled } from '@wordpress/compose';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
17
17
|
import warning from '@wordpress/warning';
|
|
18
18
|
|
|
@@ -50,17 +50,24 @@ const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
|
50
50
|
* also pass any other props through this hook, and they will be merged and
|
|
51
51
|
* returned.
|
|
52
52
|
*
|
|
53
|
-
* @param {Object} props
|
|
54
|
-
*
|
|
55
|
-
* @param {Object} options
|
|
53
|
+
* @param {Object} props Optional. Props to pass to the element. Must contain
|
|
54
|
+
* the ref if one is defined.
|
|
55
|
+
* @param {Object} options Options for internal use only.
|
|
56
56
|
* @param {boolean} options.__unstableIsHtml
|
|
57
|
+
* @param {boolean} options.__unstableIsDisabled Whether the block should be disabled.
|
|
57
58
|
*
|
|
58
59
|
* @return {Object} Props to pass to the element to mark as a block.
|
|
59
60
|
*/
|
|
60
|
-
export function useBlockProps(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
export function useBlockProps(
|
|
62
|
+
props = {},
|
|
63
|
+
{ __unstableIsHtml, __unstableIsDisabled = false } = {}
|
|
64
|
+
) {
|
|
65
|
+
const {
|
|
66
|
+
clientId,
|
|
67
|
+
className,
|
|
68
|
+
wrapperProps = {},
|
|
69
|
+
isAligned,
|
|
70
|
+
} = useContext( BlockListBlockContext );
|
|
64
71
|
const {
|
|
65
72
|
index,
|
|
66
73
|
mode,
|
|
@@ -125,6 +132,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
125
132
|
enableAnimation,
|
|
126
133
|
triggerAnimationOnChange: index,
|
|
127
134
|
} ),
|
|
135
|
+
useDisabled( { isDisabled: ! __unstableIsDisabled } ),
|
|
128
136
|
] );
|
|
129
137
|
|
|
130
138
|
const blockEditContext = useBlockEditContext();
|