@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,5 +1,4 @@
|
|
|
1
1
|
$block-editor-link-control-number-of-actions: 1;
|
|
2
|
-
$preview-image-height: 140px;
|
|
3
2
|
|
|
4
3
|
@keyframes loadingpulse {
|
|
5
4
|
0% {
|
|
@@ -51,13 +50,6 @@ $preview-image-height: 140px;
|
|
|
51
50
|
position: relative;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
// If the input doesn't have a visible label then
|
|
55
|
-
// we need to expand the input itself to occupy
|
|
56
|
-
// the full available horizontal space.
|
|
57
|
-
.block-editor-link-control__search-input.has-no-label .block-editor-url-input__input {
|
|
58
|
-
flex: 1;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
53
|
.block-editor-link-control__field {
|
|
62
54
|
margin: $grid-unit-20; // allow margin collapse for vertical spacing.
|
|
63
55
|
|
|
@@ -77,6 +69,10 @@ $preview-image-height: 140px;
|
|
|
77
69
|
padding: $grid-unit-10 $button-size-next-default-40px $grid-unit-10 $grid-unit-20;
|
|
78
70
|
position: relative;
|
|
79
71
|
width: 100%;
|
|
72
|
+
|
|
73
|
+
.has-actions & {
|
|
74
|
+
padding-right: $grid-unit-20;
|
|
75
|
+
}
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
|
|
@@ -183,6 +179,7 @@ $preview-image-height: 140px;
|
|
|
183
179
|
flex-direction: row;
|
|
184
180
|
align-items: flex-start;
|
|
185
181
|
margin-right: $grid-unit-10;
|
|
182
|
+
gap: $grid-unit-10;
|
|
186
183
|
|
|
187
184
|
// Force text to wrap to improve UX when encountering long lines
|
|
188
185
|
// of text, particular those with no spaces.
|
|
@@ -191,6 +188,9 @@ $preview-image-height: 140px;
|
|
|
191
188
|
overflow-wrap: break-word;
|
|
192
189
|
|
|
193
190
|
.block-editor-link-control__search-item-info {
|
|
191
|
+
color: $gray-700;
|
|
192
|
+
line-height: 1.1;
|
|
193
|
+
font-size: $helptext-font-size;
|
|
194
194
|
word-break: break-all;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -209,17 +209,29 @@ $preview-image-height: 140px;
|
|
|
209
209
|
word-break: break-all;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
.block-editor-link-control__search-item-details {
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
justify-content: space-between;
|
|
216
|
+
gap: $grid-unit-05;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.block-editor-link-control__search-item-header .block-editor-link-control__search-item-icon {
|
|
220
|
+
background-color: $gray-100;
|
|
221
|
+
width: $grid-unit-40;
|
|
222
|
+
height: $grid-unit-40;
|
|
223
|
+
border-radius: $radius-block-ui;
|
|
224
|
+
}
|
|
225
|
+
|
|
212
226
|
.block-editor-link-control__search-item-icon {
|
|
213
227
|
position: relative;
|
|
214
|
-
margin-right: $grid-unit-10;
|
|
215
|
-
max-height: 24px;
|
|
216
228
|
flex-shrink: 0;
|
|
217
|
-
width: 24px;
|
|
218
229
|
display: flex;
|
|
219
230
|
justify-content: center;
|
|
231
|
+
align-items: center;
|
|
220
232
|
|
|
221
233
|
img {
|
|
222
|
-
width:
|
|
234
|
+
width: $grid-unit-20; // favicons often have a source of 32px
|
|
223
235
|
}
|
|
224
236
|
}
|
|
225
237
|
|
|
@@ -230,10 +242,13 @@ $preview-image-height: 140px;
|
|
|
230
242
|
}
|
|
231
243
|
|
|
232
244
|
.block-editor-link-control__search-item-title {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
245
|
+
border-radius: $radius-block-ui;
|
|
246
|
+
line-height: 1.1;
|
|
247
|
+
|
|
248
|
+
&:focus-visible {
|
|
249
|
+
@include block-toolbar-button-style__focus();
|
|
250
|
+
text-decoration: none;
|
|
251
|
+
}
|
|
237
252
|
|
|
238
253
|
mark {
|
|
239
254
|
font-weight: 600;
|
|
@@ -249,58 +264,6 @@ $preview-image-height: 140px;
|
|
|
249
264
|
display: none; // specifically requested to be removed visually as well.
|
|
250
265
|
}
|
|
251
266
|
}
|
|
252
|
-
|
|
253
|
-
.block-editor-link-control__search-item-description {
|
|
254
|
-
padding-top: 12px;
|
|
255
|
-
margin: 0;
|
|
256
|
-
|
|
257
|
-
&.is-placeholder {
|
|
258
|
-
margin-top: 12px;
|
|
259
|
-
padding-top: 0;
|
|
260
|
-
height: 28px;
|
|
261
|
-
display: flex;
|
|
262
|
-
flex-direction: column;
|
|
263
|
-
justify-content: space-around;
|
|
264
|
-
|
|
265
|
-
&::before,
|
|
266
|
-
&::after {
|
|
267
|
-
display: block;
|
|
268
|
-
content: "";
|
|
269
|
-
height: 0.7em;
|
|
270
|
-
width: 100%;
|
|
271
|
-
background-color: $gray-100;
|
|
272
|
-
border-radius: 3px;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.components-text {
|
|
277
|
-
font-size: 0.9em;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.block-editor-link-control__search-item-image {
|
|
282
|
-
display: flex;
|
|
283
|
-
width: 100%;
|
|
284
|
-
background-color: $gray-100;
|
|
285
|
-
justify-content: center;
|
|
286
|
-
height: $preview-image-height; // limit height
|
|
287
|
-
max-height: $preview-image-height; // limit height
|
|
288
|
-
overflow: hidden;
|
|
289
|
-
border-radius: 2px;
|
|
290
|
-
margin-top: 12px;
|
|
291
|
-
|
|
292
|
-
&.is-placeholder {
|
|
293
|
-
background-color: $gray-100;
|
|
294
|
-
border-radius: 3px;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
img {
|
|
298
|
-
display: block; // remove unwanted space below image
|
|
299
|
-
width: 100%;
|
|
300
|
-
height: 100%;
|
|
301
|
-
object-fit: contain;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
267
|
}
|
|
305
268
|
|
|
306
269
|
.block-editor-link-control__search-item-top {
|
|
@@ -310,24 +273,7 @@ $preview-image-height: 140px;
|
|
|
310
273
|
align-items: center;
|
|
311
274
|
}
|
|
312
275
|
|
|
313
|
-
.block-editor-link-control__search-item-bottom {
|
|
314
|
-
transition: opacity 1.5s;
|
|
315
|
-
width: 100%;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
276
|
.block-editor-link-control__search-item.is-fetching {
|
|
319
|
-
.block-editor-link-control__search-item-description {
|
|
320
|
-
&::before,
|
|
321
|
-
&::after {
|
|
322
|
-
animation: loadingpulse 1s linear infinite;
|
|
323
|
-
animation-delay: 0.5s; // avoid animating for fast network responses
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.block-editor-link-control__search-item-image {
|
|
328
|
-
animation: loadingpulse 1s linear infinite;
|
|
329
|
-
animation-delay: 0.5s; // avoid animating for fast network responses
|
|
330
|
-
}
|
|
331
277
|
|
|
332
278
|
.block-editor-link-control__search-item-icon {
|
|
333
279
|
svg,
|
|
@@ -2244,7 +2244,8 @@ describe( 'Rich link previews', () => {
|
|
|
2244
2244
|
|
|
2245
2245
|
const titlePreview = screen.getByText( selectedLink.title );
|
|
2246
2246
|
|
|
2247
|
-
|
|
2247
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
2248
|
+
expect( titlePreview.parentElement ).toHaveClass(
|
|
2248
2249
|
'block-editor-link-control__search-item-title'
|
|
2249
2250
|
);
|
|
2250
2251
|
} );
|
|
@@ -74,7 +74,11 @@ const ListViewBlockContents = forwardRef(
|
|
|
74
74
|
setInsertedBlock={ setInsertedBlock }
|
|
75
75
|
/>
|
|
76
76
|
) }
|
|
77
|
-
<BlockDraggable
|
|
77
|
+
<BlockDraggable
|
|
78
|
+
appendToOwnerDocument
|
|
79
|
+
clientIds={ draggableClientIds }
|
|
80
|
+
cloneClassname={ 'block-editor-list-view-draggable-chip' }
|
|
81
|
+
>
|
|
78
82
|
{ ( { draggable, onDragStart, onDragEnd } ) => (
|
|
79
83
|
<ListViewBlockSelectButton
|
|
80
84
|
ref={ ref }
|
|
@@ -43,7 +43,10 @@ import AriaReferencedText from './aria-referenced-text';
|
|
|
43
43
|
|
|
44
44
|
function ListViewBlock( {
|
|
45
45
|
block: { clientId },
|
|
46
|
+
displacement,
|
|
47
|
+
isAfterDraggedBlocks,
|
|
46
48
|
isDragged,
|
|
49
|
+
isNesting,
|
|
47
50
|
isSelected,
|
|
48
51
|
isBranchSelected,
|
|
49
52
|
selectBlock,
|
|
@@ -270,6 +273,11 @@ function ListViewBlock( {
|
|
|
270
273
|
'has-single-cell': ! showBlockActions,
|
|
271
274
|
'is-synced': blockInformation?.isSynced,
|
|
272
275
|
'is-draggable': canMove,
|
|
276
|
+
'is-displacement-normal': displacement === 'normal',
|
|
277
|
+
'is-displacement-up': displacement === 'up',
|
|
278
|
+
'is-displacement-down': displacement === 'down',
|
|
279
|
+
'is-after-dragged-blocks': isAfterDraggedBlocks,
|
|
280
|
+
'is-nesting': isNesting,
|
|
273
281
|
} );
|
|
274
282
|
|
|
275
283
|
// Only include all selected blocks if the currently clicked on block
|
|
@@ -296,6 +304,7 @@ function ListViewBlock( {
|
|
|
296
304
|
return (
|
|
297
305
|
<ListViewLeaf
|
|
298
306
|
className={ classes }
|
|
307
|
+
isDragged={ isDragged }
|
|
299
308
|
onKeyDown={ onKeyDown }
|
|
300
309
|
onMouseEnter={ onMouseEnter }
|
|
301
310
|
onMouseLeave={ onMouseLeave }
|
|
@@ -14,7 +14,7 @@ import { AsyncModeProvider, useSelect } from '@wordpress/data';
|
|
|
14
14
|
import { Appender } from './appender';
|
|
15
15
|
import ListViewBlock from './block';
|
|
16
16
|
import { useListViewContext } from './context';
|
|
17
|
-
import { isClientIdSelected } from './utils';
|
|
17
|
+
import { getDragDisplacementValues, isClientIdSelected } from './utils';
|
|
18
18
|
import { store as blockEditorStore } from '../../store';
|
|
19
19
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
20
20
|
|
|
@@ -91,7 +91,6 @@ function ListViewBranch( props ) {
|
|
|
91
91
|
selectedClientIds,
|
|
92
92
|
level = 1,
|
|
93
93
|
path = '',
|
|
94
|
-
isBranchDragged = false,
|
|
95
94
|
isBranchSelected = false,
|
|
96
95
|
listPosition = 0,
|
|
97
96
|
fixedListWindow,
|
|
@@ -115,7 +114,14 @@ function ListViewBranch( props ) {
|
|
|
115
114
|
[ parentId ]
|
|
116
115
|
);
|
|
117
116
|
|
|
118
|
-
const {
|
|
117
|
+
const {
|
|
118
|
+
blockDropPosition,
|
|
119
|
+
blockDropTargetIndex,
|
|
120
|
+
firstDraggedBlockIndex,
|
|
121
|
+
blockIndexes,
|
|
122
|
+
expandedState,
|
|
123
|
+
draggedClientIds,
|
|
124
|
+
} = useListViewContext();
|
|
119
125
|
|
|
120
126
|
if ( ! canParentExpand ) {
|
|
121
127
|
return null;
|
|
@@ -143,6 +149,21 @@ function ListViewBranch( props ) {
|
|
|
143
149
|
);
|
|
144
150
|
}
|
|
145
151
|
|
|
152
|
+
const isDragged = !! draggedClientIds?.includes( clientId );
|
|
153
|
+
|
|
154
|
+
// Determine the displacement of the block while dragging. This
|
|
155
|
+
// works out whether the current block should be displaced up or
|
|
156
|
+
// down, relative to the dragged blocks and the drop target.
|
|
157
|
+
const { displacement, isAfterDraggedBlocks, isNesting } =
|
|
158
|
+
getDragDisplacementValues( {
|
|
159
|
+
blockIndexes,
|
|
160
|
+
blockDropTargetIndex,
|
|
161
|
+
blockDropPosition,
|
|
162
|
+
clientId,
|
|
163
|
+
firstDraggedBlockIndex,
|
|
164
|
+
isDragged,
|
|
165
|
+
} );
|
|
166
|
+
|
|
146
167
|
const { itemInView } = fixedListWindow;
|
|
147
168
|
const blockInView = itemInView( nextPosition );
|
|
148
169
|
|
|
@@ -158,8 +179,6 @@ function ListViewBranch( props ) {
|
|
|
158
179
|
? expandedState[ clientId ] ?? isExpanded
|
|
159
180
|
: undefined;
|
|
160
181
|
|
|
161
|
-
const isDragged = !! draggedClientIds?.includes( clientId );
|
|
162
|
-
|
|
163
182
|
// Make updates to the selected or dragged blocks synchronous,
|
|
164
183
|
// but asynchronous for any other block.
|
|
165
184
|
const isSelected = isClientIdSelected(
|
|
@@ -178,7 +197,6 @@ function ListViewBranch( props ) {
|
|
|
178
197
|
const showBlock =
|
|
179
198
|
isDragged ||
|
|
180
199
|
blockInView ||
|
|
181
|
-
isBranchDragged ||
|
|
182
200
|
( isSelected && clientId === selectedClientIds[ 0 ] );
|
|
183
201
|
return (
|
|
184
202
|
<AsyncModeProvider key={ clientId } value={ ! isSelected }>
|
|
@@ -188,17 +206,20 @@ function ListViewBranch( props ) {
|
|
|
188
206
|
selectBlock={ selectBlock }
|
|
189
207
|
isSelected={ isSelected }
|
|
190
208
|
isBranchSelected={ isSelectedBranch }
|
|
191
|
-
isDragged={ isDragged
|
|
209
|
+
isDragged={ isDragged }
|
|
192
210
|
level={ level }
|
|
193
211
|
position={ position }
|
|
194
212
|
rowCount={ rowCount }
|
|
195
213
|
siblingBlockCount={ blockCount }
|
|
196
214
|
showBlockMovers={ showBlockMovers }
|
|
197
215
|
path={ updatedPath }
|
|
198
|
-
isExpanded={ shouldExpand }
|
|
216
|
+
isExpanded={ isDragged ? false : shouldExpand }
|
|
199
217
|
listPosition={ nextPosition }
|
|
200
218
|
selectedClientIds={ selectedClientIds }
|
|
201
219
|
isSyncedBranch={ syncedBranch }
|
|
220
|
+
displacement={ displacement }
|
|
221
|
+
isAfterDraggedBlocks={ isAfterDraggedBlocks }
|
|
222
|
+
isNesting={ isNesting }
|
|
202
223
|
/>
|
|
203
224
|
) }
|
|
204
225
|
{ ! showBlock && (
|
|
@@ -206,7 +227,7 @@ function ListViewBranch( props ) {
|
|
|
206
227
|
<td className="block-editor-list-view-placeholder" />
|
|
207
228
|
</tr>
|
|
208
229
|
) }
|
|
209
|
-
{ hasNestedBlocks && shouldExpand && (
|
|
230
|
+
{ hasNestedBlocks && shouldExpand && ! isDragged && (
|
|
210
231
|
<ListViewBranch
|
|
211
232
|
parentId={ clientId }
|
|
212
233
|
blocks={ innerBlocks }
|
|
@@ -217,7 +238,6 @@ function ListViewBranch( props ) {
|
|
|
217
238
|
listPosition={ nextPosition + 1 }
|
|
218
239
|
fixedListWindow={ fixedListWindow }
|
|
219
240
|
isBranchSelected={ isSelectedBranch }
|
|
220
|
-
isBranchDragged={ isDragged || isBranchDragged }
|
|
221
241
|
selectedClientIds={ selectedClientIds }
|
|
222
242
|
isExpanded={ isExpanded }
|
|
223
243
|
isSyncedBranch={ syncedBranch }
|
|
@@ -1,15 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
__experimentalHStack as HStack,
|
|
11
|
+
__experimentalTruncate as Truncate,
|
|
12
|
+
Popover,
|
|
13
|
+
} from '@wordpress/components';
|
|
14
|
+
|
|
5
15
|
import { getScrollContainer } from '@wordpress/dom';
|
|
6
16
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
7
17
|
import { isRTL } from '@wordpress/i18n';
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
import BlockIcon from '../block-icon';
|
|
23
|
+
import useBlockDisplayInformation from '../use-block-display-information';
|
|
24
|
+
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
25
|
+
import ListViewExpander from './expander';
|
|
26
|
+
|
|
27
|
+
export default function ListViewDropIndicatorPreview( {
|
|
28
|
+
draggedBlockClientId,
|
|
10
29
|
listViewRef,
|
|
11
30
|
blockDropTarget,
|
|
12
31
|
} ) {
|
|
32
|
+
const blockInformation = useBlockDisplayInformation( draggedBlockClientId );
|
|
33
|
+
const blockTitle = useBlockDisplayTitle( {
|
|
34
|
+
clientId: draggedBlockClientId,
|
|
35
|
+
context: 'list-view',
|
|
36
|
+
} );
|
|
37
|
+
|
|
13
38
|
const { rootClientId, clientId, dropPosition } = blockDropTarget || {};
|
|
14
39
|
|
|
15
40
|
const [ rootBlockElement, blockElement ] = useMemo( () => {
|
|
@@ -35,7 +60,7 @@ export default function ListViewDropIndicator( {
|
|
|
35
60
|
: undefined;
|
|
36
61
|
|
|
37
62
|
return [ _rootBlockElement, _blockElement ];
|
|
38
|
-
}, [ rootClientId, clientId ] );
|
|
63
|
+
}, [ listViewRef, rootClientId, clientId ] );
|
|
39
64
|
|
|
40
65
|
// The targetElement is the element that the drop indicator will appear
|
|
41
66
|
// before or after. When dropping into an empty block list, blockElement
|
|
@@ -44,27 +69,6 @@ export default function ListViewDropIndicator( {
|
|
|
44
69
|
|
|
45
70
|
const rtl = isRTL();
|
|
46
71
|
|
|
47
|
-
const getDropIndicatorIndent = useCallback(
|
|
48
|
-
( targetElementRect ) => {
|
|
49
|
-
if ( ! rootBlockElement ) {
|
|
50
|
-
return 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Calculate the indent using the block icon of the root block.
|
|
54
|
-
// Using a classname selector here might be flaky and could be
|
|
55
|
-
// improved.
|
|
56
|
-
const rootBlockIconElement = rootBlockElement.querySelector(
|
|
57
|
-
'.block-editor-block-icon'
|
|
58
|
-
);
|
|
59
|
-
const rootBlockIconRect =
|
|
60
|
-
rootBlockIconElement.getBoundingClientRect();
|
|
61
|
-
return rtl
|
|
62
|
-
? targetElementRect.right - rootBlockIconRect.left
|
|
63
|
-
: rootBlockIconRect.right - targetElementRect.left;
|
|
64
|
-
},
|
|
65
|
-
[ rootBlockElement, rtl ]
|
|
66
|
-
);
|
|
67
|
-
|
|
68
72
|
const getDropIndicatorWidth = useCallback(
|
|
69
73
|
( targetElementRect, indent ) => {
|
|
70
74
|
if ( ! targetElement ) {
|
|
@@ -143,12 +147,69 @@ export default function ListViewDropIndicator( {
|
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
const targetElementRect = targetElement.getBoundingClientRect();
|
|
146
|
-
const indent = getDropIndicatorIndent( targetElementRect );
|
|
147
150
|
|
|
148
151
|
return {
|
|
149
|
-
width: getDropIndicatorWidth( targetElementRect,
|
|
152
|
+
width: getDropIndicatorWidth( targetElementRect, 0 ),
|
|
150
153
|
};
|
|
151
|
-
}, [
|
|
154
|
+
}, [ getDropIndicatorWidth, targetElement ] );
|
|
155
|
+
|
|
156
|
+
const horizontalScrollOffsetStyle = useMemo( () => {
|
|
157
|
+
if ( ! targetElement ) {
|
|
158
|
+
return {};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const scrollContainer = getScrollContainer( targetElement );
|
|
162
|
+
const ownerDocument = targetElement.ownerDocument;
|
|
163
|
+
const windowScroll =
|
|
164
|
+
scrollContainer === ownerDocument.body ||
|
|
165
|
+
scrollContainer === ownerDocument.documentElement;
|
|
166
|
+
|
|
167
|
+
if ( scrollContainer && ! windowScroll ) {
|
|
168
|
+
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
|
169
|
+
const targetElementRect = targetElement.getBoundingClientRect();
|
|
170
|
+
|
|
171
|
+
const distanceBetweenContainerAndTarget = rtl
|
|
172
|
+
? scrollContainerRect.right - targetElementRect.right
|
|
173
|
+
: targetElementRect.left - scrollContainerRect.left;
|
|
174
|
+
|
|
175
|
+
if ( ! rtl && scrollContainerRect.left > targetElementRect.left ) {
|
|
176
|
+
return {
|
|
177
|
+
transform: `translateX( ${ distanceBetweenContainerAndTarget }px )`,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if ( rtl && scrollContainerRect.right < targetElementRect.right ) {
|
|
182
|
+
return {
|
|
183
|
+
transform: `translateX( ${
|
|
184
|
+
distanceBetweenContainerAndTarget * -1
|
|
185
|
+
}px )`,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return {};
|
|
191
|
+
}, [ rtl, targetElement ] );
|
|
192
|
+
|
|
193
|
+
const ariaLevel = useMemo( () => {
|
|
194
|
+
if ( ! rootBlockElement ) {
|
|
195
|
+
return 1;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const _ariaLevel = parseInt(
|
|
199
|
+
rootBlockElement.getAttribute( 'aria-level' ),
|
|
200
|
+
10
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
return _ariaLevel ? _ariaLevel + 1 : 1;
|
|
204
|
+
}, [ rootBlockElement ] );
|
|
205
|
+
|
|
206
|
+
const hasAdjacentSelectedBranch = useMemo( () => {
|
|
207
|
+
if ( ! targetElement ) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return targetElement.classList.contains( 'is-branch-selected' );
|
|
212
|
+
}, [ targetElement ] );
|
|
152
213
|
|
|
153
214
|
const popoverAnchor = useMemo( () => {
|
|
154
215
|
const isValidDropPosition =
|
|
@@ -163,16 +224,15 @@ export default function ListViewDropIndicator( {
|
|
|
163
224
|
contextElement: targetElement,
|
|
164
225
|
getBoundingClientRect() {
|
|
165
226
|
const rect = targetElement.getBoundingClientRect();
|
|
166
|
-
const indent = getDropIndicatorIndent( rect );
|
|
167
227
|
// In RTL languages, the drop indicator should be positioned
|
|
168
228
|
// to the left of the target element, with the width of the
|
|
169
229
|
// indicator determining the indent at the right edge of the
|
|
170
230
|
// target element. In LTR languages, the drop indicator should
|
|
171
231
|
// end at the right edge of the target element, with the indent
|
|
172
232
|
// added to the position of the left edge of the target element.
|
|
173
|
-
let left = rtl ? rect.left : rect.left + indent;
|
|
233
|
+
// let left = rtl ? rect.left : rect.left + indent;
|
|
234
|
+
let left = rect.left;
|
|
174
235
|
let top = 0;
|
|
175
|
-
let bottom = 0;
|
|
176
236
|
|
|
177
237
|
// In deeply nested lists, where a scrollbar is present,
|
|
178
238
|
// the width of the drop indicator should be the width of
|
|
@@ -212,27 +272,19 @@ export default function ListViewDropIndicator( {
|
|
|
212
272
|
}
|
|
213
273
|
|
|
214
274
|
if ( dropPosition === 'top' ) {
|
|
215
|
-
top = rect.top;
|
|
216
|
-
bottom = rect.top;
|
|
275
|
+
top = rect.top - rect.height * 2;
|
|
217
276
|
} else {
|
|
218
277
|
// `dropPosition` is either `bottom` or `inside`
|
|
219
|
-
top = rect.
|
|
220
|
-
bottom = rect.bottom;
|
|
278
|
+
top = rect.top;
|
|
221
279
|
}
|
|
222
280
|
|
|
223
|
-
const width = getDropIndicatorWidth( rect,
|
|
224
|
-
const height =
|
|
281
|
+
const width = getDropIndicatorWidth( rect, 0 );
|
|
282
|
+
const height = rect.height;
|
|
225
283
|
|
|
226
284
|
return new window.DOMRect( left, top, width, height );
|
|
227
285
|
},
|
|
228
286
|
};
|
|
229
|
-
}, [
|
|
230
|
-
targetElement,
|
|
231
|
-
dropPosition,
|
|
232
|
-
getDropIndicatorIndent,
|
|
233
|
-
getDropIndicatorWidth,
|
|
234
|
-
rtl,
|
|
235
|
-
] );
|
|
287
|
+
}, [ targetElement, dropPosition, getDropIndicatorWidth, rtl ] );
|
|
236
288
|
|
|
237
289
|
if ( ! targetElement ) {
|
|
238
290
|
return null;
|
|
@@ -243,13 +295,54 @@ export default function ListViewDropIndicator( {
|
|
|
243
295
|
animate={ false }
|
|
244
296
|
anchor={ popoverAnchor }
|
|
245
297
|
focusOnMount={ false }
|
|
246
|
-
className="block-editor-list-view-drop-indicator"
|
|
298
|
+
className="block-editor-list-view-drop-indicator--preview"
|
|
247
299
|
variant="unstyled"
|
|
300
|
+
flip={ false }
|
|
301
|
+
resize={ true }
|
|
248
302
|
>
|
|
249
303
|
<div
|
|
250
304
|
style={ style }
|
|
251
|
-
className=
|
|
252
|
-
|
|
305
|
+
className={ classnames(
|
|
306
|
+
'block-editor-list-view-drop-indicator__line',
|
|
307
|
+
{
|
|
308
|
+
'block-editor-list-view-drop-indicator__line--darker':
|
|
309
|
+
hasAdjacentSelectedBranch,
|
|
310
|
+
}
|
|
311
|
+
) }
|
|
312
|
+
>
|
|
313
|
+
<div
|
|
314
|
+
className="block-editor-list-view-leaf"
|
|
315
|
+
aria-level={ ariaLevel }
|
|
316
|
+
>
|
|
317
|
+
<div
|
|
318
|
+
className={ classnames(
|
|
319
|
+
'block-editor-list-view-block-select-button',
|
|
320
|
+
'block-editor-list-view-block-contents'
|
|
321
|
+
) }
|
|
322
|
+
style={ horizontalScrollOffsetStyle }
|
|
323
|
+
>
|
|
324
|
+
<ListViewExpander onClick={ () => {} } />
|
|
325
|
+
<BlockIcon
|
|
326
|
+
icon={ blockInformation?.icon }
|
|
327
|
+
showColors
|
|
328
|
+
context="list-view"
|
|
329
|
+
/>
|
|
330
|
+
<HStack
|
|
331
|
+
alignment="center"
|
|
332
|
+
className="block-editor-list-view-block-select-button__label-wrapper"
|
|
333
|
+
justify="flex-start"
|
|
334
|
+
spacing={ 1 }
|
|
335
|
+
>
|
|
336
|
+
<span className="block-editor-list-view-block-select-button__title">
|
|
337
|
+
<Truncate ellipsizeMode="auto">
|
|
338
|
+
{ blockTitle }
|
|
339
|
+
</Truncate>
|
|
340
|
+
</span>
|
|
341
|
+
</HStack>
|
|
342
|
+
</div>
|
|
343
|
+
<div className="block-editor-list-view-block__menu-cell"></div>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
253
346
|
</Popover>
|
|
254
347
|
);
|
|
255
348
|
}
|