@wordpress/editor 14.35.1-next.16d95556a.0 → 14.35.2-next.dc3f6d3c1.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/collab-sidebar/comments.js +57 -14
  3. package/build/components/collab-sidebar/comments.js.map +2 -2
  4. package/build/components/global-styles/index.js +8 -8
  5. package/build/components/global-styles/index.js.map +2 -2
  6. package/build/components/post-featured-image/index.js +1 -32
  7. package/build/components/post-featured-image/index.js.map +3 -3
  8. package/build/components/provider/use-block-editor-settings.js +9 -1
  9. package/build/components/provider/use-block-editor-settings.js.map +2 -2
  10. package/build/hooks/media-upload.js +89 -6
  11. package/build/hooks/media-upload.js.map +3 -3
  12. package/build-module/components/collab-sidebar/comments.js +57 -14
  13. package/build-module/components/collab-sidebar/comments.js.map +2 -2
  14. package/build-module/components/global-styles/index.js +8 -8
  15. package/build-module/components/global-styles/index.js.map +2 -2
  16. package/build-module/components/post-featured-image/index.js +3 -35
  17. package/build-module/components/post-featured-image/index.js.map +2 -2
  18. package/build-module/components/provider/use-block-editor-settings.js +9 -1
  19. package/build-module/components/provider/use-block-editor-settings.js.map +2 -2
  20. package/build-module/hooks/media-upload.js +67 -6
  21. package/build-module/hooks/media-upload.js.map +2 -2
  22. package/build-style/style-rtl.css +49 -16
  23. package/build-style/style.css +49 -16
  24. package/build-types/components/global-styles/index.d.ts.map +1 -1
  25. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  26. package/package.json +40 -40
  27. package/src/bindings/test/post-data.js +199 -0
  28. package/src/components/collab-sidebar/comments.js +66 -8
  29. package/src/components/global-styles/index.js +8 -9
  30. package/src/components/global-styles-sidebar/style.scss +7 -0
  31. package/src/components/post-featured-image/index.js +1 -44
  32. package/src/components/provider/use-block-editor-settings.js +8 -0
  33. package/src/hooks/media-upload.js +75 -7
  34. package/tsconfig.tsbuildinfo +1 -1
@@ -257,6 +257,26 @@
257
257
  font-size: 12px;
258
258
  }
259
259
 
260
+ .admin-ui-breadcrumbs__list {
261
+ list-style: none;
262
+ padding: 0;
263
+ margin: 0;
264
+ gap: 0;
265
+ font-size: 15px;
266
+ min-height: 32px;
267
+ font-weight: 500;
268
+ }
269
+
270
+ .admin-ui-breadcrumbs__list li:not(:last-child)::after {
271
+ content: "/";
272
+ margin: 0 8px;
273
+ }
274
+
275
+ .admin-ui-breadcrumbs__list h1 {
276
+ font-size: inherit;
277
+ line-height: inherit;
278
+ }
279
+
260
280
  /**
261
281
  * Colors
262
282
  */
@@ -1553,6 +1573,7 @@ button.font-library-modal__upload-area {
1553
1573
  flex-direction: column;
1554
1574
  font-size: 13px;
1555
1575
  line-height: 1.4;
1576
+ background-color: inherit;
1556
1577
  }
1557
1578
 
1558
1579
  .dataviews__view-actions,
@@ -1562,6 +1583,7 @@ button.font-library-modal__upload-area {
1562
1583
  flex-shrink: 0;
1563
1584
  position: sticky;
1564
1585
  left: 0;
1586
+ background-color: inherit;
1565
1587
  }
1566
1588
 
1567
1589
  @media not (prefers-reduced-motion) {
@@ -2297,7 +2319,7 @@ button.font-library-modal__upload-area {
2297
2319
  position: sticky;
2298
2320
  bottom: 0;
2299
2321
  left: 0;
2300
- background-color: #fff;
2322
+ background-color: inherit;
2301
2323
  padding: 12px 48px;
2302
2324
  border-top: 1px solid #f0f0f0;
2303
2325
  flex-shrink: 0;
@@ -2676,6 +2698,7 @@ div.dataviews-view-list {
2676
2698
  width: max-content;
2677
2699
  flex: 0 0 auto;
2678
2700
  gap: 4px;
2701
+ white-space: nowrap;
2679
2702
  }
2680
2703
 
2681
2704
  .dataviews-view-list div[role=row] .dataviews-view-list__item-actions .components-button,
@@ -2879,6 +2902,7 @@ div.dataviews-view-list {
2879
2902
  position: relative;
2880
2903
  color: #757575;
2881
2904
  margin-bottom: auto;
2905
+ background-color: inherit;
2882
2906
  }
2883
2907
 
2884
2908
  .dataviews-view-table th {
@@ -2902,7 +2926,7 @@ div.dataviews-view-list {
2902
2926
  .dataviews-view-table th.dataviews-view-table__actions-column--sticky {
2903
2927
  position: sticky;
2904
2928
  right: 0;
2905
- background-color: #fff;
2929
+ background-color: inherit;
2906
2930
  }
2907
2931
 
2908
2932
  .dataviews-view-table td.dataviews-view-table__actions-column--stuck::after,
@@ -2930,6 +2954,7 @@ div.dataviews-view-list {
2930
2954
 
2931
2955
  .dataviews-view-table tr {
2932
2956
  border-top: 1px solid #f0f0f0;
2957
+ background-color: inherit;
2933
2958
  }
2934
2959
 
2935
2960
  .dataviews-view-table tr .dataviews-view-table-header-button {
@@ -2955,10 +2980,6 @@ div.dataviews-view-list {
2955
2980
  border-bottom: 0;
2956
2981
  }
2957
2982
 
2958
- .dataviews-view-table tr.is-hovered, .dataviews-view-table tr.is-hovered .dataviews-view-table__actions-column--sticky {
2959
- background-color: #f8f8f8;
2960
- }
2961
-
2962
2983
  .dataviews-view-table tr .components-checkbox-control__input.components-checkbox-control__input {
2963
2984
  opacity: 0;
2964
2985
  }
@@ -2971,13 +2992,6 @@ div.dataviews-view-list {
2971
2992
  opacity: 0;
2972
2993
  }
2973
2994
 
2974
- .dataviews-view-table tr:focus-within .components-checkbox-control__input,
2975
- .dataviews-view-table tr:focus-within .dataviews-item-actions .components-button:not(.dataviews-all-actions-button), .dataviews-view-table tr.is-hovered .components-checkbox-control__input,
2976
- .dataviews-view-table tr.is-hovered .dataviews-item-actions .components-button:not(.dataviews-all-actions-button), .dataviews-view-table tr:hover .components-checkbox-control__input,
2977
- .dataviews-view-table tr:hover .dataviews-item-actions .components-button:not(.dataviews-all-actions-button) {
2978
- opacity: 1;
2979
- }
2980
-
2981
2995
  @media (hover: none) {
2982
2996
  .dataviews-view-table tr .components-checkbox-control__input.components-checkbox-control__input,
2983
2997
  .dataviews-view-table tr .dataviews-item-actions .components-button:not(.dataviews-all-actions-button) {
@@ -2985,7 +2999,7 @@ div.dataviews-view-list {
2985
2999
  }
2986
3000
  }
2987
3001
  .dataviews-view-table tr.is-selected {
2988
- background-color: rgba(var(--wp-admin-theme-color--rgb), 0.04);
3002
+ background-color: color-mix(in srgb, rgb(var(--wp-admin-theme-color--rgb)) 4%, #fff);
2989
3003
  color: #757575;
2990
3004
  }
2991
3005
 
@@ -2994,7 +3008,7 @@ div.dataviews-view-list {
2994
3008
  }
2995
3009
 
2996
3010
  .dataviews-view-table tr.is-selected:hover {
2997
- background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
3011
+ background-color: color-mix(in srgb, rgb(var(--wp-admin-theme-color--rgb)) 8%, #fff);
2998
3012
  }
2999
3013
 
3000
3014
  .dataviews-view-table tr.is-selected .dataviews-view-table__actions-column--sticky {
@@ -3005,10 +3019,22 @@ div.dataviews-view-list {
3005
3019
  background-color: color-mix(in srgb, rgb(var(--wp-admin-theme-color--rgb)) 8%, #fff);
3006
3020
  }
3007
3021
 
3022
+ .dataviews-view-table.has-bulk-actions tr:not(.is-selected).is-hovered, .dataviews-view-table.has-bulk-actions tr:not(.is-selected).is-hovered .dataviews-view-table__actions-column--sticky {
3023
+ background-color: #f8f8f8;
3024
+ }
3025
+
3026
+ .dataviews-view-table.has-bulk-actions tr:focus-within .components-checkbox-control__input,
3027
+ .dataviews-view-table.has-bulk-actions tr:focus-within .dataviews-item-actions .components-button:not(.dataviews-all-actions-button), .dataviews-view-table.has-bulk-actions tr.is-hovered .components-checkbox-control__input,
3028
+ .dataviews-view-table.has-bulk-actions tr.is-hovered .dataviews-item-actions .components-button:not(.dataviews-all-actions-button), .dataviews-view-table.has-bulk-actions tr:hover .components-checkbox-control__input,
3029
+ .dataviews-view-table.has-bulk-actions tr:hover .dataviews-item-actions .components-button:not(.dataviews-all-actions-button) {
3030
+ opacity: 1;
3031
+ }
3032
+
3008
3033
  .dataviews-view-table thead {
3009
3034
  position: sticky;
3010
3035
  inset-block-start: 0;
3011
3036
  z-index: 1;
3037
+ background-color: inherit;
3012
3038
  }
3013
3039
 
3014
3040
  .dataviews-view-table thead tr {
@@ -3020,7 +3046,7 @@ div.dataviews-view-list {
3020
3046
  }
3021
3047
 
3022
3048
  .dataviews-view-table thead th {
3023
- background-color: #fff;
3049
+ background-color: inherit;
3024
3050
  padding-top: 8px;
3025
3051
  padding-bottom: 8px;
3026
3052
  padding-left: 12px;
@@ -3329,6 +3355,10 @@ div.dataviews-view-list {
3329
3355
  padding: 0 48px;
3330
3356
  }
3331
3357
 
3358
+ .dataviews-view-picker-table {
3359
+ background-color: inherit;
3360
+ }
3361
+
3332
3362
  .dataviews-view-picker-table tbody:focus-visible[aria-activedescendant] {
3333
3363
  outline: none;
3334
3364
  }
@@ -4308,6 +4338,9 @@ div.dataviews-view-list {
4308
4338
  .editor-welcome-guide__text img {
4309
4339
  vertical-align: bottom;
4310
4340
  }
4341
+ .editor-welcome-guide .components-button:hover svg {
4342
+ fill: #fff;
4343
+ }
4311
4344
 
4312
4345
  .editor-header {
4313
4346
  box-sizing: border-box;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/global-styles/index.js"],"names":[],"mappings":"AA0FA;;;uCAgCC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/global-styles/index.js"],"names":[],"mappings":"AAyFA;;;uCAgCC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-block-editor-settings.d.ts","sourceRoot":"","sources":["../../../src/components/provider/use-block-editor-settings.js"],"names":[],"mappings":";AAoGA;;;;;;;;;GASG;AACH,kDAPW,MAAM,YACN,MAAM,UACN,MAAM,iBACN,MAAM,GAEL,MAAM,CAwQjB"}
1
+ {"version":3,"file":"use-block-editor-settings.d.ts","sourceRoot":"","sources":["../../../src/components/provider/use-block-editor-settings.js"],"names":[],"mappings":";AAqGA;;;;;;;;;GASG;AACH,kDAPW,MAAM,YACN,MAAM,UACN,MAAM,iBACN,MAAM,GAEL,MAAM,CA+QjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.35.1-next.16d95556a.0",
3
+ "version": "14.35.2-next.dc3f6d3c1.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -53,44 +53,44 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "@floating-ui/react-dom": "2.0.8",
56
- "@wordpress/a11y": "^4.35.1-next.16d95556a.0",
57
- "@wordpress/api-fetch": "^7.35.1-next.16d95556a.0",
58
- "@wordpress/base-styles": "^6.11.1-next.16d95556a.0",
59
- "@wordpress/blob": "^4.35.1-next.16d95556a.0",
60
- "@wordpress/block-editor": "^15.8.1-next.16d95556a.0",
61
- "@wordpress/blocks": "^15.8.1-next.16d95556a.0",
62
- "@wordpress/commands": "^1.35.1-next.16d95556a.0",
63
- "@wordpress/components": "^30.8.1-next.16d95556a.0",
64
- "@wordpress/compose": "^7.35.1-next.16d95556a.0",
65
- "@wordpress/core-data": "^7.35.1-next.16d95556a.0",
66
- "@wordpress/data": "^10.35.1-next.16d95556a.0",
67
- "@wordpress/dataviews": "^10.3.1-next.16d95556a.0",
68
- "@wordpress/date": "^5.35.1-next.16d95556a.0",
69
- "@wordpress/deprecated": "^4.35.1-next.16d95556a.0",
70
- "@wordpress/dom": "^4.35.1-next.16d95556a.0",
71
- "@wordpress/element": "^6.35.1-next.16d95556a.0",
72
- "@wordpress/fields": "^0.27.1-next.16d95556a.0",
73
- "@wordpress/global-styles-engine": "^1.2.1-next.16d95556a.0",
74
- "@wordpress/global-styles-ui": "^1.2.1-next.16d95556a.0",
75
- "@wordpress/hooks": "^4.35.1-next.16d95556a.0",
76
- "@wordpress/html-entities": "^4.35.1-next.16d95556a.0",
77
- "@wordpress/i18n": "^6.8.1-next.16d95556a.0",
78
- "@wordpress/icons": "^11.2.1-next.16d95556a.0",
79
- "@wordpress/interface": "^9.20.1-next.16d95556a.0",
80
- "@wordpress/keyboard-shortcuts": "^5.35.1-next.16d95556a.0",
81
- "@wordpress/keycodes": "^4.35.1-next.16d95556a.0",
82
- "@wordpress/media-utils": "^5.35.1-next.16d95556a.0",
83
- "@wordpress/notices": "^5.35.1-next.16d95556a.0",
84
- "@wordpress/patterns": "^2.35.1-next.16d95556a.0",
85
- "@wordpress/plugins": "^7.35.1-next.16d95556a.0",
86
- "@wordpress/preferences": "^4.35.1-next.16d95556a.0",
87
- "@wordpress/private-apis": "^1.35.1-next.16d95556a.0",
88
- "@wordpress/reusable-blocks": "^5.35.1-next.16d95556a.0",
89
- "@wordpress/rich-text": "^7.35.1-next.16d95556a.0",
90
- "@wordpress/server-side-render": "^6.11.1-next.16d95556a.0",
91
- "@wordpress/url": "^4.35.1-next.16d95556a.0",
92
- "@wordpress/warning": "^3.35.1-next.16d95556a.0",
93
- "@wordpress/wordcount": "^4.35.1-next.16d95556a.0",
56
+ "@wordpress/a11y": "^4.35.1-next.dc3f6d3c1.0",
57
+ "@wordpress/api-fetch": "^7.35.1-next.dc3f6d3c1.0",
58
+ "@wordpress/base-styles": "^6.11.1-next.dc3f6d3c1.0",
59
+ "@wordpress/blob": "^4.35.1-next.dc3f6d3c1.0",
60
+ "@wordpress/block-editor": "^15.8.1-next.dc3f6d3c1.0",
61
+ "@wordpress/blocks": "^15.8.1-next.dc3f6d3c1.0",
62
+ "@wordpress/commands": "^1.35.1-next.dc3f6d3c1.0",
63
+ "@wordpress/components": "^30.8.2-next.dc3f6d3c1.0",
64
+ "@wordpress/compose": "^7.35.1-next.dc3f6d3c1.0",
65
+ "@wordpress/core-data": "^7.35.1-next.dc3f6d3c1.0",
66
+ "@wordpress/data": "^10.35.1-next.dc3f6d3c1.0",
67
+ "@wordpress/dataviews": "^10.4.1-next.dc3f6d3c1.0",
68
+ "@wordpress/date": "^5.35.1-next.dc3f6d3c1.0",
69
+ "@wordpress/deprecated": "^4.35.1-next.dc3f6d3c1.0",
70
+ "@wordpress/dom": "^4.35.1-next.dc3f6d3c1.0",
71
+ "@wordpress/element": "^6.35.1-next.dc3f6d3c1.0",
72
+ "@wordpress/fields": "^0.27.1-next.dc3f6d3c1.0",
73
+ "@wordpress/global-styles-engine": "^1.2.1-next.dc3f6d3c1.0",
74
+ "@wordpress/global-styles-ui": "^1.2.1-next.dc3f6d3c1.0",
75
+ "@wordpress/hooks": "^4.35.1-next.dc3f6d3c1.0",
76
+ "@wordpress/html-entities": "^4.35.1-next.dc3f6d3c1.0",
77
+ "@wordpress/i18n": "^6.8.1-next.dc3f6d3c1.0",
78
+ "@wordpress/icons": "^11.2.1-next.dc3f6d3c1.0",
79
+ "@wordpress/interface": "^9.20.1-next.dc3f6d3c1.0",
80
+ "@wordpress/keyboard-shortcuts": "^5.35.1-next.dc3f6d3c1.0",
81
+ "@wordpress/keycodes": "^4.35.1-next.dc3f6d3c1.0",
82
+ "@wordpress/media-utils": "^5.35.1-next.dc3f6d3c1.0",
83
+ "@wordpress/notices": "^5.35.1-next.dc3f6d3c1.0",
84
+ "@wordpress/patterns": "^2.35.1-next.dc3f6d3c1.0",
85
+ "@wordpress/plugins": "^7.35.1-next.dc3f6d3c1.0",
86
+ "@wordpress/preferences": "^4.35.1-next.dc3f6d3c1.0",
87
+ "@wordpress/private-apis": "^1.35.1-next.dc3f6d3c1.0",
88
+ "@wordpress/reusable-blocks": "^5.35.1-next.dc3f6d3c1.0",
89
+ "@wordpress/rich-text": "^7.35.1-next.dc3f6d3c1.0",
90
+ "@wordpress/server-side-render": "^6.11.1-next.dc3f6d3c1.0",
91
+ "@wordpress/url": "^4.35.1-next.dc3f6d3c1.0",
92
+ "@wordpress/warning": "^3.35.1-next.dc3f6d3c1.0",
93
+ "@wordpress/wordcount": "^4.35.1-next.dc3f6d3c1.0",
94
94
  "change-case": "^4.1.2",
95
95
  "client-zip": "^2.4.5",
96
96
  "clsx": "^2.1.1",
@@ -108,5 +108,5 @@
108
108
  "publishConfig": {
109
109
  "access": "public"
110
110
  },
111
- "gitHead": "59a9383612bbe16e21af84d13b035bfbca7fe833"
111
+ "gitHead": "f73b5e69b34fbaccfb8c47783f4f993059ff1a41"
112
112
  }
@@ -0,0 +1,199 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as blockEditorStore } from '@wordpress/block-editor';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import postDataBindings from '../post-data';
10
+
11
+ describe( 'post-data bindings', () => {
12
+ describe( 'getValues', () => {
13
+ describe( 'for regular blocks using block context', () => {
14
+ let select;
15
+ beforeAll( () => {
16
+ select = ( store ) => {
17
+ if ( store === blockEditorStore ) {
18
+ return {
19
+ getBlockName: ( clientId ) =>
20
+ clientId === '123abc456'
21
+ ? 'core/post-date'
22
+ : undefined,
23
+ getBlockAttributes: () => ( {} ),
24
+ };
25
+ }
26
+ return {
27
+ getEditedEntityRecord: ( kind, name, recordId ) =>
28
+ name === 'post' && recordId === 123
29
+ ? {
30
+ date: '2024-03-02 00:00:00',
31
+ modified: '2025-06-07 00:00:00',
32
+ link: 'https://example.com/post',
33
+ unknown: 'Unknown field value',
34
+ }
35
+ : {},
36
+ };
37
+ };
38
+ } );
39
+
40
+ it( 'should return entity field values when they exist', () => {
41
+ const values = postDataBindings.getValues( {
42
+ select,
43
+ context: { postId: 123, postType: 'post' },
44
+ bindings: {
45
+ datetime: {
46
+ source: 'core/post-date',
47
+ args: { field: 'date' },
48
+ },
49
+ modified: {
50
+ source: 'core/post-date',
51
+ args: { field: 'modified' },
52
+ },
53
+ url: {
54
+ source: 'core/post-date',
55
+ args: { field: 'link' },
56
+ },
57
+ },
58
+ clientId: '123abc456',
59
+ } );
60
+
61
+ expect( values ).toStrictEqual( {
62
+ datetime: '2024-03-02 00:00:00',
63
+ modified: '2025-06-07 00:00:00',
64
+ url: 'https://example.com/post',
65
+ } );
66
+ } );
67
+
68
+ it( 'should fall back to field labels when entity value does not exist', () => {
69
+ const values = postDataBindings.getValues( {
70
+ select,
71
+ context: { postId: 456, postType: 'post' },
72
+ bindings: {
73
+ datetime: {
74
+ source: 'core/post-date',
75
+ args: { field: 'date' },
76
+ },
77
+ modified: {
78
+ source: 'core/post-date',
79
+ args: { field: 'modified' },
80
+ },
81
+ url: {
82
+ source: 'core/post-date',
83
+ args: { field: 'link' },
84
+ },
85
+ },
86
+ clientId: '123abc456',
87
+ } );
88
+
89
+ expect( values ).toStrictEqual( {
90
+ datetime: 'Post Date',
91
+ modified: 'Post Modified Date',
92
+ url: 'Post Link',
93
+ } );
94
+ } );
95
+
96
+ it( 'should return empty object for unknown fields', () => {
97
+ const values = postDataBindings.getValues( {
98
+ select,
99
+ context: { postId: 123, postType: 'post' },
100
+ bindings: {
101
+ content: {
102
+ source: 'core/post-date',
103
+ args: { field: 'unknown' },
104
+ },
105
+ },
106
+ clientId: '123abc456',
107
+ } );
108
+
109
+ expect( values.content ).toEqual( {} );
110
+ } );
111
+ } );
112
+
113
+ describe( 'for navigation blocks using block attributes', () => {
114
+ it( 'should use block attributes instead of context', () => {
115
+ const select = ( store ) => {
116
+ if ( store === blockEditorStore ) {
117
+ return {
118
+ getBlockName: () => 'core/navigation-link',
119
+ getBlockAttributes: () => ( {
120
+ id: 456,
121
+ type: 'page',
122
+ } ),
123
+ };
124
+ }
125
+ return {
126
+ getEditedEntityRecord: ( _kind, type, id ) => {
127
+ if ( type !== 'page' || id !== 456 ) {
128
+ return {};
129
+ }
130
+ return {
131
+ link: 'https://example.com/page',
132
+ };
133
+ },
134
+ };
135
+ };
136
+
137
+ const values = postDataBindings.getValues( {
138
+ select,
139
+ context: { postId: 123, postType: 'post' },
140
+ bindings: {
141
+ url: {
142
+ source: 'core/post-date',
143
+ args: { field: 'link' },
144
+ },
145
+ },
146
+ clientId: '123abc456',
147
+ } );
148
+
149
+ expect( values.url ).toBe( 'https://example.com/page' );
150
+ } );
151
+ } );
152
+ } );
153
+
154
+ describe( 'getFieldsList', () => {
155
+ it( 'should return the list of available post data fields when the Date block is selected', () => {
156
+ const select = () => ( {
157
+ getSelectedBlock: () => ( {
158
+ name: 'core/post-date',
159
+ } ),
160
+ } );
161
+
162
+ const fields = postDataBindings.getFieldsList( {
163
+ select,
164
+ } );
165
+
166
+ expect( fields ).toEqual( [
167
+ {
168
+ label: 'Post Date',
169
+ args: { field: 'date' },
170
+ type: 'string',
171
+ },
172
+ {
173
+ label: 'Post Modified Date',
174
+ args: { field: 'modified' },
175
+ type: 'string',
176
+ },
177
+ {
178
+ label: 'Post Link',
179
+ args: { field: 'link' },
180
+ type: 'string',
181
+ },
182
+ ] );
183
+ } );
184
+
185
+ it( 'should return an empty array when any other block than the Date block is selected', () => {
186
+ const select = () => ( {
187
+ getSelectedBlock: () => ( {
188
+ name: 'core/paragraph',
189
+ } ),
190
+ } );
191
+
192
+ const fields = postDataBindings.getFieldsList( {
193
+ select,
194
+ } );
195
+
196
+ expect( fields ).toEqual( [] );
197
+ } );
198
+ } );
199
+ } );
@@ -470,6 +470,7 @@ function Thread( {
470
470
  selectedThread,
471
471
  commentLastUpdated,
472
472
  } );
473
+ const isKeyboardTabbingRef = useRef( false );
473
474
 
474
475
  const onMouseEnter = () => {
475
476
  debouncedToggleBlockHighlight( thread.blockClientId, true );
@@ -479,13 +480,48 @@ function Thread( {
479
480
  debouncedToggleBlockHighlight( thread.blockClientId, false );
480
481
  };
481
482
 
483
+ const onFocus = () => {
484
+ toggleBlockHighlight( thread.blockClientId, true );
485
+ };
486
+
487
+ const onBlur = ( event ) => {
488
+ const isNoteFocused = event.relatedTarget?.closest(
489
+ '.editor-collab-sidebar-panel__thread'
490
+ );
491
+ const isDialogFocused =
492
+ event.relatedTarget?.closest( '[role="dialog"]' );
493
+ const isTabbing = isKeyboardTabbingRef.current;
494
+
495
+ // When another note is clicked, do nothing because the current note is automatically closed.
496
+ if ( isNoteFocused && ! isTabbing ) {
497
+ return;
498
+ }
499
+ // When deleting a note, a dialog appears, but the note should not be collapsed.
500
+ if ( isDialogFocused ) {
501
+ return;
502
+ }
503
+ // When tabbing, do nothing if the focus is within the current note.
504
+ if (
505
+ isTabbing &&
506
+ event.currentTarget.contains( event.relatedTarget )
507
+ ) {
508
+ return;
509
+ }
510
+
511
+ // Closes a note that has lost focus when any of the following conditions are met:
512
+ // - An element other than a note is clicked.
513
+ // - Focus was lost by tabbing.
514
+ toggleBlockHighlight( thread.blockClientId, false );
515
+ unselectThread();
516
+ };
517
+
482
518
  const handleCommentSelect = () => {
483
519
  setNewNoteFormState( 'closed' );
484
520
  setSelectedThread( thread.id );
521
+ toggleBlockSpotlight( thread.blockClientId, true );
485
522
  if ( !! thread.blockClientId ) {
486
523
  // Pass `null` as the second parameter to prevent focusing the block.
487
524
  selectBlock( thread.blockClientId, null );
488
- toggleBlockSpotlight( thread.blockClientId, true );
489
525
  }
490
526
  };
491
527
 
@@ -547,9 +583,20 @@ function Thread( {
547
583
  onClick={ handleCommentSelect }
548
584
  onMouseEnter={ onMouseEnter }
549
585
  onMouseLeave={ onMouseLeave }
550
- onFocus={ onMouseEnter }
551
- onBlur={ onMouseLeave }
552
- onKeyDown={ onKeyDown }
586
+ onFocus={ onFocus }
587
+ onBlur={ onBlur }
588
+ onKeyUp={ ( event ) => {
589
+ if ( event.key === 'Tab' ) {
590
+ isKeyboardTabbingRef.current = false;
591
+ }
592
+ } }
593
+ onKeyDown={ ( event ) => {
594
+ if ( event.key === 'Tab' ) {
595
+ isKeyboardTabbingRef.current = true;
596
+ } else {
597
+ onKeyDown( event );
598
+ }
599
+ } }
553
600
  tabIndex={ 0 }
554
601
  role="treeitem"
555
602
  aria-label={ ariaLabel }
@@ -774,6 +821,14 @@ const CommentBoard = ( {
774
821
  ? actions.filter( ( item ) => item.isEligible( thread ) )
775
822
  : [];
776
823
 
824
+ const deleteConfirmMessage =
825
+ // When deleting a top level note, descendants will also be deleted.
826
+ thread.parent === 0
827
+ ? __(
828
+ "Are you sure you want to delete this note? This will also delete all of this note's replies."
829
+ )
830
+ : __( 'Are you sure you want to delete this reply?' );
831
+
777
832
  return (
778
833
  <VStack
779
834
  spacing="2"
@@ -828,7 +883,12 @@ const CommentBoard = ( {
828
883
  />
829
884
  }
830
885
  />
831
- <Menu.Popover>
886
+ <Menu.Popover
887
+ // The menu popover is rendered in a portal, which causes focus to be
888
+ // lost and the note to be collapsed unintentionally. To prevent this,
889
+ // the popover should be rendered as an inline.
890
+ modal={ false }
891
+ >
832
892
  { moreActions.map( ( action ) => (
833
893
  <Menu.Item
834
894
  key={ action.id }
@@ -909,9 +969,7 @@ const CommentBoard = ( {
909
969
  onCancel={ handleCancel }
910
970
  confirmButtonText={ __( 'Delete' ) }
911
971
  >
912
- { __(
913
- "Are you sure you want to delete this note? This will also delete all of this note's replies."
914
- ) }
972
+ { deleteConfirmMessage }
915
973
  </ConfirmDialog>
916
974
  ) }
917
975
  </VStack>
@@ -32,16 +32,15 @@ function useServerData() {
32
32
  const editorSettings = getEditorSettings();
33
33
 
34
34
  const canUserUploadMedia = canUser( 'create', {
35
- kind: 'root',
36
- name: 'media',
35
+ kind: 'postType',
36
+ name: 'attachement',
37
37
  } );
38
38
 
39
39
  return {
40
- styles: editorSettings?.styles || [],
41
- __unstableResolvedAssets:
42
- editorSettings?.__unstableResolvedAssets || {},
43
- colors: editorSettings?.colors || [],
44
- gradients: editorSettings?.gradients || [],
40
+ styles: editorSettings?.styles,
41
+ __unstableResolvedAssets: editorSettings?.__unstableResolvedAssets,
42
+ colors: editorSettings?.colors,
43
+ gradients: editorSettings?.gradients,
45
44
  __experimentalDiscussionSettings:
46
45
  editorSettings?.__experimentalDiscussionSettings,
47
46
  mediaUploadHandler: canUserUploadMedia ? uploadMedia : undefined,
@@ -64,10 +63,10 @@ function useServerData() {
64
63
  settings: {
65
64
  color: {
66
65
  palette: {
67
- theme: colors,
66
+ theme: colors ?? [],
68
67
  },
69
68
  gradients: {
70
- theme: gradients,
69
+ theme: gradients ?? [],
71
70
  },
72
71
  duotone: {
73
72
  theme: [],
@@ -116,4 +116,11 @@
116
116
  vertical-align: bottom;
117
117
  }
118
118
  }
119
+ .components-button {
120
+ &:hover {
121
+ svg {
122
+ fill: $white;
123
+ }
124
+ }
125
+ }
119
126
  }