@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
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get, set } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -32,7 +27,11 @@ import { PresetDuotoneFilter } from '../duotone/components';
|
|
|
32
27
|
import { getGapCSSValue } from '../../hooks/gap';
|
|
33
28
|
import { store as blockEditorStore } from '../../store';
|
|
34
29
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
35
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
getValueFromObjectPath,
|
|
32
|
+
kebabCase,
|
|
33
|
+
setImmutably,
|
|
34
|
+
} from '../../utils/object';
|
|
36
35
|
|
|
37
36
|
// List of block support features that can have their related styles
|
|
38
37
|
// generated under their own feature level selector rather than the block's.
|
|
@@ -69,7 +68,11 @@ function compileStyleValue( uncompiledValue ) {
|
|
|
69
68
|
function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
|
|
70
69
|
return PRESET_METADATA.reduce(
|
|
71
70
|
( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {
|
|
72
|
-
const presetByOrigin =
|
|
71
|
+
const presetByOrigin = getValueFromObjectPath(
|
|
72
|
+
blockPresets,
|
|
73
|
+
path,
|
|
74
|
+
[]
|
|
75
|
+
);
|
|
73
76
|
[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
|
|
74
77
|
if ( presetByOrigin[ origin ] ) {
|
|
75
78
|
presetByOrigin[ origin ].forEach( ( value ) => {
|
|
@@ -113,7 +116,11 @@ function getPresetsClasses( blockSelector = '*', blockPresets = {} ) {
|
|
|
113
116
|
return declarations;
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
const presetByOrigin =
|
|
119
|
+
const presetByOrigin = getValueFromObjectPath(
|
|
120
|
+
blockPresets,
|
|
121
|
+
path,
|
|
122
|
+
[]
|
|
123
|
+
);
|
|
117
124
|
[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
|
|
118
125
|
if ( presetByOrigin[ origin ] ) {
|
|
119
126
|
presetByOrigin[ origin ].forEach( ( { slug } ) => {
|
|
@@ -147,7 +154,11 @@ function getPresetsSvgFilters( blockPresets = {} ) {
|
|
|
147
154
|
// Duotone are the only type of filters for now.
|
|
148
155
|
( metadata ) => metadata.path.at( -1 ) === 'duotone'
|
|
149
156
|
).flatMap( ( metadata ) => {
|
|
150
|
-
const presetByOrigin =
|
|
157
|
+
const presetByOrigin = getValueFromObjectPath(
|
|
158
|
+
blockPresets,
|
|
159
|
+
metadata.path,
|
|
160
|
+
{}
|
|
161
|
+
);
|
|
151
162
|
return [ 'default', 'theme' ]
|
|
152
163
|
.filter( ( origin ) => presetByOrigin[ origin ] )
|
|
153
164
|
.flatMap( ( origin ) =>
|
|
@@ -319,7 +330,10 @@ export function getStylesDeclarations(
|
|
|
319
330
|
return declarations;
|
|
320
331
|
}
|
|
321
332
|
|
|
322
|
-
const styleValue =
|
|
333
|
+
const styleValue = getValueFromObjectPath(
|
|
334
|
+
blockStyles,
|
|
335
|
+
pathToValue
|
|
336
|
+
);
|
|
323
337
|
|
|
324
338
|
// Root-level padding styles don't currently support strings with CSS shorthand values.
|
|
325
339
|
// This may change: https://github.com/WordPress/gutenberg/issues/40132.
|
|
@@ -334,7 +348,9 @@ export function getStylesDeclarations(
|
|
|
334
348
|
Object.entries( properties ).forEach( ( entry ) => {
|
|
335
349
|
const [ name, prop ] = entry;
|
|
336
350
|
|
|
337
|
-
if (
|
|
351
|
+
if (
|
|
352
|
+
! getValueFromObjectPath( styleValue, [ prop ], false )
|
|
353
|
+
) {
|
|
338
354
|
// Do not create a declaration
|
|
339
355
|
// for sub-properties that don't have any value.
|
|
340
356
|
return;
|
|
@@ -345,17 +361,19 @@ export function getStylesDeclarations(
|
|
|
345
361
|
: kebabCase( name );
|
|
346
362
|
declarations.push(
|
|
347
363
|
`${ cssProperty }: ${ compileStyleValue(
|
|
348
|
-
|
|
364
|
+
getValueFromObjectPath( styleValue, [ prop ] )
|
|
349
365
|
) }`
|
|
350
366
|
);
|
|
351
367
|
} );
|
|
352
|
-
} else if (
|
|
368
|
+
} else if (
|
|
369
|
+
getValueFromObjectPath( blockStyles, pathToValue, false )
|
|
370
|
+
) {
|
|
353
371
|
const cssProperty = key.startsWith( '--' )
|
|
354
372
|
? key
|
|
355
373
|
: kebabCase( key );
|
|
356
374
|
declarations.push(
|
|
357
375
|
`${ cssProperty }: ${ compileStyleValue(
|
|
358
|
-
|
|
376
|
+
getValueFromObjectPath( blockStyles, pathToValue )
|
|
359
377
|
) }`
|
|
360
378
|
);
|
|
361
379
|
}
|
|
@@ -384,7 +402,7 @@ export function getStylesDeclarations(
|
|
|
384
402
|
let ruleValue = rule.value;
|
|
385
403
|
if ( typeof ruleValue !== 'string' && ruleValue?.ref ) {
|
|
386
404
|
const refPath = ruleValue.ref.split( '.' );
|
|
387
|
-
ruleValue =
|
|
405
|
+
ruleValue = getValueFromObjectPath( tree, refPath );
|
|
388
406
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
389
407
|
// Pointing to another dynamic value is not supported.
|
|
390
408
|
if ( ! ruleValue || ruleValue?.ref ) {
|
|
@@ -678,11 +696,11 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
678
696
|
}
|
|
679
697
|
|
|
680
698
|
const pickPresets = ( treeToPickFrom ) => {
|
|
681
|
-
|
|
699
|
+
let presets = {};
|
|
682
700
|
PRESET_METADATA.forEach( ( { path } ) => {
|
|
683
|
-
const value =
|
|
701
|
+
const value = getValueFromObjectPath( treeToPickFrom, path, false );
|
|
684
702
|
if ( value !== false ) {
|
|
685
|
-
|
|
703
|
+
presets = setImmutably( presets, path, value );
|
|
686
704
|
}
|
|
687
705
|
} );
|
|
688
706
|
return presets;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
getTypographyFontSizeValue,
|
|
12
11
|
getFluidTypographyOptionsFromSettings,
|
|
13
12
|
} from './typography-utils';
|
|
13
|
+
import { getValueFromObjectPath } from '../../utils/object';
|
|
14
14
|
|
|
15
15
|
/* Supporting data. */
|
|
16
16
|
export const ROOT_BLOCK_NAME = 'root';
|
|
@@ -168,8 +168,12 @@ function findInPresetsBy(
|
|
|
168
168
|
) {
|
|
169
169
|
// Block presets take priority above root level presets.
|
|
170
170
|
const orderedPresetsByOrigin = [
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
getValueFromObjectPath( features, [
|
|
172
|
+
'blocks',
|
|
173
|
+
blockName,
|
|
174
|
+
...presetPath,
|
|
175
|
+
] ),
|
|
176
|
+
getValueFromObjectPath( features, presetPath ),
|
|
173
177
|
];
|
|
174
178
|
|
|
175
179
|
for ( const presetByOrigin of orderedPresetsByOrigin ) {
|
|
@@ -282,8 +286,13 @@ function getValueFromPresetVariable(
|
|
|
282
286
|
|
|
283
287
|
function getValueFromCustomVariable( features, blockName, variable, path ) {
|
|
284
288
|
const result =
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
getValueFromObjectPath( features.settings, [
|
|
290
|
+
'blocks',
|
|
291
|
+
blockName,
|
|
292
|
+
'custom',
|
|
293
|
+
...path,
|
|
294
|
+
] ) ??
|
|
295
|
+
getValueFromObjectPath( features.settings, [ 'custom', ...path ] );
|
|
287
296
|
if ( ! result ) {
|
|
288
297
|
return variable;
|
|
289
298
|
}
|
|
@@ -303,7 +312,7 @@ export function getValueFromVariable( features, blockName, variable ) {
|
|
|
303
312
|
if ( ! variable || typeof variable !== 'string' ) {
|
|
304
313
|
if ( variable?.ref && typeof variable?.ref === 'string' ) {
|
|
305
314
|
const refPath = variable.ref.split( '.' );
|
|
306
|
-
variable =
|
|
315
|
+
variable = getValueFromObjectPath( features, refPath );
|
|
307
316
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
308
317
|
// Pointing to another dynamic value is not supported.
|
|
309
318
|
if ( ! variable || !! variable?.ref ) {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
createPortal,
|
|
12
12
|
forwardRef,
|
|
13
13
|
useMemo,
|
|
14
|
-
useReducer,
|
|
15
14
|
useEffect,
|
|
16
15
|
} from '@wordpress/element';
|
|
17
16
|
import { __ } from '@wordpress/i18n';
|
|
@@ -78,29 +77,6 @@ function bubbleEvents( doc ) {
|
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
function useParsedAssets( html ) {
|
|
82
|
-
return useMemo( () => {
|
|
83
|
-
const doc = document.implementation.createHTMLDocument( '' );
|
|
84
|
-
doc.body.innerHTML = html;
|
|
85
|
-
return Array.from( doc.body.children );
|
|
86
|
-
}, [ html ] );
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async function loadScript( head, { id, src } ) {
|
|
90
|
-
return new Promise( ( resolve, reject ) => {
|
|
91
|
-
const script = head.ownerDocument.createElement( 'script' );
|
|
92
|
-
script.id = id;
|
|
93
|
-
if ( src ) {
|
|
94
|
-
script.src = src;
|
|
95
|
-
script.onload = () => resolve();
|
|
96
|
-
script.onerror = () => reject();
|
|
97
|
-
} else {
|
|
98
|
-
resolve();
|
|
99
|
-
}
|
|
100
|
-
head.appendChild( script );
|
|
101
|
-
} );
|
|
102
|
-
}
|
|
103
|
-
|
|
104
80
|
function Iframe( {
|
|
105
81
|
contentRef,
|
|
106
82
|
children,
|
|
@@ -112,21 +88,25 @@ function Iframe( {
|
|
|
112
88
|
forwardedRef: ref,
|
|
113
89
|
...props
|
|
114
90
|
} ) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
91
|
+
const { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {
|
|
92
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
93
|
+
return {
|
|
94
|
+
resolvedAssets: settings.__unstableResolvedAssets,
|
|
95
|
+
isPreviewMode: settings.__unstableIsPreviewMode,
|
|
96
|
+
};
|
|
97
|
+
}, [] );
|
|
98
|
+
const { styles = '', scripts = '' } = resolvedAssets;
|
|
121
99
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
122
100
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
123
101
|
const compatStyles = useCompatibilityStyles();
|
|
124
|
-
const scripts = useParsedAssets( assets?.scripts );
|
|
125
102
|
const clearerRef = useBlockSelectionClearer();
|
|
126
103
|
const [ before, writingFlowRef, after ] = useWritingFlow();
|
|
127
104
|
const [ contentResizeListener, { height: contentHeight } ] =
|
|
128
105
|
useResizeObserver();
|
|
129
106
|
const setRef = useRefEffect( ( node ) => {
|
|
107
|
+
node._load = () => {
|
|
108
|
+
setIframeDocument( node.contentDocument );
|
|
109
|
+
};
|
|
130
110
|
let iFrameDocument;
|
|
131
111
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
132
112
|
function preventFileDropDefault( event ) {
|
|
@@ -138,7 +118,6 @@ function Iframe( {
|
|
|
138
118
|
iFrameDocument = contentDocument;
|
|
139
119
|
|
|
140
120
|
bubbleEvents( contentDocument );
|
|
141
|
-
setIframeDocument( contentDocument );
|
|
142
121
|
clearerRef( documentElement );
|
|
143
122
|
|
|
144
123
|
// Ideally ALL classes that are added through get_body_class should
|
|
@@ -154,7 +133,6 @@ function Iframe( {
|
|
|
154
133
|
);
|
|
155
134
|
|
|
156
135
|
contentDocument.dir = ownerDocument.dir;
|
|
157
|
-
documentElement.removeChild( contentDocument.body );
|
|
158
136
|
|
|
159
137
|
for ( const compatStyle of compatStyles ) {
|
|
160
138
|
if ( contentDocument.getElementById( compatStyle.id ) ) {
|
|
@@ -165,11 +143,13 @@ function Iframe( {
|
|
|
165
143
|
compatStyle.cloneNode( true )
|
|
166
144
|
);
|
|
167
145
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
146
|
+
if ( ! isPreviewMode ) {
|
|
147
|
+
// eslint-disable-next-line no-console
|
|
148
|
+
console.warn(
|
|
149
|
+
`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,
|
|
150
|
+
compatStyle
|
|
151
|
+
);
|
|
152
|
+
}
|
|
173
153
|
}
|
|
174
154
|
|
|
175
155
|
iFrameDocument.addEventListener(
|
|
@@ -199,35 +179,29 @@ function Iframe( {
|
|
|
199
179
|
};
|
|
200
180
|
}, [] );
|
|
201
181
|
|
|
202
|
-
const headRef = useRefEffect( ( element ) => {
|
|
203
|
-
scripts
|
|
204
|
-
.reduce(
|
|
205
|
-
( promise, script ) =>
|
|
206
|
-
promise.then( () => loadScript( element, script ) ),
|
|
207
|
-
Promise.resolve()
|
|
208
|
-
)
|
|
209
|
-
.finally( () => {
|
|
210
|
-
// When script are loaded, re-render blocks to allow them
|
|
211
|
-
// to initialise.
|
|
212
|
-
forceRender();
|
|
213
|
-
} );
|
|
214
|
-
}, [] );
|
|
215
182
|
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
216
183
|
const bodyRef = useMergeRefs( [
|
|
217
184
|
contentRef,
|
|
218
185
|
clearerRef,
|
|
219
186
|
writingFlowRef,
|
|
220
187
|
disabledRef,
|
|
221
|
-
headRef,
|
|
222
188
|
] );
|
|
223
189
|
|
|
224
190
|
// Correct doctype is required to enable rendering in standards
|
|
225
191
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
226
192
|
// content.
|
|
227
|
-
const html =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(
|
|
193
|
+
const html = `<!doctype html>
|
|
194
|
+
<html>
|
|
195
|
+
<head>
|
|
196
|
+
<script>window.frameElement._load()</script>
|
|
197
|
+
<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>
|
|
198
|
+
${ styles }
|
|
199
|
+
${ scripts }
|
|
200
|
+
</head>
|
|
201
|
+
<body>
|
|
202
|
+
<script>document.currentScript.parentElement.remove()</script>
|
|
203
|
+
</body>
|
|
204
|
+
</html>`;
|
|
231
205
|
|
|
232
206
|
const [ src, cleanup ] = useMemo( () => {
|
|
233
207
|
const _src = URL.createObjectURL(
|
|
@@ -45,6 +45,11 @@ export function useCompatibilityStyles() {
|
|
|
45
45
|
return accumulator;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
// Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.
|
|
49
|
+
if ( ! ownerNode.id ) {
|
|
50
|
+
return accumulator;
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
function matchFromRules( _cssRules ) {
|
|
49
54
|
return Array.from( _cssRules ).find(
|
|
50
55
|
( {
|
|
@@ -54,7 +54,7 @@ export default function AspectRatioDropdown( { toggleProps } ) {
|
|
|
54
54
|
} }
|
|
55
55
|
value={ aspect }
|
|
56
56
|
aspectRatios={ [
|
|
57
|
-
// All ratios should be mirrored in
|
|
57
|
+
// All ratios should be mirrored in AspectRatioTool in @wordpress/block-editor.
|
|
58
58
|
{
|
|
59
59
|
title: __( 'Original' ),
|
|
60
60
|
aspect: defaultAspect,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
__experimentalNumberControl as NumberControl,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
+
import deprecated from '@wordpress/deprecated';
|
|
11
12
|
import { __ } from '@wordpress/i18n';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -30,6 +31,11 @@ export default function ImageSizeControl( {
|
|
|
30
31
|
onChange,
|
|
31
32
|
onChangeImage = noop,
|
|
32
33
|
} ) {
|
|
34
|
+
deprecated( 'wp.blockEditor.__experimentalImageSizeControl', {
|
|
35
|
+
since: '6.3',
|
|
36
|
+
alternative:
|
|
37
|
+
'wp.blockEditor.privateApis.DimensionsTool and wp.blockEditor.privateApis.ResolutionTool',
|
|
38
|
+
} );
|
|
33
39
|
const { currentHeight, currentWidth, updateDimension, updateDimensions } =
|
|
34
40
|
useDimensionHandler( height, width, imageHeight, imageWidth, onChange );
|
|
35
41
|
|
package/src/components/index.js
CHANGED
|
@@ -50,6 +50,7 @@ export { default as __experimentalFontFamilyControl } from './font-family';
|
|
|
50
50
|
export { default as __experimentalLetterSpacingControl } from './letter-spacing-control';
|
|
51
51
|
export { default as __experimentalTextDecorationControl } from './text-decoration-control';
|
|
52
52
|
export { default as __experimentalTextTransformControl } from './text-transform-control';
|
|
53
|
+
export { default as __experimentalWritingModeControl } from './writing-mode-control';
|
|
53
54
|
export { default as __experimentalColorGradientControl } from './colors-gradients/control';
|
|
54
55
|
export { default as __experimentalColorGradientSettingsDropdown } from './colors-gradients/dropdown';
|
|
55
56
|
export { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';
|
|
@@ -185,3 +185,13 @@ For example, a button block, deeply nested in several levels of block `X` that u
|
|
|
185
185
|
|
|
186
186
|
- **Type:** `Array`
|
|
187
187
|
- **Default:** - `undefined`. Determines which block types should be shown in the block inserter. For example, when inserting a block within the Navigation block we specify `core/navigation-link` and `core/navigation-link/page` as these are the most commonly used inner blocks. `prioritizedInserterBlocks` takes an array of the form {blockName}/{variationName}, where {variationName} is optional.
|
|
188
|
+
|
|
189
|
+
### `defaultBlock`
|
|
190
|
+
|
|
191
|
+
- **Type:** `Array`
|
|
192
|
+
- **Default:** - `undefined`. Determines which block type should be inserted by default and any attributes that should be set by default when the block is inserted. Takes an array in the form of `[ blockname, {blockAttributes} ]`.
|
|
193
|
+
|
|
194
|
+
### `directInsert`
|
|
195
|
+
|
|
196
|
+
- **Type:** `Boolean`
|
|
197
|
+
- **Default:** - `undefined`. Determines whether the default block should be inserted directly into the InnerBlocks area by the block appender.
|
|
@@ -46,6 +46,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
46
46
|
clientId,
|
|
47
47
|
allowedBlocks,
|
|
48
48
|
prioritizedInserterBlocks,
|
|
49
|
+
defaultBlock,
|
|
50
|
+
directInsert,
|
|
49
51
|
__experimentalDefaultBlock,
|
|
50
52
|
__experimentalDirectInsert,
|
|
51
53
|
template,
|
|
@@ -64,6 +66,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
64
66
|
clientId,
|
|
65
67
|
allowedBlocks,
|
|
66
68
|
prioritizedInserterBlocks,
|
|
69
|
+
defaultBlock,
|
|
70
|
+
directInsert,
|
|
67
71
|
__experimentalDefaultBlock,
|
|
68
72
|
__experimentalDirectInsert,
|
|
69
73
|
templateLock,
|
|
@@ -73,6 +73,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
73
73
|
clientId,
|
|
74
74
|
allowedBlocks,
|
|
75
75
|
prioritizedInserterBlocks,
|
|
76
|
+
defaultBlock,
|
|
77
|
+
directInsert,
|
|
76
78
|
__experimentalDefaultBlock,
|
|
77
79
|
__experimentalDirectInsert,
|
|
78
80
|
template,
|
|
@@ -103,6 +105,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
103
105
|
clientId,
|
|
104
106
|
allowedBlocks,
|
|
105
107
|
prioritizedInserterBlocks,
|
|
108
|
+
defaultBlock,
|
|
109
|
+
directInsert,
|
|
106
110
|
__experimentalDefaultBlock,
|
|
107
111
|
__experimentalDirectInsert,
|
|
108
112
|
templateLock,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useLayoutEffect, useMemo } from '@wordpress/element';
|
|
5
5
|
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
6
|
+
import deprecated from '@wordpress/deprecated';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -25,9 +26,13 @@ const pendingSettingsUpdates = new WeakMap();
|
|
|
25
26
|
* @param {string[]} allowedBlocks An array of block names which are permitted
|
|
26
27
|
* in inner blocks.
|
|
27
28
|
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
|
|
28
|
-
* @param {?WPDirectInsertBlock}
|
|
29
|
-
* @param {?Function|boolean}
|
|
30
|
-
*
|
|
29
|
+
* @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
30
|
+
* @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.
|
|
31
|
+
*
|
|
32
|
+
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
|
|
33
|
+
*
|
|
34
|
+
* @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
|
|
35
|
+
*
|
|
31
36
|
* @param {string} [templateLock] The template lock specified for the inner
|
|
32
37
|
* blocks component. (e.g. "all")
|
|
33
38
|
* @param {boolean} captureToolbars Whether or children toolbars should be shown
|
|
@@ -41,6 +46,8 @@ export default function useNestedSettingsUpdate(
|
|
|
41
46
|
clientId,
|
|
42
47
|
allowedBlocks,
|
|
43
48
|
prioritizedInserterBlocks,
|
|
49
|
+
defaultBlock,
|
|
50
|
+
directInsert,
|
|
44
51
|
__experimentalDefaultBlock,
|
|
45
52
|
__experimentalDirectInsert,
|
|
46
53
|
templateLock,
|
|
@@ -108,11 +115,29 @@ export default function useNestedSettingsUpdate(
|
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
if ( __experimentalDefaultBlock !== undefined ) {
|
|
111
|
-
|
|
118
|
+
deprecated( '__experimentalDefaultBlock', {
|
|
119
|
+
alternative: 'defaultBlock',
|
|
120
|
+
since: '6.3',
|
|
121
|
+
version: '6.4',
|
|
122
|
+
} );
|
|
123
|
+
newSettings.defaultBlock = __experimentalDefaultBlock;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if ( defaultBlock !== undefined ) {
|
|
127
|
+
newSettings.defaultBlock = defaultBlock;
|
|
112
128
|
}
|
|
113
129
|
|
|
114
130
|
if ( __experimentalDirectInsert !== undefined ) {
|
|
115
|
-
|
|
131
|
+
deprecated( '__experimentalDirectInsert', {
|
|
132
|
+
alternative: 'directInsert',
|
|
133
|
+
since: '6.3',
|
|
134
|
+
version: '6.4',
|
|
135
|
+
} );
|
|
136
|
+
newSettings.directInsert = __experimentalDirectInsert;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if ( directInsert !== undefined ) {
|
|
140
|
+
newSettings.directInsert = directInsert;
|
|
116
141
|
}
|
|
117
142
|
|
|
118
143
|
// Batch updates to block list settings to avoid triggering cascading renders
|
|
@@ -144,6 +169,8 @@ export default function useNestedSettingsUpdate(
|
|
|
144
169
|
_allowedBlocks,
|
|
145
170
|
_prioritizedInserterBlocks,
|
|
146
171
|
_templateLock,
|
|
172
|
+
defaultBlock,
|
|
173
|
+
directInsert,
|
|
147
174
|
__experimentalDefaultBlock,
|
|
148
175
|
__experimentalDirectInsert,
|
|
149
176
|
captureToolbars,
|
|
@@ -52,6 +52,7 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
|
|
|
52
52
|
onInsertBlocks,
|
|
53
53
|
destinationRootClientId
|
|
54
54
|
);
|
|
55
|
+
|
|
55
56
|
const registeredPatternCategories = useMemo(
|
|
56
57
|
() =>
|
|
57
58
|
patternCategories.map(
|
|
@@ -75,7 +76,12 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
|
|
|
75
76
|
);
|
|
76
77
|
}
|
|
77
78
|
return searchItems( allPatterns, filterValue );
|
|
78
|
-
}, [
|
|
79
|
+
}, [
|
|
80
|
+
filterValue,
|
|
81
|
+
allPatterns,
|
|
82
|
+
selectedCategory,
|
|
83
|
+
registeredPatternCategories,
|
|
84
|
+
] );
|
|
79
85
|
|
|
80
86
|
// Announce search results on change.
|
|
81
87
|
useEffect( () => {
|
|
@@ -89,7 +95,7 @@ function PatternList( { filterValue, selectedCategory, patternCategories } ) {
|
|
|
89
95
|
count
|
|
90
96
|
);
|
|
91
97
|
debouncedSpeak( resultsFoundMessage );
|
|
92
|
-
}, [ filterValue, debouncedSpeak ] );
|
|
98
|
+
}, [ filterValue, debouncedSpeak, filteredBlockPatterns.length ] );
|
|
93
99
|
|
|
94
100
|
const currentShownPatterns = useAsyncList( filteredBlockPatterns, {
|
|
95
101
|
step: INITIAL_INSERTER_RESULTS,
|
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
Button,
|
|
19
19
|
} from '@wordpress/components';
|
|
20
20
|
import { Icon, chevronRight, chevronLeft } from '@wordpress/icons';
|
|
21
|
-
import { parse } from '@wordpress/blocks';
|
|
22
21
|
import { focus } from '@wordpress/dom';
|
|
23
22
|
|
|
24
23
|
/**
|
|
@@ -28,13 +27,13 @@ import usePatternsState from './hooks/use-patterns-state';
|
|
|
28
27
|
import BlockPatternList from '../block-patterns-list';
|
|
29
28
|
import PatternsExplorerModal from './block-patterns-explorer/explorer';
|
|
30
29
|
import MobileTabNavigation from './mobile-tab-navigation';
|
|
31
|
-
import useBlockTypesState from './hooks/use-block-types-state';
|
|
32
30
|
|
|
33
31
|
const noop = () => {};
|
|
34
32
|
|
|
35
33
|
// Preferred order of pattern categories. Any other categories should
|
|
36
34
|
// be at the bottom without any re-ordering.
|
|
37
35
|
const patternCategoriesOrder = [
|
|
36
|
+
'custom',
|
|
38
37
|
'featured',
|
|
39
38
|
'posts',
|
|
40
39
|
'text',
|
|
@@ -51,18 +50,6 @@ function usePatternsCategories( rootClientId ) {
|
|
|
51
50
|
rootClientId
|
|
52
51
|
);
|
|
53
52
|
|
|
54
|
-
const [ unsyncedPatterns ] = useBlockTypesState(
|
|
55
|
-
rootClientId,
|
|
56
|
-
undefined,
|
|
57
|
-
'unsynced'
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const filteredUnsyncedPatterns = useMemo( () => {
|
|
61
|
-
return unsyncedPatterns.filter(
|
|
62
|
-
( { category: unsyncedPatternCategory } ) =>
|
|
63
|
-
unsyncedPatternCategory === 'reusable'
|
|
64
|
-
);
|
|
65
|
-
}, [ unsyncedPatterns ] );
|
|
66
53
|
const hasRegisteredCategory = useCallback(
|
|
67
54
|
( pattern ) => {
|
|
68
55
|
if ( ! pattern.categories || ! pattern.categories.length ) {
|
|
@@ -107,20 +94,9 @@ function usePatternsCategories( rootClientId ) {
|
|
|
107
94
|
label: _x( 'Uncategorized' ),
|
|
108
95
|
} );
|
|
109
96
|
}
|
|
110
|
-
if ( filteredUnsyncedPatterns.length > 0 ) {
|
|
111
|
-
categories.push( {
|
|
112
|
-
name: 'reusable',
|
|
113
|
-
label: _x( 'Custom patterns' ),
|
|
114
|
-
} );
|
|
115
|
-
}
|
|
116
97
|
|
|
117
98
|
return categories;
|
|
118
|
-
}, [
|
|
119
|
-
allCategories,
|
|
120
|
-
allPatterns,
|
|
121
|
-
filteredUnsyncedPatterns.length,
|
|
122
|
-
hasRegisteredCategory,
|
|
123
|
-
] );
|
|
99
|
+
}, [ allCategories, allPatterns, hasRegisteredCategory ] );
|
|
124
100
|
|
|
125
101
|
return populatedCategories;
|
|
126
102
|
}
|
|
@@ -169,24 +145,6 @@ export function BlockPatternsCategoryPanel( {
|
|
|
169
145
|
onInsert,
|
|
170
146
|
rootClientId
|
|
171
147
|
);
|
|
172
|
-
const [ unsyncedPatterns ] = useBlockTypesState(
|
|
173
|
-
rootClientId,
|
|
174
|
-
onInsert,
|
|
175
|
-
'unsynced'
|
|
176
|
-
);
|
|
177
|
-
const filteredUnsyncedPatterns = useMemo( () => {
|
|
178
|
-
return unsyncedPatterns
|
|
179
|
-
.filter(
|
|
180
|
-
( { category: unsyncedPatternCategory } ) =>
|
|
181
|
-
unsyncedPatternCategory === 'reusable'
|
|
182
|
-
)
|
|
183
|
-
.map( ( syncedPattern ) => ( {
|
|
184
|
-
...syncedPattern,
|
|
185
|
-
blocks: parse( syncedPattern.content, {
|
|
186
|
-
__unstableSkipMigrationLogs: true,
|
|
187
|
-
} ),
|
|
188
|
-
} ) );
|
|
189
|
-
}, [ unsyncedPatterns ] );
|
|
190
148
|
|
|
191
149
|
const availableCategories = usePatternsCategories( rootClientId );
|
|
192
150
|
const currentCategoryPatterns = useMemo(
|
|
@@ -208,21 +166,15 @@ export function BlockPatternsCategoryPanel( {
|
|
|
208
166
|
|
|
209
167
|
return availablePatternCategories.length === 0;
|
|
210
168
|
} ),
|
|
211
|
-
[ allPatterns, category ]
|
|
169
|
+
[ allPatterns, availableCategories, category.name ]
|
|
212
170
|
);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
? filteredUnsyncedPatterns
|
|
216
|
-
: currentCategoryPatterns;
|
|
217
|
-
const currentShownPatterns = useAsyncList( patterns );
|
|
171
|
+
|
|
172
|
+
const categoryPatternsList = useAsyncList( currentCategoryPatterns );
|
|
218
173
|
|
|
219
174
|
// Hide block pattern preview on unmount.
|
|
220
175
|
useEffect( () => () => onHover( null ), [] );
|
|
221
176
|
|
|
222
|
-
if (
|
|
223
|
-
! currentCategoryPatterns.length &&
|
|
224
|
-
! filteredUnsyncedPatterns.length
|
|
225
|
-
) {
|
|
177
|
+
if ( ! currentCategoryPatterns.length ) {
|
|
226
178
|
return null;
|
|
227
179
|
}
|
|
228
180
|
|
|
@@ -233,8 +185,8 @@ export function BlockPatternsCategoryPanel( {
|
|
|
233
185
|
</div>
|
|
234
186
|
<p>{ category.description }</p>
|
|
235
187
|
<BlockPatternList
|
|
236
|
-
shownPatterns={
|
|
237
|
-
blockPatterns={
|
|
188
|
+
shownPatterns={ categoryPatternsList }
|
|
189
|
+
blockPatterns={ currentCategoryPatterns }
|
|
238
190
|
onClickPattern={ onClick }
|
|
239
191
|
onHover={ onHover }
|
|
240
192
|
label={ category.label }
|