@wordpress/editor 14.4.0 → 14.6.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 (375) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/bindings/post-meta.js +12 -0
  3. package/build/bindings/post-meta.js.map +1 -1
  4. package/build/components/blog-title/index.js +1 -1
  5. package/build/components/blog-title/index.js.map +1 -1
  6. package/build/components/commands/index.js +8 -2
  7. package/build/components/commands/index.js.map +1 -1
  8. package/build/components/create-template-part-modal/index.js +1 -0
  9. package/build/components/create-template-part-modal/index.js.map +1 -1
  10. package/build/components/document-bar/index.js +1 -1
  11. package/build/components/document-bar/index.js.map +1 -1
  12. package/build/components/global-styles-provider/index.js +17 -4
  13. package/build/components/global-styles-provider/index.js.map +1 -1
  14. package/build/components/header/index.js +2 -3
  15. package/build/components/header/index.js.map +1 -1
  16. package/build/components/inserter-sidebar/index.js +5 -2
  17. package/build/components/inserter-sidebar/index.js.map +1 -1
  18. package/build/components/page-attributes/parent.js +11 -6
  19. package/build/components/page-attributes/parent.js.map +1 -1
  20. package/build/components/post-actions/actions.js +10 -811
  21. package/build/components/post-actions/actions.js.map +1 -1
  22. package/build/components/post-actions/index.js +20 -19
  23. package/build/components/post-actions/index.js.map +1 -1
  24. package/build/components/post-author/hook.js +10 -3
  25. package/build/components/post-author/hook.js.map +1 -1
  26. package/build/components/post-author/panel.js +2 -1
  27. package/build/components/post-author/panel.js.map +1 -1
  28. package/build/components/post-card-panel/index.js +21 -21
  29. package/build/components/post-card-panel/index.js.map +1 -1
  30. package/build/components/post-comments/index.js +6 -20
  31. package/build/components/post-comments/index.js.map +1 -1
  32. package/build/components/post-featured-image/index.js +2 -0
  33. package/build/components/post-featured-image/index.js.map +1 -1
  34. package/build/components/post-publish-panel/postpublish.js +4 -0
  35. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  36. package/build/components/post-slug/index.js +1 -0
  37. package/build/components/post-slug/index.js.map +1 -1
  38. package/build/components/post-status/index.js +17 -41
  39. package/build/components/post-status/index.js.map +1 -1
  40. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -1
  41. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  42. package/build/components/post-template/create-new-template-modal.js +3 -0
  43. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  44. package/build/components/post-url/index.js +6 -5
  45. package/build/components/post-url/index.js.map +1 -1
  46. package/build/components/post-url/panel.js +3 -2
  47. package/build/components/post-url/panel.js.map +1 -1
  48. package/build/components/preview-dropdown/index.js +82 -17
  49. package/build/components/preview-dropdown/index.js.map +1 -1
  50. package/build/components/provider/disable-non-page-content-blocks.js +14 -18
  51. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  52. package/build/components/sidebar/post-summary.js +10 -7
  53. package/build/components/sidebar/post-summary.js.map +1 -1
  54. package/build/components/site-discussion/index.js +6 -20
  55. package/build/components/site-discussion/index.js.map +1 -1
  56. package/build/components/template-content-panel/index.js +15 -13
  57. package/build/components/template-content-panel/index.js.map +1 -1
  58. package/build/components/visual-editor/index.js +2 -1
  59. package/build/components/visual-editor/index.js.map +1 -1
  60. package/build/dataviews/actions/duplicate-pattern.js +48 -0
  61. package/build/dataviews/actions/duplicate-pattern.js.map +1 -0
  62. package/build/dataviews/actions/duplicate-post.js +146 -0
  63. package/build/dataviews/actions/duplicate-post.js.map +1 -0
  64. package/build/dataviews/actions/duplicate-post.native.js +9 -0
  65. package/build/dataviews/actions/duplicate-post.native.js.map +1 -0
  66. package/build/dataviews/actions/duplicate-template-part.js +67 -0
  67. package/build/dataviews/actions/duplicate-template-part.js.map +1 -0
  68. package/build/dataviews/actions/export-pattern.native.js +9 -0
  69. package/build/dataviews/actions/export-pattern.native.js.map +1 -0
  70. package/build/dataviews/actions/permanently-delete-post.js +107 -0
  71. package/build/dataviews/actions/permanently-delete-post.js.map +1 -0
  72. package/build/dataviews/actions/rename-post.js +125 -0
  73. package/build/dataviews/actions/rename-post.js.map +1 -0
  74. package/build/dataviews/actions/reorder-page.js +116 -0
  75. package/build/dataviews/actions/reorder-page.js.map +1 -0
  76. package/build/dataviews/actions/reorder-page.native.js +9 -0
  77. package/build/dataviews/actions/reorder-page.native.js.map +1 -0
  78. package/build/dataviews/actions/reset-post.js +1 -1
  79. package/build/dataviews/actions/reset-post.js.map +1 -1
  80. package/build/dataviews/actions/restore-post.js +112 -0
  81. package/build/dataviews/actions/restore-post.js.map +1 -0
  82. package/build/dataviews/actions/trash-post.js +142 -0
  83. package/build/dataviews/actions/trash-post.js.map +1 -0
  84. package/build/dataviews/actions/utils.js +9 -1
  85. package/build/dataviews/actions/utils.js.map +1 -1
  86. package/build/dataviews/actions/view-post-revisions.js +49 -0
  87. package/build/dataviews/actions/view-post-revisions.js.map +1 -0
  88. package/build/dataviews/actions/view-post.js +36 -0
  89. package/build/dataviews/actions/view-post.js.map +1 -0
  90. package/build/dataviews/fields/index.js +32 -0
  91. package/build/dataviews/fields/index.js.map +1 -0
  92. package/build/dataviews/store/private-actions.js +59 -0
  93. package/build/dataviews/store/private-actions.js.map +1 -1
  94. package/build/dataviews/store/private-selectors.js +10 -10
  95. package/build/dataviews/store/private-selectors.js.map +1 -1
  96. package/build/dataviews/store/reducer.js +15 -1
  97. package/build/dataviews/store/reducer.js.map +1 -1
  98. package/build/dataviews/types.js.map +1 -1
  99. package/build/private-apis.js +2 -2
  100. package/build/private-apis.js.map +1 -1
  101. package/build/store/actions.js +16 -2
  102. package/build/store/actions.js.map +1 -1
  103. package/build/store/private-actions.js +9 -2
  104. package/build/store/private-actions.js.map +1 -1
  105. package/build/store/private-selectors.js +33 -2
  106. package/build/store/private-selectors.js.map +1 -1
  107. package/build/store/utils/is-template-revertable.js +1 -1
  108. package/build/store/utils/is-template-revertable.js.map +1 -1
  109. package/build-module/bindings/post-meta.js +12 -0
  110. package/build-module/bindings/post-meta.js.map +1 -1
  111. package/build-module/components/blog-title/index.js +1 -1
  112. package/build-module/components/blog-title/index.js.map +1 -1
  113. package/build-module/components/commands/index.js +8 -2
  114. package/build-module/components/commands/index.js.map +1 -1
  115. package/build-module/components/create-template-part-modal/index.js +1 -0
  116. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  117. package/build-module/components/document-bar/index.js +1 -1
  118. package/build-module/components/document-bar/index.js.map +1 -1
  119. package/build-module/components/global-styles-provider/index.js +17 -4
  120. package/build-module/components/global-styles-provider/index.js.map +1 -1
  121. package/build-module/components/header/index.js +2 -3
  122. package/build-module/components/header/index.js.map +1 -1
  123. package/build-module/components/inserter-sidebar/index.js +5 -2
  124. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  125. package/build-module/components/page-attributes/parent.js +12 -7
  126. package/build-module/components/page-attributes/parent.js.map +1 -1
  127. package/build-module/components/post-actions/actions.js +12 -814
  128. package/build-module/components/post-actions/actions.js.map +1 -1
  129. package/build-module/components/post-actions/index.js +20 -19
  130. package/build-module/components/post-actions/index.js.map +1 -1
  131. package/build-module/components/post-author/hook.js +10 -3
  132. package/build-module/components/post-author/hook.js.map +1 -1
  133. package/build-module/components/post-author/panel.js +2 -1
  134. package/build-module/components/post-author/panel.js.map +1 -1
  135. package/build-module/components/post-card-panel/index.js +21 -21
  136. package/build-module/components/post-card-panel/index.js.map +1 -1
  137. package/build-module/components/post-comments/index.js +7 -23
  138. package/build-module/components/post-comments/index.js.map +1 -1
  139. package/build-module/components/post-featured-image/index.js +2 -0
  140. package/build-module/components/post-featured-image/index.js.map +1 -1
  141. package/build-module/components/post-publish-panel/postpublish.js +4 -0
  142. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  143. package/build-module/components/post-slug/index.js +1 -0
  144. package/build-module/components/post-slug/index.js.map +1 -1
  145. package/build-module/components/post-status/index.js +19 -43
  146. package/build-module/components/post-status/index.js.map +1 -1
  147. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  148. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  149. package/build-module/components/post-template/create-new-template-modal.js +3 -0
  150. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  151. package/build-module/components/post-url/index.js +7 -6
  152. package/build-module/components/post-url/index.js.map +1 -1
  153. package/build-module/components/post-url/panel.js +4 -5
  154. package/build-module/components/post-url/panel.js.map +1 -1
  155. package/build-module/components/preview-dropdown/index.js +84 -19
  156. package/build-module/components/preview-dropdown/index.js.map +1 -1
  157. package/build-module/components/provider/disable-non-page-content-blocks.js +15 -19
  158. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  159. package/build-module/components/sidebar/post-summary.js +10 -7
  160. package/build-module/components/sidebar/post-summary.js.map +1 -1
  161. package/build-module/components/site-discussion/index.js +7 -21
  162. package/build-module/components/site-discussion/index.js.map +1 -1
  163. package/build-module/components/template-content-panel/index.js +16 -14
  164. package/build-module/components/template-content-panel/index.js.map +1 -1
  165. package/build-module/components/visual-editor/index.js +2 -1
  166. package/build-module/components/visual-editor/index.js.map +1 -1
  167. package/build-module/dataviews/actions/duplicate-pattern.js +39 -0
  168. package/build-module/dataviews/actions/duplicate-pattern.js.map +1 -0
  169. package/build-module/dataviews/actions/duplicate-post.js +139 -0
  170. package/build-module/dataviews/actions/duplicate-post.js.map +1 -0
  171. package/build-module/dataviews/actions/duplicate-post.native.js +3 -0
  172. package/build-module/dataviews/actions/duplicate-post.native.js.map +1 -0
  173. package/build-module/dataviews/actions/duplicate-template-part.js +58 -0
  174. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -0
  175. package/build-module/dataviews/actions/export-pattern.native.js +3 -0
  176. package/build-module/dataviews/actions/export-pattern.native.js.map +1 -0
  177. package/build-module/dataviews/actions/permanently-delete-post.js +99 -0
  178. package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -0
  179. package/build-module/dataviews/actions/rename-post.js +118 -0
  180. package/build-module/dataviews/actions/rename-post.js.map +1 -0
  181. package/build-module/dataviews/actions/reorder-page.js +111 -0
  182. package/build-module/dataviews/actions/reorder-page.js.map +1 -0
  183. package/build-module/dataviews/actions/reorder-page.native.js +3 -0
  184. package/build-module/dataviews/actions/reorder-page.native.js.map +1 -0
  185. package/build-module/dataviews/actions/reset-post.js +1 -1
  186. package/build-module/dataviews/actions/reset-post.js.map +1 -1
  187. package/build-module/dataviews/actions/restore-post.js +104 -0
  188. package/build-module/dataviews/actions/restore-post.js.map +1 -0
  189. package/build-module/dataviews/actions/trash-post.js +135 -0
  190. package/build-module/dataviews/actions/trash-post.js.map +1 -0
  191. package/build-module/dataviews/actions/utils.js +7 -1
  192. package/build-module/dataviews/actions/utils.js.map +1 -1
  193. package/build-module/dataviews/actions/view-post-revisions.js +43 -0
  194. package/build-module/dataviews/actions/view-post-revisions.js.map +1 -0
  195. package/build-module/dataviews/actions/view-post.js +30 -0
  196. package/build-module/dataviews/actions/view-post.js.map +1 -0
  197. package/build-module/dataviews/fields/index.js +26 -0
  198. package/build-module/dataviews/fields/index.js.map +1 -0
  199. package/build-module/dataviews/store/private-actions.js +54 -0
  200. package/build-module/dataviews/store/private-actions.js.map +1 -1
  201. package/build-module/dataviews/store/private-selectors.js +8 -9
  202. package/build-module/dataviews/store/private-selectors.js.map +1 -1
  203. package/build-module/dataviews/store/reducer.js +15 -1
  204. package/build-module/dataviews/store/reducer.js.map +1 -1
  205. package/build-module/dataviews/types.js.map +1 -1
  206. package/build-module/private-apis.js +2 -2
  207. package/build-module/private-apis.js.map +1 -1
  208. package/build-module/store/actions.js +16 -2
  209. package/build-module/store/actions.js.map +1 -1
  210. package/build-module/store/private-actions.js +9 -2
  211. package/build-module/store/private-actions.js.map +1 -1
  212. package/build-module/store/private-selectors.js +32 -2
  213. package/build-module/store/private-selectors.js.map +1 -1
  214. package/build-module/store/utils/is-template-revertable.js +1 -1
  215. package/build-module/store/utils/is-template-revertable.js.map +1 -1
  216. package/build-style/style-rtl.css +21 -34
  217. package/build-style/style.css +21 -34
  218. package/build-types/bindings/post-meta.d.ts +6 -0
  219. package/build-types/bindings/post-meta.d.ts.map +1 -1
  220. package/build-types/components/commands/index.d.ts.map +1 -1
  221. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  222. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  223. package/build-types/components/header/index.d.ts.map +1 -1
  224. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  225. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  226. package/build-types/components/post-actions/actions.d.ts +1 -26
  227. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  228. package/build-types/components/post-actions/index.d.ts +3 -2
  229. package/build-types/components/post-actions/index.d.ts.map +1 -1
  230. package/build-types/components/post-author/hook.d.ts +1 -1
  231. package/build-types/components/post-author/hook.d.ts.map +1 -1
  232. package/build-types/components/post-author/panel.d.ts.map +1 -1
  233. package/build-types/components/post-card-panel/index.d.ts +4 -2
  234. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  235. package/build-types/components/post-comments/index.d.ts.map +1 -1
  236. package/build-types/components/post-slug/index.d.ts.map +1 -1
  237. package/build-types/components/post-status/index.d.ts +2 -1
  238. package/build-types/components/post-status/index.d.ts.map +1 -1
  239. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -17
  240. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  241. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  242. package/build-types/components/post-url/index.d.ts.map +1 -1
  243. package/build-types/components/post-url/panel.d.ts.map +1 -1
  244. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  245. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  246. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  247. package/build-types/components/site-discussion/index.d.ts.map +1 -1
  248. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  249. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  250. package/build-types/dataviews/actions/duplicate-pattern.d.ts +5 -0
  251. package/build-types/dataviews/actions/duplicate-pattern.d.ts.map +1 -0
  252. package/build-types/dataviews/actions/duplicate-post.d.ts +5 -0
  253. package/build-types/dataviews/actions/duplicate-post.d.ts.map +1 -0
  254. package/build-types/dataviews/actions/duplicate-post.native.d.ts +3 -0
  255. package/build-types/dataviews/actions/duplicate-post.native.d.ts.map +1 -0
  256. package/build-types/dataviews/actions/duplicate-template-part.d.ts +5 -0
  257. package/build-types/dataviews/actions/duplicate-template-part.d.ts.map +1 -0
  258. package/build-types/dataviews/actions/export-pattern.native.d.ts +3 -0
  259. package/build-types/dataviews/actions/export-pattern.native.d.ts.map +1 -0
  260. package/build-types/dataviews/actions/permanently-delete-post.d.ts +5 -0
  261. package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -0
  262. package/build-types/dataviews/actions/rename-post.d.ts +5 -0
  263. package/build-types/dataviews/actions/rename-post.d.ts.map +1 -0
  264. package/build-types/dataviews/actions/reorder-page.d.ts +8 -0
  265. package/build-types/dataviews/actions/reorder-page.d.ts.map +1 -0
  266. package/build-types/dataviews/actions/reorder-page.native.d.ts +3 -0
  267. package/build-types/dataviews/actions/reorder-page.native.d.ts.map +1 -0
  268. package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
  269. package/build-types/dataviews/actions/restore-post.d.ts +5 -0
  270. package/build-types/dataviews/actions/restore-post.d.ts.map +1 -0
  271. package/build-types/dataviews/actions/trash-post.d.ts +5 -0
  272. package/build-types/dataviews/actions/trash-post.d.ts.map +1 -0
  273. package/build-types/dataviews/actions/utils.d.ts +5 -3
  274. package/build-types/dataviews/actions/utils.d.ts.map +1 -1
  275. package/build-types/dataviews/actions/view-post-revisions.d.ts +8 -0
  276. package/build-types/dataviews/actions/view-post-revisions.d.ts.map +1 -0
  277. package/build-types/dataviews/actions/view-post.d.ts +8 -0
  278. package/build-types/dataviews/actions/view-post.d.ts.map +1 -0
  279. package/build-types/dataviews/fields/index.d.ts +8 -0
  280. package/build-types/dataviews/fields/index.d.ts.map +1 -0
  281. package/build-types/dataviews/store/private-actions.d.ts +8 -3
  282. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  283. package/build-types/dataviews/store/private-selectors.d.ts +2 -1
  284. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
  285. package/build-types/dataviews/store/reducer.d.ts +4 -1
  286. package/build-types/dataviews/store/reducer.d.ts.map +1 -1
  287. package/build-types/dataviews/types.d.ts +66 -8
  288. package/build-types/dataviews/types.d.ts.map +1 -1
  289. package/build-types/store/actions.d.ts.map +1 -1
  290. package/build-types/store/private-actions.d.ts.map +1 -1
  291. package/build-types/store/private-selectors.d.ts +11 -0
  292. package/build-types/store/private-selectors.d.ts.map +1 -1
  293. package/build-types/store/reducer.d.ts +1 -0
  294. package/build-types/store/reducer.d.ts.map +1 -1
  295. package/build-types/store/utils/is-template-revertable.d.ts.map +1 -1
  296. package/package.json +36 -36
  297. package/src/bindings/post-meta.js +20 -0
  298. package/src/components/block-manager/style.scss +2 -2
  299. package/src/components/blog-title/index.js +1 -1
  300. package/src/components/commands/index.js +4 -2
  301. package/src/components/create-template-part-modal/index.js +1 -0
  302. package/src/components/document-bar/index.js +1 -1
  303. package/src/components/document-bar/style.scss +1 -1
  304. package/src/components/editor-interface/style.scss +5 -0
  305. package/src/components/error-boundary/style.native.scss +1 -1
  306. package/src/components/error-boundary/style.scss +1 -1
  307. package/src/components/global-styles-provider/index.js +16 -3
  308. package/src/components/header/index.js +1 -2
  309. package/src/components/inserter-sidebar/index.js +10 -4
  310. package/src/components/list-view-sidebar/style.scss +4 -0
  311. package/src/components/page-attributes/parent.js +38 -16
  312. package/src/components/post-actions/actions.js +10 -1044
  313. package/src/components/post-actions/index.js +25 -17
  314. package/src/components/post-author/hook.js +11 -3
  315. package/src/components/post-author/panel.js +3 -1
  316. package/src/components/post-card-panel/index.js +29 -28
  317. package/src/components/post-comments/index.js +7 -20
  318. package/src/components/post-discussion/style.scss +0 -9
  319. package/src/components/post-featured-image/index.js +2 -0
  320. package/src/components/post-format/style.scss +0 -6
  321. package/src/components/post-publish-panel/postpublish.js +8 -2
  322. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +10 -10
  323. package/src/components/post-slug/index.js +1 -0
  324. package/src/components/post-status/index.js +11 -41
  325. package/src/components/post-status/style.scss +0 -19
  326. package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -1
  327. package/src/components/post-template/create-new-template-modal.js +7 -1
  328. package/src/components/post-url/index.js +15 -9
  329. package/src/components/post-url/panel.js +8 -2
  330. package/src/components/preview-dropdown/index.js +113 -35
  331. package/src/components/preview-dropdown/style.scss +5 -0
  332. package/src/components/provider/disable-non-page-content-blocks.js +27 -24
  333. package/src/components/save-publish-panels/style.scss +3 -3
  334. package/src/components/sidebar/post-summary.js +20 -16
  335. package/src/components/site-discussion/index.js +7 -19
  336. package/src/components/site-discussion/style.scss +0 -14
  337. package/src/components/template-content-panel/index.js +40 -22
  338. package/src/components/visual-editor/index.js +8 -6
  339. package/src/components/visual-editor/style.scss +1 -3
  340. package/src/dataviews/actions/duplicate-pattern.tsx +40 -0
  341. package/src/dataviews/actions/duplicate-post.native.tsx +3 -0
  342. package/src/dataviews/actions/duplicate-post.tsx +174 -0
  343. package/src/dataviews/actions/duplicate-template-part.tsx +70 -0
  344. package/src/dataviews/actions/export-pattern.native.tsx +3 -0
  345. package/src/dataviews/actions/permanently-delete-post.tsx +116 -0
  346. package/src/dataviews/actions/rename-post.tsx +146 -0
  347. package/src/dataviews/actions/reorder-page.native.tsx +3 -0
  348. package/src/dataviews/actions/reorder-page.tsx +125 -0
  349. package/src/dataviews/actions/reset-post.tsx +2 -1
  350. package/src/dataviews/actions/restore-post.tsx +134 -0
  351. package/src/dataviews/actions/trash-post.tsx +196 -0
  352. package/src/dataviews/actions/utils.ts +14 -4
  353. package/src/dataviews/actions/view-post-revisions.tsx +47 -0
  354. package/src/dataviews/actions/view-post.tsx +30 -0
  355. package/src/dataviews/fields/index.ts +26 -0
  356. package/src/dataviews/store/private-actions.ts +109 -0
  357. package/src/dataviews/store/private-selectors.ts +9 -17
  358. package/src/dataviews/store/reducer.ts +20 -1
  359. package/src/dataviews/types.ts +58 -6
  360. package/src/private-apis.js +2 -2
  361. package/src/store/actions.js +36 -13
  362. package/src/store/private-actions.js +9 -5
  363. package/src/store/private-selectors.js +45 -2
  364. package/src/store/test/private-selectors.js +78 -0
  365. package/src/store/utils/is-template-revertable.js +2 -1
  366. package/tsconfig.tsbuildinfo +1 -1
  367. package/build/dataviews/actions/index.js +0 -32
  368. package/build/dataviews/actions/index.js.map +0 -1
  369. package/build-module/dataviews/actions/index.js +0 -24
  370. package/build-module/dataviews/actions/index.js.map +0 -1
  371. package/build-types/dataviews/actions/index.d.ts +0 -2
  372. package/build-types/dataviews/actions/index.d.ts.map +0 -1
  373. package/src/components/document-outline/test/__snapshots__/index.js.snap +0 -111
  374. package/src/components/document-outline/test/index.js +0 -185
  375. package/src/dataviews/actions/index.ts +0 -25
@@ -7,27 +7,79 @@ type PostStatus =
7
7
  | 'auto-draft'
8
8
  | 'trash';
9
9
 
10
- export interface BasePost {
10
+ export interface CommonPost {
11
11
  status?: PostStatus;
12
12
  title: string | { rendered: string } | { raw: string };
13
+ content: string | { raw: string; rendered: string };
13
14
  type: string;
14
15
  id: string | number;
16
+ blocks?: Object[];
17
+ _links?: Links;
15
18
  }
16
- export interface TemplateOrTemplatePart extends BasePost {
17
- type: 'wp_template' | 'wp_template_part';
19
+
20
+ interface Links {
21
+ 'predecessor-version'?: { href: string; id: number }[];
22
+ 'version-history'?: { href: string; count: number }[];
23
+ [ key: string ]: { href: string }[] | undefined;
24
+ }
25
+
26
+ export interface BasePost extends CommonPost {
27
+ comment_status?: 'open' | 'closed';
28
+ excerpt?: string | { raw: string; rendered: string };
29
+ meta?: Record< string, any >;
30
+ parent?: number;
31
+ password?: string;
32
+ template?: string;
33
+ format?: string;
34
+ featured_media?: number;
35
+ menu_order?: number;
36
+ ping_status?: 'open' | 'closed';
37
+ link?: string;
38
+ }
39
+
40
+ export interface Template extends CommonPost {
41
+ type: 'wp_template';
42
+ is_custom: boolean;
43
+ source: string;
44
+ origin: string;
45
+ plugin?: string;
46
+ has_theme_file: boolean;
47
+ id: string;
48
+ }
49
+
50
+ export interface TemplatePart extends CommonPost {
51
+ type: 'wp_template_part';
18
52
  source: string;
53
+ origin: string;
19
54
  has_theme_file: boolean;
20
55
  id: string;
56
+ area: string;
21
57
  }
22
58
 
23
- export interface Pattern extends BasePost {
59
+ export interface Pattern extends CommonPost {
24
60
  slug: string;
25
61
  title: { raw: string };
26
- content: { raw: string } | string;
27
62
  wp_pattern_sync_status: string;
28
63
  }
29
64
 
30
- export type Post = TemplateOrTemplatePart | Pattern | BasePost;
65
+ export type Post = Template | TemplatePart | Pattern | BasePost;
66
+
67
+ export type PostWithPermissions = Post & {
68
+ permissions: {
69
+ delete: boolean;
70
+ update: boolean;
71
+ };
72
+ };
73
+
74
+ export interface PostType {
75
+ slug: string;
76
+ viewable: boolean;
77
+ supports?: {
78
+ 'page-attributes'?: boolean;
79
+ title?: boolean;
80
+ revisions?: boolean;
81
+ };
82
+ }
31
83
 
32
84
  // Will be unnecessary after typescript 5.0 upgrade.
33
85
  export type CoreDataError = { message?: string; code?: string };
@@ -14,6 +14,7 @@ import BackButton from './components/header/back-button';
14
14
  import CreateTemplatePartModal from './components/create-template-part-modal';
15
15
  import Editor from './components/editor';
16
16
  import PluginPostExcerpt from './components/post-excerpt/plugin';
17
+ import PostCardPanel from './components/post-card-panel';
17
18
  import PreferencesModal from './components/preferences-modal';
18
19
  import { usePostActions } from './components/post-actions/actions';
19
20
  import ToolsMoreMenuGroup from './components/more-menu/tools-more-menu-group';
@@ -23,7 +24,6 @@ import {
23
24
  mergeBaseAndUserConfigs,
24
25
  GlobalStylesProvider,
25
26
  } from './components/global-styles-provider';
26
- import registerDefaultActions from './dataviews/actions';
27
27
  import {
28
28
  registerCoreBlockBindingsSources,
29
29
  bootstrapBlockBindingsSourcesFromServer,
@@ -41,12 +41,12 @@ lock( privateApis, {
41
41
  GlobalStylesProvider,
42
42
  mergeBaseAndUserConfigs,
43
43
  PluginPostExcerpt,
44
+ PostCardPanel,
44
45
  PreferencesModal,
45
46
  usePostActions,
46
47
  ToolsMoreMenuGroup,
47
48
  ViewMoreMenuGroup,
48
49
  ResizableEditor,
49
- registerDefaultActions,
50
50
  registerCoreBlockBindingsSources,
51
51
  bootstrapBlockBindingsSourcesFromServer,
52
52
 
@@ -196,22 +196,45 @@ export const savePost =
196
196
  content,
197
197
  };
198
198
  dispatch( { type: 'REQUEST_POST_UPDATE_START', options } );
199
- await registry
200
- .dispatch( coreStore )
201
- .saveEntityRecord(
202
- 'postType',
203
- previousRecord.type,
204
- edits,
199
+
200
+ let error = false;
201
+ try {
202
+ error = await applyFilters(
203
+ 'editor.__unstablePreSavePost',
204
+ Promise.resolve( false ),
205
205
  options
206
206
  );
207
+ } catch ( err ) {
208
+ error = err;
209
+ }
207
210
 
208
- let error = registry
209
- .select( coreStore )
210
- .getLastEntitySaveError(
211
- 'postType',
212
- previousRecord.type,
213
- previousRecord.id
214
- );
211
+ if ( ! error ) {
212
+ try {
213
+ await registry
214
+ .dispatch( coreStore )
215
+ .saveEntityRecord(
216
+ 'postType',
217
+ previousRecord.type,
218
+ edits,
219
+ options
220
+ );
221
+ } catch ( err ) {
222
+ error =
223
+ err.message && err.code !== 'unknown_error'
224
+ ? err.message
225
+ : __( 'An error occurred while updating.' );
226
+ }
227
+ }
228
+
229
+ if ( ! error ) {
230
+ error = registry
231
+ .select( coreStore )
232
+ .getLastEntitySaveError(
233
+ 'postType',
234
+ previousRecord.type,
235
+ previousRecord.id
236
+ );
237
+ }
215
238
 
216
239
  if ( ! error ) {
217
240
  await applyFilters(
@@ -269,7 +269,7 @@ export const revertTemplate =
269
269
 
270
270
  const fileTemplatePath = addQueryArgs(
271
271
  `${ templateEntityConfig.baseURL }/${ template.id }`,
272
- { context: 'edit', source: 'theme' }
272
+ { context: 'edit', source: template.origin }
273
273
  );
274
274
 
275
275
  const fileTemplate = await apiFetch( { path: fileTemplatePath } );
@@ -393,10 +393,14 @@ export const removeTemplates =
393
393
  if ( items.length === 1 ) {
394
394
  // Depending on how the entity was retrieved its title might be
395
395
  // an object or simple string.
396
- const title =
397
- typeof items[ 0 ].title === 'string'
398
- ? items[ 0 ].title
399
- : items[ 0 ].title?.rendered;
396
+ let title;
397
+ if ( typeof items[ 0 ].title === 'string' ) {
398
+ title = items[ 0 ].title;
399
+ } else if ( typeof items[ 0 ].title?.rendered === 'string' ) {
400
+ title = items[ 0 ].title?.rendered;
401
+ } else if ( typeof items[ 0 ].title?.raw === 'string' ) {
402
+ title = items[ 0 ].title?.raw;
403
+ }
400
404
  successMessage = isResetting
401
405
  ? sprintf(
402
406
  /* translators: The template/part's name. */
@@ -25,7 +25,10 @@ import {
25
25
  getCurrentPost,
26
26
  __experimentalGetDefaultTemplatePartAreas,
27
27
  } from './selectors';
28
- import { getEntityActions as _getEntityActions } from '../dataviews/store/private-selectors';
28
+ import {
29
+ getEntityActions as _getEntityActions,
30
+ isEntityReady as _isEntityReady,
31
+ } from '../dataviews/store/private-selectors';
29
32
 
30
33
  const EMPTY_INSERTION_POINT = {
31
34
  rootClientId: undefined,
@@ -110,7 +113,10 @@ export const getPostIcon = createRegistrySelector(
110
113
  // `icon` is the `menu_icon` property of a post type. We
111
114
  // only handle `dashicons` for now, even if the `menu_icon`
112
115
  // also supports urls and svg as values.
113
- if ( postTypeEntity?.icon?.startsWith( 'dashicons-' ) ) {
116
+ if (
117
+ typeof postTypeEntity?.icon === 'string' &&
118
+ postTypeEntity.icon.startsWith( 'dashicons-' )
119
+ ) {
114
120
  return postTypeEntity.icon.slice( 10 );
115
121
  }
116
122
  return pageIcon;
@@ -160,3 +166,40 @@ export const hasPostMetaChanges = createRegistrySelector(
160
166
  export function getEntityActions( state, ...args ) {
161
167
  return _getEntityActions( state.dataviews, ...args );
162
168
  }
169
+
170
+ export function isEntityReady( state, ...args ) {
171
+ return _isEntityReady( state.dataviews, ...args );
172
+ }
173
+
174
+ /**
175
+ * Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most
176
+ * blocks that aren't descendants of the query block.
177
+ *
178
+ * @param {Object} state Global application state.
179
+ * @param {Array|string} blockNames Block names of the blocks to retrieve.
180
+ *
181
+ * @return {Array} Block client IDs.
182
+ */
183
+ export const getPostBlocksByName = createRegistrySelector( ( select ) =>
184
+ createSelector(
185
+ ( state, blockNames ) => {
186
+ blockNames = Array.isArray( blockNames )
187
+ ? blockNames
188
+ : [ blockNames ];
189
+ const { getBlocksByName, getBlockParents, getBlockName } =
190
+ select( blockEditorStore );
191
+ return getBlocksByName( blockNames ).filter( ( clientId ) =>
192
+ getBlockParents( clientId ).every( ( parentClientId ) => {
193
+ const parentBlockName = getBlockName( parentClientId );
194
+ return (
195
+ // Ignore descendents of the query block.
196
+ parentBlockName !== 'core/query' &&
197
+ // Enable only the top-most block.
198
+ ! blockNames.includes( parentBlockName )
199
+ );
200
+ } )
201
+ );
202
+ },
203
+ () => [ select( blockEditorStore ).getBlocks() ]
204
+ )
205
+ );
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { getPostBlocksByName } from '../private-selectors';
5
+
6
+ describe( 'getPostBlocksByName', () => {
7
+ const state = {
8
+ blocks: {
9
+ byClientId: new Map( [
10
+ [ 'block1', { name: 'core/paragraph' } ],
11
+ [ 'block2', { name: 'core/heading' } ],
12
+ [ 'block3', { name: 'core/paragraph' } ],
13
+ [ 'block4', { name: 'core/query' } ],
14
+ [ 'block5', { name: 'core/paragraph' } ],
15
+ [ 'block6', { name: 'core/heading' } ],
16
+ ] ),
17
+ order: new Map( [
18
+ [ '', [ 'block1', 'block2', 'block3', 'block4' ] ],
19
+ [ 'block4', [ 'block5', 'block6' ] ],
20
+ ] ),
21
+ parents: new Map( [
22
+ [ 'block1', '' ],
23
+ [ 'block2', '' ],
24
+ [ 'block3', '' ],
25
+ [ 'block4', '' ],
26
+ [ 'block5', 'block4' ],
27
+ [ 'block6', 'block4' ],
28
+ ] ),
29
+ },
30
+ };
31
+
32
+ getPostBlocksByName.registry = {
33
+ select: () => ( {
34
+ getBlocksByName: ( blockNames ) =>
35
+ Array.from( state.blocks.byClientId.keys() ).filter(
36
+ ( clientId ) =>
37
+ blockNames.includes(
38
+ state.blocks.byClientId.get( clientId ).name
39
+ )
40
+ ),
41
+ getBlockParents: ( clientId ) => {
42
+ const parents = [];
43
+ let parent = state.blocks.parents.get( clientId );
44
+ while ( parent ) {
45
+ parents.push( parent );
46
+ parent = state.blocks.parents.get( parent );
47
+ }
48
+ return parents;
49
+ },
50
+ getBlockName: ( clientId ) =>
51
+ state.blocks.byClientId.get( clientId ).name,
52
+ getBlocks: () => [],
53
+ } ),
54
+ };
55
+
56
+ it( 'should return top-level blocks of the specified name', () => {
57
+ const result = getPostBlocksByName( state, 'core/paragraph' );
58
+ expect( result ).toEqual( [ 'block1', 'block3' ] );
59
+ } );
60
+
61
+ it( 'should return an empty array if no blocks match', () => {
62
+ const result = getPostBlocksByName( state, 'core/non-existent' );
63
+ expect( result ).toEqual( [] );
64
+ } );
65
+
66
+ it( 'should ignore blocks inside a query block', () => {
67
+ const result = getPostBlocksByName( state, 'core/paragraph' );
68
+ expect( result ).toEqual( [ 'block1', 'block3' ] );
69
+ } );
70
+
71
+ it( 'should handle multiple block names', () => {
72
+ const result = getPostBlocksByName( state, [
73
+ 'core/paragraph',
74
+ 'core/heading',
75
+ ] );
76
+ expect( result ).toEqual( [ 'block1', 'block2', 'block3' ] );
77
+ } );
78
+ } );
@@ -18,6 +18,7 @@ export default function isTemplateRevertable( templateOrTemplatePart ) {
18
18
 
19
19
  return (
20
20
  templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom &&
21
- templateOrTemplatePart.has_theme_file
21
+ ( Boolean( templateOrTemplatePart?.plugin ) ||
22
+ templateOrTemplatePart?.has_theme_file )
22
23
  );
23
24
  }