@wordpress/block-editor 7.0.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +47 -4
- package/build/components/autocomplete/index.js +1 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +8 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +61 -14
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-content-overlay/index.js +2 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-controls/fill.js +6 -6
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/groups.js +3 -1
- package/build/components/block-controls/groups.js.map +1 -1
- package/build/components/block-controls/hook.js +57 -0
- package/build/components/block-controls/hook.js.map +1 -0
- package/build/components/block-edit/context.js +6 -5
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +13 -9
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +14 -7
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +31 -12
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js +4 -4
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js +15 -9
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +6 -7
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/grid-item.native.js +68 -0
- package/build/components/block-list/grid-item.native.js.map +1 -0
- package/build/components/block-list/index.js +19 -15
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +13 -9
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +6 -6
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +4 -6
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +1 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -6
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +9 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/index.js +4 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +4 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +42 -14
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +5 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +3 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +3 -0
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-popover.js +8 -7
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -4
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-types-list/index.native.js +3 -2
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +11 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +22 -57
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +18 -12
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/copy-handler/index.js +9 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/duotone-control/index.js +41 -39
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editor-styles/index.js +9 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +44 -12
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-sizes/index.native.js +24 -0
- package/build/components/font-sizes/index.native.js.map +1 -1
- package/build/components/iframe/index.js +46 -63
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build/components/image-editor/constants.js +16 -0
- package/build/components/image-editor/constants.js.map +1 -0
- package/build/components/image-editor/context.js +59 -0
- package/build/components/image-editor/context.js.map +1 -0
- package/build/components/image-editor/cropper.js +83 -0
- package/build/components/image-editor/cropper.js.map +1 -0
- package/build/components/image-editor/form-controls.js +36 -0
- package/build/components/image-editor/form-controls.js.map +1 -0
- package/build/components/image-editor/index.js +60 -0
- package/build/components/image-editor/index.js.map +1 -0
- package/build/components/image-editor/rotation-button.js +37 -0
- package/build/components/image-editor/rotation-button.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +84 -0
- package/build/components/image-editor/use-save-image.js.map +1 -0
- package/build/components/image-editor/use-transform-image.js +135 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -0
- package/build/components/image-editor/zoom-dropdown.js +55 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build/components/image-size-control/use-dimension-handler.js +14 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +42 -37
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +12 -7
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +11 -1
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +28 -10
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +42 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +3 -6
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/index.js +12 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +18 -17
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +9 -2
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -4
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +44 -0
- package/build/components/inserter/utils.native.js.map +1 -0
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build/components/inspector-controls/fill.js +64 -0
- package/build/components/inspector-controls/fill.js.map +1 -0
- package/build/components/inspector-controls/{index.native.js → fill.native.js} +20 -19
- package/build/components/inspector-controls/fill.native.js.map +1 -0
- package/build/components/inspector-controls/groups.js +25 -0
- package/build/components/inspector-controls/groups.js.map +1 -0
- package/build/components/inspector-controls/index.js +22 -20
- package/build/components/inspector-controls/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +67 -0
- package/build/components/inspector-controls/slot.js.map +1 -0
- package/build/components/inspector-controls/slot.native.js +38 -0
- package/build/components/inspector-controls/slot.native.js.map +1 -0
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.native.js +39 -0
- package/build/components/line-height-control/index.native.js.map +1 -0
- package/build/components/link-control/index.js +93 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +45 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +25 -7
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +54 -69
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +102 -76
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +53 -23
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +13 -54
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.js +35 -21
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +2 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +1 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +66 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +32 -11
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +29 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +43 -5
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/input-event.js +25 -24
- package/build/components/rich-text/input-event.js.map +1 -1
- package/build/components/rich-text/shortcut.js +23 -9
- package/build/components/rich-text/shortcut.js.map +1 -1
- package/build/components/rich-text/use-input-events.js +27 -0
- package/build/components/rich-text/use-input-events.js.map +1 -0
- package/build/components/rich-text/use-paste-handler.js +45 -10
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-shortcuts.js +27 -0
- package/build/components/rich-text/use-shortcuts.js.map +1 -0
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-input/index.js +25 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-display-block-controls/index.js +5 -7
- package/build/components/use-display-block-controls/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +13 -10
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +2 -13
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-setting/index.js +49 -14
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +6 -0
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +18 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +14 -14
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +4 -2
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border-color.js +9 -5
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +5 -2
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +6 -4
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/compat.js +23 -0
- package/build/hooks/compat.js.map +1 -0
- package/build/hooks/custom-class-name.js +3 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/dimensions.js +63 -28
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +63 -18
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +123 -32
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +163 -0
- package/build/hooks/gap.js.map +1 -0
- package/build/hooks/index.js +12 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +10 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +47 -30
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/letter-spacing.js +45 -8
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +43 -0
- package/build/hooks/lock.js.map +1 -0
- package/build/hooks/margin.js +6 -3
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +6 -3
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +39 -11
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +109 -9
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +60 -0
- package/build/hooks/typography.native.js.map +1 -0
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +215 -11
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +99 -6
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +331 -266
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +16 -1
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +165 -114
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +203 -115
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +10 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +295 -0
- package/build/utils/parse-css-unit-to-px.js.map +1 -0
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +8 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +64 -17
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +2 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +6 -5
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/groups.js +3 -1
- package/build-module/components/block-controls/groups.js.map +1 -1
- package/build-module/components/block-controls/hook.js +42 -0
- package/build-module/components/block-controls/hook.js.map +1 -0
- package/build-module/components/block-edit/context.js +4 -4
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-icon/index.native.js +14 -9
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +12 -6
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +30 -12
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +3 -4
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +16 -10
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +6 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/grid-item.native.js +57 -0
- package/build-module/components/block-list/grid-item.native.js.map +1 -0
- package/build-module/components/block-list/index.js +17 -14
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +13 -9
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +7 -7
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +2 -2
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -6
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +9 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +4 -4
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +40 -16
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +5 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +3 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +3 -0
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +9 -8
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -4
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +3 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +26 -63
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +13 -10
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/copy-handler/index.js +9 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +43 -39
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +7 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +40 -12
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-sizes/index.native.js +3 -1
- package/build-module/components/font-sizes/index.native.js.map +1 -1
- package/build-module/components/iframe/index.js +47 -65
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build-module/components/image-editor/constants.js +7 -0
- package/build-module/components/image-editor/constants.js.map +1 -0
- package/build-module/components/image-editor/context.js +44 -0
- package/build-module/components/image-editor/context.js.map +1 -0
- package/build-module/components/image-editor/cropper.js +69 -0
- package/build-module/components/image-editor/cropper.js.map +1 -0
- package/build-module/components/image-editor/form-controls.js +26 -0
- package/build-module/components/image-editor/form-controls.js.map +1 -0
- package/build-module/components/image-editor/index.js +37 -0
- package/build-module/components/image-editor/index.js.map +1 -0
- package/build-module/components/image-editor/rotation-button.js +26 -0
- package/build-module/components/image-editor/rotation-button.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +70 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -0
- package/build-module/components/image-editor/use-transform-image.js +127 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js +43 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +5 -6
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -3
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +10 -1
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +29 -11
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +41 -5
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -36
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +2 -5
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/index.js +12 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +17 -17
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +8 -2
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -4
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +35 -0
- package/build-module/components/inserter/utils.native.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build-module/components/inspector-controls/fill.js +50 -0
- package/build-module/components/inspector-controls/fill.js.map +1 -0
- package/build-module/components/inspector-controls/{index.native.js → fill.native.js} +16 -18
- package/build-module/components/inspector-controls/fill.native.js.map +1 -0
- package/build-module/components/inspector-controls/groups.js +16 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -0
- package/build-module/components/inspector-controls/index.js +16 -17
- package/build-module/components/inspector-controls/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +52 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -0
- package/build-module/components/inspector-controls/slot.native.js +27 -0
- package/build-module/components/inspector-controls/slot.native.js.map +1 -0
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +29 -0
- package/build-module/components/line-height-control/index.native.js.map +1 -0
- package/build-module/components/link-control/index.js +93 -35
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +46 -17
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +24 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +56 -71
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +102 -78
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +55 -27
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +35 -21
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +2 -1
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +1 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +29 -11
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +22 -6
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +43 -6
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/input-event.js +24 -22
- package/build-module/components/rich-text/input-event.js.map +1 -1
- package/build-module/components/rich-text/shortcut.js +22 -9
- package/build-module/components/rich-text/shortcut.js.map +1 -1
- package/build-module/components/rich-text/use-input-events.js +19 -0
- package/build-module/components/rich-text/use-input-events.js.map +1 -0
- package/build-module/components/rich-text/use-paste-handler.js +44 -10
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-shortcuts.js +19 -0
- package/build-module/components/rich-text/use-shortcuts.js.map +1 -0
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-input/index.js +25 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.js +5 -7
- package/build-module/components/use-display-block-controls/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +13 -10
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +2 -10
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -14
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +6 -0
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +18 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +15 -15
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +5 -3
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border-color.js +10 -5
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +6 -3
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +6 -4
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/compat.js +20 -0
- package/build-module/hooks/compat.js.map +1 -0
- package/build-module/hooks/custom-class-name.js +4 -2
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/dimensions.js +57 -26
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +62 -18
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +117 -33
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +140 -0
- package/build-module/hooks/gap.js.map +1 -0
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +2 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +47 -30
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +41 -8
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +33 -0
- package/build-module/hooks/lock.js.map +1 -0
- package/build-module/hooks/margin.js +7 -4
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +7 -4
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +39 -11
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +118 -19
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +41 -0
- package/build-module/hooks/typography.native.js.map +1 -0
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +210 -12
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +99 -7
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +294 -242
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +15 -1
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +167 -115
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +189 -104
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +285 -0
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -0
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/default-editor-styles-rtl.css +114 -0
- package/build-style/default-editor-styles.css +114 -0
- package/build-style/style-rtl.css +292 -181
- package/build-style/style.css +292 -181
- package/build-types/components/block-context/index.d.ts +1 -1
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/package.json +28 -27
- package/src/components/autocomplete/index.js +5 -2
- package/src/components/block-actions/index.js +9 -5
- package/src/components/block-alignment-control/style.scss +5 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
- package/src/components/block-alignment-control/test/index.native.js +37 -0
- package/src/components/block-alignment-control/ui.js +98 -27
- package/src/components/block-alignment-control/use-available-alignments.js +31 -10
- package/src/components/block-content-overlay/index.js +3 -6
- package/src/components/block-content-overlay/style.scss +9 -21
- package/src/components/block-controls/fill.js +7 -4
- package/src/components/block-controls/groups.js +2 -0
- package/src/components/block-controls/hook.js +44 -0
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-edit/context.js +4 -3
- package/src/components/block-edit/edit.js +1 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +11 -12
- package/src/components/block-inspector/index.js +19 -9
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block-list-item.native.js +34 -11
- package/src/components/block-list/block-list-item.native.scss +4 -0
- package/src/components/block-list/block-selection-button.native.js +8 -5
- package/src/components/block-list/block.js +13 -9
- package/src/components/block-list/block.native.js +7 -5
- package/src/components/block-list/grid-item.native.js +58 -0
- package/src/components/block-list/index.js +33 -27
- package/src/components/block-list/index.native.js +10 -4
- package/src/components/block-list/style.native.scss +0 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/index.js +4 -7
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +5 -7
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +2 -8
- package/src/components/block-list/use-block-props/use-multi-selection.js +30 -4
- package/src/components/block-list/use-in-between-inserter.js +9 -0
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-mover/index.js +4 -4
- package/src/components/block-mover/index.native.js +4 -4
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
- package/src/components/block-mover/test/index.native.js +26 -28
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/auto.js +36 -18
- package/src/components/block-preview/style.scss +0 -20
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-styles/index.js +6 -1
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-switcher/index.js +7 -3
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-switcher/test/index.js +3 -0
- package/src/components/block-title/index.js +5 -2
- package/src/components/block-toolbar/index.js +4 -0
- package/src/components/block-tools/block-contextual-toolbar.js +7 -5
- package/src/components/block-tools/block-popover.js +8 -8
- package/src/components/block-tools/block-selection-button.js +2 -4
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/block-types-list/index.native.js +8 -2
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/block-variation-picker/README.md +47 -14
- package/src/components/block-variation-picker/style.native.scss +4 -0
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
- package/src/components/colors/test/utils.js +41 -0
- package/src/components/colors/utils.js +9 -5
- package/src/components/colors-gradients/control.js +70 -110
- package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
- package/src/components/colors-gradients/style.scss +10 -18
- package/src/components/colors-gradients/test/control.js +41 -66
- package/src/components/contrast-checker/index.js +14 -10
- package/src/components/copy-handler/index.js +6 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/duotone-control/index.js +49 -41
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/editor-styles/index.js +8 -4
- package/src/components/font-appearance-control/index.js +62 -24
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/font-sizes/index.native.js +7 -1
- package/src/components/iframe/index.js +64 -75
- package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
- package/src/components/image-editor/constants.js +6 -0
- package/src/components/image-editor/context.js +56 -0
- package/src/components/image-editor/cropper.js +74 -0
- package/src/components/image-editor/form-controls.js +22 -0
- package/src/components/image-editor/index.js +52 -0
- package/src/components/image-editor/rotation-button.js +24 -0
- package/src/components/image-editor/use-save-image.js +97 -0
- package/src/components/image-editor/use-transform-image.js +162 -0
- package/src/components/image-editor/zoom-dropdown.js +40 -0
- package/src/components/image-size-control/use-dimension-handler.js +18 -1
- package/src/components/index.js +10 -8
- package/src/components/index.native.js +5 -3
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +43 -14
- package/src/components/inner-blocks/index.native.js +48 -4
- package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -73
- package/src/components/inserter/block-types-tab.native.js +3 -6
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/index.js +15 -3
- package/src/components/inserter/index.native.js +2 -19
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +4 -1
- package/src/components/inserter/menu.native.js +18 -15
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
- package/src/components/inserter/search-results.native.js +8 -1
- package/src/components/inserter/style.native.scss +8 -5
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/tabs.native.js +1 -7
- package/src/components/inserter/test/block-types-tab.native.js +3 -2
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inserter/utils.native.js +35 -0
- package/src/components/inserter-list-item/style.scss +4 -2
- package/src/components/inspector-controls/README.md +43 -198
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
- package/src/components/inspector-controls/fill.js +53 -0
- package/src/components/inspector-controls/{index.native.js → fill.native.js} +14 -14
- package/src/components/inspector-controls/groups.js +22 -0
- package/src/components/inspector-controls/index.js +16 -18
- package/src/components/inspector-controls/slot.js +45 -0
- package/src/components/inspector-controls/slot.native.js +22 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/line-height-control/index.native.js +25 -0
- package/src/components/link-control/README.md +47 -14
- package/src/components/link-control/index.js +102 -31
- package/src/components/link-control/link-preview.js +53 -20
- package/src/components/link-control/search-input.js +21 -7
- package/src/components/link-control/style.scss +66 -19
- package/src/components/link-control/test/index.js +311 -4
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +73 -84
- package/src/components/list-view/branch.js +123 -94
- package/src/components/list-view/index.js +95 -37
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +70 -33
- package/src/components/list-view/use-list-view-client-ids.js +9 -68
- package/src/components/media-placeholder/README.md +9 -0
- package/src/components/media-placeholder/index.js +31 -20
- package/src/components/media-placeholder/index.native.js +2 -1
- package/src/components/media-placeholder/style.scss +2 -0
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-replace-flow/style.scss +11 -12
- package/src/components/media-upload/README.md +1 -1
- package/src/components/navigable-toolbar/index.js +1 -4
- package/src/components/observe-typing/index.js +3 -2
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +68 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +25 -6
- package/src/components/rich-text/index.js +38 -12
- package/src/components/rich-text/index.native.js +37 -4
- package/src/components/rich-text/input-event.js +21 -20
- package/src/components/rich-text/shortcut.js +24 -9
- package/src/components/rich-text/style.scss +7 -5
- package/src/components/rich-text/use-input-events.js +19 -0
- package/src/components/rich-text/use-paste-handler.js +47 -12
- package/src/components/rich-text/use-shortcuts.js +19 -0
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/tool-selector/style.scss +5 -5
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-display-block-controls/index.js +7 -10
- package/src/components/use-moving-animation/index.js +9 -8
- package/src/components/use-on-block-drop/index.js +5 -1
- package/src/components/use-resize-canvas/index.js +2 -17
- package/src/components/use-setting/index.js +48 -16
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +21 -11
- package/src/default-editor-styles.scss +24 -0
- package/src/hooks/align.js +28 -20
- package/src/hooks/anchor.js +5 -5
- package/src/hooks/border-color.js +12 -1
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +11 -4
- package/src/hooks/compat.js +23 -0
- package/src/hooks/custom-class-name.js +3 -3
- package/src/hooks/dimensions.js +94 -50
- package/src/hooks/duotone.js +70 -21
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +129 -33
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/gap.js +146 -0
- package/src/hooks/index.js +3 -0
- package/src/hooks/index.native.js +2 -0
- package/src/hooks/layout.js +82 -56
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +37 -8
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +13 -3
- package/src/hooks/padding.js +13 -3
- package/src/hooks/style.js +57 -18
- package/src/hooks/test/style.js +4 -0
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +167 -21
- package/src/hooks/typography.native.js +64 -0
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +237 -14
- package/src/layouts/flow.js +81 -14
- package/src/store/actions.js +248 -378
- package/src/store/defaults.js +2 -0
- package/src/store/defaults.native.js +15 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +248 -145
- package/src/store/selectors.js +212 -158
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +184 -146
- package/src/store/test/selectors.js +197 -177
- package/src/style.scss +2 -15
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +272 -0
- package/src/utils/test/parse-css-unit-to-px.js +166 -0
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -466
- package/build/components/block-list/head.js +0 -27
- package/build/components/block-list/head.js.map +0 -1
- package/build/components/duotone-control/duotone-picker-popover.js +0 -44
- package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build/components/inspector-advanced-controls/index.js +0 -46
- package/build/components/inspector-advanced-controls/index.js.map +0 -1
- package/build/components/inspector-controls/index.native.js.map +0 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/components/use-simulated-media-query/index.js +0 -137
- package/build/components/use-simulated-media-query/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/block-list/head.js +0 -19
- package/build-module/components/block-list/head.js.map +0 -1
- package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
- package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build-module/components/inspector-advanced-controls/index.js +0 -36
- package/build-module/components/inspector-advanced-controls/index.js.map +0 -1
- package/build-module/components/inspector-controls/index.native.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/components/use-simulated-media-query/index.js +0 -126
- package/build-module/components/use-simulated-media-query/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/block-list/head.js +0 -18
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/inspector-advanced-controls/README.md +0 -72
- package/src/components/inspector-advanced-controls/index.js +0 -32
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/components/use-simulated-media-query/index.js +0 -144
- package/src/store/controls.js +0 -39
package/build/store/actions.js
CHANGED
|
@@ -5,32 +5,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.resetBlocks = resetBlocks;
|
|
9
|
-
exports.validateBlocksToTemplate = validateBlocksToTemplate;
|
|
10
8
|
exports.resetSelection = resetSelection;
|
|
11
9
|
exports.receiveBlocks = receiveBlocks;
|
|
12
10
|
exports.updateBlockAttributes = updateBlockAttributes;
|
|
13
11
|
exports.updateBlock = updateBlock;
|
|
14
12
|
exports.selectBlock = selectBlock;
|
|
15
|
-
exports.selectPreviousBlock = selectPreviousBlock;
|
|
16
|
-
exports.selectNextBlock = selectNextBlock;
|
|
17
13
|
exports.startMultiSelect = startMultiSelect;
|
|
18
14
|
exports.stopMultiSelect = stopMultiSelect;
|
|
19
|
-
exports.multiSelect = multiSelect;
|
|
20
15
|
exports.clearSelectedBlock = clearSelectedBlock;
|
|
21
16
|
exports.toggleSelection = toggleSelection;
|
|
22
|
-
exports.replaceBlocks = replaceBlocks;
|
|
23
17
|
exports.replaceBlock = replaceBlock;
|
|
24
|
-
exports.moveBlocksToPosition = moveBlocksToPosition;
|
|
25
18
|
exports.moveBlockToPosition = moveBlockToPosition;
|
|
26
19
|
exports.insertBlock = insertBlock;
|
|
27
|
-
exports.insertBlocks = insertBlocks;
|
|
28
20
|
exports.showInsertionPoint = showInsertionPoint;
|
|
29
21
|
exports.hideInsertionPoint = hideInsertionPoint;
|
|
30
22
|
exports.setTemplateValidity = setTemplateValidity;
|
|
31
|
-
exports.synchronizeTemplate = synchronizeTemplate;
|
|
32
|
-
exports.mergeBlocks = mergeBlocks;
|
|
33
|
-
exports.removeBlocks = removeBlocks;
|
|
34
23
|
exports.removeBlock = removeBlock;
|
|
35
24
|
exports.replaceInnerBlocks = replaceInnerBlocks;
|
|
36
25
|
exports.toggleBlockMode = toggleBlockMode;
|
|
@@ -47,17 +36,9 @@ exports.updateSettings = updateSettings;
|
|
|
47
36
|
exports.__unstableSaveReusableBlock = __unstableSaveReusableBlock;
|
|
48
37
|
exports.__unstableMarkLastChangeAsPersistent = __unstableMarkLastChangeAsPersistent;
|
|
49
38
|
exports.__unstableMarkNextChangeAsNotPersistent = __unstableMarkNextChangeAsNotPersistent;
|
|
50
|
-
exports.__unstableMarkAutomaticChange = __unstableMarkAutomaticChange;
|
|
51
|
-
exports.__unstableMarkAutomaticChangeFinal = __unstableMarkAutomaticChangeFinal;
|
|
52
|
-
exports.setNavigationMode = setNavigationMode;
|
|
53
|
-
exports.setBlockMovingClientId = setBlockMovingClientId;
|
|
54
|
-
exports.duplicateBlocks = duplicateBlocks;
|
|
55
|
-
exports.insertBeforeBlock = insertBeforeBlock;
|
|
56
|
-
exports.insertAfterBlock = insertAfterBlock;
|
|
57
39
|
exports.toggleBlockHighlight = toggleBlockHighlight;
|
|
58
|
-
exports.flashBlock = flashBlock;
|
|
59
40
|
exports.setHasControlledInnerBlocks = setHasControlledInnerBlocks;
|
|
60
|
-
exports.moveBlocksUp = exports.moveBlocksDown = void 0;
|
|
41
|
+
exports.flashBlock = exports.insertAfterBlock = exports.insertBeforeBlock = exports.duplicateBlocks = exports.setBlockMovingClientId = exports.setNavigationMode = exports.__unstableMarkAutomaticChange = exports.removeBlocks = exports.mergeBlocks = exports.synchronizeTemplate = exports.insertBlocks = exports.moveBlocksToPosition = exports.moveBlocksUp = exports.moveBlocksDown = exports.replaceBlocks = exports.multiSelect = exports.selectNextBlock = exports.selectPreviousBlock = exports.validateBlocksToTemplate = exports.resetBlocks = void 0;
|
|
61
42
|
|
|
62
43
|
var _lodash = require("lodash");
|
|
63
44
|
|
|
@@ -67,16 +48,10 @@ var _a11y = require("@wordpress/a11y");
|
|
|
67
48
|
|
|
68
49
|
var _i18n = require("@wordpress/i18n");
|
|
69
50
|
|
|
70
|
-
var _data = require("@wordpress/data");
|
|
71
|
-
|
|
72
51
|
var _richText = require("@wordpress/rich-text");
|
|
73
52
|
|
|
74
53
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
75
54
|
|
|
76
|
-
var _controls = require("../store/controls");
|
|
77
|
-
|
|
78
|
-
var _constants = require("./constants");
|
|
79
|
-
|
|
80
55
|
/**
|
|
81
56
|
* External dependencies
|
|
82
57
|
*/
|
|
@@ -86,49 +61,53 @@ var _constants = require("./constants");
|
|
|
86
61
|
*/
|
|
87
62
|
|
|
88
63
|
/**
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Generator which will yield a default block insert action if there
|
|
94
|
-
* are no other blocks at the root of the editor. This generator should be used
|
|
64
|
+
* Action which will insert a default block insert action if there
|
|
65
|
+
* are no other blocks at the root of the editor. This action should be used
|
|
95
66
|
* in actions which may result in no blocks remaining in the editor (removal,
|
|
96
67
|
* replacement, etc).
|
|
97
68
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
69
|
+
const ensureDefaultBlock = () => ({
|
|
70
|
+
select,
|
|
71
|
+
dispatch
|
|
72
|
+
}) => {
|
|
73
|
+
// To avoid a focus loss when removing the last block, assure there is
|
|
100
74
|
// always a default block if the last of the blocks have been removed.
|
|
75
|
+
const count = select.getBlockCount();
|
|
101
76
|
|
|
102
|
-
if (count
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// prevent it from being lost though.
|
|
77
|
+
if (count > 0) {
|
|
78
|
+
return;
|
|
79
|
+
} // If there's an custom appender, don't insert default block.
|
|
80
|
+
// We have to remember to manually move the focus elsewhere to
|
|
81
|
+
// prevent it from being lost though.
|
|
108
82
|
|
|
109
|
-
if (__unstableHasCustomAppender) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
83
|
|
|
113
|
-
|
|
84
|
+
const {
|
|
85
|
+
__unstableHasCustomAppender
|
|
86
|
+
} = select.getSettings();
|
|
87
|
+
|
|
88
|
+
if (__unstableHasCustomAppender) {
|
|
89
|
+
return;
|
|
114
90
|
}
|
|
115
|
-
|
|
91
|
+
|
|
92
|
+
dispatch.insertDefaultBlock();
|
|
93
|
+
};
|
|
116
94
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* content reflected as an edit in state.
|
|
95
|
+
* Action that resets blocks state to the specified array of blocks, taking precedence
|
|
96
|
+
* over any other content reflected as an edit in state.
|
|
120
97
|
*
|
|
121
98
|
* @param {Array} blocks Array of blocks.
|
|
122
99
|
*/
|
|
123
100
|
|
|
124
101
|
|
|
125
|
-
|
|
126
|
-
|
|
102
|
+
const resetBlocks = blocks => ({
|
|
103
|
+
dispatch
|
|
104
|
+
}) => {
|
|
105
|
+
dispatch({
|
|
127
106
|
type: 'RESET_BLOCKS',
|
|
128
107
|
blocks
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
}
|
|
108
|
+
});
|
|
109
|
+
dispatch(validateBlocksToTemplate(blocks));
|
|
110
|
+
};
|
|
132
111
|
/**
|
|
133
112
|
* Block validity is a function of blocks state (at the point of a
|
|
134
113
|
* reset) and the template setting. As a compromise to its placement
|
|
@@ -139,20 +118,25 @@ function* resetBlocks(blocks) {
|
|
|
139
118
|
*/
|
|
140
119
|
|
|
141
120
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
exports.resetBlocks = resetBlocks;
|
|
122
|
+
|
|
123
|
+
const validateBlocksToTemplate = blocks => ({
|
|
124
|
+
select,
|
|
125
|
+
dispatch
|
|
126
|
+
}) => {
|
|
127
|
+
const template = select.getTemplate();
|
|
128
|
+
const templateLock = select.getTemplateLock(); // Unlocked templates are considered always valid because they act
|
|
145
129
|
// as default values only.
|
|
146
130
|
|
|
147
131
|
const isBlocksValidToTemplate = !template || templateLock !== 'all' || (0, _blocks.doBlocksMatchTemplate)(blocks, template); // Update if validity has changed.
|
|
148
132
|
|
|
149
|
-
const isValidTemplate =
|
|
133
|
+
const isValidTemplate = select.isValidTemplate();
|
|
150
134
|
|
|
151
135
|
if (isBlocksValidToTemplate !== isValidTemplate) {
|
|
152
|
-
|
|
136
|
+
dispatch.setTemplateValidity(isBlocksValidToTemplate);
|
|
153
137
|
return isBlocksValidToTemplate;
|
|
154
138
|
}
|
|
155
|
-
}
|
|
139
|
+
};
|
|
156
140
|
/**
|
|
157
141
|
* A block selection object.
|
|
158
142
|
*
|
|
@@ -164,6 +148,8 @@ function* validateBlocksToTemplate(blocks) {
|
|
|
164
148
|
* text value. See `wp.richText.create`.
|
|
165
149
|
*/
|
|
166
150
|
|
|
151
|
+
/* eslint-disable jsdoc/valid-types */
|
|
152
|
+
|
|
167
153
|
/**
|
|
168
154
|
* Returns an action object used in signalling that selection state should be
|
|
169
155
|
* reset to the specified selection.
|
|
@@ -176,7 +162,10 @@ function* validateBlocksToTemplate(blocks) {
|
|
|
176
162
|
*/
|
|
177
163
|
|
|
178
164
|
|
|
165
|
+
exports.validateBlocksToTemplate = validateBlocksToTemplate;
|
|
166
|
+
|
|
179
167
|
function resetSelection(selectionStart, selectionEnd, initialPosition) {
|
|
168
|
+
/* eslint-enable jsdoc/valid-types */
|
|
180
169
|
return {
|
|
181
170
|
type: 'RESET_SELECTION',
|
|
182
171
|
selectionStart,
|
|
@@ -189,6 +178,8 @@ function resetSelection(selectionStart, selectionEnd, initialPosition) {
|
|
|
189
178
|
* Unlike resetBlocks, these should be appended to the existing known set, not
|
|
190
179
|
* replacing.
|
|
191
180
|
*
|
|
181
|
+
* @deprecated
|
|
182
|
+
*
|
|
192
183
|
* @param {Object[]} blocks Array of block objects.
|
|
193
184
|
*
|
|
194
185
|
* @return {Object} Action object.
|
|
@@ -196,14 +187,17 @@ function resetSelection(selectionStart, selectionEnd, initialPosition) {
|
|
|
196
187
|
|
|
197
188
|
|
|
198
189
|
function receiveBlocks(blocks) {
|
|
190
|
+
(0, _deprecated.default)('wp.data.dispatch( "core/block-editor" ).receiveBlocks', {
|
|
191
|
+
since: '5.9',
|
|
192
|
+
alternative: 'resetBlocks or insertBlocks'
|
|
193
|
+
});
|
|
199
194
|
return {
|
|
200
195
|
type: 'RECEIVE_BLOCKS',
|
|
201
196
|
blocks
|
|
202
197
|
};
|
|
203
198
|
}
|
|
204
199
|
/**
|
|
205
|
-
*
|
|
206
|
-
* attributes with the specified client IDs have been updated.
|
|
200
|
+
* Action that updates attributes of multiple blocks with the specified client IDs.
|
|
207
201
|
*
|
|
208
202
|
* @param {string|string[]} clientIds Block client IDs.
|
|
209
203
|
* @param {Object} attributes Block attributes to be merged. Should be keyed by clientIds if
|
|
@@ -222,8 +216,7 @@ function updateBlockAttributes(clientIds, attributes, uniqueByBlock = false) {
|
|
|
222
216
|
};
|
|
223
217
|
}
|
|
224
218
|
/**
|
|
225
|
-
*
|
|
226
|
-
* specified client ID has been updated.
|
|
219
|
+
* Action that updates the block with the specified client ID.
|
|
227
220
|
*
|
|
228
221
|
* @param {string} clientId Block client ID.
|
|
229
222
|
* @param {Object} updates Block attributes to be merged.
|
|
@@ -239,6 +232,8 @@ function updateBlock(clientId, updates) {
|
|
|
239
232
|
updates
|
|
240
233
|
};
|
|
241
234
|
}
|
|
235
|
+
/* eslint-disable jsdoc/valid-types */
|
|
236
|
+
|
|
242
237
|
/**
|
|
243
238
|
* Returns an action object used in signalling that the block with the
|
|
244
239
|
* specified client ID has been selected, optionally accepting a position
|
|
@@ -254,6 +249,7 @@ function updateBlock(clientId, updates) {
|
|
|
254
249
|
|
|
255
250
|
|
|
256
251
|
function selectBlock(clientId, initialPosition = 0) {
|
|
252
|
+
/* eslint-enable jsdoc/valid-types */
|
|
257
253
|
return {
|
|
258
254
|
type: 'SELECT_BLOCK',
|
|
259
255
|
initialPosition,
|
|
@@ -268,14 +264,16 @@ function selectBlock(clientId, initialPosition = 0) {
|
|
|
268
264
|
*/
|
|
269
265
|
|
|
270
266
|
|
|
271
|
-
|
|
272
|
-
|
|
267
|
+
const selectPreviousBlock = clientId => ({
|
|
268
|
+
select,
|
|
269
|
+
dispatch
|
|
270
|
+
}) => {
|
|
271
|
+
const previousBlockClientId = select.getPreviousBlockClientId(clientId);
|
|
273
272
|
|
|
274
273
|
if (previousBlockClientId) {
|
|
275
|
-
|
|
276
|
-
return [previousBlockClientId];
|
|
274
|
+
dispatch.selectBlock(previousBlockClientId, -1);
|
|
277
275
|
}
|
|
278
|
-
}
|
|
276
|
+
};
|
|
279
277
|
/**
|
|
280
278
|
* Yields action objects used in signalling that the block following the given
|
|
281
279
|
* clientId should be selected.
|
|
@@ -284,28 +282,34 @@ function* selectPreviousBlock(clientId) {
|
|
|
284
282
|
*/
|
|
285
283
|
|
|
286
284
|
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
exports.selectPreviousBlock = selectPreviousBlock;
|
|
286
|
+
|
|
287
|
+
const selectNextBlock = clientId => ({
|
|
288
|
+
select,
|
|
289
|
+
dispatch
|
|
290
|
+
}) => {
|
|
291
|
+
const nextBlockClientId = select.getNextBlockClientId(clientId);
|
|
289
292
|
|
|
290
293
|
if (nextBlockClientId) {
|
|
291
|
-
|
|
292
|
-
return [nextBlockClientId];
|
|
294
|
+
dispatch.selectBlock(nextBlockClientId);
|
|
293
295
|
}
|
|
294
|
-
}
|
|
296
|
+
};
|
|
295
297
|
/**
|
|
296
|
-
*
|
|
298
|
+
* Action that starts block multi-selection.
|
|
297
299
|
*
|
|
298
300
|
* @return {Object} Action object.
|
|
299
301
|
*/
|
|
300
302
|
|
|
301
303
|
|
|
304
|
+
exports.selectNextBlock = selectNextBlock;
|
|
305
|
+
|
|
302
306
|
function startMultiSelect() {
|
|
303
307
|
return {
|
|
304
308
|
type: 'START_MULTI_SELECT'
|
|
305
309
|
};
|
|
306
310
|
}
|
|
307
311
|
/**
|
|
308
|
-
*
|
|
312
|
+
* Action that stops block multi-selection.
|
|
309
313
|
*
|
|
310
314
|
* @return {Object} Action object.
|
|
311
315
|
*/
|
|
@@ -317,45 +321,50 @@ function stopMultiSelect() {
|
|
|
317
321
|
};
|
|
318
322
|
}
|
|
319
323
|
/**
|
|
320
|
-
*
|
|
324
|
+
* Action that changes block multi-selection.
|
|
321
325
|
*
|
|
322
326
|
* @param {string} start First block of the multi selection.
|
|
323
327
|
* @param {string} end Last block of the multiselection.
|
|
324
328
|
*/
|
|
325
329
|
|
|
326
330
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
331
|
+
const multiSelect = (start, end) => ({
|
|
332
|
+
select,
|
|
333
|
+
dispatch
|
|
334
|
+
}) => {
|
|
335
|
+
const startBlockRootClientId = select.getBlockRootClientId(start);
|
|
336
|
+
const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
|
|
330
337
|
|
|
331
338
|
if (startBlockRootClientId !== endBlockRootClientId) {
|
|
332
339
|
return;
|
|
333
340
|
}
|
|
334
341
|
|
|
335
|
-
|
|
342
|
+
dispatch({
|
|
336
343
|
type: 'MULTI_SELECT',
|
|
337
344
|
start,
|
|
338
345
|
end
|
|
339
|
-
};
|
|
340
|
-
const blockCount =
|
|
346
|
+
});
|
|
347
|
+
const blockCount = select.getSelectedBlockCount();
|
|
341
348
|
(0, _a11y.speak)((0, _i18n.sprintf)(
|
|
342
349
|
/* translators: %s: number of selected blocks */
|
|
343
350
|
(0, _i18n._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
|
344
|
-
}
|
|
351
|
+
};
|
|
345
352
|
/**
|
|
346
|
-
*
|
|
353
|
+
* Action that clears the block selection.
|
|
347
354
|
*
|
|
348
355
|
* @return {Object} Action object.
|
|
349
356
|
*/
|
|
350
357
|
|
|
351
358
|
|
|
359
|
+
exports.multiSelect = multiSelect;
|
|
360
|
+
|
|
352
361
|
function clearSelectedBlock() {
|
|
353
362
|
return {
|
|
354
363
|
type: 'CLEAR_SELECTED_BLOCK'
|
|
355
364
|
};
|
|
356
365
|
}
|
|
357
366
|
/**
|
|
358
|
-
*
|
|
367
|
+
* Action that enables or disables block selection.
|
|
359
368
|
*
|
|
360
369
|
* @param {boolean} [isSelectionEnabled=true] Whether block selection should
|
|
361
370
|
* be enabled.
|
|
@@ -405,9 +414,10 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
|
405
414
|
};
|
|
406
415
|
});
|
|
407
416
|
}
|
|
417
|
+
/* eslint-disable jsdoc/valid-types */
|
|
418
|
+
|
|
408
419
|
/**
|
|
409
|
-
*
|
|
410
|
-
* one or more replacement blocks.
|
|
420
|
+
* Action that replaces given blocks with one or more replacement blocks.
|
|
411
421
|
*
|
|
412
422
|
* @param {(string|string[])} clientIds Block client ID(s) to replace.
|
|
413
423
|
* @param {(Object|Object[])} blocks Replacement block(s).
|
|
@@ -415,25 +425,29 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
|
415
425
|
* @param {0|-1|null} initialPosition Index of caret after in the selected block after the operation.
|
|
416
426
|
* @param {?Object} meta Optional Meta values to be passed to the action object.
|
|
417
427
|
*
|
|
418
|
-
* @
|
|
428
|
+
* @return {Object} Action object.
|
|
419
429
|
*/
|
|
420
430
|
|
|
421
431
|
|
|
422
|
-
|
|
432
|
+
const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({
|
|
433
|
+
select,
|
|
434
|
+
dispatch
|
|
435
|
+
}) => {
|
|
436
|
+
/* eslint-enable jsdoc/valid-types */
|
|
423
437
|
clientIds = (0, _lodash.castArray)(clientIds);
|
|
424
|
-
blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks),
|
|
425
|
-
const rootClientId =
|
|
438
|
+
blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks), select.getSettings());
|
|
439
|
+
const rootClientId = select.getBlockRootClientId((0, _lodash.first)(clientIds)); // Replace is valid if the new blocks can be inserted in the root block.
|
|
426
440
|
|
|
427
441
|
for (let index = 0; index < blocks.length; index++) {
|
|
428
442
|
const block = blocks[index];
|
|
429
|
-
const canInsertBlock =
|
|
443
|
+
const canInsertBlock = select.canInsertBlockType(block.name, rootClientId);
|
|
430
444
|
|
|
431
445
|
if (!canInsertBlock) {
|
|
432
446
|
return;
|
|
433
447
|
}
|
|
434
448
|
}
|
|
435
449
|
|
|
436
|
-
|
|
450
|
+
dispatch({
|
|
437
451
|
type: 'REPLACE_BLOCKS',
|
|
438
452
|
clientIds,
|
|
439
453
|
blocks,
|
|
@@ -441,12 +455,11 @@ function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, m
|
|
|
441
455
|
indexToSelect,
|
|
442
456
|
initialPosition,
|
|
443
457
|
meta
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
}
|
|
458
|
+
});
|
|
459
|
+
dispatch(ensureDefaultBlock());
|
|
460
|
+
};
|
|
447
461
|
/**
|
|
448
|
-
*
|
|
449
|
-
* with one or more replacement blocks.
|
|
462
|
+
* Action that replaces a single block with one or more replacement blocks.
|
|
450
463
|
*
|
|
451
464
|
* @param {(string|string[])} clientId Block client ID to replace.
|
|
452
465
|
* @param {(Object|Object[])} block Replacement block(s).
|
|
@@ -455,6 +468,8 @@ function* replaceBlocks(clientIds, blocks, indexToSelect, initialPosition = 0, m
|
|
|
455
468
|
*/
|
|
456
469
|
|
|
457
470
|
|
|
471
|
+
exports.replaceBlocks = replaceBlocks;
|
|
472
|
+
|
|
458
473
|
function replaceBlock(clientId, block) {
|
|
459
474
|
return replaceBlocks(clientId, block);
|
|
460
475
|
}
|
|
@@ -468,86 +483,89 @@ function replaceBlock(clientId, block) {
|
|
|
468
483
|
*/
|
|
469
484
|
|
|
470
485
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
486
|
+
const createOnMove = type => (clientIds, rootClientId) => ({
|
|
487
|
+
select,
|
|
488
|
+
dispatch
|
|
489
|
+
}) => {
|
|
490
|
+
// If one of the blocks is locked or the parent is locked, we cannot move any block.
|
|
491
|
+
const canMoveBlocks = select.canMoveBlocks(clientIds, rootClientId);
|
|
492
|
+
|
|
493
|
+
if (!canMoveBlocks) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
dispatch({
|
|
498
|
+
type,
|
|
499
|
+
clientIds: (0, _lodash.castArray)(clientIds),
|
|
500
|
+
rootClientId
|
|
501
|
+
});
|
|
502
|
+
};
|
|
480
503
|
|
|
481
504
|
const moveBlocksDown = createOnMove('MOVE_BLOCKS_DOWN');
|
|
482
505
|
exports.moveBlocksDown = moveBlocksDown;
|
|
483
506
|
const moveBlocksUp = createOnMove('MOVE_BLOCKS_UP');
|
|
484
507
|
/**
|
|
485
|
-
*
|
|
486
|
-
* a new position.
|
|
508
|
+
* Action that moves given blocks to a new position.
|
|
487
509
|
*
|
|
488
510
|
* @param {?string} clientIds The client IDs of the blocks.
|
|
489
511
|
* @param {?string} fromRootClientId Root client ID source.
|
|
490
512
|
* @param {?string} toRootClientId Root client ID destination.
|
|
491
513
|
* @param {number} index The index to move the blocks to.
|
|
492
|
-
*
|
|
493
|
-
* @yield {Object} Action object.
|
|
494
514
|
*/
|
|
495
515
|
|
|
496
516
|
exports.moveBlocksUp = moveBlocksUp;
|
|
497
517
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
518
|
+
const moveBlocksToPosition = (clientIds, fromRootClientId = '', toRootClientId = '', index) => ({
|
|
519
|
+
select,
|
|
520
|
+
dispatch
|
|
521
|
+
}) => {
|
|
522
|
+
const canMoveBlocks = select.canMoveBlocks(clientIds, fromRootClientId); // If one of the blocks is locked or the parent is locked, we cannot move any block.
|
|
501
523
|
|
|
502
|
-
if (
|
|
524
|
+
if (!canMoveBlocks) {
|
|
503
525
|
return;
|
|
526
|
+
} // If moving inside the same root block the move is always possible.
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
if (fromRootClientId !== toRootClientId) {
|
|
530
|
+
const canRemoveBlocks = select.canRemoveBlocks(clientIds, fromRootClientId); // If we're moving to another block, it means we're deleting blocks from
|
|
531
|
+
// the original block, so we need to check if removing is possible.
|
|
532
|
+
|
|
533
|
+
if (!canRemoveBlocks) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
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.
|
|
538
|
+
|
|
539
|
+
if (!canInsertBlocks) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
504
542
|
}
|
|
505
543
|
|
|
506
|
-
|
|
544
|
+
dispatch({
|
|
507
545
|
type: 'MOVE_BLOCKS_TO_POSITION',
|
|
508
546
|
fromRootClientId,
|
|
509
547
|
toRootClientId,
|
|
510
548
|
clientIds,
|
|
511
549
|
index
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
if (fromRootClientId === toRootClientId) {
|
|
515
|
-
yield action;
|
|
516
|
-
return;
|
|
517
|
-
} // If templateLock is insert we can not remove the block from the parent.
|
|
518
|
-
// Given that here we know that we are moving the block to a different
|
|
519
|
-
// parent, the move should not be possible if the condition is true.
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if (templateLock === 'insert') {
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
const canInsertBlocks = yield _data.controls.select(_constants.STORE_NAME, '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.
|
|
527
|
-
|
|
528
|
-
if (canInsertBlocks) {
|
|
529
|
-
yield action;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
550
|
+
});
|
|
551
|
+
};
|
|
532
552
|
/**
|
|
533
|
-
*
|
|
534
|
-
* new position.
|
|
553
|
+
* Action that moves given block to a new position.
|
|
535
554
|
*
|
|
536
555
|
* @param {?string} clientId The client ID of the block.
|
|
537
556
|
* @param {?string} fromRootClientId Root client ID source.
|
|
538
557
|
* @param {?string} toRootClientId Root client ID destination.
|
|
539
558
|
* @param {number} index The index to move the block to.
|
|
540
|
-
*
|
|
541
|
-
* @yield {Object} Action object.
|
|
542
559
|
*/
|
|
543
560
|
|
|
544
561
|
|
|
545
|
-
|
|
546
|
-
|
|
562
|
+
exports.moveBlocksToPosition = moveBlocksToPosition;
|
|
563
|
+
|
|
564
|
+
function moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId = '', index) {
|
|
565
|
+
return moveBlocksToPosition([clientId], fromRootClientId, toRootClientId, index);
|
|
547
566
|
}
|
|
548
567
|
/**
|
|
549
|
-
*
|
|
550
|
-
* inserted, optionally at a specific index respective a root block list.
|
|
568
|
+
* Action that inserts a single block, optionally at a specific index respective a root block list.
|
|
551
569
|
*
|
|
552
570
|
* @param {Object} block Block object to insert.
|
|
553
571
|
* @param {?number} index Index at which block should be inserted.
|
|
@@ -559,12 +577,13 @@ function* moveBlockToPosition(clientId, fromRootClientId = '', toRootClientId =
|
|
|
559
577
|
*/
|
|
560
578
|
|
|
561
579
|
|
|
562
|
-
function insertBlock(block, index, rootClientId, updateSelection
|
|
580
|
+
function insertBlock(block, index, rootClientId, updateSelection, meta) {
|
|
563
581
|
return insertBlocks([block], index, rootClientId, updateSelection, 0, meta);
|
|
564
582
|
}
|
|
583
|
+
/* eslint-disable jsdoc/valid-types */
|
|
584
|
+
|
|
565
585
|
/**
|
|
566
|
-
*
|
|
567
|
-
* be inserted, optionally at a specific index respective a root block list.
|
|
586
|
+
* Action that inserts an array of blocks, optionally at a specific index respective a root block list.
|
|
568
587
|
*
|
|
569
588
|
* @param {Object[]} blocks Block objects to insert.
|
|
570
589
|
* @param {?number} index Index at which block should be inserted.
|
|
@@ -576,7 +595,11 @@ function insertBlock(block, index, rootClientId, updateSelection = true, meta) {
|
|
|
576
595
|
*/
|
|
577
596
|
|
|
578
597
|
|
|
579
|
-
|
|
598
|
+
const insertBlocks = (blocks, index, rootClientId, updateSelection = true, initialPosition = 0, meta) => ({
|
|
599
|
+
select,
|
|
600
|
+
dispatch
|
|
601
|
+
}) => {
|
|
602
|
+
/* eslint-enable jsdoc/valid-types */
|
|
580
603
|
if ((0, _lodash.isObject)(initialPosition)) {
|
|
581
604
|
meta = initialPosition;
|
|
582
605
|
initialPosition = 0;
|
|
@@ -587,11 +610,11 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
|
587
610
|
});
|
|
588
611
|
}
|
|
589
612
|
|
|
590
|
-
blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks),
|
|
613
|
+
blocks = getBlocksWithDefaultStylesApplied((0, _lodash.castArray)(blocks), select.getSettings());
|
|
591
614
|
const allowedBlocks = [];
|
|
592
615
|
|
|
593
616
|
for (const block of blocks) {
|
|
594
|
-
const isValid =
|
|
617
|
+
const isValid = select.canInsertBlockType(block.name, rootClientId);
|
|
595
618
|
|
|
596
619
|
if (isValid) {
|
|
597
620
|
allowedBlocks.push(block);
|
|
@@ -599,7 +622,7 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
|
599
622
|
}
|
|
600
623
|
|
|
601
624
|
if (allowedBlocks.length) {
|
|
602
|
-
|
|
625
|
+
dispatch({
|
|
603
626
|
type: 'INSERT_BLOCKS',
|
|
604
627
|
blocks: allowedBlocks,
|
|
605
628
|
index,
|
|
@@ -608,12 +631,11 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
|
608
631
|
updateSelection,
|
|
609
632
|
initialPosition: updateSelection ? initialPosition : null,
|
|
610
633
|
meta
|
|
611
|
-
};
|
|
634
|
+
});
|
|
612
635
|
}
|
|
613
|
-
}
|
|
636
|
+
};
|
|
614
637
|
/**
|
|
615
|
-
*
|
|
616
|
-
* be shown.
|
|
638
|
+
* Action that shows the insertion point.
|
|
617
639
|
*
|
|
618
640
|
* @param {?string} rootClientId Optional root client ID of block list on
|
|
619
641
|
* which to insert.
|
|
@@ -624,6 +646,8 @@ function* insertBlocks(blocks, index, rootClientId, updateSelection = true, init
|
|
|
624
646
|
*/
|
|
625
647
|
|
|
626
648
|
|
|
649
|
+
exports.insertBlocks = insertBlocks;
|
|
650
|
+
|
|
627
651
|
function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
|
|
628
652
|
const {
|
|
629
653
|
__unstableWithInserter
|
|
@@ -636,7 +660,7 @@ function showInsertionPoint(rootClientId, index, __unstableOptions = {}) {
|
|
|
636
660
|
};
|
|
637
661
|
}
|
|
638
662
|
/**
|
|
639
|
-
*
|
|
663
|
+
* Action that hides the insertion point.
|
|
640
664
|
*
|
|
641
665
|
* @return {Object} Action object.
|
|
642
666
|
*/
|
|
@@ -648,7 +672,7 @@ function hideInsertionPoint() {
|
|
|
648
672
|
};
|
|
649
673
|
}
|
|
650
674
|
/**
|
|
651
|
-
*
|
|
675
|
+
* Action that resets the template validity.
|
|
652
676
|
*
|
|
653
677
|
* @param {boolean} isValid template validity flag.
|
|
654
678
|
*
|
|
@@ -663,51 +687,59 @@ function setTemplateValidity(isValid) {
|
|
|
663
687
|
};
|
|
664
688
|
}
|
|
665
689
|
/**
|
|
666
|
-
*
|
|
690
|
+
* Action that synchronizes the template with the list of blocks.
|
|
667
691
|
*
|
|
668
692
|
* @return {Object} Action object.
|
|
669
693
|
*/
|
|
670
694
|
|
|
671
695
|
|
|
672
|
-
|
|
673
|
-
|
|
696
|
+
const synchronizeTemplate = () => ({
|
|
697
|
+
select,
|
|
698
|
+
dispatch
|
|
699
|
+
}) => {
|
|
700
|
+
dispatch({
|
|
674
701
|
type: 'SYNCHRONIZE_TEMPLATE'
|
|
675
|
-
};
|
|
676
|
-
const blocks =
|
|
677
|
-
const template =
|
|
702
|
+
});
|
|
703
|
+
const blocks = select.getBlocks();
|
|
704
|
+
const template = select.getTemplate();
|
|
678
705
|
const updatedBlockList = (0, _blocks.synchronizeBlocksWithTemplate)(blocks, template);
|
|
679
|
-
|
|
680
|
-
}
|
|
706
|
+
dispatch.resetBlocks(updatedBlockList);
|
|
707
|
+
};
|
|
681
708
|
/**
|
|
682
|
-
*
|
|
709
|
+
* Action that merges two blocks.
|
|
683
710
|
*
|
|
684
711
|
* @param {string} firstBlockClientId Client ID of the first block to merge.
|
|
685
712
|
* @param {string} secondBlockClientId Client ID of the second block to merge.
|
|
686
713
|
*/
|
|
687
714
|
|
|
688
715
|
|
|
689
|
-
|
|
716
|
+
exports.synchronizeTemplate = synchronizeTemplate;
|
|
717
|
+
|
|
718
|
+
const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({
|
|
719
|
+
select,
|
|
720
|
+
dispatch
|
|
721
|
+
}) => {
|
|
690
722
|
const blocks = [firstBlockClientId, secondBlockClientId];
|
|
691
|
-
|
|
723
|
+
dispatch({
|
|
692
724
|
type: 'MERGE_BLOCKS',
|
|
693
725
|
blocks
|
|
694
|
-
};
|
|
726
|
+
});
|
|
695
727
|
const [clientIdA, clientIdB] = blocks;
|
|
696
|
-
const blockA =
|
|
728
|
+
const blockA = select.getBlock(clientIdA);
|
|
697
729
|
const blockAType = (0, _blocks.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable
|
|
698
730
|
|
|
699
|
-
if (!blockAType.merge) {
|
|
700
|
-
|
|
731
|
+
if (blockAType && !blockAType.merge) {
|
|
732
|
+
dispatch.selectBlock(blockA.clientId);
|
|
701
733
|
return;
|
|
702
734
|
}
|
|
703
735
|
|
|
704
|
-
const blockB =
|
|
736
|
+
const blockB = select.getBlock(clientIdB);
|
|
705
737
|
const blockBType = (0, _blocks.getBlockType)(blockB.name);
|
|
706
738
|
const {
|
|
707
739
|
clientId,
|
|
708
740
|
attributeKey,
|
|
709
741
|
offset
|
|
710
|
-
} =
|
|
742
|
+
} = select.getSelectionStart();
|
|
711
743
|
const selectedBlockType = clientId === clientIdA ? blockAType : blockBType;
|
|
712
744
|
const attributeDefinition = selectedBlockType.attributes[attributeKey];
|
|
713
745
|
const canRestoreTextSelection = (clientId === clientIdA || clientId === clientIdB) && attributeKey !== undefined && offset !== undefined && // We cannot restore text selection if the RichText identifier
|
|
@@ -785,15 +817,16 @@ function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
|
|
785
817
|
preserveWhiteSpace
|
|
786
818
|
});
|
|
787
819
|
updatedAttributes[newAttributeKey] = newHtml;
|
|
788
|
-
|
|
820
|
+
dispatch.selectionChange(blockA.clientId, newAttributeKey, newOffset, newOffset);
|
|
789
821
|
}
|
|
790
822
|
|
|
791
|
-
|
|
823
|
+
dispatch.replaceBlocks([blockA.clientId, blockB.clientId], [{ ...blockA,
|
|
792
824
|
attributes: { ...blockA.attributes,
|
|
793
825
|
...updatedAttributes
|
|
794
826
|
}
|
|
795
|
-
}, ...blocksWithTheSameType.slice(1)]
|
|
796
|
-
|
|
827
|
+
}, ...blocksWithTheSameType.slice(1)], 0 // If we don't pass the `indexToSelect` it will default to the last block.
|
|
828
|
+
);
|
|
829
|
+
};
|
|
797
830
|
/**
|
|
798
831
|
* Yields action objects used in signalling that the blocks corresponding to
|
|
799
832
|
* the set of specified client IDs are to be removed.
|
|
@@ -804,36 +837,36 @@ function* mergeBlocks(firstBlockClientId, secondBlockClientId) {
|
|
|
804
837
|
*/
|
|
805
838
|
|
|
806
839
|
|
|
807
|
-
|
|
840
|
+
exports.mergeBlocks = mergeBlocks;
|
|
841
|
+
|
|
842
|
+
const removeBlocks = (clientIds, selectPrevious = true) => ({
|
|
843
|
+
select,
|
|
844
|
+
dispatch
|
|
845
|
+
}) => {
|
|
808
846
|
if (!clientIds || !clientIds.length) {
|
|
809
847
|
return;
|
|
810
848
|
}
|
|
811
849
|
|
|
812
850
|
clientIds = (0, _lodash.castArray)(clientIds);
|
|
813
|
-
const rootClientId =
|
|
814
|
-
const
|
|
851
|
+
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
|
852
|
+
const canRemoveBlocks = select.canRemoveBlocks(clientIds, rootClientId);
|
|
815
853
|
|
|
816
|
-
if (
|
|
854
|
+
if (!canRemoveBlocks) {
|
|
817
855
|
return;
|
|
818
856
|
}
|
|
819
857
|
|
|
820
|
-
let previousBlockId;
|
|
821
|
-
|
|
822
858
|
if (selectPrevious) {
|
|
823
|
-
|
|
824
|
-
} else {
|
|
825
|
-
previousBlockId = yield _data.controls.select(_constants.STORE_NAME, 'getPreviousBlockClientId', clientIds[0]);
|
|
859
|
+
dispatch.selectPreviousBlock(clientIds[0]);
|
|
826
860
|
}
|
|
827
861
|
|
|
828
|
-
|
|
862
|
+
dispatch({
|
|
829
863
|
type: 'REMOVE_BLOCKS',
|
|
830
864
|
clientIds
|
|
831
|
-
}; // To avoid a focus loss when removing the last block, assure there is
|
|
865
|
+
}); // To avoid a focus loss when removing the last block, assure there is
|
|
832
866
|
// always a default block if the last of the blocks have been removed.
|
|
833
867
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
868
|
+
dispatch(ensureDefaultBlock());
|
|
869
|
+
};
|
|
837
870
|
/**
|
|
838
871
|
* Returns an action object used in signalling that the block with the
|
|
839
872
|
* specified client ID is to be removed.
|
|
@@ -846,9 +879,13 @@ function* removeBlocks(clientIds, selectPrevious = true) {
|
|
|
846
879
|
*/
|
|
847
880
|
|
|
848
881
|
|
|
882
|
+
exports.removeBlocks = removeBlocks;
|
|
883
|
+
|
|
849
884
|
function removeBlock(clientId, selectPrevious) {
|
|
850
885
|
return removeBlocks([clientId], selectPrevious);
|
|
851
886
|
}
|
|
887
|
+
/* eslint-disable jsdoc/valid-types */
|
|
888
|
+
|
|
852
889
|
/**
|
|
853
890
|
* Returns an action object used in signalling that the inner blocks with the
|
|
854
891
|
* specified client ID should be replaced.
|
|
@@ -862,6 +899,7 @@ function removeBlock(clientId, selectPrevious) {
|
|
|
862
899
|
|
|
863
900
|
|
|
864
901
|
function replaceInnerBlocks(rootClientId, blocks, updateSelection = false, initialPosition = 0) {
|
|
902
|
+
/* eslint-enable jsdoc/valid-types */
|
|
865
903
|
return {
|
|
866
904
|
type: 'REPLACE_INNER_BLOCKS',
|
|
867
905
|
rootClientId,
|
|
@@ -963,8 +1001,7 @@ function exitFormattedText() {
|
|
|
963
1001
|
};
|
|
964
1002
|
}
|
|
965
1003
|
/**
|
|
966
|
-
*
|
|
967
|
-
* position.
|
|
1004
|
+
* Action that changes the position of the user caret.
|
|
968
1005
|
*
|
|
969
1006
|
* @param {string} clientId The selected block client ID.
|
|
970
1007
|
* @param {string} attributeKey The selected block attribute key.
|
|
@@ -985,8 +1022,7 @@ function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
|
985
1022
|
};
|
|
986
1023
|
}
|
|
987
1024
|
/**
|
|
988
|
-
*
|
|
989
|
-
* type should be added to the block list.
|
|
1025
|
+
* Action that adds a new block of the default type to the block list.
|
|
990
1026
|
*
|
|
991
1027
|
* @param {?Object} attributes Optional attributes of the block to assign.
|
|
992
1028
|
* @param {?string} rootClientId Optional root client ID of block list on which
|
|
@@ -1009,7 +1045,7 @@ function insertDefaultBlock(attributes, rootClientId, index) {
|
|
|
1009
1045
|
return insertBlock(block, index, rootClientId);
|
|
1010
1046
|
}
|
|
1011
1047
|
/**
|
|
1012
|
-
*
|
|
1048
|
+
* Action that changes the nested settings of a given block.
|
|
1013
1049
|
*
|
|
1014
1050
|
* @param {string} clientId Client ID of the block whose nested setting are
|
|
1015
1051
|
* being received.
|
|
@@ -1027,7 +1063,7 @@ function updateBlockListSettings(clientId, settings) {
|
|
|
1027
1063
|
};
|
|
1028
1064
|
}
|
|
1029
1065
|
/**
|
|
1030
|
-
*
|
|
1066
|
+
* Action that updates the block editor settings.
|
|
1031
1067
|
*
|
|
1032
1068
|
* @param {Object} settings Updated settings
|
|
1033
1069
|
*
|
|
@@ -1042,7 +1078,7 @@ function updateSettings(settings) {
|
|
|
1042
1078
|
};
|
|
1043
1079
|
}
|
|
1044
1080
|
/**
|
|
1045
|
-
*
|
|
1081
|
+
* Action that signals that a temporary reusable block has been saved
|
|
1046
1082
|
* in order to switch its temporary id with the real id.
|
|
1047
1083
|
*
|
|
1048
1084
|
* @param {string} id Reusable block's id.
|
|
@@ -1060,7 +1096,7 @@ function __unstableSaveReusableBlock(id, updatedId) {
|
|
|
1060
1096
|
};
|
|
1061
1097
|
}
|
|
1062
1098
|
/**
|
|
1063
|
-
*
|
|
1099
|
+
* Action that marks the last block change explicitly as persistent.
|
|
1064
1100
|
*
|
|
1065
1101
|
* @return {Object} Action object.
|
|
1066
1102
|
*/
|
|
@@ -1072,7 +1108,7 @@ function __unstableMarkLastChangeAsPersistent() {
|
|
|
1072
1108
|
};
|
|
1073
1109
|
}
|
|
1074
1110
|
/**
|
|
1075
|
-
*
|
|
1111
|
+
* Action that signals that the next block change should be marked explicitly as not persistent.
|
|
1076
1112
|
*
|
|
1077
1113
|
* @return {Object} Action object.
|
|
1078
1114
|
*/
|
|
@@ -1084,151 +1120,180 @@ function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
1084
1120
|
};
|
|
1085
1121
|
}
|
|
1086
1122
|
/**
|
|
1087
|
-
*
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1091
|
-
* it is recommended to be called at the next idle period to ensure all
|
|
1123
|
+
* Action that marks the last block change as an automatic change, meaning it was not
|
|
1124
|
+
* performed by the user, and can be undone using the `Escape` and `Backspace` keys.
|
|
1125
|
+
* This action must be called after the change was made, and any actions that are a
|
|
1126
|
+
* consequence of it, so it is recommended to be called at the next idle period to ensure all
|
|
1092
1127
|
* selection changes have been recorded.
|
|
1093
1128
|
*/
|
|
1094
1129
|
|
|
1095
1130
|
|
|
1096
|
-
|
|
1097
|
-
|
|
1131
|
+
const __unstableMarkAutomaticChange = () => ({
|
|
1132
|
+
dispatch
|
|
1133
|
+
}) => {
|
|
1134
|
+
dispatch({
|
|
1098
1135
|
type: 'MARK_AUTOMATIC_CHANGE'
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
}
|
|
1136
|
+
});
|
|
1137
|
+
const {
|
|
1138
|
+
requestIdleCallback = cb => setTimeout(cb, 100)
|
|
1139
|
+
} = window;
|
|
1140
|
+
requestIdleCallback(() => {
|
|
1141
|
+
dispatch({
|
|
1142
|
+
type: 'MARK_AUTOMATIC_CHANGE_FINAL'
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
};
|
|
1108
1146
|
/**
|
|
1109
|
-
*
|
|
1147
|
+
* Action that enables or disables the navigation mode.
|
|
1110
1148
|
*
|
|
1111
1149
|
* @param {string} isNavigationMode Enable/Disable navigation mode.
|
|
1112
1150
|
*/
|
|
1113
1151
|
|
|
1114
1152
|
|
|
1115
|
-
|
|
1116
|
-
|
|
1153
|
+
exports.__unstableMarkAutomaticChange = __unstableMarkAutomaticChange;
|
|
1154
|
+
|
|
1155
|
+
const setNavigationMode = (isNavigationMode = true) => ({
|
|
1156
|
+
dispatch
|
|
1157
|
+
}) => {
|
|
1158
|
+
dispatch({
|
|
1117
1159
|
type: 'SET_NAVIGATION_MODE',
|
|
1118
1160
|
isNavigationMode
|
|
1119
|
-
};
|
|
1161
|
+
});
|
|
1120
1162
|
|
|
1121
1163
|
if (isNavigationMode) {
|
|
1122
1164
|
(0, _a11y.speak)((0, _i18n.__)('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.'));
|
|
1123
1165
|
} else {
|
|
1124
1166
|
(0, _a11y.speak)((0, _i18n.__)('You are currently in edit mode. To return to the navigation mode, press Escape.'));
|
|
1125
1167
|
}
|
|
1126
|
-
}
|
|
1168
|
+
};
|
|
1127
1169
|
/**
|
|
1128
|
-
*
|
|
1170
|
+
* Action that enables or disables the block moving mode.
|
|
1129
1171
|
*
|
|
1130
1172
|
* @param {string|null} hasBlockMovingClientId Enable/Disable block moving mode.
|
|
1131
1173
|
*/
|
|
1132
1174
|
|
|
1133
1175
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1176
|
+
exports.setNavigationMode = setNavigationMode;
|
|
1177
|
+
|
|
1178
|
+
const setBlockMovingClientId = (hasBlockMovingClientId = null) => ({
|
|
1179
|
+
dispatch
|
|
1180
|
+
}) => {
|
|
1181
|
+
dispatch({
|
|
1136
1182
|
type: 'SET_BLOCK_MOVING_MODE',
|
|
1137
1183
|
hasBlockMovingClientId
|
|
1138
|
-
};
|
|
1184
|
+
});
|
|
1139
1185
|
|
|
1140
1186
|
if (hasBlockMovingClientId) {
|
|
1141
1187
|
(0, _a11y.speak)((0, _i18n.__)('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.'));
|
|
1142
1188
|
}
|
|
1143
|
-
}
|
|
1189
|
+
};
|
|
1144
1190
|
/**
|
|
1145
|
-
*
|
|
1191
|
+
* Action that duplicates a list of blocks.
|
|
1146
1192
|
*
|
|
1147
1193
|
* @param {string[]} clientIds
|
|
1148
1194
|
* @param {boolean} updateSelection
|
|
1149
1195
|
*/
|
|
1150
1196
|
|
|
1151
1197
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1198
|
+
exports.setBlockMovingClientId = setBlockMovingClientId;
|
|
1199
|
+
|
|
1200
|
+
const duplicateBlocks = (clientIds, updateSelection = true) => ({
|
|
1201
|
+
select,
|
|
1202
|
+
dispatch
|
|
1203
|
+
}) => {
|
|
1204
|
+
if (!clientIds || !clientIds.length) {
|
|
1154
1205
|
return;
|
|
1155
|
-
}
|
|
1206
|
+
} // Return early if blocks don't exist.
|
|
1207
|
+
|
|
1156
1208
|
|
|
1157
|
-
const blocks =
|
|
1158
|
-
const rootClientId = yield _data.controls.select(_constants.STORE_NAME, 'getBlockRootClientId', clientIds[0]); // Return early if blocks don't exist.
|
|
1209
|
+
const blocks = select.getBlocksByClientId(clientIds);
|
|
1159
1210
|
|
|
1160
1211
|
if ((0, _lodash.some)(blocks, block => !block)) {
|
|
1161
1212
|
return;
|
|
1162
|
-
}
|
|
1213
|
+
} // Return early if blocks don't support multiple usage.
|
|
1214
|
+
|
|
1163
1215
|
|
|
1164
|
-
const blockNames = blocks.map(block => block.name);
|
|
1216
|
+
const blockNames = blocks.map(block => block.name);
|
|
1165
1217
|
|
|
1166
|
-
if (
|
|
1218
|
+
if (blockNames.some(blockName => !(0, _blocks.hasBlockSupport)(blockName, 'multiple', true))) {
|
|
1167
1219
|
return;
|
|
1168
1220
|
}
|
|
1169
1221
|
|
|
1170
|
-
const
|
|
1222
|
+
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
|
1223
|
+
const lastSelectedIndex = select.getBlockIndex((0, _lodash.last)((0, _lodash.castArray)(clientIds)), rootClientId);
|
|
1171
1224
|
const clonedBlocks = blocks.map(block => (0, _blocks.__experimentalCloneSanitizedBlock)(block));
|
|
1172
|
-
|
|
1225
|
+
dispatch.insertBlocks(clonedBlocks, lastSelectedIndex + 1, rootClientId, updateSelection);
|
|
1173
1226
|
|
|
1174
1227
|
if (clonedBlocks.length > 1 && updateSelection) {
|
|
1175
|
-
|
|
1228
|
+
dispatch.multiSelect((0, _lodash.first)(clonedBlocks).clientId, (0, _lodash.last)(clonedBlocks).clientId);
|
|
1176
1229
|
}
|
|
1177
1230
|
|
|
1178
1231
|
return clonedBlocks.map(block => block.clientId);
|
|
1179
|
-
}
|
|
1232
|
+
};
|
|
1180
1233
|
/**
|
|
1181
|
-
*
|
|
1234
|
+
* Action that inserts an empty block before a given block.
|
|
1182
1235
|
*
|
|
1183
1236
|
* @param {string} clientId
|
|
1184
1237
|
*/
|
|
1185
1238
|
|
|
1186
1239
|
|
|
1187
|
-
|
|
1240
|
+
exports.duplicateBlocks = duplicateBlocks;
|
|
1241
|
+
|
|
1242
|
+
const insertBeforeBlock = clientId => ({
|
|
1243
|
+
select,
|
|
1244
|
+
dispatch
|
|
1245
|
+
}) => {
|
|
1188
1246
|
if (!clientId) {
|
|
1189
1247
|
return;
|
|
1190
1248
|
}
|
|
1191
1249
|
|
|
1192
|
-
const rootClientId =
|
|
1193
|
-
const isLocked =
|
|
1250
|
+
const rootClientId = select.getBlockRootClientId(clientId);
|
|
1251
|
+
const isLocked = select.getTemplateLock(rootClientId);
|
|
1194
1252
|
|
|
1195
1253
|
if (isLocked) {
|
|
1196
1254
|
return;
|
|
1197
1255
|
}
|
|
1198
1256
|
|
|
1199
|
-
const firstSelectedIndex =
|
|
1200
|
-
return
|
|
1201
|
-
}
|
|
1257
|
+
const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
|
|
1258
|
+
return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex);
|
|
1259
|
+
};
|
|
1202
1260
|
/**
|
|
1203
|
-
*
|
|
1261
|
+
* Action that inserts an empty block after a given block.
|
|
1204
1262
|
*
|
|
1205
1263
|
* @param {string} clientId
|
|
1206
1264
|
*/
|
|
1207
1265
|
|
|
1208
1266
|
|
|
1209
|
-
|
|
1267
|
+
exports.insertBeforeBlock = insertBeforeBlock;
|
|
1268
|
+
|
|
1269
|
+
const insertAfterBlock = clientId => ({
|
|
1270
|
+
select,
|
|
1271
|
+
dispatch
|
|
1272
|
+
}) => {
|
|
1210
1273
|
if (!clientId) {
|
|
1211
1274
|
return;
|
|
1212
1275
|
}
|
|
1213
1276
|
|
|
1214
|
-
const rootClientId =
|
|
1215
|
-
const isLocked =
|
|
1277
|
+
const rootClientId = select.getBlockRootClientId(clientId);
|
|
1278
|
+
const isLocked = select.getTemplateLock(rootClientId);
|
|
1216
1279
|
|
|
1217
1280
|
if (isLocked) {
|
|
1218
1281
|
return;
|
|
1219
1282
|
}
|
|
1220
1283
|
|
|
1221
|
-
const firstSelectedIndex =
|
|
1222
|
-
return
|
|
1223
|
-
}
|
|
1284
|
+
const firstSelectedIndex = select.getBlockIndex(clientId, rootClientId);
|
|
1285
|
+
return dispatch.insertDefaultBlock({}, rootClientId, firstSelectedIndex + 1);
|
|
1286
|
+
};
|
|
1224
1287
|
/**
|
|
1225
|
-
*
|
|
1288
|
+
* Action that toggles the highlighted block state.
|
|
1226
1289
|
*
|
|
1227
1290
|
* @param {string} clientId The block's clientId.
|
|
1228
1291
|
* @param {boolean} isHighlighted The highlight state.
|
|
1229
1292
|
*/
|
|
1230
1293
|
|
|
1231
1294
|
|
|
1295
|
+
exports.insertAfterBlock = insertAfterBlock;
|
|
1296
|
+
|
|
1232
1297
|
function toggleBlockHighlight(clientId, isHighlighted) {
|
|
1233
1298
|
return {
|
|
1234
1299
|
type: 'TOGGLE_BLOCK_HIGHLIGHT',
|
|
@@ -1237,29 +1302,29 @@ function toggleBlockHighlight(clientId, isHighlighted) {
|
|
|
1237
1302
|
};
|
|
1238
1303
|
}
|
|
1239
1304
|
/**
|
|
1240
|
-
*
|
|
1241
|
-
* given clientId should appear to "flash" by rhythmically highlighting it.
|
|
1305
|
+
* Action that "flashes" the block with a given `clientId` by rhythmically highlighting it.
|
|
1242
1306
|
*
|
|
1243
1307
|
* @param {string} clientId Target block client ID.
|
|
1244
1308
|
*/
|
|
1245
1309
|
|
|
1246
1310
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
}
|
|
1311
|
+
const flashBlock = clientId => async ({
|
|
1312
|
+
dispatch
|
|
1313
|
+
}) => {
|
|
1314
|
+
dispatch(toggleBlockHighlight(clientId, true));
|
|
1315
|
+
await new Promise(resolve => setTimeout(resolve, 150));
|
|
1316
|
+
dispatch(toggleBlockHighlight(clientId, false));
|
|
1317
|
+
};
|
|
1255
1318
|
/**
|
|
1256
|
-
*
|
|
1319
|
+
* Action that sets whether a block has controlled inner blocks.
|
|
1257
1320
|
*
|
|
1258
1321
|
* @param {string} clientId The block's clientId.
|
|
1259
1322
|
* @param {boolean} hasControlledInnerBlocks True if the block's inner blocks are controlled.
|
|
1260
1323
|
*/
|
|
1261
1324
|
|
|
1262
1325
|
|
|
1326
|
+
exports.flashBlock = flashBlock;
|
|
1327
|
+
|
|
1263
1328
|
function setHasControlledInnerBlocks(clientId, hasControlledInnerBlocks) {
|
|
1264
1329
|
return {
|
|
1265
1330
|
type: 'SET_HAS_CONTROLLED_INNER_BLOCKS',
|