@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { useState } from '@wordpress/element';
|
|
5
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import {
|
|
8
8
|
privateApis as componentsPrivateApis,
|
|
@@ -17,11 +17,6 @@ import { moreVertical } from '@wordpress/icons';
|
|
|
17
17
|
import { unlock } from '../../lock-unlock';
|
|
18
18
|
import { usePostActions } from './actions';
|
|
19
19
|
import { store as editorStore } from '../../store';
|
|
20
|
-
import {
|
|
21
|
-
TEMPLATE_POST_TYPE,
|
|
22
|
-
TEMPLATE_PART_POST_TYPE,
|
|
23
|
-
PATTERN_POST_TYPE,
|
|
24
|
-
} from '../../store/constants';
|
|
25
20
|
|
|
26
21
|
const {
|
|
27
22
|
DropdownMenuV2: DropdownMenu,
|
|
@@ -31,50 +26,50 @@ const {
|
|
|
31
26
|
kebabCase,
|
|
32
27
|
} = unlock( componentsPrivateApis );
|
|
33
28
|
|
|
34
|
-
const POST_ACTIONS_WHILE_EDITING = [
|
|
35
|
-
'view-post',
|
|
36
|
-
'view-post-revisions',
|
|
37
|
-
'rename-post',
|
|
38
|
-
'move-to-trash',
|
|
39
|
-
];
|
|
40
|
-
|
|
41
29
|
export default function PostActions( { onActionPerformed, buttonProps } ) {
|
|
42
|
-
const
|
|
30
|
+
const [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );
|
|
31
|
+
const { item, postType } = useSelect( ( select ) => {
|
|
43
32
|
const { getCurrentPostType, getCurrentPost } = select( editorStore );
|
|
44
33
|
return {
|
|
45
|
-
postType: getCurrentPostType(),
|
|
46
34
|
item: getCurrentPost(),
|
|
35
|
+
postType: getCurrentPostType(),
|
|
47
36
|
};
|
|
48
|
-
} );
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
}, [] );
|
|
38
|
+
const allActions = usePostActions( postType, onActionPerformed );
|
|
39
|
+
|
|
40
|
+
const actions = useMemo( () => {
|
|
41
|
+
return allActions.filter( ( action ) => {
|
|
42
|
+
return ! action.isEligible || action.isEligible( item );
|
|
43
|
+
} );
|
|
44
|
+
}, [ allActions, item ] );
|
|
53
45
|
|
|
54
|
-
if (
|
|
55
|
-
[
|
|
56
|
-
TEMPLATE_POST_TYPE,
|
|
57
|
-
TEMPLATE_PART_POST_TYPE,
|
|
58
|
-
PATTERN_POST_TYPE,
|
|
59
|
-
].includes( postType )
|
|
60
|
-
) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
46
|
return (
|
|
64
47
|
<DropdownMenu
|
|
48
|
+
open={ isActionsMenuOpen }
|
|
65
49
|
trigger={
|
|
66
50
|
<Button
|
|
67
51
|
size="small"
|
|
68
52
|
icon={ moreVertical }
|
|
69
53
|
label={ __( 'Actions' ) }
|
|
70
54
|
disabled={ ! actions.length }
|
|
55
|
+
__experimentalIsFocusable
|
|
71
56
|
className="editor-all-actions-button"
|
|
57
|
+
onClick={ () =>
|
|
58
|
+
setIsActionsMenuOpen( ! isActionsMenuOpen )
|
|
59
|
+
}
|
|
72
60
|
{ ...buttonProps }
|
|
73
61
|
/>
|
|
74
62
|
}
|
|
63
|
+
onOpenChange={ setIsActionsMenuOpen }
|
|
75
64
|
placement="bottom-end"
|
|
76
65
|
>
|
|
77
|
-
<ActionsDropdownMenuGroup
|
|
66
|
+
<ActionsDropdownMenuGroup
|
|
67
|
+
actions={ actions }
|
|
68
|
+
item={ item }
|
|
69
|
+
onClose={ () => {
|
|
70
|
+
setIsActionsMenuOpen( false );
|
|
71
|
+
} }
|
|
72
|
+
/>
|
|
78
73
|
</DropdownMenu>
|
|
79
74
|
);
|
|
80
75
|
}
|
|
@@ -97,7 +92,8 @@ function DropdownMenuItemTrigger( { action, onClick } ) {
|
|
|
97
92
|
}
|
|
98
93
|
|
|
99
94
|
// Copied as is from packages/dataviews/src/item-actions.js
|
|
100
|
-
|
|
95
|
+
// With an added onClose prop.
|
|
96
|
+
function ActionWithModal( { action, item, ActionTrigger, onClose } ) {
|
|
101
97
|
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
102
98
|
const actionTriggerProps = {
|
|
103
99
|
action,
|
|
@@ -120,7 +116,10 @@ function ActionWithModal( { action, item, ActionTrigger } ) {
|
|
|
120
116
|
>
|
|
121
117
|
<RenderModal
|
|
122
118
|
items={ [ item ] }
|
|
123
|
-
closeModal={ () =>
|
|
119
|
+
closeModal={ () => {
|
|
120
|
+
setIsModalOpen( false );
|
|
121
|
+
onClose();
|
|
122
|
+
} }
|
|
124
123
|
/>
|
|
125
124
|
</Modal>
|
|
126
125
|
) }
|
|
@@ -129,7 +128,8 @@ function ActionWithModal( { action, item, ActionTrigger } ) {
|
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
// Copied as is from packages/dataviews/src/item-actions.js
|
|
132
|
-
|
|
131
|
+
// With an added onClose prop.
|
|
132
|
+
function ActionsDropdownMenuGroup( { actions, item, onClose } ) {
|
|
133
133
|
return (
|
|
134
134
|
<DropdownMenuGroup>
|
|
135
135
|
{ actions.map( ( action ) => {
|
|
@@ -140,6 +140,7 @@ function ActionsDropdownMenuGroup( { actions, item } ) {
|
|
|
140
140
|
action={ action }
|
|
141
141
|
item={ item }
|
|
142
142
|
ActionTrigger={ DropdownMenuItemTrigger }
|
|
143
|
+
onClose={ onClose }
|
|
143
144
|
/>
|
|
144
145
|
);
|
|
145
146
|
}
|
|
@@ -11,6 +11,15 @@ import PostTypeSupportCheck from '../post-type-support-check';
|
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
12
|
import { AUTHORS_QUERY } from './constants';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Wrapper component that renders its children only if the post type supports the author.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} props The component props.
|
|
18
|
+
* @param {Element} props.children Children to be rendered.
|
|
19
|
+
*
|
|
20
|
+
* @return {Component|null} The component to be rendered. Return `null` if the post type doesn't
|
|
21
|
+
* supports the author or if there are no authors available.
|
|
22
|
+
*/
|
|
14
23
|
export default function PostAuthorCheck( { children } ) {
|
|
15
24
|
const { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {
|
|
16
25
|
const post = select( editorStore ).getCurrentPost();
|
|
@@ -13,6 +13,11 @@ import { AUTHORS_QUERY } from './constants';
|
|
|
13
13
|
|
|
14
14
|
const minimumUsersForCombobox = 25;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Renders the component for selecting the post author.
|
|
18
|
+
*
|
|
19
|
+
* @return {Component} The component to be rendered.
|
|
20
|
+
*/
|
|
16
21
|
function PostAuthor() {
|
|
17
22
|
const showCombobox = useSelect( ( select ) => {
|
|
18
23
|
const authors = select( coreStore ).getUsers( AUTHORS_QUERY );
|
|
@@ -5,6 +5,11 @@ import PostAuthorCheck from './check';
|
|
|
5
5
|
import PostAuthorForm from './index';
|
|
6
6
|
import PostPanelRow from '../post-panel-row';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Renders the Post Author Panel component.
|
|
10
|
+
*
|
|
11
|
+
* @return {Component} The component to be rendered.
|
|
12
|
+
*/
|
|
8
13
|
export function PostAuthor() {
|
|
9
14
|
return (
|
|
10
15
|
<PostAuthorCheck>
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import {
|
|
10
5
|
Icon,
|
|
11
6
|
__experimentalHStack as HStack,
|
|
12
|
-
__experimentalVStack as VStack,
|
|
13
7
|
__experimentalText as Text,
|
|
14
|
-
PanelBody,
|
|
15
8
|
} from '@wordpress/components';
|
|
16
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
17
10
|
import { useSelect } from '@wordpress/data';
|
|
18
|
-
import { __
|
|
19
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
20
12
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
21
|
-
import { count as wordCount } from '@wordpress/wordcount';
|
|
22
|
-
import { useMemo } from '@wordpress/element';
|
|
23
13
|
|
|
24
14
|
/**
|
|
25
15
|
* Internal dependencies
|
|
@@ -30,139 +20,48 @@ import {
|
|
|
30
20
|
TEMPLATE_PART_POST_TYPE,
|
|
31
21
|
} from '../../store/constants';
|
|
32
22
|
import { unlock } from '../../lock-unlock';
|
|
33
|
-
import TemplateAreas from '../template-areas';
|
|
34
23
|
|
|
35
|
-
export default function PostCardPanel( {
|
|
36
|
-
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
templateInfo: _templateInfo,
|
|
58
|
-
icon: unlock( select( editorStore ) ).getPostIcon( _type, {
|
|
59
|
-
area: _record?.area,
|
|
60
|
-
} ),
|
|
61
|
-
isPostsPage: +_id === siteSettings?.page_for_posts,
|
|
62
|
-
};
|
|
63
|
-
}, [] );
|
|
64
|
-
const description = templateInfo?.description;
|
|
65
|
-
const lastEditedText =
|
|
66
|
-
modified &&
|
|
67
|
-
sprintf(
|
|
68
|
-
// translators: %s: Human-readable time difference, e.g. "2 days ago".
|
|
69
|
-
__( 'Last edited %s.' ),
|
|
70
|
-
humanTimeDiff( modified )
|
|
71
|
-
);
|
|
72
|
-
const showPostContentInfo =
|
|
73
|
-
! isPostsPage &&
|
|
74
|
-
! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( postType );
|
|
24
|
+
export default function PostCardPanel( { actions } ) {
|
|
25
|
+
const { title, icon } = useSelect( ( select ) => {
|
|
26
|
+
const {
|
|
27
|
+
getEditedPostAttribute,
|
|
28
|
+
getCurrentPostType,
|
|
29
|
+
getCurrentPostId,
|
|
30
|
+
__experimentalGetTemplateInfo,
|
|
31
|
+
} = select( editorStore );
|
|
32
|
+
const { getEditedEntityRecord } = select( coreStore );
|
|
33
|
+
const _type = getCurrentPostType();
|
|
34
|
+
const _id = getCurrentPostId();
|
|
35
|
+
const _record = getEditedEntityRecord( 'postType', _type, _id );
|
|
36
|
+
const _templateInfo =
|
|
37
|
+
[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( _type ) &&
|
|
38
|
+
__experimentalGetTemplateInfo( _record );
|
|
39
|
+
return {
|
|
40
|
+
title: _templateInfo?.title || getEditedPostAttribute( 'title' ),
|
|
41
|
+
icon: unlock( select( editorStore ) ).getPostIcon( _type, {
|
|
42
|
+
area: _record?.area,
|
|
43
|
+
} ),
|
|
44
|
+
};
|
|
45
|
+
}, [] );
|
|
75
46
|
return (
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
|
|
47
|
+
<div className="editor-post-card-panel">
|
|
48
|
+
<HStack
|
|
49
|
+
spacing={ 2 }
|
|
50
|
+
className="editor-post-card-panel__header"
|
|
51
|
+
align="flex-start"
|
|
79
52
|
>
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
53
|
+
<Icon className="editor-post-card-panel__icon" icon={ icon } />
|
|
54
|
+
<Text
|
|
55
|
+
numberOfLines={ 2 }
|
|
56
|
+
truncate
|
|
57
|
+
className="editor-post-card-panel__title"
|
|
58
|
+
weight={ 500 }
|
|
59
|
+
as="h2"
|
|
84
60
|
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
numberOfLines={ 2 }
|
|
91
|
-
truncate
|
|
92
|
-
className="editor-post-card-panel__title"
|
|
93
|
-
weight={ 500 }
|
|
94
|
-
as="h2"
|
|
95
|
-
>
|
|
96
|
-
{ title ? decodeEntities( title ) : __( 'No Title' ) }
|
|
97
|
-
</Text>
|
|
98
|
-
{ actions }
|
|
99
|
-
</HStack>
|
|
100
|
-
<VStack className="editor-post-card-panel__content">
|
|
101
|
-
{ ( description ||
|
|
102
|
-
lastEditedText ||
|
|
103
|
-
showPostContentInfo ) && (
|
|
104
|
-
<VStack
|
|
105
|
-
className="editor-post-card-panel__description"
|
|
106
|
-
spacing={ 2 }
|
|
107
|
-
>
|
|
108
|
-
{ description && <Text>{ description }</Text> }
|
|
109
|
-
{ showPostContentInfo && <PostContentInfo /> }
|
|
110
|
-
{ lastEditedText && (
|
|
111
|
-
<Text>{ lastEditedText }</Text>
|
|
112
|
-
) }
|
|
113
|
-
</VStack>
|
|
114
|
-
) }
|
|
115
|
-
{ postType === TEMPLATE_POST_TYPE && <TemplateAreas /> }
|
|
116
|
-
</VStack>
|
|
117
|
-
</div>
|
|
118
|
-
</PanelBody>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
123
|
-
const AVERAGE_READING_RATE = 189;
|
|
124
|
-
|
|
125
|
-
// This component renders the wordcount and reading time for the post.
|
|
126
|
-
function PostContentInfo() {
|
|
127
|
-
const postContent = useSelect(
|
|
128
|
-
( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),
|
|
129
|
-
[]
|
|
130
|
-
);
|
|
131
|
-
/*
|
|
132
|
-
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
133
|
-
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
134
|
-
* Do not translate into your own language.
|
|
135
|
-
*/
|
|
136
|
-
const wordCountType = _x( 'words', 'Word count type. Do not translate!' );
|
|
137
|
-
const wordsCounted = useMemo(
|
|
138
|
-
() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),
|
|
139
|
-
[ postContent, wordCountType ]
|
|
140
|
-
);
|
|
141
|
-
if ( ! wordsCounted ) {
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
const readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );
|
|
145
|
-
const wordsCountText = sprintf(
|
|
146
|
-
// translators: %s: the number of words in the post.
|
|
147
|
-
_n( '%s word', '%s words', wordsCounted ),
|
|
148
|
-
wordsCounted.toLocaleString()
|
|
149
|
-
);
|
|
150
|
-
const minutesText =
|
|
151
|
-
readingTime <= 1
|
|
152
|
-
? __( '1 minute' )
|
|
153
|
-
: sprintf(
|
|
154
|
-
// translators: %s: the number of minutes to read the post.
|
|
155
|
-
_n( '%s minute', '%s minutes', readingTime ),
|
|
156
|
-
readingTime.toLocaleString()
|
|
157
|
-
);
|
|
158
|
-
return (
|
|
159
|
-
<Text>
|
|
160
|
-
{ sprintf(
|
|
161
|
-
/* 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.) */
|
|
162
|
-
__( '%1$s, %2$s read time.' ),
|
|
163
|
-
wordsCountText,
|
|
164
|
-
minutesText
|
|
165
|
-
) }
|
|
166
|
-
</Text>
|
|
61
|
+
{ title ? decodeEntities( title ) : __( 'No Title' ) }
|
|
62
|
+
</Text>
|
|
63
|
+
{ actions }
|
|
64
|
+
</HStack>
|
|
65
|
+
</div>
|
|
167
66
|
);
|
|
168
67
|
}
|
|
@@ -20,13 +20,9 @@
|
|
|
20
20
|
&__header {
|
|
21
21
|
display: flex;
|
|
22
22
|
justify-content: space-between;
|
|
23
|
-
margin: 0 0 $grid-unit-10;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
&
|
|
27
|
-
|
|
28
|
-
& .components-text {
|
|
29
|
-
color: inherit;
|
|
30
|
-
}
|
|
25
|
+
&.has-description &__header {
|
|
26
|
+
margin-bottom: $grid-unit-10;
|
|
31
27
|
}
|
|
32
28
|
}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
RadioControl,
|
|
7
|
+
__experimentalText as Text,
|
|
8
|
+
__experimentalVStack as VStack,
|
|
9
|
+
} from '@wordpress/components';
|
|
6
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
11
|
|
|
8
12
|
/**
|
|
@@ -10,6 +14,34 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
10
14
|
*/
|
|
11
15
|
import { store as editorStore } from '../../store';
|
|
12
16
|
|
|
17
|
+
const COMMENT_OPTIONS = [
|
|
18
|
+
{
|
|
19
|
+
label: (
|
|
20
|
+
<>
|
|
21
|
+
{ __( 'Open' ) }
|
|
22
|
+
<Text variant="muted" size={ 12 }>
|
|
23
|
+
{ __( 'Visitors can add new comments and replies.' ) }
|
|
24
|
+
</Text>
|
|
25
|
+
</>
|
|
26
|
+
),
|
|
27
|
+
value: 'open',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: (
|
|
31
|
+
<>
|
|
32
|
+
{ __( 'Closed' ) }
|
|
33
|
+
<Text variant="muted" size={ 12 }>
|
|
34
|
+
{ __( 'Visitors cannot add new comments or replies.' ) }
|
|
35
|
+
</Text>
|
|
36
|
+
<Text variant="muted" size={ 12 }>
|
|
37
|
+
{ __( 'Existing comments remain visible.' ) }
|
|
38
|
+
</Text>
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
value: 'closed',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
13
45
|
function PostComments() {
|
|
14
46
|
const commentStatus = useSelect(
|
|
15
47
|
( select ) =>
|
|
@@ -18,18 +50,24 @@ function PostComments() {
|
|
|
18
50
|
[]
|
|
19
51
|
);
|
|
20
52
|
const { editPost } = useDispatch( editorStore );
|
|
21
|
-
const
|
|
53
|
+
const handleStatus = ( newCommentStatus ) =>
|
|
22
54
|
editPost( {
|
|
23
|
-
comment_status:
|
|
55
|
+
comment_status: newCommentStatus,
|
|
24
56
|
} );
|
|
25
57
|
|
|
26
58
|
return (
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
<form>
|
|
60
|
+
<VStack spacing={ 4 }>
|
|
61
|
+
<RadioControl
|
|
62
|
+
className="editor-change-status__options"
|
|
63
|
+
hideLabelFromVision
|
|
64
|
+
label={ __( 'Comment status' ) }
|
|
65
|
+
options={ COMMENT_OPTIONS }
|
|
66
|
+
onChange={ handleStatus }
|
|
67
|
+
selected={ commentStatus }
|
|
68
|
+
/>
|
|
69
|
+
</VStack>
|
|
70
|
+
</form>
|
|
33
71
|
);
|
|
34
72
|
}
|
|
35
73
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __experimentalText as Text } from '@wordpress/components';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __, _x, _n, sprintf } from '@wordpress/i18n';
|
|
7
|
+
import { count as wordCount } from '@wordpress/wordcount';
|
|
8
|
+
import { useMemo } from '@wordpress/element';
|
|
9
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { store as editorStore } from '../../store';
|
|
15
|
+
import {
|
|
16
|
+
TEMPLATE_POST_TYPE,
|
|
17
|
+
TEMPLATE_PART_POST_TYPE,
|
|
18
|
+
} from '../../store/constants';
|
|
19
|
+
|
|
20
|
+
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
21
|
+
const AVERAGE_READING_RATE = 189;
|
|
22
|
+
|
|
23
|
+
// This component renders the wordcount and reading time for the post.
|
|
24
|
+
export default function PostContentInformation() {
|
|
25
|
+
const { postContent } = useSelect( ( select ) => {
|
|
26
|
+
const { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =
|
|
27
|
+
select( editorStore );
|
|
28
|
+
const { getEntityRecord } = select( coreStore );
|
|
29
|
+
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
30
|
+
const postType = getCurrentPostType();
|
|
31
|
+
const _id = getCurrentPostId();
|
|
32
|
+
const isPostsPage = +_id === siteSettings?.page_for_posts;
|
|
33
|
+
const showPostContentInfo =
|
|
34
|
+
! isPostsPage &&
|
|
35
|
+
! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(
|
|
36
|
+
postType
|
|
37
|
+
);
|
|
38
|
+
return {
|
|
39
|
+
postContent:
|
|
40
|
+
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(
|
|
51
|
+
() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),
|
|
52
|
+
[ postContent, wordCountType ]
|
|
53
|
+
);
|
|
54
|
+
if ( ! wordsCounted ) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );
|
|
58
|
+
const wordsCountText = sprintf(
|
|
59
|
+
// translators: %s: the number of words in the post.
|
|
60
|
+
_n( '%s word', '%s words', wordsCounted ),
|
|
61
|
+
wordsCounted.toLocaleString()
|
|
62
|
+
);
|
|
63
|
+
const minutesText =
|
|
64
|
+
readingTime <= 1
|
|
65
|
+
? __( '1 minute' )
|
|
66
|
+
: sprintf(
|
|
67
|
+
// translators: %s: the number of minutes to read the post.
|
|
68
|
+
_n( '%s minute', '%s minutes', readingTime ),
|
|
69
|
+
readingTime.toLocaleString()
|
|
70
|
+
);
|
|
71
|
+
return (
|
|
72
|
+
<div className="editor-post-content-information">
|
|
73
|
+
<Text>
|
|
74
|
+
{ sprintf(
|
|
75
|
+
/* 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.) */
|
|
76
|
+
__( '%1$s, %2$s read time.' ),
|
|
77
|
+
wordsCountText,
|
|
78
|
+
minutesText
|
|
79
|
+
) }
|
|
80
|
+
</Text>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|