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