@wordpress/editor 14.10.0 → 14.12.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 -10
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +119 -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 +274 -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 +148 -40
- package/build/components/commands/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/document-bar/index.js +17 -10
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-tools/index.js +7 -7
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-interface/index.js +4 -4
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/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 +25 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +12 -11
- 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/more-menu/index.js +9 -7
- package/build/components/more-menu/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-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 +1 -2
- 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-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-schedule/label.js +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +11 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +0 -3
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-transform-panel/index.js +0 -3
- package/build/components/post-transform-panel/index.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +3 -3
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +26 -22
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +23 -8
- 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 +11 -10
- package/build/components/provider/use-block-editor-settings.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/sidebar/post-summary.js +2 -2
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/start-page-options/index.js +0 -3
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +0 -3
- package/build/components/start-template-options/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/index.js +30 -29
- package/build/components/visual-editor/index.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 +2 -2
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build/store/actions.js +68 -18
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +0 -2
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +0 -4
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +2 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +5 -4
- package/build/store/selectors.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/post-meta.js +2 -1
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +113 -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 +266 -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/commands/index.js +151 -44
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +19 -12
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +8 -8
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +4 -4
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/entities-saved-states/index.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 +25 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +12 -11
- 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/more-menu/index.js +9 -7
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -5
- package/build-module/components/page-attributes/parent.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 +5 -5
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +4 -4
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +8 -36
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +1 -2
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +26 -7
- package/build-module/components/post-featured-image/index.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-schedule/label.js +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +14 -4
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +0 -3
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-transform-panel/index.js +0 -3
- package/build-module/components/post-transform-panel/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +3 -3
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +26 -22
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +24 -9
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +10 -12
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +12 -11
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/header.js +2 -1
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +2 -2
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/start-page-options/index.js +0 -3
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +0 -3
- package/build-module/components/start-template-options/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/index.js +31 -30
- package/build-module/components/visual-editor/index.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 +3 -3
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build-module/store/actions.js +64 -16
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -2
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +0 -4
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +3 -3
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +5 -4
- package/build-module/store/selectors.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 +118 -60
- package/build-style/style.css +118 -60
- 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/create-template-part-modal/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/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts +1 -2
- 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/more-menu/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-template/hooks.d.ts +2 -2
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
- package/build-types/components/post-transform-panel/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.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/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.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/dataviews/store/reducer.d.ts +5 -2
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +2 -2
- package/build-types/store/actions.d.ts +9 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +0 -2
- package/build-types/store/constants.d.ts.map +1 -1
- package/build-types/store/index.d.ts +9 -11
- package/build-types/store/index.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +24 -4
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +3 -3
- 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 -37
- package/src/bindings/post-meta.js +1 -0
- package/src/components/collab-sidebar/add-comment.js +121 -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 +298 -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 +390 -268
- package/src/components/create-template-part-modal/index.js +1 -0
- package/src/components/document-bar/index.js +25 -8
- package/src/components/document-bar/style.scss +13 -4
- package/src/components/document-tools/index.js +8 -8
- package/src/components/editor-interface/index.js +4 -4
- 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 +32 -6
- package/src/components/header/index.js +20 -10
- package/src/components/inserter-sidebar/index.js +3 -6
- package/src/components/more-menu/index.js +12 -7
- package/src/components/page-attributes/parent.js +6 -4
- package/src/components/plugin-more-menu-item/index.js +12 -11
- package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- 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-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 +2 -2
- package/src/components/post-template/swap-template-button.js +0 -3
- package/src/components/post-transform-panel/index.js +0 -3
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-url/panel.js +4 -2
- package/src/components/preferences-modal/index.js +26 -19
- package/src/components/preferences-modal/test/index.js +1 -1
- package/src/components/preview-dropdown/index.js +45 -18
- package/src/components/provider/index.js +31 -24
- package/src/components/provider/use-block-editor-settings.js +11 -10
- package/src/components/sidebar/header.js +3 -2
- package/src/components/sidebar/index.js +5 -3
- package/src/components/sidebar/post-summary.js +1 -1
- package/src/components/sidebar/style.scss +1 -3
- package/src/components/start-page-options/index.js +0 -3
- package/src/components/start-template-options/index.js +0 -3
- package/src/components/time-to-read/index.js +3 -3
- package/src/components/visual-editor/index.js +39 -42
- package/src/components/visual-editor/style.scss +11 -0
- 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/store/actions.js +113 -34
- package/src/store/constants.ts +0 -2
- package/src/store/index.js +0 -4
- package/src/store/private-actions.js +3 -3
- package/src/store/selectors.js +5 -4
- 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
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = PluginSidebar;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
7
|
var _interface = require("@wordpress/interface");
|
|
10
|
-
var _store = require("../../store");
|
|
11
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
9
|
/**
|
|
13
10
|
* WordPress dependencies
|
|
14
11
|
*/
|
|
15
12
|
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
22
15
|
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
@@ -85,17 +78,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
85
78
|
className,
|
|
86
79
|
...props
|
|
87
80
|
}) {
|
|
88
|
-
const {
|
|
89
|
-
postTitle
|
|
90
|
-
} = (0, _data.useSelect)(select => {
|
|
91
|
-
return {
|
|
92
|
-
postTitle: select(_store.store).getEditedPostAttribute('title')
|
|
93
|
-
};
|
|
94
|
-
}, []);
|
|
95
81
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.ComplementaryArea, {
|
|
96
82
|
panelClassName: className,
|
|
97
83
|
className: "editor-sidebar",
|
|
98
|
-
smallScreenTitle: postTitle || (0, _i18n.__)('(no title)'),
|
|
99
84
|
scope: "core",
|
|
100
85
|
...props
|
|
101
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_interface","require","_jsxRuntime","PluginSidebar","className","props","jsx","ComplementaryArea","panelClassName","scope"],"sources":["@wordpress/editor/src/components/plugin-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = React.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editor.PluginSidebar;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/editor';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebar( { className, ...props } ) {\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"editor-sidebar\"\n\t\t\tscope=\"core\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAAyD,IAAAC,WAAA,GAAAD,OAAA;AAHzD;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASE,aAAaA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EAChE,oBACC,IAAAH,WAAA,CAAAI,GAAA,EAACN,UAAA,CAAAO,iBAAiB;IACjBC,cAAc,EAAGJ,SAAW;IAC5BA,SAAS,EAAC,gBAAgB;IAC1BK,KAAK,EAAC,MAAM;IAAA,GACPJ;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
const {
|
|
25
|
-
|
|
25
|
+
Menu,
|
|
26
26
|
kebabCase
|
|
27
27
|
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
28
28
|
function PostActions({
|
|
@@ -59,7 +59,7 @@ function PostActions({
|
|
|
59
59
|
return !action.isEligible || action.isEligible(itemWithPermissions);
|
|
60
60
|
});
|
|
61
61
|
}, [allActions, itemWithPermissions]);
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu, {
|
|
63
63
|
open: isActionsMenuOpen,
|
|
64
64
|
trigger: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
65
65
|
size: "small",
|
|
@@ -94,10 +94,10 @@ function DropdownMenuItemTrigger({
|
|
|
94
94
|
items
|
|
95
95
|
}) {
|
|
96
96
|
const label = typeof action.label === 'string' ? action.label : action.label(items);
|
|
97
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
97
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Item, {
|
|
98
98
|
onClick: onClick,
|
|
99
99
|
hideOnClick: !action.RenderModal,
|
|
100
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
100
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemLabel, {
|
|
101
101
|
children: label
|
|
102
102
|
})
|
|
103
103
|
});
|
|
@@ -151,7 +151,7 @@ function ActionsDropdownMenuGroup({
|
|
|
151
151
|
item,
|
|
152
152
|
onClose
|
|
153
153
|
}) {
|
|
154
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
154
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Group, {
|
|
155
155
|
children: actions.map(action => {
|
|
156
156
|
if (action.RenderModal) {
|
|
157
157
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionWithModal, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","DropdownMenuV2","kebabCase","unlock","componentsPrivateApis","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","useState","item","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","itemWithPermissions","useMemo","allActions","usePostActions","actions","filter","action","isEligible","jsx","open","trigger","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","Item","hideOnClick","RenderModal","ItemLabel","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","jsxs","Fragment","Modal","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { DropdownMenuV2, kebabCase } = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<DropdownMenuV2\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenuV2>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuV2.Item\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuV2.ItemLabel>{ label }</DropdownMenuV2.ItemLabel>\n\t\t</DropdownMenuV2.Item>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuV2.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuV2.Group>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAlB3C;AACA;AACA;;AAYA;AACA;AACA;;AAIA,MAAM;EAAES,cAAc;EAAEC;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEtD,SAASC,WAAWA,CAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAG;EAC9E,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,I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AAA,EAACyB,eAAe;UAEf3B,MAAM,EAAGA,MAAQ;UACjBb,IAAI,EAAGA,IAAM;UACbyC,aAAa,EAAGP,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbpB,MAAM,CAACyC,EAKb,CAAC;MAEJ;MACA,oBACC,IAAAlE,WAAA,CAAA2B,GAAA,EAACmB,uBAAuB;QAEvBrB,MAAM,EAAGA,MAAQ;QACjBe,OAAO,EAAGA,CAAA,KAAMf,MAAM,CAAC8C,QAAQ,CAAE,CAAE3D,IAAI,CAAG,CAAG;QAC7CmC,KAAK,EAAG,CAAEnC,IAAI;MAAI,GAHZa,MAAM,CAACyC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACkB,CAAC;AAEzB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","Menu","kebabCase","unlock","componentsPrivateApis","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","useState","item","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","itemWithPermissions","useMemo","allActions","usePostActions","actions","filter","action","isEligible","jsx","open","trigger","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","Item","hideOnClick","RenderModal","ItemLabel","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","jsxs","Fragment","Modal","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<Menu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</Menu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item onClick={ onClick } hideOnClick={ ! action.RenderModal }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Menu.Group>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAlB3C;AACA;AACA;;AAYA;AACA;AACA;;AAIA,MAAM;EAAES,IAAI;EAAEC;AAAU,CAAC,GAA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AA,EAAC1B,IAAI,CAACoE,KAAK;IAAA1B,QAAA,EACRpB,OAAO,CAAC+C,GAAG,CAAI7C,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACyB,WAAW,EAAG;QACzB,oBACC,IAAAlD,WAAA,CAAA2B,GAAA,EAACyB,eAAe;UAEf3B,MAAM,EAAGA,MAAQ;UACjBb,IAAI,EAAGA,IAAM;UACbyC,aAAa,EAAGP,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbpB,MAAM,CAACyC,EAKb,CAAC;MAEJ;MACA,oBACC,IAAAlE,WAAA,CAAA2B,GAAA,EAACmB,uBAAuB;QAEvBrB,MAAM,EAAGA,MAAQ;QACjBe,OAAO,EAAGA,CAAA,KAAMf,MAAM,CAAC8C,QAAQ,CAAE,CAAE3D,IAAI,CAAG,CAAG;QAC7CmC,KAAK,EAAG,CAAEnC,IAAI;MAAI,GAHZa,MAAM,CAACyC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACQ,CAAC;AAEf","ignoreList":[]}
|
|
@@ -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,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,IAAA;UAAKxB,SAAS,EAAC,oBAAoB;UAAAG,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,CA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AAA,CAAA2C,kBAAI;QACJC,aAAa,EAAG,CAAG;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,8 +67,7 @@ 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",
|
|
@@ -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,kBAAkB;MAAEC;IAAiB,CAAC,GACrEH,MAAM,CAAEI,YAAY,CAAC;IACtB,MAAM;MAAEC;IAAQ,CAAC,GAAGL,MAAM,CAAEM,eAAU,CAAC;IACvC,MAAM;MAAEC;IAAgB,CAAC,GAAGP,MAAM,CAAEM,eAAU,CAAC;IAC/C,MAAME,YAAY,GAAGH,OAAO,CAAE,MAA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Y,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,IAAAW,MAAA,GAAAX,OAAA;AAAmD,IAAAY,WAAA,GAAAZ,OAAA;AA5BnD;AACA;AACA;;AAsBA;AACA;AACA;;AAIA,MAAMa,mBAAmB,GAAG,CAAE,OAAO,CAAE;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAC;AAC1D,MAAMC,+BAA+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D,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;;AAEvC;AACA,MAAMC,2BAA2B,GAAG,IAAAC,QAAE,EAAE,gBAAiB,CAAC;AAC1D,MAAMC,+BAA+B,GAAG,IAAAD,QAAE,EAAE,sBAAuB,CAAC;AAEpE,MAAME,YAAY,gBACjB,IAAAL,WAAA,CAAAM,GAAA;EAAAC,QAAA,EACG,IAAAJ,QAAE,EACH,kEACD;AAAC,CACC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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":[]}
|
|
@@ -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)(/* translators: %s: number of revisions */
|
|
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,EACb;MACA,IAAAC,QAAE,EAAE,gBAAiB,CAAC,EACtBhB,cACD;IAAG,CACH;EAAC,CACoB,CAAC;AAE1B;AAEO,SAASiB,uBAAuBA,CAAA,EAAG;EACzC,MAAM;IAAElB,cAAc;IAAEC;EAAe,CAAC,GAAGP,uBAAuB,CAAC,CAAC;EACpE,oBACC,IAAAD,WAAA,CAAAU,GAAA,EAACd,MAAA,CAAAe,OAAqB;IAAAC,QAAA,eACrB,IAAAZ,WAAA,CAAAU,GAAA,EAACZ,aAAA,CAAAa,OAAY;MAACe,KAAK,EAAG,IAAAF,QAAE,EAAE,WAAY,CAAG;MAAAZ,QAAA,eACxC,IAAAZ,WAAA,CAAAU,GAAA,EAAClB,WAAA,CAAAqB,MAAM;QACNE,IAAI,EAAG,IAAAC,iBAAY,EAAE,cAAc,EAAE;UACpCC,QAAQ,EAAEV;QACX,CAAE,CAAG;QACLW,SAAS,EAAC,2CAA2C;QACrDI,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":[]}
|
|
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,EACb;MACA,IAAAC,QAAE,EAAE,gBAAiB,CAAC,EACtBhB,cACD;IAAG,CACH;EAAC,CACoB,CAAC;AAE1B;AAEO,SAASiB,uBAAuBA,CAAA,EAAG;EACzC,MAAM;IAAElB,cAAc;IAAEC;EAAe,CAAC,GAAGP,uBAAuB,CAAC,CAAC;EACpE,oBACC,IAAAD,WAAA,CAAAU,GAAA,EAACd,MAAA,CAAAe,OAAqB;IAAAC,QAAA,eACrB,IAAAZ,WAAA,CAAAU,GAAA,EAACZ,aAAA,CAAAa,OAAY;MAACe,KAAK,EAAG,IAAAF,QAAE,EAAE,WAAY,CAAG;MAAAZ,QAAA,eACxC,IAAAZ,WAAA,CAAAU,GAAA,EAAClB,WAAA,CAAAqB,MAAM;QACNE,IAAI,EAAG,IAAAC,iBAAY,EAAE,cAAc,EAAE;UACpCC,QAAQ,EAAEV;QACX,CAAE,CAAG;QACLW,SAAS,EAAC,2CAA2C;QACrDI,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":[]}
|
|
@@ -56,7 +56,7 @@ function getFullPostScheduleLabel(dateAttribute) {
|
|
|
56
56
|
const date = (0, _date.getDate)(dateAttribute);
|
|
57
57
|
const timezoneAbbreviation = getTimezoneAbbreviation();
|
|
58
58
|
const formattedDate = (0, _date.dateI18n)(
|
|
59
|
-
// translators:
|
|
59
|
+
// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
|
|
60
60
|
(0, _i18n._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
|
|
61
61
|
return (0, _i18n.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
|
|
62
62
|
}
|