@wordpress/block-editor 12.16.1-next.79a6196f.0 → 12.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -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-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/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/effects-panel.js +7 -1
- package/build/components/global-styles/effects-panel.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/effects.js +66 -0
- package/build/hooks/effects.js.map +1 -0
- package/build/hooks/index.js +14 -0
- 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 +6 -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 +7 -6
- 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/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-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/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/effects-panel.js +7 -1
- package/build-module/components/global-styles/effects-panel.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/effects.js +51 -0
- package/build-module/hooks/effects.js.map +1 -0
- package/build-module/hooks/index.js +2 -0
- 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 +6 -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 +9 -8
- 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/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-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/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/effects-panel.js +16 -1
- 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/effects.js +57 -0
- package/src/hooks/index.js +2 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/style.js +8 -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 +10 -6
- 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/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/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/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/utils/block-variation-transforms.js +0 -38
- package/src/utils/test/block-variation-transforms.js +0 -94
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
removeFormat,
|
|
20
20
|
} from '@wordpress/rich-text';
|
|
21
21
|
import { Popover } from '@wordpress/components';
|
|
22
|
+
import { getBlockType } from '@wordpress/blocks';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Internal dependencies
|
|
@@ -44,6 +45,7 @@ import FormatEdit from './format-edit';
|
|
|
44
45
|
import { getAllowedFormats } from './utils';
|
|
45
46
|
import { Content } from './content';
|
|
46
47
|
import { withDeprecations } from './with-deprecations';
|
|
48
|
+
import { unlock } from '../../lock-unlock';
|
|
47
49
|
|
|
48
50
|
export const keyboardShortcutContext = createContext();
|
|
49
51
|
export const inputEventContext = createContext();
|
|
@@ -113,7 +115,11 @@ export function RichTextWrapper(
|
|
|
113
115
|
props = removeNativeProps( props );
|
|
114
116
|
|
|
115
117
|
const anchorRef = useRef();
|
|
116
|
-
const {
|
|
118
|
+
const {
|
|
119
|
+
clientId,
|
|
120
|
+
isSelected: isBlockSelected,
|
|
121
|
+
name: blockName,
|
|
122
|
+
} = useBlockEditContext();
|
|
117
123
|
const selector = ( select ) => {
|
|
118
124
|
// Avoid subscribing to the block editor store if the block is not
|
|
119
125
|
// selected.
|
|
@@ -121,10 +127,12 @@ export function RichTextWrapper(
|
|
|
121
127
|
return { isSelected: false };
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
const { getSelectionStart, getSelectionEnd } =
|
|
130
|
+
const { getSelectionStart, getSelectionEnd, getBlockAttributes } =
|
|
125
131
|
select( blockEditorStore );
|
|
126
132
|
const selectionStart = getSelectionStart();
|
|
127
133
|
const selectionEnd = getSelectionEnd();
|
|
134
|
+
const blockBindings =
|
|
135
|
+
getBlockAttributes( clientId )?.metadata?.bindings;
|
|
128
136
|
|
|
129
137
|
let isSelected;
|
|
130
138
|
|
|
@@ -137,18 +145,44 @@ export function RichTextWrapper(
|
|
|
137
145
|
isSelected = selectionStart.clientId === clientId;
|
|
138
146
|
}
|
|
139
147
|
|
|
148
|
+
// Disable Rich Text editing if block bindings specify that.
|
|
149
|
+
let shouldDisableEditing = false;
|
|
150
|
+
if ( blockBindings ) {
|
|
151
|
+
const blockTypeAttributes = getBlockType( blockName ).attributes;
|
|
152
|
+
const { getBlockBindingsSource } = unlock(
|
|
153
|
+
select( blockEditorStore )
|
|
154
|
+
);
|
|
155
|
+
for ( const [ attribute, args ] of Object.entries(
|
|
156
|
+
blockBindings
|
|
157
|
+
) ) {
|
|
158
|
+
// If any of the attributes with source "rich-text" is part of the bindings,
|
|
159
|
+
// has a source with `lockAttributesEditing`, disable it.
|
|
160
|
+
if (
|
|
161
|
+
blockTypeAttributes?.[ attribute ]?.source ===
|
|
162
|
+
'rich-text' &&
|
|
163
|
+
getBlockBindingsSource( args.source.name )
|
|
164
|
+
?.lockAttributesEditing
|
|
165
|
+
) {
|
|
166
|
+
shouldDisableEditing = true;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
140
172
|
return {
|
|
141
173
|
selectionStart: isSelected ? selectionStart.offset : undefined,
|
|
142
174
|
selectionEnd: isSelected ? selectionEnd.offset : undefined,
|
|
143
175
|
isSelected,
|
|
176
|
+
shouldDisableEditing,
|
|
144
177
|
};
|
|
145
178
|
};
|
|
146
|
-
const { selectionStart, selectionEnd, isSelected } =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
179
|
+
const { selectionStart, selectionEnd, isSelected, shouldDisableEditing } =
|
|
180
|
+
useSelect( selector, [
|
|
181
|
+
clientId,
|
|
182
|
+
identifier,
|
|
183
|
+
originalIsSelected,
|
|
184
|
+
isBlockSelected,
|
|
185
|
+
] );
|
|
152
186
|
const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
|
|
153
187
|
useSelect( blockEditorStore );
|
|
154
188
|
const { selectionChange } = useDispatch( blockEditorStore );
|
|
@@ -376,7 +410,7 @@ export function RichTextWrapper(
|
|
|
376
410
|
useFirefoxCompat(),
|
|
377
411
|
anchorRef,
|
|
378
412
|
] ) }
|
|
379
|
-
contentEditable={
|
|
413
|
+
contentEditable={ ! shouldDisableEditing }
|
|
380
414
|
suppressContentEditableWarning={ true }
|
|
381
415
|
className={ classnames(
|
|
382
416
|
'block-editor-rich-text__editable',
|
|
@@ -389,7 +423,11 @@ export function RichTextWrapper(
|
|
|
389
423
|
// select blocks when Shift Clicking into an element with
|
|
390
424
|
// tabIndex because Safari will focus the element. However,
|
|
391
425
|
// Safari will correctly ignore nested contentEditable elements.
|
|
392
|
-
tabIndex={
|
|
426
|
+
tabIndex={
|
|
427
|
+
props.tabIndex === 0 && ! shouldDisableEditing
|
|
428
|
+
? null
|
|
429
|
+
: props.tabIndex
|
|
430
|
+
}
|
|
393
431
|
data-wp-block-attribute-key={ identifier }
|
|
394
432
|
/>
|
|
395
433
|
</>
|
|
@@ -264,7 +264,7 @@ export class RichText extends Component {
|
|
|
264
264
|
onCreateUndoLevel() {
|
|
265
265
|
const { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;
|
|
266
266
|
// If the content is the same, no level needs to be created.
|
|
267
|
-
if ( this.lastHistoryValue
|
|
267
|
+
if ( this.lastHistoryValue?.toString() === this.value?.toString() ) {
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
270
|
|
|
@@ -317,7 +317,7 @@ export class RichText extends Component {
|
|
|
317
317
|
event.nativeEvent.text
|
|
318
318
|
);
|
|
319
319
|
// On iOS, onChange can be triggered after selection changes, even though there are no content changes.
|
|
320
|
-
if ( contentWithoutRootTag === this.value
|
|
320
|
+
if ( contentWithoutRootTag === this.value?.toString() ) {
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
323
|
this.lastEventCount = event.nativeEvent.eventCount;
|
|
@@ -333,7 +333,7 @@ export class RichText extends Component {
|
|
|
333
333
|
);
|
|
334
334
|
|
|
335
335
|
this.debounceCreateUndoLevel();
|
|
336
|
-
const refresh = this.value
|
|
336
|
+
const refresh = this.value?.toString() !== contentWithoutRootTag;
|
|
337
337
|
this.value = contentWithoutRootTag;
|
|
338
338
|
|
|
339
339
|
// We don't want to refresh if our goal is just to create a record.
|
|
@@ -564,7 +564,7 @@ export class RichText extends Component {
|
|
|
564
564
|
// Check if value is up to date with latest state of native AztecView.
|
|
565
565
|
if (
|
|
566
566
|
event.nativeEvent.text &&
|
|
567
|
-
event.nativeEvent.text !== this.props.value
|
|
567
|
+
event.nativeEvent.text !== this.props.value?.toString()
|
|
568
568
|
) {
|
|
569
569
|
this.onTextUpdate( event );
|
|
570
570
|
}
|
|
@@ -589,7 +589,7 @@ export class RichText extends Component {
|
|
|
589
589
|
// this approach is not perfectly reliable.
|
|
590
590
|
const isManual =
|
|
591
591
|
this.lastAztecEventType !== 'input' &&
|
|
592
|
-
this.props.value
|
|
592
|
+
this.props.value?.toString() === this.value?.toString();
|
|
593
593
|
if ( hasChanged && isManual ) {
|
|
594
594
|
const value = this.createRecord();
|
|
595
595
|
const activeFormats = getActiveFormats( value );
|
|
@@ -659,7 +659,7 @@ export class RichText extends Component {
|
|
|
659
659
|
event.nativeEvent.text
|
|
660
660
|
);
|
|
661
661
|
if (
|
|
662
|
-
contentWithoutRootTag === this.value
|
|
662
|
+
contentWithoutRootTag === this.value?.toString() &&
|
|
663
663
|
realStart === this.selectionStart &&
|
|
664
664
|
realEnd === this.selectionEnd
|
|
665
665
|
) {
|
|
@@ -756,7 +756,7 @@ export class RichText extends Component {
|
|
|
756
756
|
typeof nextProps.value !== 'undefined' &&
|
|
757
757
|
typeof this.props.value !== 'undefined' &&
|
|
758
758
|
( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&
|
|
759
|
-
nextProps.value
|
|
759
|
+
nextProps.value?.toString() !== this.props.value?.toString()
|
|
760
760
|
) {
|
|
761
761
|
// Gutenberg seems to try to mirror the caret state even on events that only change the content so,
|
|
762
762
|
// let's force caret update if state has selection set.
|
|
@@ -824,7 +824,7 @@ export class RichText extends Component {
|
|
|
824
824
|
const { style, tagName } = this.props;
|
|
825
825
|
const { currentFontSize } = this.state;
|
|
826
826
|
|
|
827
|
-
if ( this.props.value
|
|
827
|
+
if ( this.props.value?.toString() !== this.value?.toString() ) {
|
|
828
828
|
this.value = this.props.value;
|
|
829
829
|
}
|
|
830
830
|
const { __unstableIsSelected: prevIsSelected } = prevProps;
|
|
@@ -884,8 +884,8 @@ export class RichText extends Component {
|
|
|
884
884
|
// On android if content is empty we need to send no content or else the placeholder will not show.
|
|
885
885
|
if (
|
|
886
886
|
! this.isIOS &&
|
|
887
|
-
( value
|
|
888
|
-
value
|
|
887
|
+
( value?.toString() === '' ||
|
|
888
|
+
value?.toString() === EMPTY_PARAGRAPH_TAGS )
|
|
889
889
|
) {
|
|
890
890
|
return '';
|
|
891
891
|
}
|
|
@@ -20,6 +20,7 @@ import useOnBlockDrop from '../use-on-block-drop';
|
|
|
20
20
|
import {
|
|
21
21
|
getDistanceToNearestEdge,
|
|
22
22
|
isPointContainedByRect,
|
|
23
|
+
isPointWithinTopAndBottomBoundariesOfRect,
|
|
23
24
|
} from '../../utils/math';
|
|
24
25
|
import { store as blockEditorStore } from '../../store';
|
|
25
26
|
|
|
@@ -72,6 +73,8 @@ export function getDropTargetPosition(
|
|
|
72
73
|
let nearestIndex = 0;
|
|
73
74
|
let insertPosition = 'before';
|
|
74
75
|
let minDistance = Infinity;
|
|
76
|
+
let targetBlockIndex = null;
|
|
77
|
+
let nearestSide = 'right';
|
|
75
78
|
|
|
76
79
|
const {
|
|
77
80
|
dropZoneElement,
|
|
@@ -136,7 +139,12 @@ export function getDropTargetPosition(
|
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
blocksData.forEach(
|
|
139
|
-
( {
|
|
142
|
+
( {
|
|
143
|
+
isUnmodifiedDefaultBlock,
|
|
144
|
+
getBoundingClientRect,
|
|
145
|
+
blockIndex,
|
|
146
|
+
blockOrientation,
|
|
147
|
+
} ) => {
|
|
140
148
|
const rect = getBoundingClientRect();
|
|
141
149
|
|
|
142
150
|
let [ distance, edge ] = getDistanceToNearestEdge(
|
|
@@ -144,12 +152,35 @@ export function getDropTargetPosition(
|
|
|
144
152
|
rect,
|
|
145
153
|
allowedEdges
|
|
146
154
|
);
|
|
155
|
+
// If the the point is close to a side, prioritize that side.
|
|
156
|
+
const [ sideDistance, sideEdge ] = getDistanceToNearestEdge(
|
|
157
|
+
position,
|
|
158
|
+
rect,
|
|
159
|
+
[ 'left', 'right' ]
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const isPointInsideRect = isPointContainedByRect( position, rect );
|
|
163
|
+
|
|
147
164
|
// Prioritize the element if the point is inside of an unmodified default block.
|
|
148
|
-
if (
|
|
149
|
-
isUnmodifiedDefaultBlock &&
|
|
150
|
-
isPointContainedByRect( position, rect )
|
|
151
|
-
) {
|
|
165
|
+
if ( isUnmodifiedDefaultBlock && isPointInsideRect ) {
|
|
152
166
|
distance = 0;
|
|
167
|
+
} else if (
|
|
168
|
+
orientation === 'vertical' &&
|
|
169
|
+
blockOrientation !== 'horizontal' &&
|
|
170
|
+
( ( isPointInsideRect && sideDistance < THRESHOLD_DISTANCE ) ||
|
|
171
|
+
( ! isPointInsideRect &&
|
|
172
|
+
isPointWithinTopAndBottomBoundariesOfRect(
|
|
173
|
+
position,
|
|
174
|
+
rect
|
|
175
|
+
) ) )
|
|
176
|
+
) {
|
|
177
|
+
/**
|
|
178
|
+
* This condition should only apply when the layout is vertical (otherwise there's
|
|
179
|
+
* no need to create a Row) and dropzones should only activate when the block is
|
|
180
|
+
* either within and close to the sides of the target block or on its outer sides.
|
|
181
|
+
*/
|
|
182
|
+
targetBlockIndex = blockIndex;
|
|
183
|
+
nearestSide = sideEdge;
|
|
153
184
|
}
|
|
154
185
|
|
|
155
186
|
if ( distance < minDistance ) {
|
|
@@ -175,6 +206,10 @@ export function getDropTargetPosition(
|
|
|
175
206
|
const isAdjacentBlockUnmodifiedDefaultBlock =
|
|
176
207
|
!! blocksData[ adjacentIndex ]?.isUnmodifiedDefaultBlock;
|
|
177
208
|
|
|
209
|
+
// If the target index is set then group with the block at that index.
|
|
210
|
+
if ( targetBlockIndex !== null ) {
|
|
211
|
+
return [ targetBlockIndex, 'group', nearestSide ];
|
|
212
|
+
}
|
|
178
213
|
// If both blocks are not unmodified default blocks then just insert between them.
|
|
179
214
|
if (
|
|
180
215
|
! isNearestBlockUnmodifiedDefaultBlock &&
|
|
@@ -284,6 +319,7 @@ export default function useBlockDropZone( {
|
|
|
284
319
|
dropTarget.index,
|
|
285
320
|
{
|
|
286
321
|
operation: dropTarget.operation,
|
|
322
|
+
nearestSide: dropTarget.nearestSide,
|
|
287
323
|
}
|
|
288
324
|
);
|
|
289
325
|
const throttled = useThrottle(
|
|
@@ -333,28 +369,32 @@ export default function useBlockDropZone( {
|
|
|
333
369
|
.getElementById( `block-${ clientId }` )
|
|
334
370
|
.getBoundingClientRect(),
|
|
335
371
|
blockIndex: getBlockIndex( clientId ),
|
|
372
|
+
blockOrientation:
|
|
373
|
+
getBlockListSettings( clientId )?.orientation,
|
|
336
374
|
};
|
|
337
375
|
} );
|
|
338
376
|
|
|
339
|
-
const [ targetIndex, operation ] =
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
377
|
+
const [ targetIndex, operation, nearestSide ] =
|
|
378
|
+
getDropTargetPosition(
|
|
379
|
+
blocksData,
|
|
380
|
+
{ x: event.clientX, y: event.clientY },
|
|
381
|
+
getBlockListSettings( targetRootClientId )?.orientation,
|
|
382
|
+
{
|
|
383
|
+
dropZoneElement,
|
|
384
|
+
parentBlockClientId,
|
|
385
|
+
parentBlockOrientation: parentBlockClientId
|
|
386
|
+
? getBlockListSettings( parentBlockClientId )
|
|
387
|
+
?.orientation
|
|
388
|
+
: undefined,
|
|
389
|
+
rootBlockIndex: getBlockIndex( targetRootClientId ),
|
|
390
|
+
}
|
|
391
|
+
);
|
|
353
392
|
|
|
354
393
|
registry.batch( () => {
|
|
355
394
|
setDropTarget( {
|
|
356
395
|
index: targetIndex,
|
|
357
396
|
operation,
|
|
397
|
+
nearestSide,
|
|
358
398
|
} );
|
|
359
399
|
|
|
360
400
|
const insertionPointClientId = [
|
|
@@ -366,6 +406,7 @@ export default function useBlockDropZone( {
|
|
|
366
406
|
|
|
367
407
|
showInsertionPoint( insertionPointClientId, targetIndex, {
|
|
368
408
|
operation,
|
|
409
|
+
nearestSide,
|
|
369
410
|
} );
|
|
370
411
|
} );
|
|
371
412
|
},
|
|
@@ -22,13 +22,6 @@ const elementData = [
|
|
|
22
22
|
bottom: 900,
|
|
23
23
|
right: 400,
|
|
24
24
|
},
|
|
25
|
-
// Fourth block wraps to the next row/column.
|
|
26
|
-
{
|
|
27
|
-
top: 0,
|
|
28
|
-
left: 400,
|
|
29
|
-
bottom: 300,
|
|
30
|
-
right: 800,
|
|
31
|
-
},
|
|
32
25
|
];
|
|
33
26
|
|
|
34
27
|
const mapElements =
|
|
@@ -73,7 +66,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
73
66
|
const orientation = 'vertical';
|
|
74
67
|
|
|
75
68
|
it( 'returns `0` when the position is nearest to the start of the first block', () => {
|
|
76
|
-
const position = { x:
|
|
69
|
+
const position = { x: 32, y: 0 };
|
|
77
70
|
|
|
78
71
|
const result = getDropTargetPosition(
|
|
79
72
|
verticalBlocksData,
|
|
@@ -85,7 +78,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
85
78
|
} );
|
|
86
79
|
|
|
87
80
|
it( 'returns `1` when the position is nearest to the end of the first block', () => {
|
|
88
|
-
const position = { x:
|
|
81
|
+
const position = { x: 32, y: 190 };
|
|
89
82
|
|
|
90
83
|
const result = getDropTargetPosition(
|
|
91
84
|
verticalBlocksData,
|
|
@@ -97,7 +90,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
97
90
|
} );
|
|
98
91
|
|
|
99
92
|
it( 'returns `1` when the position is nearest to the start of the second block', () => {
|
|
100
|
-
const position = { x:
|
|
93
|
+
const position = { x: 32, y: 210 };
|
|
101
94
|
|
|
102
95
|
const result = getDropTargetPosition(
|
|
103
96
|
verticalBlocksData,
|
|
@@ -109,7 +102,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
109
102
|
} );
|
|
110
103
|
|
|
111
104
|
it( 'returns `2` when the position is nearest to the end of the second block', () => {
|
|
112
|
-
const position = { x:
|
|
105
|
+
const position = { x: 32, y: 450 };
|
|
113
106
|
|
|
114
107
|
const result = getDropTargetPosition(
|
|
115
108
|
verticalBlocksData,
|
|
@@ -121,7 +114,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
121
114
|
} );
|
|
122
115
|
|
|
123
116
|
it( 'returns `2` when the position is nearest to the start of the third block', () => {
|
|
124
|
-
const position = { x:
|
|
117
|
+
const position = { x: 32, y: 510 };
|
|
125
118
|
|
|
126
119
|
const result = getDropTargetPosition(
|
|
127
120
|
verticalBlocksData,
|
|
@@ -133,7 +126,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
133
126
|
} );
|
|
134
127
|
|
|
135
128
|
it( 'returns `3` when the position is nearest to the end of the third block', () => {
|
|
136
|
-
const position = { x:
|
|
129
|
+
const position = { x: 32, y: 880 };
|
|
137
130
|
|
|
138
131
|
const result = getDropTargetPosition(
|
|
139
132
|
verticalBlocksData,
|
|
@@ -145,7 +138,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
145
138
|
} );
|
|
146
139
|
|
|
147
140
|
it( 'returns `3` when the position is past the end of the third block', () => {
|
|
148
|
-
const position = { x:
|
|
141
|
+
const position = { x: 32, y: 920 };
|
|
149
142
|
|
|
150
143
|
const result = getDropTargetPosition(
|
|
151
144
|
verticalBlocksData,
|
|
@@ -155,9 +148,8 @@ describe( 'getDropTargetPosition', () => {
|
|
|
155
148
|
|
|
156
149
|
expect( result ).toEqual( [ 3, 'insert' ] );
|
|
157
150
|
} );
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const position = { x: 401, y: 0 };
|
|
151
|
+
it( 'returns group with index 0 when position is close to the right of the first block', () => {
|
|
152
|
+
const position = { x: 372, y: 0 };
|
|
161
153
|
|
|
162
154
|
const result = getDropTargetPosition(
|
|
163
155
|
verticalBlocksData,
|
|
@@ -165,11 +157,10 @@ describe( 'getDropTargetPosition', () => {
|
|
|
165
157
|
orientation
|
|
166
158
|
);
|
|
167
159
|
|
|
168
|
-
expect( result ).toEqual( [
|
|
160
|
+
expect( result ).toEqual( [ 0, 'group', 'right' ] );
|
|
169
161
|
} );
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const position = { x: 401, y: 300 };
|
|
162
|
+
it( 'returns group with index 1 when position is close to the left of the second block', () => {
|
|
163
|
+
const position = { x: 12, y: 212 };
|
|
173
164
|
|
|
174
165
|
const result = getDropTargetPosition(
|
|
175
166
|
verticalBlocksData,
|
|
@@ -177,7 +168,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
177
168
|
orientation
|
|
178
169
|
);
|
|
179
170
|
|
|
180
|
-
expect( result ).toEqual( [
|
|
171
|
+
expect( result ).toEqual( [ 1, 'group', 'left' ] );
|
|
181
172
|
} );
|
|
182
173
|
} );
|
|
183
174
|
|
|
@@ -267,30 +258,6 @@ describe( 'getDropTargetPosition', () => {
|
|
|
267
258
|
|
|
268
259
|
expect( result ).toEqual( [ 3, 'insert' ] );
|
|
269
260
|
} );
|
|
270
|
-
|
|
271
|
-
it( 'returns `3` when the position is nearest to the start of the last block', () => {
|
|
272
|
-
const position = { x: 0, y: 401 };
|
|
273
|
-
|
|
274
|
-
const result = getDropTargetPosition(
|
|
275
|
-
horizontalBlocksData,
|
|
276
|
-
position,
|
|
277
|
-
orientation
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
expect( result ).toEqual( [ 3, 'insert' ] );
|
|
281
|
-
} );
|
|
282
|
-
|
|
283
|
-
it( 'returns `4` when the position is nearest to the end of the last block', () => {
|
|
284
|
-
const position = { x: 300, y: 401 };
|
|
285
|
-
|
|
286
|
-
const result = getDropTargetPosition(
|
|
287
|
-
horizontalBlocksData,
|
|
288
|
-
position,
|
|
289
|
-
orientation
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
expect( result ).toEqual( [ 4, 'insert' ] );
|
|
293
|
-
} );
|
|
294
261
|
} );
|
|
295
262
|
|
|
296
263
|
describe( 'Unmodified default blocks', () => {
|
|
@@ -316,14 +283,18 @@ describe( 'getDropTargetPosition', () => {
|
|
|
316
283
|
|
|
317
284
|
// Dropping above the first block.
|
|
318
285
|
expect(
|
|
319
|
-
getDropTargetPosition(
|
|
286
|
+
getDropTargetPosition(
|
|
287
|
+
blocksData,
|
|
288
|
+
{ x: 32, y: 0 },
|
|
289
|
+
orientation
|
|
290
|
+
)
|
|
320
291
|
).toEqual( [ 0, 'replace' ] );
|
|
321
292
|
|
|
322
293
|
// Dropping on the top half of the first block.
|
|
323
294
|
expect(
|
|
324
295
|
getDropTargetPosition(
|
|
325
296
|
blocksData,
|
|
326
|
-
{ x:
|
|
297
|
+
{ x: 32, y: 20 },
|
|
327
298
|
orientation
|
|
328
299
|
)
|
|
329
300
|
).toEqual( [ 0, 'replace' ] );
|
|
@@ -332,7 +303,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
332
303
|
expect(
|
|
333
304
|
getDropTargetPosition(
|
|
334
305
|
blocksData,
|
|
335
|
-
{ x:
|
|
306
|
+
{ x: 32, y: 200 },
|
|
336
307
|
orientation
|
|
337
308
|
)
|
|
338
309
|
).toEqual( [ 0, 'replace' ] );
|
|
@@ -341,7 +312,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
341
312
|
expect(
|
|
342
313
|
getDropTargetPosition(
|
|
343
314
|
blocksData,
|
|
344
|
-
{ x:
|
|
315
|
+
{ x: 32, y: 211 },
|
|
345
316
|
orientation
|
|
346
317
|
)
|
|
347
318
|
).toEqual( [ 0, 'replace' ] );
|
|
@@ -350,7 +321,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
350
321
|
expect(
|
|
351
322
|
getDropTargetPosition(
|
|
352
323
|
blocksData,
|
|
353
|
-
{ x:
|
|
324
|
+
{ x: 32, y: 219 },
|
|
354
325
|
orientation
|
|
355
326
|
)
|
|
356
327
|
).toEqual( [ 0, 'replace' ] );
|
|
@@ -359,7 +330,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
359
330
|
expect(
|
|
360
331
|
getDropTargetPosition(
|
|
361
332
|
blocksData,
|
|
362
|
-
{ x:
|
|
333
|
+
{ x: 32, y: 230 },
|
|
363
334
|
orientation
|
|
364
335
|
)
|
|
365
336
|
).toEqual( [ 0, 'replace' ] );
|
|
@@ -368,7 +339,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
368
339
|
expect(
|
|
369
340
|
getDropTargetPosition(
|
|
370
341
|
blocksData,
|
|
371
|
-
{ x:
|
|
342
|
+
{ x: 32, y: 410 },
|
|
372
343
|
orientation
|
|
373
344
|
)
|
|
374
345
|
).toEqual( [ 2, 'insert' ] );
|
|
@@ -377,7 +348,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
377
348
|
expect(
|
|
378
349
|
getDropTargetPosition(
|
|
379
350
|
blocksData,
|
|
380
|
-
{ x:
|
|
351
|
+
{ x: 32, y: 421 },
|
|
381
352
|
orientation
|
|
382
353
|
)
|
|
383
354
|
).toEqual( [ 2, 'insert' ] );
|
|
@@ -410,7 +381,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
410
381
|
expect(
|
|
411
382
|
getDropTargetPosition(
|
|
412
383
|
blocksData,
|
|
413
|
-
{ x:
|
|
384
|
+
{ x: 32, y: 20 },
|
|
414
385
|
orientation
|
|
415
386
|
)
|
|
416
387
|
).toEqual( [ 0, 'insert' ] );
|
|
@@ -419,7 +390,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
419
390
|
expect(
|
|
420
391
|
getDropTargetPosition(
|
|
421
392
|
blocksData,
|
|
422
|
-
{ x:
|
|
393
|
+
{ x: 32, y: 200 },
|
|
423
394
|
orientation
|
|
424
395
|
)
|
|
425
396
|
).toEqual( [ 1, 'replace' ] );
|
|
@@ -428,7 +399,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
428
399
|
expect(
|
|
429
400
|
getDropTargetPosition(
|
|
430
401
|
blocksData,
|
|
431
|
-
{ x:
|
|
402
|
+
{ x: 32, y: 211 },
|
|
432
403
|
orientation
|
|
433
404
|
)
|
|
434
405
|
).toEqual( [ 1, 'replace' ] );
|
|
@@ -437,7 +408,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
437
408
|
expect(
|
|
438
409
|
getDropTargetPosition(
|
|
439
410
|
blocksData,
|
|
440
|
-
{ x:
|
|
411
|
+
{ x: 32, y: 219 },
|
|
441
412
|
orientation
|
|
442
413
|
)
|
|
443
414
|
).toEqual( [ 1, 'replace' ] );
|
|
@@ -446,7 +417,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
446
417
|
expect(
|
|
447
418
|
getDropTargetPosition(
|
|
448
419
|
blocksData,
|
|
449
|
-
{ x:
|
|
420
|
+
{ x: 32, y: 230 },
|
|
450
421
|
orientation
|
|
451
422
|
)
|
|
452
423
|
).toEqual( [ 1, 'replace' ] );
|
|
@@ -455,7 +426,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
455
426
|
expect(
|
|
456
427
|
getDropTargetPosition(
|
|
457
428
|
blocksData,
|
|
458
|
-
{ x:
|
|
429
|
+
{ x: 32, y: 410 },
|
|
459
430
|
orientation
|
|
460
431
|
)
|
|
461
432
|
).toEqual( [ 1, 'replace' ] );
|
|
@@ -464,7 +435,7 @@ describe( 'getDropTargetPosition', () => {
|
|
|
464
435
|
expect(
|
|
465
436
|
getDropTargetPosition(
|
|
466
437
|
blocksData,
|
|
467
|
-
{ x:
|
|
438
|
+
{ x: 32, y: 421 },
|
|
468
439
|
orientation
|
|
469
440
|
)
|
|
470
441
|
).toEqual( [ 1, 'replace' ] );
|