@wordpress/block-editor 12.5.0 → 12.6.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 +2 -0
- package/README.md +0 -4
- 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-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.native.js +21 -42
- package/build/components/block-list/block.native.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-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-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 -3
- 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/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- 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 +13 -23
- package/build/components/global-styles/hooks.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/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 +6 -6
- 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/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/link-control/index.js +4 -1
- package/build/components/link-control/index.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/media-placeholder/index.native.js +65 -31
- package/build/components/media-placeholder/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/get-rich-text-values.js +118 -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 +1 -1
- 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/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/utils.js +1 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +1 -1
- 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 +19 -8
- 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/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-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.native.js +24 -43
- package/build-module/components/block-list/block.native.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-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-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 +4 -3
- 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/colors-gradients/control.js +3 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- 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 +12 -22
- package/build-module/components/global-styles/hooks.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/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 +5 -5
- 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/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/link-control/index.js +4 -1
- package/build-module/components/link-control/index.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/media-placeholder/index.native.js +66 -33
- package/build-module/components/media-placeholder/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/get-rich-text-values.js +105 -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 +1 -1
- 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/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/utils.js +2 -7
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- 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 +16 -6
- 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 +7 -1
- package/build-style/style.css +7 -1
- package/package.json +32 -32
- 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 +0 -54
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- 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/style.native.scss +3 -3
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
- 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-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
- package/src/components/block-toolbar/index.js +2 -3
- 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/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/colors-gradients/control.js +3 -2
- 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 +20 -26
- package/src/components/global-styles/typography-panel.js +17 -5
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +15 -6
- 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/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/style.native.scss +10 -15
- package/src/components/link-control/index.js +4 -1
- package/src/components/link-control/search-item.js +1 -1
- package/src/components/link-control/style.scss +8 -1
- package/src/components/link-control/test/index.js +26 -0
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- 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/get-rich-text-values.js +105 -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/utils.js +1 -1
- 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/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/utils.js +5 -7
- package/src/private-apis.js +7 -1
- package/src/store/actions.js +1 -2
- package/src/store/private-selectors.js +3 -6
- package/src/store/reducer.js +0 -1
- package/src/store/selectors.js +33 -5
- 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 +1 -1
- 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
|
@@ -374,7 +374,10 @@ function LinkControl( {
|
|
|
374
374
|
onEditClick={ () => setIsEditingLink( true ) }
|
|
375
375
|
hasRichPreviews={ hasRichPreviews }
|
|
376
376
|
hasUnlinkControl={ shownUnlinkControl }
|
|
377
|
-
onRemove={
|
|
377
|
+
onRemove={ () => {
|
|
378
|
+
onRemove();
|
|
379
|
+
setIsEditingLink( true );
|
|
380
|
+
} }
|
|
378
381
|
/>
|
|
379
382
|
) }
|
|
380
383
|
|
|
@@ -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
|
|
@@ -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 {
|
|
@@ -213,7 +220,7 @@ $preview-image-height: 140px;
|
|
|
213
220
|
position: relative;
|
|
214
221
|
|
|
215
222
|
mark {
|
|
216
|
-
font-weight:
|
|
223
|
+
font-weight: 600;
|
|
217
224
|
color: inherit;
|
|
218
225
|
background-color: transparent;
|
|
219
226
|
}
|
|
@@ -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
|
|
|
@@ -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 ]
|
|
@@ -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
|
+
}
|
|
@@ -28,23 +28,24 @@ const MyPreviewOptions = () => (
|
|
|
28
28
|
className="edit-post-post-preview-dropdown"
|
|
29
29
|
deviceType={ deviceType }
|
|
30
30
|
setDeviceType={ setPreviewDeviceType }
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
> { ( { onClose } ) => (
|
|
32
|
+
<MenuGroup>
|
|
33
|
+
<div className="edit-post-header-preview__grouping-external">
|
|
34
|
+
<PostPreviewButton
|
|
35
|
+
className="edit-post-header-preview__button-external"
|
|
36
|
+
role="menuitem"
|
|
37
|
+
forceIsAutosaveable={ hasActiveMetaboxes }
|
|
38
|
+
textContent={
|
|
39
|
+
<>
|
|
40
|
+
{ __( 'Preview in new tab' ) }
|
|
41
|
+
<Icon icon={ external } />
|
|
42
|
+
</>
|
|
43
|
+
}
|
|
44
|
+
onPreview={ onClose }
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</MenuGroup>
|
|
48
|
+
) }
|
|
48
49
|
</PreviewOptions>
|
|
49
50
|
);
|
|
50
51
|
```
|
|
@@ -54,7 +54,7 @@ export default function PreviewOptions( {
|
|
|
54
54
|
icon={ deviceIcons[ deviceType.toLowerCase() ] }
|
|
55
55
|
label={ label || __( 'Preview' ) }
|
|
56
56
|
>
|
|
57
|
-
{ () => (
|
|
57
|
+
{ ( renderProps ) => (
|
|
58
58
|
<>
|
|
59
59
|
<MenuGroup>
|
|
60
60
|
<MenuItem
|
|
@@ -79,7 +79,7 @@ export default function PreviewOptions( {
|
|
|
79
79
|
{ __( 'Mobile' ) }
|
|
80
80
|
</MenuItem>
|
|
81
81
|
</MenuGroup>
|
|
82
|
-
{ children }
|
|
82
|
+
{ children( renderProps ) }
|
|
83
83
|
</>
|
|
84
84
|
) }
|
|
85
85
|
</DropdownMenu>
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { RawHTML } from '@wordpress/element';
|
|
5
|
-
import {
|
|
6
|
-
children as childrenSource,
|
|
7
|
-
getSaveElement,
|
|
8
|
-
__unstableGetBlockProps as getBlockProps,
|
|
9
|
-
} from '@wordpress/blocks';
|
|
5
|
+
import { children as childrenSource } from '@wordpress/blocks';
|
|
10
6
|
import deprecated from '@wordpress/deprecated';
|
|
11
7
|
|
|
12
8
|
/**
|
|
@@ -42,44 +38,3 @@ export const Content = ( { value, tagName: Tag, multiline, ...props } ) => {
|
|
|
42
38
|
|
|
43
39
|
return content;
|
|
44
40
|
};
|
|
45
|
-
|
|
46
|
-
Content.__unstableIsRichTextContent = {};
|
|
47
|
-
|
|
48
|
-
function findContent( blocks, richTextValues = [] ) {
|
|
49
|
-
if ( ! Array.isArray( blocks ) ) {
|
|
50
|
-
blocks = [ blocks ];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
for ( const block of blocks ) {
|
|
54
|
-
if (
|
|
55
|
-
block?.type?.__unstableIsRichTextContent ===
|
|
56
|
-
Content.__unstableIsRichTextContent
|
|
57
|
-
) {
|
|
58
|
-
richTextValues.push( block.props.value );
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if ( block?.props?.children ) {
|
|
63
|
-
findContent( block.props.children, richTextValues );
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return richTextValues;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function _getSaveElement( { name, attributes, innerBlocks } ) {
|
|
71
|
-
return getSaveElement(
|
|
72
|
-
name,
|
|
73
|
-
attributes,
|
|
74
|
-
innerBlocks.map( _getSaveElement )
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function getRichTextValues( blocks = [] ) {
|
|
79
|
-
getBlockProps.skipFilters = true;
|
|
80
|
-
const values = findContent(
|
|
81
|
-
( Array.isArray( blocks ) ? blocks : [ blocks ] ).map( _getSaveElement )
|
|
82
|
-
);
|
|
83
|
-
getBlockProps.skipFilters = false;
|
|
84
|
-
return values;
|
|
85
|
-
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { RawHTML, StrictMode, Fragment } from '@wordpress/element';
|
|
5
|
+
import {
|
|
6
|
+
getSaveElement,
|
|
7
|
+
__unstableGetBlockProps as getBlockProps,
|
|
8
|
+
} from '@wordpress/blocks';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import InnerBlocks from '../inner-blocks';
|
|
14
|
+
import { Content } from './content';
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* This function is similar to `@wordpress/element`'s `renderToString` function,
|
|
18
|
+
* except that it does not render the elements to a string, but instead collects
|
|
19
|
+
* the values of all rich text `Content` elements.
|
|
20
|
+
*/
|
|
21
|
+
function addValuesForElement( element, ...args ) {
|
|
22
|
+
if ( null === element || undefined === element || false === element ) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if ( Array.isArray( element ) ) {
|
|
27
|
+
return addValuesForElements( element, ...args );
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
switch ( typeof element ) {
|
|
31
|
+
case 'string':
|
|
32
|
+
case 'number':
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { type, props } = element;
|
|
37
|
+
|
|
38
|
+
switch ( type ) {
|
|
39
|
+
case StrictMode:
|
|
40
|
+
case Fragment:
|
|
41
|
+
return addValuesForElements( props.children, ...args );
|
|
42
|
+
case RawHTML:
|
|
43
|
+
return;
|
|
44
|
+
case InnerBlocks.Content:
|
|
45
|
+
return addValuesForBlocks( ...args );
|
|
46
|
+
case Content:
|
|
47
|
+
const [ values ] = args;
|
|
48
|
+
values.push( props.value );
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
switch ( typeof type ) {
|
|
53
|
+
case 'string':
|
|
54
|
+
if ( typeof props.children !== 'undefined' ) {
|
|
55
|
+
return addValuesForElements( props.children, ...args );
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
case 'function':
|
|
59
|
+
if (
|
|
60
|
+
type.prototype &&
|
|
61
|
+
typeof type.prototype.render === 'function'
|
|
62
|
+
) {
|
|
63
|
+
return addValuesForElement(
|
|
64
|
+
new type( props ).render(),
|
|
65
|
+
...args
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return addValuesForElement( type( props ), ...args );
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function addValuesForElements( children, ...args ) {
|
|
74
|
+
children = Array.isArray( children ) ? children : [ children ];
|
|
75
|
+
|
|
76
|
+
for ( let i = 0; i < children.length; i++ ) {
|
|
77
|
+
addValuesForElement( children[ i ], ...args );
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _getSaveElement( name, attributes, innerBlocks ) {
|
|
82
|
+
return getSaveElement(
|
|
83
|
+
name,
|
|
84
|
+
attributes,
|
|
85
|
+
innerBlocks.map( ( block ) =>
|
|
86
|
+
_getSaveElement( block.name, block.attributes, block.innerBlocks )
|
|
87
|
+
)
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function addValuesForBlocks( values, blocks ) {
|
|
92
|
+
for ( let i = 0; i < blocks.length; i++ ) {
|
|
93
|
+
const { name, attributes, innerBlocks } = blocks[ i ];
|
|
94
|
+
const saveElement = _getSaveElement( name, attributes, innerBlocks );
|
|
95
|
+
addValuesForElement( saveElement, values, innerBlocks );
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function getRichTextValues( blocks = [] ) {
|
|
100
|
+
getBlockProps.skipFilters = true;
|
|
101
|
+
const values = [];
|
|
102
|
+
addValuesForBlocks( values, blocks );
|
|
103
|
+
getBlockProps.skipFilters = false;
|
|
104
|
+
return values;
|
|
105
|
+
}
|