@wordpress/editor 14.12.0 → 14.13.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/README.md +120 -99
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +17 -65
- package/build/components/collab-sidebar/add-comment.js.map +1 -1
- package/build/components/collab-sidebar/comment-author-info.js +76 -0
- package/build/components/collab-sidebar/comment-author-info.js.map +1 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js +2 -2
- package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -1
- package/build/components/collab-sidebar/comment-button.js +2 -2
- package/build/components/collab-sidebar/comment-button.js.map +1 -1
- package/build/components/collab-sidebar/comment-form.js +64 -0
- package/build/components/collab-sidebar/comment-form.js.map +1 -0
- package/build/components/collab-sidebar/comments.js +33 -91
- package/build/components/collab-sidebar/comments.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/document-bar/index.js +10 -3
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/check.js +4 -4
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +8 -8
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +1 -1
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-history/redo.js +1 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +1 -1
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-interface/content-slot-fill.js +1 -10
- package/build/components/editor-interface/content-slot-fill.js.map +1 -1
- package/build/components/editor-interface/index.js +3 -9
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/editor-notices/index.js +1 -1
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +1 -1
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +9 -1
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/index.js +2 -2
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/page-attributes/check.js +3 -3
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +1 -1
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +1 -1
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +1 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-document-setting-panel/index.js +2 -2
- package/build/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +2 -1
- package/build/components/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +2 -2
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-post-status-info/index.js +4 -4
- package/build/components/plugin-post-status-info/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +2 -2
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +2 -1
- package/build/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -0
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/plugin-sidebar-more-menu-item/index.js +2 -1
- package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/post-actions/actions.js +3 -3
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-author/check.js +3 -3
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +1 -1
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +1 -1
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +9 -4
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +1 -1
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-discussion/panel.js +1 -1
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +3 -3
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/panel.js +1 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +4 -4
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/check.js +3 -3
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +39 -9
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-featured-image/panel.js +1 -1
- package/build/components/post-featured-image/panel.js.map +1 -1
- package/build/components/post-fields/index.js +70 -0
- package/build/components/post-fields/index.js.map +1 -0
- package/build/components/post-format/check.js +9 -12
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-format/panel.js +1 -1
- package/build/components/post-format/panel.js.map +1 -1
- package/build/components/post-last-revision/check.js +3 -3
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-last-revision/panel.js +1 -1
- package/build/components/post-last-revision/panel.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +3 -3
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +1 -1
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +5 -2
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-schedule/check.js +3 -3
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +1 -1
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/check.js +3 -3
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +1 -1
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/check.js +3 -3
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +1 -1
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +3 -3
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/panel.js +16 -13
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/classic-theme.js +2 -2
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/panel.js +1 -1
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-text-editor/index.js +1 -1
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +20 -18
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +1 -1
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-trash/check.js +3 -3
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +1 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js +6 -6
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js +3 -3
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js +1 -1
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-visibility/check.js +1 -1
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +1 -1
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/preferences-modal/block-visibility.js +87 -0
- package/build/components/preferences-modal/block-visibility.js.map +1 -0
- package/build/components/preferences-modal/enable-panel.js +27 -19
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +13 -10
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
- package/build/components/preferences-modal/index.js +2 -2
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +14 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/table-of-contents/index.js +1 -1
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +4 -4
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js +1 -1
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js +1 -1
- package/build/components/word-count/index.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +8 -3
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/api.js +41 -0
- package/build/dataviews/api.js.map +1 -1
- package/build/dataviews/store/private-actions.js +26 -4
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/private-selectors.js +5 -0
- package/build/dataviews/store/private-selectors.js.map +1 -1
- package/build/dataviews/store/reducer.js +23 -0
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/private-apis.js +4 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +11 -9
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +5 -1
- package/build/store/private-selectors.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 +34 -42
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-template-info.js +60 -0
- package/build/utils/get-template-info.js.map +1 -0
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -1
- 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 +18 -67
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-author-info.js +71 -0
- package/build-module/components/collab-sidebar/comment-author-info.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js +2 -2
- package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-button.js +2 -2
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-form.js +59 -0
- package/build-module/components/collab-sidebar/comment-form.js.map +1 -0
- package/build-module/components/collab-sidebar/comments.js +33 -91
- package/build-module/components/collab-sidebar/comments.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +10 -3
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/check.js +4 -4
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +8 -8
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -1
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +1 -1
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +1 -1
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-interface/content-slot-fill.js +2 -11
- package/build-module/components/editor-interface/content-slot-fill.js.map +1 -1
- package/build-module/components/editor-interface/index.js +4 -10
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -1
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +1 -1
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +9 -1
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +2 -2
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +3 -3
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +1 -1
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +1 -1
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +1 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-document-setting-panel/index.js +2 -2
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +2 -1
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +2 -2
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-post-status-info/index.js +4 -4
- package/build-module/components/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +2 -2
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +2 -1
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -0
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/plugin-sidebar-more-menu-item/index.js +2 -1
- package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +3 -3
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-author/check.js +3 -3
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +1 -1
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +1 -1
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -4
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +1 -1
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +1 -1
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +3 -3
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +1 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +4 -4
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/check.js +3 -3
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +40 -10
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-featured-image/panel.js +1 -1
- package/build-module/components/post-featured-image/panel.js.map +1 -1
- package/build-module/components/post-fields/index.js +62 -0
- package/build-module/components/post-fields/index.js.map +1 -0
- package/build-module/components/post-format/check.js +10 -11
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +1 -1
- package/build-module/components/post-format/panel.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +3 -3
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-last-revision/panel.js +1 -1
- package/build-module/components/post-last-revision/panel.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +3 -3
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +1 -1
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +1 -1
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +5 -2
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +3 -3
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +1 -1
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/check.js +3 -3
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +1 -1
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +3 -3
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +1 -1
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +3 -3
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js +17 -12
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +2 -2
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/panel.js +1 -1
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +1 -1
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/index.js +20 -18
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +1 -1
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-trash/check.js +3 -3
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +6 -6
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js +3 -3
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-visibility/check.js +1 -1
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -1
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/preferences-modal/block-visibility.js +80 -0
- package/build-module/components/preferences-modal/block-visibility.js.map +1 -0
- package/build-module/components/preferences-modal/enable-panel.js +27 -19
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +13 -10
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +2 -2
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +14 -8
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +1 -1
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +4 -4
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +1 -1
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js +1 -1
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +8 -3
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/api.js +39 -0
- package/build-module/dataviews/api.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +23 -3
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/private-selectors.js +4 -0
- package/build-module/dataviews/store/private-selectors.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +23 -0
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/private-apis.js +4 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +11 -9
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +6 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.native.js +2 -1
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +33 -39
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-template-info.js +51 -0
- package/build-module/utils/get-template-info.js.map +1 -0
- package/build-style/style-rtl.css +11 -81
- package/build-style/style.css +11 -81
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts +2 -2
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +2 -2
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +17 -0
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-form.d.ts +18 -0
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +2 -2
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts +2 -2
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-outline/check.d.ts +5 -5
- package/build-types/components/document-outline/check.d.ts.map +1 -1
- package/build-types/components/document-outline/index.d.ts +4 -6
- package/build-types/components/document-outline/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/content-slot-fill.d.ts +12 -1
- package/build-types/components/editor-interface/content-slot-fill.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/editor-notices/index.d.ts +2 -2
- package/build-types/components/editor-notices/index.d.ts.map +1 -1
- package/build-types/components/editor-snackbars/index.d.ts +2 -2
- package/build-types/components/editor-snackbars/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts +4 -4
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/header/back-button.d.ts.map +1 -1
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/page-attributes/check.d.ts +5 -5
- package/build-types/components/page-attributes/check.d.ts.map +1 -1
- package/build-types/components/page-attributes/order.d.ts +2 -2
- package/build-types/components/page-attributes/order.d.ts.map +1 -1
- package/build-types/components/page-attributes/panel.d.ts +2 -2
- package/build-types/components/page-attributes/panel.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts +2 -2
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-document-setting-panel/index.d.ts +4 -4
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-more-menu-item/index.d.ts +4 -2
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-publish-panel/index.d.ts +4 -4
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-status-info/index.d.ts +6 -6
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
- package/build-types/components/plugin-pre-publish-panel/index.d.ts +4 -4
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +4 -2
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts +2 -0
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts +4 -2
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/post-author/check.d.ts +5 -5
- package/build-types/components/post-author/check.d.ts.map +1 -1
- package/build-types/components/post-author/index.d.ts +2 -2
- package/build-types/components/post-author/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts +2 -2
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-discussion/panel.d.ts +2 -2
- package/build-types/components/post-discussion/panel.d.ts.map +1 -1
- package/build-types/components/post-excerpt/check.d.ts +5 -5
- package/build-types/components/post-excerpt/check.d.ts.map +1 -1
- package/build-types/components/post-excerpt/panel.d.ts +2 -2
- package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
- package/build-types/components/post-excerpt/plugin.d.ts +6 -6
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
- package/build-types/components/post-featured-image/check.d.ts +5 -5
- package/build-types/components/post-featured-image/check.d.ts.map +1 -1
- package/build-types/components/post-featured-image/panel.d.ts +2 -2
- package/build-types/components/post-featured-image/panel.d.ts.map +1 -1
- package/build-types/components/post-fields/index.d.ts +12 -0
- package/build-types/components/post-fields/index.d.ts.map +1 -0
- package/build-types/components/post-format/check.d.ts +11 -4
- package/build-types/components/post-format/check.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts +2 -2
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-format/panel.d.ts +2 -2
- package/build-types/components/post-format/panel.d.ts.map +1 -1
- package/build-types/components/post-last-revision/check.d.ts +5 -5
- package/build-types/components/post-last-revision/check.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts +2 -2
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/panel.d.ts +2 -2
- package/build-types/components/post-last-revision/panel.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts +2 -2
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-pending-status/check.d.ts +5 -5
- package/build-types/components/post-pending-status/check.d.ts.map +1 -1
- package/build-types/components/post-pending-status/index.d.ts +2 -2
- package/build-types/components/post-pending-status/index.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts +2 -2
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-schedule/check.d.ts +5 -5
- package/build-types/components/post-schedule/check.d.ts.map +1 -1
- package/build-types/components/post-schedule/index.d.ts +2 -2
- package/build-types/components/post-schedule/index.d.ts.map +1 -1
- package/build-types/components/post-schedule/label.d.ts +2 -2
- package/build-types/components/post-schedule/label.d.ts.map +1 -1
- package/build-types/components/post-schedule/panel.d.ts +2 -2
- package/build-types/components/post-schedule/panel.d.ts.map +1 -1
- package/build-types/components/post-slug/check.d.ts +5 -5
- package/build-types/components/post-slug/check.d.ts.map +1 -1
- package/build-types/components/post-slug/index.d.ts +2 -2
- package/build-types/components/post-slug/index.d.ts.map +1 -1
- package/build-types/components/post-sticky/check.d.ts +5 -5
- package/build-types/components/post-sticky/check.d.ts.map +1 -1
- package/build-types/components/post-sticky/index.d.ts +2 -2
- package/build-types/components/post-sticky/index.d.ts.map +1 -1
- package/build-types/components/post-switch-to-draft-button/index.d.ts +2 -2
- package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -1
- package/build-types/components/post-sync-status/index.d.ts +2 -2
- package/build-types/components/post-sync-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/check.d.ts +5 -5
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +2 -2
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/panel.d.ts +6 -2
- package/build-types/components/post-taxonomies/panel.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts +2 -2
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/post-text-editor/index.d.ts +2 -2
- package/build-types/components/post-text-editor/index.d.ts.map +1 -1
- package/build-types/components/post-title/index.d.ts +1 -1
- package/build-types/components/post-trash/check.d.ts +5 -5
- package/build-types/components/post-trash/check.d.ts.map +1 -1
- package/build-types/components/post-trash/index.d.ts +2 -2
- package/build-types/components/post-trash/index.d.ts.map +1 -1
- package/build-types/components/post-type-support-check/index.d.ts +8 -8
- package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
- package/build-types/components/post-url/check.d.ts +5 -5
- package/build-types/components/post-url/check.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts +2 -2
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/post-url/label.d.ts +2 -2
- package/build-types/components/post-url/label.d.ts.map +1 -1
- package/build-types/components/post-url/panel.d.ts +2 -2
- package/build-types/components/post-url/panel.d.ts.map +1 -1
- package/build-types/components/post-visibility/check.d.ts +2 -2
- package/build-types/components/post-visibility/check.d.ts.map +1 -1
- package/build-types/components/post-visibility/index.d.ts +2 -2
- package/build-types/components/post-visibility/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/block-visibility.d.ts +2 -0
- package/build-types/components/preferences-modal/block-visibility.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-panel.d.ts +1 -2
- package/build-types/components/preferences-modal/enable-panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts +1 -2
- package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts +2 -2
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/theme-support-check/index.d.ts +6 -6
- package/build-types/components/theme-support-check/index.d.ts.map +1 -1
- package/build-types/components/time-to-read/index.d.ts +2 -2
- package/build-types/components/time-to-read/index.d.ts.map +1 -1
- package/build-types/components/unsaved-changes-warning/index.d.ts +2 -2
- package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -1
- package/build-types/components/word-count/index.d.ts +2 -2
- package/build-types/components/word-count/index.d.ts.map +1 -1
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
- package/build-types/dataviews/api.d.ts +24 -0
- package/build-types/dataviews/api.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts +14 -2
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/private-selectors.d.ts +1 -0
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +10 -2
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +7 -5
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +1 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +5 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +4 -11
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-info.d.ts +6 -0
- package/build-types/utils/get-template-info.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -1
- package/src/components/collab-sidebar/add-comment.js +21 -78
- package/src/components/collab-sidebar/comment-author-info.js +68 -0
- package/src/components/collab-sidebar/comment-button-toolbar.js +3 -3
- package/src/components/collab-sidebar/comment-button.js +3 -3
- package/src/components/collab-sidebar/comment-form.js +62 -0
- package/src/components/collab-sidebar/comments.js +39 -101
- package/src/components/create-template-part-modal/index.js +3 -2
- package/src/components/document-bar/index.js +12 -3
- package/src/components/document-outline/check.js +4 -4
- package/src/components/document-outline/index.js +9 -9
- package/src/components/document-tools/index.js +3 -2
- package/src/components/editor-history/redo.js +1 -1
- package/src/components/editor-history/undo.js +1 -1
- package/src/components/editor-interface/content-slot-fill.js +4 -9
- package/src/components/editor-interface/index.js +1 -11
- package/src/components/editor-notices/index.js +1 -1
- package/src/components/editor-snackbars/index.js +1 -1
- package/src/components/entities-saved-states/entity-record-item.js +12 -4
- package/src/components/entities-saved-states/index.js +2 -2
- package/src/components/header/style.scss +2 -1
- package/src/components/page-attributes/check.js +3 -3
- package/src/components/page-attributes/order.js +1 -1
- package/src/components/page-attributes/panel.js +1 -1
- package/src/components/page-attributes/parent.js +1 -1
- package/src/components/plugin-document-setting-panel/index.js +2 -2
- package/src/components/plugin-more-menu-item/index.js +2 -1
- package/src/components/plugin-post-publish-panel/index.js +2 -2
- package/src/components/plugin-post-status-info/index.js +4 -4
- package/src/components/plugin-pre-publish-panel/index.js +2 -2
- package/src/components/plugin-preview-menu-item/index.js +2 -1
- package/src/components/plugin-sidebar/index.js +1 -0
- package/src/components/plugin-sidebar-more-menu-item/index.js +2 -2
- package/src/components/post-actions/actions.js +3 -3
- package/src/components/post-author/check.js +3 -3
- package/src/components/post-author/index.js +1 -1
- package/src/components/post-author/panel.js +1 -1
- package/src/components/post-card-panel/index.js +18 -5
- package/src/components/post-comments/index.js +1 -1
- package/src/components/post-discussion/panel.js +1 -1
- package/src/components/post-excerpt/check.js +3 -3
- package/src/components/post-excerpt/panel.js +1 -1
- package/src/components/post-excerpt/plugin.js +4 -4
- package/src/components/post-featured-image/check.js +3 -3
- package/src/components/post-featured-image/index.js +107 -43
- package/src/components/post-featured-image/panel.js +1 -1
- package/src/components/post-featured-image/style.scss +23 -13
- package/src/components/post-fields/index.ts +76 -0
- package/src/components/post-format/check.js +9 -11
- package/src/components/post-format/index.js +1 -1
- package/src/components/post-format/panel.js +1 -1
- package/src/components/post-last-revision/check.js +3 -3
- package/src/components/post-last-revision/index.js +1 -1
- package/src/components/post-last-revision/panel.js +1 -1
- package/src/components/post-locked-modal/index.js +1 -1
- package/src/components/post-pending-status/check.js +3 -3
- package/src/components/post-pending-status/index.js +1 -1
- package/src/components/post-preview-button/index.js +1 -1
- package/src/components/post-publish-panel/index.js +7 -3
- package/src/components/post-schedule/check.js +3 -3
- package/src/components/post-schedule/index.js +1 -1
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-slug/check.js +3 -3
- package/src/components/post-slug/index.js +1 -1
- package/src/components/post-sticky/check.js +3 -3
- package/src/components/post-sticky/index.js +1 -1
- package/src/components/post-switch-to-draft-button/index.js +1 -1
- package/src/components/post-sync-status/index.js +1 -1
- package/src/components/post-taxonomies/check.js +3 -3
- package/src/components/post-taxonomies/flat-term-selector.js +1 -1
- package/src/components/post-taxonomies/panel.js +15 -12
- package/src/components/post-template/classic-theme.js +2 -2
- package/src/components/post-template/panel.js +1 -1
- package/src/components/post-text-editor/index.js +1 -1
- package/src/components/post-title/index.js +20 -18
- package/src/components/post-title/post-title-raw.js +1 -1
- package/src/components/post-trash/check.js +3 -3
- package/src/components/post-trash/index.js +1 -1
- package/src/components/post-type-support-check/index.js +6 -6
- package/src/components/post-url/check.js +3 -3
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-url/label.js +1 -1
- package/src/components/post-url/panel.js +1 -1
- package/src/components/post-visibility/check.js +1 -1
- package/src/components/post-visibility/index.js +1 -1
- package/src/components/preferences-modal/block-visibility.js +96 -0
- package/src/components/preferences-modal/enable-panel.js +27 -17
- package/src/components/preferences-modal/enable-publish-sidebar.js +18 -15
- package/src/components/preferences-modal/index.js +2 -2
- package/src/components/provider/index.js +55 -30
- package/src/components/table-of-contents/index.js +1 -1
- package/src/components/theme-support-check/index.js +4 -4
- package/src/components/time-to-read/index.js +1 -1
- package/src/components/unsaved-changes-warning/index.js +1 -1
- package/src/components/word-count/index.js +1 -1
- package/src/components/zoom-out-toggle/index.js +26 -13
- package/src/dataviews/api.js +41 -0
- package/src/dataviews/store/private-actions.ts +57 -3
- package/src/dataviews/store/private-selectors.ts +4 -0
- package/src/dataviews/store/reducer.ts +38 -1
- package/src/private-apis.js +4 -1
- package/src/store/actions.js +13 -9
- package/src/store/private-selectors.js +13 -8
- package/src/store/reducer.native.js +2 -0
- package/src/store/selectors.js +80 -62
- package/src/store/test/selectors.js +0 -255
- package/src/style.scss +0 -1
- package/src/utils/get-template-info.js +52 -0
- package/src/utils/test/get-template-info.js +224 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-manager/category.js +0 -107
- package/build/components/block-manager/category.js.map +0 -1
- package/build/components/block-manager/checklist.js +0 -35
- package/build/components/block-manager/checklist.js.map +0 -1
- package/build/components/block-manager/index.js +0 -115
- package/build/components/block-manager/index.js.map +0 -1
- package/build-module/components/block-manager/category.js +0 -99
- package/build-module/components/block-manager/category.js.map +0 -1
- package/build-module/components/block-manager/checklist.js +0 -28
- package/build-module/components/block-manager/checklist.js.map +0 -1
- package/build-module/components/block-manager/index.js +0 -107
- package/build-module/components/block-manager/index.js.map +0 -1
- package/build-types/components/block-manager/category.d.ts +0 -6
- package/build-types/components/block-manager/category.d.ts.map +0 -1
- package/build-types/components/block-manager/checklist.d.ts +0 -7
- package/build-types/components/block-manager/checklist.d.ts.map +0 -1
- package/build-types/components/block-manager/index.d.ts +0 -2
- package/build-types/components/block-manager/index.d.ts.map +0 -1
- package/src/components/block-manager/category.js +0 -96
- package/src/components/block-manager/checklist.js +0 -30
- package/src/components/block-manager/index.js +0 -145
- package/src/components/block-manager/style.scss +0 -82
|
@@ -15,6 +15,7 @@ var _constants = require("../../store/constants");
|
|
|
15
15
|
var _lockUnlock = require("../../lock-unlock");
|
|
16
16
|
var _postActions = _interopRequireDefault(require("../post-actions"));
|
|
17
17
|
var _pageTypeBadge = _interopRequireDefault(require("../../utils/pageTypeBadge"));
|
|
18
|
+
var _getTemplateInfo = require("../../utils/get-template-info");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
20
|
/**
|
|
20
21
|
* WordPress dependencies
|
|
@@ -33,14 +34,18 @@ function PostCardPanel({
|
|
|
33
34
|
title,
|
|
34
35
|
icon
|
|
35
36
|
} = (0, _data.useSelect)(select => {
|
|
36
|
-
|
|
37
|
-
__experimentalGetTemplateInfo
|
|
38
|
-
} = select(_store.store);
|
|
37
|
+
var _select$getEntityReco;
|
|
39
38
|
const {
|
|
40
39
|
getEditedEntityRecord
|
|
41
40
|
} = select(_coreData.store);
|
|
42
41
|
const _record = getEditedEntityRecord('postType', postType, postId);
|
|
43
|
-
const
|
|
42
|
+
const {
|
|
43
|
+
default_template_types: templateTypes = []
|
|
44
|
+
} = (_select$getEntityReco = select(_coreData.store).getEntityRecord('root', '__unstableBase')) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : {};
|
|
45
|
+
const _templateInfo = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType) ? (0, _getTemplateInfo.getTemplateInfo)({
|
|
46
|
+
template: _record,
|
|
47
|
+
templateTypes
|
|
48
|
+
}) : {};
|
|
44
49
|
return {
|
|
45
50
|
title: _templateInfo?.title || _record?.title,
|
|
46
51
|
icon: (0, _lockUnlock.unlock)(select(_store.store)).getPostIcon(postType, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_coreData","_data","_i18n","_htmlEntities","_store","_constants","_lockUnlock","_postActions","_interopRequireDefault","_pageTypeBadge","_jsxRuntime","PostCardPanel","postType","postId","onActionPerformed","title","icon","useSelect","select","
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_data","_i18n","_htmlEntities","_store","_constants","_lockUnlock","_postActions","_interopRequireDefault","_pageTypeBadge","_getTemplateInfo","_jsxRuntime","PostCardPanel","postType","postId","onActionPerformed","title","icon","useSelect","select","_select$getEntityReco","getEditedEntityRecord","coreStore","_record","default_template_types","templateTypes","getEntityRecord","_templateInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","getTemplateInfo","template","unlock","editorStore","getPostIcon","area","pageTypeBadge","usePageTypeBadge","jsx","className","children","jsxs","__experimentalHStack","spacing","align","Icon","__experimentalText","numberOfLines","truncate","weight","as","lineHeight","decodeEntities","__","default"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { title, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase'\n\t\t\t\t) ?? {};\n\n\t\t\tconst _templateInfo = [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t].includes( postType )\n\t\t\t\t? getTemplateInfo( {\n\t\t\t\t\t\ttemplate: _record,\n\t\t\t\t\t\ttemplateTypes,\n\t\t\t\t } )\n\t\t\t\t: {};\n\n\t\t\treturn {\n\t\t\t\ttitle: _templateInfo?.title || _record?.title,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\n\tconst pageTypeBadge = usePageTypeBadge();\n\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No title' ) }\n\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ pageTypeBadge }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<PostActions\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,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@ function PostComments() {
|
|
|
55
55
|
/**
|
|
56
56
|
* A form for managing comment status.
|
|
57
57
|
*
|
|
58
|
-
* @return {
|
|
58
|
+
* @return {React.ReactNode} The rendered PostComments component.
|
|
59
59
|
*/
|
|
60
60
|
var _default = exports.default = PostComments;
|
|
61
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_store","_jsxRuntime","COMMENT_OPTIONS","label","_x","value","description","__","join","PostComments","commentStatus","useSelect","select","_select$getEditedPost","editorStore","getEditedPostAttribute","editPost","useDispatch","handleStatus","newCommentStatus","comment_status","jsx","children","__experimentalVStack","spacing","RadioControl","className","hideLabelFromVision","options","onChange","selected","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tRadioControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst COMMENT_OPTIONS = [\n\t{\n\t\tlabel: _x( 'Open', 'Adjective: e.g. \"Comments are open\"' ),\n\t\tvalue: 'open',\n\t\tdescription: __( 'Visitors can add new comments and replies.' ),\n\t},\n\t{\n\t\tlabel: __( 'Closed' ),\n\t\tvalue: 'closed',\n\t\tdescription: [\n\t\t\t__( 'Visitors cannot add new comments or replies.' ),\n\t\t\t__( 'Existing comments remain visible.' ),\n\t\t].join( ' ' ),\n\t},\n];\n\nfunction PostComments() {\n\tconst commentStatus = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'comment_status' ) ??\n\t\t\t'open',\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst handleStatus = ( newCommentStatus ) =>\n\t\teditPost( {\n\t\t\tcomment_status: newCommentStatus,\n\t\t} );\n\n\treturn (\n\t\t<form>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Comment status' ) }\n\t\t\t\t\toptions={ COMMENT_OPTIONS }\n\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\tselected={ commentStatus }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\n/**\n * A form for managing comment status.\n *\n * @return {
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_store","_jsxRuntime","COMMENT_OPTIONS","label","_x","value","description","__","join","PostComments","commentStatus","useSelect","select","_select$getEditedPost","editorStore","getEditedPostAttribute","editPost","useDispatch","handleStatus","newCommentStatus","comment_status","jsx","children","__experimentalVStack","spacing","RadioControl","className","hideLabelFromVision","options","onChange","selected","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tRadioControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst COMMENT_OPTIONS = [\n\t{\n\t\tlabel: _x( 'Open', 'Adjective: e.g. \"Comments are open\"' ),\n\t\tvalue: 'open',\n\t\tdescription: __( 'Visitors can add new comments and replies.' ),\n\t},\n\t{\n\t\tlabel: __( 'Closed' ),\n\t\tvalue: 'closed',\n\t\tdescription: [\n\t\t\t__( 'Visitors cannot add new comments or replies.' ),\n\t\t\t__( 'Existing comments remain visible.' ),\n\t\t].join( ' ' ),\n\t},\n];\n\nfunction PostComments() {\n\tconst commentStatus = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'comment_status' ) ??\n\t\t\t'open',\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst handleStatus = ( newCommentStatus ) =>\n\t\teditPost( {\n\t\t\tcomment_status: newCommentStatus,\n\t\t} );\n\n\treturn (\n\t\t<form>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Comment status' ) }\n\t\t\t\t\toptions={ COMMENT_OPTIONS }\n\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\tselected={ commentStatus }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\n/**\n * A form for managing comment status.\n *\n * @return {React.ReactNode} The rendered PostComments component.\n */\nexport default PostComments;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAAmD,IAAAI,WAAA,GAAAJ,OAAA;AAbnD;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMK,eAAe,GAAG,CACvB;EACCC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAM,EAAE,qCAAsC,CAAC;EAC1DC,KAAK,EAAE,MAAM;EACbC,WAAW,EAAE,IAAAC,QAAE,EAAE,4CAA6C;AAC/D,CAAC,EACD;EACCJ,KAAK,EAAE,IAAAI,QAAE,EAAE,QAAS,CAAC;EACrBF,KAAK,EAAE,QAAQ;EACfC,WAAW,EAAE,CACZ,IAAAC,QAAE,EAAE,8CAA+C,CAAC,EACpD,IAAAA,QAAE,EAAE,mCAAoC,CAAC,CACzC,CAACC,IAAI,CAAE,GAAI;AACb,CAAC,CACD;AAED,SAASC,YAAYA,CAAA,EAAG;EACvB,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM;IAAA,IAAAC,qBAAA;IAAA,QAAAA,qBAAA,GACPD,MAAM,CAAEE,YAAY,CAAC,CAACC,sBAAsB,CAAE,gBAAiB,CAAC,cAAAF,qBAAA,cAAAA,qBAAA,GAChE,MAAM;EAAA,GACP,EACD,CAAC;EACD,MAAM;IAAEG;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAY,CAAC;EAC/C,MAAMI,YAAY,GAAKC,gBAAgB,IACtCH,QAAQ,CAAE;IACTI,cAAc,EAAED;EACjB,CAAE,CAAC;EAEJ,oBACC,IAAAlB,WAAA,CAAAoB,GAAA;IAAAC,QAAA,eACC,IAAArB,WAAA,CAAAoB,GAAA,EAACvB,WAAA,CAAAyB,oBAAM;MAACC,OAAO,EAAG,CAAG;MAAAF,QAAA,eACpB,IAAArB,WAAA,CAAAoB,GAAA,EAACvB,WAAA,CAAA2B,YAAY;QACZC,SAAS,EAAC,+BAA+B;QACzCC,mBAAmB;QACnBxB,KAAK,EAAG,IAAAI,QAAE,EAAE,gBAAiB,CAAG;QAChCqB,OAAO,EAAG1B,eAAiB;QAC3B2B,QAAQ,EAAGX,YAAc;QACzBY,QAAQ,EAAGpB;MAAe,CAC1B;IAAC,CACK;EAAC,CACJ,CAAC;AAET;;AAEA;AACA;AACA;AACA;AACA;AAJA,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKexB,YAAY","ignoreList":[]}
|
|
@@ -100,7 +100,7 @@ function PostDiscussionToggle({
|
|
|
100
100
|
* checks whether the current post has support for the
|
|
101
101
|
* above and if the `discussion-panel` panel is enabled.
|
|
102
102
|
*
|
|
103
|
-
* @return {
|
|
103
|
+
* @return {React.ReactNode} The rendered PostDiscussionPanel component.
|
|
104
104
|
*/
|
|
105
105
|
function PostDiscussionPanel() {
|
|
106
106
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_element","_blockEditor","_coreData","_store","_postTypeSupportCheck","_interopRequireDefault","_postComments","_postPingbacks","_postPanelRow","_jsxRuntime","PANEL_NAME","ModalContents","onClose","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__","__experimentalVStack","spacing","default","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","useSelect","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","supports","comments","trackbacks","label","_x","Button","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\nimport PostPanelRow from '../post-panel-row';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction ModalContents( { onClose } ) {\n\treturn (\n\t\t<div className=\"editor-post-discussion\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PostComments />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PostPingbacks />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction PostDiscussionToggle( { isOpen, onClick } ) {\n\tconst {\n\t\tcommentStatus,\n\t\tpingStatus,\n\t\tcommentsSupported,\n\t\ttrackbacksSupported,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tcommentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',\n\t\t\tpingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',\n\t\t\tcommentsSupported: !! postType.supports.comments,\n\t\t\ttrackbacksSupported: !! postType.supports.trackbacks,\n\t\t};\n\t}, [] );\n\tlet label;\n\tif ( commentStatus === 'open' ) {\n\t\tif ( pingStatus === 'open' ) {\n\t\t\tlabel = _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t} else {\n\t\t\tlabel = trackbacksSupported\n\t\t\t\t? __( 'Comments only' )\n\t\t\t\t: _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t}\n\t} else if ( pingStatus === 'open' ) {\n\t\tlabel = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );\n\t} else {\n\t\tlabel = __( 'Closed' );\n\t}\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-discussion__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ __( 'Change discussion options' ) }\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\n/**\n * This component allows to update comment and pingback\n * settings for the current post. Internally there are\n * checks whether the current post has support for the\n * above and if the `discussion-panel` panel is enabled.\n *\n * @return {
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_element","_blockEditor","_coreData","_store","_postTypeSupportCheck","_interopRequireDefault","_postComments","_postPingbacks","_postPanelRow","_jsxRuntime","PANEL_NAME","ModalContents","onClose","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__","__experimentalVStack","spacing","default","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","useSelect","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","supports","comments","trackbacks","label","_x","Button","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\nimport PostPanelRow from '../post-panel-row';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction ModalContents( { onClose } ) {\n\treturn (\n\t\t<div className=\"editor-post-discussion\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PostComments />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PostPingbacks />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction PostDiscussionToggle( { isOpen, onClick } ) {\n\tconst {\n\t\tcommentStatus,\n\t\tpingStatus,\n\t\tcommentsSupported,\n\t\ttrackbacksSupported,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tcommentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',\n\t\t\tpingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',\n\t\t\tcommentsSupported: !! postType.supports.comments,\n\t\t\ttrackbacksSupported: !! postType.supports.trackbacks,\n\t\t};\n\t}, [] );\n\tlet label;\n\tif ( commentStatus === 'open' ) {\n\t\tif ( pingStatus === 'open' ) {\n\t\t\tlabel = _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t} else {\n\t\t\tlabel = trackbacksSupported\n\t\t\t\t? __( 'Comments only' )\n\t\t\t\t: _x( 'Open', 'Adjective: e.g. \"Comments are open\"' );\n\t\t}\n\t} else if ( pingStatus === 'open' ) {\n\t\tlabel = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );\n\t} else {\n\t\tlabel = __( 'Closed' );\n\t}\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-discussion__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ __( 'Change discussion options' ) }\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\n/**\n * This component allows to update comment and pingback\n * settings for the current post. Internally there are\n * checks whether the current post has support for the\n * above and if the `discussion-panel` panel is enabled.\n *\n * @return {React.ReactNode} The rendered PostDiscussionPanel component.\n */\nexport default function PostDiscussionPanel() {\n\tconst { isEnabled } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled } = select( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PostPanelRow label={ __( 'Discussion' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-discussion__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-discussion__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostDiscussionToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<ModalContents onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,O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AN,WAAA,CAAAO,GAAA,EAAClB,WAAA,CAAA+D,QAAQ;QACRP,YAAY,EAAGA,YAAc;QAC7BxC,SAAS,EAAC,wCAAwC;QAClDgD,gBAAgB,EAAC,sCAAsC;QACvDC,YAAY;QACZC,YAAY,EAAGA,CAAE;UAAEvC,MAAM;UAAEwC;QAAS,CAAC,kBACpC,IAAAxD,WAAA,CAAAO,GAAA,EAACQ,oBAAoB;UACpBC,MAAM,EAAGA,MAAQ;UACjBC,OAAO,EAAGuC;QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAEtD;QAAQ,CAAC,kBAC5B,IAAAH,WAAA,CAAAO,GAAA,EAACL,aAAa;UAACC,OAAO,EAAGA;QAAS,CAAE;MAClC,CACH;IAAC,CACW;EAAC,CACM,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -14,10 +14,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
14
14
|
/**
|
|
15
15
|
* Component for checking if the post type supports the excerpt field.
|
|
16
16
|
*
|
|
17
|
-
* @param {Object}
|
|
18
|
-
* @param {
|
|
17
|
+
* @param {Object} props Props.
|
|
18
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
19
19
|
*
|
|
20
|
-
* @return {
|
|
20
|
+
* @return {React.ReactNode} The rendered component.
|
|
21
21
|
*/function PostExcerptCheck({
|
|
22
22
|
children
|
|
23
23
|
}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","_jsxRuntime","PostExcerptCheck","children","jsx","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\n/**\n * Component for checking if the post type supports the excerpt field.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","_jsxRuntime","PostExcerptCheck","children","jsx","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\n/**\n * Component for checking if the post type supports the excerpt field.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The rendered component.\n */\nfunction PostExcerptCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"excerpt\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostExcerptCheck;\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,IAAAC,WAAA,GAAAD,OAAA;AAH9D;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASE,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,oBACC,IAAAF,WAAA,CAAAG,GAAA,EAACN,qBAAA,CAAAO,OAAoB;IAACC,WAAW,EAAC,SAAS;IAAAH,QAAA,EACxCA;EAAQ,CACW,CAAC;AAEzB;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcH,gBAAgB","ignoreList":[]}
|
|
@@ -72,7 +72,7 @@ function ExcerptPanel() {
|
|
|
72
72
|
/**
|
|
73
73
|
* Is rendered if the post type supports excerpts and allows editing the excerpt.
|
|
74
74
|
*
|
|
75
|
-
* @return {
|
|
75
|
+
* @return {React.ReactNode} The rendered PostExcerptPanel component.
|
|
76
76
|
*/
|
|
77
77
|
function PostExcerptPanel() {
|
|
78
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_check.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_element","_blockEditor","_coreData","_htmlEntities","_index","_interopRequireDefault","_check","_plugin","_constants","_store","_jsxRuntime","PANEL_NAME","ExcerptPanel","isOpened","isEnabled","postType","useSelect","select","isEditorPanelOpened","isEditorPanelEnabled","getCurrentPostType","editorStore","toggleEditorPanelOpened","useDispatch","toggleExcerptPanel","shouldUseDescriptionLabel","includes","jsx","PanelBody","title","__","opened","onToggle","children","default","Slot","fills","jsxs","Fragment","PostExcerptPanel","PrivatePostExcerptPanel","PrivateExcerpt","shouldRender","excerpt","shouldBeUsedAsDescription","allowEditing","getCurrentPostId","getEditedPostAttribute","isTemplateOrTemplatePart","isPattern","_shouldBeUsedAsDescription","_usedAttribute","template","coreStore","getEntityRecord","_shouldRender","source","TEMPLATE_ORIGINS","custom","has_theme_file","is_custom","popoverAnchor","setPopoverAnchor","useState","label","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","excerptText","__experimentalText","align","numberOfLines","truncate","decodeEntities","excerptPlaceholder","triggerEditLabel","__experimentalVStack","Dropdown","className","contentClassName","focusOnMount","ref","renderToggle","Button","__next40pxDefaultSize","onClick","variant","renderContent","onClose","__experimentalInspectorPopoverHeader","spacing","hideLabelFromVision","updateOnBlur"],"sources":["@wordpress/editor/src/components/post-excerpt/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\t__experimentalText as Text,\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostExcerptForm from './index';\nimport PostExcerptCheck from './check';\nimport PluginPostExcerpt from './plugin';\nimport { TEMPLATE_ORIGINS } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-excerpt';\n\nfunction ExcerptPanel() {\n\tconst { isOpened, isEnabled, postType } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditorPanelOpened,\n\t\t\tisEditorPanelEnabled,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\tconst toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\t// There are special cases where we want to label the excerpt as a description.\n\tconst shouldUseDescriptionLabel = [\n\t\t'wp_template',\n\t\t'wp_template_part',\n\t\t'wp_block',\n\t].includes( postType );\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={\n\t\t\t\tshouldUseDescriptionLabel\n\t\t\t\t\t? __( 'Description' )\n\t\t\t\t\t: __( 'Excerpt' )\n\t\t\t}\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ toggleExcerptPanel }\n\t\t>\n\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostExcerptForm />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostExcerpt.Slot>\n\t\t</PanelBody>\n\t);\n}\n\n/**\n * Is rendered if the post type supports excerpts and allows editing the excerpt.\n *\n * @return {JSX.Element} The rendered PostExcerptPanel component.\n */\nexport default function PostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<ExcerptPanel />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nexport function PrivatePostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<PrivateExcerpt />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nfunction PrivateExcerpt() {\n\tconst { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tisEditorPanelEnabled,\n\t\t\t} = select( editorStore );\n\t\t\tconst postType = getCurrentPostType();\n\t\t\tconst isTemplateOrTemplatePart = [\n\t\t\t\t'wp_template',\n\t\t\t\t'wp_template_part',\n\t\t\t].includes( postType );\n\t\t\tconst isPattern = postType === 'wp_block';\n\t\t\t// These post types use the `excerpt` field as a description semantically, so we need to\n\t\t\t// handle proper labeling and some flows where we should always render them as text.\n\t\t\tconst _shouldBeUsedAsDescription =\n\t\t\t\tisTemplateOrTemplatePart || isPattern;\n\t\t\tconst _usedAttribute = isTemplateOrTemplatePart\n\t\t\t\t? 'description'\n\t\t\t\t: 'excerpt';\n\t\t\t// We need to fetch the entity in this case to check if we'll allow editing.\n\t\t\tconst template =\n\t\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tgetCurrentPostId()\n\t\t\t\t);\n\t\t\t// For post types that use excerpt as description, we do not abide\n\t\t\t// by the `isEnabled` panel flag in order to render them as text.\n\t\t\tconst _shouldRender =\n\t\t\t\tisEditorPanelEnabled( PANEL_NAME ) ||\n\t\t\t\t_shouldBeUsedAsDescription;\n\t\t\treturn {\n\t\t\t\texcerpt: getEditedPostAttribute( _usedAttribute ),\n\t\t\t\tshouldRender: _shouldRender,\n\t\t\t\tshouldBeUsedAsDescription: _shouldBeUsedAsDescription,\n\t\t\t\t// If we should render, allow editing for all post types that are not used as description.\n\t\t\t\t// For the rest allow editing only for user generated entities.\n\t\t\t\tallowEditing:\n\t\t\t\t\t_shouldRender &&\n\t\t\t\t\t( ! _shouldBeUsedAsDescription ||\n\t\t\t\t\t\tisPattern ||\n\t\t\t\t\t\t( template &&\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom &&\n\t\t\t\t\t\t\t! template.has_theme_file &&\n\t\t\t\t\t\t\ttemplate.is_custom ) ),\n\t\t\t};\n\t\t}, [] );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst label = shouldBeUsedAsDescription\n\t\t? __( 'Description' )\n\t\t: __( 'Excerpt' );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': label,\n\t\t\theaderTitle: label,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor, label ]\n\t);\n\tif ( ! shouldRender ) {\n\t\treturn false;\n\t}\n\tconst excerptText = !! excerpt && (\n\t\t<Text align=\"left\" numberOfLines={ 4 } truncate={ allowEditing }>\n\t\t\t{ decodeEntities( excerpt ) }\n\t\t</Text>\n\t);\n\tif ( ! allowEditing ) {\n\t\treturn excerptText;\n\t}\n\tconst excerptPlaceholder = shouldBeUsedAsDescription\n\t\t? __( 'Add a description…' )\n\t\t: __( 'Add an excerpt…' );\n\tconst triggerEditLabel = shouldBeUsedAsDescription\n\t\t? __( 'Edit description' )\n\t\t: __( 'Edit excerpt' );\n\treturn (\n\t\t<VStack>\n\t\t\t{ excerptText }\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"editor-post-excerpt__dropdown\"\n\t\t\t\tcontentClassName=\"editor-post-excerpt__dropdown__content\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ excerptText ? triggerEditLabel : excerptPlaceholder }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ label }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<PostExcerptForm\n\t\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\t\tupdateOnBlur\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ fills }\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</PluginPostExcerpt.Slot>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,OAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAmD,IAAAa,WAAA,GAAAb,OAAA;AAxBnD;AACA;AACA;;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OAAA,CAAA2B,OAAiB,CAACC,IAAI;YAAAF,QAAA,EAClBG,KAAK,iBACR,IAAA1B,WAAA,CAAA2B,IAAA,EAAA3B,WAAA,CAAA4B,QAAA;cAAAL,QAAA,gBACC,IAAAvB,WAAA,CAAAiB,GAAA,EAACvB,MAAA,CAAA8B,OAAe;gBACf6D,mBAAmB;gBACnBC,YAAY;cAAA,CACZ,CAAC,EACA5D,KAAK;YAAA,CACN;UACF,CACsB;QAAC,CAClB,CAAC;MAAA,CACR;IACA,CACH,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_element","_blockEditor","_coreData","_htmlEntities","_index","_interopRequireDefault","_check","_plugin","_constants","_store","_jsxRuntime","PANEL_NAME","ExcerptPanel","isOpened","isEnabled","postType","useSelect","select","isEditorPanelOpened","isEditorPanelEnabled","getCurrentPostType","editorStore","toggleEditorPanelOpened","useDispatch","toggleExcerptPanel","shouldUseDescriptionLabel","includes","jsx","PanelBody","title","__","opened","onToggle","children","default","Slot","fills","jsxs","Fragment","PostExcerptPanel","PrivatePostExcerptPanel","PrivateExcerpt","shouldRender","excerpt","shouldBeUsedAsDescription","allowEditing","getCurrentPostId","getEditedPostAttribute","isTemplateOrTemplatePart","isPattern","_shouldBeUsedAsDescription","_usedAttribute","template","coreStore","getEntityRecord","_shouldRender","source","TEMPLATE_ORIGINS","custom","has_theme_file","is_custom","popoverAnchor","setPopoverAnchor","useState","label","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","excerptText","__experimentalText","align","numberOfLines","truncate","decodeEntities","excerptPlaceholder","triggerEditLabel","__experimentalVStack","Dropdown","className","contentClassName","focusOnMount","ref","renderToggle","Button","__next40pxDefaultSize","onClick","variant","renderContent","onClose","__experimentalInspectorPopoverHeader","spacing","hideLabelFromVision","updateOnBlur"],"sources":["@wordpress/editor/src/components/post-excerpt/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\t__experimentalText as Text,\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostExcerptForm from './index';\nimport PostExcerptCheck from './check';\nimport PluginPostExcerpt from './plugin';\nimport { TEMPLATE_ORIGINS } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-excerpt';\n\nfunction ExcerptPanel() {\n\tconst { isOpened, isEnabled, postType } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditorPanelOpened,\n\t\t\tisEditorPanelEnabled,\n\t\t\tgetCurrentPostType,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\tconst toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\t// There are special cases where we want to label the excerpt as a description.\n\tconst shouldUseDescriptionLabel = [\n\t\t'wp_template',\n\t\t'wp_template_part',\n\t\t'wp_block',\n\t].includes( postType );\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={\n\t\t\t\tshouldUseDescriptionLabel\n\t\t\t\t\t? __( 'Description' )\n\t\t\t\t\t: __( 'Excerpt' )\n\t\t\t}\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ toggleExcerptPanel }\n\t\t>\n\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PostExcerptForm />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PluginPostExcerpt.Slot>\n\t\t</PanelBody>\n\t);\n}\n\n/**\n * Is rendered if the post type supports excerpts and allows editing the excerpt.\n *\n * @return {React.ReactNode} The rendered PostExcerptPanel component.\n */\nexport default function PostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<ExcerptPanel />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nexport function PrivatePostExcerptPanel() {\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<PrivateExcerpt />\n\t\t</PostExcerptCheck>\n\t);\n}\n\nfunction PrivateExcerpt() {\n\tconst { shouldRender, excerpt, shouldBeUsedAsDescription, allowEditing } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tisEditorPanelEnabled,\n\t\t\t} = select( editorStore );\n\t\t\tconst postType = getCurrentPostType();\n\t\t\tconst isTemplateOrTemplatePart = [\n\t\t\t\t'wp_template',\n\t\t\t\t'wp_template_part',\n\t\t\t].includes( postType );\n\t\t\tconst isPattern = postType === 'wp_block';\n\t\t\t// These post types use the `excerpt` field as a description semantically, so we need to\n\t\t\t// handle proper labeling and some flows where we should always render them as text.\n\t\t\tconst _shouldBeUsedAsDescription =\n\t\t\t\tisTemplateOrTemplatePart || isPattern;\n\t\t\tconst _usedAttribute = isTemplateOrTemplatePart\n\t\t\t\t? 'description'\n\t\t\t\t: 'excerpt';\n\t\t\t// We need to fetch the entity in this case to check if we'll allow editing.\n\t\t\tconst template =\n\t\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tgetCurrentPostId()\n\t\t\t\t);\n\t\t\t// For post types that use excerpt as description, we do not abide\n\t\t\t// by the `isEnabled` panel flag in order to render them as text.\n\t\t\tconst _shouldRender =\n\t\t\t\tisEditorPanelEnabled( PANEL_NAME ) ||\n\t\t\t\t_shouldBeUsedAsDescription;\n\t\t\treturn {\n\t\t\t\texcerpt: getEditedPostAttribute( _usedAttribute ),\n\t\t\t\tshouldRender: _shouldRender,\n\t\t\t\tshouldBeUsedAsDescription: _shouldBeUsedAsDescription,\n\t\t\t\t// If we should render, allow editing for all post types that are not used as description.\n\t\t\t\t// For the rest allow editing only for user generated entities.\n\t\t\t\tallowEditing:\n\t\t\t\t\t_shouldRender &&\n\t\t\t\t\t( ! _shouldBeUsedAsDescription ||\n\t\t\t\t\t\tisPattern ||\n\t\t\t\t\t\t( template &&\n\t\t\t\t\t\t\ttemplate.source === TEMPLATE_ORIGINS.custom &&\n\t\t\t\t\t\t\t! template.has_theme_file &&\n\t\t\t\t\t\t\ttemplate.is_custom ) ),\n\t\t\t};\n\t\t}, [] );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst label = shouldBeUsedAsDescription\n\t\t? __( 'Description' )\n\t\t: __( 'Excerpt' );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': label,\n\t\t\theaderTitle: label,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor, label ]\n\t);\n\tif ( ! shouldRender ) {\n\t\treturn false;\n\t}\n\tconst excerptText = !! excerpt && (\n\t\t<Text align=\"left\" numberOfLines={ 4 } truncate={ allowEditing }>\n\t\t\t{ decodeEntities( excerpt ) }\n\t\t</Text>\n\t);\n\tif ( ! allowEditing ) {\n\t\treturn excerptText;\n\t}\n\tconst excerptPlaceholder = shouldBeUsedAsDescription\n\t\t? __( 'Add a description…' )\n\t\t: __( 'Add an excerpt…' );\n\tconst triggerEditLabel = shouldBeUsedAsDescription\n\t\t? __( 'Edit description' )\n\t\t: __( 'Edit excerpt' );\n\treturn (\n\t\t<VStack>\n\t\t\t{ excerptText }\n\t\t\t<Dropdown\n\t\t\t\tclassName=\"editor-post-excerpt__dropdown\"\n\t\t\t\tcontentClassName=\"editor-post-excerpt__dropdown__content\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ excerptText ? triggerEditLabel : excerptPlaceholder }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ label }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<PostExcerptForm\n\t\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\t\tupdateOnBlur\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ fills }\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</PluginPostExcerpt.Slot>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t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BC,OAAO,EAAGzD,QAAU;QACpB0D,OAAO,EAAC,MAAM;QAAAzD,QAAA,EAEZuC,WAAW,GAAGO,gBAAgB,GAAGD;MAAkB,CAC9C,CACN;MACHa,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5B,IAAAlF,WAAA,CAAA2B,IAAA,EAAA3B,WAAA,CAAA4B,QAAA;QAAAL,QAAA,gBACC,IAAAvB,WAAA,CAAAiB,GAAA,EAAC1B,YAAA,CAAA4F,oCAAsB;UACtBhE,KAAK,EAAGmC,KAAO;UACf4B,OAAO,EAAGA;QAAS,CACnB,CAAC,eAEF,IAAAlF,WAAA,CAAAiB,GAAA,EAAC7B,WAAA,CAAAkF,oBAAM;UAACc,OAAO,EAAG,CAAG;UAAA7D,QAAA,eACpB,IAAAvB,WAAA,CAAAiB,GAAA,EAACpB,OAAA,CAAA2B,OAAiB,CAACC,IAAI;YAAAF,QAAA,EAClBG,KAAK,iBACR,IAAA1B,WAAA,CAAA2B,IAAA,EAAA3B,WAAA,CAAA4B,QAAA;cAAAL,QAAA,gBACC,IAAAvB,WAAA,CAAAiB,GAAA,EAACvB,MAAA,CAAA8B,OAAe;gBACf6D,mBAAmB;gBACnBC,YAAY;cAAA,CACZ,CAAC,EACA5D,KAAK;YAAA,CACN;UACF,CACsB;QAAC,CAClB,CAAC;MAAA,CACR;IACA,CACH,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
|
|
@@ -22,9 +22,9 @@ const {
|
|
|
22
22
|
/**
|
|
23
23
|
* Renders a post excerpt panel in the post sidebar.
|
|
24
24
|
*
|
|
25
|
-
* @param {Object}
|
|
26
|
-
* @param {string}
|
|
27
|
-
* @param {
|
|
25
|
+
* @param {Object} props Component properties.
|
|
26
|
+
* @param {string} [props.className] An optional class name added to the row.
|
|
27
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```js
|
|
@@ -56,7 +56,7 @@ const {
|
|
|
56
56
|
* );
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
|
-
* @return {
|
|
59
|
+
* @return {React.ReactNode} The rendered component.
|
|
60
60
|
*/
|
|
61
61
|
const PluginPostExcerpt = ({
|
|
62
62
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_jsxRuntime","Fill","Slot","createSlotFill","PluginPostExcerpt","children","className","jsx","PanelRow","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-excerpt/plugin.js"],"sourcesContent":["/**\n * Defines as extensibility slot for the Excerpt panel.\n */\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelRow } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );\n\n/**\n * Renders a post excerpt panel in the post sidebar.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_components","require","_jsxRuntime","Fill","Slot","createSlotFill","PluginPostExcerpt","children","className","jsx","PanelRow","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-excerpt/plugin.js"],"sourcesContent":["/**\n * Defines as extensibility slot for the Excerpt panel.\n */\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelRow } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );\n\n/**\n * Renders a post excerpt panel in the post sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginPostExcerpt = wp.editPost.__experimentalPluginPostExcerpt;\n *\n * function MyPluginPostExcerpt() {\n * \treturn React.createElement(\n * \t\tPluginPostExcerpt,\n * \t\t{\n * \t\t\tclassName: 'my-plugin-post-excerpt',\n * \t\t},\n * \t\t__( 'Post excerpt custom content' )\n * \t)\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { __experimentalPluginPostExcerpt as PluginPostExcerpt } from '@wordpress/edit-post';\n *\n * const MyPluginPostExcerpt = () => (\n * \t<PluginPostExcerpt className=\"my-plugin-post-excerpt\">\n * \t\t{ __( 'Post excerpt custom content' ) }\n * \t</PluginPostExcerpt>\n * );\n * ```\n *\n * @return {React.ReactNode} The rendered component.\n */\nconst PluginPostExcerpt = ( { children, className } ) => {\n\treturn (\n\t\t<Fill>\n\t\t\t<PanelRow className={ className }>{ children }</PanelRow>\n\t\t</Fill>\n\t);\n};\n\nPluginPostExcerpt.Slot = Slot;\n\nexport default PluginPostExcerpt;\n"],"mappings":";;;;;;AAOA,IAAAA,WAAA,GAAAC,OAAA;AAAiE,IAAAC,WAAA,GAAAD,OAAA;AAPjE;AACA;AACA;;AAEA;AACA;AACA;;AAGA,MAAM;EAAEE,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,mBAAoB,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,QAAQ;EAAEC;AAAU,CAAC,KAAM;EACxD,oBACC,IAAAN,WAAA,CAAAO,GAAA,EAACN,IAAI;IAAAI,QAAA,eACJ,IAAAL,WAAA,CAAAO,GAAA,EAACT,WAAA,CAAAU,QAAQ;MAACF,SAAS,EAAGA,SAAW;MAAAD,QAAA,EAAGA;IAAQ,CAAY;EAAC,CACpD,CAAC;AAET,CAAC;AAEDD,iBAAiB,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEfP,iBAAiB","ignoreList":[]}
|
|
@@ -16,10 +16,10 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
16
16
|
* Wrapper component that renders its children only if the post type supports a featured image
|
|
17
17
|
* and the theme supports post thumbnails.
|
|
18
18
|
*
|
|
19
|
-
* @param {Object}
|
|
20
|
-
* @param {
|
|
19
|
+
* @param {Object} props Props.
|
|
20
|
+
* @param {React.ReactNode} props.children Children to be rendered.
|
|
21
21
|
*
|
|
22
|
-
* @return {
|
|
22
|
+
* @return {React.ReactNode} The rendered component.
|
|
23
23
|
*/function PostFeaturedImageCheck({
|
|
24
24
|
children
|
|
25
25
|
}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","_themeSupportCheck","_jsxRuntime","PostFeaturedImageCheck","children","jsx","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-featured-image/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport ThemeSupportCheck from '../theme-support-check';\n\n/**\n * Wrapper component that renders its children only if the post type supports a featured image\n * and the theme supports post thumbnails.\n *\n * @param {Object}
|
|
1
|
+
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","_themeSupportCheck","_jsxRuntime","PostFeaturedImageCheck","children","jsx","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-featured-image/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport ThemeSupportCheck from '../theme-support-check';\n\n/**\n * Wrapper component that renders its children only if the post type supports a featured image\n * and the theme supports post thumbnails.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The rendered component.\n */\nfunction PostFeaturedImageCheck( { children } ) {\n\treturn (\n\t\t<ThemeSupportCheck supportKeys=\"post-thumbnails\">\n\t\t\t<PostTypeSupportCheck supportKeys=\"thumbnail\">\n\t\t\t\t{ children }\n\t\t\t</PostTypeSupportCheck>\n\t\t</ThemeSupportCheck>\n\t);\n}\n\nexport default PostFeaturedImageCheck;\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAuD,IAAAE,WAAA,GAAAF,OAAA;AAJvD;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,SAASG,sBAAsBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC/C,oBACC,IAAAF,WAAA,CAAAG,GAAA,EAACJ,kBAAA,CAAAK,OAAiB;IAACC,WAAW,EAAC,iBAAiB;IAAAH,QAAA,eAC/C,IAAAF,WAAA,CAAAG,GAAA,EAACP,qBAAA,CAAAQ,OAAoB;MAACC,WAAW,EAAC,WAAW;MAAAH,QAAA,EAC1CA;IAAQ,CACW;EAAC,CACL,CAAC;AAEtB;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcH,sBAAsB","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
8
9
|
var _i18n = require("@wordpress/i18n");
|
|
9
10
|
var _hooks = require("@wordpress/hooks");
|
|
10
11
|
var _components = require("@wordpress/components");
|
|
@@ -17,6 +18,10 @@ var _coreData = require("@wordpress/core-data");
|
|
|
17
18
|
var _check = _interopRequireDefault(require("./check"));
|
|
18
19
|
var _store = require("../../store");
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
/**
|
|
22
|
+
* External dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
20
25
|
/**
|
|
21
26
|
* WordPress dependencies
|
|
22
27
|
*/
|
|
@@ -72,9 +77,10 @@ function PostFeaturedImage({
|
|
|
72
77
|
media,
|
|
73
78
|
postType,
|
|
74
79
|
noticeUI,
|
|
75
|
-
noticeOperations
|
|
80
|
+
noticeOperations,
|
|
81
|
+
isRequestingFeaturedImageMedia
|
|
76
82
|
}) {
|
|
77
|
-
const
|
|
83
|
+
const returnsFocusRef = (0, _element.useRef)(false);
|
|
78
84
|
const [isLoading, setIsLoading] = (0, _element.useState)(false);
|
|
79
85
|
const {
|
|
80
86
|
getSettings
|
|
@@ -125,6 +131,13 @@ function PostFeaturedImage({
|
|
|
125
131
|
// Translators: %s: The selected image filename.
|
|
126
132
|
(0, _i18n.__)('The current image has no alternative text. The file name is: %s'), imageMedia.media_details.sizes?.full?.file || imageMedia.slug);
|
|
127
133
|
}
|
|
134
|
+
function returnFocus(node) {
|
|
135
|
+
if (returnsFocusRef.current && node) {
|
|
136
|
+
node.focus();
|
|
137
|
+
returnsFocusRef.current = false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const isMissingMedia = !isRequestingFeaturedImageMedia && !!featuredImageId && !media;
|
|
128
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_check.default, {
|
|
129
142
|
children: [noticeUI, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
130
143
|
className: "editor-post-featured-image",
|
|
@@ -144,9 +157,13 @@ function PostFeaturedImage({
|
|
|
144
157
|
open
|
|
145
158
|
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
146
159
|
className: "editor-post-featured-image__container",
|
|
147
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
160
|
+
children: [isMissingMedia ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Notice, {
|
|
161
|
+
status: "warning",
|
|
162
|
+
isDismissible: false,
|
|
163
|
+
children: (0, _i18n.__)('Could not retrieve the featured image data.')
|
|
164
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Button, {
|
|
148
165
|
__next40pxDefaultSize: true,
|
|
149
|
-
ref:
|
|
166
|
+
ref: returnFocus,
|
|
150
167
|
className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
|
|
151
168
|
onClick: open,
|
|
152
169
|
"aria-label": !featuredImageId ? null : (0, _i18n.__)('Edit or replace the featured image'),
|
|
@@ -158,22 +175,31 @@ function PostFeaturedImage({
|
|
|
158
175
|
className: "editor-post-featured-image__preview-image",
|
|
159
176
|
src: mediaSourceUrl,
|
|
160
177
|
alt: getImageDescription(media)
|
|
161
|
-
}), isLoading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)]
|
|
178
|
+
}), (isLoading || isRequestingFeaturedImageMedia) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)]
|
|
162
179
|
}), !!featuredImageId && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
163
|
-
className:
|
|
180
|
+
className: (0, _clsx.default)('editor-post-featured-image__actions', {
|
|
181
|
+
'editor-post-featured-image__actions-missing-image': isMissingMedia,
|
|
182
|
+
'editor-post-featured-image__actions-is-requesting-image': isRequestingFeaturedImageMedia
|
|
183
|
+
}),
|
|
164
184
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
165
185
|
__next40pxDefaultSize: true,
|
|
166
186
|
className: "editor-post-featured-image__action",
|
|
167
187
|
onClick: open,
|
|
168
188
|
"aria-haspopup": "dialog",
|
|
189
|
+
variant: isMissingMedia ? 'secondary' : undefined,
|
|
169
190
|
children: (0, _i18n.__)('Replace')
|
|
170
191
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
171
192
|
__next40pxDefaultSize: true,
|
|
172
193
|
className: "editor-post-featured-image__action",
|
|
173
194
|
onClick: () => {
|
|
174
195
|
onRemoveImage();
|
|
175
|
-
|
|
196
|
+
// Signal that the toggle button should be focused,
|
|
197
|
+
// when it is rendered. Can't focus it directly here
|
|
198
|
+
// because it's rendered conditionally.
|
|
199
|
+
returnsFocusRef.current = true;
|
|
176
200
|
},
|
|
201
|
+
variant: isMissingMedia ? 'secondary' : undefined,
|
|
202
|
+
isDestructive: isMissingMedia,
|
|
177
203
|
children: (0, _i18n.__)('Remove')
|
|
178
204
|
})]
|
|
179
205
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropZone, {
|
|
@@ -189,7 +215,8 @@ function PostFeaturedImage({
|
|
|
189
215
|
const applyWithSelect = (0, _data.withSelect)(select => {
|
|
190
216
|
const {
|
|
191
217
|
getMedia,
|
|
192
|
-
getPostType
|
|
218
|
+
getPostType,
|
|
219
|
+
hasFinishedResolution
|
|
193
220
|
} = select(_coreData.store);
|
|
194
221
|
const {
|
|
195
222
|
getCurrentPostId,
|
|
@@ -202,7 +229,10 @@ const applyWithSelect = (0, _data.withSelect)(select => {
|
|
|
202
229
|
}) : null,
|
|
203
230
|
currentPostId: getCurrentPostId(),
|
|
204
231
|
postType: getPostType(getEditedPostAttribute('type')),
|
|
205
|
-
featuredImageId
|
|
232
|
+
featuredImageId,
|
|
233
|
+
isRequestingFeaturedImageMedia: !!featuredImageId && !hasFinishedResolution('getMedia', [featuredImageId, {
|
|
234
|
+
context: 'view'
|
|
235
|
+
}])
|
|
206
236
|
};
|
|
207
237
|
});
|
|
208
238
|
const applyWithDispatch = (0, _data.withDispatch)((dispatch, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_interopRequireDefault","_store","_jsxRuntime","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","jsx","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","useRef","isLoading","setIsLoading","useState","getSettings","useSelect","blockEditorStore","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","getImageDescription","imageMedia","alt_text","sprintf","full","file","slug","jsxs","default","className","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Button","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","Spinner","set_featured_image","__experimentalHStack","current","focus","DropZone","onFilesDrop","value","applyWithSelect","withSelect","select","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","exports","compose","withNotices","withFilters"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\t/**\n\t * Generates the featured image alt text for this editing context.\n\t *\n\t * @param {Object} imageMedia The image media object.\n\t * @param {string} imageMedia.alt_text The alternative text of the image.\n\t * @param {Object} imageMedia.media_details The media details of the image.\n\t * @param {Object} imageMedia.media_details.sizes The sizes of the image.\n\t * @param {Object} imageMedia.media_details.sizes.full The full size details of the image.\n\t * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image.\n\t * @param {string} imageMedia.slug The slug of the image.\n\t * @return {string} The featured image alt text.\n\t */\n\tfunction getImageDescription( imageMedia ) {\n\t\tif ( imageMedia.alt_text ) {\n\t\t\treturn sprintf(\n\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\timageMedia.alt_text\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t// Translators: %s: The selected image filename.\n\t\t\t__(\n\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t),\n\t\t\timageMedia.media_details.sizes?.full?.file || imageMedia.slug\n\t\t);\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ getImageDescription( media ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\talt={ getImageDescription( media ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAmD,IAAAY,WAAA,GAAAZ,OAAA;AA5BnD;AACA;AACA;;AAsBA;AACA;AACA;;AAIA,MAAMa,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAC;AAC1D,MAAMC,+BAA+B,GAAG,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AEkB,KAAK,EAAG;MACtByD,QAAQ,CAAE;QAAEC,cAAc,EAAE1D,KAAK,CAAC/B;MAAG,CAAE,CAAC;IACzC,CAAC;IACD0F,WAAWA,CAAE/D,SAAS,EAAG;MACxBkD,MAAM,CAAEpD,kBAAiB,CAAC,CACxBF,WAAW,CAAC,CAAC,CACbK,WAAW,CAAE;QACbC,YAAY,EAAE,CAAE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzByD,QAAQ,CAAE;YAAEC,cAAc,EAAE1D,KAAK,CAAC/B;UAAG,CAAE,CAAC;QACzC,CAAC;QACDkC,OAAOA,CAAEC,OAAO,EAAG;UAClBlB,gBAAgB,CAACmB,gBAAgB,CAAC,CAAC;UACnCnB,gBAAgB,CAACoB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDrB,aAAaA,CAAA,EAAG;MACf0E,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAAAE,QAAA,GAAAC,OAAA,CAAA9C,OAAA,GAee,IAAA+C,gBAAO,EACrBC,uBAAW,EACXnB,eAAe,EACfU,iBAAiB,EACjB,IAAAU,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAErF,iBAAkB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_store","_jsxRuntime","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","jsx","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","isRequestingFeaturedImageMedia","returnsFocusRef","useRef","isLoading","setIsLoading","useState","getSettings","useSelect","blockEditorStore","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","getImageDescription","imageMedia","alt_text","sprintf","full","file","slug","returnFocus","node","current","focus","isMissingMedia","jsxs","default","className","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Notice","status","isDismissible","Button","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","Spinner","set_featured_image","__experimentalHStack","clsx","variant","undefined","isDestructive","DropZone","onFilesDrop","value","applyWithSelect","withSelect","select","getMedia","getPostType","hasFinishedResolution","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","exports","compose","withNotices","withFilters"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n\tNotice,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n\tisRequestingFeaturedImageMedia,\n} ) {\n\tconst returnsFocusRef = useRef( false );\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\t/**\n\t * Generates the featured image alt text for this editing context.\n\t *\n\t * @param {Object} imageMedia The image media object.\n\t * @param {string} imageMedia.alt_text The alternative text of the image.\n\t * @param {Object} imageMedia.media_details The media details of the image.\n\t * @param {Object} imageMedia.media_details.sizes The sizes of the image.\n\t * @param {Object} imageMedia.media_details.sizes.full The full size details of the image.\n\t * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image.\n\t * @param {string} imageMedia.slug The slug of the image.\n\t * @return {string} The featured image alt text.\n\t */\n\tfunction getImageDescription( imageMedia ) {\n\t\tif ( imageMedia.alt_text ) {\n\t\t\treturn sprintf(\n\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\timageMedia.alt_text\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t// Translators: %s: The selected image filename.\n\t\t\t__(\n\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t),\n\t\t\timageMedia.media_details.sizes?.full?.file || imageMedia.slug\n\t\t);\n\t}\n\n\tfunction returnFocus( node ) {\n\t\tif ( returnsFocusRef.current && node ) {\n\t\t\tnode.focus();\n\t\t\treturnsFocusRef.current = false;\n\t\t}\n\t}\n\n\tconst isMissingMedia =\n\t\t! isRequestingFeaturedImageMedia && !! featuredImageId && ! media;\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ getImageDescription( media ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t{ isMissingMedia ? (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Could not retrieve the featured image data.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\tref={ returnFocus }\n\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\t\talt={ getImageDescription(\n\t\t\t\t\t\t\t\t\t\t\t\t\tmedia\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ ( isLoading ||\n\t\t\t\t\t\t\t\t\t\t\tisRequestingFeaturedImageMedia ) && (\n\t\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions',\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions-missing-image':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia,\n\t\t\t\t\t\t\t\t\t\t\t\t'editor-post-featured-image__actions-is-requesting-image':\n\t\t\t\t\t\t\t\t\t\t\t\t\tisRequestingFeaturedImageMedia,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'secondary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\t// Signal that the toggle button should be focused,\n\t\t\t\t\t\t\t\t\t\t\t\t// when it is rendered. Can't focus it directly here\n\t\t\t\t\t\t\t\t\t\t\t\t// because it's rendered conditionally.\n\t\t\t\t\t\t\t\t\t\t\t\treturnsFocusRef.current = true;\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t\tisMissingMedia\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'secondary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tisDestructive={ isMissingMedia }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType, hasFinishedResolution } =\n\t\tselect( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t\tisRequestingFeaturedImageMedia:\n\t\t\t!! featuredImageId &&\n\t\t\t! hasFinishedResolution( 'getMedia', [\n\t\t\t\tfeaturedImageId,\n\t\t\t\t{ context: 'view' },\n\t\t\t] ),\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,SAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAmD,IAAAY,WAAA,GAAAZ,OAAA;AAlCnD;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAIA,MAAMa,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAC;AAC1D,MAAMC,+BAA+B,GAAG,IAAAD,QAAE,EAAE,sBAAuB,CAAC;AAEpE,MAAME,YAAY,gBACjB,IAAAL,WAAA,CAAAM,GAAA;EAAAC,QAAA,EACG,IAAAJ,QAAE,EACH,kEACD;AAAC,CACC,CACH;AAED,SAASK,eAAeA,CAAEC,KAAK,EAAEC,MAAM,EAAG;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EACzC,IAAK,CAAEH,KAAK,EAAG;IACd,OAAO,CAAC,CAAC;EACV;EAEA,MAAMI,WAAW,GAAG,IAAAC,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,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAAAE,QAAA,GAAAC,OAAA,CAAApD,OAAA,GAee,IAAAqD,gBAAO,EACrBC,uBAAW,EACXpB,eAAe,EACfW,iBAAiB,EACjB,IAAAU,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAEjG,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -29,7 +29,7 @@ const PANEL_NAME = 'featured-image';
|
|
|
29
29
|
* @param {Object} props Props.
|
|
30
30
|
* @param {boolean} props.withPanelBody Whether to include the panel body. Default true.
|
|
31
31
|
*
|
|
32
|
-
* @return {
|
|
32
|
+
* @return {React.ReactNode} The component to be rendered.
|
|
33
33
|
* Return Null if the editor panel is disabled for featured image.
|
|
34
34
|
*/
|
|
35
35
|
function PostFeaturedImagePanel({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_store","_index","_interopRequireDefault","_check","_jsxRuntime","PANEL_NAME","PostFeaturedImagePanel","withPanelBody","_postType$labels$feat","postType","isEnabled","isOpened","useSelect","select","getEditedPostAttribute","isEditorPanelEnabled","isEditorPanelOpened","editorStore","getPostType","coreStore","toggleEditorPanelOpened","useDispatch","jsx","default","children","PanelBody","title","labels","featured_image","__","opened","onToggle"],"sources":["@wordpress/editor/src/components/post-featured-image/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostFeaturedImage from './index';\nimport PostFeaturedImageCheck from './check';\n\nconst PANEL_NAME = 'featured-image';\n\n/**\n * Renders the panel for the post featured image.\n *\n * @param {Object} props Props.\n * @param {boolean} props.withPanelBody Whether to include the panel body. Default true.\n *\n * @return {
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_coreData","_store","_index","_interopRequireDefault","_check","_jsxRuntime","PANEL_NAME","PostFeaturedImagePanel","withPanelBody","_postType$labels$feat","postType","isEnabled","isOpened","useSelect","select","getEditedPostAttribute","isEditorPanelEnabled","isEditorPanelOpened","editorStore","getPostType","coreStore","toggleEditorPanelOpened","useDispatch","jsx","default","children","PanelBody","title","labels","featured_image","__","opened","onToggle"],"sources":["@wordpress/editor/src/components/post-featured-image/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostFeaturedImage from './index';\nimport PostFeaturedImageCheck from './check';\n\nconst PANEL_NAME = 'featured-image';\n\n/**\n * Renders the panel for the post featured image.\n *\n * @param {Object} props Props.\n * @param {boolean} props.withPanelBody Whether to include the panel body. Default true.\n *\n * @return {React.ReactNode} The component to be rendered.\n * Return Null if the editor panel is disabled for featured image.\n */\nexport default function PostFeaturedImagePanel( { withPanelBody = true } ) {\n\tconst { postType, isEnabled, isOpened } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tisEditorPanelEnabled,\n\t\t\tisEditorPanelOpened,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tif ( ! withPanelBody ) {\n\t\treturn (\n\t\t\t<PostFeaturedImageCheck>\n\t\t\t\t<PostFeaturedImage />\n\t\t\t</PostFeaturedImageCheck>\n\t\t);\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={\n\t\t\t\t\tpostType?.labels?.featured_image ?? __( 'Featured image' )\n\t\t\t\t}\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }\n\t\t\t>\n\t\t\t\t<PostFeaturedImage />\n\t\t\t</PanelBody>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAD,sBAAA,CAAAN,OAAA;AAA6C,IAAAQ,WAAA,GAAAR,OAAA;AAb7C;AACA;AACA;;AAMA;AACA;AACA;;AAKA,MAAMS,UAAU,GAAG,gBAAgB;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,sBAAsBA,CAAE;EAAEC,aAAa,GAAG;AAAK,CAAC,EAAG;EAAA,IAAAC,qBAAA;EAC1E,MAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAClE,MAAM;MACLC,sBAAsB;MACtBC,oBAAoB;MACpBC;IACD,CAAC,GAAGH,MAAM,CAAEI,YAAY,CAAC;IACzB,MAAM;MAAEC;IAAY,CAAC,GAAGL,MAAM,CAAEM,eAAU,CAAC;IAE3C,OAAO;MACNV,QAAQ,EAAES,WAAW,CAAEJ,sBAAsB,CAAE,MAAO,CAAE,CAAC;MACzDJ,SAAS,EAAEK,oBAAoB,CAAEV,UAAW,CAAC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