@wordpress/block-editor 10.5.0 → 11.1.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 +18 -0
- package/README.md +2 -1
- package/build/autocompleters/block.js +2 -6
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -0
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-card/index.js +51 -3
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +46 -39
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -3
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +4 -7
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +90 -37
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +5 -8
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block.js +55 -24
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +61 -28
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +30 -22
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +16 -8
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +33 -11
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +9 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +5 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +8 -49
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +2 -3
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +11 -6
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/height-control/index.js +115 -0
- package/build/components/height-control/index.js.map +1 -0
- package/build/components/iframe/index.js +22 -101
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +93 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +2 -0
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +1 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +25 -7
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +25 -46
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +3 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +27 -0
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +20 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -4
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +106 -0
- package/build/components/inserter/media-tab/hooks.js.map +1 -0
- package/build/components/inserter/media-tab/index.js +32 -0
- package/build/components/inserter/media-tab/index.js.map +1 -0
- package/build/components/inserter/media-tab/media-list.js +100 -0
- package/build/components/inserter/media-tab/media-list.js.map +1 -0
- package/build/components/inserter/media-tab/media-panel.js +96 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build/components/inserter/media-tab/media-tab.js +120 -0
- package/build/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build/components/inserter/media-tab/utils.js +54 -0
- package/build/components/inserter/media-tab/utils.js.map +1 -0
- package/build/components/inserter/menu.js +35 -12
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +70 -0
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build/components/inserter/quick-inserter.js +7 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +7 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +16 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/index.js +71 -0
- package/build/components/inspector-controls-tabs/index.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build/components/inspector-controls-tabs/utils.js +37 -0
- package/build/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build/components/link-control/index.js +1 -0
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +3 -3
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +5 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +13 -12
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/media-upload/index.native.js +2 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +99 -0
- package/build/components/off-canvas-editor/appender.js.map +1 -0
- package/build/components/off-canvas-editor/block-edit-button.js +50 -0
- package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +82 -38
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +3 -5
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +24 -11
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf.js +1 -1
- package/build/components/off-canvas-editor/leaf.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +185 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build/components/off-canvas-editor/update-attributes.js +108 -0
- package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +8 -4
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +3 -3
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-insert-replacement-text.js +43 -0
- package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build/components/rich-text/utils.js +1 -19
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/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/ungroup-button/index.native.js +4 -2
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +46 -43
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-display-information/index.js +8 -4
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-setting/index.js +9 -1
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/child-layout.js +209 -0
- package/build/hooks/child-layout.js.map +1 -0
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +1 -1
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +25 -7
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +57 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/min-height.js +4 -10
- package/build/hooks/min-height.js.map +1 -1
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +411 -274
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +58 -48
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/sorting.js +63 -0
- package/build/utils/sorting.js.map +1 -0
- package/build-module/autocompleters/block.js +2 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -0
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +40 -31
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -2
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +4 -6
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +87 -34
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-context.native.js +5 -8
- package/build-module/components/block-list/block-list-context.native.js.map +1 -1
- package/build-module/components/block-list/block.js +55 -25
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +61 -28
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +31 -24
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +16 -8
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +35 -13
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +9 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +5 -8
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +8 -49
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +2 -3
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +12 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/height-control/index.js +103 -0
- package/build-module/components/height-control/index.js.map +1 -0
- package/build-module/components/iframe/index.js +21 -101
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +85 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +2 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +27 -9
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +27 -49
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -2
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +20 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +3 -5
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +92 -0
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
- package/build-module/components/inserter/media-tab/index.js +4 -0
- package/build-module/components/inserter/media-tab/index.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-list.js +86 -0
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js +77 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-tab.js +100 -0
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build-module/components/inserter/media-tab/utils.js +45 -0
- package/build-module/components/inserter/media-tab/utils.js.map +1 -0
- package/build-module/components/inserter/menu.js +33 -12
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build-module/components/inserter/quick-inserter.js +7 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +7 -4
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +15 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/index.js +56 -0
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/utils.js +26 -0
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build-module/components/link-control/index.js +1 -0
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +3 -3
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +5 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +12 -11
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +2 -4
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +83 -0
- package/build-module/components/off-canvas-editor/appender.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +83 -41
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +3 -4
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +24 -12
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf.js +1 -1
- package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +165 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
- package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +6 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -3
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
- package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/utils.js +1 -16
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/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/ungroup-button/index.native.js +3 -2
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +46 -43
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +9 -5
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +8 -1
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/child-layout.js +189 -0
- package/build-module/hooks/child-layout.js.map +1 -0
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +1 -1
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +25 -8
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +55 -0
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/min-height.js +3 -9
- package/build-module/hooks/min-height.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +409 -274
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +55 -48
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/sorting.js +56 -0
- package/build-module/utils/sorting.js.map +1 -0
- package/build-style/content-rtl.css +701 -0
- package/build-style/content.css +701 -0
- package/build-style/default-editor-styles-rtl.css +17 -3
- package/build-style/default-editor-styles.css +17 -3
- package/build-style/style-rtl.css +313 -665
- package/build-style/style.css +313 -665
- package/package.json +32 -30
- package/src/autocompleters/block.js +2 -6
- package/src/autocompleters/link.js +2 -0
- package/src/components/alignment-control/test/index.js +6 -1
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-alignment-control/test/index.js +6 -1
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-card/index.js +46 -2
- package/src/components/block-card/style.scss +4 -0
- package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
- package/src/components/block-draggable/content.scss +20 -0
- package/src/components/block-draggable/index.native.js +54 -40
- package/src/components/block-draggable/style.scss +0 -21
- package/src/components/block-draggable/test/helpers.native.js +7 -9
- package/src/components/block-draggable/test/index.native.js +35 -45
- package/src/components/block-edit/edit.js +5 -2
- package/src/components/block-edit/edit.native.js +5 -6
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +173 -85
- package/src/components/block-inspector/style.scss +16 -1
- package/src/components/block-list/block-list-context.native.js +5 -8
- package/src/components/block-list/block.js +74 -23
- package/src/components/block-list/block.native.js +78 -23
- package/src/components/block-list/{style.scss → content.scss} +1 -15
- package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +42 -28
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -2
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +17 -7
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-patterns-list/index.js +47 -24
- package/src/components/block-preview/README.md +15 -10
- package/src/components/block-preview/auto.js +7 -1
- package/src/components/block-preview/content.scss +4 -0
- package/src/components/block-preview/index.js +7 -12
- package/src/components/block-preview/style.scss +0 -7
- package/src/components/block-preview/test/index.js +18 -35
- package/src/components/block-selection-clearer/test/index.js +12 -12
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +6 -1
- package/src/components/block-toolbar/index.js +12 -5
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/insertion-point.js +3 -47
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-tools/style.scss +12 -5
- package/src/components/block-variation-picker/index.js +6 -5
- package/src/components/block-vertical-alignment-control/test/index.js +6 -1
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +4 -4
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/height-control/index.js +123 -0
- package/src/components/height-control/stories/index.js +21 -0
- package/src/components/height-control/style.scss +5 -0
- package/src/components/iframe/index.js +33 -121
- package/src/components/iframe/use-compatibility-styles.js +95 -0
- package/src/components/image-editor/use-save-image.js +2 -0
- package/src/components/image-editor/zoom-dropdown.js +1 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/index.js +1 -0
- package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
- package/src/components/inner-blocks/index.js +26 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
- package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/src/components/inserter/block-patterns-tab.js +28 -71
- package/src/components/inserter/block-types-tab.js +3 -2
- package/src/components/inserter/hooks/use-debounced-input.js +17 -0
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +24 -3
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +89 -0
- package/src/components/inserter/media-tab/index.js +3 -0
- package/src/components/inserter/media-tab/media-list.js +93 -0
- package/src/components/inserter/media-tab/media-panel.js +83 -0
- package/src/components/inserter/media-tab/media-tab.js +135 -0
- package/src/components/inserter/media-tab/utils.js +37 -0
- package/src/components/inserter/menu.js +55 -13
- package/src/components/inserter/mobile-tab-navigation.js +85 -0
- package/src/components/inserter/quick-inserter.js +4 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +5 -2
- package/src/components/inserter/stories/index.js +1 -1
- package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
- package/src/components/inserter/style.scss +176 -11
- package/src/components/inserter/tabs.js +12 -1
- package/src/components/inserter-list-item/index.js +11 -1
- package/src/components/inserter-list-item/style.scss +26 -0
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/index.js +62 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
- package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
- package/src/components/inspector-controls-tabs/utils.js +28 -0
- package/src/components/line-height-control/test/index.js +5 -5
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/index.js +1 -0
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/link-control/test/index.js +204 -403
- package/src/components/link-control/use-internal-input-value.js +3 -3
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/block.js +3 -0
- package/src/components/list-view/branch.js +10 -8
- package/src/components/list-view/style.scss +21 -16
- package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
- package/src/components/media-replace-flow/test/index.js +39 -9
- package/src/components/media-upload/test/index.native.js +2 -0
- package/src/components/off-canvas-editor/appender.js +98 -0
- package/src/components/off-canvas-editor/block-edit-button.js +27 -0
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +160 -77
- package/src/components/off-canvas-editor/branch.js +3 -5
- package/src/components/off-canvas-editor/index.js +68 -33
- package/src/components/off-canvas-editor/leaf.js +5 -1
- package/src/components/off-canvas-editor/link-ui.js +166 -0
- package/src/components/off-canvas-editor/style.scss +19 -386
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/update-attributes.js +99 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/plain-text/{style.scss → content.scss} +0 -0
- package/src/components/recursion-provider/test/index.js +27 -29
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/content.scss +42 -0
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/format-toolbar/index.js +6 -4
- package/src/components/rich-text/index.js +3 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +0 -43
- package/src/components/rich-text/use-insert-replacement-text.js +31 -0
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/rich-text/use-undo-automatic-change.js +7 -1
- package/src/components/rich-text/utils.js +2 -21
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/ungroup-button/index.native.js +6 -2
- package/src/components/url-input/index.js +57 -73
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
- package/src/components/url-popover/test/index.js +37 -9
- package/src/components/use-block-display-information/index.js +14 -5
- package/src/components/use-setting/index.js +13 -1
- package/src/components/use-setting/test/index.js +99 -0
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/content.scss +10 -0
- package/src/hooks/border.js +0 -1
- package/src/hooks/child-layout.js +190 -0
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/content-lock-ui.js +1 -1
- package/src/hooks/dimensions.js +45 -7
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/layout.js +60 -0
- package/src/hooks/min-height.js +2 -19
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +471 -428
- package/src/store/selectors.js +57 -59
- package/src/store/test/performance.js +71 -0
- package/src/store/test/reducer.js +623 -491
- package/src/store/test/selectors.js +1820 -1306
- package/src/style.scss +4 -7
- package/src/utils/pasting.js +3 -9
- package/src/utils/sorting.js +54 -0
- package/src/utils/test/sorting.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-preview/live.js +0 -30
- package/build/components/block-preview/live.js.map +0 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/block-preview/live.js +0 -20
- package/build-module/components/block-preview/live.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/block-preview/live.js +0 -19
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
fireEvent,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
getBlock,
|
|
9
|
+
within,
|
|
10
|
+
getEditorHtml,
|
|
11
|
+
changeTextOfRichText,
|
|
12
|
+
} from 'test/helpers';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
18
|
+
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
19
|
+
|
|
20
|
+
beforeAll( () => {
|
|
21
|
+
// Register all core blocks
|
|
22
|
+
registerCoreBlocks();
|
|
23
|
+
} );
|
|
24
|
+
|
|
25
|
+
afterAll( () => {
|
|
26
|
+
// Clean up registered blocks
|
|
27
|
+
getBlockTypes().forEach( ( block ) => {
|
|
28
|
+
unregisterBlockType( block.name );
|
|
29
|
+
} );
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
describe( 'Block Actions Menu', () => {
|
|
33
|
+
it( "renders the block name in the Picker's header", async () => {
|
|
34
|
+
const screen = await initializeEditor( {
|
|
35
|
+
initialHtml: `<!-- wp:paragraph -->
|
|
36
|
+
<p></p>
|
|
37
|
+
<!-- /wp:paragraph -->`,
|
|
38
|
+
} );
|
|
39
|
+
const { getByLabelText, getByRole } = screen;
|
|
40
|
+
|
|
41
|
+
// Get block
|
|
42
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
43
|
+
fireEvent.press( paragraphBlock );
|
|
44
|
+
|
|
45
|
+
// Open block actions menu
|
|
46
|
+
const blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
|
|
47
|
+
fireEvent.press( blockActionsButton );
|
|
48
|
+
|
|
49
|
+
// Get Picker title
|
|
50
|
+
const pickerHeader = getByRole( 'header' );
|
|
51
|
+
const headerTitle = within( pickerHeader ).getByText(
|
|
52
|
+
/Paragraph block options/
|
|
53
|
+
);
|
|
54
|
+
expect( headerTitle ).toBeVisible();
|
|
55
|
+
} );
|
|
56
|
+
|
|
57
|
+
describe( 'moving blocks', () => {
|
|
58
|
+
it( 'moves blocks up and down', async () => {
|
|
59
|
+
const screen = await initializeEditor( {
|
|
60
|
+
screenWidth: 100, // To collapse the up/arrow buttons bellow blocks
|
|
61
|
+
} );
|
|
62
|
+
const { getByLabelText, getByTestId } = screen;
|
|
63
|
+
|
|
64
|
+
// Add Paragraph block
|
|
65
|
+
await addBlock( screen, 'Paragraph' );
|
|
66
|
+
|
|
67
|
+
// Get Paragraph block
|
|
68
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
69
|
+
fireEvent.press( paragraphBlock );
|
|
70
|
+
const paragraphField =
|
|
71
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
72
|
+
'Start writing…'
|
|
73
|
+
);
|
|
74
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
75
|
+
|
|
76
|
+
// Add Spacer block
|
|
77
|
+
await addBlock( screen, 'Spacer' );
|
|
78
|
+
|
|
79
|
+
// Add Heading block
|
|
80
|
+
await addBlock( screen, 'Heading' );
|
|
81
|
+
|
|
82
|
+
// Get Spacer block
|
|
83
|
+
const spacerBlock = await getBlock( screen, 'Spacer', {
|
|
84
|
+
rowIndex: 2,
|
|
85
|
+
} );
|
|
86
|
+
fireEvent.press( spacerBlock );
|
|
87
|
+
|
|
88
|
+
// Open block actions menu
|
|
89
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
90
|
+
|
|
91
|
+
// Get block actions modal
|
|
92
|
+
let blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
93
|
+
|
|
94
|
+
// Tap on the Move Down button
|
|
95
|
+
fireEvent.press(
|
|
96
|
+
within( blockActionsMenu ).getByLabelText( 'Move block down' )
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// Get Heading block
|
|
100
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
101
|
+
rowIndex: 2,
|
|
102
|
+
} );
|
|
103
|
+
fireEvent.press( headingBlock );
|
|
104
|
+
|
|
105
|
+
// Open block actions menu
|
|
106
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
107
|
+
|
|
108
|
+
// Get block actions modal
|
|
109
|
+
blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
110
|
+
|
|
111
|
+
// Tap on the Move Up button
|
|
112
|
+
fireEvent.press(
|
|
113
|
+
within( blockActionsMenu ).getByLabelText( 'Move block up' )
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
117
|
+
} );
|
|
118
|
+
|
|
119
|
+
it( 'disables the Move Up button for the first block', async () => {
|
|
120
|
+
const screen = await initializeEditor( {
|
|
121
|
+
screenWidth: 100, // To collapse the up/arrow buttons bellow blocks
|
|
122
|
+
} );
|
|
123
|
+
const { getByLabelText, getByTestId } = screen;
|
|
124
|
+
|
|
125
|
+
// Add Paragraph block
|
|
126
|
+
await addBlock( screen, 'Paragraph' );
|
|
127
|
+
|
|
128
|
+
// Get Paragraph block
|
|
129
|
+
let paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
130
|
+
fireEvent.press( paragraphBlock );
|
|
131
|
+
const paragraphField =
|
|
132
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
133
|
+
'Start writing…'
|
|
134
|
+
);
|
|
135
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
136
|
+
|
|
137
|
+
// Add Spacer block
|
|
138
|
+
await addBlock( screen, 'Spacer' );
|
|
139
|
+
|
|
140
|
+
// Add Heading block
|
|
141
|
+
await addBlock( screen, 'Heading' );
|
|
142
|
+
|
|
143
|
+
// Get Paragraph block
|
|
144
|
+
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
145
|
+
fireEvent.press( paragraphBlock );
|
|
146
|
+
|
|
147
|
+
// Open block actions menu
|
|
148
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
149
|
+
|
|
150
|
+
// Get block actions modal
|
|
151
|
+
const blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
152
|
+
|
|
153
|
+
// Get the Move Up button
|
|
154
|
+
const upButton =
|
|
155
|
+
within( blockActionsMenu ).getByLabelText( 'Move block up' );
|
|
156
|
+
const isUpButtonDisabled =
|
|
157
|
+
upButton.props.accessibilityState?.disabled;
|
|
158
|
+
expect( isUpButtonDisabled ).toBe( true );
|
|
159
|
+
|
|
160
|
+
// Press the button to make sure the block doesn't move
|
|
161
|
+
fireEvent.press( upButton );
|
|
162
|
+
|
|
163
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
164
|
+
} );
|
|
165
|
+
|
|
166
|
+
it( 'disables the Move Down button for the last block', async () => {
|
|
167
|
+
const screen = await initializeEditor( {
|
|
168
|
+
screenWidth: 100,
|
|
169
|
+
} );
|
|
170
|
+
const { getByLabelText, getByTestId } = screen;
|
|
171
|
+
|
|
172
|
+
// Add Paragraph block
|
|
173
|
+
await addBlock( screen, 'Paragraph' );
|
|
174
|
+
|
|
175
|
+
// Get Paragraph block
|
|
176
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
177
|
+
fireEvent.press( paragraphBlock );
|
|
178
|
+
const paragraphField =
|
|
179
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
180
|
+
'Start writing…'
|
|
181
|
+
);
|
|
182
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
183
|
+
|
|
184
|
+
// Add Spacer block
|
|
185
|
+
await addBlock( screen, 'Spacer' );
|
|
186
|
+
|
|
187
|
+
// Add Heading block
|
|
188
|
+
await addBlock( screen, 'Heading' );
|
|
189
|
+
|
|
190
|
+
// Get Heading block
|
|
191
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
192
|
+
rowIndex: 3,
|
|
193
|
+
} );
|
|
194
|
+
fireEvent.press( headingBlock );
|
|
195
|
+
|
|
196
|
+
// Open block actions menu
|
|
197
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
198
|
+
|
|
199
|
+
// Get block actions modal
|
|
200
|
+
const blockActionsMenu = await getByTestId( 'block-actions-menu' );
|
|
201
|
+
|
|
202
|
+
// Get the Move Down button
|
|
203
|
+
const downButton =
|
|
204
|
+
within( blockActionsMenu ).getByLabelText( 'Move block down' );
|
|
205
|
+
const isDownButtonDisabled =
|
|
206
|
+
downButton.props.accessibilityState?.disabled;
|
|
207
|
+
expect( isDownButtonDisabled ).toBe( true );
|
|
208
|
+
|
|
209
|
+
// Press the button to make sure the block doesn't move
|
|
210
|
+
fireEvent.press( downButton );
|
|
211
|
+
|
|
212
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
213
|
+
} );
|
|
214
|
+
} );
|
|
215
|
+
|
|
216
|
+
describe( 'block options', () => {
|
|
217
|
+
it( 'copies and pastes a block', async () => {
|
|
218
|
+
const screen = await initializeEditor();
|
|
219
|
+
const { getByLabelText } = screen;
|
|
220
|
+
|
|
221
|
+
// Add Paragraph block
|
|
222
|
+
await addBlock( screen, 'Paragraph' );
|
|
223
|
+
|
|
224
|
+
// Get Paragraph block
|
|
225
|
+
let paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
226
|
+
fireEvent.press( paragraphBlock );
|
|
227
|
+
const paragraphField =
|
|
228
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
229
|
+
'Start writing…'
|
|
230
|
+
);
|
|
231
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
232
|
+
|
|
233
|
+
// Add Spacer block
|
|
234
|
+
await addBlock( screen, 'Spacer' );
|
|
235
|
+
|
|
236
|
+
// Add Heading block
|
|
237
|
+
await addBlock( screen, 'Heading' );
|
|
238
|
+
|
|
239
|
+
// Get Heading block
|
|
240
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
241
|
+
rowIndex: 3,
|
|
242
|
+
} );
|
|
243
|
+
fireEvent.press( headingBlock );
|
|
244
|
+
|
|
245
|
+
// Open block actions menu
|
|
246
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
247
|
+
|
|
248
|
+
// Tap on the Copy button
|
|
249
|
+
fireEvent.press( getByLabelText( /Copy block/ ) );
|
|
250
|
+
|
|
251
|
+
// Get Paragraph block
|
|
252
|
+
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
253
|
+
fireEvent.press( paragraphBlock );
|
|
254
|
+
|
|
255
|
+
// Open block actions menu
|
|
256
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
257
|
+
|
|
258
|
+
// Tap on the Paste block after button
|
|
259
|
+
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
260
|
+
|
|
261
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
262
|
+
} );
|
|
263
|
+
|
|
264
|
+
it( 'does not replace a non empty Paragraph block when pasting another block', async () => {
|
|
265
|
+
const screen = await initializeEditor();
|
|
266
|
+
const { getByLabelText } = screen;
|
|
267
|
+
|
|
268
|
+
// Add Paragraph block
|
|
269
|
+
await addBlock( screen, 'Paragraph' );
|
|
270
|
+
|
|
271
|
+
// Get Paragraph block
|
|
272
|
+
let paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
273
|
+
fireEvent.press( paragraphBlock );
|
|
274
|
+
const paragraphField =
|
|
275
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
276
|
+
'Start writing…'
|
|
277
|
+
);
|
|
278
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
279
|
+
|
|
280
|
+
// Add Spacer block
|
|
281
|
+
await addBlock( screen, 'Spacer' );
|
|
282
|
+
|
|
283
|
+
// Add Heading block
|
|
284
|
+
await addBlock( screen, 'Heading' );
|
|
285
|
+
|
|
286
|
+
// Get Heading block
|
|
287
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
288
|
+
rowIndex: 3,
|
|
289
|
+
} );
|
|
290
|
+
fireEvent.press( headingBlock );
|
|
291
|
+
|
|
292
|
+
// Open block actions menu
|
|
293
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
294
|
+
|
|
295
|
+
// Tap on the Copy button
|
|
296
|
+
fireEvent.press( getByLabelText( /Copy block/ ) );
|
|
297
|
+
|
|
298
|
+
// Get Paragraph block
|
|
299
|
+
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
300
|
+
fireEvent.press( paragraphBlock );
|
|
301
|
+
|
|
302
|
+
// Open block actions menu
|
|
303
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
304
|
+
|
|
305
|
+
// Tap on the Past block after button
|
|
306
|
+
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
307
|
+
|
|
308
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
309
|
+
} );
|
|
310
|
+
|
|
311
|
+
it( 'cuts and pastes a block', async () => {
|
|
312
|
+
const screen = await initializeEditor();
|
|
313
|
+
const { getByLabelText } = screen;
|
|
314
|
+
|
|
315
|
+
// Add Paragraph block
|
|
316
|
+
await addBlock( screen, 'Paragraph' );
|
|
317
|
+
|
|
318
|
+
// Get Paragraph block
|
|
319
|
+
let paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
320
|
+
fireEvent.press( paragraphBlock );
|
|
321
|
+
const paragraphField =
|
|
322
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
323
|
+
'Start writing…'
|
|
324
|
+
);
|
|
325
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
326
|
+
|
|
327
|
+
// Add Spacer block
|
|
328
|
+
await addBlock( screen, 'Spacer' );
|
|
329
|
+
|
|
330
|
+
// Add Heading block
|
|
331
|
+
await addBlock( screen, 'Heading' );
|
|
332
|
+
|
|
333
|
+
// Get Paragraph block
|
|
334
|
+
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
335
|
+
fireEvent.press( paragraphBlock );
|
|
336
|
+
|
|
337
|
+
// Open block actions menu
|
|
338
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
339
|
+
|
|
340
|
+
// Tap on the Cut button
|
|
341
|
+
fireEvent.press( getByLabelText( /Cut block/ ) );
|
|
342
|
+
|
|
343
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
344
|
+
rowIndex: 2,
|
|
345
|
+
} );
|
|
346
|
+
fireEvent.press( headingBlock );
|
|
347
|
+
|
|
348
|
+
// Open block actions menu
|
|
349
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
350
|
+
|
|
351
|
+
// Tap on the Cut button
|
|
352
|
+
fireEvent.press( getByLabelText( /Paste block after/ ) );
|
|
353
|
+
|
|
354
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
355
|
+
} );
|
|
356
|
+
|
|
357
|
+
it( 'duplicates a block', async () => {
|
|
358
|
+
const screen = await initializeEditor();
|
|
359
|
+
const { getByLabelText } = screen;
|
|
360
|
+
|
|
361
|
+
// Add Paragraph block
|
|
362
|
+
await addBlock( screen, 'Paragraph' );
|
|
363
|
+
|
|
364
|
+
// Get Paragraph block
|
|
365
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
366
|
+
fireEvent.press( paragraphBlock );
|
|
367
|
+
const paragraphField =
|
|
368
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
369
|
+
'Start writing…'
|
|
370
|
+
);
|
|
371
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
372
|
+
|
|
373
|
+
// Add Spacer block
|
|
374
|
+
await addBlock( screen, 'Spacer' );
|
|
375
|
+
|
|
376
|
+
// Add Heading block
|
|
377
|
+
await addBlock( screen, 'Heading' );
|
|
378
|
+
|
|
379
|
+
// Get Spacer block
|
|
380
|
+
const spacerBlock = await getBlock( screen, 'Spacer', {
|
|
381
|
+
rowIndex: 2,
|
|
382
|
+
} );
|
|
383
|
+
fireEvent.press( spacerBlock );
|
|
384
|
+
|
|
385
|
+
// Open block actions menu
|
|
386
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
387
|
+
|
|
388
|
+
// Tap on the Duplicate button
|
|
389
|
+
fireEvent.press( getByLabelText( /Duplicate block/ ) );
|
|
390
|
+
|
|
391
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
392
|
+
} );
|
|
393
|
+
|
|
394
|
+
it( 'transforms a Paragraph block into a Pullquote block', async () => {
|
|
395
|
+
const screen = await initializeEditor();
|
|
396
|
+
const { getByLabelText, getByRole } = screen;
|
|
397
|
+
|
|
398
|
+
// Add Paragraph block
|
|
399
|
+
await addBlock( screen, 'Paragraph' );
|
|
400
|
+
|
|
401
|
+
// Get Paragraph block
|
|
402
|
+
let paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
403
|
+
fireEvent.press( paragraphBlock );
|
|
404
|
+
const paragraphField =
|
|
405
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
406
|
+
'Start writing…'
|
|
407
|
+
);
|
|
408
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
409
|
+
|
|
410
|
+
// Add Spacer block
|
|
411
|
+
await addBlock( screen, 'Spacer' );
|
|
412
|
+
|
|
413
|
+
// Add Heading block
|
|
414
|
+
await addBlock( screen, 'Heading' );
|
|
415
|
+
|
|
416
|
+
// Get Paragraph block
|
|
417
|
+
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
418
|
+
fireEvent.press( paragraphBlock );
|
|
419
|
+
|
|
420
|
+
// Open block actions menu
|
|
421
|
+
fireEvent.press( getByLabelText( /Open Block Actions Menu/ ) );
|
|
422
|
+
|
|
423
|
+
// Tap on the Transform block button
|
|
424
|
+
fireEvent.press( getByLabelText( /Transform block…/ ) );
|
|
425
|
+
|
|
426
|
+
// Get Picker title
|
|
427
|
+
const pickerHeader = getByRole( 'header' );
|
|
428
|
+
const headerTitle = within( pickerHeader ).getByText(
|
|
429
|
+
/Transform Paragraph to/
|
|
430
|
+
);
|
|
431
|
+
expect( headerTitle ).toBeVisible();
|
|
432
|
+
|
|
433
|
+
// Tap on the Transform block button
|
|
434
|
+
fireEvent.press( getByLabelText( /Pullquote/ ) );
|
|
435
|
+
|
|
436
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
437
|
+
} );
|
|
438
|
+
} );
|
|
439
|
+
} );
|
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Block Mover Picker moving blocks disables the Move Down button for the last block 1`] = `
|
|
4
|
+
"<!-- wp:paragraph -->
|
|
5
|
+
<p>Hello!</p>
|
|
6
|
+
<!-- /wp:paragraph -->
|
|
7
|
+
|
|
8
|
+
<!-- wp:spacer -->
|
|
9
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
10
|
+
<!-- /wp:spacer -->
|
|
11
|
+
|
|
12
|
+
<!-- wp:heading -->
|
|
13
|
+
<h2 class=\\"wp-block-heading\\"></h2>
|
|
14
|
+
<!-- /wp:heading -->"
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
exports[`Block Mover Picker moving blocks disables the Move Up button for the first block 1`] = `
|
|
18
|
+
"<!-- wp:paragraph -->
|
|
19
|
+
<p>Hello!</p>
|
|
20
|
+
<!-- /wp:paragraph -->
|
|
21
|
+
|
|
22
|
+
<!-- wp:spacer -->
|
|
23
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
24
|
+
<!-- /wp:spacer -->
|
|
25
|
+
|
|
26
|
+
<!-- wp:heading -->
|
|
27
|
+
<h2 class=\\"wp-block-heading\\"></h2>
|
|
28
|
+
<!-- /wp:heading -->"
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
exports[`Block Mover Picker moving blocks moves blocks up and down 1`] = `
|
|
32
|
+
"<!-- wp:heading -->
|
|
33
|
+
<h2 class=\\"wp-block-heading\\"></h2>
|
|
34
|
+
<!-- /wp:heading -->
|
|
35
|
+
|
|
36
|
+
<!-- wp:paragraph -->
|
|
37
|
+
<p>Hello!</p>
|
|
38
|
+
<!-- /wp:paragraph -->
|
|
39
|
+
|
|
40
|
+
<!-- wp:spacer -->
|
|
41
|
+
<div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
|
|
42
|
+
<!-- /wp:spacer -->"
|
|
43
|
+
`;
|
|
44
|
+
|
|
3
45
|
exports[`Block Mover Picker should match snapshot 1`] = `
|
|
4
46
|
Array [
|
|
5
47
|
<View>
|
|
@@ -15,7 +57,6 @@ Array [
|
|
|
15
57
|
accessible={true}
|
|
16
58
|
collapsable={false}
|
|
17
59
|
focusable={true}
|
|
18
|
-
nativeID="animatedComponent"
|
|
19
60
|
onClick={[Function]}
|
|
20
61
|
onResponderGrant={[Function]}
|
|
21
62
|
onResponderMove={[Function]}
|
|
@@ -75,7 +116,6 @@ Array [
|
|
|
75
116
|
accessible={true}
|
|
76
117
|
collapsable={false}
|
|
77
118
|
focusable={true}
|
|
78
|
-
nativeID="animatedComponent"
|
|
79
119
|
onClick={[Function]}
|
|
80
120
|
onResponderGrant={[Function]}
|
|
81
121
|
onResponderMove={[Function]}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
fireEvent,
|
|
7
|
+
initializeEditor,
|
|
8
|
+
getBlock,
|
|
9
|
+
within,
|
|
10
|
+
getEditorHtml,
|
|
11
|
+
render,
|
|
12
|
+
changeTextOfRichText,
|
|
13
|
+
} from 'test/helpers';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* WordPress dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
19
|
+
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
5
20
|
|
|
6
21
|
/**
|
|
7
22
|
* Internal dependencies
|
|
@@ -46,4 +61,145 @@ describe( 'Block Mover Picker', () => {
|
|
|
46
61
|
const screen = render( <BlockMover { ...props } /> );
|
|
47
62
|
expect( screen.toJSON() ).toMatchSnapshot();
|
|
48
63
|
} );
|
|
64
|
+
|
|
65
|
+
describe( 'moving blocks', () => {
|
|
66
|
+
beforeAll( () => {
|
|
67
|
+
// Register all core blocks
|
|
68
|
+
registerCoreBlocks();
|
|
69
|
+
} );
|
|
70
|
+
|
|
71
|
+
afterAll( () => {
|
|
72
|
+
// Clean up registered blocks
|
|
73
|
+
getBlockTypes().forEach( ( block ) => {
|
|
74
|
+
unregisterBlockType( block.name );
|
|
75
|
+
} );
|
|
76
|
+
} );
|
|
77
|
+
|
|
78
|
+
it( 'moves blocks up and down', async () => {
|
|
79
|
+
const screen = await initializeEditor();
|
|
80
|
+
const { getByLabelText } = screen;
|
|
81
|
+
|
|
82
|
+
// Add Paragraph block
|
|
83
|
+
await addBlock( screen, 'Paragraph' );
|
|
84
|
+
|
|
85
|
+
// Get Paragraph block
|
|
86
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
87
|
+
fireEvent.press( paragraphBlock );
|
|
88
|
+
const paragraphField =
|
|
89
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
90
|
+
'Start writing…'
|
|
91
|
+
);
|
|
92
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
93
|
+
|
|
94
|
+
// Add Spacer block
|
|
95
|
+
await addBlock( screen, 'Spacer' );
|
|
96
|
+
|
|
97
|
+
// Add Heading block
|
|
98
|
+
await addBlock( screen, 'Heading' );
|
|
99
|
+
|
|
100
|
+
// Get Spacer block
|
|
101
|
+
const spacerBlock = await getBlock( screen, 'Spacer', {
|
|
102
|
+
rowIndex: 2,
|
|
103
|
+
} );
|
|
104
|
+
fireEvent.press( spacerBlock );
|
|
105
|
+
|
|
106
|
+
// Tap on the Move Down button
|
|
107
|
+
const downButton = getByLabelText(
|
|
108
|
+
/Move block down from row 2 to row 3/
|
|
109
|
+
);
|
|
110
|
+
fireEvent.press( downButton );
|
|
111
|
+
|
|
112
|
+
// Get Heading block
|
|
113
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
114
|
+
rowIndex: 2,
|
|
115
|
+
} );
|
|
116
|
+
fireEvent.press( headingBlock );
|
|
117
|
+
|
|
118
|
+
// Tap on the Move Up button
|
|
119
|
+
const upButton = getByLabelText(
|
|
120
|
+
/Move block up from row 2 to row 1/
|
|
121
|
+
);
|
|
122
|
+
fireEvent.press( upButton );
|
|
123
|
+
|
|
124
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
125
|
+
} );
|
|
126
|
+
|
|
127
|
+
it( 'disables the Move Up button for the first block', async () => {
|
|
128
|
+
const screen = await initializeEditor();
|
|
129
|
+
const { getByLabelText } = screen;
|
|
130
|
+
|
|
131
|
+
// Add Paragraph block
|
|
132
|
+
await addBlock( screen, 'Paragraph' );
|
|
133
|
+
|
|
134
|
+
// Get Paragraph block
|
|
135
|
+
let paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
136
|
+
fireEvent.press( paragraphBlock );
|
|
137
|
+
const paragraphField =
|
|
138
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
139
|
+
'Start writing…'
|
|
140
|
+
);
|
|
141
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
142
|
+
|
|
143
|
+
// Add Spacer block
|
|
144
|
+
await addBlock( screen, 'Spacer' );
|
|
145
|
+
|
|
146
|
+
// Add Heading block
|
|
147
|
+
await addBlock( screen, 'Heading' );
|
|
148
|
+
|
|
149
|
+
// Get Paragraph block
|
|
150
|
+
paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
151
|
+
fireEvent.press( paragraphBlock );
|
|
152
|
+
|
|
153
|
+
// Get the Move Up button
|
|
154
|
+
const upButton = getByLabelText( /Move block up/ );
|
|
155
|
+
const isUpButtonDisabled =
|
|
156
|
+
upButton.props.accessibilityState?.disabled;
|
|
157
|
+
expect( isUpButtonDisabled ).toBe( true );
|
|
158
|
+
|
|
159
|
+
// Press the button to make sure the block doesn't move
|
|
160
|
+
fireEvent.press( upButton );
|
|
161
|
+
|
|
162
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
163
|
+
} );
|
|
164
|
+
|
|
165
|
+
it( 'disables the Move Down button for the last block', async () => {
|
|
166
|
+
const screen = await initializeEditor();
|
|
167
|
+
const { getByLabelText } = screen;
|
|
168
|
+
|
|
169
|
+
// Add Paragraph block
|
|
170
|
+
await addBlock( screen, 'Paragraph' );
|
|
171
|
+
|
|
172
|
+
// Get Paragraph block
|
|
173
|
+
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
174
|
+
fireEvent.press( paragraphBlock );
|
|
175
|
+
const paragraphField =
|
|
176
|
+
within( paragraphBlock ).getByPlaceholderText(
|
|
177
|
+
'Start writing…'
|
|
178
|
+
);
|
|
179
|
+
changeTextOfRichText( paragraphField, 'Hello!' );
|
|
180
|
+
|
|
181
|
+
// Add Spacer block
|
|
182
|
+
await addBlock( screen, 'Spacer' );
|
|
183
|
+
|
|
184
|
+
// Add Heading block
|
|
185
|
+
await addBlock( screen, 'Heading' );
|
|
186
|
+
|
|
187
|
+
// Get Heading block
|
|
188
|
+
const headingBlock = await getBlock( screen, 'Heading', {
|
|
189
|
+
rowIndex: 3,
|
|
190
|
+
} );
|
|
191
|
+
fireEvent.press( headingBlock );
|
|
192
|
+
|
|
193
|
+
// Get the Move Down button
|
|
194
|
+
const downButton = getByLabelText( /Move block down/ );
|
|
195
|
+
const isDownButtonDisabled =
|
|
196
|
+
downButton.props.accessibilityState?.disabled;
|
|
197
|
+
expect( isDownButtonDisabled ).toBe( true );
|
|
198
|
+
|
|
199
|
+
// Press the button to make sure the block doesn't move
|
|
200
|
+
fireEvent.press( downButton );
|
|
201
|
+
|
|
202
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
203
|
+
} );
|
|
204
|
+
} );
|
|
49
205
|
} );
|