@wordpress/editor 14.9.0 → 14.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/bindings/api.js +0 -29
- package/build/bindings/api.js.map +1 -1
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/block-manager/index.js +2 -2
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/commands/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/utils.js.map +1 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.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-interface/index.js +1 -12
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/media-categories/index.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.map +1 -1
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-content-information/index.js +1 -1
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-featured-image/index.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-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +2 -2
- package/build/components/post-locked-modal/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-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +1 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +4 -4
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +1 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/classic-theme.js +2 -4
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +15 -19
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +2 -2
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/index.js +76 -63
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +46 -26
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/resizable-editor/resize-handle.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/visual-editor/edit-template-blocks-notification.js +4 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -3
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build/dataviews/actions/duplicate-template-part.js +1 -1
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build/private-apis.js +0 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +26 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -0
- package/build/store/constants.js.map +1 -1
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/private-actions.js +7 -6
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +21 -0
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/bindings/api.js +1 -29
- package/build-module/bindings/api.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -3
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/block-manager/category.js +1 -2
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +1 -2
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +3 -4
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -3
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/blog-title/index.js +1 -3
- package/build-module/components/blog-title/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +1 -3
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/commands/index.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/create-template-part-modal/utils.js.map +1 -1
- package/build-module/components/document-bar/index.js +1 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +1 -2
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +1 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +2 -4
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -3
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +1 -3
- package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -2
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +1 -3
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -3
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +1 -3
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +1 -3
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +1 -2
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -15
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -3
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +1 -3
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -2
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +2 -3
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js +1 -2
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/header/index.js +1 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/list-view-sidebar/list-view-outline.js +1 -3
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +1 -3
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/offline-status/index.native.js +1 -2
- package/build-module/components/offline-status/index.native.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +2 -3
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-document-setting-panel/index.js +1 -3
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +1 -3
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +1 -2
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +1 -2
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +1 -1
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +1 -2
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +1 -3
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -2
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/index.js +2 -3
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +1 -2
- package/build-module/components/post-format/panel.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-locked-modal/index.js +3 -5
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-panel-row/index.js +1 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +2 -4
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -2
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -3
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -2
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -3
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -2
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +1 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +2 -4
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -3
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-status/index.js +1 -3
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +1 -3
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +5 -7
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -4
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -2
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +1 -3
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +3 -6
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +1 -2
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js +1 -3
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +1 -3
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +1 -3
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/index.js +15 -19
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +2 -2
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -2
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-url/index.js +78 -66
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +48 -28
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -2
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/posts-per-page/index.js +1 -3
- package/build-module/components/posts-per-page/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -3
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +1 -3
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +2 -4
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +1 -3
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/resizable-editor/resize-handle.js +1 -3
- package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +1 -3
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/header.js +1 -2
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +1 -3
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/site-discussion/index.js +1 -3
- package/build-module/components/site-discussion/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +1 -2
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -3
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-part-menu-items/convert-to-template-part.js +1 -3
- package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -3
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +1 -2
- package/build-module/components/text-editor/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/visual-editor/edit-template-blocks-notification.js +4 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/visual-editor/index.js +5 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -3
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +1 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +26 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +1 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/private-actions.js +7 -6
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +20 -5
- package/build-style/style.css +20 -5
- package/build-types/bindings/api.d.ts +0 -13
- package/build-types/bindings/api.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts +1 -2
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/post-url/panel.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +1 -4
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +21 -0
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +38 -38
- package/src/bindings/api.js +1 -32
- package/src/components/document-tools/index.js +1 -1
- package/src/components/editor-interface/index.js +0 -15
- package/src/components/header/style.scss +1 -0
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/src/components/post-template/classic-theme.js +1 -2
- package/src/components/post-url/index.js +67 -55
- package/src/components/post-url/panel.js +57 -33
- package/src/components/post-url/style.scss +21 -3
- package/src/components/provider/index.js +1 -0
- package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
- package/src/components/visual-editor/index.js +3 -1
- package/src/private-apis.js +1 -5
- package/src/store/actions.js +28 -1
- package/src/store/selectors.js +21 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","GLOBAL_POST_TYPES","unlock","PostActions","jsx","_jsx","jsxs","_jsxs","PostCardPanel","postType","postId","onActionPerformed","isFrontPage","isPostsPage","title","icon","isSync","select","__experimentalGetTemplateInfo","canUser","getEditedEntityRecord","siteSettings","kind","name","undefined","_record","_templateInfo","includes","_isSync","currentSyncStatus","meta","wp_pattern_sync_status","getPostIcon","area","page_on_front","page_for_posts","className","children","spacing","align","numberOfLines","truncate","weight","as","lineHeight"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\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\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetTemplateInfo } = select( editorStore );\n\t\t\tconst { canUser, getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\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\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\tpostType\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( postType ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === postType ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\t_record?.meta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: _record?.wp_pattern_sync_status;\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\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\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === postId,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === postId,\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\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\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\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{ isFrontPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostsPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","GLOBAL_POST_TYPES","unlock","PostActions","jsx","_jsx","jsxs","_jsxs","PostCardPanel","postType","postId","onActionPerformed","isFrontPage","isPostsPage","title","icon","isSync","select","__experimentalGetTemplateInfo","canUser","getEditedEntityRecord","siteSettings","kind","name","undefined","_record","_templateInfo","includes","_isSync","currentSyncStatus","meta","wp_pattern_sync_status","getPostIcon","area","page_on_front","page_for_posts","className","children","spacing","align","numberOfLines","truncate","weight","as","lineHeight"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\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\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetTemplateInfo } = select( editorStore );\n\t\t\tconst { canUser, getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\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\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\tpostType\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( postType ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === postType ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\t_record?.meta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: _record?.wp_pattern_sync_status;\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\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\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === postId,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === postId,\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\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\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\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{ isFrontPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostsPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\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":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1C,eAAe,SAASC,aAAaA,CAAE;EACtCC,QAAQ;EACRC,MAAM;EACNC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC,WAAW;IAAEC,KAAK;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGtB,SAAS,CAChEuB,MAAM,IAAM;IACb,MAAM;MAAEC;IAA8B,CAAC,GAAGD,MAAM,CAAEpB,WAAY,CAAC;IAC/D,MAAM;MAAEsB,O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ACCJ,IAAA;IAAK+B,SAAS,EAAC,wBAAwB;IAAAC,QAAA,eACtC9B,KAAA,CAAClB,MAAM;MACNiD,OAAO,EAAG,CAAG;MACbF,SAAS,EAAC,gCAAgC;MAC1CG,KAAK,EAAC,YAAY;MAAAF,QAAA,gBAElBhC,IAAA,CAAClB,IAAI;QACJiD,SAAS,EAAGlD,IAAI,CAAE,8BAA8B,EAAE;UACjD,SAAS,EAAE8B;QACZ,CAAE,CAAG;QACLD,IAAI,EAAGA;MAAM,CACb,CAAC,eACFR,KAAA,CAAChB,IAAI;QACJiD,aAAa,EAAG,CAAG;QACnBC,QAAQ;QACRL,SAAS,EAAC,+BAA+B;QACzCM,MAAM,EAAG,GAAK;QACdC,EAAE,EAAC,IAAI;QACPC,UAAU,EAAC,MAAM;QAAAP,QAAA,GAEfvB,KAAK,GAAGlB,cAAc,CAAEkB,KAAM,CAAC,GAAGnB,EAAE,CAAE,UAAW,CAAC,EAClDiB,WAAW,iBACZP,IAAA;UAAM+B,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD1C,EAAE,CAAE,UAAW;QAAC,CACb,CACN,EACCkB,WAAW,iBACZR,IAAA;UAAM+B,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClD1C,EAAE,CAAE,YAAa;QAAC,CACf,CACN;MAAA,CACI,CAAC,eACPU,IAAA,CAACF,WAAW;QACXM,QAAQ,EAAGA,QAAU;QACrBC,MAAM,EAAGA,MAAQ;QACjBC,iBAAiB,EAAGA;MAAmB,CACvC,CAAC;IAAA,CACK;EAAC,CACL,CAAC;AAER","ignoreList":[]}
|
|
@@ -67,7 +67,7 @@ export default function PostContentInformation() {
|
|
|
67
67
|
return /*#__PURE__*/_jsx("div", {
|
|
68
68
|
className: "editor-post-content-information",
|
|
69
69
|
children: /*#__PURE__*/_jsx(Text, {
|
|
70
|
-
children: sprintf(
|
|
70
|
+
children: sprintf(/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
|
|
71
71
|
__('%1$s, %2$s read time.'), wordsCountText, minutesText)
|
|
72
72
|
})
|
|
73
73
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalText","Text","useSelect","__","_x","_n","sprintf","count","wordCount","useMemo","store","coreStore","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","jsx","_jsx","AVERAGE_READING_RATE","PostContentInformation","postContent","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","canUser","getEntityRecord","siteSettings","kind","name","undefined","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","includes","wordCountType","wordsCounted","readingTime","Math","round","wordsCountText","toLocaleString","minutesText","className","children"],"sources":["@wordpress/editor/src/components/post-content-information/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\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';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nexport default function PostContentInformation() {\n\tconst { postContent } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst isPostsPage = +_id === siteSettings?.page_for_posts;\n\t\tconst showPostContentInfo =\n\t\t\t! isPostsPage &&\n\t\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\treturn {\n\t\t\tpostContent:\n\t\t\t\tshowPostContentInfo && getEditedPostAttribute( 'content' ),\n\t\t};\n\t}, [] );\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: the number of minutes to read the post.\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<div className=\"editor-post-content-information\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\t\twordsCountText,\n\t\t\t\t\tminutesText\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAkB,IAAIC,IAAI,QAAQ,uBAAuB;AAClE,SA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AAmB,IAAIb,sBAAsB,CAAE,SAAU;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;AACD;AACA;AACA;AACA;EACC,MAAMe,aAAa,GAAGhC,EAAE,CAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMiC,YAAY,GAAG5B,OAAO,CAC3B,MAAQU,WAAW,GAAGX,SAAS,CAAEW,WAAW,EAAEiB,aAAc,CAAC,GAAG,CAAG,EACnE,CAAEjB,WAAW,EAAEiB,aAAa,CAC7B,CAAC;EACD,IAAK,CAAEC,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,MAAMC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEH,YAAY,GAAGpB,oBAAqB,CAAC;EACrE,MAAMwB,cAAc,GAAGnC,OAAO;EAC7B;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEgC,YAAa,CAAC,EACzCA,YAAY,CAACK,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBL,WAAW,IAAI,CAAC,GACbnC,EAAE,CAAE,UAAW,CAAC,GAChBG,OAAO;EACP;EACAD,EAAE,CAAE,WAAW,EAAE,YAAY,EAAEiC,WAAY,CAAC,EAC5CA,WAAW,CAACI,cAAc,CAAC,CAC3B,CAAC;EACL,oBACC1B,IAAA;IAAK4B,SAAS,EAAC,iCAAiC;IAAAC,QAAA,eAC/C7B,IAAA,CAACf,IAAI;MAAA4C,QAAA,EACFvC,OAAO,
|
|
1
|
+
{"version":3,"names":["__experimentalText","Text","useSelect","__","_x","_n","sprintf","count","wordCount","useMemo","store","coreStore","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","jsx","_jsx","AVERAGE_READING_RATE","PostContentInformation","postContent","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","canUser","getEntityRecord","siteSettings","kind","name","undefined","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","includes","wordCountType","wordsCounted","readingTime","Math","round","wordsCountText","toLocaleString","minutesText","className","children"],"sources":["@wordpress/editor/src/components/post-content-information/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalText as Text } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\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';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nexport default function PostContentInformation() {\n\tconst { postContent } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =\n\t\t\tselect( editorStore );\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst postType = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst isPostsPage = +_id === siteSettings?.page_for_posts;\n\t\tconst showPostContentInfo =\n\t\t\t! isPostsPage &&\n\t\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\treturn {\n\t\t\tpostContent:\n\t\t\t\tshowPostContentInfo && getEditedPostAttribute( 'content' ),\n\t\t};\n\t}, [] );\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: the number of minutes to read the post.\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<div className=\"editor-post-content-information\">\n\t\t\t<Text>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\t\twordsCountText,\n\t\t\t\t\tminutesText\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAkB,IAAIC,IAAI,QAAQ,uBAAuB;AAClE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,QACjB,uBAAuB;;AAE9B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,oBAAoB,GAAG,GAAG;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,CAACC,KAAK,CAAEH,YAAY,GAAGpB,oBAAqB,CAAC;EACrE,MAAMwB,cAAc,GAAGnC,OAAO;EAC7B;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEgC,YAAa,CAAC,EACzCA,YAAY,CAACK,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBL,WAAW,IAAI,CAAC,GACbnC,EAAE,CAAE,UAAW,CAAC,GAChBG,OAAO;EACP;EACAD,EAAE,CAAE,WAAW,EAAE,YAAY,EAAEiC,WAAY,CAAC,EAC5CA,WAAW,CAACI,cAAc,CAAC,CAC3B,CAAC;EACL,oBACC1B,IAAA;IAAK4B,SAAS,EAAC,iCAAiC;IAAAC,QAAA,eAC/C7B,IAAA,CAACf,IAAI;MAAA4C,QAAA,EACFvC,OAAO,CACR;MACAH,EAAE,CAAE,uBAAwB,CAAC,EAC7BsC,cAAc,EACdE,WACD;IAAC,CACI;EAAC,CACH,CAAC;AAER","ignoreList":[]}
|
|
@@ -16,8 +16,7 @@ import PostTypeSupportCheck from '../post-type-support-check';
|
|
|
16
16
|
import PostComments from '../post-comments';
|
|
17
17
|
import PostPingbacks from '../post-pingbacks';
|
|
18
18
|
import PostPanelRow from '../post-panel-row';
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
20
|
const PANEL_NAME = 'discussion-panel';
|
|
22
21
|
function ModalContents({
|
|
23
22
|
onClose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","Dropdown","Button","__experimentalVStack","VStack","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PostPanelRow","jsx","_jsx","jsxs","_jsxs","PANEL_NAME","ModalContents","onClose","className","children","title","spacing","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","getPostType","postType","supports","comments","trackbacks","label","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","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 {JSX.Element|null} 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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,YAAY,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["__","_x","Dropdown","Button","__experimentalVStack","VStack","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PostPanelRow","jsx","_jsx","jsxs","_jsxs","PANEL_NAME","ModalContents","onClose","className","children","title","spacing","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","getPostType","postType","supports","comments","trackbacks","label","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","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 {JSX.Element|null} 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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H,QAAA,eACjEP,IAAA,CAACF,YAAY;MAAC6B,KAAK,EAAG9C,EAAE,CAAE,YAAa,CAAG;MAAC2D,GAAG,EAAGN,gBAAkB;MAAA3B,QAAA,eAClEP,IAAA,CAACjB,QAAQ;QACRoD,YAAY,EAAGA,YAAc;QAC7B7B,SAAS,EAAC,wCAAwC;QAClDmC,gBAAgB,EAAC,sCAAsC;QACvDC,YAAY;QACZC,YAAY,EAAGA,CAAE;UAAE/B,MAAM;UAAEgC;QAAS,CAAC,kBACpC5C,IAAA,CAACW,oBAAoB;UACpBC,MAAM,EAAGA,MAAQ;UACjBC,OAAO,EAAG+B;QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAExC;QAAQ,CAAC,kBAC5BL,IAAA,CAACI,aAAa;UAACC,OAAO,EAAGA;QAAS,CAAE;MAClC,CACH;IAAC,CACW;EAAC,CACM,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -21,9 +21,7 @@ import { store as editorStore } from '../../store';
|
|
|
21
21
|
/**
|
|
22
22
|
* Module Constants
|
|
23
23
|
*/
|
|
24
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
25
|
const PANEL_NAME = 'post-excerpt';
|
|
28
26
|
function ExcerptPanel() {
|
|
29
27
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","PanelBody","__experimentalText","Text","Dropdown","Button","__experimentalVStack","VStack","useDispatch","useSelect","useMemo","useState","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","decodeEntities","PostExcerptForm","PostExcerptCheck","PluginPostExcerpt","TEMPLATE_ORIGINS","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PANEL_NAME","ExcerptPanel","isOpened","isEnabled","postType","select","isEditorPanelOpened","isEditorPanelEnabled","getCurrentPostType","toggleEditorPanelOpened","toggleExcerptPanel","shouldUseDescriptionLabel","includes","title","opened","onToggle","children","Slot","fills","PostExcerptPanel","PrivatePostExcerptPanel","PrivateExcerpt","shouldRender","excerpt","shouldBeUsedAsDescription","allowEditing","getCurrentPostId","getEditedPostAttribute","isTemplateOrTemplatePart","isPattern","_shouldBeUsedAsDescription","_usedAttribute","template","getEntityRecord","_shouldRender","source","custom","has_theme_file","is_custom","popoverAnchor","setPopoverAnchor","label","popoverProps","anchor","headerTitle","placement","offset","shift","excerptText","align","numberOfLines","truncate","excerptPlaceholder","triggerEditLabel","className","contentClassName","focusOnMount","ref","renderToggle","__next40pxDefaultSize","onClick","variant","renderContent","onClose","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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,kBAAkB,IAAIC,IAAI,EAC1BC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,OAAOC,gBAAgB,MAAM,SAAS;AACtC,OAAOC,iBAAiB,MAAM,UAAU;AACxC,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;;AAElD;AACA;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EAAE,CAAE,cAAe,CAAC;EACvB,oBACC2B,KAAA,CAACpB,MAAM;IAAAqC,QAAA,GACJgC,WAAW,eACbrD,IAAA,CAACnB,QAAQ;MACR8E,SAAS,EAAC,+BAA+B;MACzCC,gBAAgB,EAAC,wCAAwC;MACzDb,YAAY,EAAGA,YAAc;MAC7Bc,YAAY;MACZC,GAAG,EAAGjB,gBAAkB;MACxBkB,YAAY,EAAGA,CAAE;QAAE3C;MAAS,CAAC,kBAC5BpB,IAAA,CAAClB,MAAM;QACNkF,qBAAqB;QACrBC,OAAO,EAAG7C,QAAU;QACpB8C,OAAO,EAAC,MAAM;QAAA7C,QAAA,EAEZgC,WAAW,GAAGK,gBAAgB,GAAGD;MAAkB,CAC9C,CACN;MACHU,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5BhE,KAAA,CAAAF,SAAA;QAAAmB,QAAA,gBACCrB,IAAA,CAACV,sBAAsB;UACtB4B,KAAK,EAAG4B,KAAO;UACfsB,OAAO,EAAGA;QAAS,CACnB,CAAC,eAEFpE,IAAA,CAAChB,MAAM;UAACqF,OAAO,EAAG,CAAG;UAAAhD,QAAA,eACpBrB,IAAA,CAACJ,iBAAiB,CAAC0B,IAAI;YAAAD,QAAA,EAClBE,KAAK,iBACRnB,KAAA,CAAAF,SAAA;cAAAmB,QAAA,gBACCrB,IAAA,CAACN,eAAe;gBACf4E,mBAAmB;gBACnBC,YAAY;cAAA,CACZ,CAAC,EACAhD,KAAK;YAAA,CACN;UACF,CACsB;QAAC,CAClB,CAAC;MAAA,CACR;IACA,CACH,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","PanelBody","__experimentalText","Text","Dropdown","Button","__experimentalVStack","VStack","useDispatch","useSelect","useMemo","useState","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","decodeEntities","PostExcerptForm","PostExcerptCheck","PluginPostExcerpt","TEMPLATE_ORIGINS","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PANEL_NAME","ExcerptPanel","isOpened","isEnabled","postType","select","isEditorPanelOpened","isEditorPanelEnabled","getCurrentPostType","toggleEditorPanelOpened","toggleExcerptPanel","shouldUseDescriptionLabel","includes","title","opened","onToggle","children","Slot","fills","PostExcerptPanel","PrivatePostExcerptPanel","PrivateExcerpt","shouldRender","excerpt","shouldBeUsedAsDescription","allowEditing","getCurrentPostId","getEditedPostAttribute","isTemplateOrTemplatePart","isPattern","_shouldBeUsedAsDescription","_usedAttribute","template","getEntityRecord","_shouldRender","source","custom","has_theme_file","is_custom","popoverAnchor","setPopoverAnchor","label","popoverProps","anchor","headerTitle","placement","offset","shift","excerptText","align","numberOfLines","truncate","excerptPlaceholder","triggerEditLabel","className","contentClassName","focusOnMount","ref","renderToggle","__next40pxDefaultSize","onClick","variant","renderContent","onClose","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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,kBAAkB,IAAIC,IAAI,EAC1BC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,OAAOC,gBAAgB,MAAM,SAAS;AACtC,OAAOC,iBAAiB,MAAM,UAAU;AACxC,SAASC,gBAAgB,QAAQ,uBAAuB;AACx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C/CpD,EAAE,CAAE,kBAAmB,CAAC,GACxBA,EAAE,CAAE,cAAe,CAAC;EACvB,oBACC2B,KAAA,CAACpB,MAAM;IAAAqC,QAAA,GACJgC,WAAW,eACbrD,IAAA,CAACnB,QAAQ;MACR8E,SAAS,EAAC,+BAA+B;MACzCC,gBAAgB,EAAC,wCAAwC;MACzDb,YAAY,EAAGA,YAAc;MAC7Bc,YAAY;MACZC,GAAG,EAAGjB,gBAAkB;MACxBkB,YAAY,EAAGA,CAAE;QAAE3C;MAAS,CAAC,kBAC5BpB,IAAA,CAAClB,MAAM;QACNkF,qBAAqB;QACrBC,OAAO,EAAG7C,QAAU;QACpB8C,OAAO,EAAC,MAAM;QAAA7C,QAAA,EAEZgC,WAAW,GAAGK,gBAAgB,GAAGD;MAAkB,CAC9C,CACN;MACHU,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,kBAC5BhE,KAAA,CAAAF,SAAA;QAAAmB,QAAA,gBACCrB,IAAA,CAACV,sBAAsB;UACtB4B,KAAK,EAAG4B,KAAO;UACfsB,OAAO,EAAGA;QAAS,CACnB,CAAC,eAEFpE,IAAA,CAAChB,MAAM;UAACqF,OAAO,EAAG,CAAG;UAAAhD,QAAA,eACpBrB,IAAA,CAACJ,iBAAiB,CAAC0B,IAAI;YAAAD,QAAA,EAClBE,KAAK,iBACRnB,KAAA,CAAAF,SAAA;cAAAmB,QAAA,gBACCrB,IAAA,CAACN,eAAe;gBACf4E,mBAAmB;gBACnBC,YAAY;cAAA,CACZ,CAAC,EACAhD,KAAK;YAAA,CACN;UACF,CACsB;QAAC,CAClB,CAAC;MAAA,CACR;IACA,CACH,CAAC;EAAA,CACK,CAAC;AAEX","ignoreList":[]}
|
|
@@ -16,8 +16,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
16
16
|
*/
|
|
17
17
|
import PostFeaturedImageCheck from './check';
|
|
18
18
|
import { store as editorStore } from '../../store';
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
20
|
const ALLOWED_MEDIA_TYPES = ['image'];
|
|
22
21
|
|
|
23
22
|
// Used when labels from post type were not yet loaded or when they are not present.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","jsx","_jsx","jsxs","_jsxs","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","getSettings","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","className","alt_text","full","file","slug","fallback","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","set_featured_image","current","focus","onFilesDrop","value","applyWithSelect","select","getMedia","getPostType","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"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\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{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\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=\"\"\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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,YAAY,EAAEC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,CACbG,WAAW,CAAE;QACbC,YAAY,EAAE,CAAE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzByC,QAAQ,CAAE;YAAEC,cAAc,EAAE1C,KAAK,CAAC3B;UAAG,CAAE,CAAC;QACzC,CAAC;QACD6B,OAAOA,CAAEC,OAAO,EAAG;UAClBb,gBAAgB,CAACc,gBAAgB,CAAC,CAAC;UACnCd,gBAAgB,CAACe,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDhB,aAAaA,CAAA,EAAG;MACfsD,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;AACA,eAAe/F,OAAO,CACrBP,WAAW,EACX4F,eAAe,EACfO,iBAAiB,EACjBlG,WAAW,CAAE,0BAA2B,CACzC,CAAC,CAAE0C,iBAAkB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","sprintf","applyFilters","DropZone","Button","Spinner","withNotices","withFilters","__experimentalHStack","HStack","isBlobURL","useState","useRef","compose","useSelect","withDispatch","withSelect","MediaUpload","MediaUploadCheck","store","blockEditorStore","coreStore","PostFeaturedImageCheck","editorStore","jsx","_jsx","jsxs","_jsxs","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","isLoading","setIsLoading","getSettings","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","url","onError","message","removeAllNotices","createErrorNotice","className","alt_text","full","file","slug","fallback","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","set_featured_image","current","focus","onFilesDrop","value","applyWithSelect","select","getMedia","getPostType","getCurrentPostId","getEditedPostAttribute","context","applyWithDispatch","dispatch","editPost","featured_media","onDropImage"],"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\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{ media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! media.alt_text &&\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// Translators: %s: The selected image filename.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tmedia.media_details.sizes?.full?.file ||\n\t\t\t\t\t\t\t\t\tmedia.slug\n\t\t\t\t\t\t\t) }\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=\"\"\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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AACrE,SACCC,WAAW,EACXC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,sBAAsB,MAAM,SAAS;AAC5C,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAMC,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG7B,EAAE,CAAE,gBAAiB,CAAC;AAC1D,MAAM8B,+BAA+B,GAAG9B,EAAE,CAAE,sBAAuB,CAAC;AAEpE,MAAM+B,YAAY,gBACjBN,IAAA;EAAAO,QAAA,EACGhC,EAAE,CACH,kEACD;AAAC,CACC,CACH;AAED,SAASiC,eAAeA,CAAEC,KAAK,EAAEC,MAAM,EAAG;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EACzC,IAAK,CAAEH,KAAK,EAAG;IACd,OAAO,CAAC,CAAC;EACV;EAEA,MAAMI,WAAW,GAAGpC,YAAY,CAC/B,oCAAoC,EACpC,O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,CAAE,CAAC;IACzDpD;EACD,CAAC;AACF,CAAE,CAAC;AAEH,MAAMsD,iBAAiB,GAAG1F,YAAY,CACrC,CAAE2F,QAAQ,EAAE;EAAElD;AAAiB,CAAC,EAAE;EAAE2C;AAAO,CAAC,KAAM;EACjD,MAAM;IAAEQ;EAAS,CAAC,GAAGD,QAAQ,CAAEnF,WAAY,CAAC;EAC5C,OAAO;IACN6B,aAAaA,CAAEc,KAAK,EAAG;MACtByC,QAAQ,CAAE;QAAEC,cAAc,EAAE1C,KAAK,CAAC3B;MAAG,CAAE,CAAC;IACzC,CAAC;IACDsE,WAAWA,CAAE/C,SAAS,EAAG;MACxBqC,MAAM,CAAE/E,gBAAiB,CAAC,CACxBwC,WAAW,CAAC,CAAC,CACbG,WAAW,CAAE;QACbC,YAAY,EAAE,CAAE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzByC,QAAQ,CAAE;YAAEC,cAAc,EAAE1C,KAAK,CAAC3B;UAAG,CAAE,CAAC;QACzC,CAAC;QACD6B,OAAOA,CAAEC,OAAO,EAAG;UAClBb,gBAAgB,CAACc,gBAAgB,CAAC,CAAC;UACnCd,gBAAgB,CAACe,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDhB,aAAaA,CAAA,EAAG;MACfsD,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;AACA,eAAe/F,OAAO,CACrBP,WAAW,EACX4F,eAAe,EACfO,iBAAiB,EACjBlG,WAAW,CAAE,0BAA2B,CACzC,CAAC,CAAE0C,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -14,8 +14,7 @@ import PostFormatCheck from './check';
|
|
|
14
14
|
import { store as editorStore } from '../../store';
|
|
15
15
|
|
|
16
16
|
// All WP post formats, sorted alphabetically by translated name.
|
|
17
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
18
|
export const POST_FORMATS = [{
|
|
20
19
|
id: 'aside',
|
|
21
20
|
caption: __('Aside')
|
|
@@ -120,7 +119,7 @@ export default function PostFormat() {
|
|
|
120
119
|
__next40pxDefaultSize: true,
|
|
121
120
|
variant: "link",
|
|
122
121
|
onClick: () => onUpdatePostFormat(suggestion.id),
|
|
123
|
-
children: sprintf(
|
|
122
|
+
children: sprintf(/* translators: %s: post format */
|
|
124
123
|
__('Apply suggested format: %s'), suggestion.caption)
|
|
125
124
|
})
|
|
126
125
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","Button","RadioControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","jsx","_jsx","jsxs","_jsxs","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","children","className","label","selected","onChange","options","map","value","hideLabelFromVision","__next40pxDefaultSize","variant","onClick"],"sources":["@wordpress/editor/src/components/post-format/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, RadioControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n/**\n * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post.\n *\n * @example\n * ```jsx\n * <PostFormat />\n * ```\n *\n * @return {JSX.Element} The rendered PostFormat component.\n */\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-post-format__options\"\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tselected={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,YAAY,QAAQ,uBAAuB;AAC5D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;;AAElD;AAAA,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["__","sprintf","Button","RadioControl","useDispatch","useSelect","useInstanceId","store","coreStore","PostFormatCheck","editorStore","jsx","_jsx","jsxs","_jsxs","POST_FORMATS","id","caption","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","select","getEditedPostAttribute","getSuggestedPostFormat","_postFormat","themeSupports","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","onUpdatePostFormat","children","className","label","selected","onChange","options","map","value","hideLabelFromVision","__next40pxDefaultSize","variant","onClick"],"sources":["@wordpress/editor/src/components/post-format/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, RadioControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFormatCheck from './check';\nimport { store as editorStore } from '../../store';\n\n// All WP post formats, sorted alphabetically by translated name.\nexport const POST_FORMATS = [\n\t{ id: 'aside', caption: __( 'Aside' ) },\n\t{ id: 'audio', caption: __( 'Audio' ) },\n\t{ id: 'chat', caption: __( 'Chat' ) },\n\t{ id: 'gallery', caption: __( 'Gallery' ) },\n\t{ id: 'image', caption: __( 'Image' ) },\n\t{ id: 'link', caption: __( 'Link' ) },\n\t{ id: 'quote', caption: __( 'Quote' ) },\n\t{ id: 'standard', caption: __( 'Standard' ) },\n\t{ id: 'status', caption: __( 'Status' ) },\n\t{ id: 'video', caption: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.caption.toUpperCase();\n\tconst normalizedB = b.caption.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n/**\n * `PostFormat` a component that allows changing the post format while also providing a suggestion for the current post.\n *\n * @example\n * ```jsx\n * <PostFormat />\n * ```\n *\n * @return {JSX.Element} The rendered PostFormat component.\n */\nexport default function PostFormat() {\n\tconst instanceId = useInstanceId( PostFormat );\n\tconst postFormatSelectorId = `post-format-selector-${ instanceId }`;\n\n\tconst { postFormat, suggestedFormat, supportedFormats } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, getSuggestedPostFormat } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\t\treturn {\n\t\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t\t\tsuggestedFormat: getSuggestedPostFormat(),\n\t\t\t\tsupportedFormats: themeSupports.formats,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst formats = POST_FORMATS.filter( ( format ) => {\n\t\t// Ensure current format is always in the set.\n\t\t// The current format may not be a format supported by the theme.\n\t\treturn (\n\t\t\tsupportedFormats?.includes( format.id ) || postFormat === format.id\n\t\t);\n\t} );\n\tconst suggestion = formats.find(\n\t\t( format ) => format.id === suggestedFormat\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst onUpdatePostFormat = ( format ) => editPost( { format } );\n\n\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<div className=\"editor-post-format\">\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-post-format__options\"\n\t\t\t\t\tlabel={ __( 'Post Format' ) }\n\t\t\t\t\tselected={ postFormat }\n\t\t\t\t\tonChange={ ( format ) => onUpdatePostFormat( format ) }\n\t\t\t\t\tid={ postFormatSelectorId }\n\t\t\t\t\toptions={ formats.map( ( format ) => ( {\n\t\t\t\t\t\tlabel: format.caption,\n\t\t\t\t\t\tvalue: format.id,\n\t\t\t\t\t} ) ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t\t{ suggestion && suggestion.id !== postFormat && (\n\t\t\t\t\t<p className=\"editor-post-format__suggestion\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tonUpdatePostFormat( suggestion.id )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: post format */\n\t\t\t\t\t\t\t\t__( 'Apply suggested format: %s' ),\n\t\t\t\t\t\t\t\tsuggestion.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</PostFormatCheck>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,YAAY,QAAQ,uBAAuB;AAC5D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;;AAElD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,OAAO,MAAMC,YAAY,GAAG,CAC3B;EAAEC,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAEjB,EAAE,CAAE,OAAQ;AAAE,CAAC,EACvC;EAAEgB,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAEjB,EAAE,CAAE,OAAQ;AAA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MK,kBAAkB,CAAEL,MAAO,CAAG;QACvDtB,EAAE,EAAGU,oBAAsB;QAC3BuB,OAAO,EAAGb,OAAO,CAACc,GAAG,CAAIZ,MAAM,KAAQ;UACtCQ,KAAK,EAAER,MAAM,CAACrB,OAAO;UACrBkC,KAAK,EAAEb,MAAM,CAACtB;QACf,CAAC,CAAG,CAAG;QACPoC,mBAAmB;MAAA,CACnB,CAAC,EACAZ,UAAU,IAAIA,UAAU,CAACxB,EAAE,KAAKW,UAAU,iBAC3Cf,IAAA;QAAGiC,SAAS,EAAC,gCAAgC;QAAAD,QAAA,eAC5ChC,IAAA,CAACV,MAAM;UACNmD,qBAAqB;UACrBC,OAAO,EAAC,MAAM;UACdC,OAAO,EAAGA,CAAA,KACTZ,kBAAkB,CAAEH,UAAU,CAACxB,EAAG,CAClC;UAAA4B,QAAA,EAEC3C,OAAO,CACR;UACAD,EAAE,CAAE,4BAA6B,CAAC,EAClCwC,UAAU,CAACvB,OACZ;QAAC,CACM;MAAC,CACP,CACH;IAAA,CACG;EAAC,CACU,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -20,8 +20,7 @@ import { store as editorStore } from '../../store';
|
|
|
20
20
|
*
|
|
21
21
|
* @return {Component} The component to be rendered.
|
|
22
22
|
*/
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
24
|
function PostFormat() {
|
|
26
25
|
const {
|
|
27
26
|
postFormat
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Dropdown","__","sprintf","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","default","PostFormatForm","POST_FORMATS","PostFormatCheck","PostPanelRow","store","editorStore","jsx","_jsx","jsxs","_jsxs","PostFormat","postFormat","select","getEditedPostAttribute","_postFormat","activeFormat","find","format","id","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","children","label","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","size","variant","caption","onClick","renderContent","onClose","className","title"],"sources":["@wordpress/editor/src/components/post-format/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Dropdown } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { default as PostFormatForm, POST_FORMATS } from './';\nimport PostFormatCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostFormat() {\n\tconst { postFormat } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\treturn {\n\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t};\n\t}, [] );\n\tconst activeFormat = POST_FORMATS.find(\n\t\t( format ) => format.id === postFormat\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\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<PostPanelRow label={ __( 'Format' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-format__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post format.\n\t\t\t\t\t\t\t\t__( 'Change format: %s' ),\n\t\t\t\t\t\t\t\tactiveFormat?.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ activeFormat?.caption }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<div className=\"editor-post-format__dialog-content\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Format' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFormatForm />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostFormatCheck>\n\t);\n}\n\nexport default PostFormat;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,QAAQ,QAAQ,uBAAuB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;AACA;AACA,SAASC,OAAO,IAAIC,cAAc,EAAEC,YAAY,QAAQ,IAAI;AAC5D,OAAOC,eAAe,MAAM,SAAS;AACrC,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA
|
|
1
|
+
{"version":3,"names":["Button","Dropdown","__","sprintf","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","default","PostFormatForm","POST_FORMATS","PostFormatCheck","PostPanelRow","store","editorStore","jsx","_jsx","jsxs","_jsxs","PostFormat","postFormat","select","getEditedPostAttribute","_postFormat","activeFormat","find","format","id","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","children","label","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","size","variant","caption","onClick","renderContent","onClose","className","title"],"sources":["@wordpress/editor/src/components/post-format/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Dropdown } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { default as PostFormatForm, POST_FORMATS } from './';\nimport PostFormatCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostFormat() {\n\tconst { postFormat } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst _postFormat = getEditedPostAttribute( 'format' );\n\t\treturn {\n\t\t\tpostFormat: _postFormat ?? 'standard',\n\t\t};\n\t}, [] );\n\tconst activeFormat = POST_FORMATS.find(\n\t\t( format ) => format.id === postFormat\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\treturn (\n\t\t<PostFormatCheck>\n\t\t\t<PostPanelRow label={ __( 'Format' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-format__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post format.\n\t\t\t\t\t\t\t\t__( 'Change format: %s' ),\n\t\t\t\t\t\t\t\tactiveFormat?.caption\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ activeFormat?.caption }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<div className=\"editor-post-format__dialog-content\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Format' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFormatForm />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostFormatCheck>\n\t);\n}\n\nexport default PostFormat;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,QAAQ,QAA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B,QAAA,eACfnB,IAAA,CAACJ,YAAY;MAACwB,KAAK,EAAGnC,EAAE,CAAE,QAAS,CAAG;MAACoC,GAAG,EAAGR,gBAAkB;MAAAM,QAAA,eAC9DnB,IAAA,CAAChB,QAAQ;QACR8B,YAAY,EAAGA,YAAc;QAC7BQ,gBAAgB,EAAC,4BAA4B;QAC7CC,YAAY;QACZC,YAAY,EAAGA,CAAE;UAAEC,MAAM;UAAEC;QAAS,CAAC,kBACpC1B,IAAA,CAACjB,MAAM;UACN4C,IAAI,EAAC,SAAS;UACdC,OAAO,EAAC,UAAU;UAClB,iBAAgBH,MAAQ;UACxB,cAAavC,OAAO;UACnB;UACAD,EAAE,CAAE,mBAAoB,CAAC,EACzBuB,YAAY,EAAEqB,OACf,CAAG;UACHC,OAAO,EAAGJ,QAAU;UAAAP,QAAA,EAElBX,YAAY,EAAEqB;QAAO,CAChB,CACN;QACHE,aAAa,EAAGA,CAAE;UAAEC;QAAQ,CAAC,kBAC5B9B,KAAA;UAAK+B,SAAS,EAAC,oCAAoC;UAAAd,QAAA,gBAClDnB,IAAA,CAACT,sBAAsB;YACtB2C,KAAK,EAAGjD,EAAE,CAAE,QAAS,CAAG;YACxB+C,OAAO,EAAGA;UAAS,CACnB,CAAC,eACFhC,IAAA,CAACP,cAAc,IAAE,CAAC;QAAA,CACd;MACH,CACH;IAAC,CACW;EAAC,CACC,CAAC;AAEpB;AAEA,eAAeU,UAAU","ignoreList":[]}
|
|
@@ -46,7 +46,7 @@ function PostLastRevision() {
|
|
|
46
46
|
className: "editor-post-last-revision__title",
|
|
47
47
|
icon: backup,
|
|
48
48
|
iconPosition: "right",
|
|
49
|
-
text: sprintf(
|
|
49
|
+
text: sprintf(/* translators: %s: number of revisions */
|
|
50
50
|
__('Revisions (%s)'), revisionsCount)
|
|
51
51
|
})
|
|
52
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sprintf","__","Button","useSelect","backup","addQueryArgs","PostLastRevisionCheck","PostPanelRow","store","editorStore","jsx","_jsx","usePostLastRevisionInfo","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","lastRevisionId","revisionsCount","PostLastRevision","children","__next40pxDefaultSize","href","revision","className","icon","iconPosition","text","PrivatePostLastRevision","label","variant","size"],"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\nfunction usePostLastRevisionInfo() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n}\n\n/**\n * Renders the component for displaying the last revision of a post.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t\ticonPosition=\"right\"\n\t\t\t\ttext={ sprintf(\n\t\t\t\t\t/* translators: %s: number of revisions */\n\t\t\t\t\t__( 'Revisions (%s)' ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport function PrivatePostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostPanelRow label={ __( 'Revisions' ) }>\n\t\t\t\t<Button\n\t\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\t} ) }\n\t\t\t\t\tclassName=\"editor-private-post-last-revision__button\"\n\t\t\t\t\ttext={ revisionsCount }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default PostLastRevision;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,SAAS;AAC3C,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnD,SAASC,uBAAuBA,CAAA,EAAG;EAClC,OAAOT,SAAS,CAAIU,MAAM,IAAM;IAC/B,MAAM;MAAEC,4BAA4B;MAAEC;IAA6B,CAAC,GACnEF,MAAM,CAAEJ,WAAY,CAAC;IACtB,OAAO;MACNO,cAAc,EAAEF,4BAA4B,CAAC,CAAC;MAC9CG,cAAc,EAAEF,4BAA4B,CAAC;IAC9C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASG,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEF,cAAc;IAAEC;EAAe,CAAC,GAAGL,uBAAuB,CAAC,CAAC;EAEpE,oBACCD,IAAA,CAACL,qBAAqB;IAAAa,QAAA,eACrBR,IAAA,CAACT,MAAM;MACNkB,qBAAqB;MACrBC,IAAI,EAAGhB,YAAY,CAAE,cAAc,EAAE;QACpCiB,QAAQ,EAAEN;MACX,CAAE,CAAG;MACLO,SAAS,EAAC,kCAAkC;MAC5CC,IAAI,EAAGpB,MAAQ;MACfqB,YAAY,EAAC,OAAO;MACpBC,IAAI,EAAG1B,OAAO,
|
|
1
|
+
{"version":3,"names":["sprintf","__","Button","useSelect","backup","addQueryArgs","PostLastRevisionCheck","PostPanelRow","store","editorStore","jsx","_jsx","usePostLastRevisionInfo","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","lastRevisionId","revisionsCount","PostLastRevision","children","__next40pxDefaultSize","href","revision","className","icon","iconPosition","text","PrivatePostLastRevision","label","variant","size"],"sources":["@wordpress/editor/src/components/post-last-revision/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\nfunction usePostLastRevisionInfo() {\n\treturn useSelect( ( select ) => {\n\t\tconst { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n}\n\n/**\n * Renders the component for displaying the last revision of a post.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t} ) }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t\ticonPosition=\"right\"\n\t\t\t\ttext={ sprintf(\n\t\t\t\t\t/* translators: %s: number of revisions */\n\t\t\t\t\t__( 'Revisions (%s)' ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport function PrivatePostLastRevision() {\n\tconst { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostPanelRow label={ __( 'Revisions' ) }>\n\t\t\t\t<Button\n\t\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\t} ) }\n\t\t\t\t\tclassName=\"editor-private-post-last-revision__button\"\n\t\t\t\t\ttext={ revisionsCount }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport default PostLastRevision;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,SAAS;AAC3C,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnD,SAASC,uBAAuBA,CAAA,EAAG;EAClC,OAAOT,SAAS,CAAIU,MAAM,IAAM;IAC/B,MAAM;MAAEC,4BAA4B;MA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 -21,9 +21,7 @@ import { store as editorStore } from '../../store';
|
|
|
21
21
|
*
|
|
22
22
|
* @return {JSX.Element|null} The rendered PostLockedModal component.
|
|
23
23
|
*/
|
|
24
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
25
|
export default function PostLockedModal() {
|
|
28
26
|
const instanceId = useInstanceId(PostLockedModal);
|
|
29
27
|
const hookName = 'core/editor/post-locked-modal-' + instanceId;
|
|
@@ -182,7 +180,7 @@ export default function PostLockedModal() {
|
|
|
182
180
|
height: 64
|
|
183
181
|
}), /*#__PURE__*/_jsxs("div", {
|
|
184
182
|
children: [!!isTakeover && /*#__PURE__*/_jsx("p", {
|
|
185
|
-
children: createInterpolateElement(userDisplayName ? sprintf(
|
|
183
|
+
children: createInterpolateElement(userDisplayName ? sprintf(/* translators: %s: user's display name */
|
|
186
184
|
__('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : __('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
|
|
187
185
|
strong: /*#__PURE__*/_jsx("strong", {}),
|
|
188
186
|
PreviewLink: /*#__PURE__*/_jsx(ExternalLink, {
|
|
@@ -192,7 +190,7 @@ export default function PostLockedModal() {
|
|
|
192
190
|
})
|
|
193
191
|
}), !isTakeover && /*#__PURE__*/_jsxs(_Fragment, {
|
|
194
192
|
children: [/*#__PURE__*/_jsx("p", {
|
|
195
|
-
children: createInterpolateElement(userDisplayName ? sprintf(
|
|
193
|
+
children: createInterpolateElement(userDisplayName ? sprintf(/* translators: %s: user's display name */
|
|
196
194
|
__('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : __('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
|
|
197
195
|
strong: /*#__PURE__*/_jsx("strong", {}),
|
|
198
196
|
PreviewLink: /*#__PURE__*/_jsx(ExternalLink, {
|