@wordpress/block-editor 12.18.2 → 12.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/autocompleters/block.js +1 -2
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +1 -2
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/alignment-control/ui.js +1 -2
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/autocomplete/index.js +1 -2
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-alignment-control/constants.js +2 -4
- package/build/components/block-alignment-control/constants.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -2
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +1 -2
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +1 -2
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +1 -2
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-canvas/index.js +1 -2
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-caption/index.native.js +1 -2
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-card/index.js +1 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-compare/index.js +1 -2
- package/build/components/block-compare/index.js.map +1 -1
- package/build/components/block-context/index.js +1 -2
- package/build/components/block-context/index.js.map +1 -1
- package/build/components/block-controls/groups.js +1 -2
- package/build/components/block-controls/groups.js.map +1 -1
- package/build/components/block-controls/index.js +1 -2
- package/build/components/block-controls/index.js.map +1 -1
- package/build/components/block-draggable/dropping-insertion-point.native.js +2 -2
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -1
- package/build/components/block-draggable/index.js +1 -2
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +3 -4
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/context.js +4 -8
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -2
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +1 -2
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-full-height-alignment-control/index.js +1 -2
- package/build/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build/components/block-icon/index.js +1 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +1 -2
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +1 -2
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-inspector/index.js +11 -9
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.js +1 -2
- package/build/components/block-list/block-crash-boundary.js.map +1 -1
- package/build/components/block-list/block-html.js +1 -2
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +1 -2
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -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 +1 -2
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +1 -2
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js +1 -2
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js +32 -21
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +7 -6
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/grid-item.native.js +1 -2
- package/build/components/block-list/grid-item.native.js.map +1 -1
- package/build/components/block-list/index.js +19 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/insertion-point.native.js +1 -2
- package/build/components/block-list/insertion-point.native.js.map +1 -1
- package/build/components/block-list/layout.js +2 -4
- package/build/components/block-list/layout.js.map +1 -1
- package/build/components/block-list/private-block-context.js +1 -2
- package/build/components/block-list/private-block-context.js.map +1 -1
- package/build/components/block-list/subdirectory-icon.js +1 -2
- package/build/components/block-list/subdirectory-icon.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +1 -2
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -1
- package/build/components/block-list-appender/index.js +5 -52
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +11 -22
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-mover/button.js +2 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +1 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +3 -6
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-mover/mover-description.native.js +0 -2
- package/build/components/block-mover/mover-description.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +1 -2
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-pattern-setup/constants.js +1 -2
- package/build/components/block-pattern-setup/constants.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -2
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +1 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-pattern-setup/use-patterns-setup.js +1 -2
- package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -2
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/drop-zone.js +1 -2
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/inbetween.js +2 -4
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +1 -2
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-popover/use-popover-scroll.js +1 -2
- package/build/components/block-popover/use-popover-scroll.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +1 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +4 -2
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +1 -2
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +1 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings/index.native.js +2 -2
- package/build/components/block-settings/index.native.js.map +1 -1
- package/build/components/block-settings-menu/block-html-convert-button.js +1 -2
- package/build/components/block-settings-menu/block-html-convert-button.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +1 -2
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +1 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-menu-first-item.js +1 -2
- package/build/components/block-settings-menu/block-settings-menu-first-item.js.map +1 -1
- package/build/components/block-settings-menu/index.js +1 -2
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -2
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -2
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +1 -2
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -2
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +1 -2
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build/components/block-switcher/index.js +13 -11
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +1 -2
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -2
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +21 -28
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-toolbar/block-name-context.js +1 -2
- package/build/components/block-toolbar/block-name-context.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-last-item.js +1 -2
- package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -2
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +20 -18
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +4 -12
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -2
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +1 -2
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-types-list/index.js +1 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -2
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +1 -2
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +1 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/icons.js +5 -10
- package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +1 -2
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -4
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/button-block-appender/index.native.js +1 -2
- package/build/components/button-block-appender/index.native.js.map +1 -1
- package/build/components/caption/index.native.js +1 -2
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/color-palette/index.js +1 -2
- package/build/components/color-palette/index.js.map +1 -1
- package/build/components/color-palette/with-color-context.js +1 -2
- package/build/components/color-palette/with-color-context.js.map +1 -1
- package/build/components/color-style-selector/index.js +1 -2
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/index.js +2 -2
- package/build/components/colors/index.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +1 -2
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +1 -2
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +1 -2
- package/build/components/contrast-checker/index.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +1 -2
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/default-block-appender/index.js +31 -40
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-block-appender/index.native.js +1 -2
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build/components/dimensions-tool/index.js +1 -2
- package/build/components/dimensions-tool/index.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -2
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editable-text/index.js +1 -2
- package/build/components/editable-text/index.js.map +1 -1
- package/build/components/floating-toolbar/index.native.js +1 -2
- package/build/components/floating-toolbar/index.native.js.map +1 -1
- package/build/components/floating-toolbar/nav-up-icon.js +1 -2
- package/build/components/floating-toolbar/nav-up-icon.js.map +1 -1
- package/build/components/font-sizes/font-size-picker.js +1 -2
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/global-styles/border-panel.js +56 -8
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +1 -2
- package/build/components/global-styles/color-panel.native.js.map +1 -1
- package/build/components/global-styles/context.js +2 -4
- package/build/components/global-styles/context.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +2 -4
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/index.js +2 -15
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +133 -0
- package/build/components/global-styles/shadow-panel-components.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +6 -7
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +38 -14
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +1 -2
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/constants.js +3 -6
- package/build/components/image-editor/constants.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +1 -2
- package/build/components/image-link-destinations/index.native.js.map +1 -1
- package/build/components/index.js +2 -2
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +1 -2
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/constants.native.js +1 -2
- package/build/components/inner-blocks/constants.native.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +1 -2
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +33 -30
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +2 -6
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +2 -3
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build/components/inner-blocks/with-client-id.js +1 -2
- package/build/components/inner-blocks/with-client-id.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +1 -2
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -2
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +1 -2
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +4 -4
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +5 -9
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -2
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +1 -2
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +1 -2
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +1 -2
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +1 -2
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -2
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +2 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -2
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +1 -2
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -2
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +1 -2
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +1 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +1 -2
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/no-results.js +1 -2
- package/build/components/inserter/no-results.js.map +1 -1
- package/build/components/inserter/no-results.native.js +1 -2
- package/build/components/inserter/no-results.native.js.map +1 -1
- package/build/components/inserter/panel.js +1 -2
- package/build/components/inserter/panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +3 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +1 -2
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-items.js +0 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +1 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/search-results.native.js +1 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -2
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter/tips.js +1 -2
- package/build/components/inserter/tips.js.map +1 -1
- package/build/components/inserter-button/index.native.js +1 -2
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/inserter-button/sparkles.js +1 -2
- package/build/components/inserter-button/sparkles.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +11 -2
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +1 -2
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inserter-listbox/context.js +1 -2
- package/build/components/inserter-listbox/context.js.map +1 -1
- package/build/components/inserter-listbox/group.js +1 -2
- package/build/components/inserter-listbox/group.js.map +1 -1
- package/build/components/inserter-listbox/index.js +1 -2
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +1 -2
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +1 -2
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/inserter-menu-extension/index.js +1 -2
- package/build/components/inserter-menu-extension/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +1 -2
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/index.js +1 -2
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +3 -4
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -2
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +1 -2
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +6 -6
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +1 -2
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -1
- package/build/components/inspector-controls-tabs/utils.js +3 -6
- package/build/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build/components/justify-content-control/ui.js +1 -2
- package/build/components/justify-content-control/ui.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +1 -2
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/line-height-control/utils.js +4 -8
- package/build/components/line-height-control/utils.js.map +1 -1
- package/build/components/link-control/constants.js +7 -14
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/index.js +2 -16
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +13 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -2
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -2
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +1 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +1 -2
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +1 -2
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/link-control/use-create-page.js +0 -1
- package/build/components/link-control/use-create-page.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js +1 -2
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/link-control/viewer-slot.js +1 -2
- package/build/components/link-control/viewer-slot.js.map +1 -1
- package/build/components/list-view/appender.js +1 -2
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +33 -28
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -2
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -2
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/index.js +20 -17
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +1 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +159 -0
- package/build/components/list-view/use-clipboard-handler.js.map +1 -0
- package/build/components/list-view/use-list-view-drop-zone.js +1 -2
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +4 -4
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +1 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +1 -2
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +1 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-replace-flow/index.native.js +1 -2
- package/build/components/media-replace-flow/index.native.js.map +1 -1
- package/build/components/media-upload/check.js +1 -2
- package/build/components/media-upload/check.js.map +1 -1
- package/build/components/media-upload/constants.native.js +8 -16
- package/build/components/media-upload/constants.native.js.map +1 -1
- package/build/components/media-upload/index.js +1 -2
- package/build/components/media-upload/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +1 -2
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +6 -12
- package/build/components/media-upload-progress/constants.js.map +1 -1
- package/build/components/media-upload-progress/index.native.js +1 -2
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +1 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +5 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -2
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js +1 -2
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/plain-text/index.js +1 -2
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/provider/block-refs-provider.js +1 -2
- package/build/components/provider/block-refs-provider.js.map +1 -1
- package/build/components/provider/index.js +3 -5
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +2 -4
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +1 -2
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +1 -2
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +3 -7
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +1 -2
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build/components/rich-text/format-edit.js +1 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +1 -2
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.native.js +1 -2
- package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -2
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.native.js +1 -2
- package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
- package/build/components/rich-text/index.js +6 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +1 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +1 -2
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +1 -6
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/native/toolbar-button-with-options.native.js +1 -2
- package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +1 -2
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +3 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +5 -10
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tool-selector/index.js +1 -2
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -2
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +1 -2
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/unsupported-block-details/index.native.js +1 -2
- package/build/components/unsupported-block-details/index.native.js.map +1 -1
- package/build/components/url-input/button.js +1 -2
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +1 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +18 -8
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/index.js +5 -5
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +15 -5
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-flash-editable-blocks/index.js +60 -0
- package/build/components/use-flash-editable-blocks/index.js.map +1 -0
- package/build/components/use-moving-animation/index.js +1 -2
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +4 -4
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-settings/index.js +3 -162
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/video-player/gridicon-play.native.js +1 -2
- package/build/components/video-player/gridicon-play.native.js.map +1 -1
- package/build/components/video-player/index.native.js +2 -4
- package/build/components/video-player/index.native.js.map +1 -1
- package/build/components/warning/index.js +1 -2
- package/build/components/warning/index.js.map +1 -1
- package/build/components/warning/index.native.js +1 -2
- package/build/components/warning/index.native.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -2
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +3 -48
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +13 -2
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/utils.js +86 -0
- package/build/components/writing-flow/utils.js.map +1 -0
- package/build/hooks/align.js +1 -2
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +2 -2
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +1 -2
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +1 -2
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +52 -14
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -2
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +1 -2
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +42 -7
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +4 -6
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +1 -2
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +1 -2
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +1 -2
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +5 -10
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +1 -3
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +2 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +25 -31
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +2 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +1 -2
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +2 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js +1 -2
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/position.js +1 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +3 -8
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +4 -6
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +3 -6
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +10 -9
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/layouts/constrained.js +1 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/definitions.js +1 -2
- package/build/layouts/definitions.js.map +1 -1
- package/build/layouts/flex.js +1 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +1 -2
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/grid.js +1 -2
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +8 -5
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -4
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +2 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/defaults.js +2 -4
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +1 -2
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/get-block-settings.js +180 -0
- package/build/store/get-block-settings.js.map +1 -0
- package/build/store/index.js +4 -6
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +37 -3
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +55 -29
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +27 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +98 -102
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +1 -2
- package/build/store/undo-ignore.js.map +1 -1
- package/build/utils/selection.js +1 -2
- package/build/utils/selection.js.map +1 -1
- package/build/utils/transform-styles/index.js +3 -4
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +0 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +10 -7
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +32 -20
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +6 -4
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +18 -7
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +8 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +5 -51
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/mover-description.native.js +0 -2
- package/build-module/components/block-mover/mover-description.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +0 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +4 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +12 -9
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +22 -28
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +20 -17
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +2 -10
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +30 -37
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +57 -9
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +2 -4
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/index.js +0 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +121 -0
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +2 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +30 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +33 -29
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +1 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +2 -3
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +4 -4
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +3 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +0 -1
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +12 -1
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +5 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -14
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +16 -18
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/use-create-page.js +0 -1
- package/build-module/components/link-control/use-create-page.js.map +1 -1
- package/build-module/components/list-view/block.js +32 -26
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +17 -11
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +153 -0
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -0
- package/build-module/components/list-view/utils.js +4 -4
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +5 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +3 -6
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +3 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +0 -4
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +4 -2
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +21 -11
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +5 -4
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +15 -5
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-flash-editable-blocks/index.js +53 -0
- package/build-module/components/use-flash-editable-blocks/index.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +4 -4
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +3 -159
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +4 -49
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +13 -2
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +79 -0
- package/build-module/components/writing-flow/utils.js.map +1 -0
- package/build-module/hooks/background.js +48 -10
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +38 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/duotone.js +0 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-size.js +23 -27
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/style.js +3 -7
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +8 -11
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/private-apis.js +5 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/get-block-settings.js +171 -0
- package/build-module/store/get-block-settings.js.map +1 -0
- package/build-module/store/private-actions.js +35 -3
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +42 -19
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +24 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +65 -34
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +23 -15
- package/build-style/content.css +23 -15
- package/build-style/style-rtl.css +66 -53
- package/build-style/style.css +66 -53
- package/package.json +31 -31
- package/src/components/block-canvas/style.scss +1 -1
- package/src/components/block-card/style.scss +3 -1
- package/src/components/block-controls/README.md +2 -2
- package/src/components/block-inspector/index.js +11 -9
- package/src/components/block-list/block.js +45 -20
- package/src/components/block-list/block.native.js +7 -4
- package/src/components/block-list/content.scss +23 -28
- package/src/components/block-list/index.js +49 -25
- package/src/components/block-list/use-block-props/index.js +8 -0
- package/src/components/block-list-appender/index.js +7 -74
- package/src/components/block-mover/style.scss +4 -3
- package/src/components/block-preview/auto.js +2 -1
- package/src/components/block-removal-warning-modal/index.js +17 -10
- package/src/components/block-switcher/index.js +22 -13
- package/src/components/block-title/test/index.js +86 -85
- package/src/components/block-title/use-block-display-title.js +25 -36
- package/src/components/block-toolbar/style.scss +8 -1
- package/src/components/block-tools/block-selection-button.js +23 -26
- package/src/components/block-tools/index.js +2 -12
- package/src/components/colors-gradients/control.js +0 -1
- package/src/components/default-block-appender/index.js +26 -38
- package/src/components/default-block-appender/test/index.js +24 -16
- package/src/components/font-sizes/README.MD +0 -9
- package/src/components/global-styles/border-panel.js +72 -1
- package/src/components/global-styles/get-global-styles-changes.js +2 -8
- package/src/components/global-styles/index.js +0 -1
- package/src/components/global-styles/shadow-panel-components.js +125 -0
- package/src/components/global-styles/style.scss +8 -9
- package/src/components/global-styles/test/get-global-styles-changes.js +3 -3
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/test/utils.js +86 -0
- package/src/components/global-styles/typography-panel.js +1 -2
- package/src/components/global-styles/use-global-styles-output.js +5 -1
- package/src/components/global-styles/utils.js +36 -0
- package/src/components/inner-blocks/index.js +31 -32
- package/src/components/inner-blocks/index.native.js +3 -9
- package/src/components/inner-blocks/use-inner-block-template-sync.js +1 -3
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +4 -10
- package/src/components/inserter/block-patterns-tab/utils.js +2 -2
- package/src/components/inserter/quick-inserter.js +4 -2
- package/src/components/inserter/style.scss +3 -13
- package/src/components/inserter-draggable-blocks/index.js +12 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +4 -2
- package/src/components/link-control/index.js +1 -20
- package/src/components/link-control/link-preview.js +19 -24
- package/src/components/link-control/style.scss +5 -11
- package/src/components/link-control/test/index.js +11 -90
- package/src/components/list-view/block.js +49 -41
- package/src/components/list-view/index.js +22 -9
- package/src/components/list-view/use-clipboard-handler.js +199 -0
- package/src/components/list-view/utils.js +4 -4
- package/src/components/media-replace-flow/style.scss +1 -1
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/navigable-toolbar/index.js +8 -4
- package/src/components/provider/index.js +1 -1
- package/src/components/responsive-block-control/index.js +3 -5
- package/src/components/rich-text/index.js +3 -1
- package/src/components/spacing-sizes-control/index.js +2 -1
- package/src/components/url-input/style.scss +4 -2
- package/src/components/url-popover/image-url-input-ui.js +22 -10
- package/src/components/url-popover/index.js +75 -69
- package/src/components/url-popover/style.scss +12 -21
- package/src/components/use-block-drop-zone/index.js +17 -3
- package/src/components/use-flash-editable-blocks/index.js +62 -0
- package/src/components/use-on-block-drop/index.js +11 -4
- package/src/components/use-settings/index.js +9 -232
- package/src/components/writing-flow/use-clipboard-handler.js +6 -78
- package/src/components/writing-flow/use-drag-selection.js +12 -3
- package/src/components/writing-flow/utils.js +103 -0
- package/src/hooks/background.js +53 -8
- package/src/hooks/border.js +47 -6
- package/src/hooks/font-size.js +33 -33
- package/src/hooks/style.js +5 -9
- package/src/hooks/test/background.js +50 -0
- package/src/hooks/test/font-size.js +164 -0
- package/src/hooks/use-bindings-attributes.js +8 -18
- package/src/private-apis.js +4 -0
- package/src/store/get-block-settings.js +225 -0
- package/src/store/private-actions.js +44 -2
- package/src/store/private-selectors.js +53 -38
- package/src/store/reducer.js +29 -1
- package/src/store/selectors.js +74 -48
- package/src/store/test/get-block-settings.js +90 -0
- package/src/store/test/private-actions.js +18 -0
- package/src/store/test/private-selectors.js +19 -0
- package/src/store/test/reducer.js +19 -0
- package/build/components/global-styles/effects-panel.js +0 -219
- package/build/components/global-styles/effects-panel.js.map +0 -1
- package/build/hooks/effects.js +0 -66
- package/build/hooks/effects.js.map +0 -1
- package/build-module/components/global-styles/effects-panel.js +0 -210
- package/build-module/components/global-styles/effects-panel.js.map +0 -1
- package/build-module/hooks/effects.js +0 -51
- package/build-module/hooks/effects.js.map +0 -1
- package/src/components/global-styles/effects-panel.js +0 -244
- package/src/components/use-settings/test/index.js +0 -141
- package/src/hooks/effects.js +0 -57
- package/src/hooks/test/effects.js +0 -39
|
@@ -25,6 +25,7 @@ import { useEventHandlers } from './use-selected-block-event-handlers';
|
|
|
25
25
|
import { useNavModeExit } from './use-nav-mode-exit';
|
|
26
26
|
import { useBlockRefProvider } from './use-block-refs';
|
|
27
27
|
import { useIntersectionObserver } from './use-intersection-observer';
|
|
28
|
+
import { useFlashEditableBlocks } from '../../use-flash-editable-blocks';
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* This hook is used to lightly mark an element as a block element. The element
|
|
@@ -97,8 +98,10 @@ export function useBlockProps(props = {}, {
|
|
|
97
98
|
isBlockMovingMode,
|
|
98
99
|
canInsertMovingBlock,
|
|
99
100
|
isEditingDisabled,
|
|
101
|
+
hasEditableOutline,
|
|
100
102
|
isTemporarilyEditingAsBlocks,
|
|
101
|
-
defaultClassName
|
|
103
|
+
defaultClassName,
|
|
104
|
+
templateLock
|
|
102
105
|
} = useContext(PrivateBlockContext);
|
|
103
106
|
|
|
104
107
|
// translators: %s: Type of block (i.e. Text, Image etc)
|
|
@@ -117,6 +120,9 @@ export function useBlockProps(props = {}, {
|
|
|
117
120
|
clientId
|
|
118
121
|
}), useDisabled({
|
|
119
122
|
isDisabled: !hasOverlay
|
|
123
|
+
}), useFlashEditableBlocks({
|
|
124
|
+
clientId,
|
|
125
|
+
isEnabled: name === 'core/block' || templateLock === 'contentOnly'
|
|
120
126
|
})]);
|
|
121
127
|
const blockEditContext = useBlockEditContext();
|
|
122
128
|
// Ensures it warns only inside the `edit` implementation for the block.
|
|
@@ -150,6 +156,7 @@ export function useBlockProps(props = {}, {
|
|
|
150
156
|
'is-block-moving-mode': isBlockMovingMode,
|
|
151
157
|
'can-insert-moving-block': canInsertMovingBlock,
|
|
152
158
|
'is-editing-disabled': isEditingDisabled,
|
|
159
|
+
'has-editable-outline': hasEditableOutline,
|
|
153
160
|
'is-content-locked-temporarily-editing-as-blocks': isTemporarilyEditingAsBlocks
|
|
154
161
|
}, className, props.className, wrapperProps.className, defaultClassName),
|
|
155
162
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","useMergeRefs","useDisabled","warning","useMovingAnimation","PrivateBlockContext","useFocusFirstElement","useIsHovered","useBlockEditContext","useFocusHandler","useEventHandlers","useNavModeExit","useBlockRefProvider","useIntersectionObserver","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","blockEditingMode","isHighlighted","isMultiSelected","isPartiallySelected","isReusable","isDragging","hasChildSelected","removeOutline","isBlockMovingMode","canInsertMovingBlock","isEditingDisabled","isTemporarilyEditingAsBlocks","defaultClassName","blockLabel","htmlSuffix","mergedRefs","ref","isEnabled","triggerAnimationOnChange","isDisabled","blockEditContext","SCRIPT_DEBUG","tabIndex","id","role","inert","undefined","style","save"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tremoveOutline,\n\t\tisBlockMovingMode,\n\t\tcanInsertMovingBlock,\n\t\tisEditingDisabled,\n\t\tisTemporarilyEditingAsBlocks,\n\t\tdefaultClassName,\n\t} = useContext( PrivateBlockContext );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered( { isEnabled: isOutlineEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'remove-outline': removeOutline,\n\t\t\t\t'is-block-moving-mode': isBlockMovingMode,\n\t\t\t\t'can-insert-moving-block': canInsertMovingBlock,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'is-content-locked-temporarily-editing-as-blocks':\n\t\t\t\t\tisTemporarilyEditingAsBlocks,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,uBAAuB,IAAIC,aAAa,QAAQ,mBAAmB;AAC5E,SAASC,YAAY,EAAEC,WAAW,QAAQ,oBAAoB;AAC9D,OAAOC,OAAO,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M,GAAG8B,SAAS;IAC7CvC,SAAS,EAAEvB,UAAU,CACpB,gCAAgC,EAChC;MACC;MACA,UAAU,EAAE,CAAEyB,SAAS;MACvB,mBAAmB,EAAES,UAAU;MAC/B,aAAa,EAAEH,UAAU;MACzB,gBAAgB,EAAEM,aAAa;MAC/B,mBAAmB,EAAEC,eAAe;MACpC,uBAAuB,EAAEC,mBAAmB;MAC5C,aAAa,EAAEC,UAAU;MACzB,aAAa,EAAEC,UAAU;MACzB,oBAAoB,EAAEC,gBAAgB;MACtC,gBAAgB,EAAEC,aAAa;MAC/B,sBAAsB,EAAEC,iBAAiB;MACzC,yBAAyB,EAAEC,oBAAoB;MAC/C,qBAAqB,EAAEC,iBAAiB;MACxC,iDAAiD,EAChDC;IACF,CAAC,EACDxB,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtByB,gBACD,CAAC;IACDe,KAAK,EAAE;MAAE,GAAGvC,YAAY,CAACuC,KAAK;MAAE,GAAG3C,KAAK,CAAC2C;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA5C,aAAa,CAAC6C,IAAI,GAAG3D,aAAa"}
|
|
1
|
+
{"version":3,"names":["classnames","useContext","__","sprintf","__unstableGetBlockProps","getBlockProps","useMergeRefs","useDisabled","warning","useMovingAnimation","PrivateBlockContext","useFocusFirstElement","useIsHovered","useBlockEditContext","useFocusHandler","useEventHandlers","useNavModeExit","useBlockRefProvider","useIntersectionObserver","useFlashEditableBlocks","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","index","mode","name","blockApiVersion","blockTitle","isSelected","isSubtreeDisabled","isOutlineEnabled","hasOverlay","initialPosition","blockEditingMode","isHighlighted","isMultiSelected","isPartiallySelected","isReusable","isDragging","hasChildSelected","removeOutline","isBlockMovingMode","canInsertMovingBlock","isEditingDisabled","hasEditableOutline","isTemporarilyEditingAsBlocks","defaultClassName","templateLock","blockLabel","htmlSuffix","mergedRefs","ref","isEnabled","triggerAnimationOnChange","isDisabled","blockEditContext","SCRIPT_DEBUG","tabIndex","id","role","inert","undefined","style","save"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { useFlashEditableBlocks } from '../../use-flash-editable-blocks';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\tisOutlineEnabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tremoveOutline,\n\t\tisBlockMovingMode,\n\t\tcanInsertMovingBlock,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisTemporarilyEditingAsBlocks,\n\t\tdefaultClassName,\n\t\ttemplateLock,\n\t} = useContext( PrivateBlockContext );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered( { isEnabled: isOutlineEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t\tuseFlashEditableBlocks( {\n\t\t\tclientId,\n\t\t\tisEnabled: name === 'core/block' || templateLock === 'contentOnly',\n\t\t} ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'remove-outline': removeOutline,\n\t\t\t\t'is-block-moving-mode': isBlockMovingMode,\n\t\t\t\t'can-insert-moving-block': canInsertMovingBlock,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'has-editable-outline': hasEditableOutline,\n\t\t\t\t'is-content-locked-temporarily-editing-as-blocks':\n\t\t\t\t\tisTemporarilyEditingAsBlocks,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA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});
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const isVisible = useSelect(select => {
|
|
39
|
-
const {
|
|
40
|
-
getTemplateLock,
|
|
41
|
-
getSelectedBlockClientId,
|
|
42
|
-
__unstableGetEditorMode,
|
|
43
|
-
getBlockEditingMode
|
|
44
|
-
} = select(blockEditorStore);
|
|
45
|
-
if (!CustomAppender) {
|
|
46
|
-
const selectedBlockClientId = getSelectedBlockClientId();
|
|
47
|
-
const isParentSelected = rootClientId === selectedBlockClientId || !rootClientId && !selectedBlockClientId;
|
|
48
|
-
if (!isParentSelected) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (getTemplateLock(rootClientId) || getBlockEditingMode(rootClientId) === 'disabled' || __unstableGetEditorMode() === 'zoom-out') {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
}, [rootClientId, CustomAppender]);
|
|
57
|
-
if (!isVisible) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return CustomAppender ? createElement(CustomAppender, null) : createElement(DefaultAppender, {
|
|
61
|
-
rootClientId: rootClientId
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function BlockListAppender({
|
|
37
|
+
export default function BlockListAppender({
|
|
65
38
|
rootClientId,
|
|
66
|
-
|
|
39
|
+
CustomAppender,
|
|
67
40
|
className,
|
|
68
41
|
tagName: TagName = 'div'
|
|
69
42
|
}) {
|
|
70
|
-
if (renderAppender === false) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
return createElement(BlockListAppenderInner, {
|
|
74
|
-
rootClientId: rootClientId,
|
|
75
|
-
renderAppender: renderAppender,
|
|
76
|
-
className: className,
|
|
77
|
-
tagName: TagName
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
function BlockListAppenderInner({
|
|
81
|
-
rootClientId,
|
|
82
|
-
renderAppender,
|
|
83
|
-
className,
|
|
84
|
-
tagName: TagName
|
|
85
|
-
}) {
|
|
86
|
-
const appender = useAppender(rootClientId, renderAppender);
|
|
87
43
|
const isDragOver = useSelect(select => {
|
|
88
44
|
const {
|
|
89
45
|
getBlockInsertionPoint,
|
|
@@ -96,9 +52,6 @@ function BlockListAppenderInner({
|
|
|
96
52
|
// the DnD utility hooks.
|
|
97
53
|
return isBlockInsertionPointVisible() && rootClientId === insertionPoint?.rootClientId && getBlockCount(rootClientId) === 0;
|
|
98
54
|
}, [rootClientId]);
|
|
99
|
-
if (!appender) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
55
|
return createElement(TagName
|
|
103
56
|
// A `tabIndex` is used on the wrapping `div` element in order to
|
|
104
57
|
// force a focus event to occur when an appender `button` element
|
|
@@ -128,7 +81,8 @@ function BlockListAppenderInner({
|
|
|
128
81
|
// have commonly targeted that attribute for margins.
|
|
129
82
|
,
|
|
130
83
|
"data-block": true
|
|
131
|
-
},
|
|
84
|
+
}, CustomAppender ? createElement(CustomAppender, null) : createElement(DefaultAppender, {
|
|
85
|
+
rootClientId: rootClientId
|
|
86
|
+
}));
|
|
132
87
|
}
|
|
133
|
-
export default BlockListAppender;
|
|
134
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","getDefaultBlockName","DefaultBlockAppender","ButtonBlockAppender","store","blockEditorStore","DefaultAppender","rootClientId","canInsertDefaultBlock","select","canInsertBlockType","createElement","className","
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","getDefaultBlockName","DefaultBlockAppender","ButtonBlockAppender","store","blockEditorStore","DefaultAppender","rootClientId","canInsertDefaultBlock","select","canInsertBlockType","createElement","className","BlockListAppender","CustomAppender","tagName","TagName","isDragOver","getBlockInsertionPoint","isBlockInsertionPointVisible","getBlockCount","insertionPoint","tabIndex","contentEditable"],"sources":["@wordpress/block-editor/src/components/block-list-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DefaultBlockAppender from '../default-block-appender';\nimport ButtonBlockAppender from '../button-block-appender';\nimport { store as blockEditorStore } from '../../store';\n\nfunction DefaultAppender( { rootClientId } ) {\n\tconst canInsertDefaultBlock = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).canInsertBlockType(\n\t\t\tgetDefaultBlockName(),\n\t\t\trootClientId\n\t\t)\n\t);\n\n\tif ( canInsertDefaultBlock ) {\n\t\t// Render the default block appender if the context supports use\n\t\t// of the default appender.\n\t\treturn <DefaultBlockAppender rootClientId={ rootClientId } />;\n\t}\n\n\t// Fallback in case the default block can't be inserted.\n\treturn (\n\t\t<ButtonBlockAppender\n\t\t\trootClientId={ rootClientId }\n\t\t\tclassName=\"block-list-appender__toggle\"\n\t\t/>\n\t);\n}\n\nexport default function BlockListAppender( {\n\trootClientId,\n\tCustomAppender,\n\tclassName,\n\ttagName: TagName = 'div',\n} ) {\n\tconst isDragOver = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\t// Ideally we should also check for `isDragging` but currently it\n\t\t\t// requires a lot more setup. We can revisit this once we refactor\n\t\t\t// the DnD utility hooks.\n\t\t\treturn (\n\t\t\t\tisBlockInsertionPointVisible() &&\n\t\t\t\trootClientId === insertionPoint?.rootClientId &&\n\t\t\t\tgetBlockCount( rootClientId ) === 0\n\t\t\t);\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\treturn (\n\t\t<TagName\n\t\t\t// A `tabIndex` is used on the wrapping `div` element in order to\n\t\t\t// force a focus event to occur when an appender `button` element\n\t\t\t// is clicked. In some browsers (Firefox, Safari), button clicks do\n\t\t\t// not emit a focus event, which could cause this event to propagate\n\t\t\t// unexpectedly. The `tabIndex` ensures that the interaction is\n\t\t\t// captured as a focus, without also adding an extra tab stop.\n\t\t\t//\n\t\t\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t\t\ttabIndex={ -1 }\n\t\t\tclassName={ classnames( 'block-list-appender wp-block', className, {\n\t\t\t\t'is-drag-over': isDragOver,\n\t\t\t} ) }\n\t\t\t// Needed in case the whole editor is content editable (for multi\n\t\t\t// selection). It fixes an edge case where ArrowDown and ArrowRight\n\t\t\t// should collapse the selection to the end of that selection and\n\t\t\t// not into the appender.\n\t\t\tcontentEditable={ false }\n\t\t\t// The appender exists to let you add the first Paragraph before\n\t\t\t// any is inserted. To that end, this appender should visually be\n\t\t\t// presented as a block. That means theme CSS should style it as if\n\t\t\t// it were an empty paragraph block. That means a `wp-block` class to\n\t\t\t// ensure the width is correct, and a [data-block] attribute to ensure\n\t\t\t// the correct margin is applied, especially for classic themes which\n\t\t\t// have commonly targeted that attribute for margins.\n\t\t\tdata-block\n\t\t>\n\t\t\t{ CustomAppender ? (\n\t\t\t\t<CustomAppender />\n\t\t\t) : (\n\t\t\t\t<DefaultAppender rootClientId={ rootClientId } />\n\t\t\t) }\n\t\t</TagName>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,eAAeA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC5C,MAAMC,qBAAqB,GAAGR,SAAS,CAAIS,MAAM,IAChDA,MAAM,CAAEJ,gBAAiB,CAAC,CAACK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fRTL(isBackwardButton, forwardButtonProp, backwardButt
|
|
|
59
59
|
if (isBackwardButton) {
|
|
60
60
|
return forwardButtonProp; // Set forwardButtonProp for backward button.
|
|
61
61
|
}
|
|
62
|
-
|
|
63
62
|
return backwardButtonProp; // Set backwardButtonProp for forward button.
|
|
64
63
|
}
|
|
65
|
-
|
|
66
64
|
return isBackwardButton ? backwardButtonProp : forwardButtonProp;
|
|
67
65
|
}
|
|
68
66
|
function getSetup() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["I18nManager","__","sprintf","arrowUp","arrowDown","arrowLeft","arrowRight","horizontalMover","backwardButtonIcon","forwardButtonIcon","backwardButtonHint","forwardButtonHint","firstBlockTitle","lastBlockTitle","backwardButtonTitle","forwardButtonTitle","verticalMover","KEYS","SETUP_GETTER","description","getMoverDescription","icon","getArrowIcon","title","getMoverButtonTitle","actionTitle","getMoverActionTitle","getMoversSetup","isStackedHorizontally","firstIndex","keys","reduce","setup","key","includes","Object","assign","getSetup","switchButtonPropIfRTL","isBackwardButton","forwardButtonProp","backwardButtonProp","isRTL","args","arguments","apply","applyRTLSetup","backward","forward","actionTitlePrev","actionTitleNext","getIndexes","fromIndex","direction","toIndex","buttonTitlePrev","buttonTitleNext"],"sources":["@wordpress/block-editor/src/components/block-mover/mover-description.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { I18nManager } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { arrowUp, arrowDown, arrowLeft, arrowRight } from '@wordpress/icons';\n\nconst horizontalMover = {\n\tbackwardButtonIcon: arrowLeft,\n\tforwardButtonIcon: arrowRight,\n\tbackwardButtonHint: __( 'Double tap to move the block to the left' ),\n\tforwardButtonHint: __( 'Double tap to move the block to the right' ),\n\tfirstBlockTitle: __( 'Move block left' ),\n\tlastBlockTitle: __( 'Move block right' ),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tbackwardButtonTitle: __(\n\t\t'Move block left from position %1$s to position %2$s'\n\t),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tforwardButtonTitle: __(\n\t\t'Move block right from position %1$s to position %2$s'\n\t),\n};\n\nconst verticalMover = {\n\tbackwardButtonIcon: arrowUp,\n\tforwardButtonIcon: arrowDown,\n\tbackwardButtonHint: __( 'Double tap to move the block up' ),\n\tforwardButtonHint: __( 'Double tap to move the block down' ),\n\tfirstBlockTitle: __( 'Move block up' ),\n\tlastBlockTitle: __( 'Move block down' ),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tbackwardButtonTitle: __( 'Move block up from row %1$s to row %2$s' ),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tforwardButtonTitle: __( 'Move block down from row %1$s to row %2$s' ),\n};\n\nconst KEYS = [ 'description', 'icon', 'title', 'actionTitle' ];\n\nconst SETUP_GETTER = {\n\tdescription: getMoverDescription,\n\ticon: getArrowIcon,\n\ttitle: getMoverButtonTitle,\n\tactionTitle: getMoverActionTitle,\n};\n\nexport function getMoversSetup(\n\tisStackedHorizontally,\n\t{ firstIndex, keys = KEYS }\n) {\n\treturn keys.reduce( ( setup, key ) => {\n\t\tif ( KEYS.includes( key ) ) {\n\t\t\tObject.assign( setup, {\n\t\t\t\t[ key ]: getSetup( key, isStackedHorizontally, {\n\t\t\t\t\tfirstIndex,\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\t\treturn setup;\n\t}, {} );\n}\n\nfunction switchButtonPropIfRTL(\n\tisBackwardButton,\n\tforwardButtonProp,\n\tbackwardButtonProp,\n\tisStackedHorizontally\n) {\n\tif ( I18nManager.isRTL && isStackedHorizontally ) {\n\t\t// For RTL and horizontal direction switch prop between forward and backward button.\n\t\tif ( isBackwardButton ) {\n\t\t\treturn forwardButtonProp; // Set forwardButtonProp for backward button.\n\t\t}\n\t\treturn backwardButtonProp; // Set backwardButtonProp for forward button.\n\t}\n\n\treturn isBackwardButton ? backwardButtonProp : forwardButtonProp;\n}\n\nfunction getSetup() {\n\tconst [ key, ...args ] = arguments;\n\treturn SETUP_GETTER[ key ].apply( null, [ ...args ] );\n}\n\nfunction applyRTLSetup( isBackwardButton, args ) {\n\treturn switchButtonPropIfRTL.apply( null, [ isBackwardButton, ...args ] );\n}\n\nfunction getMoverDescription( isStackedHorizontally ) {\n\treturn isStackedHorizontally ? horizontalMover : verticalMover;\n}\n\nfunction getArrowIcon( isStackedHorizontally ) {\n\tconst { forwardButtonIcon, backwardButtonIcon } = getMoverDescription(\n\t\tisStackedHorizontally\n\t);\n\n\tconst args = [\n\t\tforwardButtonIcon,\n\t\tbackwardButtonIcon,\n\t\tisStackedHorizontally,\n\t];\n\n\treturn {\n\t\tbackward: applyRTLSetup( true, args ),\n\t\tforward: applyRTLSetup( false, args ),\n\t};\n}\n\nfunction getMoverActionTitle( isStackedHorizontally ) {\n\tconst { firstBlockTitle, lastBlockTitle } = getMoverDescription(\n\t\tisStackedHorizontally\n\t);\n\n\tconst args = [ lastBlockTitle, firstBlockTitle, isStackedHorizontally ];\n\n\tconst actionTitlePrev = applyRTLSetup( true, args );\n\tconst actionTitleNext = applyRTLSetup( false, args );\n\n\treturn {\n\t\tbackward: sprintf( actionTitlePrev, firstBlockTitle ),\n\t\tforward: sprintf( actionTitleNext, lastBlockTitle ),\n\t};\n}\n\nfunction getMoverButtonTitle( isStackedHorizontally, { firstIndex } ) {\n\tconst getIndexes = ( isBackwardButton ) => {\n\t\tconst fromIndex = firstIndex + 1; // Current position based on index\n\t\t// for backwardButton decrease index (move left/up) for forwardButton increase index (move right/down)\n\t\tconst direction = isBackwardButton ? -1 : 1;\n\t\tconst toIndex = fromIndex + direction; // Position after move.\n\t\treturn [ fromIndex, toIndex ];\n\t};\n\n\tconst { backwardButtonTitle, forwardButtonTitle } = getMoverDescription(\n\t\tisStackedHorizontally\n\t);\n\n\tconst args = [\n\t\tforwardButtonTitle,\n\t\tbackwardButtonTitle,\n\t\tisStackedHorizontally,\n\t];\n\n\tconst buttonTitlePrev = applyRTLSetup( true, args );\n\tconst buttonTitleNext = applyRTLSetup( false, args );\n\n\treturn {\n\t\tbackward: sprintf( buttonTitlePrev, ...getIndexes( true ) ),\n\t\tforward: sprintf( buttonTitleNext, ...getIndexes( false ) ),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,cAAc;AAC1C;AACA;AACA;AACA,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,OAAO,EAAEC,SAAS,EAAEC,SAAS,EAAEC,UAAU,QAAQ,kBAAkB;AAE5E,MAAMC,eAAe,GAAG;EACvBC,kBAAkB,EAAEH,SAAS;EAC7BI,iBAAiB,EAAEH,UAAU;EAC7BI,kBAAkB,EAAET,EAAE,CAAE,0CAA2C,CAAC;EACpEU,iBAAiB,EAAEV,EAAE,CAAE,2CAA4C,CAAC;EACpEW,eAAe,EAAEX,EAAE,CAAE,iBAAkB,CAAC;EACxCY,cAAc,EAAEZ,EAAE,CAAE,kBAAmB,CAAC;EACxC;EACAa,mBAAmB,EAAEb,EAAE,CACtB,qDACD,CAAC;EACD;EACAc,kBAAkB,EAAEd,EAAE,CACrB,sDACD;AACD,CAAC;AAED,MAAMe,aAAa,GAAG;EACrBR,kBAAkB,EAAEL,OAAO;EAC3BM,iBAAiB,EAAEL,SAAS;EAC5BM,kBAAkB,EAAET,EAAE,CAAE,iCAAkC,CAAC;EAC3DU,iBAAiB,EAAEV,EAAE,CAAE,mCAAoC,CAAC;EAC5DW,eAAe,EAAEX,EAAE,CAAE,eAAgB,CAAC;EACtCY,cAAc,EAAEZ,EAAE,CAAE,iBAAkB,CAAC;EACvC;EACAa,mBAAmB,EAAEb,EAAE,CAAE,yCAA0C,CAAC;EACpE;EACAc,kBAAkB,EAAEd,EAAE,CAAE,2CAA4C;AACrE,CAAC;AAED,MAAMgB,IAAI,GAAG,CAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAE;AAE9D,MAAMC,YAAY,GAAG;EACpBC,WAAW,EAAEC,mBAAmB;EAChCC,IAAI,EAAEC,YAAY;EAClBC,KAAK,EAAEC,mBAAmB;EAC1BC,WAAW,EAAEC;AACd,CAAC;AAED,OAAO,SAASC,cAAcA,CAC7BC,qBAAqB,EACrB;EAAEC,UAAU;EAAEC,IAAI,GAAGb;AAAK,CAAC,EAC1B;EACD,OAAOa,IAAI,CAACC,MAAM,CAAE,CAAEC,KAAK,EAAEC,GAAG,KAAM;IACrC,IAAKhB,IAAI,CAACiB,QAAQ,CAAED,GAAI,CAAC,EAAG;MAC3BE,MAAM,CAACC,MAAM,CAAEJ,KAAK,EAAE;QACrB,CAAEC,GAAG,GAAII,QAAQ,CAAEJ,GAAG,EAAEL,qBAAqB,EAAE;UAC9CC;QACD,CAAE;MACH,CAAE,CAAC;IACJ;IACA,OAAOG,KAAK;EACb,CAAC,EAAE,CAAC,CAAE,CAAC;AACR;AAEA,SAASM,qBAAqBA,CAC7BC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,EAClBb,qBAAqB,EACpB;EACD,IAAK5B,WAAW,CAAC0C,KAAK,IAAId,qBAAqB,EAAG;IACjD;IACA,IAAKW,gBAAgB,EAAG;MACvB,OAAOC,iBAAiB,CAAC,CAAC;IAC3B
|
|
1
|
+
{"version":3,"names":["I18nManager","__","sprintf","arrowUp","arrowDown","arrowLeft","arrowRight","horizontalMover","backwardButtonIcon","forwardButtonIcon","backwardButtonHint","forwardButtonHint","firstBlockTitle","lastBlockTitle","backwardButtonTitle","forwardButtonTitle","verticalMover","KEYS","SETUP_GETTER","description","getMoverDescription","icon","getArrowIcon","title","getMoverButtonTitle","actionTitle","getMoverActionTitle","getMoversSetup","isStackedHorizontally","firstIndex","keys","reduce","setup","key","includes","Object","assign","getSetup","switchButtonPropIfRTL","isBackwardButton","forwardButtonProp","backwardButtonProp","isRTL","args","arguments","apply","applyRTLSetup","backward","forward","actionTitlePrev","actionTitleNext","getIndexes","fromIndex","direction","toIndex","buttonTitlePrev","buttonTitleNext"],"sources":["@wordpress/block-editor/src/components/block-mover/mover-description.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { I18nManager } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { arrowUp, arrowDown, arrowLeft, arrowRight } from '@wordpress/icons';\n\nconst horizontalMover = {\n\tbackwardButtonIcon: arrowLeft,\n\tforwardButtonIcon: arrowRight,\n\tbackwardButtonHint: __( 'Double tap to move the block to the left' ),\n\tforwardButtonHint: __( 'Double tap to move the block to the right' ),\n\tfirstBlockTitle: __( 'Move block left' ),\n\tlastBlockTitle: __( 'Move block right' ),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tbackwardButtonTitle: __(\n\t\t'Move block left from position %1$s to position %2$s'\n\t),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tforwardButtonTitle: __(\n\t\t'Move block right from position %1$s to position %2$s'\n\t),\n};\n\nconst verticalMover = {\n\tbackwardButtonIcon: arrowUp,\n\tforwardButtonIcon: arrowDown,\n\tbackwardButtonHint: __( 'Double tap to move the block up' ),\n\tforwardButtonHint: __( 'Double tap to move the block down' ),\n\tfirstBlockTitle: __( 'Move block up' ),\n\tlastBlockTitle: __( 'Move block down' ),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tbackwardButtonTitle: __( 'Move block up from row %1$s to row %2$s' ),\n\t/* translators: accessibility text. %1: current block position (number). %2: next block position (number) */\n\tforwardButtonTitle: __( 'Move block down from row %1$s to row %2$s' ),\n};\n\nconst KEYS = [ 'description', 'icon', 'title', 'actionTitle' ];\n\nconst SETUP_GETTER = {\n\tdescription: getMoverDescription,\n\ticon: getArrowIcon,\n\ttitle: getMoverButtonTitle,\n\tactionTitle: getMoverActionTitle,\n};\n\nexport function getMoversSetup(\n\tisStackedHorizontally,\n\t{ firstIndex, keys = KEYS }\n) {\n\treturn keys.reduce( ( setup, key ) => {\n\t\tif ( KEYS.includes( key ) ) {\n\t\t\tObject.assign( setup, {\n\t\t\t\t[ key ]: getSetup( key, isStackedHorizontally, {\n\t\t\t\t\tfirstIndex,\n\t\t\t\t} ),\n\t\t\t} );\n\t\t}\n\t\treturn setup;\n\t}, {} );\n}\n\nfunction switchButtonPropIfRTL(\n\tisBackwardButton,\n\tforwardButtonProp,\n\tbackwardButtonProp,\n\tisStackedHorizontally\n) {\n\tif ( I18nManager.isRTL && isStackedHorizontally ) {\n\t\t// For RTL and horizontal direction switch prop between forward and backward button.\n\t\tif ( isBackwardButton ) {\n\t\t\treturn forwardButtonProp; // Set forwardButtonProp for backward button.\n\t\t}\n\t\treturn backwardButtonProp; // Set backwardButtonProp for forward button.\n\t}\n\n\treturn isBackwardButton ? backwardButtonProp : forwardButtonProp;\n}\n\nfunction getSetup() {\n\tconst [ key, ...args ] = arguments;\n\treturn SETUP_GETTER[ key ].apply( null, [ ...args ] );\n}\n\nfunction applyRTLSetup( isBackwardButton, args ) {\n\treturn switchButtonPropIfRTL.apply( null, [ isBackwardButton, ...args ] );\n}\n\nfunction getMoverDescription( isStackedHorizontally ) {\n\treturn isStackedHorizontally ? horizontalMover : verticalMover;\n}\n\nfunction getArrowIcon( isStackedHorizontally ) {\n\tconst { forwardButtonIcon, backwardButtonIcon } = getMoverDescription(\n\t\tisStackedHorizontally\n\t);\n\n\tconst args = [\n\t\tforwardButtonIcon,\n\t\tbackwardButtonIcon,\n\t\tisStackedHorizontally,\n\t];\n\n\treturn {\n\t\tbackward: applyRTLSetup( true, args ),\n\t\tforward: applyRTLSetup( false, args ),\n\t};\n}\n\nfunction getMoverActionTitle( isStackedHorizontally ) {\n\tconst { firstBlockTitle, lastBlockTitle } = getMoverDescription(\n\t\tisStackedHorizontally\n\t);\n\n\tconst args = [ lastBlockTitle, firstBlockTitle, isStackedHorizontally ];\n\n\tconst actionTitlePrev = applyRTLSetup( true, args );\n\tconst actionTitleNext = applyRTLSetup( false, args );\n\n\treturn {\n\t\tbackward: sprintf( actionTitlePrev, firstBlockTitle ),\n\t\tforward: sprintf( actionTitleNext, lastBlockTitle ),\n\t};\n}\n\nfunction getMoverButtonTitle( isStackedHorizontally, { firstIndex } ) {\n\tconst getIndexes = ( isBackwardButton ) => {\n\t\tconst fromIndex = firstIndex + 1; // Current position based on index\n\t\t// for backwardButton decrease index (move left/up) for forwardButton increase index (move right/down)\n\t\tconst direction = isBackwardButton ? -1 : 1;\n\t\tconst toIndex = fromIndex + direction; // Position after move.\n\t\treturn [ fromIndex, toIndex ];\n\t};\n\n\tconst { backwardButtonTitle, forwardButtonTitle } = getMoverDescription(\n\t\tisStackedHorizontally\n\t);\n\n\tconst args = [\n\t\tforwardButtonTitle,\n\t\tbackwardButtonTitle,\n\t\tisStackedHorizontally,\n\t];\n\n\tconst buttonTitlePrev = applyRTLSetup( true, args );\n\tconst buttonTitleNext = applyRTLSetup( false, args );\n\n\treturn {\n\t\tbackward: sprintf( buttonTitlePrev, ...getIndexes( true ) ),\n\t\tforward: sprintf( buttonTitleNext, ...getIndexes( false ) ),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,cAAc;AAC1C;AACA;AACA;AACA,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,OAAO,EAAEC,SAAS,EAAEC,SAAS,EAAEC,UAAU,QAAQ,kBAAkB;AAE5E,MAAMC,eAAe,GAAG;EACvBC,kBAAkB,EAAEH,SAAS;EAC7BI,iBAAiB,EAAEH,UAAU;EAC7BI,kBAAkB,EAAET,EAAE,CAAE,0CAA2C,CAAC;EACpEU,iBAAiB,EAAEV,EAAE,CAAE,2CAA4C,CAAC;EACpEW,eAAe,EAAEX,EAAE,CAAE,iBAAkB,CAAC;EACxCY,cAAc,EAAEZ,EAAE,CAAE,kBAAmB,CAAC;EACxC;EACAa,mBAAmB,EAAEb,EAAE,CACtB,qDACD,CAAC;EACD;EACAc,kBAAkB,EAAE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AEH,IAAK,CAAC;EACnD,MAAMO,eAAe,GAAGJ,aAAa,CAAE,KAAK,EAAEH,IAAK,CAAC;EAEpD,OAAO;IACNI,QAAQ,EAAE7C,OAAO,CAAE+C,eAAe,EAAErC,eAAgB,CAAC;IACrDoC,OAAO,EAAE9C,OAAO,CAAEgD,eAAe,EAAErC,cAAe;EACnD,CAAC;AACF;AAEA,SAASW,mBAAmBA,CAAEI,qBAAqB,EAAE;EAAEC;AAAW,CAAC,EAAG;EACrE,MAAMsB,UAAU,GAAKZ,gBAAgB,IAAM;IAC1C,MAAMa,SAAS,GAAGvB,UAAU,GAAG,CAAC,CAAC,CAAC;IAClC;IACA,MAAMwB,SAAS,GAAGd,gBAAgB,GAAG,CAAC,CAAC,GAAG,CAAC;IAC3C,MAAMe,OAAO,GAAGF,SAAS,GAAGC,SAAS,CAAC,CAAC;IACvC,OAAO,CAAED,SAAS,EAAEE,OAAO,CAAE;EAC9B,CAAC;EAED,MAAM;IAAExC,mBAAmB;IAAEC;EAAmB,CAAC,GAAGK,mBAAmB,CACtEQ,qBACD,CAAC;EAED,MAAMe,IAAI,GAAG,CACZ5B,kBAAkB,EAClBD,mBAAmB,EACnBc,qBAAqB,CACrB;EAED,MAAM2B,eAAe,GAAGT,aAAa,CAAE,IAAI,EAAEH,IAAK,CAAC;EACnD,MAAMa,eAAe,GAAGV,aAAa,CAAE,KAAK,EAAEH,IAAK,CAAC;EAEpD,OAAO;IACNI,QAAQ,EAAE7C,OAAO,CAAEqD,eAAe,EAAE,GAAGJ,UAAU,CAAE,IAAK,CAAE,CAAC;IAC3DH,OAAO,EAAE9C,OAAO,CAAEsD,eAAe,EAAE,GAAGL,UAAU,CAAE,KAAM,CAAE;EAC3D,CAAC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","useMemo","createContext","useReducer","useLayoutEffect","Popover","isRTL","store","blockEditorStore","__unstableUseBlockElement","useBlockElement","usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","InsertionPointOpenRef","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","props","popoverRecomputeCounter","forcePopoverRecompute","s","orientation","rootClientId","isVisible","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","_rootClientId","previousElement","nextElement","isVertical","popoverAnchor","undefined","contextElement","getBoundingClientRect","previousRect","nextRect","left","top","width","height","targetRect","bottom","right","window","DOMRect","popoverScrollRef","observer","MutationObserver","observe","attributes","disconnect","ownerDocument","defaultView","addEventListener","removeEventListener","createElement","ref","animate","anchor","focusOnMount","__unstableSlotName","inline","key","className","resize","flip","placement","variant"],"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseMemo,\n\tcreateContext,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ popoverRecomputeCounter, forcePopoverRecompute ] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverRecomputeCounter is by definition always equal or greater than 0.\n\t\t\t// This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverRecomputeCounter < 0 ||\n\t\t\t( ! previousElement && ! nextElement ) ||\n\t\t\t! isVisible\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst contextElement =\n\t\t\toperation === 'group'\n\t\t\t\t? nextElement || previousElement\n\t\t\t\t: previousElement || nextElement;\n\n\t\treturn {\n\t\t\tcontextElement,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst previousRect = previousElement\n\t\t\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\t\t\t\tconst nextRect = nextElement\n\t\t\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\n\t\t\t\tlet left = 0;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet width = 0;\n\t\t\t\tlet height = 0;\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetRect = nextRect || previousRect;\n\t\t\t\t\ttop = targetRect.top;\n\t\t\t\t\t// No spacing is likely around blocks in this operation.\n\t\t\t\t\t// So width of the inserter containing rect is set to 0.\n\t\t\t\t\twidth = 0;\n\t\t\t\t\theight = targetRect.bottom - targetRect.top;\n\t\t\t\t\t// Popover calculates its distance from mid-block so some\n\t\t\t\t\t// adjustments are needed to make it appear in the right place.\n\t\t\t\t\tleft =\n\t\t\t\t\t\tnearestSide === 'left'\n\t\t\t\t\t\t\t? targetRect.left - 2\n\t\t\t\t\t\t\t: targetRect.right - 2;\n\t\t\t\t} else if ( isVertical ) {\n\t\t\t\t\t// vertical\n\t\t\t\t\ttop = previousRect ? previousRect.bottom : nextRect.top;\n\t\t\t\t\twidth = previousRect ? previousRect.width : nextRect.width;\n\t\t\t\t\theight =\n\t\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tleft = previousRect ? previousRect.left : nextRect.left;\n\t\t\t\t} else {\n\t\t\t\t\ttop = previousRect ? previousRect.top : nextRect.top;\n\t\t\t\t\theight = previousRect\n\t\t\t\t\t\t? previousRect.height\n\t\t\t\t\t\t: nextRect.height;\n\n\t\t\t\t\tif ( isRTL() ) {\n\t\t\t\t\t\t// non vertical, rtl\n\t\t\t\t\t\tleft = nextRect ? nextRect.right : previousRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// non vertical, ltr\n\t\t\t\t\t\tleft = previousRect\n\t\t\t\t\t\t\t? previousRect.right\n\t\t\t\t\t\t\t: nextRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? nextRect.left - previousRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tpopoverRecomputeCounter,\n\t\tisVertical,\n\t\tisVisible,\n\t\toperation,\n\t\tnearestSide,\n\t] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\t// When blocks are moved up/down, their position can be set by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforcePopoverRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView?.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforcePopoverRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"overlay\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"block-editor-block-popover__inbetween-container\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,OAAO,EACPC,aAAa,EACbC,UAAU,EACVC,eAAe,QACT,oBAAoB;AAC3B,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6B,YAAY,EAAG;IACf;IACA;IAAA;IACAC,kBAAkB,EAAGjD,qBAAuB;IAC5CkD,MAAM,EAAG,CAAElD;IACX;IACA;IAAA;IACAmD,GAAG,EAAGrD,YAAY,GAAG,IAAI,GAAGW,YAAc;IAAA,GACrCL,KAAK;IACVgD,SAAS,EAAGzE,UAAU,CACrB,4BAA4B,EAC5B,uCAAuC,EACvCyB,KAAK,CAACgD,SACP,CAAG;IACHC,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdC,SAAS,EAAC,SAAS;IACnBC,OAAO,EAAC;EAAU,GAElBZ,aAAA;IAAKQ,SAAS,EAAC;EAAiD,GAC7DrD,QACE,CACG,CAAC;EAEX;AACD;;AAEA,eAAeH,qBAAqB"}
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","useMemo","createContext","useReducer","useLayoutEffect","Popover","isRTL","store","blockEditorStore","__unstableUseBlockElement","useBlockElement","usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","InsertionPointOpenRef","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","props","popoverRecomputeCounter","forcePopoverRecompute","s","orientation","rootClientId","isVisible","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","_rootClientId","previousElement","nextElement","isVertical","popoverAnchor","undefined","contextElement","getBoundingClientRect","previousRect","nextRect","left","top","width","height","targetRect","bottom","right","window","DOMRect","popoverScrollRef","observer","MutationObserver","observe","attributes","disconnect","ownerDocument","defaultView","addEventListener","removeEventListener","createElement","ref","animate","anchor","focusOnMount","__unstableSlotName","inline","key","className","resize","flip","placement","variant"],"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseMemo,\n\tcreateContext,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ popoverRecomputeCounter, forcePopoverRecompute ] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverRecomputeCounter is by definition always equal or greater than 0.\n\t\t\t// This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverRecomputeCounter < 0 ||\n\t\t\t( ! previousElement && ! nextElement ) ||\n\t\t\t! isVisible\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst contextElement =\n\t\t\toperation === 'group'\n\t\t\t\t? nextElement || previousElement\n\t\t\t\t: previousElement || nextElement;\n\n\t\treturn {\n\t\t\tcontextElement,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst previousRect = previousElement\n\t\t\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\t\t\t\tconst nextRect = nextElement\n\t\t\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\n\t\t\t\tlet left = 0;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet width = 0;\n\t\t\t\tlet height = 0;\n\n\t\t\t\tif ( operation === 'group' ) {\n\t\t\t\t\tconst targetRect = nextRect || previousRect;\n\t\t\t\t\ttop = targetRect.top;\n\t\t\t\t\t// No spacing is likely around blocks in this operation.\n\t\t\t\t\t// So width of the inserter containing rect is set to 0.\n\t\t\t\t\twidth = 0;\n\t\t\t\t\theight = targetRect.bottom - targetRect.top;\n\t\t\t\t\t// Popover calculates its distance from mid-block so some\n\t\t\t\t\t// adjustments are needed to make it appear in the right place.\n\t\t\t\t\tleft =\n\t\t\t\t\t\tnearestSide === 'left'\n\t\t\t\t\t\t\t? targetRect.left - 2\n\t\t\t\t\t\t\t: targetRect.right - 2;\n\t\t\t\t} else if ( isVertical ) {\n\t\t\t\t\t// vertical\n\t\t\t\t\ttop = previousRect ? previousRect.bottom : nextRect.top;\n\t\t\t\t\twidth = previousRect ? previousRect.width : nextRect.width;\n\t\t\t\t\theight =\n\t\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tleft = previousRect ? previousRect.left : nextRect.left;\n\t\t\t\t} else {\n\t\t\t\t\ttop = previousRect ? previousRect.top : nextRect.top;\n\t\t\t\t\theight = previousRect\n\t\t\t\t\t\t? previousRect.height\n\t\t\t\t\t\t: nextRect.height;\n\n\t\t\t\t\tif ( isRTL() ) {\n\t\t\t\t\t\t// non vertical, rtl\n\t\t\t\t\t\tleft = nextRect ? nextRect.right : previousRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// non vertical, ltr\n\t\t\t\t\t\tleft = previousRect\n\t\t\t\t\t\t\t? previousRect.right\n\t\t\t\t\t\t\t: nextRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? nextRect.left - previousRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tpopoverRecomputeCounter,\n\t\tisVertical,\n\t\tisVisible,\n\t\toperation,\n\t\tnearestSide,\n\t] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\t// When blocks are moved up/down, their position can be set by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforcePopoverRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView?.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforcePopoverRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"overlay\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"block-editor-block-popover__inbetween-container\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,OAAO,EACPC,aAAa,EACbC,UAAU,EACVC,eAAe,QACT,oBAAoB;AAC3B,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,yBAAyB,IAAIC,eAAe,QAAQ,8CAA8C;AAC3G,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAE7D,OAAO,MAAMC,qBAAqB,GAAGb,aAAa,CAAC,CAAC;AAEpD,SAASc,qBAAqBA,CAAE;EAC/BC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,qBAAqB;EACrBC,oBAAoB;EACpBC,SAAS,GAAG,QAAQ;EACpBC,WAAW,GAAG,OAAO;EACrB,GAAGC;AACJ,CAAC,EAAG;EACH;EACA,MAAM,CAAEC,uBAAuB,EAAEC,qBAAqB,CAAE,GAAGvB,UAAU;EACpE;EACEwB,CAAC,IAAM,CAAEA,CAAC,GAAG,CAAC,IAAKf,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CAAEtB,WAAW,CAAG,CAAC;EAEpBjC,eAAe,CAAE,MAAM;IACtB,IAAK,CAAEgC,eAAe,EAAG;MACxB;IACD;IACAA,eAAe,CAACwB,aAAa,CAACC,WAAW,CAACC,gBAAgB,CACzD,QAAQ,EACRpC,qBACD,CAAC;IACD,OAAO,MAAM;MACZU,eAAe,CAACwB,aAAa,CAACC,WAAW,EAAEE,mBAAmB,CAC7D,QAAQ,EACRrC,qBACD,CAAC;IACF,CAAC;EACF,CAAC,EAAE,CAAEU,eAAe,CAAG,CAAC;;EAExB;EACA;EACA;EACA,IAAO,CAAEA,eAAe,IAAI,CAAEC,WAAW,IAAM,CAAEP,SAAS,EAAG;IAC5D,OAAO,IAAI;EACZ;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OACCkC,aAAA,CAAC3D,OAAO;IACP4D,GAAG,EAAGX,gBAAkB;IACxBY,OAAO,EAAG,KAAO;IACjBC,MAAM,EAAG5B,aAAe;IACxB6B,YAAY,EAAG;IACf;IACA;IAAA;IACAC,kBAAkB,EAAGjD,qBAAuB;IAC5CkD,MAAM,EAAG,CAAElD;IACX;IACA;IAAA;IACAmD,GAAG,EAAGrD,YAAY,GAAG,IAAI,GAAGW,YAAc;IAAA,GACrCL,KAAK;IACVgD,SAAS,EAAGzE,UAAU,CACrB,4BAA4B,EAC5B,uCAAuC,EACvCyB,KAAK,CAACgD,SACP,CAAG;IACHC,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdC,SAAS,EAAC,SAAS;IACnBC,OAAO,EAAC;EAAU,GAElBZ,aAAA;IAAKQ,SAAS,EAAC;EAAiD,GAC7DrD,QACE,CACG,CAAC;EAEX;AACD;AAEA,eAAeH,qBAAqB"}
|
|
@@ -18,11 +18,12 @@ import { store } from '../../store';
|
|
|
18
18
|
// This is used to avoid rendering the block list if the sizes change.
|
|
19
19
|
let MemoizedBlockList;
|
|
20
20
|
const MAX_HEIGHT = 2000;
|
|
21
|
+
const EMPTY_ADDITIONAL_STYLES = [];
|
|
21
22
|
function ScaledBlockPreview({
|
|
22
23
|
viewportWidth,
|
|
23
24
|
containerWidth,
|
|
24
25
|
minHeight,
|
|
25
|
-
additionalStyles =
|
|
26
|
+
additionalStyles = EMPTY_ADDITIONAL_STYLES
|
|
26
27
|
}) {
|
|
27
28
|
if (!viewportWidth) {
|
|
28
29
|
viewportWidth = containerWidth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useResizeObserver","useRefEffect","useSelect","memo","useMemo","Disabled","BlockList","Iframe","EditorStyles","store","MemoizedBlockList","MAX_HEIGHT","ScaledBlockPreview","viewportWidth","containerWidth","minHeight","additionalStyles","contentResizeListener","height","contentHeight","styles","select","settings","getSettings","editorStyles","css","__unstableType","scale","aspectRatio","createElement","className","style","transform","maxHeight","undefined","contentRef","bodyElement","ownerDocument","documentElement","classList","add","position","width","boxSizing","tabIndex","pointerEvents","renderAppender","AutoBlockPreview","props","containerResizeListener","Fragment"],"sources":["@wordpress/block-editor/src/components/block-preview/auto.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useResizeObserver, useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport Iframe from '../iframe';\nimport EditorStyles from '../editor-styles';\nimport { store } from '../../store';\n\n// This is used to avoid rendering the block list if the sizes change.\nlet MemoizedBlockList;\n\nconst MAX_HEIGHT = 2000;\n\nfunction ScaledBlockPreview( {\n\tviewportWidth,\n\tcontainerWidth,\n\tminHeight,\n\tadditionalStyles =
|
|
1
|
+
{"version":3,"names":["useResizeObserver","useRefEffect","useSelect","memo","useMemo","Disabled","BlockList","Iframe","EditorStyles","store","MemoizedBlockList","MAX_HEIGHT","EMPTY_ADDITIONAL_STYLES","ScaledBlockPreview","viewportWidth","containerWidth","minHeight","additionalStyles","contentResizeListener","height","contentHeight","styles","select","settings","getSettings","editorStyles","css","__unstableType","scale","aspectRatio","createElement","className","style","transform","maxHeight","undefined","contentRef","bodyElement","ownerDocument","documentElement","classList","add","position","width","boxSizing","tabIndex","pointerEvents","renderAppender","AutoBlockPreview","props","containerResizeListener","Fragment"],"sources":["@wordpress/block-editor/src/components/block-preview/auto.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useResizeObserver, useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport Iframe from '../iframe';\nimport EditorStyles from '../editor-styles';\nimport { store } from '../../store';\n\n// This is used to avoid rendering the block list if the sizes change.\nlet MemoizedBlockList;\n\nconst MAX_HEIGHT = 2000;\nconst EMPTY_ADDITIONAL_STYLES = [];\n\nfunction ScaledBlockPreview( {\n\tviewportWidth,\n\tcontainerWidth,\n\tminHeight,\n\tadditionalStyles = EMPTY_ADDITIONAL_STYLES,\n} ) {\n\tif ( ! viewportWidth ) {\n\t\tviewportWidth = containerWidth;\n\t}\n\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst { styles } = useSelect( ( select ) => {\n\t\tconst settings = select( store ).getSettings();\n\t\treturn {\n\t\t\tstyles: settings.styles,\n\t\t};\n\t}, [] );\n\n\t// Avoid scrollbars for pattern previews.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'body{height:auto;overflow:hidden;border:none;padding:0;}',\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t\t},\n\t\t\t\t...additionalStyles,\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles, additionalStyles ] );\n\n\t// Initialize on render instead of module top level, to avoid circular dependency issues.\n\tMemoizedBlockList = MemoizedBlockList || memo( BlockList );\n\n\tconst scale = containerWidth / viewportWidth;\n\tconst aspectRatio = contentHeight\n\t\t? containerWidth / ( contentHeight * scale )\n\t\t: 0;\n\treturn (\n\t\t<Disabled\n\t\t\tclassName=\"block-editor-block-preview__content\"\n\t\t\tstyle={ {\n\t\t\t\ttransform: `scale(${ scale })`,\n\t\t\t\t// Using width + aspect-ratio instead of height here triggers browsers' native\n\t\t\t\t// handling of scrollbar's visibility. It prevents the flickering issue seen\n\t\t\t\t// in https://github.com/WordPress/gutenberg/issues/52027.\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/52921 for more info.\n\t\t\t\taspectRatio,\n\t\t\t\tmaxHeight:\n\t\t\t\t\tcontentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined,\n\t\t\t\tminHeight,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tcontentRef={ useRefEffect( ( bodyElement ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\townerDocument: { documentElement },\n\t\t\t\t\t} = bodyElement;\n\t\t\t\t\tdocumentElement.classList.add(\n\t\t\t\t\t\t'block-editor-block-preview__content-iframe'\n\t\t\t\t\t);\n\t\t\t\t\tdocumentElement.style.position = 'absolute';\n\t\t\t\t\tdocumentElement.style.width = '100%';\n\n\t\t\t\t\t// Necessary for contentResizeListener to work.\n\t\t\t\t\tbodyElement.style.boxSizing = 'border-box';\n\t\t\t\t\tbodyElement.style.position = 'absolute';\n\t\t\t\t\tbodyElement.style.width = '100%';\n\t\t\t\t}, [] ) }\n\t\t\t\taria-hidden\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\twidth: viewportWidth,\n\t\t\t\t\theight: contentHeight,\n\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t// This is a catch-all max-height for patterns.\n\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/38175.\n\t\t\t\t\tmaxHeight: MAX_HEIGHT,\n\t\t\t\t\tminHeight:\n\t\t\t\t\t\tscale !== 0 && scale < 1 && minHeight\n\t\t\t\t\t\t\t? minHeight / scale\n\t\t\t\t\t\t\t: minHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t{ contentResizeListener }\n\t\t\t\t<MemoizedBlockList renderAppender={ false } />\n\t\t\t</Iframe>\n\t\t</Disabled>\n\t);\n}\n\nexport default function AutoBlockPreview( props ) {\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative', width: '100%', height: 0 } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-block-preview__container\">\n\t\t\t\t{ !! containerWidth && (\n\t\t\t\t\t<ScaledBlockPreview\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tcontainerWidth={ containerWidth }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,iBAAiB,EAAEC,YAAY,QAAQ,oBAAoB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,EAAEC,OAAO,QAAQ,oBAAoB;AAClD,SAASC,QAAQ,QAAQ,uBAAuB;;AAEhD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,KAAK,QAAQ,aAAa;;AAEnC;AACA,IAAIC,iBAAiB;AAErB,MAAMC,UAAU,GAAG,IAAI;AACvB,MAAMC,uBAAuB,GAAG,EAAE;AAElC,SAASC,kBAAkBA,CAAE;EAC5BC,aAAa;EACbC,cAAc;EACdC,SAAS;EACTC,gBAAgB,GAAGL;AACpB,CAAC,EAAG;EACH,IAAK,CAAEE,aAAa,EAAG;IACt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hB,cAAc,IAClBe,aAAA,CAACjB,kBAAkB;IAAA,GACboC,KAAK;IACVlC,cAAc,EAAGA;EAAgB,CACjC,CAEE,CACJ,CAAC;AAEL"}
|
|
@@ -18,7 +18,8 @@ export function BlockRemovalWarningModal({
|
|
|
18
18
|
const {
|
|
19
19
|
clientIds,
|
|
20
20
|
selectPrevious,
|
|
21
|
-
blockNamesForPrompt
|
|
21
|
+
blockNamesForPrompt,
|
|
22
|
+
messageType
|
|
22
23
|
} = useSelect(select => unlock(select(blockEditorStore)).getRemovalPromptData());
|
|
23
24
|
const {
|
|
24
25
|
clearBlockRemovalPrompt,
|
|
@@ -37,6 +38,7 @@ export function BlockRemovalWarningModal({
|
|
|
37
38
|
if (!blockNamesForPrompt) {
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
41
|
+
const message = messageType === 'templates' ? _n('Deleting this block will stop your post or page content from displaying on this template. It is not recommended.', 'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.', blockNamesForPrompt.length) : _n('Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?', 'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?', blockNamesForPrompt.length);
|
|
40
42
|
const onConfirmRemoval = () => {
|
|
41
43
|
privateRemoveBlocks(clientIds, selectPrevious, /* force */true);
|
|
42
44
|
clearBlockRemovalPrompt();
|
|
@@ -45,7 +47,7 @@ export function BlockRemovalWarningModal({
|
|
|
45
47
|
title: __('Be careful!'),
|
|
46
48
|
onRequestClose: clearBlockRemovalPrompt,
|
|
47
49
|
size: "medium"
|
|
48
|
-
}, createElement("p", null,
|
|
50
|
+
}, createElement("p", null, message), createElement(HStack, {
|
|
49
51
|
justify: "right"
|
|
50
52
|
}, createElement(Button, {
|
|
51
53
|
variant: "tertiary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useDispatch","useSelect","Modal","Button","__experimentalHStack","HStack","__","_n","store","blockEditorStore","unlock","BlockRemovalWarningModal","rules","clientIds","selectPrevious","blockNamesForPrompt","select","getRemovalPromptData","clearBlockRemovalPrompt","setBlockRemovalRules","privateRemoveBlocks","onConfirmRemoval","createElement","title","onRequestClose","size","
|
|
1
|
+
{"version":3,"names":["useEffect","useDispatch","useSelect","Modal","Button","__experimentalHStack","HStack","__","_n","store","blockEditorStore","unlock","BlockRemovalWarningModal","rules","clientIds","selectPrevious","blockNamesForPrompt","messageType","select","getRemovalPromptData","clearBlockRemovalPrompt","setBlockRemovalRules","privateRemoveBlocks","message","length","onConfirmRemoval","createElement","title","onRequestClose","size","justify","variant","onClick"],"sources":["@wordpress/block-editor/src/components/block-removal-warning-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tModal,\n\tButton,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function BlockRemovalWarningModal( { rules } ) {\n\tconst { clientIds, selectPrevious, blockNamesForPrompt, messageType } =\n\t\tuseSelect( ( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getRemovalPromptData()\n\t\t);\n\n\tconst {\n\t\tclearBlockRemovalPrompt,\n\t\tsetBlockRemovalRules,\n\t\tprivateRemoveBlocks,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\t// Load block removal rules, simultaneously signalling that the block\n\t// removal prompt is in place.\n\tuseEffect( () => {\n\t\tsetBlockRemovalRules( rules );\n\t\treturn () => {\n\t\t\tsetBlockRemovalRules();\n\t\t};\n\t}, [ rules, setBlockRemovalRules ] );\n\n\tif ( ! blockNamesForPrompt ) {\n\t\treturn;\n\t}\n\n\tconst message =\n\t\tmessageType === 'templates'\n\t\t\t? _n(\n\t\t\t\t\t'Deleting this block will stop your post or page content from displaying on this template. It is not recommended.',\n\t\t\t\t\t'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.',\n\t\t\t\t\tblockNamesForPrompt.length\n\t\t\t )\n\t\t\t: _n(\n\t\t\t\t\t'Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?',\n\t\t\t\t\t'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?',\n\t\t\t\t\tblockNamesForPrompt.length\n\t\t\t );\n\n\tconst onConfirmRemoval = () => {\n\t\tprivateRemoveBlocks( clientIds, selectPrevious, /* force */ true );\n\t\tclearBlockRemovalPrompt();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Be careful!' ) }\n\t\t\tonRequestClose={ clearBlockRemovalPrompt }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<p>{ message }</p>\n\t\t\t<HStack justify=\"right\">\n\t\t\t\t<Button variant=\"tertiary\" onClick={ clearBlockRemovalPrompt }>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Button>\n\t\t\t\t<Button variant=\"primary\" onClick={ onConfirmRemoval }>\n\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,EACLC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;;AAExC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,wBAAwBA,CAAE;EAAEC;AAAM,CAAC,EAAG;EACrD,MAAM;IAAEC,SAAS;IAAEC,cAAc;IAAEC,mBAAmB;IAAEC;EAAY,CAAC,GACpEf,SAAS,CAAIgB,MAA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,CACD,CACF,CAAC;AAEV"}
|
|
@@ -12,7 +12,6 @@ import { copy } from '@wordpress/icons';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import { store as blockEditorStore } from '../../store';
|
|
15
|
-
import useBlockDisplayInformation from '../use-block-display-information';
|
|
16
15
|
import BlockIcon from '../block-icon';
|
|
17
16
|
import BlockTransformationsMenu from './block-transformations-menu';
|
|
18
17
|
import { useBlockVariationTransforms } from './block-variation-transformations';
|
|
@@ -123,7 +122,6 @@ function BlockSwitcherDropdownMenuContents({
|
|
|
123
122
|
export const BlockSwitcher = ({
|
|
124
123
|
clientIds
|
|
125
124
|
}) => {
|
|
126
|
-
const blockInformation = useBlockDisplayInformation(clientIds?.[0]);
|
|
127
125
|
const {
|
|
128
126
|
canRemove,
|
|
129
127
|
hasBlockStyles,
|
|
@@ -135,11 +133,13 @@ export const BlockSwitcher = ({
|
|
|
135
133
|
const {
|
|
136
134
|
getBlockRootClientId,
|
|
137
135
|
getBlocksByClientId,
|
|
136
|
+
getBlockAttributes,
|
|
138
137
|
canRemoveBlocks
|
|
139
138
|
} = select(blockEditorStore);
|
|
140
139
|
const {
|
|
141
140
|
getBlockStyles,
|
|
142
|
-
getBlockType
|
|
141
|
+
getBlockType,
|
|
142
|
+
getActiveBlockVariation
|
|
143
143
|
} = select(blocksStore);
|
|
144
144
|
const _blocks = getBlocksByClientId(clientIds);
|
|
145
145
|
if (!_blocks.length || _blocks.some(block => !block)) {
|
|
@@ -152,16 +152,19 @@ export const BlockSwitcher = ({
|
|
|
152
152
|
name: firstBlockName
|
|
153
153
|
}] = _blocks;
|
|
154
154
|
const _isSingleBlockSelected = _blocks.length === 1;
|
|
155
|
+
const blockType = getBlockType(firstBlockName);
|
|
155
156
|
let _icon;
|
|
156
157
|
if (_isSingleBlockSelected) {
|
|
157
|
-
|
|
158
|
+
const match = getActiveBlockVariation(firstBlockName, getBlockAttributes(clientIds[0]));
|
|
159
|
+
// Take into account active block variations.
|
|
160
|
+
_icon = match?.icon || blockType.icon;
|
|
158
161
|
} else {
|
|
159
162
|
const isSelectionOfSameType = new Set(_blocks.map(({
|
|
160
163
|
name
|
|
161
164
|
}) => name)).size === 1;
|
|
162
165
|
// When selection consists of blocks of multiple types, display an
|
|
163
166
|
// appropriate icon to communicate the non-uniformity.
|
|
164
|
-
_icon = isSelectionOfSameType ?
|
|
167
|
+
_icon = isSelectionOfSameType ? blockType.icon : copy;
|
|
165
168
|
}
|
|
166
169
|
return {
|
|
167
170
|
canRemove: canRemoveBlocks(clientIds, rootClientId),
|
|
@@ -170,7 +173,7 @@ export const BlockSwitcher = ({
|
|
|
170
173
|
isReusable: _isSingleBlockSelected && isReusableBlock(_blocks[0]),
|
|
171
174
|
isTemplate: _isSingleBlockSelected && isTemplatePart(_blocks[0])
|
|
172
175
|
};
|
|
173
|
-
}, [clientIds
|
|
176
|
+
}, [clientIds]);
|
|
174
177
|
const blockTitle = useBlockDisplayTitle({
|
|
175
178
|
clientId: clientIds?.[0],
|
|
176
179
|
maximumLength: 35
|
|
@@ -178,12 +181,14 @@ export const BlockSwitcher = ({
|
|
|
178
181
|
if (invalidBlocks) {
|
|
179
182
|
return null;
|
|
180
183
|
}
|
|
184
|
+
const isSingleBlock = clientIds.length === 1;
|
|
185
|
+
const blockSwitcherLabel = isSingleBlock ? blockTitle : __('Multiple blocks selected');
|
|
181
186
|
const hideDropdown = !hasBlockStyles && !canRemove;
|
|
182
187
|
if (hideDropdown) {
|
|
183
188
|
return createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
184
189
|
disabled: true,
|
|
185
190
|
className: "block-editor-block-switcher__no-switcher-icon",
|
|
186
|
-
title:
|
|
191
|
+
title: blockSwitcherLabel,
|
|
187
192
|
icon: createElement(Fragment, null, createElement(BlockIcon, {
|
|
188
193
|
icon: icon,
|
|
189
194
|
showColors: true
|
|
@@ -192,8 +197,6 @@ export const BlockSwitcher = ({
|
|
|
192
197
|
}, blockTitle))
|
|
193
198
|
}));
|
|
194
199
|
}
|
|
195
|
-
const isSingleBlock = clientIds.length === 1;
|
|
196
|
-
const blockSwitcherLabel = isSingleBlock ? blockTitle : __('Multiple blocks selected');
|
|
197
200
|
const blockSwitcherDescription = isSingleBlock ? __('Change block type or style') : sprintf( /* translators: %d: number of blocks. */
|
|
198
201
|
_n('Change type of %d block', 'Change type of %d blocks', clientIds.length), clientIds.length);
|
|
199
202
|
return createElement(ToolbarGroup, null, createElement(ToolbarItem, null, toggleProps => createElement(DropdownMenu, {
|