@wordpress/editor 14.44.1-next.v.202604201441.0 → 14.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/collab-sidebar/{comment-menu-item.cjs → add-note-menu-item.cjs} +17 -14
- package/build/components/collab-sidebar/add-note-menu-item.cjs.map +7 -0
- package/build/components/collab-sidebar/{add-comment.cjs → add-note.cjs} +28 -41
- package/build/components/collab-sidebar/add-note.cjs.map +7 -0
- package/build/components/collab-sidebar/board-store.cjs +3 -0
- package/build/components/collab-sidebar/board-store.cjs.map +2 -2
- package/build/components/collab-sidebar/floating-container.cjs +4 -3
- package/build/components/collab-sidebar/floating-container.cjs.map +3 -3
- package/build/components/collab-sidebar/hooks.cjs +92 -135
- package/build/components/collab-sidebar/hooks.cjs.map +3 -3
- package/build/components/collab-sidebar/index.cjs +28 -79
- package/build/components/collab-sidebar/index.cjs.map +3 -3
- package/build/components/collab-sidebar/{comment-author-info.cjs → note-byline.cjs} +13 -9
- package/build/components/collab-sidebar/note-byline.cjs.map +7 -0
- package/build/components/collab-sidebar/note-card.cjs +58 -0
- package/build/components/collab-sidebar/note-card.cjs.map +7 -0
- package/build/components/collab-sidebar/{comment-form.cjs → note-form.cjs} +45 -36
- package/build/components/collab-sidebar/note-form.cjs.map +7 -0
- package/build/components/collab-sidebar/{comment-indicator-toolbar.cjs → note-indicator-toolbar.cjs} +31 -27
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +7 -0
- package/build/components/collab-sidebar/note-thread.cjs +321 -0
- package/build/components/collab-sidebar/note-thread.cjs.map +7 -0
- package/build/components/collab-sidebar/note.cjs +207 -0
- package/build/components/collab-sidebar/note.cjs.map +7 -0
- package/build/components/collab-sidebar/notes.cjs +237 -0
- package/build/components/collab-sidebar/notes.cjs.map +7 -0
- package/build/components/collab-sidebar/utils.cjs +23 -25
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/document-bar/index.cjs.map +3 -3
- package/build/components/error-boundary/index.cjs.map +3 -3
- package/build/components/list-view-sidebar/list-view-outline.cjs.map +3 -3
- package/build/components/media/media-editor-modal.cjs +93 -0
- package/build/components/media/media-editor-modal.cjs.map +7 -0
- package/build/components/more-menu/index.cjs +3 -2
- package/build/components/more-menu/index.cjs.map +2 -2
- package/build/components/post-actions/set-as-homepage.cjs.map +3 -3
- package/build/components/post-actions/set-as-posts-page.cjs.map +3 -3
- package/build/components/post-card-panel/index.cjs +2 -2
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-content-information/index.cjs.map +3 -3
- package/build/components/post-excerpt/panel.cjs.map +3 -3
- package/build/components/post-last-edited-panel/index.cjs.map +3 -3
- package/build/components/post-preview-button/index.cjs +3 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/index.cjs +2 -2
- package/build/components/post-publish-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +4 -2
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/postpublish.cjs +3 -2
- package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
- package/build/components/post-revisions-panel/index.cjs +2 -2
- package/build/components/post-revisions-panel/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +1 -1
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-slider.cjs +1 -0
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-saved-state/index.cjs +4 -1
- package/build/components/post-saved-state/index.cjs.map +2 -2
- package/build/components/post-text-editor/index.cjs +3 -4
- package/build/components/post-text-editor/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs +3 -2
- package/build/components/preview-dropdown/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +7 -1
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/provider/use-upload-save-lock.cjs +2 -12
- package/build/components/provider/use-upload-save-lock.cjs.map +2 -2
- package/build/components/resizable-editor/resize-handle.cjs +2 -1
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/revision-created-panel/index.cjs.map +3 -3
- package/build/components/site-discussion/index.cjs.map +2 -2
- package/build/components/template-actions-panel/classic-theme-content.cjs.map +2 -2
- package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
- package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +5 -22
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +0 -8
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +0 -5
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +0 -10
- package/build/store/reducer.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +3 -2
- package/build/utils/media-finalize/index.cjs.map +2 -2
- package/build/utils/media-upload/index.cjs +14 -25
- package/build/utils/media-upload/index.cjs.map +2 -2
- package/build-module/components/collab-sidebar/{comment-menu-item.mjs → add-note-menu-item.mjs} +10 -11
- package/build-module/components/collab-sidebar/add-note-menu-item.mjs.map +7 -0
- package/build-module/components/collab-sidebar/{add-comment.mjs → add-note.mjs} +26 -29
- package/build-module/components/collab-sidebar/add-note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/board-store.mjs +3 -0
- package/build-module/components/collab-sidebar/board-store.mjs.map +2 -2
- package/build-module/components/collab-sidebar/floating-container.mjs +4 -3
- package/build-module/components/collab-sidebar/floating-container.mjs.map +2 -2
- package/build-module/components/collab-sidebar/hooks.mjs +91 -137
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +29 -84
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/{comment-author-info.mjs → note-byline.mjs} +7 -7
- package/build-module/components/collab-sidebar/note-byline.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-card.mjs +33 -0
- package/build-module/components/collab-sidebar/note-card.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-form.mjs +84 -0
- package/build-module/components/collab-sidebar/note-form.mjs.map +7 -0
- package/build-module/components/collab-sidebar/{comment-indicator-toolbar.mjs → note-indicator-toolbar.mjs} +25 -29
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-thread.mjs +289 -0
- package/build-module/components/collab-sidebar/note-thread.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note.mjs +176 -0
- package/build-module/components/collab-sidebar/note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/notes.mjs +215 -0
- package/build-module/components/collab-sidebar/notes.mjs.map +7 -0
- package/build-module/components/collab-sidebar/utils.mjs +19 -21
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/document-bar/index.mjs +3 -3
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/error-boundary/index.mjs +2 -2
- package/build-module/components/error-boundary/index.mjs.map +2 -2
- package/build-module/components/list-view-sidebar/list-view-outline.mjs +5 -5
- package/build-module/components/list-view-sidebar/list-view-outline.mjs.map +2 -2
- package/build-module/components/media/media-editor-modal.mjs +62 -0
- package/build-module/components/media/media-editor-modal.mjs.map +7 -0
- package/build-module/components/more-menu/index.mjs +3 -7
- package/build-module/components/more-menu/index.mjs.map +2 -2
- package/build-module/components/post-actions/set-as-homepage.mjs +2 -2
- package/build-module/components/post-actions/set-as-homepage.mjs.map +2 -2
- package/build-module/components/post-actions/set-as-posts-page.mjs +2 -2
- package/build-module/components/post-actions/set-as-posts-page.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +5 -5
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-content-information/index.mjs +2 -2
- package/build-module/components/post-content-information/index.mjs.map +2 -2
- package/build-module/components/post-excerpt/panel.mjs +2 -2
- package/build-module/components/post-excerpt/panel.mjs.map +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
- package/build-module/components/post-preview-button/index.mjs +3 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/index.mjs +2 -2
- package/build-module/components/post-publish-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +4 -2
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/postpublish.mjs +3 -3
- package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +2 -2
- package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +1 -1
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -0
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-saved-state/index.mjs +4 -1
- package/build-module/components/post-saved-state/index.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +2 -3
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +2 -2
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +7 -1
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-upload-save-lock.mjs +2 -12
- package/build-module/components/provider/use-upload-save-lock.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs +2 -5
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/revision-created-panel/index.mjs +2 -2
- package/build-module/components/revision-created-panel/index.mjs.map +2 -2
- package/build-module/components/site-discussion/index.mjs +2 -2
- package/build-module/components/site-discussion/index.mjs.map +2 -2
- package/build-module/components/template-actions-panel/classic-theme-content.mjs +2 -2
- package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +2 -2
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +5 -22
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +0 -7
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +0 -4
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +0 -9
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +3 -2
- package/build-module/utils/media-finalize/index.mjs.map +2 -2
- package/build-module/utils/media-upload/index.mjs +14 -25
- package/build-module/utils/media-upload/index.mjs.map +2 -2
- package/build-style/style-rtl.css +386 -142
- package/build-style/style.css +386 -142
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts +8 -21
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
- package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note.d.ts +9 -0
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/notes.d.ts +7 -0
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +21 -20
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +11 -0
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-saved-state/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/provider/use-upload-save-lock.d.ts +0 -2
- package/build-types/components/provider/use-upload-save-lock.d.ts.map +1 -1
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +0 -7
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +0 -7
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +0 -10
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/media-finalize/index.d.ts +1 -1
- package/build-types/utils/media-finalize/index.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +46 -46
- package/src/components/collab-sidebar/README.md +117 -0
- package/src/components/collab-sidebar/{comment-menu-item.js → add-note-menu-item.js} +8 -10
- package/src/components/collab-sidebar/{add-comment.js → add-note.js} +20 -21
- package/src/components/collab-sidebar/board-store.js +4 -2
- package/src/components/collab-sidebar/floating-container.js +5 -4
- package/src/components/collab-sidebar/hooks.js +115 -175
- package/src/components/collab-sidebar/index.js +35 -95
- package/src/components/collab-sidebar/{comment-author-info.js → note-byline.js} +5 -6
- package/src/components/collab-sidebar/note-card.js +36 -0
- package/src/components/collab-sidebar/{comment-form.js → note-form.js} +25 -27
- package/src/components/collab-sidebar/{comment-indicator-toolbar.js → note-indicator-toolbar.js} +29 -32
- package/src/components/collab-sidebar/note-thread.js +331 -0
- package/src/components/collab-sidebar/note.js +209 -0
- package/src/components/collab-sidebar/notes.js +276 -0
- package/src/components/collab-sidebar/style.scss +21 -11
- package/src/components/collab-sidebar/test/utils.js +65 -63
- package/src/components/collab-sidebar/utils.js +33 -35
- package/src/components/document-bar/index.js +4 -4
- package/src/components/error-boundary/index.js +3 -3
- package/src/components/list-view-sidebar/list-view-outline.js +6 -6
- package/src/components/media/media-editor-modal.js +95 -0
- package/src/components/more-menu/index.js +3 -7
- package/src/components/post-actions/set-as-homepage.js +2 -2
- package/src/components/post-actions/set-as-posts-page.js +2 -2
- package/src/components/post-card-panel/index.js +7 -7
- package/src/components/post-content-information/index.js +3 -3
- package/src/components/post-excerpt/panel.js +3 -3
- package/src/components/post-last-edited-panel/index.js +3 -3
- package/src/components/post-preview-button/index.js +3 -2
- package/src/components/post-publish-button/index.js +6 -5
- package/src/components/post-publish-button/label.js +3 -1
- package/src/components/post-publish-panel/postpublish.js +2 -2
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +8 -14
- package/src/components/post-revisions-panel/index.js +3 -3
- package/src/components/post-revisions-preview/diff-markers.js +1 -1
- package/src/components/post-revisions-preview/revisions-slider.js +1 -0
- package/src/components/post-saved-state/index.js +4 -1
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -1
- package/src/components/post-text-editor/index.js +3 -3
- package/src/components/preview-dropdown/index.js +2 -2
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +10 -0
- package/src/components/provider/use-upload-save-lock.js +2 -17
- package/src/components/resizable-editor/resize-handle.js +2 -5
- package/src/components/revision-created-panel/index.js +3 -3
- package/src/components/site-discussion/index.js +3 -3
- package/src/components/template-actions-panel/classic-theme-content.js +3 -3
- package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
- package/src/components/visual-editor/index.js +2 -29
- package/src/store/private-actions.js +0 -13
- package/src/store/private-selectors.js +0 -10
- package/src/store/reducer.js +0 -16
- package/src/utils/media-finalize/index.js +2 -1
- package/src/utils/media-finalize/test/index.js +25 -1
- package/src/utils/media-upload/index.js +26 -29
- package/build/components/collab-sidebar/add-comment.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-author-info.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-form.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-indicator-toolbar.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-menu-item.cjs.map +0 -7
- package/build/components/collab-sidebar/comments.cjs +0 -696
- package/build/components/collab-sidebar/comments.cjs.map +0 -7
- package/build-module/components/collab-sidebar/add-comment.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-author-info.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-form.mjs +0 -82
- package/build-module/components/collab-sidebar/comment-form.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-menu-item.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comments.mjs +0 -678
- package/build-module/components/collab-sidebar/comments.mjs.map +0 -7
- package/build-types/components/collab-sidebar/add-comment.d.ts +0 -6
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts +0 -9
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comments.d.ts +0 -10
- package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
- package/src/components/collab-sidebar/comments.js +0 -812
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/editor/src/components/collab-sidebar/floating-container.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import {
|
|
3
|
+
import { Stack } from "@wordpress/ui";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
function FloatingContainer({
|
|
6
6
|
floating,
|
|
@@ -11,10 +11,11 @@ function FloatingContainer({
|
|
|
11
11
|
}) {
|
|
12
12
|
const isFloating = !!floating;
|
|
13
13
|
return /* @__PURE__ */ jsx(
|
|
14
|
-
|
|
14
|
+
Stack,
|
|
15
15
|
{
|
|
16
|
+
direction: "column",
|
|
16
17
|
className: clsx(className, { "is-floating": isFloating }),
|
|
17
|
-
ref: isFloating ? floating.
|
|
18
|
+
ref: isFloating ? floating.ref : void 0,
|
|
18
19
|
style: isFloating ? { top: floating.y, ...style } : style,
|
|
19
20
|
...props,
|
|
20
21
|
children
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/floating-container.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\nexport function FloatingContainer( {\n\tfloating,\n\tclassName,\n\tstyle,\n\tchildren,\n\t...props\n} ) {\n\tconst isFloating = !! floating;\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tclassName={ clsx( className, { 'is-floating': isFloating } ) }\n\t\t\tref={ isFloating ? floating.ref : undefined }\n\t\t\tstyle={ isFloating ? { top: floating.y, ...style } : style }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,aAAa;AAWpB;AATK,SAAS,kBAAmB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AACH,QAAM,aAAa,CAAC,CAAE;AACtB,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAY,KAAM,WAAW,EAAE,eAAe,WAAW,CAAE;AAAA,MAC3D,KAAM,aAAa,SAAS,MAAM;AAAA,MAClC,OAAQ,aAAa,EAAE,KAAK,SAAS,GAAG,GAAG,MAAM,IAAI;AAAA,MACnD,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
// packages/editor/src/components/collab-sidebar/hooks.js
|
|
2
|
-
import {
|
|
3
|
-
useFloating,
|
|
4
|
-
offset as offsetMiddleware,
|
|
5
|
-
autoUpdate
|
|
6
|
-
} from "@floating-ui/react-dom";
|
|
7
2
|
import { __ } from "@wordpress/i18n";
|
|
8
3
|
import {
|
|
9
4
|
useState,
|
|
@@ -18,15 +13,16 @@ import {
|
|
|
18
13
|
privateApis as blockEditorPrivateApis
|
|
19
14
|
} from "@wordpress/block-editor";
|
|
20
15
|
import { store as noticesStore } from "@wordpress/notices";
|
|
16
|
+
import { getScrollContainer } from "@wordpress/dom";
|
|
21
17
|
import { decodeEntities } from "@wordpress/html-entities";
|
|
22
18
|
import { store as interfaceStore } from "@wordpress/interface";
|
|
23
19
|
import { store as editorStore } from "../../store/index.mjs";
|
|
24
20
|
import { FLOATING_NOTES_SIDEBAR } from "./constants.mjs";
|
|
25
21
|
import { unlock } from "../../lock-unlock.mjs";
|
|
26
22
|
import { createBoardStore } from "./board-store.mjs";
|
|
27
|
-
import {
|
|
28
|
-
var {
|
|
29
|
-
function
|
|
23
|
+
import { calculateNotePositions } from "./utils.mjs";
|
|
24
|
+
var { cleanEmptyObject } = unlock(blockEditorPrivateApis);
|
|
25
|
+
function useNoteThreads(postId) {
|
|
30
26
|
const queryArgs = {
|
|
31
27
|
post: postId,
|
|
32
28
|
type: "note",
|
|
@@ -46,78 +42,68 @@ function useBlockComments(postId) {
|
|
|
46
42
|
clientIds: getClientIdsWithDescendants()
|
|
47
43
|
};
|
|
48
44
|
}, []);
|
|
49
|
-
const {
|
|
45
|
+
const { notes, unresolvedNotes } = useMemo(() => {
|
|
50
46
|
if (!threads || threads.length === 0) {
|
|
51
|
-
return {
|
|
47
|
+
return { notes: [], unresolvedNotes: [] };
|
|
52
48
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const blocksWithNotes = {};
|
|
50
|
+
const clientIdByNoteId = /* @__PURE__ */ new Map();
|
|
51
|
+
for (const clientId of clientIds) {
|
|
52
|
+
const noteId = getBlockAttributes(clientId)?.metadata?.noteId;
|
|
53
|
+
if (noteId) {
|
|
54
|
+
const key = String(noteId);
|
|
55
|
+
blocksWithNotes[clientId] = key;
|
|
56
|
+
clientIdByNoteId.set(key, clientId);
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
blocksWithComments
|
|
64
|
-
).reduce((mapping, clientId) => {
|
|
65
|
-
mapping[blocksWithComments[clientId]] = clientId;
|
|
66
|
-
return mapping;
|
|
67
|
-
}, {});
|
|
68
|
-
threads.forEach((item) => {
|
|
69
|
-
const itemBlock = commentIdToBlockClientId[item.id];
|
|
70
|
-
compare[item.id] = {
|
|
58
|
+
}
|
|
59
|
+
const threadsById = /* @__PURE__ */ new Map();
|
|
60
|
+
const rootThreads = [];
|
|
61
|
+
for (const item of threads) {
|
|
62
|
+
const thread = {
|
|
71
63
|
...item,
|
|
72
64
|
reply: [],
|
|
73
|
-
blockClientId: item.parent === 0 ?
|
|
65
|
+
blockClientId: item.parent === 0 ? clientIdByNoteId.get(String(item.id)) ?? null : null
|
|
74
66
|
};
|
|
75
|
-
|
|
76
|
-
threads.forEach((item) => {
|
|
67
|
+
threadsById.set(item.id, thread);
|
|
77
68
|
if (item.parent === 0) {
|
|
78
|
-
|
|
79
|
-
} else if (compare[item.parent]) {
|
|
80
|
-
compare[item.parent].reply.push(compare[item.id]);
|
|
69
|
+
rootThreads.push(thread);
|
|
81
70
|
}
|
|
82
|
-
});
|
|
83
|
-
if (0 === result?.length) {
|
|
84
|
-
return { resultComments: [], unresolvedSortedThreads: [] };
|
|
85
71
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
72
|
+
for (const item of threads) {
|
|
73
|
+
if (item.parent !== 0) {
|
|
74
|
+
threadsById.get(item.parent)?.reply.unshift(threadsById.get(item.id));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (rootThreads.length === 0) {
|
|
78
|
+
return { notes: [], unresolvedNotes: [] };
|
|
79
|
+
}
|
|
80
|
+
const unresolved = [];
|
|
81
|
+
const resolved = [];
|
|
82
|
+
for (const noteId of Object.values(blocksWithNotes)) {
|
|
83
|
+
const thread = threadsById.get(Number(noteId)) ?? threadsById.get(noteId);
|
|
84
|
+
if (!thread) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (thread.status === "hold") {
|
|
88
|
+
unresolved.push(thread);
|
|
89
|
+
} else if (thread.status === "approved") {
|
|
90
|
+
resolved.push(thread);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const orphans = rootThreads.filter(
|
|
94
|
+
(thread) => !thread.blockClientId
|
|
104
95
|
);
|
|
105
|
-
const allSortedComments = [
|
|
106
|
-
...unresolvedSortedComments,
|
|
107
|
-
...resolvedSortedComments,
|
|
108
|
-
...orphanedComments
|
|
109
|
-
];
|
|
110
96
|
return {
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
notes: [...unresolved, ...resolved, ...orphans],
|
|
98
|
+
unresolvedNotes: unresolved
|
|
113
99
|
};
|
|
114
100
|
}, [clientIds, threads, getBlockAttributes]);
|
|
115
101
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
notes,
|
|
103
|
+
unresolvedNotes
|
|
118
104
|
};
|
|
119
105
|
}
|
|
120
|
-
function
|
|
106
|
+
function useNoteActions() {
|
|
121
107
|
const { createNotice } = useDispatch(noticesStore);
|
|
122
108
|
const { saveEntityRecord, deleteEntityRecord } = useDispatch(coreStore);
|
|
123
109
|
const { getCurrentPostId } = useSelect(editorStore);
|
|
@@ -187,7 +173,7 @@ function useBlockCommentsActions() {
|
|
|
187
173
|
throwOnError: true
|
|
188
174
|
}
|
|
189
175
|
);
|
|
190
|
-
const
|
|
176
|
+
const newNoteData = {
|
|
191
177
|
post: getCurrentPostId(),
|
|
192
178
|
content: content || "",
|
|
193
179
|
// Empty content for resolve, content for reopen.
|
|
@@ -198,7 +184,7 @@ function useBlockCommentsActions() {
|
|
|
198
184
|
_wp_note_status: status === "approved" ? "resolved" : "reopen"
|
|
199
185
|
}
|
|
200
186
|
};
|
|
201
|
-
await saveEntityRecord("root", "comment",
|
|
187
|
+
await saveEntityRecord("root", "comment", newNoteData, {
|
|
202
188
|
throwOnError: true
|
|
203
189
|
});
|
|
204
190
|
} else {
|
|
@@ -223,18 +209,12 @@ function useBlockCommentsActions() {
|
|
|
223
209
|
onError(error);
|
|
224
210
|
}
|
|
225
211
|
};
|
|
226
|
-
const onDelete = async (
|
|
212
|
+
const onDelete = async (note) => {
|
|
227
213
|
try {
|
|
228
|
-
await deleteEntityRecord(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
void 0,
|
|
233
|
-
{
|
|
234
|
-
throwOnError: true
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
if (!comment.parent) {
|
|
214
|
+
await deleteEntityRecord("root", "comment", note.id, void 0, {
|
|
215
|
+
throwOnError: true
|
|
216
|
+
});
|
|
217
|
+
if (!note.parent) {
|
|
238
218
|
const clientId = getSelectedBlockClientId();
|
|
239
219
|
const metadata = getBlockAttributes(clientId)?.metadata;
|
|
240
220
|
updateBlockAttributes(clientId, {
|
|
@@ -275,84 +255,58 @@ function useEnableFloatingSidebar(enabled = false) {
|
|
|
275
255
|
};
|
|
276
256
|
}, [enabled, registry]);
|
|
277
257
|
}
|
|
278
|
-
function useFloatingBoard({
|
|
279
|
-
|
|
258
|
+
function useFloatingBoard({
|
|
259
|
+
threads,
|
|
260
|
+
selectedNoteId,
|
|
261
|
+
isFloating,
|
|
262
|
+
sidebarRef
|
|
263
|
+
}) {
|
|
264
|
+
const [notePositions, setNotePositions] = useState({});
|
|
280
265
|
const [store] = useState(createBoardStore);
|
|
281
|
-
const { setCanvasMinHeight } = unlock(useDispatch(editorStore));
|
|
282
266
|
const heights = useSyncExternalStore(store.subscribe, store.getSnapshot);
|
|
283
267
|
useEffect(() => {
|
|
284
|
-
if (!isFloating) {
|
|
268
|
+
if (!isFloating || !sidebarRef?.current) {
|
|
285
269
|
return;
|
|
286
270
|
}
|
|
271
|
+
const panel = sidebarRef.current;
|
|
272
|
+
const blockEl = store.getFirstBlockElement();
|
|
273
|
+
const rootEl = blockEl?.closest(".is-root-container") ?? blockEl;
|
|
274
|
+
const canvas = rootEl ? getScrollContainer(rootEl) : null;
|
|
275
|
+
const applyScroll = () => {
|
|
276
|
+
panel.style.setProperty(
|
|
277
|
+
"--canvas-scroll",
|
|
278
|
+
`${-(canvas?.scrollTop ?? 0)}px`
|
|
279
|
+
);
|
|
280
|
+
};
|
|
287
281
|
const rafId = window.requestAnimationFrame(() => {
|
|
288
|
-
const
|
|
282
|
+
const result = calculateNotePositions({
|
|
289
283
|
threads,
|
|
290
284
|
selectedNoteId,
|
|
291
285
|
blockRects: store.getBlockRects(),
|
|
292
|
-
heights
|
|
286
|
+
heights,
|
|
287
|
+
scrollTop: canvas?.scrollTop ?? 0
|
|
293
288
|
});
|
|
294
|
-
|
|
295
|
-
|
|
289
|
+
setNotePositions(result.positions);
|
|
290
|
+
applyScroll();
|
|
296
291
|
});
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
]);
|
|
292
|
+
const view = canvas?.ownerDocument?.defaultView;
|
|
293
|
+
const listenerOptions = { passive: true, capture: true };
|
|
294
|
+
view?.addEventListener("scroll", applyScroll, listenerOptions);
|
|
295
|
+
return () => {
|
|
296
|
+
window.cancelAnimationFrame(rafId);
|
|
297
|
+
view?.removeEventListener("scroll", applyScroll, listenerOptions);
|
|
298
|
+
};
|
|
299
|
+
}, [sidebarRef, heights, isFloating, selectedNoteId, store, threads]);
|
|
306
300
|
return {
|
|
307
|
-
|
|
301
|
+
notePositions,
|
|
308
302
|
registerThread: store.registerThread,
|
|
309
303
|
unregisterThread: store.unregisterThread
|
|
310
304
|
};
|
|
311
305
|
}
|
|
312
|
-
function useFloatingThread({
|
|
313
|
-
thread,
|
|
314
|
-
calculatedOffset,
|
|
315
|
-
registerThread,
|
|
316
|
-
unregisterThread
|
|
317
|
-
}) {
|
|
318
|
-
const blockElement = useBlockElement(thread.blockClientId);
|
|
319
|
-
const { y, refs } = useFloating({
|
|
320
|
-
placement: "right-start",
|
|
321
|
-
middleware: [
|
|
322
|
-
offsetMiddleware({
|
|
323
|
-
crossAxis: calculatedOffset || -16
|
|
324
|
-
})
|
|
325
|
-
],
|
|
326
|
-
whileElementsMounted: autoUpdate
|
|
327
|
-
});
|
|
328
|
-
useEffect(() => {
|
|
329
|
-
if (blockElement) {
|
|
330
|
-
refs.setReference(blockElement);
|
|
331
|
-
}
|
|
332
|
-
}, [blockElement, refs]);
|
|
333
|
-
useEffect(() => {
|
|
334
|
-
const floatingEl = refs.floating?.current;
|
|
335
|
-
if (floatingEl && registerThread) {
|
|
336
|
-
registerThread(thread.id, blockElement, floatingEl);
|
|
337
|
-
}
|
|
338
|
-
return () => unregisterThread?.(thread.id);
|
|
339
|
-
}, [
|
|
340
|
-
blockElement,
|
|
341
|
-
thread.id,
|
|
342
|
-
refs.floating,
|
|
343
|
-
registerThread,
|
|
344
|
-
unregisterThread
|
|
345
|
-
]);
|
|
346
|
-
return {
|
|
347
|
-
y,
|
|
348
|
-
refs
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
306
|
export {
|
|
352
|
-
useBlockComments,
|
|
353
|
-
useBlockCommentsActions,
|
|
354
307
|
useEnableFloatingSidebar,
|
|
355
308
|
useFloatingBoard,
|
|
356
|
-
|
|
309
|
+
useNoteActions,
|
|
310
|
+
useNoteThreads
|
|
357
311
|
};
|
|
358
312
|
//# sourceMappingURL=hooks.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/hooks.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tuseFloating,\n\toffset as offsetMiddleware,\n\tautoUpdate,\n} from '@floating-ui/react-dom';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseMemo,\n\tuseSyncExternalStore,\n} from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { FLOATING_NOTES_SIDEBAR } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { createBoardStore } from './board-store';\nimport { calculateAllOffsets } from './utils';\n\nconst { useBlockElement, cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nexport function useBlockComments( postId ) {\n\tconst queryArgs = {\n\t\tpost: postId,\n\t\ttype: 'note',\n\t\tstatus: 'all',\n\t\tper_page: -1,\n\t};\n\n\tconst { records: threads } = useEntityRecords(\n\t\t'root',\n\t\t'comment',\n\t\tqueryArgs,\n\t\t{ enabled: !! postId && typeof postId === 'number' }\n\t);\n\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\tconst { clientIds } = useSelect( ( select ) => {\n\t\tconst { getClientIdsWithDescendants } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientIds: getClientIdsWithDescendants(),\n\t\t};\n\t}, [] );\n\n\t// Process comments to build the tree structure.\n\tconst { resultComments, unresolvedSortedThreads } = useMemo( () => {\n\t\tif ( ! threads || threads.length === 0 ) {\n\t\t\treturn { resultComments: [], unresolvedSortedThreads: [] };\n\t\t}\n\n\t\tconst blocksWithComments = clientIds.reduce( ( results, clientId ) => {\n\t\t\tconst commentId = getBlockAttributes( clientId )?.metadata?.noteId;\n\t\t\tif ( commentId ) {\n\t\t\t\tresults[ clientId ] = commentId;\n\t\t\t}\n\t\t\treturn results;\n\t\t}, {} );\n\n\t\t// Create a compare to store the references to all objects by id.\n\t\tconst compare = {};\n\t\tconst result = [];\n\n\t\t// Create a reverse map for faster lookup.\n\t\tconst commentIdToBlockClientId = Object.keys(\n\t\t\tblocksWithComments\n\t\t).reduce( ( mapping, clientId ) => {\n\t\t\tmapping[ blocksWithComments[ clientId ] ] = clientId;\n\t\t\treturn mapping;\n\t\t}, {} );\n\n\t\t// Initialize each object with an empty `reply` array and map blockClientId.\n\t\tthreads.forEach( ( item ) => {\n\t\t\tconst itemBlock = commentIdToBlockClientId[ item.id ];\n\n\t\t\tcompare[ item.id ] = {\n\t\t\t\t...item,\n\t\t\t\treply: [],\n\t\t\t\tblockClientId: item.parent === 0 ? itemBlock : null,\n\t\t\t};\n\t\t} );\n\n\t\t// Iterate over the data to build the tree structure.\n\t\tthreads.forEach( ( item ) => {\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\t// If parent is 0, it's a root item, push it to the result array.\n\t\t\t\tresult.push( compare[ item.id ] );\n\t\t\t} else if ( compare[ item.parent ] ) {\n\t\t\t\t// Otherwise, find its parent and push it to the parent's `reply` array.\n\t\t\t\tcompare[ item.parent ].reply.push( compare[ item.id ] );\n\t\t\t}\n\t\t} );\n\n\t\tif ( 0 === result?.length ) {\n\t\t\treturn { resultComments: [], unresolvedSortedThreads: [] };\n\t\t}\n\n\t\tconst updatedResult = result.map( ( item ) => ( {\n\t\t\t...item,\n\t\t\treply: [ ...item.reply ].reverse(),\n\t\t} ) );\n\n\t\tconst threadIdMap = new Map(\n\t\t\tupdatedResult.map( ( thread ) => [ String( thread.id ), thread ] )\n\t\t);\n\n\t\t// Prepare sets to determine which threads are linked to existing blocks.\n\t\tconst mappedIds = new Set(\n\t\t\tObject.values( blocksWithComments ).map( ( id ) => String( id ) )\n\t\t);\n\n\t\t// Get comments by block order, first unresolved, then resolved.\n\t\tconst unresolvedSortedComments = Object.values( blocksWithComments )\n\t\t\t.map( ( commentId ) => threadIdMap.get( String( commentId ) ) )\n\t\t\t.filter(\n\t\t\t\t( thread ) => thread !== undefined && thread.status === 'hold'\n\t\t\t);\n\n\t\tconst resolvedSortedComments = Object.values( blocksWithComments )\n\t\t\t.map( ( commentId ) => threadIdMap.get( String( commentId ) ) )\n\t\t\t.filter(\n\t\t\t\t( thread ) =>\n\t\t\t\t\tthread !== undefined && thread.status === 'approved'\n\t\t\t);\n\n\t\t// Append orphaned notes (whose related block was deleted or missing).\n\t\tconst orphanedComments = updatedResult.filter(\n\t\t\t( thread ) => ! mappedIds.has( String( thread.id ) )\n\t\t);\n\n\t\tconst allSortedComments = [\n\t\t\t...unresolvedSortedComments,\n\t\t\t...resolvedSortedComments,\n\t\t\t...orphanedComments,\n\t\t];\n\n\t\treturn {\n\t\t\tresultComments: allSortedComments,\n\t\t\tunresolvedSortedThreads: unresolvedSortedComments,\n\t\t};\n\t}, [ clientIds, threads, getBlockAttributes ] );\n\n\treturn {\n\t\tresultComments,\n\t\tunresolvedSortedThreads,\n\t};\n}\n\nexport function useBlockCommentsActions() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onError = ( error ) => {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? decodeEntities( error.message )\n\t\t\t\t: __( 'An error occurred while performing an update.' );\n\t\tcreateNotice( 'error', errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t\tisDismissible: true,\n\t\t} );\n\t};\n\n\tconst onCreate = async ( { content, parent } ) => {\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tparent: parent || 0,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// If it's a main comment, update the block attributes with the comment id.\n\t\t\tif ( ! parent && savedRecord?.id ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: savedRecord.id,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparent ? __( 'Reply added.' ) : __( 'Note added.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn savedRecord;\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onEdit = async ( { id, content, status } ) => {\n\t\tconst messageType = status ? status : 'updated';\n\t\tconst messages = {\n\t\t\tapproved: __( 'Note marked as resolved.' ),\n\t\t\thold: __( 'Note reopened.' ),\n\t\t\tupdated: __( 'Note updated.' ),\n\t\t};\n\n\t\ttry {\n\t\t\t// For resolution or reopen actions, create a new note with metadata.\n\t\t\tif ( status === 'approved' || status === 'hold' ) {\n\t\t\t\t// First, update the thread status.\n\t\t\t\tawait saveEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'comment',\n\t\t\t\t\t{\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Then create a new comment with the metadata.\n\t\t\t\tconst newCommentData = {\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent: content || '', // Empty content for resolve, content for reopen.\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tstatus,\n\t\t\t\t\tparent: id,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\t_wp_note_status:\n\t\t\t\t\t\t\tstatus === 'approved' ? 'resolved' : 'reopen',\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', newCommentData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst updateData = {\n\t\t\t\t\tid,\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus,\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', updateData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tmessages[ messageType ] ?? __( 'Note updated.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onDelete = async ( comment ) => {\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\tcomment.id,\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( ! comment.parent ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice( 'snackbar', __( 'Note deleted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\treturn { onCreate, onEdit, onDelete };\n}\n\nexport function useEnableFloatingSidebar( enabled = false ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getActiveComplementaryArea } =\n\t\t\tregistry.select( interfaceStore );\n\t\tconst { disableComplementaryArea, enableComplementaryArea } =\n\t\t\tregistry.dispatch( interfaceStore );\n\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Return `null` to indicate the user hid the complementary area.\n\t\t\tif ( getActiveComplementaryArea( 'core' ) === null ) {\n\t\t\t\tenableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunsubscribe();\n\t\t\tif (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) === FLOATING_NOTES_SIDEBAR\n\t\t\t) {\n\t\t\t\tdisableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t};\n\t}, [ enabled, registry ] );\n}\n\nexport function useFloatingBoard( { threads, selectedNoteId, isFloating } ) {\n\tconst [ boardOffsets, setBoardOffsets ] = useState( {} );\n\tconst [ store ] = useState( createBoardStore );\n\tconst { setCanvasMinHeight } = unlock( useDispatch( editorStore ) );\n\n\tconst heights = useSyncExternalStore( store.subscribe, store.getSnapshot );\n\n\t// Recalc is deferred to a rAF; the cleanup cancels the pending frame\n\t// when deps change, so back-to-back updates collapse into one paint.\n\tuseEffect( () => {\n\t\tif ( ! isFloating ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rafId = window.requestAnimationFrame( () => {\n\t\t\tconst { offsets, minHeight } = calculateAllOffsets( {\n\t\t\t\tthreads,\n\t\t\t\tselectedNoteId,\n\t\t\t\tblockRects: store.getBlockRects(),\n\t\t\t\theights,\n\t\t\t} );\n\t\t\tsetBoardOffsets( offsets );\n\t\t\tsetCanvasMinHeight( minHeight );\n\t\t} );\n\n\t\treturn () => window.cancelAnimationFrame( rafId );\n\t}, [\n\t\theights,\n\t\tisFloating,\n\t\tselectedNoteId,\n\t\tsetCanvasMinHeight,\n\t\tstore,\n\t\tthreads,\n\t] );\n\n\treturn {\n\t\tboardOffsets,\n\t\tregisterThread: store.registerThread,\n\t\tunregisterThread: store.unregisterThread,\n\t};\n}\n\nexport function useFloatingThread( {\n\tthread,\n\tcalculatedOffset,\n\tregisterThread,\n\tunregisterThread,\n} ) {\n\tconst blockElement = useBlockElement( thread.blockClientId );\n\n\t// Use floating-ui to track the block element's position with the calculated offset.\n\tconst { y, refs } = useFloating( {\n\t\tplacement: 'right-start',\n\t\tmiddleware: [\n\t\t\toffsetMiddleware( {\n\t\t\t\tcrossAxis: calculatedOffset || -16,\n\t\t\t} ),\n\t\t],\n\t\twhileElementsMounted: autoUpdate,\n\t} );\n\n\t// Set the floating-ui reference element.\n\tuseEffect( () => {\n\t\tif ( blockElement ) {\n\t\t\trefs.setReference( blockElement );\n\t\t}\n\t}, [ blockElement, refs ] );\n\n\t// Register block + floating elements with the board.\n\t// The board's ResizeObserver tracks height changes automatically.\n\tuseEffect( () => {\n\t\tconst floatingEl = refs.floating?.current;\n\t\tif ( floatingEl && registerThread ) {\n\t\t\tregisterThread( thread.id, blockElement, floatingEl );\n\t\t}\n\t\treturn () => unregisterThread?.( thread.id );\n\t}, [\n\t\tblockElement,\n\t\tthread.id,\n\t\trefs.floating,\n\t\tregisterThread,\n\t\tunregisterThread,\n\t] );\n\n\treturn {\n\t\ty,\n\t\trefs,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";AAGA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseMemo,\n\tuseSyncExternalStore,\n} from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { FLOATING_NOTES_SIDEBAR } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { createBoardStore } from './board-store';\nimport { calculateNotePositions } from './utils';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nexport function useNoteThreads( postId ) {\n\tconst queryArgs = {\n\t\tpost: postId,\n\t\ttype: 'note',\n\t\tstatus: 'all',\n\t\tper_page: -1,\n\t};\n\n\tconst { records: threads } = useEntityRecords(\n\t\t'root',\n\t\t'comment',\n\t\tqueryArgs,\n\t\t{ enabled: !! postId && typeof postId === 'number' }\n\t);\n\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\tconst { clientIds } = useSelect( ( select ) => {\n\t\tconst { getClientIdsWithDescendants } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientIds: getClientIdsWithDescendants(),\n\t\t};\n\t}, [] );\n\n\t// Process notes to build the tree structure.\n\tconst { notes, unresolvedNotes } = useMemo( () => {\n\t\tif ( ! threads || threads.length === 0 ) {\n\t\t\treturn { notes: [], unresolvedNotes: [] };\n\t\t}\n\n\t\t// Single pass over clientIds: build clientId->noteId map AND reverse lookup.\n\t\tconst blocksWithNotes = {};\n\t\tconst clientIdByNoteId = new Map();\n\t\tfor ( const clientId of clientIds ) {\n\t\t\tconst noteId = getBlockAttributes( clientId )?.metadata?.noteId;\n\t\t\tif ( noteId ) {\n\t\t\t\tconst key = String( noteId );\n\t\t\t\tblocksWithNotes[ clientId ] = key;\n\t\t\t\tclientIdByNoteId.set( key, clientId );\n\t\t\t}\n\t\t}\n\n\t\t// Materialize threads; collect roots; replies linked in a second pass\n\t\t// via unshift to invert order (matches prior reverse semantics).\n\t\tconst threadsById = new Map();\n\t\tconst rootThreads = [];\n\t\tfor ( const item of threads ) {\n\t\t\tconst thread = {\n\t\t\t\t...item,\n\t\t\t\treply: [],\n\t\t\t\tblockClientId:\n\t\t\t\t\titem.parent === 0\n\t\t\t\t\t\t? clientIdByNoteId.get( String( item.id ) ) ?? null\n\t\t\t\t\t\t: null,\n\t\t\t};\n\t\t\tthreadsById.set( item.id, thread );\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\trootThreads.push( thread );\n\t\t\t}\n\t\t}\n\t\tfor ( const item of threads ) {\n\t\t\tif ( item.parent !== 0 ) {\n\t\t\t\tthreadsById\n\t\t\t\t\t.get( item.parent )\n\t\t\t\t\t?.reply.unshift( threadsById.get( item.id ) );\n\t\t\t}\n\t\t}\n\n\t\tif ( rootThreads.length === 0 ) {\n\t\t\treturn { notes: [], unresolvedNotes: [] };\n\t\t}\n\n\t\t// Single partition over notes-in-block-order.\n\t\tconst unresolved = [];\n\t\tconst resolved = [];\n\t\tfor ( const noteId of Object.values( blocksWithNotes ) ) {\n\t\t\tconst thread =\n\t\t\t\tthreadsById.get( Number( noteId ) ) ??\n\t\t\t\tthreadsById.get( noteId );\n\t\t\tif ( ! thread ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( thread.status === 'hold' ) {\n\t\t\t\tunresolved.push( thread );\n\t\t\t} else if ( thread.status === 'approved' ) {\n\t\t\t\tresolved.push( thread );\n\t\t\t}\n\t\t}\n\n\t\t// Orphans: root threads without a linked block. They only need to come last.\n\t\tconst orphans = rootThreads.filter(\n\t\t\t( thread ) => ! thread.blockClientId\n\t\t);\n\n\t\treturn {\n\t\t\tnotes: [ ...unresolved, ...resolved, ...orphans ],\n\t\t\tunresolvedNotes: unresolved,\n\t\t};\n\t}, [ clientIds, threads, getBlockAttributes ] );\n\n\treturn {\n\t\tnotes,\n\t\tunresolvedNotes,\n\t};\n}\n\nexport function useNoteActions() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onError = ( error ) => {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? decodeEntities( error.message )\n\t\t\t\t: __( 'An error occurred while performing an update.' );\n\t\tcreateNotice( 'error', errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t\tisDismissible: true,\n\t\t} );\n\t};\n\n\tconst onCreate = async ( { content, parent } ) => {\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tparent: parent || 0,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// If it's a top-level note, update the block attributes with the note id.\n\t\t\tif ( ! parent && savedRecord?.id ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: savedRecord.id,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparent ? __( 'Reply added.' ) : __( 'Note added.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn savedRecord;\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onEdit = async ( { id, content, status } ) => {\n\t\tconst messageType = status ? status : 'updated';\n\t\tconst messages = {\n\t\t\tapproved: __( 'Note marked as resolved.' ),\n\t\t\thold: __( 'Note reopened.' ),\n\t\t\tupdated: __( 'Note updated.' ),\n\t\t};\n\n\t\ttry {\n\t\t\t// For resolution or reopen actions, create a new note with metadata.\n\t\t\tif ( status === 'approved' || status === 'hold' ) {\n\t\t\t\t// First, update the thread status.\n\t\t\t\tawait saveEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'comment',\n\t\t\t\t\t{\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Then create a new note with the metadata.\n\t\t\t\tconst newNoteData = {\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent: content || '', // Empty content for resolve, content for reopen.\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tstatus,\n\t\t\t\t\tparent: id,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\t_wp_note_status:\n\t\t\t\t\t\t\tstatus === 'approved' ? 'resolved' : 'reopen',\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', newNoteData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst updateData = {\n\t\t\t\t\tid,\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus,\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', updateData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tmessages[ messageType ] ?? __( 'Note updated.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onDelete = async ( note ) => {\n\t\ttry {\n\t\t\tawait deleteEntityRecord( 'root', 'comment', note.id, undefined, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\n\t\t\tif ( ! note.parent ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice( 'snackbar', __( 'Note deleted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\treturn { onCreate, onEdit, onDelete };\n}\n\nexport function useEnableFloatingSidebar( enabled = false ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getActiveComplementaryArea } =\n\t\t\tregistry.select( interfaceStore );\n\t\tconst { disableComplementaryArea, enableComplementaryArea } =\n\t\t\tregistry.dispatch( interfaceStore );\n\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Return `null` to indicate the user hid the complementary area.\n\t\t\tif ( getActiveComplementaryArea( 'core' ) === null ) {\n\t\t\t\tenableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunsubscribe();\n\t\t\tif (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) === FLOATING_NOTES_SIDEBAR\n\t\t\t) {\n\t\t\t\tdisableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t};\n\t}, [ enabled, registry ] );\n}\n\nexport function useFloatingBoard( {\n\tthreads,\n\tselectedNoteId,\n\tisFloating,\n\tsidebarRef,\n} ) {\n\tconst [ notePositions, setNotePositions ] = useState( {} );\n\tconst [ store ] = useState( createBoardStore );\n\n\tconst heights = useSyncExternalStore( store.subscribe, store.getSnapshot );\n\n\t// Notes are positioned in canvas content-space; CSS inherits\n\t// `--canvas-scroll` to translate each thread in sync with the canvas.\n\tuseEffect( () => {\n\t\tif ( ! isFloating || ! sidebarRef?.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst panel = sidebarRef.current;\n\t\tconst blockEl = store.getFirstBlockElement();\n\t\t// Climb to the block-list root so nested scroll containers\n\t\t// (e.g. a Group with overflow:auto) don't shadow the canvas.\n\t\tconst rootEl = blockEl?.closest( '.is-root-container' ) ?? blockEl;\n\t\tconst canvas = rootEl ? getScrollContainer( rootEl ) : null;\n\n\t\tconst applyScroll = () => {\n\t\t\tpanel.style.setProperty(\n\t\t\t\t'--canvas-scroll',\n\t\t\t\t`${ -( canvas?.scrollTop ?? 0 ) }px`\n\t\t\t);\n\t\t};\n\n\t\t// Recalc is deferred to a rAF; back-to-back updates collapse into one paint.\n\t\tconst rafId = window.requestAnimationFrame( () => {\n\t\t\tconst result = calculateNotePositions( {\n\t\t\t\tthreads,\n\t\t\t\tselectedNoteId,\n\t\t\t\tblockRects: store.getBlockRects(),\n\t\t\t\theights,\n\t\t\t\tscrollTop: canvas?.scrollTop ?? 0,\n\t\t\t} );\n\n\t\t\tsetNotePositions( result.positions );\n\t\t\tapplyScroll();\n\t\t} );\n\n\t\t// Root scrolling elements (documentElement/body) don't fire scroll\n\t\t// on themselves; capture on the window catches them in either canvas.\n\t\tconst view = canvas?.ownerDocument?.defaultView;\n\t\tconst listenerOptions = { passive: true, capture: true };\n\t\tview?.addEventListener( 'scroll', applyScroll, listenerOptions );\n\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame( rafId );\n\t\t\tview?.removeEventListener( 'scroll', applyScroll, listenerOptions );\n\t\t};\n\t}, [ sidebarRef, heights, isFloating, selectedNoteId, store, threads ] );\n\n\treturn {\n\t\tnotePositions,\n\t\tregisterThread: store.registerThread,\n\t\tunregisterThread: store.unregisterThread,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,kBAAkB,SAAS,iBAAiB;AACrD,SAAS,aAAa,aAAa,iBAAiB;AACpD;AAAA,EACC,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,SAAS,oBAAoB;AACtC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,SAAS,sBAAsB;AAKxC,SAAS,SAAS,mBAAmB;AACrC,SAAS,8BAA8B;AACvC,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAEvC,IAAM,EAAE,iBAAiB,IAAI,OAAQ,sBAAuB;AAErD,SAAS,eAAgB,QAAS;AACxC,QAAM,YAAY;AAAA,IACjB,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,EACX;AAEA,QAAM,EAAE,SAAS,QAAQ,IAAI;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA,EAAE,SAAS,CAAC,CAAE,UAAU,OAAO,WAAW,SAAS;AAAA,EACpD;AAEA,QAAM,EAAE,mBAAmB,IAAI,UAAW,gBAAiB;AAC3D,QAAM,EAAE,UAAU,IAAI,UAAW,CAAE,WAAY;AAC9C,UAAM,EAAE,4BAA4B,IAAI,OAAQ,gBAAiB;AACjE,WAAO;AAAA,MACN,WAAW,4BAA4B;AA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;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// packages/editor/src/components/collab-sidebar/index.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { useSelect, useDispatch } from "@wordpress/data";
|
|
4
|
-
import { __experimentalVStack as VStack } from "@wordpress/components";
|
|
5
4
|
import { useRef } from "@wordpress/element";
|
|
6
5
|
import { useViewportMatch } from "@wordpress/compose";
|
|
7
6
|
import { useShortcut } from "@wordpress/keyboard-shortcuts";
|
|
@@ -15,54 +14,15 @@ import {
|
|
|
15
14
|
FLOATING_NOTES_SIDEBAR,
|
|
16
15
|
SIDEBARS
|
|
17
16
|
} from "./constants.mjs";
|
|
18
|
-
import {
|
|
17
|
+
import { Notes } from "./notes.mjs";
|
|
19
18
|
import { store as editorStore } from "../../store/index.mjs";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
19
|
+
import { AddNoteMenuItem } from "./add-note-menu-item.mjs";
|
|
20
|
+
import { NoteAvatarIndicator } from "./note-indicator-toolbar.mjs";
|
|
22
21
|
import { useGlobalStylesContext } from "../global-styles-provider/index.mjs";
|
|
23
|
-
import {
|
|
24
|
-
useBlockComments,
|
|
25
|
-
useBlockCommentsActions,
|
|
26
|
-
useEnableFloatingSidebar
|
|
27
|
-
} from "./hooks.mjs";
|
|
22
|
+
import { useNoteThreads, useEnableFloatingSidebar } from "./hooks.mjs";
|
|
28
23
|
import PostTypeSupportCheck from "../post-type-support-check/index.mjs";
|
|
29
24
|
import { unlock } from "../../lock-unlock.mjs";
|
|
30
25
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
-
function NotesSidebarContent({
|
|
32
|
-
styles,
|
|
33
|
-
comments,
|
|
34
|
-
commentSidebarRef,
|
|
35
|
-
isFloating = false
|
|
36
|
-
}) {
|
|
37
|
-
const { onCreate, onEdit, onDelete } = useBlockCommentsActions();
|
|
38
|
-
return /* @__PURE__ */ jsx(
|
|
39
|
-
VStack,
|
|
40
|
-
{
|
|
41
|
-
className: "editor-collab-sidebar-panel",
|
|
42
|
-
style: styles,
|
|
43
|
-
role: "tree",
|
|
44
|
-
spacing: "3",
|
|
45
|
-
justify: "flex-start",
|
|
46
|
-
ref: (node) => {
|
|
47
|
-
if (node) {
|
|
48
|
-
commentSidebarRef.current = node;
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"aria-label": isFloating ? __("Unresolved notes") : __("All notes"),
|
|
52
|
-
children: /* @__PURE__ */ jsx(
|
|
53
|
-
Comments,
|
|
54
|
-
{
|
|
55
|
-
threads: comments,
|
|
56
|
-
onEditComment: onEdit,
|
|
57
|
-
onAddReply: onCreate,
|
|
58
|
-
onCommentDelete: onDelete,
|
|
59
|
-
commentSidebarRef,
|
|
60
|
-
isFloating
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
26
|
function NotesSidebar({ postId }) {
|
|
67
27
|
const { getActiveComplementaryArea } = useSelect(interfaceStore);
|
|
68
28
|
const { enableComplementaryArea } = useDispatch(interfaceStore);
|
|
@@ -71,23 +31,16 @@ function NotesSidebar({ postId }) {
|
|
|
71
31
|
);
|
|
72
32
|
const { selectNote } = unlock(useDispatch(editorStore));
|
|
73
33
|
const isLargeViewport = useViewportMatch("medium");
|
|
74
|
-
const
|
|
75
|
-
const { clientId,
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
clientId: _clientId,
|
|
85
|
-
blockCommentId: _clientId ? getBlockAttributes(_clientId)?.metadata?.noteId : null,
|
|
86
|
-
isClassicBlock: _clientId ? getBlockName(_clientId) === "core/freeform" : false
|
|
87
|
-
};
|
|
88
|
-
},
|
|
89
|
-
[]
|
|
90
|
-
);
|
|
34
|
+
const sidebarRef = useRef(null);
|
|
35
|
+
const { clientId, noteId, isClassicBlock } = useSelect((select) => {
|
|
36
|
+
const { getBlockAttributes, getSelectedBlockClientId, getBlockName } = select(blockEditorStore);
|
|
37
|
+
const _clientId = getSelectedBlockClientId();
|
|
38
|
+
return {
|
|
39
|
+
clientId: _clientId,
|
|
40
|
+
noteId: _clientId ? getBlockAttributes(_clientId)?.metadata?.noteId : null,
|
|
41
|
+
isClassicBlock: _clientId ? getBlockName(_clientId) === "core/freeform" : false
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
91
44
|
const { isDistractionFree } = useSelect((select) => {
|
|
92
45
|
const { get } = select(preferencesStore);
|
|
93
46
|
return {
|
|
@@ -98,11 +51,11 @@ function NotesSidebar({ postId }) {
|
|
|
98
51
|
(select) => unlock(select(editorStore)).getSelectedNote(),
|
|
99
52
|
[]
|
|
100
53
|
);
|
|
101
|
-
const {
|
|
54
|
+
const { notes, unresolvedNotes } = useNoteThreads(postId);
|
|
102
55
|
const showFloatingSidebar = isLargeViewport;
|
|
103
|
-
const showAllNotesSidebar =
|
|
56
|
+
const showAllNotesSidebar = notes.length > 0 || !showFloatingSidebar;
|
|
104
57
|
useEnableFloatingSidebar(
|
|
105
|
-
showFloatingSidebar && (
|
|
58
|
+
showFloatingSidebar && (unresolvedNotes.length > 0 || selectedNote !== void 0)
|
|
106
59
|
);
|
|
107
60
|
useShortcut(
|
|
108
61
|
"core/editor/new-note",
|
|
@@ -113,17 +66,17 @@ function NotesSidebar({ postId }) {
|
|
|
113
66
|
{
|
|
114
67
|
// When multiple notes per block are supported. Remove note ID check.
|
|
115
68
|
// See: https://github.com/WordPress/gutenberg/pull/75147.
|
|
116
|
-
isDisabled: isDistractionFree || isClassicBlock || !clientId || !!
|
|
69
|
+
isDisabled: isDistractionFree || isClassicBlock || !clientId || !!noteId
|
|
117
70
|
}
|
|
118
71
|
);
|
|
119
72
|
const { merged: GlobalStyles } = useGlobalStylesContext();
|
|
120
73
|
const backgroundColor = GlobalStyles?.styles?.color?.background;
|
|
121
|
-
const currentThread =
|
|
74
|
+
const currentThread = noteId ? notes.find((thread) => thread.id === noteId) : null;
|
|
122
75
|
async function openTheSidebar(selectedClientId) {
|
|
123
76
|
const prevArea = await getActiveComplementaryArea("core");
|
|
124
77
|
const activeNotesArea = SIDEBARS.find((name) => name === prevArea);
|
|
125
78
|
const targetClientId = selectedClientId && selectedClientId !== clientId ? selectedClientId : clientId;
|
|
126
|
-
const targetNote =
|
|
79
|
+
const targetNote = notes.find(
|
|
127
80
|
(note) => note.blockClientId === targetClientId
|
|
128
81
|
);
|
|
129
82
|
if (targetNote?.status === "approved") {
|
|
@@ -143,17 +96,17 @@ function NotesSidebar({ postId }) {
|
|
|
143
96
|
selectNote(targetNote ? targetNote.id : "new", { focus: true });
|
|
144
97
|
}
|
|
145
98
|
if (isDistractionFree) {
|
|
146
|
-
return /* @__PURE__ */ jsx(
|
|
99
|
+
return /* @__PURE__ */ jsx(AddNoteMenuItem, { isDistractionFree: true });
|
|
147
100
|
}
|
|
148
101
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
149
102
|
!!currentThread && /* @__PURE__ */ jsx(
|
|
150
|
-
|
|
103
|
+
NoteAvatarIndicator,
|
|
151
104
|
{
|
|
152
|
-
|
|
105
|
+
note: currentThread,
|
|
153
106
|
onClick: openTheSidebar
|
|
154
107
|
}
|
|
155
108
|
),
|
|
156
|
-
/* @__PURE__ */ jsx(
|
|
109
|
+
/* @__PURE__ */ jsx(AddNoteMenuItem, { onClick: openTheSidebar }),
|
|
157
110
|
showAllNotesSidebar && /* @__PURE__ */ jsx(
|
|
158
111
|
PluginSidebar,
|
|
159
112
|
{
|
|
@@ -163,13 +116,7 @@ function NotesSidebar({ postId }) {
|
|
|
163
116
|
header: /* @__PURE__ */ jsx("h2", { className: "interface-complementary-area-header__title", children: __("All notes") }),
|
|
164
117
|
icon: commentIcon,
|
|
165
118
|
closeLabel: __("Close Notes"),
|
|
166
|
-
children: /* @__PURE__ */ jsx(
|
|
167
|
-
NotesSidebarContent,
|
|
168
|
-
{
|
|
169
|
-
comments: resultComments,
|
|
170
|
-
commentSidebarRef
|
|
171
|
-
}
|
|
172
|
-
)
|
|
119
|
+
children: /* @__PURE__ */ jsx(Notes, { notes, sidebarRef })
|
|
173
120
|
}
|
|
174
121
|
),
|
|
175
122
|
isLargeViewport && /* @__PURE__ */ jsx(
|
|
@@ -182,13 +129,11 @@ function NotesSidebar({ postId }) {
|
|
|
182
129
|
headerClassName: "editor-collab-sidebar__header",
|
|
183
130
|
backgroundColor,
|
|
184
131
|
children: /* @__PURE__ */ jsx(
|
|
185
|
-
|
|
132
|
+
Notes,
|
|
186
133
|
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
styles: {
|
|
190
|
-
backgroundColor
|
|
191
|
-
},
|
|
134
|
+
notes: unresolvedNotes,
|
|
135
|
+
sidebarRef,
|
|
136
|
+
styles: { backgroundColor },
|
|
192
137
|
isFloating: true
|
|
193
138
|
}
|
|
194
139
|
)
|