@wordpress/block-editor 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +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-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/menu-item.js +9 -0
- package/build/components/block-lock/menu-item.js.map +1 -1
- package/build/components/block-lock/modal.js +4 -13
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +11 -3
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +4 -0
- package/build/components/block-mover/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 +1 -1
- 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 +4 -0
- 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/list-view/block-select-button.js +25 -6
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +5 -1
- 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 +297 -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 +142 -18
- package/build/store/selectors.js.map +1 -1
- 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-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/menu-item.js +9 -0
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +5 -14
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +11 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- 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-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 +2 -2
- 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 +4 -0
- 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/list-view/block-select-button.js +22 -6
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +5 -1
- 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 +286 -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 +138 -19
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/dom.js +2 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/style-rtl.css +107 -74
- package/build-style/style.css +107 -74
- 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-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/menu-item.js +8 -1
- package/src/components/block-lock/modal.js +18 -13
- package/src/components/block-lock/style.scss +6 -3
- package/src/components/block-lock/toolbar.js +12 -2
- package/src/components/block-mover/index.js +3 -0
- package/src/components/block-mover/style.scss +4 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +62 -4
- package/src/components/block-switcher/index.js +2 -2
- package/src/components/block-switcher/style.scss +8 -1
- 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 +3 -0
- 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/list-view/block-select-button.js +21 -3
- package/src/components/list-view/block.js +8 -1
- 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 +349 -32
- package/src/store/defaults.js +7 -2
- package/src/store/reducer.js +25 -10
- package/src/store/selectors.js +181 -24
- package/src/store/test/selectors.js +242 -5
- 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
|
@@ -100,6 +100,15 @@ export const validateBlocksToTemplate = blocks => _ref3 => {
|
|
|
100
100
|
* text value. See `wp.richText.create`.
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* A selection object.
|
|
105
|
+
*
|
|
106
|
+
* @typedef {Object} WPSelection
|
|
107
|
+
*
|
|
108
|
+
* @property {WPBlockSelection} start The selection start.
|
|
109
|
+
* @property {WPBlockSelection} end The selection end.
|
|
110
|
+
*/
|
|
111
|
+
|
|
103
112
|
/* eslint-disable jsdoc/valid-types */
|
|
104
113
|
|
|
105
114
|
/**
|
|
@@ -595,7 +604,7 @@ export const insertBlocks = function (blocks, index, rootClientId) {
|
|
|
595
604
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
596
605
|
* which to insert.
|
|
597
606
|
* @param {?number} index Index at which block should be inserted.
|
|
598
|
-
* @param {Object} __unstableOptions
|
|
607
|
+
* @param {Object} __unstableOptions Whether or not to show an inserter button.
|
|
599
608
|
*
|
|
600
609
|
* @return {Object} Action object.
|
|
601
610
|
*/
|
|
@@ -657,6 +666,243 @@ export const synchronizeTemplate = () => _ref11 => {
|
|
|
657
666
|
const updatedBlockList = synchronizeBlocksWithTemplate(blocks, template);
|
|
658
667
|
dispatch.resetBlocks(updatedBlockList);
|
|
659
668
|
};
|
|
669
|
+
|
|
670
|
+
function mapRichTextSettings(attributeDefinition) {
|
|
671
|
+
const {
|
|
672
|
+
multiline: multilineTag,
|
|
673
|
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
674
|
+
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
675
|
+
} = attributeDefinition;
|
|
676
|
+
return {
|
|
677
|
+
multilineTag,
|
|
678
|
+
multilineWrapperTags,
|
|
679
|
+
preserveWhiteSpace
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Delete the current selection.
|
|
684
|
+
*
|
|
685
|
+
* @param {boolean} isForward
|
|
686
|
+
*/
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
export const __unstableDeleteSelection = isForward => _ref12 => {
|
|
690
|
+
let {
|
|
691
|
+
registry,
|
|
692
|
+
select,
|
|
693
|
+
dispatch
|
|
694
|
+
} = _ref12;
|
|
695
|
+
const selectionAnchor = select.getSelectionStart();
|
|
696
|
+
const selectionFocus = select.getSelectionEnd();
|
|
697
|
+
if (selectionAnchor.clientId === selectionFocus.clientId) return; // It's not mergeable if there's no rich text selection.
|
|
698
|
+
|
|
699
|
+
if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false;
|
|
700
|
+
const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
|
|
701
|
+
const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same
|
|
702
|
+
// block list. Maybe in the future it should be allowed.
|
|
703
|
+
|
|
704
|
+
if (anchorRootClientId !== focusRootClientId) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
const blockOrder = select.getBlockOrder(anchorRootClientId);
|
|
709
|
+
const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
|
|
710
|
+
const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
|
|
711
|
+
|
|
712
|
+
let selectionStart, selectionEnd;
|
|
713
|
+
|
|
714
|
+
if (anchorIndex > focusIndex) {
|
|
715
|
+
selectionStart = selectionFocus;
|
|
716
|
+
selectionEnd = selectionAnchor;
|
|
717
|
+
} else {
|
|
718
|
+
selectionStart = selectionAnchor;
|
|
719
|
+
selectionEnd = selectionFocus;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
const targetSelection = isForward ? selectionEnd : selectionStart;
|
|
723
|
+
const targetBlock = select.getBlock(targetSelection.clientId);
|
|
724
|
+
const targetBlockType = getBlockType(targetBlock.name);
|
|
725
|
+
|
|
726
|
+
if (!targetBlockType.merge) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
const selectionA = selectionStart;
|
|
731
|
+
const selectionB = selectionEnd;
|
|
732
|
+
const blockA = select.getBlock(selectionA.clientId);
|
|
733
|
+
const blockAType = getBlockType(blockA.name);
|
|
734
|
+
const blockB = select.getBlock(selectionB.clientId);
|
|
735
|
+
const blockBType = getBlockType(blockB.name);
|
|
736
|
+
const htmlA = blockA.attributes[selectionA.attributeKey];
|
|
737
|
+
const htmlB = blockB.attributes[selectionB.attributeKey];
|
|
738
|
+
const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
|
|
739
|
+
const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
|
|
740
|
+
let valueA = create({
|
|
741
|
+
html: htmlA,
|
|
742
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
743
|
+
});
|
|
744
|
+
let valueB = create({
|
|
745
|
+
html: htmlB,
|
|
746
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
747
|
+
}); // A robust way to retain selection position through various transforms
|
|
748
|
+
// is to insert a special character at the position and then recover it.
|
|
749
|
+
|
|
750
|
+
const START_OF_SELECTED_AREA = '\u0086';
|
|
751
|
+
valueA = remove(valueA, selectionA.offset, valueA.text.length);
|
|
752
|
+
valueB = insert(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); // Clone the blocks so we don't manipulate the original.
|
|
753
|
+
|
|
754
|
+
const cloneA = cloneBlock(blockA, {
|
|
755
|
+
[selectionA.attributeKey]: toHTMLString({
|
|
756
|
+
value: valueA,
|
|
757
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
758
|
+
})
|
|
759
|
+
});
|
|
760
|
+
const cloneB = cloneBlock(blockB, {
|
|
761
|
+
[selectionB.attributeKey]: toHTMLString({
|
|
762
|
+
value: valueB,
|
|
763
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
764
|
+
})
|
|
765
|
+
});
|
|
766
|
+
const followingBlock = isForward ? cloneA : cloneB; // We can only merge blocks with similar types
|
|
767
|
+
// thus, we transform the block to merge first
|
|
768
|
+
|
|
769
|
+
const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : switchToBlockType(followingBlock, targetBlockType.name); // If the block types can not match, do nothing
|
|
770
|
+
|
|
771
|
+
if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
let updatedAttributes;
|
|
776
|
+
|
|
777
|
+
if (isForward) {
|
|
778
|
+
const blockToMerge = blocksWithTheSameType.pop();
|
|
779
|
+
updatedAttributes = targetBlockType.merge(blockToMerge.attributes, cloneB.attributes);
|
|
780
|
+
} else {
|
|
781
|
+
const blockToMerge = blocksWithTheSameType.shift();
|
|
782
|
+
updatedAttributes = targetBlockType.merge(cloneA.attributes, blockToMerge.attributes);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
const newAttributeKey = findKey(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
|
786
|
+
const convertedHtml = updatedAttributes[newAttributeKey];
|
|
787
|
+
const convertedValue = create({
|
|
788
|
+
html: convertedHtml,
|
|
789
|
+
...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
|
|
790
|
+
});
|
|
791
|
+
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
|
792
|
+
const newValue = remove(convertedValue, newOffset, newOffset + 1);
|
|
793
|
+
const newHtml = toHTMLString({
|
|
794
|
+
value: newValue,
|
|
795
|
+
...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
|
|
796
|
+
});
|
|
797
|
+
updatedAttributes[newAttributeKey] = newHtml;
|
|
798
|
+
const selectedBlockClientIds = select.getSelectedBlockClientIds();
|
|
799
|
+
const replacement = [...(isForward ? blocksWithTheSameType : []), { // Preserve the original client ID.
|
|
800
|
+
...targetBlock,
|
|
801
|
+
attributes: { ...targetBlock.attributes,
|
|
802
|
+
...updatedAttributes
|
|
803
|
+
}
|
|
804
|
+
}, ...(isForward ? [] : blocksWithTheSameType)];
|
|
805
|
+
registry.batch(() => {
|
|
806
|
+
dispatch.selectionChange(targetBlock.clientId, newAttributeKey, newOffset, newOffset);
|
|
807
|
+
dispatch.replaceBlocks(selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
808
|
+
select.getSelectedBlocksInitialCaretPosition());
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
/**
|
|
812
|
+
* Split the current selection.
|
|
813
|
+
*/
|
|
814
|
+
|
|
815
|
+
export const __unstableSplitSelection = () => _ref13 => {
|
|
816
|
+
let {
|
|
817
|
+
select,
|
|
818
|
+
dispatch
|
|
819
|
+
} = _ref13;
|
|
820
|
+
const selectionAnchor = select.getSelectionStart();
|
|
821
|
+
const selectionFocus = select.getSelectionEnd();
|
|
822
|
+
if (selectionAnchor.clientId === selectionFocus.clientId) return; // Can't split if the selection is not set.
|
|
823
|
+
|
|
824
|
+
if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return;
|
|
825
|
+
const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
|
|
826
|
+
const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same
|
|
827
|
+
// block list. Maybe in the future it should be allowed.
|
|
828
|
+
|
|
829
|
+
if (anchorRootClientId !== focusRootClientId) {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
const blockOrder = select.getBlockOrder(anchorRootClientId);
|
|
834
|
+
const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
|
|
835
|
+
const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
|
|
836
|
+
|
|
837
|
+
let selectionStart, selectionEnd;
|
|
838
|
+
|
|
839
|
+
if (anchorIndex > focusIndex) {
|
|
840
|
+
selectionStart = selectionFocus;
|
|
841
|
+
selectionEnd = selectionAnchor;
|
|
842
|
+
} else {
|
|
843
|
+
selectionStart = selectionAnchor;
|
|
844
|
+
selectionEnd = selectionFocus;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
const selectionA = selectionStart;
|
|
848
|
+
const selectionB = selectionEnd;
|
|
849
|
+
const blockA = select.getBlock(selectionA.clientId);
|
|
850
|
+
const blockAType = getBlockType(blockA.name);
|
|
851
|
+
const blockB = select.getBlock(selectionB.clientId);
|
|
852
|
+
const blockBType = getBlockType(blockB.name);
|
|
853
|
+
const htmlA = blockA.attributes[selectionA.attributeKey];
|
|
854
|
+
const htmlB = blockB.attributes[selectionB.attributeKey];
|
|
855
|
+
const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
|
|
856
|
+
const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
|
|
857
|
+
let valueA = create({
|
|
858
|
+
html: htmlA,
|
|
859
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
860
|
+
});
|
|
861
|
+
let valueB = create({
|
|
862
|
+
html: htmlB,
|
|
863
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
864
|
+
});
|
|
865
|
+
valueA = remove(valueA, selectionA.offset, valueA.text.length);
|
|
866
|
+
valueB = remove(valueB, 0, selectionB.offset);
|
|
867
|
+
dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [{ // Preserve the original client ID.
|
|
868
|
+
...blockA,
|
|
869
|
+
attributes: { ...blockA.attributes,
|
|
870
|
+
[selectionA.attributeKey]: toHTMLString({
|
|
871
|
+
value: valueA,
|
|
872
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
873
|
+
})
|
|
874
|
+
}
|
|
875
|
+
}, createBlock(getDefaultBlockName()), { // Preserve the original client ID.
|
|
876
|
+
...blockB,
|
|
877
|
+
attributes: { ...blockB.attributes,
|
|
878
|
+
[selectionB.attributeKey]: toHTMLString({
|
|
879
|
+
value: valueB,
|
|
880
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
881
|
+
})
|
|
882
|
+
}
|
|
883
|
+
}], 1, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
884
|
+
select.getSelectedBlocksInitialCaretPosition());
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* Expand the selection to cover the entire blocks, removing partial selection.
|
|
888
|
+
*/
|
|
889
|
+
|
|
890
|
+
export const __unstableExpandSelection = () => _ref14 => {
|
|
891
|
+
let {
|
|
892
|
+
select,
|
|
893
|
+
dispatch
|
|
894
|
+
} = _ref14;
|
|
895
|
+
const selectionAnchor = select.getSelectionStart();
|
|
896
|
+
const selectionFocus = select.getSelectionEnd();
|
|
897
|
+
dispatch.selectionChange({
|
|
898
|
+
start: {
|
|
899
|
+
clientId: selectionAnchor.clientId
|
|
900
|
+
},
|
|
901
|
+
end: {
|
|
902
|
+
clientId: selectionFocus.clientId
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
};
|
|
660
906
|
/**
|
|
661
907
|
* Action that merges two blocks.
|
|
662
908
|
*
|
|
@@ -664,11 +910,11 @@ export const synchronizeTemplate = () => _ref11 => {
|
|
|
664
910
|
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
|
665
911
|
*/
|
|
666
912
|
|
|
667
|
-
export const mergeBlocks = (firstBlockClientId, secondBlockClientId) =>
|
|
913
|
+
export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => {
|
|
668
914
|
let {
|
|
669
915
|
select,
|
|
670
916
|
dispatch
|
|
671
|
-
} =
|
|
917
|
+
} = _ref15;
|
|
672
918
|
const blocks = [firstBlockClientId, secondBlockClientId];
|
|
673
919
|
dispatch({
|
|
674
920
|
type: 'MERGE_BLOCKS',
|
|
@@ -716,21 +962,13 @@ export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 =
|
|
|
716
962
|
if (canRestoreTextSelection) {
|
|
717
963
|
const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
|
|
718
964
|
const html = selectedBlock.attributes[attributeKey];
|
|
719
|
-
const {
|
|
720
|
-
multiline: multilineTag,
|
|
721
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
722
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
723
|
-
} = attributeDefinition;
|
|
724
965
|
const value = insert(create({
|
|
725
966
|
html,
|
|
726
|
-
|
|
727
|
-
multilineWrapperTags,
|
|
728
|
-
preserveWhiteSpace
|
|
967
|
+
...mapRichTextSettings(attributeDefinition)
|
|
729
968
|
}), START_OF_SELECTED_AREA, offset, offset);
|
|
730
969
|
selectedBlock.attributes[attributeKey] = toHTMLString({
|
|
731
970
|
value,
|
|
732
|
-
|
|
733
|
-
preserveWhiteSpace
|
|
971
|
+
...mapRichTextSettings(attributeDefinition)
|
|
734
972
|
});
|
|
735
973
|
} // We can only merge blocks with similar types
|
|
736
974
|
// thus, we transform the block to merge first.
|
|
@@ -748,23 +986,15 @@ export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 =
|
|
|
748
986
|
if (canRestoreTextSelection) {
|
|
749
987
|
const newAttributeKey = findKey(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
|
750
988
|
const convertedHtml = updatedAttributes[newAttributeKey];
|
|
751
|
-
const {
|
|
752
|
-
multiline: multilineTag,
|
|
753
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
754
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
755
|
-
} = blockAType.attributes[newAttributeKey];
|
|
756
989
|
const convertedValue = create({
|
|
757
990
|
html: convertedHtml,
|
|
758
|
-
|
|
759
|
-
multilineWrapperTags,
|
|
760
|
-
preserveWhiteSpace
|
|
991
|
+
...mapRichTextSettings(blockAType.attributes[newAttributeKey])
|
|
761
992
|
});
|
|
762
993
|
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
|
763
994
|
const newValue = remove(convertedValue, newOffset, newOffset + 1);
|
|
764
995
|
const newHtml = toHTMLString({
|
|
765
996
|
value: newValue,
|
|
766
|
-
|
|
767
|
-
preserveWhiteSpace
|
|
997
|
+
...mapRichTextSettings(blockAType.attributes[newAttributeKey])
|
|
768
998
|
});
|
|
769
999
|
updatedAttributes[newAttributeKey] = newHtml;
|
|
770
1000
|
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
|
@@ -788,11 +1018,11 @@ export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 =
|
|
|
788
1018
|
|
|
789
1019
|
export const removeBlocks = function (clientIds) {
|
|
790
1020
|
let selectPrevious = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
791
|
-
return
|
|
1021
|
+
return _ref16 => {
|
|
792
1022
|
let {
|
|
793
1023
|
select,
|
|
794
1024
|
dispatch
|
|
795
|
-
} =
|
|
1025
|
+
} = _ref16;
|
|
796
1026
|
|
|
797
1027
|
if (!clientIds || !clientIds.length) {
|
|
798
1028
|
return;
|
|
@@ -948,21 +1178,28 @@ export function exitFormattedText() {
|
|
|
948
1178
|
/**
|
|
949
1179
|
* Action that changes the position of the user caret.
|
|
950
1180
|
*
|
|
951
|
-
* @param {string} clientId The selected block client ID.
|
|
952
|
-
* @param {string}
|
|
953
|
-
* @param {number}
|
|
954
|
-
* @param {number}
|
|
1181
|
+
* @param {string|WPSelection} clientId The selected block client ID.
|
|
1182
|
+
* @param {string} attributeKey The selected block attribute key.
|
|
1183
|
+
* @param {number} startOffset The start offset.
|
|
1184
|
+
* @param {number} endOffset The end offset.
|
|
955
1185
|
*
|
|
956
1186
|
* @return {Object} Action object.
|
|
957
1187
|
*/
|
|
958
1188
|
|
|
959
1189
|
export function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
1190
|
+
if (typeof clientId === 'string') {
|
|
1191
|
+
return {
|
|
1192
|
+
type: 'SELECTION_CHANGE',
|
|
1193
|
+
clientId,
|
|
1194
|
+
attributeKey,
|
|
1195
|
+
startOffset,
|
|
1196
|
+
endOffset
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
|
|
960
1200
|
return {
|
|
961
1201
|
type: 'SELECTION_CHANGE',
|
|
962
|
-
clientId
|
|
963
|
-
attributeKey,
|
|
964
|
-
startOffset,
|
|
965
|
-
endOffset
|
|
1202
|
+
...clientId
|
|
966
1203
|
};
|
|
967
1204
|
}
|
|
968
1205
|
/**
|
|
@@ -974,10 +1211,10 @@ export function selectionChange(clientId, attributeKey, startOffset, endOffset)
|
|
|
974
1211
|
* @param {?number} index Optional index where to insert the default block.
|
|
975
1212
|
*/
|
|
976
1213
|
|
|
977
|
-
export const insertDefaultBlock = (attributes, rootClientId, index) =>
|
|
1214
|
+
export const insertDefaultBlock = (attributes, rootClientId, index) => _ref17 => {
|
|
978
1215
|
let {
|
|
979
1216
|
dispatch
|
|
980
|
-
} =
|
|
1217
|
+
} = _ref17;
|
|
981
1218
|
// Abort if there is no default block type (if it has been unregistered).
|
|
982
1219
|
const defaultBlockName = getDefaultBlockName();
|
|
983
1220
|
|
|
@@ -1066,10 +1303,10 @@ export function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
1066
1303
|
* selection changes have been recorded.
|
|
1067
1304
|
*/
|
|
1068
1305
|
|
|
1069
|
-
export const __unstableMarkAutomaticChange = () =>
|
|
1306
|
+
export const __unstableMarkAutomaticChange = () => _ref18 => {
|
|
1070
1307
|
let {
|
|
1071
1308
|
dispatch
|
|
1072
|
-
} =
|
|
1309
|
+
} = _ref18;
|
|
1073
1310
|
dispatch({
|
|
1074
1311
|
type: 'MARK_AUTOMATIC_CHANGE'
|
|
1075
1312
|
});
|
|
@@ -1090,10 +1327,10 @@ export const __unstableMarkAutomaticChange = () => _ref15 => {
|
|
|
1090
1327
|
|
|
1091
1328
|
export const setNavigationMode = function () {
|
|
1092
1329
|
let isNavigationMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1093
|
-
return
|
|
1330
|
+
return _ref19 => {
|
|
1094
1331
|
let {
|
|
1095
1332
|
dispatch
|
|
1096
|
-
} =
|
|
1333
|
+
} = _ref19;
|
|
1097
1334
|
dispatch({
|
|
1098
1335
|
type: 'SET_NAVIGATION_MODE',
|
|
1099
1336
|
isNavigationMode
|
|
@@ -1114,10 +1351,10 @@ export const setNavigationMode = function () {
|
|
|
1114
1351
|
|
|
1115
1352
|
export const setBlockMovingClientId = function () {
|
|
1116
1353
|
let hasBlockMovingClientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1117
|
-
return
|
|
1354
|
+
return _ref20 => {
|
|
1118
1355
|
let {
|
|
1119
1356
|
dispatch
|
|
1120
|
-
} =
|
|
1357
|
+
} = _ref20;
|
|
1121
1358
|
dispatch({
|
|
1122
1359
|
type: 'SET_BLOCK_MOVING_MODE',
|
|
1123
1360
|
hasBlockMovingClientId
|
|
@@ -1137,11 +1374,11 @@ export const setBlockMovingClientId = function () {
|
|
|
1137
1374
|
|
|
1138
1375
|
export const duplicateBlocks = function (clientIds) {
|
|
1139
1376
|
let updateSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1140
|
-
return
|
|
1377
|
+
return _ref21 => {
|
|
1141
1378
|
let {
|
|
1142
1379
|
select,
|
|
1143
1380
|
dispatch
|
|
1144
|
-
} =
|
|
1381
|
+
} = _ref21;
|
|
1145
1382
|
|
|
1146
1383
|
if (!clientIds || !clientIds.length) {
|
|
1147
1384
|
return;
|
|
@@ -1179,11 +1416,11 @@ export const duplicateBlocks = function (clientIds) {
|
|
|
1179
1416
|
* @param {string} clientId
|
|
1180
1417
|
*/
|
|
1181
1418
|
|
|
1182
|
-
export const insertBeforeBlock = clientId =>
|
|
1419
|
+
export const insertBeforeBlock = clientId => _ref22 => {
|
|
1183
1420
|
let {
|
|
1184
1421
|
select,
|
|
1185
1422
|
dispatch
|
|
1186
|
-
} =
|
|
1423
|
+
} = _ref22;
|
|
1187
1424
|
|
|
1188
1425
|
if (!clientId) {
|
|
1189
1426
|
return;
|
|
@@ -1205,11 +1442,11 @@ export const insertBeforeBlock = clientId => _ref19 => {
|
|
|
1205
1442
|
* @param {string} clientId
|
|
1206
1443
|
*/
|
|
1207
1444
|
|
|
1208
|
-
export const insertAfterBlock = clientId =>
|
|
1445
|
+
export const insertAfterBlock = clientId => _ref23 => {
|
|
1209
1446
|
let {
|
|
1210
1447
|
select,
|
|
1211
1448
|
dispatch
|
|
1212
|
-
} =
|
|
1449
|
+
} = _ref23;
|
|
1213
1450
|
|
|
1214
1451
|
if (!clientId) {
|
|
1215
1452
|
return;
|
|
@@ -1245,10 +1482,10 @@ export function toggleBlockHighlight(clientId, isHighlighted) {
|
|
|
1245
1482
|
* @param {string} clientId Target block client ID.
|
|
1246
1483
|
*/
|
|
1247
1484
|
|
|
1248
|
-
export const flashBlock = clientId => async
|
|
1485
|
+
export const flashBlock = clientId => async _ref24 => {
|
|
1249
1486
|
let {
|
|
1250
1487
|
dispatch
|
|
1251
|
-
} =
|
|
1488
|
+
} = _ref24;
|
|
1252
1489
|
dispatch(toggleBlockHighlight(clientId, true));
|
|
1253
1490
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
1254
1491
|
dispatch(toggleBlockHighlight(clientId, false));
|