@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
|
@@ -5,9 +5,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
5
5
|
import { cloneBlock } from '@wordpress/blocks';
|
|
6
6
|
import {
|
|
7
7
|
VisuallyHidden,
|
|
8
|
-
|
|
9
|
-
__unstableUseCompositeState as useCompositeState,
|
|
10
|
-
__unstableCompositeItem as CompositeItem,
|
|
8
|
+
privateApis as componentsPrivateApis,
|
|
11
9
|
} from '@wordpress/components';
|
|
12
10
|
|
|
13
11
|
import { useState } from '@wordpress/element';
|
|
@@ -22,6 +20,13 @@ import BlockPreview from '../block-preview';
|
|
|
22
20
|
import SetupToolbar from './setup-toolbar';
|
|
23
21
|
import usePatternsSetup from './use-patterns-setup';
|
|
24
22
|
import { VIEWMODES } from './constants';
|
|
23
|
+
import { unlock } from '../../lock-unlock';
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
CompositeV2: Composite,
|
|
27
|
+
CompositeItemV2: CompositeItem,
|
|
28
|
+
useCompositeStoreV2: useCompositeStore,
|
|
29
|
+
} = unlock( componentsPrivateApis );
|
|
25
30
|
|
|
26
31
|
const SetupContent = ( {
|
|
27
32
|
viewMode,
|
|
@@ -30,8 +35,9 @@ const SetupContent = ( {
|
|
|
30
35
|
onBlockPatternSelect,
|
|
31
36
|
showTitles,
|
|
32
37
|
} ) => {
|
|
33
|
-
const
|
|
38
|
+
const compositeStore = useCompositeStore();
|
|
34
39
|
const containerClass = 'block-editor-block-pattern-setup__container';
|
|
40
|
+
|
|
35
41
|
if ( viewMode === VIEWMODES.carousel ) {
|
|
36
42
|
const slideClass = new Map( [
|
|
37
43
|
[ activeSlide, 'active-slide' ],
|
|
@@ -41,23 +47,25 @@ const SetupContent = ( {
|
|
|
41
47
|
return (
|
|
42
48
|
<div className="block-editor-block-pattern-setup__carousel">
|
|
43
49
|
<div className={ containerClass }>
|
|
44
|
-
<
|
|
50
|
+
<div className="carousel-container">
|
|
45
51
|
{ patterns.map( ( pattern, index ) => (
|
|
46
52
|
<BlockPatternSlide
|
|
53
|
+
active={ index === activeSlide }
|
|
47
54
|
className={ slideClass.get( index ) || '' }
|
|
48
55
|
key={ pattern.name }
|
|
49
56
|
pattern={ pattern }
|
|
50
57
|
/>
|
|
51
58
|
) ) }
|
|
52
|
-
</
|
|
59
|
+
</div>
|
|
53
60
|
</div>
|
|
54
61
|
</div>
|
|
55
62
|
);
|
|
56
63
|
}
|
|
64
|
+
|
|
57
65
|
return (
|
|
58
66
|
<div className="block-editor-block-pattern-setup__grid">
|
|
59
67
|
<Composite
|
|
60
|
-
{
|
|
68
|
+
store={ compositeStore }
|
|
61
69
|
role="listbox"
|
|
62
70
|
className={ containerClass }
|
|
63
71
|
aria-label={ __( 'Patterns list' ) }
|
|
@@ -67,7 +75,6 @@ const SetupContent = ( {
|
|
|
67
75
|
key={ pattern.name }
|
|
68
76
|
pattern={ pattern }
|
|
69
77
|
onSelect={ onBlockPatternSelect }
|
|
70
|
-
composite={ composite }
|
|
71
78
|
showTitles={ showTitles }
|
|
72
79
|
/>
|
|
73
80
|
) ) }
|
|
@@ -76,7 +83,7 @@ const SetupContent = ( {
|
|
|
76
83
|
);
|
|
77
84
|
};
|
|
78
85
|
|
|
79
|
-
function BlockPattern( { pattern, onSelect,
|
|
86
|
+
function BlockPattern( { pattern, onSelect, showTitles } ) {
|
|
80
87
|
const baseClassName = 'block-editor-block-pattern-setup-list';
|
|
81
88
|
const { blocks, description, viewportWidth = 700 } = pattern;
|
|
82
89
|
const descriptionId = useInstanceId(
|
|
@@ -84,16 +91,19 @@ function BlockPattern( { pattern, onSelect, composite, showTitles } ) {
|
|
|
84
91
|
`${ baseClassName }__item-description`
|
|
85
92
|
);
|
|
86
93
|
return (
|
|
87
|
-
<div
|
|
88
|
-
className={ `${ baseClassName }__list-item` }
|
|
89
|
-
aria-label={ pattern.title }
|
|
90
|
-
aria-describedby={ pattern.description ? descriptionId : undefined }
|
|
91
|
-
>
|
|
94
|
+
<div className={ `${ baseClassName }__list-item` }>
|
|
92
95
|
<CompositeItem
|
|
96
|
+
render={
|
|
97
|
+
<div
|
|
98
|
+
aria-describedby={
|
|
99
|
+
description ? descriptionId : undefined
|
|
100
|
+
}
|
|
101
|
+
aria-label={ pattern.title }
|
|
102
|
+
className={ `${ baseClassName }__item` }
|
|
103
|
+
/>
|
|
104
|
+
}
|
|
105
|
+
id={ `${ baseClassName }__pattern__${ pattern.name }` }
|
|
93
106
|
role="option"
|
|
94
|
-
as="div"
|
|
95
|
-
{ ...composite }
|
|
96
|
-
className={ `${ baseClassName }__item` }
|
|
97
107
|
onClick={ () => onSelect( blocks ) }
|
|
98
108
|
>
|
|
99
109
|
<BlockPreview
|
|
@@ -115,14 +125,16 @@ function BlockPattern( { pattern, onSelect, composite, showTitles } ) {
|
|
|
115
125
|
);
|
|
116
126
|
}
|
|
117
127
|
|
|
118
|
-
function BlockPatternSlide( { className, pattern, minHeight } ) {
|
|
128
|
+
function BlockPatternSlide( { active, className, pattern, minHeight } ) {
|
|
119
129
|
const { blocks, title, description } = pattern;
|
|
120
130
|
const descriptionId = useInstanceId(
|
|
121
131
|
BlockPatternSlide,
|
|
122
132
|
'block-editor-block-pattern-setup-list__item-description'
|
|
123
133
|
);
|
|
124
134
|
return (
|
|
125
|
-
<
|
|
135
|
+
<div
|
|
136
|
+
aria-hidden={ ! active }
|
|
137
|
+
role="img"
|
|
126
138
|
className={ `pattern-slide ${ className }` }
|
|
127
139
|
aria-label={ title }
|
|
128
140
|
aria-describedby={ description ? descriptionId : undefined }
|
|
@@ -133,7 +145,7 @@ function BlockPatternSlide( { className, pattern, minHeight } ) {
|
|
|
133
145
|
{ description }
|
|
134
146
|
</VisuallyHidden>
|
|
135
147
|
) }
|
|
136
|
-
</
|
|
148
|
+
</div>
|
|
137
149
|
);
|
|
138
150
|
}
|
|
139
151
|
|
|
@@ -178,10 +190,14 @@ const BlockPatternSetup = ( {
|
|
|
178
190
|
activeSlide={ activeSlide }
|
|
179
191
|
totalSlides={ patterns.length }
|
|
180
192
|
handleNext={ () => {
|
|
181
|
-
setActiveSlide( ( active ) =>
|
|
193
|
+
setActiveSlide( ( active ) =>
|
|
194
|
+
Math.min( active + 1, patterns.length - 1 )
|
|
195
|
+
);
|
|
182
196
|
} }
|
|
183
197
|
handlePrevious={ () => {
|
|
184
|
-
setActiveSlide( ( active ) =>
|
|
198
|
+
setActiveSlide( ( active ) =>
|
|
199
|
+
Math.max( active - 1, 0 )
|
|
200
|
+
);
|
|
185
201
|
} }
|
|
186
202
|
onBlockPatternSelect={ () => {
|
|
187
203
|
onPatternSelectCallback(
|
|
@@ -35,12 +35,14 @@ const CarouselNavigation = ( {
|
|
|
35
35
|
label={ __( 'Previous pattern' ) }
|
|
36
36
|
onClick={ handlePrevious }
|
|
37
37
|
disabled={ activeSlide === 0 }
|
|
38
|
+
__experimentalIsFocusable
|
|
38
39
|
/>
|
|
39
40
|
<Button
|
|
40
41
|
icon={ chevronRight }
|
|
41
42
|
label={ __( 'Next pattern' ) }
|
|
42
43
|
onClick={ handleNext }
|
|
43
44
|
disabled={ activeSlide === totalSlides - 1 }
|
|
45
|
+
__experimentalIsFocusable
|
|
44
46
|
/>
|
|
45
47
|
</div>
|
|
46
48
|
);
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.block-editor-block-pattern-setup-list__item {
|
|
35
|
+
scroll-margin: 5px 0;
|
|
36
|
+
|
|
35
37
|
&:hover .block-editor-block-preview__container {
|
|
36
38
|
box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
|
|
37
39
|
}
|
|
@@ -44,6 +46,7 @@
|
|
|
44
46
|
color: var(--wp-admin-theme-color);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
49
|
+
|
|
47
50
|
.block-editor-block-pattern-setup-list__list-item {
|
|
48
51
|
break-inside: avoid-column;
|
|
49
52
|
margin-bottom: $grid-unit-30;
|
|
@@ -85,7 +88,7 @@
|
|
|
85
88
|
align-items: center;
|
|
86
89
|
justify-content: space-between;
|
|
87
90
|
border-top: 1px solid $gray-300;
|
|
88
|
-
align-self:
|
|
91
|
+
align-self: stretch;
|
|
89
92
|
|
|
90
93
|
.block-editor-block-pattern-setup__display-controls {
|
|
91
94
|
display: flex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Block Patterns List
|
|
2
2
|
|
|
3
|
-
The `
|
|
3
|
+
The `BlockPatternsList` component makes a list of the different registered block patterns. It uses the `BlockPreview` component to display a preview for each block pattern.
|
|
4
4
|
|
|
5
5
|
For more infos about blocks patterns, read [this](https://make.wordpress.org/core/2020/07/16/block-patterns-in-wordpress-5-5/).
|
|
6
6
|
|
|
@@ -18,10 +18,10 @@ For more infos about blocks patterns, read [this](https://make.wordpress.org/cor
|
|
|
18
18
|
Renders a block patterns list.
|
|
19
19
|
|
|
20
20
|
```jsx
|
|
21
|
-
import {
|
|
21
|
+
import { BlockPatternsList } from '@wordpress/block-editor';
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
<
|
|
23
|
+
const MyBlockPatternsList = () => (
|
|
24
|
+
<BlockPatternsList
|
|
25
25
|
blockPatterns={ shownBlockPatterns }
|
|
26
26
|
shownPatterns={ shownBlockPatterns }
|
|
27
27
|
onClickPattern={ onSelectBlockPattern }
|
|
@@ -6,13 +6,11 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useState, forwardRef } from '@wordpress/element';
|
|
9
|
+
import { useEffect, useState, forwardRef } from '@wordpress/element';
|
|
10
10
|
import {
|
|
11
11
|
VisuallyHidden,
|
|
12
|
-
__unstableComposite as Composite,
|
|
13
|
-
__unstableUseCompositeState as useCompositeState,
|
|
14
|
-
__unstableCompositeItem as CompositeItem,
|
|
15
12
|
Tooltip,
|
|
13
|
+
privateApis as componentsPrivateApis,
|
|
16
14
|
__experimentalHStack as HStack,
|
|
17
15
|
} from '@wordpress/components';
|
|
18
16
|
import { useInstanceId } from '@wordpress/compose';
|
|
@@ -22,9 +20,17 @@ import { Icon, symbol } from '@wordpress/icons';
|
|
|
22
20
|
/**
|
|
23
21
|
* Internal dependencies
|
|
24
22
|
*/
|
|
23
|
+
import { unlock } from '../../lock-unlock';
|
|
25
24
|
import BlockPreview from '../block-preview';
|
|
26
25
|
import InserterDraggableBlocks from '../inserter-draggable-blocks';
|
|
27
26
|
import BlockPatternsPaging from '../block-patterns-paging';
|
|
27
|
+
import { PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
CompositeV2: Composite,
|
|
31
|
+
CompositeItemV2: CompositeItem,
|
|
32
|
+
useCompositeStoreV2: useCompositeStore,
|
|
33
|
+
} = unlock( componentsPrivateApis );
|
|
28
34
|
|
|
29
35
|
const WithToolTip = ( { showTooltip, title, children } ) => {
|
|
30
36
|
if ( showTooltip ) {
|
|
@@ -34,11 +40,11 @@ const WithToolTip = ( { showTooltip, title, children } ) => {
|
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
function BlockPattern( {
|
|
43
|
+
id,
|
|
37
44
|
isDraggable,
|
|
38
45
|
pattern,
|
|
39
46
|
onClick,
|
|
40
47
|
onHover,
|
|
41
|
-
composite,
|
|
42
48
|
showTooltip,
|
|
43
49
|
} ) {
|
|
44
50
|
const [ isDragging, setIsDragging ] = useState( false );
|
|
@@ -71,20 +77,33 @@ function BlockPattern( {
|
|
|
71
77
|
} }
|
|
72
78
|
>
|
|
73
79
|
<WithToolTip
|
|
74
|
-
showTooltip={
|
|
80
|
+
showTooltip={
|
|
81
|
+
showTooltip && ! pattern.type !== PATTERN_TYPES.user
|
|
82
|
+
}
|
|
75
83
|
title={ pattern.title }
|
|
76
84
|
>
|
|
77
85
|
<CompositeItem
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
render={
|
|
87
|
+
<div
|
|
88
|
+
role="option"
|
|
89
|
+
aria-label={ pattern.title }
|
|
90
|
+
aria-describedby={
|
|
91
|
+
pattern.description
|
|
92
|
+
? descriptionId
|
|
93
|
+
: undefined
|
|
94
|
+
}
|
|
95
|
+
className={ classnames(
|
|
96
|
+
'block-editor-block-patterns-list__item',
|
|
97
|
+
{
|
|
98
|
+
'block-editor-block-patterns-list__list-item-synced':
|
|
99
|
+
pattern.type ===
|
|
100
|
+
PATTERN_TYPES.user &&
|
|
101
|
+
! pattern.syncStatus,
|
|
102
|
+
}
|
|
103
|
+
) }
|
|
104
|
+
/>
|
|
105
|
+
}
|
|
106
|
+
id={ id }
|
|
88
107
|
onClick={ () => {
|
|
89
108
|
onClick( pattern, blocks );
|
|
90
109
|
onHover?.( null );
|
|
@@ -96,10 +115,6 @@ function BlockPattern( {
|
|
|
96
115
|
onHover?.( pattern );
|
|
97
116
|
} }
|
|
98
117
|
onMouseLeave={ () => onHover?.( null ) }
|
|
99
|
-
aria-label={ pattern.title }
|
|
100
|
-
aria-describedby={
|
|
101
|
-
pattern.description ? descriptionId : undefined
|
|
102
|
-
}
|
|
103
118
|
>
|
|
104
119
|
<BlockPreview
|
|
105
120
|
blocks={ blocks }
|
|
@@ -107,15 +122,17 @@ function BlockPattern( {
|
|
|
107
122
|
/>
|
|
108
123
|
|
|
109
124
|
<HStack className="block-editor-patterns__pattern-details">
|
|
110
|
-
{ pattern.
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
{ pattern.type === PATTERN_TYPES.user &&
|
|
126
|
+
! pattern.syncStatus && (
|
|
127
|
+
<div className="block-editor-patterns__pattern-icon-wrapper">
|
|
128
|
+
<Icon
|
|
129
|
+
className="block-editor-patterns__pattern-icon"
|
|
130
|
+
icon={ symbol }
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
) }
|
|
134
|
+
{ ( ! showTooltip ||
|
|
135
|
+
pattern.type === PATTERN_TYPES.user ) && (
|
|
119
136
|
<div className="block-editor-block-patterns-list__item-title">
|
|
120
137
|
{ pattern.title }
|
|
121
138
|
</div>
|
|
@@ -141,7 +158,7 @@ function BlockPatternPlaceholder() {
|
|
|
141
158
|
);
|
|
142
159
|
}
|
|
143
160
|
|
|
144
|
-
function
|
|
161
|
+
function BlockPatternsList(
|
|
145
162
|
{
|
|
146
163
|
isDraggable,
|
|
147
164
|
blockPatterns,
|
|
@@ -155,10 +172,19 @@ function BlockPatternList(
|
|
|
155
172
|
},
|
|
156
173
|
ref
|
|
157
174
|
) {
|
|
158
|
-
const
|
|
175
|
+
const compositeStore = useCompositeStore( { orientation } );
|
|
176
|
+
const { setActiveId } = compositeStore;
|
|
177
|
+
|
|
178
|
+
useEffect( () => {
|
|
179
|
+
// We reset the active composite item whenever the
|
|
180
|
+
// available patterns change, to make sure that
|
|
181
|
+
// focus is put back to the start.
|
|
182
|
+
setActiveId( undefined );
|
|
183
|
+
}, [ setActiveId, shownPatterns, blockPatterns ] );
|
|
184
|
+
|
|
159
185
|
return (
|
|
160
186
|
<Composite
|
|
161
|
-
{
|
|
187
|
+
store={ compositeStore }
|
|
162
188
|
role="listbox"
|
|
163
189
|
className="block-editor-block-patterns-list"
|
|
164
190
|
aria-label={ label }
|
|
@@ -169,11 +195,11 @@ function BlockPatternList(
|
|
|
169
195
|
return isShown ? (
|
|
170
196
|
<BlockPattern
|
|
171
197
|
key={ pattern.name }
|
|
198
|
+
id={ pattern.name }
|
|
172
199
|
pattern={ pattern }
|
|
173
200
|
onClick={ onClickPattern }
|
|
174
201
|
onHover={ onHover }
|
|
175
202
|
isDraggable={ isDraggable }
|
|
176
|
-
composite={ composite }
|
|
177
203
|
showTooltip={ showTitlesAsTooltip }
|
|
178
204
|
/>
|
|
179
205
|
) : (
|
|
@@ -185,4 +211,4 @@ function BlockPatternList(
|
|
|
185
211
|
);
|
|
186
212
|
}
|
|
187
213
|
|
|
188
|
-
export default forwardRef(
|
|
214
|
+
export default forwardRef( BlockPatternsList );
|
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
.block-editor-block-patterns-list__item {
|
|
20
20
|
height: 100%;
|
|
21
|
+
// This is derived from the top padding set on
|
|
22
|
+
// `.block-editor-block-patterns-explorer__list`
|
|
23
|
+
scroll-margin-top: $grid-unit-30;
|
|
24
|
+
// This is derived from the bottom padding set on
|
|
25
|
+
// `.block-editor-block-patterns-explorer__list` and
|
|
26
|
+
// the bottom margin set on `...__list-item` above
|
|
27
|
+
scroll-margin-bottom: ($grid-unit-40 + $grid-unit-30);
|
|
21
28
|
|
|
22
29
|
.block-editor-block-preview__container {
|
|
23
30
|
display: flex;
|
|
@@ -5,7 +5,9 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
5
5
|
import {
|
|
6
6
|
Button,
|
|
7
7
|
__experimentalVStack as VStack,
|
|
8
|
-
|
|
8
|
+
__experimentalTruncate as Truncate,
|
|
9
|
+
Flex,
|
|
10
|
+
FlexBlock,
|
|
9
11
|
FlexItem,
|
|
10
12
|
} from '@wordpress/components';
|
|
11
13
|
import {
|
|
@@ -72,10 +74,14 @@ function BlockQuickNavigationItem( { clientId } ) {
|
|
|
72
74
|
isPressed={ isSelected }
|
|
73
75
|
onClick={ () => selectBlock( clientId ) }
|
|
74
76
|
>
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
<Flex>
|
|
78
|
+
<FlexItem>
|
|
79
|
+
<BlockIcon icon={ icon } />
|
|
80
|
+
</FlexItem>
|
|
81
|
+
<FlexBlock style={ { textAlign: 'left' } }>
|
|
82
|
+
<Truncate>{ name }</Truncate>
|
|
83
|
+
</FlexBlock>
|
|
84
|
+
</Flex>
|
|
79
85
|
</Button>
|
|
80
86
|
);
|
|
81
87
|
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
__experimentalVStack as VStack,
|
|
7
|
+
Button,
|
|
8
|
+
TextControl,
|
|
9
|
+
Modal,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
12
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
14
|
+
import { speak } from '@wordpress/a11y';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import isEmptyString from './is-empty-string';
|
|
20
|
+
|
|
21
|
+
export default function BlockRenameModal( {
|
|
22
|
+
blockName,
|
|
23
|
+
originalBlockName,
|
|
24
|
+
onClose,
|
|
25
|
+
onSave,
|
|
26
|
+
} ) {
|
|
27
|
+
const [ editedBlockName, setEditedBlockName ] = useState( blockName );
|
|
28
|
+
|
|
29
|
+
const nameHasChanged = editedBlockName !== blockName;
|
|
30
|
+
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
31
|
+
const nameIsEmpty = isEmptyString( editedBlockName );
|
|
32
|
+
|
|
33
|
+
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
34
|
+
|
|
35
|
+
const autoSelectInputText = ( event ) => event.target.select();
|
|
36
|
+
|
|
37
|
+
const dialogDescription = useInstanceId(
|
|
38
|
+
BlockRenameModal,
|
|
39
|
+
`block-editor-rename-modal__description`
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const handleSubmit = () => {
|
|
43
|
+
const message =
|
|
44
|
+
nameIsOriginal || nameIsEmpty
|
|
45
|
+
? sprintf(
|
|
46
|
+
/* translators: %s: new name/label for the block */
|
|
47
|
+
__( 'Block name reset to: "%s".' ),
|
|
48
|
+
editedBlockName
|
|
49
|
+
)
|
|
50
|
+
: sprintf(
|
|
51
|
+
/* translators: %s: new name/label for the block */
|
|
52
|
+
__( 'Block name changed to: "%s".' ),
|
|
53
|
+
editedBlockName
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Must be assertive to immediately announce change.
|
|
57
|
+
speak( message, 'assertive' );
|
|
58
|
+
onSave( editedBlockName );
|
|
59
|
+
|
|
60
|
+
// Immediate close avoids ability to hit save multiple times.
|
|
61
|
+
onClose();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Modal
|
|
66
|
+
title={ __( 'Rename' ) }
|
|
67
|
+
onRequestClose={ onClose }
|
|
68
|
+
overlayClassName="block-editor-block-rename-modal"
|
|
69
|
+
aria={ {
|
|
70
|
+
describedby: dialogDescription,
|
|
71
|
+
} }
|
|
72
|
+
focusOnMount="firstContentElement"
|
|
73
|
+
>
|
|
74
|
+
<p id={ dialogDescription }>
|
|
75
|
+
{ __( 'Enter a custom name for this block.' ) }
|
|
76
|
+
</p>
|
|
77
|
+
<form
|
|
78
|
+
onSubmit={ ( e ) => {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
|
|
81
|
+
if ( ! isNameValid ) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
handleSubmit();
|
|
86
|
+
} }
|
|
87
|
+
>
|
|
88
|
+
<VStack spacing="3">
|
|
89
|
+
<TextControl
|
|
90
|
+
__nextHasNoMarginBottom
|
|
91
|
+
value={ editedBlockName }
|
|
92
|
+
label={ __( 'Block name' ) }
|
|
93
|
+
hideLabelFromVision={ true }
|
|
94
|
+
placeholder={ originalBlockName }
|
|
95
|
+
onChange={ setEditedBlockName }
|
|
96
|
+
onFocus={ autoSelectInputText }
|
|
97
|
+
/>
|
|
98
|
+
<HStack justify="right">
|
|
99
|
+
<Button variant="tertiary" onClick={ onClose }>
|
|
100
|
+
{ __( 'Cancel' ) }
|
|
101
|
+
</Button>
|
|
102
|
+
|
|
103
|
+
<Button
|
|
104
|
+
aria-disabled={ ! isNameValid }
|
|
105
|
+
variant="primary"
|
|
106
|
+
type="submit"
|
|
107
|
+
>
|
|
108
|
+
{ __( 'Save' ) }
|
|
109
|
+
</Button>
|
|
110
|
+
</HStack>
|
|
111
|
+
</VStack>
|
|
112
|
+
</form>
|
|
113
|
+
</Modal>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { MenuItem } from '@wordpress/components';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as blockEditorStore } from '../../store';
|
|
13
|
+
import { useBlockDisplayInformation } from '..';
|
|
14
|
+
import isEmptyString from './is-empty-string';
|
|
15
|
+
import BlockRenameModal from './modal';
|
|
16
|
+
|
|
17
|
+
export default function BlockRenameControl( { clientId } ) {
|
|
18
|
+
const [ renamingBlock, setRenamingBlock ] = useState( false );
|
|
19
|
+
|
|
20
|
+
const { metadata } = useSelect(
|
|
21
|
+
( select ) => {
|
|
22
|
+
const { getBlockAttributes } = select( blockEditorStore );
|
|
23
|
+
|
|
24
|
+
const _metadata = getBlockAttributes( clientId )?.metadata;
|
|
25
|
+
return {
|
|
26
|
+
metadata: _metadata,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
[ clientId ]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
33
|
+
|
|
34
|
+
const customName = metadata?.name;
|
|
35
|
+
|
|
36
|
+
function onChange( newName ) {
|
|
37
|
+
updateBlockAttributes( [ clientId ], {
|
|
38
|
+
metadata: {
|
|
39
|
+
...( metadata && metadata ),
|
|
40
|
+
name: newName,
|
|
41
|
+
},
|
|
42
|
+
} );
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<MenuItem
|
|
50
|
+
onClick={ () => {
|
|
51
|
+
setRenamingBlock( true );
|
|
52
|
+
} }
|
|
53
|
+
aria-expanded={ renamingBlock }
|
|
54
|
+
aria-haspopup="dialog"
|
|
55
|
+
>
|
|
56
|
+
{ __( 'Rename' ) }
|
|
57
|
+
</MenuItem>
|
|
58
|
+
{ renamingBlock && (
|
|
59
|
+
<BlockRenameModal
|
|
60
|
+
blockName={ customName || '' }
|
|
61
|
+
originalBlockName={ blockInformation?.title }
|
|
62
|
+
onClose={ () => setRenamingBlock( false ) }
|
|
63
|
+
onSave={ ( newName ) => {
|
|
64
|
+
// If the new value is the block's original name (e.g. `Group`)
|
|
65
|
+
// or it is an empty string then assume the intent is to reset
|
|
66
|
+
// the value. Therefore reset the metadata.
|
|
67
|
+
if (
|
|
68
|
+
newName === blockInformation?.title ||
|
|
69
|
+
isEmptyString( newName )
|
|
70
|
+
) {
|
|
71
|
+
newName = undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onChange( newName );
|
|
75
|
+
} }
|
|
76
|
+
/>
|
|
77
|
+
) }
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|