@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
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
6
|
-
import { addFilter } from '@wordpress/hooks';
|
|
7
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
9
|
-
import { MenuItem, __experimentalHStack as HStack, __experimentalVStack as VStack, Button, TextControl, Modal } from '@wordpress/components';
|
|
10
|
-
import { useState } from '@wordpress/element';
|
|
11
|
-
import { speak } from '@wordpress/a11y';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { BlockSettingsMenuControls, useBlockDisplayInformation, InspectorControls } from '../components';
|
|
17
|
-
const emptyString = testString => testString?.trim()?.length === 0;
|
|
18
|
-
function RenameModal({
|
|
19
|
-
blockName,
|
|
20
|
-
originalBlockName,
|
|
21
|
-
onClose,
|
|
22
|
-
onSave
|
|
23
|
-
}) {
|
|
24
|
-
const [editedBlockName, setEditedBlockName] = useState(blockName);
|
|
25
|
-
const nameHasChanged = editedBlockName !== blockName;
|
|
26
|
-
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
27
|
-
const nameIsEmpty = emptyString(editedBlockName);
|
|
28
|
-
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
29
|
-
const autoSelectInputText = event => event.target.select();
|
|
30
|
-
const dialogDescription = useInstanceId(RenameModal, `block-editor-rename-modal__description`);
|
|
31
|
-
const handleSubmit = () => {
|
|
32
|
-
const message = nameIsOriginal || nameIsEmpty ? sprintf( /* translators: %s: new name/label for the block */
|
|
33
|
-
__('Block name reset to: "%s".'), editedBlockName) : sprintf( /* translators: %s: new name/label for the block */
|
|
34
|
-
__('Block name changed to: "%s".'), editedBlockName);
|
|
35
|
-
|
|
36
|
-
// Must be assertive to immediately announce change.
|
|
37
|
-
speak(message, 'assertive');
|
|
38
|
-
onSave(editedBlockName);
|
|
39
|
-
|
|
40
|
-
// Immediate close avoids ability to hit save multiple times.
|
|
41
|
-
onClose();
|
|
42
|
-
};
|
|
43
|
-
return createElement(Modal, {
|
|
44
|
-
title: __('Rename'),
|
|
45
|
-
onRequestClose: onClose,
|
|
46
|
-
overlayClassName: "block-editor-block-rename-modal",
|
|
47
|
-
aria: {
|
|
48
|
-
describedby: dialogDescription
|
|
49
|
-
},
|
|
50
|
-
focusOnMount: "firstContentElement"
|
|
51
|
-
}, createElement("p", {
|
|
52
|
-
id: dialogDescription
|
|
53
|
-
}, __('Enter a custom name for this block.')), createElement("form", {
|
|
54
|
-
onSubmit: e => {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
if (!isNameValid) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
handleSubmit();
|
|
60
|
-
}
|
|
61
|
-
}, createElement(VStack, {
|
|
62
|
-
spacing: "3"
|
|
63
|
-
}, createElement(TextControl, {
|
|
64
|
-
__nextHasNoMarginBottom: true,
|
|
65
|
-
value: editedBlockName,
|
|
66
|
-
label: __('Block name'),
|
|
67
|
-
hideLabelFromVision: true,
|
|
68
|
-
placeholder: originalBlockName,
|
|
69
|
-
onChange: setEditedBlockName,
|
|
70
|
-
onFocus: autoSelectInputText
|
|
71
|
-
}), createElement(HStack, {
|
|
72
|
-
justify: "right"
|
|
73
|
-
}, createElement(Button, {
|
|
74
|
-
variant: "tertiary",
|
|
75
|
-
onClick: onClose
|
|
76
|
-
}, __('Cancel')), createElement(Button, {
|
|
77
|
-
"aria-disabled": !isNameValid,
|
|
78
|
-
variant: "primary",
|
|
79
|
-
type: "submit"
|
|
80
|
-
}, __('Save'))))));
|
|
81
|
-
}
|
|
82
|
-
function BlockRenameControl(props) {
|
|
83
|
-
const [renamingBlock, setRenamingBlock] = useState(false);
|
|
84
|
-
const {
|
|
85
|
-
clientId,
|
|
86
|
-
customName,
|
|
87
|
-
onChange
|
|
88
|
-
} = props;
|
|
89
|
-
const blockInformation = useBlockDisplayInformation(clientId);
|
|
90
|
-
return createElement(Fragment, null, createElement(InspectorControls, {
|
|
91
|
-
group: "advanced"
|
|
92
|
-
}, createElement(TextControl, {
|
|
93
|
-
__nextHasNoMarginBottom: true,
|
|
94
|
-
label: __('Block name'),
|
|
95
|
-
value: customName || '',
|
|
96
|
-
onChange: onChange
|
|
97
|
-
})), createElement(BlockSettingsMenuControls, null, ({
|
|
98
|
-
selectedClientIds
|
|
99
|
-
}) => {
|
|
100
|
-
// Only enabled for single selections.
|
|
101
|
-
const canRename = selectedClientIds.length === 1 && clientId === selectedClientIds[0];
|
|
102
|
-
|
|
103
|
-
// This check ensures the `BlockSettingsMenuControls` fill
|
|
104
|
-
// doesn't render multiple times and also that it renders for
|
|
105
|
-
// the block from which the menu was triggered.
|
|
106
|
-
if (!canRename) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
return createElement(MenuItem, {
|
|
110
|
-
onClick: () => {
|
|
111
|
-
setRenamingBlock(true);
|
|
112
|
-
},
|
|
113
|
-
"aria-expanded": renamingBlock,
|
|
114
|
-
"aria-haspopup": "dialog"
|
|
115
|
-
}, __('Rename'));
|
|
116
|
-
}), renamingBlock && createElement(RenameModal, {
|
|
117
|
-
blockName: customName || '',
|
|
118
|
-
originalBlockName: blockInformation?.title,
|
|
119
|
-
onClose: () => setRenamingBlock(false),
|
|
120
|
-
onSave: newName => {
|
|
121
|
-
// If the new value is the block's original name (e.g. `Group`)
|
|
122
|
-
// or it is an empty string then assume the intent is to reset
|
|
123
|
-
// the value. Therefore reset the metadata.
|
|
124
|
-
if (newName === blockInformation?.title || emptyString(newName)) {
|
|
125
|
-
newName = undefined;
|
|
126
|
-
}
|
|
127
|
-
onChange(newName);
|
|
128
|
-
}
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
export const withBlockRenameControl = createHigherOrderComponent(BlockEdit => props => {
|
|
132
|
-
const {
|
|
133
|
-
clientId,
|
|
134
|
-
name,
|
|
135
|
-
attributes,
|
|
136
|
-
setAttributes,
|
|
137
|
-
isSelected
|
|
138
|
-
} = props;
|
|
139
|
-
const supportsBlockNaming = hasBlockSupport(name, 'renaming', true);
|
|
140
|
-
return createElement(Fragment, null, isSelected && supportsBlockNaming && createElement(Fragment, null, createElement(BlockRenameControl, {
|
|
141
|
-
clientId: clientId,
|
|
142
|
-
customName: attributes?.metadata?.name,
|
|
143
|
-
onChange: newName => {
|
|
144
|
-
setAttributes({
|
|
145
|
-
metadata: {
|
|
146
|
-
...attributes?.metadata,
|
|
147
|
-
name: newName
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
})), createElement(BlockEdit, {
|
|
152
|
-
key: "edit",
|
|
153
|
-
...props
|
|
154
|
-
}));
|
|
155
|
-
}, 'withToolbarControls');
|
|
156
|
-
addFilter('editor.BlockEdit', 'core/block-rename-ui/with-block-rename-control', withBlockRenameControl);
|
|
157
|
-
//# sourceMappingURL=block-rename-ui.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createHigherOrderComponent","useInstanceId","addFilter","__","sprintf","hasBlockSupport","MenuItem","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useState","speak","BlockSettingsMenuControls","useBlockDisplayInformation","InspectorControls","emptyString","testString","trim","length","RenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","message","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type","BlockRenameControl","props","renamingBlock","setRenamingBlock","clientId","customName","blockInformation","Fragment","group","selectedClientIds","canRename","newName","undefined","withBlockRenameControl","BlockEdit","name","attributes","setAttributes","isSelected","supportsBlockNaming","metadata","key"],"sources":["@wordpress/block-editor/src/hooks/block-rename-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockDisplayInformation,\n\tInspectorControls,\n} from '../components';\n\nconst emptyString = ( testString ) => testString?.trim()?.length === 0;\n\nfunction RenameModal( { blockName, originalBlockName, onClose, onSave } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = emptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nfunction BlockRenameControl( props ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\tconst { clientId, customName, onChange } = props;\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\tvalue={ customName || '' }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t// Only enabled for single selections.\n\t\t\t\t\tconst canRename =\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tclientId === selectedClientIds[ 0 ];\n\n\t\t\t\t\t// This check ensures the `BlockSettingsMenuControls` fill\n\t\t\t\t\t// doesn't render multiple times and also that it renders for\n\t\t\t\t\t// the block from which the menu was triggered.\n\t\t\t\t\tif ( ! canRename ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t{ renamingBlock && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tblockName={ customName || '' }\n\t\t\t\t\toriginalBlockName={ blockInformation?.title }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\t// If the new value is the block's original name (e.g. `Group`)\n\t\t\t\t\t\t// or it is an empty string then assume the intent is to reset\n\t\t\t\t\t\t// the value. Therefore reset the metadata.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnewName === blockInformation?.title ||\n\t\t\t\t\t\t\temptyString( newName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewName = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const withBlockRenameControl = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes, isSelected } = props;\n\n\t\tconst supportsBlockNaming = hasBlockSupport( name, 'renaming', true );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isSelected && supportsBlockNaming && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcustomName={ attributes?.metadata?.name }\n\t\t\t\t\t\t\tonChange={ ( newName ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\t\t\t\t\tname: newName,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-control',\n\twithBlockRenameControl\n);\n"],"mappings":"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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper function that maps attribute definition properties to the
|
|
3
|
-
* ones used by RichText utils like `create, toHTMLString, etc..`.
|
|
4
|
-
*
|
|
5
|
-
* @param {Object} attributeDefinition A block's attribute definition object.
|
|
6
|
-
* @return {Object} The mapped object.
|
|
7
|
-
*/
|
|
8
|
-
export function mapRichTextSettings(attributeDefinition) {
|
|
9
|
-
const {
|
|
10
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace
|
|
11
|
-
} = attributeDefinition;
|
|
12
|
-
return {
|
|
13
|
-
preserveWhiteSpace
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["mapRichTextSettings","attributeDefinition","__unstablePreserveWhiteSpace","preserveWhiteSpace"],"sources":["@wordpress/block-editor/src/store/utils.js"],"sourcesContent":["/**\n * Helper function that maps attribute definition properties to the\n * ones used by RichText utils like `create, toHTMLString, etc..`.\n *\n * @param {Object} attributeDefinition A block's attribute definition object.\n * @return {Object} The mapped object.\n */\nexport function mapRichTextSettings( attributeDefinition ) {\n\tconst { __unstablePreserveWhiteSpace: preserveWhiteSpace } =\n\t\tattributeDefinition;\n\treturn { preserveWhiteSpace };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mBAAmBA,CAAEC,mBAAmB,EAAG;EAC1D,MAAM;IAAEC,4BAA4B,EAAEC;EAAmB,CAAC,GACzDF,mBAAmB;EACpB,OAAO;IAAEE;EAAmB,CAAC;AAC9B"}
|
|
@@ -1,265 +0,0 @@
|
|
|
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 { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
11
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
|
-
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import BlockSelectionButton from './block-selection-button';
|
|
18
|
-
import BlockContextualToolbar from './block-contextual-toolbar';
|
|
19
|
-
import { store as blockEditorStore } from '../../store';
|
|
20
|
-
import BlockPopover from '../block-popover';
|
|
21
|
-
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
|
|
22
|
-
import Inserter from '../inserter';
|
|
23
|
-
import { useShouldContextualToolbarShow } from '../../utils/use-should-contextual-toolbar-show';
|
|
24
|
-
|
|
25
|
-
function selector( select ) {
|
|
26
|
-
const {
|
|
27
|
-
__unstableGetEditorMode,
|
|
28
|
-
hasMultiSelection,
|
|
29
|
-
isTyping,
|
|
30
|
-
getLastMultiSelectedBlockClientId,
|
|
31
|
-
} = select( blockEditorStore );
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
editorMode: __unstableGetEditorMode(),
|
|
35
|
-
hasMultiSelection: hasMultiSelection(),
|
|
36
|
-
isTyping: isTyping(),
|
|
37
|
-
lastClientId: hasMultiSelection()
|
|
38
|
-
? getLastMultiSelectedBlockClientId()
|
|
39
|
-
: null,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function SelectedBlockPopover( {
|
|
44
|
-
clientId,
|
|
45
|
-
rootClientId,
|
|
46
|
-
isEmptyDefaultBlock,
|
|
47
|
-
capturingClientId,
|
|
48
|
-
__unstablePopoverSlot,
|
|
49
|
-
__unstableContentRef,
|
|
50
|
-
} ) {
|
|
51
|
-
const { editorMode, hasMultiSelection, isTyping, lastClientId } = useSelect(
|
|
52
|
-
selector,
|
|
53
|
-
[]
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const isInsertionPointVisible = useSelect(
|
|
57
|
-
( select ) => {
|
|
58
|
-
const {
|
|
59
|
-
isBlockInsertionPointVisible,
|
|
60
|
-
getBlockInsertionPoint,
|
|
61
|
-
getBlockOrder,
|
|
62
|
-
} = select( blockEditorStore );
|
|
63
|
-
|
|
64
|
-
if ( ! isBlockInsertionPointVisible() ) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const insertionPoint = getBlockInsertionPoint();
|
|
69
|
-
const order = getBlockOrder( insertionPoint.rootClientId );
|
|
70
|
-
return order[ insertionPoint.index ] === clientId;
|
|
71
|
-
},
|
|
72
|
-
[ clientId ]
|
|
73
|
-
);
|
|
74
|
-
const isToolbarForced = useRef( false );
|
|
75
|
-
const { shouldShowContextualToolbar, canFocusHiddenToolbar } =
|
|
76
|
-
useShouldContextualToolbarShow();
|
|
77
|
-
|
|
78
|
-
const { stopTyping } = useDispatch( blockEditorStore );
|
|
79
|
-
|
|
80
|
-
const showEmptyBlockSideInserter =
|
|
81
|
-
! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;
|
|
82
|
-
const shouldShowBreadcrumb =
|
|
83
|
-
! hasMultiSelection &&
|
|
84
|
-
( editorMode === 'navigation' || editorMode === 'zoom-out' );
|
|
85
|
-
|
|
86
|
-
useShortcut(
|
|
87
|
-
'core/block-editor/focus-toolbar',
|
|
88
|
-
() => {
|
|
89
|
-
isToolbarForced.current = true;
|
|
90
|
-
stopTyping( true );
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
isDisabled: ! canFocusHiddenToolbar,
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
useEffect( () => {
|
|
98
|
-
isToolbarForced.current = false;
|
|
99
|
-
} );
|
|
100
|
-
|
|
101
|
-
// Stores the active toolbar item index so the block toolbar can return focus
|
|
102
|
-
// to it when re-mounting.
|
|
103
|
-
const initialToolbarItemIndexRef = useRef();
|
|
104
|
-
|
|
105
|
-
useEffect( () => {
|
|
106
|
-
// Resets the index whenever the active block changes so this is not
|
|
107
|
-
// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
108
|
-
initialToolbarItemIndexRef.current = undefined;
|
|
109
|
-
}, [ clientId ] );
|
|
110
|
-
|
|
111
|
-
const popoverProps = useBlockToolbarPopoverProps( {
|
|
112
|
-
contentElement: __unstableContentRef?.current,
|
|
113
|
-
clientId,
|
|
114
|
-
} );
|
|
115
|
-
|
|
116
|
-
if ( showEmptyBlockSideInserter ) {
|
|
117
|
-
return (
|
|
118
|
-
<BlockPopover
|
|
119
|
-
clientId={ capturingClientId || clientId }
|
|
120
|
-
__unstableCoverTarget
|
|
121
|
-
bottomClientId={ lastClientId }
|
|
122
|
-
className={ classnames(
|
|
123
|
-
'block-editor-block-list__block-side-inserter-popover',
|
|
124
|
-
{
|
|
125
|
-
'is-insertion-point-visible': isInsertionPointVisible,
|
|
126
|
-
}
|
|
127
|
-
) }
|
|
128
|
-
__unstablePopoverSlot={ __unstablePopoverSlot }
|
|
129
|
-
__unstableContentRef={ __unstableContentRef }
|
|
130
|
-
resize={ false }
|
|
131
|
-
shift={ false }
|
|
132
|
-
{ ...popoverProps }
|
|
133
|
-
>
|
|
134
|
-
<div className="block-editor-block-list__empty-block-inserter">
|
|
135
|
-
<Inserter
|
|
136
|
-
position="bottom right"
|
|
137
|
-
rootClientId={ rootClientId }
|
|
138
|
-
clientId={ clientId }
|
|
139
|
-
__experimentalIsQuick
|
|
140
|
-
/>
|
|
141
|
-
</div>
|
|
142
|
-
</BlockPopover>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if ( shouldShowBreadcrumb || shouldShowContextualToolbar ) {
|
|
147
|
-
return (
|
|
148
|
-
<BlockPopover
|
|
149
|
-
clientId={ capturingClientId || clientId }
|
|
150
|
-
bottomClientId={ lastClientId }
|
|
151
|
-
className={ classnames(
|
|
152
|
-
'block-editor-block-list__block-popover',
|
|
153
|
-
{
|
|
154
|
-
'is-insertion-point-visible': isInsertionPointVisible,
|
|
155
|
-
}
|
|
156
|
-
) }
|
|
157
|
-
__unstablePopoverSlot={ __unstablePopoverSlot }
|
|
158
|
-
__unstableContentRef={ __unstableContentRef }
|
|
159
|
-
resize={ false }
|
|
160
|
-
{ ...popoverProps }
|
|
161
|
-
>
|
|
162
|
-
{ shouldShowContextualToolbar && (
|
|
163
|
-
<BlockContextualToolbar
|
|
164
|
-
// If the toolbar is being shown because of being forced
|
|
165
|
-
// it should focus the toolbar right after the mount.
|
|
166
|
-
focusOnMount={ isToolbarForced.current }
|
|
167
|
-
__experimentalInitialIndex={
|
|
168
|
-
initialToolbarItemIndexRef.current
|
|
169
|
-
}
|
|
170
|
-
__experimentalOnIndexChange={ ( index ) => {
|
|
171
|
-
initialToolbarItemIndexRef.current = index;
|
|
172
|
-
} }
|
|
173
|
-
// Resets the index whenever the active block changes so
|
|
174
|
-
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
|
|
175
|
-
key={ clientId }
|
|
176
|
-
/>
|
|
177
|
-
) }
|
|
178
|
-
{ shouldShowBreadcrumb && (
|
|
179
|
-
<BlockSelectionButton
|
|
180
|
-
clientId={ clientId }
|
|
181
|
-
rootClientId={ rootClientId }
|
|
182
|
-
/>
|
|
183
|
-
) }
|
|
184
|
-
</BlockPopover>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function wrapperSelector( select ) {
|
|
192
|
-
const {
|
|
193
|
-
getSelectedBlockClientId,
|
|
194
|
-
getFirstMultiSelectedBlockClientId,
|
|
195
|
-
getBlockRootClientId,
|
|
196
|
-
getBlock,
|
|
197
|
-
getBlockParents,
|
|
198
|
-
__experimentalGetBlockListSettingsForBlocks,
|
|
199
|
-
} = select( blockEditorStore );
|
|
200
|
-
|
|
201
|
-
const clientId =
|
|
202
|
-
getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
|
|
203
|
-
|
|
204
|
-
if ( ! clientId ) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const { name, attributes = {} } = getBlock( clientId ) || {};
|
|
209
|
-
const blockParentsClientIds = getBlockParents( clientId );
|
|
210
|
-
|
|
211
|
-
// Get Block List Settings for all ancestors of the current Block clientId.
|
|
212
|
-
const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(
|
|
213
|
-
blockParentsClientIds
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
// Get the clientId of the topmost parent with the capture toolbars setting.
|
|
217
|
-
const capturingClientId = blockParentsClientIds.find(
|
|
218
|
-
( parentClientId ) =>
|
|
219
|
-
parentBlockListSettings[ parentClientId ]
|
|
220
|
-
?.__experimentalCaptureToolbars
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
return {
|
|
224
|
-
clientId,
|
|
225
|
-
rootClientId: getBlockRootClientId( clientId ),
|
|
226
|
-
name,
|
|
227
|
-
isEmptyDefaultBlock:
|
|
228
|
-
name && isUnmodifiedDefaultBlock( { name, attributes } ),
|
|
229
|
-
capturingClientId,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export default function WrappedBlockPopover( {
|
|
234
|
-
__unstablePopoverSlot,
|
|
235
|
-
__unstableContentRef,
|
|
236
|
-
} ) {
|
|
237
|
-
const selected = useSelect( wrapperSelector, [] );
|
|
238
|
-
|
|
239
|
-
if ( ! selected ) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const {
|
|
244
|
-
clientId,
|
|
245
|
-
rootClientId,
|
|
246
|
-
name,
|
|
247
|
-
isEmptyDefaultBlock,
|
|
248
|
-
capturingClientId,
|
|
249
|
-
} = selected;
|
|
250
|
-
|
|
251
|
-
if ( ! name ) {
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return (
|
|
256
|
-
<SelectedBlockPopover
|
|
257
|
-
clientId={ clientId }
|
|
258
|
-
rootClientId={ rootClientId }
|
|
259
|
-
isEmptyDefaultBlock={ isEmptyDefaultBlock }
|
|
260
|
-
capturingClientId={ capturingClientId }
|
|
261
|
-
__unstablePopoverSlot={ __unstablePopoverSlot }
|
|
262
|
-
__unstableContentRef={ __unstableContentRef }
|
|
263
|
-
/>
|
|
264
|
-
);
|
|
265
|
-
}
|