@wordpress/block-editor 11.4.0 → 11.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/build/components/block-inspector/index.js +11 -10
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js +46 -0
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build/components/block-list/block-invalid-warning.js +63 -80
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +2 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +107 -0
- package/build/components/child-layout-control/index.js.map +1 -0
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/date-format-picker/index.js +3 -3
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +306 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +594 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +127 -37
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +36 -2
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +87 -27
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +21 -14
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/index.native.js +23 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +10 -11
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +5 -108
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +242 -0
- package/build/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +38 -9
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +5 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +1 -0
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/list-view/block.js +17 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +2 -2
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/expander.js +2 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/leaf.js +10 -6
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-scroll-into-view.js +51 -0
- package/build/components/list-view/use-list-view-scroll-into-view.js.map +1 -0
- package/build/components/off-canvas-editor/appender.js +33 -13
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +6 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +8 -2
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +34 -4
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/provider/use-block-sync.js +17 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -0
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -3
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +9 -43
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-delete.js +73 -0
- package/build/components/rich-text/use-delete.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +14 -6
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +4 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/align.js +3 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/border.js +91 -240
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/custom-class-name.js +4 -4
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +3 -4
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +72 -190
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +94 -25
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/gap.js +0 -202
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +33 -27
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +7 -163
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +7 -163
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +52 -66
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +101 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +1 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +28 -14
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +28 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +53 -47
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +24 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +49 -10
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-inspector/index.js +9 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js +37 -0
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build-module/components/block-list/block-invalid-warning.js +66 -78
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +98 -0
- package/build-module/components/child-layout-control/index.js.map +1 -0
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -4
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +291 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +574 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +123 -34
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +88 -27
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +21 -14
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +10 -11
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +6 -105
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +222 -0
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +39 -9
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +4 -2
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -1
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -0
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/list-view/block.js +16 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +2 -2
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/expander.js +2 -1
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/leaf.js +8 -4
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-scroll-into-view.js +42 -0
- package/build-module/components/list-view/use-list-view-scroll-into-view.js.map +1 -0
- package/build-module/components/off-canvas-editor/appender.js +33 -14
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +6 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +8 -2
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +36 -7
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +17 -3
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -0
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -3
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -43
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-delete.js +62 -0
- package/build-module/components/rich-text/use-delete.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +14 -6
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +4 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/align.js +3 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/border.js +93 -240
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +4 -4
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +3 -4
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +75 -187
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +86 -24
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/gap.js +0 -183
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +33 -27
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +4 -143
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +4 -143
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +54 -66
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +96 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +28 -14
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +28 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +53 -45
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +49 -10
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +39 -27
- package/build-style/style.css +39 -27
- package/package.json +31 -31
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
- package/src/components/block-inspector/index.js +11 -14
- package/src/components/block-inspector/style.scss +3 -0
- package/src/components/block-inspector/useBlockInspectorAnimationSettings.js +53 -0
- package/src/components/block-list/block-invalid-warning.js +72 -64
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +0 -9
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +35 -17
- package/src/components/block-preview/test/index.js +0 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-styles/index.js +5 -1
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/src/components/child-layout-control/index.js +106 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +17 -15
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
- package/src/components/date-format-picker/index.js +6 -8
- package/src/components/date-format-picker/style.scss +0 -5
- package/src/components/global-styles/border-panel.js +285 -0
- package/src/components/global-styles/dimensions-panel.js +627 -0
- package/src/components/global-styles/hooks.js +160 -44
- package/src/components/global-styles/index.js +7 -1
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +81 -9
- package/src/components/global-styles/use-global-styles-output.js +17 -16
- package/src/components/global-styles/utils.js +2 -0
- package/src/components/index.native.js +5 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/media-tab/hooks.js +9 -8
- package/src/components/inserter/media-tab/media-list.js +3 -122
- package/src/components/inserter/media-tab/media-preview.js +268 -0
- package/src/components/inserter/menu.js +0 -1
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +25 -0
- package/src/components/inserter/tabs.js +1 -9
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/src/components/inspector-controls/fill.js +32 -8
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/search-item.js +3 -1
- package/src/components/link-control/settings-drawer.js +2 -1
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +18 -12
- package/src/components/link-control/test/index.js +3 -5
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/branch.js +1 -2
- package/src/components/list-view/expander.js +1 -0
- package/src/components/list-view/leaf.js +43 -29
- package/src/components/list-view/use-block-selection.js +0 -2
- package/src/components/list-view/use-list-view-scroll-into-view.js +48 -0
- package/src/components/media-replace-flow/style.scss +7 -9
- package/src/components/off-canvas-editor/appender.js +44 -21
- package/src/components/off-canvas-editor/branch.js +4 -1
- package/src/components/off-canvas-editor/index.js +7 -1
- package/src/components/off-canvas-editor/leaf-more-menu.js +57 -15
- package/src/components/provider/use-block-sync.js +21 -4
- package/src/components/responsive-block-control/index.js +1 -0
- package/src/components/rich-text/format-toolbar-container.js +1 -7
- package/src/components/rich-text/index.js +8 -44
- package/src/components/rich-text/use-delete.js +59 -0
- package/src/components/rich-text/use-input-rules.js +13 -5
- package/src/components/spacing-sizes-control/style.scss +1 -1
- package/src/components/url-popover/stories/index.js +1 -0
- package/src/components/url-popover/test/index.js +0 -2
- package/src/components/writing-flow/use-selection-observer.js +5 -1
- package/src/hooks/align.js +1 -1
- package/src/hooks/border.js +94 -225
- package/src/hooks/custom-class-name.js +4 -4
- package/src/hooks/custom-class-name.native.js +3 -4
- package/src/hooks/dimensions.js +85 -269
- package/src/hooks/duotone.js +100 -30
- package/src/hooks/gap.js +0 -208
- package/src/hooks/layout.js +38 -22
- package/src/hooks/margin.js +1 -164
- package/src/hooks/padding.js +1 -163
- package/src/hooks/supports.js +6 -0
- package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
- package/src/hooks/test/duotone.js +102 -0
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/test/use-typography-props.js +2 -0
- package/src/hooks/typography.js +68 -88
- package/src/hooks/utils.js +126 -0
- package/src/layouts/constrained.js +23 -17
- package/src/layouts/flex.js +1 -0
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +16 -6
- package/src/store/defaults.js +14 -1
- package/src/store/reducer.js +68 -43
- package/src/store/selectors.js +28 -4
- package/src/store/test/actions.js +4 -2
- package/src/utils/parse-css-unit-to-px.js +48 -13
- package/src/utils/test/parse-css-unit-to-px.js +13 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/border-radius.js +0 -100
- package/build/hooks/border-radius.js.map +0 -1
- package/build/hooks/child-layout.js +0 -213
- package/build/hooks/child-layout.js.map +0 -1
- package/build/hooks/min-height.js +0 -139
- package/build/hooks/min-height.js.map +0 -1
- package/build-module/hooks/border-radius.js +0 -84
- package/build-module/hooks/border-radius.js.map +0 -1
- package/build-module/hooks/child-layout.js +0 -193
- package/build-module/hooks/child-layout.js.map +0 -1
- package/build-module/hooks/min-height.js +0 -116
- package/build-module/hooks/min-height.js.map +0 -1
- package/src/hooks/border-radius.js +0 -70
- package/src/hooks/child-layout.js +0 -195
- package/src/hooks/min-height.js +0 -104
|
@@ -11,6 +11,7 @@ import { isEmpty } from 'lodash';
|
|
|
11
11
|
import { __experimentalStyleProvider as StyleProvider, __experimentalToolsPanelContext as ToolsPanelContext } from '@wordpress/components';
|
|
12
12
|
import warning from '@wordpress/warning';
|
|
13
13
|
import deprecated from '@wordpress/deprecated';
|
|
14
|
+
import { useEffect } from '@wordpress/element';
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
16
17
|
*/
|
|
@@ -23,7 +24,8 @@ export default function InspectorControlsFill(_ref) {
|
|
|
23
24
|
let {
|
|
24
25
|
children,
|
|
25
26
|
group = 'default',
|
|
26
|
-
__experimentalGroup
|
|
27
|
+
__experimentalGroup,
|
|
28
|
+
resetAllFilter
|
|
27
29
|
} = _ref;
|
|
28
30
|
|
|
29
31
|
if (__experimentalGroup) {
|
|
@@ -50,14 +52,42 @@ export default function InspectorControlsFill(_ref) {
|
|
|
50
52
|
return createElement(StyleProvider, {
|
|
51
53
|
document: document
|
|
52
54
|
}, createElement(Fill, null, fillProps => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return createElement(ToolsPanelContext.Provider, {
|
|
59
|
-
value: value
|
|
60
|
-
}, children);
|
|
55
|
+
return createElement(ToolsPanelInspectorControl, {
|
|
56
|
+
fillProps: fillProps,
|
|
57
|
+
children: children,
|
|
58
|
+
resetAllFilter: resetAllFilter
|
|
59
|
+
});
|
|
61
60
|
}));
|
|
62
61
|
}
|
|
62
|
+
|
|
63
|
+
function ToolsPanelInspectorControl(_ref2) {
|
|
64
|
+
let {
|
|
65
|
+
children,
|
|
66
|
+
resetAllFilter,
|
|
67
|
+
fillProps
|
|
68
|
+
} = _ref2;
|
|
69
|
+
const {
|
|
70
|
+
registerResetAllFilter,
|
|
71
|
+
deregisterResetAllFilter
|
|
72
|
+
} = fillProps;
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (resetAllFilter && registerResetAllFilter) {
|
|
75
|
+
registerResetAllFilter(resetAllFilter);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
if (resetAllFilter && deregisterResetAllFilter) {
|
|
80
|
+
deregisterResetAllFilter(resetAllFilter);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}, [resetAllFilter, registerResetAllFilter, deregisterResetAllFilter]); // Children passed to InspectorControlsFill will not have
|
|
84
|
+
// access to any React Context whose Provider is part of
|
|
85
|
+
// the InspectorControlsSlot tree. So we re-create the
|
|
86
|
+
// Provider in this subtree.
|
|
87
|
+
|
|
88
|
+
const value = !isEmpty(fillProps) ? fillProps : null;
|
|
89
|
+
return createElement(ToolsPanelContext.Provider, {
|
|
90
|
+
value: value
|
|
91
|
+
}, children);
|
|
92
|
+
}
|
|
63
93
|
//# sourceMappingURL=fill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.js"],"names":["isEmpty","__experimentalStyleProvider","StyleProvider","__experimentalToolsPanelContext","ToolsPanelContext","warning","deprecated","useDisplayBlockControls","groups","InspectorControlsFill","children","group","__experimentalGroup","since","version","alternative","isDisplayed","Fill","document","fillProps","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,2BAA2B,IAAIC,aADhC,EAECC,+BAA+B,IAAIC,iBAFpC,QAGO,uBAHP;AAIA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,eAAe,SAASC,qBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.js"],"names":["isEmpty","__experimentalStyleProvider","StyleProvider","__experimentalToolsPanelContext","ToolsPanelContext","warning","deprecated","useEffect","useDisplayBlockControls","groups","InspectorControlsFill","children","group","__experimentalGroup","resetAllFilter","since","version","alternative","isDisplayed","Fill","document","fillProps","ToolsPanelInspectorControl","registerResetAllFilter","deregisterResetAllFilter","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SACCC,2BAA2B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AAA;AAA5B,GAA0C;AAC9E,QAAM;AAAEE,IAAAA,sBAAF;AAA0BC,IAAAA;AAA1B,MAAuDH,SAA7D;AACAd,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKO,cAAc,IAAIS,sBAAvB,EAAgD;AAC/CA,MAAAA,sBAAsB,CAAET,cAAF,CAAtB;AACA;;AACD,WAAO,MAAM;AACZ,UAAKA,cAAc,IAAIU,wBAAvB,EAAkD;AACjDA,QAAAA,wBAAwB,CAAEV,cAAF,CAAxB;AACA;AACD,KAJD;AAKA,GATQ,EASN,CAAEA,cAAF,EAAkBS,sBAAlB,EAA0CC,wBAA1C,CATM,CAAT,CAF8E,CAa9E;AACA;AACA;AACA;;AACA,QAAMC,KAAK,GAAG,CAAEzB,OAAO,CAAEqB,SAAF,CAAT,GAAyBA,SAAzB,GAAqC,IAAnD;AACA,SACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGI;AAApC,KACGd,QADH,CADD;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport groups from './groups';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst isDisplayed = useDisplayBlockControls();\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControl group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } = fillProps;\n\tuseEffect( () => {\n\t\tif ( resetAllFilter && registerResetAllFilter ) {\n\t\t\tregisterResetAllFilter( resetAllFilter );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( resetAllFilter && deregisterResetAllFilter ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilter );\n\t\t\t}\n\t\t};\n\t}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst value = ! isEmpty( fillProps ) ? fillProps : null;\n\treturn (\n\t\t<ToolsPanelContext.Provider value={ value }>\n\t\t\t{ children }\n\t\t</ToolsPanelContext.Provider>\n\t);\n}\n"]}
|
|
@@ -314,7 +314,7 @@ function LinkControl(_ref) {
|
|
|
314
314
|
}, createElement(Button, {
|
|
315
315
|
variant: "primary",
|
|
316
316
|
onClick: handleSubmit,
|
|
317
|
-
className: "
|
|
317
|
+
className: "block-editor-link-control__search-submit",
|
|
318
318
|
disabled: currentInputIsEmpty // Disallow submitting empty values.
|
|
319
319
|
|
|
320
320
|
}, __('Apply')), createElement(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["classnames","Button","Spinner","Notice","__","useRef","useState","useEffect","focus","ENTER","LinkControlSettingsDrawer","LinkControlSearchInput","LinkPreview","useCreatePage","useInternalInputValue","ViewerFill","DEFAULT_LINK_SETTINGS","noop","LinkControl","searchInputPlaceholder","value","settings","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","settingsOpen","setSettingsOpen","internalUrlInputValue","setInternalUrlInputValue","url","internalTextInputValue","setInternalTextInputValue","title","isEditingLink","setIsEditingLink","createPage","isCreatingPage","errorMessage","current","whichFocusTargetIndex","nextFocusTarget","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showSettings","showTextControl","isEditing"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,OAAjB,EAA0BC,MAA1B,QAAwC,uBAAxC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,KAAT,QAAsB,qBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,mBAAtC;AACA,OAAOC,sBAAP,MAAmC,gBAAnC;AACA,OAAOC,WAAP,MAA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AQ,EAAGK,mBAJZ,CAIkC;;AAJlC,KAMGxE,EAAE,CAAE,OAAF,CANL,CADD,EASC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,UAAhB;AAA2B,IAAA,OAAO,EAAG2E;AAArC,KACG3E,EAAE,CAAE,QAAF,CADL,CATD,CAnBD,CA/DF,EAkGGkC,mBAAmB,IAAIA,mBAAmB,EAlG7C,CADD;AAsGA;;AAEDpB,WAAW,CAACH,UAAZ,GAAyBA,UAAzB;AAEA,eAAeG,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport useCreatePage from './use-create-page';\nimport useInternalInputValue from './use-internal-input-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst [ internalUrlInputValue, setInternalUrlInputValue ] =\n\t\tuseInternalInputValue( value?.url || '' );\n\n\tconst [ internalTextInputValue, setInternalTextInputValue ] =\n\t\tuseInternalInputValue( value?.title || '' );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\t\t// Unless we are mounting, we always want to focus either:\n\t\t// - the URL input\n\t\t// - the first focusable element in the Link UI.\n\t\t// But in editing mode if there is a text input present then\n\t\t// the URL input is at index 1. If not then it is at index 0.\n\t\tconst whichFocusTargetIndex = textInputRef?.current ? 1 : 0;\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[\n\t\t\t\twhichFocusTargetIndex\n\t\t\t] || wrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetSettingsOpen( false );\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\tonChange( {\n\t\t\t...updatedValue,\n\t\t\ttitle: internalTextInputValue || updatedValue?.title,\n\t\t} );\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif (\n\t\t\tcurrentUrlInputValue !== value?.url ||\n\t\t\tinternalTextInputValue !== value?.title\n\t\t) {\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t\ttitle: internalTextInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalUrlInputValue( value?.url );\n\t\tsetInternalTextInputValue( value?.title );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue = propInputValue || internalUrlInputValue;\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettings = !! settings?.length;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalUrlInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tuseLabel={ showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ( showSettings || showTextControl ) && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ settingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpen }\n\t\t\t\t\t\t\tshowTextControl={ showTextControl }\n\t\t\t\t\t\t\tshowSettings={ showSettings }\n\t\t\t\t\t\t\ttextInputRef={ textInputRef }\n\t\t\t\t\t\t\tinternalTextInputValue={ internalTextInputValue }\n\t\t\t\t\t\t\tsetInternalTextInputValue={\n\t\t\t\t\t\t\t\tsetInternalTextInputValue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thandleSubmitWithEnter={ handleSubmitWithEnter }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ handleSubmit }\n\t\t\t\t\t\t\tclassName=\"xblock-editor-link-control__search-submit\"\n\t\t\t\t\t\t\tdisabled={ currentInputIsEmpty } // Disallow submitting empty values.\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"names":["classnames","Button","Spinner","Notice","__","useRef","useState","useEffect","focus","ENTER","LinkControlSettingsDrawer","LinkControlSearchInput","LinkPreview","useCreatePage","useInternalInputValue","ViewerFill","DEFAULT_LINK_SETTINGS","noop","LinkControl","searchInputPlaceholder","value","settings","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","isMounting","wrapperNode","textInputRef","isEndingEditWithFocus","settingsOpen","setSettingsOpen","internalUrlInputValue","setInternalUrlInputValue","url","internalTextInputValue","setInternalTextInputValue","title","isEditingLink","setIsEditingLink","createPage","isCreatingPage","errorMessage","current","whichFocusTargetIndex","nextFocusTarget","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showSettings","showTextControl","isEditing"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,OAAjB,EAA0BC,MAA1B,QAAwC,uBAAxC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,QAAjB,EAA2BC,SAA3B,QAA4C,oBAA5C;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,KAAT,QAAsB,qBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,mBAAtC;AACA,OAAOC,sBAAP,MAAmC,gBAAnC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,qBAAT,QAAsC,aAAtC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA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7C,CADD;AAsGA;;AAEDpB,WAAW,CAACH,UAAZ,GAAyBA,UAAzB;AAEA,eAAeG,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Spinner, Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport useCreatePage from './use-create-page';\nimport useInternalInputValue from './use-internal-input-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst isMounting = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocus = useRef( false );\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst [ internalUrlInputValue, setInternalUrlInputValue ] =\n\t\tuseInternalInputValue( value?.url || '' );\n\n\tconst [ internalTextInputValue, setInternalTextInputValue ] =\n\t\tuseInternalInputValue( value?.title || '' );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tforceIsEditingLink !== undefined &&\n\t\t\tforceIsEditingLink !== isEditingLink\n\t\t) {\n\t\t\tsetIsEditingLink( forceIsEditingLink );\n\t\t}\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMounting.current ) {\n\t\t\tisMounting.current = false;\n\t\t\treturn;\n\t\t}\n\t\t// Unless we are mounting, we always want to focus either:\n\t\t// - the URL input\n\t\t// - the first focusable element in the Link UI.\n\t\t// But in editing mode if there is a text input present then\n\t\t// the URL input is at index 1. If not then it is at index 0.\n\t\tconst whichFocusTargetIndex = textInputRef?.current ? 1 : 0;\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[\n\t\t\t\twhichFocusTargetIndex\n\t\t\t] || wrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocus.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocus.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetSettingsOpen( false );\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\tonChange( {\n\t\t\t...updatedValue,\n\t\t\ttitle: internalTextInputValue || updatedValue?.title,\n\t\t} );\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif (\n\t\t\tcurrentUrlInputValue !== value?.url ||\n\t\t\tinternalTextInputValue !== value?.title\n\t\t) {\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t\ttitle: internalTextInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalUrlInputValue( value?.url );\n\t\tsetInternalTextInputValue( value?.title );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue = propInputValue || internalUrlInputValue;\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showSettings = !! settings?.length;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalUrlInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tuseLabel={ showTextControl }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ onRemove }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ( showSettings || showTextControl ) && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ settingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpen }\n\t\t\t\t\t\t\tshowTextControl={ showTextControl }\n\t\t\t\t\t\t\tshowSettings={ showSettings }\n\t\t\t\t\t\t\ttextInputRef={ textInputRef }\n\t\t\t\t\t\t\tinternalTextInputValue={ internalTextInputValue }\n\t\t\t\t\t\t\tsetInternalTextInputValue={\n\t\t\t\t\t\t\t\tsetInternalTextInputValue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thandleSubmitWithEnter={ handleSubmitWithEnter }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<div className=\"block-editor-link-control__search-actions\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ handleSubmit }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\tdisabled={ currentInputIsEmpty } // Disallow submitting empty values.\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ handleCancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\n\nexport default LinkControl;\n"]}
|
|
@@ -13,6 +13,7 @@ import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
|
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { Button, TextHighlight } from '@wordpress/components';
|
|
15
15
|
import { Icon, globe, page, tag, postList, category, file } from '@wordpress/icons';
|
|
16
|
+
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
16
17
|
const ICONS_MAP = {
|
|
17
18
|
post: postList,
|
|
18
19
|
page,
|
|
@@ -68,8 +69,9 @@ export const LinkControlSearchItem = _ref2 => {
|
|
|
68
69
|
className: "block-editor-link-control__search-item-header"
|
|
69
70
|
}, createElement("span", {
|
|
70
71
|
className: "block-editor-link-control__search-item-title"
|
|
71
|
-
}, createElement(TextHighlight
|
|
72
|
-
|
|
72
|
+
}, createElement(TextHighlight // The component expects a plain text string.
|
|
73
|
+
, {
|
|
74
|
+
text: stripHTML(suggestion.title),
|
|
73
75
|
highlight: searchTerm
|
|
74
76
|
})), createElement("span", {
|
|
75
77
|
"aria-hidden": !isURL,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["classnames","safeDecodeURI","filterURLForDisplay","__","Button","TextHighlight","Icon","globe","page","tag","postList","category","file","ICONS_MAP","post","post_tag","attachment","SearchItemIcon","isURL","suggestion","icon","type","LinkControlSearchItem","itemProps","isSelected","onClick","searchTerm","shouldShowType","title","url","getVisualTypeName","isFrontPage"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,mBAAxB,QAAmD,gBAAnD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,aAAjB,QAAsC,uBAAtC;AACA,SACCC,IADD,EAECC,KAFD,EAGCC,IAHD,EAICC,GAJD,EAKCC,QALD,EAMCC,QAND,EAOCC,IAPD,QAQO,kBARP;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["classnames","safeDecodeURI","filterURLForDisplay","__","Button","TextHighlight","Icon","globe","page","tag","postList","category","file","__unstableStripHTML","stripHTML","ICONS_MAP","post","post_tag","attachment","SearchItemIcon","isURL","suggestion","icon","type","LinkControlSearchItem","itemProps","isSelected","onClick","searchTerm","shouldShowType","title","url","getVisualTypeName","isFrontPage"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,mBAAxB,QAAmD,gBAAnD;AACA,SAASC,EAAT,QAAmB,iBA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Ae0B,UADkD;AAEjE,gBAAUN,KAFuD;AAGjE,mBAAa,CAAEA;AAHkD,KAA5C;AAHvB,MASC,cAAC,cAAD;AAAgB,IAAA,UAAU,EAAGC,UAA7B;AAA0C,IAAA,KAAK,EAAGD;AAAlD,IATD,EAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,aAAD,CACC;AADD;AAEC,IAAA,IAAI,EAAGN,SAAS,CAAEO,UAAU,CAACS,KAAb,CAFjB;AAGC,IAAA,SAAS,EAAGF;AAHb,IADD,CADD,EAQC;AACC,mBAAc,CAAER,KADjB;AAEC,IAAA,SAAS,EAAC;AAFX,KAIG,CAAEA,KAAF,KACClB,mBAAmB,CACpBD,aAAa,CAAEoB,UAAU,CAACU,GAAb,CADO,CAAnB,IAGD,EAJA,CAJH,EASGX,KAAK,IAAIjB,EAAE,CAAE,8BAAF,CATd,CARD,CAXD,EA+BG0B,cAAc,IAAIR,UAAU,CAACE,IAA7B,IACD;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGS,iBAAiB,CAAEX,UAAF,CADpB,CAhCF,CADD;AAuCA,CAhDM;;AAkDP,SAASW,iBAAT,CAA4BX,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACY,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOZ,UAAU,CAACE,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCF,UAAU,CAACE,IAA3D;AACA;;AAED,eAAeC,qBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\nimport { __ } from '@wordpress/i18n';\nimport { Button, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tisSelected = false,\n\tonClick,\n\tisURL = false,\n\tsearchTerm = '',\n\tshouldShowType = false,\n} ) => {\n\treturn (\n\t\t<Button\n\t\t\t{ ...itemProps }\n\t\t\tonClick={ onClick }\n\t\t\tclassName={ classnames( 'block-editor-link-control__search-item', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-url': isURL,\n\t\t\t\t'is-entity': ! isURL,\n\t\t\t} ) }\n\t\t>\n\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\n\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-title\">\n\t\t\t\t\t<TextHighlight\n\t\t\t\t\t\t// The component expects a plain text string.\n\t\t\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\t\t\thighlight={ searchTerm }\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t\t<span\n\t\t\t\t\taria-hidden={ ! isURL }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-info\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isURL &&\n\t\t\t\t\t\t( filterURLForDisplay(\n\t\t\t\t\t\t\tsafeDecodeURI( suggestion.url )\n\t\t\t\t\t\t) ||\n\t\t\t\t\t\t\t'' ) }\n\t\t\t\t\t{ isURL && __( 'Press ENTER to add this link' ) }\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t\t{ shouldShowType && suggestion.type && (\n\t\t\t\t<span className=\"block-editor-link-control__search-item-type\">\n\t\t\t\t\t{ getVisualTypeName( suggestion ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</Button>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
|
|
@@ -38,7 +38,7 @@ function LinkSettingsDrawer(_ref) {
|
|
|
38
38
|
"aria-expanded": settingsOpen,
|
|
39
39
|
onClick: () => setSettingsOpen(!settingsOpen),
|
|
40
40
|
icon: settingsIcon,
|
|
41
|
-
label: __('
|
|
41
|
+
label: __('Link Settings'),
|
|
42
42
|
"aria-controls": settingsDrawerId
|
|
43
43
|
}), createElement(MaybeAnimatePresence, null, settingsOpen && createElement(MaybeMotionDiv, {
|
|
44
44
|
className: "block-editor-link-control__drawer",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings-drawer.js"],"names":["Button","TextControl","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","settings","settingsIcon","useReducedMotion","useInstanceId","__","Fragment","Settings","LinkSettingsDrawer","settingsOpen","setSettingsOpen","showTextControl","showSettings","textInputRef","internalTextInputValue","setInternalTextInputValue","handleSubmitWithEnter","value","onChange","prefersReducedMotion","MaybeAnimatePresence","MaybeMotionDiv","div","id","settingsDrawerId","open","opacity","height","collapsed","duration"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,WAFD,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,yBAAyB,IAAIC,eAJ9B,QAKO,uBALP;AAMA,SAASC,QAAQ,IAAIC,YAArB,QAAyC,kBAAzC;AACA,SAASC,gBAAT,EAA2BC,aAA3B,QAAgD,oBAAhD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings-drawer.js"],"names":["Button","TextControl","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","settings","settingsIcon","useReducedMotion","useInstanceId","__","Fragment","Settings","LinkSettingsDrawer","settingsOpen","setSettingsOpen","showTextControl","showSettings","textInputRef","internalTextInputValue","setInternalTextInputValue","handleSubmitWithEnter","value","onChange","prefersReducedMotion","MaybeAnimatePresence","MaybeMotionDiv","div","id","settingsDrawerId","open","opacity","height","collapsed","duration"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,WAFD,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,yBAAyB,IAAIC,eAJ9B,QAKO,uBALP;AAMA,SAASC,QAAQ,IAAIC,YAArB,QAAyC,kBAAzC;AACA,SAASC,gBAAT,EAA2BC,aAA3B,QAAgD,oBAAhD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,SAASC,kBAAT,OAYI;AAAA,MAZyB;AAC5BC,IAAAA,YAD4B;AAE5BC,IAAAA,eAF4B;AAG5BC,IAAAA,eAH4B;AAI5BC,IAAAA,YAJ4B;AAK5BC,IAAAA,YAL4B;AAM5BC,IAAAA,sBAN4B;AAO5BC,IAAAA,yBAP4B;AAQ5BC,IAAAA,qBAR4B;AAS5BC,IAAAA,KAT4B;AAU5BhB,IAAAA,QAV4B;AAW5BiB,IAAAA;AAX4B,GAYzB;AACH,QAAMC,oBAAoB,GAAGhB,gBAAgB,EAA7C;AACA,QAAMiB,oBAAoB,GAAGD,oBAAoB,GAC9Cb,QAD8C,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AA,SAAS,EAAGC;AAPb,IAFF,EAYGJ,YAAY,IACb,cAAC,QAAD;AACC,IAAA,KAAK,EAAGK,KADT;AAEC,IAAA,QAAQ,EAAGhB,QAFZ;AAGC,IAAA,QAAQ,EAAGiB;AAHZ,IAbF,CAfD,CAFF,CATD,CADD;AAoDA;;AAED,eAAeV,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tTextControl,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { settings as settingsIcon } from '@wordpress/icons';\nimport { useReducedMotion, useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Fragment } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Settings from './settings';\n\nfunction LinkSettingsDrawer( {\n\tsettingsOpen,\n\tsetSettingsOpen,\n\tshowTextControl,\n\tshowSettings,\n\ttextInputRef,\n\tinternalTextInputValue,\n\tsetInternalTextInputValue,\n\thandleSubmitWithEnter,\n\tvalue,\n\tsettings,\n\tonChange,\n} ) {\n\tconst prefersReducedMotion = useReducedMotion();\n\tconst MaybeAnimatePresence = prefersReducedMotion\n\t\t? Fragment\n\t\t: AnimatePresence;\n\tconst MaybeMotionDiv = prefersReducedMotion ? 'div' : motion.div;\n\n\tconst id = useInstanceId( LinkSettingsDrawer );\n\n\tconst settingsDrawerId = `link-control-settings-drawer-${ id }`;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-link-control__drawer-toggle\"\n\t\t\t\taria-expanded={ settingsOpen }\n\t\t\t\tonClick={ () => setSettingsOpen( ! settingsOpen ) }\n\t\t\t\ticon={ settingsIcon }\n\t\t\t\tlabel={ __( 'Link Settings' ) }\n\t\t\t\taria-controls={ settingsDrawerId }\n\t\t\t/>\n\t\t\t<MaybeAnimatePresence>\n\t\t\t\t{ settingsOpen && (\n\t\t\t\t\t<MaybeMotionDiv\n\t\t\t\t\t\tclassName=\"block-editor-link-control__drawer\"\n\t\t\t\t\t\thidden={ ! settingsOpen }\n\t\t\t\t\t\tid={ settingsDrawerId }\n\t\t\t\t\t\tinitial=\"collapsed\"\n\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\texit=\"collapsed\"\n\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\topen: { opacity: 1, height: 'auto' },\n\t\t\t\t\t\t\tcollapsed: { opacity: 0, height: 0 },\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\tduration: 0.1,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"block-editor-link-control__drawer-inner\">\n\t\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__setting block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\t\tlabel=\"Text\"\n\t\t\t\t\t\t\t\t\tvalue={ internalTextInputValue }\n\t\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ showSettings && (\n\t\t\t\t\t\t\t\t<Settings\n\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</MaybeMotionDiv>\n\t\t\t\t) }\n\t\t\t</MaybeAnimatePresence>\n\t\t</>\n\t);\n}\n\nexport default LinkSettingsDrawer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings.js"],"names":["__","ToggleControl","VisuallyHidden","noop","LinkControlSettings","value","onChange","settings","length","handleSettingChange","setting","newValue","id","theSettings","map","title"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,uBAA9C;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,mBAAmB,GAAG,QAA4C;AAAA,MAA1C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAQ,GAAGH,IAApB;AAA0BI,IAAAA;AAA1B,GAA0C;;AACvE,MAAK,CAAEA,QAAF,IAAc,CAAEA,QAAQ,CAACC,MAA9B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,QAAMC,mBAAmB,GAAKC,OAAF,IAAiBC,QAAF,IAAgB;AAC1DL,IAAAA,QAAQ,CAAE,EACT,GAAGD,KADM;AAET,OAAEK,OAAO,CAACE,EAAV,GAAgBD;AAFP,KAAF,CAAR;AAIA,GALD;;AAOA,QAAME,WAAW,GAAGN,QAAQ,CAACO,GAAT,CAAgBJ,OAAF,IACjC,cAAC,aAAD;AACC,IAAA,SAAS,EAAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/settings.js"],"names":["__","ToggleControl","VisuallyHidden","noop","LinkControlSettings","value","onChange","settings","length","handleSettingChange","setting","newValue","id","theSettings","map","title"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,uBAA9C;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,mBAAmB,GAAG,QAA4C;AAAA,MAA1C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAQ,GAAGH,IAApB;AAA0BI,IAAAA;AAA1B,GAA0C;;AACvE,MAAK,CAAEA,QAAF,IAAc,CAAEA,QAAQ,CAACC,MAA9B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,QAAMC,mBAAmB,GAAKC,OAAF,IAAiBC,QAAF,IAAgB;AAC1DL,IAAAA,QAAQ,CAAE,EACT,GAAGD,KADM;AAET,OAAEK,OAAO,CAACE,EAAV,GAAgBD;AAFP,KAAF,CAAR;AAIA,GALD;;AAOA,QAAME,WAAW,GAAGN,QAAQ,CAACO,GAAT,CAAgBJ,OAAF,IACjC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,oCAFX;AAGC,IAAA,GAAG,EAAGA,OAAO,CAACE,EAHf;AAIC,IAAA,KAAK,EAAGF,OAAO,CAACK,KAJjB;AAKC,IAAA,QAAQ,EAAGN,mBAAmB,CAAEC,OAAF,CAL/B;AAMC,IAAA,OAAO,EAAGL,KAAK,GAAG,CAAC,CAAEA,KAAK,CAAEK,OAAO,CAACE,EAAV,CAAX,GAA4B;AAN5C,IADmB,CAApB;AAWA,SACC;AAAU,IAAA,SAAS,EAAC;AAApB,KACC,cAAC,cAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACGZ,EAAE,CAAE,kCAAF,CADL,CADD,EAIGa,WAJH,CADD;AAQA,CA/BD;;AAiCA,eAAeT,mBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToggleControl, VisuallyHidden } from '@wordpress/components';\n\nconst noop = () => {};\n\nconst LinkControlSettings = ( { value, onChange = noop, settings } ) => {\n\tif ( ! settings || ! settings.length ) {\n\t\treturn null;\n\t}\n\n\tconst handleSettingChange = ( setting ) => ( newValue ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\t[ setting.id ]: newValue,\n\t\t} );\n\t};\n\n\tconst theSettings = settings.map( ( setting ) => (\n\t\t<ToggleControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"block-editor-link-control__setting\"\n\t\t\tkey={ setting.id }\n\t\t\tlabel={ setting.title }\n\t\t\tonChange={ handleSettingChange( setting ) }\n\t\t\tchecked={ value ? !! value[ setting.id ] : false }\n\t\t/>\n\t) );\n\n\treturn (\n\t\t<fieldset className=\"block-editor-link-control__settings\">\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Currently selected link settings' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ theSettings }\n\t\t</fieldset>\n\t);\n};\n\nexport default LinkControlSettings;\n"]}
|
|
@@ -20,6 +20,7 @@ import { sprintf, __ } from '@wordpress/i18n';
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import ListViewLeaf from './leaf';
|
|
23
|
+
import useListViewScrollIntoView from './use-list-view-scroll-into-view';
|
|
23
24
|
import { BlockMoverUpButton, BlockMoverDownButton } from '../block-mover/button';
|
|
24
25
|
import ListViewBlockContents from './block-contents';
|
|
25
26
|
import BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';
|
|
@@ -48,6 +49,7 @@ function ListViewBlock(_ref) {
|
|
|
48
49
|
isSyncedBranch
|
|
49
50
|
} = _ref;
|
|
50
51
|
const cellRef = useRef(null);
|
|
52
|
+
const rowRef = useRef(null);
|
|
51
53
|
const [isHovered, setIsHovered] = useState(false);
|
|
52
54
|
const {
|
|
53
55
|
clientId
|
|
@@ -163,7 +165,17 @@ function ListViewBlock(_ref) {
|
|
|
163
165
|
// to alter a block that isn't part of the selection, they're still able
|
|
164
166
|
// to do so.
|
|
165
167
|
|
|
166
|
-
const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId];
|
|
168
|
+
const dropdownClientIds = selectedClientIds.includes(clientId) ? selectedClientIds : [clientId]; // Pass in a ref to the row, so that it can be scrolled
|
|
169
|
+
// into view when selected. For long lists, the placeholder for the
|
|
170
|
+
// selected block is also observed, within ListViewLeafPlaceholder.
|
|
171
|
+
|
|
172
|
+
useListViewScrollIntoView({
|
|
173
|
+
isSelected,
|
|
174
|
+
rowItemRef: rowRef,
|
|
175
|
+
selectedClientIds
|
|
176
|
+
}); // Detect if there is a block in the canvas currently being edited and multi-selection is not happening.
|
|
177
|
+
|
|
178
|
+
const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1;
|
|
167
179
|
return createElement(ListViewLeaf, {
|
|
168
180
|
className: classes,
|
|
169
181
|
onMouseEnter: onMouseEnter,
|
|
@@ -177,7 +189,8 @@ function ListViewBlock(_ref) {
|
|
|
177
189
|
id: `list-view-block-${clientId}`,
|
|
178
190
|
"data-block": clientId,
|
|
179
191
|
isExpanded: canExpand ? isExpanded : undefined,
|
|
180
|
-
"aria-selected": !!isSelected || forceSelectionContentLock
|
|
192
|
+
"aria-selected": !!isSelected || forceSelectionContentLock,
|
|
193
|
+
ref: rowRef
|
|
181
194
|
}, createElement(TreeGridCell, {
|
|
182
195
|
className: "block-editor-list-view-block__contents-cell",
|
|
183
196
|
colSpan: colSpan,
|
|
@@ -203,7 +216,7 @@ function ListViewBlock(_ref) {
|
|
|
203
216
|
siblingBlockCount: siblingBlockCount,
|
|
204
217
|
level: level,
|
|
205
218
|
ref: ref,
|
|
206
|
-
tabIndex: tabIndex,
|
|
219
|
+
tabIndex: currentlyEditingBlockInCanvas ? 0 : tabIndex,
|
|
207
220
|
onFocus: onFocus,
|
|
208
221
|
isExpanded: isExpanded,
|
|
209
222
|
selectedClientIds: selectedClientIds,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["classnames","hasBlockSupport","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","useInstanceId","moreVertical","useState","useRef","useEffect","useCallback","memo","useDispatch","useSelect","sprintf","__","ListViewLeaf","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","BlockSettingsDropdown","useListViewContext","getBlockPositionDescription","store","blockEditorStore","useBlockDisplayInformation","useBlockLock","ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","isSyncedBranch","cellRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","canEdit","forceSelectionContentLock","select","hasSelectedInnerBlock","canExpand","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockName","getBlockName","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","ref","tabIndex","onFocus","className"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,uBAHP;AAIA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,QADD,EAECC,MAFD,EAGCC,SAHD,EAICC,WAJD,EAKCC,IALD,QAMO,oBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,QAAzB;AACA,SACCC,kBADD,EAECC,oBAFD,QAGO,uBAHP;AAIA,OAAOC,qBAAP,MAAkC,kBAAlC;AACA,OAAOC,qBAAP,MAAkC,gDAAlC;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,2BAAT,QAA4C,SAA5C;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,SAASC,YAAT,QAA6B,eAA7B;;AAEA,SAASC,aAAT,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AAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGZ;AAX7B,MADC;AAAA,GAJH,CAnFF,CADD;AA2GA;;AAED,eAAevE,IAAI,CAAEgB,aAAF,CAAnB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tpreventAnnouncement,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst canExpand = isContentLocked ? false : canEdit;\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions = hasBlockSupport(\n\t\tblockName,\n\t\t'__experimentalToolbar',\n\t\ttrue\n\t);\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tlet blockAriaLabel = __( 'Link' );\n\tif ( blockInformation ) {\n\t\tblockAriaLabel = isLocked\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t\t__( '%s link (locked)' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the block.\n\t\t\t\t\t__( '%s link' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t );\n\t}\n\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\tconst { isTreeGridMounted, expand, collapse } = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ canExpand ? isExpanded : undefined }\n\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\taria-expanded={ canExpand ? isExpanded : undefined }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tpreventAnnouncement={ preventAnnouncement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"names":["classnames","hasBlockSupport","__experimentalTreeGridCell","TreeGridCell","__experimentalTreeGridItem","TreeGridItem","useInstanceId","moreVertical","useState","useRef","useEffect","useCallback","memo","useDispatch","useSelect","sprintf","__","ListViewLeaf","useListViewScrollIntoView","BlockMoverUpButton","BlockMoverDownButton","ListViewBlockContents","BlockSettingsDropdown","useListViewContext","getBlockPositionDescription","store","blockEditorStore","useBlockDisplayInformation","useBlockLock","ListViewBlock","block","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","preventAnnouncement","isSyncedBranch","cellRef","rowRef","isHovered","setIsHovered","clientId","isLocked","isContentLocked","canEdit","forceSelectionContentLock","select","hasSelectedInnerBlock","canExpand","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","blockInformation","blockName","getBlockName","showBlockActions","instanceId","descriptionId","blockPositionDescription","blockAriaLabel","title","settingsAriaLabel","isTreeGridMounted","expand","collapse","hasSiblings","hasRenderedMovers","moverCellClassName","listViewBlockSettingsClassName","current","focus","onMouseEnter","onMouseLeave","selectEditorBlock","event","preventDefault","updateSelection","newClientId","undefined","toggleExpanded","stopPropagation","colSpan","classes","isSynced","dropdownClientIds","includes","rowItemRef","currentlyEditingBlockInCanvas","ref","tabIndex","onFocus","className"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,uBAHP;AAIA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SACCC,QADD,EAECC,MAFD,EAGCC,SAHD,EAICC,WAJD,EAKCC,IALD,QAMO,oBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,OAA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MADC;AAAA,GADH,CAJD,EAeC,cAAC,YAAD,QACG;AAAA,QAAE;AAAEF,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,cAAC,oBAAD;AACC,MAAA,WAAW,EAAC,UADb;AAEC,MAAA,SAAS,EAAG,CAAElD,QAAF,CAFb;AAGC,MAAA,GAAG,EAAGgD,GAHP;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,OAAO,EAAGC;AALX,MADC;AAAA,GADH,CAfD,CADD,CAtDF,EAqFGnC,gBAAgB,IACjB,cAAC,YAAD;AACC,IAAA,SAAS,EAAGa,8BADb;AAEC,qBAAgB,CAAC,CAAE7C,UAAH,IAAiBqB;AAFlC,KAIG;AAAA,QAAE;AAAE4C,MAAAA,GAAF;AAAOC,MAAAA,QAAP;AAAiBC,MAAAA;AAAjB,KAAF;AAAA,WACD,cAAC,qBAAD;AACC,MAAA,SAAS,EAAGN,iBADb;AAEC,MAAA,IAAI,EAAGtF,YAFR;AAGC,MAAA,KAAK,EAAG+D,iBAHT;AAIC,MAAA,WAAW,EAAG;AACb2B,QAAAA,GADa;AAEbG,QAAAA,SAAS,EAAE,oCAFE;AAGbF,QAAAA,QAHa;AAIbC,QAAAA;AAJa,OAJf;AAUC,MAAA,sBAAsB,MAVvB;AAWC,MAAA,yBAAyB,EAAGd;AAX7B,MADC;AAAA,GAJH,CAtFF,CADD;AA8GA;;AAED,eAAezE,IAAI,CAAEiB,aAAF,CAAnB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalTreeGridCell as TreeGridCell,\n\t__experimentalTreeGridItem as TreeGridItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport useListViewScrollIntoView from './use-list-view-scroll-into-view';\nimport {\n\tBlockMoverUpButton,\n\tBlockMoverDownButton,\n} from '../block-mover/button';\nimport ListViewBlockContents from './block-contents';\nimport BlockSettingsDropdown from '../block-settings-menu/block-settings-dropdown';\nimport { useListViewContext } from './context';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\n\nfunction ListViewBlock( {\n\tblock,\n\tisDragged,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tpreventAnnouncement,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst { clientId } = block;\n\n\tconst { isLocked, isContentLocked, canEdit } = useBlockLock( clientId );\n\tconst forceSelectionContentLock = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isSelected ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif ( ! isContentLocked ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( blockEditorStore ).hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\t\t},\n\t\t[ isContentLocked, clientId, isSelected ]\n\t);\n\n\tconst canExpand = isContentLocked ? false : canEdit;\n\tconst isFirstSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected && selectedClientIds[ 0 ] === clientId );\n\tconst isLastSelectedBlock =\n\t\tforceSelectionContentLock ||\n\t\t( isSelected &&\n\t\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId );\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockName = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\n\t// When a block hides its toolbar it also hides the block settings menu,\n\t// since that menu is part of the toolbar in the editor canvas.\n\t// List View respects this by also hiding the block settings menu.\n\tconst showBlockActions = hasBlockSupport(\n\t\tblockName,\n\t\t'__experimentalToolbar',\n\t\ttrue\n\t);\n\tconst instanceId = useInstanceId( ListViewBlock );\n\tconst descriptionId = `list-view-block-select-button__${ instanceId }`;\n\tconst blockPositionDescription = getBlockPositionDescription(\n\t\tposition,\n\t\tsiblingBlockCount,\n\t\tlevel\n\t);\n\n\tlet blockAriaLabel = __( 'Link' );\n\tif ( blockInformation ) {\n\t\tblockAriaLabel = isLocked\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the locked block.\n\t\t\t\t\t__( '%s link (locked)' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: The title of the block. This string indicates a link to select the block.\n\t\t\t\t\t__( '%s link' ),\n\t\t\t\t\tblockInformation.title\n\t\t\t );\n\t}\n\n\tconst settingsAriaLabel = blockInformation\n\t\t? sprintf(\n\t\t\t\t// translators: %s: The title of the block.\n\t\t\t\t__( 'Options for %s block' ),\n\t\t\t\tblockInformation.title\n\t\t )\n\t\t: __( 'Options' );\n\n\tconst { isTreeGridMounted, expand, collapse } = useListViewContext();\n\n\tconst hasSiblings = siblingBlockCount > 0;\n\tconst hasRenderedMovers = showBlockMovers && hasSiblings;\n\tconst moverCellClassName = classnames(\n\t\t'block-editor-list-view-block__mover-cell',\n\t\t{ 'is-visible': isHovered || isSelected }\n\t);\n\n\tconst listViewBlockSettingsClassName = classnames(\n\t\t'block-editor-list-view-block__menu-cell',\n\t\t{ 'is-visible': isHovered || isFirstSelectedBlock }\n\t);\n\n\t// If ListView has experimental features related to the Persistent List View,\n\t// only focus the selected list item on mount; otherwise the list would always\n\t// try to steal the focus from the editor canvas.\n\tuseEffect( () => {\n\t\tif ( ! isTreeGridMounted && isSelected ) {\n\t\t\tcellRef.current.focus();\n\t\t}\n\t}, [] );\n\n\tconst onMouseEnter = useCallback( () => {\n\t\tsetIsHovered( true );\n\t\ttoggleBlockHighlight( clientId, true );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\tconst onMouseLeave = useCallback( () => {\n\t\tsetIsHovered( false );\n\t\ttoggleBlockHighlight( clientId, false );\n\t}, [ clientId, setIsHovered, toggleBlockHighlight ] );\n\n\tconst selectEditorBlock = useCallback(\n\t\t( event ) => {\n\t\t\tselectBlock( event, clientId );\n\t\t\tevent.preventDefault();\n\t\t},\n\t\t[ clientId, selectBlock ]\n\t);\n\n\tconst updateSelection = useCallback(\n\t\t( newClientId ) => {\n\t\t\tselectBlock( undefined, newClientId );\n\t\t},\n\t\t[ selectBlock ]\n\t);\n\n\tconst toggleExpanded = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent shift+click from opening link in a new window when toggling.\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t\tif ( isExpanded === true ) {\n\t\t\t\tcollapse( clientId );\n\t\t\t} else if ( isExpanded === false ) {\n\t\t\t\texpand( clientId );\n\t\t\t}\n\t\t},\n\t\t[ clientId, expand, collapse, isExpanded ]\n\t);\n\n\tlet colSpan;\n\tif ( hasRenderedMovers ) {\n\t\tcolSpan = 2;\n\t} else if ( ! showBlockActions ) {\n\t\tcolSpan = 3;\n\t}\n\n\tconst classes = classnames( {\n\t\t'is-selected': isSelected || forceSelectionContentLock,\n\t\t'is-first-selected': isFirstSelectedBlock,\n\t\t'is-last-selected': isLastSelectedBlock,\n\t\t'is-branch-selected': isBranchSelected,\n\t\t'is-synced-branch': isSyncedBranch,\n\t\t'is-dragging': isDragged,\n\t\t'has-single-cell': ! showBlockActions,\n\t\t'is-synced': blockInformation?.isSynced,\n\t} );\n\n\t// Only include all selected blocks if the currently clicked on block\n\t// is one of the selected blocks. This ensures that if a user attempts\n\t// to alter a block that isn't part of the selection, they're still able\n\t// to do so.\n\tconst dropdownClientIds = selectedClientIds.includes( clientId )\n\t\t? selectedClientIds\n\t\t: [ clientId ];\n\n\t// Pass in a ref to the row, so that it can be scrolled\n\t// into view when selected. For long lists, the placeholder for the\n\t// selected block is also observed, within ListViewLeafPlaceholder.\n\tuseListViewScrollIntoView( {\n\t\tisSelected,\n\t\trowItemRef: rowRef,\n\t\tselectedClientIds,\n\t} );\n\n\t// Detect if there is a block in the canvas currently being edited and multi-selection is not happening.\n\tconst currentlyEditingBlockInCanvas =\n\t\tisSelected && selectedClientIds.length === 1;\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onMouseEnter }\n\t\t\tonBlur={ onMouseLeave }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t\tid={ `list-view-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tisExpanded={ canExpand ? isExpanded : undefined }\n\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\tref={ rowRef }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-block__contents-cell\"\n\t\t\t\tcolSpan={ colSpan }\n\t\t\t\tref={ cellRef }\n\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\taria-expanded={ canExpand ? isExpanded : undefined }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-block__contents-container\">\n\t\t\t\t\t\t<ListViewBlockContents\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ selectEditorBlock }\n\t\t\t\t\t\t\tonToggleExpanded={ toggleExpanded }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\tsiblingBlockCount={ siblingBlockCount }\n\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\ttabIndex={\n\t\t\t\t\t\t\t\tcurrentlyEditingBlockInCanvas ? 0 : tabIndex\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tpreventAnnouncement={ preventAnnouncement }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t\t{ hasRenderedMovers && (\n\t\t\t\t<>\n\t\t\t\t\t<TreeGridCell\n\t\t\t\t\t\tclassName={ moverCellClassName }\n\t\t\t\t\t\twithoutGridItem\n\t\t\t\t\t>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverUpButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t\t<TreeGridItem>\n\t\t\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t\t\t<BlockMoverDownButton\n\t\t\t\t\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t\t\t\t\t\tclientIds={ [ clientId ] }\n\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</TreeGridItem>\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ showBlockActions && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected || forceSelectionContentLock }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsDropdown\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ settingsAriaLabel }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\tclassName: 'block-editor-list-view-block__menu',\n\t\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\t\tonFocus,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdisableOpenOnArrowDown\n\t\t\t\t\t\t\t__experimentalSelectBlock={ updateSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"]}
|
|
@@ -125,12 +125,12 @@ function ListViewBranch(props) {
|
|
|
125
125
|
const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
|
|
126
126
|
const hasNestedBlocks = !!(innerBlocks !== null && innerBlocks !== void 0 && innerBlocks.length);
|
|
127
127
|
const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined;
|
|
128
|
-
const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId));
|
|
129
|
-
const showBlock = isDragged || blockInView; // Make updates to the selected or dragged blocks synchronous,
|
|
128
|
+
const isDragged = !!(draggedClientIds !== null && draggedClientIds !== void 0 && draggedClientIds.includes(clientId)); // Make updates to the selected or dragged blocks synchronous,
|
|
130
129
|
// but asynchronous for any other block.
|
|
131
130
|
|
|
132
131
|
const isSelected = isClientIdSelected(clientId, selectedClientIds);
|
|
133
132
|
const isSelectedBranch = isBranchSelected || isSelected && hasNestedBlocks;
|
|
133
|
+
const showBlock = isDragged || blockInView || isSelected;
|
|
134
134
|
return createElement(AsyncModeProvider, {
|
|
135
135
|
key: clientId,
|
|
136
136
|
value: !isSelected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"names":["memo","AsyncModeProvider","useSelect","ListViewBlock","useListViewContext","isClientIdSelected","store","blockEditorStore","useBlockDisplayInformation","countBlocks","block","expandedState","draggedClientIds","isExpandedByDefault","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","length","noop","ListViewBranch","props","blocks","selectBlock","showBlockMovers","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","parentId","shouldShowInnerBlocks","isSyncedBranch","parentBlockInformation","syncedBranch","isSynced","canParentExpand","select","isContentLocked","getTemplateLock","canEdit","canEditBlock","filteredBlocks","filter","Boolean","blockCount","nextPosition","map","index","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","showBlock","isSelected","isSelectedBranch"],"m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G,CAP/B;AAQC,MAAA,eAAe,EAAGjB,eARnB;AASC,MAAA,gBAAgB,EAAG6B,gBATpB;AAUC,MAAA,iBAAiB,EAAGlC,iBAVrB;AAWC,MAAA,UAAU,EAAGZ,UAXd;AAYC,MAAA,cAAc,EAAGsB;AAZlB,MA1BF,CADD;AA4CA,GAnFC,CADH,CADD;AAwFA;;AAED,eAAevC,IAAI,CAAEwB,cAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\n\n/**\n * Given a block, returns the total number of blocks in that subtree. This is used to help determine\n * the list position of a block.\n *\n * When a block is collapsed, we do not count their children as part of that total. In the current drag\n * implementation dragged blocks and their children are not counted.\n *\n * @param {Object} block block tree\n * @param {Object} expandedState state that notes which branches are collapsed\n * @param {Array} draggedClientIds a list of dragged client ids\n * @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state.\n * @return {number} block count\n */\nfunction countBlocks(\n\tblock,\n\texpandedState,\n\tdraggedClientIds,\n\tisExpandedByDefault\n) {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn 0;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? isExpandedByDefault;\n\n\tif ( isExpanded ) {\n\t\treturn (\n\t\t\t1 +\n\t\t\tblock.innerBlocks.reduce(\n\t\t\t\tcountReducer(\n\t\t\t\t\texpandedState,\n\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\tisExpandedByDefault\n\t\t\t\t),\n\t\t\t\t0\n\t\t\t)\n\t\t);\n\t}\n\treturn 1;\n}\nconst countReducer =\n\t( expandedState, draggedClientIds, isExpandedByDefault ) =>\n\t( count, block ) => {\n\t\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\t\tif ( isDragged ) {\n\t\t\treturn count;\n\t\t}\n\t\tconst isExpanded =\n\t\t\texpandedState[ block.clientId ] ?? isExpandedByDefault;\n\t\tif ( isExpanded && block.innerBlocks.length > 0 ) {\n\t\t\treturn (\n\t\t\t\tcount +\n\t\t\t\tcountBlocks(\n\t\t\t\t\tblock,\n\t\t\t\t\texpandedState,\n\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\tisExpandedByDefault\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn count + 1;\n\t};\n\nconst noop = () => {};\n\nfunction ListViewBranch( props ) {\n\tconst {\n\t\tblocks,\n\t\tselectBlock = noop,\n\t\tshowBlockMovers,\n\t\tselectedClientIds,\n\t\tlevel = 1,\n\t\tpath = '',\n\t\tisBranchSelected = false,\n\t\tlistPosition = 0,\n\t\tfixedListWindow,\n\t\tisExpanded,\n\t\tparentId,\n\t\tshouldShowInnerBlocks = true,\n\t\tisSyncedBranch = false,\n\t} = props;\n\n\tconst parentBlockInformation = useBlockDisplayInformation( parentId );\n\tconst syncedBranch = isSyncedBranch || !! parentBlockInformation?.isSynced;\n\n\tconst canParentExpand = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parentId ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst isContentLocked =\n\t\t\t\tselect( blockEditorStore ).getTemplateLock( parentId ) ===\n\t\t\t\t'contentOnly';\n\t\t\tconst canEdit = select( blockEditorStore ).canEditBlock( parentId );\n\n\t\t\treturn isContentLocked ? false : canEdit;\n\t\t},\n\t\t[ parentId ]\n\t);\n\n\tconst { expandedState, draggedClientIds } = useListViewContext();\n\n\tif ( ! canParentExpand ) {\n\t\treturn null;\n\t}\n\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\n\tlet nextPosition = listPosition;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredBlocks.map( ( block, index ) => {\n\t\t\t\tconst { clientId, innerBlocks } = block;\n\n\t\t\t\tif ( index > 0 ) {\n\t\t\t\t\tnextPosition += countBlocks(\n\t\t\t\t\t\tfilteredBlocks[ index - 1 ],\n\t\t\t\t\t\texpandedState,\n\t\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\t\tisExpanded\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst { itemInView } = fixedListWindow;\n\t\t\t\tconst blockInView = itemInView( nextPosition );\n\n\t\t\t\tconst position = index + 1;\n\t\t\t\tconst updatedPath =\n\t\t\t\t\tpath.length > 0\n\t\t\t\t\t\t? `${ path }_${ position }`\n\t\t\t\t\t\t: `${ position }`;\n\t\t\t\tconst hasNestedBlocks = !! innerBlocks?.length;\n\n\t\t\t\tconst shouldExpand =\n\t\t\t\t\thasNestedBlocks && shouldShowInnerBlocks\n\t\t\t\t\t\t? expandedState[ clientId ] ?? isExpanded\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\tconst isDragged = !! draggedClientIds?.includes( clientId );\n\n\t\t\t\tconst showBlock = isDragged || blockInView;\n\n\t\t\t\t// Make updates to the selected or dragged blocks synchronous,\n\t\t\t\t// but asynchronous for any other block.\n\t\t\t\tconst isSelected = isClientIdSelected(\n\t\t\t\t\tclientId,\n\t\t\t\t\tselectedClientIds\n\t\t\t\t);\n\t\t\t\tconst isSelectedBranch =\n\t\t\t\t\tisBranchSelected || ( isSelected && hasNestedBlocks );\n\t\t\t\treturn (\n\t\t\t\t\t<AsyncModeProvider key={ clientId } value={ ! isSelected }>\n\t\t\t\t\t\t{ showBlock && (\n\t\t\t\t\t\t\t<ListViewBlock\n\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tisDragged={ isDragged }\n\t\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\t\trowCount={ blockCount }\n\t\t\t\t\t\t\t\tsiblingBlockCount={ blockCount }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tisExpanded={ shouldExpand }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t\tisSyncedBranch={ syncedBranch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! showBlock && (\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td className=\"block-editor-list-view-placeholder\" />\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ hasNestedBlocks && shouldExpand && ! isDragged && (\n\t\t\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\t\t\tparentId={ clientId }\n\t\t\t\t\t\t\t\tblocks={ innerBlocks }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tlevel={ level + 1 }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition + 1 }\n\t\t\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tisSyncedBranch={ syncedBranch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AsyncModeProvider>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default memo( ListViewBranch );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"names":["memo","AsyncModeProvider","useSelect","ListViewBlock","useListViewContext","isClientIdSelected","store","blockEditorStore","useBlockDisplayInformation","countBlocks","block","expandedState","draggedClientIds","isExpandedByDefault","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","length","noop","ListViewBranch","props","blocks","selectBlock","showBlockMovers","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","parentId","shouldShowInnerBlocks","isSyncedBranch","parentBlockInformation","syncedBranch","isSynced","canParentExpand","select","isContentLocked","getTemplateLock","canEdit","canEditBlock","filteredBlocks","filter","Boolean","blockCount","nextPosition","map","index","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","isSelected","isSelectedBranch","showBlock"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,oBAArB;AACA,SAASC,iBAAT,EAA4BC,SAA5B,QAA6C,iBAA7C;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,SAASC,kBAAT,QAAmC,WAAnC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,WAAT,CACCC,KADD,EAECC,aAFD,EAGCC,gBAHD,EAICC,mBAJD,EAKE;AAAA;;AACD,QAAMC,SAAS,GAAGF,gBAAH,aAAGA,gBAAH,uBAAGA,gBAAgB,CAAEG,QAAlB,CAA4BL,KAAK,CAACM,QAAlC,CAAlB;;AACA,MAAKF,SAAL,EAAiB;AAChB,WAAO,CAAP;AACA;;AACD,QAAMG,UAAU,4BAAGN,aAAa,CAAED,KAAK,CAACM,QAAR,CAAhB,yEAAsCH,mBAAtD;;AAEA,MAAKI,UAAL,EAAkB;AACjB,WACC,IACAP,KAAK,CAACQ,WAAN,CAAkBC,MA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C,MAAA,YAAY,EAAGR,YAbhB;AAcC,MAAA,iBAAiB,EAAGtB,iBAdrB;AAeC,MAAA,cAAc,EAAGU;AAflB,MAFF,EAoBG,CAAEwB,SAAF,IACD,0BACC;AAAI,MAAA,SAAS,EAAC;AAAd,MADD,CArBF,EAyBGL,eAAe,IAAIC,YAAnB,IAAmC,CAAE7C,SAArC,IACD,cAAC,cAAD;AACC,MAAA,QAAQ,EAAGE,QADZ;AAEC,MAAA,MAAM,EAAGE,WAFV;AAGC,MAAA,WAAW,EAAGS,WAHf;AAIC,MAAA,eAAe,EAAGC,eAJnB;AAKC,MAAA,KAAK,EAAGE,KAAK,GAAG,CALjB;AAMC,MAAA,IAAI,EAAG2B,WANR;AAOC,MAAA,YAAY,EAAGN,YAAY,GAAG,CAP/B;AAQC,MAAA,eAAe,EAAGjB,eARnB;AASC,MAAA,gBAAgB,EAAG4B,gBATpB;AAUC,MAAA,iBAAiB,EAAGjC,iBAVrB;AAWC,MAAA,UAAU,EAAGZ,UAXd;AAYC,MAAA,cAAc,EAAGsB;AAZlB,MA1BF,CADD;AA4CA,GAlFC,CADH,CADD;AAuFA;;AAED,eAAevC,IAAI,CAAEwB,cAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { isClientIdSelected } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\n\n/**\n * Given a block, returns the total number of blocks in that subtree. This is used to help determine\n * the list position of a block.\n *\n * When a block is collapsed, we do not count their children as part of that total. In the current drag\n * implementation dragged blocks and their children are not counted.\n *\n * @param {Object} block block tree\n * @param {Object} expandedState state that notes which branches are collapsed\n * @param {Array} draggedClientIds a list of dragged client ids\n * @param {boolean} isExpandedByDefault flag to determine the default fallback expanded state.\n * @return {number} block count\n */\nfunction countBlocks(\n\tblock,\n\texpandedState,\n\tdraggedClientIds,\n\tisExpandedByDefault\n) {\n\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\tif ( isDragged ) {\n\t\treturn 0;\n\t}\n\tconst isExpanded = expandedState[ block.clientId ] ?? isExpandedByDefault;\n\n\tif ( isExpanded ) {\n\t\treturn (\n\t\t\t1 +\n\t\t\tblock.innerBlocks.reduce(\n\t\t\t\tcountReducer(\n\t\t\t\t\texpandedState,\n\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\tisExpandedByDefault\n\t\t\t\t),\n\t\t\t\t0\n\t\t\t)\n\t\t);\n\t}\n\treturn 1;\n}\nconst countReducer =\n\t( expandedState, draggedClientIds, isExpandedByDefault ) =>\n\t( count, block ) => {\n\t\tconst isDragged = draggedClientIds?.includes( block.clientId );\n\t\tif ( isDragged ) {\n\t\t\treturn count;\n\t\t}\n\t\tconst isExpanded =\n\t\t\texpandedState[ block.clientId ] ?? isExpandedByDefault;\n\t\tif ( isExpanded && block.innerBlocks.length > 0 ) {\n\t\t\treturn (\n\t\t\t\tcount +\n\t\t\t\tcountBlocks(\n\t\t\t\t\tblock,\n\t\t\t\t\texpandedState,\n\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\tisExpandedByDefault\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn count + 1;\n\t};\n\nconst noop = () => {};\n\nfunction ListViewBranch( props ) {\n\tconst {\n\t\tblocks,\n\t\tselectBlock = noop,\n\t\tshowBlockMovers,\n\t\tselectedClientIds,\n\t\tlevel = 1,\n\t\tpath = '',\n\t\tisBranchSelected = false,\n\t\tlistPosition = 0,\n\t\tfixedListWindow,\n\t\tisExpanded,\n\t\tparentId,\n\t\tshouldShowInnerBlocks = true,\n\t\tisSyncedBranch = false,\n\t} = props;\n\n\tconst parentBlockInformation = useBlockDisplayInformation( parentId );\n\tconst syncedBranch = isSyncedBranch || !! parentBlockInformation?.isSynced;\n\n\tconst canParentExpand = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parentId ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst isContentLocked =\n\t\t\t\tselect( blockEditorStore ).getTemplateLock( parentId ) ===\n\t\t\t\t'contentOnly';\n\t\t\tconst canEdit = select( blockEditorStore ).canEditBlock( parentId );\n\n\t\t\treturn isContentLocked ? false : canEdit;\n\t\t},\n\t\t[ parentId ]\n\t);\n\n\tconst { expandedState, draggedClientIds } = useListViewContext();\n\n\tif ( ! canParentExpand ) {\n\t\treturn null;\n\t}\n\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\n\tlet nextPosition = listPosition;\n\n\treturn (\n\t\t<>\n\t\t\t{ filteredBlocks.map( ( block, index ) => {\n\t\t\t\tconst { clientId, innerBlocks } = block;\n\n\t\t\t\tif ( index > 0 ) {\n\t\t\t\t\tnextPosition += countBlocks(\n\t\t\t\t\t\tfilteredBlocks[ index - 1 ],\n\t\t\t\t\t\texpandedState,\n\t\t\t\t\t\tdraggedClientIds,\n\t\t\t\t\t\tisExpanded\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst { itemInView } = fixedListWindow;\n\t\t\t\tconst blockInView = itemInView( nextPosition );\n\n\t\t\t\tconst position = index + 1;\n\t\t\t\tconst updatedPath =\n\t\t\t\t\tpath.length > 0\n\t\t\t\t\t\t? `${ path }_${ position }`\n\t\t\t\t\t\t: `${ position }`;\n\t\t\t\tconst hasNestedBlocks = !! innerBlocks?.length;\n\n\t\t\t\tconst shouldExpand =\n\t\t\t\t\thasNestedBlocks && shouldShowInnerBlocks\n\t\t\t\t\t\t? expandedState[ clientId ] ?? isExpanded\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\tconst isDragged = !! draggedClientIds?.includes( clientId );\n\n\t\t\t\t// Make updates to the selected or dragged blocks synchronous,\n\t\t\t\t// but asynchronous for any other block.\n\t\t\t\tconst isSelected = isClientIdSelected(\n\t\t\t\t\tclientId,\n\t\t\t\t\tselectedClientIds\n\t\t\t\t);\n\t\t\t\tconst isSelectedBranch =\n\t\t\t\t\tisBranchSelected || ( isSelected && hasNestedBlocks );\n\t\t\t\tconst showBlock = isDragged || blockInView || isSelected;\n\t\t\t\treturn (\n\t\t\t\t\t<AsyncModeProvider key={ clientId } value={ ! isSelected }>\n\t\t\t\t\t\t{ showBlock && (\n\t\t\t\t\t\t\t<ListViewBlock\n\t\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tisDragged={ isDragged }\n\t\t\t\t\t\t\t\tlevel={ level }\n\t\t\t\t\t\t\t\tposition={ position }\n\t\t\t\t\t\t\t\trowCount={ blockCount }\n\t\t\t\t\t\t\t\tsiblingBlockCount={ blockCount }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tisExpanded={ shouldExpand }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t\tisSyncedBranch={ syncedBranch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! showBlock && (\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td className=\"block-editor-list-view-placeholder\" />\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ hasNestedBlocks && shouldExpand && ! isDragged && (\n\t\t\t\t\t\t\t<ListViewBranch\n\t\t\t\t\t\t\t\tparentId={ clientId }\n\t\t\t\t\t\t\t\tblocks={ innerBlocks }\n\t\t\t\t\t\t\t\tselectBlock={ selectBlock }\n\t\t\t\t\t\t\t\tshowBlockMovers={ showBlockMovers }\n\t\t\t\t\t\t\t\tlevel={ level + 1 }\n\t\t\t\t\t\t\t\tpath={ updatedPath }\n\t\t\t\t\t\t\t\tlistPosition={ nextPosition + 1 }\n\t\t\t\t\t\t\t\tfixedListWindow={ fixedListWindow }\n\t\t\t\t\t\t\t\tisBranchSelected={ isSelectedBranch }\n\t\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tisSyncedBranch={ syncedBranch }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AsyncModeProvider>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default memo( ListViewBranch );\n"]}
|
|
@@ -23,7 +23,8 @@ export default function ListViewExpander(_ref) {
|
|
|
23
23
|
onClick: event => onClick(event, {
|
|
24
24
|
forceToggle: true
|
|
25
25
|
}),
|
|
26
|
-
"aria-hidden": "true"
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
"data-testid": "list-view-expander"
|
|
27
28
|
}, createElement(Icon, {
|
|
28
29
|
icon: isRTL() ? chevronLeftSmall : chevronRightSmall
|
|
29
30
|
}))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/expander.js"],"names":["chevronRightSmall","chevronLeftSmall","Icon","isRTL","ListViewExpander","onClick","event","forceToggle"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,iBAAT,EAA4BC,gBAA5B,EAA8CC,IAA9C,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA,eAAe,SAASC,gBAAT,OAAyC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACvD,SACC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,MAAA,SAAS,EAAC,kCADX;AAEC,MAAA,OAAO,EAAKC,KAAF,IAAaD,OAAO,CAAEC,KAAF,EAAS;AAAEC,QAAAA,WAAW,EAAE;AAAf,OAAT,CAF/B;AAGC,qBAAY;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/expander.js"],"names":["chevronRightSmall","chevronLeftSmall","Icon","isRTL","ListViewExpander","onClick","event","forceToggle"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,iBAAT,EAA4BC,gBAA5B,EAA8CC,IAA9C,QAA0D,kBAA1D;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA,eAAe,SAASC,gBAAT,OAAyC;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AACvD,SACC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,MAAA,SAAS,EAAC,kCADX;AAEC,MAAA,OAAO,EAAKC,KAAF,IAAaD,OAAO,CAAEC,KAAF,EAAS;AAAEC,QAAAA,WAAW,EAAE;AAAf,OAAT,CAF/B;AAGC,qBAAY,MAHb;AAIC,qBAAY;AAJb,OAMC,cAAC,IAAD;AAAM,MAAA,IAAI,EAAGJ,KAAK,KAAKF,gBAAL,GAAwBD;AAA1C,MAND;AAVD;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { chevronRightSmall, chevronLeftSmall, Icon } from '@wordpress/icons';\nimport { isRTL } from '@wordpress/i18n';\n\nexport default function ListViewExpander( { onClick } ) {\n\treturn (\n\t\t// Keyboard events are handled by TreeGrid see: components/src/tree-grid/index.js\n\t\t//\n\t\t// The expander component is implemented as a pseudo element in the w3 example\n\t\t// https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html\n\t\t//\n\t\t// We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree.\n\t\t// For the current tree grid implementation, please do not try to make this a button.\n\t\t//\n\t\t// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n\t\t<span\n\t\t\tclassName=\"block-editor-list-view__expander\"\n\t\t\tonClick={ ( event ) => onClick( event, { forceToggle: true } ) }\n\t\t\taria-hidden=\"true\"\n\t\t\tdata-testid=\"list-view-expander\"\n\t\t>\n\t\t\t<Icon icon={ isRTL() ? chevronLeftSmall : chevronRightSmall } />\n\t\t</span>\n\t);\n}\n"]}
|