@wordpress/block-editor 15.23.0 → 16.0.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 +33 -0
- package/build/autocompleters/block.cjs +10 -2
- package/build/autocompleters/block.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +0 -2
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-canvas/index.cjs +6 -1
- package/build/components/block-canvas/index.cjs.map +2 -2
- package/build/components/block-controls/groups.cjs +3 -1
- package/build/components/block-controls/groups.cjs.map +2 -2
- package/build/components/block-edit/edit.cjs +10 -18
- package/build/components/block-edit/edit.cjs.map +2 -2
- package/build/components/block-inspector/edit-contents.cjs +3 -0
- package/build/components/block-inspector/edit-contents.cjs.map +3 -3
- package/build/components/block-inspector/index.cjs +2 -3
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block-invalid-warning.cjs +8 -19
- package/build/components/block-list/block-invalid-warning.cjs.map +2 -2
- package/build/components/block-list/block.cjs +9 -3
- package/build/components/block-list/block.cjs.map +3 -3
- package/build/components/block-list/index.cjs +1 -3
- package/build/components/block-list/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +3 -1
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-first-element.cjs +9 -4
- package/build/components/block-list/use-block-props/use-focus-first-element.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +12 -4
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
- package/build/components/block-styles/use-styles-for-block.cjs +2 -1
- package/build/components/block-styles/use-styles-for-block.cjs.map +2 -2
- package/build/components/block-title/use-block-display-title.cjs +7 -2
- package/build/components/block-title/use-block-display-title.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +10 -14
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +43 -24
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +7 -2
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +0 -1
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/modal.cjs +20 -6
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +16 -6
- package/build/components/block-visibility/use-block-visibility.cjs.map +3 -3
- package/build/components/block-visibility/utils.cjs +15 -2
- package/build/components/block-visibility/utils.cjs.map +3 -3
- package/build/components/block-visibility/viewport-menu-item.cjs +7 -1
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +5 -0
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +5 -1
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +0 -6
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +5 -5
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs +0 -1
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs +1 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +0 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/dimensions-tool/width-height-tool.cjs +2 -4
- package/build/components/dimensions-tool/width-height-tool.cjs.map +2 -2
- package/build/components/font-appearance-control/index.cjs +6 -25
- package/build/components/font-appearance-control/index.cjs.map +3 -3
- package/build/components/font-family/index.cjs +6 -15
- package/build/components/font-family/index.cjs.map +3 -3
- package/build/components/font-sizes/font-size-picker.cjs +1 -2
- package/build/components/font-sizes/font-size-picker.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +0 -1
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +0 -3
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +39 -3
- package/build/components/global-styles/state-control-badges.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +4 -11
- package/build/components/global-styles/typography-panel.cjs.map +2 -2
- package/build/components/height-control/index.cjs +0 -2
- package/build/components/height-control/index.cjs.map +2 -2
- package/build/components/html-element-control/index.cjs +0 -1
- package/build/components/html-element-control/index.cjs.map +2 -2
- package/build/components/image-editor/index.cjs +5 -0
- package/build/components/image-editor/index.cjs.map +3 -3
- package/build/components/image-editor/zoom-dropdown.cjs +0 -1
- package/build/components/image-editor/zoom-dropdown.cjs.map +2 -2
- package/build/components/image-size-control/index.cjs +3 -7
- package/build/components/image-size-control/index.cjs.map +2 -2
- package/build/components/inner-content/index.cjs +107 -0
- package/build/components/inner-content/index.cjs.map +7 -0
- package/build/components/inserter/hooks/use-block-types-state.cjs +10 -2
- package/build/components/inserter/hooks/use-block-types-state.cjs.map +2 -2
- package/build/components/inserter/media-tab/hooks.cjs +67 -12
- package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-list.cjs +3 -1
- package/build/components/inserter/media-tab/media-list.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-panel.cjs +287 -28
- package/build/components/inserter/media-tab/media-panel.cjs.map +3 -3
- package/build/components/inserter/media-tab/media-preview.cjs +32 -17
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-tab.cjs +26 -6
- package/build/components/inserter/media-tab/media-tab.cjs.map +2 -2
- package/build/components/inserter/mobile-tab-navigation.cjs +6 -1
- package/build/components/inserter/mobile-tab-navigation.cjs.map +2 -2
- package/build/components/inserter/no-results.cjs +2 -2
- package/build/components/inserter/no-results.cjs.map +2 -2
- package/build/components/inserter/preview-panel.cjs +2 -1
- package/build/components/inserter/preview-panel.cjs.map +2 -2
- package/build/components/inserter-list-item/index.cjs +8 -2
- package/build/components/inserter-list-item/index.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs +19 -11
- package/build/components/keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/letter-spacing-control/index.cjs +0 -24
- package/build/components/letter-spacing-control/index.cjs.map +3 -3
- package/build/components/line-height-control/index.cjs +6 -22
- package/build/components/line-height-control/index.cjs.map +3 -3
- package/build/components/list-view/block-select-button.cjs +90 -84
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +61 -21
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/expander.cjs +1 -1
- package/build/components/list-view/expander.cjs.map +2 -2
- package/build/components/list-view/use-list-view-client-ids.cjs +2 -2
- package/build/components/list-view/use-list-view-client-ids.cjs.map +2 -2
- package/build/components/media-placeholder/index.cjs +0 -1
- package/build/components/media-placeholder/index.cjs.map +2 -2
- package/build/components/observe-typing/index.cjs +4 -3
- package/build/components/observe-typing/index.cjs.map +2 -2
- package/build/components/preset-input-control/custom-value-controls.cjs +1 -3
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs +1 -3
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/resolution-tool/index.cjs +1 -2
- package/build/components/resolution-tool/index.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +3 -4
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +2 -3
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +3 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-events.cjs +3 -3
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +3 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs +2 -1
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +3 -3
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +66 -17
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/text-alignment-control/index.cjs +0 -1
- package/build/components/text-alignment-control/index.cjs.map +2 -2
- package/build/components/text-decoration-control/index.cjs +0 -1
- package/build/components/text-decoration-control/index.cjs.map +2 -2
- package/build/components/text-indent-control/index.cjs +0 -8
- package/build/components/text-indent-control/index.cjs.map +2 -2
- package/build/components/text-transform-control/index.cjs +0 -1
- package/build/components/text-transform-control/index.cjs.map +2 -2
- package/build/components/typewriter/index.cjs +129 -136
- package/build/components/typewriter/index.cjs.map +3 -3
- package/build/components/use-block-commands/index.cjs +21 -17
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +10 -8
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/use-on-block-drop/index.cjs +3 -7
- package/build/components/use-on-block-drop/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +12 -1
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs +18 -5
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-click-selection.cjs +2 -2
- package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-clipboard-handler.cjs +4 -1
- package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
- package/build/components/writing-flow/use-drag-selection.cjs +3 -8
- package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-editable-root.cjs +112 -0
- package/build/components/writing-flow/use-editable-root.cjs.map +7 -0
- package/build/components/writing-flow/use-home-end.cjs +64 -0
- package/build/components/writing-flow/use-home-end.cjs.map +7 -0
- package/build/components/writing-flow/use-input.cjs +15 -5
- package/build/components/writing-flow/use-input.cjs.map +2 -2
- package/build/components/writing-flow/use-multi-selection.cjs +2 -2
- package/build/components/writing-flow/use-multi-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-select-all.cjs +14 -2
- package/build/components/writing-flow/use-select-all.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +126 -20
- package/build/components/writing-flow/use-selection-observer.cjs.map +3 -3
- package/build/components/writing-flow/utils.cjs +39 -2
- package/build/components/writing-flow/utils.cjs.map +2 -2
- package/build/components/writing-mode-control/index.cjs +0 -1
- package/build/components/writing-mode-control/index.cjs.map +2 -2
- package/build/hooks/background.cjs +3 -2
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-fields/rich-text/index.cjs +2 -3
- package/build/hooks/block-fields/rich-text/index.cjs.map +3 -3
- package/build/hooks/elements.cjs +1 -1
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/font-size.cjs +1 -2
- package/build/hooks/font-size.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +5 -3
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +22 -12
- package/build/hooks/layout-child.cjs.map +3 -3
- package/build/hooks/layout.cjs +33 -16
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/position.cjs +36 -16
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/states.cjs +29 -12
- package/build/hooks/states.cjs.map +3 -3
- package/build/hooks/style.cjs +31 -9
- package/build/hooks/style.cjs.map +3 -3
- package/build/hooks/text-align.cjs +36 -6
- package/build/hooks/text-align.cjs.map +3 -3
- package/build/hooks/typography.cjs +1 -1
- package/build/hooks/typography.cjs.map +2 -2
- package/build/layouts/constrained.cjs +35 -27
- package/build/layouts/constrained.cjs.map +2 -2
- package/build/layouts/flex.cjs +27 -22
- package/build/layouts/flex.cjs.map +2 -2
- package/build/layouts/grid.cjs +51 -11
- package/build/layouts/grid.cjs.map +2 -2
- package/build/private-apis.cjs +4 -1
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +2 -2
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-keys.cjs +3 -0
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/private-selectors.cjs +85 -6
- package/build/store/private-selectors.cjs.map +3 -3
- package/build/store/selectors.cjs +13 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/block-bindings.cjs +29 -0
- package/build/utils/block-bindings.cjs.map +2 -2
- package/build/utils/dom.cjs +14 -0
- package/build/utils/dom.cjs.map +2 -2
- package/build-module/autocompleters/block.mjs +10 -2
- package/build-module/autocompleters/block.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +0 -2
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-canvas/index.mjs +7 -2
- package/build-module/components/block-canvas/index.mjs.map +2 -2
- package/build-module/components/block-controls/groups.mjs +3 -1
- package/build-module/components/block-controls/groups.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs +11 -18
- package/build-module/components/block-edit/edit.mjs.map +2 -2
- package/build-module/components/block-inspector/edit-contents.mjs +4 -1
- package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +2 -3
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block-invalid-warning.mjs +8 -19
- package/build-module/components/block-list/block-invalid-warning.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +9 -3
- package/build-module/components/block-list/block.mjs.map +3 -3
- package/build-module/components/block-list/index.mjs +1 -3
- package/build-module/components/block-list/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +3 -1
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs +9 -4
- package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +12 -4
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
- package/build-module/components/block-styles/use-styles-for-block.mjs +2 -1
- package/build-module/components/block-styles/use-styles-for-block.mjs.map +2 -2
- package/build-module/components/block-title/use-block-display-title.mjs +7 -2
- package/build-module/components/block-title/use-block-display-title.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +10 -14
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +43 -24
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +7 -2
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +0 -1
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +22 -10
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +17 -7
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +18 -3
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +7 -1
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +5 -0
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +5 -1
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +0 -6
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +5 -5
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs +0 -1
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +1 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +0 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/dimensions-tool/width-height-tool.mjs +2 -4
- package/build-module/components/dimensions-tool/width-height-tool.mjs.map +2 -2
- package/build-module/components/font-appearance-control/index.mjs +6 -15
- package/build-module/components/font-appearance-control/index.mjs.map +2 -2
- package/build-module/components/font-family/index.mjs +6 -15
- package/build-module/components/font-family/index.mjs.map +2 -2
- package/build-module/components/font-sizes/font-size-picker.mjs +1 -2
- package/build-module/components/font-sizes/font-size-picker.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +0 -1
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +0 -3
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +41 -5
- package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +4 -11
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/height-control/index.mjs +0 -2
- package/build-module/components/height-control/index.mjs.map +2 -2
- package/build-module/components/html-element-control/index.mjs +0 -1
- package/build-module/components/html-element-control/index.mjs.map +2 -2
- package/build-module/components/image-editor/index.mjs +5 -0
- package/build-module/components/image-editor/index.mjs.map +2 -2
- package/build-module/components/image-editor/zoom-dropdown.mjs +0 -1
- package/build-module/components/image-editor/zoom-dropdown.mjs.map +2 -2
- package/build-module/components/image-size-control/index.mjs +3 -7
- package/build-module/components/image-size-control/index.mjs.map +2 -2
- package/build-module/components/inner-content/index.mjs +82 -0
- package/build-module/components/inner-content/index.mjs.map +7 -0
- package/build-module/components/inserter/hooks/use-block-types-state.mjs +10 -2
- package/build-module/components/inserter/hooks/use-block-types-state.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/hooks.mjs +66 -12
- package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-list.mjs +3 -1
- package/build-module/components/inserter/media-tab/media-list.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-panel.mjs +297 -32
- package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs +33 -18
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-tab.mjs +27 -7
- package/build-module/components/inserter/media-tab/media-tab.mjs.map +2 -2
- package/build-module/components/inserter/mobile-tab-navigation.mjs +6 -1
- package/build-module/components/inserter/mobile-tab-navigation.mjs.map +2 -2
- package/build-module/components/inserter/no-results.mjs +2 -2
- package/build-module/components/inserter/no-results.mjs.map +2 -2
- package/build-module/components/inserter/preview-panel.mjs +2 -1
- package/build-module/components/inserter/preview-panel.mjs.map +2 -2
- package/build-module/components/inserter-list-item/index.mjs +8 -2
- package/build-module/components/inserter-list-item/index.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs +19 -11
- package/build-module/components/keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/letter-spacing-control/index.mjs +0 -14
- package/build-module/components/letter-spacing-control/index.mjs.map +2 -2
- package/build-module/components/line-height-control/index.mjs +6 -12
- package/build-module/components/line-height-control/index.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +90 -84
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +61 -21
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/expander.mjs +1 -1
- package/build-module/components/list-view/expander.mjs.map +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.mjs +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.mjs.map +2 -2
- package/build-module/components/media-placeholder/index.mjs +0 -1
- package/build-module/components/media-placeholder/index.mjs.map +2 -2
- package/build-module/components/observe-typing/index.mjs +4 -3
- package/build-module/components/observe-typing/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/custom-value-controls.mjs +1 -3
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +1 -3
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/resolution-tool/index.mjs +1 -2
- package/build-module/components/resolution-tool/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +8 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +7 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +8 -3
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +8 -5
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +8 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +64 -13
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/text-alignment-control/index.mjs +0 -1
- package/build-module/components/text-alignment-control/index.mjs.map +2 -2
- package/build-module/components/text-decoration-control/index.mjs +0 -1
- package/build-module/components/text-decoration-control/index.mjs.map +2 -2
- package/build-module/components/text-indent-control/index.mjs +0 -8
- package/build-module/components/text-indent-control/index.mjs.map +2 -2
- package/build-module/components/text-transform-control/index.mjs +0 -1
- package/build-module/components/text-transform-control/index.mjs.map +2 -2
- package/build-module/components/typewriter/index.mjs +129 -136
- package/build-module/components/typewriter/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +21 -17
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +10 -8
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/use-on-block-drop/index.mjs +4 -7
- package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +12 -1
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +19 -6
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-click-selection.mjs +2 -2
- package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs +5 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
- package/build-module/components/writing-flow/use-drag-selection.mjs +1 -6
- package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-editable-root.mjs +86 -0
- package/build-module/components/writing-flow/use-editable-root.mjs.map +7 -0
- package/build-module/components/writing-flow/use-home-end.mjs +43 -0
- package/build-module/components/writing-flow/use-home-end.mjs.map +7 -0
- package/build-module/components/writing-flow/use-input.mjs +15 -5
- package/build-module/components/writing-flow/use-input.mjs.map +2 -2
- package/build-module/components/writing-flow/use-multi-selection.mjs +2 -2
- package/build-module/components/writing-flow/use-multi-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-select-all.mjs +19 -3
- package/build-module/components/writing-flow/use-select-all.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +128 -19
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/components/writing-flow/utils.mjs +35 -1
- package/build-module/components/writing-flow/utils.mjs.map +2 -2
- package/build-module/components/writing-mode-control/index.mjs +0 -1
- package/build-module/components/writing-mode-control/index.mjs.map +2 -2
- package/build-module/hooks/background.mjs +3 -2
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/rich-text/index.mjs +2 -6
- package/build-module/hooks/block-fields/rich-text/index.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +1 -1
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/font-size.mjs +1 -2
- package/build-module/hooks/font-size.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +5 -3
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +22 -12
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +32 -16
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/position.mjs +38 -18
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/states.mjs +29 -12
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +40 -11
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/text-align.mjs +39 -10
- package/build-module/hooks/text-align.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +1 -1
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/constrained.mjs +35 -27
- package/build-module/layouts/constrained.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +27 -22
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +52 -11
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +5 -1
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +3 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +2 -0
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +84 -6
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +13 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/block-bindings.mjs +28 -0
- package/build-module/utils/block-bindings.mjs.map +2 -2
- package/build-module/utils/dom.mjs +13 -0
- package/build-module/utils/dom.mjs.map +2 -2
- package/build-style/content-rtl.css +15 -14
- package/build-style/content.css +15 -14
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +144 -47
- package/build-style/style.css +144 -47
- package/build-types/components/block-context/index.d.ts +7 -0
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/block-bindings.d.ts +19 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts +11 -0
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/get-px-from-css-unit.d.ts +2 -2
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -1
- package/build-types/utils/pasting.d.ts +1 -1
- package/build-types/utils/pasting.d.ts.map +1 -1
- package/package.json +46 -44
- package/src/autocompleters/block.js +10 -3
- package/src/autocompleters/test/block.js +53 -0
- package/src/components/background-image-control/index.js +0 -2
- package/src/components/block-canvas/index.js +9 -2
- package/src/components/block-card/style.scss +1 -1
- package/src/components/block-controls/groups.js +2 -0
- package/src/components/block-edit/edit.js +13 -31
- package/src/components/block-inspector/edit-contents.js +5 -1
- package/src/components/block-inspector/index.js +3 -2
- package/src/components/block-list/block-invalid-warning.js +8 -19
- package/src/components/block-list/block.js +6 -0
- package/src/components/block-list/index.js +0 -2
- package/src/components/block-list/use-block-props/index.js +2 -0
- package/src/components/block-list/use-block-props/use-focus-first-element.js +23 -4
- package/src/components/block-list/use-block-props/use-focus-handler.js +34 -9
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-manager/style.scss +1 -1
- package/src/components/block-navigation/style.scss +1 -1
- package/src/components/block-patterns-list/stories/index.story.jsx +1 -1
- package/src/components/block-quick-navigation/style.scss +1 -3
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-styles/use-styles-for-block.js +1 -0
- package/src/components/block-title/use-block-display-title.js +7 -2
- package/src/components/block-toolbar/block-toolbar-icon.js +11 -16
- package/src/components/block-toolbar/index.js +41 -18
- package/src/components/block-toolbar/test/block-toolbar-icon.js +32 -9
- package/src/components/block-tools/index.js +7 -0
- package/src/components/block-types-list/style.scss +0 -1
- package/src/components/block-variation-transforms/index.js +0 -1
- package/src/components/block-visibility/modal.js +24 -10
- package/src/components/block-visibility/style.scss +1 -1
- package/src/components/block-visibility/test/use-block-visibility.js +128 -35
- package/src/components/block-visibility/test/utils.js +11 -0
- package/src/components/block-visibility/use-block-visibility.js +33 -11
- package/src/components/block-visibility/utils.js +31 -6
- package/src/components/block-visibility/viewport-menu-item.js +10 -1
- package/src/components/block-visibility/viewport-toolbar.js +6 -0
- package/src/components/block-visibility/viewport-visibility-info.js +5 -1
- package/src/components/button-block-appender/content.scss +1 -7
- package/src/components/child-layout-control/index.js +0 -6
- package/src/components/color-palette/test/__snapshots__/control.js.snap +13 -108
- package/src/components/colors-gradients/control.js +4 -4
- package/src/components/colors-gradients/style.scss +2 -2
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/dimensions-tool/aspect-ratio-tool.js +0 -1
- package/src/components/dimensions-tool/scale-tool.js +0 -1
- package/src/components/dimensions-tool/width-height-tool.js +0 -2
- package/src/components/font-appearance-control/index.js +6 -19
- package/src/components/font-family/README.md +0 -9
- package/src/components/font-family/index.js +6 -19
- package/src/components/font-family/stories/index.story.jsx +1 -2
- package/src/components/font-sizes/font-size-picker.js +0 -1
- package/src/components/global-styles/border-panel.js +0 -1
- package/src/components/global-styles/dimensions-panel.js +0 -3
- package/src/components/global-styles/state-control-badges.js +45 -6
- package/src/components/global-styles/style.scss +5 -0
- package/src/components/global-styles/test/state-control-badges.js +65 -0
- package/src/components/global-styles/typography-panel.js +0 -7
- package/src/components/height-control/index.js +0 -2
- package/src/components/html-element-control/index.js +0 -1
- package/src/components/iframe/content.scss +3 -3
- package/src/components/image-editor/index.js +22 -0
- package/src/components/image-editor/zoom-dropdown.js +0 -1
- package/src/components/image-size-control/index.js +0 -4
- package/src/components/inner-content/index.js +119 -0
- package/src/components/inner-content/test/index.js +81 -0
- package/src/components/inserter/hooks/use-block-types-state.js +10 -2
- package/src/components/inserter/media-tab/hooks.js +114 -16
- package/src/components/inserter/media-tab/media-list.js +2 -0
- package/src/components/inserter/media-tab/media-panel.js +354 -19
- package/src/components/inserter/media-tab/media-preview.js +34 -17
- package/src/components/inserter/media-tab/media-tab.js +20 -2
- package/src/components/inserter/media-tab/test/hooks.js +267 -0
- package/src/components/inserter/media-tab/test/media-panel.js +127 -0
- package/src/components/inserter/mobile-tab-navigation.js +6 -1
- package/src/components/inserter/no-results.js +2 -2
- package/src/components/inserter/preview-panel.js +1 -0
- package/src/components/inserter/style.scss +115 -3
- package/src/components/inserter-list-item/index.js +8 -2
- package/src/components/inserter-list-item/style.scss +0 -15
- package/src/components/keyboard-shortcuts/index.js +28 -11
- package/src/components/letter-spacing-control/README.md +0 -8
- package/src/components/letter-spacing-control/index.js +5 -23
- package/src/components/letter-spacing-control/stories/index.story.jsx +0 -12
- package/src/components/line-height-control/README.md +0 -8
- package/src/components/line-height-control/index.js +6 -16
- package/src/components/line-height-control/stories/index.story.jsx +0 -1
- package/src/components/line-height-control/test/index.js +1 -7
- package/src/components/link-control/style.scss +2 -2
- package/src/components/link-control/test/index.js +6 -6
- package/src/components/link-picker/style.scss +1 -2
- package/src/components/link-picker/test/index.js +3 -1
- package/src/components/list-view/block-select-button.js +5 -1
- package/src/components/list-view/block.js +69 -23
- package/src/components/list-view/expander.js +5 -1
- package/src/components/list-view/style.scss +23 -5
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/media-placeholder/index.js +0 -1
- package/src/components/multi-selection-inspector/style.scss +1 -1
- package/src/components/observe-typing/index.js +9 -4
- package/src/components/preset-input-control/custom-value-controls.js +0 -2
- package/src/components/preset-input-control/index.js +0 -2
- package/src/components/resolution-tool/index.js +0 -1
- package/src/components/responsive-block-control/style.scss +1 -1
- package/src/components/responsive-block-control/test/index.js +1 -5
- package/src/components/rich-text/event-listeners/before-input-rules.js +8 -5
- package/src/components/rich-text/event-listeners/delete.js +7 -4
- package/src/components/rich-text/event-listeners/enter.js +10 -4
- package/src/components/rich-text/event-listeners/input-events.js +4 -3
- package/src/components/rich-text/event-listeners/input-rules.js +8 -5
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +4 -3
- package/src/components/rich-text/event-listeners/paste-handler.js +15 -3
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +4 -3
- package/src/components/rich-text/event-listeners/shortcuts.js +4 -3
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +4 -3
- package/src/components/rich-text/index.js +94 -25
- package/src/components/skip-to-selected-block/style.scss +1 -1
- package/src/components/text-alignment-control/index.js +0 -1
- package/src/components/text-decoration-control/index.js +0 -1
- package/src/components/text-indent-control/index.js +7 -16
- package/src/components/text-transform-control/index.js +0 -1
- package/src/components/typewriter/index.js +228 -224
- package/src/components/use-block-commands/index.js +27 -17
- package/src/components/use-block-display-information/index.js +9 -13
- package/src/components/use-block-display-information/test/index.js +47 -9
- package/src/components/use-on-block-drop/index.js +4 -7
- package/src/components/writing-flow/index.js +15 -1
- package/src/components/writing-flow/use-arrow-nav.js +39 -12
- package/src/components/writing-flow/use-click-selection.js +2 -3
- package/src/components/writing-flow/use-clipboard-handler.js +5 -2
- package/src/components/writing-flow/use-drag-selection.js +1 -14
- package/src/components/writing-flow/use-editable-root.js +182 -0
- package/src/components/writing-flow/use-home-end.js +63 -0
- package/src/components/writing-flow/use-input.js +25 -8
- package/src/components/writing-flow/use-multi-selection.js +2 -3
- package/src/components/writing-flow/use-select-all.js +33 -3
- package/src/components/writing-flow/use-selection-observer.js +197 -38
- package/src/components/writing-flow/utils.js +83 -0
- package/src/components/writing-mode-control/index.js +0 -1
- package/src/hooks/background.js +7 -9
- package/src/hooks/block-fields/link/styles.scss +1 -6
- package/src/hooks/block-fields/media/styles.scss +1 -6
- package/src/hooks/block-fields/rich-text/index.js +6 -9
- package/src/hooks/block-hooks.scss +15 -0
- package/src/hooks/elements.js +0 -1
- package/src/hooks/font-size.js +0 -1
- package/src/hooks/grid-visualizer.js +40 -36
- package/src/hooks/layout-child.js +19 -9
- package/src/hooks/layout.js +53 -35
- package/src/hooks/position.js +44 -23
- package/src/hooks/states.js +36 -13
- package/src/hooks/style.js +67 -17
- package/src/hooks/test/cross-origin-isolation.js +0 -4
- package/src/hooks/test/layout.js +75 -1
- package/src/hooks/test/style.js +29 -0
- package/src/hooks/test/text-align.js +34 -1
- package/src/hooks/text-align.js +41 -10
- package/src/hooks/typography.js +0 -1
- package/src/layouts/constrained.js +56 -29
- package/src/layouts/flex.js +5 -4
- package/src/layouts/grid.js +59 -9
- package/src/layouts/test/constrained.js +91 -0
- package/src/layouts/test/grid.js +71 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +43 -14
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +166 -9
- package/src/store/selectors.js +41 -0
- package/src/store/test/actions.js +1 -1
- package/src/store/test/private-selectors.js +533 -0
- package/src/store/test/reducer.js +11 -11
- package/src/store/test/selectors.js +133 -0
- package/src/style.scss +1 -0
- package/src/utils/block-bindings.ts +50 -0
- package/src/utils/dom.ts +33 -0
- package/src/utils/test/block-bindings.js +181 -0
- package/build/components/rich-text/input-event.cjs +0 -50
- package/build/components/rich-text/input-event.cjs.map +0 -7
- package/build/components/rich-text/shortcut.cjs +0 -51
- package/build/components/rich-text/shortcut.cjs.map +0 -7
- package/build-module/components/rich-text/input-event.mjs +0 -25
- package/build-module/components/rich-text/input-event.mjs.map +0 -7
- package/build-module/components/rich-text/shortcut.mjs +0 -26
- package/build-module/components/rich-text/shortcut.mjs.map +0 -7
- package/src/components/rich-text/input-event.js +0 -31
- package/src/components/rich-text/shortcut.js +0 -32
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/block-list/use-block-props/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled, useRefEffect } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport {\n\tblockBindingsKey,\n\tuseBlockEditContext,\n} from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { useScrollIntoView } from './use-scroll-into-view';\nimport { useFlashEditableBlocks } from '../../use-flash-editable-blocks';\nimport { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';\nimport { useBlockVisibility } from '../../block-visibility/';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps( {\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * } )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisEditingContentOnlySection,\n\t\tdefaultClassName,\n\t\tisSectionBlock,\n\t\tisWithinSectionBlock,\n\t\tcanMove,\n\t\tblockVisibility,\n\t\tdeviceType,\n\t} = useContext( PrivateBlockContext );\n\n\tconst defaultViewRef = useRefEffect( ( element ) => {\n\t\tif ( element ) {\n\t\t\tconst { ownerDocument } = element;\n\t\t\tconst { defaultView } = ownerDocument;\n\t\t\tdefaultViewRef.current = defaultView;\n\t\t}\n\t}, [] );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst ffDragRef = useFirefoxDraggableCompatibility();\n\tconst isHoverEnabled = ! isWithinSectionBlock;\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tdefaultViewRef,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseIsHovered( { isEnabled: isHoverEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t\tuseFlashEditableBlocks( {\n\t\t\tclientId,\n\t\t\tisEnabled: isSectionBlock,\n\t\t} ),\n\t\tuseScrollIntoView( { isSelected } ),\n\t\tcanMove ? ffDragRef : undefined,\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\tconst hasBlockBindings = !! blockEditContext[ blockBindingsKey ];\n\tconst bindingsStyle = hasBlockBindings\n\t\t? {\n\t\t\t\t'--wp-admin-theme-color': 'var(--wp-block-synced-color)',\n\t\t\t\t'--wp-admin-theme-color--rgb':\n\t\t\t\t\t'var(--wp-block-synced-color--rgb)',\n\t\t }\n\t\t: {};\n\n\t// Use block visibility hook with data from context to avoid extra subscription.\n\tconst { isBlockCurrentlyHidden } = useBlockVisibility( {\n\t\tblockVisibility,\n\t\tdeviceType,\n\t\tview: defaultViewRef.current,\n\t} );\n\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\tlet hasNegativeMargin = false;\n\tif (\n\t\twrapperProps?.style?.marginTop?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginBottom?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginLeft?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginRight?.charAt( 0 ) === '-'\n\t) {\n\t\thasNegativeMargin = true;\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\tdraggable: canMove && ! hasChildSelected ? true : undefined,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: clsx(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'has-editable-outline': hasEditableOutline,\n\t\t\t\t'has-negative-margin': hasNegativeMargin,\n\t\t\t\t'is-editing-content-only-section': isEditingContentOnlySection,\n\t\t\t\t'is-block-hidden': isBlockCurrentlyHidden,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style, ...bindingsStyle },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA2B;AAC3B,kBAA4B;AAC5B,oBAAyD;AACzD,qBAAwD;AACxD,qBAAoB;AAKpB,kCAA+B;AAC/B,mCAAoC;AACpC,qCAAqC;AACrC,4BAA6B;AAC7B,qBAGO;AACP,+BAAgC;AAChC,+CAAiC;AACjC,4BAAoC;AACpC,uCAAwC;AACxC,kCAAkC;AAClC,uCAAuC;AACvC,iDAAiD;AACjD,8BAAmC;AA4C5B,SAAS,cAAe,QAAQ,CAAC,GAAG,EAAE,iBAAiB,IAAI,CAAC,GAAI;AACtE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,eAAe,CAAC;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,2BAAY,gDAAoB;AAEpC,QAAM,qBAAiB,6BAAc,CAAE,YAAa;AACnD,QAAK,SAAU;AACd,YAAM,EAAE,cAAc,IAAI;AAC1B,YAAM,EAAE,YAAY,IAAI;AACxB,qBAAe,UAAU;AAAA,IAC1B;AAAA,EACD,GAAG,CAAC,CAAE;AAGN,QAAM,iBAAa,yBAAS,gBAAI,WAAY,GAAG,UAAW;AAC1D,QAAM,aAAa,SAAS,UAAU,CAAE,mBAAmB,YAAY;AACvE,QAAM,gBAAY,6EAAiC;AACnD,QAAM,iBAAiB,CAAE;AACzB,QAAM,iBAAa,6BAAc;AAAA,IAChC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A,IACH,KAAK;AAAA,IACL,IAAI,SAAU,QAAS,GAAI,UAAW;AAAA,IACtC,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc;AAAA,IACd,aAAa;AAAA,IACb,cAAc;AAAA,IACd,OAAO,oBAAoB,SAAS;AAAA,IACpC,eAAW,YAAAC;AAAA,MACV;AAAA,MACA;AAAA;AAAA,QAEC,YAAY,CAAE;AAAA,QACd,qBAAqB;AAAA,QACrB,eAAe;AAAA,QACf,kBAAkB;AAAA,QAClB,qBAAqB;AAAA,QACrB,yBAAyB;AAAA,QACzB,eAAe;AAAA,QACf,eAAe;AAAA,QACf,sBAAsB;AAAA,QACtB,uBAAuB;AAAA,QACvB,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,mCAAmC;AAAA,QACnC,mBAAmB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,aAAa;AAAA,MACb;AAAA,IACD;AAAA,IACA,OAAO,EAAE,GAAG,aAAa,OAAO,GAAG,MAAM,OAAO,GAAG,cAAc;AAAA,EAClE;AACD;AAOA,cAAc,OAAO,cAAAC;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableGetBlockProps as getBlockProps } from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled, useRefEffect } from '@wordpress/compose';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { PrivateBlockContext } from '../private-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport {\n\tblockBindingsKey,\n\tuseBlockEditContext,\n} from '../../block-edit/context';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { useScrollIntoView } from './use-scroll-into-view';\nimport { useFlashEditableBlocks } from '../../use-flash-editable-blocks';\nimport { useFirefoxDraggableCompatibility } from './use-firefox-draggable-compatibility';\nimport { useBlockVisibility } from '../../block-visibility/';\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps( {\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * } )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisSelected,\n\t\tisSubtreeDisabled,\n\t\thasOverlay,\n\t\tinitialPosition,\n\t\tblockEditingMode,\n\t\tisHighlighted,\n\t\tisMultiSelected,\n\t\tisPartiallySelected,\n\t\tisReusable,\n\t\tisDragging,\n\t\thasChildSelected,\n\t\tisEditingDisabled,\n\t\thasEditableOutline,\n\t\tisEditingContentOnlySection,\n\t\tdefaultClassName,\n\t\tisSectionBlock,\n\t\tisWithinSectionBlock,\n\t\tcanMove,\n\t\tblockVisibility,\n\t\tdeviceType,\n\t\tviewportSettings,\n\t} = useContext( PrivateBlockContext );\n\n\tconst defaultViewRef = useRefEffect( ( element ) => {\n\t\tif ( element ) {\n\t\t\tconst { ownerDocument } = element;\n\t\t\tconst { defaultView } = ownerDocument;\n\t\t\tdefaultViewRef.current = defaultView;\n\t\t}\n\t}, [] );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst ffDragRef = useFirefoxDraggableCompatibility();\n\tconst isHoverEnabled = ! isWithinSectionBlock;\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tdefaultViewRef,\n\t\tuseFocusFirstElement( { clientId, initialPosition } ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( { clientId, isSelected } ),\n\t\tuseIsHovered( { isEnabled: isHoverEnabled } ),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( { triggerAnimationOnChange: index, clientId } ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t\tuseFlashEditableBlocks( {\n\t\t\tclientId,\n\t\t\tisEnabled: isSectionBlock,\n\t\t} ),\n\t\tuseScrollIntoView( { isSelected } ),\n\t\tcanMove ? ffDragRef : undefined,\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\tconst hasBlockBindings = !! blockEditContext[ blockBindingsKey ];\n\tconst bindingsStyle = hasBlockBindings\n\t\t? {\n\t\t\t\t'--wp-admin-theme-color': 'var(--wp-block-synced-color)',\n\t\t\t\t'--wp-admin-theme-color--rgb':\n\t\t\t\t\t'var(--wp-block-synced-color--rgb)',\n\t\t }\n\t\t: {};\n\n\t// Use block visibility hook with data from context to avoid extra subscription.\n\tconst { isBlockCurrentlyHidden } = useBlockVisibility( {\n\t\tblockVisibility,\n\t\tdeviceType,\n\t\tviewportSettings,\n\t\tview: defaultViewRef.current,\n\t} );\n\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\tlet hasNegativeMargin = false;\n\tif (\n\t\twrapperProps?.style?.marginTop?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginBottom?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginLeft?.charAt( 0 ) === '-' ||\n\t\twrapperProps?.style?.marginRight?.charAt( 0 ) === '-'\n\t) {\n\t\thasNegativeMargin = true;\n\t}\n\n\treturn {\n\t\ttabIndex: blockEditingMode === 'disabled' ? -1 : 0,\n\t\tdraggable: canMove && ! hasChildSelected ? true : undefined,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: clsx(\n\t\t\t'block-editor-block-list__block',\n\t\t\t{\n\t\t\t\t// The wp-block className is important for editor styles.\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isHighlighted,\n\t\t\t\t'is-multi-selected': isMultiSelected,\n\t\t\t\t'is-partially-selected': isPartiallySelected,\n\t\t\t\t'is-reusable': isReusable,\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': hasChildSelected,\n\t\t\t\t'is-editing-disabled': isEditingDisabled,\n\t\t\t\t'has-editable-outline': hasEditableOutline,\n\t\t\t\t'has-negative-margin': hasNegativeMargin,\n\t\t\t\t'is-editing-content-only-section': isEditingContentOnlySection,\n\t\t\t\t'is-block-hidden': isBlockCurrentlyHidden,\n\t\t\t},\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tdefaultClassName\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style, ...bindingsStyle },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA2B;AAC3B,kBAA4B;AAC5B,oBAAyD;AACzD,qBAAwD;AACxD,qBAAoB;AAKpB,kCAA+B;AAC/B,mCAAoC;AACpC,qCAAqC;AACrC,4BAA6B;AAC7B,qBAGO;AACP,+BAAgC;AAChC,+CAAiC;AACjC,4BAAoC;AACpC,uCAAwC;AACxC,kCAAkC;AAClC,uCAAuC;AACvC,iDAAiD;AACjD,8BAAmC;AA4C5B,SAAS,cAAe,QAAQ,CAAC,GAAG,EAAE,iBAAiB,IAAI,CAAC,GAAI;AACtE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,eAAe,CAAC;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,2BAAY,gDAAoB;AAEpC,QAAM,qBAAiB,6BAAc,CAAE,YAAa;AACnD,QAAK,SAAU;AACd,YAAM,EAAE,cAAc,IAAI;AAC1B,YAAM,EAAE,YAAY,IAAI;AACxB,qBAAe,UAAU;AAAA,IAC1B;AAAA,EACD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AAQ,CAAE,MAAM,OACjD,cAAc,OAAO,aAAa,OAAQ,CAAE,MAAM,KACjD;AACD,wBAAoB;AAAA,EACrB;AAEA,SAAO;AAAA,IACN,UAAU,qBAAqB,aAAa,KAAK;AAAA,IACjD,WAAW,WAAW,CAAE,mBAAmB,OAAO;AAAA,IAClD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,KAAK;AAAA,IACL,IAAI,SAAU,QAAS,GAAI,UAAW;AAAA,IACtC,MAAM;AAAA,IACN,cAAc;AAAA,IACd,cAAc;AAAA,IACd,aAAa;AAAA,IACb,cAAc;AAAA,IACd,OAAO,oBAAoB,SAAS;AAAA,IACpC,eAAW,YAAAC;AAAA,MACV;AAAA,MACA;AAAA;AAAA,QAEC,YAAY,CAAE;AAAA,QACd,qBAAqB;AAAA,QACrB,eAAe;AAAA,QACf,kBAAkB;AAAA,QAClB,qBAAqB;AAAA,QACrB,yBAAyB;AAAA,QACzB,eAAe;AAAA,QACf,eAAe;AAAA,QACf,sBAAsB;AAAA,QACtB,uBAAuB;AAAA,QACvB,wBAAwB;AAAA,QACxB,uBAAuB;AAAA,QACvB,mCAAmC;AAAA,QACnC,mBAAmB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,MAAM;AAAA,MACN,aAAa;AAAA,MACb;AAAA,IACD;AAAA,IACA,OAAO,EAAE,GAAG,aAAa,OAAO,GAAG,MAAM,OAAO,GAAG,cAAc;AAAA,EAClE;AACD;AAOA,cAAc,OAAO,cAAAC;",
|
|
6
6
|
"names": ["useMovingAnimation", "warning", "clsx", "getBlockProps"]
|
|
7
7
|
}
|
|
@@ -31,9 +31,7 @@ var import_store = require("../../../store/index.cjs");
|
|
|
31
31
|
var import_lock_unlock = require("../../../lock-unlock.cjs");
|
|
32
32
|
function useFocusFirstElement({ clientId, initialPosition }) {
|
|
33
33
|
const ref = (0, import_element.useRef)();
|
|
34
|
-
const { isBlockSelected, isMultiSelecting, isZoomOut } = (0, import_lock_unlock.unlock)(
|
|
35
|
-
(0, import_data.useSelect)(import_store.store)
|
|
36
|
-
);
|
|
34
|
+
const { isBlockSelected, isMultiSelecting, isZoomOut, getSelectionStart } = (0, import_lock_unlock.unlock)((0, import_data.useSelect)(import_store.store));
|
|
37
35
|
(0, import_element.useEffect)(() => {
|
|
38
36
|
if (!isBlockSelected(clientId) || isMultiSelecting() || isZoomOut()) {
|
|
39
37
|
return;
|
|
@@ -62,7 +60,14 @@ function useFocusFirstElement({ clientId, initialPosition }) {
|
|
|
62
60
|
return;
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
|
-
|
|
63
|
+
const { activeElement } = ownerDocument;
|
|
64
|
+
const selection = ownerDocument.defaultView.getSelection();
|
|
65
|
+
const { clientId: selectionClientId, offset } = getSelectionStart();
|
|
66
|
+
const hasCaret = activeElement?.isContentEditable && activeElement.contains(target) && !!selection.anchorNode && target.contains(selection.anchorNode);
|
|
67
|
+
const isDeliberate = initialPosition === 0 || offset !== void 0 && selectionClientId === clientId;
|
|
68
|
+
if (!(hasCaret && isDeliberate)) {
|
|
69
|
+
(0, import_dom.placeCaretAtHorizontalEdge)(target, isReverse);
|
|
70
|
+
}
|
|
66
71
|
}, [initialPosition, clientId]);
|
|
67
72
|
return ref;
|
|
68
73
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/block-list/use-block-props/use-focus-first-element.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tfocus,\n\tisFormElement,\n\tisTextField,\n\tplaceCaretAtHorizontalEdge,\n} from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * Transitions focus to the block or inner tabbable when the block becomes\n * selected and an initial position is set.\n *\n * @param {string} clientId Block client ID.\n *\n * @return {RefObject} React ref with the block element.\n */\nexport function useFocusFirstElement( { clientId, initialPosition } ) {\n\tconst ref = useRef();\n\tconst { isBlockSelected, isMultiSelecting, isZoomOut }
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAClC,iBAKO;AACP,kBAA0B;AAK1B,IAAAA,cAAkC;AAClC,mBAA0C;AAC1C,yBAAuB;AAYhB,SAAS,qBAAsB,EAAE,UAAU,gBAAgB,GAAI;AACrE,QAAM,UAAM,uBAAO;AACnB,QAAM,EAAE,iBAAiB,kBAAkB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tfocus,\n\tisFormElement,\n\tisTextField,\n\tplaceCaretAtHorizontalEdge,\n} from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * Transitions focus to the block or inner tabbable when the block becomes\n * selected and an initial position is set.\n *\n * @param {string} clientId Block client ID.\n *\n * @return {RefObject} React ref with the block element.\n */\nexport function useFocusFirstElement( { clientId, initialPosition } ) {\n\tconst ref = useRef();\n\tconst { isBlockSelected, isMultiSelecting, isZoomOut, getSelectionStart } =\n\t\tunlock( useSelect( blockEditorStore ) );\n\n\tuseEffect( () => {\n\t\t// Check if the block is still selected at the time this effect runs.\n\t\tif (\n\t\t\t! isBlockSelected( clientId ) ||\n\t\t\tisMultiSelecting() ||\n\t\t\tisZoomOut()\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( initialPosition === undefined || initialPosition === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { ownerDocument } = ref.current;\n\n\t\t// Do not focus the block if it already contains the active element.\n\t\tif ( isInsideRootBlock( ref.current, ownerDocument.activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Find all tabbables within node.\n\t\tconst textInputs = focus.tabbable\n\t\t\t.find( ref.current )\n\t\t\t.filter( ( node ) => isTextField( node ) );\n\n\t\t// If reversed (e.g. merge via backspace), use the last in the set of\n\t\t// tabbables.\n\t\tconst isReverse = -1 === initialPosition;\n\t\tconst target =\n\t\t\ttextInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current;\n\n\t\tif ( ! isInsideRootBlock( ref.current, target ) ) {\n\t\t\tref.current.focus();\n\t\t\treturn;\n\t\t}\n\n\t\t// Check to see if element is focussable before a generic caret insert.\n\t\tif ( ! ref.current.getAttribute( 'contenteditable' ) ) {\n\t\t\tconst focusElement = focus.tabbable.findNext( ref.current );\n\t\t\t// Make sure focusElement is valid, contained in the same block, and a form field.\n\t\t\tif (\n\t\t\t\tfocusElement &&\n\t\t\t\tisInsideRootBlock( ref.current, focusElement ) &&\n\t\t\t\tisFormElement( focusElement )\n\t\t\t) {\n\t\t\t\tfocusElement.focus();\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// Do not place a caret when the target already contains one:\n\t\t// while a focused editing host contains the target (the block\n\t\t// supports `editableRoot`), the caret can be inside it without the\n\t\t// target holding focus. Only a caret the rich text synchronized to\n\t\t// the store (offsets present) is deliberate; a leftover one yields\n\t\t// to an explicitly requested edge position (initialPosition -1).\n\t\tconst { activeElement } = ownerDocument;\n\t\tconst selection = ownerDocument.defaultView.getSelection();\n\t\tconst { clientId: selectionClientId, offset } = getSelectionStart();\n\t\tconst hasCaret =\n\t\t\tactiveElement?.isContentEditable &&\n\t\t\tactiveElement.contains( target ) &&\n\t\t\t!! selection.anchorNode &&\n\t\t\ttarget.contains( selection.anchorNode );\n\t\tconst isDeliberate =\n\t\t\tinitialPosition === 0 ||\n\t\t\t( offset !== undefined && selectionClientId === clientId );\n\n\t\tif ( ! ( hasCaret && isDeliberate ) ) {\n\t\t\tplaceCaretAtHorizontalEdge( target, isReverse );\n\t\t}\n\t}, [ initialPosition, clientId ] );\n\n\treturn ref;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAClC,iBAKO;AACP,kBAA0B;AAK1B,IAAAA,cAAkC;AAClC,mBAA0C;AAC1C,yBAAuB;AAYhB,SAAS,qBAAsB,EAAE,UAAU,gBAAgB,GAAI;AACrE,QAAM,UAAM,uBAAO;AACnB,QAAM,EAAE,iBAAiB,kBAAkB,WAAW,kBAAkB,QACvE,+BAAQ,uBAAW,aAAAC,KAAiB,CAAE;AAEvC,gCAAW,MAAM;AAEhB,QACC,CAAE,gBAAiB,QAAS,KAC5B,iBAAiB,KACjB,UAAU,GACT;AACD;AAAA,IACD;AAEA,QAAK,oBAAoB,UAAa,oBAAoB,MAAO;AAChE;AAAA,IACD;AAEA,QAAK,CAAE,IAAI,SAAU;AACpB;AAAA,IACD;AAEA,UAAM,EAAE,cAAc,IAAI,IAAI;AAG9B,YAAK,+BAAmB,IAAI,SAAS,cAAc,aAAc,GAAI;AACpE;AAAA,IACD;AAGA,UAAM,aAAa,iBAAM,SACvB,KAAM,IAAI,OAAQ,EAClB,OAAQ,CAAE,aAAU,wBAAa,IAAK,CAAE;AAI1C,UAAM,YAAY,OAAO;AACzB,UAAM,SACL,WAAY,YAAY,WAAW,SAAS,IAAI,CAAE,KAAK,IAAI;AAE5D,QAAK,KAAE,+BAAmB,IAAI,SAAS,MAAO,GAAI;AACjD,UAAI,QAAQ,MAAM;AAClB;AAAA,IACD;AAGA,QAAK,CAAE,IAAI,QAAQ,aAAc,iBAAkB,GAAI;AACtD,YAAM,eAAe,iBAAM,SAAS,SAAU,IAAI,OAAQ;AAE1D,UACC,oBACA,+BAAmB,IAAI,SAAS,YAAa,SAC7C,0BAAe,YAAa,GAC3B;AACD,qBAAa,MAAM;AACnB;AAAA,MACD;AAAA,IACD;AAOA,UAAM,EAAE,cAAc,IAAI;AAC1B,UAAM,YAAY,cAAc,YAAY,aAAa;AACzD,UAAM,EAAE,UAAU,mBAAmB,OAAO,IAAI,kBAAkB;AAClE,UAAM,WACL,eAAe,qBACf,cAAc,SAAU,MAAO,KAC/B,CAAC,CAAE,UAAU,cACb,OAAO,SAAU,UAAU,UAAW;AACvC,UAAM,eACL,oBAAoB,KAClB,WAAW,UAAa,sBAAsB;AAEjD,QAAK,EAAI,YAAY,eAAiB;AACrC,iDAA4B,QAAQ,SAAU;AAAA,IAC/C;AAAA,EACD,GAAG,CAAE,iBAAiB,QAAS,CAAE;AAEjC,SAAO;AACR;",
|
|
6
6
|
"names": ["import_dom", "blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -27,26 +27,34 @@ var import_data = require("@wordpress/data");
|
|
|
27
27
|
var import_compose = require("@wordpress/compose");
|
|
28
28
|
var import_dom = require("../../../utils/dom.cjs");
|
|
29
29
|
var import_store = require("../../../store/index.cjs");
|
|
30
|
+
var import_utils = require("../../writing-flow/utils.cjs");
|
|
30
31
|
var import_lock_unlock = require("../../../lock-unlock.cjs");
|
|
31
32
|
var { subscribeDelegatedListener } = (0, import_lock_unlock.unlock)(import_compose.privateApis);
|
|
32
33
|
function useFocusHandler(clientId) {
|
|
33
|
-
const { isBlockSelected } = (0, import_data.useSelect)(import_store.store);
|
|
34
|
+
const { isBlockSelected, isBlockMultiSelected } = (0, import_data.useSelect)(import_store.store);
|
|
34
35
|
const { selectBlock, selectionChange } = (0, import_data.useDispatch)(import_store.store);
|
|
35
36
|
return (0, import_compose.useRefEffect)(
|
|
36
37
|
(node) => {
|
|
37
38
|
function onFocus(event) {
|
|
38
|
-
if (node.parentElement.closest('[contenteditable="true"]')) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
39
|
if (isBlockSelected(clientId)) {
|
|
42
40
|
if (!event.target.isContentEditable) {
|
|
43
41
|
selectionChange(clientId);
|
|
44
42
|
}
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
45
|
+
if ((0, import_utils.isShiftClickInProgress)()) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (isBlockMultiSelected(clientId)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
47
51
|
if (!(0, import_dom.isInsideRootBlock)(node, event.target)) {
|
|
48
52
|
return;
|
|
49
53
|
}
|
|
54
|
+
if (event.target.isContentEditable) {
|
|
55
|
+
selectBlock(clientId, null);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
50
58
|
selectBlock(clientId);
|
|
51
59
|
}
|
|
52
60
|
return subscribeDelegatedListener(node, "focusin", onFocus);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/block-list/use-block-props/use-focus-handler.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseRefEffect,\n\tprivateApis as composePrivateApis,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { subscribeDelegatedListener } = unlock( composePrivateApis );\n\n/**\n * Selects the block if it receives focus.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useFocusHandler( clientId ) {\n\tconst { isBlockSelected }
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,qBAGO;AAKP,iBAAkC;AAClC,mBAA0C;AAC1C,yBAAuB;AAEvB,IAAM,EAAE,2BAA2B,QAAI,2BAAQ,eAAAA,WAAmB;AAO3D,SAAS,gBAAiB,UAAW;AAC3C,QAAM,EAAE,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseRefEffect,\n\tprivateApis as composePrivateApis,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { isInsideRootBlock } from '../../../utils/dom';\nimport { store as blockEditorStore } from '../../../store';\nimport { isShiftClickInProgress } from '../../writing-flow/utils';\nimport { unlock } from '../../../lock-unlock';\n\nconst { subscribeDelegatedListener } = unlock( composePrivateApis );\n\n/**\n * Selects the block if it receives focus.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useFocusHandler( clientId ) {\n\tconst { isBlockSelected, isBlockMultiSelected } =\n\t\tuseSelect( blockEditorStore );\n\tconst { selectBlock, selectionChange } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\t/**\n\t\t\t * Marks the block as selected when focused and not already\n\t\t\t * selected. This specifically handles the case where block does not\n\t\t\t * set focus on its own (via `setFocus`), typically if there is no\n\t\t\t * focusable input in the block.\n\t\t\t *\n\t\t\t * @param {FocusEvent} event Focus event.\n\t\t\t */\n\t\t\tfunction onFocus( event ) {\n\t\t\t\t// Check synchronously because a non-selected block might be\n\t\t\t\t// getting data through `useSelect` asynchronously.\n\t\t\t\tif ( isBlockSelected( clientId ) ) {\n\t\t\t\t\t// Potentially change selection away from rich text.\n\t\t\t\t\tif ( ! event.target.isContentEditable ) {\n\t\t\t\t\t\tselectionChange( clientId );\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Never select on the focus fired by a shift+click: the\n\t\t\t\t// browser can focus the common editable ancestor of the\n\t\t\t\t// range (e.g. a group block), and any selection re-render\n\t\t\t\t// mid gesture destroys the native selection being made. The\n\t\t\t\t// selection observer builds the multi-selection on mouseup.\n\t\t\t\tif ( isShiftClickInProgress() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// A block that is part of the current multi-selection must\n\t\t\t\t// not collapse it. Focus can land on the clicked block after\n\t\t\t\t// the multi-selection was built: the focus event of a\n\t\t\t\t// shift+click is not ordered consistently against its\n\t\t\t\t// mouseup across browsers.\n\t\t\t\tif ( isBlockMultiSelected( clientId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If an inner block is focussed, that block is responsible for\n\t\t\t\t// setting the selected block.\n\t\t\t\tif ( ! isInsideRootBlock( node, event.target ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// For editable targets, select without initial caret\n\t\t\t\t// placement: the caret is inside the target. Placement would\n\t\t\t\t// move it, and would collapse a native selection in the\n\t\t\t\t// making, e.g. a shift+click extending the selection across\n\t\t\t\t// blocks while the wrapper is the editing host. The observer\n\t\t\t\t// builds the multi-selection from the anchor it recorded at\n\t\t\t\t// mousedown, so this dispatch overwriting the store anchor\n\t\t\t\t// is harmless.\n\t\t\t\tif ( event.target.isContentEditable ) {\n\t\t\t\t\tselectBlock( clientId, null );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselectBlock( clientId );\n\t\t\t}\n\n\t\t\treturn subscribeDelegatedListener( node, 'focusin', onFocus );\n\t\t},\n\t\t[ isBlockSelected, selectBlock ]\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,qBAGO;AAKP,iBAAkC;AAClC,mBAA0C;AAC1C,mBAAuC;AACvC,yBAAuB;AAEvB,IAAM,EAAE,2BAA2B,QAAI,2BAAQ,eAAAA,WAAmB;AAO3D,SAAS,gBAAiB,UAAW;AAC3C,QAAM,EAAE,iBAAiB,qBAAqB,QAC7C,uBAAW,aAAAC,KAAiB;AAC7B,QAAM,EAAE,aAAa,gBAAgB,QAAI,yBAAa,aAAAA,KAAiB;AAEvE,aAAO;AAAA,IACN,CAAE,SAAU;AASX,eAAS,QAAS,OAAQ;AAGzB,YAAK,gBAAiB,QAAS,GAAI;AAElC,cAAK,CAAE,MAAM,OAAO,mBAAoB;AACvC,4BAAiB,QAAS;AAAA,UAC3B;AACA;AAAA,QACD;AAOA,gBAAK,qCAAuB,GAAI;AAC/B;AAAA,QACD;AAOA,YAAK,qBAAsB,QAAS,GAAI;AACvC;AAAA,QACD;AAIA,YAAK,KAAE,8BAAmB,MAAM,MAAM,MAAO,GAAI;AAChD;AAAA,QACD;AAUA,YAAK,MAAM,OAAO,mBAAoB;AACrC,sBAAa,UAAU,IAAK;AAC5B;AAAA,QACD;AAEA,oBAAa,QAAS;AAAA,MACvB;AAEA,aAAO,2BAA4B,MAAM,WAAW,OAAQ;AAAA,IAC7D;AAAA,IACA,CAAE,iBAAiB,WAAY;AAAA,EAChC;AACD;",
|
|
6
6
|
"names": ["composePrivateApis", "blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -35,7 +35,8 @@ function useGenericPreviewBlock(block, type) {
|
|
|
35
35
|
if (example && blockName) {
|
|
36
36
|
return (0, import_blocks.getBlockFromExample)(blockName, {
|
|
37
37
|
attributes: example.attributes,
|
|
38
|
-
innerBlocks: example.innerBlocks
|
|
38
|
+
innerBlocks: example.innerBlocks,
|
|
39
|
+
innerContent: example.innerContent
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
if (block) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-styles/use-styles-for-block.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tcloneBlock,\n\tgetBlockType,\n\tgetBlockFromExample,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getActiveStyle, getRenderedStyles, replaceActiveStyle } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n *\n * @param {WPBlock} block Block object.\n * @param {WPBlockType} type Block type settings.\n * @return {WPBlock} A generic block ready for styles preview.\n */\nfunction useGenericPreviewBlock( block, type ) {\n\treturn useMemo( () => {\n\t\tconst example = type?.example;\n\t\tconst blockName = type?.name;\n\n\t\tif ( example && blockName ) {\n\t\t\treturn getBlockFromExample( blockName, {\n\t\t\t\tattributes: example.attributes,\n\t\t\t\tinnerBlocks: example.innerBlocks,\n\t\t\t} );\n\t\t}\n\n\t\tif ( block ) {\n\t\t\treturn cloneBlock( block );\n\t\t}\n\t}, [ block, type?.example, type?.name ] );\n}\n\n/**\n * @typedef useStylesForBlocksArguments\n * @property {string} clientId Block client ID.\n * @property {() => void} onSwitch Block style switch callback function.\n */\n\n/**\n *\n * @param {useStylesForBlocksArguments} useStylesForBlocks arguments.\n * @return {Object} Results of the select methods.\n */\nexport default function useStylesForBlocks( { clientId, onSwitch } ) {\n\tconst selector = ( select ) => {\n\t\tconst { getBlock } = select( blockEditorStore );\n\t\tconst block = getBlock( clientId );\n\n\t\tif ( ! block ) {\n\t\t\treturn {};\n\t\t}\n\t\tconst blockType = getBlockType( block.name );\n\t\tconst { getBlockStyles } = select( blocksStore );\n\n\t\treturn {\n\t\t\tblock: ! blockType?.example ? block : null,\n\t\t\tblockType,\n\t\t\tstyles: getBlockStyles( block.name ),\n\t\t\tclassName: block.attributes.className || '',\n\t\t};\n\t};\n\tconst { styles, block, blockType, className } = useSelect( selector, [\n\t\tclientId,\n\t] );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst stylesToRender = getRenderedStyles( styles );\n\tconst activeStyle = getActiveStyle( stylesToRender, className );\n\tconst genericPreviewBlock = useGenericPreviewBlock( block, blockType );\n\n\tconst onSelect = ( style ) => {\n\t\tconst styleClassName = replaceActiveStyle(\n\t\t\tclassName,\n\t\t\tactiveStyle,\n\t\t\tstyle\n\t\t);\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tclassName: styleClassName,\n\t\t} );\n\t\tonSwitch();\n\t};\n\n\treturn {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,oBAKO;AACP,qBAAwB;AAKxB,mBAAsE;AACtE,mBAA0C;AAQ1C,SAAS,uBAAwB,OAAO,MAAO;AAC9C,aAAO,wBAAS,MAAM;AACrB,UAAM,UAAU,MAAM;AACtB,UAAM,YAAY,MAAM;AAExB,QAAK,WAAW,WAAY;AAC3B,iBAAO,mCAAqB,WAAW;AAAA,QACtC,YAAY,QAAQ;AAAA,QACpB,aAAa,QAAQ;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tcloneBlock,\n\tgetBlockType,\n\tgetBlockFromExample,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getActiveStyle, getRenderedStyles, replaceActiveStyle } from './utils';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n *\n * @param {WPBlock} block Block object.\n * @param {WPBlockType} type Block type settings.\n * @return {WPBlock} A generic block ready for styles preview.\n */\nfunction useGenericPreviewBlock( block, type ) {\n\treturn useMemo( () => {\n\t\tconst example = type?.example;\n\t\tconst blockName = type?.name;\n\n\t\tif ( example && blockName ) {\n\t\t\treturn getBlockFromExample( blockName, {\n\t\t\t\tattributes: example.attributes,\n\t\t\t\tinnerBlocks: example.innerBlocks,\n\t\t\t\tinnerContent: example.innerContent,\n\t\t\t} );\n\t\t}\n\n\t\tif ( block ) {\n\t\t\treturn cloneBlock( block );\n\t\t}\n\t}, [ block, type?.example, type?.name ] );\n}\n\n/**\n * @typedef useStylesForBlocksArguments\n * @property {string} clientId Block client ID.\n * @property {() => void} onSwitch Block style switch callback function.\n */\n\n/**\n *\n * @param {useStylesForBlocksArguments} useStylesForBlocks arguments.\n * @return {Object} Results of the select methods.\n */\nexport default function useStylesForBlocks( { clientId, onSwitch } ) {\n\tconst selector = ( select ) => {\n\t\tconst { getBlock } = select( blockEditorStore );\n\t\tconst block = getBlock( clientId );\n\n\t\tif ( ! block ) {\n\t\t\treturn {};\n\t\t}\n\t\tconst blockType = getBlockType( block.name );\n\t\tconst { getBlockStyles } = select( blocksStore );\n\n\t\treturn {\n\t\t\tblock: ! blockType?.example ? block : null,\n\t\t\tblockType,\n\t\t\tstyles: getBlockStyles( block.name ),\n\t\t\tclassName: block.attributes.className || '',\n\t\t};\n\t};\n\tconst { styles, block, blockType, className } = useSelect( selector, [\n\t\tclientId,\n\t] );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst stylesToRender = getRenderedStyles( styles );\n\tconst activeStyle = getActiveStyle( stylesToRender, className );\n\tconst genericPreviewBlock = useGenericPreviewBlock( block, blockType );\n\n\tconst onSelect = ( style ) => {\n\t\tconst styleClassName = replaceActiveStyle(\n\t\t\tclassName,\n\t\t\tactiveStyle,\n\t\t\tstyle\n\t\t);\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tclassName: styleClassName,\n\t\t} );\n\t\tonSwitch();\n\t};\n\n\treturn {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,oBAKO;AACP,qBAAwB;AAKxB,mBAAsE;AACtE,mBAA0C;AAQ1C,SAAS,uBAAwB,OAAO,MAAO;AAC9C,aAAO,wBAAS,MAAM;AACrB,UAAM,UAAU,MAAM;AACtB,UAAM,YAAY,MAAM;AAExB,QAAK,WAAW,WAAY;AAC3B,iBAAO,mCAAqB,WAAW;AAAA,QACtC,YAAY,Q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EditorStore", "block", "blockType", "blocksStore"]
|
|
7
7
|
}
|
|
@@ -36,7 +36,7 @@ function useBlockDisplayTitle({
|
|
|
36
36
|
if (!clientId) {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
const { getBlockName, getBlockAttributes } = select(import_store.store);
|
|
39
|
+
const { getBlockName, getBlockAttributes, getBlock } = select(import_store.store);
|
|
40
40
|
const { getBlockType, getActiveBlockVariation } = select(import_blocks.store);
|
|
41
41
|
const blockName = getBlockName(clientId);
|
|
42
42
|
const blockType = getBlockType(blockName);
|
|
@@ -48,7 +48,12 @@ function useBlockDisplayTitle({
|
|
|
48
48
|
if (label !== blockType.title) {
|
|
49
49
|
return label;
|
|
50
50
|
}
|
|
51
|
-
const match = getActiveBlockVariation(
|
|
51
|
+
const match = getActiveBlockVariation(
|
|
52
|
+
blockName,
|
|
53
|
+
attributes,
|
|
54
|
+
void 0,
|
|
55
|
+
getBlock?.(clientId)?.innerContent
|
|
56
|
+
);
|
|
52
57
|
return match?.title || blockType.title;
|
|
53
58
|
},
|
|
54
59
|
[clientId, context]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-title/use-block-display-title.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns the block's configured title as a string, or empty if the title\n * cannot be determined.\n *\n * @example\n *\n * ```js\n * useBlockDisplayTitle( { clientId: 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', maximumLength: 17 } );\n * ```\n *\n * @param {Object} props\n * @param {string} props.clientId Client ID of block.\n * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated.\n * @param {string|undefined} props.context The context to pass to `getBlockLabel`.\n * @return {?string} Block title.\n */\nexport default function useBlockDisplayTitle( {\n\tclientId,\n\tmaximumLength,\n\tcontext,\n} ) {\n\tconst blockTitle = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst label = getBlockLabel( blockType, attributes, context );\n\t\t\t// If the label is defined we prioritize it over a possible block variation title match.\n\t\t\tif ( label !== blockType.title ) {\n\t\t\t\treturn label;\n\t\t\t}\n\n\t\t\tconst match = getActiveBlockVariation(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,oBAGO;AAKP,mBAA0C;AAkB3B,SAAR,qBAAuC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,iBAAa;AAAA,IAClB,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,cAAc,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns the block's configured title as a string, or empty if the title\n * cannot be determined.\n *\n * @example\n *\n * ```js\n * useBlockDisplayTitle( { clientId: 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', maximumLength: 17 } );\n * ```\n *\n * @param {Object} props\n * @param {string} props.clientId Client ID of block.\n * @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated.\n * @param {string|undefined} props.context The context to pass to `getBlockLabel`.\n * @return {?string} Block title.\n */\nexport default function useBlockDisplayTitle( {\n\tclientId,\n\tmaximumLength,\n\tcontext,\n} ) {\n\tconst blockTitle = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getBlockAttributes, getBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getBlockType, getActiveBlockVariation } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tif ( ! blockType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst label = getBlockLabel( blockType, attributes, context );\n\t\t\t// If the label is defined we prioritize it over a possible block variation title match.\n\t\t\tif ( label !== blockType.title ) {\n\t\t\t\treturn label;\n\t\t\t}\n\n\t\t\tconst match = getActiveBlockVariation(\n\t\t\t\tblockName,\n\t\t\t\tattributes,\n\t\t\t\tundefined,\n\t\t\t\tgetBlock?.( clientId )?.innerContent\n\t\t\t);\n\t\t\t// Label will fallback to the title if no label is defined for the current label context.\n\t\t\treturn match?.title || blockType.title;\n\t\t},\n\t\t[ clientId, context ]\n\t);\n\n\tif ( ! blockTitle ) {\n\t\treturn null;\n\t}\n\n\tif (\n\t\tmaximumLength &&\n\t\tmaximumLength > 0 &&\n\t\tblockTitle.length > maximumLength\n\t) {\n\t\tconst omission = '...';\n\t\treturn (\n\t\t\tblockTitle.slice( 0, maximumLength - omission.length ) + omission\n\t\t);\n\t}\n\n\treturn blockTitle;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,oBAGO;AAKP,mBAA0C;AAkB3B,SAAR,qBAAuC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,iBAAa;AAAA,IAClB,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO;AAAA,MACR;AAEA,YAAM,EAAE,cAAc,oBAAoB,SAAS,IAClD,OAAQ,aAAAA,KAAiB;AAC1B,YAAM,EAAE,cAAc,wBAAwB,IAC7C,OAAQ,cAAAC,KAAY;AAErB,YAAM,YAAY,aAAc,QAAS;AACzC,YAAM,YAAY,aAAc,SAAU;AAC1C,UAAK,CAAE,WAAY;AAClB,eAAO;AAAA,MACR;AAEA,YAAM,aAAa,mBAAoB,QAAS;AAChD,YAAM,YAAQ,cAAAC,6BAAe,WAAW,YAAY,OAAQ;AAE5D,UAAK,UAAU,UAAU,OAAQ;AAChC,eAAO;AAAA,MACR;AAEA,YAAM,QAAQ;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAY,QAAS,GAAG;AAAA,MACzB;AAEA,aAAO,OAAO,SAAS,UAAU;AAAA,IAClC;AAAA,IACA,CAAE,UAAU,OAAQ;AAAA,EACrB;AAEA,MAAK,CAAE,YAAa;AACnB,WAAO;AAAA,EACR;AAEA,MACC,iBACA,gBAAgB,KAChB,WAAW,SAAS,eACnB;AACD,UAAM,WAAW;AACjB,WACC,WAAW,MAAO,GAAG,gBAAgB,SAAS,MAAO,IAAI;AAAA,EAE3D;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": ["blockEditorStore", "blocksStore", "getBlockLabel"]
|
|
7
7
|
}
|
|
@@ -47,7 +47,6 @@ var import_use_block_display_title = __toESM(require("../block-title/use-block-d
|
|
|
47
47
|
var import_store = require("../../store/index.cjs");
|
|
48
48
|
var import_block_bindings = require("../../utils/block-bindings.cjs");
|
|
49
49
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
50
|
-
var import_private_keys = require("../../store/private-keys.cjs");
|
|
51
50
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
51
|
function getBlockIconVariant({ select, clientIds }) {
|
|
53
52
|
const {
|
|
@@ -58,11 +57,9 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
58
57
|
getTemplateLock,
|
|
59
58
|
getBlockEditingMode,
|
|
60
59
|
canEditBlock,
|
|
61
|
-
|
|
62
|
-
getSettings
|
|
60
|
+
isSectionBlock
|
|
63
61
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
64
62
|
const { getBlockStyles } = select(import_blocks.store);
|
|
65
|
-
const isIsolatedEditor = !!getSettings()?.[import_private_keys.isIsolatedEditorKey];
|
|
66
63
|
const hasTemplateLock = clientIds.some(
|
|
67
64
|
(id) => getTemplateLock(id) === "contentOnly"
|
|
68
65
|
);
|
|
@@ -70,7 +67,7 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
70
67
|
const blockName = isSingleBlock && getBlockName(clientIds[0]);
|
|
71
68
|
const hasBlockStyles = isSingleBlock && !!getBlockStyles(blockName)?.length;
|
|
72
69
|
const hasPatternNameInSelection = clientIds.some(
|
|
73
|
-
(id) => !!getBlockAttributes(id)?.metadata?.patternName &&
|
|
70
|
+
(id) => !!getBlockAttributes(id)?.metadata?.patternName && isSectionBlock(id)
|
|
74
71
|
);
|
|
75
72
|
const hasPatternOverrides = clientIds.every(
|
|
76
73
|
(clientId) => (0, import_block_bindings.hasPatternOverridesDefaultBinding)(
|
|
@@ -98,24 +95,23 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
98
95
|
return "default";
|
|
99
96
|
}
|
|
100
97
|
function getBlockIcon({ select, clientIds }) {
|
|
101
|
-
const {
|
|
102
|
-
getBlockName,
|
|
103
|
-
getBlockAttributes,
|
|
104
|
-
isWithinEditedContentOnlySection,
|
|
105
|
-
getSettings
|
|
106
|
-
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
107
|
-
const isIsolatedEditor = !!getSettings()?.[import_private_keys.isIsolatedEditorKey];
|
|
98
|
+
const { getBlockName, getBlockAttributes, getBlock, isSectionBlock } = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
108
99
|
const _isSingleBlock = clientIds.length === 1;
|
|
109
100
|
const firstClientId = clientIds[0];
|
|
110
101
|
const blockAttributes = getBlockAttributes(firstClientId);
|
|
111
|
-
if (_isSingleBlock && blockAttributes?.metadata?.patternName &&
|
|
102
|
+
if (_isSingleBlock && blockAttributes?.metadata?.patternName && isSectionBlock(firstClientId)) {
|
|
112
103
|
return import_icons.symbol;
|
|
113
104
|
}
|
|
114
105
|
const blockName = getBlockName(firstClientId);
|
|
115
106
|
const blockType = (0, import_blocks.getBlockType)(blockName);
|
|
116
107
|
if (_isSingleBlock) {
|
|
117
108
|
const { getActiveBlockVariation } = select(import_blocks.store);
|
|
118
|
-
const match = getActiveBlockVariation(
|
|
109
|
+
const match = getActiveBlockVariation(
|
|
110
|
+
blockName,
|
|
111
|
+
blockAttributes,
|
|
112
|
+
void 0,
|
|
113
|
+
getBlock?.(firstClientId)?.innerContent
|
|
114
|
+
);
|
|
119
115
|
return match?.icon || blockType?.icon;
|
|
120
116
|
}
|
|
121
117
|
const blockNames = clientIds.map((id) => getBlockName(id));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-toolbar/block-toolbar-icon.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy, symbol } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport BlockStylesDropdown from './block-styles-dropdown';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,mBAA6B;AAC7B,oBAAmD;AACnD,yBAA0C;AAK1C,4BAA0B;AAC1B,wBAAsB;AACtB,mCAAgC;AAChC,wCAAqC;AACrC,qCAAiC;AACjC,mBAA0C;AAC1C,4BAAkD;AAClD,yBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy, symbol } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport BlockStylesDropdown from './block-styles-dropdown';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\tcanRemoveBlocks,\n\t\tgetTemplateLock,\n\t\tgetBlockEditingMode,\n\t\tcanEditBlock,\n\t\tisSectionBlock,\n\t} = unlock( select( blockEditorStore ) );\n\tconst { getBlockStyles } = select( blocksStore );\n\n\tconst hasTemplateLock = clientIds.some(\n\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t);\n\n\t// Calculate props only used in this function\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockName = isSingleBlock && getBlockName( clientIds[ 0 ] );\n\tconst hasBlockStyles =\n\t\tisSingleBlock && !! getBlockStyles( blockName )?.length;\n\tconst hasPatternNameInSelection = clientIds.some(\n\t\t( id ) =>\n\t\t\t!! getBlockAttributes( id )?.metadata?.patternName &&\n\t\t\tisSectionBlock( id )\n\t);\n\tconst hasPatternOverrides = clientIds.every( ( clientId ) =>\n\t\thasPatternOverridesDefaultBinding(\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings\n\t\t)\n\t);\n\tconst hasParentPattern = clientIds.every(\n\t\t( clientId ) =>\n\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true ).length >\n\t\t\t0\n\t);\n\tconst canRemove = canRemoveBlocks( clientIds );\n\tconst canEdit = clientIds.every( ( clientId ) => canEditBlock( clientId ) );\n\tconst editingMode = getBlockEditingMode( clientIds[ 0 ] );\n\tconst isDefaultEditingMode = editingMode === 'default';\n\tconst isContentOnlyMode = editingMode === 'contentOnly';\n\tconst _hideTransformsForSections = hasPatternNameInSelection;\n\tconst _showBlockSwitcher =\n\t\t! _hideTransformsForSections &&\n\t\tisDefaultEditingMode &&\n\t\t( hasBlockStyles || canRemove ) &&\n\t\t! hasTemplateLock &&\n\t\tcanEdit;\n\n\tconst _showPatternOverrides = hasPatternOverrides && hasParentPattern;\n\n\tif ( _showBlockSwitcher ) {\n\t\treturn 'switcher';\n\t} else if (\n\t\tisContentOnlyMode &&\n\t\thasBlockStyles &&\n\t\t! hasPatternOverrides &&\n\t\tcanEdit\n\t) {\n\t\treturn 'styles-only';\n\t} else if ( _showPatternOverrides ) {\n\t\treturn 'pattern-overrides';\n\t}\n\n\treturn 'default';\n}\n\nfunction getBlockIcon( { select, clientIds } ) {\n\tconst { getBlockName, getBlockAttributes, getBlock, isSectionBlock } =\n\t\tunlock( select( blockEditorStore ) );\n\n\tconst _isSingleBlock = clientIds.length === 1;\n\tconst firstClientId = clientIds[ 0 ];\n\n\tconst blockAttributes = getBlockAttributes( firstClientId );\n\tif (\n\t\t_isSingleBlock &&\n\t\tblockAttributes?.metadata?.patternName &&\n\t\tisSectionBlock( firstClientId )\n\t) {\n\t\treturn symbol;\n\t}\n\n\tconst blockName = getBlockName( firstClientId );\n\tconst blockType = getBlockType( blockName );\n\tif ( _isSingleBlock ) {\n\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\tconst match = getActiveBlockVariation(\n\t\t\tblockName,\n\t\t\tblockAttributes,\n\t\t\tundefined,\n\t\t\tgetBlock?.( firstClientId )?.innerContent\n\t\t);\n\t\treturn match?.icon || blockType?.icon;\n\t}\n\n\tconst blockNames = clientIds.map( ( id ) => getBlockName( id ) );\n\tconst isSelectionOfSameType = new Set( blockNames ).size === 1;\n\treturn isSelectionOfSameType ? blockType?.icon : copy;\n}\n\nexport default function BlockToolbarIcon( { clientIds, isSynced } ) {\n\tconst { icon, showIconLabels, variant } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\ticon: getBlockIcon( { select, clientIds } ),\n\t\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'showIconLabels'\n\t\t\t\t),\n\t\t\t\tvariant: getBlockIconVariant( {\n\t\t\t\t\tselect,\n\t\t\t\t\tclientIds,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds?.[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst showBlockTitle = isSingleBlock && isSynced && ! showIconLabels;\n\tconst label = isSingleBlock ? blockTitle : __( 'Multiple blocks selected' );\n\t// Used to hide the block icon when the showIconLabels preference is enabled, or to display the template title when it's a template.\n\tconst text = showBlockTitle && blockTitle ? blockTitle : undefined;\n\n\tconst BlockIconElement = (\n\t\t<BlockIcon\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon\"\n\t\t\ticon={ icon }\n\t\t/>\n\t);\n\n\tif ( variant === 'switcher' ) {\n\t\treturn (\n\t\t\t<BlockSwitcher\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tlabel={ label }\n\t\t\t\ttext={ text }\n\t\t\t>\n\t\t\t\t{ BlockIconElement }\n\t\t\t</BlockSwitcher>\n\t\t);\n\t}\n\n\tif ( variant === 'styles-only' ) {\n\t\treturn (\n\t\t\t<BlockStylesDropdown\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tlabel={ label }\n\t\t\t\ttext={ text }\n\t\t\t>\n\t\t\t\t{ BlockIconElement }\n\t\t\t</BlockStylesDropdown>\n\t\t);\n\t}\n\n\tif ( variant === 'pattern-overrides' ) {\n\t\treturn (\n\t\t\t<PatternOverridesDropdown\n\t\t\t\ticon={ BlockIconElement }\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tdisabled\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon-button\"\n\t\t\ttitle={ label }\n\t\t\ticon={ BlockIconElement }\n\t\t\ttext={ text }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,mBAA6B;AAC7B,oBAAmD;AACnD,yBAA0C;AAK1C,4BAA0B;AAC1B,wBAAsB;AACtB,mCAAgC;AAChC,wCAAqC;AACrC,qCAAiC;AACjC,mBAA0C;AAC1C,4BAAkD;AAClD,yBAAuB;AAsIrB;AApIF,SAAS,oBAAqB,EAAE,QAAQ,UAAU,GAAI;AACrD,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA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,gBAAI,0BAA2B;AAE1E,QAAM,OAAO,kBAAkB,aAAa,aAAa;AAEzD,QAAM,mBACL;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA;AAAA,EACD;AAGD,MAAK,YAAY,YAAa;AAC7B,WACC;AAAA,MAAC,sBAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,MAAK,YAAY,eAAgB;AAChC,WACC;AAAA,MAAC,6BAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,MAAK,YAAY,qBAAsB;AACtC,WACC;AAAA,MAAC,kCAAAC;AAAA,MAAA;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAQ;AAAA,MACR,WAAU;AAAA,MACV,OAAQ;AAAA,MACR,MAAO;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "blocksStore", "preferencesStore", "useBlockDisplayTitle", "BlockIcon", "BlockSwitcher", "BlockStylesDropdown", "PatternOverridesDropdown"]
|
|
7
7
|
}
|
|
@@ -60,6 +60,7 @@ var import_edit_section_button = __toESM(require("./edit-section-button.cjs"));
|
|
|
60
60
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
61
61
|
var import_private_keys = require("../../store/private-keys.cjs");
|
|
62
62
|
var import_block_toolbar_icon = __toESM(require("./block-toolbar-icon.cjs"));
|
|
63
|
+
var import_block_style_state = require("../../hooks/block-style-state.cjs");
|
|
63
64
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
64
65
|
function PrivateBlockToolbar({
|
|
65
66
|
hideDragHandle,
|
|
@@ -86,6 +87,7 @@ function PrivateBlockToolbar({
|
|
|
86
87
|
showBlockVisibilityButton,
|
|
87
88
|
showSwitchSectionStyleButton,
|
|
88
89
|
areSelectedBlocksHiddenOnViewport,
|
|
90
|
+
showStyleStateSlot,
|
|
89
91
|
canEdit
|
|
90
92
|
} = (0, import_data.useSelect)((select) => {
|
|
91
93
|
const { canEditBlock } = select(import_store.store);
|
|
@@ -102,7 +104,9 @@ function PrivateBlockToolbar({
|
|
|
102
104
|
getParentSectionBlock,
|
|
103
105
|
isZoomOut,
|
|
104
106
|
isSectionBlock,
|
|
105
|
-
isBlockHiddenAtViewport
|
|
107
|
+
isBlockHiddenAtViewport,
|
|
108
|
+
getSelectedBlockStyleState,
|
|
109
|
+
isResponsiveEditing
|
|
106
110
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
107
111
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
108
112
|
const selectedBlockClientId = selectedBlockClientIds[0];
|
|
@@ -134,6 +138,9 @@ function PrivateBlockToolbar({
|
|
|
134
138
|
const _areSelectedBlocksHiddenOnViewport = selectedBlockClientIds.length > 0 && selectedBlockClientIds.every(
|
|
135
139
|
(id) => isBlockHiddenAtViewport(id, _currentDeviceType)
|
|
136
140
|
);
|
|
141
|
+
const _isEditingResponsiveStyleState = isResponsiveEditing() && (0, import_block_style_state.hasViewportBlockStyleState)(
|
|
142
|
+
getSelectedBlockStyleState(selectedBlockClientId)
|
|
143
|
+
);
|
|
137
144
|
return {
|
|
138
145
|
blockClientId: selectedBlockClientId,
|
|
139
146
|
blockClientIds: selectedBlockClientIds,
|
|
@@ -150,7 +157,8 @@ function PrivateBlockToolbar({
|
|
|
150
157
|
isSectionContainer: _isSectionBlock,
|
|
151
158
|
hasContentOnlyLocking: _hasTemplateLock,
|
|
152
159
|
showShuffleButton: _isZoomOut,
|
|
153
|
-
showSlots: !_isZoomOut,
|
|
160
|
+
showSlots: !_isZoomOut && !_isEditingResponsiveStyleState,
|
|
161
|
+
showStyleStateSlot: !_isZoomOut && _isEditingResponsiveStyleState,
|
|
154
162
|
showGroupButtons: !_isZoomOut,
|
|
155
163
|
showLockButtons: !_isZoomOut,
|
|
156
164
|
showBlockVisibilityButton: !_isZoomOut,
|
|
@@ -222,39 +230,50 @@ function PrivateBlockToolbar({
|
|
|
222
230
|
!isMultiToolbar && canEdit && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_edit_section_button.default, { clientId: blockClientIds[0] }),
|
|
223
231
|
!areSelectedBlocksHiddenOnViewport && showShuffleButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_change_design.default, { clientId: blockClientIds[0] }),
|
|
224
232
|
!areSelectedBlocksHiddenOnViewport && showSwitchSectionStyleButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_switch_section_style.default, { clientId: blockClientIds[0] }),
|
|
225
|
-
!areSelectedBlocksHiddenOnViewport && shouldShowVisualToolbar &&
|
|
233
|
+
!areSelectedBlocksHiddenOnViewport && shouldShowVisualToolbar && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
226
234
|
!isSectionContainer && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
227
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
235
|
+
showSlots && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
237
|
+
import_block_controls.default.Slot,
|
|
238
|
+
{
|
|
239
|
+
group: "parent",
|
|
240
|
+
className: "block-editor-block-toolbar__slot"
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
244
|
+
import_block_controls.default.Slot,
|
|
245
|
+
{
|
|
246
|
+
group: "block",
|
|
247
|
+
className: "block-editor-block-toolbar__slot"
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_controls.default.Slot, { className: "block-editor-block-toolbar__slot" }),
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
252
|
+
import_block_controls.default.Slot,
|
|
253
|
+
{
|
|
254
|
+
group: "inline",
|
|
255
|
+
className: "block-editor-block-toolbar__slot"
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] }),
|
|
259
|
+
showStyleStateSlot && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
260
|
import_block_controls.default.Slot,
|
|
229
261
|
{
|
|
230
|
-
group: "
|
|
262
|
+
group: "style-state",
|
|
231
263
|
className: "block-editor-block-toolbar__slot"
|
|
232
264
|
}
|
|
233
|
-
)
|
|
265
|
+
)
|
|
266
|
+
] }),
|
|
267
|
+
showSlots && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
234
268
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
235
269
|
import_block_controls.default.Slot,
|
|
236
270
|
{
|
|
237
|
-
group: "
|
|
271
|
+
group: "other",
|
|
238
272
|
className: "block-editor-block-toolbar__slot"
|
|
239
273
|
}
|
|
240
274
|
),
|
|
241
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
|
-
|
|
243
|
-
import_block_controls.default.Slot,
|
|
244
|
-
{
|
|
245
|
-
group: "inline",
|
|
246
|
-
className: "block-editor-block-toolbar__slot"
|
|
247
|
-
}
|
|
248
|
-
)
|
|
249
|
-
] }),
|
|
250
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
251
|
-
import_block_controls.default.Slot,
|
|
252
|
-
{
|
|
253
|
-
group: "other",
|
|
254
|
-
className: "block-editor-block-toolbar__slot"
|
|
255
|
-
}
|
|
256
|
-
),
|
|
257
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_toolbar_last_item.default.Slot, {})
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_toolbar_last_item.default.Slot, {})
|
|
276
|
+
] })
|
|
258
277
|
] }),
|
|
259
278
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_edit_visually_button.default, { clientIds: blockClientIds }),
|
|
260
279
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_settings_menu.default, { clientIds: blockClientIds })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-toolbar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { ViewportVisibilityToolbar } from '../block-visibility';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport EditSectionButton from './edit-section-button';\nimport { unlock } from '../../lock-unlock';\nimport { deviceTypeKey } from '../../store/private-keys';\nimport BlockToolbarIcon from './block-toolbar-icon';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\tisSectionContainer,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowBlockVisibilityButton,\n\t\tshowSwitchSectionStyleButton,\n\t\tareSelectedBlocksHiddenOnViewport,\n\t\tcanEdit,\n\t} = useSelect( ( select ) => {\n\t\tconst { canEditBlock } = select( blockEditorStore );\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetSettings,\n\t\t\tgetTemplateLock,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisSectionBlock,\n\t\t\tisBlockHiddenAtViewport,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\t\tconst _isSectionBlock = isSectionBlock( selectedBlockClientId );\n\t\tconst _canEditBlock = canEditBlock( selectedBlockClientId );\n\t\tconst _showSwitchSectionStyleButton =\n\t\t\t_canEditBlock && ( _isZoomOut || _isSectionBlock );\n\n\t\tconst _currentDeviceType =\n\t\t\tgetSettings()?.[ deviceTypeKey ]?.toLowerCase() || 'desktop';\n\t\tconst _areSelectedBlocksHiddenOnViewport =\n\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\tselectedBlockClientIds.every( ( id ) =>\n\t\t\t\tisBlockHiddenAtViewport( id, _currentDeviceType )\n\t\t\t);\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\tisSectionContainer: _isSectionBlock,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowBlockVisibilityButton: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton: _showSwitchSectionStyleButton,\n\t\t\tareSelectedBlocksHiddenOnViewport:\n\t\t\t\t_areSelectedBlocksHiddenOnViewport,\n\t\t\tcanEdit: _canEditBlock,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) && (\n\t\t\t\t\t<div ref={ nodeRef } { ...showHoveredOrFocusedGestures }>\n\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t<BlockToolbarIcon\n\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\tisSynced={ isSynced }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isDefaultEditingMode &&\n\t\t\t\t\t\t\t\tshowBlockVisibilityButton && (\n\t\t\t\t\t\t\t\t\t<ViewportVisibilityToolbar\n\t\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\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{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\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<BlockMover\n\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport &&\n\t\t\t\t\t! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ ! isMultiToolbar && canEdit && (\n\t\t\t\t\t<EditSectionButton clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport && showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport &&\n\t\t\t\t\tshowSwitchSectionStyleButton && (\n\t\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tshowSlots && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isSectionContainer && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\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) }\n\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,kBAA0B;AAC1B,qBAAuB;AACvB,qBAAiC;AACjC,oBAKO;AACP,wBAA6B;AAK7B,yBAAuB;AACvB,mCAAgC;AAChC,4BAA0B;AAC1B,qCAA2C;AAC3C,iCAA8B;AAC9B,wBAAiC;AACjC,8BAA0C;AAC1C,sCAAkC;AAClC,wCAAoC;AACpC,mBAAgD;AAChD,mBAA0C;AAC1C,+BAA6B;AAC7B,mCAAmC;AACnC,2BAAyB;AACzB,kCAA+B;AAC/B,iCAA8B;AAC9B,yBAAuB;AACvB,0BAA8B;AAC9B,gCAA6B;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { ViewportVisibilityToolbar } from '../block-visibility';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasBlockToolbar } from './use-has-block-toolbar';\nimport ChangeDesign from './change-design';\nimport SwitchSectionStyle from './switch-section-style';\nimport EditSectionButton from './edit-section-button';\nimport { unlock } from '../../lock-unlock';\nimport { deviceTypeKey } from '../../store/private-keys';\nimport BlockToolbarIcon from './block-toolbar-icon';\nimport { hasViewportBlockStyleState } from '../../hooks/block-style-state';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\ttoolbarKey,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t\tisUsingBindings,\n\t\tisSectionContainer,\n\t\thasContentOnlyLocking,\n\t\tshowShuffleButton,\n\t\tshowSlots,\n\t\tshowGroupButtons,\n\t\tshowLockButtons,\n\t\tshowBlockVisibilityButton,\n\t\tshowSwitchSectionStyleButton,\n\t\tareSelectedBlocksHiddenOnViewport,\n\t\tshowStyleStateSlot,\n\t\tcanEdit,\n\t} = useSelect( ( select ) => {\n\t\tconst { canEditBlock } = select( blockEditorStore );\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetBlockAttributes,\n\t\t\tgetSettings,\n\t\t\tgetTemplateLock,\n\t\t\tgetParentSectionBlock,\n\t\t\tisZoomOut,\n\t\t\tisSectionBlock,\n\t\t\tisBlockHiddenAtViewport,\n\t\t\tgetSelectedBlockStyleState,\n\t\t\tisResponsiveEditing,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst editingMode = getBlockEditingMode( selectedBlockClientId );\n\t\tconst _isDefaultEditingMode = editingMode === 'default';\n\t\tconst _blockName = getBlockName( selectedBlockClientId );\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\tconst _isUsingBindings = selectedBlockClientIds.every(\n\t\t\t( clientId ) =>\n\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t);\n\n\t\t// If one or more selected blocks are locked, do not show the BlockGroupToolbar.\n\t\tconst _hasTemplateLock = selectedBlockClientIds.some(\n\t\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t\t);\n\n\t\tconst _isZoomOut = isZoomOut();\n\t\tconst _isSectionBlock = isSectionBlock( selectedBlockClientId );\n\t\tconst _canEditBlock = canEditBlock( selectedBlockClientId );\n\t\tconst _showSwitchSectionStyleButton =\n\t\t\t_canEditBlock && ( _isZoomOut || _isSectionBlock );\n\n\t\tconst _currentDeviceType =\n\t\t\tgetSettings()?.[ deviceTypeKey ]?.toLowerCase() || 'desktop';\n\t\tconst _areSelectedBlocksHiddenOnViewport =\n\t\t\tselectedBlockClientIds.length > 0 &&\n\t\t\tselectedBlockClientIds.every( ( id ) =>\n\t\t\t\tisBlockHiddenAtViewport( id, _currentDeviceType )\n\t\t\t);\n\t\tconst _isEditingResponsiveStyleState =\n\t\t\tisResponsiveEditing() &&\n\t\t\thasViewportBlockStyleState(\n\t\t\t\tgetSelectedBlockStyleState( selectedBlockClientId )\n\t\t\t);\n\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType: selectedBlockClientId && getBlockType( _blockName ),\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\ttoolbarKey: `${ selectedBlockClientId }${ parentClientId }`,\n\t\t\tshowParentSelector:\n\t\t\t\t! _isZoomOut &&\n\t\t\t\tparentBlockType &&\n\t\t\t\teditingMode !== 'contentOnly' &&\n\t\t\t\tgetBlockEditingMode( parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1,\n\t\t\tisUsingBindings: _isUsingBindings,\n\t\t\tisSectionContainer: _isSectionBlock,\n\t\t\thasContentOnlyLocking: _hasTemplateLock,\n\t\t\tshowShuffleButton: _isZoomOut,\n\t\t\tshowSlots: ! _isZoomOut && ! _isEditingResponsiveStyleState,\n\t\t\tshowStyleStateSlot: ! _isZoomOut && _isEditingResponsiveStyleState,\n\t\t\tshowGroupButtons: ! _isZoomOut,\n\t\t\tshowLockButtons: ! _isZoomOut,\n\t\t\tshowBlockVisibilityButton: ! _isZoomOut,\n\t\t\tshowSwitchSectionStyleButton: _showSwitchSectionStyleButton,\n\t\t\tareSelectedBlocksHiddenOnViewport:\n\t\t\t\t_areSelectedBlocksHiddenOnViewport,\n\t\t\tcanEdit: _canEditBlock,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst hasBlockToolbar = useHasBlockToolbar();\n\tif ( ! hasBlockToolbar ) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = clsx( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = clsx( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t\t'is-connected': isUsingBindings,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ toolbarKey }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ showParentSelector && ! isMultiToolbar && isLargeViewport && (\n\t\t\t\t\t<BlockParentSelector />\n\t\t\t\t) }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) && (\n\t\t\t\t\t<div ref={ nodeRef } { ...showHoveredOrFocusedGestures }>\n\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t<BlockToolbarIcon\n\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\tisSynced={ isSynced }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isDefaultEditingMode &&\n\t\t\t\t\t\t\t\tshowBlockVisibilityButton && (\n\t\t\t\t\t\t\t\t\t<ViewportVisibilityToolbar\n\t\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\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{ ! isMultiToolbar &&\n\t\t\t\t\t\t\t\tisDefaultEditingMode &&\n\t\t\t\t\t\t\t\tshowLockButtons && (\n\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\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<BlockMover\n\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport &&\n\t\t\t\t\t! hasContentOnlyLocking &&\n\t\t\t\t\tshouldShowVisualToolbar &&\n\t\t\t\t\tisMultiToolbar &&\n\t\t\t\t\tshowGroupButtons && <BlockGroupToolbar /> }\n\t\t\t\t{ ! isMultiToolbar && canEdit && (\n\t\t\t\t\t<EditSectionButton clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport && showShuffleButton && (\n\t\t\t\t\t<ChangeDesign clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport &&\n\t\t\t\t\tshowSwitchSectionStyleButton && (\n\t\t\t\t\t\t<SwitchSectionStyle clientId={ blockClientIds[ 0 ] } />\n\t\t\t\t\t) }\n\t\t\t\t{ ! areSelectedBlocksHiddenOnViewport &&\n\t\t\t\t\tshouldShowVisualToolbar && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isSectionContainer && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{ showSlots && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\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\t{ showStyleStateSlot && (\n\t\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\t\tgroup=\"style-state\"\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\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) }\n\t\t\t\t\t\t\t{ showSlots && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t\t\t</>\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<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,kBAA0B;AAC1B,qBAAuB;AACvB,qBAAiC;AACjC,oBAKO;AACP,wBAA6B;AAK7B,yBAAuB;AACvB,mCAAgC;AAChC,4BAA0B;AAC1B,qCAA2C;AAC3C,iCAA8B;AAC9B,wBAAiC;AACjC,8BAA0C;AAC1C,sCAAkC;AAClC,wC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,EAAwB,WAAY,gBAAiB;AAAA,QACtD,4CAAC,2BAAAC,SAAA,EAAkB,WAAY,gBAAiB;AAAA,SACjD;AAAA;AAAA,IA3FM;AAAA,EA4FP;AAEF;AAWe,SAAR,aAA+B,EAAE,gBAAgB,QAAQ,GAAI;AACnE,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAe;AAAA,MACf,4BAA6B;AAAA,MAC7B,6BAA8B;AAAA;AAAA,EAC/B;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "clsx", "NavigableToolbar", "BlockParentSelector", "BlockToolbarIcon", "BlockMover", "EditSectionButton", "ChangeDesign", "SwitchSectionStyle", "BlockControls", "__unstableBlockToolbarLastItem", "BlockEditVisuallyButton", "BlockSettingsMenu"]
|
|
7
7
|
}
|