@wordpress/editor 14.48.1 → 14.49.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 (460) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -13
  3. package/build/bindings/pattern-overrides.cjs +1 -1
  4. package/build/bindings/pattern-overrides.cjs.map +2 -2
  5. package/build/components/autosave-monitor/index.cjs +40 -83
  6. package/build/components/autosave-monitor/index.cjs.map +3 -3
  7. package/build/components/collab-sidebar/note-byline.cjs +1 -1
  8. package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
  9. package/build/components/collab-sidebar/note.cjs +49 -17
  10. package/build/components/collab-sidebar/note.cjs.map +3 -3
  11. package/build/components/collab-sidebar/notes.cjs.map +1 -1
  12. package/build/components/collab-sidebar/utils.cjs +1 -1
  13. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  14. package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +1 -1
  15. package/build/components/collaborators-overlay/collaborator-styles.cjs.map +1 -1
  16. package/build/components/collaborators-overlay/compute-selection.cjs.map +1 -1
  17. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +1 -1
  18. package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +1 -1
  19. package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +1 -1
  20. package/build/components/collaborators-presence/avatar/component.cjs.map +2 -2
  21. package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +1 -1
  22. package/build/components/document-bar/index.cjs +7 -5
  23. package/build/components/document-bar/index.cjs.map +2 -2
  24. package/build/components/global-keyboard-shortcuts/index.cjs +3 -2
  25. package/build/components/global-keyboard-shortcuts/index.cjs.map +2 -2
  26. package/build/components/global-styles-sidebar/welcome-guide.cjs +3 -3
  27. package/build/components/global-styles-sidebar/welcome-guide.cjs.map +1 -1
  28. package/build/components/local-autosave-monitor/index.cjs +14 -15
  29. package/build/components/local-autosave-monitor/index.cjs.map +2 -2
  30. package/build/components/page-attributes/parent.cjs +1 -1
  31. package/build/components/page-attributes/parent.cjs.map +2 -2
  32. package/build/components/post-card-panel/index.cjs +1 -1
  33. package/build/components/post-card-panel/index.cjs.map +2 -2
  34. package/build/components/post-excerpt/panel.cjs +1 -1
  35. package/build/components/post-excerpt/panel.cjs.map +2 -2
  36. package/build/components/post-locked-modal/index.cjs +3 -3
  37. package/build/components/post-locked-modal/index.cjs.map +1 -1
  38. package/build/components/post-preview-button/index.cjs +2 -2
  39. package/build/components/post-preview-button/index.cjs.map +2 -2
  40. package/build/components/post-publish-button/index.cjs +4 -3
  41. package/build/components/post-publish-button/index.cjs.map +2 -2
  42. package/build/components/post-publish-button/label.cjs +2 -2
  43. package/build/components/post-publish-button/label.cjs.map +2 -2
  44. package/build/components/post-publish-panel/index.cjs.map +1 -1
  45. package/build/components/post-publish-panel/postpublish.cjs +1 -2
  46. package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
  47. package/build/components/post-revisions-preview/block-diff.cjs.map +1 -1
  48. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  49. package/build/components/post-revisions-preview/revisions-slider.cjs +1 -1
  50. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  51. package/build/components/post-revisions-timeline/index.cjs +173 -0
  52. package/build/components/post-revisions-timeline/index.cjs.map +7 -0
  53. package/build/components/post-saved-state/index.cjs +17 -26
  54. package/build/components/post-saved-state/index.cjs.map +2 -2
  55. package/build/components/post-schedule/label.cjs +5 -5
  56. package/build/components/post-schedule/label.cjs.map +1 -1
  57. package/build/components/post-status/index.cjs +0 -1
  58. package/build/components/post-status/index.cjs.map +2 -2
  59. package/build/components/post-taxonomies/flat-term-selector.cjs +2 -1
  60. package/build/components/post-taxonomies/flat-term-selector.cjs.map +3 -3
  61. package/build/components/post-taxonomies/hierarchical-term-selector.cjs +1 -2
  62. package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
  63. package/build/components/post-template/create-new-template-modal.cjs +0 -1
  64. package/build/components/post-template/create-new-template-modal.cjs.map +2 -2
  65. package/build/components/post-text-editor/index.cjs +51 -0
  66. package/build/components/post-text-editor/index.cjs.map +2 -2
  67. package/build/components/post-text-editor/utils.cjs +150 -0
  68. package/build/components/post-text-editor/utils.cjs.map +7 -0
  69. package/build/components/post-url/index.cjs +1 -1
  70. package/build/components/post-url/index.cjs.map +2 -2
  71. package/build/components/post-view-link/index.cjs +1 -1
  72. package/build/components/post-view-link/index.cjs.map +2 -2
  73. package/build/components/post-visibility/index.cjs +0 -1
  74. package/build/components/post-visibility/index.cjs.map +2 -2
  75. package/build/components/provider/disable-non-page-content-blocks.cjs +23 -3
  76. package/build/components/provider/disable-non-page-content-blocks.cjs.map +2 -2
  77. package/build/components/provider/index.cjs +1 -1
  78. package/build/components/provider/index.cjs.map +2 -2
  79. package/build/components/provider/navigation-block-editing-mode.cjs +9 -2
  80. package/build/components/provider/navigation-block-editing-mode.cjs.map +2 -2
  81. package/build/components/provider/use-block-editor-settings.cjs +2 -1
  82. package/build/components/provider/use-block-editor-settings.cjs.map +2 -2
  83. package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
  84. package/build/components/revision-diff-panel/index.cjs +7 -2
  85. package/build/components/revision-diff-panel/index.cjs.map +2 -2
  86. package/build/components/revision-fields-diff/index.cjs +6 -2
  87. package/build/components/revision-fields-diff/index.cjs.map +2 -2
  88. package/build/components/sidebar/dataform-post-summary.cjs +189 -29
  89. package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
  90. package/build/components/sidebar/index.cjs +1 -11
  91. package/build/components/sidebar/index.cjs.map +3 -3
  92. package/build/components/sidebar/post-revision-summary.cjs +11 -17
  93. package/build/components/sidebar/post-revision-summary.cjs.map +3 -3
  94. package/build/components/sidebar/post-summary.cjs +8 -6
  95. package/build/components/sidebar/post-summary.cjs.map +3 -3
  96. package/build/components/style-book/examples.cjs +1 -1
  97. package/build/components/style-book/examples.cjs.map +1 -1
  98. package/build/components/style-book/index.cjs +1 -1
  99. package/build/components/style-book/index.cjs.map +2 -2
  100. package/build/components/sync-connection-error-modal/index.cjs +3 -3
  101. package/build/components/sync-connection-error-modal/index.cjs.map +1 -1
  102. package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
  103. package/build/components/template-actions-panel/index.cjs +0 -9
  104. package/build/components/template-actions-panel/index.cjs.map +3 -3
  105. package/build/components/template-validation-notice/index.cjs +1 -1
  106. package/build/components/template-validation-notice/index.cjs.map +1 -1
  107. package/build/components/upload-progress-snackbar/index.cjs +3 -3
  108. package/build/components/upload-progress-snackbar/index.cjs.map +2 -2
  109. package/build/components/upload-progress-snackbar/tracker.cjs.map +1 -1
  110. package/build/components/visual-editor/edit-template-blocks-notification.cjs +1 -1
  111. package/build/components/visual-editor/edit-template-blocks-notification.cjs.map +1 -1
  112. package/build/{components/revision-author-panel → dataviews/fields/revisions}/index.cjs +18 -26
  113. package/build/dataviews/fields/revisions/index.cjs.map +7 -0
  114. package/build/dataviews/fields/revisions/revisions-view.cjs +74 -0
  115. package/build/dataviews/fields/revisions/revisions-view.cjs.map +7 -0
  116. package/build/dataviews/store/private-actions.cjs +17 -5
  117. package/build/dataviews/store/private-actions.cjs.map +3 -3
  118. package/build/hooks/push-changes-to-global-styles/index.cjs +1 -1
  119. package/build/hooks/push-changes-to-global-styles/index.cjs.map +1 -1
  120. package/build/store/actions.cjs +1 -1
  121. package/build/store/actions.cjs.map +2 -2
  122. package/build/store/private-actions.cjs +2 -2
  123. package/build/store/private-actions.cjs.map +2 -2
  124. package/build/store/private-selectors.cjs +6 -1
  125. package/build/store/private-selectors.cjs.map +2 -2
  126. package/build/utils/media-upload/index.cjs.map +1 -1
  127. package/build/utils/set-nested-value.cjs.map +1 -1
  128. package/build-module/bindings/pattern-overrides.mjs +1 -1
  129. package/build-module/bindings/pattern-overrides.mjs.map +2 -2
  130. package/build-module/components/autosave-monitor/index.mjs +42 -81
  131. package/build-module/components/autosave-monitor/index.mjs.map +2 -2
  132. package/build-module/components/collab-sidebar/note-byline.mjs +1 -1
  133. package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
  134. package/build-module/components/collab-sidebar/note.mjs +50 -18
  135. package/build-module/components/collab-sidebar/note.mjs.map +2 -2
  136. package/build-module/components/collab-sidebar/notes.mjs.map +1 -1
  137. package/build-module/components/collab-sidebar/utils.mjs +1 -1
  138. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  139. package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +1 -1
  140. package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +1 -1
  141. package/build-module/components/collaborators-overlay/compute-selection.mjs.map +1 -1
  142. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +1 -1
  143. package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +1 -1
  144. package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +1 -1
  145. package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
  146. package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +1 -1
  147. package/build-module/components/document-bar/index.mjs +7 -5
  148. package/build-module/components/document-bar/index.mjs.map +2 -2
  149. package/build-module/components/global-keyboard-shortcuts/index.mjs +3 -2
  150. package/build-module/components/global-keyboard-shortcuts/index.mjs.map +2 -2
  151. package/build-module/components/global-styles-sidebar/welcome-guide.mjs +3 -3
  152. package/build-module/components/global-styles-sidebar/welcome-guide.mjs.map +1 -1
  153. package/build-module/components/local-autosave-monitor/index.mjs +15 -16
  154. package/build-module/components/local-autosave-monitor/index.mjs.map +2 -2
  155. package/build-module/components/page-attributes/parent.mjs +1 -1
  156. package/build-module/components/page-attributes/parent.mjs.map +2 -2
  157. package/build-module/components/post-card-panel/index.mjs +1 -1
  158. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  159. package/build-module/components/post-excerpt/panel.mjs +1 -1
  160. package/build-module/components/post-excerpt/panel.mjs.map +2 -2
  161. package/build-module/components/post-locked-modal/index.mjs +3 -3
  162. package/build-module/components/post-locked-modal/index.mjs.map +1 -1
  163. package/build-module/components/post-preview-button/index.mjs +2 -2
  164. package/build-module/components/post-preview-button/index.mjs.map +2 -2
  165. package/build-module/components/post-publish-button/index.mjs +4 -3
  166. package/build-module/components/post-publish-button/index.mjs.map +2 -2
  167. package/build-module/components/post-publish-button/label.mjs +2 -2
  168. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  169. package/build-module/components/post-publish-panel/index.mjs.map +1 -1
  170. package/build-module/components/post-publish-panel/postpublish.mjs +1 -2
  171. package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
  172. package/build-module/components/post-revisions-preview/block-diff.mjs.map +1 -1
  173. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  174. package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -1
  175. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  176. package/build-module/components/post-revisions-timeline/index.mjs +152 -0
  177. package/build-module/components/post-revisions-timeline/index.mjs.map +7 -0
  178. package/build-module/components/post-saved-state/index.mjs +17 -26
  179. package/build-module/components/post-saved-state/index.mjs.map +2 -2
  180. package/build-module/components/post-schedule/label.mjs +5 -5
  181. package/build-module/components/post-schedule/label.mjs.map +1 -1
  182. package/build-module/components/post-status/index.mjs +0 -1
  183. package/build-module/components/post-status/index.mjs.map +2 -2
  184. package/build-module/components/post-taxonomies/flat-term-selector.mjs +3 -6
  185. package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
  186. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +1 -2
  187. package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
  188. package/build-module/components/post-template/create-new-template-modal.mjs +0 -1
  189. package/build-module/components/post-template/create-new-template-modal.mjs.map +2 -2
  190. package/build-module/components/post-text-editor/index.mjs +51 -0
  191. package/build-module/components/post-text-editor/index.mjs.map +2 -2
  192. package/build-module/components/post-text-editor/utils.mjs +123 -0
  193. package/build-module/components/post-text-editor/utils.mjs.map +7 -0
  194. package/build-module/components/post-url/index.mjs +1 -1
  195. package/build-module/components/post-url/index.mjs.map +2 -2
  196. package/build-module/components/post-view-link/index.mjs +1 -1
  197. package/build-module/components/post-view-link/index.mjs.map +2 -2
  198. package/build-module/components/post-visibility/index.mjs +0 -1
  199. package/build-module/components/post-visibility/index.mjs.map +2 -2
  200. package/build-module/components/provider/disable-non-page-content-blocks.mjs +23 -3
  201. package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
  202. package/build-module/components/provider/index.mjs +1 -1
  203. package/build-module/components/provider/index.mjs.map +2 -2
  204. package/build-module/components/provider/navigation-block-editing-mode.mjs +10 -3
  205. package/build-module/components/provider/navigation-block-editing-mode.mjs.map +2 -2
  206. package/build-module/components/provider/use-block-editor-settings.mjs +2 -1
  207. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  208. package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
  209. package/build-module/components/revision-diff-panel/index.mjs +7 -2
  210. package/build-module/components/revision-diff-panel/index.mjs.map +2 -2
  211. package/build-module/components/revision-fields-diff/index.mjs +6 -2
  212. package/build-module/components/revision-fields-diff/index.mjs.map +2 -2
  213. package/build-module/components/sidebar/dataform-post-summary.mjs +190 -30
  214. package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
  215. package/build-module/components/sidebar/index.mjs +1 -11
  216. package/build-module/components/sidebar/index.mjs.map +2 -2
  217. package/build-module/components/sidebar/post-revision-summary.mjs +11 -17
  218. package/build-module/components/sidebar/post-revision-summary.mjs.map +2 -2
  219. package/build-module/components/sidebar/post-summary.mjs +8 -6
  220. package/build-module/components/sidebar/post-summary.mjs.map +2 -2
  221. package/build-module/components/style-book/examples.mjs +1 -1
  222. package/build-module/components/style-book/examples.mjs.map +1 -1
  223. package/build-module/components/style-book/index.mjs +1 -1
  224. package/build-module/components/style-book/index.mjs.map +2 -2
  225. package/build-module/components/sync-connection-error-modal/index.mjs +3 -3
  226. package/build-module/components/sync-connection-error-modal/index.mjs.map +1 -1
  227. package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
  228. package/build-module/components/template-actions-panel/index.mjs +0 -9
  229. package/build-module/components/template-actions-panel/index.mjs.map +2 -2
  230. package/build-module/components/template-validation-notice/index.mjs +1 -1
  231. package/build-module/components/template-validation-notice/index.mjs.map +1 -1
  232. package/build-module/components/upload-progress-snackbar/index.mjs +3 -3
  233. package/build-module/components/upload-progress-snackbar/index.mjs.map +2 -2
  234. package/build-module/components/upload-progress-snackbar/tracker.mjs.map +1 -1
  235. package/build-module/components/visual-editor/edit-template-blocks-notification.mjs +1 -1
  236. package/build-module/components/visual-editor/edit-template-blocks-notification.mjs.map +1 -1
  237. package/build-module/dataviews/fields/revisions/index.mjs +20 -0
  238. package/build-module/dataviews/fields/revisions/index.mjs.map +7 -0
  239. package/build-module/dataviews/fields/revisions/revisions-view.mjs +53 -0
  240. package/build-module/dataviews/fields/revisions/revisions-view.mjs.map +7 -0
  241. package/build-module/dataviews/store/private-actions.mjs +28 -8
  242. package/build-module/dataviews/store/private-actions.mjs.map +2 -2
  243. package/build-module/hooks/push-changes-to-global-styles/index.mjs +1 -1
  244. package/build-module/hooks/push-changes-to-global-styles/index.mjs.map +1 -1
  245. package/build-module/store/actions.mjs +1 -1
  246. package/build-module/store/actions.mjs.map +2 -2
  247. package/build-module/store/private-actions.mjs +2 -2
  248. package/build-module/store/private-actions.mjs.map +2 -2
  249. package/build-module/store/private-selectors.mjs +7 -1
  250. package/build-module/store/private-selectors.mjs.map +2 -2
  251. package/build-module/utils/media-upload/index.mjs.map +1 -1
  252. package/build-module/utils/set-nested-value.mjs.map +1 -1
  253. package/build-style/style-rtl.css +298 -238
  254. package/build-style/style.css +298 -238
  255. package/build-types/components/autosave-monitor/index.d.ts +11 -29
  256. package/build-types/components/autosave-monitor/index.d.ts.map +1 -1
  257. package/build-types/components/collab-sidebar/note-byline.d.ts +0 -3
  258. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
  259. package/build-types/components/collab-sidebar/note.d.ts.map +1 -1
  260. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
  261. package/build-types/components/document-bar/index.d.ts +2 -2
  262. package/build-types/components/document-bar/index.d.ts.map +1 -1
  263. package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -1
  264. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  265. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  266. package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -1
  267. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  268. package/build-types/components/post-revisions-timeline/index.d.ts +2 -0
  269. package/build-types/components/post-revisions-timeline/index.d.ts.map +1 -0
  270. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  271. package/build-types/components/post-status/index.d.ts.map +1 -1
  272. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  273. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  274. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  275. package/build-types/components/post-text-editor/index.d.ts +1 -1
  276. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  277. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  278. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  279. package/build-types/components/provider/index.d.ts.map +1 -1
  280. package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -1
  281. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  282. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  283. package/build-types/components/revision-diff-panel/index.d.ts +3 -1
  284. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -1
  285. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
  286. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  287. package/build-types/components/sidebar/index.d.ts.map +1 -1
  288. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -1
  289. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  290. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
  291. package/build-types/components/template-actions-panel/index.d.ts.map +1 -1
  292. package/build-types/dataviews/fields/revisions/index.d.ts +8 -0
  293. package/build-types/dataviews/fields/revisions/index.d.ts.map +1 -0
  294. package/build-types/dataviews/fields/revisions/revisions-view.d.ts +2 -0
  295. package/build-types/dataviews/fields/revisions/revisions-view.d.ts.map +1 -0
  296. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  297. package/build-types/store/private-selectors.d.ts +1 -1
  298. package/build-types/store/private-selectors.d.ts.map +1 -1
  299. package/build-types/store/selectors.d.ts +1 -1
  300. package/build-types/store/selectors.d.ts.map +1 -1
  301. package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
  302. package/package.json +53 -47
  303. package/src/bindings/pattern-overrides.js +1 -1
  304. package/src/bindings/test/pattern-overrides.js +65 -0
  305. package/src/components/autosave-monitor/index.js +69 -104
  306. package/src/components/autosave-monitor/test/index.js +137 -122
  307. package/src/components/collab-sidebar/note-byline.js +0 -1
  308. package/src/components/collab-sidebar/note.js +64 -29
  309. package/src/components/collab-sidebar/style.scss +20 -0
  310. package/src/components/collaborators-presence/avatar/component.tsx +0 -1
  311. package/src/components/collaborators-presence/avatar/test/index.tsx +0 -1
  312. package/src/components/document-bar/index.js +8 -3
  313. package/src/components/document-bar/style.scss +4 -2
  314. package/src/components/global-keyboard-shortcuts/index.js +2 -1
  315. package/src/components/local-autosave-monitor/index.js +23 -21
  316. package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -0
  317. package/src/components/post-card-panel/index.js +1 -1
  318. package/src/components/post-publish-button/index.js +6 -3
  319. package/src/components/post-publish-button/test/index.js +13 -0
  320. package/src/components/post-publish-panel/postpublish.js +0 -1
  321. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +7 -2
  322. package/src/components/post-revisions-preview/diff-markers.js +0 -1
  323. package/src/components/post-revisions-timeline/index.js +186 -0
  324. package/src/components/post-revisions-timeline/style.scss +43 -0
  325. package/src/components/post-saved-state/index.js +23 -26
  326. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -0
  327. package/src/components/post-saved-state/test/index.js +18 -0
  328. package/src/components/post-status/index.js +0 -1
  329. package/src/components/post-taxonomies/flat-term-selector.js +4 -7
  330. package/src/components/post-taxonomies/hierarchical-term-selector.js +0 -1
  331. package/src/components/post-template/create-new-template-modal.js +0 -1
  332. package/src/components/post-text-editor/index.js +65 -0
  333. package/src/components/post-text-editor/test/utils.js +210 -0
  334. package/src/components/post-text-editor/utils.js +204 -0
  335. package/src/components/post-type-support-check/test/index.js +11 -0
  336. package/src/components/post-url/index.js +1 -1
  337. package/src/components/post-view-link/index.js +1 -1
  338. package/src/components/post-view-link/test/index.js +71 -0
  339. package/src/components/post-visibility/index.js +0 -1
  340. package/src/components/provider/disable-non-page-content-blocks.js +23 -6
  341. package/src/components/provider/index.js +2 -1
  342. package/src/components/provider/navigation-block-editing-mode.js +10 -4
  343. package/src/components/provider/use-block-editor-settings.js +3 -1
  344. package/src/components/resizable-editor/resize-handle.js +0 -1
  345. package/src/components/revision-diff-panel/index.js +8 -2
  346. package/src/components/revision-fields-diff/index.js +12 -1
  347. package/src/components/sidebar/dataform-post-summary.js +291 -36
  348. package/src/components/sidebar/index.js +2 -12
  349. package/src/components/sidebar/post-revision-summary.js +8 -15
  350. package/src/components/sidebar/post-summary.js +12 -10
  351. package/src/components/style-book/index.js +1 -1
  352. package/src/components/template-actions-panel/block-theme-content.js +0 -1
  353. package/src/components/template-actions-panel/index.js +0 -15
  354. package/src/dataviews/fields/revisions/index.tsx +28 -0
  355. package/src/dataviews/fields/revisions/revisions-view.tsx +59 -0
  356. package/src/dataviews/store/private-actions.ts +35 -7
  357. package/src/store/private-actions.js +2 -2
  358. package/src/store/private-selectors.js +11 -1
  359. package/src/store/test/actions.js +2 -2
  360. package/src/store/test/private-selectors.js +69 -0
  361. package/src/style.scss +1 -1
  362. package/build/components/post-revisions-panel/index.cjs +0 -173
  363. package/build/components/post-revisions-panel/index.cjs.map +0 -7
  364. package/build/components/revision-author-panel/index.cjs.map +0 -7
  365. package/build/components/revision-created-panel/index.cjs +0 -47
  366. package/build/components/revision-created-panel/index.cjs.map +0 -7
  367. package/build-module/components/post-revisions-panel/index.mjs +0 -148
  368. package/build-module/components/post-revisions-panel/index.mjs.map +0 -7
  369. package/build-module/components/revision-author-panel/index.mjs +0 -28
  370. package/build-module/components/revision-author-panel/index.mjs.map +0 -7
  371. package/build-module/components/revision-created-panel/index.mjs +0 -26
  372. package/build-module/components/revision-created-panel/index.mjs.map +0 -7
  373. package/build-types/components/collab-sidebar/add-comment.d.ts +0 -6
  374. package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
  375. package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
  376. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
  377. package/build-types/components/collab-sidebar/comment-form.d.ts +0 -9
  378. package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
  379. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
  380. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
  381. package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
  382. package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
  383. package/build-types/components/collab-sidebar/comments.d.ts +0 -10
  384. package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
  385. package/build-types/components/global-styles-provider/index.d.ts +0 -16
  386. package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
  387. package/build-types/components/media/index.d.ts +0 -3
  388. package/build-types/components/media/index.d.ts.map +0 -1
  389. package/build-types/components/media/metadata-panel.d.ts +0 -12
  390. package/build-types/components/media/metadata-panel.d.ts.map +0 -1
  391. package/build-types/components/media/preview.d.ts +0 -9
  392. package/build-types/components/media/preview.d.ts.map +0 -1
  393. package/build-types/components/post-revisions-panel/index.d.ts +0 -2
  394. package/build-types/components/post-revisions-panel/index.d.ts.map +0 -1
  395. package/build-types/components/revision-author-panel/index.d.ts +0 -2
  396. package/build-types/components/revision-author-panel/index.d.ts.map +0 -1
  397. package/build-types/components/revision-created-panel/index.d.ts +0 -2
  398. package/build-types/components/revision-created-panel/index.d.ts.map +0 -1
  399. package/src/components/editor-help/images/add-dark.png +0 -0
  400. package/src/components/editor-help/images/add-dark@2x.png +0 -0
  401. package/src/components/editor-help/images/add-dark@3x.png +0 -0
  402. package/src/components/editor-help/images/add-light.png +0 -0
  403. package/src/components/editor-help/images/add-light@2x.png +0 -0
  404. package/src/components/editor-help/images/add-light@3x.png +0 -0
  405. package/src/components/editor-help/images/block-layout-collage.png +0 -0
  406. package/src/components/editor-help/images/block-layout-collage@2x.png +0 -0
  407. package/src/components/editor-help/images/block-layout-collage@3x.png +0 -0
  408. package/src/components/editor-help/images/build-layouts-dark.png +0 -0
  409. package/src/components/editor-help/images/build-layouts-dark@2x.png +0 -0
  410. package/src/components/editor-help/images/build-layouts-dark@3x.png +0 -0
  411. package/src/components/editor-help/images/build-layouts-light.png +0 -0
  412. package/src/components/editor-help/images/build-layouts-light@2x.png +0 -0
  413. package/src/components/editor-help/images/build-layouts-light@3x.png +0 -0
  414. package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
  415. package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
  416. package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
  417. package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
  418. package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
  419. package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
  420. package/src/components/editor-help/images/edit-media-dark.png +0 -0
  421. package/src/components/editor-help/images/edit-media-dark@2x.png +0 -0
  422. package/src/components/editor-help/images/edit-media-dark@3x.png +0 -0
  423. package/src/components/editor-help/images/edit-media-light.png +0 -0
  424. package/src/components/editor-help/images/edit-media-light@2x.png +0 -0
  425. package/src/components/editor-help/images/edit-media-light@3x.png +0 -0
  426. package/src/components/editor-help/images/embed-media-dark.png +0 -0
  427. package/src/components/editor-help/images/embed-media-dark@2x.png +0 -0
  428. package/src/components/editor-help/images/embed-media-dark@3x.png +0 -0
  429. package/src/components/editor-help/images/embed-media-light.png +0 -0
  430. package/src/components/editor-help/images/embed-media-light@2x.png +0 -0
  431. package/src/components/editor-help/images/embed-media-light@3x.png +0 -0
  432. package/src/components/editor-help/images/move-dark.png +0 -0
  433. package/src/components/editor-help/images/move-dark@2x.png +0 -0
  434. package/src/components/editor-help/images/move-dark@3x.png +0 -0
  435. package/src/components/editor-help/images/move-light.png +0 -0
  436. package/src/components/editor-help/images/move-light@2x.png +0 -0
  437. package/src/components/editor-help/images/move-light@3x.png +0 -0
  438. package/src/components/editor-help/images/options-dark.png +0 -0
  439. package/src/components/editor-help/images/options-dark@2x.png +0 -0
  440. package/src/components/editor-help/images/options-dark@3x.png +0 -0
  441. package/src/components/editor-help/images/options-light.png +0 -0
  442. package/src/components/editor-help/images/options-light@2x.png +0 -0
  443. package/src/components/editor-help/images/options-light@3x.png +0 -0
  444. package/src/components/editor-help/images/rich-text-dark.png +0 -0
  445. package/src/components/editor-help/images/rich-text-dark@2x.png +0 -0
  446. package/src/components/editor-help/images/rich-text-dark@3x.png +0 -0
  447. package/src/components/editor-help/images/rich-text-light.png +0 -0
  448. package/src/components/editor-help/images/rich-text-light@2x.png +0 -0
  449. package/src/components/editor-help/images/rich-text-light@3x.png +0 -0
  450. package/src/components/editor-help/images/settings-dark.png +0 -0
  451. package/src/components/editor-help/images/settings-dark@2x.png +0 -0
  452. package/src/components/editor-help/images/settings-dark@3x.png +0 -0
  453. package/src/components/editor-help/images/settings-light.png +0 -0
  454. package/src/components/editor-help/images/settings-light@2x.png +0 -0
  455. package/src/components/editor-help/images/settings-light@3x.png +0 -0
  456. package/src/components/editor-help/style.scss +0 -123
  457. package/src/components/post-revisions-panel/index.js +0 -161
  458. package/src/components/post-revisions-panel/style.scss +0 -16
  459. package/src/components/revision-author-panel/index.js +0 -36
  460. package/src/components/revision-created-panel/index.js +0 -36
@@ -27,33 +27,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/editor/src/components/revision-author-panel/index.js
31
- var revision_author_panel_exports = {};
32
- __export(revision_author_panel_exports, {
33
- default: () => RevisionAuthorPanel
30
+ // packages/editor/src/dataviews/fields/revisions/index.tsx
31
+ var revisions_exports = {};
32
+ __export(revisions_exports, {
33
+ default: () => revisions_default
34
34
  });
35
- module.exports = __toCommonJS(revision_author_panel_exports);
36
- var import_data = require("@wordpress/data");
37
- var import_core_data = require("@wordpress/core-data");
38
- var import_html_entities = require("@wordpress/html-entities");
35
+ module.exports = __toCommonJS(revisions_exports);
39
36
  var import_i18n = require("@wordpress/i18n");
40
- var import_post_panel_row = __toESM(require("../post-panel-row/index.cjs"));
41
- var import_store = require("../../store/index.cjs");
42
- var import_lock_unlock = require("../../lock-unlock.cjs");
43
- var import_jsx_runtime = require("react/jsx-runtime");
44
- function RevisionAuthorPanel() {
45
- const authorName = (0, import_data.useSelect)((select) => {
46
- const { getCurrentRevision } = (0, import_lock_unlock.unlock)(select(import_store.store));
47
- const revision = getCurrentRevision();
48
- if (!revision?.author) {
49
- return null;
50
- }
51
- const author = select(import_core_data.store).getUser(revision.author);
52
- return author?.name;
53
- }, []);
54
- if (!authorName) {
55
- return null;
37
+ var import_revisions_view = __toESM(require("./revisions-view.cjs"));
38
+ var revisionsField = {
39
+ id: "revisions",
40
+ label: (0, import_i18n.__)("Revisions"),
41
+ readOnly: true,
42
+ enableSorting: false,
43
+ render: import_revisions_view.default,
44
+ isVisible: (item) => {
45
+ const revisionsCount = item._links?.["version-history"]?.[0]?.count ?? 0;
46
+ const lastRevisionId = item._links?.["predecessor-version"]?.[0]?.id ?? null;
47
+ return !!lastRevisionId && revisionsCount >= 2;
56
48
  }
57
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_post_panel_row.default, { label: (0, import_i18n.__)("Author"), children: (0, import_html_entities.decodeEntities)(authorName) });
58
- }
49
+ };
50
+ var revisions_default = revisionsField;
59
51
  //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/dataviews/fields/revisions/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport type { BasePost } from '@wordpress/fields';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport RevisionsView from './revisions-view';\n\nconst revisionsField: Field< BasePost > = {\n\tid: 'revisions',\n\tlabel: __( 'Revisions' ),\n\treadOnly: true,\n\tenableSorting: false,\n\trender: RevisionsView,\n\tisVisible: ( item ) => {\n\t\tconst revisionsCount =\n\t\t\titem._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\tconst lastRevisionId =\n\t\t\titem._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\treturn !! lastRevisionId && revisionsCount >= 2;\n\t},\n};\n\nexport default revisionsField;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,kBAAmB;AAKnB,4BAA0B;AAE1B,IAAM,iBAAoC;AAAA,EACzC,IAAI;AAAA,EACJ,WAAO,gBAAI,WAAY;AAAA,EACvB,UAAU;AAAA,EACV,eAAe;AAAA,EACf,QAAQ,sBAAAA;AAAA,EACR,WAAW,CAAE,SAAU;AACtB,UAAM,iBACL,KAAK,SAAU,iBAAkB,IAAK,CAAE,GAAG,SAAS;AACrD,UAAM,iBACL,KAAK,SAAU,qBAAsB,IAAK,CAAE,GAAG,MAAM;AACtD,WAAO,CAAC,CAAE,kBAAkB,kBAAkB;AAAA,EAC/C;AACD;AAEA,IAAO,oBAAQ;",
6
+ "names": ["RevisionsView"]
7
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/editor/src/dataviews/fields/revisions/revisions-view.tsx
21
+ var revisions_view_exports = {};
22
+ __export(revisions_view_exports, {
23
+ default: () => RevisionsView
24
+ });
25
+ module.exports = __toCommonJS(revisions_view_exports);
26
+ var import_components = require("@wordpress/components");
27
+ var import_data = require("@wordpress/data");
28
+ var import_i18n = require("@wordpress/i18n");
29
+ var import_url = require("@wordpress/url");
30
+ var import_store = require("../../../store/index.cjs");
31
+ var import_lock_unlock = require("../../../lock-unlock.cjs");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ function RevisionsView() {
34
+ const { lastRevisionId, revisionsCount, disableVisualRevisions } = (0, import_data.useSelect)((select) => {
35
+ const {
36
+ getCurrentPostLastRevisionId,
37
+ getCurrentPostRevisionsCount,
38
+ getEditorSettings
39
+ // @ts-ignore
40
+ } = select(import_store.store);
41
+ return {
42
+ lastRevisionId: getCurrentPostLastRevisionId(),
43
+ revisionsCount: getCurrentPostRevisionsCount(),
44
+ disableVisualRevisions: (
45
+ // @ts-ignore
46
+ !!getEditorSettings().disableVisualRevisions
47
+ )
48
+ };
49
+ }, []);
50
+ const { setCurrentRevisionId } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
51
+ const buttonProps = disableVisualRevisions ? {
52
+ href: (0, import_url.addQueryArgs)("revision.php", {
53
+ revision: lastRevisionId
54
+ })
55
+ } : { onClick: () => setCurrentRevisionId(lastRevisionId) };
56
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
57
+ import_components.Button,
58
+ {
59
+ ...buttonProps,
60
+ variant: "link",
61
+ text: String(revisionsCount),
62
+ "aria-label": (0, import_i18n.sprintf)(
63
+ /* translators: %d: number of revisions. */
64
+ (0, import_i18n._n)(
65
+ "Open revisions screen: %d revision",
66
+ "Open revisions screen: %d revisions",
67
+ revisionsCount
68
+ ),
69
+ revisionsCount
70
+ )
71
+ }
72
+ );
73
+ }
74
+ //# sourceMappingURL=revisions-view.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/dataviews/fields/revisions/revisions-view.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\n// @ts-ignore\nimport { store as editorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nexport default function RevisionsView() {\n\tconst { lastRevisionId, revisionsCount, disableVisualRevisions } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetCurrentPostLastRevisionId,\n\t\t\t\tgetCurrentPostRevisionsCount,\n\t\t\t\tgetEditorSettings,\n\t\t\t\t// @ts-ignore\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t\t\tdisableVisualRevisions:\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t!! getEditorSettings().disableVisualRevisions,\n\t\t\t};\n\t\t}, [] );\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\n\tconst buttonProps = disableVisualRevisions\n\t\t? {\n\t\t\t\thref: addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t} ),\n\t\t }\n\t\t: { onClick: () => setCurrentRevisionId( lastRevisionId ) };\n\n\treturn (\n\t\t<Button\n\t\t\t{ ...buttonProps }\n\t\t\tvariant=\"link\"\n\t\t\ttext={ String( revisionsCount ) }\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %d: number of revisions. */\n\t\t\t\t_n(\n\t\t\t\t\t'Open revisions screen: %d revision',\n\t\t\t\t\t'Open revisions screen: %d revisions',\n\t\t\t\t\trevisionsCount\n\t\t\t\t),\n\t\t\t\trevisionsCount\n\t\t\t) }\n\t\t/>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AACvB,kBAAuC;AACvC,kBAA4B;AAC5B,iBAA6B;AAM7B,mBAAqC;AACrC,yBAAuB;AA8BrB;AA5Ba,SAAR,gBAAiC;AACvC,QAAM,EAAE,gBAAgB,gBAAgB,uBAAuB,QAC9D,uBAAW,CAAE,WAAY;AACxB,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA;AAAA,IAED,IAAI,OAAQ,aAAAA,KAAY;AACxB,WAAO;AAAA,MACN,gBAAgB,6BAA6B;AAAA,MAC7C,gBAAgB,6BAA6B;AAAA,MAC7C;AAAA;AAAA,QAEC,CAAC,CAAE,kBAAkB,EAAE;AAAA;AAAA,IACzB;AAAA,EACD,GAAG,CAAC,CAAE;AACP,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,aAAAA,KAAY,CAAE;AAEpE,QAAM,cAAc,yBACjB;AAAA,IACA,UAAM,yBAAc,gBAAgB;AAAA,MACnC,UAAU;AAAA,IACX,CAAE;AAAA,EACF,IACA,EAAE,SAAS,MAAM,qBAAsB,cAAe,EAAE;AAE3D,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL,SAAQ;AAAA,MACR,MAAO,OAAQ,cAAe;AAAA,MAC9B,kBAAa;AAAA;AAAA,YAEZ;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,QACA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
+ "names": ["editorStore"]
7
+ }
@@ -159,21 +159,33 @@ var registerPostTypeSchema = (postType) => async ({ registry }) => {
159
159
  } else {
160
160
  fields = [
161
161
  postTypeConfig.supports?.thumbnail && currentTheme?.theme_supports?.["post-thumbnails"] && import_fields.featuredImageField,
162
- postTypeConfig.supports?.author && import_fields.authorField,
163
- import_fields.statusField,
162
+ !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && postTypeConfig.supports?.author && import_fields.authorField,
163
+ postTypeConfig.slug === "wp_template" && import_fields.templateAuthorField,
164
+ postTypeConfig.slug === "wp_template_part" && import_fields.templatePartAuthorField,
165
+ !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.statusField,
164
166
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.dateField,
165
167
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.scheduledDateField,
166
- import_fields.slugField,
168
+ import_fields.lastEditedDateField,
169
+ !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.slugField,
167
170
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && postTypeConfig.supports?.excerpt && import_fields.excerptField,
168
171
  postTypeConfig.supports?.["page-attributes"] && import_fields.parentField,
169
172
  postTypeConfig.supports?.comments && import_fields.commentStatusField,
170
173
  postTypeConfig.supports?.trackbacks && import_fields.pingStatusField,
171
174
  (postTypeConfig.supports?.comments || postTypeConfig.supports?.trackbacks) && import_fields.discussionField,
172
- import_fields.templateField,
175
+ !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.templateField,
173
176
  postTypeConfig.supports?.["post-formats"] && !disablePostFormats && import_fields.formatField,
174
177
  !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && postTypeConfig.supports?.editor && import_fields.postContentInfoField,
175
- import_fields.passwordField,
178
+ !import_constants.DESIGN_POST_TYPES.includes(postTypeConfig.slug) && import_fields.passwordField,
176
179
  postTypeConfig.slug === "post" && import_fields.stickyField,
180
+ postTypeConfig.slug === "wp_template" && import_fields.descriptionField,
181
+ postTypeConfig.slug === "wp_template" && import_fields.readOnlyDescriptionField,
182
+ // The `home`/`index` template summary exposes a few fields that
183
+ // target other entities (`root/site` and the posts page).
184
+ // `DataFormPostSummary` overrides them to read/write the right
185
+ // entity and to control their visibility.
186
+ postTypeConfig.slug === "wp_template" && import_fields.postsPageTitleField,
187
+ postTypeConfig.slug === "wp_template" && import_fields.postsPerPageField,
188
+ postTypeConfig.slug === "wp_template" && import_fields.siteDiscussionField,
177
189
  postTypeConfig.supports?.editor && postTypeConfig.viewable && import_content_preview.default,
178
190
  hasEditorNotesSupport(postTypeConfig.supports) && import_fields.notesField
179
191
  ].filter(Boolean);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/dataviews/store/private-actions.ts"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\texcerptField,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tpingStatusField,\n\tdiscussionField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n\tnotesField,\n\tscheduledDateField,\n\tformatField,\n\tpostContentInfoField,\n\tstickyField,\n} from '@wordpress/fields';\nimport {\n\taltTextField,\n\tattachedToField,\n\tauthorField as mediaAuthorField,\n\tcaptionField,\n\tdateAddedField,\n\tdescriptionField,\n\tfilenameField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tmimeTypeField,\n} from '@wordpress/media-fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE, DESIGN_POST_TYPES } from '../../store/constants';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\ndeclare global {\n\tinterface Window {\n\t\t__experimentalTemplateActivate?: boolean;\n\t}\n}\n\n/**\n * Check if a post type supports editor notes.\n *\n * @param supports The post type supports object.\n * @return Whether editor notes are supported.\n */\nfunction hasEditorNotesSupport( supports?: PostType[ 'supports' ] ): boolean {\n\tconst editor = supports?.editor;\n\tif ( Array.isArray( editor ) ) {\n\t\treturn !! editor[ 0 ]?.notes;\n\t}\n\treturn false;\n}\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\n/*\n * Media fields for the attachment post type.\n *\n * Field order follows a logical grouping:\n * 1. Metadata fields in panels (date, author, file info)\n * 2. Core editable fields (title, alt text, caption, description)\n *\n * Note: media_thumbnail is not included as it's shown in the canvas preview\n */\nconst ORDERED_MEDIA_FIELDS = [\n\t// Metadata in panels (collapsed by default).\n\tdateAddedField,\n\tmediaAuthorField,\n\tfilenameField,\n\tmimeTypeField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tattachedToField,\n\t// Regular layout fields (always visible).\n\ttitleField,\n\taltTextField,\n\tcaptionField,\n\tdescriptionField,\n];\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\t\tconst { disablePostFormats } = registry\n\t\t\t.select( editorStore )\n\t\t\t.getEditorSettings();\n\n\t\tlet canDuplicate =\n\t\t\t! [ 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\tpostTypeConfig.slug\n\t\t\t) &&\n\t\t\tcanCreate &&\n\t\t\tduplicatePost;\n\n\t\t// @ts-ignore\n\t\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t// Outside Gutenberg, disable duplication except for wp_template.\n\t\t\tif ( 'wp_template' !== postTypeConfig.slug ) {\n\t\t\t\tcanDuplicate = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// When template activation experiment is disabled, templates cannot be duplicated.\n\t\t// @ts-ignore\n\t\tif (\n\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t! window?.__experimentalTemplateActivate\n\t\t) {\n\t\t\tcanDuplicate = undefined;\n\t\t}\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tcanDuplicate,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\t// Handle attachment post type separately with media-specific fields\n\t\tlet fields;\n\n\t\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\t\tfields = ORDERED_MEDIA_FIELDS;\n\t\t} else {\n\t\t\tfields = [\n\t\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\t\tfeaturedImageField,\n\t\t\t\tpostTypeConfig.supports?.author && authorField,\n\t\t\t\tstatusField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tdateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tscheduledDateField,\n\t\t\t\tslugField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.excerpt &&\n\t\t\t\t\texcerptField,\n\t\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\t\tpostTypeConfig.supports?.trackbacks && pingStatusField,\n\t\t\t\t( postTypeConfig.supports?.comments ||\n\t\t\t\t\tpostTypeConfig.supports?.trackbacks ) &&\n\t\t\t\t\tdiscussionField,\n\t\t\t\ttemplateField,\n\t\t\t\tpostTypeConfig.supports?.[ 'post-formats' ] &&\n\t\t\t\t\t! disablePostFormats &&\n\t\t\t\t\tformatField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostContentInfoField,\n\t\t\t\tpasswordField,\n\t\t\t\tpostTypeConfig.slug === 'post' && stickyField,\n\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\t\tpostPreviewField,\n\t\t\t\thasEditorNotesSupport( postTypeConfig.supports ) && notesField,\n\t\t\t].filter( Boolean );\n\t\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\t\tlet _titleField;\n\t\t\t\tif ( postType === 'page' ) {\n\t\t\t\t\t_titleField = pageTitleField;\n\t\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t\t_titleField = templateTitleField;\n\t\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t\t_titleField = patternTitleField;\n\t\t\t\t} else {\n\t\t\t\t\t_titleField = titleField;\n\t\t\t\t}\n\t\t\t\tfields.push( _titleField );\n\t\t\t}\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AAEnC,mBAAyB;AAEzB,oBAmCO;AACP,0BAWO;AAKP,mBAAqC;AACrC,uBAAwD;AACxD,6BAA6B;AAC7B,yBAAuB;AAcvB,SAAS,sBAAuB,UAA6C;AAC5E,QAAM,SAAS,UAAU;AACzB,MAAK,MAAM,QAAS,MAAO,GAAI;AAC9B,WAAO,CAAC,CAAE,OAAQ,CAAE,GAAG;AAAA,EACxB;AACA,SAAO;AACR;AAEO,SAAS,qBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,uBACf,MACA,MACA,UACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IAC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AU;AAAA,MAClC,eAAe,UAAU,UACxB,eAAe,YACf,uBAAAE;AAAA,MACD,sBAAuB,eAAe,QAAS,KAAK;AAAA,IACrD,EAAE,OAAQ,OAAQ;AAClB,QAAK,eAAe,UAAU,OAAQ;AACrC,UAAI;AACJ,UAAK,aAAa,QAAS;AAC1B,sBAAc;AAAA,MACf,WAAY,aAAa,eAAgB;AACxC,sBAAc;AAAA,MACf,WAAY,aAAa,YAAa;AACrC,sBAAc;AAAA,MACf,OAAO;AACN,sBAAc;AAAA,MACf;AACA,aAAO,KAAM,WAAY;AAAA,IAC1B;AAAA,EACD;AAEA,WAAS,MAAO,MAAM;AACrB,YAAQ,QAAS,CAAE,WAAY;AAC9B,qCAAQ,SAAS,SAAU,aAAAF,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AACF,WAAO,QAAS,CAAE,UAAW;AAC5B,qCAAQ,SAAS,SAAU,aAAAA,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,6BAAU,+BAA+B,QAAS;AACnD;",
6
- "names": ["mediaAuthorField", "editorStore", "coreStore", "postPreviewField"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\texcerptField,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tpingStatusField,\n\tdiscussionField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttemplateAuthorField,\n\ttemplatePartAuthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n\tnotesField,\n\tscheduledDateField,\n\tlastEditedDateField,\n\tformatField,\n\tpostContentInfoField,\n\tstickyField,\n\tdescriptionField,\n\treadOnlyDescriptionField,\n\tpostsPerPageField,\n\tsiteDiscussionField,\n\tpostsPageTitleField,\n} from '@wordpress/fields';\nimport {\n\taltTextField,\n\tattachedToField,\n\tauthorField as mediaAuthorField,\n\tcaptionField,\n\tdateAddedField,\n\tdescriptionField as mediaDescriptionField,\n\tfilenameField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tmimeTypeField,\n} from '@wordpress/media-fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { ATTACHMENT_POST_TYPE, DESIGN_POST_TYPES } from '../../store/constants';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\ndeclare global {\n\tinterface Window {\n\t\t__experimentalTemplateActivate?: boolean;\n\t}\n}\n\n/**\n * Check if a post type supports editor notes.\n *\n * @param supports The post type supports object.\n * @return Whether editor notes are supported.\n */\nfunction hasEditorNotesSupport( supports?: PostType[ 'supports' ] ): boolean {\n\tconst editor = supports?.editor;\n\tif ( Array.isArray( editor ) ) {\n\t\treturn !! editor[ 0 ]?.notes;\n\t}\n\treturn false;\n}\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\n/*\n * Media fields for the attachment post type.\n *\n * Field order follows a logical grouping:\n * 1. Metadata fields in panels (date, author, file info)\n * 2. Core editable fields (title, alt text, caption, description)\n *\n * Note: media_thumbnail is not included as it's shown in the canvas preview\n */\nconst ORDERED_MEDIA_FIELDS = [\n\t// Metadata in panels (collapsed by default).\n\tdateAddedField,\n\tmediaAuthorField,\n\tfilenameField,\n\tmimeTypeField,\n\tfilesizeField,\n\tmediaDimensionsField,\n\tattachedToField,\n\t// Regular layout fields (always visible).\n\ttitleField,\n\taltTextField,\n\tcaptionField,\n\tmediaDescriptionField,\n];\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\t\tconst { disablePostFormats } = registry\n\t\t\t.select( editorStore )\n\t\t\t.getEditorSettings();\n\n\t\tlet canDuplicate =\n\t\t\t! [ 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\tpostTypeConfig.slug\n\t\t\t) &&\n\t\t\tcanCreate &&\n\t\t\tduplicatePost;\n\n\t\t// @ts-ignore\n\t\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t// Outside Gutenberg, disable duplication except for wp_template.\n\t\t\tif ( 'wp_template' !== postTypeConfig.slug ) {\n\t\t\t\tcanDuplicate = undefined;\n\t\t\t}\n\t\t}\n\n\t\t// When template activation experiment is disabled, templates cannot be duplicated.\n\t\t// @ts-ignore\n\t\tif (\n\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t! window?.__experimentalTemplateActivate\n\t\t) {\n\t\t\tcanDuplicate = undefined;\n\t\t}\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tcanDuplicate,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\t// Handle attachment post type separately with media-specific fields\n\t\tlet fields;\n\n\t\tif ( postType === ATTACHMENT_POST_TYPE ) {\n\t\t\tfields = ORDERED_MEDIA_FIELDS;\n\t\t} else {\n\t\t\tfields = [\n\t\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\t\tfeaturedImageField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.author &&\n\t\t\t\t\tauthorField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && templateAuthorField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\t\t\ttemplatePartAuthorField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tstatusField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tdateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tscheduledDateField,\n\t\t\t\tlastEditedDateField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tslugField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.excerpt &&\n\t\t\t\t\texcerptField,\n\t\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\t\tpostTypeConfig.supports?.trackbacks && pingStatusField,\n\t\t\t\t( postTypeConfig.supports?.comments ||\n\t\t\t\t\tpostTypeConfig.supports?.trackbacks ) &&\n\t\t\t\t\tdiscussionField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\ttemplateField,\n\t\t\t\tpostTypeConfig.supports?.[ 'post-formats' ] &&\n\t\t\t\t\t! disablePostFormats &&\n\t\t\t\t\tformatField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostContentInfoField,\n\t\t\t\t! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&\n\t\t\t\t\tpasswordField,\n\t\t\t\tpostTypeConfig.slug === 'post' && stickyField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && descriptionField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' &&\n\t\t\t\t\treadOnlyDescriptionField,\n\t\t\t\t// The `home`/`index` template summary exposes a few fields that\n\t\t\t\t// target other entities (`root/site` and the posts page).\n\t\t\t\t// `DataFormPostSummary` overrides them to read/write the right\n\t\t\t\t// entity and to control their visibility.\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && postsPageTitleField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && postsPerPageField,\n\t\t\t\tpostTypeConfig.slug === 'wp_template' && siteDiscussionField,\n\t\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\t\tpostPreviewField,\n\t\t\t\thasEditorNotesSupport( postTypeConfig.supports ) && notesField,\n\t\t\t].filter( Boolean );\n\t\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\t\tlet _titleField;\n\t\t\t\tif ( postType === 'page' ) {\n\t\t\t\t\t_titleField = pageTitleField;\n\t\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t\t_titleField = templateTitleField;\n\t\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t\t_titleField = patternTitleField;\n\t\t\t\t} else {\n\t\t\t\t\t_titleField = titleField;\n\t\t\t\t}\n\t\t\t\tfields.push( _titleField );\n\t\t\t}\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AAEnC,mBAAyB;AAEzB,oBA2CO;AACP,0BAWO;AAKP,mBAAqC;AACrC,uBAAwD;AACxD,6BAA6B;AAC7B,yBAAuB;AAcvB,SAAS,sBAAuB,UAA6C;AAC5E,QAAM,SAAS,UAAU;AACzB,MAAK,MAAM,QAAS,MAAO,GAAI;AAC9B,WAAO,CAAC,CAAE,OAAQ,CAAE,GAAG;AAAA,EACxB;AACA,SAAO;AACR;AAEO,SAAS,qBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,uBACf,MACA,MACA,UACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,oBACf,MACA,MACA,QACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,sBACf,MACA,MACA,SACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAEO,SAAS,WAAY,MAAc,MAAe;AACxD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAWA,IAAM,uBAAuB;AAAA;AAAA,EAE5B;AAAA,EAC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BAAiB;AAAA,MACzC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,SAAS,iBAAiB;AAAA,MACzC,eAAe,UAAU,UACxB,eAAe,YACf,uBAAAE;AAAA,MACD,sBAAuB,eAAe,QAAS,KAAK;AAAA,IACrD,EAAE,OAAQ,OAAQ;AAClB,QAAK,eAAe,UAAU,OAAQ;AACrC,UAAI;AACJ,UAAK,aAAa,QAAS;AAC1B,sBAAc;AAAA,MACf,WAAY,aAAa,eAAgB;AACxC,sBAAc;AAAA,MACf,WAAY,aAAa,YAAa;AACrC,sBAAc;AAAA,MACf,OAAO;AACN,sBAAc;AAAA,MACf;AACA,aAAO,KAAM,WAAY;AAAA,IAC1B;AAAA,EACD;AAEA,WAAS,MAAO,MAAM;AACrB,YAAQ,QAAS,CAAE,WAAY;AAC9B,qCAAQ,SAAS,SAAU,aAAAF,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AACF,WAAO,QAAS,CAAE,UAAW;AAC5B,qCAAQ,SAAS,SAAU,aAAAA,KAAY,CAAE,EAAE;AAAA,QAC1C;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,6BAAU,+BAA+B,QAAS;AACnD;",
6
+ "names": ["mediaAuthorField", "mediaDescriptionField", "editorStore", "coreStore", "postPreviewField"]
7
7
  }
@@ -273,7 +273,7 @@ function PushChangesToGlobalStylesControl({
273
273
  help: (0, import_i18n.sprintf)(
274
274
  // translators: %s: Title of the block e.g. 'Heading'.
275
275
  (0, import_i18n.__)(
276
- "Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks."
276
+ "Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."
277
277
  ),
278
278
  (0, import_blocks.getBlockType)(name).title
279
279
  ),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/push-changes-to-global-styles/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport setNestedValue from '../../utils/set-nested-value';\nimport { useGlobalStyles } from '../../components/global-styles/hooks';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSelect(\n\t\t( select ) => {\n\t\t\treturn unlock( select( blocksStore ) ).getSupportedStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUser: setUserConfig } = useGlobalStyles();\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = structuredClone( blockStyles );\n\t\t\tconst newUserConfig = structuredClone( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"editor-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block\u2019s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport setNestedValue from '../../utils/set-nested-value';\nimport { useGlobalStyles } from '../../components/global-styles/hooks';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSelect(\n\t\t( select ) => {\n\t\t\treturn unlock( select( blocksStore ) ).getSupportedStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUser: setUserConfig } = useGlobalStyles();\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = structuredClone( blockStyles );\n\t\t\tconst newUserConfig = structuredClone( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"editor-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,mBAA0B;AAC1B,qBAA2C;AAC3C,0BAKO;AACP,wBAAoC;AACpC,kBAA4B;AAC5B,oBAKO;AACP,qBAAqC;AACrC,kBAAuC;AACvC,qBAAsC;AACtC,uBAAmC;AAKnC,yBAAuB;AACvB,8BAA2B;AAC3B,IAAAA,gBAAgC;AA0S9B;AAxSF,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,oBAAAC,WAAuB;AAK5D,IAAM,iBAAiB;AAAA,EACtB,GAAG;AAAA,EACH,UAAU,EAAE,OAAO,CAAE,WAAW,UAAW,EAAE;AAC9C;AAKA,IAAM,8BAA8B;AAAA,EACnC,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,4BAA4B;AAAA,EAC5B,mCAAmC;AAAA,EACnC,uCAAuC;AAAA,EACvC,qCAAqC;AAAA,EACrC,8BAA8B;AAAA,EAC9B,oCAAoC;AAAA,EACpC,yCAAyC;AAAA,EACzC,uCAAuC;AAAA,EACvC,+BAA+B;AAAA,EAC/B,0BAA0B;AAAA,EAC1B,qCAAqC;AAAA,EACrC,0CAA0C;AAAA,EAC1C,6BA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EditorStore", "noticesStore", "setNestedValue", "coreStore"]
7
7
  }
@@ -306,7 +306,7 @@ async function templateActivationNotice({ select, registry }) {
306
306
  onClick: async () => {
307
307
  await registry.dispatch(import_notices.store).createNotice(
308
308
  "info",
309
- (0, import_i18n.__)("Activating template\u2026"),
309
+ (0, import_i18n.__)("Activating template"),
310
310
  { id: "template-activate-notice" }
311
311
  );
312
312
  try {