@wordpress/block-editor 7.0.2 → 8.0.1
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 +11 -0
- package/README.md +45 -1
- package/build/components/autocomplete/index.js +1 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +8 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +61 -14
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-controls/fill.js +2 -2
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -3
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +9 -11
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +8 -0
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +12 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +4 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/index.js +4 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +4 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +3 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-tools/block-popover.js +2 -4
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +11 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +22 -57
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +18 -12
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/copy-handler/index.js +9 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/duotone-control/index.js +41 -39
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editor-styles/index.js +9 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +32 -21
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +6 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build/components/image-editor/constants.js +16 -0
- package/build/components/image-editor/constants.js.map +1 -0
- package/build/components/image-editor/context.js +59 -0
- package/build/components/image-editor/context.js.map +1 -0
- package/build/components/image-editor/cropper.js +83 -0
- package/build/components/image-editor/cropper.js.map +1 -0
- package/build/components/image-editor/form-controls.js +36 -0
- package/build/components/image-editor/form-controls.js.map +1 -0
- package/build/components/image-editor/index.js +60 -0
- package/build/components/image-editor/index.js.map +1 -0
- package/build/components/image-editor/rotation-button.js +37 -0
- package/build/components/image-editor/rotation-button.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +84 -0
- package/build/components/image-editor/use-save-image.js.map +1 -0
- package/build/components/image-editor/use-transform-image.js +135 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -0
- package/build/components/image-editor/zoom-dropdown.js +55 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build/components/image-size-control/use-dimension-handler.js +14 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +36 -20
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +11 -1
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +8 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +4 -3
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +3 -11
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/index.js +12 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +11 -15
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +6 -11
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +44 -0
- package/build/components/inserter/utils.native.js.map +1 -0
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build/components/inspector-controls/fill.js +16 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +15 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +93 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +45 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +25 -7
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +54 -69
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +102 -76
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +45 -20
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +13 -54
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.js +29 -20
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +1 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +66 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +32 -11
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +41 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +28 -9
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-input/index.js +25 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +13 -10
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +48 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +6 -0
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +13 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +5 -2
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +23 -27
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +60 -16
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +123 -32
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +2 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +10 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/letter-spacing.js +44 -7
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +43 -0
- package/build/hooks/lock.js.map +1 -0
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +7 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +108 -8
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +160 -34
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +75 -8
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +323 -265
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.native.js +13 -1
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +33 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +172 -38
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +10 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +51 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +8 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +64 -17
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-controls/fill.js +2 -2
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/hook.js +3 -3
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-icon/index.native.js +10 -11
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +8 -0
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +12 -5
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +4 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +4 -4
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +3 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +3 -5
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +26 -63
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +13 -10
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/copy-handler/index.js +9 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +43 -39
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +7 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -21
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build-module/components/image-editor/constants.js +7 -0
- package/build-module/components/image-editor/constants.js.map +1 -0
- package/build-module/components/image-editor/context.js +44 -0
- package/build-module/components/image-editor/context.js.map +1 -0
- package/build-module/components/image-editor/cropper.js +69 -0
- package/build-module/components/image-editor/cropper.js.map +1 -0
- package/build-module/components/image-editor/form-controls.js +26 -0
- package/build-module/components/image-editor/form-controls.js.map +1 -0
- package/build-module/components/image-editor/index.js +37 -0
- package/build-module/components/image-editor/index.js.map +1 -0
- package/build-module/components/image-editor/rotation-button.js +26 -0
- package/build-module/components/image-editor/rotation-button.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +70 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -0
- package/build-module/components/image-editor/use-transform-image.js +127 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js +43 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +4 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +10 -1
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -6
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -36
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +2 -10
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/index.js +12 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +10 -15
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +5 -10
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +35 -0
- package/build-module/components/inserter/utils.native.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build-module/components/inspector-controls/fill.js +16 -2
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +13 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +93 -35
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +46 -17
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +24 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +56 -71
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +102 -78
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +48 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +29 -20
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +1 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +29 -11
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +41 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +28 -9
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-input/index.js +25 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +13 -10
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +6 -0
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +10 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +13 -10
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +6 -3
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +24 -27
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +59 -16
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +117 -33
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +2 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +2 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +40 -7
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +33 -0
- package/build-module/hooks/lock.js.map +1 -0
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +7 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +117 -17
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +163 -38
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +74 -8
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -241
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.native.js +12 -1
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +33 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +160 -34
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +48 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +267 -144
- package/build-style/style.css +267 -144
- package/package.json +28 -27
- package/src/components/autocomplete/index.js +5 -2
- package/src/components/block-actions/index.js +9 -5
- package/src/components/block-alignment-control/style.scss +5 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
- package/src/components/block-alignment-control/test/index.native.js +37 -0
- package/src/components/block-alignment-control/ui.js +98 -27
- package/src/components/block-alignment-control/use-available-alignments.js +31 -10
- package/src/components/block-controls/fill.js +5 -2
- package/src/components/block-controls/hook.js +3 -3
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +10 -16
- package/src/components/block-inspector/index.js +10 -0
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block.js +11 -3
- package/src/components/block-list/block.native.js +5 -3
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-mover/index.js +4 -4
- package/src/components/block-mover/index.native.js +4 -4
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
- package/src/components/block-mover/test/index.native.js +26 -28
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/style.scss +0 -17
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-switcher/index.js +7 -3
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-switcher/test/index.js +3 -0
- package/src/components/block-title/index.js +5 -2
- package/src/components/block-tools/block-popover.js +3 -5
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
- package/src/components/colors/test/utils.js +41 -0
- package/src/components/colors/utils.js +9 -5
- package/src/components/colors-gradients/control.js +70 -110
- package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
- package/src/components/colors-gradients/style.scss +10 -18
- package/src/components/colors-gradients/test/control.js +41 -66
- package/src/components/contrast-checker/index.js +14 -10
- package/src/components/copy-handler/index.js +6 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/duotone-control/index.js +49 -41
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/editor-styles/index.js +7 -4
- package/src/components/font-appearance-control/index.js +41 -33
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/iframe/index.js +4 -4
- package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
- package/src/components/image-editor/constants.js +6 -0
- package/src/components/image-editor/context.js +56 -0
- package/src/components/image-editor/cropper.js +74 -0
- package/src/components/image-editor/form-controls.js +22 -0
- package/src/components/image-editor/index.js +52 -0
- package/src/components/image-editor/rotation-button.js +24 -0
- package/src/components/image-editor/use-save-image.js +97 -0
- package/src/components/image-editor/use-transform-image.js +162 -0
- package/src/components/image-editor/zoom-dropdown.js +40 -0
- package/src/components/image-size-control/use-dimension-handler.js +18 -1
- package/src/components/index.js +7 -6
- package/src/components/index.native.js +1 -4
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +8 -4
- package/src/components/inner-blocks/index.native.js +7 -4
- package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -73
- package/src/components/inserter/block-types-tab.native.js +3 -15
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/index.js +15 -3
- package/src/components/inserter/index.native.js +2 -19
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +4 -1
- package/src/components/inserter/menu.native.js +9 -14
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
- package/src/components/inserter/search-results.native.js +5 -15
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/test/block-types-tab.native.js +1 -1
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inserter/utils.native.js +35 -0
- package/src/components/inserter-list-item/style.scss +4 -2
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
- package/src/components/inspector-controls/fill.js +23 -2
- package/src/components/inspector-controls/groups.js +8 -0
- package/src/components/inspector-controls/slot.js +15 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/link-control/README.md +47 -14
- package/src/components/link-control/index.js +102 -31
- package/src/components/link-control/link-preview.js +53 -20
- package/src/components/link-control/search-input.js +21 -7
- package/src/components/link-control/style.scss +66 -19
- package/src/components/link-control/test/index.js +311 -4
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +73 -84
- package/src/components/list-view/branch.js +123 -94
- package/src/components/list-view/index.js +82 -30
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +70 -33
- package/src/components/list-view/use-list-view-client-ids.js +9 -68
- package/src/components/media-placeholder/index.js +26 -19
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-upload/README.md +1 -1
- package/src/components/navigable-toolbar/index.js +1 -4
- package/src/components/observe-typing/index.js +3 -2
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +68 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +25 -6
- package/src/components/rich-text/index.js +12 -8
- package/src/components/rich-text/index.native.js +35 -1
- package/src/components/rich-text/use-paste-handler.js +30 -12
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-moving-animation/index.js +9 -8
- package/src/components/use-on-block-drop/index.js +5 -1
- package/src/components/use-setting/index.js +49 -11
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +17 -3
- package/src/hooks/align.js +19 -10
- package/src/hooks/anchor.js +2 -2
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +7 -4
- package/src/hooks/dimensions.js +48 -59
- package/src/hooks/duotone.js +68 -19
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +129 -33
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/gap.js +2 -1
- package/src/hooks/index.js +2 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +35 -7
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +1 -1
- package/src/hooks/padding.js +1 -1
- package/src/hooks/style.js +15 -11
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +165 -15
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +179 -50
- package/src/layouts/flow.js +54 -8
- package/src/store/actions.js +239 -377
- package/src/store/defaults.native.js +12 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +54 -18
- package/src/store/selectors.js +173 -47
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +22 -54
- package/src/store/test/selectors.js +79 -21
- package/src/style.scss +2 -1
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +43 -1
- package/src/utils/test/parse-css-unit-to-px.js +148 -165
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/duotone-control/duotone-picker-popover.js +0 -44
- package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
- package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/store/controls.js +0 -39
|
@@ -9,56 +9,57 @@ import { castArray, findKey, first, isObject, last, some } from 'lodash';
|
|
|
9
9
|
import { cloneBlock, __experimentalCloneSanitizedBlock, createBlock, doBlocksMatchTemplate, getBlockType, getDefaultBlockName, hasBlockSupport, switchToBlockType, synchronizeBlocksWithTemplate } from '@wordpress/blocks';
|
|
10
10
|
import { speak } from '@wordpress/a11y';
|
|
11
11
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
12
|
-
import { controls } from '@wordpress/data';
|
|
13
12
|
import { create, insert, remove, toHTMLString } from '@wordpress/rich-text';
|
|
14
13
|
import deprecated from '@wordpress/deprecated';
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import { __unstableMarkAutomaticChangeFinalControl } from '../store/controls';
|
|
20
|
-
import { STORE_NAME as blockEditorStoreName } from './constants';
|
|
21
|
-
/**
|
|
22
|
-
* Generator which will yield a default block insert action if there
|
|
23
|
-
* are no other blocks at the root of the editor. This generator should be used
|
|
15
|
+
* Action which will insert a default block insert action if there
|
|
16
|
+
* are no other blocks at the root of the editor. This action should be used
|
|
24
17
|
* in actions which may result in no blocks remaining in the editor (removal,
|
|
25
18
|
* replacement, etc).
|
|
26
19
|
*/
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
const ensureDefaultBlock = () => ({
|
|
22
|
+
select,
|
|
23
|
+
dispatch
|
|
24
|
+
}) => {
|
|
25
|
+
// To avoid a focus loss when removing the last block, assure there is
|
|
30
26
|
// always a default block if the last of the blocks have been removed.
|
|
27
|
+
const count = select.getBlockCount();
|
|
31
28
|
|
|
32
|
-
if (count
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// prevent it from being lost though.
|
|
29
|
+
if (count > 0) {
|
|
30
|
+
return;
|
|
31
|
+
} // If there's an custom appender, don't insert default block.
|
|
32
|
+
// We have to remember to manually move the focus elsewhere to
|
|
33
|
+
// prevent it from being lost though.
|
|
38
34
|
|
|
39
|
-
if (__unstableHasCustomAppender) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
35
|
|
|
43
|
-
|
|
36
|
+
const {
|
|
37
|
+
__unstableHasCustomAppender
|
|
38
|
+
} = select.getSettings();
|
|
39
|
+
|
|
40
|
+
if (__unstableHasCustomAppender) {
|
|
41
|
+
return;
|
|
44
42
|
}
|
|
45
|
-
|
|
43
|
+
|
|
44
|
+
dispatch.insertDefaultBlock();
|
|
45
|
+
};
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* content reflected as an edit in state.
|
|
47
|
+
* Action that resets blocks state to the specified array of blocks, taking precedence
|
|
48
|
+
* over any other content reflected as an edit in state.
|
|
50
49
|
*
|
|
51
50
|
* @param {Array} blocks Array of blocks.
|
|
52
51
|
*/
|
|
53
52
|
|
|
54
53
|
|
|
55
|
-
export
|
|
56
|
-
|
|
54
|
+
export const resetBlocks = blocks => ({
|
|
55
|
+
dispatch
|
|
56
|
+
}) => {
|
|
57
|
+
dispatch({
|
|
57
58
|
type: 'RESET_BLOCKS',
|
|
58
59
|
blocks
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
}
|
|
60
|
+
});
|
|
61
|
+
dispatch(validateBlocksToTemplate(blocks));
|
|
62
|
+
};
|
|
62
63
|
/**
|
|
63
64
|
* Block validity is a function of blocks state (at the point of a
|
|
64
65
|
* reset) and the template setting. As a compromise to its placement
|
|
@@ -68,20 +69,23 @@ export function* resetBlocks(blocks) {
|
|
|
68
69
|
* @param {Array} blocks Array of blocks.
|
|
69
70
|
*/
|
|
70
71
|
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
export const validateBlocksToTemplate = blocks => ({
|
|
73
|
+
select,
|
|
74
|
+
dispatch
|
|
75
|
+
}) => {
|
|
76
|
+
const template = select.getTemplate();
|
|
77
|
+
const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act
|
|
74
78
|
// as default values only.
|
|
75
79
|
|
|
76
80
|
const isBlocksValidToTemplate = !template || templateLock !== 'all' || doBlocksMatchTemplate(blocks, template); // Update if validity has changed.
|
|
77
81
|
|
|
78
|
-
const isValidTemplate =
|
|
82
|
+
const isValidTemplate = select.isValidTemplate();
|
|
79
83
|
|
|
80
84
|
if (isBlocksValidToTemplate !== isValidTemplate) {
|
|
81
|
-
|
|
85
|
+
dispatch.setTemplateValidity(isBlocksValidToTemplate);
|
|
82
86
|
return isBlocksValidToTemplate;
|
|
83
87
|
}
|
|
84
|
-
}
|
|
88
|
+
};
|
|
85
89
|
/**
|
|
86
90
|
* A block selection object.
|
|
87
91
|
*
|
|
@@ -93,6 +97,8 @@ export function* validateBlocksToTemplate(blocks) {
|
|
|
93
97
|
* text value. See `wp.richText.create`.
|
|
94
98
|
*/
|
|
95
99
|
|
|
100
|
+
/* eslint-disable jsdoc/valid-types */
|
|
101
|
+
|
|
96
102
|
/**
|
|
97
103
|
* Returns an action object used in signalling that selection state should be
|
|
98
104
|
* reset to the specified selection.
|
|
@@ -105,6 +111,7 @@ export function* validateBlocksToTemplate(blocks) {
|
|
|
105
111
|
*/
|
|
106
112
|
|
|
107
113
|
export function resetSelection(selectionStart, selectionEnd, initialPosition) {
|
|
114
|
+
/* eslint-enable jsdoc/valid-types */
|
|
108
115
|
return {
|
|
109
116
|
type: 'RESET_SELECTION',
|
|
110
117
|
selectionStart,
|
|
@@ -135,8 +142,7 @@ export function receiveBlocks(blocks) {
|
|
|
135
142
|
};
|
|
136
143
|
}
|
|
137
144
|
/**
|
|
138
|
-
*
|
|
139
|
-
* attributes with the specified client IDs have been updated.
|
|
145
|
+
* Action that updates attributes of multiple blocks with the specified client IDs.
|
|
140
146
|
*
|
|
141
147
|
* @param {string|string[]} clientIds Block client IDs.
|
|
142
148
|
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
|
@@ -154,8 +160,7 @@ export function updateBlockAttributes(clientIds, attributes, uniqueByBlock = fal
|
|
|
154
160
|
};
|
|
155
161
|
}
|
|
156
162
|
/**
|
|
157
|
-
*
|
|
158
|
-
* specified client ID has been updated.
|
|
163
|
+
* Action that updates the block with the specified client ID.
|
|
159
164
|
*
|
|
160
165
|
* @param {string} clientId Block client ID.
|
|
161
166
|
* @param {Object} updates Block attributes to be merged.
|
|
@@ -170,6 +175,8 @@ export function updateBlock(clientId, updates) {
|
|
|
170
175
|
updates
|
|
171
176
|
};
|
|
172
177
|
}
|
|
178
|
+
/* eslint-disable jsdoc/valid-types */
|
|
179
|
+
|
|
173
180
|
/**
|
|
174
181
|
* Returns an action object used in signalling that the block with the
|
|
175
182
|
* specified client ID has been selected, optionally accepting a position
|
|
@@ -184,6 +191,7 @@ export function updateBlock(clientId, updates) {
|
|
|
184
191
|
*/
|
|
185
192
|
|
|
186
193
|
export function selectBlock(clientId, initialPosition = 0) {
|
|
194
|
+
/* eslint-enable jsdoc/valid-types */
|
|
187
195
|
return {
|
|
188
196
|
type: 'SELECT_BLOCK',
|
|
189
197
|
initialPosition,
|
|
@@ -197,14 +205,16 @@ export function selectBlock(clientId, initialPosition = 0) {
|
|
|
197
205
|
* @param {string} clientId Block client ID.
|
|
198
206
|
*/
|
|
199
207
|
|
|
200
|
-
export
|
|
201
|
-
|
|
208
|
+
export const selectPreviousBlock = clientId => ({
|
|
209
|
+
select,
|
|
210
|
+
dispatch
|
|
211
|
+
}) => {
|
|
212
|
+
const previousBlockClientId = select.getPreviousBlockClientId(clientId);
|
|
202
213
|
|
|
203
214
|
if (previousBlockClientId) {
|
|
204
|
-
|
|
205
|
-
return [previousBlockClientId];
|
|
215
|
+
dispatch.selectBlock(previousBlockClientId, -1);
|
|
206
216
|
}
|
|
207
|
-
}
|
|
217
|
+
};
|
|
208
218
|
/**
|
|
209
219
|
* Yields action objects used in signalling that the block following the given
|
|
210
220
|
* clientId should be selected.
|
|
@@ -212,16 +222,18 @@ export function* selectPreviousBlock(clientId) {
|
|
|
212
222
|
* @param {string} clientId Block client ID.
|
|
213
223
|
*/
|
|
214
224
|
|
|
215
|
-
export
|
|
216
|
-
|
|
225
|
+
export const selectNextBlock = clientId => ({
|
|
226
|
+
select,
|
|
227
|
+
dispatch
|
|
228
|
+
}) => {
|
|
229
|
+
const nextBlockClientId = select.getNextBlockClientId(clientId);
|
|
217
230
|
|
|
218
231
|
if (nextBlockClientId) {
|
|
219
|
-
|
|
220
|
-
return [nextBlockClientId];
|
|
232
|
+
dispatch.selectBlock(nextBlockClientId);
|
|
221
233
|
}
|
|
222
|
-
}
|
|
234
|
+
};
|
|
223
235
|
/**
|
|
224
|
-
*
|
|
236
|
+
* Action that starts block multi-selection.
|
|
225
237
|
*
|
|
226
238
|
* @return {Object} Action object.
|
|
227
239
|
*/
|
|
@@ -232,7 +244,7 @@ export function startMultiSelect() {
|
|
|
232
244
|
};
|
|
233
245
|
}
|
|
234
246
|
/**
|
|
235
|
-
*
|
|
247
|
+
* Action that stops block multi-selection.
|
|
236
248
|
*
|
|
237
249
|
* @return {Object} Action object.
|
|
238
250
|
*/
|
|
@@ -243,32 +255,35 @@ export function stopMultiSelect() {
|
|
|
243
255
|
};
|
|
244
256
|
}
|
|
245
257
|
/**
|
|
246
|
-
*
|
|
258
|
+
* Action that changes block multi-selection.
|
|
247
259
|
*
|
|
248
260
|
* @param {string} start First block of the multi selection.
|
|
249
261
|
* @param {string} end Last block of the multiselection.
|
|
250
262
|
*/
|
|
251
263
|
|
|
252
|
-
export
|
|
253
|
-
|
|
254
|
-
|
|
264
|
+
export const multiSelect = (start, end) => ({
|
|
265
|
+
select,
|
|
266
|
+
dispatch
|
|
267
|
+
}) => {
|
|
268
|
+
const startBlockRootClientId = select.getBlockRootClientId(start);
|
|
269
|
+
const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
|
|
255
270
|
|
|
256
271
|
if (startBlockRootClientId !== endBlockRootClientId) {
|
|
257
272
|
return;
|
|
258
273
|
}
|
|
259
274
|
|
|
260
|
-
|
|
275
|
+
dispatch({
|
|
261
276
|
type: 'MULTI_SELECT',
|
|
262
277
|
start,
|
|
263
278
|
end
|
|
264
|
-
};
|
|
265
|
-
const blockCount =
|
|
279
|
+
});
|
|
280
|
+
const blockCount = select.getSelectedBlockCount();
|
|
266
281
|
speak(sprintf(
|
|
267
282
|
/* translators: %s: number of selected blocks */
|
|
268
283
|
_n('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
|
269
|
-
}
|
|
284
|
+
};
|
|
270
285
|
/**
|
|
271
|
-
*
|
|
286
|
+
* Action that clears the block selection.
|
|
272
287
|
*
|
|
273
288
|
* @return {Object} Action object.
|
|
274
289
|
*/
|
|
@@ -279,7 +294,7 @@ export function clearSelectedBlock() {
|
|
|
279
294
|
};
|
|
280
295
|
}
|
|
281
296
|
/**
|
|
282
|
-
*
|
|
297
|
+
* Action that enables or disables block selection.
|
|
283
298
|
*
|
|
284
299
|
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
|
285
300
|
* be enabled.
|
|
@@ -328,9 +343,10 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
|
328
343
|
};
|
|
329
344
|
});
|
|
330
345
|
}
|
|
346
|
+
/* eslint-disable jsdoc/valid-types */
|
|
347
|
+
|
|
331
348
|
/**
|
|
332
|
-
*
|
|
333
|
-
* one or more replacement blocks.
|
|
349
|
+
* Action that replaces given blocks with one or more replacement blocks.
|
|
334
350
|
*
|
|
335
351
|
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
|
336
352
|
* @param {(Object|Object[])} blocks Replacement block(s).
|
|
@@ -338,25 +354,29 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
|
338
354
|
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
|
339
355
|
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
|
340
356
|
*
|
|
341
|
-
* @
|
|
357
|
+
* @return {Object} Action object.
|
|
342
358
|
*/
|
|
343
359
|
|
|
344
360
|
|
|
345
|
-
export
|
|
361
|
+
export const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({
|
|
362
|
+
select,
|
|
363
|
+
dispatch
|
|
364
|
+
}) => {
|
|
365
|
+
/* eslint-enable jsdoc/valid-types */
|
|
346
366
|
clientIds = castArray(clientIds);
|
|
347
|
-
blocks = getBlocksWithDefaultStylesApplied(castArray(blocks),
|
|
348
|
-
const rootClientId =
|
|
367
|
+
blocks = getBlocksWithDefaultStylesApplied(castArray(blocks), select.getSettings());
|
|
368
|
+
const rootClientId = select.getBlockRootClientId(first(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
|
|
349
369
|
|
|
350
370
|
for (let index = 0; index < blocks.length; index++) {
|
|
351
371
|
const block = blocks[index];
|
|
352
|
-
const canInsertBlock =
|
|
372
|
+
const canInsertBlock = select.canInsertBlockType(block.name, rootClientId);
|
|
353
373
|
|
|
354
374
|
if (!canInsertBlock) {
|
|
355
375
|
return;
|
|
356
376
|
}
|
|
357
377
|
}
|
|
358
378
|
|
|
359
|
-
|
|
379
|
+
dispatch({
|
|
360
380
|
type: 'REPLACE_BLOCKS',
|
|
361
381
|
clientIds,
|
|
362
382
|
blocks,
|
|
@@ -364,12 +384,11 @@ export function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition
|
|
|
364
384
|
indexToSelect,
|
|
365
385
|
initialPosition,
|
|
366
386
|
meta
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
}
|
|
387
|
+
});
|
|
388
|
+
dispatch(ensureDefaultBlock());
|
|
389
|
+
};
|
|
370
390
|
/**
|
|
371
|
-
*
|
|
372
|
-
* with one or more replacement blocks.
|
|
391
|
+
* Action that replaces a single block with one or more replacement blocks.
|
|
373
392
|
*
|
|
374
393
|
* @param {(string|string[])} clientId Block client ID to replace.
|
|
375
394
|
* @param {(Object|Object[])} block Replacement block(s).
|
|
@@ -389,82 +408,83 @@ export function replaceBlock(clientId, block) {
|
|
|
389
408
|
* @return {Function} Action creator.
|
|
390
409
|
*/
|
|
391
410
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
411
|
+
const createOnMove = type => (clientIds, rootClientId) => ({
|
|
412
|
+
select,
|
|
413
|
+
dispatch
|
|
414
|
+
}) => {
|
|
415
|
+
// If one of the blocks is locked or the parent is locked, we cannot move any block.
|
|
416
|
+
const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId);
|
|
417
|
+
|
|
418
|
+
if (!canMoveBlocks) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
dispatch({
|
|
423
|
+
type,
|
|
424
|
+
clientIds: castArray(clientIds),
|
|
425
|
+
rootClientId
|
|
426
|
+
});
|
|
427
|
+
};
|
|
401
428
|
|
|
402
429
|
export const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
|
|
403
430
|
export const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
|
|
404
431
|
/**
|
|
405
|
-
*
|
|
406
|
-
* a new position.
|
|
432
|
+
* Action that moves given blocks to a new position.
|
|
407
433
|
*
|
|
408
434
|
* @param {?string} clientIds The client IDs of the blocks.
|
|
409
435
|
* @param {?string} fromRootClientId Root client ID source.
|
|
410
436
|
* @param {?string} toRootClientId Root client ID destination.
|
|
411
437
|
* @param {number} index The index to move the blocks to.
|
|
412
|
-
*
|
|
413
|
-
* @yield {Object} Action object.
|
|
414
438
|
*/
|
|
415
439
|
|
|
416
|
-
export
|
|
417
|
-
|
|
418
|
-
|
|
440
|
+
export const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = '', index) => ({
|
|
441
|
+
select,
|
|
442
|
+
dispatch
|
|
443
|
+
}) => {
|
|
444
|
+
const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); // If one of the blocks is locked or the parent is locked, we cannot move any block.
|
|
419
445
|
|
|
420
|
-
if (
|
|
446
|
+
if (!canMoveBlocks) {
|
|
421
447
|
return;
|
|
448
|
+
} // If moving inside the same root block the move is always possible.
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
if (fromRootClientId !== toRootClientId) {
|
|
452
|
+
const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); // If we're moving to another block, it means we're deleting blocks from
|
|
453
|
+
// the original block, so we need to check if removing is possible.
|
|
454
|
+
|
|
455
|
+
if (!canRemoveBlocks) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const canInsertBlocks = select.canInsertBlocks(clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
|
|
460
|
+
|
|
461
|
+
if (!canInsertBlocks) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
422
464
|
}
|
|
423
465
|
|
|
424
|
-
|
|
466
|
+
dispatch({
|
|
425
467
|
type: 'MOVE_BLOCKS_TO_POSITION',
|
|
426
468
|
fromRootClientId,
|
|
427
469
|
toRootClientId,
|
|
428
470
|
clientIds,
|
|
429
471
|
index
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
if (fromRootClientId === toRootClientId) {
|
|
433
|
-
yield action;
|
|
434
|
-
return;
|
|
435
|
-
} // If templateLock is insert we can not remove the block from the parent.
|
|
436
|
-
// Given that here we know that we are moving the block to a different
|
|
437
|
-
// parent, the move should not be possible if the condition is true.
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (templateLock === 'insert') {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
const canInsertBlocks = yield controls.select(blockEditorStoreName, 'canInsertBlocks', clientIds, toRootClientId); // If moving to other parent block, the move is possible if we can insert a block of the same type inside the new parent block.
|
|
445
|
-
|
|
446
|
-
if (canInsertBlocks) {
|
|
447
|
-
yield action;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
472
|
+
});
|
|
473
|
+
};
|
|
450
474
|
/**
|
|
451
|
-
*
|
|
452
|
-
* new position.
|
|
475
|
+
* Action that moves given block to a new position.
|
|
453
476
|
*
|
|
454
477
|
* @param {?string} clientId The client ID of the block.
|
|
455
478
|
* @param {?string} fromRootClientId Root client ID source.
|
|
456
479
|
* @param {?string} toRootClientId Root client ID destination.
|
|
457
480
|
* @param {number} index The index to move the block to.
|
|
458
|
-
*
|
|
459
|
-
* @yield {Object} Action object.
|
|
460
481
|
*/
|
|
461
482
|
|
|
462
|
-
export function
|
|
463
|
-
|
|
483
|
+
export function moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) {
|
|
484
|
+
return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
|
|
464
485
|
}
|
|
465
486
|
/**
|
|
466
|
-
*
|
|
467
|
-
* inserted, optionally at a specific index respective a root block list.
|
|
487
|
+
* Action that inserts a single block, optionally at a specific index respective a root block list.
|
|
468
488
|
*
|
|
469
489
|
* @param {Object} block Block object to insert.
|
|
470
490
|
* @param {?number} index Index at which block should be inserted.
|
|
@@ -475,12 +495,13 @@ export function* moveBlockToPosition(clientId, fromRootClientId = '', toRootClie
|
|
|
475
495
|
* @return {Object} Action object.
|
|
476
496
|
*/
|
|
477
497
|
|
|
478
|
-
export function insertBlock(block, index, rootClientId, updateSelection
|
|
498
|
+
export function insertBlock(block, index, rootClientId, updateSelection, meta) {
|
|
479
499
|
return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
|
|
480
500
|
}
|
|
501
|
+
/* eslint-disable jsdoc/valid-types */
|
|
502
|
+
|
|
481
503
|
/**
|
|
482
|
-
*
|
|
483
|
-
* be inserted, optionally at a specific index respective a root block list.
|
|
504
|
+
* Action that inserts an array of blocks, optionally at a specific index respective a root block list.
|
|
484
505
|
*
|
|
485
506
|
* @param {Object[]} blocks Block objects to insert.
|
|
486
507
|
* @param {?number} index Index at which block should be inserted.
|
|
@@ -491,7 +512,11 @@ export function insertBlock(block, index, rootClientId, updateSelection = true,
|
|
|
491
512
|
* @return {Object} Action object.
|
|
492
513
|
*/
|
|
493
514
|
|
|
494
|
-
export
|
|
515
|
+
export const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({
|
|
516
|
+
select,
|
|
517
|
+
dispatch
|
|
518
|
+
}) => {
|
|
519
|
+
/* eslint-enable jsdoc/valid-types */
|
|
495
520
|
if (isObject(initialPosition)) {
|
|
496
521
|
meta = initialPosition;
|
|
497
522
|
initialPosition = 0;
|
|
@@ -502,11 +527,11 @@ export function* insertBlocks(blocks, index, rootClientId, updateSelection = tru
|
|
|
502
527
|
});
|
|
503
528
|
}
|
|
504
529
|
|
|
505
|
-
blocks = getBlocksWithDefaultStylesApplied(castArray(blocks),
|
|
530
|
+
blocks = getBlocksWithDefaultStylesApplied(castArray(blocks), select.getSettings());
|
|
506
531
|
const allowedBlocks = [];
|
|
507
532
|
|
|
508
533
|
for (const block of blocks) {
|
|
509
|
-
const isValid =
|
|
534
|
+
const isValid = select.canInsertBlockType(block.name, rootClientId);
|
|
510
535
|
|
|
511
536
|
if (isValid) {
|
|
512
537
|
allowedBlocks.push(block);
|
|
@@ -514,7 +539,7 @@ export function* insertBlocks(blocks, index, rootClientId, updateSelection = tru
|
|
|
514
539
|
}
|
|
515
540
|
|
|
516
541
|
if (allowedBlocks.length) {
|
|
517
|
-
|
|
542
|
+
dispatch({
|
|
518
543
|
type: 'INSERT_BLOCKS',
|
|
519
544
|
blocks: allowedBlocks,
|
|
520
545
|
index,
|
|
@@ -523,12 +548,11 @@ export function* insertBlocks(blocks, index, rootClientId, updateSelection = tru
|
|
|
523
548
|
updateSelection,
|
|
524
549
|
initialPosition: updateSelection ? initialPosition : null,
|
|
525
550
|
meta
|
|
526
|
-
};
|
|
551
|
+
});
|
|
527
552
|
}
|
|
528
|
-
}
|
|
553
|
+
};
|
|
529
554
|
/**
|
|
530
|
-
*
|
|
531
|
-
* be shown.
|
|
555
|
+
* Action that shows the insertion point.
|
|
532
556
|
*
|
|
533
557
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
534
558
|
* which to insert.
|
|
@@ -550,7 +574,7 @@ export function showInsertionPoint(rootClientId, index, __unstableOptions = {})
|
|
|
550
574
|
};
|
|
551
575
|
}
|
|
552
576
|
/**
|
|
553
|
-
*
|
|
577
|
+
* Action that hides the insertion point.
|
|
554
578
|
*
|
|
555
579
|
* @return {Object} Action object.
|
|
556
580
|
*/
|
|
@@ -561,7 +585,7 @@ export function hideInsertionPoint() {
|
|
|
561
585
|
};
|
|
562
586
|
}
|
|
563
587
|
/**
|
|
564
|
-
*
|
|
588
|
+
* Action that resets the template validity.
|
|
565
589
|
*
|
|
566
590
|
* @param {boolean} isValid template validity flag.
|
|
567
591
|
*
|
|
@@ -575,49 +599,55 @@ export function setTemplateValidity(isValid) {
|
|
|
575
599
|
};
|
|
576
600
|
}
|
|
577
601
|
/**
|
|
578
|
-
*
|
|
602
|
+
* Action that synchronizes the template with the list of blocks.
|
|
579
603
|
*
|
|
580
604
|
* @return {Object} Action object.
|
|
581
605
|
*/
|
|
582
606
|
|
|
583
|
-
export
|
|
584
|
-
|
|
607
|
+
export const synchronizeTemplate = () => ({
|
|
608
|
+
select,
|
|
609
|
+
dispatch
|
|
610
|
+
}) => {
|
|
611
|
+
dispatch({
|
|
585
612
|
type: 'SYNCHRONIZE_TEMPLATE'
|
|
586
|
-
};
|
|
587
|
-
const blocks =
|
|
588
|
-
const template =
|
|
613
|
+
});
|
|
614
|
+
const blocks = select.getBlocks();
|
|
615
|
+
const template = select.getTemplate();
|
|
589
616
|
const updatedBlockList = synchronizeBlocksWithTemplate(blocks, template);
|
|
590
|
-
|
|
591
|
-
}
|
|
617
|
+
dispatch.resetBlocks(updatedBlockList);
|
|
618
|
+
};
|
|
592
619
|
/**
|
|
593
|
-
*
|
|
620
|
+
* Action that merges two blocks.
|
|
594
621
|
*
|
|
595
622
|
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
|
596
623
|
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
|
597
624
|
*/
|
|
598
625
|
|
|
599
|
-
export
|
|
626
|
+
export const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({
|
|
627
|
+
select,
|
|
628
|
+
dispatch
|
|
629
|
+
}) => {
|
|
600
630
|
const blocks = [firstBlockClientId, secondBlockClientId];
|
|
601
|
-
|
|
631
|
+
dispatch({
|
|
602
632
|
type: 'MERGE_BLOCKS',
|
|
603
633
|
blocks
|
|
604
|
-
};
|
|
634
|
+
});
|
|
605
635
|
const [clientIdA, clientIdB] = blocks;
|
|
606
|
-
const blockA =
|
|
636
|
+
const blockA = select.getBlock(clientIdA);
|
|
607
637
|
const blockAType = getBlockType(blockA.name); // Only focus the previous block if it's not mergeable
|
|
608
638
|
|
|
609
|
-
if (!blockAType.merge) {
|
|
610
|
-
|
|
639
|
+
if (blockAType && !blockAType.merge) {
|
|
640
|
+
dispatch.selectBlock(blockA.clientId);
|
|
611
641
|
return;
|
|
612
642
|
}
|
|
613
643
|
|
|
614
|
-
const blockB =
|
|
644
|
+
const blockB = select.getBlock(clientIdB);
|
|
615
645
|
const blockBType = getBlockType(blockB.name);
|
|
616
646
|
const {
|
|
617
647
|
clientId,
|
|
618
648
|
attributeKey,
|
|
619
649
|
offset
|
|
620
|
-
} =
|
|
650
|
+
} = select.getSelectionStart();
|
|
621
651
|
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
|
622
652
|
const attributeDefinition = selectedBlockType.attributes[attributeKey];
|
|
623
653
|
const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
|
|
@@ -695,16 +725,16 @@ export function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
|
|
695
725
|
preserveWhiteSpace
|
|
696
726
|
});
|
|
697
727
|
updatedAttributes[newAttributeKey] = newHtml;
|
|
698
|
-
|
|
728
|
+
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
|
699
729
|
}
|
|
700
730
|
|
|
701
|
-
|
|
731
|
+
dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
|
|
702
732
|
attributes: { ...blockA.attributes,
|
|
703
733
|
...updatedAttributes
|
|
704
734
|
}
|
|
705
735
|
}, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block.
|
|
706
736
|
);
|
|
707
|
-
}
|
|
737
|
+
};
|
|
708
738
|
/**
|
|
709
739
|
* Yields action objects used in signalling that the blocks corresponding to
|
|
710
740
|
* the set of specified client IDs are to be removed.
|
|
@@ -714,36 +744,34 @@ export function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
|
|
714
744
|
* selected when a block is removed.
|
|
715
745
|
*/
|
|
716
746
|
|
|
717
|
-
export
|
|
747
|
+
export const removeBlocks = (clientIds, selectPrevious = true) => ({
|
|
748
|
+
select,
|
|
749
|
+
dispatch
|
|
750
|
+
}) => {
|
|
718
751
|
if (!clientIds || !clientIds.length) {
|
|
719
752
|
return;
|
|
720
753
|
}
|
|
721
754
|
|
|
722
755
|
clientIds = castArray(clientIds);
|
|
723
|
-
const rootClientId =
|
|
724
|
-
const
|
|
756
|
+
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
|
757
|
+
const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId);
|
|
725
758
|
|
|
726
|
-
if (
|
|
759
|
+
if (!canRemoveBlocks) {
|
|
727
760
|
return;
|
|
728
761
|
}
|
|
729
762
|
|
|
730
|
-
let previousBlockId;
|
|
731
|
-
|
|
732
763
|
if (selectPrevious) {
|
|
733
|
-
|
|
734
|
-
} else {
|
|
735
|
-
previousBlockId = yield controls.select(blockEditorStoreName, 'getPreviousBlockClientId', clientIds[0]);
|
|
764
|
+
dispatch.selectPreviousBlock(clientIds[0]);
|
|
736
765
|
}
|
|
737
766
|
|
|
738
|
-
|
|
767
|
+
dispatch({
|
|
739
768
|
type: 'REMOVE_BLOCKS',
|
|
740
769
|
clientIds
|
|
741
|
-
}; // To avoid a focus loss when removing the last block, assure there is
|
|
770
|
+
}); // To avoid a focus loss when removing the last block, assure there is
|
|
742
771
|
// always a default block if the last of the blocks have been removed.
|
|
743
772
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
773
|
+
dispatch(ensureDefaultBlock());
|
|
774
|
+
};
|
|
747
775
|
/**
|
|
748
776
|
* Returns an action object used in signalling that the block with the
|
|
749
777
|
* specified client ID is to be removed.
|
|
@@ -758,6 +786,8 @@ export function* removeBlocks(clientIds, selectPrevious = true) {
|
|
|
758
786
|
export function removeBlock(clientId, selectPrevious) {
|
|
759
787
|
return removeBlocks([clientId], selectPrevious);
|
|
760
788
|
}
|
|
789
|
+
/* eslint-disable jsdoc/valid-types */
|
|
790
|
+
|
|
761
791
|
/**
|
|
762
792
|
* Returns an action object used in signalling that the inner blocks with the
|
|
763
793
|
* specified client ID should be replaced.
|
|
@@ -770,6 +800,7 @@ export function removeBlock(clientId, selectPrevious) {
|
|
|
770
800
|
*/
|
|
771
801
|
|
|
772
802
|
export function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) {
|
|
803
|
+
/* eslint-enable jsdoc/valid-types */
|
|
773
804
|
return {
|
|
774
805
|
type: 'REPLACE_INNER_BLOCKS',
|
|
775
806
|
rootClientId,
|
|
@@ -864,8 +895,7 @@ export function exitFormattedText() {
|
|
|
864
895
|
};
|
|
865
896
|
}
|
|
866
897
|
/**
|
|
867
|
-
*
|
|
868
|
-
* position.
|
|
898
|
+
* Action that changes the position of the user caret.
|
|
869
899
|
*
|
|
870
900
|
* @param {string} clientId The selected block client ID.
|
|
871
901
|
* @param {string} attributeKey The selected block attribute key.
|
|
@@ -885,8 +915,7 @@ export function selectionChange(clientId, attributeKey, startOffset, endOffset)
|
|
|
885
915
|
};
|
|
886
916
|
}
|
|
887
917
|
/**
|
|
888
|
-
*
|
|
889
|
-
* type should be added to the block list.
|
|
918
|
+
* Action that adds a new block of the default type to the block list.
|
|
890
919
|
*
|
|
891
920
|
* @param {?Object} attributes Optional attributes of the block to assign.
|
|
892
921
|
* @param {?string} rootClientId Optional root client ID of block list on which
|
|
@@ -908,7 +937,7 @@ export function insertDefaultBlock(attributes, rootClientId, index) {
|
|
|
908
937
|
return insertBlock(block, index, rootClientId);
|
|
909
938
|
}
|
|
910
939
|
/**
|
|
911
|
-
*
|
|
940
|
+
* Action that changes the nested settings of a given block.
|
|
912
941
|
*
|
|
913
942
|
* @param {string} clientId Client ID of the block whose nested setting are
|
|
914
943
|
* being received.
|
|
@@ -925,7 +954,7 @@ export function updateBlockListSettings(clientId, settings) {
|
|
|
925
954
|
};
|
|
926
955
|
}
|
|
927
956
|
/**
|
|
928
|
-
*
|
|
957
|
+
* Action that updates the block editor settings.
|
|
929
958
|
*
|
|
930
959
|
* @param {Object} settings Updated settings
|
|
931
960
|
*
|
|
@@ -939,7 +968,7 @@ export function updateSettings(settings) {
|
|
|
939
968
|
};
|
|
940
969
|
}
|
|
941
970
|
/**
|
|
942
|
-
*
|
|
971
|
+
* Action that signals that a temporary reusable block has been saved
|
|
943
972
|
* in order to switch its temporary id with the real id.
|
|
944
973
|
*
|
|
945
974
|
* @param {string} id Reusable block's id.
|
|
@@ -956,7 +985,7 @@ export function __unstableSaveReusableBlock(id, updatedId) {
|
|
|
956
985
|
};
|
|
957
986
|
}
|
|
958
987
|
/**
|
|
959
|
-
*
|
|
988
|
+
* Action that marks the last block change explicitly as persistent.
|
|
960
989
|
*
|
|
961
990
|
* @return {Object} Action object.
|
|
962
991
|
*/
|
|
@@ -967,7 +996,7 @@ export function __unstableMarkLastChangeAsPersistent() {
|
|
|
967
996
|
};
|
|
968
997
|
}
|
|
969
998
|
/**
|
|
970
|
-
*
|
|
999
|
+
* Action that signals that the next block change should be marked explicitly as not persistent.
|
|
971
1000
|
*
|
|
972
1001
|
* @return {Object} Action object.
|
|
973
1002
|
*/
|
|
@@ -978,138 +1007,156 @@ export function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
978
1007
|
};
|
|
979
1008
|
}
|
|
980
1009
|
/**
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
* it is recommended to be called at the next idle period to ensure all
|
|
1010
|
+
* Action that marks the last block change as an automatic change, meaning it was not
|
|
1011
|
+
* performed by the user, and can be undone using the `Escape` and `Backspace` keys.
|
|
1012
|
+
* This action must be called after the change was made, and any actions that are a
|
|
1013
|
+
* consequence of it, so it is recommended to be called at the next idle period to ensure all
|
|
986
1014
|
* selection changes have been recorded.
|
|
987
1015
|
*/
|
|
988
1016
|
|
|
989
|
-
export
|
|
990
|
-
|
|
1017
|
+
export const __unstableMarkAutomaticChange = () => ({
|
|
1018
|
+
dispatch
|
|
1019
|
+
}) => {
|
|
1020
|
+
dispatch({
|
|
991
1021
|
type: 'MARK_AUTOMATIC_CHANGE'
|
|
992
|
-
};
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}
|
|
1022
|
+
});
|
|
1023
|
+
const {
|
|
1024
|
+
requestIdleCallback = cb => setTimeout(cb, 100)
|
|
1025
|
+
} = window;
|
|
1026
|
+
requestIdleCallback(() => {
|
|
1027
|
+
dispatch({
|
|
1028
|
+
type: 'MARK_AUTOMATIC_CHANGE_FINAL'
|
|
1029
|
+
});
|
|
1030
|
+
});
|
|
1031
|
+
};
|
|
1000
1032
|
/**
|
|
1001
|
-
*
|
|
1033
|
+
* Action that enables or disables the navigation mode.
|
|
1002
1034
|
*
|
|
1003
1035
|
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
|
1004
1036
|
*/
|
|
1005
1037
|
|
|
1006
|
-
export
|
|
1007
|
-
|
|
1038
|
+
export const setNavigationMode = (isNavigationMode = true) => ({
|
|
1039
|
+
dispatch
|
|
1040
|
+
}) => {
|
|
1041
|
+
dispatch({
|
|
1008
1042
|
type: 'SET_NAVIGATION_MODE',
|
|
1009
1043
|
isNavigationMode
|
|
1010
|
-
};
|
|
1044
|
+
});
|
|
1011
1045
|
|
|
1012
1046
|
if (isNavigationMode) {
|
|
1013
1047
|
speak(__('You are currently in navigation mode. Navigate blocks using the Tab key and Arrow keys. Use Left and Right Arrow keys to move between nesting levels. To exit navigation mode and edit the selected block, press Enter.'));
|
|
1014
1048
|
} else {
|
|
1015
1049
|
speak(__('You are currently in edit mode. To return to the navigation mode, press Escape.'));
|
|
1016
1050
|
}
|
|
1017
|
-
}
|
|
1051
|
+
};
|
|
1018
1052
|
/**
|
|
1019
|
-
*
|
|
1053
|
+
* Action that enables or disables the block moving mode.
|
|
1020
1054
|
*
|
|
1021
1055
|
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
|
1022
1056
|
*/
|
|
1023
1057
|
|
|
1024
|
-
export
|
|
1025
|
-
|
|
1058
|
+
export const setBlockMovingClientId = (hasBlockMovingClientId = null) => ({
|
|
1059
|
+
dispatch
|
|
1060
|
+
}) => {
|
|
1061
|
+
dispatch({
|
|
1026
1062
|
type: 'SET_BLOCK_MOVING_MODE',
|
|
1027
1063
|
hasBlockMovingClientId
|
|
1028
|
-
};
|
|
1064
|
+
});
|
|
1029
1065
|
|
|
1030
1066
|
if (hasBlockMovingClientId) {
|
|
1031
1067
|
speak(__('Use the Tab key and Arrow keys to choose new block location. Use Left and Right Arrow keys to move between nesting levels. Once location is selected press Enter or Space to move the block.'));
|
|
1032
1068
|
}
|
|
1033
|
-
}
|
|
1069
|
+
};
|
|
1034
1070
|
/**
|
|
1035
|
-
*
|
|
1071
|
+
* Action that duplicates a list of blocks.
|
|
1036
1072
|
*
|
|
1037
1073
|
* @param {string[]} clientIds
|
|
1038
1074
|
* @param {boolean} updateSelection
|
|
1039
1075
|
*/
|
|
1040
1076
|
|
|
1041
|
-
export
|
|
1042
|
-
|
|
1077
|
+
export const duplicateBlocks = (clientIds, updateSelection = true) => ({
|
|
1078
|
+
select,
|
|
1079
|
+
dispatch
|
|
1080
|
+
}) => {
|
|
1081
|
+
if (!clientIds || !clientIds.length) {
|
|
1043
1082
|
return;
|
|
1044
|
-
}
|
|
1083
|
+
} // Return early if blocks don't exist.
|
|
1084
|
+
|
|
1045
1085
|
|
|
1046
|
-
const blocks =
|
|
1047
|
-
const rootClientId = yield controls.select(blockEditorStoreName, 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist.
|
|
1086
|
+
const blocks = select.getBlocksByClientId(clientIds);
|
|
1048
1087
|
|
|
1049
1088
|
if (some(blocks, block => !block)) {
|
|
1050
1089
|
return;
|
|
1051
|
-
}
|
|
1090
|
+
} // Return early if blocks don't support multiple usage.
|
|
1052
1091
|
|
|
1053
|
-
const blockNames = blocks.map(block => block.name); // Return early if blocks don't support multiple usage.
|
|
1054
1092
|
|
|
1055
|
-
|
|
1093
|
+
const blockNames = blocks.map(block => block.name);
|
|
1094
|
+
|
|
1095
|
+
if (blockNames.some(blockName => !hasBlockSupport(blockName, 'multiple', true))) {
|
|
1056
1096
|
return;
|
|
1057
1097
|
}
|
|
1058
1098
|
|
|
1059
|
-
const
|
|
1099
|
+
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
|
1100
|
+
const lastSelectedIndex = select.getBlockIndex(last(castArray(clientIds)), rootClientId);
|
|
1060
1101
|
const clonedBlocks = blocks.map(block => __experimentalCloneSanitizedBlock(block));
|
|
1061
|
-
|
|
1102
|
+
dispatch.insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
|
|
1062
1103
|
|
|
1063
1104
|
if (clonedBlocks.length > 1 && updateSelection) {
|
|
1064
|
-
|
|
1105
|
+
dispatch.multiSelect(first(clonedBlocks).clientId, last(clonedBlocks).clientId);
|
|
1065
1106
|
}
|
|
1066
1107
|
|
|
1067
1108
|
return clonedBlocks.map(block => block.clientId);
|
|
1068
|
-
}
|
|
1109
|
+
};
|
|
1069
1110
|
/**
|
|
1070
|
-
*
|
|
1111
|
+
* Action that inserts an empty block before a given block.
|
|
1071
1112
|
*
|
|
1072
1113
|
* @param {string} clientId
|
|
1073
1114
|
*/
|
|
1074
1115
|
|
|
1075
|
-
export
|
|
1116
|
+
export const insertBeforeBlock = clientId => ({
|
|
1117
|
+
select,
|
|
1118
|
+
dispatch
|
|
1119
|
+
}) => {
|
|
1076
1120
|
if (!clientId) {
|
|
1077
1121
|
return;
|
|
1078
1122
|
}
|
|
1079
1123
|
|
|
1080
|
-
const rootClientId =
|
|
1081
|
-
const isLocked =
|
|
1124
|
+
const rootClientId = select.getBlockRootClientId(clientId);
|
|
1125
|
+
const isLocked = select.getTemplateLock(rootClientId);
|
|
1082
1126
|
|
|
1083
1127
|
if (isLocked) {
|
|
1084
1128
|
return;
|
|
1085
1129
|
}
|
|
1086
1130
|
|
|
1087
|
-
const firstSelectedIndex =
|
|
1088
|
-
return
|
|
1089
|
-
}
|
|
1131
|
+
const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
|
|
1132
|
+
return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex);
|
|
1133
|
+
};
|
|
1090
1134
|
/**
|
|
1091
|
-
*
|
|
1135
|
+
* Action that inserts an empty block after a given block.
|
|
1092
1136
|
*
|
|
1093
1137
|
* @param {string} clientId
|
|
1094
1138
|
*/
|
|
1095
1139
|
|
|
1096
|
-
export
|
|
1140
|
+
export const insertAfterBlock = clientId => ({
|
|
1141
|
+
select,
|
|
1142
|
+
dispatch
|
|
1143
|
+
}) => {
|
|
1097
1144
|
if (!clientId) {
|
|
1098
1145
|
return;
|
|
1099
1146
|
}
|
|
1100
1147
|
|
|
1101
|
-
const rootClientId =
|
|
1102
|
-
const isLocked =
|
|
1148
|
+
const rootClientId = select.getBlockRootClientId(clientId);
|
|
1149
|
+
const isLocked = select.getTemplateLock(rootClientId);
|
|
1103
1150
|
|
|
1104
1151
|
if (isLocked) {
|
|
1105
1152
|
return;
|
|
1106
1153
|
}
|
|
1107
1154
|
|
|
1108
|
-
const firstSelectedIndex =
|
|
1109
|
-
return
|
|
1110
|
-
}
|
|
1155
|
+
const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
|
|
1156
|
+
return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1);
|
|
1157
|
+
};
|
|
1111
1158
|
/**
|
|
1112
|
-
*
|
|
1159
|
+
* Action that toggles the highlighted block state.
|
|
1113
1160
|
*
|
|
1114
1161
|
* @param {string} clientId The block's clientId.
|
|
1115
1162
|
* @param {boolean} isHighlighted The highlight state.
|
|
@@ -1123,22 +1170,20 @@ export function toggleBlockHighlight(clientId, isHighlighted) {
|
|
|
1123
1170
|
};
|
|
1124
1171
|
}
|
|
1125
1172
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
* given clientId should appear to "flash" by rhythmically highlighting it.
|
|
1173
|
+
* Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
|
|
1128
1174
|
*
|
|
1129
1175
|
* @param {string} clientId Target block client ID.
|
|
1130
1176
|
*/
|
|
1131
1177
|
|
|
1132
|
-
export
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
}
|
|
1178
|
+
export const flashBlock = clientId => async ({
|
|
1179
|
+
dispatch
|
|
1180
|
+
}) => {
|
|
1181
|
+
dispatch(toggleBlockHighlight(clientId, true));
|
|
1182
|
+
await new Promise(resolve => setTimeout(resolve, 150));
|
|
1183
|
+
dispatch(toggleBlockHighlight(clientId, false));
|
|
1184
|
+
};
|
|
1140
1185
|
/**
|
|
1141
|
-
*
|
|
1186
|
+
* Action that sets whether a block has controlled inner blocks.
|
|
1142
1187
|
*
|
|
1143
1188
|
* @param {string} clientId The block's clientId.
|
|
1144
1189
|
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|