@wordpress/block-editor 15.20.0 → 15.21.1
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/build/components/block-compare/index.cjs +2 -2
- package/build/components/block-compare/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +1 -1
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-patterns-list/index.cjs +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-switcher/block-transformations-menu.cjs +16 -15
- package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +4 -4
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +10 -5
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +23 -15
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +2 -2
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +2 -0
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +5 -4
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/iframe/index.cjs +3 -0
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +3 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +179 -220
- package/build/components/inserter/index.cjs.map +3 -3
- package/build/components/inserter/media-tab/utils.cjs +1 -1
- package/build/components/inserter/media-tab/utils.cjs.map +2 -2
- package/build/components/inserter/search-results.cjs +1 -1
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +10 -12
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs +11 -2
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +4 -4
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +4 -4
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +7 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -23
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +5 -5
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/hooks/anchor.cjs +11 -15
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/border.cjs +0 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +1 -4
- package/build/hooks/color.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +0 -3
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/fit-text.cjs +11 -0
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/position.cjs +19 -22
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/supports.cjs +0 -7
- package/build/hooks/supports.cjs.map +2 -2
- package/build/store/actions.cjs +7 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +1 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +29 -0
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +14 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +60 -41
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/block-compare/index.mjs +1 -1
- package/build-module/components/block-compare/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +1 -1
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-switcher/block-transformations-menu.mjs +16 -15
- package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +4 -4
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +10 -5
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +23 -15
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +3 -3
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -0
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +9 -6
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs +3 -0
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +3 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +185 -222
- package/build-module/components/inserter/index.mjs.map +3 -3
- package/build-module/components/inserter/media-tab/utils.mjs +1 -1
- package/build-module/components/inserter/media-tab/utils.mjs.map +2 -2
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +10 -12
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs +11 -2
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -23
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +5 -5
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/hooks/anchor.mjs +11 -15
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/border.mjs +1 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -5
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +1 -4
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs +11 -0
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/position.mjs +20 -23
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/supports.mjs +0 -7
- package/build-module/hooks/supports.mjs.map +2 -2
- package/build-module/store/actions.mjs +7 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +1 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +26 -0
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +14 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +62 -42
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/content-rtl.css +12 -0
- package/build-style/content.css +12 -0
- package/build-style/style-rtl.css +26 -8
- package/build-style/style.css +26 -8
- package/package.json +51 -48
- package/src/components/block-breadcrumb/README.md +2 -2
- package/src/components/block-compare/README.md +6 -6
- package/src/components/block-compare/index.js +1 -3
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-patterns-list/index.js +1 -1
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-switcher/block-transformations-menu.js +16 -18
- package/src/components/block-switcher/index.js +4 -4
- package/src/components/block-types-list/README.md +0 -19
- package/src/components/child-layout-control/index.js +15 -8
- package/src/components/child-layout-control/test/index.js +126 -0
- package/src/components/colors/test/with-colors.js +1 -1
- package/src/components/global-styles/advanced-panel.js +5 -1
- package/src/components/global-styles/background-panel.js +3 -3
- package/src/components/global-styles/border-panel.js +2 -0
- package/src/components/global-styles/dimensions-panel.js +23 -16
- package/src/components/iframe/index.js +3 -0
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/index.js +257 -288
- package/src/components/inserter/media-tab/utils.js +1 -1
- package/src/components/inserter/search-results.js +1 -3
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/list-view/block-select-button.js +9 -13
- package/src/components/list-view/block.js +1 -0
- package/src/components/media-placeholder/README.md +1 -29
- package/src/components/media-upload/README.md +0 -19
- package/src/components/provider/test/use-block-sync.js +40 -0
- package/src/components/provider/use-block-sync.js +12 -2
- package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
- package/src/components/rich-text/event-listeners/delete.js +9 -4
- package/src/components/rich-text/event-listeners/enter.js +9 -2
- package/src/components/rich-text/event-listeners/input-events.js +13 -4
- package/src/components/rich-text/event-listeners/input-rules.js +20 -4
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
- package/src/components/rich-text/index.js +1 -33
- package/src/components/unit-control/README.md +1 -1
- package/src/components/url-popover/README.md +1 -1
- package/src/components/use-block-commands/index.js +5 -5
- package/src/hooks/anchor.js +9 -17
- package/src/hooks/border.js +1 -5
- package/src/hooks/color.js +1 -6
- package/src/hooks/dimensions.js +1 -5
- package/src/hooks/fit-text.js +16 -0
- package/src/hooks/position.js +23 -27
- package/src/hooks/supports.js +0 -9
- package/src/store/actions.js +13 -3
- package/src/store/private-actions.js +1 -4
- package/src/store/private-selectors.js +59 -0
- package/src/store/reducer.js +19 -7
- package/src/store/selectors.js +91 -53
- package/src/store/test/actions.js +21 -0
- package/src/store/test/private-selectors.js +53 -0
- package/src/store/test/reducer.js +46 -0
- package/src/store/test/selectors.js +77 -0
- package/build/components/media-upload-progress/constants.cjs +0 -46
- package/build/components/media-upload-progress/constants.cjs.map +0 -7
- package/build/components/rich-text/native/format-edit.cjs +0 -60
- package/build/components/rich-text/native/format-edit.cjs.map +0 -7
- package/build/components/rich-text/native/index.cjs +0 -28
- package/build/components/rich-text/native/index.cjs.map +0 -7
- package/build/components/rich-text/native/use-format-types.cjs +0 -139
- package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
- package/build-module/components/media-upload-progress/constants.mjs +0 -16
- package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
- package/build-module/components/rich-text/native/format-edit.mjs +0 -39
- package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
- package/build-module/components/rich-text/native/index.mjs +0 -7
- package/build-module/components/rich-text/native/index.mjs.map +0 -7
- package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
- package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
- package/src/components/audio-player/audio-url-parser.native.js +0 -20
- package/src/components/audio-player/index.native.js +0 -225
- package/src/components/audio-player/styles.native.scss +0 -114
- package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
- package/src/components/block-alignment-control/test/index.native.js +0 -37
- package/src/components/block-alignment-control/ui.native.js +0 -86
- package/src/components/block-caption/README.md +0 -104
- package/src/components/block-caption/index.native.js +0 -89
- package/src/components/block-caption/styles.native.scss +0 -7
- package/src/components/block-controls/slot.native.js +0 -33
- package/src/components/block-draggable/draggable-chip.native.js +0 -49
- package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
- package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
- package/src/components/block-draggable/index.native.js +0 -467
- package/src/components/block-draggable/style.native.scss +0 -19
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
- package/src/components/block-draggable/test/helpers.native.js +0 -182
- package/src/components/block-draggable/test/index.native.js +0 -419
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
- package/src/components/block-edit/edit.native.js +0 -49
- package/src/components/block-edit/test/edit.native.js +0 -65
- package/src/components/block-heading-level-dropdown/index.native.js +0 -68
- package/src/components/block-icon/index.native.js +0 -47
- package/src/components/block-icon/style.native.scss +0 -7
- package/src/components/block-list/block-crash-boundary.native.js +0 -43
- package/src/components/block-list/block-crash-warning.native.js +0 -21
- package/src/components/block-list/block-invalid-warning.native.js +0 -70
- package/src/components/block-list/block-list-context.native.js +0 -172
- package/src/components/block-list/block-list-item-cell.native.js +0 -62
- package/src/components/block-list/block-list-item.native.js +0 -209
- package/src/components/block-list/block-list-item.native.scss +0 -16
- package/src/components/block-list/block-outline.native.js +0 -77
- package/src/components/block-list/block-selection-button.native.js +0 -100
- package/src/components/block-list/block-selection-button.native.scss +0 -34
- package/src/components/block-list/block.native.js +0 -716
- package/src/components/block-list/block.native.scss +0 -62
- package/src/components/block-list/grid-item.native.js +0 -58
- package/src/components/block-list/index.native.js +0 -437
- package/src/components/block-list/insertion-point.native.js +0 -36
- package/src/components/block-list/style.native.scss +0 -117
- package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
- package/src/components/block-list/test/block-list-context.native.js +0 -243
- package/src/components/block-list/test/block-outline.native.js +0 -255
- package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
- package/src/components/block-list/test/index.native.js +0 -205
- package/src/components/block-list/use-block-props/index.native.js +0 -10
- package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
- package/src/components/block-list-appender/index.native.js +0 -70
- package/src/components/block-list-appender/style.native.scss +0 -8
- package/src/components/block-media-update-progress/README.md +0 -100
- package/src/components/block-media-update-progress/index.native.js +0 -299
- package/src/components/block-media-update-progress/styles.native.scss +0 -9
- package/src/components/block-media-update-progress/test/index.native.js +0 -543
- package/src/components/block-mover/index.native.js +0 -193
- package/src/components/block-mover/mover-description.native.js +0 -155
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
- package/src/components/block-mover/test/index.native.js +0 -186
- package/src/components/block-settings/button.native.js +0 -41
- package/src/components/block-settings/container.native.js +0 -91
- package/src/components/block-settings/container.native.scss +0 -4
- package/src/components/block-settings/index.native.js +0 -5
- package/src/components/block-styles/index.native.js +0 -94
- package/src/components/block-styles/preview.native.js +0 -109
- package/src/components/block-styles/style.native.scss +0 -64
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
- package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
- package/src/components/block-toolbar/index.native.js +0 -126
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
- package/src/components/block-toolbar/test/index.native.js +0 -36
- package/src/components/block-types-list/index.native.js +0 -175
- package/src/components/block-types-list/style.native.scss +0 -25
- package/src/components/block-variation-picker/index.native.js +0 -107
- package/src/components/block-variation-picker/style.native.scss +0 -32
- package/src/components/button-block-appender/index.native.js +0 -92
- package/src/components/button-block-appender/styles.native.scss +0 -43
- package/src/components/caption/README.md +0 -44
- package/src/components/caption/index.native.js +0 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
- package/src/components/contrast-checker/index.native.js +0 -113
- package/src/components/contrast-checker/style.native.scss +0 -26
- package/src/components/convert-to-group-buttons/index.native.js +0 -79
- package/src/components/default-block-appender/index.native.js +0 -113
- package/src/components/default-block-appender/style.native.scss +0 -18
- package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
- package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
- package/src/components/floating-toolbar/index.native.js +0 -141
- package/src/components/floating-toolbar/styles.native.scss +0 -43
- package/src/components/font-sizes/index.native.js +0 -7
- package/src/components/global-styles/color-panel.native.js +0 -207
- package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
- package/src/components/global-styles/use-global-styles-context.native.js +0 -592
- package/src/components/gradients/index.native.js +0 -2
- package/src/components/image-link-destinations/index.native.js +0 -152
- package/src/components/image-link-destinations/style.native.scss +0 -16
- package/src/components/index.native.js +0 -108
- package/src/components/inner-blocks/constants.native.js +0 -5
- package/src/components/inner-blocks/index.native.js +0 -221
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
- package/src/components/inserter/block-types-tab.native.js +0 -76
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
- package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
- package/src/components/inserter/index.native.js +0 -424
- package/src/components/inserter/menu.native.js +0 -237
- package/src/components/inserter/no-results.native.js +0 -49
- package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
- package/src/components/inserter/search-results.native.js +0 -67
- package/src/components/inserter/style.native.scss +0 -83
- package/src/components/inserter/tabs.native.js +0 -152
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
- package/src/components/inserter/test/fixtures/index.native.js +0 -12
- package/src/components/inserter/test/index.native.js +0 -273
- package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
- package/src/components/inserter/test/utils.native.js +0 -37
- package/src/components/inserter/utils.native.js +0 -46
- package/src/components/inserter-button/index.native.js +0 -108
- package/src/components/inserter-button/style.native.scss +0 -72
- package/src/components/inspector-controls/fill.native.js +0 -62
- package/src/components/inspector-controls/slot.native.js +0 -35
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
- package/src/components/line-height-control/index.native.js +0 -28
- package/src/components/media-placeholder/index.native.js +0 -258
- package/src/components/media-placeholder/styles.native.scss +0 -108
- package/src/components/media-replace-flow/index.native.js +0 -12
- package/src/components/media-upload/constants.native.js +0 -14
- package/src/components/media-upload/index.native.js +0 -356
- package/src/components/media-upload/style.native.scss +0 -4
- package/src/components/media-upload/test/index.native.js +0 -172
- package/src/components/media-upload-progress/README.md +0 -100
- package/src/components/media-upload-progress/constants.js +0 -6
- package/src/components/media-upload-progress/index.native.js +0 -233
- package/src/components/media-upload-progress/styles.native.scss +0 -15
- package/src/components/media-upload-progress/test/index.native.js +0 -220
- package/src/components/plain-text/index.native.js +0 -164
- package/src/components/plain-text/style.native.scss +0 -10
- package/src/components/provider/index.native.js +0 -32
- package/src/components/rich-text/embed-handler-picker.native.js +0 -65
- package/src/components/rich-text/file-paste-handler.native.js +0 -3
- package/src/components/rich-text/format-toolbar/index.native.js +0 -21
- package/src/components/rich-text/format-toolbar-container.native.js +0 -16
- package/src/components/rich-text/index.native.js +0 -701
- package/src/components/rich-text/input-event.native.js +0 -10
- package/src/components/rich-text/native/format-edit.js +0 -44
- package/src/components/rich-text/native/get-format-colors.native.js +0 -47
- package/src/components/rich-text/native/index.js +0 -1
- package/src/components/rich-text/native/index.native.js +0 -1389
- package/src/components/rich-text/native/style.native.scss +0 -28
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
- package/src/components/rich-text/native/test/index.native.js +0 -345
- package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
- package/src/components/rich-text/native/use-format-types.js +0 -146
- package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
- package/src/components/rich-text/shortcut.native.js +0 -10
- package/src/components/ungroup-button/README.md +0 -23
- package/src/components/ungroup-button/index.native.js +0 -77
- package/src/components/unsupported-block-details/index.native.js +0 -187
- package/src/components/unsupported-block-details/style.native.scss +0 -56
- package/src/components/url-input/index.native.js +0 -33
- package/src/components/use-block-drop-zone/index.native.js +0 -207
- package/src/components/use-on-block-drop/index.native.js +0 -115
- package/src/components/use-unsupported-block-editor/index.native.js +0 -59
- package/src/components/video-player/gridicon-play.native.js +0 -13
- package/src/components/video-player/index.native.js +0 -133
- package/src/components/video-player/styles.native.scss +0 -29
- package/src/components/warning/index.native.js +0 -64
- package/src/components/warning/style.native.scss +0 -47
- package/src/hooks/align.native.js +0 -49
- package/src/hooks/custom-class-name.native.js +0 -70
- package/src/hooks/index.native.js +0 -36
- package/src/hooks/layout.native.js +0 -23
- package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
- package/src/hooks/test/align.native.js +0 -134
- package/src/hooks/test/anchor.native.js +0 -32
- package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
- package/src/hooks/typography.native.js +0 -60
- package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
- package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
- package/src/index.native.js +0 -6
- package/src/private-apis.native.js +0 -21
- package/src/store/defaults.native.js +0 -23
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Inserter can add blocks adds new block at the end of post 1`] = `
|
|
4
|
-
"<!-- wp:spacer -->
|
|
5
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
6
|
-
<!-- /wp:spacer -->
|
|
7
|
-
|
|
8
|
-
<!-- wp:heading -->
|
|
9
|
-
<h2 class="wp-block-heading"></h2>
|
|
10
|
-
<!-- /wp:heading -->"
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
exports[`Inserter can add blocks after another block 1`] = `
|
|
14
|
-
"<!-- wp:spacer -->
|
|
15
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
16
|
-
<!-- /wp:spacer -->
|
|
17
|
-
|
|
18
|
-
<!-- wp:heading -->
|
|
19
|
-
<h2 class="wp-block-heading"></h2>
|
|
20
|
-
<!-- /wp:heading -->
|
|
21
|
-
|
|
22
|
-
<!-- wp:more -->
|
|
23
|
-
<!--more-->
|
|
24
|
-
<!-- /wp:more -->
|
|
25
|
-
|
|
26
|
-
<!-- wp:paragraph -->
|
|
27
|
-
<p></p>
|
|
28
|
-
<!-- /wp:paragraph -->"
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
exports[`Inserter can add blocks before another block 1`] = `
|
|
32
|
-
"<!-- wp:heading -->
|
|
33
|
-
<h2 class="wp-block-heading"></h2>
|
|
34
|
-
<!-- /wp:heading -->
|
|
35
|
-
|
|
36
|
-
<!-- wp:paragraph -->
|
|
37
|
-
<p></p>
|
|
38
|
-
<!-- /wp:paragraph -->"
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
exports[`Inserter can add blocks creates a new Paragraph block tapping on the empty area below the last block 1`] = `
|
|
42
|
-
"<!-- wp:spacer -->
|
|
43
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
44
|
-
<!-- /wp:spacer -->
|
|
45
|
-
|
|
46
|
-
<!-- wp:heading -->
|
|
47
|
-
<h2 class="wp-block-heading"></h2>
|
|
48
|
-
<!-- /wp:heading -->
|
|
49
|
-
|
|
50
|
-
<!-- wp:paragraph -->
|
|
51
|
-
<p></p>
|
|
52
|
-
<!-- /wp:paragraph -->"
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
exports[`Inserter can add blocks inserts between 2 existing blocks 1`] = `
|
|
56
|
-
"<!-- wp:spacer -->
|
|
57
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
58
|
-
<!-- /wp:spacer -->
|
|
59
|
-
|
|
60
|
-
<!-- wp:more -->
|
|
61
|
-
<!--more-->
|
|
62
|
-
<!-- /wp:more -->
|
|
63
|
-
|
|
64
|
-
<!-- wp:heading -->
|
|
65
|
-
<h2 class="wp-block-heading"></h2>
|
|
66
|
-
<!-- /wp:heading -->"
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
exports[`Inserter can add blocks inserts block at the end of post when no block is selected 1`] = `
|
|
70
|
-
"<!-- wp:spacer -->
|
|
71
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
72
|
-
<!-- /wp:spacer -->
|
|
73
|
-
|
|
74
|
-
<!-- wp:heading -->
|
|
75
|
-
<h2 class="wp-block-heading"></h2>
|
|
76
|
-
<!-- /wp:heading -->
|
|
77
|
-
|
|
78
|
-
<!-- wp:more -->
|
|
79
|
-
<!--more-->
|
|
80
|
-
<!-- /wp:more -->"
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
exports[`Inserter can add blocks to the beginning 1`] = `
|
|
84
|
-
"<!-- wp:more -->
|
|
85
|
-
<!--more-->
|
|
86
|
-
<!-- /wp:more -->
|
|
87
|
-
|
|
88
|
-
<!-- wp:spacer -->
|
|
89
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
90
|
-
<!-- /wp:spacer -->
|
|
91
|
-
|
|
92
|
-
<!-- wp:heading -->
|
|
93
|
-
<h2 class="wp-block-heading"></h2>
|
|
94
|
-
<!-- /wp:heading -->
|
|
95
|
-
|
|
96
|
-
<!-- wp:paragraph -->
|
|
97
|
-
<p></p>
|
|
98
|
-
<!-- /wp:paragraph -->"
|
|
99
|
-
`;
|
|
100
|
-
|
|
101
|
-
exports[`Inserter can add blocks to the end 1`] = `
|
|
102
|
-
"<!-- wp:spacer -->
|
|
103
|
-
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
104
|
-
<!-- /wp:spacer -->
|
|
105
|
-
|
|
106
|
-
<!-- wp:heading -->
|
|
107
|
-
<h2 class="wp-block-heading"></h2>
|
|
108
|
-
<!-- /wp:heading -->
|
|
109
|
-
|
|
110
|
-
<!-- wp:paragraph -->
|
|
111
|
-
<p></p>
|
|
112
|
-
<!-- /wp:paragraph -->
|
|
113
|
-
|
|
114
|
-
<!-- wp:more -->
|
|
115
|
-
<!--more-->
|
|
116
|
-
<!-- /wp:more -->"
|
|
117
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import fixtures from './index.js';
|
|
5
|
-
|
|
6
|
-
export * from './index';
|
|
7
|
-
|
|
8
|
-
export default fixtures.map( ( filteredItems ) => ( {
|
|
9
|
-
...filteredItems,
|
|
10
|
-
// Set `isNew` property expected from block type impressions.
|
|
11
|
-
isNew: false,
|
|
12
|
-
} ) );
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
addBlock,
|
|
6
|
-
fireEvent,
|
|
7
|
-
initializeEditor,
|
|
8
|
-
getBlock,
|
|
9
|
-
getEditorHtml,
|
|
10
|
-
render,
|
|
11
|
-
} from 'test/helpers';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
17
|
-
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
import { Inserter } from '../index';
|
|
23
|
-
|
|
24
|
-
const getStylesFromColorScheme = () => {
|
|
25
|
-
return { color: 'white' };
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
describe( 'Inserter', () => {
|
|
29
|
-
it( 'button contains the testID "add-block-button"', () => {
|
|
30
|
-
const screen = render(
|
|
31
|
-
<Inserter getStylesFromColorScheme={ getStylesFromColorScheme } />
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
expect( screen.getByTestId( 'add-block-button' ) ).toBeTruthy();
|
|
35
|
-
} );
|
|
36
|
-
|
|
37
|
-
describe( 'can add blocks', () => {
|
|
38
|
-
beforeAll( () => {
|
|
39
|
-
// Register all core blocks
|
|
40
|
-
registerCoreBlocks();
|
|
41
|
-
} );
|
|
42
|
-
|
|
43
|
-
afterAll( () => {
|
|
44
|
-
// Clean up registered blocks
|
|
45
|
-
getBlockTypes().forEach( ( block ) => {
|
|
46
|
-
unregisterBlockType( block.name );
|
|
47
|
-
} );
|
|
48
|
-
} );
|
|
49
|
-
|
|
50
|
-
it( 'to the beginning', async () => {
|
|
51
|
-
const screen = await initializeEditor();
|
|
52
|
-
const { getByLabelText, getByTestId } = screen;
|
|
53
|
-
|
|
54
|
-
// Add Spacer block
|
|
55
|
-
await addBlock( screen, 'Spacer' );
|
|
56
|
-
|
|
57
|
-
// Add Heading block
|
|
58
|
-
await addBlock( screen, 'Heading' );
|
|
59
|
-
|
|
60
|
-
// Add Paragraph block
|
|
61
|
-
await addBlock( screen, 'Paragraph' );
|
|
62
|
-
|
|
63
|
-
// Get Inserter button
|
|
64
|
-
const addBlockButton = await getByTestId( 'add-block-button' );
|
|
65
|
-
|
|
66
|
-
// Long press the inserter button
|
|
67
|
-
fireEvent( addBlockButton, 'onLongPress' );
|
|
68
|
-
|
|
69
|
-
// Get Add To Beginning option
|
|
70
|
-
const addBlockToBeginningButton =
|
|
71
|
-
await getByLabelText( 'Add To Beginning' );
|
|
72
|
-
expect( addBlockToBeginningButton ).toBeVisible();
|
|
73
|
-
fireEvent.press( addBlockToBeginningButton );
|
|
74
|
-
|
|
75
|
-
// Add another block at the beginning
|
|
76
|
-
await addBlock( screen, 'More', { isPickerOpened: true } );
|
|
77
|
-
|
|
78
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
79
|
-
} );
|
|
80
|
-
|
|
81
|
-
it( 'before another block', async () => {
|
|
82
|
-
const screen = await initializeEditor();
|
|
83
|
-
const { getByLabelText, getByTestId } = screen;
|
|
84
|
-
|
|
85
|
-
// Add Paragraph block
|
|
86
|
-
await addBlock( screen, 'Paragraph' );
|
|
87
|
-
|
|
88
|
-
// Get Paragraph block
|
|
89
|
-
const paragraphBlock = await getBlock( screen, 'Paragraph' );
|
|
90
|
-
fireEvent.press( paragraphBlock );
|
|
91
|
-
|
|
92
|
-
// Get Inserter button
|
|
93
|
-
const addBlockButton = await getByTestId( 'add-block-button' );
|
|
94
|
-
|
|
95
|
-
// Long press the inserter button
|
|
96
|
-
fireEvent( addBlockButton, 'onLongPress' );
|
|
97
|
-
|
|
98
|
-
// Get Add Block Before option
|
|
99
|
-
const addBlockBeforeButton =
|
|
100
|
-
await getByLabelText( 'Add Block Before' );
|
|
101
|
-
expect( addBlockBeforeButton ).toBeVisible();
|
|
102
|
-
fireEvent.press( addBlockBeforeButton );
|
|
103
|
-
|
|
104
|
-
// Add another block before the first one
|
|
105
|
-
await addBlock( screen, 'Heading', { isPickerOpened: true } );
|
|
106
|
-
|
|
107
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
108
|
-
} );
|
|
109
|
-
|
|
110
|
-
it( 'after another block', async () => {
|
|
111
|
-
const screen = await initializeEditor();
|
|
112
|
-
const { getByLabelText, getByTestId } = screen;
|
|
113
|
-
|
|
114
|
-
// Add Spacer block
|
|
115
|
-
await addBlock( screen, 'Spacer' );
|
|
116
|
-
|
|
117
|
-
// Add Heading block
|
|
118
|
-
await addBlock( screen, 'Heading' );
|
|
119
|
-
|
|
120
|
-
// Add Paragraph block
|
|
121
|
-
await addBlock( screen, 'Paragraph' );
|
|
122
|
-
|
|
123
|
-
// Get Heading block
|
|
124
|
-
const headingBlock = await getBlock( screen, 'Heading', {
|
|
125
|
-
rowIndex: 2,
|
|
126
|
-
} );
|
|
127
|
-
fireEvent.press( headingBlock );
|
|
128
|
-
|
|
129
|
-
// Get Inserter button
|
|
130
|
-
const addBlockButton = await getByTestId( 'add-block-button' );
|
|
131
|
-
|
|
132
|
-
// Long press the inserter button
|
|
133
|
-
fireEvent( addBlockButton, 'onLongPress' );
|
|
134
|
-
|
|
135
|
-
// Get Add Block After option
|
|
136
|
-
const addBlockAfterButton =
|
|
137
|
-
await getByLabelText( 'Add Block After' );
|
|
138
|
-
expect( addBlockAfterButton ).toBeVisible();
|
|
139
|
-
fireEvent.press( addBlockAfterButton );
|
|
140
|
-
|
|
141
|
-
// Add another block after the Heading block
|
|
142
|
-
await addBlock( screen, 'More', { isPickerOpened: true } );
|
|
143
|
-
|
|
144
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
145
|
-
} );
|
|
146
|
-
|
|
147
|
-
it( 'to the end', async () => {
|
|
148
|
-
const screen = await initializeEditor();
|
|
149
|
-
const { getByLabelText, getByTestId } = screen;
|
|
150
|
-
|
|
151
|
-
// Add Spacer block
|
|
152
|
-
await addBlock( screen, 'Spacer' );
|
|
153
|
-
|
|
154
|
-
// Add Heading block
|
|
155
|
-
await addBlock( screen, 'Heading' );
|
|
156
|
-
|
|
157
|
-
// Add Paragraph block
|
|
158
|
-
await addBlock( screen, 'Paragraph' );
|
|
159
|
-
|
|
160
|
-
// Get Spacer block
|
|
161
|
-
const spacerBlock = await getBlock( screen, 'Spacer' );
|
|
162
|
-
fireEvent.press( spacerBlock );
|
|
163
|
-
|
|
164
|
-
// Get Inserter button
|
|
165
|
-
const addBlockButton = await getByTestId( 'add-block-button' );
|
|
166
|
-
|
|
167
|
-
// Long press the inserter button
|
|
168
|
-
fireEvent( addBlockButton, 'onLongPress' );
|
|
169
|
-
|
|
170
|
-
// Get Add To End option
|
|
171
|
-
const addBlockToEndButton = await getByLabelText( 'Add To End' );
|
|
172
|
-
expect( addBlockToEndButton ).toBeVisible();
|
|
173
|
-
fireEvent.press( addBlockToEndButton );
|
|
174
|
-
|
|
175
|
-
// Add another block to the end after the Paragraph Block
|
|
176
|
-
await addBlock( screen, 'More', { isPickerOpened: true } );
|
|
177
|
-
|
|
178
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
179
|
-
} );
|
|
180
|
-
|
|
181
|
-
it( 'adds new block at the end of post', async () => {
|
|
182
|
-
const screen = await initializeEditor();
|
|
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: 2,
|
|
193
|
-
} );
|
|
194
|
-
expect( headingBlock ).toBeVisible();
|
|
195
|
-
|
|
196
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
197
|
-
} );
|
|
198
|
-
|
|
199
|
-
it( 'inserts between 2 existing blocks', async () => {
|
|
200
|
-
const screen = await initializeEditor();
|
|
201
|
-
|
|
202
|
-
// Add Spacer block
|
|
203
|
-
await addBlock( screen, 'Spacer' );
|
|
204
|
-
|
|
205
|
-
// Add Heading block
|
|
206
|
-
await addBlock( screen, 'Heading' );
|
|
207
|
-
|
|
208
|
-
// Get Spacer block
|
|
209
|
-
const spacerBlock = await getBlock( screen, 'Spacer' );
|
|
210
|
-
fireEvent.press( spacerBlock );
|
|
211
|
-
|
|
212
|
-
// Add More block
|
|
213
|
-
await addBlock( screen, 'More' );
|
|
214
|
-
|
|
215
|
-
// Get More block
|
|
216
|
-
const moreBlock = await getBlock( screen, 'More', { rowIndex: 2 } );
|
|
217
|
-
expect( moreBlock ).toBeVisible();
|
|
218
|
-
|
|
219
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
220
|
-
} );
|
|
221
|
-
|
|
222
|
-
it( 'inserts block at the end of post when no block is selected', async () => {
|
|
223
|
-
const screen = await initializeEditor();
|
|
224
|
-
const { getAllByLabelText } = screen;
|
|
225
|
-
|
|
226
|
-
// Add Spacer block
|
|
227
|
-
await addBlock( screen, 'Spacer' );
|
|
228
|
-
|
|
229
|
-
// Add Heading block
|
|
230
|
-
await addBlock( screen, 'Heading' );
|
|
231
|
-
|
|
232
|
-
// Select the title
|
|
233
|
-
const titleInputElement =
|
|
234
|
-
await getAllByLabelText( 'Post title. test' )[ 0 ];
|
|
235
|
-
expect( titleInputElement ).toBeVisible();
|
|
236
|
-
fireEvent.press( titleInputElement );
|
|
237
|
-
|
|
238
|
-
// Add More block
|
|
239
|
-
await addBlock( screen, 'More' );
|
|
240
|
-
|
|
241
|
-
// Get More block
|
|
242
|
-
const moreBlock = await getBlock( screen, 'More', { rowIndex: 3 } );
|
|
243
|
-
expect( moreBlock ).toBeVisible();
|
|
244
|
-
|
|
245
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
246
|
-
} );
|
|
247
|
-
|
|
248
|
-
it( 'creates a new Paragraph block tapping on the empty area below the last block', async () => {
|
|
249
|
-
const screen = await initializeEditor();
|
|
250
|
-
const { getByLabelText } = screen;
|
|
251
|
-
|
|
252
|
-
// Add Spacer block
|
|
253
|
-
await addBlock( screen, 'Spacer' );
|
|
254
|
-
|
|
255
|
-
// Add Heading block
|
|
256
|
-
await addBlock( screen, 'Heading' );
|
|
257
|
-
|
|
258
|
-
// Get the empty paragraph placeholder
|
|
259
|
-
const paragraphPlaceholder = await getByLabelText(
|
|
260
|
-
'Add paragraph block'
|
|
261
|
-
);
|
|
262
|
-
fireEvent.press( paragraphPlaceholder );
|
|
263
|
-
|
|
264
|
-
// Get Paragraph block
|
|
265
|
-
const paragraphBlock = await getBlock( screen, 'Paragraph', {
|
|
266
|
-
rowIndex: 3,
|
|
267
|
-
} );
|
|
268
|
-
expect( paragraphBlock ).toBeVisible();
|
|
269
|
-
|
|
270
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
271
|
-
} );
|
|
272
|
-
} );
|
|
273
|
-
} );
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from 'test/helpers';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import items from './fixtures';
|
|
15
|
-
import ReusableBlocksTab from '../reusable-blocks-tab';
|
|
16
|
-
|
|
17
|
-
jest.mock( '@wordpress/data/src/components/use-select' );
|
|
18
|
-
|
|
19
|
-
const fetchReusableBlocks = jest.fn();
|
|
20
|
-
const selectMock = {
|
|
21
|
-
getInserterItems: jest.fn().mockReturnValue( [] ),
|
|
22
|
-
getSettings: jest.fn().mockReturnValue( {
|
|
23
|
-
__experimentalFetchReusableBlocks: fetchReusableBlocks,
|
|
24
|
-
} ),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
describe( 'ReusableBlocksTab component', () => {
|
|
28
|
-
beforeEach( () => {
|
|
29
|
-
useSelect.mockImplementation( ( callback ) =>
|
|
30
|
-
callback( () => selectMock )
|
|
31
|
-
);
|
|
32
|
-
} );
|
|
33
|
-
|
|
34
|
-
it( 'renders without crashing', () => {
|
|
35
|
-
const component = render(
|
|
36
|
-
<ReusableBlocksTab
|
|
37
|
-
rootClientId={ 0 }
|
|
38
|
-
onSelect={ jest.fn() }
|
|
39
|
-
listProps={ { contentContainerStyle: {} } }
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
expect( component ).toBeTruthy();
|
|
43
|
-
} );
|
|
44
|
-
|
|
45
|
-
it( 'shows reusable block items', () => {
|
|
46
|
-
selectMock.getInserterItems.mockReturnValue( items );
|
|
47
|
-
|
|
48
|
-
const reusableBlockItems = items.filter(
|
|
49
|
-
( { category } ) => category === 'reusable'
|
|
50
|
-
);
|
|
51
|
-
const component = render(
|
|
52
|
-
<ReusableBlocksTab
|
|
53
|
-
rootClientId={ 0 }
|
|
54
|
-
onSelect={ jest.fn() }
|
|
55
|
-
listProps={ { contentContainerStyle: {} } }
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
reusableBlockItems.forEach( ( { title } ) => {
|
|
59
|
-
expect( component.getByText( title ) ).toBeTruthy();
|
|
60
|
-
} );
|
|
61
|
-
} );
|
|
62
|
-
} );
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createInserterSection } from '../utils';
|
|
5
|
-
|
|
6
|
-
describe( 'createInserterSection', () => {
|
|
7
|
-
it( 'returns the expected object shape', () => {
|
|
8
|
-
const key = 'mock-1';
|
|
9
|
-
const items = [ 1, 2, 3 ];
|
|
10
|
-
const metadata = { icon: 'icon-mock', title: 'Title Mock' };
|
|
11
|
-
|
|
12
|
-
expect( createInserterSection( { key, metadata, items } ) ).toEqual(
|
|
13
|
-
expect.objectContaining( {
|
|
14
|
-
metadata,
|
|
15
|
-
data: [ { key, list: items } ],
|
|
16
|
-
} )
|
|
17
|
-
);
|
|
18
|
-
} );
|
|
19
|
-
|
|
20
|
-
it( 'return always includes metadata', () => {
|
|
21
|
-
const key = 'mock-1';
|
|
22
|
-
const items = [ 1, 2, 3 ];
|
|
23
|
-
|
|
24
|
-
expect( createInserterSection( { key, items } ) ).toEqual(
|
|
25
|
-
expect.objectContaining( {
|
|
26
|
-
metadata: {},
|
|
27
|
-
data: [ { key, list: items } ],
|
|
28
|
-
} )
|
|
29
|
-
);
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
it( 'requires a unique key', () => {
|
|
33
|
-
expect( () => {
|
|
34
|
-
createInserterSection( { items: [ 1, 2, 3 ] } );
|
|
35
|
-
} ).toThrow( 'A unique key for the section must be provided.' );
|
|
36
|
-
} );
|
|
37
|
-
} );
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const REUSABLE_BLOCKS_CATEGORY = 'reusable';
|
|
2
|
-
const ALLOWED_EMBED_VARIATIONS = [
|
|
3
|
-
'core/embed',
|
|
4
|
-
'core/embed/youtube',
|
|
5
|
-
'core/embed/twitter',
|
|
6
|
-
'core/embed/wordpress',
|
|
7
|
-
'core/embed/instagram',
|
|
8
|
-
'core/embed/vimeo',
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
export function blockAllowed( block, { onlyReusable, allowReusable } ) {
|
|
12
|
-
const { id, category } = block;
|
|
13
|
-
const isReusable = category === REUSABLE_BLOCKS_CATEGORY;
|
|
14
|
-
|
|
15
|
-
if ( onlyReusable ) {
|
|
16
|
-
return isReusable;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if ( isReusable ) {
|
|
20
|
-
return allowReusable;
|
|
21
|
-
}
|
|
22
|
-
// We don't want to show all possible embed variations
|
|
23
|
-
// as different blocks in the inserter. We'll only show a
|
|
24
|
-
// few popular ones.
|
|
25
|
-
return category !== 'embed' || ALLOWED_EMBED_VARIATIONS.includes( id );
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function filterInserterItems(
|
|
29
|
-
items,
|
|
30
|
-
{ onlyReusable = false, allowReusable = false } = {}
|
|
31
|
-
) {
|
|
32
|
-
return items.filter( ( block ) =>
|
|
33
|
-
blockAllowed( block, { onlyReusable, allowReusable } )
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function createInserterSection( { key, metadata = {}, items } ) {
|
|
38
|
-
if ( ! key ) {
|
|
39
|
-
throw new Error( 'A unique key for the section must be provided.' );
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
metadata,
|
|
44
|
-
data: [ { key, list: items } ],
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { View, TouchableHighlight, Text } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useCallback } from '@wordpress/element';
|
|
10
|
-
import { Icon as WCIcon } from '@wordpress/components';
|
|
11
|
-
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
12
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import { BlockIcon } from '../block-icon';
|
|
18
|
-
import styles from './style.scss';
|
|
19
|
-
import sparkles from './sparkles';
|
|
20
|
-
|
|
21
|
-
function MenuItem( {
|
|
22
|
-
getStylesFromColorScheme,
|
|
23
|
-
item,
|
|
24
|
-
itemWidth,
|
|
25
|
-
maxWidth,
|
|
26
|
-
onSelect,
|
|
27
|
-
} ) {
|
|
28
|
-
const onPress = useCallback( () => {
|
|
29
|
-
onSelect( item );
|
|
30
|
-
}, [ onSelect, item ] );
|
|
31
|
-
|
|
32
|
-
const modalIconWrapperStyle = getStylesFromColorScheme(
|
|
33
|
-
styles.modalIconWrapper,
|
|
34
|
-
styles.modalIconWrapperDark
|
|
35
|
-
);
|
|
36
|
-
const modalIconStyle = styles.modalIcon;
|
|
37
|
-
const modalItemLabelStyle = getStylesFromColorScheme(
|
|
38
|
-
styles.modalItemLabel,
|
|
39
|
-
styles.modalItemLabelDark
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const clipboardBlockStyles = getStylesFromColorScheme(
|
|
43
|
-
styles.clipboardBlock,
|
|
44
|
-
styles.clipboardBlockDark
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const isClipboardBlock = item.id === 'clipboard';
|
|
48
|
-
const blockTitle = isClipboardBlock ? __( 'Copied block' ) : item.title;
|
|
49
|
-
const blockIsNew = item.isNew === true;
|
|
50
|
-
const accessibilityLabelFormat = blockIsNew
|
|
51
|
-
? // translators: Newly available block name. %s: The localized block name
|
|
52
|
-
__( '%s block, newly available' )
|
|
53
|
-
: // translators: %s: Block name e.g. "Image block"
|
|
54
|
-
__( '%s block' );
|
|
55
|
-
const accessibilityLabel = sprintf( accessibilityLabelFormat, item.title );
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<TouchableHighlight
|
|
59
|
-
style={ [
|
|
60
|
-
styles.touchableArea,
|
|
61
|
-
item.isDisabled ? styles.disabled : null,
|
|
62
|
-
] }
|
|
63
|
-
underlayColor="transparent"
|
|
64
|
-
activeOpacity={ 0.5 }
|
|
65
|
-
accessibilityRole="button"
|
|
66
|
-
accessibilityLabel={ accessibilityLabel }
|
|
67
|
-
onPress={ onPress }
|
|
68
|
-
disabled={ item.isDisabled }
|
|
69
|
-
>
|
|
70
|
-
<View style={ [ styles.modalItem, { width: maxWidth } ] }>
|
|
71
|
-
<View
|
|
72
|
-
style={ [
|
|
73
|
-
modalIconWrapperStyle,
|
|
74
|
-
itemWidth && {
|
|
75
|
-
width: itemWidth,
|
|
76
|
-
},
|
|
77
|
-
isClipboardBlock && clipboardBlockStyles,
|
|
78
|
-
] }
|
|
79
|
-
>
|
|
80
|
-
{ blockIsNew && (
|
|
81
|
-
<WCIcon
|
|
82
|
-
icon={ sparkles }
|
|
83
|
-
style={ styles.newIndicator }
|
|
84
|
-
/>
|
|
85
|
-
) }
|
|
86
|
-
<View style={ modalIconStyle }>
|
|
87
|
-
<BlockIcon
|
|
88
|
-
icon={ item.icon }
|
|
89
|
-
size={ modalIconStyle.width }
|
|
90
|
-
/>
|
|
91
|
-
</View>
|
|
92
|
-
</View>
|
|
93
|
-
<Text numberOfLines={ 3 } style={ modalItemLabelStyle }>
|
|
94
|
-
{ blockTitle }
|
|
95
|
-
</Text>
|
|
96
|
-
</View>
|
|
97
|
-
</TouchableHighlight>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const InserterButton = withPreferredColorScheme( MenuItem );
|
|
102
|
-
|
|
103
|
-
InserterButton.Styles = {
|
|
104
|
-
modalItem: styles.modalItem,
|
|
105
|
-
modalIconWrapper: styles.modalIconWrapper,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export default InserterButton;
|