@wordpress/editor 14.44.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-note.cjs +100 -0
- package/build/components/collab-sidebar/add-note.cjs.map +7 -0
- package/build/components/collab-sidebar/board-store.cjs +106 -0
- package/build/components/collab-sidebar/board-store.cjs.map +7 -0
- package/build/components/collab-sidebar/floating-container.cjs +63 -0
- package/build/components/collab-sidebar/floating-container.cjs.map +7 -0
- package/build/components/collab-sidebar/hooks.cjs +105 -140
- package/build/components/collab-sidebar/hooks.cjs.map +3 -3
- package/build/components/collab-sidebar/index.cjs +28 -90
- 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} +46 -45
- 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 +80 -14
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-presence/avatar/component.cjs.map +1 -1
- package/build/components/collaborators-presence/index.cjs +3 -3
- package/build/components/collaborators-presence/index.cjs.map +2 -2
- package/build/components/collaborators-presence/list.cjs +3 -3
- package/build/components/collaborators-presence/list.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/media-categories/index.cjs +1 -1
- package/build/components/media-categories/index.cjs.map +1 -1
- package/build/components/more-menu/index.cjs +4 -3
- 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/maybe-upload-media.cjs +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.cjs.map +1 -1
- 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/style-book/constants.cjs +1 -1
- package/build/components/style-book/constants.cjs.map +1 -1
- package/build/components/style-book/index.cjs +1 -1
- package/build/components/style-book/index.cjs.map +1 -1
- 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-note.mjs +78 -0
- package/build-module/components/collab-sidebar/add-note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/board-store.mjs +81 -0
- package/build-module/components/collab-sidebar/board-store.mjs.map +7 -0
- package/build-module/components/collab-sidebar/floating-container.mjs +28 -0
- package/build-module/components/collab-sidebar/floating-container.mjs.map +7 -0
- package/build-module/components/collab-sidebar/hooks.mjs +105 -144
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +29 -95
- 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 +76 -10
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +1 -1
- package/build-module/components/collaborators-presence/index.mjs +3 -3
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +3 -3
- package/build-module/components/collaborators-presence/list.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/media-categories/index.mjs +1 -1
- package/build-module/components/media-categories/index.mjs.map +1 -1
- package/build-module/components/more-menu/index.mjs +4 -8
- 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/maybe-upload-media.mjs +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs.map +1 -1
- 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/style-book/constants.mjs +1 -1
- package/build-module/components/style-book/constants.mjs.map +1 -1
- package/build-module/components/style-book/index.mjs +1 -1
- package/build-module/components/style-book/index.mjs.map +1 -1
- 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 +397 -171
- package/build-style/style.css +397 -171
- 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 +9 -0
- package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/hooks.d.ts +13 -22
- 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 +41 -17
- 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/style-book/constants.d.ts +1 -1
- package/build-types/components/style-book/constants.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} +26 -49
- package/src/components/collab-sidebar/board-store.js +85 -0
- package/src/components/collab-sidebar/floating-container.js +30 -0
- package/src/components/collab-sidebar/hooks.js +130 -178
- package/src/components/collab-sidebar/index.js +35 -106
- 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} +29 -40
- 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 +155 -0
- package/src/components/collab-sidebar/utils.js +125 -19
- package/src/components/collaborators-presence/avatar/component.tsx +1 -1
- package/src/components/collaborators-presence/styles/collaborators-list.scss +1 -1
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +1 -1
- package/src/components/document-bar/index.js +4 -4
- package/src/components/document-outline/style.scss +1 -1
- 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/media-categories/index.js +1 -1
- package/src/components/more-menu/index.js +4 -8
- 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/maybe-upload-media.js +1 -1
- package/src/components/post-publish-panel/postpublish.js +2 -2
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +10 -16
- 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-revisions-preview/style.scss +1 -1
- 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/style-book/constants.ts +1 -1
- package/src/components/style-book/index.js +1 -1
- package/src/components/template-actions-panel/classic-theme-content.js +3 -3
- package/src/components/template-actions-panel/style.scss +1 -1
- 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 +0 -129
- 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 -816
- package/build/components/collab-sidebar/comments.cjs.map +0 -7
- package/build-module/components/collab-sidebar/add-comment.mjs +0 -100
- 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 -90
- 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 -799
- package/build-module/components/collab-sidebar/comments.mjs.map +0 -7
- package/build-types/components/collab-sidebar/add-comment.d.ts +0 -10
- 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 -11
- 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 -12
- package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
- package/src/components/collab-sidebar/comments.js +0 -985
|
@@ -11,7 +11,7 @@ import { BlockPreview } from '@wordpress/block-editor';
|
|
|
11
11
|
import {
|
|
12
12
|
PanelBody,
|
|
13
13
|
Button,
|
|
14
|
-
__experimentalText as
|
|
14
|
+
__experimentalText as WCText,
|
|
15
15
|
__experimentalHStack as HStack,
|
|
16
16
|
__experimentalVStack as VStack,
|
|
17
17
|
} from '@wordpress/components';
|
|
@@ -117,11 +117,11 @@ export default function ClassicThemeContent() {
|
|
|
117
117
|
>
|
|
118
118
|
<VStack>
|
|
119
119
|
{ ! templateId && (
|
|
120
|
-
<
|
|
120
|
+
<WCText>
|
|
121
121
|
{ __(
|
|
122
122
|
'This page uses a classic template. To edit this template with blocks, create a block template.'
|
|
123
123
|
) }
|
|
124
|
-
</
|
|
124
|
+
</WCText>
|
|
125
125
|
) }
|
|
126
126
|
{ template && previewContent && (
|
|
127
127
|
<div className="editor-template-actions-panel__preview">
|
|
@@ -3,15 +3,46 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import {
|
|
8
|
+
MenuItem,
|
|
9
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
8
14
|
|
|
9
15
|
export default function ConvertToRegularBlocks( { clientId, onClose } ) {
|
|
16
|
+
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
17
|
+
|
|
10
18
|
const { getBlocks } = useSelect( blockEditorStore );
|
|
11
19
|
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
12
20
|
|
|
13
|
-
const canRemove = useSelect(
|
|
14
|
-
( select ) =>
|
|
21
|
+
const { canRemove, templatePartTitle } = useSelect(
|
|
22
|
+
( select ) => {
|
|
23
|
+
const { canRemoveBlock, getBlock } = select( blockEditorStore );
|
|
24
|
+
const { getEntityRecord, getCurrentTheme } = select( coreStore );
|
|
25
|
+
|
|
26
|
+
const block = getBlock( clientId );
|
|
27
|
+
const { slug, theme } = block?.attributes ?? {};
|
|
28
|
+
const themeSlug = theme || getCurrentTheme()?.stylesheet;
|
|
29
|
+
const templatePartId =
|
|
30
|
+
themeSlug && slug ? `${ themeSlug }//${ slug }` : null;
|
|
31
|
+
const entity = templatePartId
|
|
32
|
+
? getEntityRecord(
|
|
33
|
+
'postType',
|
|
34
|
+
'wp_template_part',
|
|
35
|
+
templatePartId
|
|
36
|
+
)
|
|
37
|
+
: null;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
canRemove: canRemoveBlock( clientId ),
|
|
41
|
+
templatePartTitle: entity?.title?.rendered
|
|
42
|
+
? decodeEntities( entity.title.rendered )
|
|
43
|
+
: null,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
15
46
|
[ clientId ]
|
|
16
47
|
);
|
|
17
48
|
|
|
@@ -19,14 +50,45 @@ export default function ConvertToRegularBlocks( { clientId, onClose } ) {
|
|
|
19
50
|
return null;
|
|
20
51
|
}
|
|
21
52
|
|
|
53
|
+
const title = templatePartTitle
|
|
54
|
+
? sprintf(
|
|
55
|
+
/* translators: %s: template part title, e.g. "Header" */
|
|
56
|
+
__( 'Detach %s?' ),
|
|
57
|
+
templatePartTitle
|
|
58
|
+
)
|
|
59
|
+
: __( 'Detach template part?' );
|
|
60
|
+
|
|
61
|
+
const message = templatePartTitle
|
|
62
|
+
? sprintf(
|
|
63
|
+
/* translators: %s: template part title, e.g. "Header" */
|
|
64
|
+
__(
|
|
65
|
+
'The blocks will be separated from the original template part and will be fully editable. Future changes to the %s template part will not apply here.'
|
|
66
|
+
),
|
|
67
|
+
templatePartTitle
|
|
68
|
+
)
|
|
69
|
+
: __(
|
|
70
|
+
'The blocks will be separated from the original template part and will be fully editable. Future changes to the template part will not apply here.'
|
|
71
|
+
);
|
|
72
|
+
|
|
22
73
|
return (
|
|
23
|
-
|
|
24
|
-
onClick={ () =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
74
|
+
<>
|
|
75
|
+
<MenuItem onClick={ () => setShowConfirmDialog( true ) }>
|
|
76
|
+
{ __( 'Detach' ) }
|
|
77
|
+
</MenuItem>
|
|
78
|
+
<ConfirmDialog
|
|
79
|
+
isOpen={ showConfirmDialog }
|
|
80
|
+
onConfirm={ () => {
|
|
81
|
+
replaceBlocks( clientId, getBlocks( clientId ) );
|
|
82
|
+
onClose();
|
|
83
|
+
} }
|
|
84
|
+
onCancel={ () => setShowConfirmDialog( false ) }
|
|
85
|
+
confirmButtonText={ __( 'Detach' ) }
|
|
86
|
+
size="medium"
|
|
87
|
+
title={ title }
|
|
88
|
+
__experimentalHideHeader={ false }
|
|
89
|
+
>
|
|
90
|
+
{ message }
|
|
91
|
+
</ConfirmDialog>
|
|
92
|
+
</>
|
|
31
93
|
);
|
|
32
94
|
}
|
|
@@ -112,7 +112,6 @@ function VisualEditor( {
|
|
|
112
112
|
postType,
|
|
113
113
|
isPreview,
|
|
114
114
|
styles,
|
|
115
|
-
canvasMinHeight,
|
|
116
115
|
} = useSelect( ( select ) => {
|
|
117
116
|
const {
|
|
118
117
|
getCurrentPostId,
|
|
@@ -121,7 +120,6 @@ function VisualEditor( {
|
|
|
121
120
|
getEditorSettings,
|
|
122
121
|
getRenderingMode,
|
|
123
122
|
getDeviceType,
|
|
124
|
-
getCanvasMinHeight,
|
|
125
123
|
} = unlock( select( editorStore ) );
|
|
126
124
|
const { getPostType, getEditedEntityRecord } = select( coreStore );
|
|
127
125
|
const postTypeSlug = getCurrentPostType();
|
|
@@ -163,7 +161,6 @@ function VisualEditor( {
|
|
|
163
161
|
postType: postTypeSlug,
|
|
164
162
|
isPreview: editorSettings.isPreviewMode,
|
|
165
163
|
styles: editorSettings.styles,
|
|
166
|
-
canvasMinHeight: getCanvasMinHeight(),
|
|
167
164
|
};
|
|
168
165
|
}, [] );
|
|
169
166
|
const { isCleanNewPost } = useSelect( editorStore );
|
|
@@ -336,20 +333,6 @@ function VisualEditor( {
|
|
|
336
333
|
|
|
337
334
|
const isNavigationPreview = postType === NAVIGATION_POST_TYPE && isPreview;
|
|
338
335
|
|
|
339
|
-
// Calculate the minimum height including scroll offset to fit all notes.
|
|
340
|
-
const calculatedMinHeight = useMemo( () => {
|
|
341
|
-
if ( ! localRef.current ) {
|
|
342
|
-
return canvasMinHeight;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const { ownerDocument } = localRef.current;
|
|
346
|
-
const scrollTop =
|
|
347
|
-
ownerDocument.documentElement.scrollTop ||
|
|
348
|
-
ownerDocument.body.scrollTop;
|
|
349
|
-
|
|
350
|
-
return canvasMinHeight + scrollTop;
|
|
351
|
-
}, [ canvasMinHeight ] );
|
|
352
|
-
|
|
353
336
|
const [ paddingAppenderRef, paddingStyle ] = usePaddingAppender(
|
|
354
337
|
! isPreview && renderingMode === 'post-only' && ! isDesignPostType
|
|
355
338
|
);
|
|
@@ -363,11 +346,7 @@ function VisualEditor( {
|
|
|
363
346
|
// Ensures margins of children are contained so that the body background paints behind them.
|
|
364
347
|
// Otherwise, the background of html (when zoomed out) would show there and appear broken. It's
|
|
365
348
|
// important mostly for post-only views yet conceivably an issue in templated views too.
|
|
366
|
-
css: `:where(.block-editor-iframe__body){display:flow-root;${
|
|
367
|
-
calculatedMinHeight
|
|
368
|
-
? `min-height:${ calculatedMinHeight }px;`
|
|
369
|
-
: ''
|
|
370
|
-
}}.is-root-container{display:flow-root;${
|
|
349
|
+
css: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${
|
|
371
350
|
// Some themes will have `min-height: 100vh` for the root container,
|
|
372
351
|
// which isn't a requirement in auto resize mode.
|
|
373
352
|
enableResizing || isNavigationPreview
|
|
@@ -389,13 +368,7 @@ function VisualEditor( {
|
|
|
389
368
|
// The CSS for isNavigationPreview centers the body content vertically and horizontally when the navigation is in preview mode.
|
|
390
369
|
},
|
|
391
370
|
];
|
|
392
|
-
}, [
|
|
393
|
-
styles,
|
|
394
|
-
enableResizing,
|
|
395
|
-
isNavigationPreview,
|
|
396
|
-
calculatedMinHeight,
|
|
397
|
-
paddingStyle,
|
|
398
|
-
] );
|
|
371
|
+
}, [ styles, enableResizing, isNavigationPreview, paddingStyle ] );
|
|
399
372
|
|
|
400
373
|
const typewriterRef = useTypewriter();
|
|
401
374
|
contentRef = useMergeRefs( [
|
|
@@ -575,19 +575,6 @@ export function resetStylesNavigation() {
|
|
|
575
575
|
};
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
/**
|
|
579
|
-
* Set the minimum height of the canvas.
|
|
580
|
-
*
|
|
581
|
-
* @param {number} minHeight
|
|
582
|
-
* @return {Object} Action object.
|
|
583
|
-
*/
|
|
584
|
-
export function setCanvasMinHeight( minHeight ) {
|
|
585
|
-
return {
|
|
586
|
-
type: 'SET_CANVAS_MIN_HEIGHT',
|
|
587
|
-
minHeight,
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
|
|
591
578
|
/**
|
|
592
579
|
* Set the current revision ID for revisions preview mode.
|
|
593
580
|
* Pass a revision ID to enter revisions mode, or null to exit.
|
|
@@ -336,16 +336,6 @@ export function getShowStylebook( state ) {
|
|
|
336
336
|
return state.showStylebook ?? false;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
/**
|
|
340
|
-
* Get the canvas minimum height.
|
|
341
|
-
*
|
|
342
|
-
* @param {Object} state Global application state.
|
|
343
|
-
* @return {number} The canvas minimum height.
|
|
344
|
-
*/
|
|
345
|
-
export function getCanvasMinHeight( state ) {
|
|
346
|
-
return state.canvasMinHeight;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
339
|
/**
|
|
350
340
|
* Returns whether the editor is in revisions preview mode.
|
|
351
341
|
*
|
package/src/store/reducer.js
CHANGED
|
@@ -418,21 +418,6 @@ export function showStylebook( state = false, action ) {
|
|
|
418
418
|
return state;
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
/**
|
|
422
|
-
* Reducer for the canvas minimum height.
|
|
423
|
-
*
|
|
424
|
-
* @param {number} state Current state.
|
|
425
|
-
* @param {Object} action Dispatched action.
|
|
426
|
-
* @return {number} Updated state.
|
|
427
|
-
*/
|
|
428
|
-
export function canvasMinHeight( state = 0, action ) {
|
|
429
|
-
switch ( action.type ) {
|
|
430
|
-
case 'SET_CANVAS_MIN_HEIGHT':
|
|
431
|
-
return action.minHeight;
|
|
432
|
-
}
|
|
433
|
-
return state;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
421
|
/**
|
|
437
422
|
* Reducer for the revisions preview mode.
|
|
438
423
|
* Stores the current revision ID, or null if not in revisions mode.
|
|
@@ -504,7 +489,6 @@ export default combineReducers( {
|
|
|
504
489
|
publishSidebarActive,
|
|
505
490
|
stylesPath,
|
|
506
491
|
showStylebook,
|
|
507
|
-
canvasMinHeight,
|
|
508
492
|
revisionId,
|
|
509
493
|
showRevisionDiff,
|
|
510
494
|
selectedNote,
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import apiFetch from '@wordpress/api-fetch';
|
|
5
5
|
|
|
6
|
-
export default async function mediaFinalize( id ) {
|
|
6
|
+
export default async function mediaFinalize( id, subSizes = [] ) {
|
|
7
7
|
await apiFetch( {
|
|
8
8
|
path: `/wp/v2/media/${ id }/finalize`,
|
|
9
9
|
method: 'POST',
|
|
10
|
+
data: { sub_sizes: subSizes },
|
|
10
11
|
} );
|
|
11
12
|
}
|
|
@@ -15,7 +15,30 @@ describe( 'mediaFinalize', () => {
|
|
|
15
15
|
jest.clearAllMocks();
|
|
16
16
|
} );
|
|
17
17
|
|
|
18
|
-
it( 'should call the finalize endpoint with the correct path and
|
|
18
|
+
it( 'should call the finalize endpoint with the correct path, method, and sub_sizes', async () => {
|
|
19
|
+
apiFetch.mockResolvedValue( {} );
|
|
20
|
+
|
|
21
|
+
const subSizes = [
|
|
22
|
+
{
|
|
23
|
+
image_size: 'thumbnail',
|
|
24
|
+
width: 150,
|
|
25
|
+
height: 150,
|
|
26
|
+
file: 'image-150x150.jpg',
|
|
27
|
+
mime_type: 'image/jpeg',
|
|
28
|
+
filesize: 5000,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
await mediaFinalize( 123, subSizes );
|
|
33
|
+
|
|
34
|
+
expect( apiFetch ).toHaveBeenCalledWith( {
|
|
35
|
+
path: '/wp/v2/media/123/finalize',
|
|
36
|
+
method: 'POST',
|
|
37
|
+
data: { sub_sizes: subSizes },
|
|
38
|
+
} );
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
it( 'should send empty sub_sizes array by default', async () => {
|
|
19
42
|
apiFetch.mockResolvedValue( {} );
|
|
20
43
|
|
|
21
44
|
await mediaFinalize( 123 );
|
|
@@ -23,6 +46,7 @@ describe( 'mediaFinalize', () => {
|
|
|
23
46
|
expect( apiFetch ).toHaveBeenCalledWith( {
|
|
24
47
|
path: '/wp/v2/media/123/finalize',
|
|
25
48
|
method: 'POST',
|
|
49
|
+
data: { sub_sizes: [] },
|
|
26
50
|
} );
|
|
27
51
|
} );
|
|
28
52
|
|
|
@@ -9,6 +9,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
9
9
|
import { select, dispatch } from '@wordpress/data';
|
|
10
10
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
11
11
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
12
|
+
import { isClientSideMediaSupported } from '@wordpress/upload-media';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -51,8 +52,9 @@ export default function mediaUpload( {
|
|
|
51
52
|
} = dispatch( editorStore );
|
|
52
53
|
|
|
53
54
|
const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
|
|
55
|
+
const isClientSideMediaActive =
|
|
56
|
+
window.__clientSideMediaProcessing && isClientSideMediaSupported();
|
|
54
57
|
const lockKey = `image-upload-${ uuid() }`;
|
|
55
|
-
let imageIsUploading = false;
|
|
56
58
|
maxUploadFileSize =
|
|
57
59
|
maxUploadFileSize || getEditorSettings().maxUploadFileSize;
|
|
58
60
|
const currentPost = getCurrentPost();
|
|
@@ -61,44 +63,31 @@ export default function mediaUpload( {
|
|
|
61
63
|
typeof currentPost?.id === 'number'
|
|
62
64
|
? currentPost.id
|
|
63
65
|
: currentPost?.wp_id;
|
|
64
|
-
const setSaveLock = () => {
|
|
65
|
-
if ( window.__clientSideMediaProcessing ) {
|
|
66
|
-
return; // Skip - handled by useUploadSaveLock in editor provider
|
|
67
|
-
}
|
|
68
|
-
lockPostSaving( lockKey );
|
|
69
|
-
lockPostAutosaving( lockKey );
|
|
70
|
-
imageIsUploading = true;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const postData = currentPostId ? { post: currentPostId } : {};
|
|
74
66
|
const clearSaveLock = () => {
|
|
75
|
-
if ( window.__clientSideMediaProcessing ) {
|
|
76
|
-
return; // Skip - handled by useUploadSaveLock in editor provider
|
|
77
|
-
}
|
|
78
67
|
unlockPostSaving( lockKey );
|
|
79
68
|
unlockPostAutosaving( lockKey );
|
|
80
|
-
imageIsUploading = false;
|
|
81
69
|
};
|
|
82
70
|
|
|
71
|
+
// Lock saving immediately when the upload starts.
|
|
72
|
+
// When client-side media processing is enabled, save locking
|
|
73
|
+
// is handled by useUploadSaveLock in the editor provider.
|
|
74
|
+
if ( ! isClientSideMediaActive ) {
|
|
75
|
+
lockPostSaving( lockKey );
|
|
76
|
+
lockPostAutosaving( lockKey );
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const postData = currentPostId ? { post: currentPostId } : {};
|
|
80
|
+
|
|
83
81
|
uploadMedia( {
|
|
84
82
|
allowedTypes,
|
|
85
83
|
filesList,
|
|
86
|
-
onFileChange: (
|
|
87
|
-
|
|
88
|
-
// is handled by useUploadSaveLock in the editor provider.
|
|
89
|
-
if ( ! window.__clientSideMediaProcessing ) {
|
|
90
|
-
if ( ! imageIsUploading ) {
|
|
91
|
-
setSaveLock();
|
|
92
|
-
} else {
|
|
93
|
-
clearSaveLock();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
onFileChange?.( file );
|
|
84
|
+
onFileChange: ( files ) => {
|
|
85
|
+
onFileChange?.( files );
|
|
97
86
|
|
|
98
87
|
// Files are initially received by `onFileChange` as a blob.
|
|
99
|
-
// After that the function is called
|
|
88
|
+
// After that the function is called again with the file as an entity.
|
|
100
89
|
// For core-data, we only care about receiving/invalidating entities.
|
|
101
|
-
const entityFiles =
|
|
90
|
+
const entityFiles = files.filter( ( _file ) => _file?.id );
|
|
102
91
|
if ( entityFiles?.length ) {
|
|
103
92
|
const invalidateCache = true;
|
|
104
93
|
receiveEntityRecords(
|
|
@@ -109,6 +98,14 @@ export default function mediaUpload( {
|
|
|
109
98
|
invalidateCache
|
|
110
99
|
);
|
|
111
100
|
}
|
|
101
|
+
|
|
102
|
+
// Unlock saving once all files have been uploaded (all have IDs).
|
|
103
|
+
if (
|
|
104
|
+
! isClientSideMediaActive &&
|
|
105
|
+
entityFiles.length === files.length
|
|
106
|
+
) {
|
|
107
|
+
clearSaveLock();
|
|
108
|
+
}
|
|
112
109
|
},
|
|
113
110
|
onSuccess,
|
|
114
111
|
additionalData: {
|
|
@@ -117,7 +114,7 @@ export default function mediaUpload( {
|
|
|
117
114
|
},
|
|
118
115
|
maxUploadFileSize,
|
|
119
116
|
onError: ( { message } ) => {
|
|
120
|
-
if ( !
|
|
117
|
+
if ( ! isClientSideMediaActive ) {
|
|
121
118
|
clearSaveLock();
|
|
122
119
|
}
|
|
123
120
|
onError( message );
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
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
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// packages/editor/src/components/collab-sidebar/add-comment.js
|
|
31
|
-
var add_comment_exports = {};
|
|
32
|
-
__export(add_comment_exports, {
|
|
33
|
-
AddComment: () => AddComment
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(add_comment_exports);
|
|
36
|
-
var import_clsx = __toESM(require("clsx"));
|
|
37
|
-
var import_i18n = require("@wordpress/i18n");
|
|
38
|
-
var import_data = require("@wordpress/data");
|
|
39
|
-
var import_components = require("@wordpress/components");
|
|
40
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
41
|
-
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
42
|
-
var import_comment_author_info = __toESM(require("./comment-author-info.cjs"));
|
|
43
|
-
var import_comment_form = __toESM(require("./comment-form.cjs"));
|
|
44
|
-
var import_utils = require("./utils.cjs");
|
|
45
|
-
var import_store = require("../../store/index.cjs");
|
|
46
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
|
-
var { useBlockElement } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
48
|
-
function AddComment({
|
|
49
|
-
onSubmit,
|
|
50
|
-
commentSidebarRef,
|
|
51
|
-
reflowComments = import_utils.noop,
|
|
52
|
-
isFloating = false,
|
|
53
|
-
y,
|
|
54
|
-
refs
|
|
55
|
-
}) {
|
|
56
|
-
const { clientId } = (0, import_data.useSelect)((select) => {
|
|
57
|
-
const { getSelectedBlockClientId } = select(import_block_editor.store);
|
|
58
|
-
return {
|
|
59
|
-
clientId: getSelectedBlockClientId()
|
|
60
|
-
};
|
|
61
|
-
}, []);
|
|
62
|
-
const selectedNote = (0, import_data.useSelect)(
|
|
63
|
-
(select) => (0, import_lock_unlock.unlock)(select(import_store.store)).getSelectedNote(),
|
|
64
|
-
[]
|
|
65
|
-
);
|
|
66
|
-
const blockElement = useBlockElement(clientId);
|
|
67
|
-
const { toggleBlockSpotlight } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_block_editor.store));
|
|
68
|
-
const { selectNote } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
|
|
69
|
-
const unselectThread = () => {
|
|
70
|
-
selectNote(void 0);
|
|
71
|
-
blockElement?.focus();
|
|
72
|
-
toggleBlockSpotlight(clientId, false);
|
|
73
|
-
};
|
|
74
|
-
if (selectedNote !== "new" || !clientId) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
78
|
-
import_components.__experimentalVStack,
|
|
79
|
-
{
|
|
80
|
-
className: (0, import_clsx.default)(
|
|
81
|
-
"editor-collab-sidebar-panel__thread is-selected",
|
|
82
|
-
{
|
|
83
|
-
"is-floating": isFloating
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
spacing: "3",
|
|
87
|
-
tabIndex: 0,
|
|
88
|
-
"aria-label": (0, import_i18n.__)("New note"),
|
|
89
|
-
role: "treeitem",
|
|
90
|
-
ref: isFloating ? refs.setFloating : void 0,
|
|
91
|
-
style: isFloating ? (
|
|
92
|
-
// Delay showing the floating note box until a Y position is known to prevent blink.
|
|
93
|
-
{ top: y, opacity: !y ? 0 : void 0 }
|
|
94
|
-
) : void 0,
|
|
95
|
-
onBlur: (event) => {
|
|
96
|
-
if (!document.hasFocus()) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (event.currentTarget.contains(event.relatedTarget)) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
toggleBlockSpotlight(clientId, false);
|
|
103
|
-
selectNote(void 0);
|
|
104
|
-
},
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHStack, { alignment: "left", spacing: "3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_author_info.default, {}) }),
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
-
import_comment_form.default,
|
|
109
|
-
{
|
|
110
|
-
onSubmit: async (inputComment) => {
|
|
111
|
-
const { id } = await onSubmit({ content: inputComment });
|
|
112
|
-
selectNote(id);
|
|
113
|
-
(0, import_utils.focusCommentThread)(id, commentSidebarRef.current);
|
|
114
|
-
},
|
|
115
|
-
onCancel: unselectThread,
|
|
116
|
-
reflowComments,
|
|
117
|
-
submitButtonText: (0, import_i18n.__)("Add note"),
|
|
118
|
-
labelText: (0, import_i18n.__)("New note")
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
-
0 && (module.exports = {
|
|
127
|
-
AddComment
|
|
128
|
-
});
|
|
129
|
-
//# sourceMappingURL=add-comment.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab-sidebar/add-comment.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, noop } from './utils';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function AddComment( {\n\tonSubmit,\n\tcommentSidebarRef,\n\treflowComments = noop,\n\tisFloating = false,\n\ty,\n\trefs,\n} ) {\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 unselectThread = () => {\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<VStack\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-collab-sidebar-panel__thread is-selected',\n\t\t\t\t{\n\t\t\t\t\t'is-floating': isFloating,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tspacing=\"3\"\n\t\t\ttabIndex={ 0 }\n\t\t\taria-label={ __( 'New note' ) }\n\t\t\trole=\"treeitem\"\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={\n\t\t\t\tisFloating\n\t\t\t\t\t? // Delay showing the floating note box until a Y position is known to prevent blink.\n\t\t\t\t\t { top: y, opacity: ! y ? 0 : undefined }\n\t\t\t\t\t: 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<HStack alignment=\"left\" spacing=\"3\">\n\t\t\t\t<CommentAuthorInfo />\n\t\t\t</HStack>\n\t\t\t<CommentForm\n\t\t\t\tonSubmit={ async ( inputComment ) => {\n\t\t\t\t\tconst { id } = await onSubmit( { content: inputComment } );\n\t\t\t\t\tselectNote( id );\n\t\t\t\t\tfocusCommentThread( id, commentSidebarRef.current );\n\t\t\t\t} }\n\t\t\t\tonCancel={ unselectThread }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tsubmitButtonText={ __( 'Add note' ) }\n\t\t\t\tlabelText={ __( 'New note' ) }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,kBAAmB;AACnB,kBAAuC;AACvC,wBAGO;AACP,0BAGO;AAKP,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AACxB,mBAAyC;AACzC,mBAAqC;AAqCnC;AAnCF,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,WAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb;AAAA,EACA;AACD,GAAI;AACH,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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kBAAkB,OAAQ;AAAA,YACnD;AAAA,YACA,UAAW;AAAA,YACX;AAAA,YACA,sBAAmB,gBAAI,UAAW;AAAA,YAClC,eAAY,gBAAI,UAAW;AAAA;AAAA,QAC5B;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
-
"names": ["blockEditorPrivateApis", "blockEditorStore", "editorStore", "VStack", "clsx", "HStack", "CommentAuthorInfo", "CommentForm"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab-sidebar/comment-author-info.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip, __experimentalVStack as VStack } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\nfunction CommentAuthorInfo( { avatar, name, date, userId } ) {\n\tconst hasAvatar = !! avatar;\n\tconst dateSettings = getDateSettings();\n\tconst {\n\t\tcurrentUserAvatar,\n\t\tcurrentUserName,\n\t\tcurrentUserId,\n\t\tdateFormat = dateSettings.formats.date,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getCurrentUser, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tif ( hasAvatar ) {\n\t\t\t\treturn {\n\t\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\t\tconst defaultAvatar = __experimentalDiscussionSettings?.avatarURL;\n\t\t\tconst userData = getCurrentUser();\n\t\t\treturn {\n\t\t\t\tcurrentUserAvatar:\n\t\t\t\t\tuserData?.avatar_urls?.[ 48 ] ?? defaultAvatar,\n\t\t\t\tcurrentUserName: userData?.name,\n\t\t\t\tcurrentUserId: userData?.id,\n\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t};\n\t\t},\n\t\t[ hasAvatar ]\n\t);\n\n\tconst commentDate = getDate( date );\n\tconst commentDateTime = dateI18n( 'c', commentDate );\n\tconst shouldShowHumanTimeDiff =\n\t\tMath.floor( ( new Date() - commentDate ) / ( 1000 * 60 * 60 * 24 ) ) <\n\t\t30;\n\n\tconst commentDateText = shouldShowHumanTimeDiff\n\t\t? humanTimeDiff( commentDate )\n\t\t: dateI18n( dateFormat, commentDate );\n\n\tconst tooltipText = dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'Note date full date format' ),\n\t\tdate\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ avatar || currentUserAvatar }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\tuserId ?? currentUserId\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<VStack spacing=\"0\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ name ?? currentUserName }\n\t\t\t\t</span>\n\t\t\t\t{ date && (\n\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t<time\n\t\t\t\t\t\t\tdateTime={ commentDateTime }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ commentDateText }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default CommentAuthorInfo;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAwD;AACxD,kBAAuB;AACvB,kBAKO;AACP,uBAAmC;AACnC,kBAA0B;AAC1B,0BAA0C;AAK1C,mBAAqC;AA2DnC;AAzDF,SAAS,kBAAmB,EAAE,QAAQ,MAAM,MAAM,OAAO,GAAI;AAC5D,QAAM,YAAY,CAAC,CAAE;AACrB,QAAM,mBAAe,YAAAA,aAAgB;AACrC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,aAAa,QAAQ;AAAA,EACnC,QAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM,EAAE,SAAS,gBAAgB,gBAAgB,IAChD,OAAQ,iBAAAC,KAAU;AACnB,YAAM,eAAe,QAAS,QAAQ;AAAA,QACrC,MAAM;AAAA,QACN,MAAM;AAAA,MACP,CAAE,IACC,gBAAiB,QAAQ,MAAO,IAChC;AAEH,UAAK,WAAY;AAChB,eAAO;AAAA,UACN,YAAY,cAAc;AAAA,QAC3B;AAAA,MACD;AAEA,YAAM,EAAE,YAAY,IAAI,OAAQ,oBAAAC,KAAiB;AACjD,YAAM,EAAE,iCAAiC,IAAI,YAAY;AACzD,YAAM,gBAAgB,kCAAkC;AACxD,YAAM,WAAW,eAAe;AAChC,aAAO;AAAA,QACN,mBACC,UAAU,cAAe,EAAG,KAAK;AAAA,QAClC,iBAAiB,UAAU;AAAA,QAC3B,eAAe,UAAU;AAAA,QACzB,YAAY,cAAc;AAAA,MAC3B;AAAA,IACD;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,kBAAc,qBAAS,IAAK;AAClC,QAAM,sBAAkB,sBAAU,KAAK,WAAY;AACnD,QAAM,0BACL,KAAK,OAAS,oBAAI,KAAK,IAAI,gBAAkB,MAAO,KAAK,KAAK,GAAK,IACnE;AAED,QAAM,kBAAkB,8BACrB,2BAAe,WAAY,QAC3B,sBAAU,YAAY,WAAY;AAErC,QAAM,kBAAc;AAAA;AAAA,QAEnB,gBAAI,mBAAmB,4BAA6B;AAAA,IACpD;AAAA,EACD;AAEA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,KAAM,UAAU;AAAA,QAChB,WAAU;AAAA,QAEV,SAAM,gBAAI,aAAc;AAAA,QACxB,OAAQ;AAAA,QACR,QAAS;AAAA,QACT,OAAQ;AAAA,UACP,iBAAa;AAAA,YACZ,UAAU;AAAA,UACX;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,KACf;AAAA,kDAAC,UAAK,WAAU,0CACb,kBAAQ,iBACX;AAAA,MACE,QACD,4CAAC,6BAAQ,MAAO,aACf;AAAA,QAAC;AAAA;AAAA,UACA,UAAW;AAAA,UACX,WAAU;AAAA,UAER;AAAA;AAAA,MACH,GACD;AAAA,OAEF;AAAA,KACD;AAEF;AAEA,IAAO,8BAAQ;",
|
|
6
|
-
"names": ["getDateSettings", "coreStore", "blockEditorStore", "VStack"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab-sidebar/comment-form.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport TextareaAutosize from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tButton,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId, useDebounce } from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { sanitizeCommentString, noop } from './utils';\n\nfunction CommentForm( {\n\tonSubmit,\n\tonCancel,\n\tthread,\n\tsubmitButtonText,\n\tlabelText,\n\treflowComments = noop,\n} ) {\n\tconst [ inputComment, setInputComment ] = useState(\n\t\tthread?.content?.raw ?? ''\n\t);\n\n\t// Regularly trigger a reflow as the user types since the textarea may grow or shrink.\n\tconst debouncedCommentUpdated = useDebounce( reflowComments, 100 );\n\n\tconst updateComment = ( value ) => {\n\t\tsetInputComment( value );\n\t};\n\n\tconst inputId = useInstanceId( CommentForm, 'comment-input' );\n\tconst isDisabled =\n\t\tinputComment === thread?.content?.raw ||\n\t\t! sanitizeCommentString( inputComment ).length;\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"editor-collab-sidebar-panel__comment-form\"\n\t\t\tspacing=\"4\"\n\t\t\tas=\"form\"\n\t\t\tonSubmit={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonSubmit( inputComment );\n\t\t\t\tsetInputComment( '' );\n\t\t\t} }\n\t\t>\n\t\t\t<VisuallyHidden as=\"label\" htmlFor={ inputId }>\n\t\t\t\t{ labelText ?? __( 'Note' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<TextareaAutosize\n\t\t\t\tid={ inputId }\n\t\t\t\tvalue={ inputComment ?? '' }\n\t\t\t\tonChange={ ( comment ) => {\n\t\t\t\t\tupdateComment( comment.target.value );\n\t\t\t\t\tdebouncedCommentUpdated();\n\t\t\t\t} }\n\t\t\t\trows={ 1 }\n\t\t\t\tmaxRows={ 20 }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisKeyboardEvent.primary( event, 'Enter' ) &&\n\t\t\t\t\t\t! isDisabled\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.target.parentNode.requestSubmit();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t// Passing event for reply forms.\n\t\t\t\t\t\tonCancel( event );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<HStack spacing=\"2\" justify=\"flex-end\" wrap>\n\t\t\t\t<Button size=\"compact\" variant=\"tertiary\" onClick={ onCancel }>\n\t\t\t\t\t<Truncate>{ __( 'Cancel' ) }</Truncate>\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t>\n\t\t\t\t\t<Truncate>{ submitButtonText }</Truncate>\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</VStack>\n\t);\n}\n\nexport default CommentForm;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qCAA6B;AAK7B,qBAAyB;AACzB,wBAMO;AACP,kBAAmB;AACnB,qBAA2C;AAC3C,sBAAgC;AAKhC,mBAA4C;AAqCzC;AAnCH,SAAS,YAAa;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAClB,GAAI;AACH,QAAM,CAAE,cAAc,eAAgB,QAAI;AAAA,IACzC,QAAQ,SAAS,OAAO;AAAA,EACzB;AAGA,QAAM,8BAA0B,4BAAa,gBAAgB,GAAI;AAEjE,QAAM,gBAAgB,CAAE,UAAW;AAClC,oBAAiB,KAAM;AAAA,EACxB;AAEA,QAAM,cAAU,8BAAe,aAAa,eAAgB;AAC5D,QAAM,aACL,iBAAiB,QAAQ,S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TextareaAutosize", "HStack", "Truncate"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab-sidebar/comment-indicator-toolbar.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarBorderColor } from './utils';\n\nconst { CommentIconToolbarSlotFill } = unlock( blockEditorPrivateApis );\n\nconst CommentAvatarIndicator = ( { onClick, thread } ) => {\n\tconst threadParticipants = useMemo( () => {\n\t\tif ( ! thread ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst participantsMap = new Map();\n\t\tconst allComments = [ thread, ...thread.reply ];\n\n\t\t// Sort by date to show participants in chronological order.\n\t\tallComments.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) );\n\n\t\tallComments.forEach( ( comment ) => {\n\t\t\t// Track thread participants (original commenter + repliers).\n\t\t\tif ( comment.author_name && comment.author_avatar_urls ) {\n\t\t\t\tif ( ! participantsMap.has( comment.author ) ) {\n\t\t\t\t\tparticipantsMap.set( comment.author, {\n\t\t\t\t\t\tname: comment.author_name,\n\t\t\t\t\t\tavatar:\n\t\t\t\t\t\t\tcomment.author_avatar_urls?.[ '48' ] ||\n\t\t\t\t\t\t\tcomment.author_avatar_urls?.[ '96' ],\n\t\t\t\t\t\tid: comment.author,\n\t\t\t\t\t\tdate: comment.date,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\treturn Array.from( participantsMap.values() );\n\t}, [ thread ] );\n\n\tif ( ! threadParticipants.length ) {\n\t\treturn null;\n\t}\n\n\t// If there are more than 3 participants, show 2 avatars and a \"+n\" number.\n\tconst maxAvatars = 3;\n\tconst isOverflow = threadParticipants.length > maxAvatars;\n\tconst visibleParticipants = isOverflow\n\t\t? threadParticipants.slice( 0, maxAvatars - 1 )\n\t\t: threadParticipants;\n\tconst overflowCount = Math.max(\n\t\t0,\n\t\tthreadParticipants.length - visibleParticipants.length\n\t);\n\tconst threadHasMoreParticipants = threadParticipants.length > 100;\n\n\t// If we hit the comment limit, show \"100+\" instead of exact overflow count.\n\tconst overflowText =\n\t\tthreadHasMoreParticipants && overflowCount > 0\n\t\t\t? __( '100+' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: Number of participants.\n\t\t\t\t\t__( '+%s' ),\n\t\t\t\t\toverflowCount\n\t\t\t );\n\n\treturn (\n\t\t<CommentIconToolbarSlotFill.Fill>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"comment-avatar-indicator\"\n\t\t\t\tlabel={ __( 'View notes' ) }\n\t\t\t\tonClick={ () => onClick() }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t<HStack spacing=\"1\">\n\t\t\t\t\t{ visibleParticipants.map( ( participant ) => (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tkey={ participant.id }\n\t\t\t\t\t\t\tsrc={ participant.avatar }\n\t\t\t\t\t\t\talt={ participant.name }\n\t\t\t\t\t\t\tclassName=\"comment-avatar\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\tparticipant.id\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ overflowCount > 0 && (\n\t\t\t\t\t\t<Text weight={ 500 }>{ overflowText }</Text>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</ToolbarButton>\n\t\t</CommentIconToolbarSlotFill.Fill>\n\t);\n};\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IACA,mBAAmB,SAAS,oBAAoB;AAAA,EACjD;AACA,QAAM,4BAA4B,mBAAmB,SAAS;AAG9D,QAAM,eACL,6BAA6B,gBAAgB,QAC1C,gBAAI,MAAO,QACX;AAAA;AAAA,QAEA,gBAAI,KAAM;AAAA,IACV;AAAA,EACA;AAEJ,SACC,4CAAC,2BAA2B,MAA3B,EACA;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,YAAa;AAAA,MACzB,SAAU,MAAM,QAAQ;AAAA,MACxB,aAAW;AAAA,MAEX,uDAAC,kBAAAC,sBAAA,EAAO,SAAQ,KACb;AAAA,4BAAoB,IAAK,CAAE,gBAC5B;AAAA,UAAC;AAAA;AAAA,YAEA,KAAM,YAAY;AAAA,YAClB,KAAM,YAAY;AAAA,YAClB,WAAU;AAAA,YACV,OAAQ;AAAA,cACP,iBAAa;AAAA,gBACZ,YAAY;AAAA,cACb;AAAA,YACD;AAAA;AAAA,UARM,YAAY;AAAA,QASnB,CACC;AAAA,QACA,gBAAgB,KACjB,4CAAC,kBAAAC,oBAAA,EAAK,QAAS,KAAQ,wBAAc;AAAA,SAEvC;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,oCAAQ;",
|
|
6
|
-
"names": ["blockEditorPrivateApis", "HStack", "Text"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/collab-sidebar/comment-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 { CommentIconSlotFill } = unlock( blockEditorPrivateApis );\n\nconst AddCommentMenuItem = ( { 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\nconst AddCommentMenuItemFill = ( { onClick, isDistractionFree } ) => {\n\treturn (\n\t\t<CommentIconSlotFill.Fill>\n\t\t\t{ ( { clientId, onClose } ) => (\n\t\t\t\t<AddCommentMenuItem\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</CommentIconSlotFill.Fill>\n\t);\n};\n\nexport default AddCommentMenuItemFill;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;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