@wordpress/block-editor 7.0.1 → 8.0.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 +11 -0
- package/README.md +47 -4
- 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-content-overlay/index.js +2 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-controls/fill.js +6 -6
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/groups.js +3 -1
- package/build/components/block-controls/groups.js.map +1 -1
- package/build/components/block-controls/hook.js +57 -0
- package/build/components/block-controls/hook.js.map +1 -0
- package/build/components/block-edit/context.js +6 -5
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.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 +13 -9
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +14 -7
- 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-list-item.native.js +31 -12
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js +4 -4
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js +15 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +6 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/grid-item.native.js +68 -0
- package/build/components/block-list/grid-item.native.js.map +1 -0
- package/build/components/block-list/index.js +19 -15
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +13 -9
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +4 -6
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +1 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -6
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +9 -1
- package/build/components/block-list/use-in-between-inserter.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 +42 -14
- 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/index.js +5 -1
- package/build/components/block-styles/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-toolbar/index.js +3 -0
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-popover.js +8 -7
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -4
- package/build/components/block-tools/block-selection-button.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/block-types-list/index.native.js +3 -2
- package/build/components/block-types-list/index.native.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 +44 -12
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-sizes/index.native.js +24 -0
- package/build/components/font-sizes/index.native.js.map +1 -1
- package/build/components/iframe/index.js +46 -63
- 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 +42 -37
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +12 -7
- 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 +28 -10
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +42 -4
- 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 -6
- 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 +18 -17
- 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 +9 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -4
- package/build/components/inserter/tabs.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 +64 -0
- package/build/components/inspector-controls/fill.js.map +1 -0
- package/build/components/inspector-controls/{index.native.js → fill.native.js} +20 -19
- package/build/components/inspector-controls/fill.native.js.map +1 -0
- package/build/components/inspector-controls/groups.js +25 -0
- package/build/components/inspector-controls/groups.js.map +1 -0
- package/build/components/inspector-controls/index.js +22 -20
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +67 -0
- package/build/components/inspector-controls/slot.js.map +1 -0
- package/build/components/inspector-controls/slot.native.js +38 -0
- package/build/components/inspector-controls/slot.native.js.map +1 -0
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.native.js +39 -0
- package/build/components/line-height-control/index.native.js.map +1 -0
- 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 +53 -23
- 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 +35 -21
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +2 -1
- package/build/components/media-placeholder/index.native.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 +29 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +43 -5
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/input-event.js +25 -24
- package/build/components/rich-text/input-event.js.map +1 -1
- package/build/components/rich-text/shortcut.js +23 -9
- package/build/components/rich-text/shortcut.js.map +1 -1
- package/build/components/rich-text/use-input-events.js +27 -0
- package/build/components/rich-text/use-input-events.js.map +1 -0
- package/build/components/rich-text/use-paste-handler.js +45 -10
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-shortcuts.js +27 -0
- package/build/components/rich-text/use-shortcuts.js.map +1 -0
- 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-display-block-controls/index.js +5 -7
- package/build/components/use-display-block-controls/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-resize-canvas/index.js +2 -13
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-setting/index.js +49 -14
- 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 +18 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +14 -14
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +4 -2
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border-color.js +9 -5
- package/build/hooks/border-color.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 +6 -4
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/compat.js +23 -0
- package/build/hooks/compat.js.map +1 -0
- package/build/hooks/custom-class-name.js +3 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/dimensions.js +63 -28
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +63 -18
- 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 +163 -0
- package/build/hooks/gap.js.map +1 -0
- package/build/hooks/index.js +12 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +10 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +47 -30
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/letter-spacing.js +45 -8
- 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 +6 -3
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +6 -3
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +39 -11
- 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 +109 -9
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +60 -0
- package/build/hooks/typography.native.js.map +1 -0
- 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 +215 -11
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +99 -6
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +331 -266
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +16 -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 +165 -114
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +203 -115
- 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 +295 -0
- package/build/utils/parse-css-unit-to-px.js.map +1 -0
- 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-content-overlay/index.js +2 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +6 -5
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/groups.js +3 -1
- package/build-module/components/block-controls/groups.js.map +1 -1
- package/build-module/components/block-controls/hook.js +42 -0
- package/build-module/components/block-controls/hook.js.map +1 -0
- package/build-module/components/block-edit/context.js +4 -4
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.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 +14 -9
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +12 -6
- 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-list-item.native.js +30 -12
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +3 -4
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +16 -10
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +6 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/grid-item.native.js +57 -0
- package/build-module/components/block-list/grid-item.native.js.map +1 -0
- package/build-module/components/block-list/index.js +17 -14
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +13 -9
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +7 -7
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +2 -2
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -6
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +9 -1
- package/build-module/components/block-list/use-in-between-inserter.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 +40 -16
- 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/index.js +5 -1
- package/build-module/components/block-styles/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-toolbar/index.js +3 -0
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +9 -8
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -4
- package/build-module/components/block-tools/block-selection-button.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/block-types-list/index.native.js +3 -2
- package/build-module/components/block-types-list/index.native.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 +40 -12
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-sizes/index.native.js +3 -1
- package/build-module/components/font-sizes/index.native.js.map +1 -1
- package/build-module/components/iframe/index.js +47 -65
- 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 +5 -6
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -3
- 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 +29 -11
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +41 -5
- 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 -5
- 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 +17 -17
- 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 +8 -2
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -4
- package/build-module/components/inserter/tabs.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 +50 -0
- package/build-module/components/inspector-controls/fill.js.map +1 -0
- package/build-module/components/inspector-controls/{index.native.js → fill.native.js} +16 -18
- package/build-module/components/inspector-controls/fill.native.js.map +1 -0
- package/build-module/components/inspector-controls/groups.js +16 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -0
- package/build-module/components/inspector-controls/index.js +16 -17
- package/build-module/components/inspector-controls/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +52 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -0
- package/build-module/components/inspector-controls/slot.native.js +27 -0
- package/build-module/components/inspector-controls/slot.native.js.map +1 -0
- 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/line-height-control/index.native.js +29 -0
- package/build-module/components/line-height-control/index.native.js.map +1 -0
- 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 +55 -27
- 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 +35 -21
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -1
- package/build-module/components/media-placeholder/index.native.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 +22 -6
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +43 -6
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/input-event.js +24 -22
- package/build-module/components/rich-text/input-event.js.map +1 -1
- package/build-module/components/rich-text/shortcut.js +22 -9
- package/build-module/components/rich-text/shortcut.js.map +1 -1
- package/build-module/components/rich-text/use-input-events.js +19 -0
- package/build-module/components/rich-text/use-input-events.js.map +1 -0
- package/build-module/components/rich-text/use-paste-handler.js +44 -10
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-shortcuts.js +19 -0
- package/build-module/components/rich-text/use-shortcuts.js.map +1 -0
- 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-display-block-controls/index.js +5 -7
- package/build-module/components/use-display-block-controls/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-resize-canvas/index.js +2 -10
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -14
- 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 +18 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +15 -15
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +5 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border-color.js +10 -5
- package/build-module/hooks/border-color.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 +6 -4
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/compat.js +20 -0
- package/build-module/hooks/compat.js.map +1 -0
- package/build-module/hooks/custom-class-name.js +4 -2
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/dimensions.js +57 -26
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +62 -18
- 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 +140 -0
- package/build-module/hooks/gap.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +2 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +47 -30
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +41 -8
- 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 +7 -4
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +7 -4
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +39 -11
- 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 +118 -19
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +41 -0
- package/build-module/hooks/typography.native.js.map +1 -0
- 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 +210 -12
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +99 -7
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +294 -242
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +15 -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 +167 -115
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +189 -104
- 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 +285 -0
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -0
- 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/default-editor-styles-rtl.css +114 -0
- package/build-style/default-editor-styles.css +114 -0
- package/build-style/style-rtl.css +292 -181
- package/build-style/style.css +292 -181
- package/build-types/components/block-context/index.d.ts +1 -1
- package/build-types/components/block-context/index.d.ts.map +1 -1
- 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-content-overlay/index.js +3 -6
- package/src/components/block-content-overlay/style.scss +9 -21
- package/src/components/block-controls/fill.js +7 -4
- package/src/components/block-controls/groups.js +2 -0
- package/src/components/block-controls/hook.js +44 -0
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-edit/context.js +4 -3
- package/src/components/block-edit/edit.js +1 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +11 -12
- package/src/components/block-inspector/index.js +19 -9
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block-list-item.native.js +34 -11
- package/src/components/block-list/block-list-item.native.scss +4 -0
- package/src/components/block-list/block-selection-button.native.js +8 -5
- package/src/components/block-list/block.js +13 -9
- package/src/components/block-list/block.native.js +7 -5
- package/src/components/block-list/grid-item.native.js +58 -0
- package/src/components/block-list/index.js +33 -27
- package/src/components/block-list/index.native.js +10 -4
- package/src/components/block-list/style.native.scss +0 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/index.js +4 -7
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +2 -8
- package/src/components/block-list/use-block-props/use-multi-selection.js +30 -4
- package/src/components/block-list/use-in-between-inserter.js +9 -0
- 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 +36 -18
- package/src/components/block-preview/style.scss +0 -20
- 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/index.js +6 -1
- 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-toolbar/index.js +4 -0
- package/src/components/block-tools/block-contextual-toolbar.js +7 -5
- package/src/components/block-tools/block-popover.js +8 -8
- package/src/components/block-tools/block-selection-button.js +2 -4
- 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/index.native.js +8 -2
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/block-variation-picker/README.md +47 -14
- package/src/components/block-variation-picker/style.native.scss +4 -0
- 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 +8 -4
- package/src/components/font-appearance-control/index.js +62 -24
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/font-sizes/index.native.js +7 -1
- package/src/components/iframe/index.js +64 -75
- 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 +10 -8
- package/src/components/index.native.js +5 -3
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +43 -14
- package/src/components/inner-blocks/index.native.js +48 -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 -6
- 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 +18 -15
- 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 +8 -1
- package/src/components/inserter/style.native.scss +8 -5
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/tabs.native.js +1 -7
- package/src/components/inserter/test/block-types-tab.native.js +3 -2
- 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/README.md +43 -198
- 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 +53 -0
- package/src/components/inspector-controls/{index.native.js → fill.native.js} +14 -14
- package/src/components/inspector-controls/groups.js +22 -0
- package/src/components/inspector-controls/index.js +16 -18
- package/src/components/inspector-controls/slot.js +45 -0
- package/src/components/inspector-controls/slot.native.js +22 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/line-height-control/index.native.js +25 -0
- 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 +95 -37
- 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/README.md +9 -0
- package/src/components/media-placeholder/index.js +31 -20
- package/src/components/media-placeholder/index.native.js +2 -1
- package/src/components/media-placeholder/style.scss +2 -0
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-replace-flow/style.scss +11 -12
- 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 +38 -12
- package/src/components/rich-text/index.native.js +37 -4
- package/src/components/rich-text/input-event.js +21 -20
- package/src/components/rich-text/shortcut.js +24 -9
- package/src/components/rich-text/style.scss +7 -5
- package/src/components/rich-text/use-input-events.js +19 -0
- package/src/components/rich-text/use-paste-handler.js +47 -12
- package/src/components/rich-text/use-shortcuts.js +19 -0
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/tool-selector/style.scss +5 -5
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-display-block-controls/index.js +7 -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-resize-canvas/index.js +2 -17
- package/src/components/use-setting/index.js +48 -16
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +21 -11
- package/src/default-editor-styles.scss +24 -0
- package/src/hooks/align.js +28 -20
- package/src/hooks/anchor.js +5 -5
- package/src/hooks/border-color.js +12 -1
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +11 -4
- package/src/hooks/compat.js +23 -0
- package/src/hooks/custom-class-name.js +3 -3
- package/src/hooks/dimensions.js +94 -50
- package/src/hooks/duotone.js +70 -21
- 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 +146 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/index.native.js +2 -0
- package/src/hooks/layout.js +82 -56
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +37 -8
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +13 -3
- package/src/hooks/padding.js +13 -3
- package/src/hooks/style.js +57 -18
- package/src/hooks/test/style.js +4 -0
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +167 -21
- package/src/hooks/typography.native.js +64 -0
- 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 +237 -14
- package/src/layouts/flow.js +81 -14
- package/src/store/actions.js +248 -378
- package/src/store/defaults.js +2 -0
- package/src/store/defaults.native.js +15 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +248 -145
- package/src/store/selectors.js +212 -158
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +184 -146
- package/src/store/test/selectors.js +197 -177
- package/src/style.scss +2 -15
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +272 -0
- package/src/utils/test/parse-css-unit-to-px.js +166 -0
- 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 -466
- package/build/components/block-list/head.js +0 -27
- package/build/components/block-list/head.js.map +0 -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/inspector-advanced-controls/index.js +0 -46
- package/build/components/inspector-advanced-controls/index.js.map +0 -1
- package/build/components/inspector-controls/index.native.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/components/use-simulated-media-query/index.js +0 -137
- package/build/components/use-simulated-media-query/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/block-list/head.js +0 -19
- package/build-module/components/block-list/head.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/inspector-advanced-controls/index.js +0 -36
- package/build-module/components/inspector-advanced-controls/index.js.map +0 -1
- package/build-module/components/inspector-controls/index.native.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/components/use-simulated-media-query/index.js +0 -126
- package/build-module/components/use-simulated-media-query/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/block-list/head.js +0 -18
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/inspector-advanced-controls/README.md +0 -72
- package/src/components/inspector-advanced-controls/index.js +0 -32
- 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/components/use-simulated-media-query/index.js +0 -144
- package/src/store/controls.js +0 -39
package/src/store/actions.js
CHANGED
|
@@ -19,61 +19,44 @@ import {
|
|
|
19
19
|
} from '@wordpress/blocks';
|
|
20
20
|
import { speak } from '@wordpress/a11y';
|
|
21
21
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
22
|
-
import { controls } from '@wordpress/data';
|
|
23
22
|
import { create, insert, remove, toHTMLString } from '@wordpress/rich-text';
|
|
24
23
|
import deprecated from '@wordpress/deprecated';
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
import { __unstableMarkAutomaticChangeFinalControl } from '../store/controls';
|
|
30
|
-
import { STORE_NAME as blockEditorStoreName } from './constants';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Generator which will yield a default block insert action if there
|
|
34
|
-
* are no other blocks at the root of the editor. This generator should be used
|
|
26
|
+
* Action which will insert a default block insert action if there
|
|
27
|
+
* are no other blocks at the root of the editor. This action should be used
|
|
35
28
|
* in actions which may result in no blocks remaining in the editor (removal,
|
|
36
29
|
* replacement, etc).
|
|
37
30
|
*/
|
|
38
|
-
|
|
39
|
-
const count = yield controls.select(
|
|
40
|
-
blockEditorStoreName,
|
|
41
|
-
'getBlockCount'
|
|
42
|
-
);
|
|
43
|
-
|
|
31
|
+
const ensureDefaultBlock = () => ( { select, dispatch } ) => {
|
|
44
32
|
// To avoid a focus loss when removing the last block, assure there is
|
|
45
33
|
// always a default block if the last of the blocks have been removed.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
// If there's an custom appender, don't insert default block.
|
|
53
|
-
// We have to remember to manually move the focus elsewhere to
|
|
54
|
-
// prevent it from being lost though.
|
|
55
|
-
if ( __unstableHasCustomAppender ) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
34
|
+
const count = select.getBlockCount();
|
|
35
|
+
if ( count > 0 ) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
58
38
|
|
|
59
|
-
|
|
39
|
+
// If there's an custom appender, don't insert default block.
|
|
40
|
+
// We have to remember to manually move the focus elsewhere to
|
|
41
|
+
// prevent it from being lost though.
|
|
42
|
+
const { __unstableHasCustomAppender } = select.getSettings();
|
|
43
|
+
if ( __unstableHasCustomAppender ) {
|
|
44
|
+
return;
|
|
60
45
|
}
|
|
61
|
-
|
|
46
|
+
|
|
47
|
+
dispatch.insertDefaultBlock();
|
|
48
|
+
};
|
|
62
49
|
|
|
63
50
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* content reflected as an edit in state.
|
|
51
|
+
* Action that resets blocks state to the specified array of blocks, taking precedence
|
|
52
|
+
* over any other content reflected as an edit in state.
|
|
67
53
|
*
|
|
68
54
|
* @param {Array} blocks Array of blocks.
|
|
69
55
|
*/
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
75
|
-
return yield* validateBlocksToTemplate( blocks );
|
|
76
|
-
}
|
|
56
|
+
export const resetBlocks = ( blocks ) => ( { dispatch } ) => {
|
|
57
|
+
dispatch( { type: 'RESET_BLOCKS', blocks } );
|
|
58
|
+
dispatch( validateBlocksToTemplate( blocks ) );
|
|
59
|
+
};
|
|
77
60
|
|
|
78
61
|
/**
|
|
79
62
|
* Block validity is a function of blocks state (at the point of a
|
|
@@ -83,15 +66,12 @@ export function* resetBlocks( blocks ) {
|
|
|
83
66
|
*
|
|
84
67
|
* @param {Array} blocks Array of blocks.
|
|
85
68
|
*/
|
|
86
|
-
export
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
);
|
|
91
|
-
const templateLock =
|
|
92
|
-
blockEditorStoreName,
|
|
93
|
-
'getTemplateLock'
|
|
94
|
-
);
|
|
69
|
+
export const validateBlocksToTemplate = ( blocks ) => ( {
|
|
70
|
+
select,
|
|
71
|
+
dispatch,
|
|
72
|
+
} ) => {
|
|
73
|
+
const template = select.getTemplate();
|
|
74
|
+
const templateLock = select.getTemplateLock();
|
|
95
75
|
|
|
96
76
|
// Unlocked templates are considered always valid because they act
|
|
97
77
|
// as default values only.
|
|
@@ -101,16 +81,13 @@ export function* validateBlocksToTemplate( blocks ) {
|
|
|
101
81
|
doBlocksMatchTemplate( blocks, template );
|
|
102
82
|
|
|
103
83
|
// Update if validity has changed.
|
|
104
|
-
const isValidTemplate =
|
|
105
|
-
blockEditorStoreName,
|
|
106
|
-
'isValidTemplate'
|
|
107
|
-
);
|
|
84
|
+
const isValidTemplate = select.isValidTemplate();
|
|
108
85
|
|
|
109
86
|
if ( isBlocksValidToTemplate !== isValidTemplate ) {
|
|
110
|
-
|
|
87
|
+
dispatch.setTemplateValidity( isBlocksValidToTemplate );
|
|
111
88
|
return isBlocksValidToTemplate;
|
|
112
89
|
}
|
|
113
|
-
}
|
|
90
|
+
};
|
|
114
91
|
|
|
115
92
|
/**
|
|
116
93
|
* A block selection object.
|
|
@@ -123,6 +100,7 @@ export function* validateBlocksToTemplate( blocks ) {
|
|
|
123
100
|
* text value. See `wp.richText.create`.
|
|
124
101
|
*/
|
|
125
102
|
|
|
103
|
+
/* eslint-disable jsdoc/valid-types */
|
|
126
104
|
/**
|
|
127
105
|
* Returns an action object used in signalling that selection state should be
|
|
128
106
|
* reset to the specified selection.
|
|
@@ -138,6 +116,7 @@ export function resetSelection(
|
|
|
138
116
|
selectionEnd,
|
|
139
117
|
initialPosition
|
|
140
118
|
) {
|
|
119
|
+
/* eslint-enable jsdoc/valid-types */
|
|
141
120
|
return {
|
|
142
121
|
type: 'RESET_SELECTION',
|
|
143
122
|
selectionStart,
|
|
@@ -151,11 +130,18 @@ export function resetSelection(
|
|
|
151
130
|
* Unlike resetBlocks, these should be appended to the existing known set, not
|
|
152
131
|
* replacing.
|
|
153
132
|
*
|
|
133
|
+
* @deprecated
|
|
134
|
+
*
|
|
154
135
|
* @param {Object[]} blocks Array of block objects.
|
|
155
136
|
*
|
|
156
137
|
* @return {Object} Action object.
|
|
157
138
|
*/
|
|
158
139
|
export function receiveBlocks( blocks ) {
|
|
140
|
+
deprecated( 'wp.data.dispatch( "core/block-editor" ).receiveBlocks', {
|
|
141
|
+
since: '5.9',
|
|
142
|
+
alternative: 'resetBlocks or insertBlocks',
|
|
143
|
+
} );
|
|
144
|
+
|
|
159
145
|
return {
|
|
160
146
|
type: 'RECEIVE_BLOCKS',
|
|
161
147
|
blocks,
|
|
@@ -163,8 +149,7 @@ export function receiveBlocks( blocks ) {
|
|
|
163
149
|
}
|
|
164
150
|
|
|
165
151
|
/**
|
|
166
|
-
*
|
|
167
|
-
* attributes with the specified client IDs have been updated.
|
|
152
|
+
* Action that updates attributes of multiple blocks with the specified client IDs.
|
|
168
153
|
*
|
|
169
154
|
* @param {string|string[]} clientIds Block client IDs.
|
|
170
155
|
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
|
@@ -186,8 +171,7 @@ export function updateBlockAttributes(
|
|
|
186
171
|
}
|
|
187
172
|
|
|
188
173
|
/**
|
|
189
|
-
*
|
|
190
|
-
* specified client ID has been updated.
|
|
174
|
+
* Action that updates the block with the specified client ID.
|
|
191
175
|
*
|
|
192
176
|
* @param {string} clientId Block client ID.
|
|
193
177
|
* @param {Object} updates Block attributes to be merged.
|
|
@@ -202,6 +186,7 @@ export function updateBlock( clientId, updates ) {
|
|
|
202
186
|
};
|
|
203
187
|
}
|
|
204
188
|
|
|
189
|
+
/* eslint-disable jsdoc/valid-types */
|
|
205
190
|
/**
|
|
206
191
|
* Returns an action object used in signalling that the block with the
|
|
207
192
|
* specified client ID has been selected, optionally accepting a position
|
|
@@ -215,6 +200,7 @@ export function updateBlock( clientId, updates ) {
|
|
|
215
200
|
* @return {Object} Action object.
|
|
216
201
|
*/
|
|
217
202
|
export function selectBlock( clientId, initialPosition = 0 ) {
|
|
203
|
+
/* eslint-enable jsdoc/valid-types */
|
|
218
204
|
return {
|
|
219
205
|
type: 'SELECT_BLOCK',
|
|
220
206
|
initialPosition,
|
|
@@ -228,18 +214,12 @@ export function selectBlock( clientId, initialPosition = 0 ) {
|
|
|
228
214
|
*
|
|
229
215
|
* @param {string} clientId Block client ID.
|
|
230
216
|
*/
|
|
231
|
-
export
|
|
232
|
-
const previousBlockClientId =
|
|
233
|
-
blockEditorStoreName,
|
|
234
|
-
'getPreviousBlockClientId',
|
|
235
|
-
clientId
|
|
236
|
-
);
|
|
237
|
-
|
|
217
|
+
export const selectPreviousBlock = ( clientId ) => ( { select, dispatch } ) => {
|
|
218
|
+
const previousBlockClientId = select.getPreviousBlockClientId( clientId );
|
|
238
219
|
if ( previousBlockClientId ) {
|
|
239
|
-
|
|
240
|
-
return [ previousBlockClientId ];
|
|
220
|
+
dispatch.selectBlock( previousBlockClientId, -1 );
|
|
241
221
|
}
|
|
242
|
-
}
|
|
222
|
+
};
|
|
243
223
|
|
|
244
224
|
/**
|
|
245
225
|
* Yields action objects used in signalling that the block following the given
|
|
@@ -247,21 +227,15 @@ export function* selectPreviousBlock( clientId ) {
|
|
|
247
227
|
*
|
|
248
228
|
* @param {string} clientId Block client ID.
|
|
249
229
|
*/
|
|
250
|
-
export
|
|
251
|
-
const nextBlockClientId =
|
|
252
|
-
blockEditorStoreName,
|
|
253
|
-
'getNextBlockClientId',
|
|
254
|
-
clientId
|
|
255
|
-
);
|
|
256
|
-
|
|
230
|
+
export const selectNextBlock = ( clientId ) => ( { select, dispatch } ) => {
|
|
231
|
+
const nextBlockClientId = select.getNextBlockClientId( clientId );
|
|
257
232
|
if ( nextBlockClientId ) {
|
|
258
|
-
|
|
259
|
-
return [ nextBlockClientId ];
|
|
233
|
+
dispatch.selectBlock( nextBlockClientId );
|
|
260
234
|
}
|
|
261
|
-
}
|
|
235
|
+
};
|
|
262
236
|
|
|
263
237
|
/**
|
|
264
|
-
*
|
|
238
|
+
* Action that starts block multi-selection.
|
|
265
239
|
*
|
|
266
240
|
* @return {Object} Action object.
|
|
267
241
|
*/
|
|
@@ -272,7 +246,7 @@ export function startMultiSelect() {
|
|
|
272
246
|
}
|
|
273
247
|
|
|
274
248
|
/**
|
|
275
|
-
*
|
|
249
|
+
* Action that stops block multi-selection.
|
|
276
250
|
*
|
|
277
251
|
* @return {Object} Action object.
|
|
278
252
|
*/
|
|
@@ -283,38 +257,23 @@ export function stopMultiSelect() {
|
|
|
283
257
|
}
|
|
284
258
|
|
|
285
259
|
/**
|
|
286
|
-
*
|
|
260
|
+
* Action that changes block multi-selection.
|
|
287
261
|
*
|
|
288
262
|
* @param {string} start First block of the multi selection.
|
|
289
263
|
* @param {string} end Last block of the multiselection.
|
|
290
264
|
*/
|
|
291
|
-
export
|
|
292
|
-
const startBlockRootClientId =
|
|
293
|
-
|
|
294
|
-
'getBlockRootClientId',
|
|
295
|
-
start
|
|
296
|
-
);
|
|
297
|
-
const endBlockRootClientId = yield controls.select(
|
|
298
|
-
blockEditorStoreName,
|
|
299
|
-
'getBlockRootClientId',
|
|
300
|
-
end
|
|
301
|
-
);
|
|
265
|
+
export const multiSelect = ( start, end ) => ( { select, dispatch } ) => {
|
|
266
|
+
const startBlockRootClientId = select.getBlockRootClientId( start );
|
|
267
|
+
const endBlockRootClientId = select.getBlockRootClientId( end );
|
|
302
268
|
|
|
303
269
|
// Only allow block multi-selections at the same level.
|
|
304
270
|
if ( startBlockRootClientId !== endBlockRootClientId ) {
|
|
305
271
|
return;
|
|
306
272
|
}
|
|
307
273
|
|
|
308
|
-
|
|
309
|
-
type: 'MULTI_SELECT',
|
|
310
|
-
start,
|
|
311
|
-
end,
|
|
312
|
-
};
|
|
274
|
+
dispatch( { type: 'MULTI_SELECT', start, end } );
|
|
313
275
|
|
|
314
|
-
const blockCount =
|
|
315
|
-
blockEditorStoreName,
|
|
316
|
-
'getSelectedBlockCount'
|
|
317
|
-
);
|
|
276
|
+
const blockCount = select.getSelectedBlockCount();
|
|
318
277
|
|
|
319
278
|
speak(
|
|
320
279
|
sprintf(
|
|
@@ -324,10 +283,10 @@ export function* multiSelect( start, end ) {
|
|
|
324
283
|
),
|
|
325
284
|
'assertive'
|
|
326
285
|
);
|
|
327
|
-
}
|
|
286
|
+
};
|
|
328
287
|
|
|
329
288
|
/**
|
|
330
|
-
*
|
|
289
|
+
* Action that clears the block selection.
|
|
331
290
|
*
|
|
332
291
|
* @return {Object} Action object.
|
|
333
292
|
*/
|
|
@@ -338,7 +297,7 @@ export function clearSelectedBlock() {
|
|
|
338
297
|
}
|
|
339
298
|
|
|
340
299
|
/**
|
|
341
|
-
*
|
|
300
|
+
* Action that enables or disables block selection.
|
|
342
301
|
*
|
|
343
302
|
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
|
344
303
|
* be enabled.
|
|
@@ -382,9 +341,9 @@ function getBlocksWithDefaultStylesApplied( blocks, blockEditorSettings ) {
|
|
|
382
341
|
} );
|
|
383
342
|
}
|
|
384
343
|
|
|
344
|
+
/* eslint-disable jsdoc/valid-types */
|
|
385
345
|
/**
|
|
386
|
-
*
|
|
387
|
-
* one or more replacement blocks.
|
|
346
|
+
* Action that replaces given blocks with one or more replacement blocks.
|
|
388
347
|
*
|
|
389
348
|
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
|
390
349
|
* @param {(Object|Object[])} blocks Replacement block(s).
|
|
@@ -392,31 +351,26 @@ function getBlocksWithDefaultStylesApplied( blocks, blockEditorSettings ) {
|
|
|
392
351
|
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
|
393
352
|
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
|
394
353
|
*
|
|
395
|
-
* @
|
|
354
|
+
* @return {Object} Action object.
|
|
396
355
|
*/
|
|
397
|
-
export
|
|
356
|
+
export const replaceBlocks = (
|
|
398
357
|
clientIds,
|
|
399
358
|
blocks,
|
|
400
359
|
indexToSelect,
|
|
401
360
|
initialPosition = 0,
|
|
402
361
|
meta
|
|
403
|
-
) {
|
|
362
|
+
) => ( { select, dispatch } ) => {
|
|
363
|
+
/* eslint-enable jsdoc/valid-types */
|
|
404
364
|
clientIds = castArray( clientIds );
|
|
405
365
|
blocks = getBlocksWithDefaultStylesApplied(
|
|
406
366
|
castArray( blocks ),
|
|
407
|
-
|
|
408
|
-
);
|
|
409
|
-
const rootClientId = yield controls.select(
|
|
410
|
-
blockEditorStoreName,
|
|
411
|
-
'getBlockRootClientId',
|
|
412
|
-
first( clientIds )
|
|
367
|
+
select.getSettings()
|
|
413
368
|
);
|
|
369
|
+
const rootClientId = select.getBlockRootClientId( first( clientIds ) );
|
|
414
370
|
// Replace is valid if the new blocks can be inserted in the root block.
|
|
415
371
|
for ( let index = 0; index < blocks.length; index++ ) {
|
|
416
372
|
const block = blocks[ index ];
|
|
417
|
-
const canInsertBlock =
|
|
418
|
-
blockEditorStoreName,
|
|
419
|
-
'canInsertBlockType',
|
|
373
|
+
const canInsertBlock = select.canInsertBlockType(
|
|
420
374
|
block.name,
|
|
421
375
|
rootClientId
|
|
422
376
|
);
|
|
@@ -424,7 +378,7 @@ export function* replaceBlocks(
|
|
|
424
378
|
return;
|
|
425
379
|
}
|
|
426
380
|
}
|
|
427
|
-
|
|
381
|
+
dispatch( {
|
|
428
382
|
type: 'REPLACE_BLOCKS',
|
|
429
383
|
clientIds,
|
|
430
384
|
blocks,
|
|
@@ -432,13 +386,12 @@ export function* replaceBlocks(
|
|
|
432
386
|
indexToSelect,
|
|
433
387
|
initialPosition,
|
|
434
388
|
meta,
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
}
|
|
389
|
+
} );
|
|
390
|
+
dispatch( ensureDefaultBlock() );
|
|
391
|
+
};
|
|
438
392
|
|
|
439
393
|
/**
|
|
440
|
-
*
|
|
441
|
-
* with one or more replacement blocks.
|
|
394
|
+
* Action that replaces a single block with one or more replacement blocks.
|
|
442
395
|
*
|
|
443
396
|
* @param {(string|string[])} clientId Block client ID to replace.
|
|
444
397
|
* @param {(Object|Object[])} block Replacement block(s).
|
|
@@ -457,100 +410,91 @@ export function replaceBlock( clientId, block ) {
|
|
|
457
410
|
*
|
|
458
411
|
* @return {Function} Action creator.
|
|
459
412
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
413
|
+
const createOnMove = ( type ) => ( clientIds, rootClientId ) => ( {
|
|
414
|
+
select,
|
|
415
|
+
dispatch,
|
|
416
|
+
} ) => {
|
|
417
|
+
// If one of the blocks is locked or the parent is locked, we cannot move any block.
|
|
418
|
+
const canMoveBlocks = select.canMoveBlocks( clientIds, rootClientId );
|
|
419
|
+
if ( ! canMoveBlocks ) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
dispatch( { type, clientIds: castArray( clientIds ), rootClientId } );
|
|
424
|
+
};
|
|
469
425
|
|
|
470
426
|
export const moveBlocksDown = createOnMove( 'MOVE_BLOCKS_DOWN' );
|
|
471
427
|
export const moveBlocksUp = createOnMove( 'MOVE_BLOCKS_UP' );
|
|
472
428
|
|
|
473
429
|
/**
|
|
474
|
-
*
|
|
475
|
-
* a new position.
|
|
430
|
+
* Action that moves given blocks to a new position.
|
|
476
431
|
*
|
|
477
432
|
* @param {?string} clientIds The client IDs of the blocks.
|
|
478
433
|
* @param {?string} fromRootClientId Root client ID source.
|
|
479
434
|
* @param {?string} toRootClientId Root client ID destination.
|
|
480
435
|
* @param {number} index The index to move the blocks to.
|
|
481
|
-
*
|
|
482
|
-
* @yield {Object} Action object.
|
|
483
436
|
*/
|
|
484
|
-
export
|
|
437
|
+
export const moveBlocksToPosition = (
|
|
485
438
|
clientIds,
|
|
486
439
|
fromRootClientId = '',
|
|
487
440
|
toRootClientId = '',
|
|
488
441
|
index
|
|
489
|
-
) {
|
|
490
|
-
const
|
|
491
|
-
blockEditorStoreName,
|
|
492
|
-
'getTemplateLock',
|
|
493
|
-
fromRootClientId
|
|
494
|
-
);
|
|
442
|
+
) => ( { select, dispatch } ) => {
|
|
443
|
+
const canMoveBlocks = select.canMoveBlocks( clientIds, fromRootClientId );
|
|
495
444
|
|
|
496
|
-
// If
|
|
497
|
-
|
|
498
|
-
if ( templateLock === 'all' ) {
|
|
445
|
+
// If one of the blocks is locked or the parent is locked, we cannot move any block.
|
|
446
|
+
if ( ! canMoveBlocks ) {
|
|
499
447
|
return;
|
|
500
448
|
}
|
|
501
449
|
|
|
502
|
-
const action = {
|
|
503
|
-
type: 'MOVE_BLOCKS_TO_POSITION',
|
|
504
|
-
fromRootClientId,
|
|
505
|
-
toRootClientId,
|
|
506
|
-
clientIds,
|
|
507
|
-
index,
|
|
508
|
-
};
|
|
509
|
-
|
|
510
450
|
// If moving inside the same root block the move is always possible.
|
|
511
|
-
if ( fromRootClientId
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
451
|
+
if ( fromRootClientId !== toRootClientId ) {
|
|
452
|
+
const canRemoveBlocks = select.canRemoveBlocks(
|
|
453
|
+
clientIds,
|
|
454
|
+
fromRootClientId
|
|
455
|
+
);
|
|
515
456
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
457
|
+
// If we're moving to another block, it means we're deleting blocks from
|
|
458
|
+
// the original block, so we need to check if removing is possible.
|
|
459
|
+
if ( ! canRemoveBlocks ) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
522
462
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
toRootClientId
|
|
528
|
-
);
|
|
463
|
+
const canInsertBlocks = select.canInsertBlocks(
|
|
464
|
+
clientIds,
|
|
465
|
+
toRootClientId
|
|
466
|
+
);
|
|
529
467
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
468
|
+
// 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.
|
|
469
|
+
if ( ! canInsertBlocks ) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
533
472
|
}
|
|
534
|
-
|
|
473
|
+
|
|
474
|
+
dispatch( {
|
|
475
|
+
type: 'MOVE_BLOCKS_TO_POSITION',
|
|
476
|
+
fromRootClientId,
|
|
477
|
+
toRootClientId,
|
|
478
|
+
clientIds,
|
|
479
|
+
index,
|
|
480
|
+
} );
|
|
481
|
+
};
|
|
535
482
|
|
|
536
483
|
/**
|
|
537
|
-
*
|
|
538
|
-
* new position.
|
|
484
|
+
* Action that moves given block to a new position.
|
|
539
485
|
*
|
|
540
486
|
* @param {?string} clientId The client ID of the block.
|
|
541
487
|
* @param {?string} fromRootClientId Root client ID source.
|
|
542
488
|
* @param {?string} toRootClientId Root client ID destination.
|
|
543
489
|
* @param {number} index The index to move the block to.
|
|
544
|
-
*
|
|
545
|
-
* @yield {Object} Action object.
|
|
546
490
|
*/
|
|
547
|
-
export function
|
|
491
|
+
export function moveBlockToPosition(
|
|
548
492
|
clientId,
|
|
549
493
|
fromRootClientId = '',
|
|
550
494
|
toRootClientId = '',
|
|
551
495
|
index
|
|
552
496
|
) {
|
|
553
|
-
|
|
497
|
+
return moveBlocksToPosition(
|
|
554
498
|
[ clientId ],
|
|
555
499
|
fromRootClientId,
|
|
556
500
|
toRootClientId,
|
|
@@ -559,8 +503,7 @@ export function* moveBlockToPosition(
|
|
|
559
503
|
}
|
|
560
504
|
|
|
561
505
|
/**
|
|
562
|
-
*
|
|
563
|
-
* inserted, optionally at a specific index respective a root block list.
|
|
506
|
+
* Action that inserts a single block, optionally at a specific index respective a root block list.
|
|
564
507
|
*
|
|
565
508
|
* @param {Object} block Block object to insert.
|
|
566
509
|
* @param {?number} index Index at which block should be inserted.
|
|
@@ -574,7 +517,7 @@ export function insertBlock(
|
|
|
574
517
|
block,
|
|
575
518
|
index,
|
|
576
519
|
rootClientId,
|
|
577
|
-
updateSelection
|
|
520
|
+
updateSelection,
|
|
578
521
|
meta
|
|
579
522
|
) {
|
|
580
523
|
return insertBlocks(
|
|
@@ -587,9 +530,9 @@ export function insertBlock(
|
|
|
587
530
|
);
|
|
588
531
|
}
|
|
589
532
|
|
|
533
|
+
/* eslint-disable jsdoc/valid-types */
|
|
590
534
|
/**
|
|
591
|
-
*
|
|
592
|
-
* be inserted, optionally at a specific index respective a root block list.
|
|
535
|
+
* Action that inserts an array of blocks, optionally at a specific index respective a root block list.
|
|
593
536
|
*
|
|
594
537
|
* @param {Object[]} blocks Block objects to insert.
|
|
595
538
|
* @param {?number} index Index at which block should be inserted.
|
|
@@ -599,14 +542,15 @@ export function insertBlock(
|
|
|
599
542
|
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
|
600
543
|
* @return {Object} Action object.
|
|
601
544
|
*/
|
|
602
|
-
export
|
|
545
|
+
export const insertBlocks = (
|
|
603
546
|
blocks,
|
|
604
547
|
index,
|
|
605
548
|
rootClientId,
|
|
606
549
|
updateSelection = true,
|
|
607
550
|
initialPosition = 0,
|
|
608
551
|
meta
|
|
609
|
-
) {
|
|
552
|
+
) => ( { select, dispatch } ) => {
|
|
553
|
+
/* eslint-enable jsdoc/valid-types */
|
|
610
554
|
if ( isObject( initialPosition ) ) {
|
|
611
555
|
meta = initialPosition;
|
|
612
556
|
initialPosition = 0;
|
|
@@ -619,22 +563,17 @@ export function* insertBlocks(
|
|
|
619
563
|
|
|
620
564
|
blocks = getBlocksWithDefaultStylesApplied(
|
|
621
565
|
castArray( blocks ),
|
|
622
|
-
|
|
566
|
+
select.getSettings()
|
|
623
567
|
);
|
|
624
568
|
const allowedBlocks = [];
|
|
625
569
|
for ( const block of blocks ) {
|
|
626
|
-
const isValid =
|
|
627
|
-
blockEditorStoreName,
|
|
628
|
-
'canInsertBlockType',
|
|
629
|
-
block.name,
|
|
630
|
-
rootClientId
|
|
631
|
-
);
|
|
570
|
+
const isValid = select.canInsertBlockType( block.name, rootClientId );
|
|
632
571
|
if ( isValid ) {
|
|
633
572
|
allowedBlocks.push( block );
|
|
634
573
|
}
|
|
635
574
|
}
|
|
636
575
|
if ( allowedBlocks.length ) {
|
|
637
|
-
|
|
576
|
+
dispatch( {
|
|
638
577
|
type: 'INSERT_BLOCKS',
|
|
639
578
|
blocks: allowedBlocks,
|
|
640
579
|
index,
|
|
@@ -643,13 +582,12 @@ export function* insertBlocks(
|
|
|
643
582
|
updateSelection,
|
|
644
583
|
initialPosition: updateSelection ? initialPosition : null,
|
|
645
584
|
meta,
|
|
646
|
-
};
|
|
585
|
+
} );
|
|
647
586
|
}
|
|
648
|
-
}
|
|
587
|
+
};
|
|
649
588
|
|
|
650
589
|
/**
|
|
651
|
-
*
|
|
652
|
-
* be shown.
|
|
590
|
+
* Action that shows the insertion point.
|
|
653
591
|
*
|
|
654
592
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
655
593
|
* which to insert.
|
|
@@ -673,7 +611,7 @@ export function showInsertionPoint(
|
|
|
673
611
|
}
|
|
674
612
|
|
|
675
613
|
/**
|
|
676
|
-
*
|
|
614
|
+
* Action that hides the insertion point.
|
|
677
615
|
*
|
|
678
616
|
* @return {Object} Action object.
|
|
679
617
|
*/
|
|
@@ -684,7 +622,7 @@ export function hideInsertionPoint() {
|
|
|
684
622
|
}
|
|
685
623
|
|
|
686
624
|
/**
|
|
687
|
-
*
|
|
625
|
+
* Action that resets the template validity.
|
|
688
626
|
*
|
|
689
627
|
* @param {boolean} isValid template validity flag.
|
|
690
628
|
*
|
|
@@ -698,61 +636,45 @@ export function setTemplateValidity( isValid ) {
|
|
|
698
636
|
}
|
|
699
637
|
|
|
700
638
|
/**
|
|
701
|
-
*
|
|
639
|
+
* Action that synchronizes the template with the list of blocks.
|
|
702
640
|
*
|
|
703
641
|
* @return {Object} Action object.
|
|
704
642
|
*/
|
|
705
|
-
export
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
const blocks = yield controls.select( blockEditorStoreName, 'getBlocks' );
|
|
710
|
-
const template = yield controls.select(
|
|
711
|
-
blockEditorStoreName,
|
|
712
|
-
'getTemplate'
|
|
713
|
-
);
|
|
643
|
+
export const synchronizeTemplate = () => ( { select, dispatch } ) => {
|
|
644
|
+
dispatch( { type: 'SYNCHRONIZE_TEMPLATE' } );
|
|
645
|
+
const blocks = select.getBlocks();
|
|
646
|
+
const template = select.getTemplate();
|
|
714
647
|
const updatedBlockList = synchronizeBlocksWithTemplate( blocks, template );
|
|
715
648
|
|
|
716
|
-
|
|
717
|
-
}
|
|
649
|
+
dispatch.resetBlocks( updatedBlockList );
|
|
650
|
+
};
|
|
718
651
|
|
|
719
652
|
/**
|
|
720
|
-
*
|
|
653
|
+
* Action that merges two blocks.
|
|
721
654
|
*
|
|
722
655
|
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
|
723
656
|
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
|
724
657
|
*/
|
|
725
|
-
export
|
|
658
|
+
export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
|
|
659
|
+
select,
|
|
660
|
+
dispatch,
|
|
661
|
+
} ) => {
|
|
726
662
|
const blocks = [ firstBlockClientId, secondBlockClientId ];
|
|
727
|
-
|
|
728
|
-
type: 'MERGE_BLOCKS',
|
|
729
|
-
blocks,
|
|
730
|
-
};
|
|
663
|
+
dispatch( { type: 'MERGE_BLOCKS', blocks } );
|
|
731
664
|
|
|
732
665
|
const [ clientIdA, clientIdB ] = blocks;
|
|
733
|
-
const blockA =
|
|
734
|
-
blockEditorStoreName,
|
|
735
|
-
'getBlock',
|
|
736
|
-
clientIdA
|
|
737
|
-
);
|
|
666
|
+
const blockA = select.getBlock( clientIdA );
|
|
738
667
|
const blockAType = getBlockType( blockA.name );
|
|
739
668
|
|
|
740
669
|
// Only focus the previous block if it's not mergeable
|
|
741
|
-
if ( ! blockAType.merge ) {
|
|
742
|
-
|
|
670
|
+
if ( blockAType && ! blockAType.merge ) {
|
|
671
|
+
dispatch.selectBlock( blockA.clientId );
|
|
743
672
|
return;
|
|
744
673
|
}
|
|
745
674
|
|
|
746
|
-
const blockB =
|
|
747
|
-
blockEditorStoreName,
|
|
748
|
-
'getBlock',
|
|
749
|
-
clientIdB
|
|
750
|
-
);
|
|
675
|
+
const blockB = select.getBlock( clientIdB );
|
|
751
676
|
const blockBType = getBlockType( blockB.name );
|
|
752
|
-
const { clientId, attributeKey, offset } =
|
|
753
|
-
blockEditorStoreName,
|
|
754
|
-
'getSelectionStart'
|
|
755
|
-
);
|
|
677
|
+
const { clientId, attributeKey, offset } = select.getSelectionStart();
|
|
756
678
|
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
|
757
679
|
const attributeDefinition = selectedBlockType.attributes[ attributeKey ];
|
|
758
680
|
const canRestoreTextSelection =
|
|
@@ -859,7 +781,7 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
|
|
|
859
781
|
|
|
860
782
|
updatedAttributes[ newAttributeKey ] = newHtml;
|
|
861
783
|
|
|
862
|
-
|
|
784
|
+
dispatch.selectionChange(
|
|
863
785
|
blockA.clientId,
|
|
864
786
|
newAttributeKey,
|
|
865
787
|
newOffset,
|
|
@@ -867,7 +789,7 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
|
|
|
867
789
|
);
|
|
868
790
|
}
|
|
869
791
|
|
|
870
|
-
|
|
792
|
+
dispatch.replaceBlocks(
|
|
871
793
|
[ blockA.clientId, blockB.clientId ],
|
|
872
794
|
[
|
|
873
795
|
{
|
|
@@ -878,9 +800,10 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
|
|
|
878
800
|
},
|
|
879
801
|
},
|
|
880
802
|
...blocksWithTheSameType.slice( 1 ),
|
|
881
|
-
]
|
|
803
|
+
],
|
|
804
|
+
0 // If we don't pass the `indexToSelect` it will default to the last block.
|
|
882
805
|
);
|
|
883
|
-
}
|
|
806
|
+
};
|
|
884
807
|
|
|
885
808
|
/**
|
|
886
809
|
* Yields action objects used in signalling that the blocks corresponding to
|
|
@@ -890,47 +813,32 @@ export function* mergeBlocks( firstBlockClientId, secondBlockClientId ) {
|
|
|
890
813
|
* @param {boolean} selectPrevious True if the previous block should be
|
|
891
814
|
* selected when a block is removed.
|
|
892
815
|
*/
|
|
893
|
-
export
|
|
816
|
+
export const removeBlocks = ( clientIds, selectPrevious = true ) => ( {
|
|
817
|
+
select,
|
|
818
|
+
dispatch,
|
|
819
|
+
} ) => {
|
|
894
820
|
if ( ! clientIds || ! clientIds.length ) {
|
|
895
821
|
return;
|
|
896
822
|
}
|
|
897
823
|
|
|
898
824
|
clientIds = castArray( clientIds );
|
|
899
|
-
const rootClientId =
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
);
|
|
904
|
-
const isLocked = yield controls.select(
|
|
905
|
-
blockEditorStoreName,
|
|
906
|
-
'getTemplateLock',
|
|
907
|
-
rootClientId
|
|
908
|
-
);
|
|
909
|
-
if ( isLocked ) {
|
|
825
|
+
const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
|
|
826
|
+
const canRemoveBlocks = select.canRemoveBlocks( clientIds, rootClientId );
|
|
827
|
+
|
|
828
|
+
if ( ! canRemoveBlocks ) {
|
|
910
829
|
return;
|
|
911
830
|
}
|
|
912
831
|
|
|
913
|
-
let previousBlockId;
|
|
914
832
|
if ( selectPrevious ) {
|
|
915
|
-
|
|
916
|
-
} else {
|
|
917
|
-
previousBlockId = yield controls.select(
|
|
918
|
-
blockEditorStoreName,
|
|
919
|
-
'getPreviousBlockClientId',
|
|
920
|
-
clientIds[ 0 ]
|
|
921
|
-
);
|
|
833
|
+
dispatch.selectPreviousBlock( clientIds[ 0 ] );
|
|
922
834
|
}
|
|
923
835
|
|
|
924
|
-
|
|
925
|
-
type: 'REMOVE_BLOCKS',
|
|
926
|
-
clientIds,
|
|
927
|
-
};
|
|
836
|
+
dispatch( { type: 'REMOVE_BLOCKS', clientIds } );
|
|
928
837
|
|
|
929
838
|
// To avoid a focus loss when removing the last block, assure there is
|
|
930
839
|
// always a default block if the last of the blocks have been removed.
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
}
|
|
840
|
+
dispatch( ensureDefaultBlock() );
|
|
841
|
+
};
|
|
934
842
|
|
|
935
843
|
/**
|
|
936
844
|
* Returns an action object used in signalling that the block with the
|
|
@@ -946,6 +854,7 @@ export function removeBlock( clientId, selectPrevious ) {
|
|
|
946
854
|
return removeBlocks( [ clientId ], selectPrevious );
|
|
947
855
|
}
|
|
948
856
|
|
|
857
|
+
/* eslint-disable jsdoc/valid-types */
|
|
949
858
|
/**
|
|
950
859
|
* Returns an action object used in signalling that the inner blocks with the
|
|
951
860
|
* specified client ID should be replaced.
|
|
@@ -962,6 +871,7 @@ export function replaceInnerBlocks(
|
|
|
962
871
|
updateSelection = false,
|
|
963
872
|
initialPosition = 0
|
|
964
873
|
) {
|
|
874
|
+
/* eslint-enable jsdoc/valid-types */
|
|
965
875
|
return {
|
|
966
876
|
type: 'REPLACE_INNER_BLOCKS',
|
|
967
877
|
rootClientId,
|
|
@@ -1057,8 +967,7 @@ export function exitFormattedText() {
|
|
|
1057
967
|
}
|
|
1058
968
|
|
|
1059
969
|
/**
|
|
1060
|
-
*
|
|
1061
|
-
* position.
|
|
970
|
+
* Action that changes the position of the user caret.
|
|
1062
971
|
*
|
|
1063
972
|
* @param {string} clientId The selected block client ID.
|
|
1064
973
|
* @param {string} attributeKey The selected block attribute key.
|
|
@@ -1083,8 +992,7 @@ export function selectionChange(
|
|
|
1083
992
|
}
|
|
1084
993
|
|
|
1085
994
|
/**
|
|
1086
|
-
*
|
|
1087
|
-
* type should be added to the block list.
|
|
995
|
+
* Action that adds a new block of the default type to the block list.
|
|
1088
996
|
*
|
|
1089
997
|
* @param {?Object} attributes Optional attributes of the block to assign.
|
|
1090
998
|
* @param {?string} rootClientId Optional root client ID of block list on which
|
|
@@ -1106,7 +1014,7 @@ export function insertDefaultBlock( attributes, rootClientId, index ) {
|
|
|
1106
1014
|
}
|
|
1107
1015
|
|
|
1108
1016
|
/**
|
|
1109
|
-
*
|
|
1017
|
+
* Action that changes the nested settings of a given block.
|
|
1110
1018
|
*
|
|
1111
1019
|
* @param {string} clientId Client ID of the block whose nested setting are
|
|
1112
1020
|
* being received.
|
|
@@ -1123,7 +1031,7 @@ export function updateBlockListSettings( clientId, settings ) {
|
|
|
1123
1031
|
}
|
|
1124
1032
|
|
|
1125
1033
|
/**
|
|
1126
|
-
*
|
|
1034
|
+
* Action that updates the block editor settings.
|
|
1127
1035
|
*
|
|
1128
1036
|
* @param {Object} settings Updated settings
|
|
1129
1037
|
*
|
|
@@ -1137,7 +1045,7 @@ export function updateSettings( settings ) {
|
|
|
1137
1045
|
}
|
|
1138
1046
|
|
|
1139
1047
|
/**
|
|
1140
|
-
*
|
|
1048
|
+
* Action that signals that a temporary reusable block has been saved
|
|
1141
1049
|
* in order to switch its temporary id with the real id.
|
|
1142
1050
|
*
|
|
1143
1051
|
* @param {string} id Reusable block's id.
|
|
@@ -1154,7 +1062,7 @@ export function __unstableSaveReusableBlock( id, updatedId ) {
|
|
|
1154
1062
|
}
|
|
1155
1063
|
|
|
1156
1064
|
/**
|
|
1157
|
-
*
|
|
1065
|
+
* Action that marks the last block change explicitly as persistent.
|
|
1158
1066
|
*
|
|
1159
1067
|
* @return {Object} Action object.
|
|
1160
1068
|
*/
|
|
@@ -1163,7 +1071,7 @@ export function __unstableMarkLastChangeAsPersistent() {
|
|
|
1163
1071
|
}
|
|
1164
1072
|
|
|
1165
1073
|
/**
|
|
1166
|
-
*
|
|
1074
|
+
* Action that signals that the next block change should be marked explicitly as not persistent.
|
|
1167
1075
|
*
|
|
1168
1076
|
* @return {Object} Action object.
|
|
1169
1077
|
*/
|
|
@@ -1172,34 +1080,29 @@ export function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
1172
1080
|
}
|
|
1173
1081
|
|
|
1174
1082
|
/**
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1179
|
-
* it is recommended to be called at the next idle period to ensure all
|
|
1083
|
+
* Action that marks the last block change as an automatic change, meaning it was not
|
|
1084
|
+
* performed by the user, and can be undone using the `Escape` and `Backspace` keys.
|
|
1085
|
+
* This action must be called after the change was made, and any actions that are a
|
|
1086
|
+
* consequence of it, so it is recommended to be called at the next idle period to ensure all
|
|
1180
1087
|
* selection changes have been recorded.
|
|
1181
1088
|
*/
|
|
1182
|
-
export
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
type: 'MARK_AUTOMATIC_CHANGE_FINAL',
|
|
1190
|
-
};
|
|
1191
|
-
}
|
|
1089
|
+
export const __unstableMarkAutomaticChange = () => ( { dispatch } ) => {
|
|
1090
|
+
dispatch( { type: 'MARK_AUTOMATIC_CHANGE' } );
|
|
1091
|
+
const { requestIdleCallback = ( cb ) => setTimeout( cb, 100 ) } = window;
|
|
1092
|
+
requestIdleCallback( () => {
|
|
1093
|
+
dispatch( { type: 'MARK_AUTOMATIC_CHANGE_FINAL' } );
|
|
1094
|
+
} );
|
|
1095
|
+
};
|
|
1192
1096
|
|
|
1193
1097
|
/**
|
|
1194
|
-
*
|
|
1098
|
+
* Action that enables or disables the navigation mode.
|
|
1195
1099
|
*
|
|
1196
1100
|
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
|
1197
1101
|
*/
|
|
1198
|
-
export
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
};
|
|
1102
|
+
export const setNavigationMode = ( isNavigationMode = true ) => ( {
|
|
1103
|
+
dispatch,
|
|
1104
|
+
} ) => {
|
|
1105
|
+
dispatch( { type: 'SET_NAVIGATION_MODE', isNavigationMode } );
|
|
1203
1106
|
|
|
1204
1107
|
if ( isNavigationMode ) {
|
|
1205
1108
|
speak(
|
|
@@ -1214,18 +1117,17 @@ export function* setNavigationMode( isNavigationMode = true ) {
|
|
|
1214
1117
|
)
|
|
1215
1118
|
);
|
|
1216
1119
|
}
|
|
1217
|
-
}
|
|
1120
|
+
};
|
|
1218
1121
|
|
|
1219
1122
|
/**
|
|
1220
|
-
*
|
|
1123
|
+
* Action that enables or disables the block moving mode.
|
|
1221
1124
|
*
|
|
1222
1125
|
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
|
1223
1126
|
*/
|
|
1224
|
-
export
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
};
|
|
1127
|
+
export const setBlockMovingClientId = ( hasBlockMovingClientId = null ) => ( {
|
|
1128
|
+
dispatch,
|
|
1129
|
+
} ) => {
|
|
1130
|
+
dispatch( { type: 'SET_BLOCK_MOVING_MODE', hasBlockMovingClientId } );
|
|
1229
1131
|
|
|
1230
1132
|
if ( hasBlockMovingClientId ) {
|
|
1231
1133
|
speak(
|
|
@@ -1234,133 +1136,105 @@ export function* setBlockMovingClientId( hasBlockMovingClientId = null ) {
|
|
|
1234
1136
|
)
|
|
1235
1137
|
);
|
|
1236
1138
|
}
|
|
1237
|
-
}
|
|
1139
|
+
};
|
|
1238
1140
|
|
|
1239
1141
|
/**
|
|
1240
|
-
*
|
|
1142
|
+
* Action that duplicates a list of blocks.
|
|
1241
1143
|
*
|
|
1242
1144
|
* @param {string[]} clientIds
|
|
1243
1145
|
* @param {boolean} updateSelection
|
|
1244
1146
|
*/
|
|
1245
|
-
export
|
|
1246
|
-
|
|
1147
|
+
export const duplicateBlocks = ( clientIds, updateSelection = true ) => ( {
|
|
1148
|
+
select,
|
|
1149
|
+
dispatch,
|
|
1150
|
+
} ) => {
|
|
1151
|
+
if ( ! clientIds || ! clientIds.length ) {
|
|
1247
1152
|
return;
|
|
1248
1153
|
}
|
|
1249
|
-
|
|
1250
|
-
blockEditorStoreName,
|
|
1251
|
-
'getBlocksByClientId',
|
|
1252
|
-
clientIds
|
|
1253
|
-
);
|
|
1254
|
-
const rootClientId = yield controls.select(
|
|
1255
|
-
blockEditorStoreName,
|
|
1256
|
-
'getBlockRootClientId',
|
|
1257
|
-
clientIds[ 0 ]
|
|
1258
|
-
);
|
|
1154
|
+
|
|
1259
1155
|
// Return early if blocks don't exist.
|
|
1156
|
+
const blocks = select.getBlocksByClientId( clientIds );
|
|
1260
1157
|
if ( some( blocks, ( block ) => ! block ) ) {
|
|
1261
1158
|
return;
|
|
1262
1159
|
}
|
|
1263
|
-
|
|
1160
|
+
|
|
1264
1161
|
// Return early if blocks don't support multiple usage.
|
|
1162
|
+
const blockNames = blocks.map( ( block ) => block.name );
|
|
1265
1163
|
if (
|
|
1266
|
-
some(
|
|
1267
|
-
blockNames,
|
|
1164
|
+
blockNames.some(
|
|
1268
1165
|
( blockName ) => ! hasBlockSupport( blockName, 'multiple', true )
|
|
1269
1166
|
)
|
|
1270
1167
|
) {
|
|
1271
1168
|
return;
|
|
1272
1169
|
}
|
|
1273
1170
|
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
'getBlockIndex',
|
|
1171
|
+
const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
|
|
1172
|
+
const lastSelectedIndex = select.getBlockIndex(
|
|
1277
1173
|
last( castArray( clientIds ) ),
|
|
1278
1174
|
rootClientId
|
|
1279
1175
|
);
|
|
1280
1176
|
const clonedBlocks = blocks.map( ( block ) =>
|
|
1281
1177
|
__experimentalCloneSanitizedBlock( block )
|
|
1282
1178
|
);
|
|
1283
|
-
|
|
1179
|
+
dispatch.insertBlocks(
|
|
1284
1180
|
clonedBlocks,
|
|
1285
1181
|
lastSelectedIndex + 1,
|
|
1286
1182
|
rootClientId,
|
|
1287
1183
|
updateSelection
|
|
1288
1184
|
);
|
|
1289
1185
|
if ( clonedBlocks.length > 1 && updateSelection ) {
|
|
1290
|
-
|
|
1186
|
+
dispatch.multiSelect(
|
|
1291
1187
|
first( clonedBlocks ).clientId,
|
|
1292
1188
|
last( clonedBlocks ).clientId
|
|
1293
1189
|
);
|
|
1294
1190
|
}
|
|
1295
1191
|
return clonedBlocks.map( ( block ) => block.clientId );
|
|
1296
|
-
}
|
|
1192
|
+
};
|
|
1297
1193
|
|
|
1298
1194
|
/**
|
|
1299
|
-
*
|
|
1195
|
+
* Action that inserts an empty block before a given block.
|
|
1300
1196
|
*
|
|
1301
1197
|
* @param {string} clientId
|
|
1302
1198
|
*/
|
|
1303
|
-
export
|
|
1199
|
+
export const insertBeforeBlock = ( clientId ) => ( { select, dispatch } ) => {
|
|
1304
1200
|
if ( ! clientId ) {
|
|
1305
1201
|
return;
|
|
1306
1202
|
}
|
|
1307
|
-
const rootClientId =
|
|
1308
|
-
|
|
1309
|
-
'getBlockRootClientId',
|
|
1310
|
-
clientId
|
|
1311
|
-
);
|
|
1312
|
-
const isLocked = yield controls.select(
|
|
1313
|
-
blockEditorStoreName,
|
|
1314
|
-
'getTemplateLock',
|
|
1315
|
-
rootClientId
|
|
1316
|
-
);
|
|
1203
|
+
const rootClientId = select.getBlockRootClientId( clientId );
|
|
1204
|
+
const isLocked = select.getTemplateLock( rootClientId );
|
|
1317
1205
|
if ( isLocked ) {
|
|
1318
1206
|
return;
|
|
1319
1207
|
}
|
|
1320
1208
|
|
|
1321
|
-
const firstSelectedIndex =
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
clientId,
|
|
1325
|
-
rootClientId
|
|
1326
|
-
);
|
|
1327
|
-
return yield insertDefaultBlock( {}, rootClientId, firstSelectedIndex );
|
|
1328
|
-
}
|
|
1209
|
+
const firstSelectedIndex = select.getBlockIndex( clientId, rootClientId );
|
|
1210
|
+
return dispatch.insertDefaultBlock( {}, rootClientId, firstSelectedIndex );
|
|
1211
|
+
};
|
|
1329
1212
|
|
|
1330
1213
|
/**
|
|
1331
|
-
*
|
|
1214
|
+
* Action that inserts an empty block after a given block.
|
|
1332
1215
|
*
|
|
1333
1216
|
* @param {string} clientId
|
|
1334
1217
|
*/
|
|
1335
|
-
export
|
|
1218
|
+
export const insertAfterBlock = ( clientId ) => ( { select, dispatch } ) => {
|
|
1336
1219
|
if ( ! clientId ) {
|
|
1337
1220
|
return;
|
|
1338
1221
|
}
|
|
1339
|
-
const rootClientId =
|
|
1340
|
-
|
|
1341
|
-
'getBlockRootClientId',
|
|
1342
|
-
clientId
|
|
1343
|
-
);
|
|
1344
|
-
const isLocked = yield controls.select(
|
|
1345
|
-
blockEditorStoreName,
|
|
1346
|
-
'getTemplateLock',
|
|
1347
|
-
rootClientId
|
|
1348
|
-
);
|
|
1222
|
+
const rootClientId = select.getBlockRootClientId( clientId );
|
|
1223
|
+
const isLocked = select.getTemplateLock( rootClientId );
|
|
1349
1224
|
if ( isLocked ) {
|
|
1350
1225
|
return;
|
|
1351
1226
|
}
|
|
1352
1227
|
|
|
1353
|
-
const firstSelectedIndex =
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1228
|
+
const firstSelectedIndex = select.getBlockIndex( clientId, rootClientId );
|
|
1229
|
+
return dispatch.insertDefaultBlock(
|
|
1230
|
+
{},
|
|
1231
|
+
rootClientId,
|
|
1232
|
+
firstSelectedIndex + 1
|
|
1358
1233
|
);
|
|
1359
|
-
|
|
1360
|
-
}
|
|
1234
|
+
};
|
|
1361
1235
|
|
|
1362
1236
|
/**
|
|
1363
|
-
*
|
|
1237
|
+
* Action that toggles the highlighted block state.
|
|
1364
1238
|
*
|
|
1365
1239
|
* @param {string} clientId The block's clientId.
|
|
1366
1240
|
* @param {boolean} isHighlighted The highlight state.
|
|
@@ -1374,22 +1248,18 @@ export function toggleBlockHighlight( clientId, isHighlighted ) {
|
|
|
1374
1248
|
}
|
|
1375
1249
|
|
|
1376
1250
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
* given clientId should appear to "flash" by rhythmically highlighting it.
|
|
1251
|
+
* Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
|
|
1379
1252
|
*
|
|
1380
1253
|
* @param {string} clientId Target block client ID.
|
|
1381
1254
|
*/
|
|
1382
|
-
export
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
};
|
|
1388
|
-
yield toggleBlockHighlight( clientId, false );
|
|
1389
|
-
}
|
|
1255
|
+
export const flashBlock = ( clientId ) => async ( { dispatch } ) => {
|
|
1256
|
+
dispatch( toggleBlockHighlight( clientId, true ) );
|
|
1257
|
+
await new Promise( ( resolve ) => setTimeout( resolve, 150 ) );
|
|
1258
|
+
dispatch( toggleBlockHighlight( clientId, false ) );
|
|
1259
|
+
};
|
|
1390
1260
|
|
|
1391
1261
|
/**
|
|
1392
|
-
*
|
|
1262
|
+
* Action that sets whether a block has controlled inner blocks.
|
|
1393
1263
|
*
|
|
1394
1264
|
* @param {string} clientId The block's clientId.
|
|
1395
1265
|
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|