@wordpress/editor 14.9.0 → 14.11.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 +8 -0
- package/README.md +2 -2
- package/build/bindings/api.js +0 -29
- package/build/bindings/api.js.map +1 -1
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.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/collab-sidebar/add-comment.js +120 -0
- package/build/components/collab-sidebar/add-comment.js.map +1 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build/components/collab-sidebar/comment-button.js +37 -0
- package/build/components/collab-sidebar/comment-button.js.map +1 -0
- package/build/components/collab-sidebar/comments.js +321 -0
- package/build/components/collab-sidebar/comments.js.map +1 -0
- package/build/components/collab-sidebar/constants.js +8 -0
- package/build/components/collab-sidebar/constants.js.map +1 -0
- package/build/components/collab-sidebar/index.js +272 -0
- package/build/components/collab-sidebar/index.js.map +1 -0
- package/build/components/collab-sidebar/utils.js +16 -0
- package/build/components/collab-sidebar/utils.js.map +1 -0
- package/build/components/commands/index.js +6 -6
- 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-bar/index.js +8 -7
- package/build/components/document-bar/index.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 +2 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-interface/index.js +4 -14
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +2 -2
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +13 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +5 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +2 -2
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -5
- 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/plugin-more-menu-item/index.js +13 -11
- package/build/components/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +15 -13
- package/build/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +0 -15
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/index.js +5 -5
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/panel.js +4 -4
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -36
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +2 -3
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +26 -7
- 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 +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +13 -5
- 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 +49 -29
- 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 +0 -4
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +10 -12
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/resizable-editor/resize-handle.js.map +1 -1
- package/build/components/sidebar/header.js +2 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +3 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -2
- 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 +24 -25
- 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/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
- package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/zoom-out-toggle/index.js +37 -5
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/actions/duplicate-template-part.js +3 -3
- 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 +30 -4
- 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 +8 -7
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +24 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/pageTypeBadge.js +51 -0
- package/build/utils/pageTypeBadge.js.map +1 -0
- package/build/utils/terms.js +2 -2
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/api.js +1 -29
- package/build-module/bindings/api.js.map +1 -1
- package/build-module/bindings/post-meta.js +2 -1
- package/build-module/bindings/post-meta.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/collab-sidebar/add-comment.js +114 -0
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button.js +30 -0
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
- package/build-module/components/collab-sidebar/comments.js +314 -0
- package/build-module/components/collab-sidebar/comments.js.map +1 -0
- package/build-module/components/collab-sidebar/constants.js +2 -0
- package/build-module/components/collab-sidebar/constants.js.map +1 -0
- package/build-module/components/collab-sidebar/index.js +264 -0
- package/build-module/components/collab-sidebar/index.js.map +1 -0
- package/build-module/components/collab-sidebar/utils.js +10 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -0
- 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 +6 -6
- 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 +10 -10
- 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 +4 -10
- 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 +5 -17
- 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 +3 -4
- 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/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +13 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +6 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -2
- package/build-module/components/inserter-sidebar/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 +6 -7
- 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/plugin-more-menu-item/index.js +12 -10
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +14 -12
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +0 -15
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +6 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +5 -6
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -38
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +2 -3
- 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 +27 -9
- 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 +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 +16 -10
- 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 +51 -31
- 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 -7
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +11 -15
- 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/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.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 +3 -3
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -6
- 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 +2 -2
- 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 +26 -29
- 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/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/zoom-out-toggle/index.js +37 -5
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js +4 -4
- 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 +30 -4
- 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 +9 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +24 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +45 -0
- package/build-module/utils/pageTypeBadge.js.map +1 -0
- package/build-module/utils/terms.js +2 -2
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +116 -59
- package/build-style/style.css +116 -59
- package/build-types/bindings/api.d.ts +0 -13
- package/build-types/bindings/api.d.ts.map +1 -1
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +19 -0
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/constants.d.ts +2 -0
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts +5 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +8 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.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/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.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/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/sidebar/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/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
- package/build-types/components/zoom-out-toggle/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/build-types/utils/pageTypeBadge.d.ts +5 -0
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts.map +1 -1
- package/package.json +39 -38
- package/src/bindings/api.js +1 -32
- package/src/bindings/post-meta.js +1 -0
- package/src/components/collab-sidebar/add-comment.js +124 -0
- package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
- package/src/components/collab-sidebar/comment-button.js +31 -0
- package/src/components/collab-sidebar/comments.js +404 -0
- package/src/components/collab-sidebar/constants.js +1 -0
- package/src/components/collab-sidebar/index.js +307 -0
- package/src/components/collab-sidebar/style.scss +111 -0
- package/src/components/collab-sidebar/utils.js +9 -0
- package/src/components/commands/index.js +9 -7
- package/src/components/document-bar/index.js +15 -7
- package/src/components/document-bar/style.scss +0 -4
- package/src/components/document-tools/index.js +2 -8
- package/src/components/editor-interface/index.js +4 -18
- package/src/components/entities-saved-states/index.js +2 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/src/components/global-styles-provider/index.js +20 -6
- package/src/components/header/index.js +3 -1
- package/src/components/header/style.scss +1 -0
- package/src/components/inserter-sidebar/index.js +3 -6
- package/src/components/page-attributes/parent.js +6 -4
- package/src/components/plugin-more-menu-item/index.js +12 -11
- package/src/components/plugin-preview-menu-item/index.js +14 -13
- package/src/components/plugin-sidebar/index.js +0 -13
- package/src/components/post-actions/index.js +8 -11
- package/src/components/post-author/panel.js +4 -2
- package/src/components/post-card-panel/index.js +9 -43
- package/src/components/post-card-panel/style.scss +1 -9
- package/src/components/post-content-information/index.js +1 -1
- package/src/components/post-featured-image/index.js +31 -16
- package/src/components/post-featured-image/style.scss +5 -2
- package/src/components/post-last-revision/index.js +1 -1
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-sticky/test/index.js +6 -6
- package/src/components/post-taxonomies/flat-term-selector.js +15 -4
- package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -2
- 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 +61 -35
- package/src/components/post-url/style.scss +21 -3
- package/src/components/preview-dropdown/index.js +0 -2
- package/src/components/provider/index.js +32 -24
- package/src/components/provider/use-block-editor-settings.js +1 -1
- package/src/components/sidebar/header.js +3 -2
- package/src/components/sidebar/index.js +5 -3
- package/src/components/time-to-read/index.js +3 -3
- package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
- package/src/components/visual-editor/index.js +32 -39
- package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
- package/src/components/zoom-out-toggle/index.js +39 -5
- package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
- package/src/private-apis.js +1 -5
- package/src/store/actions.js +33 -4
- package/src/store/private-actions.js +3 -3
- package/src/store/selectors.js +24 -2
- package/src/style.scss +1 -0
- package/src/utils/pageTypeBadge.js +41 -0
- package/src/utils/terms.js +4 -2
- package/src/utils/test/terms.js +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -36,10 +36,10 @@ function PostAuthorToggle({
|
|
|
36
36
|
size: "compact",
|
|
37
37
|
className: "editor-post-author__panel-toggle",
|
|
38
38
|
variant: "tertiary",
|
|
39
|
-
"aria-expanded": isOpen
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
"aria-expanded": isOpen,
|
|
40
|
+
"aria-label":
|
|
41
|
+
// translators: %s: Author name.
|
|
42
|
+
(0, _i18n.sprintf)((0, _i18n.__)('Change author: %s'), authorName),
|
|
43
43
|
onClick: onClick,
|
|
44
44
|
children: authorName
|
|
45
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_element","_htmlEntities","_blockEditor","_check","_interopRequireDefault","_index","_postPanelRow","_hook","_jsxRuntime","PostAuthorToggle","isOpen","onClick","postAuthor","useAuthorsQuery","authorName","decodeEntities","name","__","jsx","Button","size","className","variant","sprintf","children","PostAuthor","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","default","label","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","jsxs","__experimentalInspectorPopoverHeader","title","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName =\n\t\tdecodeEntities( postAuthor?.name ) || __( '(No author)' );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-author__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s:
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_element","_htmlEntities","_blockEditor","_check","_interopRequireDefault","_index","_postPanelRow","_hook","_jsxRuntime","PostAuthorToggle","isOpen","onClick","postAuthor","useAuthorsQuery","authorName","decodeEntities","name","__","jsx","Button","size","className","variant","sprintf","children","PostAuthor","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","default","label","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","jsxs","__experimentalInspectorPopoverHeader","title","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName =\n\t\tdecodeEntities( postAuthor?.name ) || __( '(No author)' );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-author__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\t// translators: %s: Author name.\n\t\t\t\tsprintf( __( 'Change author: %s' ), authorName )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ authorName }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nexport function PostAuthor() {\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<PostAuthorCheck>\n\t\t\t<PostPanelRow label={ __( 'Author' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-author__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostAuthorToggle\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<div className=\"editor-post-author\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Author' ) }\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<PostAuthorForm onClose={ onClose } />\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</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,aAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AAAyC,IAAAU,WAAA,GAAAV,OAAA;AAfzC;AACA;AACA;;AAOA;AACA;AACA;;AAMA,SAASW,gBAAgBA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAChD,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,qBAAe,EAAC,CAAC;EACxC,MAAMC,UAAU,GACf,IAAAC,4BAAc,EAAEH,UAAU,EAAEI,IAAK,CAAC,IAAI,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1D,oBACC,IAAAT,WAAA,CAAAU,GAAA,EAACnB,WAAA,CAAAoB,MAAM;IACNC,IAAI,EAAC,SAAS;IACdC,SAAS,EAAC,kCAA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G,QAAA,gBAClC,IAAAhB,WAAA,CAAAU,GAAA,EAAChB,YAAA,CAAA4C,oCAAsB;YACtBC,KAAK,EAAG,IAAA9B,QAAE,EAAE,QAAS,CAAG;YACxB2B,OAAO,EAAGA;UAAS,CACnB,CAAC,eACF,IAAApC,WAAA,CAAAU,GAAA,EAACb,MAAA,CAAA8B,OAAc;YAACS,OAAO,EAAGA;UAAS,CAAE,CAAC;QAAA,CAClC;MACH,CACH;IAAC,CACW;EAAC,CACC,CAAC;AAEpB;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEcV,UAAU","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = PostCardPanel;
|
|
8
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _coreData = require("@wordpress/core-data");
|
|
11
10
|
var _data = require("@wordpress/data");
|
|
@@ -15,11 +14,8 @@ var _store = require("../../store");
|
|
|
15
14
|
var _constants = require("../../store/constants");
|
|
16
15
|
var _lockUnlock = require("../../lock-unlock");
|
|
17
16
|
var _postActions = _interopRequireDefault(require("../post-actions"));
|
|
17
|
+
var _pageTypeBadge = _interopRequireDefault(require("../../utils/pageTypeBadge"));
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
/**
|
|
20
|
-
* External dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* WordPress dependencies
|
|
25
21
|
*/
|
|
@@ -34,45 +30,25 @@ function PostCardPanel({
|
|
|
34
30
|
onActionPerformed
|
|
35
31
|
}) {
|
|
36
32
|
const {
|
|
37
|
-
isFrontPage,
|
|
38
|
-
isPostsPage,
|
|
39
33
|
title,
|
|
40
|
-
icon
|
|
41
|
-
isSync
|
|
34
|
+
icon
|
|
42
35
|
} = (0, _data.useSelect)(select => {
|
|
43
36
|
const {
|
|
44
37
|
__experimentalGetTemplateInfo
|
|
45
38
|
} = select(_store.store);
|
|
46
39
|
const {
|
|
47
|
-
canUser,
|
|
48
40
|
getEditedEntityRecord
|
|
49
41
|
} = select(_coreData.store);
|
|
50
|
-
const siteSettings = canUser('read', {
|
|
51
|
-
kind: 'root',
|
|
52
|
-
name: 'site'
|
|
53
|
-
}) ? getEditedEntityRecord('root', 'site') : undefined;
|
|
54
42
|
const _record = getEditedEntityRecord('postType', postType, postId);
|
|
55
43
|
const _templateInfo = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType) && __experimentalGetTemplateInfo(_record);
|
|
56
|
-
let _isSync = false;
|
|
57
|
-
if (_constants.GLOBAL_POST_TYPES.includes(postType)) {
|
|
58
|
-
if (_constants.PATTERN_POST_TYPE === postType) {
|
|
59
|
-
// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
|
|
60
|
-
const currentSyncStatus = _record?.meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : _record?.wp_pattern_sync_status;
|
|
61
|
-
_isSync = currentSyncStatus !== 'unsynced';
|
|
62
|
-
} else {
|
|
63
|
-
_isSync = true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
44
|
return {
|
|
67
45
|
title: _templateInfo?.title || _record?.title,
|
|
68
46
|
icon: (0, _lockUnlock.unlock)(select(_store.store)).getPostIcon(postType, {
|
|
69
47
|
area: _record?.area
|
|
70
|
-
})
|
|
71
|
-
isSync: _isSync,
|
|
72
|
-
isFrontPage: siteSettings?.page_on_front === postId,
|
|
73
|
-
isPostsPage: siteSettings?.page_for_posts === postId
|
|
48
|
+
})
|
|
74
49
|
};
|
|
75
50
|
}, [postId, postType]);
|
|
51
|
+
const pageTypeBadge = (0, _pageTypeBadge.default)();
|
|
76
52
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
77
53
|
className: "editor-post-card-panel",
|
|
78
54
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
@@ -80,9 +56,7 @@ function PostCardPanel({
|
|
|
80
56
|
className: "editor-post-card-panel__header",
|
|
81
57
|
align: "flex-start",
|
|
82
58
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
83
|
-
className:
|
|
84
|
-
'is-sync': isSync
|
|
85
|
-
}),
|
|
59
|
+
className: "editor-post-card-panel__icon",
|
|
86
60
|
icon: icon
|
|
87
61
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalText, {
|
|
88
62
|
numberOfLines: 2,
|
|
@@ -91,12 +65,9 @@ function PostCardPanel({
|
|
|
91
65
|
weight: 500,
|
|
92
66
|
as: "h2",
|
|
93
67
|
lineHeight: "20px",
|
|
94
|
-
children: [title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No title'),
|
|
95
|
-
className: "editor-post-card-panel__title-badge",
|
|
96
|
-
children: (0, _i18n.__)('Homepage')
|
|
97
|
-
}), isPostsPage && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
68
|
+
children: [title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No title'), pageTypeBadge && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
98
69
|
className: "editor-post-card-panel__title-badge",
|
|
99
|
-
children:
|
|
70
|
+
children: pageTypeBadge
|
|
100
71
|
})]
|
|
101
72
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postActions.default, {
|
|
102
73
|
postType: postType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_components","require","_coreData","_data","_i18n","_htmlEntities","_store","_constants","_lockUnlock","_postActions","_interopRequireDefault","_pageTypeBadge","_jsxRuntime","PostCardPanel","postType","postId","onActionPerformed","title","icon","useSelect","select","__experimentalGetTemplateInfo","editorStore","getEditedEntityRecord","coreStore","_record","_templateInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","unlock","getPostIcon","area","pageTypeBadge","usePageTypeBadge","jsx","className","children","jsxs","__experimentalHStack","spacing","align","Icon","__experimentalText","numberOfLines","truncate","weight","as","lineHeight","decodeEntities","__","default"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { title, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetTemplateInfo } = select( editorStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\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\treturn {\n\t\t\t\ttitle: _templateInfo?.title || _record?.title,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\n\tconst pageTypeBadge = usePageTypeBadge();\n\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No title' ) }\n\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ pageTypeBadge }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<PostActions\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAIA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,cAAA,GAAAD,sBAAA,CAAAT,OAAA;AAAyD,IAAAW,WAAA,GAAAX,OAAA;AAvBzD;AACA;AACA;;AAWA;AACA;AACA;;AAUe,SAASY,aAAaA,CAAE;EACtCC,QAAQ;EACRC,MAAM;EACNC;AACD,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AG;QACnBC,QAAQ;QACRT,SAAS,EAAC,+BAA+B;QACzCU,MAAM,EAAG,GAAK;QACdC,EAAE,EAAC,IAAI;QACPC,UAAU,EAAC,MAAM;QAAAX,QAAA,GAEfpB,KAAK,GAAG,IAAAgC,4BAAc,EAAEhC,KAAM,CAAC,GAAG,IAAAiC,QAAE,EAAE,UAAW,CAAC,EAClDjB,aAAa,iBACd,IAAArB,WAAA,CAAAuB,GAAA;UAAMC,SAAS,EAAC,qCAAqC;UAAAC,QAAA,EAClDJ;QAAa,CACV,CACN;MAAA,CACI,CAAC,eACP,IAAArB,WAAA,CAAAuB,GAAA,EAAC1B,YAAA,CAAA0C,OAAW;QACXrC,QAAQ,EAAGA,QAAU;QACrBC,MAAM,EAAGA,MAAQ;QACjBC,iBAAiB,EAAGA;MAAmB,CACvC,CAAC;IAAA,CACK;EAAC,CACL,CAAC;AAER","ignoreList":[]}
|
|
@@ -67,13 +67,12 @@ function PostContentInformation() {
|
|
|
67
67
|
const wordsCountText = (0, _i18n.sprintf)(
|
|
68
68
|
// translators: %s: the number of words in the post.
|
|
69
69
|
(0, _i18n._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString());
|
|
70
|
-
const minutesText = readingTime <= 1 ? (0, _i18n.__)('1 minute') : (0, _i18n.sprintf)(
|
|
71
|
-
// translators: %s: the number of minutes to read the post.
|
|
70
|
+
const minutesText = readingTime <= 1 ? (0, _i18n.__)('1 minute') : (0, _i18n.sprintf)(/* translators: %s: the number of minutes to read the post. */
|
|
72
71
|
(0, _i18n._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString());
|
|
73
72
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
74
73
|
className: "editor-post-content-information",
|
|
75
74
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
76
|
-
children: (0, _i18n.sprintf)(
|
|
75
|
+
children: (0, _i18n.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.) */
|
|
77
76
|
(0, _i18n.__)('%1$s, %2$s read time.'), wordsCountText, minutesText)
|
|
78
77
|
})
|
|
79
78
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_wordcount","_element","_coreData","_store","_constants","_jsxRuntime","AVERAGE_READING_RATE","PostContentInformation","postContent","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","editorStore","canUser","coreStore","getEntityRecord","siteSettings","kind","name","undefined","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","wordCountType","_x","wordsCounted","useMemo","wordCount","readingTime","Math","round","wordsCountText","sprintf","_n","toLocaleString","minutesText","__","jsx","className","children","__experimentalText"],"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
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_i18n","_wordcount","_element","_coreData","_store","_constants","_jsxRuntime","AVERAGE_READING_RATE","PostContentInformation","postContent","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","editorStore","canUser","coreStore","getEntityRecord","siteSettings","kind","name","undefined","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","wordCountType","_x","wordsCounted","useMemo","wordCount","readingTime","Math","round","wordsCountText","sprintf","_n","toLocaleString","minutesText","__","jsx","className","children","__experimentalText"],"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":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAG+B,IAAAQ,WAAA,GAAAR,OAAA;AAjB/B;AACA;AACA;;AAQA;AACA;AACA;;AAOA;AACA,MAAMS,oBAAoB,GAAG,GAAG;;AAEhC;AACe,SAASC,sBAAsBA,CAAA,EAAG;EAChD,MAAM;IAAEC;EAAY,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAChD,MAAM;MAAEC,sBAAsB;MAAEC,kB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AE,UAAU,EAAER,YAAa,CAAC,EACzCA,YAAY,CAACS,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBP,WAAW,IAAI,CAAC,GACb,IAAAQ,QAAE,EAAE,UAAW,CAAC,GAChB,IAAAJ,aAAO,EACP;EACA,IAAAC,QAAE,EAAE,WAAW,EAAE,YAAY,EAAEL,WAAY,CAAC,EAC5CA,WAAW,CAACM,cAAc,CAAC,CAC3B,CAAC;EACL,oBACC,IAAApC,WAAA,CAAAuC,GAAA;IAAKC,SAAS,EAAC,iCAAiC;IAAAC,QAAA,eAC/C,IAAAzC,WAAA,CAAAuC,GAAA,EAAChD,WAAA,CAAAmD,kBAAI;MAAAD,QAAA,EACF,IAAAP,aAAO,EACR;MACA,IAAAI,QAAE,EAAE,uBAAwB,CAAC,EAC7BL,cAAc,EACdI,WACD;IAAC,CACI;EAAC,CACH,CAAC;AAER","ignoreList":[]}
|
|
@@ -102,17 +102,36 @@ function PostFeaturedImage({
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Generates the featured image alt text for this editing context.
|
|
108
|
+
*
|
|
109
|
+
* @param {Object} imageMedia The image media object.
|
|
110
|
+
* @param {string} imageMedia.alt_text The alternative text of the image.
|
|
111
|
+
* @param {Object} imageMedia.media_details The media details of the image.
|
|
112
|
+
* @param {Object} imageMedia.media_details.sizes The sizes of the image.
|
|
113
|
+
* @param {Object} imageMedia.media_details.sizes.full The full size details of the image.
|
|
114
|
+
* @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image.
|
|
115
|
+
* @param {string} imageMedia.slug The slug of the image.
|
|
116
|
+
* @return {string} The featured image alt text.
|
|
117
|
+
*/
|
|
118
|
+
function getImageDescription(imageMedia) {
|
|
119
|
+
if (imageMedia.alt_text) {
|
|
120
|
+
return (0, _i18n.sprintf)(
|
|
121
|
+
// Translators: %s: The selected image alt text.
|
|
122
|
+
(0, _i18n.__)('Current image: %s'), imageMedia.alt_text);
|
|
123
|
+
}
|
|
124
|
+
return (0, _i18n.sprintf)(
|
|
125
|
+
// Translators: %s: The selected image filename.
|
|
126
|
+
(0, _i18n.__)('The current image has no alternative text. The file name is: %s'), imageMedia.media_details.sizes?.full?.file || imageMedia.slug);
|
|
127
|
+
}
|
|
105
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_check.default, {
|
|
106
129
|
children: [noticeUI, /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
107
130
|
className: "editor-post-featured-image",
|
|
108
|
-
children: [media && /*#__PURE__*/(0, _jsxRuntime.
|
|
131
|
+
children: [media && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
109
132
|
id: `editor-post-featured-image-${featuredImageId}-describedby`,
|
|
110
133
|
className: "hidden",
|
|
111
|
-
children:
|
|
112
|
-
// Translators: %s: The selected image alt text.
|
|
113
|
-
(0, _i18n.__)('Current image: %s'), media.alt_text), !media.alt_text && (0, _i18n.sprintf)(
|
|
114
|
-
// Translators: %s: The selected image filename.
|
|
115
|
-
(0, _i18n.__)('The current image has no alternative text. The file name is: %s'), media.media_details.sizes?.full?.file || media.slug)]
|
|
134
|
+
children: getImageDescription(media)
|
|
116
135
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.MediaUploadCheck, {
|
|
117
136
|
fallback: instructions,
|
|
118
137
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.MediaUpload, {
|
|
@@ -138,7 +157,7 @@ function PostFeaturedImage({
|
|
|
138
157
|
children: [!!featuredImageId && media && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
139
158
|
className: "editor-post-featured-image__preview-image",
|
|
140
159
|
src: mediaSourceUrl,
|
|
141
|
-
alt:
|
|
160
|
+
alt: getImageDescription(media)
|
|
142
161
|
}), isLoading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {}), !featuredImageId && !isLoading && (postType?.labels?.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)]
|
|
143
162
|
}), !!featuredImageId && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
144
163
|
className: "editor-post-featured-image__actions",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_interopRequireDefault","_store","_jsxRuntime","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","jsx","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","useRef","isLoading","setIsLoading","useState","getSettings","useSelect","blockEditorStore","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","jsxs","default","className","alt_text","sprintf","full","file","slug","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Button","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","Spinner","set_featured_image","__experimentalHStack","current","focus","DropZone","onFilesDrop","value","applyWithSelect","withSelect","select","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","exports","compose","withNotices","withFilters"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IA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;IAAEW;EAAS,CAAC,GAAGD,QAAQ,CAAEJ,YAAY,CAAC;EAC5C,OAAO;IACNpE,aAAaA,CAAEkB,KAAK,EAAG;MACtBuD,QAAQ,CAAE;QAAEC,cAAc,EAAExD,KAAK,CAAC/B;MAAG,CAAE,CAAC;IACzC,CAAC;IACDwF,WAAWA,CAAE7D,SAAS,EAAG;MACxBgD,MAAM,CAAElD,kBAAiB,CAAC,CACxBF,WAAW,CAAC,CAAC,CACbK,WAAW,CAAE;QACbC,YAAY,EAAE,CAAE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzBuD,QAAQ,CAAE;YAAEC,cAAc,EAAExD,KAAK,CAAC/B;UAAG,CAAE,CAAC;QACzC,CAAC;QACDkC,OAAOA,CAAEC,OAAO,EAAG;UAClBlB,gBAAgB,CAACmB,gBAAgB,CAAC,CAAC;UACnCnB,gBAAgB,CAACoB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDrB,aAAaA,CAAA,EAAG;MACfwE,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAAAE,QAAA,GAAAC,OAAA,CAAAnD,OAAA,GAee,IAAAoD,gBAAO,EACrBC,uBAAW,EACXnB,eAAe,EACfU,iBAAiB,EACjB,IAAAU,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAEnF,iBAAkB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_hooks","_components","_blob","_element","_compose","_data","_blockEditor","_coreData","_check","_interopRequireDefault","_store","_jsxRuntime","ALLOWED_MEDIA_TYPES","DEFAULT_FEATURE_IMAGE_LABEL","__","DEFAULT_SET_FEATURE_IMAGE_LABEL","instructions","jsx","children","getMediaDetails","media","postId","_media$media_details$","_media$media_details$2","defaultSize","applyFilters","id","media_details","sizes","mediaWidth","width","mediaHeight","height","mediaSourceUrl","source_url","fallbackSize","PostFeaturedImage","currentPostId","featuredImageId","onUpdateImage","onRemoveImage","postType","noticeUI","noticeOperations","toggleRef","useRef","isLoading","setIsLoading","useState","getSettings","useSelect","blockEditorStore","onDropFiles","filesList","mediaUpload","allowedTypes","onFileChange","image","isBlobURL","url","onError","message","removeAllNotices","createErrorNotice","getImageDescription","imageMedia","alt_text","sprintf","full","file","slug","jsxs","default","className","MediaUploadCheck","fallback","MediaUpload","title","labels","featured_image","onSelect","unstableFeaturedImageFlow","modalClass","render","open","Button","__next40pxDefaultSize","ref","onClick","disabled","accessibleWhenDisabled","src","alt","Spinner","set_featured_image","__experimentalHStack","current","focus","DropZone","onFilesDrop","value","applyWithSelect","withSelect","select","getMedia","getPostType","coreStore","getCurrentPostId","getEditedPostAttribute","editorStore","context","applyWithDispatch","withDispatch","dispatch","editPost","featured_media","onDropImage","_default","exports","compose","withNotices","withFilters"],"sources":["@wordpress/editor/src/components/post-featured-image/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { applyFilters } from '@wordpress/hooks';\nimport {\n\tDropZone,\n\tButton,\n\tSpinner,\n\twithNotices,\n\twithFilters,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { isBlobURL } from '@wordpress/blob';\nimport { useState, useRef } from '@wordpress/element';\nimport { compose } from '@wordpress/compose';\nimport { useSelect, withDispatch, withSelect } from '@wordpress/data';\nimport {\n\tMediaUpload,\n\tMediaUploadCheck,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostFeaturedImageCheck from './check';\nimport { store as editorStore } from '../../store';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\n\n// Used when labels from post type were not yet loaded or when they are not present.\nconst DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );\nconst DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Add a featured image' );\n\nconst instructions = (\n\t<p>\n\t\t{ __(\n\t\t\t'To edit the featured image, you need permission to upload media.'\n\t\t) }\n\t</p>\n);\n\nfunction getMediaDetails( media, postId ) {\n\tif ( ! media ) {\n\t\treturn {};\n\t}\n\n\tconst defaultSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'large',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( defaultSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ defaultSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ defaultSize ].height,\n\t\t\tmediaSourceUrl: media.media_details.sizes[ defaultSize ].source_url,\n\t\t};\n\t}\n\n\t// Use fallbackSize when defaultSize is not available.\n\tconst fallbackSize = applyFilters(\n\t\t'editor.PostFeaturedImage.imageSize',\n\t\t'thumbnail',\n\t\tmedia.id,\n\t\tpostId\n\t);\n\tif ( fallbackSize in ( media?.media_details?.sizes ?? {} ) ) {\n\t\treturn {\n\t\t\tmediaWidth: media.media_details.sizes[ fallbackSize ].width,\n\t\t\tmediaHeight: media.media_details.sizes[ fallbackSize ].height,\n\t\t\tmediaSourceUrl:\n\t\t\t\tmedia.media_details.sizes[ fallbackSize ].source_url,\n\t\t};\n\t}\n\n\t// Use full image size when fallbackSize and defaultSize are not available.\n\treturn {\n\t\tmediaWidth: media.media_details.width,\n\t\tmediaHeight: media.media_details.height,\n\t\tmediaSourceUrl: media.source_url,\n\t};\n}\n\nfunction PostFeaturedImage( {\n\tcurrentPostId,\n\tfeaturedImageId,\n\tonUpdateImage,\n\tonRemoveImage,\n\tmedia,\n\tpostType,\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst toggleRef = useRef();\n\tconst [ isLoading, setIsLoading ] = useState( false );\n\tconst { getSettings } = useSelect( blockEditorStore );\n\tconst { mediaSourceUrl } = getMediaDetails( media, currentPostId );\n\n\tfunction onDropFiles( filesList ) {\n\t\tgetSettings().mediaUpload( {\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\tsetIsLoading( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( image ) {\n\t\t\t\t\tonUpdateImage( image );\n\t\t\t\t}\n\t\t\t\tsetIsLoading( false );\n\t\t\t},\n\t\t\tonError( message ) {\n\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t},\n\t\t} );\n\t}\n\n\t/**\n\t * Generates the featured image alt text for this editing context.\n\t *\n\t * @param {Object} imageMedia The image media object.\n\t * @param {string} imageMedia.alt_text The alternative text of the image.\n\t * @param {Object} imageMedia.media_details The media details of the image.\n\t * @param {Object} imageMedia.media_details.sizes The sizes of the image.\n\t * @param {Object} imageMedia.media_details.sizes.full The full size details of the image.\n\t * @param {string} imageMedia.media_details.sizes.full.file The file name of the full size image.\n\t * @param {string} imageMedia.slug The slug of the image.\n\t * @return {string} The featured image alt text.\n\t */\n\tfunction getImageDescription( imageMedia ) {\n\t\tif ( imageMedia.alt_text ) {\n\t\t\treturn sprintf(\n\t\t\t\t// Translators: %s: The selected image alt text.\n\t\t\t\t__( 'Current image: %s' ),\n\t\t\t\timageMedia.alt_text\n\t\t\t);\n\t\t}\n\t\treturn sprintf(\n\t\t\t// Translators: %s: The selected image filename.\n\t\t\t__(\n\t\t\t\t'The current image has no alternative text. The file name is: %s'\n\t\t\t),\n\t\t\timageMedia.media_details.sizes?.full?.file || imageMedia.slug\n\t\t);\n\t}\n\n\treturn (\n\t\t<PostFeaturedImageCheck>\n\t\t\t{ noticeUI }\n\t\t\t<div className=\"editor-post-featured-image\">\n\t\t\t\t{ media && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={ `editor-post-featured-image-${ featuredImageId }-describedby` }\n\t\t\t\t\t\tclassName=\"hidden\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ getImageDescription( media ) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<MediaUploadCheck fallback={ instructions }>\n\t\t\t\t\t<MediaUpload\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tpostType?.labels?.featured_image ||\n\t\t\t\t\t\t\tDEFAULT_FEATURE_IMAGE_LABEL\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={ onUpdateImage }\n\t\t\t\t\t\tunstableFeaturedImageFlow\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\tmodalClass=\"editor-post-featured-image__media-modal\"\n\t\t\t\t\t\trender={ ( { open } ) => (\n\t\t\t\t\t\t\t<div className=\"editor-post-featured-image__container\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tref={ toggleRef }\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? 'editor-post-featured-image__toggle'\n\t\t\t\t\t\t\t\t\t\t\t: 'editor-post-featured-image__preview'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Edit or replace the featured image'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t! featuredImageId\n\t\t\t\t\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t\t\t\t\t: `editor-post-featured-image-${ featuredImageId }-describedby`\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\tdisabled={ isLoading }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ !! featuredImageId && media && (\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__preview-image\"\n\t\t\t\t\t\t\t\t\t\t\tsrc={ mediaSourceUrl }\n\t\t\t\t\t\t\t\t\t\t\talt={ getImageDescription( media ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ isLoading && <Spinner /> }\n\t\t\t\t\t\t\t\t\t{ ! featuredImageId &&\n\t\t\t\t\t\t\t\t\t\t! isLoading &&\n\t\t\t\t\t\t\t\t\t\t( postType?.labels\n\t\t\t\t\t\t\t\t\t\t\t?.set_featured_image ||\n\t\t\t\t\t\t\t\t\t\t\tDEFAULT_SET_FEATURE_IMAGE_LABEL ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{ !! featuredImageId && (\n\t\t\t\t\t\t\t\t\t<HStack className=\"editor-post-featured-image__actions\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ open }\n\t\t\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-post-featured-image__action\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonRemoveImage();\n\t\t\t\t\t\t\t\t\t\t\t\ttoggleRef.current.focus();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<DropZone onFilesDrop={ onDropFiles } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ featuredImageId }\n\t\t\t\t\t/>\n\t\t\t\t</MediaUploadCheck>\n\t\t\t</div>\n\t\t</PostFeaturedImageCheck>\n\t);\n}\n\nconst applyWithSelect = withSelect( ( select ) => {\n\tconst { getMedia, getPostType } = select( coreStore );\n\tconst { getCurrentPostId, getEditedPostAttribute } = select( editorStore );\n\tconst featuredImageId = getEditedPostAttribute( 'featured_media' );\n\n\treturn {\n\t\tmedia: featuredImageId\n\t\t\t? getMedia( featuredImageId, { context: 'view' } )\n\t\t\t: null,\n\t\tcurrentPostId: getCurrentPostId(),\n\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\tfeaturedImageId,\n\t};\n} );\n\nconst applyWithDispatch = withDispatch(\n\t( dispatch, { noticeOperations }, { select } ) => {\n\t\tconst { editPost } = dispatch( editorStore );\n\t\treturn {\n\t\t\tonUpdateImage( image ) {\n\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t},\n\t\t\tonDropImage( filesList ) {\n\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t.getSettings()\n\t\t\t\t\t.mediaUpload( {\n\t\t\t\t\t\tallowedTypes: [ 'image' ],\n\t\t\t\t\t\tfilesList,\n\t\t\t\t\t\tonFileChange( [ image ] ) {\n\t\t\t\t\t\t\teditPost( { featured_media: image.id } );\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError( message ) {\n\t\t\t\t\t\t\tnoticeOperations.removeAllNotices();\n\t\t\t\t\t\t\tnoticeOperations.createErrorNotice( message );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tonRemoveImage() {\n\t\t\t\teditPost( { featured_media: 0 } );\n\t\t\t},\n\t\t};\n\t}\n);\n\n/**\n * Renders the component for managing the featured image of a post.\n *\n * @param {Object} props Props.\n * @param {number} props.currentPostId ID of the current post.\n * @param {number} props.featuredImageId ID of the featured image.\n * @param {Function} props.onUpdateImage Function to call when the image is updated.\n * @param {Function} props.onRemoveImage Function to call when the image is removed.\n * @param {Object} props.media The media object representing the featured image.\n * @param {string} props.postType Post type.\n * @param {Element} props.noticeUI UI for displaying notices.\n * @param {Object} props.noticeOperations Operations for managing notices.\n *\n * @return {Element} Component to be rendered .\n */\nexport default compose(\n\twithNotices,\n\tapplyWithSelect,\n\tapplyWithDispatch,\n\twithFilters( 'editor.PostFeaturedImage' )\n)( PostFeaturedImage );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAmD,IAAAY,WAAA,GAAAZ,OAAA;AA5BnD;AACA;AACA;;AAsBA;AACA;AACA;;AAIA,MAAMa,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEv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,MAAM;IAAEW;EAAS,CAAC,GAAGD,QAAQ,CAAEJ,YAAY,CAAC;EAC5C,OAAO;IACNtE,aAAaA,CAAEkB,KAAK,EAAG;MACtByD,QAAQ,CAAE;QAAEC,cAAc,EAAE1D,KAAK,CAAC/B;MAAG,CAAE,CAAC;IACzC,CAAC;IACD0F,WAAWA,CAAE/D,SAAS,EAAG;MACxBkD,MAAM,CAAEpD,kBAAiB,CAAC,CACxBF,WAAW,CAAC,CAAC,CACbK,WAAW,CAAE;QACbC,YAAY,EAAE,CAAE,OAAO,CAAE;QACzBF,SAAS;QACTG,YAAYA,CAAE,CAAEC,KAAK,CAAE,EAAG;UACzByD,QAAQ,CAAE;YAAEC,cAAc,EAAE1D,KAAK,CAAC/B;UAAG,CAAE,CAAC;QACzC,CAAC;QACDkC,OAAOA,CAAEC,OAAO,EAAG;UAClBlB,gBAAgB,CAACmB,gBAAgB,CAAC,CAAC;UACnCnB,gBAAgB,CAACoB,iBAAiB,CAAEF,OAAQ,CAAC;QAC9C;MACD,CAAE,CAAC;IACL,CAAC;IACDrB,aAAaA,CAAA,EAAG;MACf0E,QAAQ,CAAE;QAAEC,cAAc,EAAE;MAAE,CAAE,CAAC;IAClC;EACD,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,IAAAE,QAAA,GAAAC,OAAA,CAAA9C,OAAA,GAee,IAAA+C,gBAAO,EACrBC,uBAAW,EACXnB,eAAe,EACfU,iBAAiB,EACjB,IAAAU,uBAAW,EAAE,0BAA2B,CACzC,CAAC,CAAErF,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -127,7 +127,7 @@ function PostFormat() {
|
|
|
127
127
|
__next40pxDefaultSize: true,
|
|
128
128
|
variant: "link",
|
|
129
129
|
onClick: () => onUpdatePostFormat(suggestion.id),
|
|
130
|
-
children: (0, _i18n.sprintf)(
|
|
130
|
+
children: (0, _i18n.sprintf)(/* translators: %s: post format */
|
|
131
131
|
(0, _i18n.__)('Apply suggested format: %s'), suggestion.caption)
|
|
132
132
|
})
|
|
133
133
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_compose","_coreData","_check","_interopRequireDefault","_store","_jsxRuntime","POST_FORMATS","exports","id","caption","__","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","useInstanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","useSelect","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","useDispatch","onUpdatePostFormat","jsx","default","children","jsxs","className","RadioControl","label","selected","onChange","options","map","value","hideLabelFromVision","Button","__next40pxDefaultSize","variant","onClick","sprintf"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAbnD;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACO,MAAMS,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,CAC3B;EAAEE,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,MAAM;EAAEC,OAAO,E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coreData","_check","_interopRequireDefault","_store","_jsxRuntime","POST_FORMATS","exports","id","caption","__","sort","a","b","normalizedA","toUpperCase","normalizedB","PostFormat","instanceId","useInstanceId","postFormatSelectorId","postFormat","suggestedFormat","supportedFormats","useSelect","select","getEditedPostAttribute","getSuggestedPostFormat","editorStore","_postFormat","themeSupports","coreStore","getThemeSupports","formats","filter","format","includes","suggestion","find","editPost","useDispatch","onUpdatePostFormat","jsx","default","children","jsxs","className","RadioControl","label","selected","onChange","options","map","value","hideLabelFromVision","Button","__next40pxDefaultSize","variant","onClick","sprintf"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAmD,IAAAQ,WAAA,GAAAR,OAAA;AAbnD;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACO,MAAMS,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,CAC3B;EAAEE,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,OAAO;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,OAAQ;AAAE,CAAC,EACvC;EAAEF,EAAE,EAAE,MAAM;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,MAAO;AAAE,CAAC,EACrC;EAAEF,EAAE,EAAE,SAAS;EAAEC,OAAO,EAAE,IAAAC,QAAE,EAAE,SAAU;AAAE,CAAC,EAC3C;EAAEF,EAAE,EAAE,OAAO;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AGlB,OAAO,CAACmB,GAAG,CAAIjB,MAAM,KAAQ;UACtCa,KAAK,EAAEb,MAAM,CAAC1B,OAAO;UACrB4C,KAAK,EAAElB,MAAM,CAAC3B;QACf,CAAC,CAAG,CAAG;QACP8C,mBAAmB;MAAA,CACnB,CAAC,EACAjB,UAAU,IAAIA,UAAU,CAAC7B,EAAE,KAAKa,UAAU,iBAC3C,IAAAhB,WAAA,CAAAqC,GAAA;QAAGI,SAAS,EAAC,gCAAgC;QAAAF,QAAA,eAC5C,IAAAvC,WAAA,CAAAqC,GAAA,EAAC5C,WAAA,CAAAyD,MAAM;UACNC,qBAAqB;UACrBC,OAAO,EAAC,MAAM;UACdC,OAAO,EAAGA,CAAA,KACTjB,kBAAkB,CAAEJ,UAAU,CAAC7B,EAAG,CAClC;UAAAoC,QAAA,EAEC,IAAAe,aAAO,EACR;UACA,IAAAjD,QAAE,EAAE,4BAA6B,CAAC,EAClC2B,UAAU,CAAC5B,OACZ;QAAC,CACM;MAAC,CACP,CACH;IAAA,CACG;EAAC,CACU,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -55,7 +55,7 @@ function PostLastRevision() {
|
|
|
55
55
|
className: "editor-post-last-revision__title",
|
|
56
56
|
icon: _icons.backup,
|
|
57
57
|
iconPosition: "right",
|
|
58
|
-
text: (0, _i18n.sprintf)(
|
|
58
|
+
text: (0, _i18n.sprintf)(/* translators: %s: number of revisions. */
|
|
59
59
|
(0, _i18n.__)('Revisions (%s)'), revisionsCount)
|
|
60
60
|
})
|
|
61
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_url","_check","_interopRequireDefault","_postPanelRow","_store","_jsxRuntime","usePostLastRevisionInfo","useSelect","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore","lastRevisionId","revisionsCount","PostLastRevision","jsx","default","children","Button","__next40pxDefaultSize","href","addQueryArgs","revision","className","icon","backup","iconPosition","text","sprintf","__","PrivatePostLastRevision","label","variant","size","_default","exports"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,aAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAdnD;AACA;AACA;;AAOA;AACA;AACA;;AAKA,SAASU,uBAAuBA,CAAA,EAAG;EAClC,OAAO,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/B,MAAM;MAAEC,4BAA4B;MAAEC;IAA6B,CAAC,GACnEF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNC,cAAc,EAAEH,4BAA4B,CAAC,CAAC;MAC9CI,cAAc,EAAEH,4BAA4B,CAAC;IAC9C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASI,gBAAgBA,CAAA,EAAG;EAC3B,MAAM;IAAEF,cAAc;IAAEC;EAAe,CAAC,GAAGP,uBAAuB,CAAC,CAAC;EAEpE,oBACC,IAAAD,WAAA,CAAAU,GAAA,EAACd,MAAA,CAAAe,OAAqB;IAAAC,QAAA,eACrB,IAAAZ,WAAA,CAAAU,GAAA,EAAClB,WAAA,CAAAqB,MAAM;MACNC,qBAAqB;MACrBC,IAAI,EAAG,IAAAC,iBAAY,EAAE,cAAc,EAAE;QACpCC,QAAQ,EAAEV;MACX,CAAE,CAAG;MACLW,SAAS,EAAC,kCAAkC;MAC5CC,IAAI,EAAGC,aAAQ;MACfC,YAAY,EAAC,OAAO;MACpBC,IAAI,EAAG,IAAAC,aAAO,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_url","_check","_interopRequireDefault","_postPanelRow","_store","_jsxRuntime","usePostLastRevisionInfo","useSelect","select","getCurrentPostLastRevisionId","getCurrentPostRevisionsCount","editorStore","lastRevisionId","revisionsCount","PostLastRevision","jsx","default","children","Button","__next40pxDefaultSize","href","addQueryArgs","revision","className","icon","backup","iconPosition","text","sprintf","__","PrivatePostLastRevision","label","variant","size","_default","exports"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,aAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAdnD;AACA;AACA;;AAOA;AACA;AACA;;AAKA,SAASU,uBAAuBA,CAAA,EAAG;EAClC,OAAO,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/B,MAAM;MAAEC,4BAA4B;MAAEC;IAA6B,CAAC,GACnEF,MA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,IAAI,EAAGd,cAAgB;QACvBmB,OAAO,EAAC,UAAU;QAClBC,IAAI,EAAC;MAAS,CACd;IAAC,CACW;EAAC,CACO,CAAC;AAE1B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEcF,gBAAgB","ignoreList":[]}
|
|
@@ -185,7 +185,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
185
185
|
height: 64
|
|
186
186
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
187
187
|
children: [!!isTakeover && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
188
|
-
children: (0, _element.createInterpolateElement)(userDisplayName ? (0, _i18n.sprintf)(
|
|
188
|
+
children: (0, _element.createInterpolateElement)(userDisplayName ? (0, _i18n.sprintf)(/* translators: %s: user's display name */
|
|
189
189
|
(0, _i18n.__)('<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0, _i18n.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
|
|
190
190
|
strong: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {}),
|
|
191
191
|
PreviewLink: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
|
|
@@ -195,7 +195,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
195
195
|
})
|
|
196
196
|
}), !isTakeover && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
197
197
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
198
|
-
children: (0, _element.createInterpolateElement)(userDisplayName ? (0, _i18n.sprintf)(
|
|
198
|
+
children: (0, _element.createInterpolateElement)(userDisplayName ? (0, _i18n.sprintf)(/* translators: %s: user's display name */
|
|
199
199
|
(0, _i18n.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0, _i18n.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
|
|
200
200
|
strong: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {}),
|
|
201
201
|
PreviewLink: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_url","_element","_hooks","_compose","_coreData","_store","_jsxRuntime","PostLockedModal","instanceId","useInstanceId","hookName","autosave","updatePostLock","useDispatch","editorStore","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","previewLink","useSelect","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditedPostPreviewLink","getEditorSettings","getPostType","coreStore","useEffect","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","name","avatar","avatar_src_2x","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addAction","addEventListener","removeAction","removeEventListener","userDisplayName","userAvatar","unlockUrl","addQueryArgs","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","slug","allPostsLabel","__","jsx","Modal","title","focusOnMount","shouldCloseOnClickOutside","shouldCloseOnEsc","isDismissible","className","size","children","jsxs","__experimentalHStack","alignment","spacing","src","alt","width","height","createInterpolateElement","sprintf","strong","PreviewLink","ExternalLink","href","Fragment","justify","Button","__next40pxDefaultSize","variant"],"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A modal component that is displayed when a post is locked for editing by another user.\n * The modal provides information about the lock status and options to take over or exit the editor.\n *\n * @return {JSX.Element|null} The rendered PostLockedModal component.\n */\nexport default function PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t\tpreviewLink,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tpreviewLink: getEditedPostPreviewLink(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post' )\n\t\t\t\t\t: __( 'This post is already being edited' )\n\t\t\t}\n\t\t\tfocusOnMount\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\t// Do not remove this class, as this class is used by third party plugins.\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\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'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\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\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\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\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\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\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\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) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\thref={ unlockUrl }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\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=\"primary\"\n\t\t\t\t\t\t\thref={ allPostsUrl }\n\t\t\t\t\t\t>\n\t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AAC,mCAAmC;UAC7CkB,OAAO,EAAC,UAAU;UAAAhB,QAAA,GAEhB,CAAEtE,UAAU,iBACb,IAAAV,WAAA,CAAAuE,GAAA,EAAC/E,WAAA,CAAAyG,MAAM;YACNC,qBAAqB;YACrBC,OAAO,EAAC,UAAU;YAClBL,IAAI,EAAGnC,SAAW;YAAAqB,QAAA,EAEhB,IAAAV,QAAE,EAAE,WAAY;UAAC,CACZ,CACR,eACD,IAAAtE,WAAA,CAAAuE,GAAA,EAAC/E,WAAA,CAAAyG,MAAM;YACNC,qBAAqB;YACrBC,OAAO,EAAC,SAAS;YACjBL,IAAI,EAAG5B,WAAa;YAAAc,QAAA,EAElBX;UAAa,CACR,CAAC;QAAA,CACF,CAAC;MAAA,CACL,CAAC;IAAA,CACC;EAAC,CACH,CAAC;AAEV","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_url","_element","_hooks","_compose","_coreData","_store","_jsxRuntime","PostLockedModal","instanceId","useInstanceId","hookName","autosave","updatePostLock","useDispatch","editorStore","isLocked","isTakeover","user","postId","postLockUtils","activePostLock","postType","previewLink","useSelect","select","isPostLocked","isPostLockTakeover","getPostLockUser","getCurrentPostId","getActivePostLock","getEditedPostAttribute","getEditedPostPreviewLink","getEditorSettings","getPostType","coreStore","useEffect","sendPostLock","data","lock","post_id","receivePostLock","received","lock_error","name","avatar","avatar_src_2x","new_lock","releasePostLock","window","FormData","append","unlockNonce","navigator","sendBeacon","ajaxUrl","xhr","XMLHttpRequest","open","send","addAction","addEventListener","removeAction","removeEventListener","userDisplayName","userAvatar","unlockUrl","addQueryArgs","lockKey","post","action","_wpnonce","nonce","allPostsUrl","post_type","slug","allPostsLabel","__","jsx","Modal","title","focusOnMount","shouldCloseOnClickOutside","shouldCloseOnEsc","isDismissible","className","size","children","jsxs","__experimentalHStack","alignment","spacing","src","alt","width","height","createInterpolateElement","sprintf","strong","PreviewLink","ExternalLink","href","Fragment","justify","Button","__next40pxDefaultSize","variant"],"sources":["@wordpress/editor/src/components/post-locked-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A modal component that is displayed when a post is locked for editing by another user.\n * The modal provides information about the lock status and options to take over or exit the editor.\n *\n * @return {JSX.Element|null} The rendered PostLockedModal component.\n */\nexport default function PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t\tpreviewLink,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tpreviewLink: getEditedPostPreviewLink(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post' )\n\t\t\t\t\t: __( 'This post is already being edited' )\n\t\t\t}\n\t\t\tfocusOnMount\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\t// Do not remove this class, as this class is used by third party plugins.\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\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'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'\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\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\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\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\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\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\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) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\thref={ unlockUrl }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\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=\"primary\"\n\t\t\t\t\t\t\thref={ allPostsUrl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AApBnD;AACA;AACA;;AAeA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,GACe,SAASU,eAAeA,CAAA,EAAG;EACzC,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEF,eAAgB,CAAC;EACnD,MAAMG,QAAQ,GAAG,gCAAgC,GAAGF,UAAU;EAC9D,MAAM;IAAEG,QAAQ;IAAEC;EAAe,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/D,MAAM;IACLC,QAAQ;IACRC,UAAU;IACVC,IAAI;IACJC,MAAM;IACNC,aAAa;IACbC,cAAc;IACdC,QAAQ;IACRC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,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CAAAqG,YAAY;gBAACC,IAAI,EAAG9E,WAAa;gBAAAgE,QAAA,EAC/B,IAAAV,QAAE,EAAE,SAAU;cAAC,CACJ;YAEhB,CACD;UAAC,CACC,CAAC,eACJ,IAAAtE,WAAA,CAAAuE,GAAA;YAAAS,QAAA,EACG,IAAAV,QAAE,EACH,0GACD;UAAC,CACC,CAAC;QAAA,CACH,CACF,eAED,IAAAtE,WAAA,CAAAiF,IAAA,EAACzF,WAAA,CAAA0F,oBAAM;UACNJ,SAAS,EAAC,mCAAmC;UAC7CkB,OAAO,EAAC,UAAU;UAAAhB,QAAA,GAEhB,CAAEtE,UAAU,iBACb,IAAAV,WAAA,CAAAuE,GAAA,EAAC/E,WAAA,CAAAyG,MAAM;YACNC,qBAAqB;YACrBC,OAAO,EAAC,UAAU;YAClBL,IAAI,EAAGnC,SAAW;YAAAqB,QAAA,EAEhB,IAAAV,QAAE,EAAE,WAAY;UAAC,CACZ,CACR,eACD,IAAAtE,WAAA,CAAAuE,GAAA,EAAC/E,WAAA,CAAAyG,MAAM;YACNC,qBAAqB;YACrBC,OAAO,EAAC,SAAS;YACjBL,IAAI,EAAG5B,WAAa;YAAAc,QAAA,EAElBX;UAAa,CACR,CAAC;QAAA,CACF,CAAC;MAAA,CACL,CAAC;IAAA,CACC;EAAC,CACH,CAAC;AAEV","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
function writeInterstitialMessage(targetDocument) {
|
|
24
|
-
let markup = (0, _element.renderToString)(
|
|
24
|
+
let markup = (0, _element.renderToString)(/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
25
25
|
className: "editor-post-preview-button__interstitial-message",
|
|
26
26
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.SVG, {
|
|
27
27
|
xmlns: "http://www.w3.org/2000/svg",
|