@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
package/CHANGELOG.md
CHANGED
|
@@ -17,12 +17,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// packages/editor/src/components/collab-sidebar/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
20
|
+
// packages/editor/src/components/collab-sidebar/add-note-menu-item.js
|
|
21
|
+
var add_note_menu_item_exports = {};
|
|
22
|
+
__export(add_note_menu_item_exports, {
|
|
23
|
+
AddNoteMenuItem: () => AddNoteMenuItem
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(add_note_menu_item_exports);
|
|
26
26
|
var import_components = require("@wordpress/components");
|
|
27
27
|
var import_i18n = require("@wordpress/i18n");
|
|
28
28
|
var import_block_editor = require("@wordpress/block-editor");
|
|
@@ -31,8 +31,8 @@ var import_blocks = require("@wordpress/blocks");
|
|
|
31
31
|
var import_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
|
|
32
32
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
33
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
var {
|
|
35
|
-
|
|
34
|
+
var { NoteIconSlotFill } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
35
|
+
function NoteMenuItem({ clientId, onClick, isDistractionFree }) {
|
|
36
36
|
const block = (0, import_data.useSelect)(
|
|
37
37
|
(select) => {
|
|
38
38
|
return select(import_block_editor.store).getBlock(clientId);
|
|
@@ -66,10 +66,10 @@ var AddCommentMenuItem = ({ clientId, onClick, isDistractionFree }) => {
|
|
|
66
66
|
children: (0, import_i18n.__)("Add note")
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
-
|
|
69
|
+
}
|
|
70
|
+
function AddNoteMenuItem({ onClick, isDistractionFree }) {
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NoteIconSlotFill.Fill, { children: ({ clientId, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
NoteMenuItem,
|
|
73
73
|
{
|
|
74
74
|
clientId,
|
|
75
75
|
isDistractionFree,
|
|
@@ -79,6 +79,9 @@ var AddCommentMenuItemFill = ({ onClick, isDistractionFree }) => {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
) });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
}
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
AddNoteMenuItem
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=add-note-menu-item.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/collab-sidebar/add-note-menu-item.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { getUnregisteredTypeHandlerName } from '@wordpress/blocks';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { NoteIconSlotFill } = unlock( blockEditorPrivateApis );\n\nfunction NoteMenuItem( { clientId, onClick, isDistractionFree } ) {\n\tconst block = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlock( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst shortcut = useSelect(\n\t\t( select ) =>\n\t\t\tselect( keyboardShortcutsStore ).getShortcutRepresentation(\n\t\t\t\t'core/editor/new-note'\n\t\t\t),\n\t\t[]\n\t);\n\n\tif (\n\t\t! block?.isValid ||\n\t\tblock?.name === getUnregisteredTypeHandlerName()\n\t) {\n\t\treturn null;\n\t}\n\n\tconst isDisabled = isDistractionFree || block?.name === 'core/freeform';\n\n\tlet infoText;\n\n\tif ( isDistractionFree ) {\n\t\tinfoText = __( 'Notes are disabled in distraction free mode.' );\n\t} else if ( block?.name === 'core/freeform' ) {\n\t\tinfoText = __( 'Convert to blocks to add notes.' );\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ onClick }\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdisabled={ isDisabled }\n\t\t\tinfo={ infoText }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ __( 'Add note' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport function AddNoteMenuItem( { onClick, isDistractionFree } ) {\n\treturn (\n\t\t<NoteIconSlotFill.Fill>\n\t\t\t{ ( { clientId, onClose } ) => (\n\t\t\t\t<NoteMenuItem\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonClick( clientId );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</NoteIconSlotFill.Fill>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAyB;AACzB,kBAAmB;AACnB,0BAGO;AACP,kBAA0B;AAC1B,oBAA+C;AAC/C,gCAAgD;AAKhD,yBAAuB;AAqCrB;AAnCF,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE5D,SAAS,aAAc,EAAE,UAAU,SAAS,kBAAkB,GAAI;AACjE,QAAM,YAAQ;AAAA,IACb,CAAE,WAAY;AACb,aAAO,OAAQ,oBAAAC,KAAiB,EAAE,SAAU,QAAS;AAAA,IACtD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACA,QAAM,eAAW;AAAA,IAChB,CAAE,WACD,OAAQ,0BAAAC,KAAuB,EAAE;AAAA,MAChC;AAAA,IACD;AAAA,IACD,CAAC;AAAA,EACF;AAEA,MACC,CAAE,OAAO,WACT,OAAO,aAAS,8CAA+B,GAC9C;AACD,WAAO;AAAA,EACR;AAEA,QAAM,aAAa,qBAAqB,OAAO,SAAS;AAExD,MAAI;AAEJ,MAAK,mBAAoB;AACxB,mBAAW,gBAAI,8CAA+C;AAAA,EAC/D,WAAY,OAAO,SAAS,iBAAkB;AAC7C,mBAAW,gBAAI,iCAAkC;AAAA,EAClD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,iBAAc;AAAA,MACd,UAAW;AAAA,MACX,MAAO;AAAA,MACP;AAAA,MAEE,8BAAI,UAAW;AAAA;AAAA,EAClB;AAEF;AAEO,SAAS,gBAAiB,EAAE,SAAS,kBAAkB,GAAI;AACjE,SACC,4CAAC,iBAAiB,MAAjB,EACE,WAAE,EAAE,UAAU,QAAQ,MACvB;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAU,MAAM;AACf,gBAAS,QAAS;AAClB,gBAAQ;AAAA,MACT;AAAA;AAAA,EACD,GAEF;AAEF;",
|
|
6
|
+
"names": ["blockEditorPrivateApis", "blockEditorStore", "keyboardShortcutsStore"]
|
|
7
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,35 +15,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
|
-
// packages/editor/src/components/collab-sidebar/add-
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
33
|
-
|
|
20
|
+
// packages/editor/src/components/collab-sidebar/add-note.js
|
|
21
|
+
var add_note_exports = {};
|
|
22
|
+
__export(add_note_exports, {
|
|
23
|
+
AddNote: () => AddNote
|
|
34
24
|
});
|
|
35
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(add_note_exports);
|
|
36
26
|
var import_i18n = require("@wordpress/i18n");
|
|
37
27
|
var import_data = require("@wordpress/data");
|
|
38
|
-
var import_components = require("@wordpress/components");
|
|
39
28
|
var import_block_editor = require("@wordpress/block-editor");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var import_comment_form = __toESM(require("./comment-form.cjs"));
|
|
29
|
+
var import_note_card = require("./note-card.cjs");
|
|
30
|
+
var import_note_form = require("./note-form.cjs");
|
|
43
31
|
var import_floating_container = require("./floating-container.cjs");
|
|
44
32
|
var import_utils = require("./utils.cjs");
|
|
45
33
|
var import_store = require("../../store/index.cjs");
|
|
34
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
46
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
36
|
var { useBlockElement } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
48
|
-
function
|
|
37
|
+
function AddNote({ onSubmit, sidebarRef, floating }) {
|
|
49
38
|
const { clientId } = (0, import_data.useSelect)((select) => {
|
|
50
39
|
const { getSelectedBlockClientId } = select(import_block_editor.store);
|
|
51
40
|
return {
|
|
@@ -59,7 +48,7 @@ function AddComment({ onSubmit, commentSidebarRef, floating }) {
|
|
|
59
48
|
const blockElement = useBlockElement(clientId);
|
|
60
49
|
const { toggleBlockSpotlight } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_block_editor.store));
|
|
61
50
|
const { selectNote } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
|
|
62
|
-
const
|
|
51
|
+
const unselectNote = () => {
|
|
63
52
|
selectNote(void 0);
|
|
64
53
|
blockElement?.focus();
|
|
65
54
|
toggleBlockSpotlight(clientId, false);
|
|
@@ -67,12 +56,12 @@ function AddComment({ onSubmit, commentSidebarRef, floating }) {
|
|
|
67
56
|
if (selectedNote !== "new" || !clientId) {
|
|
68
57
|
return null;
|
|
69
58
|
}
|
|
70
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
60
|
import_floating_container.FloatingContainer,
|
|
72
61
|
{
|
|
73
62
|
floating,
|
|
74
63
|
className: "editor-collab-sidebar-panel__thread is-selected",
|
|
75
|
-
|
|
64
|
+
gap: "md",
|
|
76
65
|
tabIndex: 0,
|
|
77
66
|
"aria-label": (0, import_i18n.__)("New note"),
|
|
78
67
|
role: "treeitem",
|
|
@@ -87,27 +76,25 @@ function AddComment({ onSubmit, commentSidebarRef, floating }) {
|
|
|
87
76
|
toggleBlockSpotlight(clientId, false);
|
|
88
77
|
selectNote(void 0);
|
|
89
78
|
},
|
|
90
|
-
children:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
]
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_note_card.NoteCard, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_note_form.NoteForm,
|
|
81
|
+
{
|
|
82
|
+
onSubmit: async (inputComment) => {
|
|
83
|
+
const { id } = await onSubmit({
|
|
84
|
+
content: inputComment
|
|
85
|
+
});
|
|
86
|
+
selectNote(id);
|
|
87
|
+
(0, import_utils.focusNoteThread)(id, sidebarRef.current);
|
|
88
|
+
},
|
|
89
|
+
onCancel: unselectNote,
|
|
90
|
+
labels: { input: (0, import_i18n.__)("New note") }
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
106
93
|
}
|
|
107
94
|
);
|
|
108
95
|
}
|
|
109
96
|
// Annotate the CommonJS export names for ESM import in node:
|
|
110
97
|
0 && (module.exports = {
|
|
111
|
-
|
|
98
|
+
AddNote
|
|
112
99
|
});
|
|
113
|
-
//# sourceMappingURL=add-
|
|
100
|
+
//# sourceMappingURL=add-note.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/collab-sidebar/add-note.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { NoteCard } from './note-card';\nimport { NoteForm } from './note-form';\nimport { FloatingContainer } from './floating-container';\nimport { focusNoteThread } from './utils';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function AddNote( { onSubmit, sidebarRef, floating } ) {\n\tconst { clientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientId: getSelectedBlockClientId(),\n\t\t};\n\t}, [] );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\tconst blockElement = useBlockElement( clientId );\n\tconst { toggleBlockSpotlight } = unlock( useDispatch( blockEditorStore ) );\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\n\tconst unselectNote = () => {\n\t\tselectNote( undefined );\n\t\tblockElement?.focus();\n\t\ttoggleBlockSpotlight( clientId, false );\n\t};\n\n\tif ( selectedNote !== 'new' || ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<FloatingContainer\n\t\t\tfloating={ floating }\n\t\t\tclassName=\"editor-collab-sidebar-panel__thread is-selected\"\n\t\t\tgap=\"md\"\n\t\t\ttabIndex={ 0 }\n\t\t\taria-label={ __( 'New note' ) }\n\t\t\trole=\"treeitem\"\n\t\t\tstyle={\n\t\t\t\tfloating ? { opacity: ! floating.y ? 0 : undefined } : undefined\n\t\t\t}\n\t\t\tonBlur={ ( event ) => {\n\t\t\t\t// Don't deselect notes when the browser window/tab loses focus.\n\t\t\t\tif ( ! document.hasFocus() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.currentTarget.contains( event.relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttoggleBlockSpotlight( clientId, false );\n\t\t\t\tselectNote( undefined );\n\t\t\t} }\n\t\t>\n\t\t\t<NoteCard>\n\t\t\t\t<NoteForm\n\t\t\t\t\tonSubmit={ async ( inputComment ) => {\n\t\t\t\t\t\tconst { id } = await onSubmit( {\n\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tselectNote( id );\n\t\t\t\t\t\tfocusNoteThread( id, sidebarRef.current );\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ unselectNote }\n\t\t\t\t\tlabels={ { input: __( 'New note' ) } }\n\t\t\t\t/>\n\t\t\t</NoteCard>\n\t\t</FloatingContainer>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AACvC,0BAGO;AAKP,uBAAyB;AACzB,uBAAyB;AACzB,gCAAkC;AAClC,mBAAgC;AAChC,mBAAqC;AACrC,yBAAuB;AAqDnB;AAnDJ,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,QAAS,EAAE,UAAU,YAAY,SAAS,GAAI;AAC7D,QAAM,EAAE,SAAS,QAAI,uBAAW,CAAE,WAAY;AAC7C,UAAM,EAAE,yBAAyB,IAAI,OAAQ,oBAAAC,KAAiB;AAC9D,WAAO;AAAA,MACN,UAAU,yBAAyB;AAAA,IACpC;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,mBAAe;AAAA,IACpB,CAAE,eAAY,2BAAQ,OAAQ,aAAAC,KAAY,CAAE,EAAE,gBAAgB;AAAA,IAC9D,CAAC;AAAA,EACF;AACA,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,oBAAAD,KAAiB,CAAE;AACzE,QAAM,EAAE,WAAW,QAAI,+BAAQ,yBAAa,aAAAC,KAAY,CAAE;AAE1D,QAAM,eAAe,MAAM;AAC1B,eAAY,MAAU;AACtB,kBAAc,MAAM;AACpB,yBAAsB,UAAU,KAAM;AAAA,EACvC;AAEA,MAAK,iBAAiB,SAAS,CAAE,UAAW;AAC3C,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAU;AAAA,MACV,KAAI;AAAA,MACJ,UAAW;AAAA,MACX,kBAAa,gBAAI,UAAW;AAAA,MAC5B,MAAK;AAAA,MACL,OACC,WAAW,EAAE,SAAS,CAAE,SAAS,IAAI,IAAI,OAAU,IAAI;AAAA,MAExD,QAAS,CAAE,UAAW;AAErB,YAAK,CAAE,SAAS,SAAS,GAAI;AAC5B;AAAA,QACD;AACA,YAAK,MAAM,cAAc,SAAU,MAAM,aAAc,GAAI;AAC1D;AAAA,QACD;AACA,6BAAsB,UAAU,KAAM;AACtC,mBAAY,MAAU;AAAA,MACvB;AAAA,MAEA,sDAAC,6BACA;AAAA,QAAC;AAAA;AAAA,UACA,UAAW,OAAQ,iBAAkB;AACpC,kBAAM,EAAE,GAAG,IAAI,MAAM,SAAU;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AACF,uBAAY,EAAG;AACf,8CAAiB,IAAI,WAAW,OAAQ;AAAA,UACzC;AAAA,UACA,UAAW;AAAA,UACX,QAAS,EAAE,WAAO,gBAAI,UAAW,EAAE;AAAA;AAAA,MACpC,GACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": ["blockEditorPrivateApis", "blockEditorStore", "editorStore"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/board-store.js"],
|
|
4
|
-
"sourcesContent": ["export function createBoardStore() {\n\tconst listeners = new Set();\n\tconst blockRefs = new Map();\n\tconst floatingRefs = new Map();\n\tconst idByElement = new WeakMap();\n\tconst heights = {};\n\tlet snapshot = {};\n\n\tfunction emit() {\n\t\tsnapshot = { ...heights };\n\t\tfor ( const listener of listeners ) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\tconst observer = new window.ResizeObserver( ( entries ) => {\n\t\tlet changed = false;\n\t\tfor ( const entry of entries ) {\n\t\t\tconst id = idByElement.get( entry.target );\n\t\t\tconst newHeight = entry.borderBoxSize[ 0 ].blockSize;\n\t\t\tif ( heights[ id ] !== newHeight ) {\n\t\t\t\theights[ id ] = newHeight;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\t\tif ( changed ) {\n\t\t\temit();\n\t\t}\n\t} );\n\n\treturn {\n\t\tsubscribe( listener ) {\n\t\t\tlisteners.add( listener );\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete( listener );\n\t\t\t\tif ( listeners.size === 0 ) {\n\t\t\t\t\tobserver.disconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\n\t\tgetSnapshot() {\n\t\t\treturn snapshot;\n\t\t},\n\n\t\tregisterThread( id, blockEl, floatingEl ) {\n\t\t\tblockRefs.set( id, blockEl );\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,mBAAmB;AAClC,QAAM,YAAY,oBAAI,IAAI;AAC1B,QAAM,YAAY,oBAAI,IAAI;AAC1B,QAAM,eAAe,oBAAI,IAAI;AAC7B,QAAM,cAAc,oBAAI,QAAQ;AAChC,QAAM,UAAU,CAAC;AACjB,MAAI,WAAW,CAAC;AAEhB,WAAS,OAAO;AACf,eAAW,EAAE,GAAG,QAAQ;AACxB,eAAY,YAAY,WAAY;AACnC,eAAS;AAAA,IACV;AAAA,EACD;AAEA,QAAM,WAAW,IAAI,OAAO,eAAgB,CAAE,YAAa;AAC1D,QAAI,UAAU;AACd,eAAY,SAAS,SAAU;AAC9B,YAAM,KAAK,YAAY,IAAK,MAAM,MAAO;AACzC,YAAM,YAAY,MAAM,cAAe,CAAE,EAAE;AAC3C,UAAK,QAAS,EAAG,MAAM,WAAY;AAClC,gBAAS,EAAG,IAAI;AAChB,kBAAU;AAAA,MACX;AAAA,IACD;AACA,QAAK,SAAU;AACd,WAAK;AAAA,IACN;AAAA,EACD,CAAE;AAEF,SAAO;AAAA,IACN,UAAW,UAAW;AACrB,gBAAU,IAAK,QAAS;AACxB,aAAO,MAAM;AACZ,kBAAU,OAAQ,QAAS;AAC3B,YAAK,UAAU,SAAS,GAAI;AAC3B,mBAAS,WAAW;AAAA,QACrB;AAAA,MACD;AAAA,IACD;AAAA,IAEA,cAAc;AACb,aAAO;AAAA,IACR;AAAA,IAEA,eAAgB,IAAI,SAAS,YAAa;AACzC,gBAAU,IAAK,IAAI,OAAQ;
|
|
4
|
+
"sourcesContent": ["export function createBoardStore() {\n\tconst listeners = new Set();\n\tconst blockRefs = new Map();\n\tconst floatingRefs = new Map();\n\tconst idByElement = new WeakMap();\n\tconst heights = {};\n\tlet snapshot = {};\n\n\tfunction emit() {\n\t\tsnapshot = { ...heights };\n\t\tfor ( const listener of listeners ) {\n\t\t\tlistener();\n\t\t}\n\t}\n\n\tconst observer = new window.ResizeObserver( ( entries ) => {\n\t\tlet changed = false;\n\t\tfor ( const entry of entries ) {\n\t\t\tconst id = idByElement.get( entry.target );\n\t\t\tconst newHeight = entry.borderBoxSize[ 0 ].blockSize;\n\t\t\tif ( heights[ id ] !== newHeight ) {\n\t\t\t\theights[ id ] = newHeight;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t}\n\t\tif ( changed ) {\n\t\t\temit();\n\t\t}\n\t} );\n\n\treturn {\n\t\tsubscribe( listener ) {\n\t\t\tlisteners.add( listener );\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete( listener );\n\t\t\t\tif ( listeners.size === 0 ) {\n\t\t\t\t\tobserver.disconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\n\t\tgetSnapshot() {\n\t\t\treturn snapshot;\n\t\t},\n\n\t\tregisterThread( id, blockEl, floatingEl ) {\n\t\t\tblockRefs.set( id, blockEl );\n\t\t\tconst prev = floatingRefs.get( id );\n\t\t\tif ( prev && prev !== floatingEl ) {\n\t\t\t\tobserver.unobserve( prev );\n\t\t\t\tidByElement.delete( prev );\n\t\t\t}\n\t\t\tif ( floatingEl ) {\n\t\t\t\tfloatingRefs.set( id, floatingEl );\n\t\t\t\tidByElement.set( floatingEl, id );\n\t\t\t\tobserver.observe( floatingEl );\n\t\t\t}\n\t\t\temit();\n\t\t},\n\n\t\tunregisterThread( id ) {\n\t\t\tblockRefs.delete( id );\n\t\t\tconst prev = floatingRefs.get( id );\n\t\t\tif ( prev ) {\n\t\t\t\tobserver.unobserve( prev );\n\t\t\t\tidByElement.delete( prev );\n\t\t\t\tfloatingRefs.delete( id );\n\t\t\t}\n\t\t\tdelete heights[ id ];\n\t\t},\n\n\t\tgetBlockRects() {\n\t\t\t// Batch all rect reads before any writes to avoid layout thrashing.\n\t\t\treturn Object.fromEntries(\n\t\t\t\tArray.from( blockRefs ).flatMap( ( [ id, el ] ) =>\n\t\t\t\t\tel ? [ [ id, el.getBoundingClientRect() ] ] : []\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\n\t\tgetFirstBlockElement() {\n\t\t\treturn blockRefs.values().next().value ?? null;\n\t\t},\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,SAAS,mBAAmB;AAClC,QAAM,YAAY,oBAAI,IAAI;AAC1B,QAAM,YAAY,oBAAI,IAAI;AAC1B,QAAM,eAAe,oBAAI,IAAI;AAC7B,QAAM,cAAc,oBAAI,QAAQ;AAChC,QAAM,UAAU,CAAC;AACjB,MAAI,WAAW,CAAC;AAEhB,WAAS,OAAO;AACf,eAAW,EAAE,GAAG,QAAQ;AACxB,eAAY,YAAY,WAAY;AACnC,eAAS;AAAA,IACV;AAAA,EACD;AAEA,QAAM,WAAW,IAAI,OAAO,eAAgB,CAAE,YAAa;AAC1D,QAAI,UAAU;AACd,eAAY,SAAS,SAAU;AAC9B,YAAM,KAAK,YAAY,IAAK,MAAM,MAAO;AACzC,YAAM,YAAY,MAAM,cAAe,CAAE,EAAE;AAC3C,UAAK,QAAS,EAAG,MAAM,WAAY;AAClC,gBAAS,EAAG,IAAI;AAChB,kBAAU;AAAA,MACX;AAAA,IACD;AACA,QAAK,SAAU;AACd,WAAK;AAAA,IACN;AAAA,EACD,CAAE;AAEF,SAAO;AAAA,IACN,UAAW,UAAW;AACrB,gBAAU,IAAK,QAAS;AACxB,aAAO,MAAM;AACZ,kBAAU,OAAQ,QAAS;AAC3B,YAAK,UAAU,SAAS,GAAI;AAC3B,mBAAS,WAAW;AAAA,QACrB;AAAA,MACD;AAAA,IACD;AAAA,IAEA,cAAc;AACb,aAAO;AAAA,IACR;AAAA,IAEA,eAAgB,IAAI,SAAS,YAAa;AACzC,gBAAU,IAAK,IAAI,OAAQ;AAC3B,YAAM,OAAO,aAAa,IAAK,EAAG;AAClC,UAAK,QAAQ,SAAS,YAAa;AAClC,iBAAS,UAAW,IAAK;AACzB,oBAAY,OAAQ,IAAK;AAAA,MAC1B;AACA,UAAK,YAAa;AACjB,qBAAa,IAAK,IAAI,UAAW;AACjC,oBAAY,IAAK,YAAY,EAAG;AAChC,iBAAS,QAAS,UAAW;AAAA,MAC9B;AACA,WAAK;AAAA,IACN;AAAA,IAEA,iBAAkB,IAAK;AACtB,gBAAU,OAAQ,EAAG;AACrB,YAAM,OAAO,aAAa,IAAK,EAAG;AAClC,UAAK,MAAO;AACX,iBAAS,UAAW,IAAK;AACzB,oBAAY,OAAQ,IAAK;AACzB,qBAAa,OAAQ,EAAG;AAAA,MACzB;AACA,aAAO,QAAS,EAAG;AAAA,IACpB;AAAA,IAEA,gBAAgB;AAEf,aAAO,OAAO;AAAA,QACb,MAAM,KAAM,SAAU,EAAE;AAAA,UAAS,CAAE,CAAE,IAAI,EAAG,MAC3C,KAAK,CAAE,CAAE,IAAI,GAAG,sBAAsB,CAAE,CAAE,IAAI,CAAC;AAAA,QAChD;AAAA,MACD;AAAA,IACD;AAAA,IAEA,uBAAuB;AACtB,aAAO,UAAU,OAAO,EAAE,KAAK,EAAE,SAAS;AAAA,IAC3C;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ __export(floating_container_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(floating_container_exports);
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var
|
|
37
|
+
var import_ui = require("@wordpress/ui");
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
39
|
function FloatingContainer({
|
|
40
40
|
floating,
|
|
@@ -45,10 +45,11 @@ function FloatingContainer({
|
|
|
45
45
|
}) {
|
|
46
46
|
const isFloating = !!floating;
|
|
47
47
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
-
|
|
48
|
+
import_ui.Stack,
|
|
49
49
|
{
|
|
50
|
+
direction: "column",
|
|
50
51
|
className: (0, import_clsx.default)(className, { "is-floating": isFloating }),
|
|
51
|
-
ref: isFloating ? floating.
|
|
52
|
+
ref: isFloating ? floating.ref : void 0,
|
|
52
53
|
style: isFloating ? { top: floating.y, ...style } : style,
|
|
53
54
|
...props,
|
|
54
55
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,
|
|
6
|
-
"names": ["
|
|
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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,gBAAsB;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,eAAY,YAAAA,SAAM,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
|
+
"names": ["clsx"]
|
|
7
7
|
}
|
|
@@ -20,20 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// packages/editor/src/components/collab-sidebar/hooks.js
|
|
21
21
|
var hooks_exports = {};
|
|
22
22
|
__export(hooks_exports, {
|
|
23
|
-
useBlockComments: () => useBlockComments,
|
|
24
|
-
useBlockCommentsActions: () => useBlockCommentsActions,
|
|
25
23
|
useEnableFloatingSidebar: () => useEnableFloatingSidebar,
|
|
26
24
|
useFloatingBoard: () => useFloatingBoard,
|
|
27
|
-
|
|
25
|
+
useNoteActions: () => useNoteActions,
|
|
26
|
+
useNoteThreads: () => useNoteThreads
|
|
28
27
|
});
|
|
29
28
|
module.exports = __toCommonJS(hooks_exports);
|
|
30
|
-
var import_react_dom = require("@floating-ui/react-dom");
|
|
31
29
|
var import_i18n = require("@wordpress/i18n");
|
|
32
30
|
var import_element = require("@wordpress/element");
|
|
33
31
|
var import_core_data = require("@wordpress/core-data");
|
|
34
32
|
var import_data = require("@wordpress/data");
|
|
35
33
|
var import_block_editor = require("@wordpress/block-editor");
|
|
36
34
|
var import_notices = require("@wordpress/notices");
|
|
35
|
+
var import_dom = require("@wordpress/dom");
|
|
37
36
|
var import_html_entities = require("@wordpress/html-entities");
|
|
38
37
|
var import_interface = require("@wordpress/interface");
|
|
39
38
|
var import_store = require("../../store/index.cjs");
|
|
@@ -41,8 +40,8 @@ var import_constants = require("./constants.cjs");
|
|
|
41
40
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
42
41
|
var import_board_store = require("./board-store.cjs");
|
|
43
42
|
var import_utils = require("./utils.cjs");
|
|
44
|
-
var {
|
|
45
|
-
function
|
|
43
|
+
var { cleanEmptyObject } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
44
|
+
function useNoteThreads(postId) {
|
|
46
45
|
const queryArgs = {
|
|
47
46
|
post: postId,
|
|
48
47
|
type: "note",
|
|
@@ -62,78 +61,68 @@ function useBlockComments(postId) {
|
|
|
62
61
|
clientIds: getClientIdsWithDescendants()
|
|
63
62
|
};
|
|
64
63
|
}, []);
|
|
65
|
-
const {
|
|
64
|
+
const { notes, unresolvedNotes } = (0, import_element.useMemo)(() => {
|
|
66
65
|
if (!threads || threads.length === 0) {
|
|
67
|
-
return {
|
|
66
|
+
return { notes: [], unresolvedNotes: [] };
|
|
68
67
|
}
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const blocksWithNotes = {};
|
|
69
|
+
const clientIdByNoteId = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const clientId of clientIds) {
|
|
71
|
+
const noteId = getBlockAttributes(clientId)?.metadata?.noteId;
|
|
72
|
+
if (noteId) {
|
|
73
|
+
const key = String(noteId);
|
|
74
|
+
blocksWithNotes[clientId] = key;
|
|
75
|
+
clientIdByNoteId.set(key, clientId);
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
blocksWithComments
|
|
80
|
-
).reduce((mapping, clientId) => {
|
|
81
|
-
mapping[blocksWithComments[clientId]] = clientId;
|
|
82
|
-
return mapping;
|
|
83
|
-
}, {});
|
|
84
|
-
threads.forEach((item) => {
|
|
85
|
-
const itemBlock = commentIdToBlockClientId[item.id];
|
|
86
|
-
compare[item.id] = {
|
|
77
|
+
}
|
|
78
|
+
const threadsById = /* @__PURE__ */ new Map();
|
|
79
|
+
const rootThreads = [];
|
|
80
|
+
for (const item of threads) {
|
|
81
|
+
const thread = {
|
|
87
82
|
...item,
|
|
88
83
|
reply: [],
|
|
89
|
-
blockClientId: item.parent === 0 ?
|
|
84
|
+
blockClientId: item.parent === 0 ? clientIdByNoteId.get(String(item.id)) ?? null : null
|
|
90
85
|
};
|
|
91
|
-
|
|
92
|
-
threads.forEach((item) => {
|
|
86
|
+
threadsById.set(item.id, thread);
|
|
93
87
|
if (item.parent === 0) {
|
|
94
|
-
|
|
95
|
-
} else if (compare[item.parent]) {
|
|
96
|
-
compare[item.parent].reply.push(compare[item.id]);
|
|
88
|
+
rootThreads.push(thread);
|
|
97
89
|
}
|
|
98
|
-
});
|
|
99
|
-
if (0 === result?.length) {
|
|
100
|
-
return { resultComments: [], unresolvedSortedThreads: [] };
|
|
101
90
|
}
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
91
|
+
for (const item of threads) {
|
|
92
|
+
if (item.parent !== 0) {
|
|
93
|
+
threadsById.get(item.parent)?.reply.unshift(threadsById.get(item.id));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (rootThreads.length === 0) {
|
|
97
|
+
return { notes: [], unresolvedNotes: [] };
|
|
98
|
+
}
|
|
99
|
+
const unresolved = [];
|
|
100
|
+
const resolved = [];
|
|
101
|
+
for (const noteId of Object.values(blocksWithNotes)) {
|
|
102
|
+
const thread = threadsById.get(Number(noteId)) ?? threadsById.get(noteId);
|
|
103
|
+
if (!thread) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (thread.status === "hold") {
|
|
107
|
+
unresolved.push(thread);
|
|
108
|
+
} else if (thread.status === "approved") {
|
|
109
|
+
resolved.push(thread);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const orphans = rootThreads.filter(
|
|
113
|
+
(thread) => !thread.blockClientId
|
|
120
114
|
);
|
|
121
|
-
const allSortedComments = [
|
|
122
|
-
...unresolvedSortedComments,
|
|
123
|
-
...resolvedSortedComments,
|
|
124
|
-
...orphanedComments
|
|
125
|
-
];
|
|
126
115
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
notes: [...unresolved, ...resolved, ...orphans],
|
|
117
|
+
unresolvedNotes: unresolved
|
|
129
118
|
};
|
|
130
119
|
}, [clientIds, threads, getBlockAttributes]);
|
|
131
120
|
return {
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
notes,
|
|
122
|
+
unresolvedNotes
|
|
134
123
|
};
|
|
135
124
|
}
|
|
136
|
-
function
|
|
125
|
+
function useNoteActions() {
|
|
137
126
|
const { createNotice } = (0, import_data.useDispatch)(import_notices.store);
|
|
138
127
|
const { saveEntityRecord, deleteEntityRecord } = (0, import_data.useDispatch)(import_core_data.store);
|
|
139
128
|
const { getCurrentPostId } = (0, import_data.useSelect)(import_store.store);
|
|
@@ -203,7 +192,7 @@ function useBlockCommentsActions() {
|
|
|
203
192
|
throwOnError: true
|
|
204
193
|
}
|
|
205
194
|
);
|
|
206
|
-
const
|
|
195
|
+
const newNoteData = {
|
|
207
196
|
post: getCurrentPostId(),
|
|
208
197
|
content: content || "",
|
|
209
198
|
// Empty content for resolve, content for reopen.
|
|
@@ -214,7 +203,7 @@ function useBlockCommentsActions() {
|
|
|
214
203
|
_wp_note_status: status === "approved" ? "resolved" : "reopen"
|
|
215
204
|
}
|
|
216
205
|
};
|
|
217
|
-
await saveEntityRecord("root", "comment",
|
|
206
|
+
await saveEntityRecord("root", "comment", newNoteData, {
|
|
218
207
|
throwOnError: true
|
|
219
208
|
});
|
|
220
209
|
} else {
|
|
@@ -239,18 +228,12 @@ function useBlockCommentsActions() {
|
|
|
239
228
|
onError(error);
|
|
240
229
|
}
|
|
241
230
|
};
|
|
242
|
-
const onDelete = async (
|
|
231
|
+
const onDelete = async (note) => {
|
|
243
232
|
try {
|
|
244
|
-
await deleteEntityRecord(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
void 0,
|
|
249
|
-
{
|
|
250
|
-
throwOnError: true
|
|
251
|
-
}
|
|
252
|
-
);
|
|
253
|
-
if (!comment.parent) {
|
|
233
|
+
await deleteEntityRecord("root", "comment", note.id, void 0, {
|
|
234
|
+
throwOnError: true
|
|
235
|
+
});
|
|
236
|
+
if (!note.parent) {
|
|
254
237
|
const clientId = getSelectedBlockClientId();
|
|
255
238
|
const metadata = getBlockAttributes(clientId)?.metadata;
|
|
256
239
|
updateBlockAttributes(clientId, {
|
|
@@ -291,85 +274,59 @@ function useEnableFloatingSidebar(enabled = false) {
|
|
|
291
274
|
};
|
|
292
275
|
}, [enabled, registry]);
|
|
293
276
|
}
|
|
294
|
-
function useFloatingBoard({
|
|
295
|
-
|
|
277
|
+
function useFloatingBoard({
|
|
278
|
+
threads,
|
|
279
|
+
selectedNoteId,
|
|
280
|
+
isFloating,
|
|
281
|
+
sidebarRef
|
|
282
|
+
}) {
|
|
283
|
+
const [notePositions, setNotePositions] = (0, import_element.useState)({});
|
|
296
284
|
const [store] = (0, import_element.useState)(import_board_store.createBoardStore);
|
|
297
|
-
const { setCanvasMinHeight } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
|
|
298
285
|
const heights = (0, import_element.useSyncExternalStore)(store.subscribe, store.getSnapshot);
|
|
299
286
|
(0, import_element.useEffect)(() => {
|
|
300
|
-
if (!isFloating) {
|
|
287
|
+
if (!isFloating || !sidebarRef?.current) {
|
|
301
288
|
return;
|
|
302
289
|
}
|
|
290
|
+
const panel = sidebarRef.current;
|
|
291
|
+
const blockEl = store.getFirstBlockElement();
|
|
292
|
+
const rootEl = blockEl?.closest(".is-root-container") ?? blockEl;
|
|
293
|
+
const canvas = rootEl ? (0, import_dom.getScrollContainer)(rootEl) : null;
|
|
294
|
+
const applyScroll = () => {
|
|
295
|
+
panel.style.setProperty(
|
|
296
|
+
"--canvas-scroll",
|
|
297
|
+
`${-(canvas?.scrollTop ?? 0)}px`
|
|
298
|
+
);
|
|
299
|
+
};
|
|
303
300
|
const rafId = window.requestAnimationFrame(() => {
|
|
304
|
-
const
|
|
301
|
+
const result = (0, import_utils.calculateNotePositions)({
|
|
305
302
|
threads,
|
|
306
303
|
selectedNoteId,
|
|
307
304
|
blockRects: store.getBlockRects(),
|
|
308
|
-
heights
|
|
305
|
+
heights,
|
|
306
|
+
scrollTop: canvas?.scrollTop ?? 0
|
|
309
307
|
});
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
setNotePositions(result.positions);
|
|
309
|
+
applyScroll();
|
|
312
310
|
});
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
]);
|
|
311
|
+
const view = canvas?.ownerDocument?.defaultView;
|
|
312
|
+
const listenerOptions = { passive: true, capture: true };
|
|
313
|
+
view?.addEventListener("scroll", applyScroll, listenerOptions);
|
|
314
|
+
return () => {
|
|
315
|
+
window.cancelAnimationFrame(rafId);
|
|
316
|
+
view?.removeEventListener("scroll", applyScroll, listenerOptions);
|
|
317
|
+
};
|
|
318
|
+
}, [sidebarRef, heights, isFloating, selectedNoteId, store, threads]);
|
|
322
319
|
return {
|
|
323
|
-
|
|
320
|
+
notePositions,
|
|
324
321
|
registerThread: store.registerThread,
|
|
325
322
|
unregisterThread: store.unregisterThread
|
|
326
323
|
};
|
|
327
324
|
}
|
|
328
|
-
function useFloatingThread({
|
|
329
|
-
thread,
|
|
330
|
-
calculatedOffset,
|
|
331
|
-
registerThread,
|
|
332
|
-
unregisterThread
|
|
333
|
-
}) {
|
|
334
|
-
const blockElement = useBlockElement(thread.blockClientId);
|
|
335
|
-
const { y, refs } = (0, import_react_dom.useFloating)({
|
|
336
|
-
placement: "right-start",
|
|
337
|
-
middleware: [
|
|
338
|
-
(0, import_react_dom.offset)({
|
|
339
|
-
crossAxis: calculatedOffset || -16
|
|
340
|
-
})
|
|
341
|
-
],
|
|
342
|
-
whileElementsMounted: import_react_dom.autoUpdate
|
|
343
|
-
});
|
|
344
|
-
(0, import_element.useEffect)(() => {
|
|
345
|
-
if (blockElement) {
|
|
346
|
-
refs.setReference(blockElement);
|
|
347
|
-
}
|
|
348
|
-
}, [blockElement, refs]);
|
|
349
|
-
(0, import_element.useEffect)(() => {
|
|
350
|
-
const floatingEl = refs.floating?.current;
|
|
351
|
-
if (floatingEl && registerThread) {
|
|
352
|
-
registerThread(thread.id, blockElement, floatingEl);
|
|
353
|
-
}
|
|
354
|
-
return () => unregisterThread?.(thread.id);
|
|
355
|
-
}, [
|
|
356
|
-
blockElement,
|
|
357
|
-
thread.id,
|
|
358
|
-
refs.floating,
|
|
359
|
-
registerThread,
|
|
360
|
-
unregisterThread
|
|
361
|
-
]);
|
|
362
|
-
return {
|
|
363
|
-
y,
|
|
364
|
-
refs
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
325
|
// Annotate the CommonJS export names for ESM import in node:
|
|
368
326
|
0 && (module.exports = {
|
|
369
|
-
useBlockComments,
|
|
370
|
-
useBlockCommentsActions,
|
|
371
327
|
useEnableFloatingSidebar,
|
|
372
328
|
useFloatingBoard,
|
|
373
|
-
|
|
329
|
+
useNoteActions,
|
|
330
|
+
useNoteThreads
|
|
374
331
|
});
|
|
375
332
|
//# sourceMappingURL=hooks.cjs.map
|