@wordpress/block-editor 10.5.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/autocompleters/block.js +2 -6
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -0
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/block-card/index.js +51 -3
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +46 -39
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -3
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +4 -7
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-inspector/index.js +35 -33
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +5 -8
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block.js +55 -24
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +61 -28
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +12 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +3 -2
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +33 -11
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +9 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +5 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +8 -49
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -2
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/height-control/index.js +115 -0
- package/build/components/height-control/index.js.map +1 -0
- package/build/components/iframe/index.js +11 -8
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -0
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +1 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +20 -6
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +25 -46
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +3 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +27 -0
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build/components/inserter/index.js +8 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -4
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +103 -0
- package/build/components/inserter/media-tab/hooks.js.map +1 -0
- package/build/components/inserter/media-tab/index.js +32 -0
- package/build/components/inserter/media-tab/index.js.map +1 -0
- package/build/components/inserter/media-tab/media-list.js +100 -0
- package/build/components/inserter/media-tab/media-list.js.map +1 -0
- package/build/components/inserter/media-tab/media-panel.js +96 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build/components/inserter/media-tab/media-tab.js +120 -0
- package/build/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build/components/inserter/media-tab/utils.js +54 -0
- package/build/components/inserter/media-tab/utils.js.map +1 -0
- package/build/components/inserter/menu.js +35 -12
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +70 -0
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build/components/inserter/quick-inserter.js +1 -0
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -1
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +16 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/index.js +71 -0
- package/build/components/inspector-controls-tabs/index.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build/components/inspector-controls-tabs/utils.js +37 -0
- package/build/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build/components/link-control/index.js +1 -0
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +3 -3
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block.js +5 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +13 -12
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/media-upload/index.native.js +2 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +104 -0
- package/build/components/off-canvas-editor/appender.js.map +1 -0
- package/build/components/off-canvas-editor/block-edit-button.js +50 -0
- package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build/components/off-canvas-editor/block.js +36 -4
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +3 -5
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +20 -11
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf.js +1 -1
- package/build/components/off-canvas-editor/leaf.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +185 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build/components/off-canvas-editor/update-attributes.js +108 -0
- package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build/components/rich-text/format-toolbar/index.js +8 -4
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +3 -3
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-insert-replacement-text.js +43 -0
- package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build/components/rich-text/utils.js +1 -19
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +4 -2
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +46 -43
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +8 -4
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-setting/index.js +9 -1
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/child-layout.js +209 -0
- package/build/hooks/child-layout.js.map +1 -0
- package/build/hooks/content-lock-ui.js +1 -1
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +25 -7
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/layout.js +57 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/min-height.js +4 -10
- package/build/hooks/min-height.js.map +1 -1
- package/build/store/reducer.js +393 -270
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +57 -47
- package/build/store/selectors.js.map +1 -1
- package/build/utils/sorting.js +63 -0
- package/build/utils/sorting.js.map +1 -0
- package/build-module/autocompleters/block.js +2 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -0
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +40 -31
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -2
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +4 -6
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +32 -30
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-context.native.js +5 -8
- package/build-module/components/block-list/block-list-context.native.js.map +1 -1
- package/build-module/components/block-list/block.js +55 -25
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +61 -28
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +13 -6
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +3 -2
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +35 -13
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +9 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +5 -8
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +8 -49
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/height-control/index.js +103 -0
- package/build-module/components/height-control/index.js.map +1 -0
- package/build-module/components/iframe/index.js +11 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +22 -8
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +27 -49
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -2
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build-module/components/inserter/index.js +8 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +3 -5
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +89 -0
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
- package/build-module/components/inserter/media-tab/index.js +4 -0
- package/build-module/components/inserter/media-tab/index.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-list.js +86 -0
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js +77 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-tab.js +100 -0
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build-module/components/inserter/media-tab/utils.js +45 -0
- package/build-module/components/inserter/media-tab/utils.js.map +1 -0
- package/build-module/components/inserter/menu.js +33 -12
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build-module/components/inserter/quick-inserter.js +1 -0
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +15 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/index.js +56 -0
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/utils.js +26 -0
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build-module/components/link-control/index.js +1 -0
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +3 -3
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block.js +5 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +12 -11
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +2 -4
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +89 -0
- package/build-module/components/off-canvas-editor/appender.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build-module/components/off-canvas-editor/block.js +36 -6
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +3 -4
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +20 -12
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf.js +1 -1
- package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +165 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
- package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar/index.js +6 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -3
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
- package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/utils.js +1 -16
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -2
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +46 -43
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +9 -5
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +8 -1
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/child-layout.js +189 -0
- package/build-module/hooks/child-layout.js.map +1 -0
- package/build-module/hooks/content-lock-ui.js +1 -1
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +25 -8
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/layout.js +55 -0
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/min-height.js +3 -9
- package/build-module/hooks/min-height.js.map +1 -1
- package/build-module/store/reducer.js +391 -271
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +54 -47
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/sorting.js +56 -0
- package/build-module/utils/sorting.js.map +1 -0
- package/build-style/content-rtl.css +701 -0
- package/build-style/content.css +701 -0
- package/build-style/default-editor-styles-rtl.css +14 -0
- package/build-style/default-editor-styles.css +14 -0
- package/build-style/style-rtl.css +286 -662
- package/build-style/style.css +286 -662
- package/package.json +32 -30
- package/src/autocompleters/block.js +2 -6
- package/src/autocompleters/link.js +2 -0
- package/src/components/alignment-control/test/index.js +4 -1
- package/src/components/block-alignment-control/test/index.js +4 -1
- package/src/components/block-card/index.js +46 -2
- package/src/components/block-card/style.scss +4 -0
- package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
- package/src/components/block-draggable/content.scss +20 -0
- package/src/components/block-draggable/index.native.js +54 -40
- package/src/components/block-draggable/style.scss +0 -21
- package/src/components/block-draggable/test/helpers.native.js +7 -9
- package/src/components/block-draggable/test/index.native.js +35 -45
- package/src/components/block-edit/edit.js +5 -2
- package/src/components/block-edit/edit.native.js +5 -6
- package/src/components/block-inspector/index.js +96 -81
- package/src/components/block-inspector/style.scss +9 -1
- package/src/components/block-list/block-list-context.native.js +5 -8
- package/src/components/block-list/block.js +74 -23
- package/src/components/block-list/block.native.js +78 -23
- package/src/components/block-list/{style.scss → content.scss} +1 -15
- package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +24 -6
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -2
- package/src/components/block-pattern-setup/index.js +2 -1
- package/src/components/block-patterns-list/index.js +47 -24
- package/src/components/block-preview/README.md +15 -10
- package/src/components/block-preview/auto.js +7 -1
- package/src/components/block-preview/content.scss +4 -0
- package/src/components/block-preview/index.js +7 -12
- package/src/components/block-preview/style.scss +0 -7
- package/src/components/block-preview/test/index.js +18 -35
- package/src/components/block-selection-clearer/test/index.js +12 -12
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
- package/src/components/block-switcher/test/index.js +4 -0
- package/src/components/block-toolbar/index.js +12 -5
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/insertion-point.js +3 -47
- package/src/components/block-tools/style.scss +12 -5
- package/src/components/block-variation-picker/index.js +1 -4
- package/src/components/block-vertical-alignment-control/test/index.js +4 -1
- package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/height-control/index.js +123 -0
- package/src/components/height-control/stories/index.js +21 -0
- package/src/components/height-control/style.scss +5 -0
- package/src/components/iframe/index.js +25 -18
- package/src/components/image-editor/use-save-image.js +2 -0
- package/src/components/image-editor/zoom-dropdown.js +1 -0
- package/src/components/index.js +1 -0
- package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
- package/src/components/inner-blocks/index.js +23 -6
- package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
- package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/src/components/inserter/block-patterns-tab.js +28 -71
- package/src/components/inserter/block-types-tab.js +3 -2
- package/src/components/inserter/hooks/use-debounced-input.js +17 -0
- package/src/components/inserter/index.js +10 -2
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +88 -0
- package/src/components/inserter/media-tab/index.js +3 -0
- package/src/components/inserter/media-tab/media-list.js +93 -0
- package/src/components/inserter/media-tab/media-panel.js +83 -0
- package/src/components/inserter/media-tab/media-tab.js +135 -0
- package/src/components/inserter/media-tab/utils.js +37 -0
- package/src/components/inserter/menu.js +55 -13
- package/src/components/inserter/mobile-tab-navigation.js +85 -0
- package/src/components/inserter/quick-inserter.js +1 -0
- package/src/components/inserter/search-results.js +3 -2
- package/src/components/inserter/stories/index.js +1 -1
- package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
- package/src/components/inserter/style.scss +176 -11
- package/src/components/inserter/tabs.js +12 -1
- package/src/components/inserter-list-item/index.js +11 -1
- package/src/components/inserter-list-item/style.scss +26 -0
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/index.js +62 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
- package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
- package/src/components/inspector-controls-tabs/utils.js +28 -0
- package/src/components/line-height-control/test/index.js +5 -5
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/index.js +1 -0
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/link-control/test/index.js +188 -401
- package/src/components/link-control/use-internal-input-value.js +3 -3
- package/src/components/list-view/block.js +3 -0
- package/src/components/list-view/branch.js +10 -8
- package/src/components/list-view/style.scss +20 -9
- package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
- package/src/components/media-replace-flow/test/index.js +37 -9
- package/src/components/media-upload/test/index.native.js +2 -0
- package/src/components/off-canvas-editor/appender.js +93 -0
- package/src/components/off-canvas-editor/block-edit-button.js +27 -0
- package/src/components/off-canvas-editor/block.js +88 -22
- package/src/components/off-canvas-editor/branch.js +3 -5
- package/src/components/off-canvas-editor/index.js +59 -33
- package/src/components/off-canvas-editor/leaf.js +5 -1
- package/src/components/off-canvas-editor/link-ui.js +166 -0
- package/src/components/off-canvas-editor/style.scss +17 -388
- package/src/components/off-canvas-editor/update-attributes.js +99 -0
- package/src/components/plain-text/{style.scss → content.scss} +0 -0
- package/src/components/recursion-provider/test/index.js +27 -29
- package/src/components/rich-text/content.scss +42 -0
- package/src/components/rich-text/format-toolbar/index.js +6 -4
- package/src/components/rich-text/index.js +2 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +0 -43
- package/src/components/rich-text/use-insert-replacement-text.js +31 -0
- package/src/components/rich-text/use-undo-automatic-change.js +7 -1
- package/src/components/rich-text/utils.js +2 -21
- package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
- package/src/components/ungroup-button/index.native.js +6 -2
- package/src/components/url-input/index.js +57 -73
- package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
- package/src/components/url-popover/test/index.js +21 -9
- package/src/components/use-block-display-information/index.js +14 -5
- package/src/components/use-setting/index.js +13 -1
- package/src/components/use-setting/test/index.js +99 -0
- package/src/content.scss +10 -0
- package/src/hooks/child-layout.js +190 -0
- package/src/hooks/content-lock-ui.js +1 -1
- package/src/hooks/dimensions.js +45 -7
- package/src/hooks/layout.js +60 -0
- package/src/hooks/min-height.js +2 -19
- package/src/store/reducer.js +459 -423
- package/src/store/selectors.js +56 -57
- package/src/store/test/performance.js +71 -0
- package/src/store/test/reducer.js +623 -491
- package/src/store/test/selectors.js +1820 -1306
- package/src/style.scss +4 -7
- package/src/utils/sorting.js +54 -0
- package/src/utils/test/sorting.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-preview/live.js +0 -30
- package/build/components/block-preview/live.js.map +0 -1
- package/build-module/components/block-preview/live.js +0 -20
- package/build-module/components/block-preview/live.js.map +0 -1
- package/src/components/block-preview/live.js +0 -19
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import { orderBy } from 'lodash';
|
|
6
4
|
import classnames from 'classnames';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* WordPress dependencies
|
|
10
8
|
*/
|
|
11
|
-
|
|
12
9
|
import { __ } from '@wordpress/i18n';
|
|
13
10
|
import { ToolbarItem, DropdownMenu, Slot } from '@wordpress/components';
|
|
14
11
|
import { chevronDown } from '@wordpress/icons';
|
|
15
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { orderBy } from '../../../utils/sorting';
|
|
17
|
+
|
|
16
18
|
const POPOVER_PROPS = {
|
|
17
19
|
position: 'bottom right',
|
|
18
20
|
variant: 'toolbar',
|
|
@@ -21,7 +23,7 @@ const POPOVER_PROPS = {
|
|
|
21
23
|
const FormatToolbar = () => {
|
|
22
24
|
return (
|
|
23
25
|
<>
|
|
24
|
-
{ [ 'bold', 'italic', 'link' ].map( ( format ) => (
|
|
26
|
+
{ [ 'bold', 'italic', 'link', 'unknown' ].map( ( format ) => (
|
|
25
27
|
<Slot
|
|
26
28
|
name={ `RichText.ToolbarControls.${ format }` }
|
|
27
29
|
key={ format }
|
|
@@ -44,6 +44,7 @@ import { useFormatTypes } from './use-format-types';
|
|
|
44
44
|
import { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';
|
|
45
45
|
import { useShortcuts } from './use-shortcuts';
|
|
46
46
|
import { useInputEvents } from './use-input-events';
|
|
47
|
+
import { useInsertReplacementText } from './use-insert-replacement-text';
|
|
47
48
|
import { useFirefoxCompat } from './use-firefox-compat';
|
|
48
49
|
import FormatEdit from './format-edit';
|
|
49
50
|
import { getMultilineTag, getAllowedFormats } from './utils';
|
|
@@ -97,7 +98,6 @@ function RichTextWrapper(
|
|
|
97
98
|
onReplace,
|
|
98
99
|
placeholder,
|
|
99
100
|
allowedFormats,
|
|
100
|
-
formattingControls,
|
|
101
101
|
withoutInteractiveFormatting,
|
|
102
102
|
onRemove,
|
|
103
103
|
onMerge,
|
|
@@ -165,7 +165,6 @@ function RichTextWrapper(
|
|
|
165
165
|
const multilineTag = getMultilineTag( multiline );
|
|
166
166
|
const adjustedAllowedFormats = getAllowedFormats( {
|
|
167
167
|
allowedFormats,
|
|
168
|
-
formattingControls,
|
|
169
168
|
disableFormats,
|
|
170
169
|
} );
|
|
171
170
|
const hasFormats =
|
|
@@ -408,6 +407,7 @@ function RichTextWrapper(
|
|
|
408
407
|
onReplace,
|
|
409
408
|
selectionChange,
|
|
410
409
|
} ),
|
|
410
|
+
useInsertReplacementText(),
|
|
411
411
|
useRemoveBrowserShortcuts(),
|
|
412
412
|
useShortcuts( keyboardShortcuts ),
|
|
413
413
|
useInputEvents( inputEvents ),
|
|
@@ -75,7 +75,6 @@ function RichTextWrapper(
|
|
|
75
75
|
onReplace,
|
|
76
76
|
placeholder,
|
|
77
77
|
allowedFormats,
|
|
78
|
-
formattingControls,
|
|
79
78
|
withoutInteractiveFormatting,
|
|
80
79
|
onRemove,
|
|
81
80
|
onMerge,
|
|
@@ -194,7 +193,6 @@ function RichTextWrapper(
|
|
|
194
193
|
const multilineTag = getMultilineTag( multiline );
|
|
195
194
|
const adjustedAllowedFormats = getAllowedFormats( {
|
|
196
195
|
allowedFormats,
|
|
197
|
-
formattingControls,
|
|
198
196
|
disableFormats,
|
|
199
197
|
} );
|
|
200
198
|
const hasFormats =
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
.rich-text {
|
|
2
|
-
[data-rich-text-placeholder] {
|
|
3
|
-
pointer-events: none;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
[data-rich-text-placeholder]::after {
|
|
7
|
-
content: attr(data-rich-text-placeholder);
|
|
8
|
-
// Use opacity to work in various editor styles.
|
|
9
|
-
// We don't specify the color here, because blocks or editor styles might provide their own.
|
|
10
|
-
opacity: 0.62;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
&:focus {
|
|
14
|
-
// Removes outline added by the browser.
|
|
15
|
-
outline: none;
|
|
16
|
-
|
|
17
|
-
[data-rich-text-format-boundary] {
|
|
18
|
-
border-radius: 2px;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.block-editor-rich-text__editable {
|
|
24
|
-
> p:first-child {
|
|
25
|
-
margin-top: 0;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Captions may have lighter (gray) text, or be shown on a range of different background luminosites.
|
|
30
|
-
// To ensure legibility, we increase the default placeholder opacity to ensure contrast.
|
|
31
|
-
figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before {
|
|
32
|
-
opacity: 0.8;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
1
|
.components-popover.block-editor-rich-text__inline-format-toolbar {
|
|
36
2
|
// Set z-index as if it's displayed on the bottom, otherwise the block
|
|
37
3
|
// switcher popover might overlap if displayed on the bottom.
|
|
@@ -80,12 +46,3 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
80
46
|
}
|
|
81
47
|
}
|
|
82
48
|
}
|
|
83
|
-
|
|
84
|
-
[data-rich-text-script] {
|
|
85
|
-
display: inline;
|
|
86
|
-
|
|
87
|
-
&::before {
|
|
88
|
-
content: "</>";
|
|
89
|
-
background: rgb(255, 255, 0);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as blockEditorStore } from '../../store';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* When the browser is about to auto correct, add an undo level so the user can
|
|
14
|
+
* revert the change.
|
|
15
|
+
*/
|
|
16
|
+
export function useInsertReplacementText() {
|
|
17
|
+
const { __unstableMarkLastChangeAsPersistent } =
|
|
18
|
+
useDispatch( blockEditorStore );
|
|
19
|
+
return useRefEffect( ( element ) => {
|
|
20
|
+
function onInput( event ) {
|
|
21
|
+
if ( event.inputType === 'insertReplacementText' ) {
|
|
22
|
+
__unstableMarkLastChangeAsPersistent();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
element.addEventListener( 'beforeinput', onInput );
|
|
27
|
+
return () => {
|
|
28
|
+
element.removeEventListener( 'beforeinput', onInput );
|
|
29
|
+
};
|
|
30
|
+
}, [] );
|
|
31
|
+
}
|
|
@@ -28,12 +28,18 @@ export function useUndoAutomaticChange() {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
const { __experimentalUndo } = getSettings();
|
|
32
|
+
|
|
33
|
+
if ( ! __experimentalUndo ) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
31
37
|
if ( ! didAutomaticChange() ) {
|
|
32
38
|
return;
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
event.preventDefault();
|
|
36
|
-
|
|
42
|
+
__experimentalUndo();
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
element.addEventListener( 'keydown', onKeyDown );
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { regexp } from '@wordpress/shortcode';
|
|
5
|
-
import deprecated from '@wordpress/deprecated';
|
|
6
5
|
import { renderToString } from '@wordpress/element';
|
|
7
6
|
import { createBlock } from '@wordpress/blocks';
|
|
8
7
|
|
|
@@ -34,30 +33,12 @@ export function getMultilineTag( multiline ) {
|
|
|
34
33
|
return multiline === true ? 'p' : multiline;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
export function getAllowedFormats( {
|
|
38
|
-
allowedFormats,
|
|
39
|
-
formattingControls,
|
|
40
|
-
disableFormats,
|
|
41
|
-
} ) {
|
|
36
|
+
export function getAllowedFormats( { allowedFormats, disableFormats } ) {
|
|
42
37
|
if ( disableFormats ) {
|
|
43
38
|
return getAllowedFormats.EMPTY_ARRAY;
|
|
44
39
|
}
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if ( allowedFormats ) {
|
|
51
|
-
return allowedFormats;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
deprecated( 'wp.blockEditor.RichText formattingControls prop', {
|
|
55
|
-
since: '5.4',
|
|
56
|
-
alternative: 'allowedFormats',
|
|
57
|
-
version: '6.2',
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
return formattingControls.map( ( name ) => `core/${ name }` );
|
|
41
|
+
return allowedFormats;
|
|
61
42
|
}
|
|
62
43
|
|
|
63
44
|
getAllowedFormats.EMPTY_ARRAY = [];
|
|
@@ -222,6 +222,8 @@ export default function SpacingInputControl( {
|
|
|
222
222
|
<UnitControl
|
|
223
223
|
onMouseOver={ onMouseOver }
|
|
224
224
|
onMouseOut={ onMouseOut }
|
|
225
|
+
onFocus={ onMouseOver }
|
|
226
|
+
onBlur={ onMouseOut }
|
|
225
227
|
onChange={ ( newSize ) =>
|
|
226
228
|
onChange( getNewCustomValue( newSize ) )
|
|
227
229
|
}
|
|
@@ -239,6 +241,8 @@ export default function SpacingInputControl( {
|
|
|
239
241
|
<RangeControl
|
|
240
242
|
onMouseOver={ onMouseOver }
|
|
241
243
|
onMouseOut={ onMouseOut }
|
|
244
|
+
onFocus={ onMouseOver }
|
|
245
|
+
onBlur={ onMouseOut }
|
|
242
246
|
value={ customRangeValue }
|
|
243
247
|
min={ 0 }
|
|
244
248
|
max={ CUSTOM_VALUE_SETTINGS[ selectedUnit ]?.max ?? 10 }
|
|
@@ -248,6 +252,7 @@ export default function SpacingInputControl( {
|
|
|
248
252
|
withInputField={ false }
|
|
249
253
|
onChange={ handleCustomValueSliderChange }
|
|
250
254
|
className="components-spacing-sizes-control__custom-value-range"
|
|
255
|
+
__nextHasNoMarginBottom
|
|
251
256
|
/>
|
|
252
257
|
</>
|
|
253
258
|
) }
|
|
@@ -277,6 +282,8 @@ export default function SpacingInputControl( {
|
|
|
277
282
|
label={ ariaLabel }
|
|
278
283
|
hideLabelFromVision={ true }
|
|
279
284
|
__nextHasNoMarginBottom={ true }
|
|
285
|
+
onFocus={ onMouseOver }
|
|
286
|
+
onBlur={ onMouseOut }
|
|
280
287
|
/>
|
|
281
288
|
) }
|
|
282
289
|
{ ! showRangeControl && ! showCustomValueControl && (
|
|
@@ -302,6 +309,8 @@ export default function SpacingInputControl( {
|
|
|
302
309
|
size={ '__unstable-large' }
|
|
303
310
|
onMouseOver={ onMouseOver }
|
|
304
311
|
onMouseOut={ onMouseOut }
|
|
312
|
+
onFocus={ onMouseOver }
|
|
313
|
+
onBlur={ onMouseOut }
|
|
305
314
|
/>
|
|
306
315
|
) }
|
|
307
316
|
</>
|
|
@@ -14,6 +14,7 @@ import UngroupIcon from './icon';
|
|
|
14
14
|
import { store as blockEditorStore } from '../../store';
|
|
15
15
|
|
|
16
16
|
const noop = () => {};
|
|
17
|
+
const EMPTY_BLOCKS_LIST = [];
|
|
17
18
|
|
|
18
19
|
export function UngroupButton( { onConvertFromGroup, isUngroupable = false } ) {
|
|
19
20
|
if ( ! isUngroupable ) {
|
|
@@ -45,9 +46,12 @@ export default compose( [
|
|
|
45
46
|
const isUngroupable =
|
|
46
47
|
selectedBlock &&
|
|
47
48
|
selectedBlock.innerBlocks &&
|
|
48
|
-
|
|
49
|
+
selectedBlock.innerBlocks.length > 0 &&
|
|
49
50
|
selectedBlock.name === groupingBlockName;
|
|
50
|
-
|
|
51
|
+
|
|
52
|
+
const innerBlocks = isUngroupable
|
|
53
|
+
? selectedBlock.innerBlocks
|
|
54
|
+
: EMPTY_BLOCKS_LIST;
|
|
51
55
|
|
|
52
56
|
return {
|
|
53
57
|
isUngroupable,
|
|
@@ -60,13 +60,14 @@ class URLInput extends Component {
|
|
|
60
60
|
|
|
61
61
|
this.suggestionNodes = [];
|
|
62
62
|
|
|
63
|
-
this.
|
|
63
|
+
this.suggestionsRequest = null;
|
|
64
64
|
|
|
65
65
|
this.state = {
|
|
66
66
|
suggestions: [],
|
|
67
67
|
showSuggestions: false,
|
|
68
|
+
isUpdatingSuggestions: false,
|
|
69
|
+
suggestionsValue: null,
|
|
68
70
|
selectedSuggestion: null,
|
|
69
|
-
|
|
70
71
|
suggestionsListboxId: '',
|
|
71
72
|
suggestionOptionIdPrefix: '',
|
|
72
73
|
};
|
|
@@ -103,7 +104,7 @@ class URLInput extends Component {
|
|
|
103
104
|
if (
|
|
104
105
|
prevProps.value !== value &&
|
|
105
106
|
! this.props.disableSuggestions &&
|
|
106
|
-
! this.isUpdatingSuggestions
|
|
107
|
+
! this.state.isUpdatingSuggestions
|
|
107
108
|
) {
|
|
108
109
|
if ( value?.length ) {
|
|
109
110
|
// If the new value is not empty we need to update with suggestions for it.
|
|
@@ -123,7 +124,7 @@ class URLInput extends Component {
|
|
|
123
124
|
|
|
124
125
|
componentWillUnmount() {
|
|
125
126
|
this.suggestionsRequest?.cancel?.();
|
|
126
|
-
|
|
127
|
+
this.suggestionsRequest = null;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
bindSuggestionNode( index ) {
|
|
@@ -133,14 +134,10 @@ class URLInput extends Component {
|
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
shouldShowInitialSuggestions() {
|
|
136
|
-
const { suggestions } = this.state;
|
|
137
137
|
const { __experimentalShowInitialSuggestions = false, value } =
|
|
138
138
|
this.props;
|
|
139
139
|
return (
|
|
140
|
-
!
|
|
141
|
-
__experimentalShowInitialSuggestions &&
|
|
142
|
-
! ( value && value.length ) &&
|
|
143
|
-
! ( suggestions && suggestions.length )
|
|
140
|
+
__experimentalShowInitialSuggestions && ! ( value && value.length )
|
|
144
141
|
);
|
|
145
142
|
}
|
|
146
143
|
|
|
@@ -170,8 +167,13 @@ class URLInput extends Component {
|
|
|
170
167
|
! isInitialSuggestions &&
|
|
171
168
|
( value.length < 2 || ( ! handleURLSuggestions && isURL( value ) ) )
|
|
172
169
|
) {
|
|
170
|
+
this.suggestionsRequest?.cancel?.();
|
|
171
|
+
this.suggestionsRequest = null;
|
|
172
|
+
|
|
173
173
|
this.setState( {
|
|
174
|
+
suggestions: [],
|
|
174
175
|
showSuggestions: false,
|
|
176
|
+
suggestionsValue: value,
|
|
175
177
|
selectedSuggestion: null,
|
|
176
178
|
loading: false,
|
|
177
179
|
} );
|
|
@@ -179,9 +181,8 @@ class URLInput extends Component {
|
|
|
179
181
|
return;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
|
-
this.isUpdatingSuggestions = true;
|
|
183
|
-
|
|
184
184
|
this.setState( {
|
|
185
|
+
isUpdatingSuggestions: true,
|
|
185
186
|
selectedSuggestion: null,
|
|
186
187
|
loading: true,
|
|
187
188
|
} );
|
|
@@ -201,6 +202,8 @@ class URLInput extends Component {
|
|
|
201
202
|
|
|
202
203
|
this.setState( {
|
|
203
204
|
suggestions,
|
|
205
|
+
isUpdatingSuggestions: false,
|
|
206
|
+
suggestionsValue: value,
|
|
204
207
|
loading: false,
|
|
205
208
|
showSuggestions: !! suggestions.length,
|
|
206
209
|
} );
|
|
@@ -224,15 +227,16 @@ class URLInput extends Component {
|
|
|
224
227
|
'assertive'
|
|
225
228
|
);
|
|
226
229
|
}
|
|
227
|
-
this.isUpdatingSuggestions = false;
|
|
228
230
|
} )
|
|
229
231
|
.catch( () => {
|
|
230
|
-
if ( this.suggestionsRequest
|
|
231
|
-
|
|
232
|
-
loading: false,
|
|
233
|
-
} );
|
|
234
|
-
this.isUpdatingSuggestions = false;
|
|
232
|
+
if ( this.suggestionsRequest !== request ) {
|
|
233
|
+
return;
|
|
235
234
|
}
|
|
235
|
+
|
|
236
|
+
this.setState( {
|
|
237
|
+
isUpdatingSuggestions: false,
|
|
238
|
+
loading: false,
|
|
239
|
+
} );
|
|
236
240
|
} );
|
|
237
241
|
|
|
238
242
|
// Note that this assignment is handled *before* the async search request
|
|
@@ -241,12 +245,7 @@ class URLInput extends Component {
|
|
|
241
245
|
}
|
|
242
246
|
|
|
243
247
|
onChange( event ) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
this.props.onChange( inputValue );
|
|
247
|
-
if ( ! this.props.disableSuggestions ) {
|
|
248
|
-
this.updateSuggestions( inputValue );
|
|
249
|
-
}
|
|
248
|
+
this.props.onChange( event.target.value );
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
onFocus() {
|
|
@@ -258,7 +257,7 @@ class URLInput extends Component {
|
|
|
258
257
|
if (
|
|
259
258
|
value &&
|
|
260
259
|
! disableSuggestions &&
|
|
261
|
-
! this.isUpdatingSuggestions &&
|
|
260
|
+
! this.state.isUpdatingSuggestions &&
|
|
262
261
|
! ( suggestions && suggestions.length )
|
|
263
262
|
) {
|
|
264
263
|
// Ensure the suggestions are updated with the current input value.
|
|
@@ -490,19 +489,22 @@ class URLInput extends Component {
|
|
|
490
489
|
const {
|
|
491
490
|
className,
|
|
492
491
|
__experimentalRenderSuggestions: renderSuggestions,
|
|
493
|
-
value = '',
|
|
494
|
-
__experimentalShowInitialSuggestions = false,
|
|
495
492
|
} = this.props;
|
|
496
493
|
|
|
497
494
|
const {
|
|
498
495
|
showSuggestions,
|
|
499
496
|
suggestions,
|
|
497
|
+
suggestionsValue,
|
|
500
498
|
selectedSuggestion,
|
|
501
499
|
suggestionsListboxId,
|
|
502
500
|
suggestionOptionIdPrefix,
|
|
503
501
|
loading,
|
|
504
502
|
} = this.state;
|
|
505
503
|
|
|
504
|
+
if ( ! showSuggestions || suggestions.length === 0 ) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
|
|
506
508
|
const suggestionsListProps = {
|
|
507
509
|
id: suggestionsListboxId,
|
|
508
510
|
ref: this.autocompleteRef,
|
|
@@ -519,11 +521,7 @@ class URLInput extends Component {
|
|
|
519
521
|
};
|
|
520
522
|
};
|
|
521
523
|
|
|
522
|
-
if (
|
|
523
|
-
isFunction( renderSuggestions ) &&
|
|
524
|
-
showSuggestions &&
|
|
525
|
-
!! suggestions.length
|
|
526
|
-
) {
|
|
524
|
+
if ( isFunction( renderSuggestions ) ) {
|
|
527
525
|
return renderSuggestions( {
|
|
528
526
|
suggestions,
|
|
529
527
|
selectedSuggestion,
|
|
@@ -531,52 +529,38 @@ class URLInput extends Component {
|
|
|
531
529
|
buildSuggestionItemProps,
|
|
532
530
|
isLoading: loading,
|
|
533
531
|
handleSuggestionClick: this.handleOnClick,
|
|
534
|
-
isInitialSuggestions:
|
|
535
|
-
|
|
536
|
-
! ( value && value.length ),
|
|
532
|
+
isInitialSuggestions: ! suggestionsValue?.length,
|
|
533
|
+
currentInputValue: suggestionsValue,
|
|
537
534
|
} );
|
|
538
535
|
}
|
|
539
536
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
suggestion,
|
|
558
|
-
index
|
|
559
|
-
) }
|
|
560
|
-
key={ suggestion.id }
|
|
561
|
-
className={ classnames(
|
|
562
|
-
'block-editor-url-input__suggestion',
|
|
563
|
-
{
|
|
564
|
-
'is-selected':
|
|
565
|
-
index === selectedSuggestion,
|
|
566
|
-
}
|
|
567
|
-
) }
|
|
568
|
-
onClick={ () =>
|
|
569
|
-
this.handleOnClick( suggestion )
|
|
537
|
+
return (
|
|
538
|
+
<Popover placement="bottom" focusOnMount={ false }>
|
|
539
|
+
<div
|
|
540
|
+
{ ...suggestionsListProps }
|
|
541
|
+
className={ classnames(
|
|
542
|
+
'block-editor-url-input__suggestions',
|
|
543
|
+
`${ className }__suggestions`
|
|
544
|
+
) }
|
|
545
|
+
>
|
|
546
|
+
{ suggestions.map( ( suggestion, index ) => (
|
|
547
|
+
<Button
|
|
548
|
+
{ ...buildSuggestionItemProps( suggestion, index ) }
|
|
549
|
+
key={ suggestion.id }
|
|
550
|
+
className={ classnames(
|
|
551
|
+
'block-editor-url-input__suggestion',
|
|
552
|
+
{
|
|
553
|
+
'is-selected': index === selectedSuggestion,
|
|
570
554
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
555
|
+
) }
|
|
556
|
+
onClick={ () => this.handleOnClick( suggestion ) }
|
|
557
|
+
>
|
|
558
|
+
{ suggestion.title }
|
|
559
|
+
</Button>
|
|
560
|
+
) ) }
|
|
561
|
+
</div>
|
|
562
|
+
</Popover>
|
|
563
|
+
);
|
|
580
564
|
}
|
|
581
565
|
}
|
|
582
566
|
|
|
@@ -4,12 +4,13 @@ exports[`URLPopover matches the snapshot in its default state 1`] = `
|
|
|
4
4
|
<div>
|
|
5
5
|
<span>
|
|
6
6
|
<div
|
|
7
|
-
class="components-popover block-editor-url-popover"
|
|
8
|
-
style="position: absolute;
|
|
7
|
+
class="components-popover block-editor-url-popover is-positioned"
|
|
8
|
+
style="position: absolute; top: 0px; left: 0px; transform: none;"
|
|
9
9
|
tabindex="-1"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
12
|
class="components-popover__content"
|
|
13
|
+
style="max-height: 0px; overflow: auto;"
|
|
13
14
|
>
|
|
14
15
|
<div
|
|
15
16
|
class="block-editor-url-popover__input-container"
|
|
@@ -51,8 +52,8 @@ exports[`URLPopover matches the snapshot when the settings are toggled open 1`]
|
|
|
51
52
|
<div>
|
|
52
53
|
<span>
|
|
53
54
|
<div
|
|
54
|
-
class="components-popover block-editor-url-popover"
|
|
55
|
-
style="position: absolute;
|
|
55
|
+
class="components-popover block-editor-url-popover is-positioned"
|
|
56
|
+
style="position: absolute; top: 0px; left: 0px; transform: none;"
|
|
56
57
|
tabindex="-1"
|
|
57
58
|
>
|
|
58
59
|
<div
|
|
@@ -106,12 +107,13 @@ exports[`URLPopover matches the snapshot when there are no settings 1`] = `
|
|
|
106
107
|
<div>
|
|
107
108
|
<span>
|
|
108
109
|
<div
|
|
109
|
-
class="components-popover block-editor-url-popover"
|
|
110
|
-
style="position: absolute;
|
|
110
|
+
class="components-popover block-editor-url-popover is-positioned"
|
|
111
|
+
style="position: absolute; top: 0px; left: 0px; transform: none;"
|
|
111
112
|
tabindex="-1"
|
|
112
113
|
>
|
|
113
114
|
<div
|
|
114
115
|
class="components-popover__content"
|
|
116
|
+
style="max-height: 0px; overflow: auto;"
|
|
115
117
|
>
|
|
116
118
|
<div
|
|
117
119
|
class="block-editor-url-popover__input-container"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { act, render, screen } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,23 +9,32 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import URLPopover from '../';
|
|
11
11
|
|
|
12
|
+
jest.useRealTimers();
|
|
13
|
+
|
|
12
14
|
describe( 'URLPopover', () => {
|
|
13
|
-
it( 'matches the snapshot in its default state', () => {
|
|
15
|
+
it( 'matches the snapshot in its default state', async () => {
|
|
14
16
|
const { container } = render(
|
|
15
|
-
<URLPopover
|
|
17
|
+
<URLPopover
|
|
18
|
+
animate={ false }
|
|
19
|
+
renderSettings={ () => <div>Settings</div> }
|
|
20
|
+
>
|
|
16
21
|
<div>Editor</div>
|
|
17
22
|
</URLPopover>
|
|
18
23
|
);
|
|
19
24
|
|
|
25
|
+
// wait for `Popover` effects to finish
|
|
26
|
+
await act( () => Promise.resolve() );
|
|
27
|
+
|
|
20
28
|
expect( container ).toMatchSnapshot();
|
|
21
29
|
} );
|
|
22
30
|
|
|
23
31
|
it( 'matches the snapshot when the settings are toggled open', async () => {
|
|
24
|
-
const user = userEvent.setup(
|
|
25
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
26
|
-
} );
|
|
32
|
+
const user = userEvent.setup();
|
|
27
33
|
const { container } = render(
|
|
28
|
-
<URLPopover
|
|
34
|
+
<URLPopover
|
|
35
|
+
animate={ false }
|
|
36
|
+
renderSettings={ () => <div>Settings</div> }
|
|
37
|
+
>
|
|
29
38
|
<div>Editor</div>
|
|
30
39
|
</URLPopover>
|
|
31
40
|
);
|
|
@@ -37,13 +46,16 @@ describe( 'URLPopover', () => {
|
|
|
37
46
|
expect( container ).toMatchSnapshot();
|
|
38
47
|
} );
|
|
39
48
|
|
|
40
|
-
it( 'matches the snapshot when there are no settings', () => {
|
|
49
|
+
it( 'matches the snapshot when there are no settings', async () => {
|
|
41
50
|
const { container } = render(
|
|
42
|
-
<URLPopover>
|
|
51
|
+
<URLPopover animate={ false }>
|
|
43
52
|
<div>Editor</div>
|
|
44
53
|
</URLPopover>
|
|
45
54
|
);
|
|
46
55
|
|
|
56
|
+
// wait for `Popover` effects to finish
|
|
57
|
+
await act( () => Promise.resolve() );
|
|
58
|
+
|
|
47
59
|
expect( container ).toMatchSnapshot();
|
|
48
60
|
} );
|
|
49
61
|
} );
|