@wordpress/block-editor 14.4.0 → 14.6.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/README.md +4 -8
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/background-image-control/index.js +1 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-canvas/index.js +10 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +1 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-full-height-alignment-control/index.js +1 -1
- package/build/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.js +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +1 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +6 -5
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +11 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +10 -7
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +1 -1
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +1 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +2 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-rename/modal.js +2 -2
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +4 -3
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-switcher/index.js +2 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-switcher/utils.js +1 -0
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/change-design.js +122 -0
- package/build/components/block-toolbar/change-design.js.map +1 -0
- package/build/components/block-toolbar/index.js +19 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +4 -17
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -6
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +3 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +6 -10
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +7 -10
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/collab/block-comment-icon-slot.js +18 -0
- package/build/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
- package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +4 -4
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -4
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +2 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/iframe/index.js +46 -11
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +61 -20
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +9 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +15 -8
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -2
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +16 -12
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/media-tab/utils.js.map +1 -1
- package/build/components/inserter/menu.js +8 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +1 -1
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-button/index.native.js +1 -1
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +0 -2
- package/build/components/inspector-controls-tabs/index.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/line-height-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/link-preview.js +12 -9
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-create-button.js +1 -1
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +3 -5
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +5 -15
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/list-view/appender.js +5 -4
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +6 -5
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +1 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +2 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/utils.js +1 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +1 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +2 -2
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -0
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +1 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +3 -3
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/responsive-block-control/label.js +1 -1
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/event-listeners/index.js +3 -1
- package/build/components/rich-text/event-listeners/index.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build/components/rich-text/index.js +3 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +2 -6
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/toolbar-button.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -0
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +2 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +1 -5
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -0
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tool-selector/index.js +8 -5
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -0
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/unsupported-block-details/index.native.js.map +1 -1
- package/build/components/url-input/index.js +1 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +5 -5
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +0 -1
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -3
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -2
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +1 -3
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +5 -3
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +20 -5
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/block-bindings.js +19 -8
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +1 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/contrast-checker.js +0 -1
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/duotone.js +2 -2
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/generated-class-name.js +1 -0
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/grid-visualizer.js +13 -11
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/layout-child.js +41 -3
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js +4 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-align.js.map +1 -1
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/use-zoom-out.js +17 -18
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +6 -38
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/private-actions.js +57 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +9 -21
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -24
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +66 -22
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +9 -6
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/dom.js +16 -1
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +2 -2
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/object.js +1 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/transform-styles/index.js +4 -3
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +15 -9
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +1 -3
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +1 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +2 -3
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +1 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +1 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +12 -3
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +4 -5
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +1 -2
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-compare/index.js +1 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +1 -3
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +2 -3
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +1 -2
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -3
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +1 -2
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +1 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js +1 -1
- package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -3
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.js +1 -1
- package/build-module/components/block-list/block-crash-warning.js.map +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js +1 -1
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +1 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -2
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +1 -2
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +2 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -9
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +7 -7
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -3
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/insertion-point.native.js +1 -2
- package/build-module/components/block-list/insertion-point.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +11 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +10 -7
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +1 -3
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +2 -3
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +1 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +1 -2
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +1 -3
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +1 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +1 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +1 -2
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -3
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -3
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +2 -3
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -7
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +3 -4
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +1 -2
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -4
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +1 -3
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +6 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +5 -4
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -2
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +1 -2
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +1 -3
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +1 -3
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +3 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -2
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/preview-block-popover.js +1 -2
- package/build-module/components/block-switcher/preview-block-popover.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -0
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +1 -0
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -2
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/change-design.js +114 -0
- package/build-module/components/block-toolbar/change-design.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +20 -10
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +1 -3
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/index.js +5 -19
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +5 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -6
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +1 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +1 -2
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -4
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -3
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +8 -11
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.native.js +1 -2
- package/build-module/components/button-block-appender/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +1 -3
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/collab/block-comment-icon-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -3
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +1 -3
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +1 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -3
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +5 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -2
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +1 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/dimensions-tool/index.js +1 -3
- package/build-module/components/dimensions-tool/index.js.map +1 -1
- package/build-module/components/dimensions-tool/width-height-tool.js +1 -3
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -1
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -2
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +1 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/floating-toolbar/index.native.js +1 -2
- package/build-module/components/floating-toolbar/index.native.js.map +1 -1
- package/build-module/components/floating-toolbar/nav-up-icon.js +1 -2
- package/build-module/components/floating-toolbar/nav-up-icon.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +2 -2
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +1 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -7
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +1 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +1 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +2 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +1 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +1 -2
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +1 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +47 -14
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -3
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/cropper.js +1 -3
- package/build-module/components/image-editor/cropper.js.map +1 -1
- package/build-module/components/image-editor/form-controls.js +1 -3
- package/build-module/components/image-editor/form-controls.js.map +1 -1
- package/build-module/components/image-editor/index.js +1 -2
- package/build-module/components/image-editor/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +1 -3
- package/build-module/components/image-link-destinations/index.native.js.map +1 -1
- package/build-module/components/image-size-control/index.js +63 -24
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -5
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -9
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +1 -2
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -2
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -5
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -3
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +3 -5
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -4
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +1 -3
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +18 -15
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -3
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -2
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +2 -4
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +1 -3
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/media-tab/utils.js.map +1 -1
- package/build-module/components/inserter/menu.js +10 -7
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +1 -3
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -2
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/no-results.js +1 -2
- package/build-module/components/inserter/no-results.js.map +1 -1
- package/build-module/components/inserter/no-results.native.js +1 -2
- package/build-module/components/inserter/no-results.native.js.map +1 -1
- package/build-module/components/inserter/panel.js +1 -3
- package/build-module/components/inserter/panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +2 -3
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -2
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -4
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +1 -3
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/utils.js +3 -6
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +1 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -3
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +14 -13
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +1 -1
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +6 -17
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -3
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -2
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -6
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -3
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +1 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +8 -9
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +1 -2
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +2 -4
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +2 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/utils.js +1 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -4
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +1 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +1 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +1 -2
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +3 -4
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -0
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/provider/index.js +2 -3
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +1 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +1 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +4 -5
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/responsive-block-control/label.js +2 -4
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +2 -2
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/enter.js +2 -2
- package/build-module/components/rich-text/event-listeners/enter.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/firefox-compat.js +2 -2
- package/build-module/components/rich-text/event-listeners/firefox-compat.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/index.js +4 -2
- package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-events.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/shortcuts.js +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.native.js +1 -3
- package/build-module/components/rich-text/format-toolbar/index.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -9
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.js +1 -1
- package/build-module/components/rich-text/native/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +1 -3
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +1 -3
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/toolbar-button.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -0
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +4 -5
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +1 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +5 -7
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -0
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +1 -2
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +9 -8
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -0
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/unsupported-block-details/index.native.js +1 -2
- package/build-module/components/unsupported-block-details/index.native.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -2
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +1 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/index.js +1 -2
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -2
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/url-popover/link-viewer.js +1 -2
- package/build-module/components/url-popover/link-viewer.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +5 -5
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +0 -1
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -3
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -2
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +1 -3
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/video-player/index.native.js +1 -2
- package/build-module/components/video-player/index.native.js.map +1 -1
- package/build-module/components/warning/index.js +1 -2
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +1 -2
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/components/writing-flow/index.js +6 -6
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +20 -5
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/block-bindings.js +21 -12
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +2 -3
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +1 -2
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +0 -1
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -3
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +3 -5
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +1 -0
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +14 -14
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +42 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +1 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +5 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-align.js.map +1 -1
- package/build-module/hooks/typography.native.js +1 -2
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +1 -2
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +18 -19
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/constrained.js +1 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -3
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +1 -3
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +6 -38
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/private-actions.js +54 -7
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +9 -20
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +17 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +66 -20
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +9 -6
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/dom.js +16 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +3 -3
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/get-px-from-css-unit.js +1 -1
- package/build-module/utils/get-px-from-css-unit.js.map +1 -1
- package/build-module/utils/object.js +1 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +3 -2
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +19 -27
- package/build-style/content.css +19 -27
- package/build-style/style-rtl.css +47 -54
- package/build-style/style.css +47 -54
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +34 -33
- package/src/autocompleters/block.js +16 -7
- package/src/components/block-canvas/index.js +17 -1
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-card/index.js +3 -3
- package/src/components/block-full-height-alignment-control/index.js +1 -1
- package/src/components/block-inspector/style.scss +0 -6
- package/src/components/block-list/block.js +1 -2
- package/src/components/block-list/block.native.js +0 -4
- package/src/components/block-list/content.scss +4 -3
- package/src/components/block-list/index.js +4 -4
- package/src/components/block-list/use-block-props/index.js +0 -2
- package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +12 -4
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-list/zoom-out-separator.js +8 -6
- package/src/components/block-patterns-list/stories/fixtures.js +834 -0
- package/src/components/block-patterns-list/stories/index.story.js +81 -0
- package/src/components/block-patterns-list/style.scss +2 -0
- package/src/components/block-patterns-paging/index.js +1 -1
- package/src/components/block-popover/index.js +2 -2
- package/src/components/block-preview/auto.js +1 -4
- package/src/components/block-preview/index.js +2 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-settings-menu/index.js +3 -0
- package/src/components/block-toolbar/change-design.js +133 -0
- package/src/components/block-toolbar/index.js +25 -8
- package/src/components/block-toolbar/style.scss +16 -0
- package/src/components/block-tools/index.js +4 -28
- package/src/components/block-tools/insertion-point.js +4 -3
- package/src/components/block-tools/style.scss +0 -20
- package/src/components/block-tools/use-show-block-tools.js +2 -8
- package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/block-vertical-alignment-control/ui.js +11 -15
- package/src/components/border-radius-control/linked-button.js +9 -11
- package/src/components/collab/block-comment-icon-slot.js +12 -0
- package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
- package/src/components/convert-to-group-buttons/toolbar.js +4 -4
- package/src/components/global-styles/color-panel.js +2 -10
- package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
- package/src/components/global-styles/use-global-styles-context.native.js +6 -0
- package/src/components/iframe/content.scss +22 -32
- package/src/components/iframe/index.js +62 -15
- package/src/components/iframe/style.scss +17 -0
- package/src/components/image-size-control/index.js +74 -43
- package/src/components/image-size-control/test/index.js +5 -63
- package/src/components/inner-blocks/index.js +12 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -10
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +1 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +2 -3
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/category-tabs/index.js +17 -13
- package/src/components/inserter/menu.js +12 -5
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/style.scss +14 -41
- package/src/components/inserter-button/index.native.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +1 -6
- package/src/components/inspector-controls-tabs/utils.js +0 -3
- package/src/components/link-control/link-preview.js +15 -8
- package/src/components/link-control/search-input.js +4 -5
- package/src/components/link-control/search-results.js +2 -13
- package/src/components/link-control/test/index.js +147 -70
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/branch.js +8 -6
- package/src/components/list-view/index.js +1 -2
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/provider/index.js +1 -3
- package/src/components/provider/test/experimental-provider.js +43 -1
- package/src/components/responsive-block-control/style.scss +0 -1
- package/src/components/rich-text/event-listeners/index.js +4 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +5 -0
- package/src/components/spacing-sizes-control/index.js +3 -3
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/spacing-sizes-control/linked-button.js +2 -12
- package/src/components/tool-selector/index.js +6 -5
- package/src/components/url-input/index.js +1 -1
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/index.js +5 -5
- package/src/components/use-block-drop-zone/index.native.js +0 -1
- package/src/components/use-moving-animation/index.js +0 -1
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/components/use-settings/index.js +0 -1
- package/src/components/writing-flow/index.js +5 -3
- package/src/components/writing-flow/use-tab-nav.js +27 -4
- package/src/hooks/block-bindings.js +48 -31
- package/src/hooks/contrast-checker.js +0 -1
- package/src/hooks/duotone.js +2 -2
- package/src/hooks/grid-visualizer.js +23 -9
- package/src/hooks/layout-child.js +48 -3
- package/src/hooks/style.js +7 -3
- package/src/hooks/use-zoom-out.js +20 -24
- package/src/index.js +0 -1
- package/src/private-apis.js +6 -1
- package/src/store/actions.js +5 -53
- package/src/store/defaults.js +2 -1
- package/src/store/private-actions.js +71 -8
- package/src/store/private-selectors.js +9 -19
- package/src/store/reducer.js +25 -28
- package/src/store/selectors.js +82 -20
- package/src/store/test/actions.js +41 -0
- package/src/store/test/private-selectors.js +7 -1
- package/src/store/test/reducer.js +23 -0
- package/src/store/test/selectors.js +13 -2
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.js +9 -6
- package/src/utils/dom.js +22 -2
- package/src/utils/get-font-styles-and-weights.js +2 -2
- package/src/utils/test/use-block-bindings-utils.js +174 -0
- package/src/utils/transform-styles/index.js +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build/components/block-toolbar/shuffle.js +0 -110
- package/build/components/block-toolbar/shuffle.js.map +0 -1
- package/build/components/block-tools/zoom-out-popover.js +0 -57
- package/build/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -149
- package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build/components/block-vertical-alignment-control/icons.js +0 -48
- package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
- package/build-module/components/block-toolbar/shuffle.js +0 -103
- package/build-module/components/block-toolbar/shuffle.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-popover.js +0 -48
- package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -142
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
- package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
- package/src/components/block-toolbar/shuffle.js +0 -111
- package/src/components/block-tools/zoom-out-popover.js +0 -46
- package/src/components/block-tools/zoom-out-toolbar.js +0 -156
- package/src/components/block-vertical-alignment-control/icons.js +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_data","_store","_lockUnlock","useFlashEditableBlocks","clientId","isEnabled","getEnabledClientIdsTree","unlock","useSelect","blockEditorStore","useRefEffect","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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIO,SAASI,sBAAsBA,CAAE;EACvCC,QAAQ,GAAG,EAAE;EACbC,SAAS,GAAG;AACb,CAAC,GAAG,CAAC,CAAC,EAAG;EACR,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,eAAS,EAAEC,YAAiB,CAAE,CAAC;EAE3E,OAAO,IAAAC,qBAAY,EAChBC,OAAO,IAAM;IACd,IAAK,CAAEN,SAAS,EAAG;MAClB;IACD;IAEA,MAAMO,mBAAmB,GAAGA,CAAA,KAAM;MACjCN,uBAAuB,CAAEF,QAAS,CAAC,CAACS,OAAO,CAC1C,CAAE;QAAET,QAAQ,EAAEU;MAAG,CAAC,KAAM;QACvB,MAAMC,KAAK,GAAGJ,OAAO,CAACK,aAAa,
|
|
1
|
+
{"version":3,"names":["_compose","require","_data","_store","_lockUnlock","useFlashEditableBlocks","clientId","isEnabled","getEnabledClientIdsTree","unlock","useSelect","blockEditorStore","useRefEffect","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":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA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OAAO,EAAEP,WAAY,CAAC;IAChD,OAAO,MAAMV,OAAO,CAACkB,mBAAmB,CAAE,OAAO,EAAER,WAAY,CAAC;EACjE,CAAC,EACD,CAAEhB,SAAS,CACZ,CAAC;AACF","ignoreList":[]}
|
|
@@ -70,9 +70,7 @@ function useMovingAnimation({
|
|
|
70
70
|
} = (0, _element.useMemo)(() => ({
|
|
71
71
|
previous: ref.current && getAbsolutePosition(ref.current),
|
|
72
72
|
prevRect: ref.current && ref.current.getBoundingClientRect()
|
|
73
|
-
}),
|
|
74
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
-
[triggerAnimationOnChange]);
|
|
73
|
+
}), [triggerAnimationOnChange]);
|
|
76
74
|
(0, _element.useLayoutEffect)(() => {
|
|
77
75
|
if (!previous || !ref.current) {
|
|
78
76
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t
|
|
1
|
+
{"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AAC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sBAAsB,CAAC,CAAC;MACzB;IACD,CAAE,CAAC;IAEHpB,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACE,SAAS,GAAGC,SAAS;IACvC,MAAMC,WAAW,GAAGxD,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAEtD,MAAMmB,CAAC,GAAGQ,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACf,IAAI,GAAGoD,WAAW,CAACpD,IAAK,CAAC;IACxD,MAAMsC,CAAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;MACjBpB,UAAU,CAACqB,GAAG,CAAE;QAAEnB,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAE,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,CACFvB,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEczD,kBAAkB","ignoreList":[]}
|
|
@@ -42,10 +42,9 @@ function useResizeCanvas(deviceType) {
|
|
|
42
42
|
}
|
|
43
43
|
return deviceWidth < actualWidth ? deviceWidth : actualWidth;
|
|
44
44
|
};
|
|
45
|
-
const marginValue = () => window.innerHeight < 800 ? 36 : 64;
|
|
46
45
|
const contentInlineStyles = device => {
|
|
47
46
|
const height = device === 'Mobile' ? '768px' : '1024px';
|
|
48
|
-
const marginVertical =
|
|
47
|
+
const marginVertical = '40px';
|
|
49
48
|
const marginHorizontal = 'auto';
|
|
50
49
|
switch (device) {
|
|
51
50
|
case 'Tablet':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","useResizeCanvas","deviceType","actualWidth","updateActualWidth","useState","window","innerWidth","useEffect","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","
|
|
1
|
+
{"version":3,"names":["_element","require","useResizeCanvas","deviceType","actualWidth","updateActualWidth","useState","window","innerWidth","useEffect","resizeListener","addEventListener","removeEventListener","getCanvasWidth","device","deviceWidth","contentInlineStyles","height","marginVertical","marginHorizontal","width","marginTop","marginBottom","marginLeft","marginRight","overflowY"],"sources":["@wordpress/block-editor/src/components/use-resize-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\n/**\n * Function to resize the editor window.\n *\n * @param {string} deviceType Used for determining the size of the container (e.g. Desktop, Tablet, Mobile)\n *\n * @return {Object} Inline styles to be added to resizable container.\n */\nexport default function useResizeCanvas( deviceType ) {\n\tconst [ actualWidth, updateActualWidth ] = useState( window.innerWidth );\n\n\tuseEffect( () => {\n\t\tif ( deviceType === 'Desktop' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeListener = () => updateActualWidth( window.innerWidth );\n\t\twindow.addEventListener( 'resize', resizeListener );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'resize', resizeListener );\n\t\t};\n\t}, [ deviceType ] );\n\n\tconst getCanvasWidth = ( device ) => {\n\t\tlet deviceWidth;\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\t\tdeviceWidth = 780;\n\t\t\t\tbreak;\n\t\t\tcase 'Mobile':\n\t\t\t\tdeviceWidth = 360;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn null;\n\t\t}\n\n\t\treturn deviceWidth < actualWidth ? deviceWidth : actualWidth;\n\t};\n\n\tconst contentInlineStyles = ( device ) => {\n\t\tconst height = device === 'Mobile' ? '768px' : '1024px';\n\t\tconst marginVertical = '40px';\n\t\tconst marginHorizontal = 'auto';\n\n\t\tswitch ( device ) {\n\t\t\tcase 'Tablet':\n\t\t\tcase 'Mobile':\n\t\t\t\treturn {\n\t\t\t\t\twidth: getCanvasWidth( device ),\n\t\t\t\t\t// Keeping margin styles separate to avoid warnings\n\t\t\t\t\t// when those props get overridden in the iframe component\n\t\t\t\t\tmarginTop: marginVertical,\n\t\t\t\t\tmarginBottom: marginVertical,\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t\theight,\n\t\t\t\t\toverflowY: 'auto',\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn {\n\t\t\t\t\tmarginLeft: marginHorizontal,\n\t\t\t\t\tmarginRight: marginHorizontal,\n\t\t\t\t};\n\t\t}\n\t};\n\n\treturn contentInlineStyles( deviceType );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,eAAeA,CAAEC,UAAU,EAAG;EACrD,MAAM,CAAEC,WAAW,EAAEC,iBAAiB,CAAE,GAAG,IAAAC,iBAAQ,EAAEC,MAAM,CAACC,UAAW,CAAC;EAExE,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKN,UAAU,KAAK,SAAS,EAAG;MAC/B;IACD;IAEA,MAAMO,cAAc,GAAGA,CAAA,KAAML,iBAAiB,CAAEE,MAAM,CAACC,UAAW,CAAC;IACnED,MAAM,CAACI,gBAAgB,CAAE,QAAQ,EAAED,cAAe,CAAC;IAEnD,OAAO,MAAM;MACZH,MAAM,CAACK,mBAAmB,CAAE,QAAQ,EAAEF,cAAe,CAAC;IACvD,CAAC;EACF,CAAC,EAAE,CAAEP,UAAU,CAAG,CAAC;EAEnB,MAAMU,cAAc,GAAKC,MAAM,IAAM;IACpC,IAAIC,WAAW;IAEf,QAASD,MAAM;MACd,KAAK,QAAQ;QACZC,WAAW,GAAG,GAAG;QACjB;MACD,KAAK,QAAQ;QACZA,WAAW,GAAG,GAAG;QACjB;MACD;QACC,OAAO,IAAI;IACb;IAEA,OAAOA,WAAW,GAAGX,WAAW,GAAGW,WAAW,GAAGX,WAAW;EAC7D,CAAC;EAED,MAAMY,mBAAmB,GAAKF,MAAM,IAAM;IACzC,MAAMG,MAAM,GAAGH,MAAM,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ;IACvD,MAAMI,cAAc,GAAG,MAAM;IAC7B,MAAMC,gBAAgB,GAAG,MAAM;IAE/B,QAASL,MAAM;MACd,KAAK,QAAQ;MACb,KAAK,QAAQ;QACZ,OAAO;UACNM,KAAK,EAAEP,cAAc,CAAEC,MAAO,CAAC;UAC/B;UACA;UACAO,SAAS,EAAEH,cAAc;UACzBI,YAAY,EAAEJ,cAAc;UAC5BK,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL,gBAAgB;UAC7BF,MAAM;UACNQ,SAAS,EAAE;QACZ,CAAC;MACF;QACC,OAAO;UACNF,UAAU,EAAEJ,gBAAgB;UAC5BK,WAAW,EAAEL;QACd,CAAC;IACH;EACD,CAAC;EAED,OAAOH,mBAAmB,CAAEb,UAAW,CAAC;AACzC","ignoreList":[]}
|
|
@@ -36,9 +36,7 @@ function useSettings(...paths) {
|
|
|
36
36
|
const {
|
|
37
37
|
clientId = null
|
|
38
38
|
} = (0, _blockEdit.useBlockEditContext)();
|
|
39
|
-
return (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_store.store)).getBlockSettings(clientId, ...paths),
|
|
40
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
-
[clientId, ...paths]);
|
|
39
|
+
return (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_store.store)).getBlockSettings(clientId, ...paths), [clientId, ...paths]);
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_blockEdit","_store","_lockUnlock","useSettings","paths","clientId","useBlockEditContext","useSelect","select","unlock","blockEditorStore","getBlockSettings","useSetting","path","deprecated","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t
|
|
1
|
+
{"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_blockEdit","_store","_lockUnlock","useSettings","paths","clientId","useBlockEditContext","useSelect","select","unlock","blockEditorStore","getBlockSettings","useSetting","path","deprecated","since","alternative","note","value"],"sources":["@wordpress/block-editor/src/components/use-settings/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Hook that retrieves the given settings for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none are found, it'll look them up in the block editor settings.\n *\n * @param {string[]} paths The paths to the settings.\n * @return {any[]} Returns the values defined for the settings.\n * @example\n * ```js\n * const [ fixed, sticky ] = useSettings( 'position.fixed', 'position.sticky' );\n * ```\n */\nexport function useSettings( ...paths ) {\n\tconst { clientId = null } = useBlockEditContext();\n\treturn useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getBlockSettings(\n\t\t\t\tclientId,\n\t\t\t\t...paths\n\t\t\t),\n\t\t[ clientId, ...paths ]\n\t);\n}\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the setting first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor settings.\n *\n * @deprecated 6.5.0 Use useSettings instead.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport function useSetting( path ) {\n\tdeprecated( 'wp.blockEditor.useSetting', {\n\t\tsince: '6.5',\n\t\talternative: 'wp.blockEditor.useSettings',\n\t\tnote: 'The new useSettings function can retrieve multiple settings at once, with better performance.',\n\t} );\n\n\tconst [ value ] = useSettings( path );\n\treturn value;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAAE,GAAGC,KAAK,EAAG;EACvC,MAAM;IAAEC,QAAQ,GAAG;EAAK,CAAC,GAAG,IAAAC,8BAAmB,EAAC,CAAC;EACjD,OAAO,IAAAC,eAAS,EACbC,MAAM,IACP,IAAAC,kBAAM,EAAED,MAAM,CAAEE,YAAiB,CAAE,CAAC,CAACC,gBAAgB,CACpDN,QAAQ,EACR,GAAGD,KACJ,CAAC,EACF,CAAEC,QAAQ,EAAE,GAAGD,KAAK,CACrB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,UAAUA,CAAEC,IAAI,EAAG;EAClC,IAAAC,mBAAU,EAAE,2BAA2B,EAAE;IACxCC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE,4BAA4B;IACzCC,IAAI,EAAE;EACP,CAAE,CAAC;EAEH,MAAM,CAAEC,KAAK,CAAE,GAAGf,WAAW,CAAEU,IAAK,CAAC;EACrC,OAAOK,KAAK;AACb","ignoreList":[]}
|
|
@@ -39,13 +39,15 @@ function useWritingFlow() {
|
|
|
39
39
|
const hasMultiSelection = (0, _data.useSelect)(select => select(_store.store).hasMultiSelection(), []);
|
|
40
40
|
return [before, (0, _compose.useMergeRefs)([ref, (0, _useClipboardHandler.default)(), (0, _useInput.default)(), (0, _useDragSelection.default)(), (0, _useSelectionObserver.default)(), (0, _useClickSelection.default)(), (0, _useMultiSelection.default)(), (0, _useSelectAll.default)(), (0, _useArrowNav.default)(), (0, _compose.useRefEffect)(node => {
|
|
41
41
|
node.tabIndex = 0;
|
|
42
|
+
node.dataset.hasMultiSelection = hasMultiSelection;
|
|
42
43
|
if (!hasMultiSelection) {
|
|
43
|
-
return
|
|
44
|
+
return () => {
|
|
45
|
+
delete node.dataset.hasMultiSelection;
|
|
46
|
+
};
|
|
44
47
|
}
|
|
45
|
-
node.classList.add('has-multi-selection');
|
|
46
48
|
node.setAttribute('aria-label', (0, _i18n.__)('Multiple selected blocks'));
|
|
47
49
|
return () => {
|
|
48
|
-
node.
|
|
50
|
+
delete node.dataset.hasMultiSelection;
|
|
49
51
|
node.removeAttribute('aria-label');
|
|
50
52
|
};
|
|
51
53
|
}, [hasMultiSelection])]), after];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_i18n","_compose","_element","_useMultiSelection","_useTabNav","_useArrowNav","_useSelectAll","_useDragSelection","_useSelectionObserver","_useClickSelection","_useInput","_useClipboardHandler","_store","_jsxRuntime","useWritingFlow","before","ref","after","useTabNav","hasMultiSelection","useSelect","select","blockEditorStore","useMergeRefs","useClipboardHandler","useInput","useDragSelection","useSelectionObserver","useClickSelection","useMultiSelection","useSelectAll","useArrowNav","useRefEffect","node","tabIndex","
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_i18n","_compose","_element","_useMultiSelection","_useTabNav","_useArrowNav","_useSelectAll","_useDragSelection","_useSelectionObserver","_useClickSelection","_useInput","_useClipboardHandler","_store","_jsxRuntime","useWritingFlow","before","ref","after","useTabNav","hasMultiSelection","useSelect","select","blockEditorStore","useMergeRefs","useClipboardHandler","useInput","useDragSelection","useSelectionObserver","useClickSelection","useMultiSelection","useSelectAll","useArrowNav","useRefEffect","node","tabIndex","dataset","setAttribute","__","removeAttribute","WritingFlow","children","props","forwardedRef","jsxs","Fragment","jsx","className","clsx","_default","exports","default","forwardRef"],"sources":["@wordpress/block-editor/src/components/writing-flow/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useMultiSelection from './use-multi-selection';\nimport useTabNav from './use-tab-nav';\nimport useArrowNav from './use-arrow-nav';\nimport useSelectAll from './use-select-all';\nimport useDragSelection from './use-drag-selection';\nimport useSelectionObserver from './use-selection-observer';\nimport useClickSelection from './use-click-selection';\nimport useInput from './use-input';\nimport useClipboardHandler from './use-clipboard-handler';\nimport { store as blockEditorStore } from '../../store';\n\nexport function useWritingFlow() {\n\tconst [ before, ref, after ] = useTabNav();\n\tconst hasMultiSelection = useSelect(\n\t\t( select ) => select( blockEditorStore ).hasMultiSelection(),\n\t\t[]\n\t);\n\n\treturn [\n\t\tbefore,\n\t\tuseMergeRefs( [\n\t\t\tref,\n\t\t\tuseClipboardHandler(),\n\t\t\tuseInput(),\n\t\t\tuseDragSelection(),\n\t\t\tuseSelectionObserver(),\n\t\t\tuseClickSelection(),\n\t\t\tuseMultiSelection(),\n\t\t\tuseSelectAll(),\n\t\t\tuseArrowNav(),\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tnode.tabIndex = 0;\n\t\t\t\t\tnode.dataset.hasMultiSelection = hasMultiSelection;\n\n\t\t\t\t\tif ( ! hasMultiSelection ) {\n\t\t\t\t\t\treturn () => {\n\t\t\t\t\t\t\tdelete node.dataset.hasMultiSelection;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.setAttribute(\n\t\t\t\t\t\t'aria-label',\n\t\t\t\t\t\t__( 'Multiple selected blocks' )\n\t\t\t\t\t);\n\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tdelete node.dataset.hasMultiSelection;\n\t\t\t\t\t\tnode.removeAttribute( 'aria-label' );\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ hasMultiSelection ]\n\t\t\t),\n\t\t] ),\n\t\tafter,\n\t];\n}\n\nfunction WritingFlow( { children, ...props }, forwardedRef ) {\n\tconst [ before, ref, after ] = useWritingFlow();\n\treturn (\n\t\t<>\n\t\t\t{ before }\n\t\t\t<div\n\t\t\t\t{ ...props }\n\t\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tprops.className,\n\t\t\t\t\t'block-editor-writing-flow'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t\t{ after }\n\t\t</>\n\t);\n}\n\n/**\n * Handles selection and navigation across blocks. This component should be\n * wrapped around BlockList.\n *\n * @param {Object} props Component properties.\n * @param {Element} props.children Children to be rendered.\n */\nexport default forwardRef( WritingFlow );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,kBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,UAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,YAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,qBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,kBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,SAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,oBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAAwD,IAAAe,WAAA,GAAAf,OAAA;AAzBxD;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAYO,SAASgB,cAAcA,CAAA,EAAG;EAChC,MAAM,CAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,CAAE,GAAG,IAAAC,kBAAS,EAAC,CAAC;EAC1C,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IAAMA,MAAM,CAAEC,YAAiB,CAAC,CAACH,iBAAiB,CAAC,CAAC,EAC5D,EACD,CAAC;EAED,OAAO,CACNJ,MAAM,EACN,IAAAQ,qBAAY,EAAE,CACbP,GAAG,EACH,IAAAQ,4BAAmB,EAAC,CAAC,EACrB,IAAAC,iBAAQ,EAAC,CAAC,EACV,IAAAC,yBAAgB,EAAC,CA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,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAA+B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAOe,IAAAC,mBAAU,EAAEZ,WAAY,CAAC","ignoreList":[]}
|
|
@@ -28,14 +28,15 @@ function useTabNav() {
|
|
|
28
28
|
const {
|
|
29
29
|
hasMultiSelection,
|
|
30
30
|
getSelectedBlockClientId,
|
|
31
|
-
getBlockCount
|
|
32
|
-
|
|
31
|
+
getBlockCount,
|
|
32
|
+
getBlockOrder,
|
|
33
|
+
getLastFocus,
|
|
34
|
+
getSectionRootClientId,
|
|
35
|
+
isZoomOut
|
|
36
|
+
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
|
|
33
37
|
const {
|
|
34
38
|
setLastFocus
|
|
35
39
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
36
|
-
const {
|
|
37
|
-
getLastFocus
|
|
38
|
-
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
|
|
39
40
|
|
|
40
41
|
// Reference that holds the a flag for enabling or disabling
|
|
41
42
|
// capturing on the focus capture elements.
|
|
@@ -53,6 +54,20 @@ function useTabNav() {
|
|
|
53
54
|
// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.
|
|
54
55
|
container.current.querySelector(`[data-block="${getSelectedBlockClientId()}"]`).focus();
|
|
55
56
|
}
|
|
57
|
+
}
|
|
58
|
+
// In "compose" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.
|
|
59
|
+
else if (isZoomOut()) {
|
|
60
|
+
const sectionRootClientId = getSectionRootClientId();
|
|
61
|
+
const sectionBlocks = getBlockOrder(sectionRootClientId);
|
|
62
|
+
|
|
63
|
+
// If we have section within the section root, focus the first one.
|
|
64
|
+
if (sectionBlocks.length) {
|
|
65
|
+
container.current.querySelector(`[data-block="${sectionBlocks[0]}"]`).focus();
|
|
66
|
+
}
|
|
67
|
+
// If we don't have any section blocks, focus the section root.
|
|
68
|
+
else {
|
|
69
|
+
container.current.querySelector(`[data-block="${sectionRootClientId}"]`).focus();
|
|
70
|
+
}
|
|
56
71
|
} else {
|
|
57
72
|
const canvasElement = container.current.ownerDocument === event.target.ownerDocument ? container.current : container.current.ownerDocument.defaultView.frameElement;
|
|
58
73
|
const isBefore =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dom","require","_keycodes","_data","_compose","_element","_store","_dom2","_lockUnlock","_jsxRuntime","useTabNav","container","useRef","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","useSelect","blockEditorStore","setLastFocus","unlock","useDispatch","getLastFocus","noCaptureRef","onFocusCapture","event","current","focus","querySelector","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","length","next","before","jsx","ref","tabIndex","onFocus","after","useRefEffect","node","onKeyDown","defaultPrevented","keyCode","TAB","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","isInSameBlock","isInsideRootBlock","isFormElement","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs","useMergeRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =\n\t\tuseSelect( blockEditorStore );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\tconst { getLastFocus } = unlock( useSelect( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAd3C;AACA;AACA;;AAOA;AACA;AACA;;AAKe,SAASS,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC1B,MAAMC,qBAAqB,GAAG,IAAAD,eAAM,EAAC,CAAC;EACtC,MAAME,oBAAoB,GAAG,IAAAF,eAAM,EAAC,CAAC;EAErC,MAAM;IAAEG,iBAAiB;IAAEC,wBAAwB;IAAEC;EAAc,CAAC,GACnE,IAAAC,eAAS,EAAEC,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,CAACM,MAAO,CAAC;MAC1D;MACA,IACCA,MAAM,KAAKnB,qBAAqB,CAACc,OAAO,IACxCK,MAAM,KAAKlB,oBAAoB,CAACa,OAAO,EACtC;QACDD,KAAK,CAAC8C,cAAc,CAAC,CAAC;QACtBxC,MAAM,CAACJ,KAAK,CAAE;UAAEqC,aAAa,EAAE;QAAK,CAAE,CAAC;MACxC;IACD;IAEA,MAAM;MAAElC;IAAc,CAAC,GAAGmB,IAAI;IAC9B,MAAM;MAAEjB;IAAY,CAAC,GAAGF,aAAa;IACrCE,WAAW,CAACwC,gBAAgB,CAAE,SAAS,EAAEH,kBAAmB,CAAC;IAC7DpB,IAAI,CAACuB,gBAAgB,CAAE,SAAS,EAAEtB,SAAU,CAAC;IAC7CD,IAAI,CAACuB,gBAAgB,CAAE,UAAU,EAAEP,UAAW,CAAC;IAC/C,OAAO,MAAM;MACZjC,WAAW,CAACyC,mBAAmB,CAAE,SAAS,EAAEJ,kBAAmB,CAAC;MAChEpB,IAAI,CAACwB,mBAAmB,CAAE,SAAS,EAAEvB,SAAU,CAAC;MAChDD,IAAI,CAACwB,mBAAmB,CAAE,UAAU,EAAER,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAG,IAAAC,qBAAY,EAAE,CAAEjE,SAAS,EAAEkC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAEF,MAAM,EAAEgC,UAAU,EAAE3B,KAAK,CAAE;AACrC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_dom","require","_keycodes","_data","_compose","_element","_store","_dom2","_lockUnlock","_jsxRuntime","useTabNav","container","useRef","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","getBlockOrder","getLastFocus","getSectionRootClientId","isZoomOut","unlock","useSelect","blockEditorStore","setLastFocus","useDispatch","noCaptureRef","onFocusCapture","event","current","focus","querySelector","sectionRootClientId","sectionBlocks","length","canvasElement","ownerDocument","target","defaultView","frameElement","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","next","before","jsx","ref","tabIndex","onFocus","after","useRefEffect","node","onKeyDown","defaultPrevented","keyCode","TAB","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","isInSameBlock","isInsideRootBlock","isFormElement","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs","useMergeRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t\tgetBlockOrder,\n\t\tgetLastFocus,\n\t\tgetSectionRootClientId,\n\t\tisZoomOut,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t}\n\t\t// In \"compose\" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.\n\t\telse if ( isZoomOut() ) {\n\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\tconst sectionBlocks = getBlockOrder( sectionRootClientId );\n\n\t\t\t// If we have section within the section root, focus the first one.\n\t\t\tif ( sectionBlocks.length ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionBlocks[ 0 ] }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t\t// If we don't have any section blocks, focus the section root.\n\t\t\telse {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionRootClientId }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst canvasElement =\n\t\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t\t? container.current\n\t\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAd3C;AACA;AACA;;AAOA;AACA;AACA;;AAKe,SAASS,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAG,IAAAC,eAAM,EAAC,CAAC;EAC1B,MAAMC,qBAAqB,GAAG,IAAAD,eAAM,EAAC,CAAC;EACtC,MAAME,oBAAoB,GAAG,IAAAF,eAAM,EAAC,CAAC;EAErC,MAAM;IACLG,iBAAiB;IACj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C,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAG,IAAAC,qBAAY,EAAE,CAAEtE,SAAS,EAAEuC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAEF,MAAM,EAAEgC,UAAU,EAAE3B,KAAK,CAAE;AACrC","ignoreList":[]}
|
package/build/hooks/align.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_hooks","_blocks","_components","_useAvailableAlignments","_blockEditingMode","_jsxRuntime","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","_settings$attributes$","attributes","align","hasBlockSupport","type","enum","BlockEditAlignmentToolbarControlsPure","name","blockName","setAttributes","blockAllowedAlignments","getBlockSupport","useAvailableAlignments","map","blockEditingMode","useBlockEditingMode","length","updateAlignment","nextAlign","blockType","getBlockType","blockDefaultAlign","default","jsx","BlockControls","group","__experimentalShareWithChildBlocks","children","BlockAlignmentControl","onChange","controls","_default","exports","shareWithChildBlocks","edit","useBlockProps","addSaveProps","addAssignedAlign","attributeKeys","hasSupport","some","props","isAlignValid","className","clsx","addFilter"],"sources":["@wordpress/block-editor/src/hooks/align.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAlignmentToolbarControlsPure( {\n\tname: blockName,\n\talign,\n\tsetAttributes,\n} ) {\n\t// Compute the block valid alignments by taking into account,\n\t// if the theme supports wide alignments or not and the layout's\n\t// available alignments. We do that for conditionally rendering\n\t// Slot.\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( blockName, 'align' ),\n\t\thasBlockSupport( blockName, 'alignWide', true )\n\t);\n\n\tconst validAlignments = useAvailableAlignments(\n\t\tblockAllowedAlignments\n\t).map( ( { name } ) => name );\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst updateAlignment = ( nextAlign ) => {\n\t\tif ( ! nextAlign ) {\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\tnextAlign = '';\n\t\t\t}\n\t\t}\n\t\tsetAttributes( { align: nextAlign } );\n\t};\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<BlockAlignmentControl\n\t\t\t\tvalue={ align }\n\t\t\t\tonChange={ updateAlignment }\n\t\t\t\tcontrols={ validAlignments }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: BlockEditAlignmentToolbarControlsPure,\n\tuseBlockProps,\n\taddSaveProps: addAssignedAlign,\n\tattributeKeys: [ 'align' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'align', false );\n\t},\n};\n\nfunction useBlockProps( { name, align } ) {\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( name, 'align' ),\n\t\thasBlockSupport( name, 'alignWide', true )\n\t);\n\tconst validAlignments = useAvailableAlignments( blockAllowedAlignments );\n\n\tif ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {\n\t\treturn { 'data-align': align };\n\t}\n\n\treturn {};\n}\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = clsx( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/align/addAttribute',\n\taddAttribute\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AASA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAAuE,IAAAM,WAAA,GAAAN,OAAA;AApBvE;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMO,cAAc,GAAG,CAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAE;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,CAAE,MAAM,EA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C,YAAY,EAAG;IACnBD,KAAK,CAACE,SAAS,GAAG,IAAAC,aAAI,EAAG,QAAQ1C,KAAO,EAAC,EAAEuC,KAAK,CAACE,SAAU,CAAC;EAC7D;EAEA,OAAOF,KAAK;AACb;AAEA,IAAAI,gBAAS,EACR,0BAA0B,EAC1B,gCAAgC,EAChC/C,YACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_hooks","_blocks","_components","_useAvailableAlignments","_blockEditingMode","_jsxRuntime","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","_settings$attributes$","attributes","align","hasBlockSupport","type","enum","BlockEditAlignmentToolbarControlsPure","name","blockName","setAttributes","blockAllowedAlignments","getBlockSupport","useAvailableAlignments","map","blockEditingMode","useBlockEditingMode","length","updateAlignment","nextAlign","blockType","getBlockType","blockDefaultAlign","default","jsx","BlockControls","group","__experimentalShareWithChildBlocks","children","BlockAlignmentControl","onChange","controls","_default","exports","shareWithChildBlocks","edit","useBlockProps","addSaveProps","addAssignedAlign","attributeKeys","hasSupport","some","props","isAlignValid","className","clsx","addFilter"],"sources":["@wordpress/block-editor/src/hooks/align.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAlignmentToolbarControlsPure( {\n\tname: blockName,\n\talign,\n\tsetAttributes,\n} ) {\n\t// Compute the block valid alignments by taking into account,\n\t// if the theme supports wide alignments or not and the layout's\n\t// available alignments. We do that for conditionally rendering\n\t// Slot.\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( blockName, 'align' ),\n\t\thasBlockSupport( blockName, 'alignWide', true )\n\t);\n\n\tconst validAlignments = useAvailableAlignments(\n\t\tblockAllowedAlignments\n\t).map( ( { name } ) => name );\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst updateAlignment = ( nextAlign ) => {\n\t\tif ( ! nextAlign ) {\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\tnextAlign = '';\n\t\t\t}\n\t\t}\n\t\tsetAttributes( { align: nextAlign } );\n\t};\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<BlockAlignmentControl\n\t\t\t\tvalue={ align }\n\t\t\t\tonChange={ updateAlignment }\n\t\t\t\tcontrols={ validAlignments }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: BlockEditAlignmentToolbarControlsPure,\n\tuseBlockProps,\n\taddSaveProps: addAssignedAlign,\n\tattributeKeys: [ 'align' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'align', false );\n\t},\n};\n\nfunction useBlockProps( { name, align } ) {\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( name, 'align' ),\n\t\thasBlockSupport( name, 'alignWide', true )\n\t);\n\tconst validAlignments = useAvailableAlignments( blockAllowedAlignments );\n\n\tif ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {\n\t\treturn { 'data-align': align };\n\t}\n\n\treturn {};\n}\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = clsx( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/align/addAttribute',\n\taddAttribute\n);\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AASA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAAuE,IAAAM,WAAA,GAAAN,OAAA;AApBvE;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMO,cAAc,GAAG,CAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAE;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,CAAE,MAAM,EA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C,YAAY,EAAG;IACnBD,KAAK,CAACE,SAAS,GAAG,IAAAC,aAAI,EAAE,QAAS1C,KAAK,EAAG,EAAEuC,KAAK,CAACE,SAAU,CAAC;EAC7D;EAEA,OAAOF,KAAK;AACb;AAEA,IAAAI,gBAAS,EACR,0BAA0B,EAC1B,gCAAgC,EAChC/C,YACD,CAAC","ignoreList":[]}
|
|
@@ -15,6 +15,7 @@ var _useBindingsAttributes = require("../hooks/use-bindings-attributes");
|
|
|
15
15
|
var _lockUnlock = require("../lock-unlock");
|
|
16
16
|
var _inspectorControls = _interopRequireDefault(require("../components/inspector-controls"));
|
|
17
17
|
var _blockContext = _interopRequireDefault(require("../components/block-context"));
|
|
18
|
+
var _blockEdit = require("../components/block-edit");
|
|
18
19
|
var _blockBindings = require("../utils/block-bindings");
|
|
19
20
|
var _store = require("../store");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -27,7 +28,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
const {
|
|
30
|
-
|
|
31
|
+
Menu
|
|
31
32
|
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
32
33
|
const EMPTY_OBJECT = {};
|
|
33
34
|
const useToolsPanelDropdownMenuProps = () => {
|
|
@@ -45,17 +46,27 @@ function BlockBindingsPanelDropdown({
|
|
|
45
46
|
attribute,
|
|
46
47
|
binding
|
|
47
48
|
}) {
|
|
49
|
+
const {
|
|
50
|
+
clientId
|
|
51
|
+
} = (0, _blockEdit.useBlockEditContext)();
|
|
48
52
|
const registeredSources = (0, _blocks.getBlockBindingsSources)();
|
|
49
53
|
const {
|
|
50
54
|
updateBlockBindings
|
|
51
55
|
} = (0, _blockBindings.useBlockBindingsUtils)();
|
|
52
56
|
const currentKey = binding?.args?.key;
|
|
57
|
+
const attributeType = (0, _data.useSelect)(select => {
|
|
58
|
+
const {
|
|
59
|
+
name: blockName
|
|
60
|
+
} = select(_store.store).getBlock(clientId);
|
|
61
|
+
const _attributeType = (0, _blocks.getBlockType)(blockName).attributes?.[attribute]?.type;
|
|
62
|
+
return _attributeType === 'rich-text' ? 'string' : _attributeType;
|
|
63
|
+
}, [clientId, attribute]);
|
|
53
64
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
54
65
|
children: Object.entries(fieldsList).map(([name, fields], i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_element.Fragment, {
|
|
55
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
56
|
-
children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu.Group, {
|
|
67
|
+
children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.GroupLabel, {
|
|
57
68
|
children: registeredSources[name].label
|
|
58
|
-
}), Object.entries(fields).map(([key, args]) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
69
|
+
}), Object.entries(fields).filter(([, args]) => args?.type === attributeType).map(([key, args]) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(Menu.RadioItem, {
|
|
59
70
|
onChange: () => updateBlockBindings({
|
|
60
71
|
[attribute]: {
|
|
61
72
|
source: name,
|
|
@@ -67,13 +78,13 @@ function BlockBindingsPanelDropdown({
|
|
|
67
78
|
name: attribute + '-binding',
|
|
68
79
|
value: key,
|
|
69
80
|
checked: key === currentKey,
|
|
70
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemLabel, {
|
|
71
82
|
children: args?.label
|
|
72
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
83
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemHelpText, {
|
|
73
84
|
children: args?.value
|
|
74
85
|
})]
|
|
75
86
|
}, key))]
|
|
76
|
-
}), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
87
|
+
}), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Separator, {})]
|
|
77
88
|
}, name))
|
|
78
89
|
});
|
|
79
90
|
}
|
|
@@ -136,7 +147,7 @@ function EditableBlockBindingsPanelItems({
|
|
|
136
147
|
[attribute]: undefined
|
|
137
148
|
});
|
|
138
149
|
},
|
|
139
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
150
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu, {
|
|
140
151
|
placement: isMobile ? 'bottom-start' : 'left-start',
|
|
141
152
|
gutter: isMobile ? 8 : 36,
|
|
142
153
|
trigger: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_blocks","_components","_data","_element","_compose","_useBindingsAttributes","_lockUnlock","_inspectorControls","_interopRequireDefault","_blockContext","_blockBindings","_store","_jsxRuntime","DropdownMenuV2","unlock","componentsPrivateApis","EMPTY_OBJECT","useToolsPanelDropdownMenuProps","isMobile","useViewportMatch","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","registeredSources","getBlockBindingsSources","updateBlockBindings","useBlockBindingsUtils","currentKey","args","key","jsx","Fragment","children","Object","entries","map","name","fields","i","jsxs","Group","keys","length","GroupLabel","label","RadioItem","onChange","source","value","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","getBlockBindingsSource","isSourceInvalid","__experimentalVStack","className","spacing","__experimentalText","truncate","variant","isDestructive","__","ReadOnlyBlockBindingsPanelItems","bindings","__experimentalItem","EditableBlockBindingsPanelItems","attributes","__experimentalToolsPanelItem","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","blockName","metadata","blockContext","useContext","BlockContext","removeAllBlockBindings","bindableAttributes","getBindableAttributes","dropdownMenuProps","_fieldsList","canUpdateBlockBindings","useSelect","select","forEach","getFieldsList","usesContext","context","sourceList","values","blockEditorStore","getSettings","filteredBindings","canBindAttribute","readOnly","default","group","__experimentalToolsPanel","resetAll","__experimentalItemGroup","isBordered","isSeparated","exports","_default","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockBindingsSource,\n\tgetBlockBindingsSources,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, args ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\targs: { key },\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}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ args?.label }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t\t\t{ args?.value }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuV2.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding, fieldsList } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps = getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\" spacing={ 0 }>\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: fieldsList?.[ sourceName ]?.[ args?.key ]?.label ||\n\t\t\t\t\t\t sourceProps?.label ||\n\t\t\t\t\t\t sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings, fieldsList } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\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\t<DropdownMenuV2\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenuV2>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst blockContext = useContext( BlockContext );\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// `useSelect` is used purposely here to ensure `getFieldsList`\n\t// is updated whenever there are updates in block context.\n\t// `source.getFieldsList` may also call a selector via `select`.\n\tconst _fieldsList = {};\n\tconst { fieldsList, canUpdateBlockBindings } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\tconst registeredSources = getBlockBindingsSources();\n\t\t\tObject.entries( registeredSources ).forEach(\n\t\t\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\t\t\tif ( getFieldsList ) {\n\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\tconst context = {};\n\t\t\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\t\t\tif ( Object.keys( sourceList || {} ).length ) {\n\t\t\t\t\t\t\t_fieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tfieldsList:\n\t\t\t\t\tObject.values( _fieldsList ).length > 0\n\t\t\t\t\t\t? _fieldsList\n\t\t\t\t\t\t: EMPTY_OBJECT,\n\t\t\t\tcanUpdateBlockBindings:\n\t\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t\t.canUpdateBlockBindings,\n\t\t\t};\n\t\t},\n\t\t[ blockContext, bindableAttributes ]\n\t);\n\t// Return early if there are no bindable attributes.\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Filter bindings to only show bindable attributes and remove pattern overrides.\n\tconst { bindings } = metadata || {};\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</In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,uBAAS;QAAA1E,QAAA,eACT,IAAAxB,WAAA,CAAAsB,GAAA,EAACjC,WAAA,CAAAgE,kBAAI;UAACE,OAAO,EAAC,OAAO;UAAA/B,QAAA,EAClB,IAAAiC,QAAE,EACH,8DACD;QAAC,CACI;MAAC,CACG,CAAC;IAAA,CACD;EAAC,CACK,CAAC;AAEtB,CAAC;AAAC4C,OAAA,CAAAhC,kBAAA,GAAAA,kBAAA;AAAA,IAAAiC,QAAA,GAAAD,OAAA,CAAAP,OAAA,GAEa;EACdS,IAAI,EAAElC,kBAAkB;EACxBmC,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_blocks","_components","_data","_element","_compose","_useBindingsAttributes","_lockUnlock","_inspectorControls","_interopRequireDefault","_blockContext","_blockEdit","_blockBindings","_store","_jsxRuntime","Menu","unlock","componentsPrivateApis","EMPTY_OBJECT","useToolsPanelDropdownMenuProps","isMobile","useViewportMatch","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","clientId","useBlockEditContext","registeredSources","getBlockBindingsSources","updateBlockBindings","useBlockBindingsUtils","currentKey","args","key","attributeType","useSelect","select","name","blockName","blockEditorStore","getBlock","_attributeType","getBlockType","attributes","type","jsx","Fragment","children","Object","entries","map","fields","i","jsxs","Group","keys","length","GroupLabel","label","filter","RadioItem","onChange","source","value","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","getBlockBindingsSource","isSourceInvalid","__experimentalVStack","className","spacing","__experimentalText","truncate","variant","isDestructive","__","ReadOnlyBlockBindingsPanelItems","bindings","__experimentalItem","EditableBlockBindingsPanelItems","__experimentalToolsPanelItem","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","metadata","blockContext","useContext","BlockContext","removeAllBlockBindings","bindableAttributes","getBindableAttributes","dropdownMenuProps","_fieldsList","canUpdateBlockBindings","forEach","getFieldsList","usesContext","context","sourceList","values","getSettings","filteredBindings","canBindAttribute","readOnly","default","group","__experimentalToolsPanel","resetAll","__experimentalItemGroup","isBordered","isSeparated","exports","_default","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tgetBlockBindingsSource,\n\tgetBlockBindingsSources,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockEditContext } from '../components/block-edit';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nconst EMPTY_OBJECT = {};\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst { clientId } = useBlockEditContext();\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\tconst attributeType = useSelect(\n\t\t( select ) => {\n\t\t\tconst { name: blockName } =\n\t\t\t\tselect( blockEditorStore ).getBlock( clientId );\n\t\t\tconst _attributeType =\n\t\t\t\tgetBlockType( blockName ).attributes?.[ attribute ]?.type;\n\t\t\treturn _attributeType === 'rich-text' ? 'string' : _attributeType;\n\t\t},\n\t\t[ clientId, attribute ]\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<Menu.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</Menu.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields )\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t( [ , args ] ) => args?.type === attributeType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( [ key, args ] ) => (\n\t\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\t\t\t\t\t\t\t\t\t\t},\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\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t{ args?.label }\n\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ args?.value }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<Menu.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding, fieldsList } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps = getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\" spacing={ 0 }>\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: fieldsList?.[ sourceName ]?.[ args?.key ]?.label ||\n\t\t\t\t\t\t sourceProps?.label ||\n\t\t\t\t\t\t sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings, fieldsList } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\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\t<Menu\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Menu>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst blockContext = useContext( BlockContext );\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// `useSelect` is used purposely here to ensure `getFieldsList`\n\t// is updated whenever there are updates in block context.\n\t// `source.getFieldsList` may also call a selector via `select`.\n\tconst _fieldsList = {};\n\tconst { fieldsList, canUpdateBlockBindings } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\t\t\treturn EMPTY_OBJECT;\n\t\t\t}\n\t\t\tconst registeredSources = getBlockBindingsSources();\n\t\t\tObject.entries( registeredSources ).forEach(\n\t\t\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\t\t\tif ( getFieldsList ) {\n\t\t\t\t\t\t// Populate context.\n\t\t\t\t\t\tconst context = {};\n\t\t\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\t\t\tselect,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\t\t\tif ( Object.keys( sourceList || {} ).length ) {\n\t\t\t\t\t\t\t_fieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tfieldsList:\n\t\t\t\t\tObject.values( _fieldsList ).length > 0\n\t\t\t\t\t\t? _fieldsList\n\t\t\t\t\t\t: EMPTY_OBJECT,\n\t\t\t\tcanUpdateBlockBindings:\n\t\t\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t\t\t.canUpdateBlockBindings,\n\t\t\t};\n\t\t},\n\t\t[ blockContext, bindableAttributes ]\n\t);\n\t// Return early if there are no bindable attributes.\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Filter bindings to only show bindable attributes and remove pattern overrides.\n\tconst { bindings } = metadata || {};\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,sBAAA,GAAAN,OAAA;AAIA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,kBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,aAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAAqD,IAAAc,WAAA,GAAAd,OAAA;AAlCrD;AACA;AACA;;AAoBA;AACA;AACA;;AAYA,MAAM;EAAEe;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAMC,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAMC,8BAA8B,GAAGA,CAAA,KAAM;EAC5C,MAAMC,QAAQ,GAAG,IAAAC,yBAAgB,EAAE,QAAQ,EAAE,GAAI,CAAC;EAClD,OAAO,CAAED,QAAQ,GACd;IACAE,YAAY,EAAE;MACbC,SAAS,EAAE,YAAY;MACvB;MACA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AE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
@@ -159,7 +159,7 @@ function BlockHooksControlPure({
|
|
|
159
159
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
160
160
|
children: vendor
|
|
161
161
|
}), groupedHookedBlocks[vendor].map(block => {
|
|
162
|
-
const checked =
|
|
162
|
+
const checked = block.name in hookedBlockClientIds;
|
|
163
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
164
164
|
__nextHasNoMarginBottom: true,
|
|
165
165
|
checked: checked,
|