@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
|
@@ -11,6 +11,11 @@ import { speak } from '@wordpress/a11y';
|
|
|
11
11
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
12
12
|
import { create, insert, remove, toHTMLString } from '@wordpress/rich-text';
|
|
13
13
|
import deprecated from '@wordpress/deprecated';
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { mapRichTextSettings } from './utils';
|
|
14
19
|
/**
|
|
15
20
|
* Action which will insert a default block insert action if there
|
|
16
21
|
* are no other blocks at the root of the editor. This action should be used
|
|
@@ -100,6 +105,15 @@ export const validateBlocksToTemplate = blocks => _ref3 => {
|
|
|
100
105
|
* text value. See `wp.richText.create`.
|
|
101
106
|
*/
|
|
102
107
|
|
|
108
|
+
/**
|
|
109
|
+
* A selection object.
|
|
110
|
+
*
|
|
111
|
+
* @typedef {Object} WPSelection
|
|
112
|
+
*
|
|
113
|
+
* @property {WPBlockSelection} start The selection start.
|
|
114
|
+
* @property {WPBlockSelection} end The selection end.
|
|
115
|
+
*/
|
|
116
|
+
|
|
103
117
|
/* eslint-disable jsdoc/valid-types */
|
|
104
118
|
|
|
105
119
|
/**
|
|
@@ -595,7 +609,7 @@ export const insertBlocks = function (blocks, index, rootClientId) {
|
|
|
595
609
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
596
610
|
* which to insert.
|
|
597
611
|
* @param {?number} index Index at which block should be inserted.
|
|
598
|
-
* @param {Object} __unstableOptions
|
|
612
|
+
* @param {Object} __unstableOptions Whether or not to show an inserter button.
|
|
599
613
|
*
|
|
600
614
|
* @return {Object} Action object.
|
|
601
615
|
*/
|
|
@@ -657,6 +671,229 @@ export const synchronizeTemplate = () => _ref11 => {
|
|
|
657
671
|
const updatedBlockList = synchronizeBlocksWithTemplate(blocks, template);
|
|
658
672
|
dispatch.resetBlocks(updatedBlockList);
|
|
659
673
|
};
|
|
674
|
+
/**
|
|
675
|
+
* Delete the current selection.
|
|
676
|
+
*
|
|
677
|
+
* @param {boolean} isForward
|
|
678
|
+
*/
|
|
679
|
+
|
|
680
|
+
export const __unstableDeleteSelection = isForward => _ref12 => {
|
|
681
|
+
let {
|
|
682
|
+
registry,
|
|
683
|
+
select,
|
|
684
|
+
dispatch
|
|
685
|
+
} = _ref12;
|
|
686
|
+
const selectionAnchor = select.getSelectionStart();
|
|
687
|
+
const selectionFocus = select.getSelectionEnd();
|
|
688
|
+
if (selectionAnchor.clientId === selectionFocus.clientId) return; // It's not mergeable if there's no rich text selection.
|
|
689
|
+
|
|
690
|
+
if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false;
|
|
691
|
+
const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
|
|
692
|
+
const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same
|
|
693
|
+
// block list. Maybe in the future it should be allowed.
|
|
694
|
+
|
|
695
|
+
if (anchorRootClientId !== focusRootClientId) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const blockOrder = select.getBlockOrder(anchorRootClientId);
|
|
700
|
+
const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
|
|
701
|
+
const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
|
|
702
|
+
|
|
703
|
+
let selectionStart, selectionEnd;
|
|
704
|
+
|
|
705
|
+
if (anchorIndex > focusIndex) {
|
|
706
|
+
selectionStart = selectionFocus;
|
|
707
|
+
selectionEnd = selectionAnchor;
|
|
708
|
+
} else {
|
|
709
|
+
selectionStart = selectionAnchor;
|
|
710
|
+
selectionEnd = selectionFocus;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
const targetSelection = isForward ? selectionEnd : selectionStart;
|
|
714
|
+
const targetBlock = select.getBlock(targetSelection.clientId);
|
|
715
|
+
const targetBlockType = getBlockType(targetBlock.name);
|
|
716
|
+
|
|
717
|
+
if (!targetBlockType.merge) {
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
const selectionA = selectionStart;
|
|
722
|
+
const selectionB = selectionEnd;
|
|
723
|
+
const blockA = select.getBlock(selectionA.clientId);
|
|
724
|
+
const blockAType = getBlockType(blockA.name);
|
|
725
|
+
const blockB = select.getBlock(selectionB.clientId);
|
|
726
|
+
const blockBType = getBlockType(blockB.name);
|
|
727
|
+
const htmlA = blockA.attributes[selectionA.attributeKey];
|
|
728
|
+
const htmlB = blockB.attributes[selectionB.attributeKey];
|
|
729
|
+
const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
|
|
730
|
+
const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
|
|
731
|
+
let valueA = create({
|
|
732
|
+
html: htmlA,
|
|
733
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
734
|
+
});
|
|
735
|
+
let valueB = create({
|
|
736
|
+
html: htmlB,
|
|
737
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
738
|
+
}); // A robust way to retain selection position through various transforms
|
|
739
|
+
// is to insert a special character at the position and then recover it.
|
|
740
|
+
|
|
741
|
+
const START_OF_SELECTED_AREA = '\u0086';
|
|
742
|
+
valueA = remove(valueA, selectionA.offset, valueA.text.length);
|
|
743
|
+
valueB = insert(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); // Clone the blocks so we don't manipulate the original.
|
|
744
|
+
|
|
745
|
+
const cloneA = cloneBlock(blockA, {
|
|
746
|
+
[selectionA.attributeKey]: toHTMLString({
|
|
747
|
+
value: valueA,
|
|
748
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
749
|
+
})
|
|
750
|
+
});
|
|
751
|
+
const cloneB = cloneBlock(blockB, {
|
|
752
|
+
[selectionB.attributeKey]: toHTMLString({
|
|
753
|
+
value: valueB,
|
|
754
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
755
|
+
})
|
|
756
|
+
});
|
|
757
|
+
const followingBlock = isForward ? cloneA : cloneB; // We can only merge blocks with similar types
|
|
758
|
+
// thus, we transform the block to merge first
|
|
759
|
+
|
|
760
|
+
const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : switchToBlockType(followingBlock, targetBlockType.name); // If the block types can not match, do nothing
|
|
761
|
+
|
|
762
|
+
if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
let updatedAttributes;
|
|
767
|
+
|
|
768
|
+
if (isForward) {
|
|
769
|
+
const blockToMerge = blocksWithTheSameType.pop();
|
|
770
|
+
updatedAttributes = targetBlockType.merge(blockToMerge.attributes, cloneB.attributes);
|
|
771
|
+
} else {
|
|
772
|
+
const blockToMerge = blocksWithTheSameType.shift();
|
|
773
|
+
updatedAttributes = targetBlockType.merge(cloneA.attributes, blockToMerge.attributes);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const newAttributeKey = findKey(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
|
777
|
+
const convertedHtml = updatedAttributes[newAttributeKey];
|
|
778
|
+
const convertedValue = create({
|
|
779
|
+
html: convertedHtml,
|
|
780
|
+
...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
|
|
781
|
+
});
|
|
782
|
+
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
|
783
|
+
const newValue = remove(convertedValue, newOffset, newOffset + 1);
|
|
784
|
+
const newHtml = toHTMLString({
|
|
785
|
+
value: newValue,
|
|
786
|
+
...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
|
|
787
|
+
});
|
|
788
|
+
updatedAttributes[newAttributeKey] = newHtml;
|
|
789
|
+
const selectedBlockClientIds = select.getSelectedBlockClientIds();
|
|
790
|
+
const replacement = [...(isForward ? blocksWithTheSameType : []), { // Preserve the original client ID.
|
|
791
|
+
...targetBlock,
|
|
792
|
+
attributes: { ...targetBlock.attributes,
|
|
793
|
+
...updatedAttributes
|
|
794
|
+
}
|
|
795
|
+
}, ...(isForward ? [] : blocksWithTheSameType)];
|
|
796
|
+
registry.batch(() => {
|
|
797
|
+
dispatch.selectionChange(targetBlock.clientId, newAttributeKey, newOffset, newOffset);
|
|
798
|
+
dispatch.replaceBlocks(selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
799
|
+
select.getSelectedBlocksInitialCaretPosition());
|
|
800
|
+
});
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* Split the current selection.
|
|
804
|
+
*/
|
|
805
|
+
|
|
806
|
+
export const __unstableSplitSelection = () => _ref13 => {
|
|
807
|
+
let {
|
|
808
|
+
select,
|
|
809
|
+
dispatch
|
|
810
|
+
} = _ref13;
|
|
811
|
+
const selectionAnchor = select.getSelectionStart();
|
|
812
|
+
const selectionFocus = select.getSelectionEnd();
|
|
813
|
+
if (selectionAnchor.clientId === selectionFocus.clientId) return; // Can't split if the selection is not set.
|
|
814
|
+
|
|
815
|
+
if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return;
|
|
816
|
+
const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
|
|
817
|
+
const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same
|
|
818
|
+
// block list. Maybe in the future it should be allowed.
|
|
819
|
+
|
|
820
|
+
if (anchorRootClientId !== focusRootClientId) {
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const blockOrder = select.getBlockOrder(anchorRootClientId);
|
|
825
|
+
const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
|
|
826
|
+
const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
|
|
827
|
+
|
|
828
|
+
let selectionStart, selectionEnd;
|
|
829
|
+
|
|
830
|
+
if (anchorIndex > focusIndex) {
|
|
831
|
+
selectionStart = selectionFocus;
|
|
832
|
+
selectionEnd = selectionAnchor;
|
|
833
|
+
} else {
|
|
834
|
+
selectionStart = selectionAnchor;
|
|
835
|
+
selectionEnd = selectionFocus;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const selectionA = selectionStart;
|
|
839
|
+
const selectionB = selectionEnd;
|
|
840
|
+
const blockA = select.getBlock(selectionA.clientId);
|
|
841
|
+
const blockAType = getBlockType(blockA.name);
|
|
842
|
+
const blockB = select.getBlock(selectionB.clientId);
|
|
843
|
+
const blockBType = getBlockType(blockB.name);
|
|
844
|
+
const htmlA = blockA.attributes[selectionA.attributeKey];
|
|
845
|
+
const htmlB = blockB.attributes[selectionB.attributeKey];
|
|
846
|
+
const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
|
|
847
|
+
const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
|
|
848
|
+
let valueA = create({
|
|
849
|
+
html: htmlA,
|
|
850
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
851
|
+
});
|
|
852
|
+
let valueB = create({
|
|
853
|
+
html: htmlB,
|
|
854
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
855
|
+
});
|
|
856
|
+
valueA = remove(valueA, selectionA.offset, valueA.text.length);
|
|
857
|
+
valueB = remove(valueB, 0, selectionB.offset);
|
|
858
|
+
dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [{ // Preserve the original client ID.
|
|
859
|
+
...blockA,
|
|
860
|
+
attributes: { ...blockA.attributes,
|
|
861
|
+
[selectionA.attributeKey]: toHTMLString({
|
|
862
|
+
value: valueA,
|
|
863
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
864
|
+
})
|
|
865
|
+
}
|
|
866
|
+
}, createBlock(getDefaultBlockName()), { // Preserve the original client ID.
|
|
867
|
+
...blockB,
|
|
868
|
+
attributes: { ...blockB.attributes,
|
|
869
|
+
[selectionB.attributeKey]: toHTMLString({
|
|
870
|
+
value: valueB,
|
|
871
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
872
|
+
})
|
|
873
|
+
}
|
|
874
|
+
}], 1, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
875
|
+
select.getSelectedBlocksInitialCaretPosition());
|
|
876
|
+
};
|
|
877
|
+
/**
|
|
878
|
+
* Expand the selection to cover the entire blocks, removing partial selection.
|
|
879
|
+
*/
|
|
880
|
+
|
|
881
|
+
export const __unstableExpandSelection = () => _ref14 => {
|
|
882
|
+
let {
|
|
883
|
+
select,
|
|
884
|
+
dispatch
|
|
885
|
+
} = _ref14;
|
|
886
|
+
const selectionAnchor = select.getSelectionStart();
|
|
887
|
+
const selectionFocus = select.getSelectionEnd();
|
|
888
|
+
dispatch.selectionChange({
|
|
889
|
+
start: {
|
|
890
|
+
clientId: selectionAnchor.clientId
|
|
891
|
+
},
|
|
892
|
+
end: {
|
|
893
|
+
clientId: selectionFocus.clientId
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
};
|
|
660
897
|
/**
|
|
661
898
|
* Action that merges two blocks.
|
|
662
899
|
*
|
|
@@ -664,11 +901,11 @@ export const synchronizeTemplate = () => _ref11 => {
|
|
|
664
901
|
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
|
665
902
|
*/
|
|
666
903
|
|
|
667
|
-
export const mergeBlocks = (firstBlockClientId, secondBlockClientId) =>
|
|
904
|
+
export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => {
|
|
668
905
|
let {
|
|
669
906
|
select,
|
|
670
907
|
dispatch
|
|
671
|
-
} =
|
|
908
|
+
} = _ref15;
|
|
672
909
|
const blocks = [firstBlockClientId, secondBlockClientId];
|
|
673
910
|
dispatch({
|
|
674
911
|
type: 'MERGE_BLOCKS',
|
|
@@ -716,21 +953,13 @@ export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 =
|
|
|
716
953
|
if (canRestoreTextSelection) {
|
|
717
954
|
const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
|
|
718
955
|
const html = selectedBlock.attributes[attributeKey];
|
|
719
|
-
const {
|
|
720
|
-
multiline: multilineTag,
|
|
721
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
722
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
723
|
-
} = attributeDefinition;
|
|
724
956
|
const value = insert(create({
|
|
725
957
|
html,
|
|
726
|
-
|
|
727
|
-
multilineWrapperTags,
|
|
728
|
-
preserveWhiteSpace
|
|
958
|
+
...mapRichTextSettings(attributeDefinition)
|
|
729
959
|
}), START_OF_SELECTED_AREA, offset, offset);
|
|
730
960
|
selectedBlock.attributes[attributeKey] = toHTMLString({
|
|
731
961
|
value,
|
|
732
|
-
|
|
733
|
-
preserveWhiteSpace
|
|
962
|
+
...mapRichTextSettings(attributeDefinition)
|
|
734
963
|
});
|
|
735
964
|
} // We can only merge blocks with similar types
|
|
736
965
|
// thus, we transform the block to merge first.
|
|
@@ -748,23 +977,15 @@ export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 =
|
|
|
748
977
|
if (canRestoreTextSelection) {
|
|
749
978
|
const newAttributeKey = findKey(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
|
750
979
|
const convertedHtml = updatedAttributes[newAttributeKey];
|
|
751
|
-
const {
|
|
752
|
-
multiline: multilineTag,
|
|
753
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
754
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
755
|
-
} = blockAType.attributes[newAttributeKey];
|
|
756
980
|
const convertedValue = create({
|
|
757
981
|
html: convertedHtml,
|
|
758
|
-
|
|
759
|
-
multilineWrapperTags,
|
|
760
|
-
preserveWhiteSpace
|
|
982
|
+
...mapRichTextSettings(blockAType.attributes[newAttributeKey])
|
|
761
983
|
});
|
|
762
984
|
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
|
763
985
|
const newValue = remove(convertedValue, newOffset, newOffset + 1);
|
|
764
986
|
const newHtml = toHTMLString({
|
|
765
987
|
value: newValue,
|
|
766
|
-
|
|
767
|
-
preserveWhiteSpace
|
|
988
|
+
...mapRichTextSettings(blockAType.attributes[newAttributeKey])
|
|
768
989
|
});
|
|
769
990
|
updatedAttributes[newAttributeKey] = newHtml;
|
|
770
991
|
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
|
@@ -788,11 +1009,11 @@ export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 =
|
|
|
788
1009
|
|
|
789
1010
|
export const removeBlocks = function (clientIds) {
|
|
790
1011
|
let selectPrevious = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
791
|
-
return
|
|
1012
|
+
return _ref16 => {
|
|
792
1013
|
let {
|
|
793
1014
|
select,
|
|
794
1015
|
dispatch
|
|
795
|
-
} =
|
|
1016
|
+
} = _ref16;
|
|
796
1017
|
|
|
797
1018
|
if (!clientIds || !clientIds.length) {
|
|
798
1019
|
return;
|
|
@@ -948,21 +1169,28 @@ export function exitFormattedText() {
|
|
|
948
1169
|
/**
|
|
949
1170
|
* Action that changes the position of the user caret.
|
|
950
1171
|
*
|
|
951
|
-
* @param {string} clientId The selected block client ID.
|
|
952
|
-
* @param {string}
|
|
953
|
-
* @param {number}
|
|
954
|
-
* @param {number}
|
|
1172
|
+
* @param {string|WPSelection} clientId The selected block client ID.
|
|
1173
|
+
* @param {string} attributeKey The selected block attribute key.
|
|
1174
|
+
* @param {number} startOffset The start offset.
|
|
1175
|
+
* @param {number} endOffset The end offset.
|
|
955
1176
|
*
|
|
956
1177
|
* @return {Object} Action object.
|
|
957
1178
|
*/
|
|
958
1179
|
|
|
959
1180
|
export function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
1181
|
+
if (typeof clientId === 'string') {
|
|
1182
|
+
return {
|
|
1183
|
+
type: 'SELECTION_CHANGE',
|
|
1184
|
+
clientId,
|
|
1185
|
+
attributeKey,
|
|
1186
|
+
startOffset,
|
|
1187
|
+
endOffset
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
|
|
960
1191
|
return {
|
|
961
1192
|
type: 'SELECTION_CHANGE',
|
|
962
|
-
clientId
|
|
963
|
-
attributeKey,
|
|
964
|
-
startOffset,
|
|
965
|
-
endOffset
|
|
1193
|
+
...clientId
|
|
966
1194
|
};
|
|
967
1195
|
}
|
|
968
1196
|
/**
|
|
@@ -974,10 +1202,10 @@ export function selectionChange(clientId, attributeKey, startOffset, endOffset)
|
|
|
974
1202
|
* @param {?number} index Optional index where to insert the default block.
|
|
975
1203
|
*/
|
|
976
1204
|
|
|
977
|
-
export const insertDefaultBlock = (attributes, rootClientId, index) =>
|
|
1205
|
+
export const insertDefaultBlock = (attributes, rootClientId, index) => _ref17 => {
|
|
978
1206
|
let {
|
|
979
1207
|
dispatch
|
|
980
|
-
} =
|
|
1208
|
+
} = _ref17;
|
|
981
1209
|
// Abort if there is no default block type (if it has been unregistered).
|
|
982
1210
|
const defaultBlockName = getDefaultBlockName();
|
|
983
1211
|
|
|
@@ -1066,10 +1294,10 @@ export function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
1066
1294
|
* selection changes have been recorded.
|
|
1067
1295
|
*/
|
|
1068
1296
|
|
|
1069
|
-
export const __unstableMarkAutomaticChange = () =>
|
|
1297
|
+
export const __unstableMarkAutomaticChange = () => _ref18 => {
|
|
1070
1298
|
let {
|
|
1071
1299
|
dispatch
|
|
1072
|
-
} =
|
|
1300
|
+
} = _ref18;
|
|
1073
1301
|
dispatch({
|
|
1074
1302
|
type: 'MARK_AUTOMATIC_CHANGE'
|
|
1075
1303
|
});
|
|
@@ -1090,10 +1318,10 @@ export const __unstableMarkAutomaticChange = () => _ref15 => {
|
|
|
1090
1318
|
|
|
1091
1319
|
export const setNavigationMode = function () {
|
|
1092
1320
|
let isNavigationMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1093
|
-
return
|
|
1321
|
+
return _ref19 => {
|
|
1094
1322
|
let {
|
|
1095
1323
|
dispatch
|
|
1096
|
-
} =
|
|
1324
|
+
} = _ref19;
|
|
1097
1325
|
dispatch({
|
|
1098
1326
|
type: 'SET_NAVIGATION_MODE',
|
|
1099
1327
|
isNavigationMode
|
|
@@ -1114,10 +1342,10 @@ export const setNavigationMode = function () {
|
|
|
1114
1342
|
|
|
1115
1343
|
export const setBlockMovingClientId = function () {
|
|
1116
1344
|
let hasBlockMovingClientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1117
|
-
return
|
|
1345
|
+
return _ref20 => {
|
|
1118
1346
|
let {
|
|
1119
1347
|
dispatch
|
|
1120
|
-
} =
|
|
1348
|
+
} = _ref20;
|
|
1121
1349
|
dispatch({
|
|
1122
1350
|
type: 'SET_BLOCK_MOVING_MODE',
|
|
1123
1351
|
hasBlockMovingClientId
|
|
@@ -1137,11 +1365,11 @@ export const setBlockMovingClientId = function () {
|
|
|
1137
1365
|
|
|
1138
1366
|
export const duplicateBlocks = function (clientIds) {
|
|
1139
1367
|
let updateSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1140
|
-
return
|
|
1368
|
+
return _ref21 => {
|
|
1141
1369
|
let {
|
|
1142
1370
|
select,
|
|
1143
1371
|
dispatch
|
|
1144
|
-
} =
|
|
1372
|
+
} = _ref21;
|
|
1145
1373
|
|
|
1146
1374
|
if (!clientIds || !clientIds.length) {
|
|
1147
1375
|
return;
|
|
@@ -1179,11 +1407,11 @@ export const duplicateBlocks = function (clientIds) {
|
|
|
1179
1407
|
* @param {string} clientId
|
|
1180
1408
|
*/
|
|
1181
1409
|
|
|
1182
|
-
export const insertBeforeBlock = clientId =>
|
|
1410
|
+
export const insertBeforeBlock = clientId => _ref22 => {
|
|
1183
1411
|
let {
|
|
1184
1412
|
select,
|
|
1185
1413
|
dispatch
|
|
1186
|
-
} =
|
|
1414
|
+
} = _ref22;
|
|
1187
1415
|
|
|
1188
1416
|
if (!clientId) {
|
|
1189
1417
|
return;
|
|
@@ -1205,11 +1433,11 @@ export const insertBeforeBlock = clientId => _ref19 => {
|
|
|
1205
1433
|
* @param {string} clientId
|
|
1206
1434
|
*/
|
|
1207
1435
|
|
|
1208
|
-
export const insertAfterBlock = clientId =>
|
|
1436
|
+
export const insertAfterBlock = clientId => _ref23 => {
|
|
1209
1437
|
let {
|
|
1210
1438
|
select,
|
|
1211
1439
|
dispatch
|
|
1212
|
-
} =
|
|
1440
|
+
} = _ref23;
|
|
1213
1441
|
|
|
1214
1442
|
if (!clientId) {
|
|
1215
1443
|
return;
|
|
@@ -1245,10 +1473,10 @@ export function toggleBlockHighlight(clientId, isHighlighted) {
|
|
|
1245
1473
|
* @param {string} clientId Target block client ID.
|
|
1246
1474
|
*/
|
|
1247
1475
|
|
|
1248
|
-
export const flashBlock = clientId => async
|
|
1476
|
+
export const flashBlock = clientId => async _ref24 => {
|
|
1249
1477
|
let {
|
|
1250
1478
|
dispatch
|
|
1251
|
-
} =
|
|
1479
|
+
} = _ref24;
|
|
1252
1480
|
dispatch(toggleBlockHighlight(clientId, true));
|
|
1253
1481
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
1254
1482
|
dispatch(toggleBlockHighlight(clientId, false));
|