@wordpress/block-editor 12.4.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 +4 -0
- package/README.md +1 -0
- 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-heading-level-dropdown/heading-level-icon.js +10 -2
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build/components/block-heading-level-dropdown/index.native.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-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.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 +8 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +15 -25
- 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} +10 -11
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build/components/block-toolbar/index.js +12 -8
- 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-tools/block-contextual-toolbar.js +7 -11
- package/build/components/block-tools/block-contextual-toolbar.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/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/global-styles/color-panel.js +22 -16
- 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/filters-panel.js +1 -1
- package/build/components/global-styles/filters-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 +15 -25
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +52 -5
- 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/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +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/block-patterns-explorer/patterns-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +7 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +9 -3
- 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/media-tab/hooks.js +2 -21
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +82 -0
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build/components/inserter/reusable-blocks-tab.js +6 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +9 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/link-control/constants.js +1 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/index.js +21 -16
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +5 -21
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -4
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +13 -30
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/appender.js +2 -6
- package/build/components/list-view/appender.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/provider/index.js +5 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- 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/url-input/index.js +4 -2
- package/build/components/url-input/index.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/components/writing-flow/use-tab-nav.js +10 -27
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +70 -0
- package/build/components/writing-mode-control/index.js.map +1 -0
- package/build/hooks/behaviors.js +25 -20
- package/build/hooks/behaviors.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/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +5 -9
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +16 -3
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -0
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +196 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +10 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +46 -40
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +8 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +22 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +52 -23
- 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-heading-level-dropdown/heading-level-icon.js +9 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build-module/components/block-heading-level-dropdown/index.native.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-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.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 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +17 -24
- 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} +13 -13
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +12 -8
- 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-tools/block-contextual-toolbar.js +8 -11
- package/build-module/components/block-tools/block-contextual-toolbar.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/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +22 -16
- 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/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-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 +14 -24
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +51 -5
- 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/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +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/block-patterns-explorer/patterns-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +7 -33
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
- 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/media-tab/hooks.js +2 -21
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +67 -0
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +9 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/link-control/constants.js +1 -1
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/index.js +21 -16
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +7 -20
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -4
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +14 -28
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -6
- package/build-module/components/list-view/appender.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/provider/index.js +5 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- 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/url-input/index.js +4 -2
- package/build-module/components/url-input/index.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/components/writing-flow/use-tab-nav.js +8 -26
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +57 -0
- package/build-module/components/writing-mode-control/index.js.map +1 -0
- package/build-module/hooks/behaviors.js +26 -20
- package/build-module/hooks/behaviors.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/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +6 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +11 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +2 -0
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +193 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +10 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +45 -36
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +5 -5
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -9
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +49 -21
- 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 +4 -0
- package/build-style/content.css +4 -0
- package/build-style/style-rtl.css +137 -129
- package/build-style/style.css +137 -129
- package/package.json +33 -32
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- 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/style.scss +1 -0
- 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-heading-level-dropdown/heading-level-icon.js +6 -1
- package/src/components/block-heading-level-dropdown/index.native.js +8 -4
- package/src/components/block-inspector/style.scss +2 -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-lock/toolbar.js +34 -6
- 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-parent-selector/index.js +13 -8
- package/src/components/block-removal-warning-modal/index.js +17 -33
- 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} +19 -18
- package/src/components/block-toolbar/index.js +11 -9
- 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-tools/block-contextual-toolbar.js +5 -11
- package/src/components/block-tools/style.scss +73 -26
- 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/default-block-appender/content.scss +11 -0
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/font-family/README.md +71 -0
- package/src/components/global-styles/color-panel.js +24 -17
- package/src/components/global-styles/dimensions-panel.js +8 -2
- package/src/components/global-styles/filters-panel.js +2 -2
- package/src/components/global-styles/get-block-css-selector.js +5 -9
- package/src/components/global-styles/hooks.js +22 -26
- package/src/components/global-styles/typography-panel.js +57 -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/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/index.js +1 -0
- 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/block-patterns-explorer/patterns-list.js +8 -2
- package/src/components/inserter/block-patterns-tab.js +8 -56
- package/src/components/inserter/hooks/use-block-types-state.js +3 -4
- package/src/components/inserter/hooks/use-patterns-state.js +35 -19
- package/src/components/inserter/index.js +2 -3
- package/src/components/inserter/index.native.js +17 -36
- package/src/components/inserter/media-tab/hooks.js +2 -22
- package/src/components/inserter/reusable-block-rename-hint.js +69 -0
- package/src/components/inserter/reusable-blocks-tab.js +5 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/inserter/style.scss +28 -0
- package/src/components/inserter/tabs.native.js +5 -1
- package/src/components/inserter-draggable-blocks/index.js +13 -2
- package/src/components/link-control/constants.js +1 -1
- package/src/components/link-control/index.js +36 -29
- package/src/components/link-control/search-create-button.js +8 -26
- package/src/components/link-control/search-input.js +4 -3
- package/src/components/link-control/search-item.js +21 -43
- package/src/components/link-control/search-results.js +48 -46
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +58 -123
- package/src/components/link-control/test/index.js +161 -123
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/style.scss +1 -2
- 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/media-replace-flow/test/index.js +1 -1
- package/src/components/panel-color-settings/README.md +98 -0
- package/src/components/preview-options/README.md +18 -17
- package/src/components/preview-options/index.js +2 -2
- package/src/components/provider/index.js +9 -2
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/recursion-provider/README.md +101 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- 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/url-input/index.js +2 -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/components/writing-flow/use-tab-nav.js +10 -33
- package/src/components/writing-mode-control/index.js +68 -0
- package/src/components/writing-mode-control/style.scss +18 -0
- package/src/hooks/behaviors.js +25 -16
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/supports.js +7 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/utils.js +8 -7
- package/src/private-apis.js +13 -1
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +195 -3
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +10 -0
- package/src/store/private-actions.js +39 -39
- package/src/store/private-selectors.js +5 -8
- package/src/store/reducer.js +22 -9
- package/src/store/selectors.js +87 -25
- package/src/store/test/actions.js +114 -0
- package/src/store/test/private-actions.js +56 -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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# RecursionProvider
|
|
2
|
+
|
|
3
|
+
According to Gutenberg's block rendering architecture, any block type capable of recursion should be responsible for handling its own infinite loops.
|
|
4
|
+
|
|
5
|
+
To help with detecting infinite loops on the client, the `RecursionProvider` component and the `useHasRecursion()` hook are used to identify if a block has already been rendered.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
/**
|
|
11
|
+
* WordPress dependencies
|
|
12
|
+
*/
|
|
13
|
+
import {
|
|
14
|
+
__experimentalRecursionProvider as RecursionProvider,
|
|
15
|
+
__experimentalUseHasRecursion as useHasRecursion,
|
|
16
|
+
useBlockProps,
|
|
17
|
+
Warning,
|
|
18
|
+
} from '@wordpress/block-editor';
|
|
19
|
+
import { __ } from '@wordpress/i18n';
|
|
20
|
+
|
|
21
|
+
export default function MyRecursiveBlockEdit( { attributes: { ref } } ) {
|
|
22
|
+
const hasAlreadyRendered = useHasRecursion( ref );
|
|
23
|
+
const blockProps = useBlockProps( {
|
|
24
|
+
className: 'my-block__custom-class',
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
if ( hasAlreadyRendered ) {
|
|
28
|
+
return (
|
|
29
|
+
<div { ...blockProps }>
|
|
30
|
+
<Warning>
|
|
31
|
+
{ __( 'Block cannot be rendered inside itself.' ) }
|
|
32
|
+
</Warning>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<RecursionProvider uniqueId={ ref }>
|
|
39
|
+
Block editing code here....
|
|
40
|
+
</RecursionProvider>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// ...
|
|
45
|
+
|
|
46
|
+
<MyRecursiveBlockEdit />;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Props
|
|
50
|
+
|
|
51
|
+
The component accepts the following props:
|
|
52
|
+
|
|
53
|
+
### uniqueId
|
|
54
|
+
|
|
55
|
+
Any value that acts as a unique identifier for a block instance.
|
|
56
|
+
|
|
57
|
+
- Type: `any`
|
|
58
|
+
- Required: Yes
|
|
59
|
+
|
|
60
|
+
### children
|
|
61
|
+
|
|
62
|
+
Components to be rendered as content.
|
|
63
|
+
|
|
64
|
+
- Type: `Element`
|
|
65
|
+
- Required: Yes.
|
|
66
|
+
|
|
67
|
+
### blockName
|
|
68
|
+
|
|
69
|
+
Optional block name.
|
|
70
|
+
|
|
71
|
+
- Type: `String`
|
|
72
|
+
- Required: No
|
|
73
|
+
- Default: ''
|
|
74
|
+
|
|
75
|
+
# `useHasRecursion()`
|
|
76
|
+
|
|
77
|
+
Used in conjunction with `RecursionProvider`, this hook is used to identify if a block has already been rendered.
|
|
78
|
+
|
|
79
|
+
## Usage
|
|
80
|
+
|
|
81
|
+
For example usage, refer to the example above.
|
|
82
|
+
|
|
83
|
+
## Props
|
|
84
|
+
|
|
85
|
+
The component accepts the following props:
|
|
86
|
+
|
|
87
|
+
### uniqueId
|
|
88
|
+
|
|
89
|
+
Any value that acts as a unique identifier for a block instance.
|
|
90
|
+
|
|
91
|
+
- Type: `any`
|
|
92
|
+
- Required: Yes
|
|
93
|
+
|
|
94
|
+
### blockName
|
|
95
|
+
|
|
96
|
+
Optional block name.
|
|
97
|
+
|
|
98
|
+
- Type: `String`
|
|
99
|
+
- Required: No
|
|
100
|
+
- Default: ''
|
|
101
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
SelectControl,
|
|
6
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import { __, _x } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_SIZE_OPTIONS = [
|
|
11
|
+
{
|
|
12
|
+
label: _x( 'Thumbnail', 'Image size option for resolution control' ),
|
|
13
|
+
value: 'thumbnail',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: _x( 'Medium', 'Image size option for resolution control' ),
|
|
17
|
+
value: 'medium',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: _x( 'Large', 'Image size option for resolution control' ),
|
|
21
|
+
value: 'large',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: _x( 'Full Size', 'Image size option for resolution control' ),
|
|
25
|
+
value: 'full',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export default function ResolutionTool( {
|
|
30
|
+
panelId,
|
|
31
|
+
value,
|
|
32
|
+
onChange,
|
|
33
|
+
options = DEFAULT_SIZE_OPTIONS,
|
|
34
|
+
defaultValue = DEFAULT_SIZE_OPTIONS[ 0 ].value,
|
|
35
|
+
isShownByDefault = true,
|
|
36
|
+
} ) {
|
|
37
|
+
const displayValue = value ?? defaultValue;
|
|
38
|
+
return (
|
|
39
|
+
<ToolsPanelItem
|
|
40
|
+
hasValue={ () => displayValue !== defaultValue }
|
|
41
|
+
label={ __( 'Resolution' ) }
|
|
42
|
+
onDeselect={ () => onChange( defaultValue ) }
|
|
43
|
+
isShownByDefault={ isShownByDefault }
|
|
44
|
+
panelId={ panelId }
|
|
45
|
+
>
|
|
46
|
+
<SelectControl
|
|
47
|
+
label={ __( 'Resolution' ) }
|
|
48
|
+
value={ displayValue }
|
|
49
|
+
options={ options }
|
|
50
|
+
onChange={ onChange }
|
|
51
|
+
help={ __( 'Select the size of the source image.' ) }
|
|
52
|
+
size={ '__unstable-large' }
|
|
53
|
+
/>
|
|
54
|
+
</ToolsPanelItem>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
import {
|
|
6
|
+
Panel,
|
|
7
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import ResolutionTool from '..';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'BlockEditor (Private APIs)/ResolutionControl',
|
|
17
|
+
component: ResolutionTool,
|
|
18
|
+
argTypes: {
|
|
19
|
+
panelId: { control: { type: null } },
|
|
20
|
+
onChange: { action: 'changed' },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Default = ( { panelId, onChange: onChangeProp, ...props } ) => {
|
|
25
|
+
const [ resolution, setResolution ] = useState( undefined );
|
|
26
|
+
const resetAll = () => {
|
|
27
|
+
setResolution( undefined );
|
|
28
|
+
onChangeProp( undefined );
|
|
29
|
+
};
|
|
30
|
+
return (
|
|
31
|
+
<Panel>
|
|
32
|
+
<ToolsPanel panelId={ panelId } resetAll={ resetAll }>
|
|
33
|
+
<ResolutionTool
|
|
34
|
+
panelId={ panelId }
|
|
35
|
+
onChange={ ( newValue ) => {
|
|
36
|
+
setResolution( newValue );
|
|
37
|
+
onChangeProp( newValue );
|
|
38
|
+
} }
|
|
39
|
+
value={ resolution }
|
|
40
|
+
{ ...props }
|
|
41
|
+
/>
|
|
42
|
+
</ToolsPanel>
|
|
43
|
+
</Panel>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
Default.args = {
|
|
47
|
+
panelId: 'panel-id',
|
|
48
|
+
};
|
|
@@ -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
|
+
}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import SpacingInputControl from './spacing-input-control';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
LABELS,
|
|
7
|
+
ICONS,
|
|
8
|
+
getPresetValueFromCustomValue,
|
|
9
|
+
hasAxisSupport,
|
|
10
|
+
} from '../utils';
|
|
6
11
|
|
|
7
12
|
const groupedSides = [ 'vertical', 'horizontal' ];
|
|
8
13
|
|
|
@@ -20,7 +25,17 @@ export default function AxialInputControls( {
|
|
|
20
25
|
if ( ! onChange ) {
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
23
|
-
|
|
28
|
+
|
|
29
|
+
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
|
|
30
|
+
const nextValues = {
|
|
31
|
+
...Object.keys( values ).reduce( ( acc, key ) => {
|
|
32
|
+
acc[ key ] = getPresetValueFromCustomValue(
|
|
33
|
+
values[ key ],
|
|
34
|
+
spacingSizes
|
|
35
|
+
);
|
|
36
|
+
return acc;
|
|
37
|
+
}, {} ),
|
|
38
|
+
};
|
|
24
39
|
|
|
25
40
|
if ( side === 'vertical' ) {
|
|
26
41
|
nextValues.top = next;
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import SpacingInputControl from './spacing-input-control';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
ALL_SIDES,
|
|
7
|
+
LABELS,
|
|
8
|
+
ICONS,
|
|
9
|
+
getPresetValueFromCustomValue,
|
|
10
|
+
} from '../utils';
|
|
6
11
|
|
|
7
12
|
export default function SeparatedInputControls( {
|
|
8
13
|
minimumCustomValue,
|
|
@@ -20,7 +25,17 @@ export default function SeparatedInputControls( {
|
|
|
20
25
|
: ALL_SIDES;
|
|
21
26
|
|
|
22
27
|
const createHandleOnChange = ( side ) => ( next ) => {
|
|
23
|
-
|
|
28
|
+
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
|
|
29
|
+
const nextValues = {
|
|
30
|
+
...Object.keys( values ).reduce( ( acc, key ) => {
|
|
31
|
+
acc[ key ] = getPresetValueFromCustomValue(
|
|
32
|
+
values[ key ],
|
|
33
|
+
spacingSizes
|
|
34
|
+
);
|
|
35
|
+
return acc;
|
|
36
|
+
}, {} ),
|
|
37
|
+
};
|
|
38
|
+
|
|
24
39
|
nextValues[ side ] = next;
|
|
25
40
|
|
|
26
41
|
onChange( nextValues );
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import SpacingInputControl from './spacing-input-control';
|
|
5
|
-
import { LABELS } from '../utils';
|
|
5
|
+
import { LABELS, getPresetValueFromCustomValue } from '../utils';
|
|
6
6
|
|
|
7
7
|
export default function SingleInputControl( {
|
|
8
8
|
minimumCustomValue,
|
|
@@ -16,7 +16,17 @@ export default function SingleInputControl( {
|
|
|
16
16
|
values,
|
|
17
17
|
} ) {
|
|
18
18
|
const createHandleOnChange = ( currentSide ) => ( next ) => {
|
|
19
|
-
|
|
19
|
+
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
|
|
20
|
+
const nextValues = {
|
|
21
|
+
...Object.keys( values ).reduce( ( acc, key ) => {
|
|
22
|
+
acc[ key ] = getPresetValueFromCustomValue(
|
|
23
|
+
values[ key ],
|
|
24
|
+
spacingSizes
|
|
25
|
+
);
|
|
26
|
+
return acc;
|
|
27
|
+
}, {} ),
|
|
28
|
+
};
|
|
29
|
+
|
|
20
30
|
nextValues[ currentSide ] = next;
|
|
21
31
|
|
|
22
32
|
onChange( nextValues );
|
|
@@ -102,7 +102,7 @@ export function getCustomValueFromPreset( value, spacingSizes ) {
|
|
|
102
102
|
*/
|
|
103
103
|
export function getPresetValueFromCustomValue( value, spacingSizes ) {
|
|
104
104
|
// Return value as-is if it is already a preset;
|
|
105
|
-
if ( isValueSpacingPreset( value ) ) {
|
|
105
|
+
if ( isValueSpacingPreset( value ) || value === '0' ) {
|
|
106
106
|
return value;
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# TextTransformControl
|
|
2
|
+
|
|
3
|
+
The `TextTransformControl` component is responsible for rendering a control element that allows users to select and apply text transformation options to blocks or elements in the Gutenberg editor. It provides an intuitive interface for changing the text appearance by applying different transformations such as `none`, `uppercase`, `lowercase`, `capitalize`.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Table of contents
|
|
8
|
+
|
|
9
|
+
1. [Development guidelines](#development-guidelines)
|
|
10
|
+
|
|
11
|
+
## Development guidelines
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
Renders the Text Transform Component with `none`, `uppercase`, `lowercase`, `capitalize` options.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
import { TextTransformControl } from '@wordpress/block-editor';
|
|
19
|
+
|
|
20
|
+
const MyTextTransformControlComponent = () => (
|
|
21
|
+
<TextTransformControl
|
|
22
|
+
value={ textTransform }
|
|
23
|
+
onChange={ ( value ) => {
|
|
24
|
+
setAttributes( { textTransform: value } );
|
|
25
|
+
} }
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Props
|
|
31
|
+
|
|
32
|
+
### `value`
|
|
33
|
+
|
|
34
|
+
- **Type:** `String`
|
|
35
|
+
- **Default:** `none`
|
|
36
|
+
- **Options:** `none`, `uppercase`, `lowercase`, `capitalize`
|
|
37
|
+
|
|
38
|
+
The current value of the Text Transform setting. You may only choose from the `Options` listed above.
|
|
39
|
+
|
|
40
|
+
### `onChange`
|
|
41
|
+
|
|
42
|
+
- **Type:** `Function`
|
|
43
|
+
|
|
44
|
+
A callback function invoked when the Text Transform value is changed via an interaction with any of the buttons. Called with the Text Transform value (`none`, `uppercase`, `lowercase`, `capitalize`) as the only argument.
|
|
@@ -434,6 +434,7 @@ class URLInput extends Component {
|
|
|
434
434
|
placeholder = __( 'Paste URL or type to search' ),
|
|
435
435
|
__experimentalRenderControl: renderControl,
|
|
436
436
|
value = '',
|
|
437
|
+
hideLabelFromVision = false,
|
|
437
438
|
} = this.props;
|
|
438
439
|
|
|
439
440
|
const {
|
|
@@ -452,6 +453,7 @@ class URLInput extends Component {
|
|
|
452
453
|
className: classnames( 'block-editor-url-input', className, {
|
|
453
454
|
'is-full-width': isFullWidth,
|
|
454
455
|
} ),
|
|
456
|
+
hideLabelFromVision,
|
|
455
457
|
};
|
|
456
458
|
|
|
457
459
|
const inputProps = {
|
|
@@ -67,8 +67,11 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
67
67
|
return useSelect(
|
|
68
68
|
( select ) => {
|
|
69
69
|
if ( ! clientId ) return null;
|
|
70
|
-
const {
|
|
71
|
-
|
|
70
|
+
const {
|
|
71
|
+
getBlockName,
|
|
72
|
+
getBlockAttributes,
|
|
73
|
+
__experimentalGetReusableBlockTitle,
|
|
74
|
+
} = select( blockEditorStore );
|
|
72
75
|
const { getBlockType, getActiveBlockVariation } =
|
|
73
76
|
select( blocksStore );
|
|
74
77
|
const blockName = getBlockName( clientId );
|
|
@@ -76,12 +79,16 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
76
79
|
if ( ! blockType ) return null;
|
|
77
80
|
const attributes = getBlockAttributes( clientId );
|
|
78
81
|
const match = getActiveBlockVariation( blockName, attributes );
|
|
79
|
-
const
|
|
80
|
-
|
|
82
|
+
const isReusable = isReusableBlock( blockType );
|
|
83
|
+
const resusableTitle = isReusable
|
|
84
|
+
? __experimentalGetReusableBlockTitle( attributes.ref )
|
|
85
|
+
: undefined;
|
|
86
|
+
const title = resusableTitle || blockType.title;
|
|
87
|
+
const isSynced = isReusable || isTemplatePart( blockType );
|
|
81
88
|
const positionLabel = getPositionTypeLabel( attributes );
|
|
82
89
|
const blockTypeInfo = {
|
|
83
90
|
isSynced,
|
|
84
|
-
title
|
|
91
|
+
title,
|
|
85
92
|
icon: blockType.icon,
|
|
86
93
|
description: blockType.description,
|
|
87
94
|
anchor: attributes?.anchor,
|