@wordpress/editor 14.41.2-next.v.202603161435.0 → 14.43.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 (311) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/components/collaborators-overlay/compute-selection.cjs +10 -10
  3. package/build/components/collaborators-overlay/compute-selection.cjs.map +2 -2
  4. package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
  5. package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
  6. package/build/components/collaborators-overlay/index.cjs +7 -2
  7. package/build/components/collaborators-overlay/index.cjs.map +2 -2
  8. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
  9. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +2 -2
  10. package/build/components/collaborators-overlay/overlay.cjs +42 -1
  11. package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
  12. package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
  13. package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
  14. package/build/components/collaborators-overlay/use-render-cursors.cjs +1 -1
  15. package/build/components/collaborators-overlay/use-render-cursors.cjs.map +2 -2
  16. package/build/components/collaborators-presence/index.cjs +14 -4
  17. package/build/components/collaborators-presence/index.cjs.map +2 -2
  18. package/build/components/collaborators-presence/list.cjs +20 -4
  19. package/build/components/collaborators-presence/list.cjs.map +2 -2
  20. package/build/components/post-card-panel/index.cjs +4 -15
  21. package/build/components/post-card-panel/index.cjs.map +2 -2
  22. package/build/components/post-content-information/index.cjs +10 -13
  23. package/build/components/post-content-information/index.cjs.map +2 -2
  24. package/build/components/post-locked-modal/index.cjs +16 -3
  25. package/build/components/post-locked-modal/index.cjs.map +2 -2
  26. package/build/components/post-revisions-panel/index.cjs +164 -0
  27. package/build/components/post-revisions-panel/index.cjs.map +7 -0
  28. package/build/components/post-revisions-preview/block-diff.cjs +39 -11
  29. package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
  30. package/build/components/post-revisions-preview/diff-markers.cjs +2 -2
  31. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  32. package/build/components/post-revisions-preview/revisions-canvas.cjs +1 -1
  33. package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
  34. package/build/components/post-revisions-preview/revisions-slider.cjs +24 -5
  35. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  36. package/build/components/post-template/block-theme.cjs +7 -4
  37. package/build/components/post-template/block-theme.cjs.map +2 -2
  38. package/build/components/post-template/create-new-template-modal.cjs +39 -46
  39. package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
  40. package/build/components/post-template/hooks.cjs +91 -8
  41. package/build/components/post-template/hooks.cjs.map +2 -2
  42. package/build/components/post-template/panel.cjs +5 -42
  43. package/build/components/post-template/panel.cjs.map +3 -3
  44. package/build/components/post-template/swap-template-button.cjs +31 -20
  45. package/build/components/post-template/swap-template-button.cjs.map +2 -2
  46. package/build/components/preferences-modal/index.cjs +35 -27
  47. package/build/components/preferences-modal/index.cjs.map +2 -2
  48. package/build/components/provider/use-block-editor-settings.cjs +2 -0
  49. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  50. package/build/components/revision-block-diff/index.cjs +61 -0
  51. package/build/components/revision-block-diff/index.cjs.map +7 -0
  52. package/build/components/revision-diff-panel/index.cjs +68 -0
  53. package/build/components/revision-diff-panel/index.cjs.map +7 -0
  54. package/build/components/revision-fields-diff/index.cjs +96 -0
  55. package/build/components/revision-fields-diff/index.cjs.map +7 -0
  56. package/build/components/sidebar/dataform-post-summary.cjs +25 -55
  57. package/build/components/sidebar/dataform-post-summary.cjs.map +2 -2
  58. package/build/components/sidebar/index.cjs +30 -23
  59. package/build/components/sidebar/index.cjs.map +3 -3
  60. package/build/components/sidebar/post-revision-summary.cjs +74 -0
  61. package/build/components/sidebar/post-revision-summary.cjs.map +7 -0
  62. package/build/components/sidebar/post-summary.cjs +35 -42
  63. package/build/components/sidebar/post-summary.cjs.map +3 -3
  64. package/build/components/style-book/index.cjs +4 -3
  65. package/build/components/style-book/index.cjs.map +2 -2
  66. package/build/components/{sync-connection-modal → sync-connection-error-modal}/index.cjs +89 -80
  67. package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
  68. package/build/components/{sync-connection-modal → sync-connection-error-modal}/use-retry-countdown.cjs +14 -27
  69. package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
  70. package/build/components/template-actions-panel/block-theme-content.cjs +188 -0
  71. package/build/components/template-actions-panel/block-theme-content.cjs.map +7 -0
  72. package/build/components/template-actions-panel/classic-theme-content.cjs +159 -0
  73. package/build/components/template-actions-panel/classic-theme-content.cjs.map +7 -0
  74. package/build/components/template-actions-panel/index.cjs +59 -0
  75. package/build/components/template-actions-panel/index.cjs.map +7 -0
  76. package/build/components/visual-editor/index.cjs +2 -2
  77. package/build/components/visual-editor/index.cjs.map +2 -2
  78. package/build/dataviews/store/private-actions.cjs +2 -0
  79. package/build/dataviews/store/private-actions.cjs.map +2 -2
  80. package/build/store/actions.cjs +1 -3
  81. package/build/store/actions.cjs.map +2 -2
  82. package/build/store/private-actions.cjs +21 -2
  83. package/build/store/private-actions.cjs.map +2 -2
  84. package/build/store/private-selectors.cjs +40 -15
  85. package/build/store/private-selectors.cjs.map +2 -2
  86. package/build/utils/media-finalize/index.cjs +43 -0
  87. package/build/utils/media-finalize/index.cjs.map +7 -0
  88. package/build/utils/sync-error-messages.cjs +29 -16
  89. package/build/utils/sync-error-messages.cjs.map +3 -3
  90. package/build-module/components/collaborators-overlay/compute-selection.mjs +10 -10
  91. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
  92. package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
  93. package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
  94. package/build-module/components/collaborators-overlay/index.mjs +7 -2
  95. package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
  96. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
  97. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +2 -2
  98. package/build-module/components/collaborators-overlay/overlay.mjs +43 -2
  99. package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
  100. package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
  101. package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
  102. package/build-module/components/collaborators-overlay/use-render-cursors.mjs +1 -1
  103. package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
  104. package/build-module/components/collaborators-presence/index.mjs +14 -4
  105. package/build-module/components/collaborators-presence/index.mjs.map +2 -2
  106. package/build-module/components/collaborators-presence/list.mjs +20 -4
  107. package/build-module/components/collaborators-presence/list.mjs.map +2 -2
  108. package/build-module/components/post-card-panel/index.mjs +6 -17
  109. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  110. package/build-module/components/post-content-information/index.mjs +6 -13
  111. package/build-module/components/post-content-information/index.mjs.map +2 -2
  112. package/build-module/components/post-locked-modal/index.mjs +16 -3
  113. package/build-module/components/post-locked-modal/index.mjs.map +2 -2
  114. package/build-module/components/post-revisions-panel/index.mjs +139 -0
  115. package/build-module/components/post-revisions-panel/index.mjs.map +7 -0
  116. package/build-module/components/post-revisions-preview/block-diff.mjs +39 -11
  117. package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
  118. package/build-module/components/post-revisions-preview/diff-markers.mjs +2 -2
  119. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  120. package/build-module/components/post-revisions-preview/revisions-canvas.mjs +1 -1
  121. package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
  122. package/build-module/components/post-revisions-preview/revisions-slider.mjs +24 -5
  123. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  124. package/build-module/components/post-template/block-theme.mjs +7 -4
  125. package/build-module/components/post-template/block-theme.mjs.map +2 -2
  126. package/build-module/components/post-template/create-new-template-modal.mjs +39 -46
  127. package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
  128. package/build-module/components/post-template/hooks.mjs +90 -8
  129. package/build-module/components/post-template/hooks.mjs.map +2 -2
  130. package/build-module/components/post-template/panel.mjs +5 -42
  131. package/build-module/components/post-template/panel.mjs.map +2 -2
  132. package/build-module/components/post-template/swap-template-button.mjs +27 -20
  133. package/build-module/components/post-template/swap-template-button.mjs.map +2 -2
  134. package/build-module/components/preferences-modal/index.mjs +35 -27
  135. package/build-module/components/preferences-modal/index.mjs.map +2 -2
  136. package/build-module/components/provider/use-block-editor-settings.mjs +2 -0
  137. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  138. package/build-module/components/revision-block-diff/index.mjs +30 -0
  139. package/build-module/components/revision-block-diff/index.mjs.map +7 -0
  140. package/build-module/components/revision-diff-panel/index.mjs +37 -0
  141. package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
  142. package/build-module/components/revision-fields-diff/index.mjs +65 -0
  143. package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
  144. package/build-module/components/sidebar/dataform-post-summary.mjs +25 -55
  145. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  146. package/build-module/components/sidebar/index.mjs +30 -23
  147. package/build-module/components/sidebar/index.mjs.map +2 -2
  148. package/build-module/components/sidebar/post-revision-summary.mjs +43 -0
  149. package/build-module/components/sidebar/post-revision-summary.mjs.map +7 -0
  150. package/build-module/components/sidebar/post-summary.mjs +31 -42
  151. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  152. package/build-module/components/style-book/index.mjs +4 -3
  153. package/build-module/components/style-book/index.mjs.map +2 -2
  154. package/build-module/components/sync-connection-error-modal/index.mjs +177 -0
  155. package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
  156. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +36 -0
  157. package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
  158. package/build-module/components/template-actions-panel/block-theme-content.mjs +167 -0
  159. package/build-module/components/template-actions-panel/block-theme-content.mjs.map +7 -0
  160. package/build-module/components/template-actions-panel/classic-theme-content.mjs +138 -0
  161. package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +7 -0
  162. package/build-module/components/template-actions-panel/index.mjs +28 -0
  163. package/build-module/components/template-actions-panel/index.mjs.map +7 -0
  164. package/build-module/components/visual-editor/index.mjs +2 -2
  165. package/build-module/components/visual-editor/index.mjs.map +2 -2
  166. package/build-module/dataviews/store/private-actions.mjs +5 -1
  167. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  168. package/build-module/store/actions.mjs +1 -3
  169. package/build-module/store/actions.mjs.map +2 -2
  170. package/build-module/store/private-actions.mjs +21 -2
  171. package/build-module/store/private-actions.mjs.map +2 -2
  172. package/build-module/store/private-selectors.mjs +40 -15
  173. package/build-module/store/private-selectors.mjs.map +2 -2
  174. package/build-module/utils/media-finalize/index.mjs +12 -0
  175. package/build-module/utils/media-finalize/index.mjs.map +7 -0
  176. package/build-module/utils/sync-error-messages.mjs +24 -16
  177. package/build-module/utils/sync-error-messages.mjs.map +3 -3
  178. package/build-style/style-rtl.css +135 -50
  179. package/build-style/style.css +135 -50
  180. package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
  181. package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
  182. package/build-types/components/collaborators-overlay/index.d.ts +7 -4
  183. package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
  184. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +1 -1
  185. package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -1
  186. package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
  187. package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
  188. package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
  189. package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
  190. package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
  191. package/build-types/components/collaborators-presence/list.d.ts +4 -1
  192. package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
  193. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  194. package/build-types/components/post-content-information/index.d.ts +4 -1
  195. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  196. package/build-types/components/post-locked-modal/index.d.ts +2 -2
  197. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  198. package/build-types/components/post-revisions-panel/index.d.ts +2 -0
  199. package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
  200. package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
  201. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  202. package/build-types/components/post-template/block-theme.d.ts +1 -3
  203. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  204. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  205. package/build-types/components/post-template/hooks.d.ts +2 -1
  206. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  207. package/build-types/components/post-template/panel.d.ts.map +1 -1
  208. package/build-types/components/post-template/swap-template-button.d.ts +4 -0
  209. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
  210. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  211. package/build-types/components/revision-block-diff/index.d.ts +6 -0
  212. package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
  213. package/build-types/components/revision-diff-panel/index.d.ts +14 -0
  214. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
  215. package/build-types/components/revision-fields-diff/index.d.ts +6 -0
  216. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
  217. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  218. package/build-types/components/sidebar/index.d.ts.map +1 -1
  219. package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
  220. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
  221. package/build-types/components/sidebar/post-summary.d.ts +3 -0
  222. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  223. package/build-types/components/style-book/index.d.ts +2 -1
  224. package/build-types/components/style-book/index.d.ts.map +1 -1
  225. package/build-types/components/sync-connection-error-modal/index.d.ts +22 -0
  226. package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
  227. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
  228. package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
  229. package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
  230. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
  231. package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
  232. package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
  233. package/build-types/components/template-actions-panel/index.d.ts +2 -0
  234. package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
  235. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  236. package/build-types/store/actions.d.ts.map +1 -1
  237. package/build-types/store/private-actions.d.ts.map +1 -1
  238. package/build-types/store/private-selectors.d.ts.map +1 -1
  239. package/build-types/utils/media-finalize/index.d.ts +2 -0
  240. package/build-types/utils/media-finalize/index.d.ts.map +1 -0
  241. package/build-types/utils/sync-error-messages.d.ts +17 -3
  242. package/build-types/utils/sync-error-messages.d.ts.map +1 -1
  243. package/package.json +45 -44
  244. package/src/components/collaborators-overlay/compute-selection.ts +13 -13
  245. package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
  246. package/src/components/collaborators-overlay/index.tsx +12 -4
  247. package/src/components/collaborators-overlay/overlay-iframe-styles.ts +1 -1
  248. package/src/components/collaborators-overlay/overlay.tsx +64 -1
  249. package/src/components/collaborators-overlay/timing-utils.ts +30 -0
  250. package/src/components/collaborators-overlay/use-render-cursors.ts +1 -1
  251. package/src/components/collaborators-presence/index.tsx +9 -1
  252. package/src/components/collaborators-presence/list.tsx +25 -1
  253. package/src/components/post-card-panel/index.js +7 -21
  254. package/src/components/post-content-information/index.js +5 -16
  255. package/src/components/post-locked-modal/index.js +21 -3
  256. package/src/components/post-revisions-panel/index.js +151 -0
  257. package/src/components/post-revisions-panel/style.scss +16 -0
  258. package/src/components/post-revisions-preview/block-diff.js +59 -20
  259. package/src/components/post-revisions-preview/diff-markers.js +2 -2
  260. package/src/components/post-revisions-preview/revisions-canvas.js +1 -1
  261. package/src/components/post-revisions-preview/revisions-slider.js +29 -7
  262. package/src/components/post-revisions-preview/test/block-diff.js +69 -31
  263. package/src/components/post-template/block-theme.js +4 -1
  264. package/src/components/post-template/create-new-template-modal.js +1 -4
  265. package/src/components/post-template/hooks.js +107 -9
  266. package/src/components/post-template/panel.js +5 -59
  267. package/src/components/post-template/style.scss +0 -6
  268. package/src/components/post-template/swap-template-button.js +30 -21
  269. package/src/components/preferences-modal/index.js +37 -25
  270. package/src/components/provider/use-block-editor-settings.js +2 -0
  271. package/src/components/revision-block-diff/index.js +39 -0
  272. package/src/components/revision-diff-panel/index.js +59 -0
  273. package/src/components/revision-diff-panel/style.scss +13 -0
  274. package/src/components/revision-fields-diff/index.js +91 -0
  275. package/src/components/sidebar/dataform-post-summary.js +45 -68
  276. package/src/components/sidebar/index.js +35 -22
  277. package/src/components/sidebar/post-revision-summary.js +50 -0
  278. package/src/components/sidebar/post-summary.js +22 -40
  279. package/src/components/sidebar/style.scss +7 -0
  280. package/src/components/style-book/index.js +4 -2
  281. package/src/components/sync-connection-error-modal/index.tsx +265 -0
  282. package/src/components/sync-connection-error-modal/style.scss +14 -0
  283. package/src/components/sync-connection-error-modal/use-retry-countdown.ts +57 -0
  284. package/src/components/template-actions-panel/block-theme-content.js +196 -0
  285. package/src/components/template-actions-panel/classic-theme-content.js +170 -0
  286. package/src/components/template-actions-panel/index.js +32 -0
  287. package/src/components/template-actions-panel/style.scss +39 -0
  288. package/src/components/visual-editor/index.js +2 -2
  289. package/src/dataviews/store/private-actions.ts +6 -0
  290. package/src/store/actions.js +1 -4
  291. package/src/store/private-actions.js +24 -3
  292. package/src/store/private-selectors.js +46 -16
  293. package/src/style.scss +4 -1
  294. package/src/utils/media-finalize/index.js +11 -0
  295. package/src/utils/media-finalize/test/index.js +34 -0
  296. package/src/utils/sync-error-messages.ts +72 -0
  297. package/src/utils/test/sync-error-messages.js +9 -32
  298. package/build/components/sync-connection-modal/index.cjs.map +0 -7
  299. package/build/components/sync-connection-modal/use-retry-countdown.cjs.map +0 -7
  300. package/build-module/components/sync-connection-modal/index.mjs +0 -170
  301. package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
  302. package/build-module/components/sync-connection-modal/use-retry-countdown.mjs +0 -49
  303. package/build-module/components/sync-connection-modal/use-retry-countdown.mjs.map +0 -7
  304. package/build-types/components/sync-connection-modal/index.d.ts +0 -8
  305. package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
  306. package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts +0 -9
  307. package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts.map +0 -1
  308. package/src/components/sync-connection-modal/index.js +0 -206
  309. package/src/components/sync-connection-modal/style.scss +0 -14
  310. package/src/components/sync-connection-modal/use-retry-countdown.js +0 -70
  311. package/src/utils/sync-error-messages.js +0 -58
@@ -7,6 +7,7 @@ import { store as coreDataStore } from '@wordpress/core-data';
7
7
  import { DataForm } from '@wordpress/dataviews';
8
8
  import { __experimentalVStack as VStack } from '@wordpress/components';
9
9
  import { useMemo } from '@wordpress/element';
10
+ import { useViewConfig } from '@wordpress/views';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -16,69 +17,23 @@ import PostPanelSection from '../post-panel-section';
16
17
  import { store as editorStore } from '../../store';
17
18
  import PostTrash from '../post-trash';
18
19
  import usePostFields from '../post-fields';
19
- import { unlock } from '../../lock-unlock';
20
+ import { usePostTemplatePanelMode } from '../post-template/hooks';
20
21
 
21
- const form = {
22
- layout: {
23
- type: 'panel',
24
- },
25
- fields: [
26
- {
27
- id: 'featured_media',
28
- layout: {
29
- type: 'regular',
30
- labelPosition: 'none',
31
- },
32
- },
33
- {
34
- id: 'post-content-info',
35
- layout: {
36
- type: 'regular',
37
- labelPosition: 'none',
38
- },
39
- },
40
- {
41
- id: 'status',
42
- label: __( 'Status' ),
43
- children: [
44
- {
45
- id: 'status',
46
- layout: { type: 'regular', labelPosition: 'none' },
47
- },
48
- 'password',
49
- ],
50
- },
51
- 'date',
52
- 'slug',
53
- 'author',
54
- 'template',
55
- {
56
- id: 'discussion',
57
- label: __( 'Discussion' ),
58
- children: [
59
- {
60
- id: 'comment_status',
61
- layout: { type: 'regular', labelPosition: 'none' },
62
- },
63
- 'ping_status',
64
- ],
65
- },
66
- 'parent',
67
- 'format',
68
- ],
69
- };
22
+ const EMPTY_FORM = { layout: { type: 'panel' }, fields: [] };
70
23
 
71
24
  export default function DataFormPostSummary( { onActionPerformed } ) {
72
25
  const { postType, postId } = useSelect( ( select ) => {
73
- const { getCurrentPostType, getCurrentPostId } = unlock(
74
- select( editorStore )
75
- );
26
+ const { getCurrentPostType, getCurrentPostId } = select( editorStore );
76
27
  return {
77
28
  postType: getCurrentPostType(),
78
29
  postId: getCurrentPostId(),
79
30
  };
80
31
  }, [] );
81
-
32
+ const { form: formConfig } = useViewConfig( {
33
+ kind: 'postType',
34
+ name: postType,
35
+ } );
36
+ const form = formConfig ?? EMPTY_FORM;
82
37
  const record = useSelect(
83
38
  ( select ) => {
84
39
  if ( ! postType || ! postId ) {
@@ -93,7 +48,8 @@ export default function DataFormPostSummary( { onActionPerformed } ) {
93
48
  [ postType, postId ]
94
49
  );
95
50
 
96
- // Fetch classic theme templates from editor settings.
51
+ const templatePanelMode = usePostTemplatePanelMode();
52
+
97
53
  const availableTemplates = useSelect( ( select ) => {
98
54
  if ( select( coreDataStore ).getCurrentTheme()?.is_block_theme ) {
99
55
  return null;
@@ -119,18 +75,40 @@ export default function DataFormPostSummary( { onActionPerformed } ) {
119
75
  const _fields = usePostFields( { postType } );
120
76
  const fields = useMemo(
121
77
  () =>
122
- _fields?.map( ( field ) => {
123
- if ( field.id === 'status' ) {
124
- return {
125
- ...field,
126
- elements: field.elements.filter(
127
- ( element ) => element.value !== 'trash'
128
- ),
129
- };
130
- }
131
- return field;
132
- } ),
133
- [ _fields ]
78
+ _fields
79
+ ?.map( ( field ) => {
80
+ if ( field.id === 'status' ) {
81
+ return {
82
+ ...field,
83
+ elements: field.elements.filter(
84
+ ( element ) => element.value !== 'trash'
85
+ ),
86
+ };
87
+ }
88
+ if ( field.id === 'template' ) {
89
+ // `usePostTemplatePanelMode` is reused in the Post Template panel to match
90
+ // the existing behavior. If the panel rendered nothing we should exclude the
91
+ // template field from the form.
92
+ if ( ! templatePanelMode ) {
93
+ return null;
94
+ }
95
+ // In classic themes without available templates we need to make the field read-only.
96
+ if (
97
+ templatePanelMode === 'classic' &&
98
+ Object.keys( availableTemplates ?? {} ).length === 0
99
+ ) {
100
+ return {
101
+ ...field,
102
+ readOnly: true,
103
+ render: () => __( 'Default template' ),
104
+ };
105
+ }
106
+ return field;
107
+ }
108
+ return field;
109
+ } )
110
+ .filter( Boolean ),
111
+ [ _fields, templatePanelMode, availableTemplates ]
134
112
  );
135
113
 
136
114
  const onChange = ( edits ) => {
@@ -148,7 +126,6 @@ export default function DataFormPostSummary( { onActionPerformed } ) {
148
126
 
149
127
  editEntityRecord( 'postType', postType, postId, edits );
150
128
  };
151
-
152
129
  return (
153
130
  <PostPanelSection className="editor-post-summary">
154
131
  <VStack spacing={ 4 }>
@@ -26,12 +26,16 @@ import PatternOverridesPanel from '../pattern-overrides-panel';
26
26
  import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
27
27
  import PluginSidebar from '../plugin-sidebar';
28
28
  import PostSummary from './post-summary';
29
+ import PostRevisionSummary from './post-revision-summary';
29
30
  import PostTaxonomiesPanel from '../post-taxonomies/panel';
30
31
  import PostTransformPanel from '../post-transform-panel';
31
32
  import SidebarHeader from './header';
33
+ import TemplateActionsPanel from '../template-actions-panel';
32
34
  import TemplateContentPanel from '../template-content-panel';
33
35
  import TemplatePartContentPanel from '../template-part-content-panel';
34
36
  import { MediaMetadataPanel } from '../media';
37
+ import PostRevisionsPanel from '../post-revisions-panel';
38
+ import RevisionBlockDiffPanel from '../revision-block-diff';
35
39
  import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
36
40
  import { sidebars } from './constants';
37
41
  import { unlock } from '../../lock-unlock';
@@ -94,6 +98,35 @@ const SidebarContent = ( {
94
98
  }
95
99
  }, [ tabName ] );
96
100
 
101
+ let tabContent;
102
+ if ( isAttachment ) {
103
+ tabContent = (
104
+ <MediaMetadataPanel onActionPerformed={ onActionPerformed } />
105
+ );
106
+ } else if ( isRevisionsMode ) {
107
+ tabContent = <PostRevisionSummary />;
108
+ } else {
109
+ tabContent = (
110
+ <>
111
+ <PostSummary onActionPerformed={ onActionPerformed } />
112
+ <PluginDocumentSettingPanel.Slot />
113
+ <TemplateContentPanel />
114
+ { window?.__experimentalDataFormInspector &&
115
+ [ 'post', 'page' ].includes( postType ) && (
116
+ <>
117
+ <TemplateActionsPanel />
118
+ <PostRevisionsPanel />
119
+ </>
120
+ ) }
121
+ <TemplatePartContentPanel />
122
+ <PostTransformPanel />
123
+ <PostTaxonomiesPanel />
124
+ <PatternOverridesPanel />
125
+ { extraPanels }
126
+ </>
127
+ );
128
+ }
129
+
97
130
  return (
98
131
  <PluginSidebar
99
132
  identifier={ tabName }
@@ -118,32 +151,12 @@ const SidebarContent = ( {
118
151
  >
119
152
  <Tabs.Context.Provider value={ tabsContextValue }>
120
153
  <Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
121
- { isAttachment ? (
122
- <MediaMetadataPanel
123
- onActionPerformed={ onActionPerformed }
124
- />
125
- ) : (
126
- <>
127
- <PostSummary
128
- onActionPerformed={ onActionPerformed }
129
- />
130
- { ! isRevisionsMode && (
131
- <>
132
- <PluginDocumentSettingPanel.Slot />
133
- <TemplateContentPanel />
134
- <TemplatePartContentPanel />
135
- <PostTransformPanel />
136
- <PostTaxonomiesPanel />
137
- <PatternOverridesPanel />
138
- { extraPanels }
139
- </>
140
- ) }
141
- </>
142
- ) }
154
+ { tabContent }
143
155
  </Tabs.TabPanel>
144
156
  { ! isAttachment && (
145
157
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
146
158
  <BlockInspector />
159
+ { isRevisionsMode && <RevisionBlockDiffPanel /> }
147
160
  </Tabs.TabPanel>
148
161
  ) }
149
162
  </Tabs.Context.Provider>
@@ -0,0 +1,50 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { __experimentalVStack as VStack } from '@wordpress/components';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as editorStore } from '../../store';
11
+ import { unlock } from '../../lock-unlock';
12
+ import RevisionAuthorPanel from '../revision-author-panel';
13
+ import RevisionCreatedPanel from '../revision-created-panel';
14
+ import { PostContentInformationUI } from '../post-content-information';
15
+ import RevisionFieldsDiffPanel from '../revision-fields-diff';
16
+ import PostPanelSection from '../post-panel-section';
17
+ import PostCardPanel from '../post-card-panel';
18
+ import { OpenRevisionsClassicScreen } from './post-summary';
19
+
20
+ export default function PostRevisionSummary() {
21
+ const { revisionId, postId, postContent } = useSelect( ( select ) => {
22
+ const { getCurrentRevisionId, getCurrentRevision, getCurrentPostId } =
23
+ unlock( select( editorStore ) );
24
+ const _revisionId = getCurrentRevisionId();
25
+ return {
26
+ revisionId: _revisionId,
27
+ postId: getCurrentPostId(),
28
+ postContent: _revisionId && getCurrentRevision()?.content?.raw,
29
+ };
30
+ }, [] );
31
+ if ( ! revisionId ) {
32
+ return null;
33
+ }
34
+ return (
35
+ <>
36
+ <PostPanelSection className="editor-post-summary">
37
+ <VStack spacing={ 4 }>
38
+ <PostCardPanel postId={ postId } hideActions />
39
+ <VStack spacing={ 1 }>
40
+ <PostContentInformationUI postContent={ postContent } />
41
+ <RevisionCreatedPanel />
42
+ </VStack>
43
+ <OpenRevisionsClassicScreen revisionId={ revisionId } />
44
+ <RevisionAuthorPanel />
45
+ </VStack>
46
+ </PostPanelSection>
47
+ <RevisionFieldsDiffPanel />
48
+ </>
49
+ );
50
+ }
@@ -23,7 +23,6 @@ import { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/pan
23
23
  import PostFeaturedImagePanel from '../post-featured-image/panel';
24
24
  import PostFormatPanel from '../post-format/panel';
25
25
  import PostLastEditedPanel from '../post-last-edited-panel';
26
- import RevisionCreatedPanel from '../revision-created-panel';
27
26
  import PostPanelSection from '../post-panel-section';
28
27
  import PostSchedulePanel from '../post-schedule/panel';
29
28
  import PostStatusPanel from '../post-status';
@@ -36,14 +35,24 @@ import SiteDiscussion from '../site-discussion';
36
35
  import { store as editorStore } from '../../store';
37
36
  import { PrivatePostLastRevision } from '../post-last-revision';
38
37
  import PostTrash from '../post-trash';
39
- import RevisionAuthorPanel from '../revision-author-panel';
40
- import { unlock } from '../../lock-unlock';
41
38
 
42
39
  /**
43
40
  * Module Constants
44
41
  */
45
42
  const PANEL_NAME = 'post-status';
46
43
 
44
+ export function OpenRevisionsClassicScreen( { revisionId } ) {
45
+ return (
46
+ <ExternalLink
47
+ href={ addQueryArgs( 'revision.php', {
48
+ revision: revisionId,
49
+ } ) }
50
+ >
51
+ { __( 'Open classic revisions screen' ) }
52
+ </ExternalLink>
53
+ );
54
+ }
55
+
47
56
  export default function PostSummary( { onActionPerformed } ) {
48
57
  const postType = useSelect(
49
58
  ( select ) => select( editorStore ).getCurrentPostType(),
@@ -59,28 +68,23 @@ export default function PostSummary( { onActionPerformed } ) {
59
68
  }
60
69
 
61
70
  function ClassicPostSummary( { onActionPerformed } ) {
62
- const { isRemovedPostStatusPanel, postType, postId, revisionId } =
63
- useSelect( ( select ) => {
71
+ const { isRemovedPostStatusPanel, postType, postId } = useSelect(
72
+ ( select ) => {
64
73
  // We use isEditorPanelRemoved to hide the panel if it was programmatically removed. We do
65
74
  // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
66
75
  const {
67
76
  isEditorPanelRemoved,
68
77
  getCurrentPostType,
69
78
  getCurrentPostId,
70
- getCurrentRevisionId,
71
- } = unlock( select( editorStore ) );
79
+ } = select( editorStore );
72
80
  return {
73
81
  isRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),
74
82
  postType: getCurrentPostType(),
75
83
  postId: getCurrentPostId(),
76
- revisionId: getCurrentRevisionId(),
77
84
  };
78
- }, [] );
79
-
80
- const isRevisionsMode = !! revisionId;
81
- const shouldShowPostStatusPanel =
82
- ! isRemovedPostStatusPanel && ! isRevisionsMode;
83
-
85
+ },
86
+ []
87
+ );
84
88
  return (
85
89
  <PostPanelSection className="editor-post-summary">
86
90
  <PluginPostStatusInfo.Slot>
@@ -92,35 +96,13 @@ function ClassicPostSummary( { onActionPerformed } ) {
92
96
  postId={ postId }
93
97
  onActionPerformed={ onActionPerformed }
94
98
  />
95
- { ! isRevisionsMode && (
96
- <PostFeaturedImagePanel
97
- withPanelBody={ false }
98
- />
99
- ) }
100
- { ! isRevisionsMode && <PostExcerptPanel /> }
99
+ <PostFeaturedImagePanel withPanelBody={ false } />
100
+ <PostExcerptPanel />
101
101
  <VStack spacing={ 1 }>
102
102
  <PostContentInformation />
103
- { isRevisionsMode ? (
104
- <RevisionCreatedPanel />
105
- ) : (
106
- <PostLastEditedPanel />
107
- ) }
103
+ <PostLastEditedPanel />
108
104
  </VStack>
109
- { isRevisionsMode && revisionId && (
110
- <>
111
- <ExternalLink
112
- href={ addQueryArgs( 'revision.php', {
113
- revision: revisionId,
114
- } ) }
115
- >
116
- { __(
117
- 'Open classic revisions screen'
118
- ) }
119
- </ExternalLink>
120
- <RevisionAuthorPanel />
121
- </>
122
- ) }
123
- { shouldShowPostStatusPanel && (
105
+ { ! isRemovedPostStatusPanel && (
124
106
  <VStack spacing={ 4 }>
125
107
  <VStack spacing={ 1 }>
126
108
  <PostStatusPanel />
@@ -28,3 +28,10 @@
28
28
  font-size: $default-font-size;
29
29
  }
30
30
  }
31
+
32
+ // TODO: These styles should be absorbed by DataForm API.
33
+ // @see https://github.com/WordPress/gutenberg/issues/75916
34
+ .fields-controls__password {
35
+ border-top: $border-width solid $gray-200;
36
+ padding-top: $grid-unit-20;
37
+ }
@@ -375,6 +375,7 @@ function StyleBook(
375
375
  * @param {Function} props.onPathChange Callback when the path changes.
376
376
  * @param {Object} props.userConfig User configuration.
377
377
  * @param {boolean} props.isStatic Whether the stylebook is static or clickable.
378
+ * @param {Object} props.settings Optional editor settings to use instead of the editor store settings.
378
379
  * @return {Object} Style Book Preview component.
379
380
  */
380
381
  export const StyleBookPreview = ( {
@@ -382,10 +383,11 @@ export const StyleBookPreview = ( {
382
383
  isStatic = false,
383
384
  path,
384
385
  onPathChange,
386
+ settings: settingsProp,
385
387
  } ) => {
386
388
  const editorSettings = useSelect(
387
- ( select ) => select( editorStore ).getEditorSettings(),
388
- []
389
+ ( select ) => settingsProp ?? select( editorStore ).getEditorSettings(),
390
+ [ settingsProp ]
389
391
  );
390
392
 
391
393
  const canUserUploadMedia = useSelect(
@@ -0,0 +1,265 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect, select } from '@wordpress/data';
5
+ import { useCopyToClipboard } from '@wordpress/compose';
6
+ // @ts-ignore No exported types.
7
+ import { serialize } from '@wordpress/blocks';
8
+ import {
9
+ store as coreDataStore,
10
+ privateApis as coreDataPrivateApis,
11
+ type ConnectionError,
12
+ } from '@wordpress/core-data';
13
+ // @ts-expect-error - No type declarations available for @wordpress/block-editor
14
+ // prettier-ignore
15
+ import { privateApis, store as blockEditorStore } from '@wordpress/block-editor';
16
+ import {
17
+ Button,
18
+ Modal,
19
+ withFilters,
20
+ __experimentalHStack as HStack,
21
+ __experimentalVStack as VStack,
22
+ } from '@wordpress/components';
23
+ import { useState, useEffect } from '@wordpress/element';
24
+ import { __, sprintf, _n } from '@wordpress/i18n';
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ import { getSyncErrorMessages } from '../../utils/sync-error-messages';
30
+ import { store as editorStore } from '../../store';
31
+ import { unlock } from '../../lock-unlock';
32
+ import { useRetryCountdown } from './use-retry-countdown';
33
+
34
+ const { BlockCanvasCover } = unlock( privateApis );
35
+ const { retrySyncConnection } = unlock( coreDataPrivateApis );
36
+
37
+ // Debounce time for initial disconnected status to allow connection to establish.
38
+ const INITIAL_DISCONNECTED_DEBOUNCE_MS = 20000;
39
+
40
+ // Debounce time for showing the disconnect dialog after the intial connection,
41
+ // allowing brief network interruptions to resolve.
42
+ const DISCONNECTED_DEBOUNCE_MS = 8000;
43
+
44
+ export interface SyncConnectionErrorModalProps {
45
+ description: string; // Modal description.
46
+ error?: ConnectionError; // Error object with a `code` property.
47
+ manualRetry?: () => void; // Callback for when the retry button is clicked.
48
+ postType?: { slug?: string; labels?: { name?: string } } | null; // Current post type object.
49
+ secondsRemainingUntilAutoRetry?: number; // Seconds remaining until the next automatic retry attempt, if applicable.
50
+ title: string; // Modal title.
51
+ }
52
+
53
+ /**
54
+ * Default sync connection modal component.
55
+ *
56
+ * Can be replaced or wrapped via the `editor.SyncConnectionErrorModal` filter.
57
+ *
58
+ * @param props - SyncConnectionErrorModalProps.
59
+ */
60
+ function DefaultSyncConnectionErrorModal(
61
+ props: SyncConnectionErrorModalProps
62
+ ) {
63
+ const {
64
+ description,
65
+ manualRetry,
66
+ postType,
67
+ secondsRemainingUntilAutoRetry,
68
+ title,
69
+ } = props;
70
+ const copyButtonRef = useCopyToClipboard( () => {
71
+ const blocks = select( blockEditorStore ).getBlocks();
72
+ return serialize( blocks );
73
+ } );
74
+
75
+ let retryCountdownText: string = '';
76
+ let isRetrying = false;
77
+ if (
78
+ secondsRemainingUntilAutoRetry &&
79
+ secondsRemainingUntilAutoRetry > 0
80
+ ) {
81
+ retryCountdownText = sprintf(
82
+ /* translators: %d: number of seconds until retry */
83
+ _n(
84
+ 'Retrying connection in %d second\u2026',
85
+ 'Retrying connection in %d seconds\u2026',
86
+ secondsRemainingUntilAutoRetry
87
+ ),
88
+ secondsRemainingUntilAutoRetry
89
+ );
90
+ } else if ( 0 === secondsRemainingUntilAutoRetry ) {
91
+ isRetrying = true;
92
+ retryCountdownText = __( 'Retrying\u2026' );
93
+ }
94
+
95
+ let editPostHref = 'edit.php';
96
+ if ( postType?.slug ) {
97
+ editPostHref = `edit.php?post_type=${ postType.slug }`;
98
+ }
99
+
100
+ return (
101
+ <Modal
102
+ overlayClassName="editor-sync-connection-error-modal"
103
+ isDismissible={ false }
104
+ onRequestClose={ () => {} }
105
+ shouldCloseOnClickOutside={ false }
106
+ shouldCloseOnEsc={ false }
107
+ size="medium"
108
+ title={ title }
109
+ >
110
+ <VStack spacing={ 6 }>
111
+ <p>{ description }</p>
112
+ { retryCountdownText && (
113
+ <p className="editor-sync-connection-error-modal__retry-countdown">
114
+ { retryCountdownText }
115
+ </p>
116
+ ) }
117
+ <HStack justify="right">
118
+ <Button
119
+ __next40pxDefaultSize
120
+ href={ editPostHref }
121
+ isDestructive
122
+ variant="tertiary"
123
+ >
124
+ { sprintf(
125
+ /* translators: %s: Post type name (e.g., "Posts", "Pages"). */
126
+ __( 'Back to %s' ),
127
+ postType?.labels?.name ?? __( 'Posts' )
128
+ ) }
129
+ </Button>
130
+ <Button
131
+ __next40pxDefaultSize
132
+ ref={ copyButtonRef }
133
+ variant={ manualRetry ? 'secondary' : 'primary' }
134
+ >
135
+ { __( 'Copy Post Content' ) }
136
+ </Button>
137
+ { manualRetry && (
138
+ <Button
139
+ __next40pxDefaultSize
140
+ accessibleWhenDisabled
141
+ aria-disabled={ isRetrying }
142
+ disabled={ isRetrying }
143
+ isBusy={ isRetrying }
144
+ variant="primary"
145
+ onClick={ manualRetry }
146
+ >
147
+ { __( 'Retry' ) }
148
+ </Button>
149
+ ) }
150
+ </HStack>
151
+ </VStack>
152
+ </Modal>
153
+ );
154
+ }
155
+
156
+ /**
157
+ * Filtered version of the sync connection modal, allowing third-party
158
+ * plugins to replace the default modal via:
159
+ *
160
+ * ```js
161
+ * wp.hooks.addFilter(
162
+ * 'editor.SyncConnectionErrorModal',
163
+ * 'my-plugin/custom-sync-connection-error-modal',
164
+ * ( OriginalComponent ) => ( props ) => {
165
+ * // Return a custom component or wrap the original.
166
+ * return <OriginalComponent { ...props } />;
167
+ * }
168
+ * );
169
+ * ```
170
+ */
171
+ // @ts-ignore
172
+ const FilteredSyncConnectionErrorModal = globalThis.IS_GUTENBERG_PLUGIN
173
+ ? withFilters( 'editor.SyncConnectionErrorModal' )(
174
+ DefaultSyncConnectionErrorModal
175
+ )
176
+ : DefaultSyncConnectionErrorModal;
177
+
178
+ /**
179
+ * Sync connection modal that displays when any entity reports a disconnection.
180
+ * Uses BlockCanvasCover.Fill to render in the block canvas.
181
+ *
182
+ * @return The modal component or null if not disconnected.
183
+ */
184
+ export function SyncConnectionErrorModal() {
185
+ const [ hasInitialized, setHasInitialized ] = useState( false );
186
+ const [ showModal, setShowModal ] = useState( false );
187
+
188
+ const { connectionStatus, isCollaborationEnabled, postType } = useSelect(
189
+ ( selectFn ) => {
190
+ const currentPostType =
191
+ selectFn( editorStore ).getCurrentPostType();
192
+ return {
193
+ connectionStatus:
194
+ selectFn( coreDataStore ).getSyncConnectionStatus() || null,
195
+ isCollaborationEnabled:
196
+ selectFn(
197
+ editorStore
198
+ ).isCollaborationEnabledForCurrentPost(),
199
+ postType: currentPostType
200
+ ? selectFn( coreDataStore ).getPostType( currentPostType )
201
+ : null,
202
+ };
203
+ },
204
+ []
205
+ );
206
+
207
+ const { onManualRetry, secondsRemaining } =
208
+ useRetryCountdown( connectionStatus );
209
+
210
+ const isConnected = 'connected' === connectionStatus?.status;
211
+
212
+ // Set hasInitialized after a debounce to give extra time on initial load.
213
+ useEffect( () => {
214
+ const timeout = setTimeout( () => {
215
+ setHasInitialized( true );
216
+ }, INITIAL_DISCONNECTED_DEBOUNCE_MS );
217
+
218
+ return () => clearTimeout( timeout );
219
+ }, [] );
220
+
221
+ useEffect( () => {
222
+ if ( isConnected ) {
223
+ setShowModal( false );
224
+ return;
225
+ }
226
+
227
+ const timeout = setTimeout( () => {
228
+ setShowModal( true );
229
+ }, DISCONNECTED_DEBOUNCE_MS );
230
+
231
+ return () => clearTimeout( timeout );
232
+ }, [ isConnected ] );
233
+
234
+ if ( ! isCollaborationEnabled || ! hasInitialized || ! showModal ) {
235
+ return null;
236
+ }
237
+
238
+ const error =
239
+ connectionStatus && 'error' in connectionStatus
240
+ ? connectionStatus?.error
241
+ : undefined;
242
+ const manualRetry =
243
+ connectionStatus &&
244
+ 'canManuallyRetry' in connectionStatus &&
245
+ connectionStatus.canManuallyRetry
246
+ ? () => {
247
+ onManualRetry();
248
+ retrySyncConnection();
249
+ }
250
+ : undefined;
251
+ const messages = getSyncErrorMessages( error );
252
+
253
+ return (
254
+ <BlockCanvasCover.Fill>
255
+ <FilteredSyncConnectionErrorModal
256
+ description={ messages.description }
257
+ error={ error }
258
+ manualRetry={ manualRetry }
259
+ postType={ postType }
260
+ secondsRemainingUntilAutoRetry={ secondsRemaining }
261
+ title={ messages.title }
262
+ />
263
+ </BlockCanvasCover.Fill>
264
+ );
265
+ }