@wordpress/block-editor 12.13.0 → 12.15.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 -1
- package/build/components/block-heading-level-dropdown/index.js +1 -1
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -0
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +2 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +16 -3
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +25 -16
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +36 -19
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +6 -4
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/index.js +28 -0
- package/build/components/block-rename/index.js.map +1 -0
- package/build/components/block-rename/is-empty-string.js +10 -0
- package/build/components/block-rename/is-empty-string.js.map +1 -0
- package/build/components/block-rename/modal.js +87 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +74 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +17 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +7 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +0 -8
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +18 -14
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +11 -81
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +56 -0
- package/build/components/block-tools/empty-block-inserter.js.map +1 -0
- package/build/components/block-tools/index.js +48 -9
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/selected-block-tools.js +113 -0
- package/build/components/block-tools/selected-block-tools.js.map +1 -0
- package/build/components/block-tools/use-selected-block-tool-props.js +56 -0
- package/build/components/block-tools/use-selected-block-tool-props.js.map +1 -0
- package/build/components/block-types-list/index.js +6 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +8 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editable-text/index.js +1 -2
- package/build/components/editable-text/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +1 -1
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/iframe/index.js +4 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +0 -5
- package/build/components/image-size-control/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/warning-max-depth-exceeded.native.js +29 -31
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/{explorer.js → index.js} +7 -7
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -4
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/index.js +75 -0
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +108 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
- package/build/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +18 -34
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +55 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/utils.js +69 -0
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +9 -5
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +15 -12
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +3 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -6
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +24 -23
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +5 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/link-control/index.js +6 -5
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +39 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +16 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +3 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +69 -18
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +4 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -14
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +4 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/format-edit.js +45 -0
- package/build/components/rich-text/native/format-edit.js.map +1 -0
- package/build/components/rich-text/native/get-format-colors.native.js +41 -0
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -0
- package/build/components/rich-text/native/index.js +9 -0
- package/build/components/rich-text/native/index.js.map +1 -0
- package/build/components/rich-text/native/index.native.js +1189 -0
- package/build/components/rich-text/native/index.native.js.map +1 -0
- package/build/components/rich-text/native/toolbar-button-with-options.native.js +58 -0
- package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
- package/build/components/rich-text/native/use-format-types.js +111 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +30 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +2 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +4 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +2 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -2
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +10 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +2 -2
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +7 -6
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +16 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +7 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +42 -0
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/content-lock-ui.js +5 -5
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +8 -7
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-fields.js +57 -52
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/duotone.js +9 -20
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +103 -93
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +10 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +10 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +30 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +4 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/private-apis.js +3 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +30 -37
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +18 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +18 -13
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +26 -6
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -0
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +3 -10
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +16 -3
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +24 -15
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +36 -19
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +7 -5
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/index.js +4 -0
- package/build-module/components/block-rename/index.js.map +1 -0
- package/build-module/components/block-rename/is-empty-string.js +4 -0
- package/build-module/components/block-rename/is-empty-string.js.map +1 -0
- package/build-module/components/block-rename/modal.js +79 -0
- package/build-module/components/block-rename/modal.js.map +1 -0
- package/build-module/components/block-rename/rename-control.js +66 -0
- package/build-module/components/block-rename/rename-control.js.map +1 -0
- package/build-module/components/block-rename/use-block-rename.js +10 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +7 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +0 -8
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +17 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +11 -80
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +48 -0
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -0
- package/build-module/components/block-tools/index.js +48 -9
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-tools.js +105 -0
- package/build-module/components/block-tools/selected-block-tools.js.map +1 -0
- package/build-module/components/block-tools/use-selected-block-tool-props.js +50 -0
- package/build-module/components/block-tools/use-selected-block-tool-props.js.map +1 -0
- package/build-module/components/block-types-list/index.js +6 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +8 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editable-text/index.js +1 -2
- package/build-module/components/editable-text/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -1
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +0 -5
- package/build-module/components/image-size-control/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/warning-max-depth-exceeded.native.js +30 -32
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/{explorer.js → index.js} +5 -5
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +3 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/index.js +66 -0
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +42 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +100 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
- package/build-module/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +7 -20
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +47 -0
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js +57 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +9 -5
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +15 -12
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +4 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +13 -8
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +25 -23
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +6 -5
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/link-control/index.js +7 -6
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +39 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +16 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +3 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +69 -17
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -14
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +4 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/format-edit.js +38 -0
- package/build-module/components/rich-text/native/format-edit.js.map +1 -0
- package/build-module/components/rich-text/native/get-format-colors.native.js +34 -0
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -0
- package/build-module/components/rich-text/native/index.js +2 -0
- package/build-module/components/rich-text/native/index.js.map +1 -0
- package/build-module/components/rich-text/native/index.native.js +1179 -0
- package/build-module/components/rich-text/native/index.native.js.map +1 -0
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +51 -0
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
- package/build-module/components/rich-text/native/use-format-types.js +104 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +31 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +2 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +4 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +2 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -2
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +8 -8
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +2 -2
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +5 -4
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +17 -5
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +5 -6
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +40 -0
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +3 -3
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +6 -5
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-fields.js +57 -52
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/duotone.js +10 -21
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +103 -93
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +11 -10
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +10 -13
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +30 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +4 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/private-apis.js +4 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +29 -37
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +17 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +24 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +26 -20
- package/build-style/style.css +26 -20
- package/package.json +31 -31
- package/src/components/block-heading-level-dropdown/index.js +1 -1
- package/src/components/block-list/block.native.js +2 -0
- package/src/components/block-list/index.js +4 -18
- package/src/components/block-list-appender/index.js +20 -4
- package/src/components/block-parent-selector/index.js +1 -1
- package/src/components/block-pattern-setup/index.js +38 -22
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
- package/src/components/block-pattern-setup/style.scss +4 -1
- package/src/components/block-patterns-list/README.md +4 -4
- package/src/components/block-patterns-list/index.js +60 -34
- package/src/components/block-patterns-list/style.scss +7 -0
- package/src/components/block-quick-navigation/index.js +11 -5
- package/src/components/block-rename/index.js +3 -0
- package/src/components/block-rename/is-empty-string.js +3 -0
- package/src/components/block-rename/modal.js +115 -0
- package/src/components/block-rename/rename-control.js +80 -0
- package/src/components/block-rename/use-block-rename.js +10 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/block-styles/index.js +0 -10
- package/src/components/block-switcher/pattern-transformations-menu.js +20 -14
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
- package/src/components/block-toolbar/style.scss +8 -0
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-contextual-toolbar.js +11 -134
- package/src/components/block-tools/empty-block-inserter.js +56 -0
- package/src/components/block-tools/index.js +72 -16
- package/src/components/block-tools/selected-block-tools.js +127 -0
- package/src/components/block-tools/style.scss +0 -10
- package/src/components/block-tools/use-selected-block-tool-props.js +66 -0
- package/src/components/block-types-list/index.js +5 -4
- package/src/components/button-block-appender/content.scss +2 -2
- package/src/components/date-format-picker/index.js +7 -0
- package/src/components/editable-text/README.md +0 -36
- package/src/components/editable-text/index.js +1 -8
- package/src/components/global-styles/advanced-panel.js +1 -1
- package/src/components/iframe/index.js +4 -3
- package/src/components/image-size-control/index.js +0 -6
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
- package/src/components/inserter/block-patterns-explorer/{explorer.js → index.js} +4 -4
- package/src/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +9 -2
- package/src/components/inserter/block-patterns-tab/index.js +118 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +179 -0
- package/src/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +15 -21
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +101 -0
- package/src/components/inserter/block-patterns-tab/utils.js +78 -0
- package/src/components/inserter/hooks/use-patterns-state.js +3 -1
- package/src/components/inserter/media-tab/media-list.js +7 -7
- package/src/components/inserter/media-tab/media-preview.js +27 -22
- package/src/components/inserter/menu.js +4 -5
- package/src/components/inserter-listbox/index.js +11 -7
- package/src/components/inserter-listbox/item.js +11 -12
- package/src/components/inserter-listbox/row.js +6 -12
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/index.js +15 -6
- package/src/components/link-control/style.scss +8 -5
- package/src/components/list-view/block-select-button.js +44 -1
- package/src/components/list-view/block.js +11 -11
- package/src/components/list-view/index.js +2 -0
- package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
- package/src/components/media-replace-flow/style.scss +2 -2
- package/src/components/navigable-toolbar/index.js +71 -25
- package/src/components/plain-text/README.md +2 -30
- package/src/components/preview-options/index.js +2 -0
- package/src/components/provider/use-block-sync.js +2 -21
- package/src/components/rich-text/README.md +6 -63
- package/src/components/rich-text/index.js +0 -1
- package/src/components/rich-text/index.native.js +4 -2
- package/src/components/rich-text/native/format-edit.js +44 -0
- package/src/components/rich-text/native/get-format-colors.native.js +54 -0
- package/src/components/rich-text/native/index.js +1 -0
- package/src/components/rich-text/native/index.native.js +1406 -0
- package/src/components/rich-text/native/style.native.scss +28 -0
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +79 -0
- package/src/components/rich-text/native/test/index.native.js +278 -0
- package/src/components/rich-text/native/test/performance/rich-text.native.js +44 -0
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +61 -0
- package/src/components/rich-text/native/use-format-types.js +146 -0
- package/src/components/rich-text/use-input-rules.js +30 -2
- package/src/components/rich-text/use-paste-handler.js +1 -6
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/url-input/README.md +1 -74
- package/src/components/url-popover/image-url-input-ui.js +1 -0
- package/src/components/use-block-drop-zone/index.js +4 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/index.js +2 -2
- package/src/components/use-settings/test/index.js +1 -1
- package/src/components/writing-flow/use-tab-nav.js +8 -3
- package/src/hooks/align.js +8 -8
- package/src/hooks/align.native.js +2 -2
- package/src/hooks/anchor.js +21 -23
- package/src/hooks/background.js +28 -6
- package/src/hooks/block-hooks.js +20 -16
- package/src/hooks/block-renaming.js +47 -0
- package/src/hooks/content-lock-ui.js +3 -3
- package/src/hooks/custom-class-name.js +7 -6
- package/src/hooks/custom-fields.js +73 -70
- package/src/hooks/duotone.js +23 -33
- package/src/hooks/index.js +0 -1
- package/src/hooks/layout.js +126 -113
- package/src/hooks/position.js +8 -21
- package/src/hooks/style.js +17 -31
- package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
- package/src/hooks/test/align.js +4 -4
- package/src/hooks/utils.js +33 -1
- package/src/layouts/constrained.js +57 -50
- package/src/private-apis.js +4 -1
- package/src/store/actions.js +26 -72
- package/src/store/reducer.js +19 -0
- package/src/store/selectors.js +15 -19
- package/src/style.scss +1 -1
- package/src/utils/test/transform-styles.js +49 -0
- package/src/utils/transform-styles/index.js +39 -13
- package/build/components/block-tools/selected-block-popover.js +0 -221
- package/build/components/block-tools/selected-block-popover.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
- package/build/components/inserter/block-patterns-filter.js.map +0 -1
- package/build/components/inserter/block-patterns-tab.js +0 -270
- package/build/components/inserter/block-patterns-tab.js.map +0 -1
- package/build/hooks/block-rename-ui.js +0 -165
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build/store/utils.js +0 -22
- package/build/store/utils.js.map +0 -1
- package/build-module/components/block-tools/selected-block-popover.js +0 -213
- package/build-module/components/block-tools/selected-block-popover.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
- package/build-module/components/inserter/block-patterns-filter.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab.js +0 -254
- package/build-module/components/inserter/block-patterns-tab.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -157
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/build-module/store/utils.js +0 -16
- package/build-module/store/utils.js.map +0 -1
- package/src/components/block-tools/selected-block-popover.js +0 -265
- package/src/components/inserter/block-patterns-tab.js +0 -448
- package/src/hooks/block-rename-ui.js +0 -226
- package/src/store/utils.js +0 -12
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
- /package/src/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useRef, useEffect } from '@wordpress/element';
|
|
10
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
+
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import BlockSelectionButton from './block-selection-button';
|
|
17
|
+
import BlockContextualToolbar from './block-contextual-toolbar';
|
|
18
|
+
import { store as blockEditorStore } from '../../store';
|
|
19
|
+
import BlockPopover from '../block-popover';
|
|
20
|
+
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
21
|
+
import useSelectedBlockToolProps from './use-selected-block-tool-props';
|
|
22
|
+
import { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';
|
|
23
|
+
|
|
24
|
+
export default function SelectedBlockTools( {
|
|
25
|
+
clientId,
|
|
26
|
+
showEmptyBlockSideInserter,
|
|
27
|
+
__unstableContentRef,
|
|
28
|
+
} ) {
|
|
29
|
+
const {
|
|
30
|
+
capturingClientId,
|
|
31
|
+
isInsertionPointVisible,
|
|
32
|
+
lastClientId,
|
|
33
|
+
rootClientId,
|
|
34
|
+
} = useSelectedBlockToolProps( clientId );
|
|
35
|
+
|
|
36
|
+
const { shouldShowBreadcrumb } = useSelect( ( select ) => {
|
|
37
|
+
const { hasMultiSelection, __unstableGetEditorMode } =
|
|
38
|
+
select( blockEditorStore );
|
|
39
|
+
|
|
40
|
+
const editorMode = __unstableGetEditorMode();
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
shouldShowBreadcrumb:
|
|
44
|
+
! hasMultiSelection() &&
|
|
45
|
+
( editorMode === 'navigation' || editorMode === 'zoom-out' ),
|
|
46
|
+
};
|
|
47
|
+
}, [] );
|
|
48
|
+
|
|
49
|
+
const isToolbarForced = useRef( false );
|
|
50
|
+
const { shouldShowContextualToolbar, canFocusHiddenToolbar } =
|
|
51
|
+
useShouldContextualToolbarShow();
|
|
52
|
+
|
|
53
|
+
const { stopTyping } = useDispatch( blockEditorStore );
|
|
54
|
+
|
|
55
|
+
useShortcut(
|
|
56
|
+
'core/block-editor/focus-toolbar',
|
|
57
|
+
() => {
|
|
58
|
+
isToolbarForced.current = true;
|
|
59
|
+
stopTyping( true );
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
isDisabled: ! canFocusHiddenToolbar,
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
useEffect( () => {
|
|
67
|
+
isToolbarForced.current = false;
|
|
68
|
+
} );
|
|
69
|
+
|
|
70
|
+
// Stores the active toolbar item index so the block toolbar can return focus
|
|
71
|
+
// to it when re-mounting.
|
|
72
|
+
const initialToolbarItemIndexRef = useRef();
|
|
73
|
+
|
|
74
|
+
useEffect( () => {
|
|
75
|
+
// Resets the index whenever the active block changes so this is not
|
|
76
|
+
// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
77
|
+
initialToolbarItemIndexRef.current = undefined;
|
|
78
|
+
}, [ clientId ] );
|
|
79
|
+
|
|
80
|
+
const popoverProps = useBlockToolbarPopoverProps( {
|
|
81
|
+
contentElement: __unstableContentRef?.current,
|
|
82
|
+
clientId,
|
|
83
|
+
} );
|
|
84
|
+
|
|
85
|
+
if ( showEmptyBlockSideInserter ) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ( shouldShowBreadcrumb || shouldShowContextualToolbar ) {
|
|
90
|
+
return (
|
|
91
|
+
<BlockPopover
|
|
92
|
+
clientId={ capturingClientId || clientId }
|
|
93
|
+
bottomClientId={ lastClientId }
|
|
94
|
+
className={ classnames(
|
|
95
|
+
'block-editor-block-list__block-popover',
|
|
96
|
+
{
|
|
97
|
+
'is-insertion-point-visible': isInsertionPointVisible,
|
|
98
|
+
}
|
|
99
|
+
) }
|
|
100
|
+
resize={ false }
|
|
101
|
+
{ ...popoverProps }
|
|
102
|
+
>
|
|
103
|
+
{ shouldShowContextualToolbar && (
|
|
104
|
+
<BlockContextualToolbar
|
|
105
|
+
// If the toolbar is being shown because of being forced
|
|
106
|
+
// it should focus the toolbar right after the mount.
|
|
107
|
+
focusOnMount={ isToolbarForced.current }
|
|
108
|
+
__experimentalInitialIndex={
|
|
109
|
+
initialToolbarItemIndexRef.current
|
|
110
|
+
}
|
|
111
|
+
__experimentalOnIndexChange={ ( index ) => {
|
|
112
|
+
initialToolbarItemIndexRef.current = index;
|
|
113
|
+
} }
|
|
114
|
+
/>
|
|
115
|
+
) }
|
|
116
|
+
{ shouldShowBreadcrumb && (
|
|
117
|
+
<BlockSelectionButton
|
|
118
|
+
clientId={ clientId }
|
|
119
|
+
rootClientId={ rootClientId }
|
|
120
|
+
/>
|
|
121
|
+
) }
|
|
122
|
+
</BlockPopover>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
@@ -118,16 +118,6 @@
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
// Add a scrim to the right of the collapsed button.
|
|
122
|
-
&.is-collapsed::after {
|
|
123
|
-
content: "";
|
|
124
|
-
position: absolute;
|
|
125
|
-
left: 100%;
|
|
126
|
-
width: $grid-unit-60;
|
|
127
|
-
height: 100%;
|
|
128
|
-
background: linear-gradient(to right, $white, transparent);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
121
|
@include break-medium() {
|
|
132
122
|
&.is-fixed {
|
|
133
123
|
& > .block-editor-block-toolbar {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { store as blockEditorStore } from '../../store';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns props for the selected block tools and empty block inserter.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} clientId Selected block client ID.
|
|
15
|
+
*/
|
|
16
|
+
export default function useSelectedBlockToolProps( clientId ) {
|
|
17
|
+
const selectedBlockProps = useSelect(
|
|
18
|
+
( select ) => {
|
|
19
|
+
const {
|
|
20
|
+
getBlockRootClientId,
|
|
21
|
+
getBlockParents,
|
|
22
|
+
__experimentalGetBlockListSettingsForBlocks,
|
|
23
|
+
isBlockInsertionPointVisible,
|
|
24
|
+
getBlockInsertionPoint,
|
|
25
|
+
getBlockOrder,
|
|
26
|
+
hasMultiSelection,
|
|
27
|
+
getLastMultiSelectedBlockClientId,
|
|
28
|
+
} = select( blockEditorStore );
|
|
29
|
+
|
|
30
|
+
const blockParentsClientIds = getBlockParents( clientId );
|
|
31
|
+
|
|
32
|
+
// Get Block List Settings for all ancestors of the current Block clientId.
|
|
33
|
+
const parentBlockListSettings =
|
|
34
|
+
__experimentalGetBlockListSettingsForBlocks(
|
|
35
|
+
blockParentsClientIds
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// Get the clientId of the topmost parent with the capture toolbars setting.
|
|
39
|
+
const capturingClientId = blockParentsClientIds.find(
|
|
40
|
+
( parentClientId ) =>
|
|
41
|
+
parentBlockListSettings[ parentClientId ]
|
|
42
|
+
?.__experimentalCaptureToolbars
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
let isInsertionPointVisible = false;
|
|
46
|
+
if ( isBlockInsertionPointVisible() ) {
|
|
47
|
+
const insertionPoint = getBlockInsertionPoint();
|
|
48
|
+
const order = getBlockOrder( insertionPoint.rootClientId );
|
|
49
|
+
isInsertionPointVisible =
|
|
50
|
+
order[ insertionPoint.index ] === clientId;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
capturingClientId,
|
|
55
|
+
isInsertionPointVisible,
|
|
56
|
+
lastClientId: hasMultiSelection()
|
|
57
|
+
? getLastMultiSelectedBlockClientId()
|
|
58
|
+
: null,
|
|
59
|
+
rootClientId: getBlockRootClientId( clientId ),
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
[ clientId ]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return selectedBlockProps;
|
|
66
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockMenuDefaultClassName } from '@wordpress/blocks';
|
|
5
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -25,11 +26,10 @@ function BlockTypesList( {
|
|
|
25
26
|
label,
|
|
26
27
|
isDraggable = true,
|
|
27
28
|
} ) {
|
|
29
|
+
const className = 'block-editor-block-types-list';
|
|
30
|
+
const listId = useInstanceId( BlockTypesList, className );
|
|
28
31
|
return (
|
|
29
|
-
<InserterListboxGroup
|
|
30
|
-
className="block-editor-block-types-list"
|
|
31
|
-
aria-label={ label }
|
|
32
|
-
>
|
|
32
|
+
<InserterListboxGroup className={ className } aria-label={ label }>
|
|
33
33
|
{ chunk( items, 3 ).map( ( row, i ) => (
|
|
34
34
|
<InserterListboxRow key={ i }>
|
|
35
35
|
{ row.map( ( item, j ) => (
|
|
@@ -43,6 +43,7 @@ function BlockTypesList( {
|
|
|
43
43
|
onHover={ onHover }
|
|
44
44
|
isDraggable={ isDraggable && ! item.isDisabled }
|
|
45
45
|
isFirst={ i === 0 && j === 0 }
|
|
46
|
+
rowId={ `${ listId }-${ i }` }
|
|
46
47
|
/>
|
|
47
48
|
) ) }
|
|
48
49
|
</InserterListboxRow>
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
.is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &,
|
|
40
40
|
.is-layout-flow.block-editor-block-list__block:not(.is-selected) > &,
|
|
41
41
|
// Legacy groups have an inner container so need to be targeted separately
|
|
42
|
-
.
|
|
43
|
-
.
|
|
42
|
+
.block-editor-block-list__block:not(.is-selected) > .is-layout-constrained.wp-block-group__inner-container > &,
|
|
43
|
+
.block-editor-block-list__block:not(.is-selected) > .is-layout-flow.wp-block-group__inner-container > & {
|
|
44
44
|
pointer-events: none;
|
|
45
45
|
|
|
46
46
|
&::after {
|
|
@@ -78,12 +78,19 @@ function NonDefaultControls( { format, onChange } ) {
|
|
|
78
78
|
// formats.
|
|
79
79
|
const suggestedFormats = [
|
|
80
80
|
...new Set( [
|
|
81
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
81
82
|
'Y-m-d',
|
|
83
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
82
84
|
_x( 'n/j/Y', 'short date format' ),
|
|
85
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
83
86
|
_x( 'n/j/Y g:i A', 'short date format with time' ),
|
|
87
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
84
88
|
_x( 'M j, Y', 'medium date format' ),
|
|
89
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
85
90
|
_x( 'M j, Y g:i A', 'medium date format with time' ),
|
|
91
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
86
92
|
_x( 'F j, Y', 'long date format' ),
|
|
93
|
+
/* translators: See https://www.php.net/manual/datetime.format.php */
|
|
87
94
|
_x( 'M j', 'short date format without the year' ),
|
|
88
95
|
] ),
|
|
89
96
|
];
|
|
@@ -47,40 +47,6 @@ _Optional._ Called when the block can be removed. `forward` is true when the sel
|
|
|
47
47
|
|
|
48
48
|
## Example
|
|
49
49
|
|
|
50
|
-
{% codetabs %}
|
|
51
|
-
{% ES5 %}
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
wp.blocks.registerBlockType( /* ... */, {
|
|
55
|
-
// ...
|
|
56
|
-
|
|
57
|
-
attributes: {
|
|
58
|
-
content: {
|
|
59
|
-
source: 'html',
|
|
60
|
-
selector: 'div',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
edit: function( props ) {
|
|
65
|
-
return React.createElement( wp.editor.EditableText, {
|
|
66
|
-
className: props.className,
|
|
67
|
-
value: props.attributes.content,
|
|
68
|
-
onChange: function( content ) {
|
|
69
|
-
props.setAttributes( { content: content } );
|
|
70
|
-
}
|
|
71
|
-
} );
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
save: function( props ) {
|
|
75
|
-
return React.createElement( wp.editor.EditableText.Content, {
|
|
76
|
-
value: props.attributes.content
|
|
77
|
-
} );
|
|
78
|
-
}
|
|
79
|
-
} );
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
{% ESNext %}
|
|
83
|
-
|
|
84
50
|
```js
|
|
85
51
|
const { registerBlockType } = wp.blocks;
|
|
86
52
|
const { EditableText } = wp.editor;
|
|
@@ -110,5 +76,3 @@ registerBlockType( /* ... */, {
|
|
|
110
76
|
}
|
|
111
77
|
} );
|
|
112
78
|
```
|
|
113
|
-
|
|
114
|
-
{% end %}
|
|
@@ -9,14 +9,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
9
9
|
import RichText from '../rich-text';
|
|
10
10
|
|
|
11
11
|
const EditableText = forwardRef( ( props, ref ) => {
|
|
12
|
-
return
|
|
13
|
-
<RichText
|
|
14
|
-
ref={ ref }
|
|
15
|
-
{ ...props }
|
|
16
|
-
__unstableDisableFormats
|
|
17
|
-
preserveWhiteSpace
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
12
|
+
return <RichText ref={ ref } { ...props } __unstableDisableFormats />;
|
|
20
13
|
} );
|
|
21
14
|
|
|
22
15
|
EditableText.Content = ( { value = '', tagName: Tag = 'div', ...props } ) => {
|
|
@@ -73,12 +73,13 @@ function bubbleEvent( event, Constructor, frame ) {
|
|
|
73
73
|
* @param {Document} iframeDocument Document to attach listeners to.
|
|
74
74
|
*/
|
|
75
75
|
function useBubbleEvents( iframeDocument ) {
|
|
76
|
-
return useRefEffect( (
|
|
76
|
+
return useRefEffect( () => {
|
|
77
77
|
const { defaultView } = iframeDocument;
|
|
78
78
|
if ( ! defaultView ) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
const { frameElement } = defaultView;
|
|
82
|
+
const html = iframeDocument.documentElement;
|
|
82
83
|
const eventTypes = [ 'dragover', 'mousemove' ];
|
|
83
84
|
const handlers = {};
|
|
84
85
|
for ( const name of eventTypes ) {
|
|
@@ -88,12 +89,12 @@ function useBubbleEvents( iframeDocument ) {
|
|
|
88
89
|
const Constructor = window[ constructorName ];
|
|
89
90
|
bubbleEvent( event, Constructor, frameElement );
|
|
90
91
|
};
|
|
91
|
-
|
|
92
|
+
html.addEventListener( name, handlers[ name ] );
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
return () => {
|
|
95
96
|
for ( const name of eventTypes ) {
|
|
96
|
-
|
|
97
|
+
html.removeEventListener( name, handlers[ name ] );
|
|
97
98
|
}
|
|
98
99
|
};
|
|
99
100
|
} );
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
__experimentalNumberControl as NumberControl,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
import deprecated from '@wordpress/deprecated';
|
|
12
11
|
import { __ } from '@wordpress/i18n';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -31,11 +30,6 @@ export default function ImageSizeControl( {
|
|
|
31
30
|
onChange,
|
|
32
31
|
onChangeImage = noop,
|
|
33
32
|
} ) {
|
|
34
|
-
deprecated( 'wp.blockEditor.__experimentalImageSizeControl', {
|
|
35
|
-
since: '6.3',
|
|
36
|
-
alternative:
|
|
37
|
-
'wp.blockEditor.privateApis.DimensionsTool and wp.blockEditor.privateApis.ResolutionTool',
|
|
38
|
-
} );
|
|
39
33
|
const { currentHeight, currentWidth, updateDimension, updateDimensions } =
|
|
40
34
|
useDimensionHandler( height, width, imageHeight, imageWidth, onChange );
|
|
41
35
|
|
|
@@ -169,8 +169,11 @@ const ForwardedInnerBlocks = forwardRef( ( props, ref ) => {
|
|
|
169
169
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md
|
|
170
170
|
*/
|
|
171
171
|
export function useInnerBlocksProps( props = {}, options = {} ) {
|
|
172
|
-
const {
|
|
173
|
-
|
|
172
|
+
const {
|
|
173
|
+
__unstableDisableLayoutClassNames,
|
|
174
|
+
__unstableDisableDropZone,
|
|
175
|
+
dropZoneElement,
|
|
176
|
+
} = options;
|
|
174
177
|
const {
|
|
175
178
|
clientId,
|
|
176
179
|
layout = null,
|
|
@@ -211,6 +214,7 @@ export function useInnerBlocksProps( props = {}, options = {} ) {
|
|
|
211
214
|
);
|
|
212
215
|
|
|
213
216
|
const blockDropZoneRef = useBlockDropZone( {
|
|
217
|
+
dropZoneElement,
|
|
214
218
|
rootClientId: clientId,
|
|
215
219
|
} );
|
|
216
220
|
|
|
@@ -8,7 +8,7 @@ import { TouchableWithoutFeedback, View } from 'react-native';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
10
|
import { useState } from '@wordpress/element';
|
|
11
|
-
import {
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -18,54 +18,71 @@ import UnsupportedBlockDetails from '../unsupported-block-details';
|
|
|
18
18
|
import { store as blockEditorStore } from '../../store';
|
|
19
19
|
import { MAX_NESTING_DEPTH } from './constants';
|
|
20
20
|
import useUnsupportedBlockEditor from '../use-unsupported-block-editor';
|
|
21
|
+
import {
|
|
22
|
+
useConvertToGroupButtons,
|
|
23
|
+
useConvertToGroupButtonProps,
|
|
24
|
+
} from '../convert-to-group-buttons';
|
|
25
|
+
|
|
26
|
+
const EMPTY_ARRAY = [];
|
|
21
27
|
|
|
22
28
|
const WarningMaxDepthExceeded = ( { clientId } ) => {
|
|
23
29
|
const [ showDetails, setShowDetails ] = useState( false );
|
|
24
30
|
|
|
25
|
-
const
|
|
26
|
-
( select ) =>
|
|
27
|
-
const { getBlock, isBlockSelected } = select( blockEditorStore );
|
|
28
|
-
return {
|
|
29
|
-
innerBlocks: getBlock( clientId )?.innerBlocks || [],
|
|
30
|
-
isSelected: isBlockSelected( clientId ),
|
|
31
|
-
};
|
|
32
|
-
},
|
|
31
|
+
const isSelected = useSelect(
|
|
32
|
+
( select ) => select( blockEditorStore ).isBlockSelected( clientId ),
|
|
33
33
|
[ clientId ]
|
|
34
34
|
);
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
// We rely on the logic related to the Group/Ungroup buttons used in the block options to
|
|
37
|
+
// determine whether to use the Ungroup action.
|
|
38
|
+
const convertToGroupButtonProps = useConvertToGroupButtonProps( [
|
|
39
|
+
clientId,
|
|
40
|
+
] );
|
|
41
|
+
const { isUngroupable } = convertToGroupButtonProps;
|
|
42
|
+
const convertToGroupButtons = useConvertToGroupButtons( {
|
|
43
|
+
...convertToGroupButtonProps,
|
|
44
|
+
} );
|
|
45
|
+
const onUngroup = convertToGroupButtons.ungroup.onSelect;
|
|
36
46
|
|
|
37
47
|
const {
|
|
38
48
|
isUnsupportedBlockEditorSupported,
|
|
39
49
|
canEnableUnsupportedBlockEditor,
|
|
40
50
|
} = useUnsupportedBlockEditor( clientId );
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
replaceBlocks( clientId, innerBlocks );
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
let description;
|
|
51
|
-
// When UBE can't be used, the description mentions using the web browser to edit the block.
|
|
52
|
+
/* translators: Warning related to having blocks deeply nested. %d: The deepest nesting level. */
|
|
53
|
+
const descriptionFormat = __(
|
|
54
|
+
'Blocks nested deeper than %d levels may not render properly in the mobile editor.'
|
|
55
|
+
);
|
|
56
|
+
let description = sprintf( descriptionFormat, MAX_NESTING_DEPTH );
|
|
52
57
|
if (
|
|
53
58
|
! isUnsupportedBlockEditorSupported &&
|
|
54
59
|
! canEnableUnsupportedBlockEditor
|
|
55
60
|
) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
'
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
// When UBE can't be used, the description mentions using the web browser to edit the block.
|
|
62
|
+
description +=
|
|
63
|
+
' ' +
|
|
64
|
+
/* translators: Recommendation included in a warning related to having blocks deeply nested. */
|
|
65
|
+
__(
|
|
66
|
+
'For this reason, we recommend editing the block using your web browser.'
|
|
67
|
+
);
|
|
61
68
|
}
|
|
62
69
|
// Otherwise, the description mentions using the web editor (i.e. UBE).
|
|
63
70
|
else {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
description +=
|
|
72
|
+
' ' +
|
|
73
|
+
/* translators: Recommendation included in a warning related to having blocks deeply nested. */
|
|
74
|
+
__(
|
|
75
|
+
'For this reason, we recommend editing the block using the web editor.'
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
// If the block can be flattened, we also suggest to ungroup the block.
|
|
79
|
+
if ( isUngroupable ) {
|
|
80
|
+
description +=
|
|
81
|
+
' ' +
|
|
82
|
+
/* translators: Alternative option included in a warning related to having blocks deeply nested. */
|
|
83
|
+
__(
|
|
84
|
+
'Alternatively, you can flatten the content by ungrouping the block.'
|
|
85
|
+
);
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
return (
|
|
@@ -88,9 +105,16 @@ const WarningMaxDepthExceeded = ( { clientId } ) => {
|
|
|
88
105
|
onCloseSheet={ () => setShowDetails( false ) }
|
|
89
106
|
title={ __( 'Deeply nested block' ) }
|
|
90
107
|
description={ description }
|
|
91
|
-
customActions={
|
|
92
|
-
|
|
93
|
-
|
|
108
|
+
customActions={
|
|
109
|
+
isUngroupable
|
|
110
|
+
? [
|
|
111
|
+
{
|
|
112
|
+
label: __( 'Ungroup block' ),
|
|
113
|
+
onPress: onUngroup,
|
|
114
|
+
},
|
|
115
|
+
]
|
|
116
|
+
: EMPTY_ARRAY
|
|
117
|
+
}
|
|
94
118
|
/>
|
|
95
119
|
</View>
|
|
96
120
|
</TouchableWithoutFeedback>
|
|
@@ -8,9 +8,9 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import PatternExplorerSidebar from './sidebar';
|
|
12
|
-
import PatternList from './
|
|
13
|
-
import {
|
|
11
|
+
import PatternExplorerSidebar from './pattern-explorer-sidebar';
|
|
12
|
+
import PatternList from './pattern-list';
|
|
13
|
+
import { usePatternCategories } from '../block-patterns-tab/use-pattern-categories';
|
|
14
14
|
|
|
15
15
|
function PatternsExplorer( { initialCategory, rootClientId } ) {
|
|
16
16
|
const [ searchValue, setSearchValue ] = useState( '' );
|
|
@@ -20,7 +20,7 @@ function PatternsExplorer( { initialCategory, rootClientId } ) {
|
|
|
20
20
|
initialCategory?.name
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const patternCategories =
|
|
23
|
+
const patternCategories = usePatternCategories(
|
|
24
24
|
rootClientId,
|
|
25
25
|
patternSourceFilter
|
|
26
26
|
);
|
package/src/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js}
RENAMED
|
@@ -17,7 +17,11 @@ import InserterListbox from '../../inserter-listbox';
|
|
|
17
17
|
import { searchItems } from '../search-items';
|
|
18
18
|
import BlockPatternsPaging from '../../block-patterns-paging';
|
|
19
19
|
import usePatternsPaging from '../hooks/use-patterns-paging';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
PATTERN_TYPES,
|
|
22
|
+
allPatternsCategory,
|
|
23
|
+
myPatternsCategory,
|
|
24
|
+
} from '../block-patterns-tab/utils';
|
|
21
25
|
|
|
22
26
|
function PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {
|
|
23
27
|
if ( ! filterValue ) {
|
|
@@ -67,7 +71,10 @@ function PatternList( { searchValue, selectedCategory, patternCategories } ) {
|
|
|
67
71
|
if ( selectedCategory === allPatternsCategory.name ) {
|
|
68
72
|
return true;
|
|
69
73
|
}
|
|
70
|
-
if (
|
|
74
|
+
if (
|
|
75
|
+
selectedCategory === myPatternsCategory.name &&
|
|
76
|
+
pattern.type === PATTERN_TYPES.user
|
|
77
|
+
) {
|
|
71
78
|
return true;
|
|
72
79
|
}
|
|
73
80
|
if ( selectedCategory === 'uncategorized' ) {
|