@wordpress/editor 13.33.0 → 13.35.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 +12 -4
- package/README.md +132 -20
- package/build/bindings/pattern-overrides.js +70 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/components/autosave-monitor/index.js +15 -12
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build/components/character-count/index.js +5 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +73 -0
- package/build/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build/components/document-bar/index.js +2 -2
- 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 +2 -2
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +15 -25
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +19 -8
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-history/redo.js +11 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +11 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-snackbars/index.js +6 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +7 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +35 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +130 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/index.js +147 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +56 -34
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +59 -0
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/more-menu/index.js +119 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/more-menu/tools-more-menu-group.js +23 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/more-menu/view-more-menu-group.js +24 -0
- package/build/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build/components/page-attributes/check.js +8 -0
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +14 -8
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +1 -1
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -1
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/actions.js +219 -66
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +32 -16
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +6 -0
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +5 -0
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -66
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +28 -8
- 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 +104 -20
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +0 -19
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +52 -12
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +118 -7
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +2 -2
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/index.js +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/panel.js +27 -0
- package/build/components/post-format/panel.js.map +1 -0
- 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-panel-row/index.js +2 -2
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +28 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pingbacks/index.js +5 -2
- package/build/components/post-pingbacks/index.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-saved-state/index.js +2 -2
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/panel.js +27 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +13 -13
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +21 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-template/block-theme.js +2 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +0 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -5
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-title/index.js +2 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +2 -2
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +90 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -0
- package/build/components/post-transform-panel/index.js +101 -0
- package/build/components/post-transform-panel/index.js.map +1 -0
- package/build/components/post-trash/panel.js +18 -0
- package/build/components/post-trash/panel.js.map +1 -0
- package/build/components/post-type-support-check/index.js +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +2 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +11 -5
- 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 +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +21 -3
- package/build/components/provider/use-block-editor-settings.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/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +53 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +157 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +84 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/start-page-options/index.js +10 -8
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +192 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/template-content-panel/index.js +38 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/hooks/pattern-overrides.js +10 -5
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +19 -8
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +72 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/private-selectors.js +6 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +15 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +69 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +15 -13
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build-module/components/character-count/index.js +6 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +65 -0
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build-module/components/document-bar/index.js +2 -2
- 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 +2 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +17 -27
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +19 -8
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +11 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +11 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +6 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +36 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +120 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/index.js +139 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +59 -37
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/more-menu/index.js +111 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/more-menu/view-more-menu-group.js +17 -0
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build-module/components/page-attributes/check.js +9 -0
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -1
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +223 -70
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +33 -17
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +10 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +6 -0
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +6 -0
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -67
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +30 -10
- 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 +105 -21
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +0 -19
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +52 -11
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +118 -8
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +2 -2
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +18 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- 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-panel-row/index.js +2 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +20 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pingbacks/index.js +6 -3
- package/build-module/components/post-pingbacks/index.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-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/panel.js +18 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +13 -13
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +12 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-template/block-theme.js +2 -2
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +0 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +3 -6
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-title/index.js +2 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +2 -2
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +83 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -0
- package/build-module/components/post-transform-panel/index.js +94 -0
- package/build-module/components/post-transform-panel/index.js.map +1 -0
- package/build-module/components/post-trash/panel.js +10 -0
- package/build-module/components/post-trash/panel.js.map +1 -0
- package/build-module/components/post-type-support-check/index.js +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +2 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +11 -5
- 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 +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +21 -3
- package/build-module/components/provider/use-block-editor-settings.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/sidebar/constants.js +5 -0
- package/build-module/components/sidebar/constants.js.map +1 -0
- package/build-module/components/sidebar/header.js +46 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +149 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +77 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/start-page-options/index.js +10 -8
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +185 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/template-content-panel/index.js +31 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +10 -5
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +19 -8
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +62 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +535 -48
- package/build-style/style.css +535 -48
- package/package.json +38 -36
- package/src/bindings/pattern-overrides.js +83 -1
- package/src/components/autocompleters/style.scss +1 -2
- package/src/components/autosave-monitor/index.js +15 -12
- package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +4 -0
- package/src/components/character-count/index.js +5 -0
- package/src/components/collapsible-block-toolbar/index.js +77 -0
- package/src/components/collapsible-block-toolbar/style.scss +80 -0
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/check.js +8 -0
- package/src/components/document-outline/index.js +10 -0
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +19 -26
- package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/src/components/editor-canvas/index.js +18 -6
- package/src/components/editor-history/redo.js +10 -0
- package/src/components/editor-history/undo.js +10 -0
- package/src/components/editor-snackbars/index.js +5 -0
- package/src/components/entities-saved-states/style.scss +7 -0
- package/src/components/global-keyboard-shortcuts/index.js +7 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +42 -1
- package/src/components/global-styles-provider/index.js +162 -0
- package/src/components/header/index.js +154 -0
- package/src/components/header/style.scss +231 -0
- package/src/components/inserter-sidebar/index.js +52 -32
- package/src/components/inserter-sidebar/style.scss +10 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/index.js +1 -1
- package/src/components/list-view-sidebar/style.scss +3 -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/page-attributes/test/order.js +5 -1
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +1 -1
- package/src/components/post-actions/actions.js +373 -152
- package/src/components/post-actions/index.js +34 -33
- 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 +40 -141
- package/src/components/post-card-panel/style.scss +2 -6
- package/src/components/post-comments/index.js +47 -9
- 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 +108 -27
- package/src/components/post-discussion/style.scss +26 -0
- package/src/components/post-excerpt/check.js +0 -18
- package/src/components/post-excerpt/index.js +66 -15
- package/src/components/post-excerpt/panel.js +196 -19
- package/src/components/post-excerpt/plugin.js +2 -2
- package/src/components/post-excerpt/style.scss +24 -0
- package/src/components/post-featured-image/index.js +1 -1
- package/src/components/post-featured-image/style.scss +2 -8
- package/src/components/post-format/panel.js +22 -0
- package/src/components/post-format/style.scss +6 -0
- 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-last-revision/test/check.js +5 -1
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-row/style.scss +3 -3
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pingbacks/index.js +11 -2
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
- package/src/components/post-publish-panel/style.scss +48 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-slug/panel.js +22 -0
- package/src/components/post-slug/style.scss +5 -0
- package/src/components/post-slug/test/index.js +5 -1
- package/src/components/post-status/index.js +88 -80
- package/src/components/post-status/style.scss +0 -1
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-template/block-theme.js +2 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/post-template/swap-template-button.js +3 -6
- package/src/components/post-text-editor/style.scss +1 -1
- package/src/components/post-title/index.js +2 -2
- package/src/components/post-title/post-title-raw.js +2 -2
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +99 -0
- package/src/components/post-trash/panel.js +13 -0
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +2 -2
- package/src/components/post-url/index.js +1 -0
- package/src/components/post-url/panel.js +1 -1
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +17 -3
- 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 +4 -0
- package/src/components/provider/use-block-editor-settings.js +19 -4
- package/src/components/save-publish-panels/index.js +96 -0
- package/src/components/save-publish-panels/style.scss +36 -0
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +200 -0
- package/src/components/sidebar/post-summary.js +104 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/start-page-options/index.js +12 -5
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +55 -0
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +22 -8
- package/src/private-apis.native.js +61 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +12 -0
- package/src/store/selectors.js +3 -1
- package/src/style.scss +11 -0
- package/src/components/post-slug/test/check.js +0 -17
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
2
|
/**
|
|
8
3
|
* WordPress dependencies
|
|
9
4
|
*/
|
|
10
|
-
import { Icon, __experimentalHStack as HStack,
|
|
5
|
+
import { Icon, __experimentalHStack as HStack, __experimentalText as Text } from '@wordpress/components';
|
|
11
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
7
|
import { useSelect } from '@wordpress/data';
|
|
13
|
-
import { __
|
|
14
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
15
9
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
16
|
-
import { count as wordCount } from '@wordpress/wordcount';
|
|
17
|
-
import { useMemo } from '@wordpress/element';
|
|
18
10
|
|
|
19
11
|
/**
|
|
20
12
|
* Internal dependencies
|
|
@@ -22,18 +14,12 @@ import { useMemo } from '@wordpress/element';
|
|
|
22
14
|
import { store as editorStore } from '../../store';
|
|
23
15
|
import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE } from '../../store/constants';
|
|
24
16
|
import { unlock } from '../../lock-unlock';
|
|
25
|
-
import TemplateAreas from '../template-areas';
|
|
26
17
|
export default function PostCardPanel({
|
|
27
|
-
className,
|
|
28
18
|
actions
|
|
29
19
|
}) {
|
|
30
20
|
const {
|
|
31
|
-
modified,
|
|
32
21
|
title,
|
|
33
|
-
|
|
34
|
-
icon,
|
|
35
|
-
postType,
|
|
36
|
-
isPostsPage
|
|
22
|
+
icon
|
|
37
23
|
} = useSelect(select => {
|
|
38
24
|
const {
|
|
39
25
|
getEditedPostAttribute,
|
|
@@ -42,33 +28,21 @@ export default function PostCardPanel({
|
|
|
42
28
|
__experimentalGetTemplateInfo
|
|
43
29
|
} = select(editorStore);
|
|
44
30
|
const {
|
|
45
|
-
getEditedEntityRecord
|
|
46
|
-
getEntityRecord
|
|
31
|
+
getEditedEntityRecord
|
|
47
32
|
} = select(coreStore);
|
|
48
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
49
33
|
const _type = getCurrentPostType();
|
|
50
34
|
const _id = getCurrentPostId();
|
|
51
35
|
const _record = getEditedEntityRecord('postType', _type, _id);
|
|
52
|
-
const _templateInfo = __experimentalGetTemplateInfo(_record);
|
|
36
|
+
const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(_type) && __experimentalGetTemplateInfo(_record);
|
|
53
37
|
return {
|
|
54
38
|
title: _templateInfo?.title || getEditedPostAttribute('title'),
|
|
55
|
-
modified: getEditedPostAttribute('modified'),
|
|
56
|
-
id: _id,
|
|
57
|
-
postType: _type,
|
|
58
|
-
templateInfo: _templateInfo,
|
|
59
39
|
icon: unlock(select(editorStore)).getPostIcon(_type, {
|
|
60
40
|
area: _record?.area
|
|
61
|
-
})
|
|
62
|
-
isPostsPage: +_id === siteSettings?.page_for_posts
|
|
41
|
+
})
|
|
63
42
|
};
|
|
64
43
|
}, []);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// translators: %s: Human-readable time difference, e.g. "2 days ago".
|
|
68
|
-
__('Last edited %s.'), humanTimeDiff(modified));
|
|
69
|
-
const showPostContentInfo = !isPostsPage && ![TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
|
|
70
|
-
return createElement(PanelBody, null, createElement("div", {
|
|
71
|
-
className: classnames('editor-post-card-panel', className)
|
|
44
|
+
return createElement("div", {
|
|
45
|
+
className: "editor-post-card-panel"
|
|
72
46
|
}, createElement(HStack, {
|
|
73
47
|
spacing: 2,
|
|
74
48
|
className: "editor-post-card-panel__header",
|
|
@@ -82,38 +56,6 @@ export default function PostCardPanel({
|
|
|
82
56
|
className: "editor-post-card-panel__title",
|
|
83
57
|
weight: 500,
|
|
84
58
|
as: "h2"
|
|
85
|
-
}, title ? decodeEntities(title) : __('No Title')), actions)
|
|
86
|
-
className: "editor-post-card-panel__content"
|
|
87
|
-
}, (description || lastEditedText || showPostContentInfo) && createElement(VStack, {
|
|
88
|
-
className: "editor-post-card-panel__description",
|
|
89
|
-
spacing: 2
|
|
90
|
-
}, description && createElement(Text, null, description), showPostContentInfo && createElement(PostContentInfo, null), lastEditedText && createElement(Text, null, lastEditedText)), postType === TEMPLATE_POST_TYPE && createElement(TemplateAreas, null))));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
94
|
-
const AVERAGE_READING_RATE = 189;
|
|
95
|
-
|
|
96
|
-
// This component renders the wordcount and reading time for the post.
|
|
97
|
-
function PostContentInfo() {
|
|
98
|
-
const postContent = useSelect(select => select(editorStore).getEditedPostAttribute('content'), []);
|
|
99
|
-
/*
|
|
100
|
-
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
101
|
-
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
102
|
-
* Do not translate into your own language.
|
|
103
|
-
*/
|
|
104
|
-
const wordCountType = _x('words', 'Word count type. Do not translate!');
|
|
105
|
-
const wordsCounted = useMemo(() => postContent ? wordCount(postContent, wordCountType) : 0, [postContent, wordCountType]);
|
|
106
|
-
if (!wordsCounted) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
const readingTime = Math.round(wordsCounted / AVERAGE_READING_RATE);
|
|
110
|
-
const wordsCountText = sprintf(
|
|
111
|
-
// translators: %s: the number of words in the post.
|
|
112
|
-
_n('%s word', '%s words', wordsCounted), wordsCounted.toLocaleString());
|
|
113
|
-
const minutesText = readingTime <= 1 ? __('1 minute') : sprintf(
|
|
114
|
-
// translators: %s: the number of minutes to read the post.
|
|
115
|
-
_n('%s minute', '%s minutes', readingTime), readingTime.toLocaleString());
|
|
116
|
-
return 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.) */
|
|
117
|
-
__('%1$s, %2$s read time.'), wordsCountText, minutesText));
|
|
59
|
+
}, title ? decodeEntities(title) : __('No Title')), actions));
|
|
118
60
|
}
|
|
119
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","Icon","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalText","Text","PanelBody","store","coreStore","useSelect","__","_x","_n","sprintf","humanTimeDiff","decodeEntities","count","wordCount","useMemo","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","unlock","TemplateAreas","PostCardPanel","className","actions","modified","title","templateInfo","icon","postType","isPostsPage","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","getEditedEntityRecord","getEntityRecord","siteSettings","_type","_id","_record","_templateInfo","id","getPostIcon","area","page_for_posts","description","lastEditedText","showPostContentInfo","includes","createElement","spacing","align","numberOfLines","truncate","weight","as","PostContentInfo","AVERAGE_READING_RATE","postContent","wordCountType","wordsCounted","readingTime","Math","round","wordsCountText","toLocaleString","minutesText"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\tPanelBody,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport TemplateAreas from '../template-areas';\n\nexport default function PostCardPanel( { className, actions } ) {\n\tconst { modified, title, templateInfo, icon, postType, isPostsPage } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\t__experimentalGetTemplateInfo,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getEditedEntityRecord, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst _type = getCurrentPostType();\n\t\t\tconst _id = getCurrentPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', _type, _id );\n\t\t\tconst _templateInfo = __experimentalGetTemplateInfo( _record );\n\t\t\treturn {\n\t\t\t\ttitle:\n\t\t\t\t\t_templateInfo?.title || getEditedPostAttribute( 'title' ),\n\t\t\t\tmodified: getEditedPostAttribute( 'modified' ),\n\t\t\t\tid: _id,\n\t\t\t\tpostType: _type,\n\t\t\t\ttemplateInfo: _templateInfo,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( _type, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisPostsPage: +_id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t}, [] );\n\tconst description = templateInfo?.description;\n\tconst lastEditedText =\n\t\tmodified &&\n\t\tsprintf(\n\t\t\t// translators: %s: Human-readable time difference, e.g. \"2 days ago\".\n\t\t\t__( 'Last edited %s.' ),\n\t\t\thumanTimeDiff( modified )\n\t\t);\n\tconst showPostContentInfo =\n\t\t! isPostsPage &&\n\t\t! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( postType );\n\treturn (\n\t\t<PanelBody>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'editor-post-card-panel', className ) }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"editor-post-card-panel__icon\"\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t/>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\t\ttruncate\n\t\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tas=\"h2\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No Title' ) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\t\t\t\t<VStack className=\"editor-post-card-panel__content\">\n\t\t\t\t\t{ ( description ||\n\t\t\t\t\t\tlastEditedText ||\n\t\t\t\t\t\tshowPostContentInfo ) && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"editor-post-card-panel__description\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ description && <Text>{ description }</Text> }\n\t\t\t\t\t\t\t{ showPostContentInfo && <PostContentInfo /> }\n\t\t\t\t\t\t\t{ lastEditedText && (\n\t\t\t\t\t\t\t\t<Text>{ lastEditedText }</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ postType === TEMPLATE_POST_TYPE && <TemplateAreas /> }\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</PanelBody>\n\t);\n}\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\n// This component renders the wordcount and reading time for the post.\nfunction PostContentInfo() {\n\tconst postContent = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = useMemo(\n\t\t() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),\n\t\t[ postContent, wordCountType ]\n\t);\n\tif ( ! wordsCounted ) {\n\t\treturn null;\n\t}\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\tconst wordsCountText = sprintf(\n\t\t// translators: %s: the number of words in the post.\n\t\t_n( '%s word', '%s words', wordsCounted ),\n\t\twordsCounted.toLocaleString()\n\t);\n\tconst minutesText =\n\t\treadingTime <= 1\n\t\t\t? __( '1 minute' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: the number of minutes to read the post.\n\t\t\t\t\t_n( '%s minute', '%s minutes', readingTime ),\n\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t );\n\treturn (\n\t\t<Text>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */\n\t\t\t\t__( '%1$s, %2$s read time.' ),\n\t\t\t\twordsCountText,\n\t\t\t\tminutesText\n\t\t\t) }\n\t\t</Text>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBA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AC7B;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEoD,YAAa,CAAC,EACzCA,YAAY,CAACK,cAAc,CAAC,CAC7B,CAAC;EACD,MAAMC,WAAW,GAChBL,WAAW,IAAI,CAAC,GACbvD,EAAE,CAAE,UAAW,CAAC,GAChBG,OAAO;EACP;EACAD,EAAE,CAAE,WAAW,EAAE,YAAY,EAAEqD,WAAY,CAAC,EAC5CA,WAAW,CAACI,cAAc,CAAC,CAC3B,CAAC;EACL,OACChB,aAAA,CAAChD,IAAI,QACFQ,OAAO,EACR;EACAH,EAAE,CAAE,uBAAwB,CAAC,EAC7B0D,cAAc,EACdE,WACD,CACK,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","unlock","PostCardPanel","actions","title","icon","select","getEditedPostAttribute","getCurrentPostType","getCurrentPostId","__experimentalGetTemplateInfo","getEditedEntityRecord","_type","_id","_record","_templateInfo","includes","getPostIcon","area","createElement","className","spacing","align","numberOfLines","truncate","weight","as"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PostCardPanel( { actions } ) {\n\tconst { title, icon } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\t__experimentalGetTemplateInfo,\n\t\t} = select( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst _type = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst _record = getEditedEntityRecord( 'postType', _type, _id );\n\t\tconst _templateInfo =\n\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( _type ) &&\n\t\t\t__experimentalGetTemplateInfo( _record );\n\t\treturn {\n\t\t\ttitle: _templateInfo?.title || getEditedPostAttribute( 'title' ),\n\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( _type, {\n\t\t\t\tarea: _record?.area,\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon className=\"editor-post-card-panel__icon\" icon={ icon } />\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No Title' ) }\n\t\t\t\t</Text>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IA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CAAE,CAAC,EAC/Dc,aAAA,CAAC3B,IAAI;IACJ+B,aAAa,EAAG,CAAG;IACnBC,QAAQ;IACRJ,SAAS,EAAC,+BAA+B;IACzCK,MAAM,EAAG,GAAK;IACdC,EAAE,EAAC;EAAI,GAELtB,KAAK,GAAGP,cAAc,CAAEO,KAAM,CAAC,GAAGR,EAAE,CAAE,UAAW,CAC9C,CAAC,EACLO,OACK,CACJ,CAAC;AAER","ignoreList":[]}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { RadioControl, __experimentalText as Text, __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { store as editorStore } from '../../store';
|
|
13
|
+
const COMMENT_OPTIONS = [{
|
|
14
|
+
label: createElement(Fragment, null, __('Open'), createElement(Text, {
|
|
15
|
+
variant: "muted",
|
|
16
|
+
size: 12
|
|
17
|
+
}, __('Visitors can add new comments and replies.'))),
|
|
18
|
+
value: 'open'
|
|
19
|
+
}, {
|
|
20
|
+
label: createElement(Fragment, null, __('Closed'), createElement(Text, {
|
|
21
|
+
variant: "muted",
|
|
22
|
+
size: 12
|
|
23
|
+
}, __('Visitors cannot add new comments or replies.')), createElement(Text, {
|
|
24
|
+
variant: "muted",
|
|
25
|
+
size: 12
|
|
26
|
+
}, __('Existing comments remain visible.'))),
|
|
27
|
+
value: 'closed'
|
|
28
|
+
}];
|
|
13
29
|
function PostComments() {
|
|
14
30
|
const commentStatus = useSelect(select => {
|
|
15
31
|
var _select$getEditedPost;
|
|
@@ -18,15 +34,19 @@ function PostComments() {
|
|
|
18
34
|
const {
|
|
19
35
|
editPost
|
|
20
36
|
} = useDispatch(editorStore);
|
|
21
|
-
const
|
|
22
|
-
comment_status:
|
|
23
|
-
});
|
|
24
|
-
return createElement(CheckboxControl, {
|
|
25
|
-
__nextHasNoMarginBottom: true,
|
|
26
|
-
label: __('Allow comments'),
|
|
27
|
-
checked: commentStatus === 'open',
|
|
28
|
-
onChange: onToggleComments
|
|
37
|
+
const handleStatus = newCommentStatus => editPost({
|
|
38
|
+
comment_status: newCommentStatus
|
|
29
39
|
});
|
|
40
|
+
return createElement("form", null, createElement(VStack, {
|
|
41
|
+
spacing: 4
|
|
42
|
+
}, createElement(RadioControl, {
|
|
43
|
+
className: "editor-change-status__options",
|
|
44
|
+
hideLabelFromVision: true,
|
|
45
|
+
label: __('Comment status'),
|
|
46
|
+
options: COMMENT_OPTIONS,
|
|
47
|
+
onChange: handleStatus,
|
|
48
|
+
selected: commentStatus
|
|
49
|
+
})));
|
|
30
50
|
}
|
|
31
51
|
export default PostComments;
|
|
32
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","
|
|
1
|
+
{"version":3,"names":["__","RadioControl","__experimentalText","Text","__experimentalVStack","VStack","useDispatch","useSelect","store","editorStore","COMMENT_OPTIONS","label","createElement","Fragment","variant","size","value","PostComments","commentStatus","select","_select$getEditedPost","getEditedPostAttribute","editPost","handleStatus","newCommentStatus","comment_status","spacing","className","hideLabelFromVision","options","onChange","selected"],"sources":["@wordpress/editor/src/components/post-comments/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tRadioControl,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nconst COMMENT_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Open' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visitors can add new comments and replies.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'open',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Closed' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visitors cannot add new comments or replies.' ) }\n\t\t\t\t</Text>\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Existing comments remain visible.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'closed',\n\t},\n];\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 handleStatus = ( newCommentStatus ) =>\n\t\teditPost( {\n\t\t\tcomment_status: newCommentStatus,\n\t\t} );\n\n\treturn (\n\t\t<form>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<RadioControl\n\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Comment status' ) }\n\t\t\t\t\toptions={ COMMENT_OPTIONS }\n\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\tselected={ commentStatus }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nexport default PostComments;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,YAAY,EACZC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAA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B,QAAQ,EAAGP,YAAc;IACzBQ,QAAQ,EAAGb;EAAe,CAC1B,CACM,CACH,CAAC;AAET;AAEA,eAAeD,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;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ACb7B,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":[]}
|
|
@@ -3,8 +3,11 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Dropdown, Button, __experimentalVStack as VStack, __experimentalText as Text } from '@wordpress/components';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
8
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
9
|
+
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Internal dependencies
|
|
@@ -13,38 +16,119 @@ import { store as editorStore } from '../../store';
|
|
|
13
16
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
14
17
|
import PostComments from '../post-comments';
|
|
15
18
|
import PostPingbacks from '../post-pingbacks';
|
|
19
|
+
import PostPanelRow from '../post-panel-row';
|
|
16
20
|
const PANEL_NAME = 'discussion-panel';
|
|
17
|
-
function
|
|
21
|
+
function ModalContents({
|
|
22
|
+
onClose
|
|
23
|
+
}) {
|
|
24
|
+
return createElement("div", {
|
|
25
|
+
className: "editor-post-discussion"
|
|
26
|
+
}, createElement(InspectorPopoverHeader, {
|
|
27
|
+
title: __('Discussion'),
|
|
28
|
+
onClose: onClose
|
|
29
|
+
}), createElement(VStack, {
|
|
30
|
+
spacing: 4
|
|
31
|
+
}, createElement(PostTypeSupportCheck, {
|
|
32
|
+
supportKeys: "comments"
|
|
33
|
+
}, createElement(PostComments, null)), createElement(PostTypeSupportCheck, {
|
|
34
|
+
supportKeys: "trackbacks"
|
|
35
|
+
}, createElement(PostPingbacks, null))));
|
|
36
|
+
}
|
|
37
|
+
function PostDiscussionToggle({
|
|
38
|
+
isOpen,
|
|
39
|
+
onClick
|
|
40
|
+
}) {
|
|
18
41
|
const {
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
commentStatus,
|
|
43
|
+
pingStatus,
|
|
44
|
+
commentsSupported,
|
|
45
|
+
trackbacksSupported
|
|
21
46
|
} = useSelect(select => {
|
|
47
|
+
var _getEditedPostAttribu, _getEditedPostAttribu2;
|
|
22
48
|
const {
|
|
23
|
-
|
|
24
|
-
isEditorPanelOpened
|
|
49
|
+
getEditedPostAttribute
|
|
25
50
|
} = select(editorStore);
|
|
51
|
+
const {
|
|
52
|
+
getPostType
|
|
53
|
+
} = select(coreStore);
|
|
54
|
+
const postType = getPostType(getEditedPostAttribute('type'));
|
|
26
55
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
commentStatus: (_getEditedPostAttribu = getEditedPostAttribute('comment_status')) !== null && _getEditedPostAttribu !== void 0 ? _getEditedPostAttribu : 'open',
|
|
57
|
+
pingStatus: (_getEditedPostAttribu2 = getEditedPostAttribute('ping_status')) !== null && _getEditedPostAttribu2 !== void 0 ? _getEditedPostAttribu2 : 'open',
|
|
58
|
+
commentsSupported: !!postType.supports.comments,
|
|
59
|
+
trackbacksSupported: !!postType.supports.trackbacks
|
|
29
60
|
};
|
|
30
61
|
}, []);
|
|
62
|
+
let label;
|
|
63
|
+
if (commentStatus === 'open') {
|
|
64
|
+
if (pingStatus === 'open') {
|
|
65
|
+
label = __('Open');
|
|
66
|
+
} else {
|
|
67
|
+
label = trackbacksSupported ? __('Comments only') : __('Open');
|
|
68
|
+
}
|
|
69
|
+
} else if (pingStatus === 'open') {
|
|
70
|
+
label = commentsSupported ? __('Pings only') : __('Pings enabled');
|
|
71
|
+
} else {
|
|
72
|
+
label = __('Closed');
|
|
73
|
+
}
|
|
74
|
+
return createElement(Button, {
|
|
75
|
+
size: "compact",
|
|
76
|
+
className: "editor-post-discussion__panel-toggle",
|
|
77
|
+
variant: "tertiary",
|
|
78
|
+
"aria-label": __('Change discussion options'),
|
|
79
|
+
"aria-expanded": isOpen,
|
|
80
|
+
onClick: onClick
|
|
81
|
+
}, createElement(Text, null, label));
|
|
82
|
+
}
|
|
83
|
+
export default function PostDiscussionPanel() {
|
|
31
84
|
const {
|
|
32
|
-
|
|
33
|
-
} =
|
|
85
|
+
isEnabled
|
|
86
|
+
} = useSelect(select => {
|
|
87
|
+
const {
|
|
88
|
+
isEditorPanelEnabled
|
|
89
|
+
} = select(editorStore);
|
|
90
|
+
return {
|
|
91
|
+
isEnabled: isEditorPanelEnabled(PANEL_NAME)
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
// Use internal state instead of a ref to make sure that the component
|
|
96
|
+
// re-renders when the popover's anchor updates.
|
|
97
|
+
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
98
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
99
|
+
const popoverProps = useMemo(() => ({
|
|
100
|
+
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
101
|
+
// move around when the label changes.
|
|
102
|
+
anchor: popoverAnchor,
|
|
103
|
+
placement: 'left-start',
|
|
104
|
+
offset: 36,
|
|
105
|
+
shift: true
|
|
106
|
+
}), [popoverAnchor]);
|
|
34
107
|
if (!isEnabled) {
|
|
35
108
|
return null;
|
|
36
109
|
}
|
|
37
110
|
return createElement(PostTypeSupportCheck, {
|
|
38
111
|
supportKeys: ['comments', 'trackbacks']
|
|
39
|
-
}, createElement(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
112
|
+
}, createElement(PostPanelRow, {
|
|
113
|
+
label: __('Discussion'),
|
|
114
|
+
ref: setPopoverAnchor
|
|
115
|
+
}, createElement(Dropdown, {
|
|
116
|
+
popoverProps: popoverProps,
|
|
117
|
+
className: "editor-post-discussion__panel-dropdown",
|
|
118
|
+
contentClassName: "editor-post-discussion__panel-dialog",
|
|
119
|
+
focusOnMount: true,
|
|
120
|
+
renderToggle: ({
|
|
121
|
+
isOpen,
|
|
122
|
+
onToggle
|
|
123
|
+
}) => createElement(PostDiscussionToggle, {
|
|
124
|
+
isOpen: isOpen,
|
|
125
|
+
onClick: onToggle
|
|
126
|
+
}),
|
|
127
|
+
renderContent: ({
|
|
128
|
+
onClose
|
|
129
|
+
}) => createElement(ModalContents, {
|
|
130
|
+
onClose: onClose
|
|
131
|
+
})
|
|
132
|
+
})));
|
|
48
133
|
}
|
|
49
|
-
export default PostDiscussionPanel;
|
|
50
134
|
//# sourceMappingURL=panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","
|
|
1
|
+
{"version":3,"names":["__","Dropdown","Button","__experimentalVStack","VStack","__experimentalText","Text","useSelect","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","store","coreStore","editorStore","PostTypeSupportCheck","PostComments","PostPingbacks","PostPanelRow","PANEL_NAME","ModalContents","onClose","createElement","className","title","spacing","supportKeys","PostDiscussionToggle","isOpen","onClick","commentStatus","pingStatus","commentsSupported","trackbacksSupported","select","_getEditedPostAttribu","_getEditedPostAttribu2","getEditedPostAttribute","getPostType","postType","supports","comments","trackbacks","label","size","variant","PostDiscussionPanel","isEnabled","isEditorPanelEnabled","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-discussion/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport PostComments from '../post-comments';\nimport PostPingbacks from '../post-pingbacks';\nimport PostPanelRow from '../post-panel-row';\n\nconst PANEL_NAME = 'discussion-panel';\n\nfunction ModalContents( { onClose } ) {\n\treturn (\n\t\t<div className=\"editor-post-discussion\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"comments\">\n\t\t\t\t\t<PostComments />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t<PostTypeSupportCheck supportKeys=\"trackbacks\">\n\t\t\t\t\t<PostPingbacks />\n\t\t\t\t</PostTypeSupportCheck>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction PostDiscussionToggle( { isOpen, onClick } ) {\n\tconst {\n\t\tcommentStatus,\n\t\tpingStatus,\n\t\tcommentsSupported,\n\t\ttrackbacksSupported,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tcommentStatus: getEditedPostAttribute( 'comment_status' ) ?? 'open',\n\t\t\tpingStatus: getEditedPostAttribute( 'ping_status' ) ?? 'open',\n\t\t\tcommentsSupported: !! postType.supports.comments,\n\t\t\ttrackbacksSupported: !! postType.supports.trackbacks,\n\t\t};\n\t}, [] );\n\tlet label;\n\tif ( commentStatus === 'open' ) {\n\t\tif ( pingStatus === 'open' ) {\n\t\t\tlabel = __( 'Open' );\n\t\t} else {\n\t\t\tlabel = trackbacksSupported ? __( 'Comments only' ) : __( 'Open' );\n\t\t}\n\t} else if ( pingStatus === 'open' ) {\n\t\tlabel = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );\n\t} else {\n\t\tlabel = __( 'Closed' );\n\t}\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-discussion__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ __( 'Change discussion options' ) }\n\t\t\taria-expanded={ isOpen }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t<Text>{ label }</Text>\n\t\t</Button>\n\t);\n}\n\nexport default function PostDiscussionPanel() {\n\tconst { isEnabled } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelEnabled } = select( editorStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys={ [ 'comments', 'trackbacks' ] }>\n\t\t\t<PostPanelRow label={ __( 'Discussion' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-discussion__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-discussion__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostDiscussionToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<ModalContents onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,QAAQ,EACRC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,YAAY,MAAM,mBAAmB;AAE5C,MAAMC,UAAU,GAAG,kBAAkB;AAErC,SAASC,aAAaA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACrC,OACCC,aAAA;IAAKC,SAAS,EAAC;EAAwB,GACtCD,aAAA,CAACX,sBAAsB;IACtBa,KAAK,EAAGxB,EAAE,CAAE,YAAa,CAAG;IAC5BqB,OAAO,EAAGA;EAAS,CACnB,CAAC,EACFC,aAAA,CAAClB,MAAM;IAACqB,OAAO,EA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GACjEJ,aAAA,CAACJ,YAAY;IAACyB,KAAK,EAAG3C,EAAE,CAAE,YAAa,CAAG;IAACwD,GAAG,EAAGN;EAAkB,GAClE5B,aAAA,CAACrB,QAAQ;IACRkD,YAAY,EAAGA,YAAc;IAC7B5B,SAAS,EAAC,wCAAwC;IAClDkC,gBAAgB,EAAC,sCAAsC;IACvDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAE/B,MAAM;MAAEgC;IAAS,CAAC,KACpCtC,aAAA,CAACK,oBAAoB;MACpBC,MAAM,EAAGA,MAAQ;MACjBC,OAAO,EAAG+B;IAAU,CACpB,CACC;IACHC,aAAa,EAAGA,CAAE;MAAExC;IAAQ,CAAC,KAC5BC,aAAA,CAACF,aAAa;MAACC,OAAO,EAAGA;IAAS,CAAE;EAClC,CACH,CACY,CACO,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
|
|
7
2
|
/**
|
|
8
3
|
* Internal dependencies
|
|
9
4
|
*/
|
|
10
5
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
11
|
-
import { store as editorStore } from '../../store';
|
|
12
6
|
|
|
13
7
|
/**
|
|
14
8
|
* Component for checking if the post type supports the excerpt field.
|
|
@@ -21,19 +15,6 @@ import { store as editorStore } from '../../store';
|
|
|
21
15
|
function PostExcerptCheck({
|
|
22
16
|
children
|
|
23
17
|
}) {
|
|
24
|
-
const postType = useSelect(select => {
|
|
25
|
-
const {
|
|
26
|
-
getEditedPostAttribute
|
|
27
|
-
} = select(editorStore);
|
|
28
|
-
return getEditedPostAttribute('type');
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
// This special case is unfortunate, but the REST API of wp_template and wp_template_part
|
|
32
|
-
// support the excerpt field throught the "description" field rather than "excerpt" which means
|
|
33
|
-
// the default ExcerptPanel won't work for these.
|
|
34
|
-
if (['wp_template', 'wp_template_part'].includes(postType)) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
18
|
return createElement(PostTypeSupportCheck, {
|
|
38
19
|
supportKeys: "excerpt"
|
|
39
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":[]}
|