@wordpress/block-editor 8.4.0 → 8.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +56 -19
- package/build/components/alignment-control/index.js +13 -6
- package/build/components/alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/index.js +13 -6
- package/build/components/block-alignment-control/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-content-overlay/index.js +13 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/index.js +2 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-icon/index.js +4 -0
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +14 -17
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-list-appender/index.js +6 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-lock/index.js +8 -0
- package/build/components/block-lock/index.js.map +1 -1
- package/build/components/block-lock/menu-item.js +9 -15
- package/build/components/block-lock/menu-item.js.map +1 -1
- package/build/components/block-lock/modal.js +35 -23
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +11 -16
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +50 -0
- package/build/components/block-lock/use-block-lock.js.map +1 -0
- package/build/components/block-mover/index.js +4 -0
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +37 -22
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +4 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +50 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/index.js +8 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +2 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +1 -1
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/block-toolbar/block-name-context.js +17 -0
- package/build/components/block-toolbar/block-name-context.js.map +1 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js +20 -0
- package/build/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build/components/block-toolbar/index.js +20 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +0 -16
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +92 -47
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/index.js +13 -6
- package/build/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build/components/contrast-checker/index.js +4 -0
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +8 -0
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +105 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build/components/copy-handler/index.js +48 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/font-size-picker.js +4 -0
- package/build/components/font-sizes/font-size-picker.js.map +1 -1
- package/build/components/iframe/index.js +6 -9
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +18 -0
- package/build/components/index.js.map +1 -1
- package/build/components/justify-content-control/index.js +13 -6
- package/build/components/justify-content-control/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +10 -3
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +6 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +19 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +18 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/media-replace-flow/index.js +4 -0
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +1 -1
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/rich-text/index.js +26 -4
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/split-value.js +12 -2
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-firefox-compat.js +49 -0
- package/build/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +34 -2
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -0
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/writing-flow/index.js +9 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +3 -44
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +68 -0
- package/build/components/writing-flow/use-click-selection.js.map +1 -0
- package/build/components/writing-flow/use-drag-selection.js +134 -0
- package/build/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build/components/writing-flow/use-input.js +116 -0
- package/build/components/writing-flow/use-input.js.map +1 -0
- package/build/components/writing-flow/use-multi-selection.js +18 -38
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +161 -0
- package/build/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build/components/writing-flow/use-tab-nav.js +1 -8
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/border-color.js +3 -3
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border.js +0 -14
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +20 -17
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +5 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +4 -2
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +23 -16
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +7 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +34 -3
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +29 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +76 -12
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +9 -4
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +290 -51
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +25 -13
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +264 -21
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +27 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/dom.js +2 -1
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/alignment-control/index.js +12 -4
- package/build-module/components/alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/index.js +12 -4
- package/build-module/components/block-alignment-control/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +2 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +13 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +2 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -0
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -4
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +15 -17
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +7 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +6 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-lock/index.js +1 -0
- package/build-module/components/block-lock/index.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +8 -13
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +34 -24
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +10 -14
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +41 -0
- package/build-module/components/block-lock/use-block-lock.js.map +1 -0
- package/build-module/components/block-mover/index.js +4 -0
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +39 -24
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +50 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/index.js +9 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +2 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +1 -1
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/block-toolbar/block-name-context.js +9 -0
- package/build-module/components/block-toolbar/block-name-context.js.map +1 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js +11 -0
- package/build-module/components/block-toolbar/block-toolbar-last-item.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +16 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +0 -16
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +95 -49
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/index.js +12 -4
- package/build-module/components/block-vertical-alignment-control/index.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +4 -0
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +2 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +90 -0
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -0
- package/build-module/components/copy-handler/index.js +48 -9
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/font-size-picker.js +4 -0
- package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -9
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +2 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/justify-content-control/index.js +12 -4
- package/build-module/components/justify-content-control/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +9 -2
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +6 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +17 -6
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +18 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +4 -0
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +2 -2
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +25 -4
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/split-value.js +12 -2
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-firefox-compat.js +39 -0
- package/build-module/components/rich-text/use-firefox-compat.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +35 -4
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -0
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +5 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -45
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +57 -0
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-drag-selection.js +124 -0
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +104 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -0
- package/build-module/components/writing-flow/use-multi-selection.js +18 -37
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +150 -0
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -0
- package/build-module/components/writing-flow/use-tab-nav.js +1 -9
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/border-color.js +5 -5
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border.js +0 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +19 -18
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +3 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +4 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +22 -15
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +7 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +33 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +26 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +76 -13
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +9 -5
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +277 -49
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +25 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +250 -21
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +20 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/dom.js +2 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/style-rtl.css +142 -101
- package/build-style/style.css +142 -101
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +28 -28
- package/src/components/alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/index.js +9 -4
- package/src/components/block-alignment-control/ui.js +2 -2
- package/src/components/block-content-overlay/index.js +19 -2
- package/src/components/block-draggable/index.js +2 -5
- package/src/components/block-icon/index.js +3 -0
- package/src/components/block-inspector/index.js +4 -0
- package/src/components/block-list/style.scss +4 -5
- package/src/components/block-list/use-block-props/index.js +0 -5
- package/src/components/block-list/use-block-props/use-focus-first-element.js +19 -26
- package/src/components/block-list/use-block-props/use-focus-handler.js +8 -0
- package/src/components/block-list-appender/index.js +5 -0
- package/src/components/block-lock/index.js +1 -0
- package/src/components/block-lock/menu-item.js +6 -19
- package/src/components/block-lock/modal.js +52 -23
- package/src/components/block-lock/style.scss +7 -5
- package/src/components/block-lock/toolbar.js +7 -14
- package/src/components/block-lock/use-block-lock.js +45 -0
- package/src/components/block-mover/index.js +3 -0
- package/src/components/block-mover/style.scss +4 -0
- package/src/components/block-pattern-setup/index.js +84 -59
- package/src/components/block-pattern-setup/setup-toolbar.js +3 -1
- package/src/components/block-pattern-setup/style.scss +32 -26
- package/src/components/block-preview/auto.js +10 -1
- package/src/components/block-preview/index.js +2 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +62 -4
- package/src/components/block-switcher/index.js +15 -3
- package/src/components/block-switcher/style.scss +15 -4
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +15 -13
- package/src/components/block-switcher/test/index.js +2 -2
- package/src/components/block-title/index.js +2 -2
- package/src/components/block-title/use-block-display-title.js +1 -1
- package/src/components/block-toolbar/block-name-context.js +8 -0
- package/src/components/block-toolbar/block-toolbar-last-item.js +12 -0
- package/src/components/block-toolbar/index.js +18 -2
- package/src/components/block-toolbar/style.scss +6 -0
- package/src/components/block-tools/index.js +0 -19
- package/src/components/block-tools/style.scss +3 -5
- package/src/components/block-variation-transforms/index.js +105 -36
- package/src/components/block-variation-transforms/style.scss +1 -1
- package/src/components/block-vertical-alignment-control/index.js +9 -4
- package/src/components/button-block-appender/style.scss +5 -1
- package/src/components/contrast-checker/index.js +3 -0
- package/src/components/convert-to-group-buttons/index.js +6 -1
- package/src/components/convert-to-group-buttons/toolbar.js +87 -0
- package/src/components/copy-handler/index.js +55 -10
- package/src/components/font-sizes/font-size-picker.js +3 -0
- package/src/components/iframe/index.js +5 -7
- package/src/components/index.js +2 -0
- package/src/components/justify-content-control/index.js +9 -4
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/line-height-control/index.js +8 -3
- package/src/components/link-control/index.js +5 -5
- package/src/components/list-view/block-select-button.js +13 -3
- package/src/components/list-view/block.js +24 -8
- package/src/components/list-view/branch.js +1 -1
- package/src/components/list-view/style.scss +56 -14
- package/src/components/media-placeholder/README.md +8 -0
- package/src/components/media-replace-flow/index.js +3 -0
- package/src/components/multi-selection-inspector/index.js +2 -2
- package/src/components/rich-text/index.js +24 -1
- package/src/components/rich-text/split-value.js +5 -1
- package/src/components/rich-text/use-firefox-compat.js +39 -0
- package/src/components/rich-text/use-input-rules.js +40 -3
- package/src/components/skip-to-selected-block/index.js +3 -0
- package/src/components/url-input/style.scss +3 -2
- package/src/components/writing-flow/index.js +8 -0
- package/src/components/writing-flow/readme.md +28 -0
- package/src/components/writing-flow/use-arrow-nav.js +4 -53
- package/src/components/writing-flow/use-click-selection.js +65 -0
- package/src/components/writing-flow/use-drag-selection.js +126 -0
- package/src/components/writing-flow/use-input.js +112 -0
- package/src/components/writing-flow/use-multi-selection.js +13 -36
- package/src/components/writing-flow/use-selection-observer.js +153 -0
- package/src/components/writing-flow/use-tab-nav.js +1 -11
- package/src/hooks/border-color.js +5 -5
- package/src/hooks/border.js +0 -13
- package/src/hooks/color.js +51 -24
- package/src/hooks/font-family.js +5 -2
- package/src/hooks/font-size.js +10 -7
- package/src/hooks/gap.js +25 -17
- package/src/hooks/layout.js +11 -1
- package/src/hooks/style.js +40 -4
- package/src/hooks/test/gap.js +25 -1
- package/src/hooks/test/style.js +94 -0
- package/src/hooks/test/utils.js +1 -1
- package/src/hooks/utils.js +26 -0
- package/src/layouts/flex.js +89 -5
- package/src/layouts/flow.js +15 -4
- package/src/store/actions.js +341 -32
- package/src/store/defaults.js +7 -2
- package/src/store/reducer.js +25 -10
- package/src/store/selectors.js +329 -26
- package/src/store/test/selectors.js +242 -5
- package/src/store/utils.js +19 -0
- package/src/utils/dom.js +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +0 -205
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build/components/block-list/use-block-props/use-scroll-into-view.js +0 -77
- package/build/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +0 -192
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js +0 -63
- package/build-module/components/block-list/use-block-props/use-scroll-into-view.js.map +0 -1
- package/src/components/block-list/use-block-props/use-multi-selection.js +0 -227
- package/src/components/block-list/use-block-props/use-scroll-into-view.js +0 -73
|
@@ -146,6 +146,41 @@ describe( 'selectors', () => {
|
|
|
146
146
|
parent: [ 'core/post-content' ],
|
|
147
147
|
} );
|
|
148
148
|
|
|
149
|
+
registerBlockType( 'core/test-block-ancestor', {
|
|
150
|
+
save: ( props ) => props.attributes.text,
|
|
151
|
+
category: 'text',
|
|
152
|
+
title: 'Test Block required as ancestor',
|
|
153
|
+
icon: 'test',
|
|
154
|
+
keywords: [ 'testing' ],
|
|
155
|
+
} );
|
|
156
|
+
|
|
157
|
+
registerBlockType( 'core/test-block-parent', {
|
|
158
|
+
save: ( props ) => props.attributes.text,
|
|
159
|
+
category: 'text',
|
|
160
|
+
title: 'Test Block required as parent',
|
|
161
|
+
icon: 'test',
|
|
162
|
+
keywords: [ 'testing' ],
|
|
163
|
+
} );
|
|
164
|
+
|
|
165
|
+
registerBlockType( 'core/test-block-requires-ancestor', {
|
|
166
|
+
save: ( props ) => props.attributes.text,
|
|
167
|
+
category: 'text',
|
|
168
|
+
title: 'Test Block that requires ancestor',
|
|
169
|
+
icon: 'test',
|
|
170
|
+
keywords: [ 'testing' ],
|
|
171
|
+
ancestor: [ 'core/test-block-ancestor' ],
|
|
172
|
+
} );
|
|
173
|
+
|
|
174
|
+
registerBlockType( 'core/test-block-requires-ancestor-parent', {
|
|
175
|
+
save: ( props ) => props.attributes.text,
|
|
176
|
+
category: 'text',
|
|
177
|
+
title: 'Test Block that requires both ancestor and parent',
|
|
178
|
+
icon: 'test',
|
|
179
|
+
keywords: [ 'testing' ],
|
|
180
|
+
parent: [ 'core/test-block-parent' ],
|
|
181
|
+
ancestor: [ 'core/test-block-ancestor' ],
|
|
182
|
+
} );
|
|
183
|
+
|
|
149
184
|
setFreeformContentHandlerName( 'core/test-freeform' );
|
|
150
185
|
|
|
151
186
|
cachedSelectors.forEach( ( { clear } ) => clear() );
|
|
@@ -158,6 +193,10 @@ describe( 'selectors', () => {
|
|
|
158
193
|
unregisterBlockType( 'core/test-block-c' );
|
|
159
194
|
unregisterBlockType( 'core/test-freeform' );
|
|
160
195
|
unregisterBlockType( 'core/post-content-child' );
|
|
196
|
+
unregisterBlockType( 'core/test-block-ancestor' );
|
|
197
|
+
unregisterBlockType( 'core/test-block-parent' );
|
|
198
|
+
unregisterBlockType( 'core/test-block-requires-ancestor' );
|
|
199
|
+
unregisterBlockType( 'core/test-block-requires-ancestor-parent' );
|
|
161
200
|
|
|
162
201
|
setFreeformContentHandlerName( undefined );
|
|
163
202
|
} );
|
|
@@ -448,7 +487,7 @@ describe( 'selectors', () => {
|
|
|
448
487
|
} );
|
|
449
488
|
|
|
450
489
|
describe( 'getClientIdsOfDescendants', () => {
|
|
451
|
-
it( 'should return the ids of any descendants, given an array of clientIds', () => {
|
|
490
|
+
it( 'should return the ids of any descendants in sequential order, given an array of clientIds', () => {
|
|
452
491
|
const state = {
|
|
453
492
|
blocks: {
|
|
454
493
|
byClientId: {
|
|
@@ -541,8 +580,8 @@ describe( 'selectors', () => {
|
|
|
541
580
|
getClientIdsOfDescendants( state, [ 'uuid-10' ] )
|
|
542
581
|
).toEqual( [
|
|
543
582
|
'uuid-12',
|
|
544
|
-
'uuid-14',
|
|
545
583
|
'uuid-16',
|
|
584
|
+
'uuid-14',
|
|
546
585
|
'uuid-18',
|
|
547
586
|
'uuid-24',
|
|
548
587
|
'uuid-26',
|
|
@@ -553,7 +592,7 @@ describe( 'selectors', () => {
|
|
|
553
592
|
} );
|
|
554
593
|
|
|
555
594
|
describe( 'getClientIdsWithDescendants', () => {
|
|
556
|
-
it( 'should return the ids for top-level blocks and their descendants of any depth (for nested blocks).', () => {
|
|
595
|
+
it( 'should return the ids for top-level blocks and their descendants of any depth (for nested blocks) in sequential order.', () => {
|
|
557
596
|
const state = {
|
|
558
597
|
blocks: {
|
|
559
598
|
byClientId: {
|
|
@@ -645,15 +684,15 @@ describe( 'selectors', () => {
|
|
|
645
684
|
'uuid-6',
|
|
646
685
|
'uuid-8',
|
|
647
686
|
'uuid-10',
|
|
648
|
-
'uuid-22',
|
|
649
687
|
'uuid-12',
|
|
650
|
-
'uuid-14',
|
|
651
688
|
'uuid-16',
|
|
689
|
+
'uuid-14',
|
|
652
690
|
'uuid-18',
|
|
653
691
|
'uuid-24',
|
|
654
692
|
'uuid-26',
|
|
655
693
|
'uuid-28',
|
|
656
694
|
'uuid-30',
|
|
695
|
+
'uuid-22',
|
|
657
696
|
] );
|
|
658
697
|
} );
|
|
659
698
|
} );
|
|
@@ -2475,6 +2514,198 @@ describe( 'selectors', () => {
|
|
|
2475
2514
|
canInsertBlockType( state, 'core/post-content-child' )
|
|
2476
2515
|
).toBe( true );
|
|
2477
2516
|
} );
|
|
2517
|
+
|
|
2518
|
+
it( 'should allow blocks to be inserted in a descendant of a required ancestor', () => {
|
|
2519
|
+
const state = {
|
|
2520
|
+
blocks: {
|
|
2521
|
+
byClientId: {
|
|
2522
|
+
block1: { name: 'core/test-block-ancestor' },
|
|
2523
|
+
block2: { name: 'core/block' },
|
|
2524
|
+
},
|
|
2525
|
+
attributes: {
|
|
2526
|
+
block1: {},
|
|
2527
|
+
block2: {},
|
|
2528
|
+
},
|
|
2529
|
+
parents: {
|
|
2530
|
+
block2: 'block1',
|
|
2531
|
+
},
|
|
2532
|
+
},
|
|
2533
|
+
blockListSettings: {
|
|
2534
|
+
block1: {},
|
|
2535
|
+
block2: {},
|
|
2536
|
+
},
|
|
2537
|
+
settings: {},
|
|
2538
|
+
};
|
|
2539
|
+
expect(
|
|
2540
|
+
canInsertBlockType(
|
|
2541
|
+
state,
|
|
2542
|
+
'core/test-block-requires-ancestor',
|
|
2543
|
+
'block2'
|
|
2544
|
+
)
|
|
2545
|
+
).toBe( true );
|
|
2546
|
+
} );
|
|
2547
|
+
|
|
2548
|
+
it( 'should allow blocks to be inserted if both parent and ancestor restrictions are met', () => {
|
|
2549
|
+
const state = {
|
|
2550
|
+
blocks: {
|
|
2551
|
+
byClientId: {
|
|
2552
|
+
block1: { name: 'core/test-block-ancestor' },
|
|
2553
|
+
block2: { name: 'core/block' },
|
|
2554
|
+
block3: { name: 'core/test-block-parent' },
|
|
2555
|
+
},
|
|
2556
|
+
attributes: {
|
|
2557
|
+
block1: {},
|
|
2558
|
+
block2: {},
|
|
2559
|
+
block3: {},
|
|
2560
|
+
},
|
|
2561
|
+
parents: {
|
|
2562
|
+
block2: 'block1',
|
|
2563
|
+
block3: 'block2',
|
|
2564
|
+
},
|
|
2565
|
+
},
|
|
2566
|
+
blockListSettings: {
|
|
2567
|
+
block1: {},
|
|
2568
|
+
block2: {},
|
|
2569
|
+
block3: {},
|
|
2570
|
+
},
|
|
2571
|
+
settings: {},
|
|
2572
|
+
};
|
|
2573
|
+
expect(
|
|
2574
|
+
canInsertBlockType(
|
|
2575
|
+
state,
|
|
2576
|
+
'core/test-block-requires-ancestor-parent',
|
|
2577
|
+
'block3'
|
|
2578
|
+
)
|
|
2579
|
+
).toBe( true );
|
|
2580
|
+
} );
|
|
2581
|
+
|
|
2582
|
+
it( 'should deny blocks from being inserted outside a required ancestor', () => {
|
|
2583
|
+
const state = {
|
|
2584
|
+
blocks: {
|
|
2585
|
+
byClientId: {
|
|
2586
|
+
block1: { name: 'core/test-block-ancestor' },
|
|
2587
|
+
block2: { name: 'core/block' },
|
|
2588
|
+
block3: { name: 'core/block' },
|
|
2589
|
+
},
|
|
2590
|
+
attributes: {
|
|
2591
|
+
block1: {},
|
|
2592
|
+
block2: {},
|
|
2593
|
+
block3: {},
|
|
2594
|
+
},
|
|
2595
|
+
parents: {
|
|
2596
|
+
block3: 'block2',
|
|
2597
|
+
},
|
|
2598
|
+
},
|
|
2599
|
+
blockListSettings: {
|
|
2600
|
+
block1: {},
|
|
2601
|
+
block2: {},
|
|
2602
|
+
block3: {},
|
|
2603
|
+
},
|
|
2604
|
+
settings: {},
|
|
2605
|
+
};
|
|
2606
|
+
expect(
|
|
2607
|
+
canInsertBlockType(
|
|
2608
|
+
state,
|
|
2609
|
+
'core/test-block-requires-ancestor',
|
|
2610
|
+
'block3'
|
|
2611
|
+
)
|
|
2612
|
+
).toBe( false );
|
|
2613
|
+
} );
|
|
2614
|
+
|
|
2615
|
+
it( 'should deny blocks from being inserted outside of a required ancestor, even if parent matches', () => {
|
|
2616
|
+
const state = {
|
|
2617
|
+
blocks: {
|
|
2618
|
+
byClientId: {
|
|
2619
|
+
block1: { name: 'core/test-block-ancestor' },
|
|
2620
|
+
block2: { name: 'core/block' },
|
|
2621
|
+
block3: { name: 'core/test-block-parent' },
|
|
2622
|
+
},
|
|
2623
|
+
attributes: {
|
|
2624
|
+
block1: {},
|
|
2625
|
+
block2: {},
|
|
2626
|
+
block3: {},
|
|
2627
|
+
},
|
|
2628
|
+
parents: {
|
|
2629
|
+
block3: 'block2',
|
|
2630
|
+
},
|
|
2631
|
+
},
|
|
2632
|
+
blockListSettings: {
|
|
2633
|
+
block1: {},
|
|
2634
|
+
block2: {},
|
|
2635
|
+
block3: {},
|
|
2636
|
+
},
|
|
2637
|
+
settings: {},
|
|
2638
|
+
};
|
|
2639
|
+
expect(
|
|
2640
|
+
canInsertBlockType(
|
|
2641
|
+
state,
|
|
2642
|
+
'core/test-block-requires-ancestor-parent',
|
|
2643
|
+
'block3'
|
|
2644
|
+
)
|
|
2645
|
+
).toBe( false );
|
|
2646
|
+
} );
|
|
2647
|
+
|
|
2648
|
+
it( 'should deny blocks from being inserted inside ancestor if parent restricts allowedBlocks', () => {
|
|
2649
|
+
const state = {
|
|
2650
|
+
blocks: {
|
|
2651
|
+
byClientId: {
|
|
2652
|
+
block1: { name: 'core/test-block-ancestor' },
|
|
2653
|
+
block2: { name: 'core/block' },
|
|
2654
|
+
},
|
|
2655
|
+
attributes: {
|
|
2656
|
+
block1: {},
|
|
2657
|
+
block2: {},
|
|
2658
|
+
},
|
|
2659
|
+
parents: {
|
|
2660
|
+
block2: 'block1',
|
|
2661
|
+
},
|
|
2662
|
+
},
|
|
2663
|
+
blockListSettings: {
|
|
2664
|
+
block1: {},
|
|
2665
|
+
block2: {
|
|
2666
|
+
allowedBlocks: [],
|
|
2667
|
+
},
|
|
2668
|
+
},
|
|
2669
|
+
settings: {},
|
|
2670
|
+
};
|
|
2671
|
+
expect(
|
|
2672
|
+
canInsertBlockType(
|
|
2673
|
+
state,
|
|
2674
|
+
'core/test-block-requires-ancestor',
|
|
2675
|
+
'block2'
|
|
2676
|
+
)
|
|
2677
|
+
).toBe( false );
|
|
2678
|
+
} );
|
|
2679
|
+
|
|
2680
|
+
it( 'should deny blocks from being inserted inside ancestor if parent restriction is not met', () => {
|
|
2681
|
+
const state = {
|
|
2682
|
+
blocks: {
|
|
2683
|
+
byClientId: {
|
|
2684
|
+
block1: { name: 'core/test-block-ancestor' },
|
|
2685
|
+
block2: { name: 'core/block' },
|
|
2686
|
+
},
|
|
2687
|
+
attributes: {
|
|
2688
|
+
block1: {},
|
|
2689
|
+
block2: {},
|
|
2690
|
+
},
|
|
2691
|
+
parents: {
|
|
2692
|
+
block2: 'block1',
|
|
2693
|
+
},
|
|
2694
|
+
},
|
|
2695
|
+
blockListSettings: {
|
|
2696
|
+
block1: {},
|
|
2697
|
+
block2: {},
|
|
2698
|
+
},
|
|
2699
|
+
settings: {},
|
|
2700
|
+
};
|
|
2701
|
+
expect(
|
|
2702
|
+
canInsertBlockType(
|
|
2703
|
+
state,
|
|
2704
|
+
'core/test-block-requires-ancestor-parent',
|
|
2705
|
+
'block2'
|
|
2706
|
+
)
|
|
2707
|
+
).toBe( false );
|
|
2708
|
+
} );
|
|
2478
2709
|
} );
|
|
2479
2710
|
|
|
2480
2711
|
describe( 'canInsertBlocks', () => {
|
|
@@ -2681,6 +2912,8 @@ describe( 'selectors', () => {
|
|
|
2681
2912
|
'core/test-block-a',
|
|
2682
2913
|
'core/test-block-b',
|
|
2683
2914
|
'core/test-freeform',
|
|
2915
|
+
'core/test-block-ancestor',
|
|
2916
|
+
'core/test-block-parent',
|
|
2684
2917
|
'core/block/1',
|
|
2685
2918
|
'core/block/2',
|
|
2686
2919
|
] );
|
|
@@ -2695,6 +2928,8 @@ describe( 'selectors', () => {
|
|
|
2695
2928
|
'core/test-block-a',
|
|
2696
2929
|
'core/test-block-b',
|
|
2697
2930
|
'core/test-freeform',
|
|
2931
|
+
'core/test-block-ancestor',
|
|
2932
|
+
'core/test-block-parent',
|
|
2698
2933
|
'core/block/1',
|
|
2699
2934
|
'core/block/2',
|
|
2700
2935
|
] );
|
|
@@ -2727,6 +2962,7 @@ describe( 'selectors', () => {
|
|
|
2727
2962
|
},
|
|
2728
2963
|
},
|
|
2729
2964
|
controlledInnerBlocks: {},
|
|
2965
|
+
parents: {},
|
|
2730
2966
|
},
|
|
2731
2967
|
preferences: {
|
|
2732
2968
|
insertUsage: {},
|
|
@@ -2935,6 +3171,7 @@ describe( 'selectors', () => {
|
|
|
2935
3171
|
},
|
|
2936
3172
|
},
|
|
2937
3173
|
controlledInnerBlocks: {},
|
|
3174
|
+
parents: {},
|
|
2938
3175
|
},
|
|
2939
3176
|
preferences: {
|
|
2940
3177
|
insertUsage: {},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function that maps attribute definition properties to the
|
|
3
|
+
* ones used by RichText utils like `create, toHTMLString, etc..`.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} attributeDefinition A block's attribute definition object.
|
|
6
|
+
* @return {Object} The mapped object.
|
|
7
|
+
*/
|
|
8
|
+
export function mapRichTextSettings( attributeDefinition ) {
|
|
9
|
+
const {
|
|
10
|
+
multiline: multilineTag,
|
|
11
|
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
12
|
+
__unstablePreserveWhiteSpace: preserveWhiteSpace,
|
|
13
|
+
} = attributeDefinition;
|
|
14
|
+
return {
|
|
15
|
+
multilineTag,
|
|
16
|
+
multilineWrapperTags,
|
|
17
|
+
preserveWhiteSpace,
|
|
18
|
+
};
|
|
19
|
+
}
|
package/src/utils/dom.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const BLOCK_SELECTOR = '.block-editor-block-list__block';
|
|
2
2
|
const APPENDER_SELECTOR = '.block-list-appender';
|
|
3
|
+
const BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Returns true if two elements are contained within the same block.
|
|
@@ -25,7 +26,7 @@ export function isInSameBlock( a, b ) {
|
|
|
25
26
|
*/
|
|
26
27
|
export function isInsideRootBlock( blockElement, element ) {
|
|
27
28
|
const parentBlock = element.closest(
|
|
28
|
-
[ BLOCK_SELECTOR, APPENDER_SELECTOR ].join( ',' )
|
|
29
|
+
[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )
|
|
29
30
|
);
|
|
30
31
|
return parentBlock === blockElement;
|
|
31
32
|
}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/components/block-context/index.js","./src/utils/dom.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"1bc82f5b3bb93df76d19730c84467b0b346187198537135d63a672956f323720","affectsGlobalScope":true},"e59d00012fb20e6746def2f4bc94650526aa6c574c49ad6a50a992f61a3ee675","e47b8ec56eb49bc1c53c9012daa9874de14ad0c5da442485aec333571c74b526","45a63e17814c570ea59407f231ef9c561510bd6edb36f17479b09b44619496c6","64edfb2b255173bc63214290f9c3ed2306d658b5895ca482a0f20f03fd544ffc","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","1e0ac21bc775686383ea8c8e48bd98b385e6195b25c85525a7affd08a2cd38b9","0449615e1ed03c7d54fc435a63b7ef0cb4e5cea5ac40c9a63280a46f7eeae0ff","c2785f1635be52763ea678e43064f7b5195af88fc8652781950ae12bdd8049d7","
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/scheduler/tracing.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/components/block-context/index.js","./src/utils/dom.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"381899b8d1d4c1be716f18cb5242ba39f66f4b1e31d45af62a32a99f8edcb39d","f7b46d22a307739c145e5fddf537818038fdfffd580d79ed717f4d4d37249380","f5a8b384f182b3851cec3596ccc96cb7464f8d3469f48c74bf2befb782a19de5",{"version":"1bc82f5b3bb93df76d19730c84467b0b346187198537135d63a672956f323720","affectsGlobalScope":true},"e59d00012fb20e6746def2f4bc94650526aa6c574c49ad6a50a992f61a3ee675","e47b8ec56eb49bc1c53c9012daa9874de14ad0c5da442485aec333571c74b526","45a63e17814c570ea59407f231ef9c561510bd6edb36f17479b09b44619496c6","64edfb2b255173bc63214290f9c3ed2306d658b5895ca482a0f20f03fd544ffc","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","1e0ac21bc775686383ea8c8e48bd98b385e6195b25c85525a7affd08a2cd38b9","0449615e1ed03c7d54fc435a63b7ef0cb4e5cea5ac40c9a63280a46f7eeae0ff","c2785f1635be52763ea678e43064f7b5195af88fc8652781950ae12bdd8049d7","4e8c59b6c243b9148b72d7428c71592176a520225ee91b718f4a655a5baf6624"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[49],[45,46,47,48],[49,58],[50],[50,51,53,54,55,56,57],[52],[49,50]],"referencedMap":[[52,1],[49,2],[59,3],[51,4],[58,5],[57,1],[53,6],[50,1],[56,7]],"exportedModulesMap":[[52,1],[49,2],[59,3],[51,4],[58,5],[57,1],[53,6],[50,1],[56,7]],"semanticDiagnosticsPerFile":[47,52,45,49,46,48,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,59,60,51,58,55,57,53,50,56,54]},"version":"4.4.2"}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setContentEditableWrapper = setContentEditableWrapper;
|
|
7
|
-
exports.useMultiSelection = useMultiSelection;
|
|
8
|
-
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
|
|
11
|
-
var _compose = require("@wordpress/compose");
|
|
12
|
-
|
|
13
|
-
var _store = require("../../../store");
|
|
14
|
-
|
|
15
|
-
var _dom = require("../../../utils/dom");
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* WordPress dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sets the `contenteditable` wrapper element to `value`.
|
|
27
|
-
*
|
|
28
|
-
* @param {HTMLElement} node Block element.
|
|
29
|
-
* @param {boolean} value `contentEditable` value (true or false)
|
|
30
|
-
*/
|
|
31
|
-
function setContentEditableWrapper(node, value) {
|
|
32
|
-
// Since `closest` considers `node` as a candidate, use `parentElement`.
|
|
33
|
-
node.parentElement.closest('[contenteditable]').contentEditable = value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Sets a multi-selection based on the native selection across blocks.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} clientId Block client ID.
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
function useMultiSelection(clientId) {
|
|
43
|
-
const {
|
|
44
|
-
startMultiSelect,
|
|
45
|
-
stopMultiSelect,
|
|
46
|
-
multiSelect,
|
|
47
|
-
selectBlock
|
|
48
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
49
|
-
const {
|
|
50
|
-
isSelectionEnabled,
|
|
51
|
-
isBlockSelected,
|
|
52
|
-
getBlockParents,
|
|
53
|
-
getBlockSelectionStart,
|
|
54
|
-
hasMultiSelection
|
|
55
|
-
} = (0, _data.useSelect)(_store.store);
|
|
56
|
-
return (0, _compose.useRefEffect)(node => {
|
|
57
|
-
const {
|
|
58
|
-
ownerDocument
|
|
59
|
-
} = node;
|
|
60
|
-
const {
|
|
61
|
-
defaultView
|
|
62
|
-
} = ownerDocument;
|
|
63
|
-
let anchorElement;
|
|
64
|
-
let rafId;
|
|
65
|
-
|
|
66
|
-
function onSelectionChange(_ref) {
|
|
67
|
-
let {
|
|
68
|
-
isSelectionEnd
|
|
69
|
-
} = _ref;
|
|
70
|
-
const selection = defaultView.getSelection(); // If no selection is found, end multi selection and disable the
|
|
71
|
-
// contentEditable wrapper.
|
|
72
|
-
|
|
73
|
-
if (!selection.rangeCount || selection.isCollapsed) {
|
|
74
|
-
setContentEditableWrapper(node, false);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const endClientId = (0, _dom.getBlockClientId)(selection.focusNode);
|
|
79
|
-
const isSingularSelection = clientId === endClientId;
|
|
80
|
-
|
|
81
|
-
if (isSingularSelection) {
|
|
82
|
-
selectBlock(clientId); // If the selection is complete (on mouse up), and no
|
|
83
|
-
// multiple blocks have been selected, set focus back to the
|
|
84
|
-
// anchor element. if the anchor element contains the
|
|
85
|
-
// selection. Additionally, the contentEditable wrapper can
|
|
86
|
-
// now be disabled again.
|
|
87
|
-
|
|
88
|
-
if (isSelectionEnd) {
|
|
89
|
-
setContentEditableWrapper(node, false);
|
|
90
|
-
|
|
91
|
-
if (selection.rangeCount) {
|
|
92
|
-
const {
|
|
93
|
-
commonAncestorContainer
|
|
94
|
-
} = selection.getRangeAt(0);
|
|
95
|
-
|
|
96
|
-
if (anchorElement.contains(commonAncestorContainer)) {
|
|
97
|
-
anchorElement.focus();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
const startPath = [...getBlockParents(clientId), clientId];
|
|
103
|
-
const endPath = [...getBlockParents(endClientId), endClientId];
|
|
104
|
-
const depth = Math.min(startPath.length, endPath.length) - 1;
|
|
105
|
-
multiSelect(startPath[depth], endPath[depth]);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function onSelectionEnd() {
|
|
110
|
-
ownerDocument.removeEventListener('selectionchange', onSelectionChange); // Equivalent to attaching the listener once.
|
|
111
|
-
|
|
112
|
-
defaultView.removeEventListener('mouseup', onSelectionEnd); // The browser selection won't have updated yet at this point,
|
|
113
|
-
// so wait until the next animation frame to get the browser
|
|
114
|
-
// selection.
|
|
115
|
-
|
|
116
|
-
rafId = defaultView.requestAnimationFrame(() => {
|
|
117
|
-
onSelectionChange({
|
|
118
|
-
isSelectionEnd: true
|
|
119
|
-
});
|
|
120
|
-
stopMultiSelect();
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function onMouseLeave(_ref2) {
|
|
125
|
-
let {
|
|
126
|
-
buttons
|
|
127
|
-
} = _ref2;
|
|
128
|
-
|
|
129
|
-
// The primary button must be pressed to initiate selection.
|
|
130
|
-
// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
|
|
131
|
-
if (buttons !== 1) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (!isSelectionEnabled() || !isBlockSelected(clientId)) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
anchorElement = ownerDocument.activeElement;
|
|
140
|
-
startMultiSelect(); // `onSelectionStart` is called after `mousedown` and
|
|
141
|
-
// `mouseleave` (from a block). The selection ends when
|
|
142
|
-
// `mouseup` happens anywhere in the window.
|
|
143
|
-
|
|
144
|
-
ownerDocument.addEventListener('selectionchange', onSelectionChange);
|
|
145
|
-
defaultView.addEventListener('mouseup', onSelectionEnd); // Allow cross contentEditable selection by temporarily making
|
|
146
|
-
// all content editable. We can't rely on using the store and
|
|
147
|
-
// React because re-rending happens too slowly. We need to be
|
|
148
|
-
// able to select across instances immediately.
|
|
149
|
-
|
|
150
|
-
setContentEditableWrapper(node, true);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function onMouseDown(event) {
|
|
154
|
-
// The main button.
|
|
155
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
|
156
|
-
if (!isSelectionEnabled() || event.button !== 0) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
if (event.shiftKey) {
|
|
161
|
-
const blockSelectionStart = getBlockSelectionStart(); // By checking `blockSelectionStart` to be set, we handle the
|
|
162
|
-
// case where we select a single block. We also have to check
|
|
163
|
-
// the selectionEnd (clientId) not to be included in the
|
|
164
|
-
// `blockSelectionStart`'s parents because the click event is
|
|
165
|
-
// propagated.
|
|
166
|
-
|
|
167
|
-
const startParents = getBlockParents(blockSelectionStart);
|
|
168
|
-
|
|
169
|
-
if (blockSelectionStart && blockSelectionStart !== clientId && !(startParents !== null && startParents !== void 0 && startParents.includes(clientId))) {
|
|
170
|
-
const startPath = [...startParents, blockSelectionStart];
|
|
171
|
-
const endPath = [...getBlockParents(clientId), clientId];
|
|
172
|
-
const depth = Math.min(startPath.length, endPath.length) - 1;
|
|
173
|
-
const start = startPath[depth];
|
|
174
|
-
const end = endPath[depth]; // Handle the case of having selected a parent block and
|
|
175
|
-
// then shift+click on a child.
|
|
176
|
-
|
|
177
|
-
if (start !== end) {
|
|
178
|
-
setContentEditableWrapper(node, true);
|
|
179
|
-
multiSelect(start, end);
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} else if (hasMultiSelection()) {
|
|
184
|
-
// Allow user to escape out of a multi-selection to a
|
|
185
|
-
// singular selection of a block via click. This is handled
|
|
186
|
-
// here since focus handling excludes blocks when there is
|
|
187
|
-
// multiselection, as focus can be incurred by starting a
|
|
188
|
-
// multiselection (focus moved to first block's multi-
|
|
189
|
-
// controls).
|
|
190
|
-
selectBlock(clientId);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
node.addEventListener('mousedown', onMouseDown);
|
|
195
|
-
node.addEventListener('mouseleave', onMouseLeave);
|
|
196
|
-
return () => {
|
|
197
|
-
node.removeEventListener('mousedown', onMouseDown);
|
|
198
|
-
node.removeEventListener('mouseleave', onMouseLeave);
|
|
199
|
-
ownerDocument.removeEventListener('selectionchange', onSelectionChange);
|
|
200
|
-
defaultView.removeEventListener('mouseup', onSelectionEnd);
|
|
201
|
-
defaultView.cancelAnimationFrame(rafId);
|
|
202
|
-
};
|
|
203
|
-
}, [clientId, startMultiSelect, stopMultiSelect, multiSelect, selectBlock, isSelectionEnabled, isBlockSelected, getBlockParents]);
|
|
204
|
-
}
|
|
205
|
-
//# sourceMappingURL=use-multi-selection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-multi-selection.js"],"names":["setContentEditableWrapper","node","value","parentElement","closest","contentEditable","useMultiSelection","clientId","startMultiSelect","stopMultiSelect","multiSelect","selectBlock","blockEditorStore","isSelectionEnabled","isBlockSelected","getBlockParents","getBlockSelectionStart","hasMultiSelection","ownerDocument","defaultView","anchorElement","rafId","onSelectionChange","isSelectionEnd","selection","getSelection","rangeCount","isCollapsed","endClientId","focusNode","isSingularSelection","commonAncestorContainer","getRangeAt","contains","focus","startPath","endPath","depth","Math","min","length","onSelectionEnd","removeEventListener","requestAnimationFrame","onMouseLeave","buttons","activeElement","addEventListener","onMouseDown","event","button","shiftKey","blockSelectionStart","startParents","includes","start","end","preventDefault","cancelAnimationFrame"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\nimport { getBlockClientId } from '../../../utils/dom';\n\n/**\n * Sets the `contenteditable` wrapper element to `value`.\n *\n * @param {HTMLElement} node Block element.\n * @param {boolean} value `contentEditable` value (true or false)\n */\nexport function setContentEditableWrapper( node, value ) {\n\t// Since `closest` considers `node` as a candidate, use `parentElement`.\n\tnode.parentElement.closest( '[contenteditable]' ).contentEditable = value;\n}\n\n/**\n * Sets a multi-selection based on the native selection across blocks.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useMultiSelection( clientId ) {\n\tconst {\n\t\tstartMultiSelect,\n\t\tstopMultiSelect,\n\t\tmultiSelect,\n\t\tselectBlock,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tisSelectionEnabled,\n\t\tisBlockSelected,\n\t\tgetBlockParents,\n\t\tgetBlockSelectionStart,\n\t\thasMultiSelection,\n\t} = useSelect( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tlet anchorElement;\n\t\t\tlet rafId;\n\n\t\t\tfunction onSelectionChange( { isSelectionEnd } ) {\n\t\t\t\tconst selection = defaultView.getSelection();\n\n\t\t\t\t// If no selection is found, end multi selection and disable the\n\t\t\t\t// contentEditable wrapper.\n\t\t\t\tif ( ! selection.rangeCount || selection.isCollapsed ) {\n\t\t\t\t\tsetContentEditableWrapper( node, false );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst endClientId = getBlockClientId( selection.focusNode );\n\t\t\t\tconst isSingularSelection = clientId === endClientId;\n\n\t\t\t\tif ( isSingularSelection ) {\n\t\t\t\t\tselectBlock( clientId );\n\n\t\t\t\t\t// If the selection is complete (on mouse up), and no\n\t\t\t\t\t// multiple blocks have been selected, set focus back to the\n\t\t\t\t\t// anchor element. if the anchor element contains the\n\t\t\t\t\t// selection. Additionally, the contentEditable wrapper can\n\t\t\t\t\t// now be disabled again.\n\t\t\t\t\tif ( isSelectionEnd ) {\n\t\t\t\t\t\tsetContentEditableWrapper( node, false );\n\n\t\t\t\t\t\tif ( selection.rangeCount ) {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tcommonAncestorContainer,\n\t\t\t\t\t\t\t} = selection.getRangeAt( 0 );\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tanchorElement.contains(\n\t\t\t\t\t\t\t\t\tcommonAncestorContainer\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tanchorElement.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst startPath = [\n\t\t\t\t\t\t...getBlockParents( clientId ),\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst endPath = [\n\t\t\t\t\t\t...getBlockParents( endClientId ),\n\t\t\t\t\t\tendClientId,\n\t\t\t\t\t];\n\t\t\t\t\tconst depth =\n\t\t\t\t\t\tMath.min( startPath.length, endPath.length ) - 1;\n\n\t\t\t\t\tmultiSelect( startPath[ depth ], endPath[ depth ] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction onSelectionEnd() {\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\t// Equivalent to attaching the listener once.\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onSelectionEnd );\n\t\t\t\t// The browser selection won't have updated yet at this point,\n\t\t\t\t// so wait until the next animation frame to get the browser\n\t\t\t\t// selection.\n\t\t\t\trafId = defaultView.requestAnimationFrame( () => {\n\t\t\t\t\tonSelectionChange( { isSelectionEnd: true } );\n\t\t\t\t\tstopMultiSelect();\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tfunction onMouseLeave( { buttons } ) {\n\t\t\t\t// The primary button must be pressed to initiate selection.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n\t\t\t\tif ( buttons !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! isSelectionEnabled() || ! isBlockSelected( clientId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tanchorElement = ownerDocument.activeElement;\n\t\t\t\tstartMultiSelect();\n\n\t\t\t\t// `onSelectionStart` is called after `mousedown` and\n\t\t\t\t// `mouseleave` (from a block). The selection ends when\n\t\t\t\t// `mouseup` happens anywhere in the window.\n\t\t\t\townerDocument.addEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.addEventListener( 'mouseup', onSelectionEnd );\n\n\t\t\t\t// Allow cross contentEditable selection by temporarily making\n\t\t\t\t// all content editable. We can't rely on using the store and\n\t\t\t\t// React because re-rending happens too slowly. We need to be\n\t\t\t\t// able to select across instances immediately.\n\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t}\n\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\t// The main button.\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n\t\t\t\tif ( ! isSelectionEnabled() || event.button !== 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( event.shiftKey ) {\n\t\t\t\t\tconst blockSelectionStart = getBlockSelectionStart();\n\t\t\t\t\t// By checking `blockSelectionStart` to be set, we handle the\n\t\t\t\t\t// case where we select a single block. We also have to check\n\t\t\t\t\t// the selectionEnd (clientId) not to be included in the\n\t\t\t\t\t// `blockSelectionStart`'s parents because the click event is\n\t\t\t\t\t// propagated.\n\t\t\t\t\tconst startParents = getBlockParents( blockSelectionStart );\n\t\t\t\t\tif (\n\t\t\t\t\t\tblockSelectionStart &&\n\t\t\t\t\t\tblockSelectionStart !== clientId &&\n\t\t\t\t\t\t! startParents?.includes( clientId )\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst startPath = [\n\t\t\t\t\t\t\t...startParents,\n\t\t\t\t\t\t\tblockSelectionStart,\n\t\t\t\t\t\t];\n\t\t\t\t\t\tconst endPath = [\n\t\t\t\t\t\t\t...getBlockParents( clientId ),\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t];\n\t\t\t\t\t\tconst depth =\n\t\t\t\t\t\t\tMath.min( startPath.length, endPath.length ) - 1;\n\t\t\t\t\t\tconst start = startPath[ depth ];\n\t\t\t\t\t\tconst end = endPath[ depth ];\n\t\t\t\t\t\t// Handle the case of having selected a parent block and\n\t\t\t\t\t\t// then shift+click on a child.\n\t\t\t\t\t\tif ( start !== end ) {\n\t\t\t\t\t\t\tsetContentEditableWrapper( node, true );\n\t\t\t\t\t\t\tmultiSelect( start, end );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if ( hasMultiSelection() ) {\n\t\t\t\t\t// Allow user to escape out of a multi-selection to a\n\t\t\t\t\t// singular selection of a block via click. This is handled\n\t\t\t\t\t// here since focus handling excludes blocks when there is\n\t\t\t\t\t// multiselection, as focus can be incurred by starting a\n\t\t\t\t\t// multiselection (focus moved to first block's multi-\n\t\t\t\t\t// controls).\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.addEventListener( 'mouseleave', onMouseLeave );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t\tnode.removeEventListener( 'mouseleave', onMouseLeave );\n\t\t\t\townerDocument.removeEventListener(\n\t\t\t\t\t'selectionchange',\n\t\t\t\t\tonSelectionChange\n\t\t\t\t);\n\t\t\t\tdefaultView.removeEventListener( 'mouseup', onSelectionEnd );\n\t\t\t\tdefaultView.cancelAnimationFrame( rafId );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tclientId,\n\t\t\tstartMultiSelect,\n\t\t\tstopMultiSelect,\n\t\t\tmultiSelect,\n\t\t\tselectBlock,\n\t\t\tisSelectionEnabled,\n\t\t\tisBlockSelected,\n\t\t\tgetBlockParents,\n\t\t]\n\t);\n}\n"]}
|