@wordpress/edit-post 8.44.0 → 8.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/back-button/fullscreen-mode-close.cjs +1 -1
  3. package/build/components/back-button/fullscreen-mode-close.cjs.map +1 -1
  4. package/build/components/layout/index.cjs +2 -1
  5. package/build/components/layout/index.cjs.map +2 -2
  6. package/build/components/meta-boxes/use-meta-box-initialization.cjs +5 -16
  7. package/build/components/meta-boxes/use-meta-box-initialization.cjs.map +2 -2
  8. package/build/store/actions.cjs +0 -8
  9. package/build/store/actions.cjs.map +2 -2
  10. package/build/store/reducer.cjs +7 -14
  11. package/build/store/reducer.cjs.map +2 -2
  12. package/build/store/selectors.cjs +0 -5
  13. package/build/store/selectors.cjs.map +2 -2
  14. package/build-module/components/back-button/fullscreen-mode-close.mjs +1 -1
  15. package/build-module/components/back-button/fullscreen-mode-close.mjs.map +1 -1
  16. package/build-module/components/layout/index.mjs +1 -1
  17. package/build-module/components/layout/index.mjs.map +2 -2
  18. package/build-module/components/meta-boxes/use-meta-box-initialization.mjs +5 -16
  19. package/build-module/components/meta-boxes/use-meta-box-initialization.mjs.map +2 -2
  20. package/build-module/store/actions.mjs +0 -7
  21. package/build-module/store/actions.mjs.map +2 -2
  22. package/build-module/store/reducer.mjs +6 -12
  23. package/build-module/store/reducer.mjs.map +2 -2
  24. package/build-module/store/selectors.mjs +0 -4
  25. package/build-module/store/selectors.mjs.map +2 -2
  26. package/build-style/style-rtl.css +1 -136
  27. package/build-style/style.css +1 -136
  28. package/package.json +34 -33
  29. package/src/components/back-button/fullscreen-mode-close.js +1 -1
  30. package/src/components/layout/index.js +1 -1
  31. package/src/components/layout/style.scss +1 -1
  32. package/src/components/meta-boxes/test/use-meta-box-initialization.js +22 -9
  33. package/src/components/meta-boxes/use-meta-box-initialization.js +9 -24
  34. package/src/store/actions.js +0 -13
  35. package/src/store/reducer.js +4 -19
  36. package/src/store/selectors.js +0 -12
  37. package/src/style.scss +0 -1
@@ -21,23 +21,18 @@ export const useMetaBoxInitialization = ( enabled ) => {
21
21
  const {
22
22
  isEnabledAndEditorReady,
23
23
  isCollaborationEnabled,
24
- hasMetaBoxes,
25
- allMetaBoxes,
26
- rtcCompatibleIds,
24
+ hasIncompatibleMetaBoxes,
27
25
  } = useSelect(
28
26
  ( select ) => ( {
29
27
  isEnabledAndEditorReady:
30
28
  enabled && select( editorStore ).__unstableIsEditorReady(),
31
29
  isCollaborationEnabled:
32
30
  select( editorStore ).isCollaborationEnabledForCurrentPost(),
33
- hasMetaBoxes: enabled
34
- ? select( editPostStore ).hasMetaBoxes()
31
+ hasIncompatibleMetaBoxes: enabled
32
+ ? select( editPostStore )
33
+ .getAllMetaBoxes()
34
+ .some( ( metaBox ) => ! metaBox.__rtc_compatible )
35
35
  : false,
36
- allMetaBoxes: enabled
37
- ? select( editPostStore ).getAllMetaBoxes()
38
- : undefined,
39
- rtcCompatibleIds:
40
- select( editPostStore ).getRtcCompatibleMetaBoxIds(),
41
36
  } ),
42
37
  [ enabled ]
43
38
  );
@@ -50,17 +45,9 @@ export const useMetaBoxInitialization = ( enabled ) => {
50
45
  if ( isEnabledAndEditorReady ) {
51
46
  initializeMetaBoxes();
52
47
 
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().
56
- if ( isCollaborationEnabled ) {
57
- const hasIncompatibleMetaBoxes = allMetaBoxes?.some(
58
- ( metaBox ) => ! rtcCompatibleIds.includes( metaBox.id )
59
- );
60
-
61
- if ( hasIncompatibleMetaBoxes ) {
62
- setCollaborationSupported( false );
63
- }
48
+ // Disable real-time collaboration when incompatible meta boxes are detected.
49
+ if ( isCollaborationEnabled && hasIncompatibleMetaBoxes ) {
50
+ setCollaborationSupported( false );
64
51
  }
65
52
  }
66
53
  }, [
@@ -68,8 +55,6 @@ export const useMetaBoxInitialization = ( enabled ) => {
68
55
  initializeMetaBoxes,
69
56
  isCollaborationEnabled,
70
57
  setCollaborationSupported,
71
- hasMetaBoxes,
72
- allMetaBoxes,
73
- rtcCompatibleIds,
58
+ hasIncompatibleMetaBoxes,
74
59
  ] );
75
60
  };
@@ -277,19 +277,6 @@ 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
-
293
280
  /**
294
281
  * Update a metabox.
295
282
  */
@@ -32,7 +32,10 @@ function mergeMetaboxes( metaboxes = [], newMetaboxes ) {
32
32
  ( box ) => box.id === metabox.id
33
33
  );
34
34
  if ( existing !== -1 ) {
35
- mergedMetaboxes[ existing ] = metabox;
35
+ mergedMetaboxes[ existing ] = {
36
+ ...mergedMetaboxes[ existing ],
37
+ ...metabox,
38
+ };
36
39
  } else {
37
40
  mergedMetaboxes.push( metabox );
38
41
  }
@@ -83,28 +86,10 @@ function metaBoxesInitialized( state = false, action ) {
83
86
  return state;
84
87
  }
85
88
 
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
-
103
89
  const metaBoxes = combineReducers( {
104
90
  isSaving: isSavingMetaBoxes,
105
91
  locations: metaBoxLocations,
106
92
  initialized: metaBoxesInitialized,
107
- rtcCompatibleIds: rtcCompatibleMetaBoxIds,
108
93
  } );
109
94
 
110
95
  export default combineReducers( {
@@ -424,18 +424,6 @@ 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
-
439
427
  /**
440
428
  * Returns true if the post is using Meta Boxes
441
429
  *
package/src/style.scss CHANGED
@@ -1,7 +1,6 @@
1
1
  @use "@wordpress/base-styles/default-custom-properties";
2
2
  @use "@wordpress/base-styles/mixins" as *;
3
3
  @use "@wordpress/base-styles/variables" as *;
4
- @use "@wordpress/admin-ui/build-style/style.css" as *;
5
4
  @use "./components/back-button/style.scss" as *;
6
5
  @use "./components/layout/style.scss" as *;
7
6
  @use "./components/meta-boxes/meta-boxes-area/style.scss" as *;