@wordpress/block-editor 12.5.0 → 12.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +2 -6
- package/build/autocompleters/block.js +6 -2
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-draggable/index.js +6 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +2 -2
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +25 -13
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-editing-mode/index.js +1 -1
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +14 -18
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block.js +4 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +21 -42
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +2 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +6 -21
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-preview/auto.js +6 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +1 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -2
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +3 -17
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build/components/block-toolbar/index.js +4 -33
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +62 -3
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-toolbar/utils.js +56 -51
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +4 -2
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +10 -20
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/editor-styles/index.js +2 -2
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +11 -11
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/behaviors-panel.js +66 -0
- package/build/components/global-styles/behaviors-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +21 -15
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +13 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +4 -8
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +131 -27
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +20 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +18 -3
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +4 -4
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +12 -18
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +7 -7
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +36 -48
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +5 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build/components/index.js +1 -10
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +3 -1
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +6 -2
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +5 -7
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +3 -2
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +2 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +21 -32
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +23 -3
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.js +3 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter-list-item/index.js +1 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/link-control/index.js +51 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +3 -3
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-item.js +1 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -2
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +6 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +65 -31
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.native.js +15 -3
- package/build/components/media-replace-flow/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +0 -36
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/format-edit.js +57 -28
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +111 -0
- package/build/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +2 -2
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-display-information/index.js +7 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +49 -8
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-setting/index.js +5 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/behaviors.js +5 -12
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/border.js +2 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +11 -2
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +1 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +10 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +3 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +5 -6
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +23 -79
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +38 -2
- package/build/utils/object.js.map +1 -1
- package/build-module/autocompleters/block.js +7 -3
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-draggable/index.js +6 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +2 -2
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +27 -10
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +1 -1
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +14 -18
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block.js +4 -2
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +24 -43
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +2 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +3 -3
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +7 -22
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +6 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -4
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +3 -3
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -18
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +6 -35
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +60 -4
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-toolbar/utils.js +54 -49
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -2
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +13 -23
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/editor-styles/index.js +2 -2
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +11 -11
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/behaviors-panel.js +57 -0
- package/build-module/components/global-styles/behaviors-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +21 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +13 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +4 -8
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +127 -27
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +18 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +4 -4
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +13 -18
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +6 -6
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +37 -49
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +5 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +3 -1
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +7 -3
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +5 -7
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +3 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +22 -33
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +3 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -1
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/link-control/index.js +49 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +3 -3
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-item.js +1 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +6 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +66 -33
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.native.js +15 -3
- package/build-module/components/media-replace-flow/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +1 -36
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +51 -26
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +100 -0
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +7 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +50 -8
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-setting/index.js +5 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/behaviors.js +5 -12
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/border.js +2 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +11 -2
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +2 -7
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +4 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +20 -75
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +34 -2
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +2 -1
- package/build-style/content.css +2 -1
- package/build-style/style-rtl.css +25 -6
- package/build-style/style.css +25 -6
- package/package.json +32 -32
- package/src/autocompleters/block.js +21 -6
- package/src/components/block-controls/README.md +89 -0
- package/src/components/block-draggable/index.js +13 -4
- package/src/components/block-draggable/index.native.js +7 -3
- package/src/components/block-draggable/test/index.native.js +2 -57
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-editing-mode/index.js +1 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- package/src/components/block-list/block.js +6 -1
- package/src/components/block-list/block.native.js +24 -38
- package/src/components/block-list/block.native.scss +18 -40
- package/src/components/block-list/index.js +3 -6
- package/src/components/block-list/style.native.scss +3 -3
- package/src/components/block-list/test/block-invalid-warning.native.js +8 -1
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +40 -6
- package/src/components/block-parent-selector/index.js +30 -42
- package/src/components/block-preview/auto.js +8 -1
- package/src/components/block-preview/style.scss +2 -1
- package/src/components/block-removal-warning-modal/index.js +0 -3
- package/src/components/block-settings/button.native.js +12 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -13
- package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
- package/src/components/block-toolbar/index.js +36 -64
- package/src/components/block-toolbar/index.native.js +86 -6
- package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
- package/src/components/block-toolbar/test/index.native.js +42 -0
- package/src/components/block-toolbar/utils.js +57 -45
- package/src/components/block-tools/block-contextual-toolbar.js +43 -35
- package/src/components/block-tools/style.scss +17 -5
- package/src/components/block-variation-picker/index.native.js +52 -72
- package/src/components/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/control.js +3 -2
- package/src/components/editor-styles/index.js +2 -2
- package/src/components/font-sizes/fluid-utils.js +17 -17
- package/src/components/font-sizes/test/fluid-utils.js +6 -6
- package/src/components/global-styles/behaviors-panel.js +71 -0
- package/src/components/global-styles/color-panel.js +23 -16
- package/src/components/global-styles/dimensions-panel.js +8 -2
- package/src/components/global-styles/get-block-css-selector.js +5 -9
- package/src/components/global-styles/hooks.js +134 -31
- package/src/components/global-styles/index.js +3 -0
- package/src/components/global-styles/test/typography-utils.js +6 -6
- package/src/components/global-styles/typography-panel.js +17 -5
- package/src/components/global-styles/typography-utils.js +4 -4
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +17 -7
- package/src/components/iframe/index.js +30 -56
- package/src/components/iframe/use-compatibility-styles.js +5 -0
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/README.md +10 -0
- package/src/components/inner-blocks/index.js +4 -0
- package/src/components/inner-blocks/index.native.js +4 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
- package/src/components/inserter/hooks/use-block-types-state.js +15 -6
- package/src/components/inserter/hooks/use-debounced-input.js +8 -7
- package/src/components/inserter/hooks/use-patterns-state.js +2 -1
- package/src/components/inserter/index.js +2 -3
- package/src/components/inserter/index.native.js +17 -36
- package/src/components/inserter/reusable-block-rename-hint.js +18 -1
- package/src/components/inserter/reusable-blocks-tab.js +4 -1
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/inserter-list-item/index.js +3 -1
- package/src/components/link-control/README.md +12 -3
- package/src/components/link-control/index.js +47 -7
- package/src/components/link-control/link-preview.js +6 -4
- package/src/components/link-control/search-item.js +1 -1
- package/src/components/link-control/style.scss +11 -3
- package/src/components/link-control/test/index.js +28 -1
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/list-view/use-list-view-drop-zone.js +5 -1
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- package/src/components/media-replace-flow/index.native.js +12 -3
- package/src/components/media-upload/test/index.native.js +1 -0
- package/src/components/preview-options/README.md +18 -17
- package/src/components/preview-options/index.js +2 -2
- package/src/components/rich-text/content.js +1 -46
- package/src/components/rich-text/format-edit.js +62 -38
- package/src/components/rich-text/get-rich-text-values.js +99 -0
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
- package/src/components/spacing-sizes-control/test/utils.js +9 -1
- package/src/components/spacing-sizes-control/utils.js +2 -2
- package/src/components/text-transform-control/README.md +44 -0
- package/src/components/use-block-display-information/index.js +12 -5
- package/src/components/use-block-drop-zone/index.native.js +65 -28
- package/src/components/use-setting/index.js +8 -8
- package/src/hooks/behaviors.js +10 -16
- package/src/hooks/border.js +2 -1
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/style.js +7 -3
- package/src/hooks/utils.js +5 -7
- package/src/private-apis.js +9 -1
- package/src/store/actions.js +23 -30
- package/src/store/private-selectors.js +3 -6
- package/src/store/reducer.js +0 -1
- package/src/store/selectors.js +36 -85
- package/src/store/test/actions.js +3 -0
- package/src/store/test/private-selectors.js +5 -5
- package/src/store/test/reducer.js +14 -7
- package/src/store/test/selectors.js +8 -7
- package/src/utils/object.js +32 -2
- package/src/utils/test/object.js +36 -0
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build/components/block-mobile-toolbar/index.native.js +0 -135
- package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
- package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.native.js +0 -127
- package/src/components/block-mobile-toolbar/style.native.scss +0 -16
- /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
|
@@ -57,6 +57,7 @@ export function kebabCase(str) {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Clones an object.
|
|
60
|
+
* Arrays are also cloned as arrays.
|
|
60
61
|
* Non-object values are returned unchanged.
|
|
61
62
|
*
|
|
62
63
|
* @param {*} object Object to clone.
|
|
@@ -64,6 +65,10 @@ export function kebabCase(str) {
|
|
|
64
65
|
*/
|
|
65
66
|
|
|
66
67
|
function cloneObject(object) {
|
|
68
|
+
if (Array.isArray(object)) {
|
|
69
|
+
return object.map(cloneObject);
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
if (object && typeof object === 'object') {
|
|
68
73
|
return { ...Object.fromEntries(Object.entries(object).map(([key, value]) => [key, cloneObject(value)]))
|
|
69
74
|
};
|
|
@@ -74,7 +79,7 @@ function cloneObject(object) {
|
|
|
74
79
|
/**
|
|
75
80
|
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
|
|
76
81
|
* new object. Treats nullish initial values as empty objects. Clones any
|
|
77
|
-
* nested objects.
|
|
82
|
+
* nested objects. Supports arrays, too.
|
|
78
83
|
*
|
|
79
84
|
* @param {Object} object Object to set a value in.
|
|
80
85
|
* @param {number|string|Array} path Path in the object to modify.
|
|
@@ -88,7 +93,11 @@ export function setImmutably(object, path, value) {
|
|
|
88
93
|
const newObject = object ? cloneObject(object) : {};
|
|
89
94
|
normalizedPath.reduce((acc, key, i) => {
|
|
90
95
|
if (acc[key] === undefined) {
|
|
91
|
-
|
|
96
|
+
if (Number.isInteger(path[i + 1])) {
|
|
97
|
+
acc[key] = [];
|
|
98
|
+
} else {
|
|
99
|
+
acc[key] = {};
|
|
100
|
+
}
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
if (i === normalizedPath.length - 1) {
|
|
@@ -99,4 +108,27 @@ export function setImmutably(object, path, value) {
|
|
|
99
108
|
}, newObject);
|
|
100
109
|
return newObject;
|
|
101
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Helper util to return a value from a certain path of the object.
|
|
113
|
+
* Path is specified as either:
|
|
114
|
+
* - a string of properties, separated by dots, for example: "x.y".
|
|
115
|
+
* - an array of properties, for example `[ 'x', 'y' ]`.
|
|
116
|
+
* You can also specify a default value in case the result is nullish.
|
|
117
|
+
*
|
|
118
|
+
* @param {Object} object Input object.
|
|
119
|
+
* @param {string|Array} path Path to the object property.
|
|
120
|
+
* @param {*} defaultValue Default value if the value at the specified path is nullish.
|
|
121
|
+
* @return {*} Value of the object property at the specified path.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
export const getValueFromObjectPath = (object, path, defaultValue) => {
|
|
125
|
+
var _value;
|
|
126
|
+
|
|
127
|
+
const normalizedPath = Array.isArray(path) ? path : path.split('.');
|
|
128
|
+
let value = object;
|
|
129
|
+
normalizedPath.forEach(fieldName => {
|
|
130
|
+
value = value?.[fieldName];
|
|
131
|
+
});
|
|
132
|
+
return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
|
|
133
|
+
};
|
|
102
134
|
//# sourceMappingURL=object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/object.js"],"names":["paramCase","normalizePath","path","Array","isArray","toString","kebabCase","str","input","replace","splitRegexp","cloneObject","object","Object","fromEntries","entries","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/utils/object.js"],"names":["paramCase","normalizePath","path","Array","isArray","toString","kebabCase","str","input","replace","splitRegexp","cloneObject","object","map","Object","fromEntries","entries","key","value","setImmutably","normalizedPath","newObject","reduce","acc","i","undefined","Number","isInteger","length","getValueFromObjectPath","defaultValue","split","forEach","fieldName"],"mappings":"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","sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase } from 'change-case';\n\n/**\n * Converts a path to an array of its fragments.\n * Supports strings, numbers and arrays:\n *\n * 'foo' => [ 'foo' ]\n * 2 => [ '2' ]\n * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]\n *\n * @param {string|number|Array} path Path\n * @return {Array} Normalized path.\n */\nfunction normalizePath( path ) {\n\tif ( Array.isArray( path ) ) {\n\t\treturn path;\n\t} else if ( typeof path === 'number' ) {\n\t\treturn [ path.toString() ];\n\t}\n\n\treturn [ path ];\n}\n\n/**\n * Converts any string to kebab case.\n * Backwards compatible with Lodash's `_.kebabCase()`.\n * Backwards compatible with `_wp_to_kebab_case()`.\n *\n * @see https://lodash.com/docs/4.17.15#kebabCase\n * @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/\n *\n * @param {string} str String to convert.\n * @return {string} Kebab-cased string\n */\nexport function kebabCase( str ) {\n\tlet input = str;\n\tif ( typeof str !== 'string' ) {\n\t\tinput = str?.toString?.() ?? '';\n\t}\n\n\t// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970\n\tinput = input.replace( /['\\u2019]/, '' );\n\n\treturn paramCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar\n\t\t\t/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar\n\t\t\t/([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3\n\t\t\t/([A-Z])([A-Z][a-z])/g, // FOOBar => foo-bar\n\t\t],\n\t} );\n}\n\n/**\n * Clones an object.\n * Arrays are also cloned as arrays.\n * Non-object values are returned unchanged.\n *\n * @param {*} object Object to clone.\n * @return {*} Cloned object, or original literal non-object value.\n */\nfunction cloneObject( object ) {\n\tif ( Array.isArray( object ) ) {\n\t\treturn object.map( cloneObject );\n\t}\n\n\tif ( object && typeof object === 'object' ) {\n\t\treturn {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tcloneObject( value ),\n\t\t\t\t] )\n\t\t\t),\n\t\t};\n\t}\n\n\treturn object;\n}\n\n/**\n * Immutably sets a value inside an object. Like `lodash#set`, but returning a\n * new object. Treats nullish initial values as empty objects. Clones any\n * nested objects. Supports arrays, too.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function setImmutably( object, path, value ) {\n\tconst normalizedPath = normalizePath( path );\n\tconst newObject = object ? cloneObject( object ) : {};\n\n\tnormalizedPath.reduce( ( acc, key, i ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( path[ i + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( i === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, newObject );\n\n\treturn newObject;\n}\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n * You can also specify a default value in case the result is nullish.\n *\n * @param {Object} object Input object.\n * @param {string|Array} path Path to the object property.\n * @param {*} defaultValue Default value if the value at the specified path is nullish.\n * @return {*} Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = ( object, path, defaultValue ) => {\n\tconst normalizedPath = Array.isArray( path ) ? path : path.split( '.' );\n\tlet value = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value ?? defaultValue;\n};\n"]}
|
|
@@ -708,7 +708,8 @@
|
|
|
708
708
|
opacity: 0.62;
|
|
709
709
|
}
|
|
710
710
|
:where(body .is-layout-constrained) .block-editor-default-block-appender > :first-child:first-child {
|
|
711
|
-
margin-
|
|
711
|
+
-webkit-margin-before: 0;
|
|
712
|
+
margin-block-start: 0;
|
|
712
713
|
}
|
|
713
714
|
.block-editor-default-block-appender .components-drop-zone__content-icon {
|
|
714
715
|
display: none;
|
package/build-style/content.css
CHANGED
|
@@ -708,7 +708,8 @@
|
|
|
708
708
|
opacity: 0.62;
|
|
709
709
|
}
|
|
710
710
|
:where(body .is-layout-constrained) .block-editor-default-block-appender > :first-child:first-child {
|
|
711
|
-
margin-
|
|
711
|
+
-webkit-margin-before: 0;
|
|
712
|
+
margin-block-start: 0;
|
|
712
713
|
}
|
|
713
714
|
.block-editor-default-block-appender .components-drop-zone__content-icon {
|
|
714
715
|
display: none;
|
|
@@ -332,6 +332,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
332
332
|
.block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
|
|
333
333
|
display: none;
|
|
334
334
|
}
|
|
335
|
+
.block-editor-block-contextual-toolbar.is-collapsed::after {
|
|
336
|
+
content: "";
|
|
337
|
+
position: absolute;
|
|
338
|
+
right: 100%;
|
|
339
|
+
width: 48px;
|
|
340
|
+
height: 100%;
|
|
341
|
+
background: linear-gradient(to left, #fff, transparent);
|
|
342
|
+
}
|
|
335
343
|
@media (min-width: 782px) {
|
|
336
344
|
.block-editor-block-contextual-toolbar.is-fixed {
|
|
337
345
|
margin-right: 180px;
|
|
@@ -351,11 +359,11 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
351
359
|
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
352
360
|
width: initial;
|
|
353
361
|
}
|
|
354
|
-
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar
|
|
362
|
+
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar {
|
|
355
363
|
flex-grow: initial;
|
|
356
364
|
width: initial;
|
|
357
365
|
}
|
|
358
|
-
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar
|
|
366
|
+
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar::before {
|
|
359
367
|
content: "";
|
|
360
368
|
width: 1px;
|
|
361
369
|
height: 24px;
|
|
@@ -473,7 +481,10 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
473
481
|
}
|
|
474
482
|
@media (min-width: 960px) {
|
|
475
483
|
.block-editor-block-contextual-toolbar.is-fixed {
|
|
476
|
-
width:
|
|
484
|
+
width: auto;
|
|
485
|
+
}
|
|
486
|
+
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
487
|
+
width: calc(100% - 280px - 256px);
|
|
477
488
|
}
|
|
478
489
|
}
|
|
479
490
|
|
|
@@ -1011,6 +1022,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
1011
1022
|
overflow: hidden;
|
|
1012
1023
|
}
|
|
1013
1024
|
.block-editor-block-preview__container .block-editor-block-preview__content {
|
|
1025
|
+
width: 100%;
|
|
1014
1026
|
top: 0;
|
|
1015
1027
|
right: 0;
|
|
1016
1028
|
transform-origin: top right;
|
|
@@ -1972,7 +1984,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
1972
1984
|
flex-direction: row-reverse;
|
|
1973
1985
|
justify-content: flex-start;
|
|
1974
1986
|
gap: 8px;
|
|
1975
|
-
padding: 8px;
|
|
1987
|
+
padding: 8px 16px 16px;
|
|
1976
1988
|
order: 20;
|
|
1977
1989
|
}
|
|
1978
1990
|
|
|
@@ -2017,6 +2029,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
2017
2029
|
overflow: hidden;
|
|
2018
2030
|
text-overflow: ellipsis;
|
|
2019
2031
|
display: inline-block;
|
|
2032
|
+
width: 100%;
|
|
2033
|
+
}
|
|
2034
|
+
.block-editor-link-control__search-item .components-menu-item__item mark {
|
|
2035
|
+
font-weight: 600;
|
|
2036
|
+
color: inherit;
|
|
2037
|
+
background-color: transparent;
|
|
2020
2038
|
}
|
|
2021
2039
|
.block-editor-link-control__search-item .components-menu-item__shortcut {
|
|
2022
2040
|
color: #757575;
|
|
@@ -2071,12 +2089,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
2071
2089
|
}
|
|
2072
2090
|
.block-editor-link-control__search-item .block-editor-link-control__search-item-title {
|
|
2073
2091
|
display: block;
|
|
2074
|
-
margin-bottom: 0.2em;
|
|
2075
2092
|
font-weight: 500;
|
|
2076
2093
|
position: relative;
|
|
2094
|
+
line-height: 24px;
|
|
2077
2095
|
}
|
|
2078
2096
|
.block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
|
|
2079
|
-
font-weight:
|
|
2097
|
+
font-weight: 600;
|
|
2080
2098
|
color: inherit;
|
|
2081
2099
|
background-color: transparent;
|
|
2082
2100
|
}
|
|
@@ -2135,6 +2153,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
2135
2153
|
display: flex;
|
|
2136
2154
|
flex-direction: row;
|
|
2137
2155
|
width: 100%;
|
|
2156
|
+
align-items: center;
|
|
2138
2157
|
}
|
|
2139
2158
|
|
|
2140
2159
|
.block-editor-link-control__search-item-bottom {
|
package/build-style/style.css
CHANGED
|
@@ -332,6 +332,14 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
332
332
|
.block-editor-block-contextual-toolbar:has(.block-editor-block-toolbar:empty) {
|
|
333
333
|
display: none;
|
|
334
334
|
}
|
|
335
|
+
.block-editor-block-contextual-toolbar.is-collapsed::after {
|
|
336
|
+
content: "";
|
|
337
|
+
position: absolute;
|
|
338
|
+
left: 100%;
|
|
339
|
+
width: 48px;
|
|
340
|
+
height: 100%;
|
|
341
|
+
background: linear-gradient(to right, #fff, transparent);
|
|
342
|
+
}
|
|
335
343
|
@media (min-width: 782px) {
|
|
336
344
|
.block-editor-block-contextual-toolbar.is-fixed {
|
|
337
345
|
margin-left: 180px;
|
|
@@ -351,11 +359,11 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
351
359
|
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed.is-collapsed {
|
|
352
360
|
width: initial;
|
|
353
361
|
}
|
|
354
|
-
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar
|
|
362
|
+
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar {
|
|
355
363
|
flex-grow: initial;
|
|
356
364
|
width: initial;
|
|
357
365
|
}
|
|
358
|
-
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar
|
|
366
|
+
.block-editor-block-contextual-toolbar.is-fixed > .block-editor-block-toolbar::before {
|
|
359
367
|
content: "";
|
|
360
368
|
width: 1px;
|
|
361
369
|
height: 24px;
|
|
@@ -473,7 +481,10 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
473
481
|
}
|
|
474
482
|
@media (min-width: 960px) {
|
|
475
483
|
.block-editor-block-contextual-toolbar.is-fixed {
|
|
476
|
-
width:
|
|
484
|
+
width: auto;
|
|
485
|
+
}
|
|
486
|
+
.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
487
|
+
width: calc(100% - 280px - 256px);
|
|
477
488
|
}
|
|
478
489
|
}
|
|
479
490
|
|
|
@@ -1011,6 +1022,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
1011
1022
|
overflow: hidden;
|
|
1012
1023
|
}
|
|
1013
1024
|
.block-editor-block-preview__container .block-editor-block-preview__content {
|
|
1025
|
+
width: 100%;
|
|
1014
1026
|
top: 0;
|
|
1015
1027
|
left: 0;
|
|
1016
1028
|
transform-origin: top left;
|
|
@@ -1973,7 +1985,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
1973
1985
|
flex-direction: row-reverse;
|
|
1974
1986
|
justify-content: flex-start;
|
|
1975
1987
|
gap: 8px;
|
|
1976
|
-
padding: 8px;
|
|
1988
|
+
padding: 8px 16px 16px;
|
|
1977
1989
|
order: 20;
|
|
1978
1990
|
}
|
|
1979
1991
|
|
|
@@ -2018,6 +2030,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
2018
2030
|
overflow: hidden;
|
|
2019
2031
|
text-overflow: ellipsis;
|
|
2020
2032
|
display: inline-block;
|
|
2033
|
+
width: 100%;
|
|
2034
|
+
}
|
|
2035
|
+
.block-editor-link-control__search-item .components-menu-item__item mark {
|
|
2036
|
+
font-weight: 600;
|
|
2037
|
+
color: inherit;
|
|
2038
|
+
background-color: transparent;
|
|
2021
2039
|
}
|
|
2022
2040
|
.block-editor-link-control__search-item .components-menu-item__shortcut {
|
|
2023
2041
|
color: #757575;
|
|
@@ -2072,12 +2090,12 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
2072
2090
|
}
|
|
2073
2091
|
.block-editor-link-control__search-item .block-editor-link-control__search-item-title {
|
|
2074
2092
|
display: block;
|
|
2075
|
-
margin-bottom: 0.2em;
|
|
2076
2093
|
font-weight: 500;
|
|
2077
2094
|
position: relative;
|
|
2095
|
+
line-height: 24px;
|
|
2078
2096
|
}
|
|
2079
2097
|
.block-editor-link-control__search-item .block-editor-link-control__search-item-title mark {
|
|
2080
|
-
font-weight:
|
|
2098
|
+
font-weight: 600;
|
|
2081
2099
|
color: inherit;
|
|
2082
2100
|
background-color: transparent;
|
|
2083
2101
|
}
|
|
@@ -2136,6 +2154,7 @@ body.is-fullscreen-mode .block-editor-block-contextual-toolbar.is-fixed {
|
|
|
2136
2154
|
display: flex;
|
|
2137
2155
|
flex-direction: row;
|
|
2138
2156
|
width: 100%;
|
|
2157
|
+
align-items: center;
|
|
2139
2158
|
}
|
|
2140
2159
|
|
|
2141
2160
|
.block-editor-link-control__search-item-bottom {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.7.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,37 +32,38 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
+
"@emotion/react": "^11.7.1",
|
|
35
36
|
"@emotion/styled": "^11.6.0",
|
|
36
37
|
"@react-spring/web": "^9.4.5",
|
|
37
|
-
"@wordpress/a11y": "^3.
|
|
38
|
-
"@wordpress/api-fetch": "^6.
|
|
39
|
-
"@wordpress/blob": "^3.
|
|
40
|
-
"@wordpress/blocks": "^12.
|
|
41
|
-
"@wordpress/components": "^25.
|
|
42
|
-
"@wordpress/compose": "^6.
|
|
43
|
-
"@wordpress/data": "^9.
|
|
44
|
-
"@wordpress/date": "^4.
|
|
45
|
-
"@wordpress/deprecated": "^3.
|
|
46
|
-
"@wordpress/dom": "^3.
|
|
47
|
-
"@wordpress/element": "^5.
|
|
48
|
-
"@wordpress/escape-html": "^2.
|
|
49
|
-
"@wordpress/hooks": "^3.
|
|
50
|
-
"@wordpress/html-entities": "^3.
|
|
51
|
-
"@wordpress/i18n": "^4.
|
|
52
|
-
"@wordpress/icons": "^9.
|
|
53
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
54
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
55
|
-
"@wordpress/keycodes": "^3.
|
|
56
|
-
"@wordpress/notices": "^4.
|
|
57
|
-
"@wordpress/preferences": "^3.
|
|
58
|
-
"@wordpress/private-apis": "^0.
|
|
59
|
-
"@wordpress/rich-text": "^6.
|
|
60
|
-
"@wordpress/shortcode": "^3.
|
|
61
|
-
"@wordpress/style-engine": "^1.
|
|
62
|
-
"@wordpress/token-list": "^2.
|
|
63
|
-
"@wordpress/url": "^3.
|
|
64
|
-
"@wordpress/warning": "^2.
|
|
65
|
-
"@wordpress/wordcount": "^3.
|
|
38
|
+
"@wordpress/a11y": "^3.39.0",
|
|
39
|
+
"@wordpress/api-fetch": "^6.36.0",
|
|
40
|
+
"@wordpress/blob": "^3.39.0",
|
|
41
|
+
"@wordpress/blocks": "^12.16.0",
|
|
42
|
+
"@wordpress/components": "^25.5.0",
|
|
43
|
+
"@wordpress/compose": "^6.16.0",
|
|
44
|
+
"@wordpress/data": "^9.9.0",
|
|
45
|
+
"@wordpress/date": "^4.39.0",
|
|
46
|
+
"@wordpress/deprecated": "^3.39.0",
|
|
47
|
+
"@wordpress/dom": "^3.39.0",
|
|
48
|
+
"@wordpress/element": "^5.16.0",
|
|
49
|
+
"@wordpress/escape-html": "^2.39.0",
|
|
50
|
+
"@wordpress/hooks": "^3.39.0",
|
|
51
|
+
"@wordpress/html-entities": "^3.39.0",
|
|
52
|
+
"@wordpress/i18n": "^4.39.0",
|
|
53
|
+
"@wordpress/icons": "^9.30.0",
|
|
54
|
+
"@wordpress/is-shallow-equal": "^4.39.0",
|
|
55
|
+
"@wordpress/keyboard-shortcuts": "^4.16.0",
|
|
56
|
+
"@wordpress/keycodes": "^3.39.0",
|
|
57
|
+
"@wordpress/notices": "^4.7.0",
|
|
58
|
+
"@wordpress/preferences": "^3.16.0",
|
|
59
|
+
"@wordpress/private-apis": "^0.21.0",
|
|
60
|
+
"@wordpress/rich-text": "^6.16.0",
|
|
61
|
+
"@wordpress/shortcode": "^3.39.0",
|
|
62
|
+
"@wordpress/style-engine": "^1.22.0",
|
|
63
|
+
"@wordpress/token-list": "^2.39.0",
|
|
64
|
+
"@wordpress/url": "^3.40.0",
|
|
65
|
+
"@wordpress/warning": "^2.39.0",
|
|
66
|
+
"@wordpress/wordcount": "^3.39.0",
|
|
66
67
|
"change-case": "^4.1.2",
|
|
67
68
|
"classnames": "^2.3.1",
|
|
68
69
|
"colord": "^2.7.0",
|
|
@@ -71,7 +72,6 @@
|
|
|
71
72
|
"dom-scroll-into-view": "^1.2.1",
|
|
72
73
|
"fast-deep-equal": "^3.1.3",
|
|
73
74
|
"inherits": "^2.0.3",
|
|
74
|
-
"lodash": "^4.17.21",
|
|
75
75
|
"react-autosize-textarea": "^7.1.0",
|
|
76
76
|
"react-easy-crop": "^4.5.1",
|
|
77
77
|
"rememo": "^4.0.2",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "b898cf1dc8e70841d1647ea0994ac6278acc18a7"
|
|
89
89
|
}
|
|
@@ -5,6 +5,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
5
5
|
import {
|
|
6
6
|
createBlock,
|
|
7
7
|
createBlocksFromInnerBlocksTemplate,
|
|
8
|
+
parse,
|
|
8
9
|
} from '@wordpress/blocks';
|
|
9
10
|
import { useMemo } from '@wordpress/element';
|
|
10
11
|
|
|
@@ -116,14 +117,28 @@ function createBlockCompleter() {
|
|
|
116
117
|
return ! ( /\S/.test( before ) || /\S/.test( after ) );
|
|
117
118
|
},
|
|
118
119
|
getOptionCompletion( inserterItem ) {
|
|
119
|
-
const {
|
|
120
|
+
const {
|
|
121
|
+
name,
|
|
122
|
+
initialAttributes,
|
|
123
|
+
innerBlocks,
|
|
124
|
+
syncStatus,
|
|
125
|
+
content,
|
|
126
|
+
} = inserterItem;
|
|
127
|
+
|
|
120
128
|
return {
|
|
121
129
|
action: 'replace',
|
|
122
|
-
value:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
value:
|
|
131
|
+
syncStatus === 'unsynced'
|
|
132
|
+
? parse( content, {
|
|
133
|
+
__unstableSkipMigrationLogs: true,
|
|
134
|
+
} )
|
|
135
|
+
: createBlock(
|
|
136
|
+
name,
|
|
137
|
+
initialAttributes,
|
|
138
|
+
createBlocksFromInnerBlocksTemplate(
|
|
139
|
+
innerBlocks
|
|
140
|
+
)
|
|
141
|
+
),
|
|
127
142
|
};
|
|
128
143
|
},
|
|
129
144
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# BlockControls
|
|
2
|
+
|
|
3
|
+
When the user selects a particular block, a toolbar positioned above the selected block displays a set of control buttons. Certain block-level controls are automatically included in the toolbar under specific circumstances. For example, there is a control for converting the block into a different type or when the focused element is a RichText component.
|
|
4
|
+
|
|
5
|
+
With `BlockControls`, you can customize the toolbar to include controls specific to your block type. If the return value of your block type's `edit` function includes a `BlockControls` element, the controls nested inside it will be shown in the selected block's toolbar.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
import {
|
|
16
|
+
BlockControls,
|
|
17
|
+
__experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl,
|
|
18
|
+
useBlockProps,
|
|
19
|
+
} from '@wordpress/block-editor';
|
|
20
|
+
import { __ } from '@wordpress/i18n';
|
|
21
|
+
|
|
22
|
+
export default function MyBlockEdit( { attributes, setAttributes } ) {
|
|
23
|
+
const blockProps = useBlockProps( {
|
|
24
|
+
className: 'my-block__custom-class',
|
|
25
|
+
} );
|
|
26
|
+
const { contentPosition } = attributes;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div { ...blockProps }>
|
|
30
|
+
{
|
|
31
|
+
<BlockControls>
|
|
32
|
+
<BlockAlignmentMatrixControl
|
|
33
|
+
label={ __( 'Change content position' ) }
|
|
34
|
+
value={ contentPosition }
|
|
35
|
+
onChange={ ( nextPosition ) =>
|
|
36
|
+
setAttributes( {
|
|
37
|
+
contentPosition: nextPosition,
|
|
38
|
+
} )
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
</BlockControls>
|
|
42
|
+
}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/// ...
|
|
48
|
+
|
|
49
|
+
<MyBlockEdit />;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
See [this custom block tutorial page](/docs/how-to-guides/block-tutorial/block-controls-toolbar-and-sidebar.md) for more information and block controls examples.
|
|
53
|
+
|
|
54
|
+
Furthermore, the READMEs of various components inside the block editor package and the components package include examples that also utilize `BlockControls` and can be a good reference.
|
|
55
|
+
|
|
56
|
+
### Props
|
|
57
|
+
|
|
58
|
+
The component accepts the following props:
|
|
59
|
+
|
|
60
|
+
### `group`
|
|
61
|
+
|
|
62
|
+
Group of the block controls. Allows you to create and render multiple groups of block controls.
|
|
63
|
+
|
|
64
|
+
- Type: `string`
|
|
65
|
+
- Default: `default`
|
|
66
|
+
- Required: No
|
|
67
|
+
|
|
68
|
+
### `controls`
|
|
69
|
+
|
|
70
|
+
Allows overriding the default `controls` if the `default` group is used.
|
|
71
|
+
|
|
72
|
+
See [this custom block tutorial page](/docs/how-to-guides/block-tutorial/block-controls-toolbar-and-sidebar.md) for more details and examples with block controls.
|
|
73
|
+
|
|
74
|
+
- Type: `array`
|
|
75
|
+
|
|
76
|
+
### `children`
|
|
77
|
+
|
|
78
|
+
Additional control components to be rendered.
|
|
79
|
+
|
|
80
|
+
- Type: `Element`
|
|
81
|
+
- Required: No.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### `__experimentalShareWithChildBlocks`
|
|
85
|
+
|
|
86
|
+
Whether the additional block controls should be added to the block toolbars of child blocks.
|
|
87
|
+
|
|
88
|
+
- Type: `boolean`
|
|
89
|
+
- Default: `false`
|
|
@@ -22,16 +22,25 @@ const BlockDraggable = ( {
|
|
|
22
22
|
} ) => {
|
|
23
23
|
const { srcRootClientId, isDraggable, icon } = useSelect(
|
|
24
24
|
( select ) => {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const {
|
|
26
|
+
canMoveBlocks,
|
|
27
|
+
getBlockRootClientId,
|
|
28
|
+
getBlockName,
|
|
29
|
+
getBlockAttributes,
|
|
30
|
+
} = select( blockEditorStore );
|
|
31
|
+
const { getBlockType, getActiveBlockVariation } =
|
|
32
|
+
select( blocksStore );
|
|
28
33
|
const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
|
|
29
34
|
const blockName = getBlockName( clientIds[ 0 ] );
|
|
35
|
+
const variation = getActiveBlockVariation(
|
|
36
|
+
blockName,
|
|
37
|
+
getBlockAttributes( clientIds[ 0 ] )
|
|
38
|
+
);
|
|
30
39
|
|
|
31
40
|
return {
|
|
32
41
|
srcRootClientId: rootClientId,
|
|
33
42
|
isDraggable: canMoveBlocks( clientIds, rootClientId ),
|
|
34
|
-
icon: getBlockType( blockName )?.icon,
|
|
43
|
+
icon: variation?.icon || getBlockType( blockName )?.icon,
|
|
35
44
|
};
|
|
36
45
|
},
|
|
37
46
|
[ clientIds ]
|
|
@@ -109,8 +109,12 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
|
|
|
109
109
|
draggingScrollHandler( event );
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
const {
|
|
113
|
-
|
|
112
|
+
const {
|
|
113
|
+
onBlockDragOverWorklet,
|
|
114
|
+
onBlockDragEnd,
|
|
115
|
+
onBlockDrop,
|
|
116
|
+
targetBlockIndex,
|
|
117
|
+
} = useBlockDropZone();
|
|
114
118
|
|
|
115
119
|
// Stop dragging blocks if the block draggable is unmounted.
|
|
116
120
|
useEffect( () => {
|
|
@@ -184,7 +188,7 @@ const BlockDraggableWrapper = ( { children, isRTL } ) => {
|
|
|
184
188
|
chip.y.value = dragPosition.y;
|
|
185
189
|
currentYPosition.value = dragPosition.y;
|
|
186
190
|
|
|
187
|
-
|
|
191
|
+
onBlockDragOverWorklet( { x, y: y + scroll.offsetY.value } );
|
|
188
192
|
|
|
189
193
|
// Update scrolling velocity
|
|
190
194
|
scrollOnDragOver( dragPosition.y );
|