@wordpress/editor 13.33.0 → 13.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +132 -20
- package/build/components/autosave-monitor/index.js +15 -12
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/character-count/index.js +5 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +73 -0
- package/build/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build/components/document-outline/check.js +8 -0
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +11 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +0 -7
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-history/redo.js +11 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +11 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-snackbars/index.js +6 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +7 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +34 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +1 -4
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +59 -0
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/more-menu/index.js +119 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/more-menu/tools-more-menu-group.js +23 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/more-menu/view-more-menu-group.js +24 -0
- package/build/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build/components/page-attributes/check.js +8 -0
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +14 -8
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +1 -1
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -1
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/actions.js +100 -5
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +30 -7
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +6 -0
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +5 -0
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +14 -49
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +72 -0
- package/build/components/post-content-information/index.js.map +1 -0
- package/build/components/post-discussion/panel.js +9 -7
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +0 -19
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +52 -12
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +118 -7
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +2 -2
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/index.js +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-edited-panel/index.js +33 -0
- package/build/components/post-last-edited-panel/index.js.map +1 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-status/index.js +9 -9
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +2 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +0 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -5
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-url/index.js +2 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +8 -2
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +3 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +23 -16
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/save-publish-panels/index.js +89 -0
- package/build/components/save-publish-panels/index.js.map +1 -0
- package/build/components/start-page-options/index.js +5 -1
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/private-apis.js +18 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +15 -13
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/character-count/index.js +6 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +65 -0
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build-module/components/document-outline/check.js +9 -0
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +11 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -8
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-history/redo.js +11 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +11 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +6 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +35 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -5
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/more-menu/index.js +111 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/more-menu/view-more-menu-group.js +17 -0
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build-module/components/page-attributes/check.js +9 -0
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -1
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +100 -6
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +31 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +10 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +6 -0
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +6 -0
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +16 -51
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +66 -0
- package/build-module/components/post-content-information/index.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +8 -6
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +0 -19
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +52 -11
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +118 -8
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +2 -2
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-edited-panel/index.js +26 -0
- package/build-module/components/post-last-edited-panel/index.js.map +1 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-status/index.js +9 -9
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +2 -2
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +0 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +3 -6
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-url/index.js +2 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +8 -2
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +3 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +80 -0
- package/build-module/components/save-publish-panels/index.js.map +1 -0
- package/build-module/components/start-page-options/index.js +5 -1
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/private-apis.js +18 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +207 -30
- package/build-style/style.css +207 -30
- package/package.json +35 -35
- package/src/components/autosave-monitor/index.js +15 -12
- package/src/components/character-count/index.js +5 -0
- package/src/components/collapsible-block-toolbar/index.js +77 -0
- package/src/components/collapsible-block-toolbar/style.scss +80 -0
- package/src/components/document-outline/check.js +8 -0
- package/src/components/document-outline/index.js +10 -0
- package/src/components/document-tools/index.js +0 -5
- package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/src/components/editor-history/redo.js +10 -0
- package/src/components/editor-history/undo.js +10 -0
- package/src/components/editor-snackbars/index.js +5 -0
- package/src/components/entities-saved-states/style.scss +7 -0
- package/src/components/global-keyboard-shortcuts/index.js +7 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +41 -0
- package/src/components/inserter-sidebar/index.js +2 -5
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/list-view-sidebar/index.js +1 -1
- package/src/components/list-view-sidebar/style.scss +2 -2
- package/src/components/more-menu/copy-content-menu-item.js +51 -0
- package/src/components/more-menu/index.js +158 -0
- package/src/components/more-menu/tools-more-menu-group.js +11 -0
- package/src/components/more-menu/view-more-menu-group.js +13 -0
- package/src/components/page-attributes/check.js +8 -0
- package/src/components/page-attributes/order.js +6 -0
- package/src/components/page-attributes/panel.js +21 -17
- package/src/components/page-attributes/parent.js +6 -0
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +1 -1
- package/src/components/post-actions/actions.js +120 -5
- package/src/components/post-actions/index.js +41 -7
- package/src/components/post-author/check.js +9 -0
- package/src/components/post-author/index.js +5 -0
- package/src/components/post-author/panel.js +5 -0
- package/src/components/post-card-panel/index.js +27 -82
- package/src/components/post-card-panel/style.scss +2 -6
- package/src/components/post-content-information/index.js +83 -0
- package/src/components/post-content-information/style.scss +6 -0
- package/src/components/post-discussion/panel.js +24 -20
- package/src/components/post-excerpt/check.js +0 -18
- package/src/components/post-excerpt/index.js +66 -15
- package/src/components/post-excerpt/panel.js +196 -19
- package/src/components/post-excerpt/plugin.js +2 -2
- package/src/components/post-excerpt/style.scss +24 -0
- package/src/components/post-featured-image/index.js +1 -1
- package/src/components/post-featured-image/style.scss +2 -8
- package/src/components/post-last-edited-panel/index.js +35 -0
- package/src/components/post-last-edited-panel/style.scss +6 -0
- package/src/components/post-panel-row/style.scss +3 -3
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
- package/src/components/post-publish-panel/style.scss +43 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-status/index.js +84 -76
- package/src/components/post-status/style.scss +0 -1
- package/src/components/post-template/block-theme.js +2 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/post-template/swap-template-button.js +3 -6
- package/src/components/post-text-editor/style.scss +1 -1
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-url/index.js +1 -0
- package/src/components/post-url/panel.js +1 -1
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +14 -0
- package/src/components/preview-dropdown/index.js +3 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -21
- package/src/components/save-publish-panels/index.js +96 -0
- package/src/components/save-publish-panels/style.scss +36 -0
- package/src/components/start-page-options/index.js +6 -1
- package/src/private-apis.js +18 -2
- package/src/store/selectors.js +3 -1
- package/src/style.scss +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_combobox","_interopRequireDefault","_select","_constants","minimumUsersForCombobox","PostAuthor","showCombobox","useSelect","select","authors","coreStore","getUsers","AUTHORS_QUERY","length","_react","createElement","default","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMM,uBAAuB,GAAG,EAAE;
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_combobox","_interopRequireDefault","_select","_constants","minimumUsersForCombobox","PostAuthor","showCombobox","useSelect","select","authors","coreStore","getUsers","AUTHORS_QUERY","length","_react","createElement","default","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCombobox from './combobox';\nimport PostAuthorSelect from './select';\nimport { AUTHORS_QUERY } from './constants';\n\nconst minimumUsersForCombobox = 25;\n\n/**\n * Renders the component for selecting the post author.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostAuthor() {\n\tconst showCombobox = useSelect( ( select ) => {\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\n\t\treturn authors?.length >= minimumUsersForCombobox;\n\t}, [] );\n\n\tif ( showCombobox ) {\n\t\treturn <PostAuthorCombobox />;\n\t}\n\treturn <PostAuthorSelect />;\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAMM,uBAAuB,GAAG,EAAE;;AAElC;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CAAA,EAAG;EACrB,MAAMC,YAAY,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7C,MAAMC,OAAO,GAAGD,MAAM,CAAEE,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc,CAAC;IAE7D,OAAOH,OAAO,EAAEI,MAAM,IAAIT,uBAAuB;EAClD,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKE,YAAY,EAAG;IACnB,OAAO,IAAAQ,MAAA,CAAAC,aAAA,EAACf,SAAA,CAAAgB,OAAkB,MAAE,CAAC;EAC9B;EACA,OAAO,IAAAF,MAAA,CAAAC,aAAA,EAACb,OAAA,CAAAc,OAAgB,MAAE,CAAC;AAC5B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEcX,UAAU","ignoreList":[]}
|
|
@@ -14,6 +14,11 @@ var _postPanelRow = _interopRequireDefault(require("../post-panel-row"));
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Renders the Post Author Panel component.
|
|
19
|
+
*
|
|
20
|
+
* @return {Component} The component to be rendered.
|
|
21
|
+
*/
|
|
17
22
|
function PostAuthor() {
|
|
18
23
|
return (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_postPanelRow.default, {
|
|
19
24
|
className: "editor-post-author__panel"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_check","_interopRequireDefault","require","_index","_postPanelRow","PostAuthor","_react","createElement","default","className","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\n\nexport function PostAuthor() {\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PostPanelRow className=\"editor-post-author__panel\">\n\t\t\t\t<PostAuthorForm />\n\t\t\t</PostPanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AALA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_check","_interopRequireDefault","require","_index","_postPanelRow","PostAuthor","_react","createElement","default","className","_default","exports"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nexport function PostAuthor() {\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PostPanelRow className=\"editor-post-author__panel\">\n\t\t\t\t<PostAuthorForm />\n\t\t\t</PostPanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAAA,EAAG;EAC5B,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,MAAA,CAAAQ,OAAe,QACf,IAAAF,MAAA,CAAAC,aAAA,EAACH,aAAA,CAAAI,OAAY;IAACC,SAAS,EAAC;EAA2B,GAClD,IAAAH,MAAA,CAAAC,aAAA,EAACJ,MAAA,CAAAK,OAAc,MAAE,CACJ,CACE,CAAC;AAEpB;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcH,UAAU","ignoreList":[]}
|
|
@@ -11,12 +11,11 @@ var _components = require("@wordpress/components");
|
|
|
11
11
|
var _coreData = require("@wordpress/core-data");
|
|
12
12
|
var _data = require("@wordpress/data");
|
|
13
13
|
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
var _date = require("@wordpress/date");
|
|
15
14
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
16
|
-
var _wordcount = require("@wordpress/wordcount");
|
|
17
|
-
var _element = require("@wordpress/element");
|
|
18
15
|
var _store = require("../../store");
|
|
19
16
|
var _constants = require("../../store/constants");
|
|
17
|
+
var _panel = require("../post-excerpt/panel");
|
|
18
|
+
var _postLastEditedPanel = _interopRequireDefault(require("../post-last-edited-panel"));
|
|
20
19
|
var _lockUnlock = require("../../lock-unlock");
|
|
21
20
|
var _templateAreas = _interopRequireDefault(require("../template-areas"));
|
|
22
21
|
/**
|
|
@@ -36,12 +35,10 @@ function PostCardPanel({
|
|
|
36
35
|
actions
|
|
37
36
|
}) {
|
|
38
37
|
const {
|
|
39
|
-
modified,
|
|
40
38
|
title,
|
|
41
|
-
|
|
39
|
+
showPostContentPanels,
|
|
42
40
|
icon,
|
|
43
|
-
postType
|
|
44
|
-
isPostsPage
|
|
41
|
+
postType
|
|
45
42
|
} = (0, _data.useSelect)(select => {
|
|
46
43
|
const {
|
|
47
44
|
getEditedPostAttribute,
|
|
@@ -50,33 +47,28 @@ function PostCardPanel({
|
|
|
50
47
|
__experimentalGetTemplateInfo
|
|
51
48
|
} = select(_store.store);
|
|
52
49
|
const {
|
|
53
|
-
getEditedEntityRecord
|
|
54
|
-
getEntityRecord
|
|
50
|
+
getEditedEntityRecord
|
|
55
51
|
} = select(_coreData.store);
|
|
56
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
57
52
|
const _type = getCurrentPostType();
|
|
58
53
|
const _id = getCurrentPostId();
|
|
59
54
|
const _record = getEditedEntityRecord('postType', _type, _id);
|
|
60
|
-
const _templateInfo = __experimentalGetTemplateInfo(_record);
|
|
55
|
+
const _templateInfo = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(_type) && __experimentalGetTemplateInfo(_record);
|
|
61
56
|
return {
|
|
62
57
|
title: _templateInfo?.title || getEditedPostAttribute('title'),
|
|
63
|
-
modified: getEditedPostAttribute('modified'),
|
|
64
58
|
id: _id,
|
|
65
59
|
postType: _type,
|
|
66
|
-
templateInfo: _templateInfo,
|
|
67
60
|
icon: (0, _lockUnlock.unlock)(select(_store.store)).getPostIcon(_type, {
|
|
68
61
|
area: _record?.area
|
|
69
62
|
}),
|
|
70
|
-
|
|
63
|
+
// Post excerpt panel and Last Edited info are rendered in different place depending on the post type.
|
|
64
|
+
// So we cannot make this check inside the PostExcerpt or PostLastEditedPanel component based on the current edited entity.
|
|
65
|
+
showPostContentPanels: [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.PATTERN_POST_TYPE].includes(_type)
|
|
71
66
|
};
|
|
72
67
|
}, []);
|
|
73
|
-
const description = templateInfo?.description;
|
|
74
|
-
const lastEditedText = modified && (0, _i18n.sprintf)(
|
|
75
|
-
// translators: %s: Human-readable time difference, e.g. "2 days ago".
|
|
76
|
-
(0, _i18n.__)('Last edited %s.'), (0, _date.humanTimeDiff)(modified));
|
|
77
|
-
const showPostContentInfo = !isPostsPage && ![_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType);
|
|
78
68
|
return (0, _react.createElement)(_components.PanelBody, null, (0, _react.createElement)("div", {
|
|
79
|
-
className: (0, _classnames.default)('editor-post-card-panel', className
|
|
69
|
+
className: (0, _classnames.default)('editor-post-card-panel', className, {
|
|
70
|
+
'has-description': showPostContentPanels
|
|
71
|
+
})
|
|
80
72
|
}, (0, _react.createElement)(_components.__experimentalHStack, {
|
|
81
73
|
spacing: 2,
|
|
82
74
|
className: "editor-post-card-panel__header",
|
|
@@ -92,36 +84,9 @@ function PostCardPanel({
|
|
|
92
84
|
as: "h2"
|
|
93
85
|
}, title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No Title')), actions), (0, _react.createElement)(_components.__experimentalVStack, {
|
|
94
86
|
className: "editor-post-card-panel__content"
|
|
95
|
-
},
|
|
87
|
+
}, showPostContentPanels && (0, _react.createElement)(_components.__experimentalVStack, {
|
|
96
88
|
className: "editor-post-card-panel__description",
|
|
97
89
|
spacing: 2
|
|
98
|
-
},
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
102
|
-
const AVERAGE_READING_RATE = 189;
|
|
103
|
-
|
|
104
|
-
// This component renders the wordcount and reading time for the post.
|
|
105
|
-
function PostContentInfo() {
|
|
106
|
-
const postContent = (0, _data.useSelect)(select => select(_store.store).getEditedPostAttribute('content'), []);
|
|
107
|
-
/*
|
|
108
|
-
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
109
|
-
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
110
|
-
* Do not translate into your own language.
|
|
111
|
-
*/
|
|
112
|
-
const wordCountType = (0, _i18n._x)('words', 'Word count type. Do not translate!');
|
|
113
|
-
const wordsCounted = (0, _element.useMemo)(() => postContent ? (0, _wordcount.count)(postContent, wordCountType) : 0, [postContent, wordCountType]);
|
|
114
|
-
if (!wordsCounted) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
|
|
118
|
-
const wordsCountText = (0, _i18n.sprintf)(
|
|
119
|
-
// translators: %s: the number of words in the post.
|
|
120
|
-
(0, _i18n._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString());
|
|
121
|
-
const minutesText = readingTime <= 1 ? (0, _i18n.__)('1 minute') : (0, _i18n.sprintf)(
|
|
122
|
-
// translators: %s: the number of minutes to read the post.
|
|
123
|
-
(0, _i18n._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString());
|
|
124
|
-
return (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.sprintf)( /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
|
|
125
|
-
(0, _i18n.__)('%1$s, %2$s read time.'), wordsCountText, minutesText));
|
|
90
|
+
}, (0, _react.createElement)(_panel.PrivatePostExcerptPanel, null), (0, _react.createElement)(_postLastEditedPanel.default, null)), postType === _constants.TEMPLATE_POST_TYPE && (0, _react.createElement)(_templateAreas.default, null))));
|
|
126
91
|
}
|
|
127
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_coreData","_data","_i18n","_date","_htmlEntities","_wordcount","_element","_store","_constants","_lockUnlock","_templateAreas","PostCardPanel","className","actions","modified","title","templateInfo","icon","postType","isPostsPage","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","editorStore","getEditedEntityRecord","getEntityRecord","coreStore","siteSettings","_type","_id","_record","_templateInfo","id","unlock","getPostIcon","area","page_for_posts","description","lastEditedText","sprintf","__","humanTimeDiff","showPostContentInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","_react","createElement","PanelBody","classnames","__experimentalHStack","spacing","align","Icon","__experimentalText","numberOfLines","truncate","weight","as","decodeEntities","__experimentalVStack","PostContentInfo","default","AVERAGE_READING_RATE","postContent","wordCountType","_x","wordsCounted","useMemo","wordCount","readingTime","Math","round","wordsCountText","_n","toLocaleString","minutesText"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tPanelBody,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\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 TemplateAreas from '../template-areas';\n\nexport default function PostCardPanel( { className, actions } ) {\n\tconst { modified, title, templateInfo, icon, postType, isPostsPage } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\t__experimentalGetTemplateInfo,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getEditedEntityRecord, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst _type = getCurrentPostType();\n\t\t\tconst _id = getCurrentPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', _type, _id );\n\t\t\tconst _templateInfo = __experimentalGetTemplateInfo( _record );\n\t\t\treturn {\n\t\t\t\ttitle:\n\t\t\t\t\t_templateInfo?.title || getEditedPostAttribute( 'title' ),\n\t\t\t\tmodified: getEditedPostAttribute( 'modified' ),\n\t\t\t\tid: _id,\n\t\t\t\tpostType: _type,\n\t\t\t\ttemplateInfo: _templateInfo,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( _type, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisPostsPage: +_id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t}, [] );\n\tconst description = templateInfo?.description;\n\tconst lastEditedText =\n\t\tmodified &&\n\t\tsprintf(\n\t\t\t// translators: %s: Human-readable time difference, e.g. \"2 days ago\".\n\t\t\t__( 'Last edited %s.' ),\n\t\t\thumanTimeDiff( modified )\n\t\t);\n\tconst showPostContentInfo =\n\t\t! isPostsPage &&\n\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( postType );\n\treturn (\n\t\t<PanelBody>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'editor-post-card-panel', className ) }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"editor-post-card-panel__icon\"\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t/>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\t\ttruncate\n\t\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tas=\"h2\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No Title' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\t\t\t\t<VStack className=\"editor-post-card-panel__content\">\n\t\t\t\t\t{ ( description ||\n\t\t\t\t\t\tlastEditedText ||\n\t\t\t\t\t\tshowPostContentInfo ) && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"editor-post-card-panel__description\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ description && <Text>{ description }</Text> }\n\t\t\t\t\t\t\t{ showPostContentInfo && <PostContentInfo /> }\n\t\t\t\t\t\t\t{ lastEditedText && (\n\t\t\t\t\t\t\t\t<Text>{ lastEditedText }</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ postType === TEMPLATE_POST_TYPE && <TemplateAreas /> }\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</PanelBody>\n\t);\n}\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.\nfunction PostContentInfo() {\n\tconst postContent = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\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<Text>\n\t\t\t{ sprintf(\n\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__( '%1$s, %2$s read time.' ),\n\t\t\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aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,MAAQJ,WAAW,GAAG,IAAAK,gBAAS,EAAEL,WAAW,EAAEC,aAAc,CAAC,GAAG,CAAG,EACnE,CAAED,WAAW,EAAEC,aAAa,CAC7B,CAAC;EACD,IAAK,CAAEE,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,MAAMG,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEL,YAAY,GAAGJ,oBAAqB,CAAC;EACrE,MAAMU,cAAc,GAAG,IAAAlC,aAAO;EAC7B;EACA,IAAAmC,QAAE,EAAE,SAAS,EAAE,UAAU,EAAEP,YAAa,CAAC,EACzCA,YAAY,CAACQ,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBN,WAAW,IAAI,CAAC,GACb,IAAA9B,QAAE,EAAE,UAAW,CAAC,GAChB,IAAAD,aAAO;EACP;EACA,IAAAmC,QAAE,EAAE,WAAW,EAAE,YAAY,EAAEJ,WAAY,CAAC,EAC5CA,WAAW,CAACK,cAAc,CAAC,CAC3B,CAAC;EACL,OACC,IAAA7B,MAAA,CAAAC,aAAA,EAACnD,WAAA,CAAA0D,kBAAI,QACF,IAAAf,aAAO,GACR;EACA,IAAAC,QAAE,EAAE,uBAAwB,CAAC,EAC7BiC,cAAc,EACdG,WACD,CACK,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_coreData","_data","_i18n","_htmlEntities","_store","_constants","_panel","_postLastEditedPanel","_lockUnlock","_templateAreas","PostCardPanel","className","actions","title","showPostContentPanels","icon","postType","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","editorStore","getEditedEntityRecord","coreStore","_type","_id","_record","_templateInfo","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","includes","id","unlock","getPostIcon","area","PATTERN_POST_TYPE","_react","createElement","PanelBody","classnames","__experimentalHStack","spacing","align","Icon","__experimentalText","numberOfLines","truncate","weight","as","decodeEntities","__","__experimentalVStack","PrivatePostExcerptPanel","default"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tPanelBody,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { PrivatePostExcerptPanel } from '../post-excerpt/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport { unlock } from '../../lock-unlock';\nimport TemplateAreas from '../template-areas';\n\nexport default function PostCardPanel( { className, actions } ) {\n\tconst { title, showPostContentPanels, icon, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\t__experimentalGetTemplateInfo,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst _type = getCurrentPostType();\n\t\t\tconst _id = getCurrentPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', _type, _id );\n\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\t_type\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\treturn {\n\t\t\t\ttitle:\n\t\t\t\t\t_templateInfo?.title || getEditedPostAttribute( 'title' ),\n\t\t\t\tid: _id,\n\t\t\t\tpostType: _type,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( _type, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\t// Post excerpt panel and Last Edited info are rendered in different place depending on the post type.\n\t\t\t\t// So we cannot make this check inside the PostExcerpt or PostLastEditedPanel component based on the current edited entity.\n\t\t\t\tshowPostContentPanels: [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tPATTERN_POST_TYPE,\n\t\t\t\t].includes( _type ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t<PanelBody>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'editor-post-card-panel', className, {\n\t\t\t\t\t'has-description': showPostContentPanels,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"editor-post-card-panel__icon\"\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t/>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\t\ttruncate\n\t\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tas=\"h2\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No Title' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\t\t\t\t<VStack className=\"editor-post-card-panel__content\">\n\t\t\t\t\t{ showPostContentPanels && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"editor-post-card-panel__description\"\n\t\t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BAA+B;IACzCsC,MAAM,EAAG,GAAK;IACdC,EAAE,EAAC;EAAI,GAELrC,KAAK,GAAG,IAAAsC,4BAAc,EAAEtC,KAAM,CAAC,GAAG,IAAAuC,QAAE,EAAE,UAAW,CAC9C,CAAC,EACLxC,OACK,CAAC,EACT,IAAA0B,MAAA,CAAAC,aAAA,EAACxC,WAAA,CAAAsD,oBAAM;IAAC1C,SAAS,EAAC;EAAiC,GAChDG,qBAAqB,IACtB,IAAAwB,MAAA,CAAAC,aAAA,EAACxC,WAAA,CAAAsD,oBAAM;IACN1C,SAAS,EAAC,qCAAqC;IAC/CgC,OAAO,EAAG;EAAG,GAEb,IAAAL,MAAA,CAAAC,aAAA,EAACjC,MAAA,CAAAgD,uBAAuB,MAAE,CAAC,EAC3B,IAAAhB,MAAA,CAAAC,aAAA,EAAChC,oBAAA,CAAAgD,OAAmB,MAAE,CACf,CACR,EACCvC,QAAQ,KAAKc,6BAAkB,IAAI,IAAAQ,MAAA,CAAAC,aAAA,EAAC9B,cAAA,CAAA8C,OAAa,MAAE,CAC9C,CACJ,CACK,CAAC;AAEd","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = PostContentInformation;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _wordcount = require("@wordpress/wordcount");
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
13
|
+
var _coreData = require("@wordpress/core-data");
|
|
14
|
+
var _store = require("../../store");
|
|
15
|
+
var _constants = require("../../store/constants");
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Internal dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
25
|
+
const AVERAGE_READING_RATE = 189;
|
|
26
|
+
|
|
27
|
+
// This component renders the wordcount and reading time for the post.
|
|
28
|
+
function PostContentInformation() {
|
|
29
|
+
const {
|
|
30
|
+
postContent
|
|
31
|
+
} = (0, _data.useSelect)(select => {
|
|
32
|
+
const {
|
|
33
|
+
getEditedPostAttribute,
|
|
34
|
+
getCurrentPostType,
|
|
35
|
+
getCurrentPostId
|
|
36
|
+
} = select(_store.store);
|
|
37
|
+
const {
|
|
38
|
+
getEntityRecord
|
|
39
|
+
} = select(_coreData.store);
|
|
40
|
+
const siteSettings = getEntityRecord('root', 'site');
|
|
41
|
+
const postType = getCurrentPostType();
|
|
42
|
+
const _id = getCurrentPostId();
|
|
43
|
+
const isPostsPage = +_id === siteSettings?.page_for_posts;
|
|
44
|
+
const showPostContentInfo = !isPostsPage && ![_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType);
|
|
45
|
+
return {
|
|
46
|
+
postContent: showPostContentInfo && getEditedPostAttribute('content')
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
|
|
50
|
+
/*
|
|
51
|
+
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
52
|
+
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
53
|
+
* Do not translate into your own language.
|
|
54
|
+
*/
|
|
55
|
+
const wordCountType = (0, _i18n._x)('words', 'Word count type. Do not translate!');
|
|
56
|
+
const wordsCounted = (0, _element.useMemo)(() => postContent ? (0, _wordcount.count)(postContent, wordCountType) : 0, [postContent, wordCountType]);
|
|
57
|
+
if (!wordsCounted) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
|
|
61
|
+
const wordsCountText = (0, _i18n.sprintf)(
|
|
62
|
+
// translators: %s: the number of words in the post.
|
|
63
|
+
(0, _i18n._n)('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString());
|
|
64
|
+
const minutesText = readingTime <= 1 ? (0, _i18n.__)('1 minute') : (0, _i18n.sprintf)(
|
|
65
|
+
// translators: %s: the number of minutes to read the post.
|
|
66
|
+
(0, _i18n._n)('%s minute', '%s minutes', readingTime), readingTime.toLocaleString());
|
|
67
|
+
return (0, _react.createElement)("div", {
|
|
68
|
+
className: "editor-post-content-information"
|
|
69
|
+
}, (0, _react.createElement)(_components.__experimentalText, null, (0, _i18n.sprintf)( /* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
|
|
70
|
+
(0, _i18n.__)('%1$s, %2$s read time.'), wordsCountText, minutesText)));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_i18n","_wordcount","_element","_coreData","_store","_constants","AVERAGE_READING_RATE","PostContentInformation","postContent","useSelect","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","editorStore","getEntityRecord","coreStore","siteSettings","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","__","_react","createElement","className","__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 { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\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;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAOA;AACA,MAAMQ,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;IAAgB,CAAC,GAAGL,MAAM,CAAEM,eAAU,CAAC;IAC/C,MAAMC,YAAY,GAAGF,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC;IACtD,MAAMG,QAAQ,GAAGN,kBAAkB,CAAC,CAAC;IACrC,MAAMO,GAAG,GAAGN,gBAAgB,CAAC,CAAC;IAC9B,MAAMO,WAAW,GAAG,CAACD,GAAG,KAAKF,YAAY,EAAEI,cAAc;IACzD,MAAMC,mBAAmB,GACxB,CAAEF,WAAW,IACb,CAAE,CAAEG,6BAAkB,EAAEC,kCAAuB,CAAE,CAACC,QAAQ,CACzDP,QACD,CAAC;IACF,OAAO;MACNV,WAAW,EACVc,mBAAmB,IAAIX,sBAAsB,CAAE,SAAU;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;AACD;AACA;AACA;AACA;EACC,MAAMe,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,MAAQrB,WAAW,GAAG,IAAAsB,gBAAS,EAAEtB,WAAW,EAAEkB,aAAc,CAAC,GAAG,CAAG,EACnE,CAAElB,WAAW,EAAEkB,aAAa,CAC7B,CAAC;EACD,IAAK,CAAEE,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,MAAMG,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEL,YAAY,GAAGtB,oBAAqB,CAAC;EACrE,MAAM4B,cAAc,GAAG,IAAAC,aAAO;EAC7B;EACA,IAAAC,QAAE,EAAE,SAAS,EAAE,UAAU,EAAER,YAAa,CAAC,EACzCA,YAAY,CAACS,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBP,WAAW,IAAI,CAAC,GACb,IAAAQ,QAAE,EAAE,UAAW,CAAC,GAChB,IAAAJ,aAAO;EACP;EACA,IAAAC,QAAE,EAAE,WAAW,EAAE,YAAY,EAAEL,WAAY,CAAC,EAC5CA,WAAW,CAACM,cAAc,CAAC,CAC3B,CAAC;EACL,OACC,IAAAG,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAiC,GAC/C,IAAAF,MAAA,CAAAC,aAAA,EAAC5C,WAAA,CAAA8C,kBAAI,QACF,IAAAR,aAAO,GACR;EACA,IAAAI,QAAE,EAAE,uBAAwB,CAAC,EAC7BL,cAAc,EACdI,WACD,CACK,CACF,CAAC;AAER","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default =
|
|
7
|
+
exports.default = PostDiscussionPanel;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _i18n = require("@wordpress/i18n");
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
@@ -22,7 +22,7 @@ var _postPingbacks = _interopRequireDefault(require("../post-pingbacks"));
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
const PANEL_NAME = 'discussion-panel';
|
|
25
|
-
function
|
|
25
|
+
function DiscussionPanel() {
|
|
26
26
|
const {
|
|
27
27
|
isEnabled,
|
|
28
28
|
isOpened
|
|
@@ -42,9 +42,7 @@ function PostDiscussionPanel() {
|
|
|
42
42
|
if (!isEnabled) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
|
-
return (0, _react.createElement)(
|
|
46
|
-
supportKeys: ['comments', 'trackbacks']
|
|
47
|
-
}, (0, _react.createElement)(_components.PanelBody, {
|
|
45
|
+
return (0, _react.createElement)(_components.PanelBody, {
|
|
48
46
|
title: (0, _i18n.__)('Discussion'),
|
|
49
47
|
opened: isOpened,
|
|
50
48
|
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
@@ -52,7 +50,11 @@ function PostDiscussionPanel() {
|
|
|
52
50
|
supportKeys: "comments"
|
|
53
51
|
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_postComments.default, null))), (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
54
52
|
supportKeys: "trackbacks"
|
|
55
|
-
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_postPingbacks.default, null))))
|
|
53
|
+
}, (0, _react.createElement)(_components.PanelRow, null, (0, _react.createElement)(_postPingbacks.default, null))));
|
|
54
|
+
}
|
|
55
|
+
function PostDiscussionPanel() {
|
|
56
|
+
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
57
|
+
supportKeys: ['comments', 'trackbacks']
|
|
58
|
+
}, (0, _react.createElement)(DiscussionPanel, null));
|
|
56
59
|
}
|
|
57
|
-
var _default = exports.default = PostDiscussionPanel;
|
|
58
60
|
//# sourceMappingURL=panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_store","_postTypeSupportCheck","_interopRequireDefault","_postComments","_postPingbacks","PANEL_NAME","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_store","_postTypeSupportCheck","_interopRequireDefault","_postComments","_postPingbacks","PANEL_NAME","DiscussionPanel","isEnabled","isOpened","useSelect","select","isEditorPanelEnabled","isEditorPanelOpened","editorStore","toggleEditorPanelOpened","useDispatch","_react","createElement","PanelBody","title","__","opened","onToggle","default","supportKeys","PanelRow","PostDiscussionPanel"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction DiscussionPanel() {\n\tconst { isEnabled, isOpened } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }\n\t\t>\n\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<PostComments />\n\t\t\t\t</PanelRow>\n\t\t\t</PostTypeSupportCheck>\n\n\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<PostPingbacks />\n\t\t\t\t</PanelRow>\n\t\t\t</PostTypeSupportCheck>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function PostDiscussionPanel() {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<DiscussionPanel />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,aAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,cAAA,GAAAF,sBAAA,CAAAL,OAAA;AAbA;AACA;AACA;;AAKA;AACA;AACA;;AAMA,MAAMQ,UAAU,GAAG,kBAAkB;AAErC,SAASC,eAAeA,CAAA,EAAG;EAC1B,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxD,MAAM;MAAEC,oBAAoB;MAAEC;IAAoB,CAAC,GAClDF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNN,SAAS,EAAEI,oBAAoB,CAAEN,UAAW,CAAC;MAC7CG,QAAQ,EAAEI,mBAAmB,CAAEP,UAAW;IAC3C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAES;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEF,YAAY,CAAC;EAE9D,IAAK,CAAEN,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAoB,SAAS;IACTC,KAAK,EAAG,IAAAC,QAAE,EAAE,YAAa,CAAG;IAC5BC,MAAM,EAAGb,QAAU;IACnBc,QAAQ,EAAGA,CAAA,KAAMR,uBAAuB,CAAET,UAAW;EAAG,GAExD,IAAAW,MAAA,CAAAC,aAAA,EAAChB,qBAAA,CAAAsB,OAAoB;IAACC,WAAW,EAAC;EAAU,GAC3C,IAAAR,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAA2B,QAAQ,QACR,IAAAT,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAAoB,OAAY,MAAE,CACN,CACW,CAAC,EAEvB,IAAAP,MAAA,CAAAC,aAAA,EAAChB,qBAAA,CAAAsB,OAAoB;IAACC,WAAW,EAAC;EAAY,GAC7C,IAAAR,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAA2B,QAAQ,QACR,IAAAT,MAAA,CAAAC,aAAA,EAACb,cAAA,CAAAmB,OAAa,MAAE,CACP,CACW,CACZ,CAAC;AAEd;AAEe,SAASG,mBAAmBA,CAAA,EAAG;EAC7C,OACC,IAAAV,MAAA,CAAAC,aAAA,EAAChB,qBAAA,CAAAsB,OAAoB;IAACC,WAAW,EAAG,CAAE,UAAU,EAAE,YAAY;EAAI,GACjE,IAAAR,MAAA,CAAAC,aAAA,EAACX,eAAe,MAAE,CACG,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -6,13 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
9
|
var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
|
|
11
|
-
var _store = require("../../store");
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
10
|
/**
|
|
17
11
|
* Internal dependencies
|
|
18
12
|
*/
|
|
@@ -28,19 +22,6 @@ var _store = require("../../store");
|
|
|
28
22
|
function PostExcerptCheck({
|
|
29
23
|
children
|
|
30
24
|
}) {
|
|
31
|
-
const postType = (0, _data.useSelect)(select => {
|
|
32
|
-
const {
|
|
33
|
-
getEditedPostAttribute
|
|
34
|
-
} = select(_store.store);
|
|
35
|
-
return getEditedPostAttribute('type');
|
|
36
|
-
}, []);
|
|
37
|
-
|
|
38
|
-
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
39
|
-
// support the excerpt field throught the "description" field rather than "excerpt" which means
|
|
40
|
-
// the default ExcerptPanel won't work for these.
|
|
41
|
-
if (['wp_template', 'wp_template_part'].includes(postType)) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
25
|
return (0, _react.createElement)(_postTypeSupportCheck.default, {
|
|
45
26
|
supportKeys: "excerpt"
|
|
46
27
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_postTypeSupportCheck","_interopRequireDefault","require","PostExcerptCheck","children","_react","createElement","default","supportKeys","_default","exports"],"sources":["@wordpress/editor/src/components/post-excerpt/check.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\n\n/**\n * Component for checking if the post type supports the excerpt field.\n *\n * @param {Object} props Props.\n * @param {Element} props.children Children to be rendered.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostExcerptCheck( { children } ) {\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"excerpt\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nexport default PostExcerptCheck;\n"],"mappings":";;;;;;;;AAGA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACN,qBAAA,CAAAO,OAAoB;IAACC,WAAW,EAAC;EAAS,GACxCJ,QACmB,CAAC;AAEzB;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcJ,gBAAgB","ignoreList":[]}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = PostExcerpt;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
|
+
var _element = require("@wordpress/element");
|
|
11
12
|
var _store = require("../../store");
|
|
12
13
|
/**
|
|
13
14
|
* WordPress dependencies
|
|
@@ -17,24 +18,63 @@ var _store = require("../../store");
|
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Renders an editable textarea for the post excerpt.
|
|
23
|
+
* Templates, template parts and patterns use the `excerpt` field as a description semantically.
|
|
24
|
+
* Additionally templates and template parts override the `excerpt` field as `description` in
|
|
25
|
+
* REST API. So this component handles proper labeling and updating the edited entity.
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} props - Component props.
|
|
28
|
+
* @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label.
|
|
29
|
+
* @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur.
|
|
30
|
+
*/
|
|
31
|
+
function PostExcerpt({
|
|
32
|
+
hideLabelFromVision = false,
|
|
33
|
+
updateOnBlur = false
|
|
34
|
+
}) {
|
|
35
|
+
const {
|
|
36
|
+
excerpt,
|
|
37
|
+
shouldUseDescriptionLabel,
|
|
38
|
+
usedAttribute
|
|
39
|
+
} = (0, _data.useSelect)(select => {
|
|
40
|
+
const {
|
|
41
|
+
getCurrentPostType,
|
|
42
|
+
getEditedPostAttribute
|
|
43
|
+
} = select(_store.store);
|
|
44
|
+
const postType = getCurrentPostType();
|
|
45
|
+
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
46
|
+
// support the excerpt field throught the "description" field rather than "excerpt".
|
|
47
|
+
const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt';
|
|
48
|
+
return {
|
|
49
|
+
excerpt: getEditedPostAttribute(_usedAttribute),
|
|
50
|
+
// There are special cases where we want to label the excerpt as a description.
|
|
51
|
+
shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType),
|
|
52
|
+
usedAttribute: _usedAttribute
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
22
55
|
const {
|
|
23
56
|
editPost
|
|
24
57
|
} = (0, _data.useDispatch)(_store.store);
|
|
58
|
+
const [localExcerpt, setLocalExcerpt] = (0, _element.useState)(excerpt);
|
|
59
|
+
const updatePost = value => {
|
|
60
|
+
editPost({
|
|
61
|
+
[usedAttribute]: value
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const label = shouldUseDescriptionLabel ? (0, _i18n.__)('Write a description (optional)') : (0, _i18n.__)('Write an excerpt (optional)');
|
|
25
65
|
return (0, _react.createElement)("div", {
|
|
26
66
|
className: "editor-post-excerpt"
|
|
27
67
|
}, (0, _react.createElement)(_components.TextareaControl, {
|
|
28
68
|
__nextHasNoMarginBottom: true,
|
|
29
|
-
label:
|
|
69
|
+
label: label,
|
|
70
|
+
hideLabelFromVision: hideLabelFromVision,
|
|
30
71
|
className: "editor-post-excerpt__textarea",
|
|
31
|
-
onChange:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
72
|
+
onChange: updateOnBlur ? setLocalExcerpt : updatePost,
|
|
73
|
+
onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined,
|
|
74
|
+
value: updateOnBlur ? localExcerpt : excerpt,
|
|
75
|
+
help: !shouldUseDescriptionLabel ? (0, _react.createElement)(_components.ExternalLink, {
|
|
76
|
+
href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt')
|
|
77
|
+
}, (0, _i18n.__)('Learn more about manual excerpts')) : (0, _i18n.__)('Write a description')
|
|
78
|
+
}));
|
|
38
79
|
}
|
|
39
|
-
var _default = exports.default = PostExcerpt;
|
|
40
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_store","PostExcerpt","excerpt","useSelect","select","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_element","_store","PostExcerpt","hideLabelFromVision","updateOnBlur","excerpt","shouldUseDescriptionLabel","usedAttribute","useSelect","select","getCurrentPostType","getEditedPostAttribute","editorStore","postType","_usedAttribute","includes","editPost","useDispatch","localExcerpt","setLocalExcerpt","useState","updatePost","value","label","__","_react","createElement","className","TextareaControl","__nextHasNoMarginBottom","onChange","onBlur","undefined","help","ExternalLink","href"],"sources":["@wordpress/editor/src/components/post-excerpt/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ExternalLink, TextareaControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders an editable textarea for the post excerpt.\n * Templates, template parts and patterns use the `excerpt` field as a description semantically.\n * Additionally templates and template parts override the `excerpt` field as `description` in\n * REST API. So this component handles proper labeling and updating the edited entity.\n *\n * @param {Object} props - Component props.\n * @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label.\n * @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur.\n */\nexport default function PostExcerpt( {\n\thideLabelFromVision = false,\n\tupdateOnBlur = false,\n} ) {\n\tconst { excerpt, shouldUseDescriptionLabel, usedAttribute } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst postType = getCurrentPostType();\n\t\t\t// This special case is unfortunate, but the REST API of wp_template and wp_template_part\n\t\t\t// support the excerpt field throught the \"description\" field rather than \"excerpt\".\n\t\t\tconst _usedAttribute = [\n\t\t\t\t'wp_template',\n\t\t\t\t'wp_template_part',\n\t\t\t].includes( postType )\n\t\t\t\t? 'description'\n\t\t\t\t: 'excerpt';\n\t\t\treturn {\n\t\t\t\texcerpt: getEditedPostAttribute( _usedAttribute ),\n\t\t\t\t// There are special cases where we want to label the excerpt as a description.\n\t\t\t\tshouldUseDescriptionLabel: [\n\t\t\t\t\t'wp_template',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t'wp_block',\n\t\t\t\t].includes( postType ),\n\t\t\t\tusedAttribute: _usedAttribute,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ localExcerpt, setLocalExcerpt ] = useState( excerpt );\n\tconst updatePost = ( value ) => {\n\t\teditPost( { [ usedAttribute ]: value } );\n\t};\n\tconst label = shouldUseDescriptionLabel\n\t\t? __( 'Write a description (optional)' )\n\t\t: __( 'Write an excerpt (optional)' );\n\n\treturn (\n\t\t<div className=\"editor-post-excerpt\">\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tclassName=\"editor-post-excerpt__textarea\"\n\t\t\t\tonChange={ updateOnBlur ? setLocalExcerpt : updatePost }\n\t\t\t\tonBlur={\n\t\t\t\t\tupdateOnBlur ? () => updatePost( localExcerpt ) : undefined\n\t\t\t\t}\n\t\t\t\tvalue={ updateOnBlur ? localExcerpt : excerpt }\n\t\t\t\thelp={\n\t\t\t\t\t! shouldUseDescriptionLabel ? (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about manual excerpts' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'Write a description' )\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASK,WAAWA,CAAE;EACpCC,mBAAmB,GAAG,KAAK;EAC3BC,YAAY,GAAG;AAChB,CAAC,EAAG;EACH,MAAM;IAAEC,OAAO;IAAEC,yBAAyB;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EACpEC,MAAM,IAAM;IACb,MAAM;MAAEC,kBAAkB;MAAEC;IAAuB,CAAC,GACnDF,MAAM,CAAEG,YAAY,CAAC;IACtB,MAAMC,QAAQ,GAAGH,kBAAkB,CAAC,CAAC;IACrC;IACA;IACA,MAAMI,cAAc,GAAG,CACtB,aAAa,EACb,kBAAkB,CAClB,CAACC,QAAQ,CAAEF,QAAS,CAAC,GACnB,aAAa,GACb,SAAS;IACZ,OAAO;MACNR,OAAO,EAAEM,sBAAsB,CAAEG,cAAe,CAAC;MACjD;MACAR,yBAAyB,EAAE,CAC1B,aAAa,EACb,kBAAkB,EAClB,UAAU,CACV,CAACS,QAAQ,CAAEF,QAAS,CAAC;MACtB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