@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
@@ -93,6 +93,7 @@ function CreateNewTemplateModal({
93
93
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
94
94
  spacing: "3",
95
95
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
96
+ __next40pxDefaultSize: true,
96
97
  __nextHasNoMarginBottom: true,
97
98
  label: (0, _i18n.__)('Name'),
98
99
  value: title,
@@ -103,10 +104,12 @@ function CreateNewTemplateModal({
103
104
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
104
105
  justify: "right",
105
106
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
107
+ __next40pxDefaultSize: true,
106
108
  variant: "tertiary",
107
109
  onClick: cancel,
108
110
  children: (0, _i18n.__)('Cancel')
109
111
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
112
+ __next40pxDefaultSize: true,
110
113
  variant: "primary",
111
114
  type: "submit",
112
115
  isBusy: isBusy,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","_jsxRuntime","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","getTemplateId","createTemplate","unlock","useDispatch","title","setTitle","useState","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","serialize","createBlock","tagName","layout","inherit","newTemplate","slug","cleanForSlug","content","postId","id","postType","jsx","Modal","onRequestClose","focusOnMount","size","children","className","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ cancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,I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AAqB,QAAA,eAEnB,IAAA3C,WAAA,CAAA8C,IAAA,EAACnD,WAAA,CAAAoD,oBAAM;QAACC,OAAO,EAAC,GAAG;QAAAL,QAAA,gBAClB,IAAA3C,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAsD,WAAW;UACXC,uBAAuB;UACvBC,KAAK,EAAG,IAAAjD,QAAE,EAAE,MAAO,CAAG;UACtBkD,KAAK,EAAGpC,KAAO;UACfqC,QAAQ,EAAGpC,QAAU;UACrBqC,WAAW,EAAGrD,aAAe;UAC7BsD,QAAQ,EAAGpC,MAAQ;UACnBqC,IAAI,EAAG,IAAAtD,QAAE,EACR,iHACD;QAAG,CACH,CAAC,eACF,IAAAF,WAAA,CAAA8C,IAAA,EAACnD,WAAA,CAAA8D,oBAAM;UAACC,OAAO,EAAC,OAAO;UAAAf,QAAA,gBACtB,IAAA3C,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAgE,MAAM;YAACC,OAAO,EAAC,UAAU;YAACC,OAAO,EAAGxC,MAAQ;YAAAsB,QAAA,EAC1C,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eAET,IAAAF,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAgE,MAAM;YACNC,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACb3C,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAwB,QAAA,EAEtB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","_jsxRuntime","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","getTemplateId","createTemplate","unlock","useDispatch","title","setTitle","useState","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","serialize","createBlock","tagName","layout","inherit","newTemplate","slug","cleanForSlug","content","postId","id","postType","jsx","Modal","onRequestClose","focusOnMount","size","children","className","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAA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B,QAAA,eAEnB,IAAA3C,WAAA,CAAA8C,IAAA,EAACnD,WAAA,CAAAoD,oBAAM;QAACC,OAAO,EAAC,GAAG;QAAAL,QAAA,gBAClB,IAAA3C,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAsD,WAAW;UACXC,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG,IAAAlD,QAAE,EAAE,MAAO,CAAG;UACtBmD,KAAK,EAAGrC,KAAO;UACfsC,QAAQ,EAAGrC,QAAU;UACrBsC,WAAW,EAAGtD,aAAe;UAC7BuD,QAAQ,EAAGrC,MAAQ;UACnBsC,IAAI,EAAG,IAAAvD,QAAE,EACR,iHACD;QAAG,CACH,CAAC,eACF,IAAAF,WAAA,CAAA8C,IAAA,EAACnD,WAAA,CAAA+D,oBAAM;UAACC,OAAO,EAAC,OAAO;UAAAhB,QAAA,gBACtB,IAAA3C,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGzC,MAAQ;YAAAsB,QAAA,EAEhB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eAET,IAAAF,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACb5C,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAwB,QAAA,EAEtB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -82,11 +82,12 @@ var _jsxRuntime = require("react/jsx-runtime");
82
82
  onClose: onClose
83
83
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
84
84
  spacing: 3,
85
- children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
86
- children: [(0, _i18n.__)('Customize the last part of the URL. '), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
87
- href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'),
88
- children: (0, _i18n.__)('Learn more.')
89
- })]
85
+ children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
86
+ children: (0, _element.createInterpolateElement)((0, _i18n.__)('Customize the last part of the URL. <a>Learn more.</a>'), {
87
+ a: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
88
+ href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink')
89
+ })
90
+ })
90
91
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
91
92
  children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
92
93
  __next40pxDefaultSize: true,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_notices","_icons","_coreData","_compose","_store","_jsxRuntime","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","useDispatch","createNotice","noticesStore","forceEmptyField","setForceEmptyField","useState","copyButtonRef","useCopyToClipboard","__","isDismissible","type","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","ExternalLink","href","__experimentalInputControl","__next40pxDefaultSize","__experimentalInputControlPrefixWrapper","Button","icon","copySmall","ref","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","cleanForSlug","target","help"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ __( 'Customize the last part of the URL. ' ) }\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more.' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\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\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLink }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAOA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAvBnD;AACA;AACA;;AAkBA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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C1C;YAAe,CACZ,CAAC,eACP,IAAAN,WAAA,CAAAiD,GAAA;cAAMF,SAAS,EAAC,4BAA4B;cAAAC,QAAA,EACzC5C;YAAQ,CACL,CAAC,eACP,IAAAJ,WAAA,CAAAiD,GAAA;cAAMF,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3CzC;YAAe,CACZ,CAAC;UAAA,CACM;QACd,CACD,CACD,EACC,CAAEJ,UAAU,iBACb,IAAAH,WAAA,CAAAiD,GAAA,EAACvD,WAAA,CAAA4D,YAAY;UACZP,SAAS,EAAC,uBAAuB;UACjCQ,IAAI,EAAGlD,QAAU;UACjBqE,MAAM,EAAC,QAAQ;UAAA1B,QAAA,EAEb3C;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_notices","_icons","_coreData","_compose","_store","_jsxRuntime","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","useDispatch","createNotice","noticesStore","forceEmptyField","setForceEmptyField","useState","copyButtonRef","useCopyToClipboard","__","isDismissible","type","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","createInterpolateElement","a","ExternalLink","href","__experimentalInputControl","__next40pxDefaultSize","__experimentalInputControlPrefixWrapper","Button","icon","copySmall","ref","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","cleanForSlug","target","help"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Customize the last part of the URL. <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t/>\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</div>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\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\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLink }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAOA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW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C,QAAQ;YAAA5B,QAAA,gBAEf,IAAAhD,WAAA,CAAAiD,GAAA;cAAMF,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3C1C;YAAe,CACZ,CAAC,eACP,IAAAN,WAAA,CAAAiD,GAAA;cAAMF,SAAS,EAAC,4BAA4B;cAAAC,QAAA,EACzC5C;YAAQ,CACL,CAAC,eACP,IAAAJ,WAAA,CAAAiD,GAAA;cAAMF,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3CzC;YAAe,CACZ,CAAC;UAAA,CACM;QACd,CACD,CACD,EACC,CAAEJ,UAAU,iBACb,IAAAH,WAAA,CAAAiD,GAAA,EAACvD,WAAA,CAAA8D,YAAY;UACZT,SAAS,EAAC,uBAAuB;UACjCU,IAAI,EAAGpD,QAAU;UACjBuE,MAAM,EAAC,QAAQ;UAAA5B,QAAA,EAEb3C;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
@@ -104,8 +104,9 @@ function PostURLToggle({
104
104
  ,
105
105
  "aria-label": (0, _i18n.sprintf)((0, _i18n.__)('Change link: %s'), decodedSlug),
106
106
  onClick: onClick,
107
- children: isFrontPage ? postLink : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
108
- children: ["/", decodedSlug]
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalTruncate, {
108
+ numberOfLines: 1,
109
+ children: isFrontPage ? postLink : `/${decodedSlug}`
109
110
  })
110
111
  });
111
112
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_components","_i18n","_url","_coreData","_check","_interopRequireDefault","_index","_postPanelRow","_store","_jsxRuntime","PostURLPanel","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","jsx","default","children","label","__","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","useSelect","select","getCurrentPostId","getCurrentPost","editorStore","getEditedEntityRecord","canUser","coreStore","siteSettings","kind","name","undefined","_id","getEditedPostSlug","page_on_front","link","decodedSlug","safeDecodeURIComponent","Button","size","variant","sprintf","jsxs","Fragment"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'Link' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug, isFrontPage, postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPost } = select( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change link: %s' ), decodedSlug ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ isFrontPage ? postLink : <>/{ decodedSlug }</> }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,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AAA,EAAArD,WAAA,CAAAsD,QAAA;MAAAzC,QAAA,GAAE,GAAC,EAAEkC,WAAW;IAAA,CAAI;EAAC,CACzC,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_components","_i18n","_url","_coreData","_check","_interopRequireDefault","_index","_postPanelRow","_store","_jsxRuntime","PostURLPanel","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","offset","shift","jsx","default","children","label","__","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","slug","isFrontPage","postLink","useSelect","select","getCurrentPostId","getCurrentPost","editorStore","getEditedEntityRecord","canUser","coreStore","siteSettings","kind","name","undefined","_id","getEditedPostSlug","page_on_front","link","decodedSlug","safeDecodeURIComponent","Button","size","variant","sprintf","__experimentalTruncate","numberOfLines"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURLPanel` component.\n *\n * @return {JSX.Element} The rendered PostURLPanel component.\n */\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'Link' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst { slug, isFrontPage, postLink } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPost } = select( editorStore );\n\t\tconst { getEditedEntityRecord, canUser } = select( coreStore );\n\t\tconst siteSettings = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _id = getCurrentPostId();\n\t\treturn {\n\t\t\tslug: select( editorStore ).getEditedPostSlug(),\n\t\t\tisFrontPage: siteSettings?.page_on_front === _id,\n\t\t\tpostLink: getCurrentPost()?.link,\n\t\t};\n\t}, [] );\n\tconst decodedSlug = safeDecodeURIComponent( slug );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change link: %s' ), decodedSlug ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t{ isFrontPage ? postLink : `/${ decodedSlug }` }\n\t\t\t</Truncate>\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,aAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AApBnD;AACA;AACA;;AAYA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,GACe,SAASY,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC5D;EACA,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,OAAQ;IACP;IACA;IACAC,MAAM,EAAEL,aAAa;IACrBM,SAAS,EAAE,YAAY;IACvBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE;EACR,CAAC,CAAE,EACH,CAAER,aAAa,CAChB,CAAC;EAED,oBACC,IAAAF,WAAA,CAAAW,GAAA,EAAChB,MAAA,CAAAiB,OAAY;IAAAC,QAAA,eACZ,IAAAb,WAAA,CAAAW,GAAA,EAACb,aAAA,CAAAc,OAAY;MAACE,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;MAACC,GAAG,EAAGb,gBAAkB;MAAAU,QAAA,eAC5D,IAAAb,WAAA,C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C;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAMC,WAAW,GAAG,IAAAC,2BAAsB,EAAEpB,IAAK,CAAC;EAClD,oBACC,IAAA5B,WAAA,CAAAW,GAAA,EAACpB,WAAA,CAAA0D,MAAM;IACNC,IAAI,EAAC,SAAS;IACdhC,SAAS,EAAC,+BAA+B;IACzCiC,OAAO,EAAC,UAAU;IAClB,iBAAgB7B;IAChB;IAAA;IACA,cAAa,IAAA8B,aAAO,EAAE,IAAArC,QAAE,EAAE,iBAAkB,CAAC,EAAEgC,WAAY,CAAG;IAC9DtB,OAAO,EAAGA,OAAS;IAAAZ,QAAA,eAEnB,IAAAb,WAAA,CAAAW,GAAA,EAACpB,WAAA,CAAA8D,sBAAQ;MAACC,aAAa,EAAG,CAAG;MAAAzC,QAAA,EAC1BgB,WAAW,GAAGC,QAAQ,GAAI,IAAIiB,WAAa;IAAC,CACrC;EAAC,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -5,16 +5,23 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = PreviewDropdown;
8
+ var _clsx = _interopRequireDefault(require("clsx"));
8
9
  var _compose = require("@wordpress/compose");
9
10
  var _components = require("@wordpress/components");
10
11
  var _i18n = require("@wordpress/i18n");
11
12
  var _icons = require("@wordpress/icons");
12
13
  var _data = require("@wordpress/data");
13
14
  var _coreData = require("@wordpress/core-data");
15
+ var _element = require("@wordpress/element");
14
16
  var _preferences = require("@wordpress/preferences");
17
+ var _blockEditor = require("@wordpress/block-editor");
15
18
  var _store = require("../../store");
16
19
  var _postPreviewButton = _interopRequireDefault(require("../post-preview-button"));
17
20
  var _jsxRuntime = require("react/jsx-runtime");
21
+ /**
22
+ * External dependencies
23
+ */
24
+
18
25
  /**
19
26
  * WordPress dependencies
20
27
  */
@@ -29,6 +36,7 @@ function PreviewDropdown({
29
36
  }) {
30
37
  const {
31
38
  deviceType,
39
+ editorMode,
32
40
  homeUrl,
33
41
  isTemplate,
34
42
  isViewable,
@@ -46,9 +54,13 @@ function PreviewDropdown({
46
54
  const {
47
55
  get
48
56
  } = select(_preferences.store);
57
+ const {
58
+ __unstableGetEditorMode
59
+ } = select(_blockEditor.store);
49
60
  const _currentPostType = getCurrentPostType();
50
61
  return {
51
62
  deviceType: getDeviceType(),
63
+ editorMode: __unstableGetEditorMode(),
52
64
  homeUrl: getUnstableBase()?.home,
53
65
  isTemplate: _currentPostType === 'wp_template',
54
66
  isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
@@ -58,6 +70,24 @@ function PreviewDropdown({
58
70
  const {
59
71
  setDeviceType
60
72
  } = (0, _data.useDispatch)(_store.store);
73
+ const {
74
+ __unstableSetEditorMode
75
+ } = (0, _data.useDispatch)(_blockEditor.store);
76
+
77
+ /**
78
+ * Save the original editing mode in a ref to restore it when we exit zoom out.
79
+ */
80
+ const originalEditingMode = (0, _element.useRef)(editorMode);
81
+ (0, _element.useEffect)(() => {
82
+ if (editorMode !== 'zoom-out') {
83
+ originalEditingMode.current = editorMode;
84
+ }
85
+ return () => {
86
+ if (editorMode === 'zoom-out' && editorMode !== originalEditingMode.current) {
87
+ __unstableSetEditorMode(originalEditingMode.current);
88
+ }
89
+ };
90
+ }, [editorMode, __unstableSetEditorMode]);
61
91
  const isMobile = (0, _compose.useViewportMatch)('medium', '<');
62
92
  if (isMobile) {
63
93
  return null;
@@ -67,6 +97,7 @@ function PreviewDropdown({
67
97
  };
68
98
  const toggleProps = {
69
99
  className: 'editor-preview-dropdown__toggle',
100
+ iconPosition: 'right',
70
101
  size: 'compact',
71
102
  showTooltip: !showIconLabels,
72
103
  disabled,
@@ -76,35 +107,68 @@ function PreviewDropdown({
76
107
  'aria-label': (0, _i18n.__)('View options')
77
108
  };
78
109
  const deviceIcons = {
110
+ desktop: _icons.desktop,
79
111
  mobile: _icons.mobile,
80
- tablet: _icons.tablet,
81
- desktop: _icons.desktop
112
+ tablet: _icons.tablet
113
+ };
114
+
115
+ /**
116
+ * The choices for the device type.
117
+ *
118
+ * @type {Array}
119
+ */
120
+ const choices = [{
121
+ value: 'Desktop',
122
+ label: (0, _i18n.__)('Desktop'),
123
+ icon: _icons.desktop
124
+ }, {
125
+ value: 'ZoomOut',
126
+ label: (0, _i18n.__)('Desktop (50%)'),
127
+ icon: _icons.desktop
128
+ }, {
129
+ value: 'Tablet',
130
+ label: (0, _i18n.__)('Tablet'),
131
+ icon: _icons.tablet
132
+ }, {
133
+ value: 'Mobile',
134
+ label: (0, _i18n.__)('Mobile'),
135
+ icon: _icons.mobile
136
+ }];
137
+ const previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;
138
+
139
+ /**
140
+ * Handles the selection of a device type.
141
+ *
142
+ * @param {string} value The device type.
143
+ */
144
+ const onSelect = value => {
145
+ let newEditorMode = originalEditingMode.current;
146
+ if (value === 'ZoomOut') {
147
+ newEditorMode = 'zoom-out';
148
+ setDeviceType('Desktop');
149
+ } else {
150
+ setDeviceType(value);
151
+ }
152
+ __unstableSetEditorMode(newEditorMode);
82
153
  };
83
154
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
84
- className: "editor-preview-dropdown",
155
+ className: (0, _clsx.default)('editor-preview-dropdown', `editor-preview-dropdown--${deviceType.toLowerCase()}`),
85
156
  popoverProps: popoverProps,
86
157
  toggleProps: toggleProps,
87
158
  menuProps: menuProps,
88
159
  icon: deviceIcons[deviceType.toLowerCase()],
160
+ text: editorMode === 'zoom-out' ? (0, _i18n.__)('50%') : undefined,
89
161
  label: (0, _i18n.__)('View'),
90
162
  disableOpenOnArrowDown: disabled,
91
163
  children: ({
92
164
  onClose
93
165
  }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
94
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.MenuGroup, {
95
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
96
- onClick: () => setDeviceType('Desktop'),
97
- icon: deviceType === 'Desktop' && _icons.check,
98
- children: (0, _i18n.__)('Desktop')
99
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
100
- onClick: () => setDeviceType('Tablet'),
101
- icon: deviceType === 'Tablet' && _icons.check,
102
- children: (0, _i18n.__)('Tablet')
103
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
104
- onClick: () => setDeviceType('Mobile'),
105
- icon: deviceType === 'Mobile' && _icons.check,
106
- children: (0, _i18n.__)('Mobile')
107
- })]
166
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuGroup, {
167
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItemsChoice, {
168
+ choices: choices,
169
+ value: previewValue,
170
+ onSelect: onSelect
171
+ })
108
172
  }), isTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuGroup, {
109
173
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.MenuItem, {
110
174
  href: homeUrl,
@@ -122,6 +186,7 @@ function PreviewDropdown({
122
186
  className: "editor-preview-dropdown__button-external",
123
187
  role: "menuitem",
124
188
  forceIsAutosaveable: forceIsAutosaveable,
189
+ "aria-label": (0, _i18n.__)('Preview in new tab'),
125
190
  textContent: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
126
191
  children: [(0, _i18n.__)('Preview in new tab'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
127
192
  icon: _icons.external
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_components","_i18n","_icons","_data","_coreData","_preferences","_store","_postPreviewButton","_interopRequireDefault","_jsxRuntime","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","editorStore","getUnstableBase","getPostType","coreStore","get","preferencesStore","_currentPostType","home","viewable","setDeviceType","useDispatch","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","size","showTooltip","accessibleWhenDisabled","menuProps","__","deviceIcons","mobile","tablet","desktop","jsx","DropdownMenu","icon","toLowerCase","label","disableOpenOnArrowDown","children","onClose","jsxs","Fragment","MenuGroup","MenuItem","onClick","check","href","target","external","VisuallyHidden","as","default","role","textContent","Icon","onPreview"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check, desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\t\tconst { getUnstableBase, getPostType } = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst _currentPostType = getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tdeviceType: getDeviceType(),\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tmobile,\n\t\ttablet,\n\t\tdesktop,\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"editor-preview-dropdown\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Desktop' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Desktop' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Desktop' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Tablet' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Tablet' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Tablet' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => setDeviceType( 'Mobile' ) }\n\t\t\t\t\t\t\ticon={ deviceType === 'Mobile' && check }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Mobile' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,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,CAAAgD,IAAA,EAAAhD,WAAA,CAAAiD,QAAA;YAAAH,QAAA,GACG,IAAAX,QAAE,EAAE,oBAAqB,CAAC,eAC5B,IAAAnC,WAAA,CAAAwC,GAAA,EAACjD,WAAA,CAAAuE,IAAI;cAACpB,IAAI,EAAGc;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACDO,SAAS,EAAGhB;QAAS,CACrB;MAAC,CACQ,CACX;IAAA,CACA;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_compose","_components","_i18n","_icons","_data","_coreData","_element","_preferences","_blockEditor","_store","_postPreviewButton","_jsxRuntime","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","editorMode","homeUrl","isTemplate","isViewable","showIconLabels","useSelect","select","_getPostType$viewable","getDeviceType","getCurrentPostType","editorStore","getUnstableBase","getPostType","coreStore","get","preferencesStore","__unstableGetEditorMode","blockEditorStore","_currentPostType","home","viewable","setDeviceType","useDispatch","__unstableSetEditorMode","originalEditingMode","useRef","useEffect","current","isMobile","useViewportMatch","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","__","deviceIcons","desktop","mobile","tablet","choices","value","label","icon","previewValue","onSelect","newEditorMode","jsx","DropdownMenu","clsx","toLowerCase","text","undefined","disableOpenOnArrowDown","children","onClose","jsxs","Fragment","MenuGroup","MenuItemsChoice","MenuItem","href","target","external","onClick","VisuallyHidden","as","default","role","textContent","Icon","onPreview"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\teditorMode,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\tconst { getUnstableBase, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Save the original editing mode in a ref to restore it when we exit zoom out.\n\t */\n\tconst originalEditingMode = useRef( editorMode );\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'zoom-out' ) {\n\t\t\toriginalEditingMode.current = editorMode;\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\teditorMode === 'zoom-out' &&\n\t\t\t\teditorMode !== originalEditingMode.current\n\t\t\t) {\n\t\t\t\t__unstableSetEditorMode( originalEditingMode.current );\n\t\t\t}\n\t\t};\n\t}, [ editorMode, __unstableSetEditorMode ] );\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'ZoomOut',\n\t\t\tlabel: __( 'Desktop (50%)' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\tconst previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;\n\n\t/**\n\t * Handles the selection of a device type.\n\t *\n\t * @param {string} value The device type.\n\t */\n\tconst onSelect = ( value ) => {\n\t\tlet newEditorMode = originalEditingMode.current;\n\n\t\tif ( value === 'ZoomOut' ) {\n\t\t\tnewEditorMode = 'zoom-out';\n\t\t\tsetDeviceType( 'Desktop' );\n\t\t} else {\n\t\t\tsetDeviceType( value );\n\t\t}\n\n\t\t__unstableSetEditorMode( newEditorMode );\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\ttext={ editorMode === 'zoom-out' ? __( '50%' ) : undefined }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAAuD,IAAAY,WAAA,GAAAZ,OAAA;AA7BvD;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAIe,SAASa,eAAeA,CAAE;EAAEC,mBAAmB;EAAEC;AAAS,CAAC,EAAG;EAC5E,MAAM;IACLC,UAAU;IACVC,UAAU;IACVC,OAAO;IACPC,UAAU;IACVC,UAAU;IACVC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC5B,MAAM;MAAEC,aAAa;MAAEC;IAAmB,CAAC,GAAGH,MAAM,CAAEI,YAAY,CAAC;IACnE,MAAM;MAAEC,eAAe;MAA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,EAAGhE,OAAS;UAChBiE,MAAM,EAAC,QAAQ;UACfnB,IAAI,EAAGoB,eAAU;UACjBC,OAAO,EAAGT,OAAS;UAAAD,QAAA,GAEjB,IAAAnB,QAAE,EAAE,WAAY,CAAC,eACnB,IAAA5C,WAAA,CAAAwD,GAAA,EAAClE,WAAA,CAAAoF,cAAc;YAACC,EAAE,EAAC,MAAM;YAAAZ,QAAA,EAEvB;YACA,IAAAnB,QAAE,EAAE,sBAAuB;UAAC,CAEd,CAAC;QAAA,CACR;MAAC,CACD,CACX,EACCpC,UAAU,iBACX,IAAAR,WAAA,CAAAwD,GAAA,EAAClE,WAAA,CAAA6E,SAAS;QAAAJ,QAAA,eACT,IAAA/D,WAAA,CAAAwD,GAAA,EAACzD,kBAAA,CAAA6E,OAAiB;UACjBtC,SAAS,EAAC,0CAA0C;UACpDuC,IAAI,EAAC,UAAU;UACf3E,mBAAmB,EAAGA,mBAAqB;UAC3C,cAAa,IAAA0C,QAAE,EAAE,oBAAqB,CAAG;UACzCkC,WAAW,eACV,IAAA9E,WAAA,CAAAiE,IAAA,EAAAjE,WAAA,CAAAkE,QAAA;YAAAH,QAAA,GACG,IAAAnB,QAAE,EAAE,oBAAqB,CAAC,eAC5B,IAAA5C,WAAA,CAAAwD,GAAA,EAAClE,WAAA,CAAAyF,IAAI;cAAC3B,IAAI,EAAGoB;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACDQ,SAAS,EAAGhB;QAAS,CACrB;MAAC,CACQ,CACX;IAAA,CACA;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -8,43 +8,39 @@ var _data = require("@wordpress/data");
8
8
  var _blockEditor = require("@wordpress/block-editor");
9
9
  var _element = require("@wordpress/element");
10
10
  var _hooks = require("@wordpress/hooks");
11
+ var _store = require("../../store");
12
+ var _lockUnlock = require("../../lock-unlock");
11
13
  /**
12
14
  * WordPress dependencies
13
15
  */
14
16
 
15
- const DEFAULT_CONTENT_ONLY_BLOCKS = ['core/post-title', 'core/post-featured-image', 'core/post-content', 'core/template-part'];
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+
21
+ const POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content'];
16
22
 
17
23
  /**
18
24
  * Component that when rendered, makes it so that the site editor allows only
19
25
  * page content to be edited.
20
26
  */
21
27
  function DisableNonPageContentBlocks() {
22
- const contentOnlyBlocks = (0, _hooks.applyFilters)('editor.postContentBlockTypes', DEFAULT_CONTENT_ONLY_BLOCKS);
28
+ const contentOnlyBlockTypes = (0, _element.useMemo)(() => [...(0, _hooks.applyFilters)('editor.postContentBlockTypes', POST_CONTENT_BLOCK_TYPES), 'core/template-part'], []);
23
29
 
24
- // Note that there are two separate subscription because the result for each
30
+ // Note that there are two separate subscriptions because the result for each
25
31
  // returns a new array.
26
32
  const contentOnlyIds = (0, _data.useSelect)(select => {
27
33
  const {
28
- getBlocksByName,
29
- getBlockParents,
30
- getBlockName
31
- } = select(_blockEditor.store);
32
- return getBlocksByName(contentOnlyBlocks).filter(clientId => getBlockParents(clientId).every(parentClientId => {
33
- const parentBlockName = getBlockName(parentClientId);
34
- return (
35
- // Ignore descendents of the query block.
36
- parentBlockName !== 'core/query' &&
37
- // Enable only the top-most block.
38
- !contentOnlyBlocks.includes(parentBlockName)
39
- );
40
- }));
41
- }, []);
34
+ getPostBlocksByName
35
+ } = (0, _lockUnlock.unlock)(select(_store.store));
36
+ return getPostBlocksByName(contentOnlyBlockTypes);
37
+ }, [contentOnlyBlockTypes]);
42
38
  const disabledIds = (0, _data.useSelect)(select => {
43
39
  const {
44
40
  getBlocksByName,
45
41
  getBlockOrder
46
42
  } = select(_blockEditor.store);
47
- return getBlocksByName(['core/template-part']).flatMap(clientId => getBlockOrder(clientId));
43
+ return getBlocksByName('core/template-part').flatMap(clientId => getBlockOrder(clientId));
48
44
  }, []);
49
45
  const registry = (0, _data.useRegistry)();
50
46
  (0, _element.useEffect)(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_element","_hooks","DEFAULT_CONTENT_ONLY_BLOCKS","DisableNonPageContentBlocks","contentOnlyBlocks","applyFilters","contentOnlyIds","useSelect","select","getBlocksByName","getBlockParents","getBlockName","blockEditorStore","filter","clientId","every","parentClientId","parentBlockName","includes","disabledIds","getBlockOrder","flatMap","registry","useRegistry","useEffect","setBlockEditingMode","unsetBlockEditingMode","dispatch","batch"],"sources":["@wordpress/editor/src/components/provider/disable-non-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\nconst DEFAULT_CONTENT_ONLY_BLOCKS = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n\t'core/template-part',\n];\n\n/**\n * Component that when rendered, makes it so that the site editor allows only\n * page content to be edited.\n */\nexport default function DisableNonPageContentBlocks() {\n\tconst contentOnlyBlocks = applyFilters(\n\t\t'editor.postContentBlockTypes',\n\t\tDEFAULT_CONTENT_ONLY_BLOCKS\n\t);\n\n\t// Note that there are two separate subscription because the result for each\n\t// returns a new array.\n\tconst contentOnlyIds = useSelect( ( select ) => {\n\t\tconst { getBlocksByName, getBlockParents, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\treturn getBlocksByName( contentOnlyBlocks ).filter( ( clientId ) =>\n\t\t\tgetBlockParents( clientId ).every( ( parentClientId ) => {\n\t\t\t\tconst parentBlockName = getBlockName( parentClientId );\n\t\t\t\treturn (\n\t\t\t\t\t// Ignore descendents of the query block.\n\t\t\t\t\tparentBlockName !== 'core/query' &&\n\t\t\t\t\t// Enable only the top-most block.\n\t\t\t\t\t! contentOnlyBlocks.includes( parentBlockName )\n\t\t\t\t);\n\t\t\t} )\n\t\t);\n\t}, [] );\n\tconst disabledIds = useSelect( ( select ) => {\n\t\tconst { getBlocksByName, getBlockOrder } = select( blockEditorStore );\n\t\treturn getBlocksByName( [ 'core/template-part' ] ).flatMap(\n\t\t\t( clientId ) => getBlockOrder( clientId )\n\t\t);\n\t}, [] );\n\n\tconst registry = useRegistry();\n\n\tuseEffect( () => {\n\t\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( '', 'disabled' );\n\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'contentOnly' );\n\t\t\t}\n\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'disabled' );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tunsetBlockEditingMode( '' );\n\t\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t} );\n\t\t};\n\t}, [ contentOnlyIds, disabledIds, registry ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,MAAMI,2BAA2B,GAAG,CACnC,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,CACpB;;AAED;AACA;AACA;AACA;AACe,SAASC,2BAA2BA,CAAA,EAAG;EACrD,MAAMC,iBAAiB,GAAG,IAAAC,mBAAY,EACrC,8BAA8B,EAC9BH,2BACD,CAAC;;EAED;EACA;EACA,MAAMI,cAAc,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC/C,MAAM;MAAEC,eAAe;MAAEC,eAAe;MA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CAAE,EAAG,CAAC;QAC3B,KAAM,MAAMZ,QAAQ,IAAIR,cAAc,EAAG;UACxCoB,qBAAqB,CAAEZ,QAAS,CAAC;QAClC;QACA,KAAM,MAAMA,QAAQ,IAAIK,WAAW,EAAG;UACrCO,qBAAqB,CAAEZ,QAAS,CAAC;QAClC;MACD,CAAE,CAAC;IACJ,CAAC;EACF,CAAC,EAAE,CAAER,cAAc,EAAEa,WAAW,EAAEG,QAAQ,CAAG,CAAC;EAE9C,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blockEditor","_element","_hooks","_store","_lockUnlock","POST_CONTENT_BLOCK_TYPES","DisableNonPageContentBlocks","contentOnlyBlockTypes","useMemo","applyFilters","contentOnlyIds","useSelect","select","getPostBlocksByName","unlock","editorStore","disabledIds","getBlocksByName","getBlockOrder","blockEditorStore","flatMap","clientId","registry","useRegistry","useEffect","setBlockEditingMode","unsetBlockEditingMode","dispatch","batch"],"sources":["@wordpress/editor/src/components/provider/disable-non-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POST_CONTENT_BLOCK_TYPES = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n];\n\n/**\n * Component that when rendered, makes it so that the site editor allows only\n * page content to be edited.\n */\nexport default function DisableNonPageContentBlocks() {\n\tconst contentOnlyBlockTypes = useMemo(\n\t\t() => [\n\t\t\t...applyFilters(\n\t\t\t\t'editor.postContentBlockTypes',\n\t\t\t\tPOST_CONTENT_BLOCK_TYPES\n\t\t\t),\n\t\t\t'core/template-part',\n\t\t],\n\t\t[]\n\t);\n\n\t// Note that there are two separate subscriptions because the result for each\n\t// returns a new array.\n\tconst contentOnlyIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostBlocksByName } = unlock( select( editorStore ) );\n\t\t\treturn getPostBlocksByName( contentOnlyBlockTypes );\n\t\t},\n\t\t[ contentOnlyBlockTypes ]\n\t);\n\tconst disabledIds = useSelect( ( select ) => {\n\t\tconst { getBlocksByName, getBlockOrder } = select( blockEditorStore );\n\t\treturn getBlocksByName( 'core/template-part' ).flatMap( ( clientId ) =>\n\t\t\tgetBlockOrder( clientId )\n\t\t);\n\t}, [] );\n\n\tconst registry = useRegistry();\n\n\tuseEffect( () => {\n\t\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( '', 'disabled' );\n\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'contentOnly' );\n\t\t\t}\n\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'disabled' );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tunsetBlockEditingMode( '' );\n\t\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t} );\n\t\t};\n\t}, [ contentOnlyIds, disabledIds, registry ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIA,MAAMM,wBAAwB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,UAAW,CAAC;MAC5C;IACD,CAAE,CAAC;IAEH,OAAO,MAAM;MACZC,QAAQ,CAACM,KAAK,CAAE,MAAM;QACrBF,qBAAqB,CAAE,EAAG,CAAC;QAC3B,KAAM,MAAML,QAAQ,IAAIX,cAAc,EAAG;UACxCgB,qBAAqB,CAAEL,QAAS,CAAC;QAClC;QACA,KAAM,MAAMA,QAAQ,IAAIL,WAAW,EAAG;UACrCU,qBAAqB,CAAEL,QAAS,CAAC;QAClC;MACD,CAAE,CAAC;IACJ,CAAC;EACF,CAAC,EAAE,CAAEX,cAAc,EAAEM,WAAW,EAAEM,QAAQ,CAAG,CAAC;EAE9C,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -8,7 +8,6 @@ exports.default = PostSummary;
8
8
  var _components = require("@wordpress/components");
9
9
  var _data = require("@wordpress/data");
10
10
  var _pluginPostStatusInfo = _interopRequireDefault(require("../plugin-post-status-info"));
11
- var _postActions = _interopRequireDefault(require("../post-actions"));
12
11
  var _panel = _interopRequireDefault(require("../post-author/panel"));
13
12
  var _postCardPanel = _interopRequireDefault(require("../post-card-panel"));
14
13
  var _postContentInformation = _interopRequireDefault(require("../post-content-information"));
@@ -45,17 +44,21 @@ function PostSummary({
45
44
  onActionPerformed
46
45
  }) {
47
46
  const {
48
- isRemovedPostStatusPanel
47
+ isRemovedPostStatusPanel,
48
+ postType,
49
+ postId
49
50
  } = (0, _data.useSelect)(select => {
50
51
  // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
51
52
  // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
52
53
  const {
53
54
  isEditorPanelRemoved,
54
- getCurrentPostType
55
+ getCurrentPostType,
56
+ getCurrentPostId
55
57
  } = select(_store.store);
56
58
  return {
57
59
  isRemovedPostStatusPanel: isEditorPanelRemoved(PANEL_NAME),
58
- postType: getCurrentPostType()
60
+ postType: getCurrentPostType(),
61
+ postId: getCurrentPostId()
59
62
  };
60
63
  }, []);
61
64
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPanelSection.default, {
@@ -65,9 +68,9 @@ function PostSummary({
65
68
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
66
69
  spacing: 4,
67
70
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_postCardPanel.default, {
68
- actions: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postActions.default, {
69
- onActionPerformed: onActionPerformed
70
- })
71
+ postType: postType,
72
+ postId: postId,
73
+ onActionPerformed: onActionPerformed
71
74
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel5.default, {
72
75
  withPanelBody: false
73
76
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel4.PrivatePostExcerptPanel, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {