@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,28 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.richText {
|
|
3
|
-
font-family: $default-regular-font;
|
|
4
|
-
color: $gray-900;
|
|
5
|
-
text-decoration-color: $blue-500;
|
|
6
|
-
background-color: transparent;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.richTextDark {
|
|
10
|
-
color: $white;
|
|
11
|
-
text-decoration-color: $blue-30;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.richTextPlaceholder {
|
|
15
|
-
color: $gray-20;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.richTextPlaceholderDark {
|
|
19
|
-
color: $gray-50;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.rich-text-selection {
|
|
23
|
-
color: $black;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.rich-text-selection--dark {
|
|
27
|
-
color: $white;
|
|
28
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<RichText/> when applying the font size renders component with style and font size 1`] = `
|
|
4
|
-
"<!-- wp:paragraph {"style":{"color":{"text":"#fcb900"},"typography":{"fontSize":35.56}}} -->
|
|
5
|
-
<p class="has-text-color" style="color:#fcb900;font-size:35.56px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet ut nibh vitae ornare. Sed auctor nec augue at blandit.</p>
|
|
6
|
-
<!-- /wp:paragraph -->"
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
exports[`<RichText/> when applying the font size should update the font size when style prop with font size property is provided 1`] = `
|
|
10
|
-
<View
|
|
11
|
-
style={
|
|
12
|
-
[
|
|
13
|
-
undefined,
|
|
14
|
-
undefined,
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
>
|
|
18
|
-
<TextInput
|
|
19
|
-
accessibilityLabel="Text input. Empty"
|
|
20
|
-
activeFormats={[]}
|
|
21
|
-
blockType={
|
|
22
|
-
{
|
|
23
|
-
"tag": "div",
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
disableEditingMenu={false}
|
|
27
|
-
fontFamily="serif"
|
|
28
|
-
fontSize={12}
|
|
29
|
-
isMultiline={false}
|
|
30
|
-
maxImagesWidth={200}
|
|
31
|
-
onBlur={[Function]}
|
|
32
|
-
onChange={[Function]}
|
|
33
|
-
onContentSizeChange={[Function]}
|
|
34
|
-
onFocus={[Function]}
|
|
35
|
-
onKeyDown={[Function]}
|
|
36
|
-
onPaste={[Function]}
|
|
37
|
-
onSelectionChange={[Function]}
|
|
38
|
-
placeholderTextColor="gray"
|
|
39
|
-
triggerKeyCodes={[]}
|
|
40
|
-
value=""
|
|
41
|
-
/>
|
|
42
|
-
</View>
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
exports[`<RichText/> when applying the font size should update the font size with decimals when style prop with font size property is provided 1`] = `
|
|
46
|
-
<View
|
|
47
|
-
style={
|
|
48
|
-
[
|
|
49
|
-
undefined,
|
|
50
|
-
undefined,
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
>
|
|
54
|
-
<TextInput
|
|
55
|
-
accessibilityLabel="Text input. Empty"
|
|
56
|
-
activeFormats={[]}
|
|
57
|
-
blockType={
|
|
58
|
-
{
|
|
59
|
-
"tag": "div",
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
disableEditingMenu={false}
|
|
63
|
-
fontFamily="serif"
|
|
64
|
-
fontSize={13}
|
|
65
|
-
isMultiline={false}
|
|
66
|
-
maxImagesWidth={200}
|
|
67
|
-
onBlur={[Function]}
|
|
68
|
-
onChange={[Function]}
|
|
69
|
-
onContentSizeChange={[Function]}
|
|
70
|
-
onFocus={[Function]}
|
|
71
|
-
onKeyDown={[Function]}
|
|
72
|
-
onPaste={[Function]}
|
|
73
|
-
onSelectionChange={[Function]}
|
|
74
|
-
placeholderTextColor="gray"
|
|
75
|
-
triggerKeyCodes={[]}
|
|
76
|
-
value=""
|
|
77
|
-
/>
|
|
78
|
-
</View>
|
|
79
|
-
`;
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Dimensions } from 'react-native';
|
|
5
|
-
import {
|
|
6
|
-
fireEvent,
|
|
7
|
-
getEditorHtml,
|
|
8
|
-
initializeEditor,
|
|
9
|
-
render,
|
|
10
|
-
screen,
|
|
11
|
-
} from 'test/helpers';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { select } from '@wordpress/data';
|
|
17
|
-
import {
|
|
18
|
-
store as richTextStore,
|
|
19
|
-
RichTextData,
|
|
20
|
-
__unstableCreateElement,
|
|
21
|
-
} from '@wordpress/rich-text';
|
|
22
|
-
import { coreBlocks } from '@wordpress/block-library';
|
|
23
|
-
import {
|
|
24
|
-
getBlockTypes,
|
|
25
|
-
setDefaultBlockName,
|
|
26
|
-
unregisterBlockType,
|
|
27
|
-
} from '@wordpress/blocks';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Internal dependencies
|
|
31
|
-
*/
|
|
32
|
-
import { store as blockEditorStore } from '../../../../store';
|
|
33
|
-
import RichText from '../index.native';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Mock `useSelect` with various global application settings, e.g., styles.
|
|
37
|
-
*
|
|
38
|
-
* @param {Object} settings the global application settings you would like to mock.
|
|
39
|
-
*/
|
|
40
|
-
const mockGlobalSettings = (
|
|
41
|
-
settings = { fontSize: 'var(--wp--preset--font-size--normal)' }
|
|
42
|
-
) => {
|
|
43
|
-
const { fontSize } = settings;
|
|
44
|
-
const DEFAULT_GLOBAL_STYLES = {
|
|
45
|
-
__experimentalGlobalStylesBaseStyles: { typography: { fontSize } },
|
|
46
|
-
};
|
|
47
|
-
jest.spyOn( select( blockEditorStore ), 'getSettings' ).mockReturnValue(
|
|
48
|
-
DEFAULT_GLOBAL_STYLES
|
|
49
|
-
);
|
|
50
|
-
jest.spyOn( select( richTextStore ), 'getFormatTypes' ).mockReturnValue(
|
|
51
|
-
[]
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
describe( '<RichText/>', () => {
|
|
56
|
-
/**
|
|
57
|
-
* Capture initial `window` dimensions before our integration tests modify them to stage runtime fixtures.
|
|
58
|
-
* Reset to the initial `window` dimensions after each test is executed in case they were modified.
|
|
59
|
-
*/
|
|
60
|
-
const window = Dimensions.get( 'window' );
|
|
61
|
-
|
|
62
|
-
const decimalUnitsData = [
|
|
63
|
-
[ '1.125rem', 18 ],
|
|
64
|
-
[ '10.52px', 11 ],
|
|
65
|
-
[ '2.3136em', 37 ],
|
|
66
|
-
[ '1.42vh', 19 ],
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
beforeAll( () => {
|
|
70
|
-
// Register Paragraph block.
|
|
71
|
-
const paragraph = coreBlocks[ 'core/paragraph' ];
|
|
72
|
-
paragraph.init();
|
|
73
|
-
setDefaultBlockName( paragraph.name );
|
|
74
|
-
} );
|
|
75
|
-
|
|
76
|
-
beforeEach( () => {
|
|
77
|
-
mockGlobalSettings( {} );
|
|
78
|
-
} );
|
|
79
|
-
|
|
80
|
-
afterEach( () => {
|
|
81
|
-
Dimensions.set( { window } );
|
|
82
|
-
} );
|
|
83
|
-
|
|
84
|
-
afterAll( () => {
|
|
85
|
-
// Clean up registered blocks.
|
|
86
|
-
getBlockTypes().forEach( ( block ) => {
|
|
87
|
-
unregisterBlockType( block.name );
|
|
88
|
-
} );
|
|
89
|
-
} );
|
|
90
|
-
|
|
91
|
-
describe( 'when the value changes', () => {
|
|
92
|
-
it( 'should avoid updating attributes when values are equal', async () => {
|
|
93
|
-
const handleChange = jest.fn();
|
|
94
|
-
const defaultEmptyValue = RichTextData.empty();
|
|
95
|
-
render(
|
|
96
|
-
<RichText
|
|
97
|
-
onChange={ handleChange }
|
|
98
|
-
value={ defaultEmptyValue }
|
|
99
|
-
/>
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
// Simulate an empty string from Aztec
|
|
103
|
-
fireEvent( screen.getByLabelText( 'Text input. Empty' ), 'change', {
|
|
104
|
-
nativeEvent: { text: '' },
|
|
105
|
-
} );
|
|
106
|
-
|
|
107
|
-
expect( handleChange ).not.toHaveBeenCalled();
|
|
108
|
-
} );
|
|
109
|
-
|
|
110
|
-
it( 'should preserve non-breaking space HTML entity', () => {
|
|
111
|
-
const onChange = jest.fn();
|
|
112
|
-
const onSelectionChange = jest.fn();
|
|
113
|
-
// The initial value is created using an HTML element to preserve
|
|
114
|
-
// the HTML entity.
|
|
115
|
-
const initialValue = RichTextData.fromHTMLElement(
|
|
116
|
-
__unstableCreateElement( document, ' ' )
|
|
117
|
-
);
|
|
118
|
-
render(
|
|
119
|
-
<RichText
|
|
120
|
-
onChange={ onChange }
|
|
121
|
-
onSelectionChange={ onSelectionChange }
|
|
122
|
-
value={ initialValue }
|
|
123
|
-
__unstableIsSelected
|
|
124
|
-
/>
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
// Trigger selection event with same text value as initial.
|
|
128
|
-
fireEvent(
|
|
129
|
-
screen.getByLabelText( /Text input/ ),
|
|
130
|
-
'onSelectionChange',
|
|
131
|
-
0,
|
|
132
|
-
0,
|
|
133
|
-
initialValue.toString(),
|
|
134
|
-
{
|
|
135
|
-
nativeEvent: {
|
|
136
|
-
eventCount: 0,
|
|
137
|
-
target: undefined,
|
|
138
|
-
text: initialValue.toString(),
|
|
139
|
-
},
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
expect( onChange ).not.toHaveBeenCalled();
|
|
144
|
-
expect( onSelectionChange ).toHaveBeenCalled();
|
|
145
|
-
} );
|
|
146
|
-
} );
|
|
147
|
-
|
|
148
|
-
describe( 'when applying the font size', () => {
|
|
149
|
-
it( 'should display rich text at the DEFAULT font size.', () => {
|
|
150
|
-
// Arrange.
|
|
151
|
-
const expectedFontSize = 16;
|
|
152
|
-
// Act.
|
|
153
|
-
const { getByLabelText } = render(
|
|
154
|
-
<RichText accessibilityLabel="editor" />
|
|
155
|
-
);
|
|
156
|
-
// Assert.
|
|
157
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
158
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
159
|
-
} );
|
|
160
|
-
|
|
161
|
-
it( 'should display rich text at the PROVIDED font size computed from the LOCAL `fontSize` CSS.', () => {
|
|
162
|
-
// Arrange.
|
|
163
|
-
const expectedFontSize = 32;
|
|
164
|
-
// Act.
|
|
165
|
-
const { getByLabelText } = render(
|
|
166
|
-
<RichText
|
|
167
|
-
accessibilityLabel="editor"
|
|
168
|
-
fontSize="min(2em, 3em)"
|
|
169
|
-
/>
|
|
170
|
-
);
|
|
171
|
-
// Assert.
|
|
172
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
173
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
174
|
-
} );
|
|
175
|
-
|
|
176
|
-
it( 'should display rich text at the PROVIDED font size computed from the LOCAL `style.fontSize` CSS.', () => {
|
|
177
|
-
// Arrange.
|
|
178
|
-
const expectedFontSize = 32;
|
|
179
|
-
// Act.
|
|
180
|
-
const { getByLabelText } = render(
|
|
181
|
-
<RichText
|
|
182
|
-
accessibilityLabel="editor"
|
|
183
|
-
style={ { fontSize: 'min(2em, 3em)' } }
|
|
184
|
-
/>
|
|
185
|
-
);
|
|
186
|
-
// Assert.
|
|
187
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
188
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
189
|
-
} );
|
|
190
|
-
|
|
191
|
-
it( `should display rich text with the default editor font size value and not use the
|
|
192
|
-
\`default font size value from the global styles for a tag different than (p)`, () => {
|
|
193
|
-
// Arrange.
|
|
194
|
-
const defaultFontSize = 16;
|
|
195
|
-
mockGlobalSettings( { fontSize: 'min(2em, 3em)' } );
|
|
196
|
-
// Act.
|
|
197
|
-
const { getByLabelText } = render(
|
|
198
|
-
<RichText accessibilityLabel="editor" tagName="div" />
|
|
199
|
-
);
|
|
200
|
-
// Assert.
|
|
201
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
202
|
-
expect( actualFontSize ).toBe( defaultFontSize );
|
|
203
|
-
} );
|
|
204
|
-
|
|
205
|
-
it( `should display rich text at the PROVIDED font size computed from the selected GLOBAL
|
|
206
|
-
\`__experimentalGlobalStylesBaseStyles.typography.fontSize\` CSS.`, () => {
|
|
207
|
-
// Arrange.
|
|
208
|
-
const expectedFontSize = 32;
|
|
209
|
-
mockGlobalSettings( { fontSize: 'min(2em, 3em)' } );
|
|
210
|
-
// Act.
|
|
211
|
-
const { getByLabelText } = render(
|
|
212
|
-
<RichText accessibilityLabel="editor" tagName="p" />
|
|
213
|
-
);
|
|
214
|
-
// Assert.
|
|
215
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
216
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
217
|
-
} );
|
|
218
|
-
|
|
219
|
-
test.each( decimalUnitsData )(
|
|
220
|
-
`should display rich text at the PROVIDED font size computed from the selected GLOBAL
|
|
221
|
-
\`__experimentalGlobalStylesBaseStyles.typography.fontSize\` CSS with decimal value: %s`,
|
|
222
|
-
( unit, expected ) => {
|
|
223
|
-
// Arrange.
|
|
224
|
-
mockGlobalSettings( { fontSize: unit } );
|
|
225
|
-
// Act.
|
|
226
|
-
const { getByLabelText } = render(
|
|
227
|
-
<RichText accessibilityLabel="editor" tagName="p" />
|
|
228
|
-
);
|
|
229
|
-
// Assert.
|
|
230
|
-
const actualFontSize =
|
|
231
|
-
getByLabelText( 'editor' ).props.fontSize;
|
|
232
|
-
expect( actualFontSize ).toBe( expected );
|
|
233
|
-
}
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
it( `should display rich text at the font size computed from the LOCAL \`style.fontSize\` CSS with HIGHEST PRIORITY
|
|
237
|
-
when CSS is provided ambiguously from ALL possible sources.`, () => {
|
|
238
|
-
// Arrange.
|
|
239
|
-
const expectedFontSize = 1;
|
|
240
|
-
mockGlobalSettings( { fontSize: '0' } );
|
|
241
|
-
// Act.
|
|
242
|
-
const { getByLabelText } = render(
|
|
243
|
-
<RichText
|
|
244
|
-
accessibilityLabel="editor"
|
|
245
|
-
style={ { fontSize: '1' } }
|
|
246
|
-
fontSize="2"
|
|
247
|
-
tagName="p"
|
|
248
|
-
/>
|
|
249
|
-
);
|
|
250
|
-
// Assert.
|
|
251
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
252
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
253
|
-
} );
|
|
254
|
-
|
|
255
|
-
it( `should display rich text at the font size computed from the LOCAL \`style.fontSize\` CSS with
|
|
256
|
-
NEXT PRIORITY when CSS is provided ambiguously from MULTIPLE possible sources EXCLUDING \`fontSize\`.`, () => {
|
|
257
|
-
// Arrange.
|
|
258
|
-
const expectedFontSize = 1;
|
|
259
|
-
mockGlobalSettings( { fontSize: '0' } );
|
|
260
|
-
// Act.
|
|
261
|
-
const { getByLabelText } = render(
|
|
262
|
-
<RichText
|
|
263
|
-
accessibilityLabel="editor"
|
|
264
|
-
style={ { fontSize: '1' } }
|
|
265
|
-
tagName="p"
|
|
266
|
-
/>
|
|
267
|
-
);
|
|
268
|
-
// Assert.
|
|
269
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
270
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
271
|
-
} );
|
|
272
|
-
|
|
273
|
-
it( 'should display rich text at the font size computed from CSS relative to the VIEWPORT WIDTH.', () => {
|
|
274
|
-
// Arrange.
|
|
275
|
-
const expectedFontSize = 3;
|
|
276
|
-
Dimensions.set( { window: { ...window, width: 300 } } );
|
|
277
|
-
// Act.
|
|
278
|
-
const { getByLabelText } = render(
|
|
279
|
-
<RichText accessibilityLabel="editor" fontSize="1vw" />
|
|
280
|
-
);
|
|
281
|
-
// Assert.
|
|
282
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
283
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
284
|
-
} );
|
|
285
|
-
|
|
286
|
-
it( 'should display rich text at the font size computed from CSS relative to the VIEWPORT HEIGHT.', () => {
|
|
287
|
-
// Arrange.
|
|
288
|
-
const expectedFontSize = 3;
|
|
289
|
-
Dimensions.set( { window: { ...window, height: 300 } } );
|
|
290
|
-
// Act.
|
|
291
|
-
const { getByLabelText } = render(
|
|
292
|
-
<RichText accessibilityLabel="editor" fontSize="1vh" />
|
|
293
|
-
);
|
|
294
|
-
// Assert.
|
|
295
|
-
const actualFontSize = getByLabelText( 'editor' ).props.fontSize;
|
|
296
|
-
expect( actualFontSize ).toBe( expectedFontSize );
|
|
297
|
-
} );
|
|
298
|
-
|
|
299
|
-
it( 'should update the font size when style prop with font size property is provided', () => {
|
|
300
|
-
// Arrange.
|
|
301
|
-
const fontSize = '10';
|
|
302
|
-
const style = { fontSize: '12' };
|
|
303
|
-
// Act.
|
|
304
|
-
render( <RichText fontSize={ fontSize } /> );
|
|
305
|
-
screen.update( <RichText fontSize={ fontSize } style={ style } /> );
|
|
306
|
-
// Assert.
|
|
307
|
-
expect( screen.toJSON() ).toMatchSnapshot();
|
|
308
|
-
} );
|
|
309
|
-
|
|
310
|
-
it( 'renders component with style and font size', async () => {
|
|
311
|
-
// Arrange.
|
|
312
|
-
const initialHtml = `<!-- wp:paragraph {"style":{"color":{"text":"#fcb900"},"typography":{"fontSize":35.56}}} -->
|
|
313
|
-
<p class="has-text-color" style="color:#fcb900;font-size:35.56px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet ut nibh vitae ornare. Sed auctor nec augue at blandit.</p>
|
|
314
|
-
<!-- /wp:paragraph -->`;
|
|
315
|
-
// Act.
|
|
316
|
-
await initializeEditor( { initialHtml } );
|
|
317
|
-
// Assert.
|
|
318
|
-
expect( getEditorHtml() ).toMatchSnapshot();
|
|
319
|
-
} );
|
|
320
|
-
|
|
321
|
-
it( 'should update the font size with decimals when style prop with font size property is provided', () => {
|
|
322
|
-
// Arrange.
|
|
323
|
-
const fontSize = '10';
|
|
324
|
-
const style = { fontSize: '12.56px' };
|
|
325
|
-
// Act.
|
|
326
|
-
render( <RichText fontSize={ fontSize } /> );
|
|
327
|
-
screen.update( <RichText fontSize={ fontSize } style={ style } /> );
|
|
328
|
-
// Assert.
|
|
329
|
-
expect( screen.toJSON() ).toMatchSnapshot();
|
|
330
|
-
} );
|
|
331
|
-
|
|
332
|
-
it( 'should set the default minimum line height value if the provided value from the styles is lower', () => {
|
|
333
|
-
// Arrange.
|
|
334
|
-
const expectedLineHeight = 1;
|
|
335
|
-
const style = { lineHeight: 0.2 };
|
|
336
|
-
// Act.
|
|
337
|
-
const { getByLabelText } = render(
|
|
338
|
-
<RichText accessibilityLabel="editor" style={ style } />
|
|
339
|
-
);
|
|
340
|
-
// Assert.
|
|
341
|
-
const actualFontSize = getByLabelText( 'editor' ).props.lineHeight;
|
|
342
|
-
expect( actualFontSize ).toBe( expectedLineHeight );
|
|
343
|
-
} );
|
|
344
|
-
} );
|
|
345
|
-
} );
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
typeInRichText,
|
|
6
|
-
fireEvent,
|
|
7
|
-
measurePerformance,
|
|
8
|
-
screen,
|
|
9
|
-
} from 'test/helpers';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import RichText from '../../index.native';
|
|
15
|
-
|
|
16
|
-
describe( 'RichText Performance', () => {
|
|
17
|
-
const onCreateUndoLevel = jest.fn();
|
|
18
|
-
const onChange = jest.fn();
|
|
19
|
-
const onSelectionChange = jest.fn();
|
|
20
|
-
|
|
21
|
-
it( 'performance is stable when typing using Rich Text', async () => {
|
|
22
|
-
const scenario = async () => {
|
|
23
|
-
const richTextInput = screen.getByLabelText( 'Text input. Empty' );
|
|
24
|
-
|
|
25
|
-
fireEvent( richTextInput, 'focus' );
|
|
26
|
-
|
|
27
|
-
typeInRichText(
|
|
28
|
-
richTextInput,
|
|
29
|
-
'<strong>Bold</strong> <em>italic</em> <s>strikethrough</s> text'
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
await measurePerformance(
|
|
34
|
-
<RichText
|
|
35
|
-
onChange={ onChange }
|
|
36
|
-
__unstableOnCreateUndoLevel={ onCreateUndoLevel }
|
|
37
|
-
onSelectionChange={ onSelectionChange }
|
|
38
|
-
/>,
|
|
39
|
-
{
|
|
40
|
-
scenario,
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
} );
|
|
44
|
-
} );
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Picker, ToolbarGroup, ToolbarButton } from '@wordpress/components';
|
|
5
|
-
import { useRef } from '@wordpress/element';
|
|
6
|
-
import { Icon } from '@wordpress/icons';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Toolbar button component that, upon a long press, opens a Picker
|
|
10
|
-
* to allow selecting from among multiple options.
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} props Component props.
|
|
13
|
-
* @param {Object} props.options Options to pick from.
|
|
14
|
-
*/
|
|
15
|
-
function ToolbarButtonWithOptions( { options } ) {
|
|
16
|
-
const picker = useRef();
|
|
17
|
-
|
|
18
|
-
function presentPicker() {
|
|
19
|
-
if ( picker.current ) {
|
|
20
|
-
picker.current.presentPicker();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function onValueSelected( selectedValue ) {
|
|
25
|
-
const selectedOption = options.find(
|
|
26
|
-
( op ) => op.value === selectedValue
|
|
27
|
-
);
|
|
28
|
-
if ( selectedOption ) {
|
|
29
|
-
selectedOption.onClick();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if ( ! options || options.length === 0 ) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const firstOption = options[ 0 ];
|
|
37
|
-
const enablePicker = options.length > 1;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<>
|
|
41
|
-
<ToolbarGroup>
|
|
42
|
-
<ToolbarButton
|
|
43
|
-
title={ firstOption.title }
|
|
44
|
-
icon={ <Icon icon={ firstOption.icon } /> }
|
|
45
|
-
onClick={ firstOption.onClick }
|
|
46
|
-
onLongPress={ enablePicker ? presentPicker : undefined }
|
|
47
|
-
/>
|
|
48
|
-
</ToolbarGroup>
|
|
49
|
-
{ enablePicker && (
|
|
50
|
-
<Picker
|
|
51
|
-
ref={ picker }
|
|
52
|
-
options={ options }
|
|
53
|
-
onChange={ onValueSelected }
|
|
54
|
-
hideCancelButton
|
|
55
|
-
/>
|
|
56
|
-
) }
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default ToolbarButtonWithOptions;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { store as richTextStore } from '@wordpress/rich-text';
|
|
7
|
-
|
|
8
|
-
function formatTypesSelector( select ) {
|
|
9
|
-
return select( richTextStore ).getFormatTypes();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Set of all interactive content tags.
|
|
14
|
-
*
|
|
15
|
-
* @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content
|
|
16
|
-
*/
|
|
17
|
-
const interactiveContentTags = new Set( [
|
|
18
|
-
'a',
|
|
19
|
-
'audio',
|
|
20
|
-
'button',
|
|
21
|
-
'details',
|
|
22
|
-
'embed',
|
|
23
|
-
'iframe',
|
|
24
|
-
'input',
|
|
25
|
-
'label',
|
|
26
|
-
'select',
|
|
27
|
-
'textarea',
|
|
28
|
-
'video',
|
|
29
|
-
] );
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* This hook provides RichText with the `formatTypes` and its derived props from
|
|
33
|
-
* experimental format type settings.
|
|
34
|
-
*
|
|
35
|
-
* @param {Object} $0 Options
|
|
36
|
-
* @param {string} $0.clientId Block client ID.
|
|
37
|
-
* @param {string} $0.identifier Block attribute.
|
|
38
|
-
* @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formatting or not.
|
|
39
|
-
* @param {Array} $0.allowedFormats Allowed formats
|
|
40
|
-
*/
|
|
41
|
-
export function useFormatTypes( {
|
|
42
|
-
clientId,
|
|
43
|
-
identifier,
|
|
44
|
-
withoutInteractiveFormatting,
|
|
45
|
-
allowedFormats,
|
|
46
|
-
} ) {
|
|
47
|
-
const allFormatTypes = useSelect( formatTypesSelector, [] );
|
|
48
|
-
const formatTypes = useMemo( () => {
|
|
49
|
-
return allFormatTypes.filter( ( { name, tagName } ) => {
|
|
50
|
-
if ( allowedFormats && ! allowedFormats.includes( name ) ) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (
|
|
55
|
-
withoutInteractiveFormatting &&
|
|
56
|
-
interactiveContentTags.has( tagName )
|
|
57
|
-
) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return true;
|
|
62
|
-
} );
|
|
63
|
-
}, [ allFormatTypes, allowedFormats, interactiveContentTags ] );
|
|
64
|
-
const keyedSelected = useSelect(
|
|
65
|
-
( select ) =>
|
|
66
|
-
formatTypes.reduce( ( accumulator, type ) => {
|
|
67
|
-
if ( type.__experimentalGetPropsForEditableTreePreparation ) {
|
|
68
|
-
accumulator[ type.name ] =
|
|
69
|
-
type.__experimentalGetPropsForEditableTreePreparation(
|
|
70
|
-
select,
|
|
71
|
-
{
|
|
72
|
-
richTextIdentifier: identifier,
|
|
73
|
-
blockClientId: clientId,
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return accumulator;
|
|
79
|
-
}, {} ),
|
|
80
|
-
[ formatTypes, clientId, identifier ]
|
|
81
|
-
);
|
|
82
|
-
const dispatch = useDispatch();
|
|
83
|
-
const prepareHandlers = [];
|
|
84
|
-
const valueHandlers = [];
|
|
85
|
-
const changeHandlers = [];
|
|
86
|
-
const dependencies = [];
|
|
87
|
-
|
|
88
|
-
formatTypes.forEach( ( type ) => {
|
|
89
|
-
if ( type.__experimentalCreatePrepareEditableTree ) {
|
|
90
|
-
const selected = keyedSelected[ type.name ];
|
|
91
|
-
const handler = type.__experimentalCreatePrepareEditableTree(
|
|
92
|
-
selected,
|
|
93
|
-
{
|
|
94
|
-
richTextIdentifier: identifier,
|
|
95
|
-
blockClientId: clientId,
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
if ( type.__experimentalCreateOnChangeEditableValue ) {
|
|
100
|
-
valueHandlers.push( handler );
|
|
101
|
-
} else {
|
|
102
|
-
prepareHandlers.push( handler );
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
for ( const key in selected ) {
|
|
106
|
-
dependencies.push( selected[ key ] );
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if ( type.__experimentalCreateOnChangeEditableValue ) {
|
|
111
|
-
let dispatchers = {};
|
|
112
|
-
|
|
113
|
-
if ( type.__experimentalGetPropsForEditableTreeChangeHandler ) {
|
|
114
|
-
dispatchers =
|
|
115
|
-
type.__experimentalGetPropsForEditableTreeChangeHandler(
|
|
116
|
-
dispatch,
|
|
117
|
-
{
|
|
118
|
-
richTextIdentifier: identifier,
|
|
119
|
-
blockClientId: clientId,
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
changeHandlers.push(
|
|
125
|
-
type.__experimentalCreateOnChangeEditableValue(
|
|
126
|
-
{
|
|
127
|
-
...( keyedSelected[ type.name ] || {} ),
|
|
128
|
-
...dispatchers,
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
richTextIdentifier: identifier,
|
|
132
|
-
blockClientId: clientId,
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
} );
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
formatTypes,
|
|
141
|
-
prepareHandlers,
|
|
142
|
-
valueHandlers,
|
|
143
|
-
changeHandlers,
|
|
144
|
-
dependencies,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const RemoveBrowserShortcuts = () => null;
|