@wordpress/editor 14.47.0 → 14.48.1
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 +26 -0
- package/build/components/block-removal-warnings/index.cjs +0 -3
- package/build/components/block-removal-warnings/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs +49 -43
- package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +1 -8
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-render-cursors.cjs +1 -7
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/more-menu/view-more-menu-group.cjs +1 -2
- package/build/components/more-menu/view-more-menu-group.cjs.map +2 -2
- package/build/components/page-attributes/parent.cjs +1 -0
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-publish-button/index.cjs +114 -157
- package/build/components/post-publish-button/index.cjs.map +3 -3
- package/build/components/post-revisions-preview/block-diff.cjs +21 -9
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/preserve-client-ids.cjs +2 -2
- package/build/components/post-revisions-preview/preserve-client-ids.cjs.map +2 -2
- package/build/components/provider/index.cjs +2 -0
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +1 -1
- package/build/components/provider/use-block-editor-settings.cjs.map +2 -2
- package/build/components/provider/use-network-reconnect.cjs +51 -0
- package/build/components/provider/use-network-reconnect.cjs.map +7 -0
- package/build/components/revision-fields-diff/index.cjs +2 -2
- package/build/components/revision-fields-diff/index.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +1 -4
- package/build/components/sidebar/index.cjs.map +2 -2
- package/build/components/template-actions-panel/block-theme-content.cjs +7 -1
- package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
- package/build/components/upload-progress-snackbar/index.cjs +161 -0
- package/build/components/upload-progress-snackbar/index.cjs.map +7 -0
- package/build/components/upload-progress-snackbar/tracker.cjs +90 -0
- package/build/components/upload-progress-snackbar/tracker.cjs.map +7 -0
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +3 -3
- package/build/store/selectors.cjs +1 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/media-upload/index.cjs +16 -0
- package/build/utils/media-upload/index.cjs.map +3 -3
- package/build-module/components/block-removal-warnings/index.mjs +0 -3
- package/build-module/components/block-removal-warnings/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs +53 -44
- package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +1 -8
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +1 -7
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/more-menu/view-more-menu-group.mjs +1 -2
- package/build-module/components/more-menu/view-more-menu-group.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +1 -0
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-publish-button/index.mjs +116 -159
- package/build-module/components/post-publish-button/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs +20 -8
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/preserve-client-ids.mjs +1 -1
- package/build-module/components/post-revisions-preview/preserve-client-ids.mjs.map +1 -1
- package/build-module/components/provider/index.mjs +2 -0
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +1 -1
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-network-reconnect.mjs +30 -0
- package/build-module/components/provider/use-network-reconnect.mjs.map +7 -0
- package/build-module/components/revision-fields-diff/index.mjs +2 -2
- package/build-module/components/revision-fields-diff/index.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +2 -11
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/template-actions-panel/block-theme-content.mjs +7 -1
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
- package/build-module/components/upload-progress-snackbar/index.mjs +135 -0
- package/build-module/components/upload-progress-snackbar/index.mjs.map +7 -0
- package/build-module/components/upload-progress-snackbar/tracker.mjs +61 -0
- package/build-module/components/upload-progress-snackbar/tracker.mjs.map +7 -0
- package/build-module/private-apis.mjs +2 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/selectors.mjs +1 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-upload/index.mjs +19 -0
- package/build-module/utils/media-upload/index.mjs.map +2 -2
- package/build-style/style-rtl.css +479 -84
- package/build-style/style.css +479 -84
- package/build-types/components/block-removal-warnings/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +6 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-author-info.d.ts +8 -0
- package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-form.d.ts +9 -0
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +6 -0
- package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts +6 -0
- package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +10 -0
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +0 -3
- 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/document-bar/index.d.ts +2 -2
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts +16 -0
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -0
- package/build-types/components/media/index.d.ts +3 -0
- package/build-types/components/media/index.d.ts.map +1 -0
- package/build-types/components/media/metadata-panel.d.ts +12 -0
- package/build-types/components/media/metadata-panel.d.ts.map +1 -0
- package/build-types/components/media/preview.d.ts +9 -0
- package/build-types/components/media/preview.d.ts.map +1 -0
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts +6 -1
- package/build-types/components/post-publish-button/index.d.ts +9 -9
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/block-diff.d.ts +3 -0
- package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +6 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +6 -1
- package/build-types/components/post-text-editor/index.d.ts +1 -1
- package/build-types/components/post-text-editor/index.d.ts.map +1 -1
- package/build-types/components/post-text-editor/utils.d.ts +29 -0
- package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
- package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
- package/build-types/components/revision-fields-diff/index.d.ts +3 -0
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
- package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
- package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
- package/build-types/private-apis.d.ts.map +1 -1
- 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-upload/index.d.ts.map +1 -1
- package/package.json +55 -52
- package/src/components/README.md +1 -1
- package/src/components/block-removal-warnings/index.js +0 -7
- package/src/components/collab-sidebar/note-indicator-toolbar.js +73 -60
- package/src/components/collaborators-overlay/use-block-highlighting.ts +0 -9
- package/src/components/collaborators-overlay/use-render-cursors.ts +0 -8
- package/src/components/collaborators-presence/avatar/test/index.tsx +8 -3
- package/src/components/more-menu/view-more-menu-group.js +1 -2
- package/src/components/page-attributes/parent.js +1 -0
- package/src/components/post-publish-button/index.js +143 -192
- package/src/components/post-publish-button/test/index.js +137 -114
- package/src/components/post-revisions-preview/block-diff.js +63 -19
- package/src/components/post-revisions-preview/preserve-client-ids.js +1 -1
- package/src/components/post-revisions-preview/test/block-diff.js +109 -6
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/test/use-network-reconnect.js +137 -0
- package/src/components/provider/use-block-editor-settings.js +2 -2
- package/src/components/provider/use-network-reconnect.js +44 -0
- package/src/components/revision-fields-diff/index.js +7 -2
- package/src/components/sidebar/index.js +2 -11
- package/src/components/template-actions-panel/block-theme-content.js +10 -1
- package/src/components/upload-progress-snackbar/README.md +26 -0
- package/src/components/upload-progress-snackbar/index.js +216 -0
- package/src/components/upload-progress-snackbar/stories/index.story.tsx +85 -0
- package/src/components/upload-progress-snackbar/style.scss +30 -0
- package/src/components/upload-progress-snackbar/test/index.js +199 -0
- package/src/components/upload-progress-snackbar/tracker.js +105 -0
- package/src/private-apis.js +2 -0
- package/src/store/selectors.js +1 -3
- package/src/style.scss +1 -0
- package/src/utils/media-upload/index.js +27 -0
- package/src/components/commands/index.native.js +0 -2
- package/src/components/deprecated.native.js +0 -47
- package/src/components/editor-help/add-blocks.native.js +0 -40
- package/src/components/editor-help/customize-blocks.native.js +0 -40
- package/src/components/editor-help/help-detail-navigation-screen.native.js +0 -67
- package/src/components/editor-help/help-get-support-button.native.js +0 -38
- package/src/components/editor-help/help-section-title.native.js +0 -29
- package/src/components/editor-help/help-topic-row.native.js +0 -33
- package/src/components/editor-help/icon-move-blocks.native.js +0 -10
- package/src/components/editor-help/index.native.js +0 -208
- package/src/components/editor-help/intro-to-blocks.native.js +0 -91
- package/src/components/editor-help/move-blocks.native.js +0 -55
- package/src/components/editor-help/remove-blocks.native.js +0 -35
- package/src/components/editor-help/style.android.scss +0 -6
- package/src/components/editor-help/style.ios.scss +0 -6
- package/src/components/editor-help/test/index.native.js +0 -81
- package/src/components/editor-help/view-sections.native.js +0 -79
- package/src/components/error-boundary/index.native.js +0 -192
- package/src/components/error-boundary/style.native.scss +0 -116
- package/src/components/index.native.js +0 -15
- package/src/components/offline-status/index.native.js +0 -99
- package/src/components/offline-status/style.native.scss +0 -28
- package/src/components/offline-status/test/index.native.js +0 -108
- package/src/components/post-title/index.native.js +0 -282
- package/src/components/post-title/style.native.scss +0 -13
- package/src/components/post-title/test/__snapshots__/index.native.js.snap +0 -25
- package/src/components/post-title/test/index.native.js +0 -78
- package/src/components/provider/index.native.js +0 -497
- package/src/components/provider/use-block-editor-settings.native.js +0 -48
- package/src/components/template-part-menu-items/index.native.js +0 -3
- package/src/hooks/index.native.js +0 -0
- package/src/index.native.js +0 -16
- package/src/private-apis.native.js +0 -33
- package/src/store/actions.native.js +0 -27
- package/src/store/reducer.native.js +0 -94
- package/src/store/selectors.native.js +0 -57
- package/src/store/test/actions.native.js +0 -16
- package/src/store/test/reducer.native.js +0 -36
- package/src/store/test/selectors.native.js +0 -28
- package/src/utils/index.native.js +0 -6
- package/src/utils/media-sideload/index.native.js +0 -1
- package/src/utils/media-upload/index.native.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.48.1",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
},
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
|
-
"react-native": "src/index",
|
|
44
43
|
"wpScript": true,
|
|
45
44
|
"types": "build-types",
|
|
46
45
|
"sideEffects": [
|
|
@@ -60,56 +59,57 @@
|
|
|
60
59
|
"build-module/bindings/**"
|
|
61
60
|
],
|
|
62
61
|
"dependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@wordpress/
|
|
65
|
-
"@wordpress/
|
|
66
|
-
"@wordpress/
|
|
67
|
-
"@wordpress/
|
|
68
|
-
"@wordpress/block-
|
|
69
|
-
"@wordpress/
|
|
70
|
-
"@wordpress/
|
|
71
|
-
"@wordpress/
|
|
72
|
-
"@wordpress/
|
|
73
|
-
"@wordpress/
|
|
74
|
-
"@wordpress/data": "^
|
|
75
|
-
"@wordpress/
|
|
76
|
-
"@wordpress/
|
|
77
|
-
"@wordpress/
|
|
78
|
-
"@wordpress/
|
|
79
|
-
"@wordpress/
|
|
80
|
-
"@wordpress/
|
|
81
|
-
"@wordpress/
|
|
82
|
-
"@wordpress/global-styles-
|
|
83
|
-
"@wordpress/
|
|
84
|
-
"@wordpress/
|
|
85
|
-
"@wordpress/
|
|
86
|
-
"@wordpress/
|
|
87
|
-
"@wordpress/
|
|
88
|
-
"@wordpress/
|
|
89
|
-
"@wordpress/
|
|
90
|
-
"@wordpress/
|
|
91
|
-
"@wordpress/media-
|
|
92
|
-
"@wordpress/media-
|
|
93
|
-
"@wordpress/
|
|
94
|
-
"@wordpress/
|
|
95
|
-
"@wordpress/
|
|
96
|
-
"@wordpress/
|
|
97
|
-
"@wordpress/
|
|
98
|
-
"@wordpress/
|
|
99
|
-
"@wordpress/
|
|
100
|
-
"@wordpress/
|
|
101
|
-
"@wordpress/
|
|
102
|
-
"@wordpress/
|
|
103
|
-
"@wordpress/
|
|
104
|
-
"@wordpress/
|
|
105
|
-
"@wordpress/
|
|
106
|
-
"@wordpress/
|
|
62
|
+
"@types/react": "^18.3.27",
|
|
63
|
+
"@wordpress/a11y": "^4.48.1",
|
|
64
|
+
"@wordpress/api-fetch": "^7.48.1",
|
|
65
|
+
"@wordpress/base-styles": "^10.0.1",
|
|
66
|
+
"@wordpress/blob": "^4.48.1",
|
|
67
|
+
"@wordpress/block-editor": "^15.21.1",
|
|
68
|
+
"@wordpress/block-serialization-default-parser": "^5.48.1",
|
|
69
|
+
"@wordpress/blocks": "^15.21.1",
|
|
70
|
+
"@wordpress/commands": "^1.48.1",
|
|
71
|
+
"@wordpress/components": "^35.0.1",
|
|
72
|
+
"@wordpress/compose": "^8.1.1",
|
|
73
|
+
"@wordpress/core-data": "^7.48.1",
|
|
74
|
+
"@wordpress/data": "^10.48.1",
|
|
75
|
+
"@wordpress/dataviews": "^16.0.1",
|
|
76
|
+
"@wordpress/date": "^5.48.1",
|
|
77
|
+
"@wordpress/deprecated": "^4.48.1",
|
|
78
|
+
"@wordpress/dom": "^4.48.1",
|
|
79
|
+
"@wordpress/element": "^8.0.1",
|
|
80
|
+
"@wordpress/fields": "^0.40.1",
|
|
81
|
+
"@wordpress/global-styles-engine": "^1.15.1",
|
|
82
|
+
"@wordpress/global-styles-ui": "^1.15.1",
|
|
83
|
+
"@wordpress/hooks": "^4.48.1",
|
|
84
|
+
"@wordpress/html-entities": "^4.48.1",
|
|
85
|
+
"@wordpress/i18n": "^6.21.1",
|
|
86
|
+
"@wordpress/icons": "^14.0.1",
|
|
87
|
+
"@wordpress/interface": "^9.33.1",
|
|
88
|
+
"@wordpress/keyboard-shortcuts": "^5.48.1",
|
|
89
|
+
"@wordpress/keycodes": "^4.48.1",
|
|
90
|
+
"@wordpress/media-editor": "^0.11.1",
|
|
91
|
+
"@wordpress/media-fields": "^0.13.1",
|
|
92
|
+
"@wordpress/media-utils": "^5.48.1",
|
|
93
|
+
"@wordpress/notices": "^5.48.1",
|
|
94
|
+
"@wordpress/patterns": "^2.48.1",
|
|
95
|
+
"@wordpress/plugins": "^7.48.1",
|
|
96
|
+
"@wordpress/preferences": "^4.48.1",
|
|
97
|
+
"@wordpress/private-apis": "^1.48.1",
|
|
98
|
+
"@wordpress/reusable-blocks": "^5.48.1",
|
|
99
|
+
"@wordpress/rich-text": "^7.48.1",
|
|
100
|
+
"@wordpress/server-side-render": "^6.24.1",
|
|
101
|
+
"@wordpress/ui": "^0.15.1",
|
|
102
|
+
"@wordpress/upload-media": "^0.33.1",
|
|
103
|
+
"@wordpress/url": "^4.48.1",
|
|
104
|
+
"@wordpress/views": "^1.15.1",
|
|
105
|
+
"@wordpress/warning": "^3.48.1",
|
|
106
|
+
"@wordpress/wordcount": "^4.48.1",
|
|
107
107
|
"change-case": "^4.1.2",
|
|
108
108
|
"client-zip": "^2.4.5",
|
|
109
109
|
"clsx": "^2.1.1",
|
|
110
|
-
"colord": "^2.
|
|
110
|
+
"colord": "^2.9.3",
|
|
111
111
|
"date-fns": "^4.1.0",
|
|
112
|
-
"diff": "^
|
|
112
|
+
"diff": "^8.0.3",
|
|
113
113
|
"fast-deep-equal": "^3.1.3",
|
|
114
114
|
"memize": "^2.1.0",
|
|
115
115
|
"react-autosize-textarea": "^7.1.0",
|
|
@@ -117,14 +117,17 @@
|
|
|
117
117
|
"uuid": "^14.0.0"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"
|
|
120
|
+
"@testing-library/dom": "^10.4.1",
|
|
121
|
+
"@testing-library/react": "^16.3.2",
|
|
122
|
+
"@testing-library/user-event": "^14.6.1",
|
|
123
|
+
"deep-freeze": "^0.0.1"
|
|
121
124
|
},
|
|
122
125
|
"peerDependencies": {
|
|
123
|
-
"react": "^
|
|
124
|
-
"react-dom": "^
|
|
126
|
+
"react": "^18.0.0",
|
|
127
|
+
"react-dom": "^18.0.0"
|
|
125
128
|
},
|
|
126
129
|
"publishConfig": {
|
|
127
130
|
"access": "public"
|
|
128
131
|
},
|
|
129
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "99df7432c5c7cb83ba41146fd1f57f3c19004305"
|
|
130
133
|
}
|
package/src/components/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Editor Components
|
|
2
2
|
|
|
3
3
|
This folder holds reusable editor components exported by the `editor` module.
|
|
4
|
-
These components combined as children of the `EditorProvider` component can be
|
|
4
|
+
These components, combined as children of the `EditorProvider` component, can be used to build alternative Editor Layouts.
|
|
5
5
|
|
|
6
6
|
## Which components should live in this folder?
|
|
7
7
|
|
|
@@ -95,13 +95,6 @@ export default function BlockRemovalWarnings() {
|
|
|
95
95
|
[ currentPostType ]
|
|
96
96
|
);
|
|
97
97
|
|
|
98
|
-
// `BlockRemovalWarnings` is rendered in the editor provider, a shared component
|
|
99
|
-
// across react native and web. However, `BlockRemovalWarningModal` is web only.
|
|
100
|
-
// Check it exists before trying to render it.
|
|
101
|
-
if ( ! BlockRemovalWarningModal ) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
98
|
if ( ! removalRulesForPostType ) {
|
|
106
99
|
return null;
|
|
107
100
|
}
|
|
@@ -5,7 +5,11 @@ import { ToolbarButton } from '@wordpress/components';
|
|
|
5
5
|
import { Stack } from '@wordpress/ui';
|
|
6
6
|
import { __, sprintf } from '@wordpress/i18n';
|
|
7
7
|
import { useMemo } from '@wordpress/element';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
privateApis as blockEditorPrivateApis,
|
|
10
|
+
store as blockEditorStore,
|
|
11
|
+
} from '@wordpress/block-editor';
|
|
12
|
+
import { useSelect } from '@wordpress/data';
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Internal dependencies
|
|
@@ -15,52 +19,24 @@ import { getAvatarBorderColor } from './utils';
|
|
|
15
19
|
|
|
16
20
|
const { NoteIconToolbarSlotFill } = unlock( blockEditorPrivateApis );
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const participantsMap = new Map();
|
|
25
|
-
const allNotes = [ note, ...note.reply ];
|
|
26
|
-
|
|
27
|
-
// Sort by date to show participants in chronological order.
|
|
28
|
-
allNotes.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) );
|
|
29
|
-
|
|
30
|
-
allNotes.forEach( ( entry ) => {
|
|
31
|
-
// Track thread participants (original author + repliers).
|
|
32
|
-
if ( entry.author_name && entry.author_avatar_urls ) {
|
|
33
|
-
if ( ! participantsMap.has( entry.author ) ) {
|
|
34
|
-
participantsMap.set( entry.author, {
|
|
35
|
-
name: entry.author_name,
|
|
36
|
-
avatar:
|
|
37
|
-
entry.author_avatar_urls?.[ '48' ] ||
|
|
38
|
-
entry.author_avatar_urls?.[ '96' ],
|
|
39
|
-
id: entry.author,
|
|
40
|
-
date: entry.date,
|
|
41
|
-
} );
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
} );
|
|
45
|
-
|
|
46
|
-
return Array.from( participantsMap.values() );
|
|
47
|
-
}, [ note ] );
|
|
48
|
-
|
|
49
|
-
if ( ! threadParticipants.length ) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
22
|
+
function ThreadParticipants( { participants } ) {
|
|
23
|
+
const defaultAvatar = useSelect( ( select ) => {
|
|
24
|
+
const { getSettings } = select( blockEditorStore );
|
|
25
|
+
const { __experimentalDiscussionSettings } = getSettings();
|
|
26
|
+
return __experimentalDiscussionSettings?.avatarURL;
|
|
27
|
+
}, [] );
|
|
52
28
|
|
|
53
29
|
// If there are more than 3 participants, show 2 avatars and a "+n" number.
|
|
54
30
|
const maxAvatars = 3;
|
|
55
|
-
const isOverflow =
|
|
31
|
+
const isOverflow = participants.length > maxAvatars;
|
|
56
32
|
const visibleParticipants = isOverflow
|
|
57
|
-
?
|
|
58
|
-
:
|
|
33
|
+
? participants.slice( 0, maxAvatars - 1 )
|
|
34
|
+
: participants;
|
|
59
35
|
const overflowCount = Math.max(
|
|
60
36
|
0,
|
|
61
|
-
|
|
37
|
+
participants.length - visibleParticipants.length
|
|
62
38
|
);
|
|
63
|
-
const threadHasMoreParticipants =
|
|
39
|
+
const threadHasMoreParticipants = participants.length > 100;
|
|
64
40
|
|
|
65
41
|
// If we hit the note limit, show "100+" instead of exact overflow count.
|
|
66
42
|
const overflowText =
|
|
@@ -72,6 +48,62 @@ export function NoteAvatarIndicator( { onClick, note } ) {
|
|
|
72
48
|
overflowCount
|
|
73
49
|
);
|
|
74
50
|
|
|
51
|
+
return (
|
|
52
|
+
<Stack direction="row" align="center" gap="xs">
|
|
53
|
+
{ visibleParticipants.map( ( participant ) => (
|
|
54
|
+
<img
|
|
55
|
+
key={ participant.id }
|
|
56
|
+
src={ participant.avatar || defaultAvatar }
|
|
57
|
+
alt={ participant.name }
|
|
58
|
+
className="editor-note-indicator__avatar"
|
|
59
|
+
style={ {
|
|
60
|
+
borderColor: getAvatarBorderColor( participant.id ),
|
|
61
|
+
} }
|
|
62
|
+
/>
|
|
63
|
+
) ) }
|
|
64
|
+
{ overflowCount > 0 && (
|
|
65
|
+
<span className="editor-note-indicator__overflow">
|
|
66
|
+
{ overflowText }
|
|
67
|
+
</span>
|
|
68
|
+
) }
|
|
69
|
+
</Stack>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function NoteAvatarIndicator( { onClick, note } ) {
|
|
74
|
+
const threadParticipants = useMemo( () => {
|
|
75
|
+
if ( ! note ) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Track thread participants (original author + repliers), sorted by
|
|
80
|
+
// date so they appear in chronological order.
|
|
81
|
+
const participantsMap = new Map();
|
|
82
|
+
const allNotes = [ note, ...note.reply ].sort(
|
|
83
|
+
( a, b ) => new Date( a.date ) - new Date( b.date )
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
for ( const entry of allNotes ) {
|
|
87
|
+
if ( ! entry.author_name || participantsMap.has( entry.author ) ) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
participantsMap.set( entry.author, {
|
|
92
|
+
id: entry.author,
|
|
93
|
+
name: entry.author_name,
|
|
94
|
+
avatar:
|
|
95
|
+
entry.author_avatar_urls?.[ '48' ] ||
|
|
96
|
+
entry.author_avatar_urls?.[ '96' ],
|
|
97
|
+
} );
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return Array.from( participantsMap.values() );
|
|
101
|
+
}, [ note ] );
|
|
102
|
+
|
|
103
|
+
if ( ! threadParticipants.length ) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
75
107
|
return (
|
|
76
108
|
<NoteIconToolbarSlotFill.Fill>
|
|
77
109
|
<ToolbarButton
|
|
@@ -80,26 +112,7 @@ export function NoteAvatarIndicator( { onClick, note } ) {
|
|
|
80
112
|
onClick={ () => onClick() }
|
|
81
113
|
showTooltip
|
|
82
114
|
>
|
|
83
|
-
<
|
|
84
|
-
{ visibleParticipants.map( ( participant ) => (
|
|
85
|
-
<img
|
|
86
|
-
key={ participant.id }
|
|
87
|
-
src={ participant.avatar }
|
|
88
|
-
alt={ participant.name }
|
|
89
|
-
className="editor-note-indicator__avatar"
|
|
90
|
-
style={ {
|
|
91
|
-
borderColor: getAvatarBorderColor(
|
|
92
|
-
participant.id
|
|
93
|
-
),
|
|
94
|
-
} }
|
|
95
|
-
/>
|
|
96
|
-
) ) }
|
|
97
|
-
{ overflowCount > 0 && (
|
|
98
|
-
<span className="editor-note-indicator__overflow">
|
|
99
|
-
{ overflowText }
|
|
100
|
-
</span>
|
|
101
|
-
) }
|
|
102
|
-
</Stack>
|
|
115
|
+
<ThreadParticipants participants={ threadParticipants } />
|
|
103
116
|
</ToolbarButton>
|
|
104
117
|
</NoteIconToolbarSlotFill.Fill>
|
|
105
118
|
);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
// @ts-expect-error No exported types
|
|
5
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
4
|
import {
|
|
7
5
|
privateApis as coreDataPrivateApis,
|
|
8
6
|
type CoreDataPrivateApis,
|
|
9
7
|
type PostEditorAwarenessState as ActiveCollaborator,
|
|
10
8
|
} from '@wordpress/core-data';
|
|
11
|
-
import { useSelect } from '@wordpress/data';
|
|
12
9
|
import { useEffect, useRef, useState } from '@wordpress/element';
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -74,11 +71,6 @@ export function useBlockHighlighting(
|
|
|
74
71
|
const [ recomputeToken, rerenderHighlightsAfterDelay ] =
|
|
75
72
|
useDebouncedRecompute( delayMs );
|
|
76
73
|
|
|
77
|
-
const blockClientIds = useSelect(
|
|
78
|
-
( select ) => select( blockEditorStore ).getClientIdsWithDescendants(),
|
|
79
|
-
[]
|
|
80
|
-
);
|
|
81
|
-
|
|
82
74
|
// All DOM mutations and position computations live inside useEffect.
|
|
83
75
|
useEffect( () => {
|
|
84
76
|
if ( ! blockEditorDocument ) {
|
|
@@ -215,7 +207,6 @@ export function useBlockHighlighting(
|
|
|
215
207
|
overlayElement,
|
|
216
208
|
recomputeToken,
|
|
217
209
|
resolveSelection,
|
|
218
|
-
blockClientIds,
|
|
219
210
|
] );
|
|
220
211
|
|
|
221
212
|
return { highlights, rerenderHighlightsAfterDelay };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-expect-error No exported types
|
|
2
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
3
1
|
import { privateApis as coreDataPrivateApis } from '@wordpress/core-data';
|
|
4
2
|
import type {
|
|
5
3
|
CoreDataPrivateApis,
|
|
@@ -70,11 +68,6 @@ export function useRenderCursors(
|
|
|
70
68
|
[]
|
|
71
69
|
);
|
|
72
70
|
|
|
73
|
-
const blockClientIds = useSelect(
|
|
74
|
-
( select ) => select( blockEditorStore ).getClientIdsWithDescendants(),
|
|
75
|
-
[]
|
|
76
|
-
);
|
|
77
|
-
|
|
78
71
|
const [ cursorPositions, setCursorPositions ] = useState< CursorData[] >(
|
|
79
72
|
[]
|
|
80
73
|
);
|
|
@@ -186,7 +179,6 @@ export function useRenderCursors(
|
|
|
186
179
|
sortedUsers,
|
|
187
180
|
showOwnCursor,
|
|
188
181
|
recomputeToken,
|
|
189
|
-
blockClientIds,
|
|
190
182
|
] );
|
|
191
183
|
|
|
192
184
|
return { cursors: cursorPositions, rerenderCursorsAfterDelay };
|
|
@@ -16,13 +16,18 @@ import { Tooltip } from '@wordpress/ui';
|
|
|
16
16
|
import Avatar from '..';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Wraps the avatar in a `Tooltip.Provider` with `delay={ 0 }`
|
|
20
|
-
* tooltip-presence assertions don't have to
|
|
19
|
+
* Wraps the avatar in a `Tooltip.Provider` with `delay={ 0 }` and
|
|
20
|
+
* `closeDelay={ 0 }` so hover-based tooltip-presence assertions don't have to
|
|
21
|
+
* wait for the real-world open/close delay.
|
|
21
22
|
*
|
|
22
23
|
* @param ui The avatar element (or anything else) to render.
|
|
23
24
|
*/
|
|
24
25
|
function renderAvatar( ui: React.ReactElement ): ReturnType< typeof render > {
|
|
25
|
-
return render(
|
|
26
|
+
return render(
|
|
27
|
+
<Tooltip.Provider delay={ 0 } closeDelay={ 0 }>
|
|
28
|
+
{ ui }
|
|
29
|
+
</Tooltip.Provider>
|
|
30
|
+
);
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createSlotFill } from '@wordpress/components';
|
|
5
|
-
import { Platform } from '@wordpress/element';
|
|
6
5
|
|
|
7
6
|
const { Fill: ViewMoreMenuGroup, Slot } = createSlotFill(
|
|
8
|
-
|
|
7
|
+
Symbol( 'ViewMoreMenuGroup' )
|
|
9
8
|
);
|
|
10
9
|
|
|
11
10
|
ViewMoreMenuGroup.Slot = ( { fillProps } ) => <Slot fillProps={ fillProps } />;
|