@wordpress/editor 14.45.2-next.v.202605131032.0 → 14.47.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 +12 -1
- package/build/components/collab-sidebar/add-note.cjs +6 -0
- package/build/components/collab-sidebar/add-note.cjs.map +2 -2
- package/build/components/collab-sidebar/hooks.cjs +36 -24
- package/build/components/collab-sidebar/hooks.cjs.map +2 -2
- package/build/components/collab-sidebar/index.cjs +19 -10
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-byline.cjs +16 -9
- package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
- package/build/components/collab-sidebar/notes.cjs +20 -11
- package/build/components/collab-sidebar/notes.cjs.map +2 -2
- package/build/components/collab-sidebar/utils.cjs +42 -2
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +39 -15
- package/build/components/collaborators-overlay/compute-selection.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +10 -2
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-render-cursors.cjs +15 -7
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs +5 -1
- package/build/components/collaborators-presence/avatar/component.cjs.map +3 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +6 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
- package/build/components/editor-interface/index.cjs +17 -16
- package/build/components/editor-interface/index.cjs.map +3 -3
- package/build/components/editor-notices/index.cjs +6 -1
- package/build/components/editor-notices/index.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +12 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/header/index.cjs +11 -6
- package/build/components/header/index.cjs.map +2 -2
- package/build/components/media/media-editor-modal.cjs +14 -1
- package/build/components/media/media-editor-modal.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +7 -1
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-last-revision/index.cjs +28 -8
- package/build/components/post-last-revision/index.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +9 -6
- package/build/components/post-locked-modal/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +0 -7
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/prepublish.cjs +8 -1
- package/build/components/post-publish-panel/prepublish.cjs.map +3 -3
- package/build/components/post-revisions-panel/index.cjs +7 -0
- package/build/components/post-revisions-panel/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +21 -13
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +7 -1
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
- package/build/components/post-taxonomies/check.cjs +1 -2
- package/build/components/post-taxonomies/check.cjs.map +2 -2
- package/build/components/post-taxonomies/index.cjs +1 -2
- package/build/components/post-taxonomies/index.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +1 -1
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs.map +3 -3
- package/build/components/provider/index.cjs +5 -21
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +16 -9
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/resizable-editor/resize-handle.cjs +24 -16
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/sidebar/header.cjs +16 -21
- package/build/components/sidebar/header.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +2 -6
- package/build/components/sidebar/index.cjs.map +2 -2
- package/build/components/start-page-options/index.cjs +14 -4
- package/build/components/start-page-options/index.cjs.map +2 -2
- package/build/components/start-template-options/index.cjs +8 -6
- package/build/components/start-template-options/index.cjs.map +2 -2
- package/build/components/styles-canvas/style-book.cjs +59 -2
- package/build/components/styles-canvas/style-book.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +10 -7
- package/build/components/sync-connection-error-modal/index.cjs.map +3 -3
- package/build/components/template-actions-panel/block-theme-content.cjs +21 -12
- package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +17 -1
- package/build/store/private-actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs +18 -0
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/selectors.cjs +0 -17
- package/build/store/selectors.cjs.map +2 -2
- package/build/{components/media → utils/media-delete}/index.cjs +12 -13
- package/build/utils/media-delete/index.cjs.map +7 -0
- package/build/utils/media-finalize/index.cjs +3 -1
- package/build/utils/media-finalize/index.cjs.map +2 -2
- package/build/utils/sync-error-messages.cjs +9 -0
- package/build/utils/sync-error-messages.cjs.map +2 -2
- package/build-module/components/collab-sidebar/add-note.mjs +6 -0
- package/build-module/components/collab-sidebar/add-note.mjs.map +2 -2
- package/build-module/components/collab-sidebar/hooks.mjs +42 -25
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +19 -10
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-byline.mjs +17 -10
- package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
- package/build-module/components/collab-sidebar/notes.mjs +26 -13
- package/build-module/components/collab-sidebar/notes.mjs.map +2 -2
- package/build-module/components/collab-sidebar/utils.mjs +38 -2
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +36 -12
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +10 -3
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +11 -6
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs +7 -3
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +6 -3
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/editor-interface/index.mjs +22 -17
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/editor-notices/index.mjs +6 -1
- package/build-module/components/editor-notices/index.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +12 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/header/index.mjs +11 -6
- package/build-module/components/header/index.mjs.map +2 -2
- package/build-module/components/media/media-editor-modal.mjs +14 -1
- package/build-module/components/media/media-editor-modal.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +8 -2
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-last-revision/index.mjs +29 -9
- package/build-module/components/post-last-revision/index.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +9 -6
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +0 -7
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/prepublish.mjs +9 -2
- package/build-module/components/post-publish-panel/prepublish.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +7 -0
- package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +22 -14
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +7 -1
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-taxonomies/check.mjs +1 -2
- package/build-module/components/post-taxonomies/check.mjs.map +2 -2
- package/build-module/components/post-taxonomies/index.mjs +1 -2
- package/build-module/components/post-taxonomies/index.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +1 -1
- package/build-module/components/preferences-modal/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 +6 -22
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +16 -9
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs +26 -18
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/sidebar/header.mjs +11 -16
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +2 -7
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/start-page-options/index.mjs +14 -4
- package/build-module/components/start-page-options/index.mjs.map +2 -2
- package/build-module/components/start-template-options/index.mjs +8 -6
- package/build-module/components/start-template-options/index.mjs.map +2 -2
- package/build-module/components/styles-canvas/style-book.mjs +60 -3
- package/build-module/components/styles-canvas/style-book.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +14 -8
- package/build-module/components/sync-connection-error-modal/index.mjs.map +2 -2
- package/build-module/components/template-actions-panel/block-theme-content.mjs +21 -13
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +16 -1
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +18 -0
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +0 -16
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-delete/index.mjs +12 -0
- package/build-module/utils/media-delete/index.mjs.map +7 -0
- package/build-module/utils/media-finalize/index.mjs +3 -1
- package/build-module/utils/media-finalize/index.mjs.map +2 -2
- package/build-module/utils/sync-error-messages.mjs +8 -0
- package/build-module/utils/sync-error-messages.mjs.map +2 -2
- package/build-style/style-rtl.css +462 -408
- package/build-style/style.css +462 -408
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -1
- 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 +3 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/utils.d.ts +33 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +3 -0
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/editor-notices/index.d.ts.map +1 -1
- package/build-types/components/global-styles/hooks.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +6 -2
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts +1 -6
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +1 -6
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -6
- package/build-types/components/post-taxonomies/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/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/styles-canvas/style-book.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts +0 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +15 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +10 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +0 -10
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/media-delete/index.d.ts +2 -0
- package/build-types/utils/media-delete/index.d.ts.map +1 -0
- 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/sync-error-messages.d.ts +1 -0
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +48 -48
- package/src/components/collab-sidebar/add-note.js +9 -0
- package/src/components/collab-sidebar/hooks.js +53 -29
- package/src/components/collab-sidebar/index.js +28 -14
- package/src/components/collab-sidebar/note-byline.js +15 -10
- package/src/components/collab-sidebar/notes.js +36 -14
- package/src/components/collab-sidebar/test/utils.js +375 -1
- package/src/components/collab-sidebar/utils.js +70 -1
- package/src/components/collaborators-overlay/compute-selection.ts +67 -19
- package/src/components/collaborators-overlay/use-block-highlighting.ts +14 -1
- package/src/components/collaborators-overlay/use-render-cursors.ts +15 -4
- package/src/components/collaborators-presence/avatar/component.tsx +10 -3
- package/src/components/collaborators-presence/avatar/test/index.tsx +50 -18
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +4 -1
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +2 -1
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +6 -4
- package/src/components/editor-help/help-topic-row.native.js +2 -2
- package/src/components/editor-interface/index.js +22 -23
- package/src/components/editor-interface/style.scss +4 -0
- package/src/components/editor-notices/index.js +7 -1
- package/src/components/error-boundary/index.native.js +2 -2
- package/src/components/global-styles/hooks.js +26 -0
- package/src/components/global-styles-sidebar/style.scss +0 -9
- package/src/components/header/index.js +12 -12
- package/src/components/media/media-editor-modal.js +20 -2
- package/src/components/offline-status/index.native.js +2 -2
- package/src/components/post-card-panel/index.js +5 -2
- package/src/components/post-last-revision/index.js +37 -9
- package/src/components/post-last-revision/style.scss +0 -3
- package/src/components/post-locked-modal/index.js +8 -5
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-publish-button/label.js +0 -11
- package/src/components/post-publish-panel/prepublish.js +6 -2
- package/src/components/post-revisions-panel/index.js +8 -0
- package/src/components/post-revisions-preview/diff-markers.js +17 -11
- package/src/components/post-revisions-preview/revisions-canvas.js +7 -1
- package/src/components/post-revisions-preview/style.scss +4 -4
- package/src/components/post-taxonomies/check.js +1 -2
- package/src/components/post-taxonomies/index.js +1 -2
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preview-dropdown/index.js +2 -2
- package/src/components/provider/index.js +10 -31
- package/src/components/provider/use-block-editor-settings.js +19 -12
- package/src/components/resizable-editor/resize-handle.js +22 -16
- package/src/components/sidebar/header.js +18 -28
- package/src/components/sidebar/index.js +5 -14
- package/src/components/start-page-options/index.js +19 -4
- package/src/components/start-template-options/index.js +13 -6
- package/src/components/styles-canvas/style-book.js +75 -13
- package/src/components/sync-connection-error-modal/index.tsx +25 -11
- package/src/components/template-actions-panel/block-theme-content.js +19 -13
- package/src/components/text-editor/style.scss +2 -2
- package/src/dataviews/store/private-actions.ts +0 -1
- package/src/store/private-actions.js +27 -0
- package/src/store/private-selectors.js +26 -0
- package/src/store/selectors.js +0 -24
- package/src/store/test/actions.js +34 -0
- package/src/utils/media-delete/index.js +11 -0
- package/src/utils/media-finalize/index.js +6 -1
- package/src/utils/media-finalize/test/index.js +32 -2
- package/src/utils/sync-error-messages.ts +8 -0
- package/src/utils/test/sync-error-messages.js +1 -0
- package/build/components/global-styles-provider/index.cjs +0 -181
- package/build/components/global-styles-provider/index.cjs.map +0 -7
- package/build/components/media/index.cjs.map +0 -7
- package/build/components/media/metadata-panel.cjs +0 -96
- package/build/components/media/metadata-panel.cjs.map +0 -7
- package/build/components/media/preview.cjs +0 -39
- package/build/components/media/preview.cjs.map +0 -7
- package/build-module/components/global-styles-provider/index.mjs +0 -156
- package/build-module/components/global-styles-provider/index.mjs.map +0 -7
- package/build-module/components/media/index.mjs +0 -8
- package/build-module/components/media/index.mjs.map +0 -7
- package/build-module/components/media/metadata-panel.mjs +0 -65
- package/build-module/components/media/metadata-panel.mjs.map +0 -7
- package/build-module/components/media/preview.mjs +0 -21
- package/build-module/components/media/preview.mjs.map +0 -7
- package/build-types/components/global-styles-provider/index.d.ts +0 -16
- package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
- package/build-types/components/media/index.d.ts +0 -3
- package/build-types/components/media/index.d.ts.map +0 -1
- package/build-types/components/media/metadata-panel.d.ts +0 -12
- package/build-types/components/media/metadata-panel.d.ts.map +0 -1
- package/build-types/components/media/preview.d.ts +0 -9
- package/build-types/components/media/preview.d.ts.map +0 -1
- package/src/components/global-styles-provider/index.js +0 -207
- package/src/components/media/index.js +0 -2
- package/src/components/media/metadata-panel.js +0 -77
- package/src/components/media/preview.js +0 -35
|
@@ -10,8 +10,10 @@ extend( [ a11yPlugin ] );
|
|
|
10
10
|
/**
|
|
11
11
|
* WordPress dependencies
|
|
12
12
|
*/
|
|
13
|
-
import { Icon
|
|
13
|
+
import { Icon as WCIcon } from '@wordpress/components';
|
|
14
14
|
import { useMemo } from '@wordpress/element';
|
|
15
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
16
|
+
import { Tooltip } from '@wordpress/ui';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Internal dependencies
|
|
@@ -104,7 +106,7 @@ function Avatar( {
|
|
|
104
106
|
</span>
|
|
105
107
|
{ dimmed && !! statusIndicator && (
|
|
106
108
|
<span className="editor-avatar__status-indicator">
|
|
107
|
-
<
|
|
109
|
+
<WCIcon icon={ statusIndicator } />
|
|
108
110
|
</span>
|
|
109
111
|
) }
|
|
110
112
|
{ showBadge && (
|
|
@@ -114,7 +116,12 @@ function Avatar( {
|
|
|
114
116
|
);
|
|
115
117
|
|
|
116
118
|
if ( name && ( ! showBadge || label ) ) {
|
|
117
|
-
return
|
|
119
|
+
return (
|
|
120
|
+
<Tooltip.Root>
|
|
121
|
+
<Tooltip.Trigger render={ avatar } />
|
|
122
|
+
<Tooltip.Popup>{ name }</Tooltip.Popup>
|
|
123
|
+
</Tooltip.Root>
|
|
124
|
+
);
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
return avatar;
|
|
@@ -2,12 +2,29 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
11
|
+
import { Tooltip } from '@wordpress/ui';
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* Internal dependencies
|
|
8
15
|
*/
|
|
9
16
|
import Avatar from '..';
|
|
10
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Wraps the avatar in a `Tooltip.Provider` with `delay={ 0 }` so hover-based
|
|
20
|
+
* tooltip-presence assertions don't have to wait for the real-world delay.
|
|
21
|
+
*
|
|
22
|
+
* @param ui The avatar element (or anything else) to render.
|
|
23
|
+
*/
|
|
24
|
+
function renderAvatar( ui: React.ReactElement ): ReturnType< typeof render > {
|
|
25
|
+
return render( <Tooltip.Provider delay={ 0 }>{ ui }</Tooltip.Provider> );
|
|
26
|
+
}
|
|
27
|
+
|
|
11
28
|
/**
|
|
12
29
|
* In JSDOM, `<img>` elements never fire `load` or `error` events on their
|
|
13
30
|
* own. We simulate them using `fireEvent` on the `<img>` element, which we
|
|
@@ -190,12 +207,13 @@ describe( 'Avatar', () => {
|
|
|
190
207
|
expect( avatar ).toBeInTheDocument();
|
|
191
208
|
} );
|
|
192
209
|
|
|
193
|
-
it( 'should wrap in tooltip when label differs from name', () => {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
210
|
+
it( 'should wrap in tooltip when label differs from name', async () => {
|
|
211
|
+
const user = userEvent.setup();
|
|
212
|
+
renderAvatar(
|
|
213
|
+
<Avatar name="Jane Doe" label="You" variant="badge" />
|
|
214
|
+
);
|
|
215
|
+
await user.hover( screen.getByRole( 'img', { name: 'Jane Doe' } ) );
|
|
216
|
+
expect( await screen.findByText( 'Jane Doe' ) ).toBeVisible();
|
|
199
217
|
} );
|
|
200
218
|
} );
|
|
201
219
|
|
|
@@ -367,23 +385,37 @@ describe( 'Avatar', () => {
|
|
|
367
385
|
} );
|
|
368
386
|
|
|
369
387
|
describe( 'tooltip', () => {
|
|
370
|
-
it( 'should wrap in tooltip when name is provided without badge', () => {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
388
|
+
it( 'should wrap in tooltip when name is provided without badge', async () => {
|
|
389
|
+
const user = userEvent.setup();
|
|
390
|
+
renderAvatar( <Avatar name="Jane Doe" /> );
|
|
391
|
+
await user.hover( screen.getByRole( 'img', { name: 'Jane Doe' } ) );
|
|
392
|
+
expect( await screen.findByText( 'Jane Doe' ) ).toBeVisible();
|
|
374
393
|
} );
|
|
375
394
|
|
|
376
|
-
it( 'should not wrap in tooltip for badge without label', () => {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
//
|
|
380
|
-
|
|
395
|
+
it( 'should not wrap in tooltip for badge without label', async () => {
|
|
396
|
+
const user = userEvent.setup();
|
|
397
|
+
renderAvatar( <Avatar name="Jane Doe" variant="badge" /> );
|
|
398
|
+
// Before hovering: the single "Jane Doe" occurrence is the
|
|
399
|
+
// badge text — that's what the next assertion is allowed to
|
|
400
|
+
// match. Hovering should not add a second occurrence.
|
|
401
|
+
expect( screen.getAllByText( 'Jane Doe' ) ).toHaveLength( 1 );
|
|
402
|
+
await user.hover( screen.getByRole( 'img', { name: 'Jane Doe' } ) );
|
|
403
|
+
expect( screen.getAllByText( 'Jane Doe' ) ).toHaveLength( 1 );
|
|
381
404
|
} );
|
|
382
405
|
|
|
383
|
-
it( 'should not wrap in tooltip when name is not provided', () => {
|
|
384
|
-
|
|
406
|
+
it( 'should not wrap in tooltip when name is not provided', async () => {
|
|
407
|
+
const user = userEvent.setup();
|
|
408
|
+
renderAvatar( <Avatar data-testid="avatar" /> );
|
|
385
409
|
const avatar = screen.getByTestId( 'avatar' );
|
|
386
|
-
|
|
410
|
+
const bodyTextBefore = document.body.textContent;
|
|
411
|
+
await user.hover( avatar );
|
|
412
|
+
// No name → no `Tooltip.Root` wrapper at all, so hovering
|
|
413
|
+
// cannot reveal any additional text content anywhere in the
|
|
414
|
+
// document (no popup mounts). Strict equality is what we
|
|
415
|
+
// want here — a substring `toHaveTextContent` would still
|
|
416
|
+
// pass if the popup added text.
|
|
417
|
+
// eslint-disable-next-line jest-dom/prefer-to-have-text-content -- intentional, see comment above.
|
|
418
|
+
expect( document.body.textContent ).toBe( bodyTextBefore );
|
|
387
419
|
} );
|
|
388
420
|
} );
|
|
389
421
|
} );
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
height: $button-size-compact;
|
|
9
9
|
background: $gray-100;
|
|
10
10
|
border-radius: $grid-unit-05;
|
|
11
|
-
margin-right: $grid-unit-10;
|
|
12
11
|
|
|
13
12
|
&:hover {
|
|
14
13
|
background-color: $gray-200;
|
|
@@ -19,6 +18,10 @@
|
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
.editor-header__center .editor-collaborators-presence {
|
|
22
|
+
margin-right: $grid-unit-10;
|
|
23
|
+
}
|
|
24
|
+
|
|
22
25
|
.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button {
|
|
23
26
|
display: flex;
|
|
24
27
|
align-items: center;
|
|
@@ -52,7 +52,8 @@ jest.mock( '@wordpress/core-data', () => ( {
|
|
|
52
52
|
} ) );
|
|
53
53
|
|
|
54
54
|
jest.mock( '../../../lock-unlock', () => ( {
|
|
55
|
-
unlock: jest.fn( () => ( {
|
|
55
|
+
unlock: jest.fn( ( value: unknown ) => ( {
|
|
56
|
+
...( value as object ),
|
|
56
57
|
useOnCollaboratorJoin: jest.fn(
|
|
57
58
|
( postId: unknown, _postType: unknown, callback: Function ) => {
|
|
58
59
|
lastJoinPostId = postId;
|
|
@@ -70,13 +70,15 @@ export function useCollaboratorNotifications(
|
|
|
70
70
|
): void {
|
|
71
71
|
const { postStatus, isCollaborationEnabled, showNotifications } = useSelect(
|
|
72
72
|
( select ) => {
|
|
73
|
-
const
|
|
73
|
+
const {
|
|
74
|
+
getCurrentPostAttribute,
|
|
75
|
+
isCollaborationEnabledForCurrentPost,
|
|
76
|
+
} = unlock( select( editorStore ) );
|
|
74
77
|
return {
|
|
75
|
-
postStatus:
|
|
78
|
+
postStatus: getCurrentPostAttribute( 'status' ) as
|
|
76
79
|
| string
|
|
77
80
|
| undefined,
|
|
78
|
-
isCollaborationEnabled:
|
|
79
|
-
editorSel.isCollaborationEnabledForCurrentPost(),
|
|
81
|
+
isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
|
|
80
82
|
showNotifications:
|
|
81
83
|
select( preferencesStore ).get(
|
|
82
84
|
'core',
|
|
@@ -6,7 +6,7 @@ import { useNavigation } from '@react-navigation/native';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { TextControl, Icon } from '@wordpress/components';
|
|
9
|
+
import { TextControl, Icon as WCIcon } from '@wordpress/components';
|
|
10
10
|
import { chevronRight } from '@wordpress/icons';
|
|
11
11
|
|
|
12
12
|
const HelpTopicRow = ( { label, icon, screenName, isLastItem } ) => {
|
|
@@ -25,7 +25,7 @@ const HelpTopicRow = ( { label, icon, screenName, isLastItem } ) => {
|
|
|
25
25
|
label={ label }
|
|
26
26
|
icon={ icon }
|
|
27
27
|
>
|
|
28
|
-
<
|
|
28
|
+
<WCIcon icon={ chevronRight } />
|
|
29
29
|
</TextControl>
|
|
30
30
|
);
|
|
31
31
|
};
|
|
@@ -10,7 +10,11 @@ import { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';
|
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
BlockBreadcrumb,
|
|
15
|
+
BlockToolbar,
|
|
16
|
+
store as blockEditorStore,
|
|
17
|
+
} from '@wordpress/block-editor';
|
|
14
18
|
import { useViewportMatch } from '@wordpress/compose';
|
|
15
19
|
import { useState, useCallback } from '@wordpress/element';
|
|
16
20
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -32,7 +36,6 @@ import SavePublishPanels from '../save-publish-panels';
|
|
|
32
36
|
import TextEditor from '../text-editor';
|
|
33
37
|
import VisualEditor from '../visual-editor';
|
|
34
38
|
import StylesCanvas from '../styles-canvas';
|
|
35
|
-
import { MediaPreview } from '../media';
|
|
36
39
|
|
|
37
40
|
const interfaceLabels = {
|
|
38
41
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
@@ -47,14 +50,21 @@ const interfaceLabels = {
|
|
|
47
50
|
footer: __( 'Editor footer' ),
|
|
48
51
|
};
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
function Notices() {
|
|
54
|
+
const isValidTemplate = useSelect( ( select ) => {
|
|
55
|
+
return select( blockEditorStore ).isValidTemplate();
|
|
56
|
+
}, [] );
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<InlineNotices
|
|
60
|
+
className="editor-notices"
|
|
61
|
+
pinnedNoticesClassName="editor-notices__pinned"
|
|
62
|
+
dismissibleNoticesClassName="editor-notices__dismissible"
|
|
63
|
+
>
|
|
64
|
+
{ ! isValidTemplate && <TemplateValidationNotice /> }
|
|
65
|
+
</InlineNotices>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
58
68
|
|
|
59
69
|
export default function EditorInterface( {
|
|
60
70
|
className,
|
|
@@ -72,7 +82,6 @@ export default function EditorInterface( {
|
|
|
72
82
|
mode,
|
|
73
83
|
postId,
|
|
74
84
|
postType,
|
|
75
|
-
isAttachment,
|
|
76
85
|
isInserterOpened,
|
|
77
86
|
isListViewOpened,
|
|
78
87
|
isDistractionFree,
|
|
@@ -119,9 +128,6 @@ export default function EditorInterface( {
|
|
|
119
128
|
postTypeLabel: getPostTypeLabel(),
|
|
120
129
|
stylesPath: getStylesPath(),
|
|
121
130
|
showStylebook: getShowStylebook(),
|
|
122
|
-
isAttachment:
|
|
123
|
-
getCurrentPostType() === 'attachment' &&
|
|
124
|
-
window?.__experimentalMediaEditor,
|
|
125
131
|
isRevisionsMode: _isRevisionsMode(),
|
|
126
132
|
showDiff: isShowingRevisionDiff(),
|
|
127
133
|
};
|
|
@@ -136,12 +142,9 @@ export default function EditorInterface( {
|
|
|
136
142
|
const secondarySidebarLabel = isListViewOpened
|
|
137
143
|
? __( 'Document Overview' )
|
|
138
144
|
: __( 'Block Library' );
|
|
139
|
-
const shouldShowMediaEditor = !! isAttachment;
|
|
140
145
|
const shouldShowStylesCanvas =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const shouldShowBlockEditor =
|
|
144
|
-
! shouldShowMediaEditor && ! shouldShowStylesCanvas;
|
|
146
|
+
showStylebook || stylesPath?.startsWith( '/revisions' );
|
|
147
|
+
const shouldShowBlockEditor = ! shouldShowStylesCanvas;
|
|
145
148
|
|
|
146
149
|
// Local state for save panel.
|
|
147
150
|
// Note 'truthy' callback implies an open panel.
|
|
@@ -200,7 +203,6 @@ export default function EditorInterface( {
|
|
|
200
203
|
}
|
|
201
204
|
editorNotices={ <Notices /> }
|
|
202
205
|
secondarySidebar={
|
|
203
|
-
! isAttachment &&
|
|
204
206
|
! isPreviewMode &&
|
|
205
207
|
mode === 'visual' &&
|
|
206
208
|
( ( isInserterOpened && <InserterSidebar /> ) ||
|
|
@@ -213,9 +215,6 @@ export default function EditorInterface( {
|
|
|
213
215
|
content={
|
|
214
216
|
<>
|
|
215
217
|
{ ! isDistractionFree && ! isPreviewMode && <Notices /> }
|
|
216
|
-
{ shouldShowMediaEditor && (
|
|
217
|
-
<MediaPreview { ...iframeProps } />
|
|
218
|
-
) }
|
|
219
218
|
{ shouldShowStylesCanvas && <StylesCanvas /> }
|
|
220
219
|
{ shouldShowBlockEditor && (
|
|
221
220
|
<>
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import deprecated from '@wordpress/deprecated';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
5
7
|
import { InlineNotices } from '@wordpress/notices';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -19,12 +21,16 @@ export function EditorNotices() {
|
|
|
19
21
|
alternative: 'wp.notices.InlineNotices',
|
|
20
22
|
} );
|
|
21
23
|
|
|
24
|
+
const isValidTemplate = useSelect( ( select ) => {
|
|
25
|
+
return select( blockEditorStore ).isValidTemplate();
|
|
26
|
+
}, [] );
|
|
27
|
+
|
|
22
28
|
return (
|
|
23
29
|
<InlineNotices
|
|
24
30
|
pinnedNoticesClassName="components-editor-notices__pinned"
|
|
25
31
|
dismissibleNoticesClassName="components-editor-notices__dismissible"
|
|
26
32
|
>
|
|
27
|
-
<TemplateValidationNotice />
|
|
33
|
+
{ ! isValidTemplate && <TemplateValidationNotice /> }
|
|
28
34
|
</InlineNotices>
|
|
29
35
|
);
|
|
30
36
|
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
withPreferredColorScheme,
|
|
18
18
|
} from '@wordpress/compose';
|
|
19
19
|
import { cautionFilled } from '@wordpress/icons';
|
|
20
|
-
import { Icon } from '@wordpress/components';
|
|
20
|
+
import { Icon as WCIcon } from '@wordpress/components';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
@@ -140,7 +140,7 @@ class ErrorBoundary extends Component {
|
|
|
140
140
|
>
|
|
141
141
|
<View style={ styles[ 'error-boundary__container' ] }>
|
|
142
142
|
<View style={ iconContainerStyle }>
|
|
143
|
-
<
|
|
143
|
+
<WCIcon
|
|
144
144
|
icon={ cautionFilled }
|
|
145
145
|
{ ...styles[ 'error-boundary__icon' ] }
|
|
146
146
|
/>
|
|
@@ -35,6 +35,13 @@ function useGlobalStylesUserConfig() {
|
|
|
35
35
|
|
|
36
36
|
let record;
|
|
37
37
|
|
|
38
|
+
/*
|
|
39
|
+
* Ensure that the global styles ID request is complete by testing `_globalStylesId`,
|
|
40
|
+
* before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will
|
|
41
|
+
* fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`.
|
|
42
|
+
* NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,
|
|
43
|
+
* or set using the `block_editor_rest_api_preload_paths` filter, if this changes.
|
|
44
|
+
*/
|
|
38
45
|
const userCanEditGlobalStyles = _globalStylesId
|
|
39
46
|
? canUser( 'update', {
|
|
40
47
|
kind: 'root',
|
|
@@ -45,8 +52,21 @@ function useGlobalStylesUserConfig() {
|
|
|
45
52
|
|
|
46
53
|
if (
|
|
47
54
|
_globalStylesId &&
|
|
55
|
+
/*
|
|
56
|
+
* Test that the OPTIONS request for user capabilities is complete
|
|
57
|
+
* before fetching the global styles entity record.
|
|
58
|
+
* This is to avoid fetching the global styles entity unnecessarily.
|
|
59
|
+
*/
|
|
48
60
|
typeof userCanEditGlobalStyles === 'boolean'
|
|
49
61
|
) {
|
|
62
|
+
/*
|
|
63
|
+
* Fetch the global styles entity record based on the user's capabilities.
|
|
64
|
+
* The default context is `edit` for users who can edit global styles.
|
|
65
|
+
* Otherwise, the context is `view`.
|
|
66
|
+
* NOTE: There is an equivalent conditional check using `current_user_can()` in the backend
|
|
67
|
+
* to preload the global styles entity. Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,
|
|
68
|
+
* or set using `block_editor_rest_api_preload_paths` filter, if this changes.
|
|
69
|
+
*/
|
|
50
70
|
if ( userCanEditGlobalStyles ) {
|
|
51
71
|
record = getEditedEntityRecord(
|
|
52
72
|
'root',
|
|
@@ -110,6 +130,12 @@ function useGlobalStylesUserConfig() {
|
|
|
110
130
|
}, [ settings, styles, _links ] );
|
|
111
131
|
|
|
112
132
|
const setConfig = useCallback(
|
|
133
|
+
/**
|
|
134
|
+
* Set the global styles config.
|
|
135
|
+
* @param {Function|Object} callbackOrObject If the callbackOrObject is a function, pass the current config to the callback so the consumer can merge values.
|
|
136
|
+
* Otherwise, overwrite the current config with the incoming object.
|
|
137
|
+
* @param {Object} options Options for editEntityRecord Core selector.
|
|
138
|
+
*/
|
|
113
139
|
( callbackOrObject, options = {} ) => {
|
|
114
140
|
const record = getEditedEntityRecord(
|
|
115
141
|
'root',
|
|
@@ -19,15 +19,6 @@
|
|
|
19
19
|
flex: 1;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.editor-global-styles-sidebar .components-navigation__menu-title-heading {
|
|
23
|
-
font-size: $default-font-size * 1.2;
|
|
24
|
-
font-weight: $font-weight-medium;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.editor-global-styles-sidebar .components-navigation__item > button span {
|
|
28
|
-
font-weight: $font-weight-medium;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
22
|
.editor-global-styles-sidebar .block-editor-panel-color-gradient-settings {
|
|
32
23
|
border: 0;
|
|
33
24
|
}
|
|
@@ -50,7 +50,6 @@ function Header( {
|
|
|
50
50
|
hasBlockSelection,
|
|
51
51
|
hasSectionRootClientId,
|
|
52
52
|
isStylesCanvasActive,
|
|
53
|
-
isAttachment,
|
|
54
53
|
} = useSelect( ( select ) => {
|
|
55
54
|
const { get: getPreference } = select( preferencesStore );
|
|
56
55
|
const {
|
|
@@ -78,9 +77,6 @@ function Header( {
|
|
|
78
77
|
isStylesCanvasActive:
|
|
79
78
|
!! getStylesPath()?.startsWith( '/revisions' ) ||
|
|
80
79
|
getShowStylebook(),
|
|
81
|
-
isAttachment:
|
|
82
|
-
getCurrentPostType() === ATTACHMENT_POST_TYPE &&
|
|
83
|
-
window?.__experimentalMediaEditor,
|
|
84
80
|
};
|
|
85
81
|
}, [] );
|
|
86
82
|
|
|
@@ -109,13 +105,11 @@ function Header( {
|
|
|
109
105
|
<HeaderSkeleton
|
|
110
106
|
toolbar={
|
|
111
107
|
<>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/>
|
|
118
|
-
) }
|
|
108
|
+
<DocumentTools
|
|
109
|
+
disableBlockTools={
|
|
110
|
+
isStylesCanvasActive || isTextEditor
|
|
111
|
+
}
|
|
112
|
+
/>
|
|
119
113
|
{ hasFixedToolbar && isLargeViewport && (
|
|
120
114
|
<CollapsibleBlockToolbar
|
|
121
115
|
isCollapsed={ isBlockToolsCollapsed }
|
|
@@ -137,6 +131,12 @@ function Header( {
|
|
|
137
131
|
}
|
|
138
132
|
settings={
|
|
139
133
|
<>
|
|
134
|
+
{ ! hasCenter && ! isTooNarrowForDocumentBar && (
|
|
135
|
+
<CollaboratorsPresence
|
|
136
|
+
postType={ postType }
|
|
137
|
+
postId={ postId }
|
|
138
|
+
/>
|
|
139
|
+
) }
|
|
140
140
|
{ ! customSaveButton && ! isPublishSidebarOpened && (
|
|
141
141
|
/*
|
|
142
142
|
* This button isn't completely hidden by the publish sidebar.
|
|
@@ -177,7 +177,7 @@ function Header( {
|
|
|
177
177
|
/>
|
|
178
178
|
) }
|
|
179
179
|
{ customSaveButton }
|
|
180
|
-
|
|
180
|
+
<MoreMenu />
|
|
181
181
|
</>
|
|
182
182
|
}
|
|
183
183
|
/>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSettings } from '@wordpress/block-editor';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
5
6
|
import { useMemo } from '@wordpress/element';
|
|
6
7
|
import { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';
|
|
7
8
|
|
|
@@ -11,7 +12,9 @@ import { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';
|
|
|
11
12
|
import { unlock } from '../../lock-unlock';
|
|
12
13
|
import usePostFields from '../post-fields';
|
|
13
14
|
|
|
14
|
-
const { MediaEditorModal } = unlock(
|
|
15
|
+
const { MediaEditorModal, store: mediaEditorStore } = unlock(
|
|
16
|
+
mediaEditorPrivateApis
|
|
17
|
+
);
|
|
15
18
|
|
|
16
19
|
function ratioToNumber( ratio ) {
|
|
17
20
|
if ( ratio === undefined || ratio === null ) {
|
|
@@ -48,9 +51,24 @@ function aspectRatioPresetFromSettings( { name, ratio } = {} ) {
|
|
|
48
51
|
* into the modal, since `@wordpress/media-editor` cannot depend on
|
|
49
52
|
* `@wordpress/editor`.
|
|
50
53
|
*
|
|
51
|
-
*
|
|
54
|
+
* Defers the attachment fields and settings reads until the modal
|
|
55
|
+
* actually opens, so editor startup doesn't pay for them on every
|
|
56
|
+
* page load.
|
|
57
|
+
*
|
|
58
|
+
* @return {Element|null} The MediaEditorModal component wired with attachment fields, or null when closed.
|
|
52
59
|
*/
|
|
53
60
|
export default function MediaEditorModalMount() {
|
|
61
|
+
const isOpen = useSelect(
|
|
62
|
+
( select ) => select( mediaEditorStore ).isOpen(),
|
|
63
|
+
[]
|
|
64
|
+
);
|
|
65
|
+
if ( ! isOpen ) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return <MediaEditorModalContent />;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function MediaEditorModalContent() {
|
|
54
72
|
const fields = usePostFields( { postType: 'attachment' } );
|
|
55
73
|
const [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(
|
|
56
74
|
'dimensions.aspectRatios.default',
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useNetworkConnectivity,
|
|
12
12
|
usePrevious,
|
|
13
13
|
} from '@wordpress/compose';
|
|
14
|
-
import { Icon } from '@wordpress/components';
|
|
14
|
+
import { Icon as WCIcon } from '@wordpress/components';
|
|
15
15
|
import { offline as offlineIcon } from '@wordpress/icons';
|
|
16
16
|
import { __ } from '@wordpress/i18n';
|
|
17
17
|
import { useEffect } from '@wordpress/element';
|
|
@@ -90,7 +90,7 @@ const OfflineStatus = () => {
|
|
|
90
90
|
) }
|
|
91
91
|
style={ containerStyle }
|
|
92
92
|
>
|
|
93
|
-
<
|
|
93
|
+
<WCIcon fill={ iconStyle.fill } icon={ offlineIcon } />
|
|
94
94
|
<Text style={ textStyle }>{ __( 'Working Offline' ) } </Text>
|
|
95
95
|
</View>
|
|
96
96
|
) : null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
Icon,
|
|
5
|
+
Icon as WCIcon,
|
|
6
6
|
Button,
|
|
7
7
|
__experimentalHStack as HStack,
|
|
8
8
|
__experimentalVStack as VStack,
|
|
@@ -130,7 +130,10 @@ export default function PostCardPanel( {
|
|
|
130
130
|
className="editor-post-card-panel__header"
|
|
131
131
|
alignment="flex-start"
|
|
132
132
|
>
|
|
133
|
-
<
|
|
133
|
+
<WCIcon
|
|
134
|
+
className="editor-post-card-panel__icon"
|
|
135
|
+
icon={ icon }
|
|
136
|
+
/>
|
|
134
137
|
<WCText
|
|
135
138
|
numberOfLines={ 2 }
|
|
136
139
|
truncate
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { sprintf, __ } from '@wordpress/i18n';
|
|
4
|
+
import { sprintf, __, _n } from '@wordpress/i18n';
|
|
5
5
|
import { Button } from '@wordpress/components';
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { backup } from '@wordpress/icons';
|
|
8
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -16,11 +17,16 @@ import { unlock } from '../../lock-unlock';
|
|
|
16
17
|
|
|
17
18
|
function usePostLastRevisionInfo() {
|
|
18
19
|
return useSelect( ( select ) => {
|
|
19
|
-
const {
|
|
20
|
-
|
|
20
|
+
const {
|
|
21
|
+
getCurrentPostLastRevisionId,
|
|
22
|
+
getCurrentPostRevisionsCount,
|
|
23
|
+
getEditorSettings,
|
|
24
|
+
} = select( editorStore );
|
|
21
25
|
return {
|
|
22
26
|
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
23
27
|
revisionsCount: getCurrentPostRevisionsCount(),
|
|
28
|
+
disableVisualRevisions:
|
|
29
|
+
!! getEditorSettings().disableVisualRevisions,
|
|
24
30
|
};
|
|
25
31
|
}, [] );
|
|
26
32
|
}
|
|
@@ -31,14 +37,23 @@ function usePostLastRevisionInfo() {
|
|
|
31
37
|
* @return {React.ReactNode} The rendered component.
|
|
32
38
|
*/
|
|
33
39
|
function PostLastRevision() {
|
|
34
|
-
const { lastRevisionId, revisionsCount } =
|
|
40
|
+
const { lastRevisionId, revisionsCount, disableVisualRevisions } =
|
|
41
|
+
usePostLastRevisionInfo();
|
|
35
42
|
const { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );
|
|
36
43
|
|
|
44
|
+
const buttonProps = disableVisualRevisions
|
|
45
|
+
? {
|
|
46
|
+
href: addQueryArgs( 'revision.php', {
|
|
47
|
+
revision: lastRevisionId,
|
|
48
|
+
} ),
|
|
49
|
+
}
|
|
50
|
+
: { onClick: () => setCurrentRevisionId( lastRevisionId ) };
|
|
51
|
+
|
|
37
52
|
return (
|
|
38
53
|
<PostLastRevisionCheck>
|
|
39
54
|
<Button
|
|
40
55
|
__next40pxDefaultSize
|
|
41
|
-
|
|
56
|
+
{ ...buttonProps }
|
|
42
57
|
className="editor-post-last-revision__title"
|
|
43
58
|
icon={ backup }
|
|
44
59
|
iconPosition="right"
|
|
@@ -53,19 +68,32 @@ function PostLastRevision() {
|
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
export function PrivatePostLastRevision() {
|
|
56
|
-
const { lastRevisionId, revisionsCount } =
|
|
71
|
+
const { lastRevisionId, revisionsCount, disableVisualRevisions } =
|
|
72
|
+
usePostLastRevisionInfo();
|
|
57
73
|
const { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );
|
|
58
74
|
|
|
75
|
+
const buttonProps = disableVisualRevisions
|
|
76
|
+
? {
|
|
77
|
+
href: addQueryArgs( 'revision.php', {
|
|
78
|
+
revision: lastRevisionId,
|
|
79
|
+
} ),
|
|
80
|
+
}
|
|
81
|
+
: { onClick: () => setCurrentRevisionId( lastRevisionId ) };
|
|
82
|
+
|
|
59
83
|
return (
|
|
60
84
|
<PostLastRevisionCheck>
|
|
61
85
|
<PostPanelRow label={ __( 'Revisions' ) }>
|
|
62
86
|
<Button
|
|
63
|
-
|
|
87
|
+
{ ...buttonProps }
|
|
64
88
|
className="editor-private-post-last-revision__button"
|
|
65
89
|
text={ revisionsCount }
|
|
66
90
|
aria-label={ sprintf(
|
|
67
|
-
/* translators: %
|
|
68
|
-
|
|
91
|
+
/* translators: %d: number of revisions. */
|
|
92
|
+
_n(
|
|
93
|
+
'Open revisions screen: %d revision',
|
|
94
|
+
'Open revisions screen: %d revisions',
|
|
95
|
+
revisionsCount
|
|
96
|
+
),
|
|
69
97
|
revisionsCount
|
|
70
98
|
) }
|
|
71
99
|
variant="tertiary"
|