@wordpress/editor 14.44.1-next.v.202604201441.0 → 14.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/collab-sidebar/{comment-menu-item.cjs → add-note-menu-item.cjs} +17 -14
- package/build/components/collab-sidebar/add-note-menu-item.cjs.map +7 -0
- package/build/components/collab-sidebar/{add-comment.cjs → add-note.cjs} +28 -41
- package/build/components/collab-sidebar/add-note.cjs.map +7 -0
- package/build/components/collab-sidebar/board-store.cjs +3 -0
- package/build/components/collab-sidebar/board-store.cjs.map +2 -2
- package/build/components/collab-sidebar/floating-container.cjs +4 -3
- package/build/components/collab-sidebar/floating-container.cjs.map +3 -3
- package/build/components/collab-sidebar/hooks.cjs +92 -135
- package/build/components/collab-sidebar/hooks.cjs.map +3 -3
- package/build/components/collab-sidebar/index.cjs +28 -79
- package/build/components/collab-sidebar/index.cjs.map +3 -3
- package/build/components/collab-sidebar/{comment-author-info.cjs → note-byline.cjs} +13 -9
- package/build/components/collab-sidebar/note-byline.cjs.map +7 -0
- package/build/components/collab-sidebar/note-card.cjs +58 -0
- package/build/components/collab-sidebar/note-card.cjs.map +7 -0
- package/build/components/collab-sidebar/{comment-form.cjs → note-form.cjs} +45 -36
- package/build/components/collab-sidebar/note-form.cjs.map +7 -0
- package/build/components/collab-sidebar/{comment-indicator-toolbar.cjs → note-indicator-toolbar.cjs} +31 -27
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +7 -0
- package/build/components/collab-sidebar/note-thread.cjs +321 -0
- package/build/components/collab-sidebar/note-thread.cjs.map +7 -0
- package/build/components/collab-sidebar/note.cjs +207 -0
- package/build/components/collab-sidebar/note.cjs.map +7 -0
- package/build/components/collab-sidebar/notes.cjs +237 -0
- package/build/components/collab-sidebar/notes.cjs.map +7 -0
- package/build/components/collab-sidebar/utils.cjs +23 -25
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/document-bar/index.cjs.map +3 -3
- package/build/components/error-boundary/index.cjs.map +3 -3
- package/build/components/list-view-sidebar/list-view-outline.cjs.map +3 -3
- package/build/components/media/media-editor-modal.cjs +93 -0
- package/build/components/media/media-editor-modal.cjs.map +7 -0
- package/build/components/more-menu/index.cjs +3 -2
- package/build/components/more-menu/index.cjs.map +2 -2
- package/build/components/post-actions/set-as-homepage.cjs.map +3 -3
- package/build/components/post-actions/set-as-posts-page.cjs.map +3 -3
- package/build/components/post-card-panel/index.cjs +2 -2
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-content-information/index.cjs.map +3 -3
- package/build/components/post-excerpt/panel.cjs.map +3 -3
- package/build/components/post-last-edited-panel/index.cjs.map +3 -3
- package/build/components/post-preview-button/index.cjs +3 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/index.cjs +2 -2
- package/build/components/post-publish-button/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +4 -2
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/postpublish.cjs +3 -2
- package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
- package/build/components/post-revisions-panel/index.cjs +2 -2
- package/build/components/post-revisions-panel/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +1 -1
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-slider.cjs +1 -0
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-saved-state/index.cjs +4 -1
- package/build/components/post-saved-state/index.cjs.map +2 -2
- package/build/components/post-text-editor/index.cjs +3 -4
- package/build/components/post-text-editor/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs +3 -2
- package/build/components/preview-dropdown/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +7 -1
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/provider/use-upload-save-lock.cjs +2 -12
- package/build/components/provider/use-upload-save-lock.cjs.map +2 -2
- package/build/components/resizable-editor/resize-handle.cjs +2 -1
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/revision-created-panel/index.cjs.map +3 -3
- package/build/components/site-discussion/index.cjs.map +2 -2
- package/build/components/template-actions-panel/classic-theme-content.cjs.map +2 -2
- package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
- package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +5 -22
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +0 -8
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +0 -5
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +0 -10
- package/build/store/reducer.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +3 -2
- package/build/utils/media-finalize/index.cjs.map +2 -2
- package/build/utils/media-upload/index.cjs +14 -25
- package/build/utils/media-upload/index.cjs.map +2 -2
- package/build-module/components/collab-sidebar/{comment-menu-item.mjs → add-note-menu-item.mjs} +10 -11
- package/build-module/components/collab-sidebar/add-note-menu-item.mjs.map +7 -0
- package/build-module/components/collab-sidebar/{add-comment.mjs → add-note.mjs} +26 -29
- package/build-module/components/collab-sidebar/add-note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/board-store.mjs +3 -0
- package/build-module/components/collab-sidebar/board-store.mjs.map +2 -2
- package/build-module/components/collab-sidebar/floating-container.mjs +4 -3
- package/build-module/components/collab-sidebar/floating-container.mjs.map +2 -2
- package/build-module/components/collab-sidebar/hooks.mjs +91 -137
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +29 -84
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/{comment-author-info.mjs → note-byline.mjs} +7 -7
- package/build-module/components/collab-sidebar/note-byline.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-card.mjs +33 -0
- package/build-module/components/collab-sidebar/note-card.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-form.mjs +84 -0
- package/build-module/components/collab-sidebar/note-form.mjs.map +7 -0
- package/build-module/components/collab-sidebar/{comment-indicator-toolbar.mjs → note-indicator-toolbar.mjs} +25 -29
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note-thread.mjs +289 -0
- package/build-module/components/collab-sidebar/note-thread.mjs.map +7 -0
- package/build-module/components/collab-sidebar/note.mjs +176 -0
- package/build-module/components/collab-sidebar/note.mjs.map +7 -0
- package/build-module/components/collab-sidebar/notes.mjs +215 -0
- package/build-module/components/collab-sidebar/notes.mjs.map +7 -0
- package/build-module/components/collab-sidebar/utils.mjs +19 -21
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/document-bar/index.mjs +3 -3
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/error-boundary/index.mjs +2 -2
- package/build-module/components/error-boundary/index.mjs.map +2 -2
- package/build-module/components/list-view-sidebar/list-view-outline.mjs +5 -5
- package/build-module/components/list-view-sidebar/list-view-outline.mjs.map +2 -2
- package/build-module/components/media/media-editor-modal.mjs +62 -0
- package/build-module/components/media/media-editor-modal.mjs.map +7 -0
- package/build-module/components/more-menu/index.mjs +3 -7
- package/build-module/components/more-menu/index.mjs.map +2 -2
- package/build-module/components/post-actions/set-as-homepage.mjs +2 -2
- package/build-module/components/post-actions/set-as-homepage.mjs.map +2 -2
- package/build-module/components/post-actions/set-as-posts-page.mjs +2 -2
- package/build-module/components/post-actions/set-as-posts-page.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +5 -5
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-content-information/index.mjs +2 -2
- package/build-module/components/post-content-information/index.mjs.map +2 -2
- package/build-module/components/post-excerpt/panel.mjs +2 -2
- package/build-module/components/post-excerpt/panel.mjs.map +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs +2 -2
- package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
- package/build-module/components/post-preview-button/index.mjs +3 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/index.mjs +2 -2
- package/build-module/components/post-publish-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +4 -2
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/postpublish.mjs +3 -3
- package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +2 -2
- package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +1 -1
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -0
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-saved-state/index.mjs +4 -1
- package/build-module/components/post-saved-state/index.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +2 -3
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +2 -2
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +7 -1
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-upload-save-lock.mjs +2 -12
- package/build-module/components/provider/use-upload-save-lock.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs +2 -5
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/revision-created-panel/index.mjs +2 -2
- package/build-module/components/revision-created-panel/index.mjs.map +2 -2
- package/build-module/components/site-discussion/index.mjs +2 -2
- package/build-module/components/site-discussion/index.mjs.map +2 -2
- package/build-module/components/template-actions-panel/classic-theme-content.mjs +2 -2
- package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +2 -2
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +5 -22
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +0 -7
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +0 -4
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +0 -9
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +3 -2
- package/build-module/utils/media-finalize/index.mjs.map +2 -2
- package/build-module/utils/media-upload/index.mjs +14 -25
- package/build-module/utils/media-upload/index.mjs.map +2 -2
- package/build-style/style-rtl.css +386 -142
- package/build-style/style.css +386 -142
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts +8 -21
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
- package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note.d.ts +9 -0
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/notes.d.ts +7 -0
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +21 -20
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +11 -0
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-saved-state/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/provider/use-upload-save-lock.d.ts +0 -2
- package/build-types/components/provider/use-upload-save-lock.d.ts.map +1 -1
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +0 -7
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +0 -7
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +0 -10
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/utils/media-finalize/index.d.ts +1 -1
- package/build-types/utils/media-finalize/index.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +46 -46
- package/src/components/collab-sidebar/README.md +117 -0
- package/src/components/collab-sidebar/{comment-menu-item.js → add-note-menu-item.js} +8 -10
- package/src/components/collab-sidebar/{add-comment.js → add-note.js} +20 -21
- package/src/components/collab-sidebar/board-store.js +4 -2
- package/src/components/collab-sidebar/floating-container.js +5 -4
- package/src/components/collab-sidebar/hooks.js +115 -175
- package/src/components/collab-sidebar/index.js +35 -95
- package/src/components/collab-sidebar/{comment-author-info.js → note-byline.js} +5 -6
- package/src/components/collab-sidebar/note-card.js +36 -0
- package/src/components/collab-sidebar/{comment-form.js → note-form.js} +25 -27
- package/src/components/collab-sidebar/{comment-indicator-toolbar.js → note-indicator-toolbar.js} +29 -32
- package/src/components/collab-sidebar/note-thread.js +331 -0
- package/src/components/collab-sidebar/note.js +209 -0
- package/src/components/collab-sidebar/notes.js +276 -0
- package/src/components/collab-sidebar/style.scss +21 -11
- package/src/components/collab-sidebar/test/utils.js +65 -63
- package/src/components/collab-sidebar/utils.js +33 -35
- package/src/components/document-bar/index.js +4 -4
- package/src/components/error-boundary/index.js +3 -3
- package/src/components/list-view-sidebar/list-view-outline.js +6 -6
- package/src/components/media/media-editor-modal.js +95 -0
- package/src/components/more-menu/index.js +3 -7
- package/src/components/post-actions/set-as-homepage.js +2 -2
- package/src/components/post-actions/set-as-posts-page.js +2 -2
- package/src/components/post-card-panel/index.js +7 -7
- package/src/components/post-content-information/index.js +3 -3
- package/src/components/post-excerpt/panel.js +3 -3
- package/src/components/post-last-edited-panel/index.js +3 -3
- package/src/components/post-preview-button/index.js +3 -2
- package/src/components/post-publish-button/index.js +6 -5
- package/src/components/post-publish-button/label.js +3 -1
- package/src/components/post-publish-panel/postpublish.js +2 -2
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +8 -14
- package/src/components/post-revisions-panel/index.js +3 -3
- package/src/components/post-revisions-preview/diff-markers.js +1 -1
- package/src/components/post-revisions-preview/revisions-slider.js +1 -0
- package/src/components/post-saved-state/index.js +4 -1
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -1
- package/src/components/post-text-editor/index.js +3 -3
- package/src/components/preview-dropdown/index.js +2 -2
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +10 -0
- package/src/components/provider/use-upload-save-lock.js +2 -17
- package/src/components/resizable-editor/resize-handle.js +2 -5
- package/src/components/revision-created-panel/index.js +3 -3
- package/src/components/site-discussion/index.js +3 -3
- package/src/components/template-actions-panel/classic-theme-content.js +3 -3
- package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
- package/src/components/visual-editor/index.js +2 -29
- package/src/store/private-actions.js +0 -13
- package/src/store/private-selectors.js +0 -10
- package/src/store/reducer.js +0 -16
- package/src/utils/media-finalize/index.js +2 -1
- package/src/utils/media-finalize/test/index.js +25 -1
- package/src/utils/media-upload/index.js +26 -29
- package/build/components/collab-sidebar/add-comment.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-author-info.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-form.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-indicator-toolbar.cjs.map +0 -7
- package/build/components/collab-sidebar/comment-menu-item.cjs.map +0 -7
- package/build/components/collab-sidebar/comments.cjs +0 -696
- package/build/components/collab-sidebar/comments.cjs.map +0 -7
- package/build-module/components/collab-sidebar/add-comment.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-author-info.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-form.mjs +0 -82
- package/build-module/components/collab-sidebar/comment-form.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-indicator-toolbar.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comment-menu-item.mjs.map +0 -7
- package/build-module/components/collab-sidebar/comments.mjs +0 -678
- package/build-module/components/collab-sidebar/comments.mjs.map +0 -7
- package/build-types/components/collab-sidebar/add-comment.d.ts +0 -6
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts +0 -9
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
- package/build-types/components/collab-sidebar/comments.d.ts +0 -10
- package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
- package/src/components/collab-sidebar/comments.js +0 -812
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { calculateNotePositions } from '../utils';
|
|
5
5
|
|
|
6
6
|
function makeRect( top ) {
|
|
7
7
|
return { top };
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
describe( '
|
|
11
|
-
it( 'returns empty
|
|
12
|
-
const {
|
|
10
|
+
describe( 'calculateNotePositions', () => {
|
|
11
|
+
it( 'returns empty positions when the anchor thread has no blockRect', () => {
|
|
12
|
+
const { positions } = calculateNotePositions( {
|
|
13
13
|
threads: [ { id: 1 } ],
|
|
14
14
|
selectedNoteId: undefined,
|
|
15
15
|
blockRects: {},
|
|
16
16
|
heights: {},
|
|
17
|
+
scrollTop: 0,
|
|
17
18
|
} );
|
|
18
|
-
expect(
|
|
19
|
-
expect( minHeight ).toBe( 0 );
|
|
19
|
+
expect( positions ).toEqual( {} );
|
|
20
20
|
} );
|
|
21
21
|
|
|
22
|
-
it( '
|
|
22
|
+
it( 'falls back to the first thread as anchor when none is selected', () => {
|
|
23
23
|
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
24
24
|
const blockRects = {
|
|
25
25
|
1: makeRect( 100 ),
|
|
@@ -28,68 +28,43 @@ describe( 'calculateAllOffsets', () => {
|
|
|
28
28
|
};
|
|
29
29
|
const heights = { 1: 50, 2: 50, 3: 50 };
|
|
30
30
|
|
|
31
|
-
const {
|
|
31
|
+
const { positions } = calculateNotePositions( {
|
|
32
32
|
threads,
|
|
33
33
|
selectedNoteId: undefined,
|
|
34
34
|
blockRects,
|
|
35
35
|
heights,
|
|
36
|
+
scrollTop: 0,
|
|
36
37
|
} );
|
|
37
38
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
expect(
|
|
42
|
-
expect( offsets[ 3 ] ).toBe( -16 );
|
|
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
43
|
} );
|
|
44
44
|
|
|
45
|
-
it( 'pushes
|
|
46
|
-
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
47
|
-
// Thread 2 selected; thread 3 starts inside thread 2's space.
|
|
48
|
-
const blockRects = {
|
|
49
|
-
1: makeRect( 100 ),
|
|
50
|
-
2: makeRect( 200 ),
|
|
51
|
-
3: makeRect( 220 ),
|
|
52
|
-
};
|
|
53
|
-
const heights = { 1: 50, 2: 80, 3: 50 };
|
|
54
|
-
|
|
55
|
-
const { offsets } = calculateAllOffsets( {
|
|
56
|
-
threads,
|
|
57
|
-
selectedNoteId: 2,
|
|
58
|
-
blockRects,
|
|
59
|
-
heights,
|
|
60
|
-
} );
|
|
61
|
-
|
|
62
|
-
expect( offsets[ 2 ] ).toBe( -16 );
|
|
63
|
-
// thread 3 overlaps thread 2: previous bottom = (200-16)+80 = 264.
|
|
64
|
-
// 220 < 264+16 = 280, so offset = 264 - 220 + 20 = 64.
|
|
65
|
-
expect( offsets[ 3 ] ).toBe( 64 );
|
|
66
|
-
} );
|
|
67
|
-
|
|
68
|
-
it( 'pushes neighbors above the selected thread upward when overlapping', () => {
|
|
45
|
+
it( 'pushes an overlapping thread above the anchor upward', () => {
|
|
69
46
|
const threads = [ { id: 1 }, { id: 2 } ];
|
|
70
|
-
// Thread 1 is tall and overlaps where thread 2 sits.
|
|
71
47
|
const blockRects = {
|
|
72
48
|
1: makeRect( 150 ),
|
|
73
49
|
2: makeRect( 180 ),
|
|
74
50
|
};
|
|
75
51
|
const heights = { 1: 60, 2: 50 };
|
|
76
52
|
|
|
77
|
-
const {
|
|
53
|
+
const { positions } = calculateNotePositions( {
|
|
78
54
|
threads,
|
|
79
55
|
selectedNoteId: 2,
|
|
80
56
|
blockRects,
|
|
81
57
|
heights,
|
|
58
|
+
scrollTop: 0,
|
|
82
59
|
} );
|
|
83
60
|
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
expect( offsets[ 1 ] ).toBe( -66 );
|
|
61
|
+
// 2 (anchor): 180 - 16 = 164
|
|
62
|
+
// 1 (upward): 164 - 60 - 20 = 84
|
|
63
|
+
expect( positions ).toEqual( { 1: 84, 2: 164 } );
|
|
88
64
|
} );
|
|
89
65
|
|
|
90
|
-
it( 'cascades
|
|
66
|
+
it( 'cascades downward offsets through consecutive overlapping threads', () => {
|
|
91
67
|
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
92
|
-
// All three threads are tightly packed.
|
|
93
68
|
const blockRects = {
|
|
94
69
|
1: makeRect( 100 ),
|
|
95
70
|
2: makeRect( 110 ),
|
|
@@ -97,57 +72,84 @@ describe( 'calculateAllOffsets', () => {
|
|
|
97
72
|
};
|
|
98
73
|
const heights = { 1: 80, 2: 80, 3: 80 };
|
|
99
74
|
|
|
100
|
-
const {
|
|
75
|
+
const { positions } = calculateNotePositions( {
|
|
101
76
|
threads,
|
|
102
77
|
selectedNoteId: 1,
|
|
103
78
|
blockRects,
|
|
104
79
|
heights,
|
|
80
|
+
scrollTop: 0,
|
|
105
81
|
} );
|
|
106
82
|
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
expect( offsets[ 3 ] ).toBe( 164 );
|
|
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 } );
|
|
112
87
|
} );
|
|
113
88
|
|
|
114
|
-
it( '
|
|
89
|
+
it( 'omits threads that have no blockRect', () => {
|
|
115
90
|
const threads = [ { id: 1 }, { id: 2 }, { id: 3 } ];
|
|
116
91
|
const blockRects = {
|
|
117
92
|
1: makeRect( 100 ),
|
|
118
|
-
// id 2 is missing
|
|
119
93
|
3: makeRect( 500 ),
|
|
120
94
|
};
|
|
121
95
|
const heights = { 1: 50, 3: 50 };
|
|
122
96
|
|
|
123
|
-
const {
|
|
97
|
+
const { positions } = calculateNotePositions( {
|
|
124
98
|
threads,
|
|
125
99
|
selectedNoteId: 1,
|
|
126
100
|
blockRects,
|
|
127
101
|
heights,
|
|
102
|
+
scrollTop: 0,
|
|
128
103
|
} );
|
|
129
104
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
expect(
|
|
105
|
+
// 1: 100 - 16 = 84
|
|
106
|
+
// 3: 500 - 16 = 484
|
|
107
|
+
expect( positions ).toEqual( { 1: 84, 3: 484 } );
|
|
133
108
|
} );
|
|
134
109
|
|
|
135
|
-
it( '
|
|
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
136
|
const threads = [ { id: 1 }, { id: 2 } ];
|
|
137
137
|
const blockRects = {
|
|
138
138
|
1: makeRect( 100 ),
|
|
139
|
-
2: makeRect(
|
|
139
|
+
2: makeRect( 300 ),
|
|
140
140
|
};
|
|
141
|
-
const heights = { 1: 50, 2:
|
|
141
|
+
const heights = { 1: 50, 2: 50 };
|
|
142
142
|
|
|
143
|
-
const {
|
|
143
|
+
const { positions } = calculateNotePositions( {
|
|
144
144
|
threads,
|
|
145
145
|
selectedNoteId: 1,
|
|
146
146
|
blockRects,
|
|
147
147
|
heights,
|
|
148
|
+
scrollTop: 500,
|
|
148
149
|
} );
|
|
149
150
|
|
|
150
|
-
//
|
|
151
|
-
|
|
151
|
+
// 1: 100 + 500 - 16 = 584
|
|
152
|
+
// 2: 300 + 500 - 16 = 784
|
|
153
|
+
expect( positions ).toEqual( { 1: 584, 2: 784 } );
|
|
152
154
|
} );
|
|
153
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
16
|
const THREAD_ALIGN_OFFSET = -16;
|
|
17
17
|
const THREAD_GAP = 16;
|
|
18
18
|
const OVERLAP_MARGIN = 20;
|
|
19
|
-
const BOARD_BOTTOM_PADDING = 32;
|
|
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,22 +91,24 @@ export function getCommentExcerpt( text, excerptLength = 10 ) {
|
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
/**
|
|
95
|
-
* Calculate
|
|
96
|
-
*
|
|
97
|
-
* and threads below it downward.
|
|
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.
|
|
98
97
|
*
|
|
99
98
|
* @param {Object} params
|
|
100
99
|
* @param {Array} params.threads Ordered list of thread objects.
|
|
101
100
|
* @param {string|number|undefined} params.selectedNoteId ID of the currently selected thread.
|
|
102
101
|
* @param {Object<string,DOMRect>} params.blockRects Pre-read bounding rects keyed by thread ID.
|
|
103
102
|
* @param {Object<string,number>} params.heights Rendered heights keyed by thread ID.
|
|
104
|
-
* @
|
|
103
|
+
* @param {number} params.scrollTop Current scroll offset of the editor content.
|
|
104
|
+
* @return {{ positions: Object<string,number> }} Computed top positions.
|
|
105
105
|
*/
|
|
106
|
-
export function
|
|
106
|
+
export function calculateNotePositions( {
|
|
107
107
|
threads,
|
|
108
108
|
selectedNoteId,
|
|
109
109
|
blockRects,
|
|
110
110
|
heights,
|
|
111
|
+
scrollTop = 0,
|
|
111
112
|
} ) {
|
|
112
113
|
const offsets = {};
|
|
113
114
|
|
|
@@ -119,7 +120,7 @@ export function calculateAllOffsets( {
|
|
|
119
120
|
const anchorThread = threads[ anchorIndex ];
|
|
120
121
|
|
|
121
122
|
if ( ! anchorThread || ! blockRects[ anchorThread.id ] ) {
|
|
122
|
-
return {
|
|
123
|
+
return { positions: {} };
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
const anchorRect = blockRects[ anchorThread.id ];
|
|
@@ -182,42 +183,39 @@ export function calculateAllOffsets( {
|
|
|
182
183
|
belowAdjustedTop = threadTop + offset;
|
|
183
184
|
}
|
|
184
185
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
lastThreadHeight +
|
|
195
|
-
lastThreadOffset +
|
|
196
|
-
BOARD_BOTTOM_PADDING;
|
|
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
|
+
}
|
|
197
195
|
}
|
|
198
196
|
|
|
199
|
-
return {
|
|
197
|
+
return { positions };
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
/**
|
|
203
|
-
* Shift focus to the
|
|
201
|
+
* Shift focus to the note thread associated with a particular note ID.
|
|
204
202
|
* If an additional selector is provided, the focus will be shifted to the element matching the selector.
|
|
205
203
|
*
|
|
206
204
|
* @typedef {import('@wordpress/element').RefObject} RefObject
|
|
207
205
|
*
|
|
208
|
-
* @param {string}
|
|
206
|
+
* @param {string} noteId The ID of the note thread to focus.
|
|
209
207
|
* @param {?HTMLElement} container The container element to search within.
|
|
210
208
|
* @param {string} additionalSelector The additional selector to focus on.
|
|
211
209
|
*/
|
|
212
|
-
export function
|
|
210
|
+
export function focusNoteThread( noteId, container, additionalSelector ) {
|
|
213
211
|
if ( ! container ) {
|
|
214
212
|
return;
|
|
215
213
|
}
|
|
216
214
|
|
|
217
|
-
// A thread without a
|
|
215
|
+
// A thread without a noteId is a new note thread.
|
|
218
216
|
const threadSelector =
|
|
219
|
-
|
|
220
|
-
? `[role=treeitem][id="
|
|
217
|
+
noteId && noteId !== 'new'
|
|
218
|
+
? `[role=treeitem][id="note-thread-${ noteId }"]`
|
|
221
219
|
: '[role=treeitem]:not([id])';
|
|
222
220
|
const selector = additionalSelector
|
|
223
221
|
? `${ threadSelector } ${ additionalSelector }`
|
|
@@ -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
|
+
}
|
|
@@ -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
|
|
@@ -135,7 +131,7 @@ export default function MoreMenu( { disabled = false } ) {
|
|
|
135
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
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
Button,
|
|
7
7
|
__experimentalHStack as HStack,
|
|
8
8
|
__experimentalVStack as VStack,
|
|
9
|
-
__experimentalText as
|
|
9
|
+
__experimentalText as WCText,
|
|
10
10
|
privateApis as componentsPrivateApis,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { close } from '@wordpress/icons';
|
|
@@ -28,7 +28,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
28
28
|
import PostActions from '../post-actions';
|
|
29
29
|
import usePageTypeBadge from '../../utils/pageTypeBadge';
|
|
30
30
|
import { getTemplateInfo } from '../../utils/get-template-info';
|
|
31
|
-
const { Badge } = unlock( componentsPrivateApis );
|
|
31
|
+
const { Badge: WCBadge } = unlock( componentsPrivateApis );
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Renders a title of the post type and the available quick actions available within a 3-dot dropdown.
|
|
@@ -131,7 +131,7 @@ export default function PostCardPanel( {
|
|
|
131
131
|
alignment="flex-start"
|
|
132
132
|
>
|
|
133
133
|
<Icon className="editor-post-card-panel__icon" icon={ icon } />
|
|
134
|
-
<
|
|
134
|
+
<WCText
|
|
135
135
|
numberOfLines={ 2 }
|
|
136
136
|
truncate
|
|
137
137
|
className="editor-post-card-panel__title"
|
|
@@ -141,9 +141,9 @@ export default function PostCardPanel( {
|
|
|
141
141
|
{ title }
|
|
142
142
|
</span>
|
|
143
143
|
{ pageTypeBadge && postIds.length === 1 && (
|
|
144
|
-
<
|
|
144
|
+
<WCBadge>{ pageTypeBadge }</WCBadge>
|
|
145
145
|
) }
|
|
146
|
-
</
|
|
146
|
+
</WCText>
|
|
147
147
|
{ ! hideActions && postIds.length === 1 && (
|
|
148
148
|
<PostActions
|
|
149
149
|
postType={ postType }
|
|
@@ -161,13 +161,13 @@ export default function PostCardPanel( {
|
|
|
161
161
|
) }
|
|
162
162
|
</HStack>
|
|
163
163
|
{ postIds.length > 1 && (
|
|
164
|
-
<
|
|
164
|
+
<WCText className="editor-post-card-panel__description">
|
|
165
165
|
{ sprintf(
|
|
166
166
|
// translators: %s: Name of the plural post type e.g: "Posts".
|
|
167
167
|
__( 'Changes will be applied to all selected %s.' ),
|
|
168
168
|
labels?.name.toLowerCase()
|
|
169
169
|
) }
|
|
170
|
-
</
|
|
170
|
+
</WCText>
|
|
171
171
|
) }
|
|
172
172
|
</VStack>
|
|
173
173
|
);
|