@wordpress/block-editor 12.20.0 → 12.21.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 +2 -0
- package/build/components/block-actions/index.js +45 -32
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-bindings-toolbar-indicator/index.js +25 -0
- package/build/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build/components/block-edit/context.js +2 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +8 -3
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +1 -1
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +23 -7
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-popover/cover.js +68 -0
- package/build/components/block-popover/cover.js.map +1 -0
- package/build/components/block-popover/drop-zone.js +2 -3
- package/build/components/block-popover/drop-zone.js.map +1 -1
- package/build/components/block-popover/index.js +1 -19
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +2 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/index.js +21 -10
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +89 -0
- package/build/components/block-toolbar/shuffle.js.map +1 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js +43 -0
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +2 -5
- package/build/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build/components/block-tools/index.js +9 -26
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +60 -0
- package/build/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build/components/caption/index.native.js.map +1 -1
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/color-palette/control.js.map +1 -1
- package/build/components/colors-gradients/control.js +1 -1
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/global-styles/border-panel.js +21 -8
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +6 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +80 -23
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +7 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +15 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js +77 -0
- package/build/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build/components/grid-visualizer/grid-visualizer.js +81 -0
- package/build/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build/components/grid-visualizer/index.js +20 -0
- package/build/components/grid-visualizer/index.js.map +1 -0
- package/build/components/grid-visualizer/utils.js +10 -0
- package/build/components/grid-visualizer/utils.js.map +1 -0
- package/build/components/iframe/index.js +61 -16
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.native.js +7 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +9 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +2 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +1 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/link-preview.js +4 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +10 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +2 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-box-popover/index.js +3 -5
- package/build/components/resizable-box-popover/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +46 -26
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +3 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/index.js +3 -3
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +2 -1
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/utils.js +23 -6
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +34 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/border.js +6 -4
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/dimensions.js +3 -4
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-size.js +6 -7
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +39 -0
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +11 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +115 -0
- package/build/hooks/spacing-visualizer.js.map +1 -0
- package/build/hooks/use-bindings-attributes.js +171 -48
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-typography-props.js +1 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/layouts/grid.js +6 -2
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +42 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +29 -55
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -8
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +3 -20
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +27 -15
- package/build/store/selectors.js.map +1 -1
- package/build/utils/calculate-scale.js +17 -0
- package/build/utils/calculate-scale.js.map +1 -0
- package/build-module/components/block-actions/index.js +45 -32
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-bindings-toolbar-indicator/index.js +18 -0
- package/build-module/components/block-bindings-toolbar-indicator/index.js.map +1 -0
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -4
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +1 -1
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +23 -7
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -3
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-popover/cover.js +60 -0
- package/build-module/components/block-popover/cover.js.map +1 -0
- package/build-module/components/block-popover/drop-zone.js +2 -3
- package/build-module/components/block-popover/drop-zone.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -19
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +2 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -5
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -10
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +21 -11
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +82 -0
- package/build-module/components/block-toolbar/shuffle.js.map +1 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +36 -0
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -0
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +2 -5
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -26
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +54 -0
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -0
- package/build-module/components/caption/index.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/color-palette/control.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +1 -1
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +22 -10
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +82 -24
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +7 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +16 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js +69 -0
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js +73 -0
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +1 -0
- package/build-module/components/grid-visualizer/index.js +3 -0
- package/build-module/components/grid-visualizer/index.js.map +1 -0
- package/build-module/components/grid-visualizer/utils.js +4 -0
- package/build-module/components/grid-visualizer/utils.js.map +1 -0
- package/build-module/components/iframe/index.js +61 -16
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +8 -2
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +9 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +2 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +1 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +5 -2
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +11 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +3 -2
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/resizable-box-popover/index.js +3 -5
- package/build-module/components/resizable-box-popover/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +47 -28
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +3 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/index.js +3 -3
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +3 -2
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +22 -7
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +34 -8
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/border.js +7 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/dimensions.js +1 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-size.js +7 -8
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +39 -0
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +11 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +106 -0
- package/build-module/hooks/spacing-visualizer.js.map +1 -0
- package/build-module/hooks/use-bindings-attributes.js +172 -49
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +2 -3
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/layouts/grid.js +6 -2
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +7 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +42 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +29 -54
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +3 -20
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +23 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/calculate-scale.js +11 -0
- package/build-module/utils/calculate-scale.js.map +1 -0
- package/build-style/content-rtl.css +8 -2
- package/build-style/content.css +8 -2
- package/build-style/default-editor-styles-rtl.css +1 -0
- package/build-style/default-editor-styles.css +1 -0
- package/build-style/style-rtl.css +113 -22
- package/build-style/style.css +113 -22
- package/package.json +31 -31
- package/src/components/block-actions/index.js +57 -47
- package/src/components/block-bindings-toolbar-indicator/index.js +20 -0
- package/src/components/block-bindings-toolbar-indicator/style.scss +14 -0
- package/src/components/block-draggable/test/index.native.js +2 -2
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +5 -1
- package/src/components/block-inspector/index.js +7 -5
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/block-list-item.native.js +1 -1
- package/src/components/block-list/block-outline.native.js +36 -21
- package/src/components/block-list/block-selection-button.native.js +1 -3
- package/src/components/block-list/block.native.js +0 -3
- package/src/components/block-list/content.scss +5 -1
- package/src/components/block-list/test/block-outline.native.js +255 -0
- package/src/components/block-list/use-block-props/index.js +12 -2
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -7
- package/src/components/block-mover/index.native.js +1 -1
- package/src/components/block-popover/cover.js +63 -0
- package/src/components/block-popover/drop-zone.js +3 -4
- package/src/components/block-popover/index.js +1 -28
- package/src/components/block-preview/index.js +3 -1
- package/src/components/block-removal-warning-modal/index.js +5 -19
- package/src/components/block-rename/modal.js +1 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +12 -9
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -1
- package/src/components/block-toolbar/block-toolbar-menu.native.js +2 -2
- package/src/components/block-toolbar/index.js +19 -15
- package/src/components/block-toolbar/shuffle.js +93 -0
- package/src/components/block-toolbar/use-has-block-toolbar.js +49 -0
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/empty-block-inserter.js +3 -6
- package/src/components/block-tools/index.js +13 -36
- package/src/components/block-tools/use-show-block-tools.js +73 -0
- package/src/components/caption/index.native.js +1 -1
- package/src/components/child-layout-control/index.js +1 -1
- package/src/components/color-palette/control.js +1 -1
- package/src/components/colors-gradients/control.js +1 -1
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/contrast-checker/test/index.js +10 -10
- package/src/components/default-block-appender/content.scss +5 -2
- package/src/components/global-styles/border-panel.js +35 -24
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/image-settings-panel.js +1 -1
- package/src/components/global-styles/index.js +5 -1
- package/src/components/global-styles/shadow-panel-components.js +92 -23
- package/src/components/global-styles/style.scss +33 -10
- package/src/components/global-styles/test/typography-utils.js +231 -81
- package/src/components/global-styles/typography-utils.js +10 -7
- package/src/components/global-styles/use-global-styles-output.js +14 -16
- package/src/components/global-styles/utils.js +2 -8
- package/src/components/grid-visualizer/grid-item-resizer.js +100 -0
- package/src/components/grid-visualizer/grid-visualizer.js +81 -0
- package/src/components/grid-visualizer/index.js +2 -0
- package/src/components/grid-visualizer/style.scss +33 -0
- package/src/components/grid-visualizer/utils.js +5 -0
- package/src/components/iframe/index.js +78 -31
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +12 -2
- package/src/components/inserter/media-tab/media-preview.js +1 -1
- package/src/components/inserter/menu.js +10 -4
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-results.js +2 -1
- package/src/components/inserter/style.scss +10 -0
- package/src/components/inserter/tabs.js +2 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -2
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +2 -2
- package/src/components/line-height-control/test/index.js +1 -1
- package/src/components/link-control/link-preview.js +9 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-control/style.scss +9 -0
- package/src/components/list-view/block-select-button.js +16 -2
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/drop-indicator.js +1 -1
- package/src/components/list-view/index.js +1 -1
- package/src/components/list-view/style.scss +8 -0
- package/src/components/list-view/use-clipboard-handler.js +3 -2
- package/src/components/panel-color-settings/index.js +1 -1
- package/src/components/panel-color-settings/test/index.js +3 -3
- package/src/components/provider/index.js +1 -4
- package/src/components/resizable-box-popover/index.js +4 -6
- package/src/components/responsive-block-control/README.md +4 -4
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/responsive-block-control/test/index.js +5 -5
- package/src/components/rich-text/index.js +76 -53
- package/src/components/rich-text/use-enter.js +4 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
- package/src/components/url-popover/index.js +5 -5
- package/src/components/url-popover/style.scss +1 -0
- package/src/components/writing-flow/use-clipboard-handler.js +3 -2
- package/src/components/writing-flow/utils.js +31 -16
- package/src/hooks/background.js +1 -1
- package/src/hooks/block-hooks.js +47 -9
- package/src/hooks/block-hooks.scss +6 -0
- package/src/hooks/border.js +16 -4
- package/src/hooks/dimensions.js +1 -2
- package/src/hooks/font-size.js +7 -12
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout-child.js +38 -0
- package/src/hooks/layout.js +12 -1
- package/src/hooks/line-height.js +1 -1
- package/src/hooks/spacing-visualizer.js +126 -0
- package/src/hooks/{padding.scss → spacing.scss} +1 -1
- package/src/hooks/use-bindings-attributes.js +215 -65
- package/src/hooks/use-typography-props.js +2 -8
- package/src/layouts/grid.js +8 -3
- package/src/private-apis.js +6 -2
- package/src/store/actions.js +56 -18
- package/src/store/private-actions.js +34 -79
- package/src/store/private-selectors.js +0 -8
- package/src/store/reducer.js +2 -23
- package/src/store/selectors.js +41 -46
- package/src/store/test/actions.js +0 -4
- package/src/style.scss +3 -1
- package/src/utils/calculate-scale.js +20 -0
- package/build/hooks/margin.js +0 -86
- package/build/hooks/margin.js.map +0 -1
- package/build/hooks/padding.js +0 -78
- package/build/hooks/padding.js.map +0 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +0 -46
- package/build/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/build-module/hooks/margin.js +0 -78
- package/build-module/hooks/margin.js.map +0 -1
- package/build-module/hooks/padding.js +0 -70
- package/build-module/hooks/padding.js.map +0 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +0 -40
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +0 -1
- package/src/hooks/margin.js +0 -91
- package/src/hooks/padding.js +0 -82
- package/src/utils/use-can-block-toolbar-be-focused.js +0 -48
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_components","_data","_deprecated","_element","_i18n","_branch","_context","_dropIndicator","_useBlockSelection","_useListViewBlockIndexes","_useListViewClientIds","_useListViewDropZone","_useListViewExpandSelectedItem","_store","_blockSettingsDropdown","_utils","_useClipboardHandler","expanded","state","action","Array","isArray","clientIds","reduce","newState","id","type","BLOCK_LIST_ITEM_HEIGHT","exports","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","BlockSettingsDropdown","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","deprecated","since","alternative","instanceId","useInstanceId","clientIdsTree","draggedClientIds","selectedClientIds","useListViewClientIds","blockIndexes","useListViewBlockIndexes","getBlock","useSelect","blockEditorStore","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","useBlockSelection","expandedState","setExpandedState","useReducer","insertedBlock","setInsertedBlock","useState","setSelectedTreeId","useListViewExpandSelectedItem","firstSelectedBlockClientId","selectEditorBlock","useCallback","event","blockClientId","focusPosition","dropZoneRef","target","blockDropTarget","useListViewDropZone","elementRef","useRef","clipBoardRef","useClipboardHandler","selectBlock","treeGridRef","useMergeRefs","useEffect","focusListItem","current","expand","clientId","collapse","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","firstDraggedBlockClientId","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","useMemo","_blockDropTargetIndex","_firstDraggedBlockIndex","foundBlockIndex","undefined","dropPosition","contextValue","listViewInstanceId","treeGridElementRef","fixedListWindow","useFixedWindowList","useWindowing","windowOverscan","describedById","_react","createElement","AsyncModeProvider","value","default","draggedBlockClientId","listViewRef","VisuallyHidden","__experimentalTreeGrid","className","classnames","__","onCollapseRow","onExpandRow","onFocusRow","applicationAriaLabel","style","ListViewContext","Provider","parentId","PrivateListView","forwardRef","_default","props"],"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport {\n\t__experimentalTreeGrid as TreeGrid,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicatorPreview from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewBlockIndexes from './use-list-view-block-indexes';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\nimport { focusListItem } from './utils';\nimport useClipboardHandler from './use-clipboard-handler';\n\nconst expanded = ( state, action ) => {\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 36;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\tconst blockIndexes = useListViewBlockIndexes( clientIdsTree );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t\texpandedState,\n\t\tsetExpandedState,\n\t} );\n\tconst elementRef = useRef();\n\n\t// Allow handling of copy, cut, and paste events.\n\tconst clipBoardRef = useClipboardHandler( {\n\t\tselectBlock: selectEditorBlock,\n\t} );\n\n\tconst treeGridRef = useMergeRefs( [\n\t\tclipBoardRef,\n\t\telementRef,\n\t\tdropZoneRef,\n\t\tref,\n\t] );\n\n\tuseEffect( () => {\n\t\t// If a blocks are already selected when the list view is initially\n\t\t// mounted, shift focus to the first selected block.\n\t\tif ( selectedClientIds?.length ) {\n\t\t\tfocusListItem( selectedClientIds[ 0 ], elementRef?.current );\n\t\t}\n\t\t// Disable reason: Only focus on the selected item when the list view is mounted.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'expand', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tconst firstDraggedBlockClientId = draggedClientIds?.[ 0 ];\n\n\t// Convert a blockDropTarget into indexes relative to the blocks in the list view.\n\t// These values are used to determine which blocks should be displaced to make room\n\t// for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.\n\tconst { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } =\n\t\tuseMemo( () => {\n\t\t\tlet _blockDropTargetIndex, _firstDraggedBlockIndex;\n\n\t\t\tif ( blockDropTarget?.clientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ blockDropTarget.clientId ];\n\t\t\t\t// If dragging below or inside the block, treat the drop target as the next block.\n\t\t\t\t_blockDropTargetIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t} else if ( blockDropTarget === null ) {\n\t\t\t\t// A `null` value is used to indicate that the user is dragging outside of the list view.\n\t\t\t\t_blockDropTargetIndex = null;\n\t\t\t}\n\n\t\t\tif ( firstDraggedBlockClientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ firstDraggedBlockClientId ];\n\t\t\t\t_firstDraggedBlockIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockDropTargetIndex: _blockDropTargetIndex,\n\t\t\t\tblockDropPosition: blockDropTarget?.dropPosition,\n\t\t\t\tfirstDraggedBlockIndex: _firstDraggedBlockIndex,\n\t\t\t};\n\t\t}, [ blockDropTarget, blockIndexes, firstDraggedBlockClientId ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t\trootClientId,\n\t\t} ),\n\t\t[\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\trootClientId,\n\t\t]\n\t);\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\t// Ensure that the windowing logic is recalculated when the expanded state changes.\n\t\t\t// This is necessary because expanding a collapsed block in a short list view can\n\t\t\t// switch the list view to a tall list view with a scrollbar, and vice versa.\n\t\t\t// When this happens, the windowing logic needs to be recalculated to ensure that\n\t\t\t// the correct number of blocks are rendered, by rechecking for a scroll container.\n\t\t\texpandedState,\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\tconst describedById =\n\t\tdescription && `block-editor-list-view-description-${ instanceId }`;\n\n\treturn (\n\t\t<AsyncModeProvider value={ true }>\n\t\t\t<ListViewDropIndicatorPreview\n\t\t\t\tdraggedBlockClientId={ firstDraggedBlockClientId }\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t{ description && (\n\t\t\t\t<VisuallyHidden id={ describedById }>\n\t\t\t\t\t{ description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName={ classnames( 'block-editor-list-view-tree', {\n\t\t\t\t\t'is-dragging':\n\t\t\t\t\t\tdraggedClientIds?.length > 0 &&\n\t\t\t\t\t\tblockDropTargetIndex !== undefined,\n\t\t\t\t} ) }\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\taria-describedby={ describedById }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-admin--list-view-dragged-items-height':\n\t\t\t\t\t\tdraggedClientIds?.length\n\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\tBLOCK_LIST_ITEM_HEIGHT *\n\t\t\t\t\t\t\t\t\t( draggedClientIds.length - 1 )\n\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t: null,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t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AAA,CAAAsH,eAAA,GAAG,IAAAC,mBAAU,EAAEtH,iBAAkB,CAAC;;AAE9D;AACA;AAAA,IAAAuH,QAAA,GAAAxH,OAAA,CAAAsG,OAAA,GACe,IAAAiB,mBAAU,EAAE,CAAEE,KAAK,EAAE1G,GAAG,KAAM;EAC5C,OACC,IAAAmF,MAAA,CAAAC,aAAA,EAACmB,eAAe;IACfvG,GAAG,EAAGA,GAAK;IAAA,GACN0G,KAAK;IACVnH,YAAY,EAAG,KAAO;IACtBI,YAAY,EAAG,IAAM;IACrBE,QAAQ,EAAG,IAAM;IACjBC,sBAAsB,EAAG,IAAM;IAC/BN,iBAAiB,EAAGiF;EAAW,CAC/B,CAAC;AAEJ,CAAE,CAAC"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_components","_data","_deprecated","_element","_i18n","_branch","_context","_dropIndicator","_useBlockSelection","_useListViewBlockIndexes","_useListViewClientIds","_useListViewDropZone","_useListViewExpandSelectedItem","_store","_blockSettingsDropdown","_utils","_useClipboardHandler","expanded","state","action","Array","isArray","clientIds","reduce","newState","id","type","BLOCK_LIST_ITEM_HEIGHT","exports","ListViewComponent","blocks","dropZoneElement","showBlockMovers","isExpanded","showAppender","blockSettingsMenu","BlockSettingsMenu","BlockSettingsDropdown","rootClientId","description","onSelect","additionalBlockContent","AdditionalBlockContent","ref","deprecated","since","alternative","instanceId","useInstanceId","clientIdsTree","draggedClientIds","selectedClientIds","useListViewClientIds","blockIndexes","useListViewBlockIndexes","getBlock","useSelect","blockEditorStore","visibleBlockCount","shouldShowInnerBlocks","select","getGlobalBlockCount","getClientIdsOfDescendants","__unstableGetEditorMode","draggedBlockCount","length","updateBlockSelection","useBlockSelection","expandedState","setExpandedState","useReducer","insertedBlock","setInsertedBlock","useState","setSelectedTreeId","useListViewExpandSelectedItem","firstSelectedBlockClientId","selectEditorBlock","useCallback","event","blockClientId","focusPosition","dropZoneRef","target","blockDropTarget","useListViewDropZone","elementRef","useRef","clipBoardRef","useClipboardHandler","selectBlock","treeGridRef","useMergeRefs","useEffect","focusListItem","current","expand","clientId","collapse","expandRow","row","dataset","block","collapseRow","focusRow","startRow","endRow","shiftKey","firstDraggedBlockClientId","blockDropTargetIndex","blockDropPosition","firstDraggedBlockIndex","useMemo","_blockDropTargetIndex","_firstDraggedBlockIndex","foundBlockIndex","undefined","dropPosition","contextValue","listViewInstanceId","treeGridElementRef","fixedListWindow","useFixedWindowList","useWindowing","windowOverscan","describedById","_react","createElement","AsyncModeProvider","value","default","draggedBlockClientId","listViewRef","VisuallyHidden","__experimentalTreeGrid","className","classnames","__","onCollapseRow","onExpandRow","onFocusRow","applicationAriaLabel","style","ListViewContext","Provider","parentId","PrivateListView","forwardRef","_default","props"],"sources":["@wordpress/block-editor/src/components/list-view/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInstanceId,\n\tuseMergeRefs,\n\t__experimentalUseFixedWindowList as useFixedWindowList,\n} from '@wordpress/compose';\nimport {\n\t__experimentalTreeGrid as TreeGrid,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseReducer,\n\tforwardRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewBranch from './branch';\nimport { ListViewContext } from './context';\nimport ListViewDropIndicatorPreview from './drop-indicator';\nimport useBlockSelection from './use-block-selection';\nimport useListViewBlockIndexes from './use-list-view-block-indexes';\nimport useListViewClientIds from './use-list-view-client-ids';\nimport useListViewDropZone from './use-list-view-drop-zone';\nimport useListViewExpandSelectedItem from './use-list-view-expand-selected-item';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockSettingsDropdown } from '../block-settings-menu/block-settings-dropdown';\nimport { focusListItem } from './utils';\nimport useClipboardHandler from './use-clipboard-handler';\n\nconst expanded = ( state, action ) => {\n\tif ( Array.isArray( action.clientIds ) ) {\n\t\treturn {\n\t\t\t...state,\n\t\t\t...action.clientIds.reduce(\n\t\t\t\t( newState, id ) => ( {\n\t\t\t\t\t...newState,\n\t\t\t\t\t[ id ]: action.type === 'expand',\n\t\t\t\t} ),\n\t\t\t\t{}\n\t\t\t),\n\t\t};\n\t}\n\treturn state;\n};\n\nexport const BLOCK_LIST_ITEM_HEIGHT = 36;\n\n/** @typedef {import('react').ComponentType} ComponentType */\n/** @typedef {import('react').Ref<HTMLElement>} Ref */\n\n/**\n * Show a hierarchical list of blocks.\n *\n * @param {Object} props Components props.\n * @param {string} props.id An HTML element id for the root element of ListView.\n * @param {Array} props.blocks _deprecated_ Custom subset of block client IDs to be used instead of the default hierarchy.\n * @param {?HTMLElement} props.dropZoneElement Optional element to be used as the drop zone.\n * @param {?boolean} props.showBlockMovers Flag to enable block movers. Defaults to `false`.\n * @param {?boolean} props.isExpanded Flag to determine whether nested levels are expanded by default. Defaults to `false`.\n * @param {?boolean} props.showAppender Flag to show or hide the block appender. Defaults to `false`.\n * @param {?ComponentType} props.blockSettingsMenu Optional more menu substitution. Defaults to the standard `BlockSettingsDropdown` component.\n * @param {string} props.rootClientId The client id of the root block from which we determine the blocks to show in the list.\n * @param {string} props.description Optional accessible description for the tree grid component.\n * @param {?Function} props.onSelect Optional callback to be invoked when a block is selected. Receives the block object that was selected.\n * @param {?ComponentType} props.additionalBlockContent Component that renders additional block content UI.\n * @param {Ref} ref Forwarded ref\n */\nfunction ListViewComponent(\n\t{\n\t\tid,\n\t\tblocks,\n\t\tdropZoneElement,\n\t\tshowBlockMovers = false,\n\t\tisExpanded = false,\n\t\tshowAppender = false,\n\t\tblockSettingsMenu: BlockSettingsMenu = BlockSettingsDropdown,\n\t\trootClientId,\n\t\tdescription,\n\t\tonSelect,\n\t\tadditionalBlockContent: AdditionalBlockContent,\n\t},\n\tref\n) {\n\t// This can be removed once we no longer need to support the blocks prop.\n\tif ( blocks ) {\n\t\tdeprecated(\n\t\t\t'`blocks` property in `wp.blockEditor.__experimentalListView`',\n\t\t\t{\n\t\t\t\tsince: '6.3',\n\t\t\t\talternative: '`rootClientId` property',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst instanceId = useInstanceId( ListViewComponent );\n\tconst { clientIdsTree, draggedClientIds, selectedClientIds } =\n\t\tuseListViewClientIds( { blocks, rootClientId } );\n\tconst blockIndexes = useListViewBlockIndexes( clientIdsTree );\n\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst { visibleBlockCount, shouldShowInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tgetClientIdsOfDescendants,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst draggedBlockCount =\n\t\t\t\tdraggedClientIds?.length > 0\n\t\t\t\t\t? getClientIdsOfDescendants( draggedClientIds ).length + 1\n\t\t\t\t\t: 0;\n\t\t\treturn {\n\t\t\t\tvisibleBlockCount: getGlobalBlockCount() - draggedBlockCount,\n\t\t\t\tshouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',\n\t\t\t};\n\t\t},\n\t\t[ draggedClientIds ]\n\t);\n\n\tconst { updateBlockSelection } = useBlockSelection();\n\n\tconst [ expandedState, setExpandedState ] = useReducer( expanded, {} );\n\n\tconst [ insertedBlock, setInsertedBlock ] = useState( null );\n\n\tconst { setSelectedTreeId } = useListViewExpandSelectedItem( {\n\t\tfirstSelectedBlockClientId: selectedClientIds[ 0 ],\n\t\tsetExpandedState,\n\t} );\n\tconst selectEditorBlock = useCallback(\n\t\t/**\n\t\t * @param {MouseEvent | KeyboardEvent | undefined} event\n\t\t * @param {string} blockClientId\n\t\t * @param {null | undefined | -1 | 1} focusPosition\n\t\t */\n\t\t( event, blockClientId, focusPosition ) => {\n\t\t\tupdateBlockSelection( event, blockClientId, null, focusPosition );\n\t\t\tsetSelectedTreeId( blockClientId );\n\t\t\tif ( onSelect ) {\n\t\t\t\tonSelect( getBlock( blockClientId ) );\n\t\t\t}\n\t\t},\n\t\t[ setSelectedTreeId, updateBlockSelection, onSelect, getBlock ]\n\t);\n\n\tconst { ref: dropZoneRef, target: blockDropTarget } = useListViewDropZone( {\n\t\tdropZoneElement,\n\t\texpandedState,\n\t\tsetExpandedState,\n\t} );\n\tconst elementRef = useRef();\n\n\t// Allow handling of copy, cut, and paste events.\n\tconst clipBoardRef = useClipboardHandler( {\n\t\tselectBlock: selectEditorBlock,\n\t} );\n\n\tconst treeGridRef = useMergeRefs( [\n\t\tclipBoardRef,\n\t\telementRef,\n\t\tdropZoneRef,\n\t\tref,\n\t] );\n\n\tuseEffect( () => {\n\t\t// If a blocks are already selected when the list view is initially\n\t\t// mounted, shift focus to the first selected block.\n\t\tif ( selectedClientIds?.length ) {\n\t\t\tfocusListItem( selectedClientIds[ 0 ], elementRef?.current );\n\t\t}\n\t\t// Disable reason: Only focus on the selected item when the list view is mounted.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst expand = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'expand', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst collapse = useCallback(\n\t\t( clientId ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetExpandedState( { type: 'collapse', clientIds: [ clientId ] } );\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\tconst expandRow = useCallback(\n\t\t( row ) => {\n\t\t\texpand( row?.dataset?.block );\n\t\t},\n\t\t[ expand ]\n\t);\n\tconst collapseRow = useCallback(\n\t\t( row ) => {\n\t\t\tcollapse( row?.dataset?.block );\n\t\t},\n\t\t[ collapse ]\n\t);\n\tconst focusRow = useCallback(\n\t\t( event, startRow, endRow ) => {\n\t\t\tif ( event.shiftKey ) {\n\t\t\t\tupdateBlockSelection(\n\t\t\t\t\tevent,\n\t\t\t\t\tstartRow?.dataset?.block,\n\t\t\t\t\tendRow?.dataset?.block\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ updateBlockSelection ]\n\t);\n\n\tconst firstDraggedBlockClientId = draggedClientIds?.[ 0 ];\n\n\t// Convert a blockDropTarget into indexes relative to the blocks in the list view.\n\t// These values are used to determine which blocks should be displaced to make room\n\t// for the drop indicator. See `ListViewBranch` and `getDragDisplacementValues`.\n\tconst { blockDropTargetIndex, blockDropPosition, firstDraggedBlockIndex } =\n\t\tuseMemo( () => {\n\t\t\tlet _blockDropTargetIndex, _firstDraggedBlockIndex;\n\n\t\t\tif ( blockDropTarget?.clientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ blockDropTarget.clientId ];\n\t\t\t\t// If dragging below or inside the block, treat the drop target as the next block.\n\t\t\t\t_blockDropTargetIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t} else if ( blockDropTarget === null ) {\n\t\t\t\t// A `null` value is used to indicate that the user is dragging outside of the list view.\n\t\t\t\t_blockDropTargetIndex = null;\n\t\t\t}\n\n\t\t\tif ( firstDraggedBlockClientId ) {\n\t\t\t\tconst foundBlockIndex =\n\t\t\t\t\tblockIndexes[ firstDraggedBlockClientId ];\n\t\t\t\t_firstDraggedBlockIndex =\n\t\t\t\t\tfoundBlockIndex === undefined ||\n\t\t\t\t\tblockDropTarget?.dropPosition === 'top'\n\t\t\t\t\t\t? foundBlockIndex\n\t\t\t\t\t\t: foundBlockIndex + 1;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tblockDropTargetIndex: _blockDropTargetIndex,\n\t\t\t\tblockDropPosition: blockDropTarget?.dropPosition,\n\t\t\t\tfirstDraggedBlockIndex: _firstDraggedBlockIndex,\n\t\t\t};\n\t\t}, [ blockDropTarget, blockIndexes, firstDraggedBlockClientId ] );\n\n\tconst contextValue = useMemo(\n\t\t() => ( {\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tlistViewInstanceId: instanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\ttreeGridElementRef: elementRef,\n\t\t\trootClientId,\n\t\t} ),\n\t\t[\n\t\t\tblockDropPosition,\n\t\t\tblockDropTargetIndex,\n\t\t\tblockIndexes,\n\t\t\tdraggedClientIds,\n\t\t\texpandedState,\n\t\t\texpand,\n\t\t\tfirstDraggedBlockIndex,\n\t\t\tcollapse,\n\t\t\tBlockSettingsMenu,\n\t\t\tinstanceId,\n\t\t\tAdditionalBlockContent,\n\t\t\tinsertedBlock,\n\t\t\tsetInsertedBlock,\n\t\t\trootClientId,\n\t\t]\n\t);\n\n\t// List View renders a fixed number of items and relies on each having a fixed item height of 36px.\n\t// If this value changes, we should also change the itemHeight value set in useFixedWindowList.\n\t// See: https://github.com/WordPress/gutenberg/pull/35230 for additional context.\n\tconst [ fixedListWindow ] = useFixedWindowList(\n\t\telementRef,\n\t\tBLOCK_LIST_ITEM_HEIGHT,\n\t\tvisibleBlockCount,\n\t\t{\n\t\t\t// Ensure that the windowing logic is recalculated when the expanded state changes.\n\t\t\t// This is necessary because expanding a collapsed block in a short list view can\n\t\t\t// switch the list view to a tall list view with a scrollbar, and vice versa.\n\t\t\t// When this happens, the windowing logic needs to be recalculated to ensure that\n\t\t\t// the correct number of blocks are rendered, by rechecking for a scroll container.\n\t\t\texpandedState,\n\t\t\tuseWindowing: true,\n\t\t\twindowOverscan: 40,\n\t\t}\n\t);\n\n\t// If there are no blocks to show and we're not showing the appender, do not render the list view.\n\tif ( ! clientIdsTree.length && ! showAppender ) {\n\t\treturn null;\n\t}\n\n\tconst describedById =\n\t\tdescription && `block-editor-list-view-description-${ instanceId }`;\n\n\treturn (\n\t\t<AsyncModeProvider value>\n\t\t\t<ListViewDropIndicatorPreview\n\t\t\t\tdraggedBlockClientId={ firstDraggedBlockClientId }\n\t\t\t\tlistViewRef={ elementRef }\n\t\t\t\tblockDropTarget={ blockDropTarget }\n\t\t\t/>\n\t\t\t{ description && (\n\t\t\t\t<VisuallyHidden id={ describedById }>\n\t\t\t\t\t{ description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t\t<TreeGrid\n\t\t\t\tid={ id }\n\t\t\t\tclassName={ classnames( 'block-editor-list-view-tree', {\n\t\t\t\t\t'is-dragging':\n\t\t\t\t\t\tdraggedClientIds?.length > 0 &&\n\t\t\t\t\t\tblockDropTargetIndex !== undefined,\n\t\t\t\t} ) }\n\t\t\t\taria-label={ __( 'Block navigation structure' ) }\n\t\t\t\tref={ treeGridRef }\n\t\t\t\tonCollapseRow={ collapseRow }\n\t\t\t\tonExpandRow={ expandRow }\n\t\t\t\tonFocusRow={ focusRow }\n\t\t\t\tapplicationAriaLabel={ __( 'Block navigation structure' ) }\n\t\t\t\taria-describedby={ describedById }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-admin--list-view-dragged-items-height':\n\t\t\t\t\t\tdraggedClientIds?.length\n\t\t\t\t\t\t\t? `${\n\t\t\t\t\t\t\t\t\tBLOCK_LIST_ITEM_HEIGHT *\n\t\t\t\t\t\t\t\t\t( draggedClientIds.length - 1 )\n\t\t\t\t\t\t\t }px`\n\t\t\t\t\t\t\t: null,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<ListViewContext.Provider value={ contextValue }>\n\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\t\tparentId={ rootClientId }\n\t\t\t\t\t\tselectBlock={ selectEditorBlock }\n\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\tshouldShowInnerBlocks={ shouldShowInnerBlocks }\n\t\t\t\t\t\tshowAppender={ showAppender }\n\t\t\t\t\t/>\n\t\t\t\t</ListViewContext.Provider>\n\t\t\t</TreeGrid>\n\t\t</AsyncModeProvider>\n\t);\n}\n\n// This is the private API for the ListView component.\n// It allows access to all props, not just the public ones.\nexport const PrivateListView = forwardRef( ListViewComponent );\n\n// This is the public API for the ListView component.\n// We wrap the PrivateListView component to hide some props from the public API.\nexport default forwardRef( ( props, ref ) => {\n\treturn (\n\t\t<PrivateListView\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tshowAppender={ false }\n\t\t\trootClientId={ null }\n\t\t\tonSelect={ null }\n\t\t\tadditionalBlockContent={ null }\n\t\t\tblockSettingsMenu={ undefined }\n\t\t/>\n\t);\n} );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AASA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,wBAAA,GAAAZ,sBAAA,CAAAC,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
24
24
|
selectBlock
|
|
25
25
|
}) {
|
|
26
|
+
const registry = (0, _data.useRegistry)();
|
|
26
27
|
const {
|
|
27
28
|
getBlockOrder,
|
|
28
29
|
getBlockRootClientId,
|
|
@@ -99,7 +100,7 @@ function useClipboardHandler({
|
|
|
99
100
|
}
|
|
100
101
|
notifyCopy(event.type, selectedBlockClientIds);
|
|
101
102
|
const blocks = getBlocksByClientId(selectedBlockClientIds);
|
|
102
|
-
(0, _utils2.setClipboardBlocks)(event, blocks);
|
|
103
|
+
(0, _utils2.setClipboardBlocks)(event, blocks, registry);
|
|
103
104
|
}
|
|
104
105
|
if (event.type === 'cut') {
|
|
105
106
|
var _getPreviousBlockClie;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_store","_useNotifyCopy","_utils","_utils2","useClipboardHandler","selectBlock","getBlockOrder","getBlockRootClientId","getBlocksByClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getSettings","canInsertBlockType","canRemoveBlocks","useSelect","blockEditorStore","flashBlock","removeBlocks","replaceBlocks","insertBlocks","useDispatch","notifyCopy","useNotifyCopy","useRefEffect","node","updateFocusAndSelection","focusClientId","shouldSelectBlock","undefined","focusListItem","getBlocksToUpdate","clientId","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","originallySelectedBlockClientIds","handler","event","defaultPrevented","contains","target","ownerDocument","activeElement","listViewRow","closest","dataset","block","length","preventDefault","type","blocks","setClipboardBlocks","_getPreviousBlockClie","blockToFocus","shouldUpdateSelection","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","getPasteBlocks","selectedBlockClientId","every","name","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/list-view/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { focusListItem } from './utils';\nimport { getPasteBlocks, setClipboardBlocks } from '../writing-flow/utils';\n\n// This hook borrows from useClipboardHandler in ../writing-flow/use-clipboard-handler.js\n// and adds behaviour for the list view, while skipping partial selection.\nexport default function useClipboardHandler( { selectBlock } ) {\n\tconst {\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlocksByClientId,\n\t\tgetPreviousBlockClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetSettings,\n\t\tcanInsertBlockType,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { flashBlock, removeBlocks, replaceBlocks, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction updateFocusAndSelection( focusClientId, shouldSelectBlock ) {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tfocusListItem( focusClientId, node );\n\t\t}\n\n\t\t// Determine which blocks to update:\n\t\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t\t// If the focused block is not part of the block selection, only update the focused block.\n\t\tfunction getBlocksToUpdate( clientId ) {\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\t\tconst isUpdatingSelectedBlocks =\n\t\t\t\tselectedBlockClientIds.includes( clientId );\n\t\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t\t: clientId;\n\t\t\tconst firstBlockRootClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\n\t\t\treturn {\n\t\t\t\tblocksToUpdate,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\toriginallySelectedBlockClientIds: selectedBlockClientIds,\n\t\t\t};\n\t\t}\n\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was possibly already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only handle events that occur within the list view.\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Retrieve the block clientId associated with the focused list view row.\n\t\t\t// This enables applying copy / cut / paste behavior to the focused block,\n\t\t\t// rather than just the blocks that are currently selected.\n\t\t\tconst listViewRow =\n\t\t\t\tevent.target.ownerDocument.activeElement?.closest(\n\t\t\t\t\t'[role=row]'\n\t\t\t\t);\n\t\t\tconst clientId = listViewRow?.dataset?.block;\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: selectedBlockClientIds,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\toriginallySelectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate( clientId );\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\n\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\tconst blocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\tsetClipboardBlocks( event, blocks );\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\t\tif (\n\t\t\t\t\t! canRemoveBlocks(\n\t\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\t\tfirstBlockRootClientId\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet blockToFocus =\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t\t// fallback to focus the parent block.\n\t\t\t\t\tfirstBlockRootClientId;\n\n\t\t\t\t// Remove blocks, but don't update selection, and it will be handled below.\n\t\t\t\tremoveBlocks( selectedBlockClientIds, false );\n\n\t\t\t\t// Update the selection if the original selection has been removed.\n\t\t\t\tconst shouldUpdateSelection =\n\t\t\t\t\toriginallySelectedBlockClientIds.length > 0 &&\n\t\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\t\tif ( ! blockToFocus ) {\n\t\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t\t}\n\n\t\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\n\t\t\t\t);\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\t// If a single block is focused, and the blocks to be posted can\n\t\t\t\t\t// be inserted within the block, then append the pasted blocks\n\t\t\t\t\t// within the focused block. For example, if you have copied a paragraph\n\t\t\t\t\t// block and paste it within a single Group block, this will append\n\t\t\t\t\t// the paragraph block within the Group block.\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\tupdateFocusAndSelection( blocks[ 0 ]?.clientId, false );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t\tupdateFocusAndSelection( blocks[ 0 ]?.clientId, false );\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACe,SAASM,mBAAmBA,CAAE;EAAEC;AAAY,CAAC,EAAG;EAC9D,MAAM;IACLC,aAAa;IACbC,oBAAoB;IACpBC,mBAAmB;IACnBC,wBAAwB;IACxBC,yBAAyB;IACzBC,WAAW;IACXC,kBAAkB;IAClBC;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vD,OAAO,MAAM;MACZf,IAAI,CAACoB,aAAa,CAACqB,mBAAmB,CAAE,MAAM,EAAE1B,OAAQ,CAAC;MACzDf,IAAI,CAACoB,aAAa,CAACqB,mBAAmB,CAAE,KAAK,EAAE1B,OAAQ,CAAC;MACxDf,IAAI,CAACoB,aAAa,CAACqB,mBAAmB,CAAE,OAAO,EAAE1B,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
|
|
1
|
+
{"version":3,"names":["_data","require","_compose","_store","_useNotifyCopy","_utils","_utils2","useClipboardHandler","selectBlock","registry","useRegistry","getBlockOrder","getBlockRootClientId","getBlocksByClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getSettings","canInsertBlockType","canRemoveBlocks","useSelect","blockEditorStore","flashBlock","removeBlocks","replaceBlocks","insertBlocks","useDispatch","notifyCopy","useNotifyCopy","useRefEffect","node","updateFocusAndSelection","focusClientId","shouldSelectBlock","undefined","focusListItem","getBlocksToUpdate","clientId","selectedBlockClientIds","isUpdatingSelectedBlocks","includes","firstBlockClientId","firstBlockRootClientId","blocksToUpdate","originallySelectedBlockClientIds","handler","event","defaultPrevented","contains","target","ownerDocument","activeElement","listViewRow","closest","dataset","block","length","preventDefault","type","blocks","setClipboardBlocks","_getPreviousBlockClie","blockToFocus","shouldUpdateSelection","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","getPasteBlocks","selectedBlockClientId","every","name","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/list-view/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { focusListItem } from './utils';\nimport { getPasteBlocks, setClipboardBlocks } from '../writing-flow/utils';\n\n// This hook borrows from useClipboardHandler in ../writing-flow/use-clipboard-handler.js\n// and adds behaviour for the list view, while skipping partial selection.\nexport default function useClipboardHandler( { selectBlock } ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlocksByClientId,\n\t\tgetPreviousBlockClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetSettings,\n\t\tcanInsertBlockType,\n\t\tcanRemoveBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst { flashBlock, removeBlocks, replaceBlocks, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction updateFocusAndSelection( focusClientId, shouldSelectBlock ) {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tfocusListItem( focusClientId, node );\n\t\t}\n\n\t\t// Determine which blocks to update:\n\t\t// If the current (focused) block is part of the block selection, use the whole selection.\n\t\t// If the focused block is not part of the block selection, only update the focused block.\n\t\tfunction getBlocksToUpdate( clientId ) {\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\t\tconst isUpdatingSelectedBlocks =\n\t\t\t\tselectedBlockClientIds.includes( clientId );\n\t\t\tconst firstBlockClientId = isUpdatingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds[ 0 ]\n\t\t\t\t: clientId;\n\t\t\tconst firstBlockRootClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\n\t\t\tconst blocksToUpdate = isUpdatingSelectedBlocks\n\t\t\t\t? selectedBlockClientIds\n\t\t\t\t: [ clientId ];\n\n\t\t\treturn {\n\t\t\t\tblocksToUpdate,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\toriginallySelectedBlockClientIds: selectedBlockClientIds,\n\t\t\t};\n\t\t}\n\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was possibly already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only handle events that occur within the list view.\n\t\t\tif ( ! node.contains( event.target.ownerDocument.activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Retrieve the block clientId associated with the focused list view row.\n\t\t\t// This enables applying copy / cut / paste behavior to the focused block,\n\t\t\t// rather than just the blocks that are currently selected.\n\t\t\tconst listViewRow =\n\t\t\t\tevent.target.ownerDocument.activeElement?.closest(\n\t\t\t\t\t'[role=row]'\n\t\t\t\t);\n\t\t\tconst clientId = listViewRow?.dataset?.block;\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tblocksToUpdate: selectedBlockClientIds,\n\t\t\t\tfirstBlockClientId,\n\t\t\t\tfirstBlockRootClientId,\n\t\t\t\toriginallySelectedBlockClientIds,\n\t\t\t} = getBlocksToUpdate( clientId );\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\n\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\tconst blocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\tsetClipboardBlocks( event, blocks, registry );\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// Don't update the selection if the blocks cannot be deleted.\n\t\t\t\tif (\n\t\t\t\t\t! canRemoveBlocks(\n\t\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\t\tfirstBlockRootClientId\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet blockToFocus =\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ) ??\n\t\t\t\t\t// If the previous block is not found (when the first block is deleted),\n\t\t\t\t\t// fallback to focus the parent block.\n\t\t\t\t\tfirstBlockRootClientId;\n\n\t\t\t\t// Remove blocks, but don't update selection, and it will be handled below.\n\t\t\t\tremoveBlocks( selectedBlockClientIds, false );\n\n\t\t\t\t// Update the selection if the original selection has been removed.\n\t\t\t\tconst shouldUpdateSelection =\n\t\t\t\t\toriginallySelectedBlockClientIds.length > 0 &&\n\t\t\t\t\tgetSelectedBlockClientIds().length === 0;\n\n\t\t\t\t// If there's no previous block nor parent block, focus the first block.\n\t\t\t\tif ( ! blockToFocus ) {\n\t\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t\t}\n\n\t\t\t\tupdateFocusAndSelection( blockToFocus, shouldUpdateSelection );\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst blocks = getPasteBlocks(\n\t\t\t\t\tevent,\n\t\t\t\t\tcanUserUseUnfilteredHTML\n\t\t\t\t);\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tconst [ selectedBlockClientId ] = selectedBlockClientIds;\n\n\t\t\t\t\t// If a single block is focused, and the blocks to be posted can\n\t\t\t\t\t// be inserted within the block, then append the pasted blocks\n\t\t\t\t\t// within the focused block. For example, if you have copied a paragraph\n\t\t\t\t\t// block and paste it within a single Group block, this will append\n\t\t\t\t\t// the paragraph block within the Group block.\n\t\t\t\t\tif (\n\t\t\t\t\t\tblocks.every( ( block ) =>\n\t\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tinsertBlocks(\n\t\t\t\t\t\t\tblocks,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tselectedBlockClientId\n\t\t\t\t\t\t);\n\t\t\t\t\t\tupdateFocusAndSelection( blocks[ 0 ]?.clientId, false );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treplaceBlocks(\n\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\tblocks,\n\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t-1\n\t\t\t\t);\n\t\t\t\tupdateFocusAndSelection( blocks[ 0 ]?.clientId, false );\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACe,SAASM,mBAAmBA,CAAE;EAAEC;AAAY,CAAC,EAAG;EAC9D,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IACLC,aAAa;IACbC,oBAAoB;IACpBC,mBAAmB;IACnBC,wBAAwB;IACxBC,yBAAyB;IACzBC,WAAW;IACXC,kBAAkB;IAClBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;EACjC,MAAM;IAA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BAAmB,CAAE,MAAM,EAAE1B,OAAQ,CAAC;MACzDf,IAAI,CAACoB,aAAa,CAACqB,mBAAmB,CAAE,KAAK,EAAE1B,OAAQ,CAAC;MACxDf,IAAI,CAACoB,aAAa,CAACqB,mBAAmB,CAAE,OAAO,EAAE1B,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_panelColorGradientSettings","_interopRequireDefault","require","PanelColorSettings","colorSettings","props","settings","map","setting","value","onChange","otherSettings","colorValue","onColorChange","_react","createElement","default","gradients","disableCustomGradients","_default","exports"],"sources":["@wordpress/block-editor/src/components/panel-color-settings/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PanelColorGradientSettings from '../colors-gradients/panel-color-gradient-settings';\n\nconst PanelColorSettings = ( { colorSettings, ...props } ) => {\n\tconst settings = colorSettings.map( ( setting ) => {\n\t\tif ( ! setting ) {\n\t\t\treturn setting;\n\t\t}\n\t\tconst { value, onChange, ...otherSettings } = setting;\n\t\treturn {\n\t\t\t...otherSettings,\n\t\t\tcolorValue: value,\n\t\t\tonColorChange: onChange,\n\t\t};\n\t} );\n\treturn (\n\t\t<PanelColorGradientSettings\n\t\t\tsettings={ settings }\n\t\t\tgradients={ [] }\n\t\t\tdisableCustomGradients
|
|
1
|
+
{"version":3,"names":["_panelColorGradientSettings","_interopRequireDefault","require","PanelColorSettings","colorSettings","props","settings","map","setting","value","onChange","otherSettings","colorValue","onColorChange","_react","createElement","default","gradients","disableCustomGradients","_default","exports"],"sources":["@wordpress/block-editor/src/components/panel-color-settings/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PanelColorGradientSettings from '../colors-gradients/panel-color-gradient-settings';\n\nconst PanelColorSettings = ( { colorSettings, ...props } ) => {\n\tconst settings = colorSettings.map( ( setting ) => {\n\t\tif ( ! setting ) {\n\t\t\treturn setting;\n\t\t}\n\t\tconst { value, onChange, ...otherSettings } = setting;\n\t\treturn {\n\t\t\t...otherSettings,\n\t\t\tcolorValue: value,\n\t\t\tonColorChange: onChange,\n\t\t};\n\t} );\n\treturn (\n\t\t<PanelColorGradientSettings\n\t\t\tsettings={ settings }\n\t\t\tgradients={ [] }\n\t\t\tdisableCustomGradients\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\nexport default PanelColorSettings;\n"],"mappings":";;;;;;;;AAGA,IAAAA,2BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAGA,CAAE;EAAEC,aAAa;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC7D,MAAMC,QAAQ,GAAGF,aAAa,CAACG,GAAG,CAAIC,OAAO,IAAM;IAClD,IAAK,CAAEA,OAAO,EAAG;MAChB,OAAOA,OAAO;IACf;IACA,MAAM;MAAEC,KAAK;MAAEC,QAAQ;MAAE,GAAGC;IAAc,CAAC,GAAGH,OAAO;IACrD,OAAO;MACN,GAAGG,aAAa;MAChBC,UAAU,EAAEH,KAAK;MACjBI,aAAa,EAAEH;IAChB,CAAC;EACF,CAAE,CAAC;EACH,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACf,2BAAA,CAAAgB,OAA0B;IAC1BV,QAAQ,EAAGA,QAAU;IACrBW,SAAS,EAAG,EAAI;IAChBC,sBAAsB;IAAA,GACjBb;EAAK,CACV,CAAC;AAEJ,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GACab,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_components","_withRegistryProvider","_interopRequireDefault","_useBlockSync","_store","_blockRefsProvider","_lockUnlock","_keyboardShortcuts","ExperimentalBlockEditorProvider","exports","withRegistryProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","unlock","useDispatch","blockEditorStore","useEffect","__internalIsInitialized","reset","useBlockSync","_react","createElement","SlotFillProvider","passthrough","__unstableIsPreviewMode","default","Register","BlockRefsProvider","BlockEditorProvider","_default"],"sources":["@wordpress/block-editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn (\n\t\t\t<SlotFillProvider passthrough>\n\t\t\t\t{ ! settings?.__unstableIsPreviewMode && (\n\t\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t) }\n\t\t\t\t<BlockRefsProvider>{ children }</BlockRefsProvider>\n\t\t\t</SlotFillProvider>\n\t\t);\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_components","_withRegistryProvider","_interopRequireDefault","_useBlockSync","_store","_blockRefsProvider","_lockUnlock","_keyboardShortcuts","ExperimentalBlockEditorProvider","exports","withRegistryProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","unlock","useDispatch","blockEditorStore","useEffect","__internalIsInitialized","reset","useBlockSync","_react","createElement","SlotFillProvider","passthrough","__unstableIsPreviewMode","default","Register","BlockRefsProvider","BlockEditorProvider","_default"],"sources":["@wordpress/block-editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn (\n\t\t\t<SlotFillProvider passthrough>\n\t\t\t\t{ ! settings?.__unstableIsPreviewMode && (\n\t\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t) }\n\t\t\t\t<BlockRefsProvider>{ children }</BlockRefsProvider>\n\t\t\t</SlotFillProvider>\n\t\t);\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider { ...props } stripExperimentalSettings>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,qBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAL,sBAAA,CAAAJ,OAAA;AAfA;AACA;AACA;;AAKA;AACA;AACA;;AAQA;;AAEO,MAAMU,+BAA+B,GAAAC,OAAA,CAAAD,+BAAA,GAAG,IAAAE,6BAAoB,EAChEC,KAAK,IAAM;EACZ,MAAM;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,yBAAyB,GAAG;EAAM,CAAC,GAAGH,KAAK;EAEvE,MAAM;IAAEI;EAA6B,CAAC,GAAG,IAAAC,kBAAM,EAC9C,IAAAC,iBAAW,EAAEC,YAAiB,CAC/B,CAAC;EACD,IAAAC,kBAAS,EAAE,MAAM;IAChBJ,4BAA4B,CAC3B;MACC,GAAGF,QAAQ;MACXO,uBAAuB,EAAE;IAC1B,CAAC,EACD;MACCN,yBAAyB;MACzBO,KAAK,EAAE;IACR,CACD,CAAC;EACF,CAAC,EAAE,CACFR,QAAQ,EACRC,yBAAyB,EACzBC,4BAA4B,CAC3B,CAAC;;EAEH;EACA,IAAAO,qBAAY,EAAEX,KAAM,CAAC;EAErB,OACC,IAAAY,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAyB,gBAAgB;IAACC,WAAW;EAAA,GAC1B,CAAEb,QAAQ,EAAEc,uBAAuB,IACpC,IAAAJ,MAAA,CAAAC,aAAA,EAACjB,kBAAA,CAAAqB,OAAiB,CAACC,QAAQ,MAAE,CAC7B,EACD,IAAAN,MAAA,CAAAC,aAAA,EAACnB,kBAAA,CAAAyB,iBAAiB,QAAGlB,QAA6B,CACjC,CAAC;AAErB,CACD,CAAC;AAEM,MAAMmB,mBAAmB,GAAKpB,KAAK,IAAM;EAC/C,OACC,IAAAY,MAAA,CAAAC,aAAA,EAAChB,+BAA+B;IAAA,GAAMG,KAAK;IAAGG,yBAAyB;EAAA,GACpEH,KAAK,CAACC,QACwB,CAAC;AAEpC,CAAC;AAACH,OAAA,CAAAsB,mBAAA,GAAAA,mBAAA;AAAA,IAAAC,QAAA,GAAAvB,OAAA,CAAAmB,OAAA,GAEaG,mBAAmB"}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = ResizableBoxPopover;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
|
-
var
|
|
10
|
+
var _cover = _interopRequireDefault(require("../block-popover/cover"));
|
|
11
11
|
/**
|
|
12
12
|
* WordPress dependencies
|
|
13
13
|
*/
|
|
@@ -21,11 +21,9 @@ function ResizableBoxPopover({
|
|
|
21
21
|
resizableBoxProps,
|
|
22
22
|
...props
|
|
23
23
|
}) {
|
|
24
|
-
return (0, _react.createElement)(
|
|
24
|
+
return (0, _react.createElement)(_cover.default, {
|
|
25
25
|
clientId: clientId,
|
|
26
|
-
|
|
27
|
-
__unstablePopoverSlot: "__unstable-block-tools-after",
|
|
28
|
-
shift: false,
|
|
26
|
+
__unstablePopoverSlot: "block-toolbar",
|
|
29
27
|
...props
|
|
30
28
|
}, (0, _react.createElement)(_components.ResizableBox, {
|
|
31
29
|
...resizableBoxProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","
|
|
1
|
+
{"version":3,"names":["_components","require","_cover","_interopRequireDefault","ResizableBoxPopover","clientId","resizableBoxProps","props","_react","createElement","default","__unstablePopoverSlot","ResizableBox"],"sources":["@wordpress/block-editor/src/components/resizable-box-popover/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ResizableBox } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../block-popover/cover';\n\nexport default function ResizableBoxPopover( {\n\tclientId,\n\tresizableBoxProps,\n\t...props\n} ) {\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<ResizableBox { ...resizableBoxProps } />\n\t\t</BlockPopoverCover>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGe,SAASG,mBAAmBA,CAAE;EAC5CC,QAAQ;EACRC,iBAAiB;EACjB,GAAGC;AACJ,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,MAAA,CAAAQ,OAAiB;IACjBL,QAAQ,EAAGA,QAAU;IACrBM,qBAAqB,EAAC,eAAe;IAAA,GAChCJ;EAAK,GAEV,IAAAC,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAY,YAAY;IAAA,GAAMN;EAAiB,CAAI,CACtB,CAAC;AAEtB"}
|
|
@@ -51,7 +51,7 @@ function ResponsiveBlockControl(props) {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
const toggleControlLabel = toggleLabel || (0, _i18n.sprintf)( /* translators: %s: Property value for the control (eg: margin, padding, etc.). */
|
|
54
|
-
(0, _i18n.__)('Use the same %s on all
|
|
54
|
+
(0, _i18n.__)('Use the same %s on all screen sizes.'), property);
|
|
55
55
|
const toggleHelpText = (0, _i18n.__)('Toggle between using the same value for all screen sizes or using a unique value per screen size.');
|
|
56
56
|
const defaultControl = renderDefaultControl((0, _react.createElement)(_label.default, {
|
|
57
57
|
property: property,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_components","_label","ResponsiveBlockControl","props","title","property","toggleLabel","onIsResponsiveChange","renderDefaultControl","renderResponsiveControls","isResponsive","defaultLabel","id","label","_x","viewports","__","toggleControlLabel","sprintf","toggleHelpText","defaultControl","_react","createElement","default","viewport","defaultResponsiveControls","map","Fragment","key","className","ToggleControl","__nextHasNoMarginBottom","checked","onChange","help","classnames","_default","exports"],"sources":["@wordpress/block-editor/src/components/responsive-block-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { Fragment } from '@wordpress/element';\nimport { ToggleControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResponsiveBlockControlLabel from './label';\n\nfunction ResponsiveBlockControl( props ) {\n\tconst {\n\t\ttitle,\n\t\tproperty,\n\t\ttoggleLabel,\n\t\tonIsResponsiveChange,\n\t\trenderDefaultControl,\n\t\trenderResponsiveControls,\n\t\tisResponsive = false,\n\t\tdefaultLabel = {\n\t\t\tid: 'all',\n\t\t\tlabel: _x( 'All', 'screen sizes' ),\n\t\t},\n\t\tviewports = [\n\t\t\t{\n\t\t\t\tid: 'small',\n\t\t\t\tlabel: __( 'Small screens' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'medium',\n\t\t\t\tlabel: __( 'Medium screens' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'large',\n\t\t\t\tlabel: __( 'Large screens' ),\n\t\t\t},\n\t\t],\n\t} = props;\n\n\tif ( ! title || ! property || ! renderDefaultControl ) {\n\t\treturn null;\n\t}\n\n\tconst toggleControlLabel =\n\t\ttoggleLabel ||\n\t\tsprintf(\n\t\t\t/* translators: %s: Property value for the control (eg: margin, padding, etc.). */\n\t\t\t__( 'Use the same %s on all
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_components","_label","ResponsiveBlockControl","props","title","property","toggleLabel","onIsResponsiveChange","renderDefaultControl","renderResponsiveControls","isResponsive","defaultLabel","id","label","_x","viewports","__","toggleControlLabel","sprintf","toggleHelpText","defaultControl","_react","createElement","default","viewport","defaultResponsiveControls","map","Fragment","key","className","ToggleControl","__nextHasNoMarginBottom","checked","onChange","help","classnames","_default","exports"],"sources":["@wordpress/block-editor/src/components/responsive-block-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { Fragment } from '@wordpress/element';\nimport { ToggleControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ResponsiveBlockControlLabel from './label';\n\nfunction ResponsiveBlockControl( props ) {\n\tconst {\n\t\ttitle,\n\t\tproperty,\n\t\ttoggleLabel,\n\t\tonIsResponsiveChange,\n\t\trenderDefaultControl,\n\t\trenderResponsiveControls,\n\t\tisResponsive = false,\n\t\tdefaultLabel = {\n\t\t\tid: 'all',\n\t\t\tlabel: _x( 'All', 'screen sizes' ),\n\t\t},\n\t\tviewports = [\n\t\t\t{\n\t\t\t\tid: 'small',\n\t\t\t\tlabel: __( 'Small screens' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'medium',\n\t\t\t\tlabel: __( 'Medium screens' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: 'large',\n\t\t\t\tlabel: __( 'Large screens' ),\n\t\t\t},\n\t\t],\n\t} = props;\n\n\tif ( ! title || ! property || ! renderDefaultControl ) {\n\t\treturn null;\n\t}\n\n\tconst toggleControlLabel =\n\t\ttoggleLabel ||\n\t\tsprintf(\n\t\t\t/* translators: %s: Property value for the control (eg: margin, padding, etc.). */\n\t\t\t__( 'Use the same %s on all screen sizes.' ),\n\t\t\tproperty\n\t\t);\n\n\tconst toggleHelpText = __(\n\t\t'Toggle between using the same value for all screen sizes or using a unique value per screen size.'\n\t);\n\n\tconst defaultControl = renderDefaultControl(\n\t\t<ResponsiveBlockControlLabel\n\t\t\tproperty={ property }\n\t\t\tviewport={ defaultLabel }\n\t\t/>,\n\t\tdefaultLabel\n\t);\n\n\tconst defaultResponsiveControls = () => {\n\t\treturn viewports.map( ( viewport ) => (\n\t\t\t<Fragment key={ viewport.id }>\n\t\t\t\t{ renderDefaultControl(\n\t\t\t\t\t<ResponsiveBlockControlLabel\n\t\t\t\t\t\tproperty={ property }\n\t\t\t\t\t\tviewport={ viewport }\n\t\t\t\t\t/>,\n\t\t\t\t\tviewport\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t) );\n\t};\n\n\treturn (\n\t\t<fieldset className=\"block-editor-responsive-block-control\">\n\t\t\t<legend className=\"block-editor-responsive-block-control__title\">\n\t\t\t\t{ title }\n\t\t\t</legend>\n\n\t\t\t<div className=\"block-editor-responsive-block-control__inner\">\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"block-editor-responsive-block-control__toggle\"\n\t\t\t\t\tlabel={ toggleControlLabel }\n\t\t\t\t\tchecked={ ! isResponsive }\n\t\t\t\t\tonChange={ onIsResponsiveChange }\n\t\t\t\t\thelp={ toggleHelpText }\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-responsive-block-control__group',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-responsive': isResponsive,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ ! isResponsive && defaultControl }\n\t\t\t\t\t{ isResponsive &&\n\t\t\t\t\t\t( renderResponsiveControls\n\t\t\t\t\t\t\t? renderResponsiveControls( viewports )\n\t\t\t\t\t\t\t: defaultResponsiveControls() ) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n\nexport default ResponsiveBlockControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASK,sBAAsBA,CAAEC,KAAK,EAAG;EACxC,MAAM;IACLC,KAAK;IACLC,QAAQ;IACRC,WAAW;IACXC,oBAAoB;IACpBC,oBAAoB;IACpBC,wBAAwB;IACxBC,YAAY,GAAG,KAAK;IACpBC,YAAY,GAAG;MACdC,EAAE,EAAE,KAAK;MACTC,KAAK,EAAE,IAAAC,QAAE,EAAE,KAAK,EAAE,cAAe;IAClC,CAAC;IACDC,SAAS,GAAG,CACX;MACCH,EAAE,EAAE,OAAO;MACXC,KAAK,EAAE,IAAAG,QAAE,EAAE,eAAgB;IAC5B,CAAC,EACD;MACCJ,EAAE,EAAE,QAAQ;MACZC,KAAK,EAAE,IAAAG,QAAE,EAAE,gBAAiB;IAC7B,CAAC,EACD;MACCJ,EAAE,EAAE,OAAO;MACXC,KAAK,EAAE,IAAAG,QAAE,EAAE,eAAgB;IAC5B,CAAC;EAEH,CAAC,GAAGb,KAAK;EAET,IAAK,CAAEC,KAAK,IAAI,CAAEC,QAAQ,IAAI,CAAEG,oBAAoB,EAAG;IACtD,OAAO,IAAI;EACZ;EAEA,MAAMS,kBAAkB,GACvBX,WAAW,IACX,IAAAY,aAAO,GACN;EACA,IAAAF,QAAE,EAAE,sCAAuC,CAAC,EAC5CX,QACD,CAAC;EAEF,MAAMc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,GACvBA,wBAAwB,CAAEM,SAAU,CAAC,GACrCU,yBAAyB,CAAC,CAAC,CAC3B,CACD,CACI,CAAC;AAEb;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcrB,sBAAsB"}
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.PrivateRichText = void 0;
|
|
7
8
|
Object.defineProperty(exports, "RichTextShortcut", {
|
|
8
9
|
enumerable: true,
|
|
9
10
|
get: function () {
|
|
@@ -34,6 +35,7 @@ var _components = require("@wordpress/components");
|
|
|
34
35
|
var _blocks = require("@wordpress/blocks");
|
|
35
36
|
var _autocomplete = require("../autocomplete");
|
|
36
37
|
var _blockEdit = require("../block-edit");
|
|
38
|
+
var _context = require("../block-edit/context");
|
|
37
39
|
var _formatToolbarContainer = _interopRequireDefault(require("./format-toolbar-container"));
|
|
38
40
|
var _store = require("../../store");
|
|
39
41
|
var _useUndoAutomaticChange = require("./use-undo-automatic-change");
|
|
@@ -129,15 +131,18 @@ function RichTextWrapper({
|
|
|
129
131
|
__unstableDisableFormats: disableFormats,
|
|
130
132
|
disableLineBreaks,
|
|
131
133
|
__unstableAllowPrefixTransformations,
|
|
134
|
+
disableEditing,
|
|
132
135
|
...props
|
|
133
136
|
}, forwardedRef) {
|
|
134
137
|
props = removeNativeProps(props);
|
|
135
138
|
const anchorRef = (0, _element.useRef)();
|
|
139
|
+
const context = (0, _blockEdit.useBlockEditContext)();
|
|
136
140
|
const {
|
|
137
141
|
clientId,
|
|
138
142
|
isSelected: isBlockSelected,
|
|
139
143
|
name: blockName
|
|
140
|
-
} =
|
|
144
|
+
} = context;
|
|
145
|
+
const blockBindings = context[_context.blockBindingsKey];
|
|
141
146
|
const selector = select => {
|
|
142
147
|
// Avoid subscribing to the block editor store if the block is not
|
|
143
148
|
// selected.
|
|
@@ -148,26 +153,35 @@ function RichTextWrapper({
|
|
|
148
153
|
}
|
|
149
154
|
const {
|
|
150
155
|
getSelectionStart,
|
|
151
|
-
getSelectionEnd
|
|
152
|
-
getBlockAttributes
|
|
156
|
+
getSelectionEnd
|
|
153
157
|
} = select(_store.store);
|
|
154
158
|
const selectionStart = getSelectionStart();
|
|
155
159
|
const selectionEnd = getSelectionEnd();
|
|
156
|
-
const blockBindings = getBlockAttributes(clientId)?.metadata?.bindings;
|
|
157
160
|
let isSelected;
|
|
158
161
|
if (originalIsSelected === undefined) {
|
|
159
162
|
isSelected = selectionStart.clientId === clientId && selectionEnd.clientId === clientId && selectionStart.attributeKey === identifier;
|
|
160
163
|
} else if (originalIsSelected) {
|
|
161
164
|
isSelected = selectionStart.clientId === clientId;
|
|
162
165
|
}
|
|
163
|
-
|
|
166
|
+
return {
|
|
167
|
+
selectionStart: isSelected ? selectionStart.offset : undefined,
|
|
168
|
+
selectionEnd: isSelected ? selectionEnd.offset : undefined,
|
|
169
|
+
isSelected
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const {
|
|
173
|
+
selectionStart,
|
|
174
|
+
selectionEnd,
|
|
175
|
+
isSelected
|
|
176
|
+
} = (0, _data.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
|
|
177
|
+
const disableBoundBlocks = (0, _data.useSelect)(select => {
|
|
164
178
|
// Disable Rich Text editing if block bindings specify that.
|
|
165
|
-
let
|
|
166
|
-
if (blockBindings &&
|
|
179
|
+
let _disableBoundBlocks = false;
|
|
180
|
+
if (blockBindings && (0, _useBindingsAttributes.canBindBlock)(blockName)) {
|
|
167
181
|
const blockTypeAttributes = (0, _blocks.getBlockType)(blockName).attributes;
|
|
168
182
|
const {
|
|
169
183
|
getBlockBindingsSource
|
|
170
|
-
} = (0, _lockUnlock.unlock)(select(
|
|
184
|
+
} = (0, _lockUnlock.unlock)(select(_blocks.store));
|
|
171
185
|
for (const [attribute, args] of Object.entries(blockBindings)) {
|
|
172
186
|
if (blockTypeAttributes?.[attribute]?.source !== 'rich-text') {
|
|
173
187
|
break;
|
|
@@ -176,24 +190,14 @@ function RichTextWrapper({
|
|
|
176
190
|
// If the source is not defined, or if its value of `lockAttributesEditing` is `true`, disable it.
|
|
177
191
|
const blockBindingsSource = getBlockBindingsSource(args.source);
|
|
178
192
|
if (!blockBindingsSource || blockBindingsSource.lockAttributesEditing) {
|
|
179
|
-
|
|
193
|
+
_disableBoundBlocks = true;
|
|
180
194
|
break;
|
|
181
195
|
}
|
|
182
196
|
}
|
|
183
197
|
}
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
isSelected,
|
|
188
|
-
shouldDisableEditing
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
const {
|
|
192
|
-
selectionStart,
|
|
193
|
-
selectionEnd,
|
|
194
|
-
isSelected,
|
|
195
|
-
shouldDisableEditing
|
|
196
|
-
} = (0, _data.useSelect)(selector, [clientId, identifier, originalIsSelected, isBlockSelected]);
|
|
198
|
+
return _disableBoundBlocks;
|
|
199
|
+
}, [blockBindings, blockName]);
|
|
200
|
+
const shouldDisableEditing = disableEditing || disableBoundBlocks;
|
|
197
201
|
const {
|
|
198
202
|
getSelectionStart,
|
|
199
203
|
getSelectionEnd,
|
|
@@ -388,14 +392,30 @@ function RichTextWrapper({
|
|
|
388
392
|
"data-wp-block-attribute-key": identifier
|
|
389
393
|
}));
|
|
390
394
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
395
|
+
|
|
396
|
+
// This is the private API for the RichText component.
|
|
397
|
+
// It allows access to all props, not just the public ones.
|
|
398
|
+
const PrivateRichText = exports.PrivateRichText = (0, _withDeprecations.withDeprecations)((0, _element.forwardRef)(RichTextWrapper));
|
|
399
|
+
PrivateRichText.Content = _content.Content;
|
|
400
|
+
PrivateRichText.isEmpty = value => {
|
|
394
401
|
return !value || value.length === 0;
|
|
395
402
|
};
|
|
396
403
|
|
|
404
|
+
// This is the public API for the RichText component.
|
|
405
|
+
// We wrap the PrivateRichText component to hide some props from the public API.
|
|
397
406
|
/**
|
|
398
407
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md
|
|
399
408
|
*/
|
|
400
|
-
|
|
409
|
+
const PublicForwardedRichTextContainer = (0, _element.forwardRef)((props, ref) => {
|
|
410
|
+
return (0, _react.createElement)(PrivateRichText, {
|
|
411
|
+
ref: ref,
|
|
412
|
+
...props,
|
|
413
|
+
disableEditing: false
|
|
414
|
+
});
|
|
415
|
+
});
|
|
416
|
+
PublicForwardedRichTextContainer.Content = _content.Content;
|
|
417
|
+
PublicForwardedRichTextContainer.isEmpty = value => {
|
|
418
|
+
return !value || value.length === 0;
|
|
419
|
+
};
|
|
420
|
+
var _default = exports.default = PublicForwardedRichTextContainer;
|
|
401
421
|
//# sourceMappingURL=index.js.map
|