@wordpress/edit-post 8.43.1-next.v.202604091042.0 → 8.44.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 (31) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/layout/index.cjs.map +1 -1
  3. package/build/components/meta-boxes/use-meta-box-initialization.cjs +21 -4
  4. package/build/components/meta-boxes/use-meta-box-initialization.cjs.map +3 -3
  5. package/build/store/actions.cjs +8 -0
  6. package/build/store/actions.cjs.map +2 -2
  7. package/build/store/reducer.cjs +13 -3
  8. package/build/store/reducer.cjs.map +2 -2
  9. package/build/store/selectors.cjs +5 -0
  10. package/build/store/selectors.cjs.map +2 -2
  11. package/build-module/components/layout/index.mjs.map +1 -1
  12. package/build-module/components/meta-boxes/use-meta-box-initialization.mjs +21 -4
  13. package/build-module/components/meta-boxes/use-meta-box-initialization.mjs.map +2 -2
  14. package/build-module/store/actions.mjs +7 -0
  15. package/build-module/store/actions.mjs.map +2 -2
  16. package/build-module/store/reducer.mjs +11 -2
  17. package/build-module/store/reducer.mjs.map +2 -2
  18. package/build-module/store/selectors.mjs +4 -0
  19. package/build-module/store/selectors.mjs.map +2 -2
  20. package/build-style/classic-rtl.css +2 -1
  21. package/build-style/classic.css +2 -1
  22. package/build-style/style-rtl.css +15 -15
  23. package/build-style/style.css +15 -15
  24. package/package.json +33 -33
  25. package/src/classic.scss +4 -1
  26. package/src/components/layout/index.js +1 -1
  27. package/src/components/meta-boxes/test/use-meta-box-initialization.js +178 -0
  28. package/src/components/meta-boxes/use-meta-box-initialization.js +28 -3
  29. package/src/store/actions.js +13 -0
  30. package/src/store/reducer.js +18 -0
  31. package/src/store/selectors.js +12 -0
@@ -109,7 +109,7 @@
109
109
  .admin-ui-page {
110
110
  display: flex;
111
111
  height: 100%;
112
- background-color: var(--wpds-color-bg-surface-neutral-strong, #ffffff);
112
+ background-color: var(--wpds-color-bg-surface-neutral, #fcfcfc);
113
113
  color: var(--wpds-color-fg-content-neutral, #1e1e1e);
114
114
  position: relative;
115
115
  z-index: 1;
@@ -118,8 +118,8 @@
118
118
  }
119
119
 
120
120
  .admin-ui-page__header {
121
- padding: var(--wpds-dimension-padding-md, 12px) var(--wpds-dimension-padding-2xl, 24px);
122
- border-bottom: var(--wpds-border-width-xs, 1px) solid var(--wpds-color-stroke-surface-neutral-weak, #e0e0e0);
121
+ padding: var(--wpds-dimension-padding-lg, 16px) var(--wpds-dimension-padding-2xl, 24px);
122
+ border-bottom: var(--wpds-border-width-xs, 1px) solid var(--wpds-color-stroke-surface-neutral-weak, #e4e4e4);
123
123
  background: var(--wpds-color-bg-surface-neutral-strong, #ffffff);
124
124
  position: sticky;
125
125
  top: 0;
@@ -127,10 +127,10 @@
127
127
  }
128
128
 
129
129
  .admin-ui-page__header-title {
130
- font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
131
- font-size: var(--wpds-font-size-lg, 15px);
132
- font-weight: var(--wpds-font-weight-medium, 499);
133
- line-height: var(--wpds-font-line-height-lg, 28px);
130
+ font-family: var(--wpds-typography-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
131
+ font-size: var(--wpds-typography-font-size-lg, 15px);
132
+ font-weight: var(--wpds-typography-font-weight-medium, 499);
133
+ line-height: var(--wpds-typography-line-height-lg, 28px);
134
134
  margin: 0;
135
135
  overflow: hidden;
136
136
  text-overflow: ellipsis;
@@ -143,9 +143,9 @@
143
143
 
144
144
  .admin-ui-page__header-subtitle {
145
145
  padding-block-end: var(--wpds-dimension-padding-xs, 4px);
146
- color: var(--wpds-color-fg-content-neutral-weak, #6d6d6d);
147
- font-size: var(--wpds-font-size-md, 13px);
148
- line-height: var(--wpds-font-line-height-md, 24px);
146
+ color: var(--wpds-color-fg-content-neutral-weak, #707070);
147
+ font-size: var(--wpds-typography-font-size-md, 13px);
148
+ line-height: var(--wpds-typography-line-height-md, 24px);
149
149
  margin: 0;
150
150
  }
151
151
 
@@ -171,7 +171,7 @@
171
171
 
172
172
  .show-icon-labels .admin-ui-page__header-actions .components-button.has-icon::after {
173
173
  content: attr(aria-label);
174
- font-size: var(--wpds-font-size-sm, 12px);
174
+ font-size: var(--wpds-typography-font-size-sm, 12px);
175
175
  }
176
176
 
177
177
  /**
@@ -220,10 +220,10 @@
220
220
  * These variables do not appear to be used anywhere else.
221
221
  */
222
222
  .admin-ui-breadcrumbs__list {
223
- font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
224
- font-size: var(--wpds-font-size-lg, 15px);
225
- font-weight: var(--wpds-font-weight-medium, 499);
226
- line-height: var(--wpds-font-line-height-lg, 28px);
223
+ font-family: var(--wpds-typography-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
224
+ font-size: var(--wpds-typography-font-size-lg, 15px);
225
+ font-weight: var(--wpds-typography-font-weight-medium, 499);
226
+ line-height: var(--wpds-typography-line-height-lg, 28px);
227
227
  list-style: none;
228
228
  padding: 0;
229
229
  margin: 0;
@@ -109,7 +109,7 @@
109
109
  .admin-ui-page {
110
110
  display: flex;
111
111
  height: 100%;
112
- background-color: var(--wpds-color-bg-surface-neutral-strong, #ffffff);
112
+ background-color: var(--wpds-color-bg-surface-neutral, #fcfcfc);
113
113
  color: var(--wpds-color-fg-content-neutral, #1e1e1e);
114
114
  position: relative;
115
115
  z-index: 1;
@@ -118,8 +118,8 @@
118
118
  }
119
119
 
120
120
  .admin-ui-page__header {
121
- padding: var(--wpds-dimension-padding-md, 12px) var(--wpds-dimension-padding-2xl, 24px);
122
- border-bottom: var(--wpds-border-width-xs, 1px) solid var(--wpds-color-stroke-surface-neutral-weak, #e0e0e0);
121
+ padding: var(--wpds-dimension-padding-lg, 16px) var(--wpds-dimension-padding-2xl, 24px);
122
+ border-bottom: var(--wpds-border-width-xs, 1px) solid var(--wpds-color-stroke-surface-neutral-weak, #e4e4e4);
123
123
  background: var(--wpds-color-bg-surface-neutral-strong, #ffffff);
124
124
  position: sticky;
125
125
  top: 0;
@@ -127,10 +127,10 @@
127
127
  }
128
128
 
129
129
  .admin-ui-page__header-title {
130
- font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
131
- font-size: var(--wpds-font-size-lg, 15px);
132
- font-weight: var(--wpds-font-weight-medium, 499);
133
- line-height: var(--wpds-font-line-height-lg, 28px);
130
+ font-family: var(--wpds-typography-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
131
+ font-size: var(--wpds-typography-font-size-lg, 15px);
132
+ font-weight: var(--wpds-typography-font-weight-medium, 499);
133
+ line-height: var(--wpds-typography-line-height-lg, 28px);
134
134
  margin: 0;
135
135
  overflow: hidden;
136
136
  text-overflow: ellipsis;
@@ -143,9 +143,9 @@
143
143
 
144
144
  .admin-ui-page__header-subtitle {
145
145
  padding-block-end: var(--wpds-dimension-padding-xs, 4px);
146
- color: var(--wpds-color-fg-content-neutral-weak, #6d6d6d);
147
- font-size: var(--wpds-font-size-md, 13px);
148
- line-height: var(--wpds-font-line-height-md, 24px);
146
+ color: var(--wpds-color-fg-content-neutral-weak, #707070);
147
+ font-size: var(--wpds-typography-font-size-md, 13px);
148
+ line-height: var(--wpds-typography-line-height-md, 24px);
149
149
  margin: 0;
150
150
  }
151
151
 
@@ -171,7 +171,7 @@
171
171
 
172
172
  .show-icon-labels .admin-ui-page__header-actions .components-button.has-icon::after {
173
173
  content: attr(aria-label);
174
- font-size: var(--wpds-font-size-sm, 12px);
174
+ font-size: var(--wpds-typography-font-size-sm, 12px);
175
175
  }
176
176
 
177
177
  /**
@@ -220,10 +220,10 @@
220
220
  * These variables do not appear to be used anywhere else.
221
221
  */
222
222
  .admin-ui-breadcrumbs__list {
223
- font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
224
- font-size: var(--wpds-font-size-lg, 15px);
225
- font-weight: var(--wpds-font-weight-medium, 499);
226
- line-height: var(--wpds-font-line-height-lg, 28px);
223
+ font-family: var(--wpds-typography-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
224
+ font-size: var(--wpds-typography-font-size-lg, 15px);
225
+ font-weight: var(--wpds-typography-font-weight-medium, 499);
226
+ line-height: var(--wpds-typography-line-height-lg, 28px);
227
227
  list-style: none;
228
228
  padding: 0;
229
229
  margin: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "8.43.1-next.v.202604091042.0+668146787",
3
+ "version": "8.44.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -48,37 +48,37 @@
48
48
  "postbox"
49
49
  ],
50
50
  "dependencies": {
51
- "@wordpress/a11y": "^4.43.1-next.v.202604091042.0+668146787",
52
- "@wordpress/admin-ui": "^1.11.1-next.v.202604091042.0+668146787",
53
- "@wordpress/api-fetch": "^7.43.1-next.v.202604091042.0+668146787",
54
- "@wordpress/base-styles": "^6.19.1-next.v.202604091042.0+668146787",
55
- "@wordpress/block-editor": "^15.16.1-next.v.202604091042.0+668146787",
56
- "@wordpress/block-library": "^9.43.1-next.v.202604091042.0+668146787",
57
- "@wordpress/blocks": "^15.16.1-next.v.202604091042.0+668146787",
58
- "@wordpress/commands": "^1.43.1-next.v.202604091042.0+668146787",
59
- "@wordpress/components": "^32.5.2-next.v.202604091042.0+668146787",
60
- "@wordpress/compose": "^7.43.1-next.v.202604091042.0+668146787",
61
- "@wordpress/core-data": "^7.43.2-next.v.202604091042.0+668146787",
62
- "@wordpress/data": "^10.43.1-next.v.202604091042.0+668146787",
63
- "@wordpress/deprecated": "^4.43.1-next.v.202604091042.0+668146787",
64
- "@wordpress/dom": "^4.43.1-next.v.202604091042.0+668146787",
65
- "@wordpress/editor": "^14.43.1-next.v.202604091042.0+668146787",
66
- "@wordpress/element": "^6.44.1-next.v.202604091042.0+668146787",
67
- "@wordpress/global-styles-engine": "^1.10.1-next.v.202604091042.0+668146787",
68
- "@wordpress/hooks": "^4.43.1-next.v.202604091042.0+668146787",
69
- "@wordpress/html-entities": "^4.43.1-next.v.202604091042.0+668146787",
70
- "@wordpress/i18n": "^6.17.1-next.v.202604091042.0+668146787",
71
- "@wordpress/icons": "^12.1.1-next.v.202604091042.0+668146787",
72
- "@wordpress/keyboard-shortcuts": "^5.43.1-next.v.202604091042.0+668146787",
73
- "@wordpress/keycodes": "^4.43.1-next.v.202604091042.0+668146787",
74
- "@wordpress/notices": "^5.43.1-next.v.202604091042.0+668146787",
75
- "@wordpress/plugins": "^7.43.1-next.v.202604091042.0+668146787",
76
- "@wordpress/preferences": "^4.43.1-next.v.202604091042.0+668146787",
77
- "@wordpress/private-apis": "^1.43.1-next.v.202604091042.0+668146787",
78
- "@wordpress/url": "^4.43.1-next.v.202604091042.0+668146787",
79
- "@wordpress/viewport": "^6.43.1-next.v.202604091042.0+668146787",
80
- "@wordpress/warning": "^3.43.1-next.v.202604091042.0+668146787",
81
- "@wordpress/widgets": "^4.43.1-next.v.202604091042.0+668146787",
51
+ "@wordpress/a11y": "^4.44.0",
52
+ "@wordpress/admin-ui": "^1.12.0",
53
+ "@wordpress/api-fetch": "^7.44.0",
54
+ "@wordpress/base-styles": "^6.20.0",
55
+ "@wordpress/block-editor": "^15.17.0",
56
+ "@wordpress/block-library": "^9.44.0",
57
+ "@wordpress/blocks": "^15.17.0",
58
+ "@wordpress/commands": "^1.44.0",
59
+ "@wordpress/components": "^32.6.0",
60
+ "@wordpress/compose": "^7.44.0",
61
+ "@wordpress/core-data": "^7.44.0",
62
+ "@wordpress/data": "^10.44.0",
63
+ "@wordpress/deprecated": "^4.44.0",
64
+ "@wordpress/dom": "^4.44.0",
65
+ "@wordpress/editor": "^14.44.0",
66
+ "@wordpress/element": "^6.44.0",
67
+ "@wordpress/global-styles-engine": "^1.11.0",
68
+ "@wordpress/hooks": "^4.44.0",
69
+ "@wordpress/html-entities": "^4.44.0",
70
+ "@wordpress/i18n": "^6.17.0",
71
+ "@wordpress/icons": "^12.2.0",
72
+ "@wordpress/keyboard-shortcuts": "^5.44.0",
73
+ "@wordpress/keycodes": "^4.44.0",
74
+ "@wordpress/notices": "^5.44.0",
75
+ "@wordpress/plugins": "^7.44.0",
76
+ "@wordpress/preferences": "^4.44.0",
77
+ "@wordpress/private-apis": "^1.44.0",
78
+ "@wordpress/url": "^4.44.0",
79
+ "@wordpress/viewport": "^6.44.0",
80
+ "@wordpress/warning": "^3.44.0",
81
+ "@wordpress/widgets": "^4.44.0",
82
82
  "clsx": "^2.1.1",
83
83
  "memize": "^2.1.0"
84
84
  },
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "73606df74f1c38a084bfa5db97205259ef817593"
92
+ "gitHead": "b862d8c84121a47bbeff882f6c87e61681ce2e0d"
93
93
  }
package/src/classic.scss CHANGED
@@ -14,8 +14,11 @@
14
14
  // Themes with theme.json can control this themselves.
15
15
  // For full-wide blocks, we compensate for the base padding.
16
16
  // These margins should match the padding value above.
17
- html :where(.editor-styles-wrapper) {
17
+ .editor-styles-wrapper {
18
18
  padding: 8px;
19
+ }
20
+
21
+ html :where(.editor-styles-wrapper) {
19
22
  .block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"] {
20
23
  margin-left: -8px;
21
24
  margin-right: -8px;
@@ -329,7 +329,7 @@ function MetaBoxesMain( { isLegacy } ) {
329
329
  const separator = ! isShort && (
330
330
  <>
331
331
  <Tooltip text={ __( 'Drag to resize' ) }>
332
- <button // eslint-disable-line jsx-a11y/role-supports-aria-props
332
+ <button
333
333
  ref={ separatorRef }
334
334
  role="separator" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role
335
335
  aria-valuenow={ usedAriaValueNow }
@@ -0,0 +1,178 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render } from '@testing-library/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { RegistryProvider, createRegistry } from '@wordpress/data';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { useMetaBoxInitialization } from '../use-meta-box-initialization';
15
+ import { STORE_NAME } from '../../../store/constants';
16
+
17
+ // Mock unlock to be an identity function so private actions are directly accessible.
18
+ jest.mock( '../../../lock-unlock', () => ( {
19
+ unlock: ( value ) => value,
20
+ } ) );
21
+
22
+ const storeConfig = {
23
+ actions: {
24
+ forceUpdate: jest.fn( () => ( { type: 'FORCE_UPDATE' } ) ),
25
+ },
26
+ reducer: ( state = {}, action ) =>
27
+ action.type === 'FORCE_UPDATE' ? { ...state } : state,
28
+ };
29
+
30
+ const setCollaborationSupported = jest.fn( () => ( {
31
+ type: 'SET_COLLABORATION_SUPPORTED',
32
+ } ) );
33
+
34
+ const initializeMetaBoxes = jest.fn( () => ( {
35
+ type: 'META_BOXES_INITIALIZED',
36
+ } ) );
37
+
38
+ function createMockStores( {
39
+ isEditorReady = true,
40
+ isCollaborationEnabled = true,
41
+ metaBoxes = [],
42
+ rtcCompatibleIds = [],
43
+ } = {} ) {
44
+ return {
45
+ 'core/editor': {
46
+ ...storeConfig,
47
+ selectors: {
48
+ __unstableIsEditorReady: jest.fn( () => isEditorReady ),
49
+ isCollaborationEnabledForCurrentPost: jest.fn(
50
+ () => isCollaborationEnabled
51
+ ),
52
+ },
53
+ },
54
+ core: {
55
+ ...storeConfig,
56
+ actions: {
57
+ ...storeConfig.actions,
58
+ setCollaborationSupported,
59
+ },
60
+ },
61
+ [ STORE_NAME ]: {
62
+ ...storeConfig,
63
+ actions: {
64
+ ...storeConfig.actions,
65
+ initializeMetaBoxes,
66
+ },
67
+ selectors: {
68
+ getAllMetaBoxes: jest.fn( () => metaBoxes ),
69
+ getRtcCompatibleMetaBoxIds: jest.fn( () => rtcCompatibleIds ),
70
+ hasMetaBoxes: jest.fn( () => metaBoxes.length > 0 ),
71
+ getActiveMetaBoxLocations: jest.fn( () =>
72
+ metaBoxes.length > 0 ? [ 'normal' ] : []
73
+ ),
74
+ },
75
+ },
76
+ };
77
+ }
78
+
79
+ function TestComponent( { enabled } ) {
80
+ useMetaBoxInitialization( enabled );
81
+ return null;
82
+ }
83
+
84
+ function renderHook( registry, enabled = true ) {
85
+ return render(
86
+ <RegistryProvider value={ registry }>
87
+ <TestComponent enabled={ enabled } />
88
+ </RegistryProvider>
89
+ );
90
+ }
91
+
92
+ describe( 'useMetaBoxInitialization', () => {
93
+ afterEach( () => {
94
+ setCollaborationSupported.mockClear();
95
+ initializeMetaBoxes.mockClear();
96
+ } );
97
+
98
+ it( 'disables collaboration when metaboxes are present', () => {
99
+ const mockStores = createMockStores( {
100
+ metaBoxes: [
101
+ { id: 'my-metabox', title: 'My Meta Box' },
102
+ { id: 'another-metabox', title: 'Another' },
103
+ ],
104
+ } );
105
+ const registry = createRegistry( mockStores );
106
+
107
+ renderHook( registry );
108
+
109
+ expect( initializeMetaBoxes ).toHaveBeenCalled();
110
+ expect( setCollaborationSupported ).toHaveBeenCalledWith( false );
111
+ } );
112
+
113
+ it( 'does not disable collaboration when all metaboxes are rtcCompatible', () => {
114
+ const mockStores = createMockStores( {
115
+ metaBoxes: [
116
+ { id: 'my-metabox', title: 'My Meta Box' },
117
+ { id: 'another-metabox', title: 'Another' },
118
+ ],
119
+ rtcCompatibleIds: [ 'my-metabox', 'another-metabox' ],
120
+ } );
121
+ const registry = createRegistry( mockStores );
122
+
123
+ renderHook( registry );
124
+
125
+ expect( initializeMetaBoxes ).toHaveBeenCalled();
126
+ expect( setCollaborationSupported ).not.toHaveBeenCalled();
127
+ } );
128
+
129
+ it( 'disables collaboration when some metaboxes lack rtcCompatible', () => {
130
+ const mockStores = createMockStores( {
131
+ metaBoxes: [
132
+ { id: 'compatible-metabox', title: 'Compatible' },
133
+ { id: 'incompatible-metabox', title: 'Incompatible' },
134
+ ],
135
+ rtcCompatibleIds: [ 'compatible-metabox' ],
136
+ } );
137
+ const registry = createRegistry( mockStores );
138
+
139
+ renderHook( registry );
140
+
141
+ expect( setCollaborationSupported ).toHaveBeenCalledWith( false );
142
+ } );
143
+
144
+ it( 'does not disable collaboration when the only metabox is rtcCompatible', () => {
145
+ const mockStores = createMockStores( {
146
+ metaBoxes: [ { id: 'compatible-metabox', title: 'Compatible' } ],
147
+ rtcCompatibleIds: [ 'compatible-metabox' ],
148
+ } );
149
+ const registry = createRegistry( mockStores );
150
+
151
+ renderHook( registry );
152
+
153
+ expect( setCollaborationSupported ).not.toHaveBeenCalled();
154
+ } );
155
+
156
+ it( 'does not disable collaboration when there are no metaboxes', () => {
157
+ const mockStores = createMockStores( {
158
+ metaBoxes: [],
159
+ } );
160
+ const registry = createRegistry( mockStores );
161
+
162
+ renderHook( registry );
163
+
164
+ expect( setCollaborationSupported ).not.toHaveBeenCalled();
165
+ } );
166
+
167
+ it( 'does not disable collaboration when collaboration is not enabled', () => {
168
+ const mockStores = createMockStores( {
169
+ isCollaborationEnabled: false,
170
+ metaBoxes: [ { id: 'my-metabox', title: 'My Meta Box' } ],
171
+ } );
172
+ const registry = createRegistry( mockStores );
173
+
174
+ renderHook( registry );
175
+
176
+ expect( setCollaborationSupported ).not.toHaveBeenCalled();
177
+ } );
178
+ } );
@@ -18,18 +18,32 @@ import { unlock } from '../../lock-unlock';
18
18
  * @param { boolean } enabled
19
19
  */
20
20
  export const useMetaBoxInitialization = ( enabled ) => {
21
- const { isEnabledAndEditorReady, isCollaborationEnabled } = useSelect(
21
+ const {
22
+ isEnabledAndEditorReady,
23
+ isCollaborationEnabled,
24
+ hasMetaBoxes,
25
+ allMetaBoxes,
26
+ rtcCompatibleIds,
27
+ } = useSelect(
22
28
  ( select ) => ( {
23
29
  isEnabledAndEditorReady:
24
30
  enabled && select( editorStore ).__unstableIsEditorReady(),
25
31
  isCollaborationEnabled:
26
32
  select( editorStore ).isCollaborationEnabledForCurrentPost(),
33
+ hasMetaBoxes: enabled
34
+ ? select( editPostStore ).hasMetaBoxes()
35
+ : false,
36
+ allMetaBoxes: enabled
37
+ ? select( editPostStore ).getAllMetaBoxes()
38
+ : undefined,
39
+ rtcCompatibleIds:
40
+ select( editPostStore ).getRtcCompatibleMetaBoxIds(),
27
41
  } ),
28
42
  [ enabled ]
29
43
  );
30
44
  const { setCollaborationSupported } = unlock( useDispatch( coreStore ) );
31
-
32
45
  const { initializeMetaBoxes } = useDispatch( editPostStore );
46
+
33
47
  // The effect has to rerun when the editor is ready because initializeMetaBoxes
34
48
  // will noop until then.
35
49
  useEffect( () => {
@@ -37,8 +51,16 @@ export const useMetaBoxInitialization = ( enabled ) => {
37
51
  initializeMetaBoxes();
38
52
 
39
53
  // Disable real-time collaboration when legacy meta boxes are detected.
54
+ // Meta boxes marked with __rtc_compatible_meta_box on the server
55
+ // have their IDs stored via setRtcCompatibleMetaBoxIds().
40
56
  if ( isCollaborationEnabled ) {
41
- setCollaborationSupported( false );
57
+ const hasIncompatibleMetaBoxes = allMetaBoxes?.some(
58
+ ( metaBox ) => ! rtcCompatibleIds.includes( metaBox.id )
59
+ );
60
+
61
+ if ( hasIncompatibleMetaBoxes ) {
62
+ setCollaborationSupported( false );
63
+ }
42
64
  }
43
65
  }
44
66
  }, [
@@ -46,5 +68,8 @@ export const useMetaBoxInitialization = ( enabled ) => {
46
68
  initializeMetaBoxes,
47
69
  isCollaborationEnabled,
48
70
  setCollaborationSupported,
71
+ hasMetaBoxes,
72
+ allMetaBoxes,
73
+ rtcCompatibleIds,
49
74
  ] );
50
75
  };
@@ -277,6 +277,19 @@ export function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {
277
277
  };
278
278
  }
279
279
 
280
+ /**
281
+ * Stores the IDs of meta boxes marked as compatible with real-time collaboration
282
+ * via the __rtc_compatible_meta_box flag on the server.
283
+ *
284
+ * @param {string[]} ids Meta box IDs that are RTC-compatible.
285
+ */
286
+ export function setRtcCompatibleMetaBoxIds( ids ) {
287
+ return {
288
+ type: 'SET_RTC_COMPATIBLE_META_BOX_IDS',
289
+ ids,
290
+ };
291
+ }
292
+
280
293
  /**
281
294
  * Update a metabox.
282
295
  */
@@ -83,10 +83,28 @@ function metaBoxesInitialized( state = false, action ) {
83
83
  return state;
84
84
  }
85
85
 
86
+ /**
87
+ * Reducer tracking meta box IDs marked as compatible with real-time collaboration
88
+ * via the add_meta_box() __rtc_compatible_meta_box compatibility flag.
89
+ *
90
+ * @param {string[]} state Previous state.
91
+ * @param {Object} action Action Object.
92
+ *
93
+ * @return {string[]} Updated state.
94
+ */
95
+ export function rtcCompatibleMetaBoxIds( state = [], action ) {
96
+ switch ( action.type ) {
97
+ case 'SET_RTC_COMPATIBLE_META_BOX_IDS':
98
+ return action.ids;
99
+ }
100
+ return state;
101
+ }
102
+
86
103
  const metaBoxes = combineReducers( {
87
104
  isSaving: isSavingMetaBoxes,
88
105
  locations: metaBoxLocations,
89
106
  initialized: metaBoxesInitialized,
107
+ rtcCompatibleIds: rtcCompatibleMetaBoxIds,
90
108
  } );
91
109
 
92
110
  export default combineReducers( {
@@ -424,6 +424,18 @@ export const getAllMetaBoxes = createSelector(
424
424
  ( state ) => [ state.metaBoxes.locations ]
425
425
  );
426
426
 
427
+ /**
428
+ * Returns the list of meta box IDs marked as compatible with real-time
429
+ * collaboration via the add_meta_box() __rtc_compatible_meta_box compatibility flag.
430
+ *
431
+ * @param {Object} state Global application state.
432
+ *
433
+ * @return {string[]} List of RTC-compatible meta box IDs.
434
+ */
435
+ export function getRtcCompatibleMetaBoxIds( state ) {
436
+ return state.metaBoxes.rtcCompatibleIds;
437
+ }
438
+
427
439
  /**
428
440
  * Returns true if the post is using Meta Boxes
429
441
  *