@wordpress/block-editor 12.9.0 → 12.10.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 +6 -0
- package/README.md +33 -3
- package/build/components/block-canvas/index.js +107 -0
- package/build/components/block-canvas/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +19 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +66 -0
- package/build/components/block-patterns-paging/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -7
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -0
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +1 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -4
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/default-block-appender/index.native.js +20 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/duotone/utils.js +68 -0
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/editor-styles/index.js +28 -9
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -101
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +61 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -0
- package/build/components/global-styles/index.js +11 -17
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +67 -33
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -5
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +9 -9
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +8 -12
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-source-filter.js +54 -0
- package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-sync-filter.js +46 -0
- package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +91 -45
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +21 -10
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/menu.js +13 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -12
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +12 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.js +24 -13
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -3
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +13 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/index.js +13 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings.js +2 -1
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +29 -24
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +11 -11
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/constants.js +30 -0
- package/build/components/media-upload/constants.js.map +1 -0
- package/build/components/media-upload/index.native.js +63 -53
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +1 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +34 -35
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +14 -32
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +95 -0
- package/build/components/rich-text/multiline.js.map +1 -0
- package/build/components/rich-text/split-value.js +10 -16
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-enter.js +31 -40
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +18 -33
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-commands/index.js +30 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +5 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/background.js +258 -0
- package/build/hooks/background.js.map +1 -0
- package/build/hooks/block-hooks.js +188 -0
- package/build/hooks/block-hooks.js.map +1 -0
- package/build/hooks/block-rename-ui.js +160 -0
- package/build/hooks/block-rename-ui.js.map +1 -0
- package/build/hooks/duotone.js +29 -42
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +31 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +74 -25
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +4 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +33 -10
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +42 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +23 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +43 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +84 -23
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +0 -4
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +97 -0
- package/build-module/components/block-canvas/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +4 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +20 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +59 -0
- package/build-module/components/block-patterns-paging/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -0
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +1 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -4
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js +20 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/duotone/utils.js +65 -0
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/editor-styles/index.js +28 -9
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -100
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +53 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
- package/build-module/components/global-styles/index.js +2 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +66 -33
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -5
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +9 -9
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
- package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +87 -46
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -12
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +25 -14
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -3
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +15 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/index.js +13 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings.js +2 -1
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +13 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +30 -25
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -7
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/constants.js +14 -0
- package/build-module/components/media-upload/constants.js.map +1 -0
- package/build-module/components/media-upload/index.native.js +53 -34
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +1 -1
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +35 -37
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +15 -33
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +87 -0
- package/build-module/components/rich-text/multiline.js.map +1 -0
- package/build-module/components/rich-text/split-value.js +10 -16
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +33 -42
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +19 -34
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +28 -16
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/hooks/background.js +244 -0
- package/build-module/hooks/background.js.map +1 -0
- package/build-module/hooks/block-hooks.js +181 -0
- package/build-module/hooks/block-hooks.js.map +1 -0
- package/build-module/hooks/block-rename-ui.js +153 -0
- package/build-module/hooks/block-rename-ui.js.map +1 -0
- package/build-module/hooks/duotone.js +26 -39
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -2
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +33 -16
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +4 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +73 -24
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +4 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +33 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +39 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +21 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +41 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +78 -22
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +0 -4
- package/build-module/store/utils.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +174 -131
- package/build-style/style.css +174 -131
- package/package.json +32 -32
- package/src/components/block-canvas/index.js +108 -0
- package/src/components/block-inspector/index.js +5 -1
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-patterns-list/index.js +32 -7
- package/src/components/block-patterns-list/style.scss +26 -9
- package/src/components/block-patterns-paging/index.js +92 -0
- package/src/components/block-patterns-paging/style.scss +42 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
- package/src/components/block-settings-menu-controls/index.js +4 -9
- package/src/components/block-styles/index.js +1 -0
- package/src/components/block-styles/style.scss +3 -3
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
- package/src/components/block-tools/block-contextual-toolbar.js +16 -5
- package/src/components/block-tools/block-selection-button.js +9 -1
- package/src/components/block-tools/style.scss +0 -98
- package/src/components/border-radius-control/input-controls.js +1 -1
- package/src/components/border-radius-control/linked-button.js +8 -11
- package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
- package/src/components/colors/with-colors.js +3 -2
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
- package/src/components/default-block-appender/index.native.js +26 -3
- package/src/components/duotone/utils.js +65 -0
- package/src/components/editor-styles/index.js +32 -23
- package/src/components/global-styles/hooks.js +4 -112
- package/src/components/global-styles/image-settings-panel.js +71 -0
- package/src/components/global-styles/index.js +4 -3
- package/src/components/global-styles/use-global-styles-output.js +25 -16
- package/src/components/global-styles/utils.js +1 -2
- package/src/components/iframe/index.js +72 -33
- package/src/components/image-editor/use-save-image.js +2 -9
- package/src/components/image-editor/use-transform-image.js +9 -9
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
- package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
- package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
- package/src/components/inserter/block-patterns-source-filter.js +40 -0
- package/src/components/inserter/block-patterns-sync-filter.js +35 -0
- package/src/components/inserter/block-patterns-tab.js +168 -57
- package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
- package/src/components/inserter/hooks/use-patterns-state.js +27 -16
- package/src/components/inserter/menu.js +15 -17
- package/src/components/inserter/search-results.js +6 -4
- package/src/components/inserter/style.scss +23 -2
- package/src/components/inserter/tabs.js +2 -12
- package/src/components/inserter/test/index.native.js +8 -12
- package/src/components/inspector-controls/block-support-slot-container.js +19 -3
- package/src/components/inspector-controls/fill.js +28 -14
- package/src/components/inspector-controls/groups.js +6 -2
- package/src/components/inspector-controls/slot.js +28 -3
- package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
- package/src/components/link-control/index.js +14 -0
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +28 -7
- package/src/components/link-control/test/index.js +88 -6
- package/src/components/list-view/block-select-button.js +1 -3
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/style.scss +1 -2
- package/src/components/list-view/use-block-selection.js +38 -32
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +2 -2
- package/src/components/media-placeholder/index.native.js +11 -12
- package/src/components/media-replace-flow/index.js +2 -2
- package/src/components/media-replace-flow/test/index.js +5 -23
- package/src/components/media-upload/README.md +3 -2
- package/src/components/media-upload/constants.js +15 -0
- package/src/components/media-upload/index.native.js +66 -40
- package/src/components/media-upload/style.native.scss +4 -0
- package/src/components/media-upload/test/index.native.js +2 -2
- package/src/components/preview-options/README.md +7 -0
- package/src/components/preview-options/index.js +1 -1
- package/src/components/rich-text/index.js +48 -44
- package/src/components/rich-text/index.native.js +14 -42
- package/src/components/rich-text/multiline.js +121 -0
- package/src/components/rich-text/split-value.js +10 -35
- package/src/components/rich-text/use-enter.js +32 -42
- package/src/components/rich-text/use-paste-handler.js +16 -40
- package/src/components/spacing-sizes-control/style.scss +5 -7
- package/src/components/spacing-sizes-control/utils.js +1 -2
- package/src/components/use-block-commands/index.js +28 -20
- package/src/components/use-block-display-information/index.js +3 -0
- package/src/hooks/background.js +288 -0
- package/src/hooks/background.scss +57 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +230 -0
- package/src/hooks/block-rename-ui.scss +3 -0
- package/src/hooks/duotone.js +42 -43
- package/src/hooks/index.js +2 -2
- package/src/hooks/layout.js +31 -33
- package/src/hooks/position.js +4 -3
- package/src/hooks/style.js +96 -37
- package/src/hooks/test/align.native.js +4 -3
- package/src/hooks/utils.js +4 -0
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +52 -10
- package/src/store/private-actions.js +37 -6
- package/src/store/private-selectors.js +21 -0
- package/src/store/reducer.js +38 -0
- package/src/store/selectors.js +107 -26
- package/src/store/test/actions.js +19 -8
- package/src/store/test/private-actions.js +17 -0
- package/src/store/test/reducer.js +25 -0
- package/src/store/test/selectors.js +130 -123
- package/src/store/utils.js +3 -10
- package/src/style.scss +4 -0
- package/build/components/duotone/components.js +0 -135
- package/build/components/duotone/components.js.map +0 -1
- package/build/components/duotone/index.js +0 -38
- package/build/components/duotone/index.js.map +0 -1
- package/build/components/global-styles/behaviors-panel.js +0 -64
- package/build/components/global-styles/behaviors-panel.js.map +0 -1
- package/build/components/inserter/reusable-blocks-tab.js +0 -85
- package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build/hooks/auto-inserting-blocks.js +0 -174
- package/build/hooks/auto-inserting-blocks.js.map +0 -1
- package/build/hooks/behaviors.js +0 -173
- package/build/hooks/behaviors.js.map +0 -1
- package/build-module/components/duotone/components.js +0 -126
- package/build-module/components/duotone/components.js.map +0 -1
- package/build-module/components/duotone/index.js +0 -3
- package/build-module/components/duotone/index.js.map +0 -1
- package/build-module/components/global-styles/behaviors-panel.js +0 -57
- package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
- package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build-module/hooks/auto-inserting-blocks.js +0 -167
- package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
- package/build-module/hooks/behaviors.js +0 -166
- package/build-module/hooks/behaviors.js.map +0 -1
- package/src/components/duotone/components.js +0 -133
- package/src/components/duotone/index.js +0 -7
- package/src/components/global-styles/behaviors-panel.js +0 -71
- package/src/components/inserter/reusable-blocks-tab.js +0 -84
- package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
- package/src/hooks/auto-inserting-blocks.js +0 -232
- package/src/hooks/behaviors.js +0 -206
|
@@ -5,7 +5,7 @@ import { speak } from '@wordpress/a11y';
|
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { useCallback } from '@wordpress/element';
|
|
8
|
-
import { UP, DOWN, HOME, END } from '@wordpress/keycodes';
|
|
8
|
+
import { UP, DOWN, HOME, END, ESCAPE } from '@wordpress/keycodes';
|
|
9
9
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -30,7 +30,7 @@ export default function useBlockSelection() {
|
|
|
30
30
|
|
|
31
31
|
const updateBlockSelection = useCallback(
|
|
32
32
|
async ( event, clientId, destinationClientId, focusPosition ) => {
|
|
33
|
-
if ( ! event?.shiftKey ) {
|
|
33
|
+
if ( ! event?.shiftKey && event?.keyCode !== ESCAPE ) {
|
|
34
34
|
selectBlock( clientId, focusPosition );
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -39,6 +39,8 @@ export default function useBlockSelection() {
|
|
|
39
39
|
// the browser default behavior of opening the link in a new window.
|
|
40
40
|
event.preventDefault();
|
|
41
41
|
|
|
42
|
+
const isOnlyDeselection =
|
|
43
|
+
event.type === 'keydown' && event.keyCode === ESCAPE;
|
|
42
44
|
const isKeyPress =
|
|
43
45
|
event.type === 'keydown' &&
|
|
44
46
|
( event.keyCode === UP ||
|
|
@@ -63,10 +65,11 @@ export default function useBlockSelection() {
|
|
|
63
65
|
];
|
|
64
66
|
|
|
65
67
|
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
isOnlyDeselection ||
|
|
69
|
+
( isKeyPress &&
|
|
70
|
+
! selectedBlocks.some( ( blockId ) =>
|
|
71
|
+
clientIdWithParents.includes( blockId )
|
|
72
|
+
) )
|
|
70
73
|
) {
|
|
71
74
|
// Ensure that shift-selecting blocks via the keyboard only
|
|
72
75
|
// expands the current selection if focusing over already
|
|
@@ -75,35 +78,38 @@ export default function useBlockSelection() {
|
|
|
75
78
|
await clearSelectedBlock();
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
// Update selection, if not only clearing the selection.
|
|
82
|
+
if ( ! isOnlyDeselection ) {
|
|
83
|
+
let startTarget = getBlockSelectionStart();
|
|
84
|
+
let endTarget = clientId;
|
|
85
|
+
|
|
86
|
+
// Handle keyboard behavior for selecting multiple blocks.
|
|
87
|
+
if ( isKeyPress ) {
|
|
88
|
+
if ( ! hasSelectedBlock() && ! hasMultiSelection() ) {
|
|
89
|
+
// Set the starting point of the selection to the currently
|
|
90
|
+
// focused block, if there are no blocks currently selected.
|
|
91
|
+
// This ensures that as the selection is expanded or contracted,
|
|
92
|
+
// the starting point of the selection is anchored to that block.
|
|
93
|
+
startTarget = clientId;
|
|
94
|
+
}
|
|
95
|
+
if ( destinationClientId ) {
|
|
96
|
+
// If the user presses UP or DOWN, we want to ensure that the block they're
|
|
97
|
+
// moving to is the target for selection, and not the currently focused one.
|
|
98
|
+
endTarget = destinationClientId;
|
|
99
|
+
}
|
|
89
100
|
}
|
|
90
|
-
if ( destinationClientId ) {
|
|
91
|
-
// If the user presses UP or DOWN, we want to ensure that the block they're
|
|
92
|
-
// moving to is the target for selection, and not the currently focused one.
|
|
93
|
-
endTarget = destinationClientId;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
const startParents = getBlockParents( startTarget );
|
|
103
|
+
const endParents = getBlockParents( endTarget );
|
|
99
104
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const { start, end } = getCommonDepthClientIds(
|
|
106
|
+
startTarget,
|
|
107
|
+
endTarget,
|
|
108
|
+
startParents,
|
|
109
|
+
endParents
|
|
110
|
+
);
|
|
111
|
+
await multiSelect( start, end, null );
|
|
112
|
+
}
|
|
107
113
|
|
|
108
114
|
// Announce deselected block, or number of deselected blocks if
|
|
109
115
|
// the total number of blocks deselected is greater than one.
|
|
@@ -133,9 +133,9 @@ An object that can contain a `title` and `instructions` properties. These proper
|
|
|
133
133
|
|
|
134
134
|
### multiple
|
|
135
135
|
|
|
136
|
-
Whether to allow multiple selection of files or not.
|
|
136
|
+
Whether to allow multiple selection of files or not. This property will also accept a string with the value `add` to allow multiple selection of files without the need to use the `Shift` or `Ctrl`/`Cmd` keys.
|
|
137
137
|
|
|
138
|
-
- Type: `Boolean`
|
|
138
|
+
- Type: `Boolean|String`
|
|
139
139
|
- Required: No
|
|
140
140
|
- Default: `false`
|
|
141
141
|
- Platform: Web
|
|
@@ -469,7 +469,7 @@ export function MediaPlaceholder( {
|
|
|
469
469
|
<FormFileUpload
|
|
470
470
|
onChange={ onUpload }
|
|
471
471
|
accept={ accept }
|
|
472
|
-
multiple={ multiple }
|
|
472
|
+
multiple={ !! multiple }
|
|
473
473
|
render={ ( { openFileDialog } ) => {
|
|
474
474
|
const content = (
|
|
475
475
|
<>
|
|
@@ -508,7 +508,7 @@ export function MediaPlaceholder( {
|
|
|
508
508
|
) }
|
|
509
509
|
onChange={ onUpload }
|
|
510
510
|
accept={ accept }
|
|
511
|
-
multiple={ multiple }
|
|
511
|
+
multiple={ !! multiple }
|
|
512
512
|
>
|
|
513
513
|
{ __( 'Upload' ) }
|
|
514
514
|
</FormFileUpload>
|
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { View, Text, TouchableOpacity } from 'react-native';
|
|
5
|
-
import { sentenceCase } from 'change-case';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
9
8
|
*/
|
|
10
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
12
|
-
MediaUpload,
|
|
13
|
-
MEDIA_TYPE_IMAGE,
|
|
14
|
-
MEDIA_TYPE_VIDEO,
|
|
15
|
-
MEDIA_TYPE_AUDIO,
|
|
16
|
-
} from '@wordpress/block-editor';
|
|
17
10
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
18
11
|
import { cloneElement, useCallback, useRef } from '@wordpress/element';
|
|
19
12
|
import { Icon, plusCircleFilled } from '@wordpress/icons';
|
|
@@ -23,6 +16,12 @@ import { Icon, plusCircleFilled } from '@wordpress/icons';
|
|
|
23
16
|
*/
|
|
24
17
|
import styles from './styles.scss';
|
|
25
18
|
import { useBlockEditContext } from '../block-edit/context';
|
|
19
|
+
import MediaUpload from '../media-upload';
|
|
20
|
+
import {
|
|
21
|
+
MEDIA_TYPE_IMAGE,
|
|
22
|
+
MEDIA_TYPE_VIDEO,
|
|
23
|
+
MEDIA_TYPE_AUDIO,
|
|
24
|
+
} from '../media-upload/constants';
|
|
26
25
|
|
|
27
26
|
const isMediaEqual = ( media1, media2 ) =>
|
|
28
27
|
media1.id === media2.id || media1.url === media2.url;
|
|
@@ -104,13 +103,13 @@ function MediaPlaceholder( props ) {
|
|
|
104
103
|
let instructions = labels.instructions;
|
|
105
104
|
if ( instructions === undefined ) {
|
|
106
105
|
if ( isImage ) {
|
|
107
|
-
instructions = __( '
|
|
106
|
+
instructions = __( 'Add image' );
|
|
108
107
|
} else if ( isVideo ) {
|
|
109
|
-
instructions = __( '
|
|
108
|
+
instructions = __( 'Add video' );
|
|
110
109
|
} else if ( isAudio ) {
|
|
111
|
-
instructions = __( '
|
|
110
|
+
instructions = __( 'Add audio' );
|
|
112
111
|
} else {
|
|
113
|
-
instructions = __( '
|
|
112
|
+
instructions = __( 'Add image or video' );
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
|
|
@@ -171,7 +170,7 @@ function MediaPlaceholder( props ) {
|
|
|
171
170
|
onPress={ onButtonPress( open ) }
|
|
172
171
|
>
|
|
173
172
|
<Text style={ emptyStateDescriptionStyles }>
|
|
174
|
-
{
|
|
173
|
+
{ instructions }
|
|
175
174
|
</Text>
|
|
176
175
|
</TouchableOpacity>
|
|
177
176
|
</>
|
|
@@ -179,7 +179,7 @@ const MediaReplaceFlow = ( {
|
|
|
179
179
|
uploadFiles( event, onClose );
|
|
180
180
|
} }
|
|
181
181
|
accept={ accept }
|
|
182
|
-
multiple={ multiple }
|
|
182
|
+
multiple={ !! multiple }
|
|
183
183
|
render={ ( { openFileDialog } ) => {
|
|
184
184
|
return (
|
|
185
185
|
<MenuItem
|
|
@@ -220,7 +220,7 @@ const MediaReplaceFlow = ( {
|
|
|
220
220
|
{ __( 'Current media URL:' ) }
|
|
221
221
|
</span>
|
|
222
222
|
|
|
223
|
-
<Tooltip text={ mediaURL }
|
|
223
|
+
<Tooltip text={ mediaURL }>
|
|
224
224
|
<div>
|
|
225
225
|
<LinkControl
|
|
226
226
|
value={ { url: mediaURL } }
|
|
@@ -32,16 +32,6 @@ function TestWrapper() {
|
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Returns the first found popover element up the DOM tree.
|
|
37
|
-
*
|
|
38
|
-
* @param {HTMLElement} element Element to start with.
|
|
39
|
-
* @return {HTMLElement|null} Popover element, or `null` if not found.
|
|
40
|
-
*/
|
|
41
|
-
function getWrappingPopoverElement( element ) {
|
|
42
|
-
return element.closest( '.components-popover' );
|
|
43
|
-
}
|
|
44
|
-
|
|
45
35
|
describe( 'General media replace flow', () => {
|
|
46
36
|
it( 'renders successfully', () => {
|
|
47
37
|
render( <TestWrapper /> );
|
|
@@ -67,11 +57,7 @@ describe( 'General media replace flow', () => {
|
|
|
67
57
|
);
|
|
68
58
|
const uploadMenu = screen.getByRole( 'menu' );
|
|
69
59
|
|
|
70
|
-
await waitFor( () =>
|
|
71
|
-
expect(
|
|
72
|
-
getWrappingPopoverElement( uploadMenu )
|
|
73
|
-
).toBePositionedPopover()
|
|
74
|
-
);
|
|
60
|
+
await waitFor( () => expect( uploadMenu ).toBePositionedPopover() );
|
|
75
61
|
|
|
76
62
|
await waitFor( () => expect( uploadMenu ).toBeVisible() );
|
|
77
63
|
} );
|
|
@@ -92,9 +78,7 @@ describe( 'General media replace flow', () => {
|
|
|
92
78
|
name: 'example.media (opens in a new tab)',
|
|
93
79
|
} );
|
|
94
80
|
|
|
95
|
-
await waitFor( () =>
|
|
96
|
-
expect( getWrappingPopoverElement( link ) ).toBePositionedPopover()
|
|
97
|
-
);
|
|
81
|
+
await waitFor( () => expect( link ).toBePositionedPopover() );
|
|
98
82
|
|
|
99
83
|
expect( link ).toHaveAttribute( 'href', 'https://example.media' );
|
|
100
84
|
} );
|
|
@@ -113,11 +97,9 @@ describe( 'General media replace flow', () => {
|
|
|
113
97
|
|
|
114
98
|
await waitFor( () =>
|
|
115
99
|
expect(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
} )
|
|
120
|
-
)
|
|
100
|
+
screen.getByRole( 'link', {
|
|
101
|
+
name: 'example.media (opens in a new tab)',
|
|
102
|
+
} )
|
|
121
103
|
).toBePositionedPopover()
|
|
122
104
|
);
|
|
123
105
|
|
|
@@ -72,11 +72,12 @@ Value of Frame content default mode like 'browse', 'upload' etc.
|
|
|
72
72
|
- Required: No
|
|
73
73
|
- Default: false
|
|
74
74
|
- Platform: Web
|
|
75
|
+
|
|
75
76
|
### multiple
|
|
76
77
|
|
|
77
|
-
Whether to allow multiple
|
|
78
|
+
Whether to allow multiple selection of files or not. This property will also accept a string with the value `add` to allow multiple selection of files without the need to use the `Shift` or `Ctrl`/`Cmd` keys.
|
|
78
79
|
|
|
79
|
-
- Type: `Boolean`
|
|
80
|
+
- Type: `Boolean|String`
|
|
80
81
|
- Required: No
|
|
81
82
|
- Default: false
|
|
82
83
|
- Platform: Web
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
export const MEDIA_TYPE_IMAGE = 'image';
|
|
7
|
+
export const MEDIA_TYPE_VIDEO = 'video';
|
|
8
|
+
export const MEDIA_TYPE_AUDIO = 'audio';
|
|
9
|
+
export const MEDIA_TYPE_ANY = 'any';
|
|
10
|
+
|
|
11
|
+
export const OPTION_TAKE_VIDEO = __( 'Take a Video' );
|
|
12
|
+
export const OPTION_TAKE_PHOTO = __( 'Take a Photo' );
|
|
13
|
+
export const OPTION_TAKE_PHOTO_OR_VIDEO = __( 'Take a Photo or Video' );
|
|
14
|
+
export const OPTION_INSERT_FROM_URL = __( 'Insert from URL' );
|
|
15
|
+
export const OPTION_WORDPRESS_MEDIA_LIBRARY = __( 'WordPress Media Library' );
|
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
|
|
6
|
-
import prompt from 'react-native-prompt-android';
|
|
7
|
-
|
|
8
6
|
/**
|
|
9
7
|
* WordPress dependencies
|
|
10
8
|
*/
|
|
11
9
|
import { Component, React } from '@wordpress/element';
|
|
12
10
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
BottomSheet,
|
|
13
|
+
PanelBody,
|
|
14
|
+
Picker,
|
|
15
|
+
TextControl,
|
|
16
|
+
} from '@wordpress/components';
|
|
14
17
|
import {
|
|
15
18
|
getOtherMediaOptions,
|
|
16
19
|
requestMediaPicker,
|
|
@@ -28,16 +31,16 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
28
31
|
import { compose } from '@wordpress/compose';
|
|
29
32
|
import { withSelect } from '@wordpress/data';
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Internal dependencies
|
|
36
|
+
*/
|
|
37
|
+
import {
|
|
38
|
+
MEDIA_TYPE_IMAGE,
|
|
39
|
+
MEDIA_TYPE_VIDEO,
|
|
40
|
+
MEDIA_TYPE_AUDIO,
|
|
41
|
+
MEDIA_TYPE_ANY,
|
|
42
|
+
} from './constants';
|
|
43
|
+
import styles from './style.scss';
|
|
41
44
|
|
|
42
45
|
const URL_MEDIA_SOURCE = 'URL';
|
|
43
46
|
|
|
@@ -52,6 +55,8 @@ export class MediaUpload extends Component {
|
|
|
52
55
|
this.onPickerSelect = this.onPickerSelect.bind( this );
|
|
53
56
|
this.getAllSources = this.getAllSources.bind( this );
|
|
54
57
|
this.state = {
|
|
58
|
+
url: '',
|
|
59
|
+
showURLInput: false,
|
|
55
60
|
otherMediaOptions: [],
|
|
56
61
|
};
|
|
57
62
|
}
|
|
@@ -204,31 +209,10 @@ export class MediaUpload extends Component {
|
|
|
204
209
|
}
|
|
205
210
|
|
|
206
211
|
onPickerSelect( value ) {
|
|
207
|
-
const {
|
|
208
|
-
allowedTypes = [],
|
|
209
|
-
onSelect,
|
|
210
|
-
onSelectURL,
|
|
211
|
-
multiple = false,
|
|
212
|
-
} = this.props;
|
|
212
|
+
const { allowedTypes = [], onSelect, multiple = false } = this.props;
|
|
213
213
|
|
|
214
214
|
if ( value === URL_MEDIA_SOURCE ) {
|
|
215
|
-
|
|
216
|
-
__( 'Type a URL' ), // title
|
|
217
|
-
undefined, // message
|
|
218
|
-
[
|
|
219
|
-
{
|
|
220
|
-
text: __( 'Cancel' ),
|
|
221
|
-
style: 'cancel',
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
text: __( 'Apply' ),
|
|
225
|
-
onPress: onSelectURL,
|
|
226
|
-
},
|
|
227
|
-
], // Buttons.
|
|
228
|
-
'plain-text', // type
|
|
229
|
-
undefined, // defaultValue
|
|
230
|
-
'url' // keyboardType
|
|
231
|
-
);
|
|
215
|
+
this.setState( { showURLInput: true } );
|
|
232
216
|
return;
|
|
233
217
|
}
|
|
234
218
|
|
|
@@ -306,13 +290,55 @@ export class MediaUpload extends Component {
|
|
|
306
290
|
/>
|
|
307
291
|
);
|
|
308
292
|
|
|
309
|
-
return
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
293
|
+
return (
|
|
294
|
+
<>
|
|
295
|
+
<URLInput
|
|
296
|
+
isVisible={ this.state.showURLInput }
|
|
297
|
+
onClose={ () => {
|
|
298
|
+
if ( this.state.url !== '' ) {
|
|
299
|
+
this.props.onSelectURL( this.state.url );
|
|
300
|
+
}
|
|
301
|
+
this.setState( { showURLInput: false, url: '' } );
|
|
302
|
+
} }
|
|
303
|
+
onChange={ ( url ) => {
|
|
304
|
+
this.setState( { url } );
|
|
305
|
+
} }
|
|
306
|
+
value={ this.state.url }
|
|
307
|
+
/>
|
|
308
|
+
{ this.props.render( {
|
|
309
|
+
open: this.onPickerPresent,
|
|
310
|
+
getMediaOptions,
|
|
311
|
+
} ) }
|
|
312
|
+
</>
|
|
313
|
+
);
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
|
|
317
|
+
function URLInput( props ) {
|
|
318
|
+
return (
|
|
319
|
+
<BottomSheet
|
|
320
|
+
hideHeader
|
|
321
|
+
isVisible={ props.isVisible }
|
|
322
|
+
onClose={ props.onClose }
|
|
323
|
+
>
|
|
324
|
+
<PanelBody style={ styles[ 'media-upload__link-input' ] }>
|
|
325
|
+
<TextControl
|
|
326
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
327
|
+
autoFocus
|
|
328
|
+
autoCapitalize="none"
|
|
329
|
+
autoCorrect={ false }
|
|
330
|
+
autoComplete={ Platform.isIOS ? 'url' : 'off' }
|
|
331
|
+
keyboardType="url"
|
|
332
|
+
label={ __( 'Insert from URL' ) }
|
|
333
|
+
onChange={ props.onChange }
|
|
334
|
+
placeholder={ __( 'Type a URL' ) }
|
|
335
|
+
value={ props.value }
|
|
336
|
+
/>
|
|
337
|
+
</PanelBody>
|
|
338
|
+
</BottomSheet>
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
316
342
|
export default compose( [
|
|
317
343
|
withSelect( ( select ) => {
|
|
318
344
|
const { capabilities } = select( blockEditorStore ).getSettings();
|
|
@@ -14,8 +14,8 @@ import { requestMediaPicker } from '@wordpress/react-native-bridge';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
+
import { MediaUpload } from '../index';
|
|
17
18
|
import {
|
|
18
|
-
MediaUpload,
|
|
19
19
|
MEDIA_TYPE_IMAGE,
|
|
20
20
|
MEDIA_TYPE_VIDEO,
|
|
21
21
|
MEDIA_TYPE_AUDIO,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
OPTION_TAKE_PHOTO,
|
|
24
24
|
OPTION_INSERT_FROM_URL,
|
|
25
25
|
OPTION_WORDPRESS_MEDIA_LIBRARY,
|
|
26
|
-
} from '../
|
|
26
|
+
} from '../constants';
|
|
27
27
|
|
|
28
28
|
const MEDIA_URL = 'http://host.media.type';
|
|
29
29
|
const MEDIA_ID = 123;
|
|
@@ -82,6 +82,13 @@ Used to set the device type that will be used to display the preview inside the
|
|
|
82
82
|
- Type: `func`
|
|
83
83
|
- Required: yes
|
|
84
84
|
|
|
85
|
+
#### children
|
|
86
|
+
|
|
87
|
+
A function that returns nodes to be rendered within the dropdown.
|
|
88
|
+
|
|
89
|
+
- Type: `Function`
|
|
90
|
+
- Required: No
|
|
91
|
+
|
|
85
92
|
## Related components
|
|
86
93
|
|
|
87
94
|
Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
|
|
@@ -44,8 +44,9 @@ import { useInputEvents } from './use-input-events';
|
|
|
44
44
|
import { useInsertReplacementText } from './use-insert-replacement-text';
|
|
45
45
|
import { useFirefoxCompat } from './use-firefox-compat';
|
|
46
46
|
import FormatEdit from './format-edit';
|
|
47
|
-
import {
|
|
47
|
+
import { getAllowedFormats } from './utils';
|
|
48
48
|
import { Content } from './content';
|
|
49
|
+
import RichTextMultiline from './multiline';
|
|
49
50
|
|
|
50
51
|
export const keyboardShortcutContext = createContext();
|
|
51
52
|
export const inputEventContext = createContext();
|
|
@@ -81,12 +82,12 @@ function removeNativeProps( props ) {
|
|
|
81
82
|
return restProps;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
function RichTextWrapper(
|
|
85
|
+
export function RichTextWrapper(
|
|
85
86
|
{
|
|
86
87
|
children,
|
|
87
88
|
tagName = 'div',
|
|
88
|
-
value:
|
|
89
|
-
onChange:
|
|
89
|
+
value: adjustedValue = '',
|
|
90
|
+
onChange: adjustedOnChange,
|
|
90
91
|
isSelected: originalIsSelected,
|
|
91
92
|
multiline,
|
|
92
93
|
inlineToolbar,
|
|
@@ -100,7 +101,7 @@ function RichTextWrapper(
|
|
|
100
101
|
onMerge,
|
|
101
102
|
onSplit,
|
|
102
103
|
__unstableOnSplitAtEnd: onSplitAtEnd,
|
|
103
|
-
|
|
104
|
+
__unstableOnSplitAtDoubleLineEnd: onSplitAtDoubleLineEnd,
|
|
104
105
|
identifier,
|
|
105
106
|
preserveWhiteSpace,
|
|
106
107
|
__unstablePastePlainText: pastePlainText,
|
|
@@ -112,18 +113,6 @@ function RichTextWrapper(
|
|
|
112
113
|
},
|
|
113
114
|
forwardedRef
|
|
114
115
|
) {
|
|
115
|
-
if ( multiline ) {
|
|
116
|
-
deprecated( 'wp.blockEditor.RichText multiline prop', {
|
|
117
|
-
since: '6.1',
|
|
118
|
-
version: '6.3',
|
|
119
|
-
alternative: 'nested blocks (InnerBlocks)',
|
|
120
|
-
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/nested-blocks-inner-blocks/',
|
|
121
|
-
} );
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const instanceId = useInstanceId( RichTextWrapper );
|
|
125
|
-
|
|
126
|
-
identifier = identifier || instanceId;
|
|
127
116
|
props = removeNativeProps( props );
|
|
128
117
|
|
|
129
118
|
const anchorRef = useRef();
|
|
@@ -158,33 +147,12 @@ function RichTextWrapper(
|
|
|
158
147
|
const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
|
|
159
148
|
useSelect( blockEditorStore );
|
|
160
149
|
const { selectionChange } = useDispatch( blockEditorStore );
|
|
161
|
-
const multilineTag = getMultilineTag( multiline );
|
|
162
150
|
const adjustedAllowedFormats = getAllowedFormats( {
|
|
163
151
|
allowedFormats,
|
|
164
152
|
disableFormats,
|
|
165
153
|
} );
|
|
166
154
|
const hasFormats =
|
|
167
155
|
! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;
|
|
168
|
-
let adjustedValue = originalValue;
|
|
169
|
-
let adjustedOnChange = originalOnChange;
|
|
170
|
-
|
|
171
|
-
// Handle deprecated format.
|
|
172
|
-
if ( Array.isArray( originalValue ) ) {
|
|
173
|
-
deprecated( 'wp.blockEditor.RichText value prop as children type', {
|
|
174
|
-
since: '6.1',
|
|
175
|
-
version: '6.3',
|
|
176
|
-
alternative: 'value prop as string',
|
|
177
|
-
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',
|
|
178
|
-
} );
|
|
179
|
-
|
|
180
|
-
adjustedValue = childrenSource.toHTML( originalValue );
|
|
181
|
-
adjustedOnChange = ( newValue ) =>
|
|
182
|
-
originalOnChange(
|
|
183
|
-
childrenSource.fromDOM(
|
|
184
|
-
__unstableCreateElement( document, newValue ).childNodes
|
|
185
|
-
)
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
156
|
|
|
189
157
|
const onSelectionChange = useCallback(
|
|
190
158
|
( start, end ) => {
|
|
@@ -293,7 +261,6 @@ function RichTextWrapper(
|
|
|
293
261
|
onSelectionChange,
|
|
294
262
|
placeholder,
|
|
295
263
|
__unstableIsSelected: isSelected,
|
|
296
|
-
__unstableMultilineTag: multilineTag,
|
|
297
264
|
__unstableDisableFormats: disableFormats,
|
|
298
265
|
preserveWhiteSpace,
|
|
299
266
|
__unstableDependencies: [ ...dependencies, tagName ],
|
|
@@ -380,9 +347,7 @@ function RichTextWrapper(
|
|
|
380
347
|
tagName,
|
|
381
348
|
onReplace,
|
|
382
349
|
onSplit,
|
|
383
|
-
onSplitMiddle,
|
|
384
350
|
__unstableEmbedURLOnPaste,
|
|
385
|
-
multilineTag,
|
|
386
351
|
preserveWhiteSpace,
|
|
387
352
|
pastePlainText,
|
|
388
353
|
} ),
|
|
@@ -396,11 +361,10 @@ function RichTextWrapper(
|
|
|
396
361
|
value,
|
|
397
362
|
onReplace,
|
|
398
363
|
onSplit,
|
|
399
|
-
onSplitMiddle,
|
|
400
|
-
multilineTag,
|
|
401
364
|
onChange,
|
|
402
365
|
disableLineBreaks,
|
|
403
366
|
onSplitAtEnd,
|
|
367
|
+
onSplitAtDoubleLineEnd,
|
|
404
368
|
} ),
|
|
405
369
|
useFirefoxCompat(),
|
|
406
370
|
anchorRef,
|
|
@@ -424,7 +388,47 @@ function RichTextWrapper(
|
|
|
424
388
|
);
|
|
425
389
|
}
|
|
426
390
|
|
|
427
|
-
const
|
|
391
|
+
const ForwardedRichTextWrapper = forwardRef( RichTextWrapper );
|
|
392
|
+
|
|
393
|
+
function RichTextSwitcher( props, ref ) {
|
|
394
|
+
let value = props.value;
|
|
395
|
+
let onChange = props.onChange;
|
|
396
|
+
|
|
397
|
+
// Handle deprecated format.
|
|
398
|
+
if ( Array.isArray( value ) ) {
|
|
399
|
+
deprecated( 'wp.blockEditor.RichText value prop as children type', {
|
|
400
|
+
since: '6.1',
|
|
401
|
+
version: '6.3',
|
|
402
|
+
alternative: 'value prop as string',
|
|
403
|
+
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',
|
|
404
|
+
} );
|
|
405
|
+
|
|
406
|
+
value = childrenSource.toHTML( props.value );
|
|
407
|
+
onChange = ( newValue ) =>
|
|
408
|
+
props.onChange(
|
|
409
|
+
childrenSource.fromDOM(
|
|
410
|
+
__unstableCreateElement( document, newValue ).childNodes
|
|
411
|
+
)
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const Component = props.multiline
|
|
416
|
+
? RichTextMultiline
|
|
417
|
+
: ForwardedRichTextWrapper;
|
|
418
|
+
const instanceId = useInstanceId( RichTextSwitcher );
|
|
419
|
+
|
|
420
|
+
return (
|
|
421
|
+
<Component
|
|
422
|
+
{ ...props }
|
|
423
|
+
identifier={ props.identifier || instanceId }
|
|
424
|
+
value={ value }
|
|
425
|
+
onChange={ onChange }
|
|
426
|
+
ref={ ref }
|
|
427
|
+
/>
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const ForwardedRichTextContainer = forwardRef( RichTextSwitcher );
|
|
428
432
|
|
|
429
433
|
ForwardedRichTextContainer.Content = Content;
|
|
430
434
|
ForwardedRichTextContainer.isEmpty = ( value ) => {
|