@wordpress/editor 14.9.0 → 14.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +2 -2
- package/build/bindings/api.js +0 -29
- package/build/bindings/api.js.map +1 -1
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/block-manager/index.js +2 -2
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +120 -0
- package/build/components/collab-sidebar/add-comment.js.map +1 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build/components/collab-sidebar/comment-button.js +37 -0
- package/build/components/collab-sidebar/comment-button.js.map +1 -0
- package/build/components/collab-sidebar/comments.js +321 -0
- package/build/components/collab-sidebar/comments.js.map +1 -0
- package/build/components/collab-sidebar/constants.js +8 -0
- package/build/components/collab-sidebar/constants.js.map +1 -0
- package/build/components/collab-sidebar/index.js +272 -0
- package/build/components/collab-sidebar/index.js.map +1 -0
- package/build/components/collab-sidebar/utils.js +16 -0
- package/build/components/collab-sidebar/utils.js.map +1 -0
- package/build/components/commands/index.js +6 -6
- package/build/components/commands/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/utils.js.map +1 -1
- package/build/components/document-bar/index.js +8 -7
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +2 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-interface/index.js +4 -14
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +2 -2
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +13 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +5 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +2 -2
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -5
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +13 -11
- package/build/components/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +15 -13
- package/build/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +0 -15
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/index.js +5 -5
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/panel.js +4 -4
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -36
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +2 -3
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +26 -7
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/index.js +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +2 -2
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +1 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-schedule/label.js +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +13 -5
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +1 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/classic-theme.js +2 -4
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +15 -19
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +2 -2
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/index.js +76 -63
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +49 -29
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +0 -4
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +10 -12
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/resizable-editor/resize-handle.js.map +1 -1
- package/build/components/sidebar/header.js +2 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +3 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -2
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +4 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/components/visual-editor/index.js +24 -25
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
- package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/zoom-out-toggle/index.js +37 -5
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/actions/duplicate-template-part.js +3 -3
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build/private-apis.js +0 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +30 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -0
- package/build/store/constants.js.map +1 -1
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/private-actions.js +8 -7
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +24 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/pageTypeBadge.js +51 -0
- package/build/utils/pageTypeBadge.js.map +1 -0
- package/build/utils/terms.js +2 -2
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/api.js +1 -29
- package/build-module/bindings/api.js.map +1 -1
- package/build-module/bindings/post-meta.js +2 -1
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -3
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/block-manager/category.js +1 -2
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +1 -2
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +3 -4
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -3
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/blog-title/index.js +1 -3
- package/build-module/components/blog-title/index.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +114 -0
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button.js +30 -0
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
- package/build-module/components/collab-sidebar/comments.js +314 -0
- package/build-module/components/collab-sidebar/comments.js.map +1 -0
- package/build-module/components/collab-sidebar/constants.js +2 -0
- package/build-module/components/collab-sidebar/constants.js.map +1 -0
- package/build-module/components/collab-sidebar/index.js +264 -0
- package/build-module/components/collab-sidebar/index.js.map +1 -0
- package/build-module/components/collab-sidebar/utils.js +10 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -0
- package/build-module/components/collapsible-block-toolbar/index.js +1 -3
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/commands/index.js +6 -6
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/utils.js.map +1 -1
- package/build-module/components/document-bar/index.js +10 -10
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +1 -2
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +1 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +4 -10
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -3
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +1 -3
- package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -2
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +1 -3
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -3
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +1 -3
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +1 -3
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +1 -2
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-interface/index.js +5 -17
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -3
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +1 -3
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -2
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +3 -4
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js +1 -2
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +13 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +6 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -2
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/list-view-sidebar/list-view-outline.js +1 -3
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +1 -3
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/offline-status/index.native.js +1 -2
- package/build-module/components/offline-status/index.native.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +6 -7
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-document-setting-panel/index.js +1 -3
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +12 -10
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +14 -12
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +0 -15
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +6 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +5 -6
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -38
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +2 -3
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +1 -2
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +1 -3
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +27 -9
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/index.js +2 -3
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +1 -2
- package/build-module/components/post-format/panel.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +3 -5
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-panel-row/index.js +1 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +2 -4
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -2
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -3
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -2
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -3
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -2
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +1 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +2 -4
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -3
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-status/index.js +1 -3
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +1 -3
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +16 -10
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -4
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -2
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +1 -3
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +3 -6
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +1 -2
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js +1 -3
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +1 -3
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +1 -3
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/index.js +15 -19
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +2 -2
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -2
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-url/index.js +78 -66
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +51 -31
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-visibility/index.js +1 -2
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/posts-per-page/index.js +1 -3
- package/build-module/components/posts-per-page/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -3
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +1 -7
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +11 -15
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +1 -3
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/resizable-editor/resize-handle.js +1 -3
- package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +1 -3
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/header.js +3 -3
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -6
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +1 -3
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/site-discussion/index.js +1 -3
- package/build-module/components/site-discussion/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +1 -2
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +1 -3
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-part-menu-items/convert-to-template-part.js +1 -3
- package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +1 -3
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +1 -2
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +2 -2
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/visual-editor/index.js +26 -29
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/zoom-out-toggle/index.js +37 -5
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js +4 -4
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -3
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +1 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +30 -4
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +1 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/private-actions.js +9 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +24 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +45 -0
- package/build-module/utils/pageTypeBadge.js.map +1 -0
- package/build-module/utils/terms.js +2 -2
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +116 -59
- package/build-style/style.css +116 -59
- package/build-types/bindings/api.d.ts +0 -13
- package/build-types/bindings/api.d.ts.map +1 -1
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +19 -0
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/constants.d.ts +2 -0
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts +5 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +8 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts +1 -2
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/post-url/panel.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +1 -4
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +21 -0
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +5 -0
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts.map +1 -1
- package/package.json +39 -38
- package/src/bindings/api.js +1 -32
- package/src/bindings/post-meta.js +1 -0
- package/src/components/collab-sidebar/add-comment.js +124 -0
- package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
- package/src/components/collab-sidebar/comment-button.js +31 -0
- package/src/components/collab-sidebar/comments.js +404 -0
- package/src/components/collab-sidebar/constants.js +1 -0
- package/src/components/collab-sidebar/index.js +307 -0
- package/src/components/collab-sidebar/style.scss +111 -0
- package/src/components/collab-sidebar/utils.js +9 -0
- package/src/components/commands/index.js +9 -7
- package/src/components/document-bar/index.js +15 -7
- package/src/components/document-bar/style.scss +0 -4
- package/src/components/document-tools/index.js +2 -8
- package/src/components/editor-interface/index.js +4 -18
- package/src/components/entities-saved-states/index.js +2 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/src/components/global-styles-provider/index.js +20 -6
- package/src/components/header/index.js +3 -1
- package/src/components/header/style.scss +1 -0
- package/src/components/inserter-sidebar/index.js +3 -6
- package/src/components/page-attributes/parent.js +6 -4
- package/src/components/plugin-more-menu-item/index.js +12 -11
- package/src/components/plugin-preview-menu-item/index.js +14 -13
- package/src/components/plugin-sidebar/index.js +0 -13
- package/src/components/post-actions/index.js +8 -11
- package/src/components/post-author/panel.js +4 -2
- package/src/components/post-card-panel/index.js +9 -43
- package/src/components/post-card-panel/style.scss +1 -9
- package/src/components/post-content-information/index.js +1 -1
- package/src/components/post-featured-image/index.js +31 -16
- package/src/components/post-featured-image/style.scss +5 -2
- package/src/components/post-last-revision/index.js +1 -1
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-sticky/test/index.js +6 -6
- package/src/components/post-taxonomies/flat-term-selector.js +15 -4
- package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -2
- package/src/components/post-template/classic-theme.js +1 -2
- package/src/components/post-url/index.js +67 -55
- package/src/components/post-url/panel.js +61 -35
- package/src/components/post-url/style.scss +21 -3
- package/src/components/preview-dropdown/index.js +0 -2
- package/src/components/provider/index.js +32 -24
- package/src/components/provider/use-block-editor-settings.js +1 -1
- package/src/components/sidebar/header.js +3 -2
- package/src/components/sidebar/index.js +5 -3
- package/src/components/time-to-read/index.js +3 -3
- package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
- package/src/components/visual-editor/index.js +32 -39
- package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
- package/src/components/zoom-out-toggle/index.js +39 -5
- package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
- package/src/private-apis.js +1 -5
- package/src/store/actions.js +33 -4
- package/src/store/private-actions.js +3 -3
- package/src/store/selectors.js +24 -2
- package/src/style.scss +1 -0
- package/src/utils/pageTypeBadge.js +41 -0
- package/src/utils/terms.js +4 -2
- package/src/utils/test/terms.js +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Comments = Comments;
|
|
8
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _date = require("@wordpress/date");
|
|
12
|
+
var _icons = require("@wordpress/icons");
|
|
13
|
+
var _i18n = require("@wordpress/i18n");
|
|
14
|
+
var _data = require("@wordpress/data");
|
|
15
|
+
var _coreData = require("@wordpress/core-data");
|
|
16
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
/**
|
|
20
|
+
* External dependencies
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* WordPress dependencies
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Internal dependencies
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Renders the Comments component.
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} props - The component props.
|
|
35
|
+
* @param {Array} props.threads - The array of comment threads.
|
|
36
|
+
* @param {Function} props.onEditComment - The function to handle comment editing.
|
|
37
|
+
* @param {Function} props.onAddReply - The function to add a reply to a comment.
|
|
38
|
+
* @param {Function} props.onCommentDelete - The function to delete a comment.
|
|
39
|
+
* @param {Function} props.onCommentResolve - The function to mark a comment as resolved.
|
|
40
|
+
* @return {JSX.Element} The rendered Comments component.
|
|
41
|
+
*/
|
|
42
|
+
function Comments({
|
|
43
|
+
threads,
|
|
44
|
+
onEditComment,
|
|
45
|
+
onAddReply,
|
|
46
|
+
onCommentDelete,
|
|
47
|
+
onCommentResolve
|
|
48
|
+
}) {
|
|
49
|
+
const [actionState, setActionState] = (0, _element.useState)(false);
|
|
50
|
+
const [isConfirmDialogOpen, setIsConfirmDialogOpen] = (0, _element.useState)(false);
|
|
51
|
+
const handleConfirmDelete = () => {
|
|
52
|
+
onCommentDelete(actionState.id);
|
|
53
|
+
setActionState(false);
|
|
54
|
+
setIsConfirmDialogOpen(false);
|
|
55
|
+
};
|
|
56
|
+
const handleConfirmResolve = () => {
|
|
57
|
+
onCommentResolve(actionState.id);
|
|
58
|
+
setActionState(false);
|
|
59
|
+
setIsConfirmDialogOpen(false);
|
|
60
|
+
};
|
|
61
|
+
const handleCancelDelete = () => {
|
|
62
|
+
setActionState(false);
|
|
63
|
+
setIsConfirmDialogOpen(false);
|
|
64
|
+
};
|
|
65
|
+
const blockCommentId = (0, _data.useSelect)(select => {
|
|
66
|
+
var _select$getBlock$attr;
|
|
67
|
+
const clientID = select(_blockEditor.store).getSelectedBlockClientId();
|
|
68
|
+
return (_select$getBlock$attr = select(_blockEditor.store).getBlock(clientID)?.attributes?.blockCommentId) !== null && _select$getBlock$attr !== void 0 ? _select$getBlock$attr : false;
|
|
69
|
+
}, []);
|
|
70
|
+
const CommentBoard = ({
|
|
71
|
+
thread,
|
|
72
|
+
parentThread
|
|
73
|
+
}) => {
|
|
74
|
+
var _parentThread$status;
|
|
75
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CommentHeader, {
|
|
77
|
+
thread: thread,
|
|
78
|
+
onResolve: () => {
|
|
79
|
+
var _parentThread$id;
|
|
80
|
+
setActionState({
|
|
81
|
+
action: 'resolve',
|
|
82
|
+
id: (_parentThread$id = parentThread?.id) !== null && _parentThread$id !== void 0 ? _parentThread$id : thread.id
|
|
83
|
+
});
|
|
84
|
+
setIsConfirmDialogOpen(true);
|
|
85
|
+
},
|
|
86
|
+
onEdit: () => setActionState({
|
|
87
|
+
action: 'edit',
|
|
88
|
+
id: thread.id
|
|
89
|
+
}),
|
|
90
|
+
onDelete: () => {
|
|
91
|
+
setActionState({
|
|
92
|
+
action: 'delete',
|
|
93
|
+
id: thread.id
|
|
94
|
+
});
|
|
95
|
+
setIsConfirmDialogOpen(true);
|
|
96
|
+
},
|
|
97
|
+
onReply: !parentThread ? () => setActionState({
|
|
98
|
+
action: 'reply',
|
|
99
|
+
id: thread.id
|
|
100
|
+
}) : undefined,
|
|
101
|
+
status: (_parentThread$status = parentThread?.status) !== null && _parentThread$status !== void 0 ? _parentThread$status : thread.status
|
|
102
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
|
|
103
|
+
alignment: "left",
|
|
104
|
+
spacing: "3",
|
|
105
|
+
justify: "flex-start",
|
|
106
|
+
className: "editor-collab-sidebar-panel__user-comment",
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
108
|
+
spacing: "3",
|
|
109
|
+
className: "editor-collab-sidebar-panel__comment-field",
|
|
110
|
+
children: ['edit' === actionState?.action && thread.id === actionState?.id && /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentForm, {
|
|
111
|
+
onSubmit: value => {
|
|
112
|
+
onEditComment(thread.id, value);
|
|
113
|
+
setActionState(false);
|
|
114
|
+
},
|
|
115
|
+
onCancel: () => setActionState(false),
|
|
116
|
+
thread: thread
|
|
117
|
+
}), (!actionState || 'edit' !== actionState?.action) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.RawHTML, {
|
|
118
|
+
children: thread?.content?.raw
|
|
119
|
+
})]
|
|
120
|
+
})
|
|
121
|
+
}), 'resolve' === actionState?.action && thread.id === actionState?.id && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalConfirmDialog, {
|
|
122
|
+
isOpen: isConfirmDialogOpen,
|
|
123
|
+
onConfirm: handleConfirmResolve,
|
|
124
|
+
onCancel: handleCancelDelete,
|
|
125
|
+
confirmButtonText: "Yes",
|
|
126
|
+
cancelButtonText: "No",
|
|
127
|
+
children:
|
|
128
|
+
// translators: message displayed when confirming an action
|
|
129
|
+
(0, _i18n.__)('Are you sure you want to mark this comment as resolved?')
|
|
130
|
+
}), 'delete' === actionState?.action && thread.id === actionState?.id && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalConfirmDialog, {
|
|
131
|
+
isOpen: isConfirmDialogOpen,
|
|
132
|
+
onConfirm: handleConfirmDelete,
|
|
133
|
+
onCancel: handleCancelDelete,
|
|
134
|
+
confirmButtonText: "Yes",
|
|
135
|
+
cancelButtonText: "No",
|
|
136
|
+
children:
|
|
137
|
+
// translators: message displayed when confirming an action
|
|
138
|
+
(0, _i18n.__)('Are you sure you want to delete this comment?')
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
143
|
+
children: [
|
|
144
|
+
// If there are no comments, show a message indicating no comments are available.
|
|
145
|
+
(!Array.isArray(threads) || threads.length === 0) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
|
|
146
|
+
alignment: "left",
|
|
147
|
+
className: "editor-collab-sidebar-panel__thread",
|
|
148
|
+
justify: "flex-start",
|
|
149
|
+
spacing: "3",
|
|
150
|
+
children:
|
|
151
|
+
// translators: message displayed when there are no comments available
|
|
152
|
+
(0, _i18n.__)('No comments available')
|
|
153
|
+
}), Array.isArray(threads) && threads.length > 0 && threads.map(thread => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
154
|
+
className: (0, _clsx.default)('editor-collab-sidebar-panel__thread', {
|
|
155
|
+
'editor-collab-sidebar-panel__active-thread': blockCommentId && blockCommentId === thread.id
|
|
156
|
+
}),
|
|
157
|
+
id: thread.id,
|
|
158
|
+
spacing: "3",
|
|
159
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
|
|
160
|
+
thread: thread
|
|
161
|
+
}), 'reply' === actionState?.action && thread.id === actionState?.id && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
|
|
162
|
+
alignment: "left",
|
|
163
|
+
spacing: "3",
|
|
164
|
+
justify: "flex-start",
|
|
165
|
+
className: "editor-collab-sidebar-panel__user-comment",
|
|
166
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
|
|
167
|
+
spacing: "3",
|
|
168
|
+
className: "editor-collab-sidebar-panel__comment-field",
|
|
169
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentForm, {
|
|
170
|
+
onSubmit: inputComment => {
|
|
171
|
+
onAddReply(inputComment, thread.id);
|
|
172
|
+
setActionState(false);
|
|
173
|
+
},
|
|
174
|
+
onCancel: () => setActionState(false)
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
}), 0 < thread?.reply?.length && thread.reply.map(reply => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
|
|
178
|
+
className: "editor-collab-sidebar-panel__child-thread",
|
|
179
|
+
id: reply.id,
|
|
180
|
+
spacing: "2",
|
|
181
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(CommentBoard, {
|
|
182
|
+
thread: reply,
|
|
183
|
+
parentThread: thread
|
|
184
|
+
})
|
|
185
|
+
}, reply.id))]
|
|
186
|
+
}, thread.id))]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* EditComment component.
|
|
192
|
+
*
|
|
193
|
+
* @param {Object} props - The component props.
|
|
194
|
+
* @param {Function} props.onSubmit - The function to call when updating the comment.
|
|
195
|
+
* @param {Function} props.onCancel - The function to call when canceling the comment update.
|
|
196
|
+
* @param {Object} props.thread - The comment thread object.
|
|
197
|
+
* @return {JSX.Element} The CommentForm component.
|
|
198
|
+
*/
|
|
199
|
+
function CommentForm({
|
|
200
|
+
onSubmit,
|
|
201
|
+
onCancel,
|
|
202
|
+
thread
|
|
203
|
+
}) {
|
|
204
|
+
var _thread$content$raw;
|
|
205
|
+
const [inputComment, setInputComment] = (0, _element.useState)((_thread$content$raw = thread?.content?.raw) !== null && _thread$content$raw !== void 0 ? _thread$content$raw : '');
|
|
206
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
207
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextareaControl, {
|
|
208
|
+
__nextHasNoMarginBottom: true,
|
|
209
|
+
value: inputComment !== null && inputComment !== void 0 ? inputComment : '',
|
|
210
|
+
onChange: setInputComment
|
|
211
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
|
|
212
|
+
alignment: "left",
|
|
213
|
+
spacing: "3",
|
|
214
|
+
justify: "flex-start",
|
|
215
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
216
|
+
alignment: "left",
|
|
217
|
+
spacing: "3",
|
|
218
|
+
justify: "flex-start",
|
|
219
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
220
|
+
__next40pxDefaultSize: true,
|
|
221
|
+
accessibleWhenDisabled: true,
|
|
222
|
+
variant: "primary",
|
|
223
|
+
onClick: () => onSubmit(inputComment),
|
|
224
|
+
disabled: 0 === (0, _utils.sanitizeCommentString)(inputComment).length,
|
|
225
|
+
children: thread ? (0, _i18n._x)('Update', 'verb') : (0, _i18n._x)('Reply', 'Add reply comment')
|
|
226
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
227
|
+
__next40pxDefaultSize: true,
|
|
228
|
+
onClick: onCancel,
|
|
229
|
+
children: (0, _i18n._x)('Cancel', 'Cancel comment edit')
|
|
230
|
+
})]
|
|
231
|
+
})
|
|
232
|
+
})]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Renders the header of a comment in the collaboration sidebar.
|
|
238
|
+
*
|
|
239
|
+
* @param {Object} props - The component props.
|
|
240
|
+
* @param {Object} props.thread - The comment thread object.
|
|
241
|
+
* @param {Function} props.onResolve - The function to resolve the comment.
|
|
242
|
+
* @param {Function} props.onEdit - The function to edit the comment.
|
|
243
|
+
* @param {Function} props.onDelete - The function to delete the comment.
|
|
244
|
+
* @param {Function} props.onReply - The function to reply to the comment.
|
|
245
|
+
* @param {string} props.status - The status of the comment.
|
|
246
|
+
* @return {JSX.Element} The rendered comment header.
|
|
247
|
+
*/
|
|
248
|
+
function CommentHeader({
|
|
249
|
+
thread,
|
|
250
|
+
onResolve,
|
|
251
|
+
onEdit,
|
|
252
|
+
onDelete,
|
|
253
|
+
onReply,
|
|
254
|
+
status
|
|
255
|
+
}) {
|
|
256
|
+
const dateSettings = (0, _date.getSettings)();
|
|
257
|
+
const [dateTimeFormat = dateSettings.formats.time] = (0, _coreData.useEntityProp)('root', 'site', 'time_format');
|
|
258
|
+
const actions = [{
|
|
259
|
+
title: (0, _i18n._x)('Edit', 'Edit comment'),
|
|
260
|
+
onClick: onEdit
|
|
261
|
+
}, {
|
|
262
|
+
title: (0, _i18n._x)('Delete', 'Delete comment'),
|
|
263
|
+
onClick: onDelete
|
|
264
|
+
}, {
|
|
265
|
+
title: (0, _i18n._x)('Reply', 'Reply on a comment'),
|
|
266
|
+
onClick: onReply
|
|
267
|
+
}];
|
|
268
|
+
const moreActions = actions.filter(item => item.onClick);
|
|
269
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
270
|
+
alignment: "left",
|
|
271
|
+
spacing: "3",
|
|
272
|
+
justify: "flex-start",
|
|
273
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
274
|
+
src: thread?.author_avatar_urls?.[48],
|
|
275
|
+
className: "editor-collab-sidebar-panel__user-avatar"
|
|
276
|
+
// translators: alt text for user avatar image
|
|
277
|
+
,
|
|
278
|
+
alt: (0, _i18n.__)('User avatar'),
|
|
279
|
+
width: 32,
|
|
280
|
+
height: 32
|
|
281
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
282
|
+
spacing: "0",
|
|
283
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
284
|
+
className: "editor-collab-sidebar-panel__user-name",
|
|
285
|
+
children: thread.author_name
|
|
286
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("time", {
|
|
287
|
+
dateTime: (0, _date.format)('h:i A', thread.date),
|
|
288
|
+
className: "editor-collab-sidebar-panel__user-time",
|
|
289
|
+
children: (0, _date.dateI18n)(dateTimeFormat, thread.date)
|
|
290
|
+
})]
|
|
291
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
292
|
+
className: "editor-collab-sidebar-panel__comment-status",
|
|
293
|
+
children: [status !== 'approved' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
294
|
+
alignment: "right",
|
|
295
|
+
justify: "flex-end",
|
|
296
|
+
spacing: "0",
|
|
297
|
+
children: [0 === thread.parent && onResolve && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
298
|
+
label: (0, _i18n._x)('Resolve', 'Mark comment as resolved'),
|
|
299
|
+
__next40pxDefaultSize: true,
|
|
300
|
+
icon: _icons.published,
|
|
301
|
+
onClick: onResolve,
|
|
302
|
+
showTooltip: true
|
|
303
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
|
|
304
|
+
icon: _icons.moreVertical,
|
|
305
|
+
label: (0, _i18n._x)('Select an action', 'Select comment action'),
|
|
306
|
+
className: "editor-collab-sidebar-panel__comment-dropdown-menu",
|
|
307
|
+
controls: moreActions
|
|
308
|
+
})]
|
|
309
|
+
}), status === 'approved' &&
|
|
310
|
+
/*#__PURE__*/
|
|
311
|
+
// translators: tooltip for resolved comment
|
|
312
|
+
(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
313
|
+
text: (0, _i18n.__)('Resolved'),
|
|
314
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
|
|
315
|
+
icon: _icons.check
|
|
316
|
+
})
|
|
317
|
+
})]
|
|
318
|
+
})]
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=comments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_date","_icons","_i18n","_data","_coreData","_blockEditor","_utils","_jsxRuntime","Comments","threads","onEditComment","onAddReply","onCommentDelete","onCommentResolve","actionState","setActionState","useState","isConfirmDialogOpen","setIsConfirmDialogOpen","handleConfirmDelete","id","handleConfirmResolve","handleCancelDelete","blockCommentId","useSelect","select","_select$getBlock$attr","clientID","blockEditorStore","getSelectedBlockClientId","getBlock","attributes","CommentBoard","thread","parentThread","_parentThread$status","jsxs","Fragment","children","jsx","CommentHeader","onResolve","_parentThread$id","action","onEdit","onDelete","onReply","undefined","status","__experimentalHStack","alignment","spacing","justify","className","__experimentalVStack","CommentForm","onSubmit","value","onCancel","RawHTML","content","raw","__experimentalConfirmDialog","isOpen","onConfirm","confirmButtonText","cancelButtonText","__","Array","isArray","length","map","clsx","inputComment","reply","_thread$content$raw","setInputComment","TextareaControl","__nextHasNoMarginBottom","onChange","Button","__next40pxDefaultSize","accessibleWhenDisabled","variant","onClick","disabled","sanitizeCommentString","_x","dateSettings","getDateSettings","dateTimeFormat","formats","time","useEntityProp","actions","title","moreActions","filter","item","src","author_avatar_urls","alt","width","height","author_name","dateTime","format","date","dateI18n","parent","label","icon","published","showTooltip","DropdownMenu","moreVertical","controls","Tooltip","text","Icon","check"],"sources":["@wordpress/editor/src/components/collab-sidebar/comments.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, RawHTML } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tDropdownMenu,\n\tTextareaControl,\n\tTooltip,\n} from '@wordpress/components';\nimport {\n\tdateI18n,\n\tformat,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport { Icon, check, published, moreVertical } from '@wordpress/icons';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { sanitizeCommentString } from './utils';\n\n/**\n * Renders the Comments component.\n *\n * @param {Object} props - The component props.\n * @param {Array} props.threads - The array of comment threads.\n * @param {Function} props.onEditComment - The function to handle comment editing.\n * @param {Function} props.onAddReply - The function to add a reply to a comment.\n * @param {Function} props.onCommentDelete - The function to delete a comment.\n * @param {Function} props.onCommentResolve - The function to mark a comment as resolved.\n * @return {JSX.Element} The rendered Comments component.\n */\nexport function Comments( {\n\tthreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tonCommentResolve,\n} ) {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ isConfirmDialogOpen, setIsConfirmDialogOpen ] = useState( false );\n\n\tconst handleConfirmDelete = () => {\n\t\tonCommentDelete( actionState.id );\n\t\tsetActionState( false );\n\t\tsetIsConfirmDialogOpen( false );\n\t};\n\n\tconst handleConfirmResolve = () => {\n\t\tonCommentResolve( actionState.id );\n\t\tsetActionState( false );\n\t\tsetIsConfirmDialogOpen( false );\n\t};\n\n\tconst handleCancelDelete = () => {\n\t\tsetActionState( false );\n\t\tsetIsConfirmDialogOpen( false );\n\t};\n\n\tconst blockCommentId = useSelect( ( select ) => {\n\t\tconst clientID = select( blockEditorStore ).getSelectedBlockClientId();\n\t\treturn (\n\t\t\tselect( blockEditorStore ).getBlock( clientID )?.attributes\n\t\t\t\t?.blockCommentId ?? false\n\t\t);\n\t}, [] );\n\n\tconst CommentBoard = ( { thread, parentThread } ) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<CommentHeader\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tonResolve={ () => {\n\t\t\t\t\t\tsetActionState( {\n\t\t\t\t\t\t\taction: 'resolve',\n\t\t\t\t\t\t\tid: parentThread?.id ?? thread.id,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsConfirmDialogOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonEdit={ () =>\n\t\t\t\t\t\tsetActionState( { action: 'edit', id: thread.id } )\n\t\t\t\t\t}\n\t\t\t\t\tonDelete={ () => {\n\t\t\t\t\t\tsetActionState( { action: 'delete', id: thread.id } );\n\t\t\t\t\t\tsetIsConfirmDialogOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonReply={\n\t\t\t\t\t\t! parentThread\n\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\tsetActionState( {\n\t\t\t\t\t\t\t\t\t\taction: 'reply',\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tstatus={ parentThread?.status ?? thread.status }\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"left\"\n\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-comment\"\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-field\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ 'edit' === actionState?.action &&\n\t\t\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonEditComment( thread.id, value );\n\t\t\t\t\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonCancel={ () => setActionState( false ) }\n\t\t\t\t\t\t\t\t\tthread={ thread }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ( ! actionState ||\n\t\t\t\t\t\t\t'edit' !== actionState?.action ) && (\n\t\t\t\t\t\t\t<RawHTML>{ thread?.content?.raw }</RawHTML>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</HStack>\n\t\t\t\t{ 'resolve' === actionState?.action &&\n\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\t\tisOpen={ isConfirmDialogOpen }\n\t\t\t\t\t\t\tonConfirm={ handleConfirmResolve }\n\t\t\t\t\t\t\tonCancel={ handleCancelDelete }\n\t\t\t\t\t\t\tconfirmButtonText=\"Yes\"\n\t\t\t\t\t\t\tcancelButtonText=\"No\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// translators: message displayed when confirming an action\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to mark this comment as resolved?'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t\t) }\n\t\t\t\t{ 'delete' === actionState?.action &&\n\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\t\tisOpen={ isConfirmDialogOpen }\n\t\t\t\t\t\t\tonConfirm={ handleConfirmDelete }\n\t\t\t\t\t\t\tonCancel={ handleCancelDelete }\n\t\t\t\t\t\t\tconfirmButtonText=\"Yes\"\n\t\t\t\t\t\t\tcancelButtonText=\"No\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// translators: message displayed when confirming an action\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete this comment?'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{\n\t\t\t\t// If there are no comments, show a message indicating no comments are available.\n\t\t\t\t( ! Array.isArray( threads ) || threads.length === 0 ) && (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__thread\"\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// translators: message displayed when there are no comments available\n\t\t\t\t\t\t\t__( 'No comments available' )\n\t\t\t\t\t\t}\n\t\t\t\t\t</VStack>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t{ Array.isArray( threads ) &&\n\t\t\t\tthreads.length > 0 &&\n\t\t\t\tthreads.map( ( thread ) => (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__thread',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'editor-collab-sidebar-panel__active-thread':\n\t\t\t\t\t\t\t\t\tblockCommentId &&\n\t\t\t\t\t\t\t\t\tblockCommentId === thread.id,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tid={ thread.id }\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<CommentBoard thread={ thread } />\n\t\t\t\t\t\t{ 'reply' === actionState?.action &&\n\t\t\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-comment\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-field\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\t\t\t\t\t\tonAddReply(\n\t\t\t\t\t\t\t\t\t\t\t\t\tinputComment,\n\t\t\t\t\t\t\t\t\t\t\t\t\tthread.id\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetActionState( false )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ 0 < thread?.reply?.length &&\n\t\t\t\t\t\t\tthread.reply.map( ( reply ) => (\n\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__child-thread\"\n\t\t\t\t\t\t\t\t\tid={ reply.id }\n\t\t\t\t\t\t\t\t\tspacing=\"2\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\t\t\t\t\tparentThread={ thread }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</VStack>\n\t\t\t\t) ) }\n\t\t</>\n\t);\n}\n\n/**\n * EditComment component.\n *\n * @param {Object} props - The component props.\n * @param {Function} props.onSubmit - The function to call when updating the comment.\n * @param {Function} props.onCancel - The function to call when canceling the comment update.\n * @param {Object} props.thread - The comment thread object.\n * @return {JSX.Element} The CommentForm component.\n */\nfunction CommentForm( { onSubmit, onCancel, thread } ) {\n\tconst [ inputComment, setInputComment ] = useState(\n\t\tthread?.content?.raw ?? ''\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ inputComment ?? '' }\n\t\t\t\tonChange={ setInputComment }\n\t\t\t/>\n\t\t\t<VStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ () => onSubmit( inputComment ) }\n\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t0 === sanitizeCommentString( inputComment ).length\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ thread\n\t\t\t\t\t\t\t? _x( 'Update', 'verb' )\n\t\t\t\t\t\t\t: _x( 'Reply', 'Add reply comment' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button __next40pxDefaultSize onClick={ onCancel }>\n\t\t\t\t\t\t{ _x( 'Cancel', 'Cancel comment edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\n/**\n * Renders the header of a comment in the collaboration sidebar.\n *\n * @param {Object} props - The component props.\n * @param {Object} props.thread - The comment thread object.\n * @param {Function} props.onResolve - The function to resolve the comment.\n * @param {Function} props.onEdit - The function to edit the comment.\n * @param {Function} props.onDelete - The function to delete the comment.\n * @param {Function} props.onReply - The function to reply to the comment.\n * @param {string} props.status - The status of the comment.\n * @return {JSX.Element} The rendered comment header.\n */\nfunction CommentHeader( {\n\tthread,\n\tonResolve,\n\tonEdit,\n\tonDelete,\n\tonReply,\n\tstatus,\n} ) {\n\tconst dateSettings = getDateSettings();\n\tconst [ dateTimeFormat = dateSettings.formats.time ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'time_format'\n\t);\n\n\tconst actions = [\n\t\t{\n\t\t\ttitle: _x( 'Edit', 'Edit comment' ),\n\t\t\tonClick: onEdit,\n\t\t},\n\t\t{\n\t\t\ttitle: _x( 'Delete', 'Delete comment' ),\n\t\t\tonClick: onDelete,\n\t\t},\n\t\t{\n\t\t\ttitle: _x( 'Reply', 'Reply on a comment' ),\n\t\t\tonClick: onReply,\n\t\t},\n\t];\n\n\tconst moreActions = actions.filter( ( item ) => item.onClick );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t<img\n\t\t\t\tsrc={ thread?.author_avatar_urls?.[ 48 ] }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t/>\n\t\t\t<VStack spacing=\"0\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ thread.author_name }\n\t\t\t\t</span>\n\t\t\t\t<time\n\t\t\t\t\tdateTime={ format( 'h:i A', thread.date ) }\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t>\n\t\t\t\t\t{ dateI18n( dateTimeFormat, thread.date ) }\n\t\t\t\t</time>\n\t\t\t</VStack>\n\t\t\t<span className=\"editor-collab-sidebar-panel__comment-status\">\n\t\t\t\t{ status !== 'approved' && (\n\t\t\t\t\t<HStack alignment=\"right\" justify=\"flex-end\" spacing=\"0\">\n\t\t\t\t\t\t{ 0 === thread.parent && onResolve && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t'Mark comment as resolved'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\tonClick={ onResolve }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Select an action',\n\t\t\t\t\t\t\t\t'Select comment action'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-dropdown-menu\"\n\t\t\t\t\t\t\tcontrols={ moreActions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t) }\n\t\t\t\t{ status === 'approved' && (\n\t\t\t\t\t// translators: tooltip for resolved comment\n\t\t\t\t\t<Tooltip text={ __( 'Resolved' ) }>\n\t\t\t\t\t\t<Icon icon={ check } />\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</HStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAAgD,IAAAU,WAAA,GAAAV,OAAA;AAhChD;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,QAAQA,CAAE;EACzBC,OAAO;EACPC,aAAa;EACbC,UAAU;EACVC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACzD,MAAM,CAAEC,mBAAmB,EAAEC,sBAAsB,CAAE,GAAG,IAAAF,iBAAQ,EAAE,KAAM,CAAC;EAEzE,MAAMG,mBAAmB,GAAGA,CAAA,KAAM;IACjCP,eAAe,CAAE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List":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["collabSidebarName","exports"],"sources":["@wordpress/editor/src/components/collab-sidebar/constants.js"],"sourcesContent":["export const collabSidebarName = 'edit-post/collab-sidebar';\n"],"mappings":";;;;;;AAAO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,0BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = CollabSidebar;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _hooks = require("@wordpress/hooks");
|
|
13
|
+
var _notices = require("@wordpress/notices");
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
16
|
+
var _interface = require("@wordpress/interface");
|
|
17
|
+
var _pluginSidebar = _interopRequireDefault(require("../plugin-sidebar"));
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
var _comments = require("./comments");
|
|
20
|
+
var _addComment = require("./add-comment");
|
|
21
|
+
var _store = require("../../store");
|
|
22
|
+
var _commentButton = _interopRequireDefault(require("./comment-button"));
|
|
23
|
+
var _commentButtonToolbar = _interopRequireDefault(require("./comment-button-toolbar"));
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
/**
|
|
26
|
+
* WordPress dependencies
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Internal dependencies
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const threadsEmptyArray = [];
|
|
34
|
+
const isBlockCommentExperimentEnabled = window?.__experimentalEnableBlockComment;
|
|
35
|
+
const modifyBlockCommentAttributes = settings => {
|
|
36
|
+
if (!settings.attributes.blockCommentId) {
|
|
37
|
+
settings.attributes = {
|
|
38
|
+
...settings.attributes,
|
|
39
|
+
blockCommentId: {
|
|
40
|
+
type: 'number'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return settings;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Apply the filter to all core blocks
|
|
48
|
+
(0, _hooks.addFilter)('blocks.registerBlockType', 'block-comment/modify-core-block-attributes', modifyBlockCommentAttributes);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Renders the Collab sidebar.
|
|
52
|
+
*/
|
|
53
|
+
function CollabSidebar() {
|
|
54
|
+
const {
|
|
55
|
+
createNotice
|
|
56
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
57
|
+
const {
|
|
58
|
+
saveEntityRecord,
|
|
59
|
+
deleteEntityRecord
|
|
60
|
+
} = (0, _data.useDispatch)(_coreData.store);
|
|
61
|
+
const {
|
|
62
|
+
getEntityRecord
|
|
63
|
+
} = (0, _data.resolveSelect)(_coreData.store);
|
|
64
|
+
const {
|
|
65
|
+
enableComplementaryArea
|
|
66
|
+
} = (0, _data.useDispatch)(_interface.store);
|
|
67
|
+
const [blockCommentID, setBlockCommentID] = (0, _element.useState)(null);
|
|
68
|
+
const [showCommentBoard, setShowCommentBoard] = (0, _element.useState)(false);
|
|
69
|
+
const {
|
|
70
|
+
postId
|
|
71
|
+
} = (0, _data.useSelect)(select => {
|
|
72
|
+
return {
|
|
73
|
+
postId: select(_store.store).getCurrentPostId()
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
const postStatus = (0, _data.useSelect)(select => {
|
|
77
|
+
const post = select(_store.store).getCurrentPost();
|
|
78
|
+
return {
|
|
79
|
+
postStatus: post?.status
|
|
80
|
+
};
|
|
81
|
+
}, []);
|
|
82
|
+
const threads = (0, _data.useSelect)(select => {
|
|
83
|
+
if (!postId) {
|
|
84
|
+
return threadsEmptyArray;
|
|
85
|
+
}
|
|
86
|
+
const {
|
|
87
|
+
getEntityRecords
|
|
88
|
+
} = select(_coreData.store);
|
|
89
|
+
const data = getEntityRecords('root', 'comment', {
|
|
90
|
+
post: postId,
|
|
91
|
+
type: 'block_comment',
|
|
92
|
+
status: 'any',
|
|
93
|
+
per_page: 100
|
|
94
|
+
});
|
|
95
|
+
return data || threadsEmptyArray;
|
|
96
|
+
}, [postId]);
|
|
97
|
+
const clientId = (0, _data.useSelect)(select => {
|
|
98
|
+
const {
|
|
99
|
+
getSelectedBlockClientId
|
|
100
|
+
} = select(_blockEditor.store);
|
|
101
|
+
return getSelectedBlockClientId();
|
|
102
|
+
}, []);
|
|
103
|
+
const blockDetails = (0, _data.useSelect)(select => {
|
|
104
|
+
return clientId ? select(_blockEditor.store).getBlock(clientId) : null;
|
|
105
|
+
}, [clientId]);
|
|
106
|
+
|
|
107
|
+
// Get the dispatch functions to save the comment and update the block attributes.
|
|
108
|
+
const {
|
|
109
|
+
updateBlockAttributes
|
|
110
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
111
|
+
|
|
112
|
+
// Process comments to build the tree structure
|
|
113
|
+
const resultComments = (0, _element.useMemo)(() => {
|
|
114
|
+
// Create a compare to store the references to all objects by id
|
|
115
|
+
const compare = {};
|
|
116
|
+
const result = [];
|
|
117
|
+
const filteredComments = threads.filter(comment => comment.status !== 'trash');
|
|
118
|
+
|
|
119
|
+
// Initialize each object with an empty `reply` array
|
|
120
|
+
filteredComments.forEach(item => {
|
|
121
|
+
compare[item.id] = {
|
|
122
|
+
...item,
|
|
123
|
+
reply: []
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Iterate over the data to build the tree structure
|
|
128
|
+
filteredComments.forEach(item => {
|
|
129
|
+
if (item.parent === 0) {
|
|
130
|
+
// If parent is 0, it's a root item, push it to the result array
|
|
131
|
+
result.push(compare[item.id]);
|
|
132
|
+
} else if (compare[item.parent]) {
|
|
133
|
+
// Otherwise, find its parent and push it to the parent's `reply` array
|
|
134
|
+
compare[item.parent].reply.push(compare[item.id]);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return result;
|
|
138
|
+
}, [threads]);
|
|
139
|
+
const openCollabBoard = () => {
|
|
140
|
+
setShowCommentBoard(true);
|
|
141
|
+
enableComplementaryArea('core', 'edit-post/collab-sidebar');
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Function to save the comment.
|
|
145
|
+
const addNewComment = async (comment, parentCommentId) => {
|
|
146
|
+
const args = {
|
|
147
|
+
post: postId,
|
|
148
|
+
content: comment,
|
|
149
|
+
comment_type: 'block_comment',
|
|
150
|
+
comment_approved: 0
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Create a new object, conditionally including the parent property
|
|
154
|
+
const updatedArgs = {
|
|
155
|
+
...args,
|
|
156
|
+
...(parentCommentId ? {
|
|
157
|
+
parent: parentCommentId
|
|
158
|
+
} : {})
|
|
159
|
+
};
|
|
160
|
+
const savedRecord = await saveEntityRecord('root', 'comment', updatedArgs);
|
|
161
|
+
if (savedRecord) {
|
|
162
|
+
// If it's a main comment, update the block attributes with the comment id.
|
|
163
|
+
if (!parentCommentId) {
|
|
164
|
+
updateBlockAttributes(clientId, {
|
|
165
|
+
blockCommentId: savedRecord?.id
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
createNotice('snackbar', parentCommentId ?
|
|
169
|
+
// translators: Reply added successfully
|
|
170
|
+
(0, _i18n.__)('Reply added successfully.') :
|
|
171
|
+
// translators: Comment added successfully
|
|
172
|
+
(0, _i18n.__)('Comment added successfully.'), {
|
|
173
|
+
type: 'snackbar',
|
|
174
|
+
isDismissible: true
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
onError();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const onCommentResolve = async commentId => {
|
|
181
|
+
const savedRecord = await saveEntityRecord('root', 'comment', {
|
|
182
|
+
id: commentId,
|
|
183
|
+
status: 'approved'
|
|
184
|
+
});
|
|
185
|
+
if (savedRecord) {
|
|
186
|
+
// translators: Comment resolved successfully
|
|
187
|
+
createNotice('snackbar', (0, _i18n.__)('Comment marked as resolved.'), {
|
|
188
|
+
type: 'snackbar',
|
|
189
|
+
isDismissible: true
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
onError();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const onEditComment = async (commentId, comment) => {
|
|
196
|
+
const savedRecord = await saveEntityRecord('root', 'comment', {
|
|
197
|
+
id: commentId,
|
|
198
|
+
content: comment
|
|
199
|
+
});
|
|
200
|
+
if (savedRecord) {
|
|
201
|
+
createNotice('snackbar',
|
|
202
|
+
// translators: Comment edited successfully
|
|
203
|
+
(0, _i18n.__)('Comment edited successfully.'), {
|
|
204
|
+
type: 'snackbar',
|
|
205
|
+
isDismissible: true
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
onError();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const onError = () => {
|
|
212
|
+
createNotice('error',
|
|
213
|
+
// translators: Error message when comment submission fails
|
|
214
|
+
(0, _i18n.__)('Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'), {
|
|
215
|
+
isDismissible: true
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const onCommentDelete = async commentId => {
|
|
219
|
+
const childComment = await getEntityRecord('root', 'comment', commentId);
|
|
220
|
+
await deleteEntityRecord('root', 'comment', commentId);
|
|
221
|
+
if (childComment && !childComment.parent) {
|
|
222
|
+
updateBlockAttributes(clientId, {
|
|
223
|
+
blockCommentId: undefined
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
createNotice('snackbar',
|
|
227
|
+
// translators: Comment deleted successfully
|
|
228
|
+
(0, _i18n.__)('Comment deleted successfully.'), {
|
|
229
|
+
type: 'snackbar',
|
|
230
|
+
isDismissible: true
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
(0, _element.useEffect)(() => {
|
|
234
|
+
if (blockDetails) {
|
|
235
|
+
setBlockCommentID(blockDetails?.attributes.blockCommentId);
|
|
236
|
+
}
|
|
237
|
+
}, [postId, clientId]);
|
|
238
|
+
|
|
239
|
+
// Check if the experimental flag is enabled.
|
|
240
|
+
if (!isBlockCommentExperimentEnabled || postStatus.postStatus === 'publish') {
|
|
241
|
+
return null; // or maybe return some message indicating no threads are available.
|
|
242
|
+
}
|
|
243
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
244
|
+
children: [!blockCommentID && /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentButton.default, {
|
|
245
|
+
onClick: openCollabBoard
|
|
246
|
+
}), blockCommentID > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentButtonToolbar.default, {
|
|
247
|
+
onClick: openCollabBoard
|
|
248
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginSidebar.default, {
|
|
249
|
+
identifier: _constants.collabSidebarName
|
|
250
|
+
// translators: Comments sidebar title
|
|
251
|
+
,
|
|
252
|
+
title: (0, _i18n.__)('Comments'),
|
|
253
|
+
icon: _icons.comment,
|
|
254
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
255
|
+
className: "editor-collab-sidebar-panel",
|
|
256
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_addComment.AddComment, {
|
|
257
|
+
threads: resultComments,
|
|
258
|
+
onSubmit: addNewComment,
|
|
259
|
+
showCommentBoard: showCommentBoard,
|
|
260
|
+
setShowCommentBoard: setShowCommentBoard
|
|
261
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_comments.Comments, {
|
|
262
|
+
threads: resultComments,
|
|
263
|
+
onEditComment: onEditComment,
|
|
264
|
+
onAddReply: addNewComment,
|
|
265
|
+
onCommentDelete: onCommentDelete,
|
|
266
|
+
onCommentResolve: onCommentResolve
|
|
267
|
+
})]
|
|
268
|
+
})
|
|
269
|
+
})]
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=index.js.map
|