@wordpress/block-editor 11.0.0 → 11.2.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 +16 -1
- package/LICENSE.md +1 -1
- package/README.md +2 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-actions/index.js +9 -0
- package/build/components/block-actions/index.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-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +58 -5
- package/build/components/block-inspector/index.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 +18 -18
- 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 +14 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +3 -1
- package/build/components/block-styles/index.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.native.js +6 -8
- package/build/components/block-toolbar/index.native.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-tools/use-block-toolbar-popover-props.js +43 -10
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -1
- 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/default-style-picker/index.js +1 -0
- package/build/components/default-style-picker/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 +14 -12
- 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/iframe/index.js +48 -101
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +98 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/image-size-control/index.js +1 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -4
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- 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 +16 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +8 -5
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/menu.js +11 -5
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +6 -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 +4 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inspector-controls/groups.js +3 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -0
- package/build/components/link-control/search-input.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/off-canvas-editor/appender.js +3 -44
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +38 -5
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- 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 +51 -57
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +12 -5
- package/build/components/off-canvas-editor/index.js.map +1 -1
- 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/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- 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/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +4 -5
- package/build/components/rich-text/use-enter.js.map +1 -1
- 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/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.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/url-input/button.js +1 -0
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +15 -1
- 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/url-popover/link-editor.js +1 -0
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-paste-styles/index.js +188 -0
- package/build/components/use-paste-styles/index.js.map +1 -0
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +22 -29
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- 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/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/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/metadata.js +1 -1
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/position.js +376 -0
- package/build/hooks/position.js.map +1 -0
- package/build/hooks/supports.js +328 -0
- package/build/hooks/supports.js.map +1 -0
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +27 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +9 -7
- 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-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-actions/index.js +6 -0
- package/build-module/components/block-actions/index.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-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +58 -6
- package/build-module/components/block-inspector/index.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 +18 -18
- 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 +14 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -4
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.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.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.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-tools/use-block-toolbar-popover-props.js +42 -11
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -1
- 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/default-style-picker/index.js +1 -0
- package/build-module/components/default-style-picker/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 +14 -11
- 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/iframe/index.js +46 -102
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +90 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/image-size-control/index.js +1 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +4 -4
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- 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 +16 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +8 -5
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -5
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -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 +4 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +3 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +33 -0
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +2 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -0
- package/build-module/components/link-control/search-input.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/off-canvas-editor/appender.js +5 -44
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +37 -7
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- 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 +54 -60
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +12 -5
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- 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/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- 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/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +4 -5
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- 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/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/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/url-input/button.js +1 -0
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +14 -1
- 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/url-popover/link-editor.js +1 -0
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +174 -0
- package/build-module/components/use-paste-styles/index.js.map +1 -0
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +22 -29
- package/build-module/components/writing-flow/use-arrow-nav.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/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/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/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/metadata.js +1 -1
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/position.js +337 -0
- package/build-module/hooks/position.js.map +1 -0
- package/build-module/hooks/supports.js +257 -0
- package/build-module/hooks/supports.js.map +1 -0
- 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 +27 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -7
- 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-style/content-rtl.css +60 -3
- package/build-style/content.css +60 -3
- package/build-style/default-editor-styles-rtl.css +3 -3
- package/build-style/default-editor-styles.css +3 -3
- package/build-style/style-rtl.css +62 -69
- package/build-style/style.css +62 -69
- package/package.json +29 -29
- package/src/components/alignment-control/test/index.js +2 -0
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-actions/index.js +5 -0
- package/src/components/block-alignment-control/test/index.js +2 -0
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- 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 +79 -4
- package/src/components/block-inspector/style.scss +7 -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 +18 -22
- 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 -0
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +15 -6
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-preview/auto.js +2 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-styles/index.js +4 -1
- 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 +3 -2
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-tools/use-block-toolbar-popover-props.js +68 -12
- package/src/components/block-variation-picker/index.js +5 -1
- package/src/components/block-vertical-alignment-control/test/index.js +2 -0
- package/src/components/button-block-appender/{style.scss → content.scss} +0 -0
- 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/test/index.js +2 -0
- package/src/components/default-style-picker/index.js +1 -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 +36 -36
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/iframe/index.js +60 -122
- package/src/components/iframe/use-compatibility-styles.js +101 -0
- package/src/components/image-size-control/index.js +1 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inserter/block-patterns-tab.js +7 -4
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +61 -43
- package/src/components/inserter/media-tab/hooks.js +5 -4
- package/src/components/inserter/menu.js +8 -4
- package/src/components/inserter/quick-inserter.js +3 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +2 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +117 -0
- package/src/components/inserter/test/index.native.js +255 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/position-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +2 -0
- package/src/components/inspector-controls-tabs/style.scss +15 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -8
- package/src/components/link-control/search-input.js +1 -0
- package/src/components/link-control/style.scss +1 -0
- package/src/components/link-control/test/index.js +18 -4
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/style.scss +14 -10
- package/src/components/media-replace-flow/test/index.js +2 -0
- package/src/components/off-canvas-editor/appender.js +4 -49
- package/src/components/off-canvas-editor/block-contents.js +84 -23
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +90 -105
- package/src/components/off-canvas-editor/index.js +21 -2
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/provider/index.js +4 -1
- 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/format-edit.js +6 -10
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-enter.js +4 -4
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/url-input/README.md +5 -0
- package/src/components/url-input/button.js +1 -0
- package/src/components/url-input/index.js +15 -1
- 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/link-editor.js +1 -0
- package/src/components/url-popover/test/index.js +21 -5
- package/src/components/use-paste-styles/index.js +230 -0
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/components/writing-flow/use-arrow-nav.js +20 -28
- package/src/content.scss +1 -0
- package/src/hooks/border.js +0 -1
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/index.js +1 -0
- package/src/hooks/metadata.js +1 -2
- package/src/hooks/position.js +375 -0
- package/src/hooks/position.scss +18 -0
- package/src/hooks/supports.js +302 -0
- package/src/hooks/test/__snapshots__/align.native.js.snap +73 -0
- package/src/hooks/test/align.native.js +133 -0
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +20 -8
- package/src/store/selectors.js +7 -8
- package/src/store/test/reducer.js +45 -3
- package/src/store/test/selectors.js +12 -9
- package/src/style.scss +2 -1
- package/src/utils/pasting.js +3 -9
- package/tsconfig.tsbuildinfo +1 -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/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/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>
|
|
@@ -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
|
} );
|