@wordpress/block-editor 12.17.0 → 12.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +32 -0
- package/build/components/block-draggable/index.js +11 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-edit/context.js +3 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +4 -2
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +6 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +4 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +9 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +30 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/private-block-context.js +1 -1
- package/build/components/block-list/private-block-context.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/toolbar.js +8 -2
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-popover/inbetween.js +15 -3
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +3 -2
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +12 -1
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +119 -90
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +10 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +7 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -14
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -5
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +7 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +11 -8
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +31 -14
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +6 -0
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +99 -0
- package/build/components/iframe/get-compatibility-styles.js.map +1 -0
- package/build/components/iframe/index.js +2 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +16 -2
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +16 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/link-control/link-preview.js +30 -26
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -9
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +3 -1
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +10 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +29 -8
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +100 -32
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +52 -4
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-block-indexes.js +30 -0
- package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
- package/build/components/list-view/use-list-view-drop-zone.js +56 -5
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +92 -0
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +21 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +30 -6
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +9 -9
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +30 -7
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +50 -8
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/hooks/block-hooks.js +5 -14
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/content-lock-ui.js +17 -42
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +71 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/effects.js +66 -0
- package/build/hooks/effects.js.map +1 -0
- package/build/hooks/index.js +17 -4
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +13 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/style.js +9 -2
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +2 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.native.js +2 -2
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +115 -0
- package/build/hooks/use-bindings-attributes.js.map +1 -0
- package/build/hooks/use-shadow-props.js +46 -0
- package/build/hooks/use-shadow-props.js.map +1 -0
- package/build/hooks/utils.js +12 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +10 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +2 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +37 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +60 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +44 -3
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +27 -0
- package/build/store/resolvers.js.map +1 -0
- package/build/store/selectors.js +94 -56
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +5 -26
- package/build/store/utils.js.map +1 -1
- package/build/utils/index.js +0 -16
- package/build/utils/index.js.map +1 -1
- package/build/utils/math.js +13 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/object.js +17 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +37 -27
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +11 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +5 -3
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +7 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +5 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +6 -5
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +11 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +31 -5
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +1 -1
- package/build-module/components/block-list/private-block-context.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +8 -2
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +15 -3
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-preview/auto.js +3 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +116 -86
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +10 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +7 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -14
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -5
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +7 -1
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +11 -8
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +32 -15
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +6 -0
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +93 -0
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
- package/build-module/components/iframe/index.js +2 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +32 -28
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -8
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +3 -1
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +10 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +30 -9
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +99 -32
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +54 -6
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
- package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
- package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +91 -0
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +17 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +30 -6
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +9 -9
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +31 -8
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +51 -9
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/hooks/block-hooks.js +5 -14
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +19 -43
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +70 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/effects.js +51 -0
- package/build-module/hooks/effects.js.map +1 -0
- package/build-module/hooks/index.js +5 -3
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/style.js +9 -2
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +2 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.native.js +2 -2
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +112 -0
- package/build-module/hooks/use-bindings-attributes.js.map +1 -0
- package/build-module/hooks/use-shadow-props.js +39 -0
- package/build-module/hooks/use-shadow-props.js.map +1 -0
- package/build-module/hooks/utils.js +14 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +10 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +2 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +35 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +53 -8
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +43 -3
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +20 -0
- package/build-module/store/resolvers.js.map +1 -0
- package/build-module/store/selectors.js +89 -52
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -23
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/index.js +0 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/math.js +12 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/object.js +16 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +36 -27
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +33 -16
- package/build-style/content.css +33 -16
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +169 -114
- package/build-style/style.css +169 -114
- package/package.json +31 -31
- package/src/components/block-canvas/style.scss +8 -1
- package/src/components/block-draggable/index.js +16 -5
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +4 -0
- package/src/components/block-editing-mode/index.js +12 -7
- package/src/components/block-inspector/index.js +5 -2
- package/src/components/block-list/block.js +5 -4
- package/src/components/block-list/block.native.js +13 -3
- package/src/components/block-list/content.scss +34 -5
- package/src/components/block-list/index.js +52 -16
- package/src/components/block-list/private-block-context.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +1 -2
- package/src/components/block-lock/toolbar.js +10 -2
- package/src/components/block-popover/inbetween.js +22 -2
- package/src/components/block-preview/auto.js +3 -3
- package/src/components/block-removal-warning-modal/index.js +3 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
- package/src/components/block-switcher/block-transformations-menu.js +18 -1
- package/src/components/block-switcher/index.js +133 -111
- package/src/components/block-switcher/style.scss +6 -4
- package/src/components/block-switcher/test/index.js +113 -230
- package/src/components/block-toolbar/style.scss +22 -18
- package/src/components/block-tools/insertion-point.js +15 -2
- package/src/components/block-tools/style.scss +8 -7
- package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
- package/src/components/font-sizes/fluid-utils.js +8 -2
- package/src/components/font-sizes/test/fluid-utils.js +9 -0
- package/src/components/global-styles/border-panel.js +7 -17
- package/src/components/global-styles/dimensions-panel.js +50 -1
- package/src/components/global-styles/effects-panel.js +16 -1
- package/src/components/global-styles/hooks.js +11 -6
- package/src/components/global-styles/typography-panel.js +45 -13
- package/src/components/global-styles/use-global-styles-output.js +6 -0
- package/src/components/iframe/get-compatibility-styles.js +120 -0
- package/src/components/iframe/index.js +2 -3
- package/src/components/index.js +4 -2
- package/src/components/index.native.js +4 -2
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
- package/src/components/link-control/link-preview.js +31 -55
- package/src/components/link-control/search-input.js +1 -9
- package/src/components/link-control/style.scss +31 -85
- package/src/components/link-control/test/index.js +2 -1
- package/src/components/list-view/block-contents.js +5 -1
- package/src/components/list-view/block.js +9 -0
- package/src/components/list-view/branch.js +30 -10
- package/src/components/list-view/drop-indicator.js +139 -46
- package/src/components/list-view/index.js +74 -3
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/style.scss +102 -13
- package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
- package/src/components/list-view/test/utils.js +218 -1
- package/src/components/list-view/use-list-view-block-indexes.js +29 -0
- package/src/components/list-view/use-list-view-drop-zone.js +78 -6
- package/src/components/list-view/utils.js +116 -0
- package/src/components/provider/index.js +3 -1
- package/src/components/recursion-provider/README.md +2 -2
- package/src/components/recursion-provider/index.js +17 -0
- package/src/components/rich-text/index.js +48 -10
- package/src/components/rich-text/native/index.native.js +10 -10
- package/src/components/use-block-drop-zone/index.js +60 -19
- package/src/components/use-block-drop-zone/test/index.js +32 -61
- package/src/components/use-on-block-drop/index.js +92 -11
- package/src/hooks/block-hooks.js +5 -17
- package/src/hooks/content-lock-ui.js +15 -55
- package/src/hooks/dimensions.js +74 -3
- package/src/hooks/effects.js +57 -0
- package/src/hooks/index.js +4 -2
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/style.js +12 -0
- package/src/hooks/supports.js +2 -0
- package/src/hooks/test/effects.js +39 -0
- package/src/hooks/typography.native.js +2 -2
- package/src/hooks/use-bindings-attributes.js +148 -0
- package/src/hooks/use-shadow-props.js +37 -0
- package/src/hooks/utils.js +30 -10
- package/src/index.js +2 -0
- package/src/store/actions.js +9 -4
- package/src/store/index.js +2 -0
- package/src/store/private-actions.js +32 -0
- package/src/store/private-selectors.js +78 -21
- package/src/store/reducer.js +49 -2
- package/src/store/resolvers.js +17 -0
- package/src/store/selectors.js +169 -161
- package/src/store/test/registry-selectors.js +431 -0
- package/src/store/test/selectors.js +14 -400
- package/src/store/utils.js +10 -33
- package/src/style.scss +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/math.js +12 -0
- package/src/utils/object.js +16 -0
- package/src/utils/transform-styles/index.js +52 -37
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/iframe/use-compatibility-styles.js +0 -100
- package/build/components/iframe/use-compatibility-styles.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -106
- package/build/hooks/custom-fields.js.map +0 -1
- package/build/utils/block-variation-transforms.js +0 -42
- package/build/utils/block-variation-transforms.js.map +0 -1
- package/build-module/components/iframe/use-compatibility-styles.js +0 -94
- package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -99
- package/build-module/hooks/custom-fields.js.map +0 -1
- package/build-module/utils/block-variation-transforms.js +0 -35
- package/build-module/utils/block-variation-transforms.js.map +0 -1
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
- package/src/components/contrast-checker/style.scss +0 -3
- package/src/components/iframe/use-compatibility-styles.js +0 -122
- package/src/hooks/custom-fields.js +0 -115
- package/src/utils/block-variation-transforms.js +0 -38
- package/src/utils/test/block-variation-transforms.js +0 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_url","_icons","_dom","_viewerSlot","_useRichUrlData","LinkPreview","value","onEditClick","hasRichPreviews","hasUnlinkControl","onRemove","additionalControls","showRichPreviews","url","richData","isFetching","useRichUrlData","hasRichData","Object","keys","length","displayURL","filterURLForDisplay","safeDecodeURI","isEmptyURL","displayTitle","stripHTML","title","icon","_react","createElement","src","alt","Icon","info","size","globe","__","className","classnames","Fragment","Tooltip","text","placement","ExternalLink","href","Button","edit","label","onClick","iconSize","linkOff","ViewerSlot","fillProps","image","description","__experimentalText","truncate","numberOfLines"],"sources":["@wordpress/block-editor/src/components/link-control/link-preview.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tExternalLink,\n\t__experimentalText as Text,\n\tTooltip,\n} from '@wordpress/components';\nimport { filterURLForDisplay, safeDecodeURI } from '@wordpress/url';\nimport { Icon, globe, info, linkOff, edit } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { ViewerSlot } from './viewer-slot';\n\nimport useRichUrlData from './use-rich-url-data';\n\nexport default function LinkPreview( {\n\tvalue,\n\tonEditClick,\n\thasRichPreviews = false,\n\thasUnlinkControl = false,\n\tonRemove,\n\tadditionalControls,\n} ) {\n\t// Avoid fetching if rich previews are not desired.\n\tconst showRichPreviews = hasRichPreviews ? value?.url : null;\n\n\tconst { richData, isFetching } = useRichUrlData( showRichPreviews );\n\n\t// Rich data may be an empty object so test for that.\n\tconst hasRichData = richData && Object.keys( richData ).length;\n\n\tconst displayURL =\n\t\t( value && filterURLForDisplay( safeDecodeURI( value.url ), 16 ) ) ||\n\t\t'';\n\n\t// url can be undefined if the href attribute is unset\n\tconst isEmptyURL = ! value?.url?.length;\n\n\tconst displayTitle =\n\t\t! isEmptyURL &&\n\t\tstripHTML( richData?.title || value?.title || displayURL );\n\n\tlet icon;\n\n\tif ( richData?.icon ) {\n\t\ticon = <img src={ richData?.icon } alt=\"\" />;\n\t} else if ( isEmptyURL ) {\n\t\ticon = <Icon icon={ info } size={ 32 } />;\n\t} else {\n\t\ticon = <Icon icon={ globe } />;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\taria-label={ __( 'Currently selected' ) }\n\t\t\tclassName={ classnames( 'block-editor-link-control__search-item', {\n\t\t\t\t'is-current': true,\n\t\t\t\t'is-rich': hasRichData,\n\t\t\t\t'is-fetching': !! isFetching,\n\t\t\t\t'is-preview': true,\n\t\t\t\t'is-error': isEmptyURL,\n\t\t\t\t'is-url-title': displayTitle === displayURL,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div className=\"block-editor-link-control__search-item-top\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-link-control__search-item-icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-image': richData?.icon,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"block-editor-link-control__search-item-details\">\n\t\t\t\t\t\t{ ! isEmptyURL ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\ttext={ value.url }\n\t\t\t\t\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-item-title\"\n\t\t\t\t\t\t\t\t\t\thref={ value.url }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ displayTitle }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t\t\t\t{ value?.url && displayTitle !== displayURL && (\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-link-control__search-item-info\">\n\t\t\t\t\t\t\t\t\t\t{ displayURL }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className=\"block-editor-link-control__search-item-error-notice\">\n\t\t\t\t\t\t\t\t{ __( 'Link is empty' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t</span>\n\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action\"\n\t\t\t\t\tonClick={ onEditClick }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t\t{ hasUnlinkControl && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Unlink' ) }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action block-editor-link-control__unlink\"\n\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<ViewerSlot fillProps={ value } />\n\t\t\t</div>\n\n\t\t\t{ !! (\n\t\t\t\t( hasRichData &&\n\t\t\t\t\t( richData?.image || richData?.description ) ) ||\n\t\t\t\tisFetching\n\t\t\t) && (\n\t\t\t\t<div className=\"block-editor-link-control__search-item-bottom\">\n\t\t\t\t\t{ ( richData?.image || isFetching ) && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-hidden={ ! richData?.image }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-link-control__search-item-image',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-placeholder': ! richData?.image,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ richData?.image && (\n\t\t\t\t\t\t\t\t<img src={ richData?.image } alt=\"\" />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ( richData?.description || isFetching ) && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-hidden={ ! richData?.description }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-link-control__search-item-description',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-placeholder': ! richData?.description,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ richData?.description && (\n\t\t\t\t\t\t\t\t<Text truncate numberOfLines=\"2\">\n\t\t\t\t\t\t\t\t\t{ richData.description }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ additionalControls && additionalControls() }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAKe,SAASQ,WAAWA,CAAE;EACpCC,KAAK;EACLC,WAAW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,aAAA;IACC,eAAc,CAAEhB,QAAQ,EAAEyC,WAAa;IACvCjB,SAAS,EAAG,IAAAC,mBAAU,EACrB,oDAAoD,EACpD;MACC,gBAAgB,EAAE,CAAEzB,QAAQ,EAAEyC;IAC/B,CACD;EAAG,GAEDzC,QAAQ,EAAEyC,WAAW,IACtB,IAAA1B,MAAA,CAAAC,aAAA,EAAC/B,WAAA,CAAAyD,kBAAI;IAACC,QAAQ;IAACC,aAAa,EAAC;EAAG,GAC7B5C,QAAQ,CAACyC,WACN,CAEH,CAEF,CACL,EAEC5C,kBAAkB,IAAIA,kBAAkB,CAAC,CACvC,CAAC;AAER"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_compose","_url","_icons","_dom","_data","_notices","_viewerSlot","_useRichUrlData","LinkPreview","value","onEditClick","hasRichPreviews","hasUnlinkControl","onRemove","additionalControls","showRichPreviews","url","richData","isFetching","useRichUrlData","hasRichData","Object","keys","length","displayURL","filterURLForDisplay","safeDecodeURI","isEmptyURL","displayTitle","stripHTML","title","icon","_react","createElement","src","alt","Icon","info","size","globe","createNotice","useDispatch","noticesStore","ref","useCopyToClipboard","__","isDismissible","type","className","classnames","Fragment","Tooltip","text","ExternalLink","href","__experimentalTruncate","numberOfLines","Button","edit","label","onClick","linkOff","copy","disabled","ViewerSlot","fillProps"],"sources":["@wordpress/block-editor/src/components/link-control/link-preview.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n\tTooltip,\n} from '@wordpress/components';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { filterURLForDisplay, safeDecodeURI } from '@wordpress/url';\nimport { Icon, globe, info, linkOff, edit, copy } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { ViewerSlot } from './viewer-slot';\n\nimport useRichUrlData from './use-rich-url-data';\n\nexport default function LinkPreview( {\n\tvalue,\n\tonEditClick,\n\thasRichPreviews = false,\n\thasUnlinkControl = false,\n\tonRemove,\n\tadditionalControls,\n} ) {\n\t// Avoid fetching if rich previews are not desired.\n\tconst showRichPreviews = hasRichPreviews ? value?.url : null;\n\n\tconst { richData, isFetching } = useRichUrlData( showRichPreviews );\n\n\t// Rich data may be an empty object so test for that.\n\tconst hasRichData = richData && Object.keys( richData ).length;\n\n\tconst displayURL =\n\t\t( value && filterURLForDisplay( safeDecodeURI( value.url ), 24 ) ) ||\n\t\t'';\n\n\t// url can be undefined if the href attribute is unset\n\tconst isEmptyURL = ! value?.url?.length;\n\n\tconst displayTitle =\n\t\t! isEmptyURL &&\n\t\tstripHTML( richData?.title || value?.title || displayURL );\n\n\tlet icon;\n\n\tif ( richData?.icon ) {\n\t\ticon = <img src={ richData?.icon } alt=\"\" />;\n\t} else if ( isEmptyURL ) {\n\t\ticon = <Icon icon={ info } size={ 32 } />;\n\t} else {\n\t\ticon = <Icon icon={ globe } />;\n\t}\n\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst ref = useCopyToClipboard( value.url, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\taria-label={ __( 'Currently selected' ) }\n\t\t\tclassName={ classnames( 'block-editor-link-control__search-item', {\n\t\t\t\t'is-current': true,\n\t\t\t\t'is-rich': hasRichData,\n\t\t\t\t'is-fetching': !! isFetching,\n\t\t\t\t'is-preview': true,\n\t\t\t\t'is-error': isEmptyURL,\n\t\t\t\t'is-url-title': displayTitle === displayURL,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div className=\"block-editor-link-control__search-item-top\">\n\t\t\t\t<span className=\"block-editor-link-control__search-item-header\">\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-link-control__search-item-icon',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-image': richData?.icon,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"block-editor-link-control__search-item-details\">\n\t\t\t\t\t\t{ ! isEmptyURL ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Tooltip text={ value.url }>\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-item-title\"\n\t\t\t\t\t\t\t\t\t\thref={ value.url }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ displayTitle }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t{ value?.url && displayTitle !== displayURL && (\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-link-control__search-item-info\">\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ displayURL }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className=\"block-editor-link-control__search-item-error-notice\">\n\t\t\t\t\t\t\t\t{ __( 'Link is empty' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t</span>\n\n\t\t\t\t<Button\n\t\t\t\t\ticon={ edit }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action\"\n\t\t\t\t\tonClick={ onEditClick }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t{ hasUnlinkControl && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\ticon={ linkOff }\n\t\t\t\t\t\tlabel={ __( 'Unlink' ) }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action block-editor-link-control__unlink\"\n\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<Button\n\t\t\t\t\ticon={ copy }\n\t\t\t\t\tlabel={ __( 'Copy URL' ) }\n\t\t\t\t\tclassName=\"block-editor-link-control__search-item-action block-editor-link-control__copy\"\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tdisabled={ isEmptyURL }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t\t<ViewerSlot fillProps={ value } />\n\t\t\t</div>\n\t\t\t{ additionalControls && additionalControls() }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AAEA,IAAAU,eAAA,GAAAX,sBAAA,CAAAC,OAAA;AA3BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;;AAKe,SAASW,WAAWA,CAAE;EACpCC,KAAK;EACLC,WAAW;EACXC,eAAe,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AAA,CAAA0D,UAAU;IAACC,SAAS,EAAGxD;EAAO,CAAE,CAC7B,CAAC,EACJK,kBAAkB,IAAIA,kBAAkB,CAAC,CACvC,CAAC;AAER"}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
9
|
var _compose = require("@wordpress/compose");
|
|
11
10
|
var _element = require("@wordpress/element");
|
|
12
11
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -14,10 +13,6 @@ var _ = require("../");
|
|
|
14
13
|
var _searchResults = _interopRequireDefault(require("./search-results"));
|
|
15
14
|
var _constants = require("./constants");
|
|
16
15
|
var _useSearchHandler = _interopRequireDefault(require("./use-search-handler"));
|
|
17
|
-
/**
|
|
18
|
-
* External dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
16
|
/**
|
|
22
17
|
* WordPress dependencies
|
|
23
18
|
*/
|
|
@@ -108,9 +103,6 @@ const LinkControlSearchInput = (0, _element.forwardRef)(({
|
|
|
108
103
|
}, suggestion);
|
|
109
104
|
}
|
|
110
105
|
};
|
|
111
|
-
const inputClasses = (0, _classnames.default)(className, {
|
|
112
|
-
// 'has-no-label': ! hideLabelFromVision,
|
|
113
|
-
});
|
|
114
106
|
return (0, _react.createElement)("div", {
|
|
115
107
|
className: "block-editor-link-control__search-input-container"
|
|
116
108
|
}, (0, _react.createElement)(_.URLInput, {
|
|
@@ -118,7 +110,7 @@ const LinkControlSearchInput = (0, _element.forwardRef)(({
|
|
|
118
110
|
__nextHasNoMarginBottom: true,
|
|
119
111
|
label: (0, _i18n.__)('Link'),
|
|
120
112
|
hideLabelFromVision: hideLabelFromVision,
|
|
121
|
-
className:
|
|
113
|
+
className: className,
|
|
122
114
|
value: value,
|
|
123
115
|
onChange: onInputChange,
|
|
124
116
|
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : (0, _i18n.__)('Search or type url'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_element","_i18n","_","_searchResults","_constants","_useSearchHandler","noopSearchHandler","Promise","resolve","noop","LinkControlSearchInput","forwardRef","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","onChange","onSelect","showSuggestions","renderSuggestions","props","_react","createElement","default","fetchSuggestions","allowDirectEntry","showInitialSuggestions","suggestionsQuery","withURLSuggestion","createSuggestionButtonText","hideLabelFromVision","ref","genericSearchHandler","useSearchHandler","searchHandler","instanceId","useInstanceId","focusedSuggestion","setFocusedSuggestion","useState","onInputChange","selection","suggestion","handleRenderSuggestions","handleSuggestionClick","onSuggestionSelected","selectedSuggestion","CREATE_TYPE","type","title","url","e","Object","keys","length","id","restLinkProps","inputClasses","classnames","URLInput","disableSuggestions","__nextHasNoMarginBottom","label","__","__experimentalRenderSuggestions","__experimentalFetchLinkSuggestions","__experimentalHandleURLSuggestions","__experimentalShowInitialSuggestions","onSubmit","event","hasSuggestion","trim","preventDefault","_default","exports"],"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst noop = () => {};\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\thideLabelFromVision = false,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst instanceId = useInstanceId( LinkControlSearchInput );\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\tinstanceId,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\tconst { id, url, ...restLinkProps } = currentLink ?? {};\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...restLinkProps, ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst inputClasses = classnames( className, {\n\t\t\t// 'has-no-label': ! hideLabelFromVision,\n\t\t} );\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tdisableSuggestions={ currentLink?.url === value }\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\t\tclassName={ inputClasses }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ placeholder ?? __( 'Search or type url' ) }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions={ true }\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tref={ ref }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,CAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAR,sBAAA,CAAAC,OAAA;AAjBA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA,MAAMQ,iBAAiB,GAAGA,CAAA,KAAMC,OAAO,CAACC,OAAO,CAAE,EAAG,CAAC;AAErD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,MAAMC,sBAAsB,GAAG,IAAAC,mBAAU,EACxC,CACC;EACCC,KAAK;EACLC,QAAQ;EACRC,WAAW,GAAG,CAAC,CAAC;EAChBC,SAAS,GAAG,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,KAAO;IACfO,QAAQ,EAAGwB,aAAe;IAC1B3B,WAAW,EAAGA,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI,IAAAkD,QAAE,EAAE,oBAAqB,CAAG;IACzDC,+BAA+B,EAC9B9C,eAAe,GAAGyB,uBAAuB,GAAG,IAC5C;IACDsB,kCAAkC,EAAG/B,aAAe;IACpDgC,kCAAkC,EAAG,IAAM;IAC3CC,oCAAoC,EACnCzC,sBACA;IACD0C,QAAQ,EAAGA,CAAE1B,UAAU,EAAE2B,KAAK,KAAM;MACnC,MAAMC,aAAa,GAAG5B,UAAU,IAAIL,iBAAiB;;MAErD;MACA;MACA,IAAK,CAAEiC,aAAa,IAAI,CAAE7D,KAAK,EAAE8D,IAAI,CAAC,CAAC,EAAEjB,MAAM,EAAG;QACjDe,KAAK,CAACG,cAAc,CAAC,CAAC;MACvB,CAAC,MAAM;QACN3B,oBAAoB,CACnByB,aAAa,IAAI;UAAEpB,GAAG,EAAEzC;QAAM,CAC/B,CAAC;MACF;IACD,CAAG;IACHsB,GAAG,EAAGA;EAAK,CACX,CAAC,EACArB,QACE,CAAC;AAER,CACD,CAAC;AAAC,IAAA+D,QAAA,GAEalE,sBAAsB;AAAAmE,OAAA,CAAAnD,OAAA,GAAAkD,QAAA"}
|
|
1
|
+
{"version":3,"names":["_compose","require","_element","_i18n","_","_searchResults","_interopRequireDefault","_constants","_useSearchHandler","noopSearchHandler","Promise","resolve","noop","LinkControlSearchInput","forwardRef","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","onChange","onSelect","showSuggestions","renderSuggestions","props","_react","createElement","default","fetchSuggestions","allowDirectEntry","showInitialSuggestions","suggestionsQuery","withURLSuggestion","createSuggestionButtonText","hideLabelFromVision","ref","genericSearchHandler","useSearchHandler","searchHandler","instanceId","useInstanceId","focusedSuggestion","setFocusedSuggestion","useState","onInputChange","selection","suggestion","handleRenderSuggestions","handleSuggestionClick","onSuggestionSelected","selectedSuggestion","CREATE_TYPE","type","title","url","e","Object","keys","length","id","restLinkProps","URLInput","disableSuggestions","__nextHasNoMarginBottom","label","__","__experimentalRenderSuggestions","__experimentalFetchLinkSuggestions","__experimentalHandleURLSuggestions","__experimentalShowInitialSuggestions","onSubmit","event","hasSuggestion","trim","preventDefault","_default","exports"],"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst noop = () => {};\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\thideLabelFromVision = false,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst instanceId = useInstanceId( LinkControlSearchInput );\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\tinstanceId,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\tconst { id, url, ...restLinkProps } = currentLink ?? {};\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...restLinkProps, ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tdisableSuggestions={ currentLink?.url === value }\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ placeholder ?? __( 'Search or type url' ) }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions={ true }\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tref={ ref }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n"],"mappings":";;;;;;;;AAGA,IAAAA,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AAgD,QAAA"}
|
|
@@ -73,7 +73,9 @@ const ListViewBlockContents = (0, _element.forwardRef)(({
|
|
|
73
73
|
insertedBlock: insertedBlock,
|
|
74
74
|
setInsertedBlock: setInsertedBlock
|
|
75
75
|
}), (0, _react.createElement)(_blockDraggable.default, {
|
|
76
|
-
|
|
76
|
+
appendToOwnerDocument: true,
|
|
77
|
+
clientIds: draggableClientIds,
|
|
78
|
+
cloneClassname: 'block-editor-list-view-draggable-chip'
|
|
77
79
|
}, ({
|
|
78
80
|
draggable,
|
|
79
81
|
onDragStart,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_element","_blockSelectButton","_blockDraggable","_store","_context","ListViewBlockContents","forwardRef","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","ref","clientId","blockMovingClientId","selectedBlockInBlockEditor","useSelect","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","AdditionalBlockContent","insertedBlock","setInsertedBlock","useListViewContext","isBlockMoveTarget","className","classnames","draggableClientIds","includes","_react","createElement","Fragment","default","clientIds","draggable","onDragStart","onDragEnd","_default","exports"],"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\nimport { useListViewContext } from './context';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\tisExpanded,\n\t\t\tselectedClientIds,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { hasBlockMovingClientId, getSelectedBlockClientId } =\n\t\t\t\t\tselect( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\n\t\tconst { AdditionalBlockContent, insertedBlock, setInsertedBlock } =\n\t\t\tuseListViewContext();\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\t// Only include all selected blocks if the currently clicked on block\n\t\t// is one of the selected blocks. This ensures that if a user attempts\n\t\t// to drag a block that isn't part of the selection, they're still able\n\t\t// to drag it and rearrange its position.\n\t\tconst draggableClientIds = selectedClientIds.includes( clientId )\n\t\t\t? selectedClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ AdditionalBlockContent && (\n\t\t\t\t\t<AdditionalBlockContent\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tinsertedBlock={ insertedBlock }\n\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockDraggable
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_element","_blockSelectButton","_blockDraggable","_store","_context","ListViewBlockContents","forwardRef","onClick","onToggleExpanded","block","isSelected","position","siblingBlockCount","level","isExpanded","selectedClientIds","props","ref","clientId","blockMovingClientId","selectedBlockInBlockEditor","useSelect","select","hasBlockMovingClientId","getSelectedBlockClientId","blockEditorStore","AdditionalBlockContent","insertedBlock","setInsertedBlock","useListViewContext","isBlockMoveTarget","className","classnames","draggableClientIds","includes","_react","createElement","Fragment","default","appendToOwnerDocument","clientIds","cloneClassname","draggable","onDragStart","onDragEnd","_default","exports"],"sources":["@wordpress/block-editor/src/components/list-view/block-contents.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ListViewBlockSelectButton from './block-select-button';\nimport BlockDraggable from '../block-draggable';\nimport { store as blockEditorStore } from '../../store';\nimport { useListViewContext } from './context';\n\nconst ListViewBlockContents = forwardRef(\n\t(\n\t\t{\n\t\t\tonClick,\n\t\t\tonToggleExpanded,\n\t\t\tblock,\n\t\t\tisSelected,\n\t\t\tposition,\n\t\t\tsiblingBlockCount,\n\t\t\tlevel,\n\t\t\tisExpanded,\n\t\t\tselectedClientIds,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst { clientId } = block;\n\n\t\tconst { blockMovingClientId, selectedBlockInBlockEditor } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { hasBlockMovingClientId, getSelectedBlockClientId } =\n\t\t\t\t\tselect( blockEditorStore );\n\t\t\t\treturn {\n\t\t\t\t\tblockMovingClientId: hasBlockMovingClientId(),\n\t\t\t\t\tselectedBlockInBlockEditor: getSelectedBlockClientId(),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\n\t\tconst { AdditionalBlockContent, insertedBlock, setInsertedBlock } =\n\t\t\tuseListViewContext();\n\n\t\tconst isBlockMoveTarget =\n\t\t\tblockMovingClientId && selectedBlockInBlockEditor === clientId;\n\n\t\tconst className = classnames( 'block-editor-list-view-block-contents', {\n\t\t\t'is-dropping-before': isBlockMoveTarget,\n\t\t} );\n\n\t\t// Only include all selected blocks if the currently clicked on block\n\t\t// is one of the selected blocks. This ensures that if a user attempts\n\t\t// to drag a block that isn't part of the selection, they're still able\n\t\t// to drag it and rearrange its position.\n\t\tconst draggableClientIds = selectedClientIds.includes( clientId )\n\t\t\t? selectedClientIds\n\t\t\t: [ clientId ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ AdditionalBlockContent && (\n\t\t\t\t\t<AdditionalBlockContent\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tinsertedBlock={ insertedBlock }\n\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockDraggable\n\t\t\t\t\tappendToOwnerDocument\n\t\t\t\t\tclientIds={ draggableClientIds }\n\t\t\t\t\tcloneClassname={ 'block-editor-list-view-draggable-chip' }\n\t\t\t\t>\n\t\t\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t\t\t<ListViewBlockSelectButton\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\tonToggleExpanded={ onToggleExpanded }\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\tdraggable={ draggable }\n\t\t\t\t\t\t\tonDragStart={ onDragStart }\n\t\t\t\t\t\t\tonDragEnd={ onDragEnd }\n\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockDraggable>\n\t\t\t</>\n\t\t);\n\t}\n);\n\nexport default ListViewBlockContents;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAK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GX,sBAAsB,IACvB,IAAAS,MAAA,CAAAC,aAAA,EAACV,sBAAsB;IACtBjB,KAAK,EAAGA,KAAO;IACfkB,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA;EAAkB,CACrC,CACD,EACD,IAAAO,MAAA,CAAAC,aAAA,EAAClC,eAAA,CAAAoC,OAAc;IACdC,qBAAqB;IACrBC,SAAS,EAAGP,kBAAoB;IAChCQ,cAAc,EAAG;EAAyC,GAExD,CAAE;IAAEC,SAAS;IAAEC,WAAW;IAAEC;EAAU,CAAC,KACxC,IAAAT,MAAA,CAAAC,aAAA,EAACnC,kBAAA,CAAAqC,OAAyB;IACzBrB,GAAG,EAAGA,GAAK;IACXc,SAAS,EAAGA,SAAW;IACvBtB,KAAK,EAAGA,KAAO;IACfF,OAAO,EAAGA,OAAS;IACnBC,gBAAgB,EAAGA,gBAAkB;IACrCE,UAAU,EAAGA,UAAY;IACzBC,QAAQ,EAAGA,QAAU;IACrBC,iBAAiB,EAAGA,iBAAmB;IACvCC,KAAK,EAAGA,KAAO;IACf6B,SAAS,EAAGA,SAAW;IACvBC,WAAW,EAAGA,WAAa;IAC3BC,SAAS,EAAGA,SAAW;IACvB9B,UAAU,EAAGA,UAAY;IAAA,GACpBE;EAAK,CACV,CAEa,CACf,CAAC;AAEL,CACD,CAAC;AAAC,IAAA6B,QAAA,GAEaxC,qBAAqB;AAAAyC,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
|
|
@@ -41,7 +41,10 @@ function ListViewBlock({
|
|
|
41
41
|
block: {
|
|
42
42
|
clientId
|
|
43
43
|
},
|
|
44
|
+
displacement,
|
|
45
|
+
isAfterDraggedBlocks,
|
|
44
46
|
isDragged,
|
|
47
|
+
isNesting,
|
|
45
48
|
isSelected,
|
|
46
49
|
isBranchSelected,
|
|
47
50
|
selectBlock,
|
|
@@ -216,7 +219,12 @@ function ListViewBlock({
|
|
|
216
219
|
'is-dragging': isDragged,
|
|
217
220
|
'has-single-cell': !showBlockActions,
|
|
218
221
|
'is-synced': blockInformation?.isSynced,
|
|
219
|
-
'is-draggable': canMove
|
|
222
|
+
'is-draggable': canMove,
|
|
223
|
+
'is-displacement-normal': displacement === 'normal',
|
|
224
|
+
'is-displacement-up': displacement === 'up',
|
|
225
|
+
'is-displacement-down': displacement === 'down',
|
|
226
|
+
'is-after-dragged-blocks': isAfterDraggedBlocks,
|
|
227
|
+
'is-nesting': isNesting
|
|
220
228
|
});
|
|
221
229
|
|
|
222
230
|
// Only include all selected blocks if the currently clicked on block
|
|
@@ -238,6 +246,7 @@ function ListViewBlock({
|
|
|
238
246
|
const currentlyEditingBlockInCanvas = isSelected && selectedClientIds.length === 1;
|
|
239
247
|
return (0, _react.createElement)(_leaf.default, {
|
|
240
248
|
className: classes,
|
|
249
|
+
isDragged: isDragged,
|
|
241
250
|
onKeyDown: onKeyDown,
|
|
242
251
|
onMouseEnter: onMouseEnter,
|
|
243
252
|
onMouseLeave: onMouseLeave,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_components","_compose","_icons","_element","_data","_i18n","_keycodes","_leaf","_useListViewScrollIntoView","_button","_blockContents","_context","_utils","_store","_useBlockDisplayInformation","_blockLock","_ariaReferencedText","ListViewBlock","block","clientId","isDragged","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","useRef","rowRef","settingsRef","isHovered","setIsHovered","useState","settingsAnchorRect","setSettingsAnchorRect","isLocked","canEdit","canMove","useBlockLock","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","useDispatch","blockEditorStore","blockInformation","useBlockDisplayInformation","blockTitle","name","title","__","blockName","blockEditingMode","useSelect","select","getBlock","getBlockName","getBlockEditingMode","allowRightClickOverrides","getSettings","showBlockActions","hasBlockSupport","instanceId","useInstanceId","descriptionId","blockPositionDescription","getBlockPositionDescription","blockAriaLabel","sprintf","settingsAriaLabel","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","useListViewContext","hasSiblings","hasRenderedMovers","moverCellClassName","classnames","listViewBlockSettingsClassName","onKeyDown","event","keyCode","ESCAPE","defaultPrevented","stopPropagation","preventDefault","undefined","onMouseEnter","useCallback","onMouseLeave","selectEditorBlock","updateFocusAndSelection","focusClientId","shouldSelectBlock","focusListItem","toggleExpanded","onContextMenu","current","click","window","DOMRect","clientX","clientY","onMouseDown","button","settingsPopoverAnchor","useMemo","ownerDocument","getBoundingClientRect","clearSettingsAnchorRect","colSpan","classes","isSynced","dropdownClientIds","includes","useListViewScrollIntoView","rowItemRef","currentlyEditingBlockInCanvas","_react","createElement","default","className","onFocus","onBlur","id","ref","__experimentalTreeGridCell","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","__experimentalTreeGridItem","BlockMoverUpButton","orientation","clientIds","BlockMoverDownButton","icon","moreVertical","label","popoverProps","anchor","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock","_default","memo","exports"],"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"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\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\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 { useListViewContext } from './context';\nimport { getBlockPositionDescription, focusListItem } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\nimport AriaReferencedText from './aria-referenced-text';\n\nfunction ListViewBlock( {\n\tblock: { clientId },\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\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst settingsRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ settingsAnchorRect, setSettingsAnchorRect ] = useState();\n\n\tconst { isLocked, canEdit, canMove } = useBlockLock( clientId );\n\n\tconst isFirstSelectedBlock =\n\t\tisSelected && selectedClientIds[ 0 ] === clientId;\n\tconst isLastSelectedBlock =\n\t\tisSelected &&\n\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle =\n\t\tblockInformation?.name || blockInformation?.title || __( 'Untitled' );\n\n\tconst { block, blockName, blockEditingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockName, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tblock: getBlock( clientId ),\n\t\t\t\tblockName: getBlockName( clientId ),\n\t\t\t\tblockEditingMode: getBlockEditingMode( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst allowRightClickOverrides = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().allowRightClickOverrides,\n\t\t[]\n\t);\n\n\tconst showBlockActions =\n\t\t// When a block hides its toolbar it also hides the block settings menu,\n\t\t// since that menu is part of the toolbar in the editor canvas.\n\t\t// List View respects this by also hiding the block settings menu.\n\t\thasBlockSupport( blockName, '__experimentalToolbar', true ) &&\n\t\t// Don't show the settings menu if block is disabled or content only.\n\t\tblockEditingMode === 'default';\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\tconst blockAriaLabel = isLocked\n\t\t? sprintf(\n\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__( '%s (locked)' ),\n\t\t\t\tblockTitle\n\t\t )\n\t\t: blockTitle;\n\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s' ),\n\t\tblockTitle\n\t);\n\n\tconst {\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t\texpandedState,\n\t\tsetInsertedBlock,\n\t\ttreeGridElementRef,\n\t} = 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 multiple blocks are selected, deselect all blocks when the user\n\t// presses the escape key.\n\tconst onKeyDown = ( event ) => {\n\t\tif (\n\t\t\tevent.keyCode === ESCAPE &&\n\t\t\t! event.defaultPrevented &&\n\t\t\tselectedClientIds.length > 0\n\t\t) {\n\t\t\tevent.stopPropagation();\n\t\t\tevent.preventDefault();\n\t\t\tselectBlock( event, undefined );\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 updateFocusAndSelection = useCallback(\n\t\t( focusClientId, shouldSelectBlock ) => {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tfocusListItem( focusClientId, treeGridElementRef );\n\t\t},\n\t\t[ selectBlock, treeGridElementRef ]\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\t// Allow right-clicking an item in the List View to open up the block settings dropdown.\n\tconst onContextMenu = useCallback(\n\t\t( event ) => {\n\t\t\tif ( showBlockActions && allowRightClickOverrides ) {\n\t\t\t\tsettingsRef.current?.click();\n\t\t\t\t// Ensure the position of the settings dropdown is at the cursor.\n\t\t\t\tsetSettingsAnchorRect(\n\t\t\t\t\tnew window.DOMRect( event.clientX, event.clientY, 0, 0 )\n\t\t\t\t);\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides, settingsRef, showBlockActions ]\n\t);\n\n\tconst onMouseDown = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent right-click from focusing the block,\n\t\t\t// because focus will be handled when opening the block settings dropdown.\n\t\t\tif ( allowRightClickOverrides && event.button === 2 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides ]\n\t);\n\n\tconst settingsPopoverAnchor = useMemo( () => {\n\t\tconst { ownerDocument } = rowRef?.current || {};\n\n\t\t// If no custom position is set, the settings dropdown will be anchored to the\n\t\t// DropdownMenu toggle button.\n\t\tif ( ! settingsAnchorRect || ! ownerDocument ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Position the settings dropdown at the cursor when right-clicking a block.\n\t\treturn {\n\t\t\townerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn settingsAnchorRect;\n\t\t\t},\n\t\t};\n\t}, [ settingsAnchorRect ] );\n\n\tconst clearSettingsAnchorRect = useCallback( () => {\n\t\t// Clear the custom position for the settings dropdown so that it is restored back\n\t\t// to being anchored to the DropdownMenu toggle button.\n\t\tsetSettingsAnchorRect( undefined );\n\t}, [ setSettingsAnchorRect ] );\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,\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\t'is-draggable': canMove,\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\tonKeyDown={ onKeyDown }\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-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canEdit ? isExpanded : undefined }\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-selected={ !! isSelected }\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\tonContextMenu={ onContextMenu }\n\t\t\t\t\t\t\tonMouseDown={ onMouseDown }\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={ canEdit ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaLabel={ blockAriaLabel }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t\tupdateFocusAndSelection={ updateFocusAndSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</AriaReferencedText>\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 && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected }\n\t\t\t\t\tref={ settingsRef }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\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\tpopoverProps={ {\n\t\t\t\t\t\t\t\tanchor: settingsPopoverAnchor, // Used to position the settings at the cursor on right-click.\n\t\t\t\t\t\t\t} }\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\tonClick: clearSettingsAnchorRect,\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\texpand={ expand }\n\t\t\t\t\t\t\texpandedState={ expandedState }\n\t\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\tupdateFocusAndSelection\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\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;IAAEoG,GAAG;IAAEE,QAAQ;IAAEL;EAAQ,CAAC,KAC7B,IAAAJ,MAAA,CAAAC,aAAA,EAACnD,iBAAiB;IACjBqE,SAAS,EAAGxB,iBAAmB;IAC/B1G,KAAK,EAAGA,KAAO;IACfoI,IAAI,EAAGC,mBAAc;IACrBC,KAAK,EAAG5E,iBAAmB;IAC3B6E,YAAY,EAAG;MACdC,MAAM,EAAEtC,qBAAqB,CAAE;IAChC,CAAG;;IACHuC,WAAW,EAAG;MACbnB,GAAG;MACHJ,SAAS,EAAE,oCAAoC;MAC/CM,QAAQ;MACRC,OAAO,EAAEnB,uBAAuB;MAChCa;IACD,CAAG;IACHuB,sBAAsB;IACtB/E,MAAM,EAAGA,MAAQ;IACjBI,aAAa,EAAGA,aAAe;IAC/BC,gBAAgB,EAAGA,gBAAkB;IACrC2E,yBAAyB,EACxBvD;EACA,CACD,CAEW,CAEF,CAAC;AAEjB;AAAC,IAAAwD,QAAA,GAEc,IAAAC,aAAI,EAAE9I,aAAc,CAAC;AAAA+I,OAAA,CAAA7B,OAAA,GAAA2B,QAAA"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blocks","_components","_compose","_icons","_element","_data","_i18n","_keycodes","_leaf","_useListViewScrollIntoView","_button","_blockContents","_context","_utils","_store","_useBlockDisplayInformation","_blockLock","_ariaReferencedText","ListViewBlock","block","clientId","displacement","isAfterDraggedBlocks","isDragged","isNesting","isSelected","isBranchSelected","selectBlock","position","level","rowCount","siblingBlockCount","showBlockMovers","path","isExpanded","selectedClientIds","isSyncedBranch","cellRef","useRef","rowRef","settingsRef","isHovered","setIsHovered","useState","settingsAnchorRect","setSettingsAnchorRect","isLocked","canEdit","canMove","useBlockLock","isFirstSelectedBlock","isLastSelectedBlock","length","toggleBlockHighlight","useDispatch","blockEditorStore","blockInformation","useBlockDisplayInformation","blockTitle","name","title","__","blockName","blockEditingMode","useSelect","select","getBlock","getBlockName","getBlockEditingMode","allowRightClickOverrides","getSettings","showBlockActions","hasBlockSupport","instanceId","useInstanceId","descriptionId","blockPositionDescription","getBlockPositionDescription","blockAriaLabel","sprintf","settingsAriaLabel","expand","collapse","BlockSettingsMenu","listViewInstanceId","expandedState","setInsertedBlock","treeGridElementRef","useListViewContext","hasSiblings","hasRenderedMovers","moverCellClassName","classnames","listViewBlockSettingsClassName","onKeyDown","event","keyCode","ESCAPE","defaultPrevented","stopPropagation","preventDefault","undefined","onMouseEnter","useCallback","onMouseLeave","selectEditorBlock","updateFocusAndSelection","focusClientId","shouldSelectBlock","focusListItem","toggleExpanded","onContextMenu","current","click","window","DOMRect","clientX","clientY","onMouseDown","button","settingsPopoverAnchor","useMemo","ownerDocument","getBoundingClientRect","clearSettingsAnchorRect","colSpan","classes","isSynced","dropdownClientIds","includes","useListViewScrollIntoView","rowItemRef","currentlyEditingBlockInCanvas","_react","createElement","default","className","onFocus","onBlur","id","ref","__experimentalTreeGridCell","tabIndex","onClick","onToggleExpanded","ariaLabel","ariaDescribedBy","Fragment","withoutGridItem","__experimentalTreeGridItem","BlockMoverUpButton","orientation","clientIds","BlockMoverDownButton","icon","moreVertical","label","popoverProps","anchor","toggleProps","disableOpenOnArrowDown","__experimentalSelectBlock","_default","memo","exports"],"sources":["@wordpress/block-editor/src/components/list-view/block.js"],"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\tuseCallback,\n\tuseMemo,\n\tuseState,\n\tuseRef,\n\tmemo,\n} from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\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 { useListViewContext } from './context';\nimport { getBlockPositionDescription, focusListItem } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport { useBlockLock } from '../block-lock';\nimport AriaReferencedText from './aria-referenced-text';\n\nfunction ListViewBlock( {\n\tblock: { clientId },\n\tdisplacement,\n\tisAfterDraggedBlocks,\n\tisDragged,\n\tisNesting,\n\tisSelected,\n\tisBranchSelected,\n\tselectBlock,\n\tposition,\n\tlevel,\n\trowCount,\n\tsiblingBlockCount,\n\tshowBlockMovers,\n\tpath,\n\tisExpanded,\n\tselectedClientIds,\n\tisSyncedBranch,\n} ) {\n\tconst cellRef = useRef( null );\n\tconst rowRef = useRef( null );\n\tconst settingsRef = useRef( null );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ settingsAnchorRect, setSettingsAnchorRect ] = useState();\n\n\tconst { isLocked, canEdit, canMove } = useBlockLock( clientId );\n\n\tconst isFirstSelectedBlock =\n\t\tisSelected && selectedClientIds[ 0 ] === clientId;\n\tconst isLastSelectedBlock =\n\t\tisSelected &&\n\t\tselectedClientIds[ selectedClientIds.length - 1 ] === clientId;\n\n\tconst { toggleBlockHighlight } = useDispatch( blockEditorStore );\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle =\n\t\tblockInformation?.name || blockInformation?.title || __( 'Untitled' );\n\n\tconst { block, blockName, blockEditingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockName, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tblock: getBlock( clientId ),\n\t\t\t\tblockName: getBlockName( clientId ),\n\t\t\t\tblockEditingMode: getBlockEditingMode( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst allowRightClickOverrides = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().allowRightClickOverrides,\n\t\t[]\n\t);\n\n\tconst showBlockActions =\n\t\t// When a block hides its toolbar it also hides the block settings menu,\n\t\t// since that menu is part of the toolbar in the editor canvas.\n\t\t// List View respects this by also hiding the block settings menu.\n\t\thasBlockSupport( blockName, '__experimentalToolbar', true ) &&\n\t\t// Don't show the settings menu if block is disabled or content only.\n\t\tblockEditingMode === 'default';\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\tconst blockAriaLabel = isLocked\n\t\t? sprintf(\n\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__( '%s (locked)' ),\n\t\t\t\tblockTitle\n\t\t )\n\t\t: blockTitle;\n\n\tconst settingsAriaLabel = sprintf(\n\t\t// translators: %s: The title of the block.\n\t\t__( 'Options for %s' ),\n\t\tblockTitle\n\t);\n\n\tconst {\n\t\texpand,\n\t\tcollapse,\n\t\tBlockSettingsMenu,\n\t\tlistViewInstanceId,\n\t\texpandedState,\n\t\tsetInsertedBlock,\n\t\ttreeGridElementRef,\n\t} = 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 multiple blocks are selected, deselect all blocks when the user\n\t// presses the escape key.\n\tconst onKeyDown = ( event ) => {\n\t\tif (\n\t\t\tevent.keyCode === ESCAPE &&\n\t\t\t! event.defaultPrevented &&\n\t\t\tselectedClientIds.length > 0\n\t\t) {\n\t\t\tevent.stopPropagation();\n\t\t\tevent.preventDefault();\n\t\t\tselectBlock( event, undefined );\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 updateFocusAndSelection = useCallback(\n\t\t( focusClientId, shouldSelectBlock ) => {\n\t\t\tif ( shouldSelectBlock ) {\n\t\t\t\tselectBlock( undefined, focusClientId, null, null );\n\t\t\t}\n\n\t\t\tfocusListItem( focusClientId, treeGridElementRef );\n\t\t},\n\t\t[ selectBlock, treeGridElementRef ]\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\t// Allow right-clicking an item in the List View to open up the block settings dropdown.\n\tconst onContextMenu = useCallback(\n\t\t( event ) => {\n\t\t\tif ( showBlockActions && allowRightClickOverrides ) {\n\t\t\t\tsettingsRef.current?.click();\n\t\t\t\t// Ensure the position of the settings dropdown is at the cursor.\n\t\t\t\tsetSettingsAnchorRect(\n\t\t\t\t\tnew window.DOMRect( event.clientX, event.clientY, 0, 0 )\n\t\t\t\t);\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides, settingsRef, showBlockActions ]\n\t);\n\n\tconst onMouseDown = useCallback(\n\t\t( event ) => {\n\t\t\t// Prevent right-click from focusing the block,\n\t\t\t// because focus will be handled when opening the block settings dropdown.\n\t\t\tif ( allowRightClickOverrides && event.button === 2 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ allowRightClickOverrides ]\n\t);\n\n\tconst settingsPopoverAnchor = useMemo( () => {\n\t\tconst { ownerDocument } = rowRef?.current || {};\n\n\t\t// If no custom position is set, the settings dropdown will be anchored to the\n\t\t// DropdownMenu toggle button.\n\t\tif ( ! settingsAnchorRect || ! ownerDocument ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Position the settings dropdown at the cursor when right-clicking a block.\n\t\treturn {\n\t\t\townerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn settingsAnchorRect;\n\t\t\t},\n\t\t};\n\t}, [ settingsAnchorRect ] );\n\n\tconst clearSettingsAnchorRect = useCallback( () => {\n\t\t// Clear the custom position for the settings dropdown so that it is restored back\n\t\t// to being anchored to the DropdownMenu toggle button.\n\t\tsetSettingsAnchorRect( undefined );\n\t}, [ setSettingsAnchorRect ] );\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,\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\t'is-draggable': canMove,\n\t\t'is-displacement-normal': displacement === 'normal',\n\t\t'is-displacement-up': displacement === 'up',\n\t\t'is-displacement-down': displacement === 'down',\n\t\t'is-after-dragged-blocks': isAfterDraggedBlocks,\n\t\t'is-nesting': isNesting,\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\tisDragged={ isDragged }\n\t\t\tonKeyDown={ onKeyDown }\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-${ listViewInstanceId }-block-${ clientId }` }\n\t\t\tdata-block={ clientId }\n\t\t\tdata-expanded={ canEdit ? isExpanded : undefined }\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-selected={ !! isSelected }\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\tonContextMenu={ onContextMenu }\n\t\t\t\t\t\t\tonMouseDown={ onMouseDown }\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={ canEdit ? isExpanded : undefined }\n\t\t\t\t\t\t\tselectedClientIds={ selectedClientIds }\n\t\t\t\t\t\t\tariaLabel={ blockAriaLabel }\n\t\t\t\t\t\t\tariaDescribedBy={ descriptionId }\n\t\t\t\t\t\t\tupdateFocusAndSelection={ updateFocusAndSelection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t</AriaReferencedText>\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 && BlockSettingsMenu && (\n\t\t\t\t<TreeGridCell\n\t\t\t\t\tclassName={ listViewBlockSettingsClassName }\n\t\t\t\t\taria-selected={ !! isSelected }\n\t\t\t\t\tref={ settingsRef }\n\t\t\t\t>\n\t\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t\t<BlockSettingsMenu\n\t\t\t\t\t\t\tclientIds={ dropdownClientIds }\n\t\t\t\t\t\t\tblock={ block }\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\tpopoverProps={ {\n\t\t\t\t\t\t\t\tanchor: settingsPopoverAnchor, // Used to position the settings at the cursor on right-click.\n\t\t\t\t\t\t\t} }\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\tonClick: clearSettingsAnchorRect,\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\texpand={ expand }\n\t\t\t\t\t\t\texpandedState={ expandedState }\n\t\t\t\t\t\t\tsetInsertedBlock={ setInsertedBlock }\n\t\t\t\t\t\t\t__experimentalSelectBlock={\n\t\t\t\t\t\t\t\tupdateFocusAndSelection\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TreeGridCell>\n\t\t\t) }\n\t\t</ListViewLeaf>\n\t);\n}\n\nexport default memo( ListViewBlock );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAIA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,0BAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAIA,IAAAY,cAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,QAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,2BAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,UAAA,GAAAjB,OAAA;AACA,IAAAkB,mBAAA,GAAAnB,sBAAA,CAAAC,OAAA;AAzCA;AACA;AACA;;AAGA;AACA;AACA;;AAmBA;AACA;AACA;;AAeA,SAASmB,aAAaA,CAAE;EACvBC,KAAK,EAAE;IAAEC;EAAS,CAAC;EACnBC,YAAY;EACZC,oBAAoB;EACpBC,SA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
|
@@ -69,7 +69,6 @@ function ListViewBranch(props) {
|
|
|
69
69
|
selectedClientIds,
|
|
70
70
|
level = 1,
|
|
71
71
|
path = '',
|
|
72
|
-
isBranchDragged = false,
|
|
73
72
|
isBranchSelected = false,
|
|
74
73
|
listPosition = 0,
|
|
75
74
|
fixedListWindow,
|
|
@@ -88,6 +87,10 @@ function ListViewBranch(props) {
|
|
|
88
87
|
return select(_store.store).canEditBlock(parentId);
|
|
89
88
|
}, [parentId]);
|
|
90
89
|
const {
|
|
90
|
+
blockDropPosition,
|
|
91
|
+
blockDropTargetIndex,
|
|
92
|
+
firstDraggedBlockIndex,
|
|
93
|
+
blockIndexes,
|
|
91
94
|
expandedState,
|
|
92
95
|
draggedClientIds
|
|
93
96
|
} = (0, _context.useListViewContext)();
|
|
@@ -111,6 +114,23 @@ function ListViewBranch(props) {
|
|
|
111
114
|
if (index > 0) {
|
|
112
115
|
nextPosition += countBlocks(filteredBlocks[index - 1], expandedState, draggedClientIds, isExpanded);
|
|
113
116
|
}
|
|
117
|
+
const isDragged = !!draggedClientIds?.includes(clientId);
|
|
118
|
+
|
|
119
|
+
// Determine the displacement of the block while dragging. This
|
|
120
|
+
// works out whether the current block should be displaced up or
|
|
121
|
+
// down, relative to the dragged blocks and the drop target.
|
|
122
|
+
const {
|
|
123
|
+
displacement,
|
|
124
|
+
isAfterDraggedBlocks,
|
|
125
|
+
isNesting
|
|
126
|
+
} = (0, _utils.getDragDisplacementValues)({
|
|
127
|
+
blockIndexes,
|
|
128
|
+
blockDropTargetIndex,
|
|
129
|
+
blockDropPosition,
|
|
130
|
+
clientId,
|
|
131
|
+
firstDraggedBlockIndex,
|
|
132
|
+
isDragged
|
|
133
|
+
});
|
|
114
134
|
const {
|
|
115
135
|
itemInView
|
|
116
136
|
} = fixedListWindow;
|
|
@@ -119,7 +139,6 @@ function ListViewBranch(props) {
|
|
|
119
139
|
const updatedPath = path.length > 0 ? `${path}_${position}` : `${position}`;
|
|
120
140
|
const hasNestedBlocks = !!innerBlocks?.length;
|
|
121
141
|
const shouldExpand = hasNestedBlocks && shouldShowInnerBlocks ? (_expandedState$client = expandedState[clientId]) !== null && _expandedState$client !== void 0 ? _expandedState$client : isExpanded : undefined;
|
|
122
|
-
const isDragged = !!draggedClientIds?.includes(clientId);
|
|
123
142
|
|
|
124
143
|
// Make updates to the selected or dragged blocks synchronous,
|
|
125
144
|
// but asynchronous for any other block.
|
|
@@ -132,7 +151,7 @@ function ListViewBranch(props) {
|
|
|
132
151
|
// This prevents the entire tree from being rendered when a branch is
|
|
133
152
|
// selected, or a user selects all blocks, while still enabling scroll
|
|
134
153
|
// into view behavior when selecting a block or opening the list view.
|
|
135
|
-
const showBlock = isDragged || blockInView ||
|
|
154
|
+
const showBlock = isDragged || blockInView || isSelected && clientId === selectedClientIds[0];
|
|
136
155
|
return (0, _react.createElement)(_data.AsyncModeProvider, {
|
|
137
156
|
key: clientId,
|
|
138
157
|
value: !isSelected
|
|
@@ -141,20 +160,23 @@ function ListViewBranch(props) {
|
|
|
141
160
|
selectBlock: selectBlock,
|
|
142
161
|
isSelected: isSelected,
|
|
143
162
|
isBranchSelected: isSelectedBranch,
|
|
144
|
-
isDragged: isDragged
|
|
163
|
+
isDragged: isDragged,
|
|
145
164
|
level: level,
|
|
146
165
|
position: position,
|
|
147
166
|
rowCount: rowCount,
|
|
148
167
|
siblingBlockCount: blockCount,
|
|
149
168
|
showBlockMovers: showBlockMovers,
|
|
150
169
|
path: updatedPath,
|
|
151
|
-
isExpanded: shouldExpand,
|
|
170
|
+
isExpanded: isDragged ? false : shouldExpand,
|
|
152
171
|
listPosition: nextPosition,
|
|
153
172
|
selectedClientIds: selectedClientIds,
|
|
154
|
-
isSyncedBranch: syncedBranch
|
|
173
|
+
isSyncedBranch: syncedBranch,
|
|
174
|
+
displacement: displacement,
|
|
175
|
+
isAfterDraggedBlocks: isAfterDraggedBlocks,
|
|
176
|
+
isNesting: isNesting
|
|
155
177
|
}), !showBlock && (0, _react.createElement)("tr", null, (0, _react.createElement)("td", {
|
|
156
178
|
className: "block-editor-list-view-placeholder"
|
|
157
|
-
})), hasNestedBlocks && shouldExpand && (0, _react.createElement)(ListViewBranch, {
|
|
179
|
+
})), hasNestedBlocks && shouldExpand && !isDragged && (0, _react.createElement)(ListViewBranch, {
|
|
158
180
|
parentId: clientId,
|
|
159
181
|
blocks: innerBlocks,
|
|
160
182
|
selectBlock: selectBlock,
|
|
@@ -164,7 +186,6 @@ function ListViewBranch(props) {
|
|
|
164
186
|
listPosition: nextPosition + 1,
|
|
165
187
|
fixedListWindow: fixedListWindow,
|
|
166
188
|
isBranchSelected: isSelectedBranch,
|
|
167
|
-
isBranchDragged: isDragged || isBranchDragged,
|
|
168
189
|
selectedClientIds: selectedClientIds,
|
|
169
190
|
isExpanded: isExpanded,
|
|
170
191
|
isSyncedBranch: syncedBranch
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_data","_appender","_block","_interopRequireDefault","_context","_utils","_store","_useBlockDisplayInformation","countBlocks","block","expandedState","draggedClientIds","isExpandedByDefault","_expandedState$block$","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","_expandedState$block$2","length","noop","ListViewBranch","props","blocks","selectBlock","showBlockMovers","selectedClientIds","level","path","isBranchDragged","isBranchSelected","listPosition","fixedListWindow","parentId","shouldShowInnerBlocks","isSyncedBranch","showAppender","showAppenderProp","parentBlockInformation","useBlockDisplayInformation","syncedBranch","isSynced","canParentExpand","useSelect","select","blockEditorStore","canEditBlock","useListViewContext","filteredBlocks","filter","Boolean","blockCount","rowCount","nextPosition","_react","createElement","Fragment","map","index","_expandedState$client","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","isSelected","isClientIdSelected","isSelectedBranch","showBlock","AsyncModeProvider","key","value","default","siblingBlockCount","className","__experimentalTreeGridRow","setSize","positionInSet","__experimentalTreeGridCell","treeGridCellProps","Appender","nestingLevel","_default","memo","exports"],"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridRow as TreeGridRow,\n\t__experimentalTreeGridCell as TreeGridCell,\n} from '@wordpress/components';\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { Appender } from './appender';\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\tisBranchDragged = false,\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\tshowAppender: showAppenderProp = true,\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\t\t\treturn select( blockEditorStore ).canEditBlock( parentId );\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\t// Only show the appender at the first level.\n\tconst showAppender = showAppenderProp && level === 1;\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\n\t// The appender means an extra row in List View, so add 1 to the row count.\n\tconst rowCount = showAppender ? blockCount + 1 : blockCount;\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\n\t\t\t\t// To avoid performance issues, we only render blocks that are in view,\n\t\t\t\t// or blocks that are selected or dragged. If a block is selected,\n\t\t\t\t// it is only counted if it is the first of the block selection.\n\t\t\t\t// This prevents the entire tree from being rendered when a branch is\n\t\t\t\t// selected, or a user selects all blocks, while still enabling scroll\n\t\t\t\t// into view behavior when selecting a block or opening the list view.\n\t\t\t\tconst showBlock =\n\t\t\t\t\tisDragged ||\n\t\t\t\t\tblockInView ||\n\t\t\t\t\tisBranchDragged ||\n\t\t\t\t\t( isSelected && clientId === selectedClientIds[ 0 ] );\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 || isBranchDragged }\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={ rowCount }\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 && (\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\tisBranchDragged={ isDragged || isBranchDragged }\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\t{ showAppender && (\n\t\t\t\t<TreeGridRow\n\t\t\t\t\tlevel={ level }\n\t\t\t\t\tsetSize={ rowCount }\n\t\t\t\t\tpositionInSet={ rowCount }\n\t\t\t\t\tisExpanded={ true }\n\t\t\t\t>\n\t\t\t\t\t<TreeGridCell>\n\t\t\t\t\t\t{ ( treeGridCellProps ) => (\n\t\t\t\t\t\t\t<Appender\n\t\t\t\t\t\t\t\tclientId={ parentId }\n\t\t\t\t\t\t\t\tnestingLevel={ level }\n\t\t\t\t\t\t\t\tblockCount={ blockCount }\n\t\t\t\t\t\t\t\t{ ...treeGridCellProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</TreeGridRow>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( ListViewBranch );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,2BAAA,GAAAJ,sBAAA,CAAAL,OAAA;AAlBA;AACA;AACA;;AAQA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASU,WAAWA,CACnBC,KAAK,EACLC,aAAa,EACbC,gBAAgB,EAChBC,mBAAmB,EAClB;EAAA,IAAAC,qB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lD,KAAK,EAAGA,KAAO;IACfmD,OAAO,EAAG1B,QAAU;IACpB2B,aAAa,EAAG3B,QAAU;IAC1BvC,UAAU,EAAG;EAAM,GAEnB,IAAAyC,MAAA,CAAAC,aAAA,EAAC9D,WAAA,CAAAuF,0BAAY,QACRC,iBAAiB,IACpB,IAAA3B,MAAA,CAAAC,aAAA,EAAC1D,SAAA,CAAAqF,QAAQ;IACRtE,QAAQ,EAAGqB,QAAU;IACrBkD,YAAY,EAAGxD,KAAO;IACtBwB,UAAU,EAAGA,UAAY;IAAA,GACpB8B;EAAiB,CACtB,CAEW,CACF,CAEb,CAAC;AAEL;AAAC,IAAAG,QAAA,GAEc,IAAAC,aAAI,EAAEhE,cAAe,CAAC;AAAAiE,OAAA,CAAAZ,OAAA,GAAAU,QAAA"}
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_data","_appender","_block","_interopRequireDefault","_context","_utils","_store","_useBlockDisplayInformation","countBlocks","block","expandedState","draggedClientIds","isExpandedByDefault","_expandedState$block$","isDragged","includes","clientId","isExpanded","innerBlocks","reduce","countReducer","count","_expandedState$block$2","length","noop","ListViewBranch","props","blocks","selectBlock","showBlockMovers","selectedClientIds","level","path","isBranchSelected","listPosition","fixedListWindow","parentId","shouldShowInnerBlocks","isSyncedBranch","showAppender","showAppenderProp","parentBlockInformation","useBlockDisplayInformation","syncedBranch","isSynced","canParentExpand","useSelect","select","blockEditorStore","canEditBlock","blockDropPosition","blockDropTargetIndex","firstDraggedBlockIndex","blockIndexes","useListViewContext","filteredBlocks","filter","Boolean","blockCount","rowCount","nextPosition","_react","createElement","Fragment","map","index","_expandedState$client","displacement","isAfterDraggedBlocks","isNesting","getDragDisplacementValues","itemInView","blockInView","position","updatedPath","hasNestedBlocks","shouldExpand","undefined","isSelected","isClientIdSelected","isSelectedBranch","showBlock","AsyncModeProvider","key","value","default","siblingBlockCount","className","__experimentalTreeGridRow","setSize","positionInSet","__experimentalTreeGridCell","treeGridCellProps","Appender","nestingLevel","_default","memo","exports"],"sources":["@wordpress/block-editor/src/components/list-view/branch.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTreeGridRow as TreeGridRow,\n\t__experimentalTreeGridCell as TreeGridCell,\n} from '@wordpress/components';\nimport { memo } from '@wordpress/element';\nimport { AsyncModeProvider, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { Appender } from './appender';\nimport ListViewBlock from './block';\nimport { useListViewContext } from './context';\nimport { getDragDisplacementValues, 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\tshowAppender: showAppenderProp = true,\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\t\t\treturn select( blockEditorStore ).canEditBlock( parentId );\n\t\t},\n\t\t[ parentId ]\n\t);\n\n\tconst {\n\t\tblockDropPosition,\n\t\tblockDropTargetIndex,\n\t\tfirstDraggedBlockIndex,\n\t\tblockIndexes,\n\t\texpandedState,\n\t\tdraggedClientIds,\n\t} = useListViewContext();\n\n\tif ( ! canParentExpand ) {\n\t\treturn null;\n\t}\n\n\t// Only show the appender at the first level.\n\tconst showAppender = showAppenderProp && level === 1;\n\tconst filteredBlocks = blocks.filter( Boolean );\n\tconst blockCount = filteredBlocks.length;\n\t// The appender means an extra row in List View, so add 1 to the row count.\n\tconst rowCount = showAppender ? blockCount + 1 : blockCount;\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 isDragged = !! draggedClientIds?.includes( clientId );\n\n\t\t\t\t// Determine the displacement of the block while dragging. This\n\t\t\t\t// works out whether the current block should be displaced up or\n\t\t\t\t// down, relative to the dragged blocks and the drop target.\n\t\t\t\tconst { displacement, isAfterDraggedBlocks, isNesting } =\n\t\t\t\t\tgetDragDisplacementValues( {\n\t\t\t\t\t\tblockIndexes,\n\t\t\t\t\t\tblockDropTargetIndex,\n\t\t\t\t\t\tblockDropPosition,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tfirstDraggedBlockIndex,\n\t\t\t\t\t\tisDragged,\n\t\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\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\n\t\t\t\t// To avoid performance issues, we only render blocks that are in view,\n\t\t\t\t// or blocks that are selected or dragged. If a block is selected,\n\t\t\t\t// it is only counted if it is the first of the block selection.\n\t\t\t\t// This prevents the entire tree from being rendered when a branch is\n\t\t\t\t// selected, or a user selects all blocks, while still enabling scroll\n\t\t\t\t// into view behavior when selecting a block or opening the list view.\n\t\t\t\tconst showBlock =\n\t\t\t\t\tisDragged ||\n\t\t\t\t\tblockInView ||\n\t\t\t\t\t( isSelected && clientId === selectedClientIds[ 0 ] );\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={ rowCount }\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={ isDragged ? false : 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\tdisplacement={ displacement }\n\t\t\t\t\t\t\t\tisAfterDraggedBlocks={ isAfterDraggedBlocks }\n\t\t\t\t\t\t\t\tisNesting={ isNesting }\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\t{ showAppender && (\n\t\t\t\t<TreeGridRow\n\t\t\t\t\tlevel={ level }\n\t\t\t\t\tsetSize={ rowCount }\n\t\t\t\t\tpositionInSet={ rowCount }\n\t\t\t\t\tisExpanded={ true }\n\t\t\t\t>\n\t\t\t\t\t<TreeGridCell>\n\t\t\t\t\t\t{ ( treeGridCellProps ) => (\n\t\t\t\t\t\t\t<Appender\n\t\t\t\t\t\t\t\tclientId={ parentId }\n\t\t\t\t\t\t\t\tnestingLevel={ level }\n\t\t\t\t\t\t\t\tblockCount={ blockCount }\n\t\t\t\t\t\t\t\t{ ...treeGridCellProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</TreeGridCell>\n\t\t\t\t</TreeGridRow>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default memo( ListViewBranch );\n"],"mapp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