@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
package/build/store/actions.js
CHANGED
|
@@ -5,10 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.__unstableMarkAutomaticChange = void 0;
|
|
8
|
+
exports.__unstableMarkAutomaticChange = exports.__unstableExpandSelection = exports.__unstableDeleteSelection = void 0;
|
|
9
9
|
exports.__unstableMarkLastChangeAsPersistent = __unstableMarkLastChangeAsPersistent;
|
|
10
10
|
exports.__unstableMarkNextChangeAsNotPersistent = __unstableMarkNextChangeAsNotPersistent;
|
|
11
11
|
exports.__unstableSaveReusableBlock = __unstableSaveReusableBlock;
|
|
12
|
+
exports.__unstableSplitSelection = void 0;
|
|
12
13
|
exports.clearSelectedBlock = clearSelectedBlock;
|
|
13
14
|
exports.duplicateBlocks = void 0;
|
|
14
15
|
exports.enterFormattedText = enterFormattedText;
|
|
@@ -163,6 +164,15 @@ const validateBlocksToTemplate = blocks => _ref3 => {
|
|
|
163
164
|
* text value. See `wp.richText.create`.
|
|
164
165
|
*/
|
|
165
166
|
|
|
167
|
+
/**
|
|
168
|
+
* A selection object.
|
|
169
|
+
*
|
|
170
|
+
* @typedef {Object} WPSelection
|
|
171
|
+
*
|
|
172
|
+
* @property {WPBlockSelection} start The selection start.
|
|
173
|
+
* @property {WPBlockSelection} end The selection end.
|
|
174
|
+
*/
|
|
175
|
+
|
|
166
176
|
/* eslint-disable jsdoc/valid-types */
|
|
167
177
|
|
|
168
178
|
/**
|
|
@@ -690,7 +700,7 @@ const insertBlocks = function (blocks, index, rootClientId) {
|
|
|
690
700
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
691
701
|
* which to insert.
|
|
692
702
|
* @param {?number} index Index at which block should be inserted.
|
|
693
|
-
* @param {Object} __unstableOptions
|
|
703
|
+
* @param {Object} __unstableOptions Whether or not to show an inserter button.
|
|
694
704
|
*
|
|
695
705
|
* @return {Object} Action object.
|
|
696
706
|
*/
|
|
@@ -758,6 +768,251 @@ const synchronizeTemplate = () => _ref11 => {
|
|
|
758
768
|
const updatedBlockList = (0, _blocks.synchronizeBlocksWithTemplate)(blocks, template);
|
|
759
769
|
dispatch.resetBlocks(updatedBlockList);
|
|
760
770
|
};
|
|
771
|
+
|
|
772
|
+
exports.synchronizeTemplate = synchronizeTemplate;
|
|
773
|
+
|
|
774
|
+
function mapRichTextSettings(attributeDefinition) {
|
|
775
|
+
const {
|
|
776
|
+
multiline: multilineTag,
|
|
777
|
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
778
|
+
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
779
|
+
} = attributeDefinition;
|
|
780
|
+
return {
|
|
781
|
+
multilineTag,
|
|
782
|
+
multilineWrapperTags,
|
|
783
|
+
preserveWhiteSpace
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Delete the current selection.
|
|
788
|
+
*
|
|
789
|
+
* @param {boolean} isForward
|
|
790
|
+
*/
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
const __unstableDeleteSelection = isForward => _ref12 => {
|
|
794
|
+
let {
|
|
795
|
+
registry,
|
|
796
|
+
select,
|
|
797
|
+
dispatch
|
|
798
|
+
} = _ref12;
|
|
799
|
+
const selectionAnchor = select.getSelectionStart();
|
|
800
|
+
const selectionFocus = select.getSelectionEnd();
|
|
801
|
+
if (selectionAnchor.clientId === selectionFocus.clientId) return; // It's not mergeable if there's no rich text selection.
|
|
802
|
+
|
|
803
|
+
if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return false;
|
|
804
|
+
const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
|
|
805
|
+
const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not mergeable if the selection doesn't start and end in the same
|
|
806
|
+
// block list. Maybe in the future it should be allowed.
|
|
807
|
+
|
|
808
|
+
if (anchorRootClientId !== focusRootClientId) {
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
const blockOrder = select.getBlockOrder(anchorRootClientId);
|
|
813
|
+
const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
|
|
814
|
+
const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
|
|
815
|
+
|
|
816
|
+
let selectionStart, selectionEnd;
|
|
817
|
+
|
|
818
|
+
if (anchorIndex > focusIndex) {
|
|
819
|
+
selectionStart = selectionFocus;
|
|
820
|
+
selectionEnd = selectionAnchor;
|
|
821
|
+
} else {
|
|
822
|
+
selectionStart = selectionAnchor;
|
|
823
|
+
selectionEnd = selectionFocus;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
const targetSelection = isForward ? selectionEnd : selectionStart;
|
|
827
|
+
const targetBlock = select.getBlock(targetSelection.clientId);
|
|
828
|
+
const targetBlockType = (0, _blocks.getBlockType)(targetBlock.name);
|
|
829
|
+
|
|
830
|
+
if (!targetBlockType.merge) {
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const selectionA = selectionStart;
|
|
835
|
+
const selectionB = selectionEnd;
|
|
836
|
+
const blockA = select.getBlock(selectionA.clientId);
|
|
837
|
+
const blockAType = (0, _blocks.getBlockType)(blockA.name);
|
|
838
|
+
const blockB = select.getBlock(selectionB.clientId);
|
|
839
|
+
const blockBType = (0, _blocks.getBlockType)(blockB.name);
|
|
840
|
+
const htmlA = blockA.attributes[selectionA.attributeKey];
|
|
841
|
+
const htmlB = blockB.attributes[selectionB.attributeKey];
|
|
842
|
+
const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
|
|
843
|
+
const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
|
|
844
|
+
let valueA = (0, _richText.create)({
|
|
845
|
+
html: htmlA,
|
|
846
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
847
|
+
});
|
|
848
|
+
let valueB = (0, _richText.create)({
|
|
849
|
+
html: htmlB,
|
|
850
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
851
|
+
}); // A robust way to retain selection position through various transforms
|
|
852
|
+
// is to insert a special character at the position and then recover it.
|
|
853
|
+
|
|
854
|
+
const START_OF_SELECTED_AREA = '\u0086';
|
|
855
|
+
valueA = (0, _richText.remove)(valueA, selectionA.offset, valueA.text.length);
|
|
856
|
+
valueB = (0, _richText.insert)(valueB, START_OF_SELECTED_AREA, 0, selectionB.offset); // Clone the blocks so we don't manipulate the original.
|
|
857
|
+
|
|
858
|
+
const cloneA = (0, _blocks.cloneBlock)(blockA, {
|
|
859
|
+
[selectionA.attributeKey]: (0, _richText.toHTMLString)({
|
|
860
|
+
value: valueA,
|
|
861
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
862
|
+
})
|
|
863
|
+
});
|
|
864
|
+
const cloneB = (0, _blocks.cloneBlock)(blockB, {
|
|
865
|
+
[selectionB.attributeKey]: (0, _richText.toHTMLString)({
|
|
866
|
+
value: valueB,
|
|
867
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
868
|
+
})
|
|
869
|
+
});
|
|
870
|
+
const followingBlock = isForward ? cloneA : cloneB; // We can only merge blocks with similar types
|
|
871
|
+
// thus, we transform the block to merge first
|
|
872
|
+
|
|
873
|
+
const blocksWithTheSameType = blockA.name === blockB.name ? [followingBlock] : (0, _blocks.switchToBlockType)(followingBlock, targetBlockType.name); // If the block types can not match, do nothing
|
|
874
|
+
|
|
875
|
+
if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
let updatedAttributes;
|
|
880
|
+
|
|
881
|
+
if (isForward) {
|
|
882
|
+
const blockToMerge = blocksWithTheSameType.pop();
|
|
883
|
+
updatedAttributes = targetBlockType.merge(blockToMerge.attributes, cloneB.attributes);
|
|
884
|
+
} else {
|
|
885
|
+
const blockToMerge = blocksWithTheSameType.shift();
|
|
886
|
+
updatedAttributes = targetBlockType.merge(cloneA.attributes, blockToMerge.attributes);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const newAttributeKey = (0, _lodash.findKey)(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
|
890
|
+
const convertedHtml = updatedAttributes[newAttributeKey];
|
|
891
|
+
const convertedValue = (0, _richText.create)({
|
|
892
|
+
html: convertedHtml,
|
|
893
|
+
...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
|
|
894
|
+
});
|
|
895
|
+
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
|
896
|
+
const newValue = (0, _richText.remove)(convertedValue, newOffset, newOffset + 1);
|
|
897
|
+
const newHtml = (0, _richText.toHTMLString)({
|
|
898
|
+
value: newValue,
|
|
899
|
+
...mapRichTextSettings(targetBlockType.attributes[newAttributeKey])
|
|
900
|
+
});
|
|
901
|
+
updatedAttributes[newAttributeKey] = newHtml;
|
|
902
|
+
const selectedBlockClientIds = select.getSelectedBlockClientIds();
|
|
903
|
+
const replacement = [...(isForward ? blocksWithTheSameType : []), { // Preserve the original client ID.
|
|
904
|
+
...targetBlock,
|
|
905
|
+
attributes: { ...targetBlock.attributes,
|
|
906
|
+
...updatedAttributes
|
|
907
|
+
}
|
|
908
|
+
}, ...(isForward ? [] : blocksWithTheSameType)];
|
|
909
|
+
registry.batch(() => {
|
|
910
|
+
dispatch.selectionChange(targetBlock.clientId, newAttributeKey, newOffset, newOffset);
|
|
911
|
+
dispatch.replaceBlocks(selectedBlockClientIds, replacement, 0, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
912
|
+
select.getSelectedBlocksInitialCaretPosition());
|
|
913
|
+
});
|
|
914
|
+
};
|
|
915
|
+
/**
|
|
916
|
+
* Split the current selection.
|
|
917
|
+
*/
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
exports.__unstableDeleteSelection = __unstableDeleteSelection;
|
|
921
|
+
|
|
922
|
+
const __unstableSplitSelection = () => _ref13 => {
|
|
923
|
+
let {
|
|
924
|
+
select,
|
|
925
|
+
dispatch
|
|
926
|
+
} = _ref13;
|
|
927
|
+
const selectionAnchor = select.getSelectionStart();
|
|
928
|
+
const selectionFocus = select.getSelectionEnd();
|
|
929
|
+
if (selectionAnchor.clientId === selectionFocus.clientId) return; // Can't split if the selection is not set.
|
|
930
|
+
|
|
931
|
+
if (!selectionAnchor.attributeKey || !selectionFocus.attributeKey || typeof selectionAnchor.offset === 'undefined' || typeof selectionFocus.offset === 'undefined') return;
|
|
932
|
+
const anchorRootClientId = select.getBlockRootClientId(selectionAnchor.clientId);
|
|
933
|
+
const focusRootClientId = select.getBlockRootClientId(selectionFocus.clientId); // It's not splittable if the selection doesn't start and end in the same
|
|
934
|
+
// block list. Maybe in the future it should be allowed.
|
|
935
|
+
|
|
936
|
+
if (anchorRootClientId !== focusRootClientId) {
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
const blockOrder = select.getBlockOrder(anchorRootClientId);
|
|
941
|
+
const anchorIndex = blockOrder.indexOf(selectionAnchor.clientId);
|
|
942
|
+
const focusIndex = blockOrder.indexOf(selectionFocus.clientId); // Reassign selection start and end based on order.
|
|
943
|
+
|
|
944
|
+
let selectionStart, selectionEnd;
|
|
945
|
+
|
|
946
|
+
if (anchorIndex > focusIndex) {
|
|
947
|
+
selectionStart = selectionFocus;
|
|
948
|
+
selectionEnd = selectionAnchor;
|
|
949
|
+
} else {
|
|
950
|
+
selectionStart = selectionAnchor;
|
|
951
|
+
selectionEnd = selectionFocus;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
const selectionA = selectionStart;
|
|
955
|
+
const selectionB = selectionEnd;
|
|
956
|
+
const blockA = select.getBlock(selectionA.clientId);
|
|
957
|
+
const blockAType = (0, _blocks.getBlockType)(blockA.name);
|
|
958
|
+
const blockB = select.getBlock(selectionB.clientId);
|
|
959
|
+
const blockBType = (0, _blocks.getBlockType)(blockB.name);
|
|
960
|
+
const htmlA = blockA.attributes[selectionA.attributeKey];
|
|
961
|
+
const htmlB = blockB.attributes[selectionB.attributeKey];
|
|
962
|
+
const attributeDefinitionA = blockAType.attributes[selectionA.attributeKey];
|
|
963
|
+
const attributeDefinitionB = blockBType.attributes[selectionB.attributeKey];
|
|
964
|
+
let valueA = (0, _richText.create)({
|
|
965
|
+
html: htmlA,
|
|
966
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
967
|
+
});
|
|
968
|
+
let valueB = (0, _richText.create)({
|
|
969
|
+
html: htmlB,
|
|
970
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
971
|
+
});
|
|
972
|
+
valueA = (0, _richText.remove)(valueA, selectionA.offset, valueA.text.length);
|
|
973
|
+
valueB = (0, _richText.remove)(valueB, 0, selectionB.offset);
|
|
974
|
+
dispatch.replaceBlocks(select.getSelectedBlockClientIds(), [{ // Preserve the original client ID.
|
|
975
|
+
...blockA,
|
|
976
|
+
attributes: { ...blockA.attributes,
|
|
977
|
+
[selectionA.attributeKey]: (0, _richText.toHTMLString)({
|
|
978
|
+
value: valueA,
|
|
979
|
+
...mapRichTextSettings(attributeDefinitionA)
|
|
980
|
+
})
|
|
981
|
+
}
|
|
982
|
+
}, (0, _blocks.createBlock)((0, _blocks.getDefaultBlockName)()), { // Preserve the original client ID.
|
|
983
|
+
...blockB,
|
|
984
|
+
attributes: { ...blockB.attributes,
|
|
985
|
+
[selectionB.attributeKey]: (0, _richText.toHTMLString)({
|
|
986
|
+
value: valueB,
|
|
987
|
+
...mapRichTextSettings(attributeDefinitionB)
|
|
988
|
+
})
|
|
989
|
+
}
|
|
990
|
+
}], 1, // If we don't pass the `indexToSelect` it will default to the last block.
|
|
991
|
+
select.getSelectedBlocksInitialCaretPosition());
|
|
992
|
+
};
|
|
993
|
+
/**
|
|
994
|
+
* Expand the selection to cover the entire blocks, removing partial selection.
|
|
995
|
+
*/
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
exports.__unstableSplitSelection = __unstableSplitSelection;
|
|
999
|
+
|
|
1000
|
+
const __unstableExpandSelection = () => _ref14 => {
|
|
1001
|
+
let {
|
|
1002
|
+
select,
|
|
1003
|
+
dispatch
|
|
1004
|
+
} = _ref14;
|
|
1005
|
+
const selectionAnchor = select.getSelectionStart();
|
|
1006
|
+
const selectionFocus = select.getSelectionEnd();
|
|
1007
|
+
dispatch.selectionChange({
|
|
1008
|
+
start: {
|
|
1009
|
+
clientId: selectionAnchor.clientId
|
|
1010
|
+
},
|
|
1011
|
+
end: {
|
|
1012
|
+
clientId: selectionFocus.clientId
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
};
|
|
761
1016
|
/**
|
|
762
1017
|
* Action that merges two blocks.
|
|
763
1018
|
*
|
|
@@ -766,13 +1021,13 @@ const synchronizeTemplate = () => _ref11 => {
|
|
|
766
1021
|
*/
|
|
767
1022
|
|
|
768
1023
|
|
|
769
|
-
exports.
|
|
1024
|
+
exports.__unstableExpandSelection = __unstableExpandSelection;
|
|
770
1025
|
|
|
771
|
-
const mergeBlocks = (firstBlockClientId, secondBlockClientId) =>
|
|
1026
|
+
const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref15 => {
|
|
772
1027
|
let {
|
|
773
1028
|
select,
|
|
774
1029
|
dispatch
|
|
775
|
-
} =
|
|
1030
|
+
} = _ref15;
|
|
776
1031
|
const blocks = [firstBlockClientId, secondBlockClientId];
|
|
777
1032
|
dispatch({
|
|
778
1033
|
type: 'MERGE_BLOCKS',
|
|
@@ -820,21 +1075,13 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 => {
|
|
|
820
1075
|
if (canRestoreTextSelection) {
|
|
821
1076
|
const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
|
|
822
1077
|
const html = selectedBlock.attributes[attributeKey];
|
|
823
|
-
const {
|
|
824
|
-
multiline: multilineTag,
|
|
825
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
826
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
827
|
-
} = attributeDefinition;
|
|
828
1078
|
const value = (0, _richText.insert)((0, _richText.create)({
|
|
829
1079
|
html,
|
|
830
|
-
|
|
831
|
-
multilineWrapperTags,
|
|
832
|
-
preserveWhiteSpace
|
|
1080
|
+
...mapRichTextSettings(attributeDefinition)
|
|
833
1081
|
}), START_OF_SELECTED_AREA, offset, offset);
|
|
834
1082
|
selectedBlock.attributes[attributeKey] = (0, _richText.toHTMLString)({
|
|
835
1083
|
value,
|
|
836
|
-
|
|
837
|
-
preserveWhiteSpace
|
|
1084
|
+
...mapRichTextSettings(attributeDefinition)
|
|
838
1085
|
});
|
|
839
1086
|
} // We can only merge blocks with similar types
|
|
840
1087
|
// thus, we transform the block to merge first.
|
|
@@ -852,23 +1099,15 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 => {
|
|
|
852
1099
|
if (canRestoreTextSelection) {
|
|
853
1100
|
const newAttributeKey = (0, _lodash.findKey)(updatedAttributes, v => typeof v === 'string' && v.indexOf(START_OF_SELECTED_AREA) !== -1);
|
|
854
1101
|
const convertedHtml = updatedAttributes[newAttributeKey];
|
|
855
|
-
const {
|
|
856
|
-
multiline: multilineTag,
|
|
857
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
858
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
859
|
-
} = blockAType.attributes[newAttributeKey];
|
|
860
1102
|
const convertedValue = (0, _richText.create)({
|
|
861
1103
|
html: convertedHtml,
|
|
862
|
-
|
|
863
|
-
multilineWrapperTags,
|
|
864
|
-
preserveWhiteSpace
|
|
1104
|
+
...mapRichTextSettings(blockAType.attributes[newAttributeKey])
|
|
865
1105
|
});
|
|
866
1106
|
const newOffset = convertedValue.text.indexOf(START_OF_SELECTED_AREA);
|
|
867
1107
|
const newValue = (0, _richText.remove)(convertedValue, newOffset, newOffset + 1);
|
|
868
1108
|
const newHtml = (0, _richText.toHTMLString)({
|
|
869
1109
|
value: newValue,
|
|
870
|
-
|
|
871
|
-
preserveWhiteSpace
|
|
1110
|
+
...mapRichTextSettings(blockAType.attributes[newAttributeKey])
|
|
872
1111
|
});
|
|
873
1112
|
updatedAttributes[newAttributeKey] = newHtml;
|
|
874
1113
|
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
|
@@ -895,11 +1134,11 @@ exports.mergeBlocks = mergeBlocks;
|
|
|
895
1134
|
|
|
896
1135
|
const removeBlocks = function (clientIds) {
|
|
897
1136
|
let selectPrevious = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
898
|
-
return
|
|
1137
|
+
return _ref16 => {
|
|
899
1138
|
let {
|
|
900
1139
|
select,
|
|
901
1140
|
dispatch
|
|
902
|
-
} =
|
|
1141
|
+
} = _ref16;
|
|
903
1142
|
|
|
904
1143
|
if (!clientIds || !clientIds.length) {
|
|
905
1144
|
return;
|
|
@@ -1066,22 +1305,29 @@ function exitFormattedText() {
|
|
|
1066
1305
|
/**
|
|
1067
1306
|
* Action that changes the position of the user caret.
|
|
1068
1307
|
*
|
|
1069
|
-
* @param {string} clientId The selected block client ID.
|
|
1070
|
-
* @param {string}
|
|
1071
|
-
* @param {number}
|
|
1072
|
-
* @param {number}
|
|
1308
|
+
* @param {string|WPSelection} clientId The selected block client ID.
|
|
1309
|
+
* @param {string} attributeKey The selected block attribute key.
|
|
1310
|
+
* @param {number} startOffset The start offset.
|
|
1311
|
+
* @param {number} endOffset The end offset.
|
|
1073
1312
|
*
|
|
1074
1313
|
* @return {Object} Action object.
|
|
1075
1314
|
*/
|
|
1076
1315
|
|
|
1077
1316
|
|
|
1078
1317
|
function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
1318
|
+
if (typeof clientId === 'string') {
|
|
1319
|
+
return {
|
|
1320
|
+
type: 'SELECTION_CHANGE',
|
|
1321
|
+
clientId,
|
|
1322
|
+
attributeKey,
|
|
1323
|
+
startOffset,
|
|
1324
|
+
endOffset
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1079
1328
|
return {
|
|
1080
1329
|
type: 'SELECTION_CHANGE',
|
|
1081
|
-
clientId
|
|
1082
|
-
attributeKey,
|
|
1083
|
-
startOffset,
|
|
1084
|
-
endOffset
|
|
1330
|
+
...clientId
|
|
1085
1331
|
};
|
|
1086
1332
|
}
|
|
1087
1333
|
/**
|
|
@@ -1094,10 +1340,10 @@ function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
|
1094
1340
|
*/
|
|
1095
1341
|
|
|
1096
1342
|
|
|
1097
|
-
const insertDefaultBlock = (attributes, rootClientId, index) =>
|
|
1343
|
+
const insertDefaultBlock = (attributes, rootClientId, index) => _ref17 => {
|
|
1098
1344
|
let {
|
|
1099
1345
|
dispatch
|
|
1100
|
-
} =
|
|
1346
|
+
} = _ref17;
|
|
1101
1347
|
// Abort if there is no default block type (if it has been unregistered).
|
|
1102
1348
|
const defaultBlockName = (0, _blocks.getDefaultBlockName)();
|
|
1103
1349
|
|
|
@@ -1194,10 +1440,10 @@ function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
1194
1440
|
*/
|
|
1195
1441
|
|
|
1196
1442
|
|
|
1197
|
-
const __unstableMarkAutomaticChange = () =>
|
|
1443
|
+
const __unstableMarkAutomaticChange = () => _ref18 => {
|
|
1198
1444
|
let {
|
|
1199
1445
|
dispatch
|
|
1200
|
-
} =
|
|
1446
|
+
} = _ref18;
|
|
1201
1447
|
dispatch({
|
|
1202
1448
|
type: 'MARK_AUTOMATIC_CHANGE'
|
|
1203
1449
|
});
|
|
@@ -1221,10 +1467,10 @@ exports.__unstableMarkAutomaticChange = __unstableMarkAutomaticChange;
|
|
|
1221
1467
|
|
|
1222
1468
|
const setNavigationMode = function () {
|
|
1223
1469
|
let isNavigationMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1224
|
-
return
|
|
1470
|
+
return _ref19 => {
|
|
1225
1471
|
let {
|
|
1226
1472
|
dispatch
|
|
1227
|
-
} =
|
|
1473
|
+
} = _ref19;
|
|
1228
1474
|
dispatch({
|
|
1229
1475
|
type: 'SET_NAVIGATION_MODE',
|
|
1230
1476
|
isNavigationMode
|
|
@@ -1248,10 +1494,10 @@ exports.setNavigationMode = setNavigationMode;
|
|
|
1248
1494
|
|
|
1249
1495
|
const setBlockMovingClientId = function () {
|
|
1250
1496
|
let hasBlockMovingClientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1251
|
-
return
|
|
1497
|
+
return _ref20 => {
|
|
1252
1498
|
let {
|
|
1253
1499
|
dispatch
|
|
1254
|
-
} =
|
|
1500
|
+
} = _ref20;
|
|
1255
1501
|
dispatch({
|
|
1256
1502
|
type: 'SET_BLOCK_MOVING_MODE',
|
|
1257
1503
|
hasBlockMovingClientId
|
|
@@ -1274,11 +1520,11 @@ exports.setBlockMovingClientId = setBlockMovingClientId;
|
|
|
1274
1520
|
|
|
1275
1521
|
const duplicateBlocks = function (clientIds) {
|
|
1276
1522
|
let updateSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1277
|
-
return
|
|
1523
|
+
return _ref21 => {
|
|
1278
1524
|
let {
|
|
1279
1525
|
select,
|
|
1280
1526
|
dispatch
|
|
1281
|
-
} =
|
|
1527
|
+
} = _ref21;
|
|
1282
1528
|
|
|
1283
1529
|
if (!clientIds || !clientIds.length) {
|
|
1284
1530
|
return;
|
|
@@ -1319,11 +1565,11 @@ const duplicateBlocks = function (clientIds) {
|
|
|
1319
1565
|
|
|
1320
1566
|
exports.duplicateBlocks = duplicateBlocks;
|
|
1321
1567
|
|
|
1322
|
-
const insertBeforeBlock = clientId =>
|
|
1568
|
+
const insertBeforeBlock = clientId => _ref22 => {
|
|
1323
1569
|
let {
|
|
1324
1570
|
select,
|
|
1325
1571
|
dispatch
|
|
1326
|
-
} =
|
|
1572
|
+
} = _ref22;
|
|
1327
1573
|
|
|
1328
1574
|
if (!clientId) {
|
|
1329
1575
|
return;
|
|
@@ -1348,11 +1594,11 @@ const insertBeforeBlock = clientId => _ref19 => {
|
|
|
1348
1594
|
|
|
1349
1595
|
exports.insertBeforeBlock = insertBeforeBlock;
|
|
1350
1596
|
|
|
1351
|
-
const insertAfterBlock = clientId =>
|
|
1597
|
+
const insertAfterBlock = clientId => _ref23 => {
|
|
1352
1598
|
let {
|
|
1353
1599
|
select,
|
|
1354
1600
|
dispatch
|
|
1355
|
-
} =
|
|
1601
|
+
} = _ref23;
|
|
1356
1602
|
|
|
1357
1603
|
if (!clientId) {
|
|
1358
1604
|
return;
|
|
@@ -1392,10 +1638,10 @@ function toggleBlockHighlight(clientId, isHighlighted) {
|
|
|
1392
1638
|
*/
|
|
1393
1639
|
|
|
1394
1640
|
|
|
1395
|
-
const flashBlock = clientId => async
|
|
1641
|
+
const flashBlock = clientId => async _ref24 => {
|
|
1396
1642
|
let {
|
|
1397
1643
|
dispatch
|
|
1398
|
-
} =
|
|
1644
|
+
} = _ref24;
|
|
1399
1645
|
dispatch(toggleBlockHighlight(clientId, true));
|
|
1400
1646
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
1401
1647
|
dispatch(toggleBlockHighlight(clientId, false));
|