@wordpress/editor 13.32.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 +4 -0
- package/README.md +355 -20
- package/build/bindings/index.js.map +1 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +12 -30
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/index.js.map +1 -1
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/autosave-monitor/index.js +24 -11
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-removal-warnings/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.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/commands/index.js +19 -0
- package/build/components/commands/index.js.map +1 -1
- package/build/components/commands/index.native.js.map +1 -1
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/document-bar/index.js.map +1 -1
- 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-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +1 -8
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +13 -2
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +2 -2
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.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-notices/index.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/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/index.native.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +31 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +52 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +33 -1
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.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 +82 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +49 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +126 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +55 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/mode-switcher/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/offline-status/index.native.js.map +1 -1
- 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/pattern-overrides-panel/index.js.map +1 -1
- package/build/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +78 -0
- package/build/components/plugin-more-menu-item/index.js.map +1 -0
- 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-post-status-info/index.js +73 -0
- package/build/components/plugin-post-status-info/index.js.map +1 -0
- 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 +108 -0
- package/build/components/plugin-sidebar/index.js.map +1 -0
- package/build/components/plugin-sidebar-more-menu-item/index.js +71 -0
- package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/post-actions/actions.js +316 -20
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +160 -0
- package/build/components/post-actions/index.js.map +1 -0
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/constants.js.map +1 -1
- package/build/components/post-author/hook.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-author/select.js.map +1 -1
- package/build/components/post-card-panel/index.js +14 -15
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/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 +7 -18
- 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/check.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-featured-image/panel.js.map +1 -1
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/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-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-last-revision/panel.js.map +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +31 -31
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +51 -43
- package/build/components/post-publish-button/label.js.map +1 -1
- 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-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +10 -6
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-schedule/panel.js +9 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +43 -68
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-status/index.js +239 -0
- package/build/components/post-status/index.js.map +1 -0
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +6 -1
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/block-theme.js +8 -4
- 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/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-template/reset-default-template.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-text-editor/index.js.map +1 -1
- package/build/components/post-title/constants.js.map +1 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-title/use-post-title-focus.js.map +1 -1
- package/build/components/post-title/use-post-title.js.map +1 -1
- package/build/components/post-trash/check.js +23 -25
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +2 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +45 -19
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-url/panel.js +15 -8
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-view-link/index.js.map +1 -1
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +2 -1
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/enable-plugin-document-setting-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 +26 -18
- 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/provider/index.js +4 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +6 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/navigation-block-editing-mode.js.map +1 -1
- package/build/components/provider/use-auto-switch-editor-sidebars.js +52 -0
- package/build/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
- package/build/components/provider/use-block-editor-settings.js +64 -43
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +1 -0
- package/build/components/provider/with-registry-provider.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 +143 -0
- package/build/components/start-page-options/index.js.map +1 -0
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-areas/index.js.map +1 -1
- package/build/components/template-validation-notice/index.js +23 -29
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +10 -16
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/pattern-overrides.js +22 -10
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/hooks/use-select-nearest-editable-block.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +38 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +8 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/private-actions.js +177 -4
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +1 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +8 -11
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js.map +1 -1
- package/build/store/utils/get-filtered-template-parts.js.map +1 -1
- package/build/store/utils/is-template-revertable.js +28 -0
- package/build/store/utils/is-template-revertable.js.map +1 -0
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-template-part-icon.js.map +1 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/media-upload/index.native.js.map +1 -1
- package/build/utils/terms.js.map +1 -1
- package/build/utils/url.js.map +1 -1
- package/build-module/bindings/index.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +14 -31
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/index.js.map +1 -1
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +24 -12
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-removal-warnings/index.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.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/commands/index.js +20 -1
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/commands/index.native.js.map +1 -1
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- package/build-module/components/document-bar/index.js.map +1 -1
- 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-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +2 -9
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +13 -2
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +2 -2
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.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-notices/index.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/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +32 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +53 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +4 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.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 +75 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +118 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +48 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- 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/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/mode-switcher/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/offline-status/index.native.js.map +1 -1
- 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/pattern-overrides-panel/index.js.map +1 -1
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +73 -0
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -0
- 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-post-status-info/index.js +66 -0
- package/build-module/components/plugin-post-status-info/index.js.map +1 -0
- 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 +102 -0
- package/build-module/components/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/plugin-sidebar-more-menu-item/index.js +65 -0
- package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/actions.js +317 -19
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +153 -0
- package/build-module/components/post-actions/index.js.map +1 -0
- 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/combobox.js.map +1 -1
- package/build-module/components/post-author/constants.js.map +1 -1
- package/build-module/components/post-author/hook.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-author/select.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +16 -17
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/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 +8 -18
- 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/check.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-featured-image/panel.js.map +1 -1
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/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-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-last-revision/panel.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +31 -31
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +51 -42
- package/build-module/components/post-publish-button/label.js.map +1 -1
- 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-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +10 -6
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +9 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +44 -68
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-status/index.js +231 -0
- package/build-module/components/post-status/index.js.map +1 -0
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +7 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +9 -5
- 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/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-template/reset-default-template.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-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/constants.js.map +1 -1
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
- package/build-module/components/post-title/use-post-title.js.map +1 -1
- package/build-module/components/post-trash/check.js +24 -26
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +2 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +47 -21
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-url/panel.js +15 -8
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-view-link/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +2 -1
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-plugin-document-setting-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 +26 -18
- 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/provider/index.js +5 -3
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -1
- package/build-module/components/provider/use-auto-switch-editor-sidebars.js +46 -0
- package/build-module/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
- package/build-module/components/provider/use-block-editor-settings.js +66 -45
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +1 -0
- package/build-module/components/provider/with-registry-provider.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 +136 -0
- package/build-module/components/start-page-options/index.js.map +1 -0
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-areas/index.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +25 -31
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +11 -16
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +22 -10
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +36 -3
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/constants.js +7 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/private-actions.js +174 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +4 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/selectors.native.js.map +1 -1
- package/build-module/store/utils/get-filtered-template-parts.js.map +1 -1
- package/build-module/store/utils/is-template-revertable.js +22 -0
- package/build-module/store/utils/is-template-revertable.js.map +1 -0
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-template-part-icon.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/index.native.js.map +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/media-upload/index.native.js.map +1 -1
- package/build-module/utils/terms.js.map +1 -1
- package/build-module/utils/url.js.map +1 -1
- package/build-style/style-rtl.css +703 -53
- package/build-style/style.css +703 -53
- package/package.json +35 -35
- package/src/bindings/post-meta.js +11 -27
- package/src/components/autosave-monitor/index.js +23 -11
- 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/commands/index.js +20 -1
- 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 +16 -19
- package/src/components/editor-canvas/edit-template-blocks-notification.js +16 -2
- package/src/components/editor-canvas/index.js +4 -4
- 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/error-boundary/style.native.scss +1 -1
- package/src/components/global-keyboard-shortcuts/index.js +32 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +61 -0
- package/src/components/index.js +4 -0
- package/src/components/inserter-sidebar/index.js +2 -5
- package/src/components/keyboard-shortcut-help-modal/config.js +62 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +43 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +160 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +67 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +61 -0
- 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-more-menu-item/index.js +73 -0
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-post-status-info/index.js +63 -0
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +98 -0
- package/src/components/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/post-actions/actions.js +413 -18
- package/src/components/post-actions/index.js +190 -0
- package/src/components/post-actions/style.scss +3 -0
- 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 +28 -23
- 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 +8 -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/index.js +23 -36
- package/src/components/post-publish-button/label.js +54 -39
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/index.js +15 -26
- package/src/components/post-publish-button/test/label.js +44 -21
- 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-saved-state/index.js +13 -6
- package/src/components/post-saved-state/test/index.js +4 -0
- package/src/components/post-schedule/panel.js +23 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-slug/index.js +50 -68
- package/src/components/post-slug/test/index.js +29 -6
- package/src/components/post-status/index.js +318 -0
- package/src/components/post-status/style.scss +74 -0
- package/src/components/post-switch-to-draft-button/index.js +5 -0
- package/src/components/post-template/block-theme.js +33 -24
- 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-trash/check.js +19 -19
- package/src/components/post-trash/index.js +1 -0
- package/src/components/post-url/index.js +132 -101
- package/src/components/post-url/panel.js +21 -8
- package/src/components/post-url/style.scss +8 -6
- package/src/components/post-visibility/index.js +1 -0
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +40 -22
- package/src/components/preview-dropdown/index.js +3 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -21
- package/src/components/provider/index.js +17 -8
- package/src/components/provider/use-auto-switch-editor-sidebars.js +49 -0
- package/src/components/provider/use-block-editor-settings.js +59 -33
- package/src/components/provider/with-registry-provider.js +1 -0
- 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 +140 -0
- package/src/components/start-page-options/style.scss +26 -0
- package/src/components/template-validation-notice/index.js +48 -50
- package/src/components/theme-support-check/index.js +9 -16
- package/src/components/theme-support-check/test/index.js +44 -43
- package/src/hooks/pattern-overrides.js +25 -14
- package/src/private-apis.js +33 -2
- package/src/store/constants.js +7 -0
- package/src/store/private-actions.js +269 -4
- package/src/store/private-selectors.js +1 -6
- package/src/store/selectors.js +4 -7
- package/src/store/utils/is-template-revertable.js +23 -0
- package/src/style.scss +10 -2
- package/src/components/post-publish-button/style.scss +0 -8
- package/src/components/provider/test/disable-non-page-content-blocks.js +0 -111
- package/src/components/template-validation-notice/style.scss +0 -9
|
@@ -10,15 +10,16 @@ import classnames from 'classnames';
|
|
|
10
10
|
import { Icon, __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalText as Text, PanelBody } from '@wordpress/components';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
12
|
import { useSelect } from '@wordpress/data';
|
|
13
|
-
import { __
|
|
14
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
15
14
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* Internal dependencies
|
|
19
18
|
*/
|
|
20
19
|
import { store as editorStore } from '../../store';
|
|
21
|
-
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
20
|
+
import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE } from '../../store/constants';
|
|
21
|
+
import { PrivatePostExcerptPanel } from '../post-excerpt/panel';
|
|
22
|
+
import PostLastEditedPanel from '../post-last-edited-panel';
|
|
22
23
|
import { unlock } from '../../lock-unlock';
|
|
23
24
|
import TemplateAreas from '../template-areas';
|
|
24
25
|
export default function PostCardPanel({
|
|
@@ -26,9 +27,8 @@ export default function PostCardPanel({
|
|
|
26
27
|
actions
|
|
27
28
|
}) {
|
|
28
29
|
const {
|
|
29
|
-
modified,
|
|
30
30
|
title,
|
|
31
|
-
|
|
31
|
+
showPostContentPanels,
|
|
32
32
|
icon,
|
|
33
33
|
postType
|
|
34
34
|
} = useSelect(select => {
|
|
@@ -44,24 +44,23 @@ export default function PostCardPanel({
|
|
|
44
44
|
const _type = getCurrentPostType();
|
|
45
45
|
const _id = getCurrentPostId();
|
|
46
46
|
const _record = getEditedEntityRecord('postType', _type, _id);
|
|
47
|
-
const _templateInfo = __experimentalGetTemplateInfo(_record);
|
|
47
|
+
const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(_type) && __experimentalGetTemplateInfo(_record);
|
|
48
48
|
return {
|
|
49
49
|
title: _templateInfo?.title || getEditedPostAttribute('title'),
|
|
50
|
-
modified: getEditedPostAttribute('modified'),
|
|
51
50
|
id: _id,
|
|
52
51
|
postType: _type,
|
|
53
|
-
templateInfo: _templateInfo,
|
|
54
52
|
icon: unlock(select(editorStore)).getPostIcon(_type, {
|
|
55
53
|
area: _record?.area
|
|
56
|
-
})
|
|
54
|
+
}),
|
|
55
|
+
// Post excerpt panel and Last Edited info are rendered in different place depending on the post type.
|
|
56
|
+
// So we cannot make this check inside the PostExcerpt or PostLastEditedPanel component based on the current edited entity.
|
|
57
|
+
showPostContentPanels: [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE].includes(_type)
|
|
57
58
|
};
|
|
58
|
-
});
|
|
59
|
-
const description = templateInfo?.description;
|
|
60
|
-
const lastEditedText = modified && sprintf(
|
|
61
|
-
// translators: %s: Human-readable time difference, e.g. "2 days ago".
|
|
62
|
-
__('Last edited %s.'), humanTimeDiff(modified));
|
|
59
|
+
}, []);
|
|
63
60
|
return createElement(PanelBody, null, createElement("div", {
|
|
64
|
-
className: classnames('editor-post-card-panel', className
|
|
61
|
+
className: classnames('editor-post-card-panel', className, {
|
|
62
|
+
'has-description': showPostContentPanels
|
|
63
|
+
})
|
|
65
64
|
}, createElement(HStack, {
|
|
66
65
|
spacing: 2,
|
|
67
66
|
className: "editor-post-card-panel__header",
|
|
@@ -77,9 +76,9 @@ export default function PostCardPanel({
|
|
|
77
76
|
as: "h2"
|
|
78
77
|
}, title ? decodeEntities(title) : __('No Title')), actions), createElement(VStack, {
|
|
79
78
|
className: "editor-post-card-panel__content"
|
|
80
|
-
},
|
|
79
|
+
}, showPostContentPanels && createElement(VStack, {
|
|
81
80
|
className: "editor-post-card-panel__description",
|
|
82
81
|
spacing: 2
|
|
83
|
-
},
|
|
82
|
+
}, createElement(PrivatePostExcerptPanel, null), createElement(PostLastEditedPanel, null)), postType === TEMPLATE_POST_TYPE && createElement(TemplateAreas, null))));
|
|
84
83
|
}
|
|
85
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","Icon","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalText","Text","PanelBody","store","coreStore","useSelect","__","
|
|
1
|
+
{"version":3,"names":["classnames","Icon","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalText","Text","PanelBody","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","PrivatePostExcerptPanel","PostLastEditedPanel","unlock","TemplateAreas","PostCardPanel","className","actions","title","showPostContentPanels","icon","postType","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","getEditedEntityRecord","_type","_id","_record","_templateInfo","includes","id","getPostIcon","area","createElement","spacing","align","numberOfLines","truncate","weight","as"],"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\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PrivatePostExcerptPanel />\n\t\t\t\t\t\t\t<PostLastEditedPanel />\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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,SAAS,QACH,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,OAAOC,mBAAmB,MAAM,2BAA2B;AAC3D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,eAAe,SAASC,aAAaA,CAAE;EAAEC,SAAS;EAAEC;AAAQ,CAAC,EAAG;EAC/D,MAAM;IAAEC,KAAK;IAAEC,qBAAqB;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGjB,SAAS,CAC/DkB,MAAM,IAAM;IACb,MAAM;MACLC,sBAAsB;MACtBC,kBAAkB;MAClBC,gBAAgB;MAChBC;IACD,CAAC,GAAGJ,MAAM,CAAEf,WAAY,CAAC;IACzB,MAAM;MAAEoB;IAAsB,CAAC,GAAGL,MAAM,CAAEnB,SAAU,CAAC;IACrD,MAAMyB,KAAK,GAAGJ,kBAAkB,CAAC,CAAC;IAClC,MAAMK,GAAG,GAAGJ,gBAAgB,CAAC,CAAC;IAC9B,MAAMK,OAAO,GAAGH,qBAAqB,CAAE,UAAU,EAAEC,KAAK,EAAEC,GAAI,CAAC;IAC/D,MAAME,aAAa,GAClB,CAAEvB,kBAAkB,EAAEC,uBAAuB,CAAE,CAACuB,QAAQ,CACvDJ,KACD,CAAC,IAAIF,6BAA6B,CAAEI,OAAQ,CAAC;IAC9C,OAAO;MACNZ,KAAK,EACJa,aAAa,EAAEb,KAAK,IAAIK,sBAAsB,CAAE,OAAQ,CAAC;MAC1DU,EAAE,EAAEJ,GAAG;MACPR,QAAQ,EAAEO,KAAK;MACfR,IAAI,EAAEP,MAAM,CAAES,MAAM,CAAEf,WAAY,CAAE,CAAC,CAAC2B,WAAW,CAAEN,KAAK,EAAE;QACzDO,IAAI,EAAEL,OAAO,EAAEK;MAChB,CAAE,CAAC;MACH;MACA;MACAhB,qBAAqB,EAAE,CACtBX,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,CACjB,CAACsB,QAAQ,CAAEJ,KAAM;IACnB,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,OACCQ,aAAA,CAACnC,SAAS,QACTmC,aAAA;IACCpB,SAAS,EAAGvB,UAAU,CAAE,wBAAwB,EAAEuB,SAAS,EAAE;MAC5D,iBAAiB,EAAEG;IACpB,CAAE;EAAG,GAELiB,aAAA,CAACxC,MAAM;IACNyC,OAAO,EAAG,CAAG;IACbrB,SAAS,EAAC,gCAAgC;IAC1CsB,KAAK,EAAC;EAAY,GAElBF,aAAA,CAAC1C,IAAI;IACJsB,SAAS,EAAC,8BAA8B;IACxCI,IAAI,EAAGA;EAAM,CACb,CAAC,EACFgB,aAAA,CAACpC,IAAI;IACJuC,aAAa,EAAG,CAAG;IACnBC,QAAQ;IACRxB,SAAS,EAAC,+BAA+B;IACzCyB,MAAM,EAAG,GAAK;IACdC,EAAE,EAAC;EAAI,GAELxB,KAAK,GAAGZ,cAAc,CAAEY,KAAM,CAAC,GAAGb,EAAE,CAAE,UAAW,CAC9C,CAAC,EACLY,OACK,CAAC,EACTmB,aAAA,CAACtC,MAAM;IAACkB,SAAS,EAAC;EAAiC,GAChDG,qBAAqB,IACtBiB,aAAA,CAACtC,MAAM;IACNkB,SAAS,EAAC,qCAAqC;IAC/CqB,OAAO,EAAG;EAAG,GAEbD,aAAA,CAACzB,uBAAuB,MAAE,CAAC,EAC3ByB,aAAA,CAACxB,mBAAmB,MAAE,CACf,CACR,EACCS,QAAQ,KAAKb,kBAAkB,IAAI4B,aAAA,CAACtB,aAAa,MAAE,CAC9C,CACJ,CACK,CAAC;AAEd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","CheckboxControl","useDispatch","useSelect","store","editorStore","PostComments","commentStatus","select","_select$getEditedPost","getEditedPostAttribute","editPost","onToggleComments","comment_status","createElement","__nextHasNoMarginBottom","label","checked","onChange"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments() {\n\tconst commentStatus = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'comment_status' ) ??\n\t\t\t'open',\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onToggleComments = () =>\n\t\teditPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default PostComments;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,YAAYA,CAAA,EAAG;EACvB,MAAMC,aAAa,GAAGJ,SAAS,CAC5BK,MAAM;IAAA,IAAAC,qBAAA;IAAA,QAAAA,qBAAA,GACPD,MAAM,CAAEH,WAAY,CAAC,CAACK,sBAAsB,CAAE,gBAAiB,CAAC,cAAAD,qBAAA,cAAAA,qBAAA,GAChE,MAAM;EAAA,GACP,EACD,CAAC;EACD,MAAM;IAAEE;EAAS,CAAC,GAAGT,WAAW,CAAEG,WAAY,CAAC;EAC/C,MAAMO,gBAAgB,GAAGA,CAAA,KACxBD,QAAQ,CAAE;IACTE,cAAc,EAAEN,aAAa,KAAK,MAAM,GAAG,QAAQ,GAAG;EACvD,CAAE,CAAC;EAEJ,OACCO,aAAA,CAACb,eAAe;IACfc,uBAAuB;IACvBC,KAAK,EAAGhB,EAAE,CAAE,gBAAiB,CAAG;IAChCiB,OAAO,EAAGV,aAAa,KAAK,MAAQ;IACpCW,QAAQ,EAAGN;EAAkB,CAC7B,CAAC;AAEJ;AAEA,eAAeN,YAAY"}
|
|
1
|
+
{"version":3,"names":["__","CheckboxControl","useDispatch","useSelect","store","editorStore","PostComments","commentStatus","select","_select$getEditedPost","getEditedPostAttribute","editPost","onToggleComments","comment_status","createElement","__nextHasNoMarginBottom","label","checked","onChange"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction PostComments() {\n\tconst commentStatus = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'comment_status' ) ??\n\t\t\t'open',\n\t\t[]\n\t);\n\tconst { editPost } = useDispatch( editorStore );\n\tconst onToggleComments = () =>\n\t\teditPost( {\n\t\t\tcomment_status: commentStatus === 'open' ? 'closed' : 'open',\n\t\t} );\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Allow comments' ) }\n\t\t\tchecked={ commentStatus === 'open' }\n\t\t\tonChange={ onToggleComments }\n\t\t/>\n\t);\n}\n\nexport default PostComments;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,SAASC,YAAYA,CAAA,EAAG;EACvB,MAAMC,aAAa,GAAGJ,SAAS,CAC5BK,MAAM;IAAA,IAAAC,qBAAA;IAAA,QAAAA,qBAAA,GACPD,MAAM,CAAEH,WAAY,CAAC,CAACK,sBAAsB,CAAE,gBAAiB,CAAC,cAAAD,qBAAA,cAAAA,qBAAA,GAChE,MAAM;EAAA,GACP,EACD,CAAC;EACD,MAAM;IAAEE;EAAS,CAAC,GAAGT,WAAW,CAAEG,WAAY,CAAC;EAC/C,MAAMO,gBAAgB,GAAGA,CAAA,KACxBD,QAAQ,CAAE;IACTE,cAAc,EAAEN,aAAa,KAAK,MAAM,GAAG,QAAQ,GAAG;EACvD,CAAE,CAAC;EAEJ,OACCO,aAAA,CAACb,eAAe;IACfc,uBAAuB;IACvBC,KAAK,EAAGhB,EAAE,CAAE,gBAAiB,CAAG;IAChCiB,OAAO,EAAGV,aAAa,KAAK,MAAQ;IACpCW,QAAQ,EAAGN;EAAkB,CAC7B,CAAC;AAEJ;AAEA,eAAeN,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* WordPress dependencies
|
|
4
|
+
*/
|
|
5
|
+
import { __experimentalText as Text } from '@wordpress/components';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { __, _x, _n, sprintf } from '@wordpress/i18n';
|
|
8
|
+
import { count as wordCount } from '@wordpress/wordcount';
|
|
9
|
+
import { useMemo } from '@wordpress/element';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { store as editorStore } from '../../store';
|
|
16
|
+
import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE } from '../../store/constants';
|
|
17
|
+
|
|
18
|
+
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
19
|
+
const AVERAGE_READING_RATE = 189;
|
|
20
|
+
|
|
21
|
+
// This component renders the wordcount and reading time for the post.
|
|
22
|
+
export default function PostContentInformation() {
|
|
23
|
+
const {
|
|
24
|
+
postContent
|
|
25
|
+
} = useSelect(select => {
|
|
26
|
+
const {
|
|
27
|
+
getEditedPostAttribute,
|
|
28
|
+
getCurrentPostType,
|
|
29
|
+
getCurrentPostId
|
|
30
|
+
} = select(editorStore);
|
|
31
|
+
const {
|
|
32
|
+
getEntityRecord
|
|
33
|
+
} = select(coreStore);
|
|
34
|
+
const siteSettings = getEntityRecord('root', 'site');
|
|
35
|
+
const postType = getCurrentPostType();
|
|
36
|
+
const _id = getCurrentPostId();
|
|
37
|
+
const isPostsPage = +_id === siteSettings?.page_for_posts;
|
|
38
|
+
const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
|
|
39
|
+
return {
|
|
40
|
+
postContent: showPostContentInfo && getEditedPostAttribute('content')
|
|
41
|
+
};
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
46
|
+
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
47
|
+
* Do not translate into your own language.
|
|
48
|
+
*/
|
|
49
|
+
const wordCountType = _x('words', 'Word count type. Do not translate!');
|
|
50
|
+
const wordsCounted = useMemo(() => postContent ? wordCount(postContent, wordCountType) : 0, [postContent, wordCountType]);
|
|
51
|
+
if (!wordsCounted) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
|
|
55
|
+
const wordsCountText = sprintf(
|
|
56
|
+
// translators: %s: the number of words in the post.
|
|
57
|
+
_n('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString());
|
|
58
|
+
const minutesText = readingTime <= 1 ? __('1 minute') : sprintf(
|
|
59
|
+
// translators: %s: the number of minutes to read the post.
|
|
60
|
+
_n('%s minute', '%s minutes', readingTime), readingTime.toLocaleString());
|
|
61
|
+
return createElement("div", {
|
|
62
|
+
className: "editor-post-content-information"
|
|
63
|
+
}, createElement(Text, null, 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.) */
|
|
64
|
+
__('%1$s, %2$s read time.'), wordsCountText, minutesText)));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalText","Text","useSelect","__","_x","_n","sprintf","count","wordCount","useMemo","store","coreStore","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","AVERAGE_READING_RATE","PostContentInformation","postContent","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","getEntityRecord","siteSettings","postType","_id","isPostsPage","page_for_posts","showPostContentInfo","includes","wordCountType","wordsCounted","readingTime","Math","round","wordsCountText","toLocaleString","minutesText","createElement","className"],"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":";AAAA;AACA;AACA;AACA,SAASA,kBAAkB,IAAIC,IAAI,QAAQ,uBAAuB;AAClE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,QACjB,uBAAuB;;AAE9B;AACA,MAAMC,oBAAoB,GAAG,GAAG;;AAEhC;AACA,eAAe,SAASC,sBAAsBA,CAAA,EAAG;EAChD,MAAM;IAAEC;EAAY,CAAC,GAAGf,SAAS,CAAIgB,MAAM,IAAM;IAChD,MAAM;MAAEC,sBAAsB;MAAEC,kBAAkB;MAAEC;IAAiB,CAAC,GACrEH,MAAM,CAAEN,WAAY,CAAC;IACtB,MAAM;MAAEU;IAAgB,CAAC,GAAGJ,MAAM,CAAEP,SAAU,CAAC;IAC/C,MAAMY,YAAY,GAAGD,eAAe,CAAE,MAAM,EAAE,MAAO,CAAC;IACtD,MAAME,QAAQ,GAAGJ,kBAAkB,CAAC,CAAC;IACrC,MAAMK,GAAG,GAAGJ,gBAAgB,CAAC,CAAC;IAC9B,MAAMK,WAAW,GAAG,CAACD,GAAG,KAAKF,YAAY,EAAEI,cAAc;IACzD,MAAMC,mBAAmB,GACxB,CAAEF,WAAW,IACb,CAAE,CAAEb,kBAAkB,EAAEC,uBAAuB,CAAE,CAACe,QAAQ,CACzDL,QACD,CAAC;IACF,OAAO;MACNP,WAAW,EACVW,mBAAmB,IAAIT,sBAAsB,CAAE,SAAU;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;AACD;AACA;AACA;AACA;EACC,MAAMW,aAAa,GAAG1B,EAAE,CAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAM2B,YAAY,GAAGtB,OAAO,CAC3B,MAAQQ,WAAW,GAAGT,SAAS,CAAES,WAAW,EAAEa,aAAc,CAAC,GAAG,CAAG,EACnE,CAAEb,WAAW,EAAEa,aAAa,CAC7B,CAAC;EACD,IAAK,CAAEC,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACA,MAAMC,WAAW,GAAGC,IAAI,CAACC,KAAK,CAAEH,YAAY,GAAGhB,oBAAqB,CAAC;EACrE,MAAMoB,cAAc,GAAG7B,OAAO;EAC7B;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAE0B,YAAa,CAAC,EACzCA,YAAY,CAACK,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBL,WAAW,IAAI,CAAC,GACb7B,EAAE,CAAE,UAAW,CAAC,GAChBG,OAAO;EACP;EACAD,EAAE,CAAE,WAAW,EAAE,YAAY,EAAE2B,WAAY,CAAC,EAC5CA,WAAW,CAACI,cAAc,CAAC,CAC3B,CAAC;EACL,OACCE,aAAA;IAAKC,SAAS,EAAC;EAAiC,GAC/CD,aAAA,CAACrC,IAAI,QACFK,OAAO,EACR;EACAH,EAAE,CAAE,uBAAwB,CAAC,EAC7BgC,cAAc,EACdE,WACD,CACK,CACF,CAAC;AAER","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ import PostTypeSupportCheck from '../post-type-support-check';
|
|
|
14
14
|
import PostComments from '../post-comments';
|
|
15
15
|
import PostPingbacks from '../post-pingbacks';
|
|
16
16
|
const PANEL_NAME = 'discussion-panel';
|
|
17
|
-
function
|
|
17
|
+
function DiscussionPanel() {
|
|
18
18
|
const {
|
|
19
19
|
isEnabled,
|
|
20
20
|
isOpened
|
|
@@ -34,9 +34,7 @@ function PostDiscussionPanel() {
|
|
|
34
34
|
if (!isEnabled) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
return createElement(
|
|
38
|
-
supportKeys: ['comments', 'trackbacks']
|
|
39
|
-
}, createElement(PanelBody, {
|
|
37
|
+
return createElement(PanelBody, {
|
|
40
38
|
title: __('Discussion'),
|
|
41
39
|
opened: isOpened,
|
|
42
40
|
onToggle: () => toggleEditorPanelOpened(PANEL_NAME)
|
|
@@ -44,7 +42,11 @@ function PostDiscussionPanel() {
|
|
|
44
42
|
supportKeys: "comments"
|
|
45
43
|
}, createElement(PanelRow, null, createElement(PostComments, null))), createElement(PostTypeSupportCheck, {
|
|
46
44
|
supportKeys: "trackbacks"
|
|
47
|
-
}, createElement(PanelRow, null, createElement(PostPingbacks, null))))
|
|
45
|
+
}, createElement(PanelRow, null, createElement(PostPingbacks, null))));
|
|
46
|
+
}
|
|
47
|
+
export default function PostDiscussionPanel() {
|
|
48
|
+
return createElement(PostTypeSupportCheck, {
|
|
49
|
+
supportKeys: ['comments', 'trackbacks']
|
|
50
|
+
}, createElement(DiscussionPanel, null));
|
|
48
51
|
}
|
|
49
|
-
export default PostDiscussionPanel;
|
|
50
52
|
//# sourceMappingURL=panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","PanelBody","PanelRow","useDispatch","useSelect","store","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PANEL_NAME","
|
|
1
|
+
{"version":3,"names":["__","PanelBody","PanelRow","useDispatch","useSelect","store","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PANEL_NAME","DiscussionPanel","isEnabled","isOpened","select","isEditorPanelEnabled","isEditorPanelOpened","toggleEditorPanelOpened","createElement","title","opened","onToggle","supportKeys","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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,aAAa,MAAM,mBAAmB;AAE7C,MAAMC,UAAU,GAAG,kBAAkB;AAErC,SAASC,eAAeA,CAAA,EAAG;EAC1B,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGT,SAAS,CAAIU,MAAM,IAAM;IACxD,MAAM;MAAEC,oBAAoB;MAAEC;IAAoB,CAAC,GAClDF,MAAM,CAAER,WAAY,CAAC;IACtB,OAAO;MACNM,SAAS,EAAEG,oBAAoB,CAAEL,UAAW,CAAC;MAC7CG,QAAQ,EAAEG,mBAAmB,CAAEN,UAAW;IAC3C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEO;EAAwB,CAAC,GAAGd,WAAW,CAAEG,WAAY,CAAC;EAE9D,IAAK,CAAEM,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OACCM,aAAA,CAACjB,SAAS;IACTkB,KAAK,EAAGnB,EAAE,CAAE,YAAa,CAAG;IAC5BoB,MAAM,EAAGP,QAAU;IACnBQ,QAAQ,EAAGA,CAAA,KAAMJ,uBAAuB,CAAEP,UAAW;EAAG,GAExDQ,aAAA,CAACX,oBAAoB;IAACe,WAAW,EAAC;EAAU,GAC3CJ,aAAA,CAAChB,QAAQ,QACRgB,aAAA,CAACV,YAAY,MAAE,CACN,CACW,CAAC,EAEvBU,aAAA,CAACX,oBAAoB;IAACe,WAAW,EAAC;EAAY,GAC7CJ,aAAA,CAAChB,QAAQ,QACRgB,aAAA,CAACT,aAAa,MAAE,CACP,CACW,CACZ,CAAC;AAEd;AAEA,eAAe,SAASc,mBAAmBA,CAAA,EAAG;EAC7C,OACCL,aAAA,CAACX,oBAAoB;IAACe,WAAW,EAAG,CAAE,UAAU,EAAE,YAAY;EAAI,GACjEJ,aAAA,CAACP,eAAe,MAAE,CACG,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
import { createElement } from "react";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Internal dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import PostTypeSupportCheck from '../post-type-support-check';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Component for checking if the post type supports the excerpt field.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} props Props.
|
|
11
|
+
* @param {Element} props.children Children to be rendered.
|
|
12
|
+
*
|
|
13
|
+
* @return {Component} The component to be rendered.
|
|
9
14
|
*/
|
|
10
|
-
import PostTypeSupportCheck from '../post-type-support-check';
|
|
11
|
-
import { store as editorStore } from '../../store';
|
|
12
15
|
function PostExcerptCheck({
|
|
13
16
|
children
|
|
14
17
|
}) {
|
|
15
|
-
const postType = useSelect(select => {
|
|
16
|
-
const {
|
|
17
|
-
getEditedPostAttribute
|
|
18
|
-
} = select(editorStore);
|
|
19
|
-
return getEditedPostAttribute('type');
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
23
|
-
// support the excerpt field throught the "description" field rather than "excerpt" which means
|
|
24
|
-
// the default ExcerptPanel won't work for these.
|
|
25
|
-
if (['wp_template', 'wp_template_part'].includes(postType)) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
18
|
return createElement(PostTypeSupportCheck, {
|
|
29
19
|
supportKeys: "excerpt"
|
|
30
20
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["PostTypeSupportCheck","PostExcerptCheck","children","createElement","supportKeys"],"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":";AAAA;AACA;AACA;AACA,OAAOA,oBAAoB,MAAM,4BAA4B;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzC,OACCC,aAAA,CAACH,oBAAoB;IAACI,WAAW,EAAC;EAAS,GACxCF,QACmB,CAAC;AAEzB;AAEA,eAAeD,gBAAgB","ignoreList":[]}
|
|
@@ -5,29 +5,70 @@ import { createElement } from "react";
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { ExternalLink, TextareaControl } from '@wordpress/components';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { useState } from '@wordpress/element';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
12
13
|
import { store as editorStore } from '../../store';
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Renders an editable textarea for the post excerpt.
|
|
17
|
+
* Templates, template parts and patterns use the `excerpt` field as a description semantically.
|
|
18
|
+
* Additionally templates and template parts override the `excerpt` field as `description` in
|
|
19
|
+
* REST API. So this component handles proper labeling and updating the edited entity.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} props - Component props.
|
|
22
|
+
* @param {boolean} [props.hideLabelFromVision=false] - Whether to visually hide the textarea's label.
|
|
23
|
+
* @param {boolean} [props.updateOnBlur=false] - Whether to update the post on change or use local state and update on blur.
|
|
24
|
+
*/
|
|
25
|
+
export default function PostExcerpt({
|
|
26
|
+
hideLabelFromVision = false,
|
|
27
|
+
updateOnBlur = false
|
|
28
|
+
}) {
|
|
29
|
+
const {
|
|
30
|
+
excerpt,
|
|
31
|
+
shouldUseDescriptionLabel,
|
|
32
|
+
usedAttribute
|
|
33
|
+
} = useSelect(select => {
|
|
34
|
+
const {
|
|
35
|
+
getCurrentPostType,
|
|
36
|
+
getEditedPostAttribute
|
|
37
|
+
} = select(editorStore);
|
|
38
|
+
const postType = getCurrentPostType();
|
|
39
|
+
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
40
|
+
// support the excerpt field throught the "description" field rather than "excerpt".
|
|
41
|
+
const _usedAttribute = ['wp_template', 'wp_template_part'].includes(postType) ? 'description' : 'excerpt';
|
|
42
|
+
return {
|
|
43
|
+
excerpt: getEditedPostAttribute(_usedAttribute),
|
|
44
|
+
// There are special cases where we want to label the excerpt as a description.
|
|
45
|
+
shouldUseDescriptionLabel: ['wp_template', 'wp_template_part', 'wp_block'].includes(postType),
|
|
46
|
+
usedAttribute: _usedAttribute
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
15
49
|
const {
|
|
16
50
|
editPost
|
|
17
51
|
} = useDispatch(editorStore);
|
|
52
|
+
const [localExcerpt, setLocalExcerpt] = useState(excerpt);
|
|
53
|
+
const updatePost = value => {
|
|
54
|
+
editPost({
|
|
55
|
+
[usedAttribute]: value
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const label = shouldUseDescriptionLabel ? __('Write a description (optional)') : __('Write an excerpt (optional)');
|
|
18
59
|
return createElement("div", {
|
|
19
60
|
className: "editor-post-excerpt"
|
|
20
61
|
}, createElement(TextareaControl, {
|
|
21
62
|
__nextHasNoMarginBottom: true,
|
|
22
|
-
label:
|
|
63
|
+
label: label,
|
|
64
|
+
hideLabelFromVision: hideLabelFromVision,
|
|
23
65
|
className: "editor-post-excerpt__textarea",
|
|
24
|
-
onChange:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
66
|
+
onChange: updateOnBlur ? setLocalExcerpt : updatePost,
|
|
67
|
+
onBlur: updateOnBlur ? () => updatePost(localExcerpt) : undefined,
|
|
68
|
+
value: updateOnBlur ? localExcerpt : excerpt,
|
|
69
|
+
help: !shouldUseDescriptionLabel ? createElement(ExternalLink, {
|
|
70
|
+
href: __('https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt')
|
|
71
|
+
}, __('Learn more about manual excerpts')) : __('Write a description')
|
|
72
|
+
}));
|
|
31
73
|
}
|
|
32
|
-
export default PostExcerpt;
|
|
33
74
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","ExternalLink","TextareaControl","useDispatch","useSelect","store","editorStore","PostExcerpt","excerpt","select","getEditedPostAttribute","editPost","createElement","className","__nextHasNoMarginBottom","
|
|
1
|
+
{"version":3,"names":["__","ExternalLink","TextareaControl","useDispatch","useSelect","useState","store","editorStore","PostExcerpt","hideLabelFromVision","updateOnBlur","excerpt","shouldUseDescriptionLabel","usedAttribute","select","getCurrentPostType","getEditedPostAttribute","postType","_usedAttribute","includes","editPost","localExcerpt","setLocalExcerpt","updatePost","value","label","createElement","className","__nextHasNoMarginBottom","onChange","onBlur","undefined","help","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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,eAAe,QAAQ,uBAAuB;AACrE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAE;EACpCC,mBAAmB,GAAG,KAAK;EAC3BC,YAAY,GAAG;AAChB,CAAC,EAAG;EACH,MAAM;IAAEC,OAAO;IAAEC,yBAAyB;IAAEC;EAAc,CAAC,GAAGT,SAAS,CACpEU,MAAM,IAAM;IACb,MAAM;MAAEC,kBAAkB;MAAEC;IAAuB,CAAC,GACnDF,MAAM,CAAEP,WAAY,CAAC;IACtB,MAAMU,QAAQ,GAAGF,kBAAkB,CAAC,CAAC;IACrC;IACA;IACA,MAAMG,cAAc,GAAG,CACtB,aAAa,EACb,kBAAkB,CAClB,CAACC,QAAQ,CAAEF,QAAS,CAAC,GACnB,aAAa,GACb,SAAS;IACZ,OAAO;MACNN,OAAO,EAAEK,sBAAsB,CAAEE,cAAe,CAAC;MACjD;MACAN,yBAAyB,EAAE,CAC1B,aAAa,EACb,kBAAkB,EAClB,UAAU,CACV,CAACO,QAAQ,CAAEF,QAAS,CAAC;MACtBJ,aAAa,EAAEK;IAChB,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,MAAM;IAAEE;EAAS,CAAC,GAAGjB,WAAW,CAAEI,WAAY,CAAC;EAC/C,MAAM,CAAEc,YAAY,EAAEC,eAAe,CAAE,GAAGjB,QAAQ,CAAEM,OAAQ,CAAC;EAC7D,MAAMY,UAAU,GAAKC,KAAK,IAAM;IAC/BJ,QAAQ,CAAE;MAAE,CAAEP,aAAa,GAAIW;IAAM,CAAE,CAAC;EACzC,CAAC;EACD,MAAMC,KAAK,GAAGb,yBAAyB,GACpCZ,EAAE,CAAE,gCAAiC,CAAC,GACtCA,EAAE,CAAE,6BAA8B,CAAC;EAEtC,OACC0B,aAAA;IAAKC,SAAS,EAAC;EAAqB,GACnCD,aAAA,CAACxB,eAAe;IACf0B,uBAAuB;IACvBH,KAAK,EAAGA,KAAO;IACfhB,mBAAmB,EAAGA,mBAAqB;IAC3CkB,SAAS,EAAC,+BAA+B;IACzCE,QAAQ,EAAGnB,YAAY,GAAGY,eAAe,GAAGC,UAAY;IACxDO,MAAM,EACLpB,YAAY,GAAG,MAAMa,UAAU,CAAEF,YAAa,CAAC,GAAGU,SAClD;IACDP,KAAK,EAAGd,YAAY,GAAGW,YAAY,GAAGV,OAAS;IAC/CqB,IAAI,EACH,CAAEpB,yBAAyB,GAC1Bc,aAAA,CAACzB,YAAY;MACZgC,IAAI,EAAGjC,EAAE,CACR,iFACD;IAAG,GAEDA,EAAE,CAAE,kCAAmC,CAC5B,CAAC,GAEfA,EAAE,CAAE,qBAAsB;EAE3B,CACD,CACG,CAAC;AAER","ignoreList":[]}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { createElement, Fragment } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import classnames from 'classnames';
|
|
6
|
+
|
|
2
7
|
/**
|
|
3
8
|
* WordPress dependencies
|
|
4
9
|
*/
|
|
5
10
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { PanelBody } from '@wordpress/components';
|
|
11
|
+
import { PanelBody, __experimentalText as Text, Dropdown, Button, __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
12
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
13
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
14
|
+
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
15
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
16
|
|
|
9
17
|
/**
|
|
10
18
|
* Internal dependencies
|
|
@@ -12,24 +20,28 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
12
20
|
import PostExcerptForm from './index';
|
|
13
21
|
import PostExcerptCheck from './check';
|
|
14
22
|
import PluginPostExcerpt from './plugin';
|
|
23
|
+
import { TEMPLATE_ORIGINS } from '../../store/constants';
|
|
15
24
|
import { store as editorStore } from '../../store';
|
|
16
25
|
|
|
17
26
|
/**
|
|
18
27
|
* Module Constants
|
|
19
28
|
*/
|
|
20
29
|
const PANEL_NAME = 'post-excerpt';
|
|
21
|
-
|
|
30
|
+
function ExcerptPanel() {
|
|
22
31
|
const {
|
|
23
32
|
isOpened,
|
|
24
|
-
isEnabled
|
|
33
|
+
isEnabled,
|
|
34
|
+
postType
|
|
25
35
|
} = useSelect(select => {
|
|
26
36
|
const {
|
|
27
37
|
isEditorPanelOpened,
|
|
28
|
-
isEditorPanelEnabled
|
|
38
|
+
isEditorPanelEnabled,
|
|
39
|
+
getCurrentPostType
|
|
29
40
|
} = select(editorStore);
|
|
30
41
|
return {
|
|
31
42
|
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
32
|
-
isEnabled: isEditorPanelEnabled(PANEL_NAME)
|
|
43
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
44
|
+
postType: getCurrentPostType()
|
|
33
45
|
};
|
|
34
46
|
}, []);
|
|
35
47
|
const {
|
|
@@ -39,10 +51,108 @@ export default function PostExcerptPanel() {
|
|
|
39
51
|
if (!isEnabled) {
|
|
40
52
|
return null;
|
|
41
53
|
}
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
|
|
55
|
+
// There are special cases where we want to label the excerpt as a description.
|
|
56
|
+
const shouldUseDescriptionLabel = ['wp_template', 'wp_template_part', 'wp_block'].includes(postType);
|
|
57
|
+
return createElement(PanelBody, {
|
|
58
|
+
title: shouldUseDescriptionLabel ? __('Description') : __('Excerpt'),
|
|
44
59
|
opened: isOpened,
|
|
45
60
|
onToggle: toggleExcerptPanel
|
|
46
|
-
}, createElement(PluginPostExcerpt.Slot, null, fills => createElement(Fragment, null, createElement(PostExcerptForm, null), fills)))
|
|
61
|
+
}, createElement(PluginPostExcerpt.Slot, null, fills => createElement(Fragment, null, createElement(PostExcerptForm, null), fills)));
|
|
62
|
+
}
|
|
63
|
+
export default function PostExcerptPanel() {
|
|
64
|
+
return createElement(PostExcerptCheck, null, createElement(ExcerptPanel, null));
|
|
65
|
+
}
|
|
66
|
+
export function PrivatePostExcerptPanel() {
|
|
67
|
+
return createElement(PostExcerptCheck, null, createElement(PrivateExcerpt, null));
|
|
68
|
+
}
|
|
69
|
+
function PrivateExcerpt() {
|
|
70
|
+
const {
|
|
71
|
+
shouldRender,
|
|
72
|
+
excerpt,
|
|
73
|
+
shouldBeUsedAsDescription,
|
|
74
|
+
allowEditing
|
|
75
|
+
} = useSelect(select => {
|
|
76
|
+
const {
|
|
77
|
+
getCurrentPostType,
|
|
78
|
+
getCurrentPostId,
|
|
79
|
+
getEditedPostAttribute,
|
|
80
|
+
isEditorPanelEnabled
|
|
81
|
+
} = select(editorStore);
|
|
82
|
+
const postType = getCurrentPostType();
|
|
83
|
+
const isTemplateOrTemplatePart = ['wp_template', 'wp_template_part'].includes(postType);
|
|
84
|
+
const isPattern = postType === 'wp_block';
|
|
85
|
+
// These post types use the `excerpt` field as a description semantically, so we need to
|
|
86
|
+
// handle proper labeling and some flows where we should always render them as text.
|
|
87
|
+
const _shouldBeUsedAsDescription = isTemplateOrTemplatePart || isPattern;
|
|
88
|
+
const _usedAttribute = isTemplateOrTemplatePart ? 'description' : 'excerpt';
|
|
89
|
+
// We need to fetch the entity in this case to check if we'll allow editing.
|
|
90
|
+
const template = isTemplateOrTemplatePart && select(coreStore).getEntityRecord('postType', postType, getCurrentPostId());
|
|
91
|
+
// For post types that use excerpt as description, we do not abide
|
|
92
|
+
// by the `isEnabled` panel flag in order to render them as text.
|
|
93
|
+
const _shouldRender = isEditorPanelEnabled(PANEL_NAME) || _shouldBeUsedAsDescription;
|
|
94
|
+
return {
|
|
95
|
+
excerpt: getEditedPostAttribute(_usedAttribute),
|
|
96
|
+
shouldRender: _shouldRender,
|
|
97
|
+
shouldBeUsedAsDescription: _shouldBeUsedAsDescription,
|
|
98
|
+
// If we should render, allow editing for all post types that are not used as description.
|
|
99
|
+
// For the rest allow editing only for user generated entities.
|
|
100
|
+
allowEditing: _shouldRender && (!_shouldBeUsedAsDescription || isPattern || template && template.source === TEMPLATE_ORIGINS.custom && !template.has_theme_file)
|
|
101
|
+
};
|
|
102
|
+
}, []);
|
|
103
|
+
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
104
|
+
const label = shouldBeUsedAsDescription ? __('Description') : __('Excerpt');
|
|
105
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
106
|
+
const popoverProps = useMemo(() => ({
|
|
107
|
+
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
108
|
+
// move around when the label changes.
|
|
109
|
+
anchor: popoverAnchor,
|
|
110
|
+
'aria-label': label,
|
|
111
|
+
headerTitle: label,
|
|
112
|
+
placement: 'left-start',
|
|
113
|
+
offset: 36,
|
|
114
|
+
shift: true
|
|
115
|
+
}), [popoverAnchor, label]);
|
|
116
|
+
if (!shouldRender) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
const excerptText = !!excerpt && createElement(Text, {
|
|
120
|
+
align: "left",
|
|
121
|
+
numberOfLines: 4,
|
|
122
|
+
truncate: true
|
|
123
|
+
}, excerpt);
|
|
124
|
+
if (!allowEditing) {
|
|
125
|
+
return excerptText;
|
|
126
|
+
}
|
|
127
|
+
const excerptPlaceholder = shouldBeUsedAsDescription ? __('Add a description…') : __('Add an excerpt…');
|
|
128
|
+
const triggerEditLabel = shouldBeUsedAsDescription ? __('Edit description') : __('Edit excerpt');
|
|
129
|
+
return createElement(Dropdown, {
|
|
130
|
+
className: "editor-post-excerpt__dropdown",
|
|
131
|
+
contentClassName: "editor-post-excerpt__dropdown__content",
|
|
132
|
+
popoverProps: popoverProps,
|
|
133
|
+
focusOnMount: true,
|
|
134
|
+
ref: setPopoverAnchor,
|
|
135
|
+
renderToggle: ({
|
|
136
|
+
onToggle
|
|
137
|
+
}) => createElement(Button, {
|
|
138
|
+
className: classnames('editor-post-excerpt__dropdown__trigger', {
|
|
139
|
+
'has-excerpt': !!excerpt
|
|
140
|
+
}),
|
|
141
|
+
onClick: onToggle,
|
|
142
|
+
label: !!excerptText ? triggerEditLabel : excerptPlaceholder,
|
|
143
|
+
showTooltip: !!excerptText
|
|
144
|
+
}, excerptText || excerptPlaceholder),
|
|
145
|
+
renderContent: ({
|
|
146
|
+
onClose
|
|
147
|
+
}) => createElement(Fragment, null, createElement(InspectorPopoverHeader, {
|
|
148
|
+
title: label,
|
|
149
|
+
onClose: onClose
|
|
150
|
+
}), createElement(VStack, {
|
|
151
|
+
spacing: 4
|
|
152
|
+
}, createElement(PluginPostExcerpt.Slot, null, fills => createElement(Fragment, null, createElement(PostExcerptForm, {
|
|
153
|
+
hideLabelFromVision: true,
|
|
154
|
+
updateOnBlur: true
|
|
155
|
+
}), fills))))
|
|
156
|
+
});
|
|
47
157
|
}
|
|
48
158
|
//# sourceMappingURL=panel.js.map
|