@wordpress/editor 14.13.1-next.cd6172eb0.0 → 14.14.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 +2 -0
- package/build/bindings/pattern-overrides.js +1 -0
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +1 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/user.js +1 -0
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/block-removal-warnings/index.js +1 -0
- package/build/components/block-removal-warnings/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -0
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +1 -1
- package/build/components/collab-sidebar/add-comment.js.map +1 -1
- package/build/components/collab-sidebar/comment-button.js +7 -2
- package/build/components/collab-sidebar/comment-button.js.map +1 -1
- package/build/components/collab-sidebar/comment-form.js +4 -1
- package/build/components/collab-sidebar/comment-form.js.map +1 -1
- package/build/components/collab-sidebar/comments.js +199 -185
- package/build/components/collab-sidebar/comments.js.map +1 -1
- package/build/components/collab-sidebar/index.js +11 -4
- package/build/components/collab-sidebar/index.js.map +1 -1
- package/build/components/collab-sidebar/utils.js +1 -0
- package/build/components/collab-sidebar/utils.js.map +1 -1
- package/build/components/deprecated.js +1 -0
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-bar/index.js +3 -1
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js +1 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/editor-help/index.native.js +1 -0
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-notices/index.js +1 -0
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +1 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +1 -0
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +1 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -0
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +26 -13
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -0
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +1 -0
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/mode-switcher/index.js +1 -0
- package/build/components/mode-switcher/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +1 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +1 -0
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +77 -91
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/hook.js +1 -0
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-card-panel/index.js +56 -23
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-fields/index.js +1 -0
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-format/index.js +1 -0
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-format/panel.js +1 -0
- package/build/components/post-format/panel.js.map +1 -1
- package/build/components/post-publish-button/index.js +1 -0
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +1 -0
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -0
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +1 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +1 -0
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +1 -0
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +1 -0
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +1 -0
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +1 -0
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/classic-theme.js +1 -0
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +1 -0
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +1 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -1
- package/build/components/post-type-support-check/index.js +1 -0
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/preferences-modal/block-visibility.js +1 -0
- package/build/components/preferences-modal/block-visibility.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -0
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +1 -0
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.native.js +1 -0
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -0
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/index.js +1 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/start-page-options/index.js +1 -0
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +1 -0
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/template-part-content-panel/index.js +1 -0
- package/build/components/template-part-content-panel/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +1 -0
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/visual-editor/use-select-nearest-editable-block.js +1 -0
- package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build/dataviews/store/private-actions.js +16 -2
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/reducer.js +1 -0
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +1 -0
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/pattern-overrides.js +1 -0
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/store/actions.js +1 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +1 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +1 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +1 -0
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +1 -0
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-template-info.js +1 -0
- package/build/utils/get-template-info.js.map +1 -1
- package/build/utils/pageTypeBadge.js +6 -12
- package/build/utils/pageTypeBadge.js.map +1 -1
- package/build/utils/terms.js +1 -0
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +1 -0
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +1 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -0
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/block-removal-warnings/index.js +1 -0
- package/build-module/components/block-removal-warnings/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -0
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +1 -1
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-button.js +7 -2
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-form.js +4 -1
- package/build-module/components/collab-sidebar/comment-form.js.map +1 -1
- package/build-module/components/collab-sidebar/comments.js +201 -187
- package/build-module/components/collab-sidebar/comments.js.map +1 -1
- package/build-module/components/collab-sidebar/index.js +11 -4
- package/build-module/components/collab-sidebar/index.js.map +1 -1
- package/build-module/components/collab-sidebar/utils.js +1 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -1
- package/build-module/components/deprecated.js +1 -0
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-bar/index.js +3 -1
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +1 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +1 -0
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -0
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +1 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -0
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +1 -0
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -0
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +28 -15
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -0
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +1 -0
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/mode-switcher/index.js +1 -0
- package/build-module/components/mode-switcher/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +1 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +1 -0
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +77 -92
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/hook.js +1 -0
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +59 -24
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +1 -0
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -0
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +1 -0
- package/build-module/components/post-format/panel.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -0
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -0
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -0
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -0
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +1 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -0
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +1 -0
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -0
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -0
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -0
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +1 -0
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +1 -0
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +1 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +1 -0
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/preferences-modal/block-visibility.js +1 -0
- package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -0
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +1 -0
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.native.js +1 -0
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -0
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +1 -0
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +1 -0
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/template-part-content-panel/index.js +1 -0
- package/build-module/components/template-part-content-panel/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +1 -0
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js +1 -0
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +16 -2
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +1 -0
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -0
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -0
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/store/actions.js +1 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +1 -0
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +1 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-template-info.js +1 -0
- package/build-module/utils/get-template-info.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +6 -12
- package/build-module/utils/pageTypeBadge.js.map +1 -1
- package/build-module/utils/terms.js +1 -0
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +22 -3
- package/build-style/style.css +22 -3
- package/build-types/components/autocompleters/user.d.ts +7 -1
- package/build-types/components/autocompleters/user.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts +11 -7
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +1 -1
- package/build-types/components/media-categories/index.d.ts.map +1 -1
- package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -1
- package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts +5 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts +13 -4
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +4 -4
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +4 -4
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-title/constants.d.ts.map +1 -1
- package/build-types/dataviews/api.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +1 -1
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
- package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +7 -9
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +20 -4
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +1 -1
- package/build-types/store/selectors.d.ts +376 -76
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +3 -1
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/components/collab-sidebar/add-comment.js +1 -1
- package/src/components/collab-sidebar/comment-button.js +12 -7
- package/src/components/collab-sidebar/comment-form.js +4 -1
- package/src/components/collab-sidebar/comments.js +260 -243
- package/src/components/collab-sidebar/index.js +10 -2
- package/src/components/collab-sidebar/style.scss +10 -1
- package/src/components/document-bar/index.js +3 -1
- package/src/components/error-boundary/index.js +30 -16
- package/src/components/error-boundary/style.scss +5 -1
- package/src/components/post-actions/index.js +89 -95
- package/src/components/post-card-panel/index.js +65 -29
- package/src/components/post-card-panel/style.scss +5 -0
- package/src/components/post-publish-panel/prepublish.js +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/dataviews/store/private-actions.ts +23 -8
- package/src/utils/pageTypeBadge.js +7 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component } from '@wordpress/element';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
__experimentalHStack as HStack,
|
|
9
|
+
__experimentalText as Text,
|
|
10
|
+
} from '@wordpress/components';
|
|
7
11
|
import { select } from '@wordpress/data';
|
|
8
|
-
import { Warning } from '@wordpress/block-editor';
|
|
9
12
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
10
13
|
import { doAction } from '@wordpress/hooks';
|
|
11
14
|
|
|
@@ -26,10 +29,10 @@ function getContent() {
|
|
|
26
29
|
} catch ( error ) {}
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
function CopyButton( { text, children } ) {
|
|
32
|
+
function CopyButton( { text, children, variant = 'secondary' } ) {
|
|
30
33
|
const ref = useCopyToClipboard( text );
|
|
31
34
|
return (
|
|
32
|
-
<Button __next40pxDefaultSize variant=
|
|
35
|
+
<Button __next40pxDefaultSize variant={ variant } ref={ ref }>
|
|
33
36
|
{ children }
|
|
34
37
|
</Button>
|
|
35
38
|
);
|
|
@@ -54,23 +57,34 @@ class ErrorBoundary extends Component {
|
|
|
54
57
|
|
|
55
58
|
render() {
|
|
56
59
|
const { error } = this.state;
|
|
60
|
+
const { canCopyContent = false } = this.props;
|
|
57
61
|
if ( ! error ) {
|
|
58
62
|
return this.props.children;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
const actions = [
|
|
62
|
-
<CopyButton key="copy-post" text={ getContent }>
|
|
63
|
-
{ __( 'Copy Post Text' ) }
|
|
64
|
-
</CopyButton>,
|
|
65
|
-
<CopyButton key="copy-error" text={ error.stack }>
|
|
66
|
-
{ __( 'Copy Error' ) }
|
|
67
|
-
</CopyButton>,
|
|
68
|
-
];
|
|
69
|
-
|
|
70
65
|
return (
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
<HStack
|
|
67
|
+
className="editor-error-boundary"
|
|
68
|
+
alignment="baseline"
|
|
69
|
+
spacing={ 4 }
|
|
70
|
+
justify="space-between"
|
|
71
|
+
expanded={ false }
|
|
72
|
+
wrap
|
|
73
|
+
>
|
|
74
|
+
<Text as="p">
|
|
75
|
+
{ __( 'The editor has encountered an unexpected error.' ) }
|
|
76
|
+
</Text>
|
|
77
|
+
<HStack expanded={ false }>
|
|
78
|
+
{ canCopyContent && (
|
|
79
|
+
<CopyButton text={ getContent }>
|
|
80
|
+
{ __( 'Copy contents' ) }
|
|
81
|
+
</CopyButton>
|
|
82
|
+
) }
|
|
83
|
+
<CopyButton variant="primary" text={ error?.stack }>
|
|
84
|
+
{ __( 'Copy error' ) }
|
|
85
|
+
</CopyButton>
|
|
86
|
+
</HStack>
|
|
87
|
+
</HStack>
|
|
74
88
|
);
|
|
75
89
|
}
|
|
76
90
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
.editor-error-boundary {
|
|
2
|
+
font-family: $default-font;
|
|
2
3
|
margin: auto;
|
|
3
4
|
max-width: 780px;
|
|
4
|
-
padding:
|
|
5
|
+
padding: 1em;
|
|
5
6
|
margin-top: 60px;
|
|
6
7
|
box-shadow: $elevation-large;
|
|
8
|
+
border: $border-width solid $gray-900;
|
|
9
|
+
border-radius: $radius-small;
|
|
10
|
+
background-color: $white;
|
|
7
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
4
|
+
import { useRegistry, useSelect } from '@wordpress/data';
|
|
5
5
|
import { useState, useMemo } from '@wordpress/element';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import {
|
|
@@ -20,66 +20,87 @@ import { usePostActions } from './actions';
|
|
|
20
20
|
|
|
21
21
|
const { Menu, kebabCase } = unlock( componentsPrivateApis );
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const { item, permissions } = useSelect(
|
|
23
|
+
function useEditedEntityRecordsWithPermissions( postType, postIds ) {
|
|
24
|
+
const { items, permissions } = useSelect(
|
|
26
25
|
( select ) => {
|
|
27
26
|
const { getEditedEntityRecord, getEntityRecordPermissions } =
|
|
28
27
|
unlock( select( coreStore ) );
|
|
29
28
|
return {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
postId
|
|
29
|
+
items: postIds.map( ( postId ) =>
|
|
30
|
+
getEditedEntityRecord( 'postType', postType, postId )
|
|
31
|
+
),
|
|
32
|
+
permissions: postIds.map( ( postId ) =>
|
|
33
|
+
getEntityRecordPermissions( 'postType', postType, postId )
|
|
35
34
|
),
|
|
36
35
|
};
|
|
37
36
|
},
|
|
38
|
-
[
|
|
37
|
+
[ postIds, postType ]
|
|
39
38
|
);
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
|
|
40
|
+
return useMemo( () => {
|
|
41
|
+
return items.map( ( item, index ) => ( {
|
|
42
42
|
...item,
|
|
43
|
-
permissions,
|
|
44
|
-
};
|
|
45
|
-
}, [
|
|
43
|
+
permissions: permissions[ index ],
|
|
44
|
+
} ) );
|
|
45
|
+
}, [ items, permissions ] );
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function PostActions( { postType, postId, onActionPerformed } ) {
|
|
49
|
+
const [ activeModalAction, setActiveModalAction ] = useState( null );
|
|
50
|
+
const _postIds = useMemo( () => {
|
|
51
|
+
if ( Array.isArray( postId ) ) {
|
|
52
|
+
return postId;
|
|
53
|
+
}
|
|
54
|
+
return postId ? [ postId ] : [];
|
|
55
|
+
}, [ postId ] );
|
|
56
|
+
|
|
57
|
+
const itemsWithPermissions = useEditedEntityRecordsWithPermissions(
|
|
58
|
+
postType,
|
|
59
|
+
_postIds
|
|
60
|
+
);
|
|
46
61
|
const allActions = usePostActions( { postType, onActionPerformed } );
|
|
47
62
|
|
|
48
63
|
const actions = useMemo( () => {
|
|
49
64
|
return allActions.filter( ( action ) => {
|
|
50
65
|
return (
|
|
51
|
-
! action.isEligible ||
|
|
66
|
+
( ! action.isEligible ||
|
|
67
|
+
itemsWithPermissions.some( ( itemWithPermissions ) =>
|
|
68
|
+
action.isEligible( itemWithPermissions )
|
|
69
|
+
) ) &&
|
|
70
|
+
( itemsWithPermissions.length < 2 || action.supportsBulk )
|
|
52
71
|
);
|
|
53
72
|
} );
|
|
54
|
-
}, [ allActions,
|
|
73
|
+
}, [ allActions, itemsWithPermissions ] );
|
|
55
74
|
|
|
56
75
|
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
<>
|
|
77
|
+
<Menu
|
|
78
|
+
trigger={
|
|
79
|
+
<Button
|
|
80
|
+
size="small"
|
|
81
|
+
icon={ moreVertical }
|
|
82
|
+
label={ __( 'Actions' ) }
|
|
83
|
+
disabled={ ! actions.length }
|
|
84
|
+
accessibleWhenDisabled
|
|
85
|
+
className="editor-all-actions-button"
|
|
86
|
+
/>
|
|
87
|
+
}
|
|
88
|
+
placement="bottom-end"
|
|
89
|
+
>
|
|
90
|
+
<ActionsDropdownMenuGroup
|
|
91
|
+
actions={ actions }
|
|
92
|
+
items={ itemsWithPermissions }
|
|
93
|
+
setActiveModalAction={ setActiveModalAction }
|
|
70
94
|
/>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} }
|
|
81
|
-
/>
|
|
82
|
-
</Menu>
|
|
95
|
+
</Menu>
|
|
96
|
+
{ !! activeModalAction && (
|
|
97
|
+
<ActionModal
|
|
98
|
+
action={ activeModalAction }
|
|
99
|
+
items={ itemsWithPermissions }
|
|
100
|
+
closeModal={ () => setActiveModalAction( null ) }
|
|
101
|
+
/>
|
|
102
|
+
) }
|
|
103
|
+
</>
|
|
83
104
|
);
|
|
84
105
|
}
|
|
85
106
|
|
|
@@ -88,79 +109,52 @@ export default function PostActions( { postType, postId, onActionPerformed } ) {
|
|
|
88
109
|
// and the dataviews package should not be using the editor packages directly,
|
|
89
110
|
// so duplicating the code here seems like the least bad option.
|
|
90
111
|
|
|
91
|
-
// Copied as is from packages/dataviews/src/item-actions.js
|
|
92
112
|
function DropdownMenuItemTrigger( { action, onClick, items } ) {
|
|
93
113
|
const label =
|
|
94
114
|
typeof action.label === 'string' ? action.label : action.label( items );
|
|
95
115
|
return (
|
|
96
|
-
<Menu.Item onClick={ onClick }
|
|
116
|
+
<Menu.Item onClick={ onClick }>
|
|
97
117
|
<Menu.ItemLabel>{ label }</Menu.ItemLabel>
|
|
98
118
|
</Menu.Item>
|
|
99
119
|
);
|
|
100
120
|
}
|
|
101
121
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
106
|
-
const actionTriggerProps = {
|
|
107
|
-
action,
|
|
108
|
-
onClick: () => setIsModalOpen( true ),
|
|
109
|
-
items: [ item ],
|
|
110
|
-
};
|
|
111
|
-
const { RenderModal, hideModalHeader } = action;
|
|
122
|
+
export function ActionModal( { action, items, closeModal } ) {
|
|
123
|
+
const label =
|
|
124
|
+
typeof action.label === 'string' ? action.label : action.label( items );
|
|
112
125
|
return (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
focusOnMount="firstContentElement"
|
|
126
|
-
size="medium"
|
|
127
|
-
>
|
|
128
|
-
<RenderModal
|
|
129
|
-
items={ [ item ] }
|
|
130
|
-
closeModal={ () => {
|
|
131
|
-
setIsModalOpen( false );
|
|
132
|
-
onClose();
|
|
133
|
-
} }
|
|
134
|
-
/>
|
|
135
|
-
</Modal>
|
|
136
|
-
) }
|
|
137
|
-
</>
|
|
126
|
+
<Modal
|
|
127
|
+
title={ action.modalHeader || label }
|
|
128
|
+
__experimentalHideHeader={ !! action.hideModalHeader }
|
|
129
|
+
onRequestClose={ closeModal ?? ( () => {} ) }
|
|
130
|
+
focusOnMount="firstContentElement"
|
|
131
|
+
size="medium"
|
|
132
|
+
overlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(
|
|
133
|
+
action.id
|
|
134
|
+
) }` }
|
|
135
|
+
>
|
|
136
|
+
<action.RenderModal items={ items } closeModal={ closeModal } />
|
|
137
|
+
</Modal>
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
function ActionsDropdownMenuGroup( { actions, item, onClose } ) {
|
|
141
|
+
function ActionsDropdownMenuGroup( { actions, items, setActiveModalAction } ) {
|
|
142
|
+
const registry = useRegistry();
|
|
144
143
|
return (
|
|
145
144
|
<Menu.Group>
|
|
146
145
|
{ actions.map( ( action ) => {
|
|
147
|
-
if ( action.RenderModal ) {
|
|
148
|
-
return (
|
|
149
|
-
<ActionWithModal
|
|
150
|
-
key={ action.id }
|
|
151
|
-
action={ action }
|
|
152
|
-
item={ item }
|
|
153
|
-
ActionTrigger={ DropdownMenuItemTrigger }
|
|
154
|
-
onClose={ onClose }
|
|
155
|
-
/>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
146
|
return (
|
|
159
147
|
<DropdownMenuItemTrigger
|
|
160
148
|
key={ action.id }
|
|
161
149
|
action={ action }
|
|
162
|
-
onClick={ () =>
|
|
163
|
-
|
|
150
|
+
onClick={ () => {
|
|
151
|
+
if ( 'RenderModal' in action ) {
|
|
152
|
+
setActiveModalAction( action );
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
action.callback( items, { registry } );
|
|
156
|
+
} }
|
|
157
|
+
items={ items }
|
|
164
158
|
/>
|
|
165
159
|
);
|
|
166
160
|
} ) }
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
import {
|
|
5
5
|
Icon,
|
|
6
6
|
__experimentalHStack as HStack,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
7
8
|
__experimentalText as Text,
|
|
8
9
|
} from '@wordpress/components';
|
|
9
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
11
|
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import {
|
|
12
|
+
import { useMemo } from '@wordpress/element';
|
|
13
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
14
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -24,50 +26,77 @@ import PostActions from '../post-actions';
|
|
|
24
26
|
import usePageTypeBadge from '../../utils/pageTypeBadge';
|
|
25
27
|
import { getTemplateInfo } from '../../utils/get-template-info';
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Renders a title of the post type and the available quick actions available within a 3-dot dropdown.
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} props - Component props.
|
|
33
|
+
* @param {string} [props.postType] - The post type string.
|
|
34
|
+
* @param {string|string[]} [props.postId] - The post id or list of post ids.
|
|
35
|
+
* @param {Function} [props.onActionPerformed] - A callback function for when a quick action is performed.
|
|
36
|
+
* @return {React.ReactNode} The rendered component.
|
|
37
|
+
*/
|
|
27
38
|
export default function PostCardPanel( {
|
|
28
39
|
postType,
|
|
29
40
|
postId,
|
|
30
41
|
onActionPerformed,
|
|
31
42
|
} ) {
|
|
32
|
-
const
|
|
43
|
+
const postIds = useMemo(
|
|
44
|
+
() => ( Array.isArray( postId ) ? postId : [ postId ] ),
|
|
45
|
+
[ postId ]
|
|
46
|
+
);
|
|
47
|
+
const { postTitle, icon, labels } = useSelect(
|
|
33
48
|
( select ) => {
|
|
34
|
-
const { getEditedEntityRecord } =
|
|
49
|
+
const { getEditedEntityRecord, getEntityRecord, getPostType } =
|
|
50
|
+
select( coreStore );
|
|
51
|
+
const { getPostIcon } = unlock( select( editorStore ) );
|
|
52
|
+
let _title = '';
|
|
35
53
|
const _record = getEditedEntityRecord(
|
|
36
54
|
'postType',
|
|
37
55
|
postType,
|
|
38
|
-
|
|
56
|
+
postIds[ 0 ]
|
|
39
57
|
);
|
|
58
|
+
if ( postIds.length === 1 ) {
|
|
59
|
+
const { default_template_types: templateTypes = [] } =
|
|
60
|
+
getEntityRecord( 'root', '__unstableBase' ) ?? {};
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
template: _record,
|
|
53
|
-
templateTypes,
|
|
54
|
-
} )
|
|
55
|
-
: {};
|
|
62
|
+
const _templateInfo = [
|
|
63
|
+
TEMPLATE_POST_TYPE,
|
|
64
|
+
TEMPLATE_PART_POST_TYPE,
|
|
65
|
+
].includes( postType )
|
|
66
|
+
? getTemplateInfo( {
|
|
67
|
+
template: _record,
|
|
68
|
+
templateTypes,
|
|
69
|
+
} )
|
|
70
|
+
: {};
|
|
71
|
+
_title = _templateInfo?.title || _record?.title;
|
|
72
|
+
}
|
|
56
73
|
|
|
57
74
|
return {
|
|
58
|
-
|
|
59
|
-
icon:
|
|
75
|
+
postTitle: _title,
|
|
76
|
+
icon: getPostIcon( postType, {
|
|
60
77
|
area: _record?.area,
|
|
61
78
|
} ),
|
|
79
|
+
labels: getPostType( postType )?.labels,
|
|
62
80
|
};
|
|
63
81
|
},
|
|
64
|
-
[
|
|
82
|
+
[ postIds, postType ]
|
|
65
83
|
);
|
|
66
84
|
|
|
67
|
-
const pageTypeBadge = usePageTypeBadge();
|
|
85
|
+
const pageTypeBadge = usePageTypeBadge( postId );
|
|
86
|
+
let title = __( 'No title' );
|
|
87
|
+
if ( labels?.name && postIds.length > 1 ) {
|
|
88
|
+
title = sprintf(
|
|
89
|
+
// translators: %i number of selected items %s: Name of the plural post type e.g: "Posts".
|
|
90
|
+
__( '%i %s' ),
|
|
91
|
+
postId.length,
|
|
92
|
+
labels?.name
|
|
93
|
+
);
|
|
94
|
+
} else if ( postTitle ) {
|
|
95
|
+
title = decodeEntities( postTitle );
|
|
96
|
+
}
|
|
68
97
|
|
|
69
98
|
return (
|
|
70
|
-
<
|
|
99
|
+
<VStack spacing={ 1 } className="editor-post-card-panel">
|
|
71
100
|
<HStack
|
|
72
101
|
spacing={ 2 }
|
|
73
102
|
className="editor-post-card-panel__header"
|
|
@@ -78,12 +107,10 @@ export default function PostCardPanel( {
|
|
|
78
107
|
numberOfLines={ 2 }
|
|
79
108
|
truncate
|
|
80
109
|
className="editor-post-card-panel__title"
|
|
81
|
-
weight={ 500 }
|
|
82
110
|
as="h2"
|
|
83
|
-
lineHeight="20px"
|
|
84
111
|
>
|
|
85
|
-
{ title
|
|
86
|
-
{ pageTypeBadge && (
|
|
112
|
+
{ title }
|
|
113
|
+
{ pageTypeBadge && postIds.length === 1 && (
|
|
87
114
|
<span className="editor-post-card-panel__title-badge">
|
|
88
115
|
{ pageTypeBadge }
|
|
89
116
|
</span>
|
|
@@ -95,6 +122,15 @@ export default function PostCardPanel( {
|
|
|
95
122
|
onActionPerformed={ onActionPerformed }
|
|
96
123
|
/>
|
|
97
124
|
</HStack>
|
|
98
|
-
|
|
125
|
+
{ postIds.length > 1 && (
|
|
126
|
+
<Text className="editor-post-card-panel__description">
|
|
127
|
+
{ sprintf(
|
|
128
|
+
// translators: %s: Name of the plural post type e.g: "Posts".
|
|
129
|
+
__( 'Changes will be applied to all selected %s.' ),
|
|
130
|
+
labels?.name.toLowerCase()
|
|
131
|
+
) }
|
|
132
|
+
</Text>
|
|
133
|
+
) }
|
|
134
|
+
</VStack>
|
|
99
135
|
);
|
|
100
136
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
width: 100%;
|
|
8
8
|
|
|
9
9
|
&.editor-post-card-panel__title {
|
|
10
|
+
@include heading-medium();
|
|
10
11
|
margin: 0;
|
|
11
12
|
padding: 2px 0;
|
|
12
13
|
display: flex;
|
|
@@ -32,6 +33,10 @@
|
|
|
32
33
|
&.has-description &__header {
|
|
33
34
|
margin-bottom: $grid-unit-10;
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
.editor-post-card-panel__description {
|
|
38
|
+
color: $gray-700;
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
.editor-post-card-panel__title-badge {
|
|
@@ -75,7 +75,7 @@ function PostPublishPanelPrepublish( { children } ) {
|
|
|
75
75
|
if ( ! hasPublishAction ) {
|
|
76
76
|
prePublishTitle = __( 'Are you ready to submit for review?' );
|
|
77
77
|
prePublishBodyText = __(
|
|
78
|
-
'
|
|
78
|
+
'Your work will be reviewed and then approved.'
|
|
79
79
|
);
|
|
80
80
|
} else if ( isBeingScheduled ) {
|
|
81
81
|
prePublishTitle = __( 'Are you ready to schedule?' );
|
|
@@ -466,7 +466,7 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
|
|
|
466
466
|
</strong>
|
|
467
467
|
</div>
|
|
468
468
|
<p>
|
|
469
|
-
|
|
469
|
+
Your work will be reviewed and then approved.
|
|
470
470
|
</p>
|
|
471
471
|
<div
|
|
472
472
|
class="components-site-card"
|
|
@@ -619,7 +619,7 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
|
|
|
619
619
|
</strong>
|
|
620
620
|
</div>
|
|
621
621
|
<p>
|
|
622
|
-
|
|
622
|
+
Your work will be reviewed and then approved.
|
|
623
623
|
</p>
|
|
624
624
|
<div
|
|
625
625
|
class="components-site-card"
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import type { Action, Field } from '@wordpress/dataviews';
|
|
6
6
|
import { doAction } from '@wordpress/hooks';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editorStore } from '../../store';
|
|
12
|
-
import { unlock } from '../../lock-unlock';
|
|
13
7
|
import type { PostType } from '@wordpress/fields';
|
|
14
8
|
import {
|
|
15
9
|
viewPost,
|
|
@@ -35,8 +29,17 @@ import {
|
|
|
35
29
|
authorField,
|
|
36
30
|
titleField,
|
|
37
31
|
templateField,
|
|
32
|
+
templateTitleField,
|
|
33
|
+
pageTitleField,
|
|
34
|
+
patternTitleField,
|
|
38
35
|
} from '@wordpress/fields';
|
|
39
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Internal dependencies
|
|
39
|
+
*/
|
|
40
|
+
import { store as editorStore } from '../../store';
|
|
41
|
+
import { unlock } from '../../lock-unlock';
|
|
42
|
+
|
|
40
43
|
export function registerEntityAction< Item >(
|
|
41
44
|
kind: string,
|
|
42
45
|
name: string,
|
|
@@ -164,16 +167,28 @@ export const registerPostTypeSchema =
|
|
|
164
167
|
postTypeConfig.supports?.thumbnail &&
|
|
165
168
|
currentTheme?.theme_supports?.[ 'post-thumbnails' ] &&
|
|
166
169
|
featuredImageField,
|
|
167
|
-
titleField,
|
|
168
170
|
postTypeConfig.supports?.author && authorField,
|
|
169
171
|
statusField,
|
|
170
172
|
dateField,
|
|
171
173
|
slugField,
|
|
172
174
|
postTypeConfig.supports?.[ 'page-attributes' ] && parentField,
|
|
173
175
|
postTypeConfig.supports?.comments && commentStatusField,
|
|
174
|
-
passwordField,
|
|
175
176
|
templateField,
|
|
177
|
+
passwordField,
|
|
176
178
|
].filter( Boolean );
|
|
179
|
+
if ( postTypeConfig.supports?.title ) {
|
|
180
|
+
let _titleField;
|
|
181
|
+
if ( postType === 'page' ) {
|
|
182
|
+
_titleField = pageTitleField;
|
|
183
|
+
} else if ( postType === 'wp_template' ) {
|
|
184
|
+
_titleField = templateTitleField;
|
|
185
|
+
} else if ( postType === 'wp_block' ) {
|
|
186
|
+
_titleField = patternTitleField;
|
|
187
|
+
} else {
|
|
188
|
+
_titleField = titleField;
|
|
189
|
+
}
|
|
190
|
+
fields.push( _titleField );
|
|
191
|
+
}
|
|
177
192
|
|
|
178
193
|
registry.batch( () => {
|
|
179
194
|
actions.forEach( ( action ) => {
|
|
@@ -5,19 +5,14 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editorStore } from '../store';
|
|
12
|
-
|
|
13
8
|
/**
|
|
14
9
|
* Custom hook to get the page type badge for the current post on edit site view.
|
|
10
|
+
*
|
|
11
|
+
* @param {number|string} postId postId of the current post being edited.
|
|
15
12
|
*/
|
|
16
|
-
export default function usePageTypeBadge() {
|
|
13
|
+
export default function usePageTypeBadge( postId ) {
|
|
17
14
|
const { isFrontPage, isPostsPage } = useSelect( ( select ) => {
|
|
18
|
-
const { getCurrentPostId } = select( editorStore );
|
|
19
15
|
const { canUser, getEditedEntityRecord } = select( coreStore );
|
|
20
|
-
const postId = getCurrentPostId();
|
|
21
16
|
const siteSettings = canUser( 'read', {
|
|
22
17
|
kind: 'root',
|
|
23
18
|
name: 'site',
|
|
@@ -25,9 +20,11 @@ export default function usePageTypeBadge() {
|
|
|
25
20
|
? getEditedEntityRecord( 'root', 'site' )
|
|
26
21
|
: undefined;
|
|
27
22
|
|
|
23
|
+
const _postId = parseInt( postId, 10 );
|
|
24
|
+
|
|
28
25
|
return {
|
|
29
|
-
isFrontPage: siteSettings?.page_on_front ===
|
|
30
|
-
isPostsPage: siteSettings?.page_for_posts ===
|
|
26
|
+
isFrontPage: siteSettings?.page_on_front === _postId,
|
|
27
|
+
isPostsPage: siteSettings?.page_for_posts === _postId,
|
|
31
28
|
};
|
|
32
29
|
} );
|
|
33
30
|
|