@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
|
@@ -3,9 +3,10 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useRef, useState } from '@wordpress/element';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { useRef, useEffect, useState } from '@wordpress/element';
|
|
7
|
+
import { focus } from '@wordpress/dom';
|
|
8
|
+
import { ToolbarButton, NavigableMenu, Button, MenuItem, ToggleControl, TextControl, __experimentalVStack as VStack } from '@wordpress/components';
|
|
9
|
+
import { Icon, link as linkIcon, image, page, fullscreen, linkOff } from '@wordpress/icons';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
@@ -40,6 +41,14 @@ const ImageURLInputUI = ({
|
|
|
40
41
|
const [isEditingLink, setIsEditingLink] = useState(false);
|
|
41
42
|
const [urlInput, setUrlInput] = useState(null);
|
|
42
43
|
const autocompleteRef = useRef(null);
|
|
44
|
+
const wrapperRef = useRef();
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!wrapperRef.current) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const nextFocusTarget = focus.focusable.find(wrapperRef.current)[0] || wrapperRef.current;
|
|
50
|
+
nextFocusTarget.focus();
|
|
51
|
+
}, [isEditingLink, url, lightboxEnabled]);
|
|
43
52
|
const startEditLink = () => {
|
|
44
53
|
if (linkDestination === LINK_DESTINATION_MEDIA || linkDestination === LINK_DESTINATION_ATTACHMENT) {
|
|
45
54
|
setUrlInput('');
|
|
@@ -186,17 +195,18 @@ const ImageURLInputUI = ({
|
|
|
186
195
|
return createElement(Fragment, null, createElement(ToolbarButton, {
|
|
187
196
|
icon: linkIcon,
|
|
188
197
|
className: "components-toolbar__control",
|
|
189
|
-
label:
|
|
198
|
+
label: __('Link'),
|
|
190
199
|
"aria-expanded": isOpen,
|
|
191
200
|
onClick: openLinkUI,
|
|
192
201
|
ref: setPopoverAnchor,
|
|
193
|
-
isActive: !!url
|
|
202
|
+
isActive: !!url || lightboxEnabled
|
|
194
203
|
}), isOpen && createElement(URLPopover, {
|
|
204
|
+
ref: wrapperRef,
|
|
195
205
|
anchor: popoverAnchor,
|
|
196
206
|
onFocusOutside: onFocusOutside(),
|
|
197
207
|
onClose: closeLinkUI,
|
|
198
208
|
renderSettings: !lightboxEnabled ? () => advancedOptions : null,
|
|
199
|
-
additionalControls: showLinkEditor && createElement(
|
|
209
|
+
additionalControls: showLinkEditor && createElement(NavigableMenu, null, getLinkDestinations().map(link => createElement(MenuItem, {
|
|
200
210
|
key: link.linkDestination,
|
|
201
211
|
icon: link.icon,
|
|
202
212
|
iconPosition: "left",
|
|
@@ -220,7 +230,8 @@ const ImageURLInputUI = ({
|
|
|
220
230
|
onSetLightbox(true);
|
|
221
231
|
stopEditLink();
|
|
222
232
|
}
|
|
223
|
-
}, __('Expand on click')))
|
|
233
|
+
}, __('Expand on click'))),
|
|
234
|
+
offset: 13
|
|
224
235
|
}, (!url || isEditingLink) && !lightboxEnabled && createElement(Fragment, null, createElement(URLPopover.LinkEditor, {
|
|
225
236
|
className: "block-editor-format-toolbar__link-container-content",
|
|
226
237
|
value: linkEditorValue,
|
|
@@ -239,15 +250,14 @@ const ImageURLInputUI = ({
|
|
|
239
250
|
size: "compact"
|
|
240
251
|
})), !url && !isEditingLink && lightboxEnabled && createElement("div", {
|
|
241
252
|
className: "block-editor-url-popover__expand-on-click"
|
|
242
|
-
}, createElement(
|
|
243
|
-
|
|
244
|
-
}
|
|
253
|
+
}, createElement(Icon, {
|
|
254
|
+
icon: fullscreen
|
|
255
|
+
}), createElement("div", {
|
|
245
256
|
className: "text"
|
|
246
257
|
}, createElement("p", null, __('Expand on click')), createElement("p", {
|
|
247
258
|
className: "description"
|
|
248
259
|
}, __('Scales the image with a lightbox effect'))), createElement(Button, {
|
|
249
260
|
icon: linkOff,
|
|
250
|
-
className: "remove-link",
|
|
251
261
|
label: __('Disable expand on click'),
|
|
252
262
|
onClick: () => {
|
|
253
263
|
onSetLightbox(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useRef","useState","ToolbarButton","Button","MenuItem","ToggleControl","TextControl","MenuGroup","__experimentalVStack","VStack","link","linkIcon","image","page","fullscreen","linkOff","URLPopover","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","current","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","find","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","icon","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","createElement","spacing","__nextHasNoMarginBottom","label","onChange","checked","linkEditorValue","showLinkEditor","urlLabel","Fragment","className","onClick","ref","isActive","anchor","onClose","renderSettings","additionalControls","map","key","iconPosition","info","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","size","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tToolbarButton,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\tMenuGroup,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ url ? __( 'Edit link' ) : __( 'Add link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\t! lightboxEnabled ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! url && ! isEditingLink && lightboxEnabled && (\n\t\t\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t\t\t<div className=\"fullscreen-icon\">\n\t\t\t\t\t\t\t\t{ fullscreen }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Scales the image with a lightbox effect'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tclassName=\"remove-link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t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BP,KAAK,EAAG5F,EAAE,CAAE,yBAA0B,CAAG;IACzCoG,OAAO,EAAGA,CAAA,KAAM;MACfjE,aAAa,CAAE,KAAM,CAAC;IACvB,CAAG;IACHiF,IAAI,EAAC;EAAS,CACd,CACG,CAEK,CAEZ,CAAC;AAEL,CAAC;AAED,SAAS7F,eAAe,IAAI8F,6BAA6B"}
|
|
1
|
+
{"version":3,"names":["__","useRef","useEffect","useState","focus","ToolbarButton","NavigableMenu","Button","MenuItem","ToggleControl","TextControl","__experimentalVStack","VStack","Icon","link","linkIcon","image","page","fullscreen","linkOff","URLPopover","LINK_DESTINATION_NONE","LINK_DESTINATION_CUSTOM","LINK_DESTINATION_MEDIA","LINK_DESTINATION_ATTACHMENT","NEW_TAB_REL","ImageURLInputUI","linkDestination","onChangeUrl","url","mediaType","mediaUrl","mediaLink","linkTarget","linkClass","rel","showLightboxSetting","lightboxEnabled","onSetLightbox","isOpen","setIsOpen","popoverAnchor","setPopoverAnchor","openLinkUI","isEditingLink","setIsEditingLink","urlInput","setUrlInput","autocompleteRef","wrapperRef","current","nextFocusTarget","focusable","find","startEditLink","stopEditLink","closeLinkUI","getUpdatedLinkTargetSettings","value","newLinkTarget","undefined","updatedRel","rels","split","forEach","relVal","includes","push","join","filter","length","onFocusOutside","event","autocompleteElement","contains","target","onSubmitLinkChange","selectedDestination","getLinkDestinations","destination","href","lightbox","enabled","preventDefault","onLinkRemove","linkDestinations","title","icon","onSetHref","linkDestinationInput","onSetNewTab","updatedLinkTarget","onSetLinkRel","onSetLinkClass","advancedOptions","createElement","spacing","__nextHasNoMarginBottom","label","onChange","checked","linkEditorValue","showLinkEditor","urlLabel","Fragment","className","onClick","ref","isActive","anchor","onClose","renderSettings","additionalControls","map","key","iconPosition","info","offset","LinkEditor","onChangeInputValue","onSubmit","LinkViewer","onEditLinkClick","size","__experimentalImageURLInputUI"],"sources":["@wordpress/block-editor/src/components/url-popover/image-url-input-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect, useState } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToolbarButton,\n\tNavigableMenu,\n\tButton,\n\tMenuItem,\n\tToggleControl,\n\tTextControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tIcon,\n\tlink as linkIcon,\n\timage,\n\tpage,\n\tfullscreen,\n\tlinkOff,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport URLPopover from './index';\n\nconst LINK_DESTINATION_NONE = 'none';\nconst LINK_DESTINATION_CUSTOM = 'custom';\nconst LINK_DESTINATION_MEDIA = 'media';\nconst LINK_DESTINATION_ATTACHMENT = 'attachment';\nconst NEW_TAB_REL = [ 'noreferrer', 'noopener' ];\n\nconst ImageURLInputUI = ( {\n\tlinkDestination,\n\tonChangeUrl,\n\turl,\n\tmediaType = 'image',\n\tmediaUrl,\n\tmediaLink,\n\tlinkTarget,\n\tlinkClass,\n\trel,\n\tshowLightboxSetting,\n\tlightboxEnabled,\n\tonSetLightbox,\n} ) => {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst openLinkUI = () => {\n\t\tsetIsOpen( true );\n\t};\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState( false );\n\tconst [ urlInput, setUrlInput ] = useState( null );\n\n\tconst autocompleteRef = useRef( null );\n\tconst wrapperRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( ! wrapperRef.current ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperRef.current )[ 0 ] ||\n\t\t\twrapperRef.current;\n\t\tnextFocusTarget.focus();\n\t}, [ isEditingLink, url, lightboxEnabled ] );\n\n\tconst startEditLink = () => {\n\t\tif (\n\t\t\tlinkDestination === LINK_DESTINATION_MEDIA ||\n\t\t\tlinkDestination === LINK_DESTINATION_ATTACHMENT\n\t\t) {\n\t\t\tsetUrlInput( '' );\n\t\t}\n\t\tsetIsEditingLink( true );\n\t};\n\n\tconst stopEditLink = () => {\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst closeLinkUI = () => {\n\t\tsetUrlInput( null );\n\t\tstopEditLink();\n\t\tsetIsOpen( false );\n\t};\n\n\tconst getUpdatedLinkTargetSettings = ( value ) => {\n\t\tconst newLinkTarget = value ? '_blank' : undefined;\n\n\t\tlet updatedRel;\n\t\tif ( newLinkTarget ) {\n\t\t\tconst rels = ( rel ?? '' ).split( ' ' );\n\t\t\tNEW_TAB_REL.forEach( ( relVal ) => {\n\t\t\t\tif ( ! rels.includes( relVal ) ) {\n\t\t\t\t\trels.push( relVal );\n\t\t\t\t}\n\t\t\t} );\n\t\t\tupdatedRel = rels.join( ' ' );\n\t\t} else {\n\t\t\tconst rels = ( rel ?? '' )\n\t\t\t\t.split( ' ' )\n\t\t\t\t.filter(\n\t\t\t\t\t( relVal ) => NEW_TAB_REL.includes( relVal ) === false\n\t\t\t\t);\n\t\t\tupdatedRel = rels.length ? rels.join( ' ' ) : undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tlinkTarget: newLinkTarget,\n\t\t\trel: updatedRel,\n\t\t};\n\t};\n\n\tconst onFocusOutside = () => {\n\t\treturn ( event ) => {\n\t\t\t// The autocomplete suggestions list renders in a separate popover (in a portal),\n\t\t\t// so onFocusOutside fails to detect that a click on a suggestion occurred in the\n\t\t\t// LinkContainer. Detect clicks on autocomplete suggestions using a ref here, and\n\t\t\t// return to avoid the popover being closed.\n\t\t\tconst autocompleteElement = autocompleteRef.current;\n\t\t\tif (\n\t\t\t\tautocompleteElement &&\n\t\t\t\tautocompleteElement.contains( event.target )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsOpen( false );\n\t\t\tsetUrlInput( null );\n\t\t\tstopEditLink();\n\t\t};\n\t};\n\n\tconst onSubmitLinkChange = () => {\n\t\treturn ( event ) => {\n\t\t\tif ( urlInput ) {\n\t\t\t\t// It is possible the entered URL actually matches a named link destination.\n\t\t\t\t// This check will ensure our link destination is correct.\n\t\t\t\tconst selectedDestination =\n\t\t\t\t\tgetLinkDestinations().find(\n\t\t\t\t\t\t( destination ) => destination.url === urlInput\n\t\t\t\t\t)?.linkDestination || LINK_DESTINATION_CUSTOM;\n\n\t\t\t\tonChangeUrl( {\n\t\t\t\t\thref: urlInput,\n\t\t\t\t\tlinkDestination: selectedDestination,\n\t\t\t\t\tlightbox: { enabled: false },\n\t\t\t\t} );\n\t\t\t}\n\t\t\tstopEditLink();\n\t\t\tsetUrlInput( null );\n\t\t\tevent.preventDefault();\n\t\t};\n\t};\n\n\tconst onLinkRemove = () => {\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: LINK_DESTINATION_NONE,\n\t\t\thref: '',\n\t\t} );\n\t};\n\n\tconst getLinkDestinations = () => {\n\t\tconst linkDestinations = [\n\t\t\t{\n\t\t\t\tlinkDestination: LINK_DESTINATION_MEDIA,\n\t\t\t\ttitle: __( 'Link to image file' ),\n\t\t\t\turl: mediaType === 'image' ? mediaUrl : undefined,\n\t\t\t\ticon: image,\n\t\t\t},\n\t\t];\n\t\tif ( mediaType === 'image' && mediaLink ) {\n\t\t\tlinkDestinations.push( {\n\t\t\t\tlinkDestination: LINK_DESTINATION_ATTACHMENT,\n\t\t\t\ttitle: __( 'Link to attachment page' ),\n\t\t\t\turl: mediaType === 'image' ? mediaLink : undefined,\n\t\t\t\ticon: page,\n\t\t\t} );\n\t\t}\n\t\treturn linkDestinations;\n\t};\n\n\tconst onSetHref = ( value ) => {\n\t\tconst linkDestinations = getLinkDestinations();\n\t\tlet linkDestinationInput;\n\t\tif ( ! value ) {\n\t\t\tlinkDestinationInput = LINK_DESTINATION_NONE;\n\t\t} else {\n\t\t\tlinkDestinationInput = (\n\t\t\t\tlinkDestinations.find( ( destination ) => {\n\t\t\t\t\treturn destination.url === value;\n\t\t\t\t} ) || { linkDestination: LINK_DESTINATION_CUSTOM }\n\t\t\t).linkDestination;\n\t\t}\n\t\tonChangeUrl( {\n\t\t\tlinkDestination: linkDestinationInput,\n\t\t\thref: value,\n\t\t} );\n\t};\n\n\tconst onSetNewTab = ( value ) => {\n\t\tconst updatedLinkTarget = getUpdatedLinkTargetSettings( value );\n\t\tonChangeUrl( updatedLinkTarget );\n\t};\n\n\tconst onSetLinkRel = ( value ) => {\n\t\tonChangeUrl( { rel: value } );\n\t};\n\n\tconst onSetLinkClass = ( value ) => {\n\t\tonChangeUrl( { linkClass: value } );\n\t};\n\n\tconst advancedOptions = (\n\t\t<VStack spacing=\"3\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\tonChange={ onSetNewTab }\n\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\tvalue={ rel ?? '' }\n\t\t\t\tonChange={ onSetLinkRel }\n\t\t\t/>\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Link CSS class' ) }\n\t\t\t\tvalue={ linkClass || '' }\n\t\t\t\tonChange={ onSetLinkClass }\n\t\t\t/>\n\t\t</VStack>\n\t);\n\n\tconst linkEditorValue = urlInput !== null ? urlInput : url;\n\tconst showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true;\n\n\tconst urlLabel = (\n\t\tgetLinkDestinations().find(\n\t\t\t( destination ) => destination.linkDestination === linkDestination\n\t\t) || {}\n\t).title;\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ linkIcon }\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tonClick={ openLinkUI }\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tisActive={ !! url || lightboxEnabled }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<URLPopover\n\t\t\t\t\tref={ wrapperRef }\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tonFocusOutside={ onFocusOutside() }\n\t\t\t\t\tonClose={ closeLinkUI }\n\t\t\t\t\trenderSettings={\n\t\t\t\t\t\t! lightboxEnabled ? () => advancedOptions : null\n\t\t\t\t\t}\n\t\t\t\t\tadditionalControls={\n\t\t\t\t\t\tshowLinkEditor && (\n\t\t\t\t\t\t\t<NavigableMenu>\n\t\t\t\t\t\t\t\t{ getLinkDestinations().map( ( link ) => (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey={ link.linkDestination }\n\t\t\t\t\t\t\t\t\t\ticon={ link.icon }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonSetHref( link.url );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ link.title }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t{ showLightboxSetting && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tkey=\"expand-on-click\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__expand-on-click\"\n\t\t\t\t\t\t\t\t\t\ticon={ fullscreen }\n\t\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Scale the image with a lightbox effect.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetUrlInput( null );\n\t\t\t\t\t\t\t\t\t\t\tonChangeUrl( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkDestination:\n\t\t\t\t\t\t\t\t\t\t\t\t\tLINK_DESTINATION_NONE,\n\t\t\t\t\t\t\t\t\t\t\t\thref: '',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\tonSetLightbox( true );\n\t\t\t\t\t\t\t\t\t\t\tstopEditLink();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Expand on click' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\toffset={ 13 }\n\t\t\t\t>\n\t\t\t\t\t{ ( ! url || isEditingLink ) && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkEditor\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\tvalue={ linkEditorValue }\n\t\t\t\t\t\t\t\tonChangeInputValue={ setUrlInput }\n\t\t\t\t\t\t\t\tonSubmit={ onSubmitLinkChange() }\n\t\t\t\t\t\t\t\tautocompleteRef={ autocompleteRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ url && ! isEditingLink && ! lightboxEnabled && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<URLPopover.LinkViewer\n\t\t\t\t\t\t\t\tclassName=\"block-editor-format-toolbar__link-container-content\"\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tonEditLinkClick={ startEditLink }\n\t\t\t\t\t\t\t\turlLabel={ urlLabel }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Remove link' ) }\n\t\t\t\t\t\t\t\tonClick={ onLinkRemove }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! url && ! isEditingLink && lightboxEnabled && (\n\t\t\t\t\t\t<div className=\"block-editor-url-popover__expand-on-click\">\n\t\t\t\t\t\t\t<Icon icon={ fullscreen } />\n\t\t\t\t\t\t\t<div className=\"text\">\n\t\t\t\t\t\t\t\t<p>{ __( 'Expand on click' ) }</p>\n\t\t\t\t\t\t\t\t<p className=\"description\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Scales the image with a lightbox effect'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\t\t\tlabel={ __( 'Disable expand on click' ) }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonSetLightbox( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</URLPopover>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport { ImageURLInputUI as __experimentalImageURLInputUI };\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SACCC,aAAa,EACbC,a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EAClC+F,aAAA;IAAGU,SAAS,EAAC;EAAa,GACvBzG,EAAE,CACH,yCACD,CACE,CACC,CAAC,EACN+F,aAAA,CAACxF,MAAM;IACNgF,IAAI,EAAGpE,OAAS;IAChB+E,KAAK,EAAGlG,EAAE,CAAE,yBAA0B,CAAG;IACzC0G,OAAO,EAAGA,CAAA,KAAM;MACfpE,aAAa,CAAE,KAAM,CAAC;IACvB,CAAG;IACHqF,IAAI,EAAC;EAAS,CACd,CACG,CAEK,CAEZ,CAAC;AAEL,CAAC;AAED,SAASjG,eAAe,IAAIkG,6BAA6B"}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useState } from '@wordpress/element';
|
|
6
|
+
import { forwardRef, useState } from '@wordpress/element';
|
|
7
7
|
import { Button, Popover, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
8
8
|
import { chevronDown } from '@wordpress/icons';
|
|
9
9
|
import deprecated from '@wordpress/deprecated';
|
|
@@ -18,7 +18,7 @@ const {
|
|
|
18
18
|
__experimentalPopoverLegacyPositionToPlacement
|
|
19
19
|
} = unlock(componentsPrivateApis);
|
|
20
20
|
const DEFAULT_PLACEMENT = 'bottom';
|
|
21
|
-
|
|
21
|
+
const URLPopover = forwardRef(({
|
|
22
22
|
additionalControls,
|
|
23
23
|
children,
|
|
24
24
|
renderSettings,
|
|
@@ -29,7 +29,7 @@ function URLPopover({
|
|
|
29
29
|
position,
|
|
30
30
|
// Rest
|
|
31
31
|
...popoverProps
|
|
32
|
-
}) {
|
|
32
|
+
}, ref) => {
|
|
33
33
|
if (position !== undefined) {
|
|
34
34
|
deprecated('`position` prop in wp.blockEditor.URLPopover', {
|
|
35
35
|
since: '6.2',
|
|
@@ -54,6 +54,7 @@ function URLPopover({
|
|
|
54
54
|
setIsSettingsExpanded(!isSettingsExpanded);
|
|
55
55
|
};
|
|
56
56
|
return createElement(Popover, {
|
|
57
|
+
ref: ref,
|
|
57
58
|
className: "block-editor-url-popover",
|
|
58
59
|
focusOnMount: focusOnMount,
|
|
59
60
|
placement: computedPlacement,
|
|
@@ -76,7 +77,7 @@ function URLPopover({
|
|
|
76
77
|
}, renderSettings())), additionalControls && !showSettings && createElement("div", {
|
|
77
78
|
className: "block-editor-url-popover__additional-controls"
|
|
78
79
|
}, additionalControls));
|
|
79
|
-
}
|
|
80
|
+
});
|
|
80
81
|
URLPopover.LinkEditor = LinkEditor;
|
|
81
82
|
URLPopover.LinkViewer = LinkViewer;
|
|
82
83
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useState","Button","Popover","privateApis","componentsPrivateApis","chevronDown","deprecated","LinkViewer","LinkEditor","unlock","__experimentalPopoverLegacyPositionToPlacement","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","undefined","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","showSettings","toggleSettingsVisibility","createElement","className","shift","variant","icon","label","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\
|
|
1
|
+
{"version":3,"names":["__","forwardRef","useState","Button","Popover","privateApis","componentsPrivateApis","chevronDown","deprecated","LinkViewer","LinkEditor","unlock","__experimentalPopoverLegacyPositionToPlacement","DEFAULT_PLACEMENT","URLPopover","additionalControls","children","renderSettings","placement","focusOnMount","position","popoverProps","ref","undefined","since","alternative","computedPlacement","isSettingsExpanded","setIsSettingsExpanded","showSettings","toggleSettingsVisibility","createElement","className","shift","variant","icon","label","onClick","size"],"sources":["@wordpress/block-editor/src/components/url-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPopover,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport LinkViewer from './link-viewer';\nimport LinkEditor from './link-editor';\nimport { unlock } from '../../lock-unlock';\n\nconst { __experimentalPopoverLegacyPositionToPlacement } = unlock(\n\tcomponentsPrivateApis\n);\n\nconst DEFAULT_PLACEMENT = 'bottom';\n\nconst URLPopover = forwardRef(\n\t(\n\t\t{\n\t\t\tadditionalControls,\n\t\t\tchildren,\n\t\t\trenderSettings,\n\t\t\t// The DEFAULT_PLACEMENT value is assigned inside the function's body\n\t\t\tplacement,\n\t\t\tfocusOnMount = 'firstElement',\n\t\t\t// Deprecated\n\t\t\tposition,\n\t\t\t// Rest\n\t\t\t...popoverProps\n\t\t},\n\t\tref\n\t) => {\n\t\tif ( position !== undefined ) {\n\t\t\tdeprecated( '`position` prop in wp.blockEditor.URLPopover', {\n\t\t\t\tsince: '6.2',\n\t\t\t\talternative: '`placement` prop',\n\t\t\t} );\n\t\t}\n\n\t\t// Compute popover's placement:\n\t\t// - give priority to `placement` prop, if defined\n\t\t// - otherwise, compute it from the legacy `position` prop (if defined)\n\t\t// - finally, fallback to the DEFAULT_PLACEMENT.\n\t\tlet computedPlacement;\n\t\tif ( placement !== undefined ) {\n\t\t\tcomputedPlacement = placement;\n\t\t} else if ( position !== undefined ) {\n\t\t\tcomputedPlacement =\n\t\t\t\t__experimentalPopoverLegacyPositionToPlacement( position );\n\t\t}\n\t\tcomputedPlacement = computedPlacement || DEFAULT_PLACEMENT;\n\n\t\tconst [ isSettingsExpanded, setIsSettingsExpanded ] = useState( false );\n\n\t\tconst showSettings = !! renderSettings && isSettingsExpanded;\n\n\t\tconst toggleSettingsVisibility = () => {\n\t\t\tsetIsSettingsExpanded( ! isSettingsExpanded );\n\t\t};\n\n\t\treturn (\n\t\t\t<Popover\n\t\t\t\tref={ ref }\n\t\t\t\tclassName=\"block-editor-url-popover\"\n\t\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t\tplacement={ computedPlacement }\n\t\t\t\tshift\n\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<div className=\"block-editor-url-popover__input-container\">\n\t\t\t\t\t<div className=\"block-editor-url-popover__row\">\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t{ !! renderSettings && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"block-editor-url-popover__settings-toggle\"\n\t\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\t\tlabel={ __( 'Link settings' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleSettingsVisibility }\n\t\t\t\t\t\t\t\taria-expanded={ isSettingsExpanded }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ showSettings && (\n\t\t\t\t\t\t<div className=\"block-editor-url-popover__row block-editor-url-popover__settings\">\n\t\t\t\t\t\t\t{ renderSettings() }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ additionalControls && ! showSettings && (\n\t\t\t\t\t<div className=\"block-editor-url-popover__additional-controls\">\n\t\t\t\t\t\t{ additionalControls }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nURLPopover.LinkEditor = LinkEditor;\n\nURLPopover.LinkViewer = LinkViewer;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/url-popover/README.md\n */\nexport default URLPopover;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SACCC,MAAM,EACNC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,UAAU,MAAM,eAAe;AACtC,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAA+C,CAAC,GAAGD,MAAM,CAChEL,qBACD,CAAC;AAED,MAAMO,iBAAiB,GAAG,QAAQ;AAElC,MAAMC,UAAU,GAAGb,UAAU,CAC5B,CACC;EACCc,kBAAkB;EAClBC,QAAQ;EACRC,cAAc;EACd;EACAC,SAAS;EACTC,YAAY,GAAG,cAAc;EAC7B;EACAC,QAAQ;EACR;EACA,GAAGC;AACJ,CAAC,EACDC,GAAG,KACC;EACJ,IAAKF,QAAQ,KAAKG,SAAS,EAAG;IAC7Bf,UAAU,CAAE,8CAA8C,EAAE;MAC3DgB,KAAK,EAAE,KAAK;MACZC,WAAW,EAAE;IACd,CAAE,CAAC;EACJ;;EAEA;EACA;EACA;EACA;EACA,IAAIC,iBAAiB;EACrB,IAAKR,SAAS,KAAKK,SAAS,EAAG;IAC9BG,iBAAiB,GAAGR,SAAS;EAC9B,CAAC,MAAM,IAAKE,QAAQ,KAAKG,SAAS,EAAG;IACpCG,iBAAiB,GAChBd,8CAA8C,CAAEQ,QAAS,CAAC;EAC5D;EACAM,iBAAiB,GAAGA,iBAAiB,IAAIb,iBAAiB;EAE1D,MAAM,CAAEc,kBAAkB,EAAEC,qBAAqB,CAAE,GAAG1B,QAAQ,CAAE,KAAM,CAAC;EAEvE,MAAM2B,YAAY,GAAG,CAAC,CAAEZ,cAAc,IAAIU,kBAAkB;EAE5D,MAAMG,wBAAwB,GAAGA,CAAA,KAAM;IACtCF,qBAAqB,CAAE,CAAED,kBAAmB,CAAC;EAC9C,CAAC;EAED,OACCI,aAAA,CAAC3B,OAAO;IACPkB,GAAG,EAAGA,GAAK;IACXU,SAAS,EAAC,0BAA0B;IACpCb,YAAY,EAAGA,YAAc;IAC7BD,SAAS,EAAGQ,iBAAmB;IAC/BO,KAAK;IACLC,OAAO,EAAC,SAAS;IAAA,GACZb;EAAY,GAEjBU,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACzDD,aAAA;IAAKC,SAAS,EAAC;EAA+B,GAC3ChB,QAAQ,EACR,CAAC,CAAEC,cAAc,IAClBc,aAAA,CAAC5B,MAAM;IACN6B,SAAS,EAAC,2CAA2C;IACrDG,IAAI,EAAG5B,WAAa;IACpB6B,KAAK,EAAGpC,EAAE,CAAE,eAAgB,CAAG;IAC/BqC,OAAO,EAAGP,wBAA0B;IACpC,iBAAgBH,kBAAoB;IACpCW,IAAI,EAAC;EAAS,CACd,CAEE,CAAC,EACJT,YAAY,IACbE,aAAA;IAAKC,SAAS,EAAC;EAAkE,GAC9Ef,cAAc,CAAC,CACb,CAEF,CAAC,EACJF,kBAAkB,IAAI,CAAEc,YAAY,IACrCE,aAAA;IAAKC,SAAS,EAAC;EAA+C,GAC3DjB,kBACE,CAEE,CAAC;AAEZ,CACD,CAAC;AAEDD,UAAU,CAACJ,UAAU,GAAGA,UAAU;AAElCI,UAAU,CAACL,UAAU,GAAGA,UAAU;;AAElC;AACA;AACA;AACA,eAAeK,UAAU"}
|
|
@@ -13,6 +13,7 @@ import { isUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock, store as block
|
|
|
13
13
|
import useOnBlockDrop from '../use-on-block-drop';
|
|
14
14
|
import { getDistanceToNearestEdge, isPointContainedByRect, isPointWithinTopAndBottomBoundariesOfRect } from '../../utils/math';
|
|
15
15
|
import { store as blockEditorStore } from '../../store';
|
|
16
|
+
import { unlock } from '../../lock-unlock';
|
|
16
17
|
const THRESHOLD_DISTANCE = 30;
|
|
17
18
|
const MINIMUM_HEIGHT_FOR_THRESHOLD = 120;
|
|
18
19
|
const MINIMUM_WIDTH_FOR_THRESHOLD = 120;
|
|
@@ -217,17 +218,25 @@ export default function useBlockDropZone({
|
|
|
217
218
|
getBlockIndex,
|
|
218
219
|
getDraggedBlockClientIds,
|
|
219
220
|
getBlockNamesByClientId,
|
|
220
|
-
getAllowedBlocks
|
|
221
|
-
|
|
221
|
+
getAllowedBlocks,
|
|
222
|
+
isDragging
|
|
223
|
+
} = unlock(useSelect(blockEditorStore));
|
|
222
224
|
const {
|
|
223
225
|
showInsertionPoint,
|
|
224
|
-
hideInsertionPoint
|
|
225
|
-
|
|
226
|
+
hideInsertionPoint,
|
|
227
|
+
startDragging,
|
|
228
|
+
stopDragging
|
|
229
|
+
} = unlock(useDispatch(blockEditorStore));
|
|
226
230
|
const onBlockDrop = useOnBlockDrop(dropTarget.operation === 'before' || dropTarget.operation === 'after' ? parentBlockClientId : targetRootClientId, dropTarget.index, {
|
|
227
231
|
operation: dropTarget.operation,
|
|
228
232
|
nearestSide: dropTarget.nearestSide
|
|
229
233
|
});
|
|
230
234
|
const throttled = useThrottle(useCallback((event, ownerDocument) => {
|
|
235
|
+
if (!isDragging()) {
|
|
236
|
+
// When dragging from the desktop, no drag start event is fired.
|
|
237
|
+
// So, ensure that the drag state is set when the user drags over a drop zone.
|
|
238
|
+
startDragging();
|
|
239
|
+
}
|
|
231
240
|
const allowedBlocks = getAllowedBlocks(targetRootClientId);
|
|
232
241
|
const targetBlockName = getBlockNamesByClientId([targetRootClientId])[0];
|
|
233
242
|
const draggedBlockNames = getBlockNamesByClientId(getDraggedBlockClientIds());
|
|
@@ -280,7 +289,7 @@ export default function useBlockDropZone({
|
|
|
280
289
|
nearestSide
|
|
281
290
|
});
|
|
282
291
|
});
|
|
283
|
-
}, [getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, showInsertionPoint]), 200);
|
|
292
|
+
}, [getAllowedBlocks, targetRootClientId, getBlockNamesByClientId, getDraggedBlockClientIds, getBlockType, getBlocks, getBlockListSettings, dropZoneElement, parentBlockClientId, getBlockIndex, registry, showInsertionPoint, isDragging, startDragging]), 200);
|
|
284
293
|
return useDropZone({
|
|
285
294
|
dropZoneElement,
|
|
286
295
|
isDisabled,
|
|
@@ -297,6 +306,7 @@ export default function useBlockDropZone({
|
|
|
297
306
|
},
|
|
298
307
|
onDragEnd() {
|
|
299
308
|
throttled.cancel();
|
|
309
|
+
stopDragging();
|
|
300
310
|
hideInsertionPoint();
|
|
301
311
|
}
|
|
302
312
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","useRegistry","useCallback","useState","useThrottle","__experimentalUseDropZone","useDropZone","isRTL","isUnmodifiedDefaultBlock","getIsUnmodifiedDefaultBlock","store","blocksStore","useOnBlockDrop","getDistanceToNearestEdge","isPointContainedByRect","isPointWithinTopAndBottomBoundariesOfRect","blockEditorStore","THRESHOLD_DISTANCE","MINIMUM_HEIGHT_FOR_THRESHOLD","MINIMUM_WIDTH_FOR_THRESHOLD","getDropTargetPosition","blocksData","position","orientation","options","allowedEdges","nearestIndex","insertPosition","minDistance","Infinity","targetBlockIndex","nearestSide","dropZoneElement","parentBlockOrientation","rootBlockIndex","rect","getBoundingClientRect","distance","edge","height","isRightToLeft","width","forEach","blockIndex","blockOrientation","sideDistance","sideEdge","isPointInsideRect","adjacentIndex","isNearestBlockUnmodifiedDefaultBlock","isAdjacentBlockUnmodifiedDefaultBlock","insertionIndex","isDropTargetValid","getBlockType","allowedBlocks","draggedBlockNames","targetBlockName","areBlocksAllowed","allowedBlockNames","map","name","every","includes","draggedBlockTypes","targetMatchesDraggedBlockParents","block","allowedParentName","parent","useBlockDropZone","rootClientId","targetRootClientId","parentClientId","parentBlockClientId","isDisabled","registry","dropTarget","setDropTarget","index","operation","getBlockListSettings","getBlocks","getBlockIndex","getDraggedBlockClientIds","getBlockNamesByClientId","getAllowedBlocks","showInsertionPoint","hideInsertionPoint","onBlockDrop","throttled","event","ownerDocument","isBlockDroppingAllowed","blocks","length","batch","clientId","getElementById","targetIndex","x","clientX","y","clientY","undefined","insertionPointClientId","onDrop","onDragOver","currentTarget","onDragLeave","cancel","onDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\tisUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOnBlockDrop from '../use-on-block-drop';\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n\tisPointWithinTopAndBottomBoundariesOfRect,\n} from '../../utils/math';\nimport { store as blockEditorStore } from '../../store';\n\nconst THRESHOLD_DISTANCE = 30;\nconst MINIMUM_HEIGHT_FOR_THRESHOLD = 120;\nconst MINIMUM_WIDTH_FOR_THRESHOLD = 120;\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * The insert position when dropping a block.\n *\n * @typedef {'before'|'after'} WPInsertPosition\n */\n\n/**\n * @typedef {Object} WPBlockData\n * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.\n * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.\n * @property {number} blockIndex The index of the block.\n */\n\n/**\n * Get the drop target position from a given drop point and the orientation.\n *\n * @param {WPBlockData[]} blocksData The block data list.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of the block list.\n * @param {Object} options Additional options.\n * @return {[number, WPDropOperation]} The drop target position.\n */\nexport function getDropTargetPosition(\n\tblocksData,\n\tposition,\n\torientation = 'vertical',\n\toptions = {}\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tlet nearestIndex = 0;\n\tlet insertPosition = 'before';\n\tlet minDistance = Infinity;\n\tlet targetBlockIndex = null;\n\tlet nearestSide = 'right';\n\n\tconst {\n\t\tdropZoneElement,\n\t\tparentBlockOrientation,\n\t\trootBlockIndex = 0,\n\t} = options;\n\n\t// Allow before/after when dragging over the top/bottom edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'top',\n\t\t\t'bottom',\n\t\t] );\n\n\t\t// If dragging over the top or bottom of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group or Cover.\n\t\tif (\n\t\t\trect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif ( edge === 'top' ) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif ( edge === 'bottom' ) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isRightToLeft = isRTL();\n\n\t// Allow before/after when dragging over the left/right edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'left',\n\t\t\t'right',\n\t\t] );\n\n\t\t// If dragging over the left or right of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group.\n\t\tif (\n\t\t\trect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'left' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'left' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tblocksData.forEach(\n\t\t( {\n\t\t\tisUnmodifiedDefaultBlock,\n\t\t\tgetBoundingClientRect,\n\t\t\tblockIndex,\n\t\t\tblockOrientation,\n\t\t} ) => {\n\t\t\tconst rect = getBoundingClientRect();\n\n\t\t\tlet [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\tallowedEdges\n\t\t\t);\n\t\t\t// If the the point is close to a side, prioritize that side.\n\t\t\tconst [ sideDistance, sideEdge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\t[ 'left', 'right' ]\n\t\t\t);\n\n\t\t\tconst isPointInsideRect = isPointContainedByRect( position, rect );\n\n\t\t\t// Prioritize the element if the point is inside of an unmodified default block.\n\t\t\tif ( isUnmodifiedDefaultBlock && isPointInsideRect ) {\n\t\t\t\tdistance = 0;\n\t\t\t} else if (\n\t\t\t\torientation === 'vertical' &&\n\t\t\t\tblockOrientation !== 'horizontal' &&\n\t\t\t\t( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||\n\t\t\t\t\t( ! isPointInsideRect &&\n\t\t\t\t\t\tisPointWithinTopAndBottomBoundariesOfRect(\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\trect\n\t\t\t\t\t\t) ) )\n\t\t\t) {\n\t\t\t\t/**\n\t\t\t\t * This condition should only apply when the layout is vertical (otherwise there's\n\t\t\t\t * no need to create a Row) and dropzones should only activate when the block is\n\t\t\t\t * either within and close to the sides of the target block or on its outer sides.\n\t\t\t\t */\n\t\t\t\ttargetBlockIndex = blockIndex;\n\t\t\t\tnearestSide = sideEdge;\n\t\t\t}\n\n\t\t\tif ( distance < minDistance ) {\n\t\t\t\t// Where the dropped block will be inserted on the nearest block.\n\t\t\t\tinsertPosition =\n\t\t\t\t\tedge === 'bottom' ||\n\t\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t\t( isRightToLeft && edge === 'left' )\n\t\t\t\t\t\t? 'after'\n\t\t\t\t\t\t: 'before';\n\n\t\t\t\t// Update the currently known best candidate.\n\t\t\t\tminDistance = distance;\n\t\t\t\tnearestIndex = blockIndex;\n\t\t\t}\n\t\t}\n\t);\n\n\tconst adjacentIndex =\n\t\tnearestIndex + ( insertPosition === 'after' ? 1 : -1 );\n\tconst isNearestBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ nearestIndex ]?.isUnmodifiedDefaultBlock;\n\tconst isAdjacentBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;\n\n\t// If the target index is set then group with the block at that index.\n\tif ( targetBlockIndex !== null ) {\n\t\treturn [ targetBlockIndex, 'group', nearestSide ];\n\t}\n\t// If both blocks are not unmodified default blocks then just insert between them.\n\tif (\n\t\t! isNearestBlockUnmodifiedDefaultBlock &&\n\t\t! isAdjacentBlockUnmodifiedDefaultBlock\n\t) {\n\t\t// If the user is dropping to the trailing edge of the block\n\t\t// add 1 to the index to represent dragging after.\n\t\tconst insertionIndex =\n\t\t\tinsertPosition === 'after' ? nearestIndex + 1 : nearestIndex;\n\t\treturn [ insertionIndex, 'insert' ];\n\t}\n\n\t// Otherwise, replace the nearest unmodified default block.\n\treturn [\n\t\tisNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,\n\t\t'replace',\n\t];\n}\n\n/**\n * Check if the dragged blocks can be dropped on the target.\n * @param {Function} getBlockType\n * @param {Object[]} allowedBlocks\n * @param {string[]} draggedBlockNames\n * @param {string} targetBlockName\n * @return {boolean} Whether the dragged blocks can be dropped on the target.\n */\nexport function isDropTargetValid(\n\tgetBlockType,\n\tallowedBlocks,\n\tdraggedBlockNames,\n\ttargetBlockName\n) {\n\t// At root level allowedBlocks is undefined and all blocks are allowed.\n\t// Otherwise, check if all dragged blocks are allowed.\n\tlet areBlocksAllowed = true;\n\tif ( allowedBlocks ) {\n\t\tconst allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );\n\n\t\tareBlocksAllowed = draggedBlockNames.every( ( name ) =>\n\t\t\tallowedBlockNames?.includes( name )\n\t\t);\n\t}\n\n\t// Work out if dragged blocks have an allowed parent and if so\n\t// check target block matches the allowed parent.\n\tconst draggedBlockTypes = draggedBlockNames.map( ( name ) =>\n\t\tgetBlockType( name )\n\t);\n\tconst targetMatchesDraggedBlockParents = draggedBlockTypes.every(\n\t\t( block ) => {\n\t\t\tconst [ allowedParentName ] = block?.parent || [];\n\t\t\tif ( ! allowedParentName ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn allowedParentName === targetBlockName;\n\t\t}\n\t);\n\n\treturn areBlocksAllowed && targetMatchesDraggedBlockParents;\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n */\nexport default function useBlockDropZone( {\n\tdropZoneElement,\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n\tparentClientId: parentBlockClientId = '',\n\tisDisabled = false,\n} = {} ) {\n\tconst registry = useRegistry();\n\tconst [ dropTarget, setDropTarget ] = useState( {\n\t\tindex: null,\n\t\toperation: 'insert',\n\t} );\n\n\tconst { getBlockType } = useSelect( blocksStore );\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlocks,\n\t\tgetBlockIndex,\n\t\tgetDraggedBlockClientIds,\n\t\tgetBlockNamesByClientId,\n\t\tgetAllowedBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst onBlockDrop = useOnBlockDrop(\n\t\tdropTarget.operation === 'before' || dropTarget.operation === 'after'\n\t\t\t? parentBlockClientId\n\t\t\t: targetRootClientId,\n\t\tdropTarget.index,\n\t\t{\n\t\t\toperation: dropTarget.operation,\n\t\t\tnearestSide: dropTarget.nearestSide,\n\t\t}\n\t);\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, ownerDocument ) => {\n\t\t\t\tconst allowedBlocks = getAllowedBlocks( targetRootClientId );\n\t\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\t\t\t\tconst draggedBlockNames = getBlockNamesByClientId(\n\t\t\t\t\tgetDraggedBlockClientIds()\n\t\t\t\t);\n\t\t\t\tconst isBlockDroppingAllowed = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\t\t\t\tif ( ! isBlockDroppingAllowed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocks = getBlocks( targetRootClientId );\n\n\t\t\t\t// The block list is empty, don't show the insertion point but still allow dropping.\n\t\t\t\tif ( blocks.length === 0 ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tshowInsertionPoint( targetRootClientId, 0, {\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocksData = blocks.map( ( block ) => {\n\t\t\t\t\tconst clientId = block.clientId;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisUnmodifiedDefaultBlock:\n\t\t\t\t\t\t\tgetIsUnmodifiedDefaultBlock( block ),\n\t\t\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t\t\townerDocument\n\t\t\t\t\t\t\t\t.getElementById( `block-${ clientId }` )\n\t\t\t\t\t\t\t\t.getBoundingClientRect(),\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\tblockOrientation:\n\t\t\t\t\t\t\tgetBlockListSettings( clientId )?.orientation,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst [ targetIndex, operation, nearestSide ] =\n\t\t\t\t\tgetDropTargetPosition(\n\t\t\t\t\t\tblocksData,\n\t\t\t\t\t\t{ x: event.clientX, y: event.clientY },\n\t\t\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdropZoneElement,\n\t\t\t\t\t\t\tparentBlockClientId,\n\t\t\t\t\t\t\tparentBlockOrientation: parentBlockClientId\n\t\t\t\t\t\t\t\t? getBlockListSettings( parentBlockClientId )\n\t\t\t\t\t\t\t\t\t\t?.orientation\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\trootBlockIndex: getBlockIndex( targetRootClientId ),\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\tindex: targetIndex,\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst insertionPointClientId = [\n\t\t\t\t\t\t'before',\n\t\t\t\t\t\t'after',\n\t\t\t\t\t].includes( operation )\n\t\t\t\t\t\t? parentBlockClientId\n\t\t\t\t\t\t: targetRootClientId;\n\n\t\t\t\t\tshowInsertionPoint( insertionPointClientId, targetIndex, {\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\ttargetRootClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tdropZoneElement,\n\t\t\t\tparentBlockClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tregistry,\n\t\t\t\tshowInsertionPoint,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\treturn useDropZone( {\n\t\tdropZoneElement,\n\t\tisDisabled,\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget.ownerDocument );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\thideInsertionPoint();\n\t\t},\n\t\tonDragEnd() {\n\t\t\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tB,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDuB,SAASA,CAAA,EAAG;MACXrB,SAAS,CAACoB,MAAM,CAAC,CAAC;MAClBtB,kBAAkB,CAAC,CAAC;IACrB;EACD,CAAE,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","useRegistry","useCallback","useState","useThrottle","__experimentalUseDropZone","useDropZone","isRTL","isUnmodifiedDefaultBlock","getIsUnmodifiedDefaultBlock","store","blocksStore","useOnBlockDrop","getDistanceToNearestEdge","isPointContainedByRect","isPointWithinTopAndBottomBoundariesOfRect","blockEditorStore","unlock","THRESHOLD_DISTANCE","MINIMUM_HEIGHT_FOR_THRESHOLD","MINIMUM_WIDTH_FOR_THRESHOLD","getDropTargetPosition","blocksData","position","orientation","options","allowedEdges","nearestIndex","insertPosition","minDistance","Infinity","targetBlockIndex","nearestSide","dropZoneElement","parentBlockOrientation","rootBlockIndex","rect","getBoundingClientRect","distance","edge","height","isRightToLeft","width","forEach","blockIndex","blockOrientation","sideDistance","sideEdge","isPointInsideRect","adjacentIndex","isNearestBlockUnmodifiedDefaultBlock","isAdjacentBlockUnmodifiedDefaultBlock","insertionIndex","isDropTargetValid","getBlockType","allowedBlocks","draggedBlockNames","targetBlockName","areBlocksAllowed","allowedBlockNames","map","name","every","includes","draggedBlockTypes","targetMatchesDraggedBlockParents","block","allowedParentName","parent","useBlockDropZone","rootClientId","targetRootClientId","parentClientId","parentBlockClientId","isDisabled","registry","dropTarget","setDropTarget","index","operation","getBlockListSettings","getBlocks","getBlockIndex","getDraggedBlockClientIds","getBlockNamesByClientId","getAllowedBlocks","isDragging","showInsertionPoint","hideInsertionPoint","startDragging","stopDragging","onBlockDrop","throttled","event","ownerDocument","isBlockDroppingAllowed","blocks","length","batch","clientId","getElementById","targetIndex","x","clientX","y","clientY","undefined","insertionPointClientId","onDrop","onDragOver","currentTarget","onDragLeave","cancel","onDragEnd"],"sources":["@wordpress/block-editor/src/components/use-block-drop-zone/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\nimport {\n\tisUnmodifiedDefaultBlock as getIsUnmodifiedDefaultBlock,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOnBlockDrop from '../use-on-block-drop';\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n\tisPointWithinTopAndBottomBoundariesOfRect,\n} from '../../utils/math';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst THRESHOLD_DISTANCE = 30;\nconst MINIMUM_HEIGHT_FOR_THRESHOLD = 120;\nconst MINIMUM_WIDTH_FOR_THRESHOLD = 120;\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n/** @typedef {import('../use-on-block-drop/types').WPDropOperation} WPDropOperation */\n\n/**\n * The orientation of a block list.\n *\n * @typedef {'horizontal'|'vertical'|undefined} WPBlockListOrientation\n */\n\n/**\n * The insert position when dropping a block.\n *\n * @typedef {'before'|'after'} WPInsertPosition\n */\n\n/**\n * @typedef {Object} WPBlockData\n * @property {boolean} isUnmodifiedDefaultBlock Is the block unmodified default block.\n * @property {() => DOMRect} getBoundingClientRect Get the bounding client rect of the block.\n * @property {number} blockIndex The index of the block.\n */\n\n/**\n * Get the drop target position from a given drop point and the orientation.\n *\n * @param {WPBlockData[]} blocksData The block data list.\n * @param {WPPoint} position The position of the item being dragged.\n * @param {WPBlockListOrientation} orientation The orientation of the block list.\n * @param {Object} options Additional options.\n * @return {[number, WPDropOperation]} The drop target position.\n */\nexport function getDropTargetPosition(\n\tblocksData,\n\tposition,\n\torientation = 'vertical',\n\toptions = {}\n) {\n\tconst allowedEdges =\n\t\torientation === 'horizontal'\n\t\t\t? [ 'left', 'right' ]\n\t\t\t: [ 'top', 'bottom' ];\n\n\tlet nearestIndex = 0;\n\tlet insertPosition = 'before';\n\tlet minDistance = Infinity;\n\tlet targetBlockIndex = null;\n\tlet nearestSide = 'right';\n\n\tconst {\n\t\tdropZoneElement,\n\t\tparentBlockOrientation,\n\t\trootBlockIndex = 0,\n\t} = options;\n\n\t// Allow before/after when dragging over the top/bottom edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation !== 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'top',\n\t\t\t'bottom',\n\t\t] );\n\n\t\t// If dragging over the top or bottom of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group or Cover.\n\t\tif (\n\t\t\trect.height > MINIMUM_HEIGHT_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif ( edge === 'top' ) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif ( edge === 'bottom' ) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tconst isRightToLeft = isRTL();\n\n\t// Allow before/after when dragging over the left/right edges of the drop zone.\n\tif ( dropZoneElement && parentBlockOrientation === 'horizontal' ) {\n\t\tconst rect = dropZoneElement.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge( position, rect, [\n\t\t\t'left',\n\t\t\t'right',\n\t\t] );\n\n\t\t// If dragging over the left or right of the drop zone, insert the block\n\t\t// before or after the parent block. This only applies to blocks that use\n\t\t// a drop zone element, typically container blocks such as Group.\n\t\tif (\n\t\t\trect.width > MINIMUM_WIDTH_FOR_THRESHOLD &&\n\t\t\tdistance < THRESHOLD_DISTANCE\n\t\t) {\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'right' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'left' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex, 'before' ];\n\t\t\t}\n\t\t\tif (\n\t\t\t\t( isRightToLeft && edge === 'left' ) ||\n\t\t\t\t( ! isRightToLeft && edge === 'right' )\n\t\t\t) {\n\t\t\t\treturn [ rootBlockIndex + 1, 'after' ];\n\t\t\t}\n\t\t}\n\t}\n\n\tblocksData.forEach(\n\t\t( {\n\t\t\tisUnmodifiedDefaultBlock,\n\t\t\tgetBoundingClientRect,\n\t\t\tblockIndex,\n\t\t\tblockOrientation,\n\t\t} ) => {\n\t\t\tconst rect = getBoundingClientRect();\n\n\t\t\tlet [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\tallowedEdges\n\t\t\t);\n\t\t\t// If the the point is close to a side, prioritize that side.\n\t\t\tconst [ sideDistance, sideEdge ] = getDistanceToNearestEdge(\n\t\t\t\tposition,\n\t\t\t\trect,\n\t\t\t\t[ 'left', 'right' ]\n\t\t\t);\n\n\t\t\tconst isPointInsideRect = isPointContainedByRect( position, rect );\n\n\t\t\t// Prioritize the element if the point is inside of an unmodified default block.\n\t\t\tif ( isUnmodifiedDefaultBlock && isPointInsideRect ) {\n\t\t\t\tdistance = 0;\n\t\t\t} else if (\n\t\t\t\torientation === 'vertical' &&\n\t\t\t\tblockOrientation !== 'horizontal' &&\n\t\t\t\t( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||\n\t\t\t\t\t( ! isPointInsideRect &&\n\t\t\t\t\t\tisPointWithinTopAndBottomBoundariesOfRect(\n\t\t\t\t\t\t\tposition,\n\t\t\t\t\t\t\trect\n\t\t\t\t\t\t) ) )\n\t\t\t) {\n\t\t\t\t/**\n\t\t\t\t * This condition should only apply when the layout is vertical (otherwise there's\n\t\t\t\t * no need to create a Row) and dropzones should only activate when the block is\n\t\t\t\t * either within and close to the sides of the target block or on its outer sides.\n\t\t\t\t */\n\t\t\t\ttargetBlockIndex = blockIndex;\n\t\t\t\tnearestSide = sideEdge;\n\t\t\t}\n\n\t\t\tif ( distance < minDistance ) {\n\t\t\t\t// Where the dropped block will be inserted on the nearest block.\n\t\t\t\tinsertPosition =\n\t\t\t\t\tedge === 'bottom' ||\n\t\t\t\t\t( ! isRightToLeft && edge === 'right' ) ||\n\t\t\t\t\t( isRightToLeft && edge === 'left' )\n\t\t\t\t\t\t? 'after'\n\t\t\t\t\t\t: 'before';\n\n\t\t\t\t// Update the currently known best candidate.\n\t\t\t\tminDistance = distance;\n\t\t\t\tnearestIndex = blockIndex;\n\t\t\t}\n\t\t}\n\t);\n\n\tconst adjacentIndex =\n\t\tnearestIndex + ( insertPosition === 'after' ? 1 : -1 );\n\tconst isNearestBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ nearestIndex ]?.isUnmodifiedDefaultBlock;\n\tconst isAdjacentBlockUnmodifiedDefaultBlock =\n\t\t!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;\n\n\t// If the target index is set then group with the block at that index.\n\tif ( targetBlockIndex !== null ) {\n\t\treturn [ targetBlockIndex, 'group', nearestSide ];\n\t}\n\t// If both blocks are not unmodified default blocks then just insert between them.\n\tif (\n\t\t! isNearestBlockUnmodifiedDefaultBlock &&\n\t\t! isAdjacentBlockUnmodifiedDefaultBlock\n\t) {\n\t\t// If the user is dropping to the trailing edge of the block\n\t\t// add 1 to the index to represent dragging after.\n\t\tconst insertionIndex =\n\t\t\tinsertPosition === 'after' ? nearestIndex + 1 : nearestIndex;\n\t\treturn [ insertionIndex, 'insert' ];\n\t}\n\n\t// Otherwise, replace the nearest unmodified default block.\n\treturn [\n\t\tisNearestBlockUnmodifiedDefaultBlock ? nearestIndex : adjacentIndex,\n\t\t'replace',\n\t];\n}\n\n/**\n * Check if the dragged blocks can be dropped on the target.\n * @param {Function} getBlockType\n * @param {Object[]} allowedBlocks\n * @param {string[]} draggedBlockNames\n * @param {string} targetBlockName\n * @return {boolean} Whether the dragged blocks can be dropped on the target.\n */\nexport function isDropTargetValid(\n\tgetBlockType,\n\tallowedBlocks,\n\tdraggedBlockNames,\n\ttargetBlockName\n) {\n\t// At root level allowedBlocks is undefined and all blocks are allowed.\n\t// Otherwise, check if all dragged blocks are allowed.\n\tlet areBlocksAllowed = true;\n\tif ( allowedBlocks ) {\n\t\tconst allowedBlockNames = allowedBlocks?.map( ( { name } ) => name );\n\n\t\tareBlocksAllowed = draggedBlockNames.every( ( name ) =>\n\t\t\tallowedBlockNames?.includes( name )\n\t\t);\n\t}\n\n\t// Work out if dragged blocks have an allowed parent and if so\n\t// check target block matches the allowed parent.\n\tconst draggedBlockTypes = draggedBlockNames.map( ( name ) =>\n\t\tgetBlockType( name )\n\t);\n\tconst targetMatchesDraggedBlockParents = draggedBlockTypes.every(\n\t\t( block ) => {\n\t\t\tconst [ allowedParentName ] = block?.parent || [];\n\t\t\tif ( ! allowedParentName ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn allowedParentName === targetBlockName;\n\t\t}\n\t);\n\n\treturn areBlocksAllowed && targetMatchesDraggedBlockParents;\n}\n\n/**\n * @typedef {Object} WPBlockDropZoneConfig\n * @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.\n * @property {string} rootClientId The root client id for the block list.\n */\n\n/**\n * A React hook that can be used to make a block list handle drag and drop.\n *\n * @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.\n */\nexport default function useBlockDropZone( {\n\tdropZoneElement,\n\t// An undefined value represents a top-level block. Default to an empty\n\t// string for this so that `targetRootClientId` can be easily compared to\n\t// values returned by the `getRootBlockClientId` selector, which also uses\n\t// an empty string to represent top-level blocks.\n\trootClientId: targetRootClientId = '',\n\tparentClientId: parentBlockClientId = '',\n\tisDisabled = false,\n} = {} ) {\n\tconst registry = useRegistry();\n\tconst [ dropTarget, setDropTarget ] = useState( {\n\t\tindex: null,\n\t\toperation: 'insert',\n\t} );\n\n\tconst { getBlockType } = useSelect( blocksStore );\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlocks,\n\t\tgetBlockIndex,\n\t\tgetDraggedBlockClientIds,\n\t\tgetBlockNamesByClientId,\n\t\tgetAllowedBlocks,\n\t\tisDragging,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst {\n\t\tshowInsertionPoint,\n\t\thideInsertionPoint,\n\t\tstartDragging,\n\t\tstopDragging,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tconst onBlockDrop = useOnBlockDrop(\n\t\tdropTarget.operation === 'before' || dropTarget.operation === 'after'\n\t\t\t? parentBlockClientId\n\t\t\t: targetRootClientId,\n\t\tdropTarget.index,\n\t\t{\n\t\t\toperation: dropTarget.operation,\n\t\t\tnearestSide: dropTarget.nearestSide,\n\t\t}\n\t);\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, ownerDocument ) => {\n\t\t\t\tif ( ! isDragging() ) {\n\t\t\t\t\t// When dragging from the desktop, no drag start event is fired.\n\t\t\t\t\t// So, ensure that the drag state is set when the user drags over a drop zone.\n\t\t\t\t\tstartDragging();\n\t\t\t\t}\n\t\t\t\tconst allowedBlocks = getAllowedBlocks( targetRootClientId );\n\t\t\t\tconst targetBlockName = getBlockNamesByClientId( [\n\t\t\t\t\ttargetRootClientId,\n\t\t\t\t] )[ 0 ];\n\t\t\t\tconst draggedBlockNames = getBlockNamesByClientId(\n\t\t\t\t\tgetDraggedBlockClientIds()\n\t\t\t\t);\n\t\t\t\tconst isBlockDroppingAllowed = isDropTargetValid(\n\t\t\t\t\tgetBlockType,\n\t\t\t\t\tallowedBlocks,\n\t\t\t\t\tdraggedBlockNames,\n\t\t\t\t\ttargetBlockName\n\t\t\t\t);\n\t\t\t\tif ( ! isBlockDroppingAllowed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocks = getBlocks( targetRootClientId );\n\n\t\t\t\t// The block list is empty, don't show the insertion point but still allow dropping.\n\t\t\t\tif ( blocks.length === 0 ) {\n\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tshowInsertionPoint( targetRootClientId, 0, {\n\t\t\t\t\t\t\toperation: 'insert',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blocksData = blocks.map( ( block ) => {\n\t\t\t\t\tconst clientId = block.clientId;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tisUnmodifiedDefaultBlock:\n\t\t\t\t\t\t\tgetIsUnmodifiedDefaultBlock( block ),\n\t\t\t\t\t\tgetBoundingClientRect: () =>\n\t\t\t\t\t\t\townerDocument\n\t\t\t\t\t\t\t\t.getElementById( `block-${ clientId }` )\n\t\t\t\t\t\t\t\t.getBoundingClientRect(),\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\tblockOrientation:\n\t\t\t\t\t\t\tgetBlockListSettings( clientId )?.orientation,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst [ targetIndex, operation, nearestSide ] =\n\t\t\t\t\tgetDropTargetPosition(\n\t\t\t\t\t\tblocksData,\n\t\t\t\t\t\t{ x: event.clientX, y: event.clientY },\n\t\t\t\t\t\tgetBlockListSettings( targetRootClientId )?.orientation,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdropZoneElement,\n\t\t\t\t\t\t\tparentBlockClientId,\n\t\t\t\t\t\t\tparentBlockOrientation: parentBlockClientId\n\t\t\t\t\t\t\t\t? getBlockListSettings( parentBlockClientId )\n\t\t\t\t\t\t\t\t\t\t?.orientation\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\trootBlockIndex: getBlockIndex( targetRootClientId ),\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tsetDropTarget( {\n\t\t\t\t\t\tindex: targetIndex,\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst insertionPointClientId = [\n\t\t\t\t\t\t'before',\n\t\t\t\t\t\t'after',\n\t\t\t\t\t].includes( operation )\n\t\t\t\t\t\t? parentBlockClientId\n\t\t\t\t\t\t: targetRootClientId;\n\n\t\t\t\t\tshowInsertionPoint( insertionPointClientId, targetIndex, {\n\t\t\t\t\t\toperation,\n\t\t\t\t\t\tnearestSide,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[\n\t\t\t\tgetAllowedBlocks,\n\t\t\t\ttargetRootClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetDraggedBlockClientIds,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tdropZoneElement,\n\t\t\t\tparentBlockClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tregistry,\n\t\t\t\tshowInsertionPoint,\n\t\t\t\tisDragging,\n\t\t\t\tstartDragging,\n\t\t\t]\n\t\t),\n\t\t200\n\t);\n\n\treturn useDropZone( {\n\t\tdropZoneElement,\n\t\tisDisabled,\n\t\tonDrop: onBlockDrop,\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget.ownerDocument );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\thideInsertionPoint();\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\tstopDragging();\n\t\t\thideInsertionPoint();\n\t\t},\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,W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,aAAa,CAAChB,aAAc,CAAC;IACtD,CAAC;IACDiB,WAAWA,CAAA,EAAG;MACbnB,SAAS,CAACoB,MAAM,CAAC,CAAC;MAClBxB,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDyB,SAASA,CAAA,EAAG;MACXrB,SAAS,CAACoB,MAAM,CAAC,CAAC;MAClBtB,YAAY,CAAC,CAAC;MACdF,kBAAkB,CAAC,CAAC;IACrB;EACD,CAAE,CAAC;AACJ"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as blockEditorStore } from '../../store';
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
export function useFlashEditableBlocks({
|
|
13
|
+
clientId = '',
|
|
14
|
+
isEnabled = true
|
|
15
|
+
} = {}) {
|
|
16
|
+
const {
|
|
17
|
+
getEnabledClientIdsTree
|
|
18
|
+
} = unlock(useSelect(blockEditorStore));
|
|
19
|
+
return useRefEffect(element => {
|
|
20
|
+
if (!isEnabled) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const flashEditableBlocks = () => {
|
|
24
|
+
getEnabledClientIdsTree(clientId).forEach(({
|
|
25
|
+
clientId: id
|
|
26
|
+
}) => {
|
|
27
|
+
const block = element.querySelector(`[data-block="${id}"]`);
|
|
28
|
+
if (!block) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
block.classList.remove('has-editable-outline');
|
|
32
|
+
// Force reflow to trigger the animation.
|
|
33
|
+
// eslint-disable-next-line no-unused-expressions
|
|
34
|
+
block.offsetWidth;
|
|
35
|
+
block.classList.add('has-editable-outline');
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const handleClick = event => {
|
|
39
|
+
const shouldFlash = event.target === element || event.target.classList.contains('is-root-container');
|
|
40
|
+
if (!shouldFlash) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (event.defaultPrevented) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
flashEditableBlocks();
|
|
48
|
+
};
|
|
49
|
+
element.addEventListener('click', handleClick);
|
|
50
|
+
return () => element.removeEventListener('click', handleClick);
|
|
51
|
+
}, [isEnabled]);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRefEffect","useSelect","store","blockEditorStore","unlock","useFlashEditableBlocks","clientId","isEnabled","getEnabledClientIdsTree","element","flashEditableBlocks","forEach","id","block","querySelector","classList","remove","offsetWidth","add","handleClick","event","shouldFlash","target","contains","defaultPrevented","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/use-flash-editable-blocks/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function useFlashEditableBlocks( {\n\tclientId = '',\n\tisEnabled = true,\n} = {} ) {\n\tconst { getEnabledClientIdsTree } = unlock( useSelect( blockEditorStore ) );\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst flashEditableBlocks = () => {\n\t\t\t\tgetEnabledClientIdsTree( clientId ).forEach(\n\t\t\t\t\t( { clientId: id } ) => {\n\t\t\t\t\t\tconst block = element.querySelector(\n\t\t\t\t\t\t\t`[data-block=\"${ id }\"]`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( ! block ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tblock.classList.remove( 'has-editable-outline' );\n\t\t\t\t\t\t// Force reflow to trigger the animation.\n\t\t\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\t\t\tblock.offsetWidth;\n\t\t\t\t\t\tblock.classList.add( 'has-editable-outline' );\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tconst shouldFlash =\n\t\t\t\t\tevent.target === element ||\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' );\n\t\t\t\tif ( ! shouldFlash ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tevent.preventDefault();\n\t\t\t\tflashEditableBlocks();\n\t\t\t};\n\n\t\t\telement.addEventListener( 'click', handleClick );\n\t\t\treturn () => element.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,sBAAsBA,CAAE;EACvCC,QAAQ,GAAG,EAAE;EACbC,SAAS,GAAG;AACb,CAAC,GAAG,CAAC,CAAC,EAAG;EACR,MAAM;IAAEC;EAAwB,CAAC,GAAGJ,MAAM,CAAEH,SAAS,CAAEE,gBAAiB,CAAE,CAAC;EAE3E,OAAOH,YAAY,CAChBS,OAAO,IAAM;IACd,IAAK,CAAEF,SAAS,EAAG;MAClB;IACD;IAEA,MAAMG,mBAAmB,GAAGA,CAAA,KAAM;MACjCF,uBAAuB,CAAEF,QAAS,CAAC,CAACK,OAAO,CAC1C,CAAE;QAAEL,QAAQ,EAAEM;MAAG,CAAC,KAAM;QACvB,MAAMC,KAAK,GAAGJ,OAAO,CAACK,aAAa,CACjC,gBAAgBF,EAAI,IACtB,CAAC;QACD,IAAK,CAAEC,KAAK,EAAG;UACd;QACD;QACAA,KAAK,CAACE,SAAS,CAACC,MAAM,CAAE,sBAAuB,CAAC;QAChD;QACA;QACAH,KAAK,CAACI,WAAW;QACjBJ,KAAK,CAACE,SAAS,CAACG,GAAG,CAAE,sBAAuB,CAAC;MAC9C,CACD,CAAC;IACF,CAAC;IAED,MAAMC,WAAW,GAAKC,KAAK,IAAM;MAChC,MAAMC,WAAW,GAChBD,KAAK,CAACE,MAAM,KAAKb,OAAO,IACxBW,KAAK,CAACE,MAAM,CAACP,SAAS,CAACQ,QAAQ,CAAE,mBAAoB,CAAC;MACvD,IAAK,CAAEF,WAAW,EAAG;QACpB;MACD;MACA,IAAKD,KAAK,CAACI,gBAAgB,EAAG;QAC7B;MACD;MACAJ,KAAK,CAACK,cAAc,CAAC,CAAC;MACtBf,mBAAmB,CAAC,CAAC;IACtB,CAAC;IAEDD,OAAO,CAACiB,gBAAgB,CAAE,OAAO,EAAEP,WAAY,CAAC;IAChD,OAAO,MAAMV,OAAO,CAACkB,mBAAmB,CAAE,OAAO,EAAER,WAAY,CAAC;EACjE,CAAC,EACD,CAAEZ,SAAS,CACZ,CAAC;AACF"}
|
|
@@ -174,7 +174,6 @@ export default function useOnBlockDrop(targetRootClientId, targetBlockIndex, opt
|
|
|
174
174
|
isGroupable
|
|
175
175
|
} = useSelect(blockEditorStore);
|
|
176
176
|
const {
|
|
177
|
-
getBlockType,
|
|
178
177
|
getGroupingBlockName
|
|
179
178
|
} = useSelect(blocksStore);
|
|
180
179
|
const {
|
|
@@ -187,6 +186,7 @@ export default function useOnBlockDrop(targetRootClientId, targetBlockIndex, opt
|
|
|
187
186
|
} = useDispatch(blockEditorStore);
|
|
188
187
|
const registry = useRegistry();
|
|
189
188
|
const insertOrReplaceBlocks = useCallback((blocks, updateSelection = true, initialPosition = 0, clientIdsToReplace = []) => {
|
|
189
|
+
if (!Array.isArray(blocks)) blocks = [blocks];
|
|
190
190
|
const clientIds = getBlockOrder(targetRootClientId);
|
|
191
191
|
const clientId = clientIds[targetBlockIndex];
|
|
192
192
|
const blocksClientIds = blocks.map(block => block.clientId);
|
|
@@ -206,11 +206,11 @@ export default function useOnBlockDrop(targetRootClientId, targetBlockIndex, opt
|
|
|
206
206
|
const areAllImages = blocks.every(block => {
|
|
207
207
|
return block.name === 'core/image';
|
|
208
208
|
});
|
|
209
|
-
const galleryBlock =
|
|
209
|
+
const galleryBlock = canInsertBlockType('core/gallery', targetRootClientId);
|
|
210
210
|
const wrappedBlocks = createBlock(areAllImages && galleryBlock ? 'core/gallery' : getGroupingBlockName(), {
|
|
211
211
|
layout: {
|
|
212
212
|
type: 'flex',
|
|
213
|
-
flexWrap: areAllImages ? null : 'nowrap'
|
|
213
|
+
flexWrap: areAllImages && galleryBlock ? null : 'nowrap'
|
|
214
214
|
}
|
|
215
215
|
}, groupInnerBlocks);
|
|
216
216
|
// Need to make sure both the target block and the block being dragged are replaced
|
|
@@ -219,7 +219,7 @@ export default function useOnBlockDrop(targetRootClientId, targetBlockIndex, opt
|
|
|
219
219
|
} else {
|
|
220
220
|
insertBlocks(blocks, targetBlockIndex, targetRootClientId, updateSelection, initialPosition);
|
|
221
221
|
}
|
|
222
|
-
}, [getBlockOrder, targetRootClientId, targetBlockIndex, operation, replaceBlocks, getBlock, nearestSide,
|
|
222
|
+
}, [getBlockOrder, targetRootClientId, targetBlockIndex, isGroupable, operation, replaceBlocks, getBlock, nearestSide, canInsertBlockType, getGroupingBlockName, insertBlocks]);
|
|
223
223
|
const moveBlocks = useCallback((sourceClientIds, sourceRootClientId, insertIndex) => {
|
|
224
224
|
if (operation === 'replace') {
|
|
225
225
|
const sourceBlocks = getBlocksByClientId(sourceClientIds);
|