@wordpress/block-editor 12.5.0 → 12.7.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 +4 -0
- package/README.md +2 -6
- package/build/autocompleters/block.js +6 -2
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-draggable/index.js +6 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +2 -2
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +25 -13
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-editing-mode/index.js +1 -1
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +14 -18
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block.js +4 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +21 -42
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +2 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +6 -21
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +1 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -2
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +3 -17
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build/components/block-toolbar/index.js +4 -33
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +62 -3
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-toolbar/utils.js +56 -51
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +4 -2
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +10 -20
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/editor-styles/index.js +2 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +11 -11
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/behaviors-panel.js +66 -0
- package/build/components/global-styles/behaviors-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +21 -15
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +13 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +4 -8
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +131 -27
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +20 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +18 -3
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +4 -4
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +12 -18
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +7 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +36 -48
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +5 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build/components/index.js +1 -10
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +3 -1
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +6 -2
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +5 -7
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +3 -2
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +2 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +21 -32
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +23 -3
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.js +3 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter-list-item/index.js +1 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/link-control/index.js +51 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +3 -3
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-item.js +1 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -2
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +6 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +65 -31
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.native.js +15 -3
- package/build/components/media-replace-flow/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +0 -36
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/format-edit.js +57 -28
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +111 -0
- package/build/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +2 -2
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-display-information/index.js +7 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +49 -8
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-setting/index.js +5 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/behaviors.js +5 -12
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/border.js +2 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +11 -2
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +1 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +10 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +3 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +5 -6
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +23 -79
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +38 -2
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +7 -3
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-draggable/index.js +6 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +2 -2
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +27 -10
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +1 -1
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +14 -18
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block.js +4 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +24 -43
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +2 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +3 -3
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +7 -22
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -4
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +3 -3
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -18
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +6 -35
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +60 -4
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/utils.js +54 -49
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -2
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +13 -23
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/editor-styles/index.js +2 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +11 -11
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/behaviors-panel.js +57 -0
- package/build-module/components/global-styles/behaviors-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +21 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +13 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +4 -8
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +127 -27
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +18 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +4 -4
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +13 -18
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +6 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +37 -49
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +5 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +3 -1
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +7 -3
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +5 -7
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +3 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +22 -33
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +3 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -1
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/link-control/index.js +49 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +3 -3
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-item.js +1 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +6 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +66 -33
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.native.js +15 -3
- package/build-module/components/media-replace-flow/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +1 -36
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +51 -26
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +100 -0
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/single.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-display-information/index.js +7 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +50 -8
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-setting/index.js +5 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/behaviors.js +5 -12
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/border.js +2 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +11 -2
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +2 -7
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +20 -75
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +34 -2
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +2 -1
- package/build-style/content.css +2 -1
- package/build-style/style-rtl.css +25 -6
- package/build-style/style.css +25 -6
- package/package.json +32 -32
- package/src/autocompleters/block.js +21 -6
- package/src/components/block-controls/README.md +89 -0
- package/src/components/block-draggable/index.js +13 -4
- package/src/components/block-draggable/index.native.js +7 -3
- package/src/components/block-draggable/test/index.native.js +2 -57
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-editing-mode/index.js +1 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- package/src/components/block-list/block.js +6 -1
- package/src/components/block-list/block.native.js +24 -38
- package/src/components/block-list/block.native.scss +18 -40
- package/src/components/block-list/index.js +3 -6
- package/src/components/block-list/style.native.scss +3 -3
- package/src/components/block-list/test/block-invalid-warning.native.js +8 -1
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +40 -6
- package/src/components/block-parent-selector/index.js +30 -42
- package/src/components/block-preview/auto.js +8 -1
- package/src/components/block-preview/style.scss +2 -1
- package/src/components/block-removal-warning-modal/index.js +0 -3
- package/src/components/block-settings/button.native.js +12 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -13
- package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
- package/src/components/block-toolbar/index.js +36 -64
- package/src/components/block-toolbar/index.native.js +86 -6
- package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
- package/src/components/block-toolbar/test/index.native.js +42 -0
- package/src/components/block-toolbar/utils.js +57 -45
- package/src/components/block-tools/block-contextual-toolbar.js +43 -35
- package/src/components/block-tools/style.scss +17 -5
- package/src/components/block-variation-picker/index.native.js +52 -72
- package/src/components/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +3 -2
- package/src/components/editor-styles/index.js +2 -2
- package/src/components/font-sizes/fluid-utils.js +17 -17
- package/src/components/font-sizes/test/fluid-utils.js +6 -6
- package/src/components/global-styles/behaviors-panel.js +71 -0
- package/src/components/global-styles/color-panel.js +23 -16
- package/src/components/global-styles/dimensions-panel.js +8 -2
- package/src/components/global-styles/get-block-css-selector.js +5 -9
- package/src/components/global-styles/hooks.js +134 -31
- package/src/components/global-styles/index.js +3 -0
- package/src/components/global-styles/test/typography-utils.js +6 -6
- package/src/components/global-styles/typography-panel.js +17 -5
- package/src/components/global-styles/typography-utils.js +4 -4
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +17 -7
- package/src/components/iframe/index.js +30 -56
- package/src/components/iframe/use-compatibility-styles.js +5 -0
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/README.md +10 -0
- package/src/components/inner-blocks/index.js +4 -0
- package/src/components/inner-blocks/index.native.js +4 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
- package/src/components/inserter/hooks/use-block-types-state.js +15 -6
- package/src/components/inserter/hooks/use-debounced-input.js +8 -7
- package/src/components/inserter/hooks/use-patterns-state.js +2 -1
- package/src/components/inserter/index.js +2 -3
- package/src/components/inserter/index.native.js +17 -36
- package/src/components/inserter/reusable-block-rename-hint.js +18 -1
- package/src/components/inserter/reusable-blocks-tab.js +4 -1
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/inserter-list-item/index.js +3 -1
- package/src/components/link-control/README.md +12 -3
- package/src/components/link-control/index.js +47 -7
- package/src/components/link-control/link-preview.js +6 -4
- package/src/components/link-control/search-item.js +1 -1
- package/src/components/link-control/style.scss +11 -3
- package/src/components/link-control/test/index.js +28 -1
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/list-view/use-list-view-drop-zone.js +5 -1
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- package/src/components/media-replace-flow/index.native.js +12 -3
- package/src/components/media-upload/test/index.native.js +1 -0
- package/src/components/preview-options/README.md +18 -17
- package/src/components/preview-options/index.js +2 -2
- package/src/components/rich-text/content.js +1 -46
- package/src/components/rich-text/format-edit.js +62 -38
- package/src/components/rich-text/get-rich-text-values.js +99 -0
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
- package/src/components/spacing-sizes-control/test/utils.js +9 -1
- package/src/components/spacing-sizes-control/utils.js +2 -2
- package/src/components/text-transform-control/README.md +44 -0
- package/src/components/use-block-display-information/index.js +12 -5
- package/src/components/use-block-drop-zone/index.native.js +65 -28
- package/src/components/use-setting/index.js +8 -8
- package/src/hooks/behaviors.js +10 -16
- package/src/hooks/border.js +2 -1
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/style.js +7 -3
- package/src/hooks/utils.js +5 -7
- package/src/private-apis.js +9 -1
- package/src/store/actions.js +23 -30
- package/src/store/private-selectors.js +3 -6
- package/src/store/reducer.js +0 -1
- package/src/store/selectors.js +36 -85
- package/src/store/test/actions.js +3 -0
- package/src/store/test/private-selectors.js +5 -5
- package/src/store/test/reducer.js +14 -7
- package/src/store/test/selectors.js +8 -7
- package/src/utils/object.js +32 -2
- package/src/utils/test/object.js +36 -0
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build/components/block-mobile-toolbar/index.native.js +0 -135
- package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
- package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.native.js +0 -127
- package/src/components/block-mobile-toolbar/style.native.scss +0 -16
- /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
|
@@ -12,6 +12,8 @@ import { useRef, useState, useEffect } from '@wordpress/element';
|
|
|
12
12
|
import { focus } from '@wordpress/dom';
|
|
13
13
|
import { ENTER } from '@wordpress/keycodes';
|
|
14
14
|
import { isShallowEqualObjects } from '@wordpress/is-shallow-equal';
|
|
15
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
16
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Internal dependencies
|
|
@@ -101,6 +103,9 @@ import { DEFAULT_LINK_SETTINGS } from './constants';
|
|
|
101
103
|
|
|
102
104
|
const noop = () => {};
|
|
103
105
|
|
|
106
|
+
const PREFERENCE_SCOPE = 'core/block-editor';
|
|
107
|
+
const PREFERENCE_KEY = 'linkControlSettingsDrawer';
|
|
108
|
+
|
|
104
109
|
/**
|
|
105
110
|
* Renders a link control. A link control is a controlled input which maintains
|
|
106
111
|
* a value associated with a link (HTML anchor element) and relevant settings
|
|
@@ -133,6 +138,41 @@ function LinkControl( {
|
|
|
133
138
|
withCreateSuggestion = true;
|
|
134
139
|
}
|
|
135
140
|
|
|
141
|
+
const [ settingsOpen, setSettingsOpen ] = useState( false );
|
|
142
|
+
|
|
143
|
+
const { advancedSettingsPreference } = useSelect( ( select ) => {
|
|
144
|
+
const prefsStore = select( preferencesStore );
|
|
145
|
+
|
|
146
|
+
return {
|
|
147
|
+
advancedSettingsPreference:
|
|
148
|
+
prefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,
|
|
149
|
+
};
|
|
150
|
+
}, [] );
|
|
151
|
+
|
|
152
|
+
const { set: setPreference } = useDispatch( preferencesStore );
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Sets the open/closed state of the Advanced Settings Drawer,
|
|
156
|
+
* optionlly persisting the state to the user's preferences.
|
|
157
|
+
*
|
|
158
|
+
* Note that Block Editor components can be consumed by non-WordPress
|
|
159
|
+
* environments which may not have preferences setup.
|
|
160
|
+
* Therefore a local state is also used as a fallback.
|
|
161
|
+
*
|
|
162
|
+
* @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.
|
|
163
|
+
*/
|
|
164
|
+
const setSettingsOpenWithPreference = ( prefVal ) => {
|
|
165
|
+
if ( setPreference ) {
|
|
166
|
+
setPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );
|
|
167
|
+
}
|
|
168
|
+
setSettingsOpen( prefVal );
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// Block Editor components can be consumed by non-WordPress environments
|
|
172
|
+
// which may not have these preferences setup.
|
|
173
|
+
// Therefore a local state is used as a fallback.
|
|
174
|
+
const isSettingsOpen = advancedSettingsPreference || settingsOpen;
|
|
175
|
+
|
|
136
176
|
const isMounting = useRef( true );
|
|
137
177
|
const wrapperNode = useRef();
|
|
138
178
|
const textInputRef = useRef();
|
|
@@ -140,8 +180,6 @@ function LinkControl( {
|
|
|
140
180
|
|
|
141
181
|
const settingsKeys = settings.map( ( { id } ) => id );
|
|
142
182
|
|
|
143
|
-
const [ settingsOpen, setSettingsOpen ] = useState( false );
|
|
144
|
-
|
|
145
183
|
const [
|
|
146
184
|
internalControlValue,
|
|
147
185
|
setInternalControlValue,
|
|
@@ -207,7 +245,6 @@ function LinkControl( {
|
|
|
207
245
|
wrapperNode.current.ownerDocument.activeElement
|
|
208
246
|
);
|
|
209
247
|
|
|
210
|
-
setSettingsOpen( false );
|
|
211
248
|
setIsEditingLink( false );
|
|
212
249
|
};
|
|
213
250
|
|
|
@@ -292,7 +329,6 @@ function LinkControl( {
|
|
|
292
329
|
const shownUnlinkControl =
|
|
293
330
|
onRemove && value && ! isEditingLink && ! isCreatingPage;
|
|
294
331
|
|
|
295
|
-
const showSettings = !! settings?.length && isEditingLink && hasLinkValue;
|
|
296
332
|
const showActions = isEditingLink && hasLinkValue;
|
|
297
333
|
|
|
298
334
|
// Only show text control once a URL value has been committed
|
|
@@ -302,6 +338,7 @@ function LinkControl( {
|
|
|
302
338
|
|
|
303
339
|
const isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;
|
|
304
340
|
const isDisabled = ! valueHasChanges || currentInputIsEmpty;
|
|
341
|
+
const showSettings = !! settings?.length && isEditingLink && hasLinkValue;
|
|
305
342
|
|
|
306
343
|
return (
|
|
307
344
|
<div
|
|
@@ -374,7 +411,10 @@ function LinkControl( {
|
|
|
374
411
|
onEditClick={ () => setIsEditingLink( true ) }
|
|
375
412
|
hasRichPreviews={ hasRichPreviews }
|
|
376
413
|
hasUnlinkControl={ shownUnlinkControl }
|
|
377
|
-
onRemove={
|
|
414
|
+
onRemove={ () => {
|
|
415
|
+
onRemove();
|
|
416
|
+
setIsEditingLink( true );
|
|
417
|
+
} }
|
|
378
418
|
/>
|
|
379
419
|
) }
|
|
380
420
|
|
|
@@ -382,8 +422,8 @@ function LinkControl( {
|
|
|
382
422
|
<div className="block-editor-link-control__tools">
|
|
383
423
|
{ ! currentInputIsEmpty && (
|
|
384
424
|
<LinkControlSettingsDrawer
|
|
385
|
-
settingsOpen={
|
|
386
|
-
setSettingsOpen={
|
|
425
|
+
settingsOpen={ isSettingsOpen }
|
|
426
|
+
setSettingsOpen={ setSettingsOpenWithPreference }
|
|
387
427
|
>
|
|
388
428
|
<LinkSettings
|
|
389
429
|
value={ internalControlValue }
|
|
@@ -42,11 +42,13 @@ export default function LinkPreview( {
|
|
|
42
42
|
( value && filterURLForDisplay( safeDecodeURI( value.url ), 16 ) ) ||
|
|
43
43
|
'';
|
|
44
44
|
|
|
45
|
-
const displayTitle = richData?.title || value?.title || displayURL;
|
|
46
|
-
|
|
47
45
|
// url can be undefined if the href attribute is unset
|
|
48
46
|
const isEmptyURL = ! value?.url?.length;
|
|
49
47
|
|
|
48
|
+
const displayTitle =
|
|
49
|
+
! isEmptyURL &&
|
|
50
|
+
stripHTML( richData?.title || value?.title || displayURL );
|
|
51
|
+
|
|
50
52
|
let icon;
|
|
51
53
|
|
|
52
54
|
if ( richData?.icon ) {
|
|
@@ -87,10 +89,10 @@ export default function LinkPreview( {
|
|
|
87
89
|
className="block-editor-link-control__search-item-title"
|
|
88
90
|
href={ value.url }
|
|
89
91
|
>
|
|
90
|
-
{
|
|
92
|
+
{ displayTitle }
|
|
91
93
|
</ExternalLink>
|
|
92
94
|
|
|
93
|
-
{ value?.url && (
|
|
95
|
+
{ value?.url && displayTitle !== displayURL && (
|
|
94
96
|
<span className="block-editor-link-control__search-item-info">
|
|
95
97
|
{ displayURL }
|
|
96
98
|
</span>
|
|
@@ -54,7 +54,7 @@ export const LinkControlSearchItem = ( {
|
|
|
54
54
|
} ) => {
|
|
55
55
|
const info = isURL
|
|
56
56
|
? __( 'Press ENTER to add this link' )
|
|
57
|
-
: filterURLForDisplay( safeDecodeURI( suggestion?.url ) );
|
|
57
|
+
: filterURLForDisplay( safeDecodeURI( suggestion?.url ), 24 );
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<MenuItem
|
|
@@ -84,7 +84,7 @@ $preview-image-height: 140px;
|
|
|
84
84
|
flex-direction: row-reverse; // put "Cancel" on the left but retain DOM order.
|
|
85
85
|
justify-content: flex-start;
|
|
86
86
|
gap: $grid-unit-10;
|
|
87
|
-
padding: $grid-unit-10;
|
|
87
|
+
padding: $grid-unit-10 $grid-unit-20 $grid-unit-20;
|
|
88
88
|
order: 20;
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -139,6 +139,13 @@ $preview-image-height: 140px;
|
|
|
139
139
|
// Inline block required to preserve white space
|
|
140
140
|
// between `<mark>` elements and text nodes.
|
|
141
141
|
display: inline-block;
|
|
142
|
+
width: 100%;
|
|
143
|
+
|
|
144
|
+
mark {
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
color: inherit;
|
|
147
|
+
background-color: transparent;
|
|
148
|
+
}
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
.components-menu-item__shortcut {
|
|
@@ -208,12 +215,12 @@ $preview-image-height: 140px;
|
|
|
208
215
|
|
|
209
216
|
.block-editor-link-control__search-item-title {
|
|
210
217
|
display: block;
|
|
211
|
-
margin-bottom: 0.2em;
|
|
212
218
|
font-weight: 500;
|
|
213
219
|
position: relative;
|
|
220
|
+
line-height: $grid-unit-30;
|
|
214
221
|
|
|
215
222
|
mark {
|
|
216
|
-
font-weight:
|
|
223
|
+
font-weight: 600;
|
|
217
224
|
color: inherit;
|
|
218
225
|
background-color: transparent;
|
|
219
226
|
}
|
|
@@ -284,6 +291,7 @@ $preview-image-height: 140px;
|
|
|
284
291
|
display: flex;
|
|
285
292
|
flex-direction: row;
|
|
286
293
|
width: 100%; // clip.
|
|
294
|
+
align-items: center;
|
|
287
295
|
}
|
|
288
296
|
|
|
289
297
|
.block-editor-link-control__search-item-bottom {
|
|
@@ -405,6 +405,32 @@ describe( 'Basic rendering', () => {
|
|
|
405
405
|
|
|
406
406
|
expect( mockOnRemove ).toHaveBeenCalled();
|
|
407
407
|
} );
|
|
408
|
+
|
|
409
|
+
it( 'should revert to "editing" mode when onRemove is triggered', async () => {
|
|
410
|
+
const user = userEvent.setup();
|
|
411
|
+
const mockOnRemove = jest.fn();
|
|
412
|
+
|
|
413
|
+
render(
|
|
414
|
+
<LinkControl
|
|
415
|
+
value={ { url: 'https://example.com' } }
|
|
416
|
+
onRemove={ mockOnRemove }
|
|
417
|
+
/>
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
const unLinkButton = screen.queryByRole( 'button', {
|
|
421
|
+
name: 'Unlink',
|
|
422
|
+
} );
|
|
423
|
+
expect( unLinkButton ).toBeVisible();
|
|
424
|
+
|
|
425
|
+
await user.click( unLinkButton );
|
|
426
|
+
|
|
427
|
+
expect( mockOnRemove ).toHaveBeenCalled();
|
|
428
|
+
|
|
429
|
+
// Should revert back to editing mode.
|
|
430
|
+
expect(
|
|
431
|
+
screen.getByRole( 'combobox', { name: 'Link' } )
|
|
432
|
+
).toBeVisible();
|
|
433
|
+
} );
|
|
408
434
|
} );
|
|
409
435
|
} );
|
|
410
436
|
|
|
@@ -1708,7 +1734,7 @@ describe( 'Selecting links', () => {
|
|
|
1708
1734
|
} );
|
|
1709
1735
|
|
|
1710
1736
|
describe( 'Addition Settings UI', () => {
|
|
1711
|
-
it( 'should
|
|
1737
|
+
it( 'should hide advanced link settings when not editing a link', async () => {
|
|
1712
1738
|
const selectedLink = fauxEntitySuggestions[ 0 ];
|
|
1713
1739
|
|
|
1714
1740
|
const LinkControlConsumer = () => {
|
|
@@ -1723,6 +1749,7 @@ describe( 'Addition Settings UI', () => {
|
|
|
1723
1749
|
|
|
1724
1750
|
expect( settingsToggle ).not.toBeInTheDocument();
|
|
1725
1751
|
} );
|
|
1752
|
+
|
|
1726
1753
|
it( 'should provides a means to toggle the link settings', async () => {
|
|
1727
1754
|
const selectedLink = fauxEntitySuggestions[ 0 ];
|
|
1728
1755
|
|
|
@@ -16,14 +16,14 @@ export default function useListViewClientIds( { blocks, rootClientId } ) {
|
|
|
16
16
|
const {
|
|
17
17
|
getDraggedBlockClientIds,
|
|
18
18
|
getSelectedBlockClientIds,
|
|
19
|
-
|
|
19
|
+
getEnabledClientIdsTree,
|
|
20
20
|
} = unlock( select( blockEditorStore ) );
|
|
21
21
|
|
|
22
22
|
return {
|
|
23
23
|
selectedClientIds: getSelectedBlockClientIds(),
|
|
24
24
|
draggedClientIds: getDraggedBlockClientIds(),
|
|
25
25
|
clientIdsTree:
|
|
26
|
-
blocks ??
|
|
26
|
+
blocks ?? getEnabledClientIdsTree( rootClientId ),
|
|
27
27
|
};
|
|
28
28
|
},
|
|
29
29
|
[ blocks, rootClientId ]
|
|
@@ -489,7 +489,11 @@ export default function useListViewDropZone( { dropZoneElement } ) {
|
|
|
489
489
|
|
|
490
490
|
const ref = useDropZone( {
|
|
491
491
|
dropZoneElement,
|
|
492
|
-
onDrop
|
|
492
|
+
onDrop( event ) {
|
|
493
|
+
if ( target ) {
|
|
494
|
+
onBlockDrop( event );
|
|
495
|
+
}
|
|
496
|
+
},
|
|
493
497
|
onDragLeave() {
|
|
494
498
|
throttled.cancel();
|
|
495
499
|
setTarget( null );
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { View, Text,
|
|
4
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
5
|
+
import { sentenceCase } from 'change-case';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -13,14 +14,15 @@ import {
|
|
|
13
14
|
MEDIA_TYPE_VIDEO,
|
|
14
15
|
MEDIA_TYPE_AUDIO,
|
|
15
16
|
} from '@wordpress/block-editor';
|
|
16
|
-
import {
|
|
17
|
-
import { useRef } from '@wordpress/element';
|
|
17
|
+
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
18
|
+
import { cloneElement, useCallback, useRef } from '@wordpress/element';
|
|
18
19
|
import { Icon, plusCircleFilled } from '@wordpress/icons';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
22
23
|
*/
|
|
23
24
|
import styles from './styles.scss';
|
|
25
|
+
import { useBlockEditContext } from '../block-edit/context';
|
|
24
26
|
|
|
25
27
|
const isMediaEqual = ( media1, media2 ) =>
|
|
26
28
|
media1.id === media2.id || media1.url === media2.url;
|
|
@@ -35,10 +37,13 @@ const dedupMedia = ( media ) =>
|
|
|
35
37
|
[]
|
|
36
38
|
);
|
|
37
39
|
|
|
40
|
+
const hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };
|
|
41
|
+
|
|
38
42
|
function MediaPlaceholder( props ) {
|
|
39
43
|
const {
|
|
40
44
|
addToGallery,
|
|
41
45
|
allowedTypes = [],
|
|
46
|
+
className = '',
|
|
42
47
|
labels = {},
|
|
43
48
|
icon,
|
|
44
49
|
onSelect,
|
|
@@ -46,7 +51,6 @@ function MediaPlaceholder( props ) {
|
|
|
46
51
|
__experimentalOnlyMediaLibrary,
|
|
47
52
|
isAppender,
|
|
48
53
|
disableMediaButtons,
|
|
49
|
-
getStylesFromColorScheme,
|
|
50
54
|
multiple,
|
|
51
55
|
value = [],
|
|
52
56
|
children,
|
|
@@ -61,6 +65,16 @@ function MediaPlaceholder( props ) {
|
|
|
61
65
|
const mediaRef = useRef( value );
|
|
62
66
|
mediaRef.current = value;
|
|
63
67
|
|
|
68
|
+
const blockEditContext = useBlockEditContext();
|
|
69
|
+
|
|
70
|
+
const onButtonPress = useCallback(
|
|
71
|
+
( open ) => ( event ) => {
|
|
72
|
+
onFocus?.( event );
|
|
73
|
+
open();
|
|
74
|
+
},
|
|
75
|
+
[ onFocus ]
|
|
76
|
+
);
|
|
77
|
+
|
|
64
78
|
// Append and deduplicate media array for gallery use case.
|
|
65
79
|
const setMedia =
|
|
66
80
|
multiple && addToGallery
|
|
@@ -109,55 +123,104 @@ function MediaPlaceholder( props ) {
|
|
|
109
123
|
accessibilityHint = __( 'Double tap to select an audio file' );
|
|
110
124
|
}
|
|
111
125
|
|
|
112
|
-
const
|
|
113
|
-
styles
|
|
114
|
-
styles
|
|
126
|
+
const titleStyles = usePreferredColorSchemeStyle(
|
|
127
|
+
styles[ 'media-placeholder__header-title' ],
|
|
128
|
+
styles[ 'media-placeholder__header-title--dark' ]
|
|
115
129
|
);
|
|
116
|
-
const addMediaButtonStyle =
|
|
130
|
+
const addMediaButtonStyle = usePreferredColorSchemeStyle(
|
|
117
131
|
styles.addMediaButton,
|
|
118
132
|
styles.addMediaButtonDark
|
|
119
133
|
);
|
|
134
|
+
const buttonStyles = usePreferredColorSchemeStyle(
|
|
135
|
+
styles[ 'media-placeholder__button' ],
|
|
136
|
+
styles[ 'media-placeholder__button--dark' ]
|
|
137
|
+
);
|
|
138
|
+
const emptyStateDescriptionStyles = usePreferredColorSchemeStyle(
|
|
139
|
+
styles.emptyStateDescription,
|
|
140
|
+
styles.emptyStateDescriptionDark
|
|
141
|
+
);
|
|
142
|
+
const iconStyles = usePreferredColorSchemeStyle(
|
|
143
|
+
styles[ 'media-placeholder__header-icon' ],
|
|
144
|
+
styles[ 'media-placeholder__header-icon--dark' ]
|
|
145
|
+
);
|
|
146
|
+
const placeholderIcon = cloneElement( icon, {
|
|
147
|
+
fill: iconStyles.fill,
|
|
148
|
+
} );
|
|
149
|
+
const accessibilityLabel = sprintf(
|
|
150
|
+
/* translators: accessibility text for the media block empty state. %s: media type */
|
|
151
|
+
__( '%s block. Empty' ),
|
|
152
|
+
placeholderTitle
|
|
153
|
+
);
|
|
120
154
|
|
|
121
|
-
const renderContent = () => {
|
|
155
|
+
const renderContent = ( open ) => {
|
|
122
156
|
if ( isAppender === undefined || ! isAppender ) {
|
|
123
157
|
return (
|
|
124
158
|
<>
|
|
125
|
-
<View style={ styles
|
|
126
|
-
|
|
127
|
-
{ placeholderTitle }
|
|
128
|
-
</
|
|
159
|
+
<View style={ styles[ 'media-placeholder__header' ] }>
|
|
160
|
+
<View style={ iconStyles }>{ placeholderIcon }</View>
|
|
161
|
+
<Text style={ titleStyles }>{ placeholderTitle }</Text>
|
|
162
|
+
</View>
|
|
129
163
|
{ children }
|
|
130
|
-
<
|
|
131
|
-
{
|
|
132
|
-
|
|
164
|
+
<TouchableOpacity
|
|
165
|
+
activeOpacity={ 0.5 }
|
|
166
|
+
accessibilityLabel={ accessibilityLabel }
|
|
167
|
+
style={ buttonStyles }
|
|
168
|
+
accessibilityRole={ 'button' }
|
|
169
|
+
accessibilityHint={ accessibilityHint }
|
|
170
|
+
hitSlop={ hitSlop }
|
|
171
|
+
onPress={ onButtonPress( open ) }
|
|
172
|
+
>
|
|
173
|
+
<Text style={ emptyStateDescriptionStyles }>
|
|
174
|
+
{ sentenceCase( instructions ) }
|
|
175
|
+
</Text>
|
|
176
|
+
</TouchableOpacity>
|
|
133
177
|
</>
|
|
134
178
|
);
|
|
135
179
|
} else if ( isAppender && ! disableMediaButtons ) {
|
|
136
180
|
return (
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
181
|
+
<TouchableOpacity
|
|
182
|
+
activeOpacity={ 0.5 }
|
|
183
|
+
accessibilityLabel={ accessibilityLabel }
|
|
184
|
+
style={ styles[ 'media-placeholder__appender' ] }
|
|
185
|
+
accessibilityRole={ 'button' }
|
|
186
|
+
accessibilityHint={ accessibilityHint }
|
|
187
|
+
hitSlop={ hitSlop }
|
|
188
|
+
onPress={ onButtonPress( open ) }
|
|
189
|
+
>
|
|
190
|
+
<View testID="media-placeholder-appender-icon">
|
|
191
|
+
<Icon
|
|
192
|
+
icon={ plusCircleFilled }
|
|
193
|
+
style={ addMediaButtonStyle }
|
|
194
|
+
color={ addMediaButtonStyle.color }
|
|
195
|
+
size={ addMediaButtonStyle.size }
|
|
196
|
+
/>
|
|
197
|
+
</View>
|
|
198
|
+
</TouchableOpacity>
|
|
145
199
|
);
|
|
146
200
|
}
|
|
147
201
|
};
|
|
148
202
|
|
|
149
|
-
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const appenderStyle = getStylesFromColorScheme(
|
|
203
|
+
const appenderStyle = usePreferredColorSchemeStyle(
|
|
154
204
|
styles.appender,
|
|
155
205
|
styles.appenderDark
|
|
156
206
|
);
|
|
157
|
-
const
|
|
158
|
-
styles
|
|
159
|
-
styles
|
|
207
|
+
const containerSelectedStyle = usePreferredColorSchemeStyle(
|
|
208
|
+
styles[ 'media-placeholder__container-selected' ],
|
|
209
|
+
styles[ 'media-placeholder__container-selected--dark' ]
|
|
160
210
|
);
|
|
211
|
+
const containerStyle = [
|
|
212
|
+
usePreferredColorSchemeStyle(
|
|
213
|
+
styles[ 'media-placeholder__container' ],
|
|
214
|
+
styles[ 'media-placeholder__container--dark' ]
|
|
215
|
+
),
|
|
216
|
+
blockEditContext?.isSelected &&
|
|
217
|
+
! className.includes( 'no-block-outline' ) &&
|
|
218
|
+
containerSelectedStyle,
|
|
219
|
+
];
|
|
220
|
+
|
|
221
|
+
if ( isAppender && disableMediaButtons ) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
161
224
|
|
|
162
225
|
return (
|
|
163
226
|
<View style={ { flex: 1 } }>
|
|
@@ -173,33 +236,19 @@ function MediaPlaceholder( props ) {
|
|
|
173
236
|
autoOpen={ autoOpenMediaUpload }
|
|
174
237
|
render={ ( { open, getMediaOptions } ) => {
|
|
175
238
|
return (
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
onFocus?.( event );
|
|
186
|
-
open();
|
|
187
|
-
} }
|
|
239
|
+
<View
|
|
240
|
+
style={ [
|
|
241
|
+
[
|
|
242
|
+
containerStyle,
|
|
243
|
+
height && { height },
|
|
244
|
+
backgroundColor && { backgroundColor },
|
|
245
|
+
],
|
|
246
|
+
isAppender && appenderStyle,
|
|
247
|
+
] }
|
|
188
248
|
>
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
emptyStateContainerStyle,
|
|
193
|
-
height && { height },
|
|
194
|
-
backgroundColor && { backgroundColor },
|
|
195
|
-
],
|
|
196
|
-
isAppender && appenderStyle,
|
|
197
|
-
] }
|
|
198
|
-
>
|
|
199
|
-
{ getMediaOptions() }
|
|
200
|
-
{ ! hideContent && renderContent() }
|
|
201
|
-
</View>
|
|
202
|
-
</TouchableWithoutFeedback>
|
|
249
|
+
{ getMediaOptions() }
|
|
250
|
+
{ ! hideContent && renderContent( open ) }
|
|
251
|
+
</View>
|
|
203
252
|
);
|
|
204
253
|
} }
|
|
205
254
|
/>
|
|
@@ -207,4 +256,4 @@ function MediaPlaceholder( props ) {
|
|
|
207
256
|
);
|
|
208
257
|
}
|
|
209
258
|
|
|
210
|
-
export default
|
|
259
|
+
export default MediaPlaceholder;
|
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
.
|
|
1
|
+
.media-placeholder__container {
|
|
2
2
|
flex: 1;
|
|
3
3
|
height: 142;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
|
-
background-color: $
|
|
7
|
+
background-color: #e0e0e0; // $light-dim
|
|
8
8
|
padding-left: 12;
|
|
9
9
|
padding-right: 12;
|
|
10
10
|
padding-top: 12;
|
|
11
11
|
padding-bottom: 12;
|
|
12
|
-
border-top-left-radius:
|
|
13
|
-
border-top-right-radius:
|
|
14
|
-
border-bottom-left-radius:
|
|
15
|
-
border-bottom-right-radius:
|
|
12
|
+
border-top-left-radius: 2;
|
|
13
|
+
border-top-right-radius: 2;
|
|
14
|
+
border-bottom-left-radius: 2;
|
|
15
|
+
border-bottom-right-radius: 2;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.
|
|
19
|
-
background-color: $
|
|
18
|
+
.media-placeholder__container--dark {
|
|
19
|
+
background-color: #1f1f1f; // $dark-dim
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
margin-bottom: 16;
|
|
26
|
-
font-size: 14;
|
|
27
|
-
color: #2e4453;
|
|
22
|
+
.media-placeholder__container-selected {
|
|
23
|
+
border-width: 2px;
|
|
24
|
+
border-color: $blue-40;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
.
|
|
31
|
-
color: $
|
|
27
|
+
.media-placeholder__container-selected--dark {
|
|
28
|
+
border-color: $blue-50;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
.emptyStateDescription {
|
|
35
|
-
width: 100%;
|
|
36
32
|
text-align: center;
|
|
37
|
-
color: $
|
|
38
|
-
font-size:
|
|
39
|
-
font-weight:
|
|
33
|
+
color: $white;
|
|
34
|
+
font-size: 16;
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.emptyStateDescriptionDark {
|
|
39
|
+
color: $black;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.media-placeholder__header-icon {
|
|
43
43
|
width: 24px;
|
|
44
44
|
height: 24px;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
margin-right: $grid-unit;
|
|
46
|
+
fill: $light-secondary;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.media-placeholder__header-icon--dark {
|
|
50
|
+
fill: $dark-tertiary;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.media-placeholder__header-title {
|
|
54
|
+
text-align: center;
|
|
55
|
+
font-size: 16;
|
|
56
|
+
color: $light-secondary;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.media-placeholder__header-title--dark {
|
|
60
|
+
color: $dark-tertiary;
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
.appender {
|
|
@@ -71,3 +84,25 @@
|
|
|
71
84
|
color: $background-dark-secondary;
|
|
72
85
|
background-color: $gray-20;
|
|
73
86
|
}
|
|
87
|
+
|
|
88
|
+
.media-placeholder__button {
|
|
89
|
+
background-color: $light-primary;
|
|
90
|
+
border-radius: 3px;
|
|
91
|
+
padding: $grid-unit $grid-unit-20;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.media-placeholder__button--dark {
|
|
95
|
+
background-color: $dark-primary;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.media-placeholder__header {
|
|
99
|
+
flex-direction: row;
|
|
100
|
+
align-items: center;
|
|
101
|
+
margin-top: 4;
|
|
102
|
+
margin-bottom: 16;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.media-placeholder__appender {
|
|
106
|
+
width: 100%;
|
|
107
|
+
align-items: center;
|
|
108
|
+
}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
|
|
6
|
+
// MediaReplaceFlow component is not yet implemented in the native version.
|
|
7
|
+
// For testing purposes, we are using an empty View component with a testID prop.
|
|
8
|
+
const MediaReplaceFlow = () => {
|
|
9
|
+
return <View testID="media-replace-flow" />;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default MediaReplaceFlow;
|