@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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { calculateNotePositions } from '../utils';
|
|
5
|
+
|
|
6
|
+
function makeRect( top ) {
|
|
7
|
+
return { top };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
describe( 'calculateNotePositions', () => {
|
|
11
|
+
it( 'returns empty positions when the anchor thread has no blockRect', () => {
|
|
12
|
+
const { positions } = calculateNotePositions( {
|
|
13
|
+
threads: [ { id: 1 } ],
|
|
14
|
+
selectedNoteId: undefined,
|
|
15
|
+
blockRects: {},
|
|
16
|
+
heights: {},
|
|
17
|
+
scrollTop: 0,
|
|
18
|
+
} );
|
|
19
|
+
expect( positions ).toEqual( {} );
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
it( 'falls back to the first thread as anchor when none is selected', () => {
|
|
23
|
+
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
24
|
+
const blockRects = {
|
|
25
|
+
1: makeRect( 100 ),
|
|
26
|
+
2: makeRect( 300 ),
|
|
27
|
+
3: makeRect( 500 ),
|
|
28
|
+
};
|
|
29
|
+
const heights = { 1: 50, 2: 50, 3: 50 };
|
|
30
|
+
|
|
31
|
+
const { positions } = calculateNotePositions( {
|
|
32
|
+
threads,
|
|
33
|
+
selectedNoteId: undefined,
|
|
34
|
+
blockRects,
|
|
35
|
+
heights,
|
|
36
|
+
scrollTop: 0,
|
|
37
|
+
} );
|
|
38
|
+
|
|
39
|
+
// 1: 100 - 16 = 84
|
|
40
|
+
// 2: 300 - 16 = 284
|
|
41
|
+
// 3: 500 - 16 = 484
|
|
42
|
+
expect( positions ).toEqual( { 1: 84, 2: 284, 3: 484 } );
|
|
43
|
+
} );
|
|
44
|
+
|
|
45
|
+
it( 'pushes an overlapping thread above the anchor upward', () => {
|
|
46
|
+
const threads = [ { id: 1 }, { id: 2 } ];
|
|
47
|
+
const blockRects = {
|
|
48
|
+
1: makeRect( 150 ),
|
|
49
|
+
2: makeRect( 180 ),
|
|
50
|
+
};
|
|
51
|
+
const heights = { 1: 60, 2: 50 };
|
|
52
|
+
|
|
53
|
+
const { positions } = calculateNotePositions( {
|
|
54
|
+
threads,
|
|
55
|
+
selectedNoteId: 2,
|
|
56
|
+
blockRects,
|
|
57
|
+
heights,
|
|
58
|
+
scrollTop: 0,
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
// 2 (anchor): 180 - 16 = 164
|
|
62
|
+
// 1 (upward): 164 - 60 - 20 = 84
|
|
63
|
+
expect( positions ).toEqual( { 1: 84, 2: 164 } );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
it( 'cascades downward offsets through consecutive overlapping threads', () => {
|
|
67
|
+
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
68
|
+
const blockRects = {
|
|
69
|
+
1: makeRect( 100 ),
|
|
70
|
+
2: makeRect( 110 ),
|
|
71
|
+
3: makeRect( 120 ),
|
|
72
|
+
};
|
|
73
|
+
const heights = { 1: 80, 2: 80, 3: 80 };
|
|
74
|
+
|
|
75
|
+
const { positions } = calculateNotePositions( {
|
|
76
|
+
threads,
|
|
77
|
+
selectedNoteId: 1,
|
|
78
|
+
blockRects,
|
|
79
|
+
heights,
|
|
80
|
+
scrollTop: 0,
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
// 1 (anchor): 100 - 16 = 84
|
|
84
|
+
// 2 (downward): 84 + 80 + 20 = 184
|
|
85
|
+
// 3 (downward): 184 + 80 + 20 = 284
|
|
86
|
+
expect( positions ).toEqual( { 1: 84, 2: 184, 3: 284 } );
|
|
87
|
+
} );
|
|
88
|
+
|
|
89
|
+
it( 'omits threads that have no blockRect', () => {
|
|
90
|
+
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
91
|
+
const blockRects = {
|
|
92
|
+
1: makeRect( 100 ),
|
|
93
|
+
3: makeRect( 500 ),
|
|
94
|
+
};
|
|
95
|
+
const heights = { 1: 50, 3: 50 };
|
|
96
|
+
|
|
97
|
+
const { positions } = calculateNotePositions( {
|
|
98
|
+
threads,
|
|
99
|
+
selectedNoteId: 1,
|
|
100
|
+
blockRects,
|
|
101
|
+
heights,
|
|
102
|
+
scrollTop: 0,
|
|
103
|
+
} );
|
|
104
|
+
|
|
105
|
+
// 1: 100 - 16 = 84
|
|
106
|
+
// 3: 500 - 16 = 484
|
|
107
|
+
expect( positions ).toEqual( { 1: 84, 3: 484 } );
|
|
108
|
+
} );
|
|
109
|
+
|
|
110
|
+
it( 'allows upward cascade to produce negative positions', () => {
|
|
111
|
+
const threads = [ { id: 1 }, { id: 2 }, { id: 3 }, { id: 4 } ];
|
|
112
|
+
const blockRects = {
|
|
113
|
+
1: makeRect( 150 ),
|
|
114
|
+
2: makeRect( 200 ),
|
|
115
|
+
3: makeRect( 250 ),
|
|
116
|
+
4: makeRect( 300 ),
|
|
117
|
+
};
|
|
118
|
+
const heights = { 1: 90, 2: 90, 3: 90, 4: 230 };
|
|
119
|
+
|
|
120
|
+
const { positions } = calculateNotePositions( {
|
|
121
|
+
threads,
|
|
122
|
+
selectedNoteId: 4,
|
|
123
|
+
blockRects,
|
|
124
|
+
heights,
|
|
125
|
+
scrollTop: 0,
|
|
126
|
+
} );
|
|
127
|
+
|
|
128
|
+
// 4 (anchor): 300 - 16 = 284
|
|
129
|
+
// 3 (upward): 284 - 90 - 20 = 174
|
|
130
|
+
// 2 (upward): 174 - 90 - 20 = 64
|
|
131
|
+
// 1 (upward): 64 - 90 - 20 = -46
|
|
132
|
+
expect( positions ).toEqual( { 1: -46, 2: 64, 3: 174, 4: 284 } );
|
|
133
|
+
} );
|
|
134
|
+
|
|
135
|
+
it( 'adds scrollTop to the final positions', () => {
|
|
136
|
+
const threads = [ { id: 1 }, { id: 2 } ];
|
|
137
|
+
const blockRects = {
|
|
138
|
+
1: makeRect( 100 ),
|
|
139
|
+
2: makeRect( 300 ),
|
|
140
|
+
};
|
|
141
|
+
const heights = { 1: 50, 2: 50 };
|
|
142
|
+
|
|
143
|
+
const { positions } = calculateNotePositions( {
|
|
144
|
+
threads,
|
|
145
|
+
selectedNoteId: 1,
|
|
146
|
+
blockRects,
|
|
147
|
+
heights,
|
|
148
|
+
scrollTop: 500,
|
|
149
|
+
} );
|
|
150
|
+
|
|
151
|
+
// 1: 100 + 500 - 16 = 584
|
|
152
|
+
// 2: 300 + 500 - 16 = 784
|
|
153
|
+
expect( positions ).toEqual( { 1: 584, 2: 784 } );
|
|
154
|
+
} );
|
|
155
|
+
} );
|
|
@@ -4,19 +4,18 @@
|
|
|
4
4
|
import { _x } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Sanitizes a
|
|
7
|
+
* Sanitizes a note string by removing non-printable ASCII characters.
|
|
8
8
|
*
|
|
9
|
-
* @param {string} str - The
|
|
10
|
-
* @return {string} - The sanitized
|
|
9
|
+
* @param {string} str - The note string to sanitize.
|
|
10
|
+
* @return {string} - The sanitized note string.
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function sanitizeNoteContent( str ) {
|
|
13
13
|
return str.trim();
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export function noop() {}
|
|
16
|
+
const THREAD_ALIGN_OFFSET = -16;
|
|
17
|
+
const THREAD_GAP = 16;
|
|
18
|
+
const OVERLAP_MARGIN = 20;
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Avatar border colors chosen to be visually distinct from each other and from
|
|
@@ -43,13 +42,13 @@ export function getAvatarBorderColor( userId ) {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
|
-
* Generates a
|
|
45
|
+
* Generates a note excerpt from text based on word count type and length.
|
|
47
46
|
*
|
|
48
|
-
* @param {string} text - The
|
|
49
|
-
* @param {number} excerptLength - The maximum length for the
|
|
50
|
-
* @return {string} - The generated
|
|
47
|
+
* @param {string} text - The note text to generate excerpt from.
|
|
48
|
+
* @param {number} excerptLength - The maximum length for the note excerpt.
|
|
49
|
+
* @return {string} - The generated note excerpt.
|
|
51
50
|
*/
|
|
52
|
-
export function
|
|
51
|
+
export function getNoteExcerpt( text, excerptLength = 10 ) {
|
|
53
52
|
if ( ! text ) {
|
|
54
53
|
return '';
|
|
55
54
|
}
|
|
@@ -92,24 +91,131 @@ export function getCommentExcerpt( text, excerptLength = 10 ) {
|
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
/**
|
|
95
|
-
*
|
|
94
|
+
* Calculate final top positions for all floating note threads in the
|
|
95
|
+
* editor's content coordinate space. Adjusts positions to prevent overlapping
|
|
96
|
+
* by pushing threads above the selected one upward and threads below it downward.
|
|
97
|
+
*
|
|
98
|
+
* @param {Object} params
|
|
99
|
+
* @param {Array} params.threads Ordered list of thread objects.
|
|
100
|
+
* @param {string|number|undefined} params.selectedNoteId ID of the currently selected thread.
|
|
101
|
+
* @param {Object<string,DOMRect>} params.blockRects Pre-read bounding rects keyed by thread ID.
|
|
102
|
+
* @param {Object<string,number>} params.heights Rendered heights keyed by thread ID.
|
|
103
|
+
* @param {number} params.scrollTop Current scroll offset of the editor content.
|
|
104
|
+
* @return {{ positions: Object<string,number> }} Computed top positions.
|
|
105
|
+
*/
|
|
106
|
+
export function calculateNotePositions( {
|
|
107
|
+
threads,
|
|
108
|
+
selectedNoteId,
|
|
109
|
+
blockRects,
|
|
110
|
+
heights,
|
|
111
|
+
scrollTop = 0,
|
|
112
|
+
} ) {
|
|
113
|
+
const offsets = {};
|
|
114
|
+
|
|
115
|
+
const anchorIndex = Math.max(
|
|
116
|
+
0,
|
|
117
|
+
threads.findIndex( ( thread ) => thread.id === selectedNoteId )
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const anchorThread = threads[ anchorIndex ];
|
|
121
|
+
|
|
122
|
+
if ( ! anchorThread || ! blockRects[ anchorThread.id ] ) {
|
|
123
|
+
return { positions: {} };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const anchorRect = blockRects[ anchorThread.id ];
|
|
127
|
+
const anchorTop = anchorRect.top || 0;
|
|
128
|
+
const anchorHeight = heights[ anchorThread.id ] || 0;
|
|
129
|
+
|
|
130
|
+
offsets[ anchorThread.id ] = THREAD_ALIGN_OFFSET;
|
|
131
|
+
|
|
132
|
+
// Process threads after the anchor, offsetting overlapping threads downward.
|
|
133
|
+
let prevAdjustedTop = anchorTop + THREAD_ALIGN_OFFSET;
|
|
134
|
+
let prevHeight = anchorHeight;
|
|
135
|
+
|
|
136
|
+
for ( let i = anchorIndex + 1; i < threads.length; i++ ) {
|
|
137
|
+
const thread = threads[ i ];
|
|
138
|
+
const threadRect = blockRects[ thread.id ];
|
|
139
|
+
if ( ! threadRect ) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const threadTop = threadRect.top || 0;
|
|
144
|
+
const threadHeight = heights[ thread.id ] || 0;
|
|
145
|
+
|
|
146
|
+
let offset = THREAD_ALIGN_OFFSET;
|
|
147
|
+
|
|
148
|
+
const prevBottom = prevAdjustedTop + prevHeight;
|
|
149
|
+
if ( threadTop < prevBottom + THREAD_GAP ) {
|
|
150
|
+
offset = prevBottom - threadTop + OVERLAP_MARGIN;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
offsets[ thread.id ] = offset;
|
|
154
|
+
|
|
155
|
+
prevAdjustedTop = threadTop + offset;
|
|
156
|
+
prevHeight = threadHeight;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Process threads before the anchor, offsetting overlapping threads upward.
|
|
160
|
+
let belowAdjustedTop = anchorTop + THREAD_ALIGN_OFFSET;
|
|
161
|
+
|
|
162
|
+
for ( let i = anchorIndex - 1; i >= 0; i-- ) {
|
|
163
|
+
const thread = threads[ i ];
|
|
164
|
+
const threadRect = blockRects[ thread.id ];
|
|
165
|
+
if ( ! threadRect ) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const threadTop = threadRect.top || 0;
|
|
170
|
+
const threadHeight = heights[ thread.id ] || 0;
|
|
171
|
+
|
|
172
|
+
let offset = THREAD_ALIGN_OFFSET;
|
|
173
|
+
|
|
174
|
+
const threadBottom = threadTop + threadHeight;
|
|
175
|
+
|
|
176
|
+
if ( threadBottom > belowAdjustedTop ) {
|
|
177
|
+
offset =
|
|
178
|
+
belowAdjustedTop - threadTop - threadHeight - OVERLAP_MARGIN;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
offsets[ thread.id ] = offset;
|
|
182
|
+
|
|
183
|
+
belowAdjustedTop = threadTop + offset;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// blockRect.top + scrollTop is the block's absolute y within the editor's
|
|
187
|
+
// scroll content; CSS translates each thread by -scrollTop at render time.
|
|
188
|
+
const positions = {};
|
|
189
|
+
for ( const thread of threads ) {
|
|
190
|
+
const blockRect = blockRects[ thread.id ];
|
|
191
|
+
if ( blockRect && offsets[ thread.id ] !== undefined ) {
|
|
192
|
+
positions[ thread.id ] =
|
|
193
|
+
blockRect.top + scrollTop + offsets[ thread.id ];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return { positions };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Shift focus to the note thread associated with a particular note ID.
|
|
96
202
|
* If an additional selector is provided, the focus will be shifted to the element matching the selector.
|
|
97
203
|
*
|
|
98
204
|
* @typedef {import('@wordpress/element').RefObject} RefObject
|
|
99
205
|
*
|
|
100
|
-
* @param {string}
|
|
206
|
+
* @param {string} noteId The ID of the note thread to focus.
|
|
101
207
|
* @param {?HTMLElement} container The container element to search within.
|
|
102
208
|
* @param {string} additionalSelector The additional selector to focus on.
|
|
103
209
|
*/
|
|
104
|
-
export function
|
|
210
|
+
export function focusNoteThread( noteId, container, additionalSelector ) {
|
|
105
211
|
if ( ! container ) {
|
|
106
212
|
return;
|
|
107
213
|
}
|
|
108
214
|
|
|
109
|
-
// A thread without a
|
|
215
|
+
// A thread without a noteId is a new note thread.
|
|
110
216
|
const threadSelector =
|
|
111
|
-
|
|
112
|
-
? `[role=treeitem][id="
|
|
217
|
+
noteId && noteId !== 'new'
|
|
218
|
+
? `[role=treeitem][id="note-thread-${ noteId }"]`
|
|
113
219
|
: '[role=treeitem]:not([id])';
|
|
114
220
|
const selector = additionalSelector
|
|
115
221
|
? `${ threadSelector } ${ additionalSelector }`
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button {
|
|
23
23
|
display: flex;
|
|
24
24
|
align-items: center;
|
|
25
|
-
cursor:
|
|
25
|
+
cursor: var(--wpds-cursor-control);
|
|
26
26
|
position: relative;
|
|
27
27
|
padding: $grid-unit-05;
|
|
28
28
|
border-radius: $grid-unit-05;
|
|
@@ -10,7 +10,7 @@ import { __, isRTL } from '@wordpress/i18n';
|
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import {
|
|
12
12
|
Button,
|
|
13
|
-
__experimentalText as
|
|
13
|
+
__experimentalText as WCText,
|
|
14
14
|
__unstableMotion as motion,
|
|
15
15
|
__unstableAnimatePresence as AnimatePresence,
|
|
16
16
|
} from '@wordpress/components';
|
|
@@ -206,7 +206,7 @@ export default function DocumentBar( props ) {
|
|
|
206
206
|
/>
|
|
207
207
|
) }
|
|
208
208
|
{ isNotFound ? (
|
|
209
|
-
<
|
|
209
|
+
<WCText>{ __( 'Document not found' ) }</WCText>
|
|
210
210
|
) : (
|
|
211
211
|
<Button
|
|
212
212
|
className="editor-document-bar__command"
|
|
@@ -236,7 +236,7 @@ export default function DocumentBar( props ) {
|
|
|
236
236
|
}
|
|
237
237
|
>
|
|
238
238
|
{ icon && <BlockIcon icon={ icon } /> }
|
|
239
|
-
<
|
|
239
|
+
<WCText size="body" as="h1">
|
|
240
240
|
<span className="editor-document-bar__post-title">
|
|
241
241
|
{ title
|
|
242
242
|
? stripHTML( title )
|
|
@@ -265,7 +265,7 @@ export default function DocumentBar( props ) {
|
|
|
265
265
|
) }` }
|
|
266
266
|
</span>
|
|
267
267
|
) }
|
|
268
|
-
</
|
|
268
|
+
</WCText>
|
|
269
269
|
</motion.div>
|
|
270
270
|
<span className="editor-document-bar__shortcut">
|
|
271
271
|
{ displayShortcut.primary( 'k' ) }
|
|
@@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
8
|
__experimentalHStack as HStack,
|
|
9
|
-
__experimentalText as
|
|
9
|
+
__experimentalText as WCText,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { select } from '@wordpress/data';
|
|
12
12
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
@@ -71,9 +71,9 @@ class ErrorBoundary extends Component {
|
|
|
71
71
|
expanded={ false }
|
|
72
72
|
wrap
|
|
73
73
|
>
|
|
74
|
-
<
|
|
74
|
+
<WCText as="p">
|
|
75
75
|
{ __( 'The editor has encountered an unexpected error.' ) }
|
|
76
|
-
</
|
|
76
|
+
</WCText>
|
|
77
77
|
<HStack expanded={ false }>
|
|
78
78
|
{ canCopyContent && (
|
|
79
79
|
<CopyButton text={ getContent }>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __experimentalText as
|
|
4
|
+
import { __experimentalText as WCText } from '@wordpress/components';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -17,17 +17,17 @@ export default function ListViewOutline() {
|
|
|
17
17
|
<>
|
|
18
18
|
<div className="editor-list-view-sidebar__outline">
|
|
19
19
|
<div>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
20
|
+
<WCText>{ __( 'Characters:' ) }</WCText>
|
|
21
|
+
<WCText>
|
|
22
22
|
<CharacterCount />
|
|
23
|
-
</
|
|
23
|
+
</WCText>
|
|
24
24
|
</div>
|
|
25
25
|
<div>
|
|
26
|
-
<
|
|
26
|
+
<WCText>{ __( 'Words:' ) }</WCText>
|
|
27
27
|
<WordCount />
|
|
28
28
|
</div>
|
|
29
29
|
<div>
|
|
30
|
-
<
|
|
30
|
+
<WCText>{ __( 'Time to read:' ) }</WCText>
|
|
31
31
|
<TimeToRead />
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSettings } from '@wordpress/block-editor';
|
|
5
|
+
import { useMemo } from '@wordpress/element';
|
|
6
|
+
import { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
import usePostFields from '../post-fields';
|
|
13
|
+
|
|
14
|
+
const { MediaEditorModal } = unlock( mediaEditorPrivateApis );
|
|
15
|
+
|
|
16
|
+
function ratioToNumber( ratio ) {
|
|
17
|
+
if ( ratio === undefined || ratio === null ) {
|
|
18
|
+
return NaN;
|
|
19
|
+
}
|
|
20
|
+
const [ a, b, ...rest ] = String( ratio ).split( '/' ).map( Number );
|
|
21
|
+
if (
|
|
22
|
+
a <= 0 ||
|
|
23
|
+
b <= 0 ||
|
|
24
|
+
Number.isNaN( a ) ||
|
|
25
|
+
Number.isNaN( b ) ||
|
|
26
|
+
rest.length
|
|
27
|
+
) {
|
|
28
|
+
return NaN;
|
|
29
|
+
}
|
|
30
|
+
return b ? a / b : a;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function aspectRatioPresetFromSettings( { name, ratio } = {} ) {
|
|
34
|
+
const value = ratioToNumber( ratio );
|
|
35
|
+
if ( ! name || ! Number.isFinite( value ) || value <= 0 ) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
label: name,
|
|
40
|
+
value,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Mounts the MediaEditorModal alongside existing editor modals.
|
|
46
|
+
*
|
|
47
|
+
* Bridges `@wordpress/editor`'s `usePostFields('attachment')` hook
|
|
48
|
+
* into the modal, since `@wordpress/media-editor` cannot depend on
|
|
49
|
+
* `@wordpress/editor`.
|
|
50
|
+
*
|
|
51
|
+
* @return {Element} The MediaEditorModal component wired with attachment fields.
|
|
52
|
+
*/
|
|
53
|
+
export default function MediaEditorModalMount() {
|
|
54
|
+
const fields = usePostFields( { postType: 'attachment' } );
|
|
55
|
+
const [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(
|
|
56
|
+
'dimensions.aspectRatios.default',
|
|
57
|
+
'dimensions.aspectRatios.theme',
|
|
58
|
+
'dimensions.defaultAspectRatios'
|
|
59
|
+
);
|
|
60
|
+
const aspectRatioPresets = useMemo( () => {
|
|
61
|
+
const hasAspectRatioSettings =
|
|
62
|
+
Array.isArray( defaultRatios ) ||
|
|
63
|
+
Array.isArray( themeRatios ) ||
|
|
64
|
+
typeof showDefaultRatios === 'boolean';
|
|
65
|
+
|
|
66
|
+
if ( ! hasAspectRatioSettings ) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const candidateRatios = [
|
|
71
|
+
...( showDefaultRatios && Array.isArray( defaultRatios )
|
|
72
|
+
? defaultRatios
|
|
73
|
+
: [] ),
|
|
74
|
+
...( Array.isArray( themeRatios ) ? themeRatios : [] ),
|
|
75
|
+
];
|
|
76
|
+
const presets = candidateRatios
|
|
77
|
+
.map( aspectRatioPresetFromSettings )
|
|
78
|
+
.filter( Boolean );
|
|
79
|
+
|
|
80
|
+
// Passing `undefined` lets the media editor use its fallback presets.
|
|
81
|
+
// Passing `[]` explicitly removes fixed presets when defaults are off.
|
|
82
|
+
if ( presets.length || showDefaultRatios === false ) {
|
|
83
|
+
return presets;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return undefined;
|
|
87
|
+
}, [ defaultRatios, themeRatios, showDefaultRatios ] );
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<MediaEditorModal
|
|
91
|
+
fields={ fields }
|
|
92
|
+
aspectRatioPresets={ aspectRatioPresets }
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -26,7 +26,7 @@ const getExternalLink = ( url, text ) =>
|
|
|
26
26
|
`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;
|
|
27
27
|
|
|
28
28
|
const getExternalLinkAttributes = ( url ) =>
|
|
29
|
-
`href="${ url }" target="_blank" rel="
|
|
29
|
+
`href="${ url }" target="_blank" rel="noopener"`;
|
|
30
30
|
|
|
31
31
|
const getOpenverseLicense = ( license, licenseVersion ) => {
|
|
32
32
|
let licenseName = license.trim();
|
|
@@ -5,17 +5,13 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
6
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
7
7
|
import { external, moreVertical } from '@wordpress/icons';
|
|
8
|
-
import {
|
|
9
|
-
MenuGroup,
|
|
10
|
-
MenuItem,
|
|
11
|
-
VisuallyHidden,
|
|
12
|
-
DropdownMenu,
|
|
13
|
-
} from '@wordpress/components';
|
|
8
|
+
import { MenuGroup, MenuItem, DropdownMenu } from '@wordpress/components';
|
|
14
9
|
import {
|
|
15
10
|
PreferenceToggleMenuItem,
|
|
16
11
|
store as preferencesStore,
|
|
17
12
|
} from '@wordpress/preferences';
|
|
18
13
|
import { store as interfaceStore, ActionItem } from '@wordpress/interface';
|
|
14
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
19
15
|
|
|
20
16
|
/**
|
|
21
17
|
* Internal dependencies
|
|
@@ -132,10 +128,10 @@ export default function MoreMenu( { disabled = false } ) {
|
|
|
132
128
|
'https://wordpress.org/documentation/article/wordpress-block-editor/'
|
|
133
129
|
) }
|
|
134
130
|
target="_blank"
|
|
135
|
-
rel="noopener
|
|
131
|
+
rel="noopener"
|
|
136
132
|
>
|
|
137
133
|
{ __( 'Help' ) }
|
|
138
|
-
<VisuallyHidden
|
|
134
|
+
<VisuallyHidden render={ <span /> }>
|
|
139
135
|
{
|
|
140
136
|
/* translators: accessibility text */
|
|
141
137
|
__( '(opens in a new tab)' )
|
|
@@ -5,7 +5,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
5
5
|
import { useMemo } from '@wordpress/element';
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
|
-
__experimentalText as
|
|
8
|
+
__experimentalText as WCText,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
__experimentalVStack as VStack,
|
|
11
11
|
} from '@wordpress/components';
|
|
@@ -92,7 +92,7 @@ const SetAsHomepageModal = ( { items, closeModal } ) => {
|
|
|
92
92
|
return (
|
|
93
93
|
<form onSubmit={ onSetPageAsHomepage }>
|
|
94
94
|
<VStack spacing="5">
|
|
95
|
-
<
|
|
95
|
+
<WCText>{ modalText }</WCText>
|
|
96
96
|
<HStack justify="right">
|
|
97
97
|
<Button
|
|
98
98
|
__next40pxDefaultSize
|
|
@@ -5,7 +5,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
5
5
|
import { useMemo } from '@wordpress/element';
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
|
-
__experimentalText as
|
|
8
|
+
__experimentalText as WCText,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
__experimentalVStack as VStack,
|
|
11
11
|
} from '@wordpress/components';
|
|
@@ -88,7 +88,7 @@ const SetAsPostsPageModal = ( { items, closeModal } ) => {
|
|
|
88
88
|
return (
|
|
89
89
|
<form onSubmit={ onSetPageAsPostsPage }>
|
|
90
90
|
<VStack spacing="5">
|
|
91
|
-
<
|
|
91
|
+
<WCText>{ modalText }</WCText>
|
|
92
92
|
<HStack justify="right">
|
|
93
93
|
<Button
|
|
94
94
|
__next40pxDefaultSize
|