@wordpress/edit-post 7.15.0 → 7.17.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 (442) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +6 -1
  3. package/build/components/block-manager/category.js +1 -14
  4. package/build/components/block-manager/category.js.map +1 -1
  5. package/build/components/block-manager/checklist.js +1 -5
  6. package/build/components/block-manager/checklist.js.map +1 -1
  7. package/build/components/block-manager/index.js +11 -23
  8. package/build/components/block-manager/index.js.map +1 -1
  9. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +3 -11
  10. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  11. package/build/components/browser-url/index.js +6 -23
  12. package/build/components/browser-url/index.js.map +1 -1
  13. package/build/components/device-preview/index.js +1 -11
  14. package/build/components/device-preview/index.js.map +1 -1
  15. package/build/components/editor-initialization/index.js +0 -2
  16. package/build/components/editor-initialization/index.js.map +1 -1
  17. package/build/components/editor-initialization/listener-hooks.js +1 -12
  18. package/build/components/editor-initialization/listener-hooks.js.map +1 -1
  19. package/build/components/header/{document-title → document-actions}/index.js +11 -28
  20. package/build/components/header/document-actions/index.js.map +1 -0
  21. package/build/components/header/fullscreen-mode-close/index.js +3 -22
  22. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  23. package/build/components/header/header-toolbar/index.js +5 -22
  24. package/build/components/header/header-toolbar/index.js.map +1 -1
  25. package/build/components/header/header-toolbar/index.native.js +4 -25
  26. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  27. package/build/components/header/index.js +6 -23
  28. package/build/components/header/index.js.map +1 -1
  29. package/build/components/header/index.native.js +1 -13
  30. package/build/components/header/index.native.js.map +1 -1
  31. package/build/components/header/main-dashboard-button/index.js +1 -7
  32. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  33. package/build/components/header/mode-switcher/index.js +23 -19
  34. package/build/components/header/mode-switcher/index.js.map +1 -1
  35. package/build/components/header/more-menu/index.js +1 -12
  36. package/build/components/header/more-menu/index.js.map +1 -1
  37. package/build/components/header/plugin-more-menu-item/index.js +0 -8
  38. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  39. package/build/components/header/plugin-sidebar-more-menu-item/index.js +3 -4
  40. package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
  41. package/build/components/header/post-publish-button-or-toggle.js +2 -11
  42. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  43. package/build/components/header/preferences-menu-item/index.js +1 -7
  44. package/build/components/header/preferences-menu-item/index.js.map +1 -1
  45. package/build/components/header/tools-more-menu-group/index.js +1 -6
  46. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  47. package/build/components/header/writing-menu/index.js +1 -15
  48. package/build/components/header/writing-menu/index.js.map +1 -1
  49. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  50. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  51. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
  52. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  53. package/build/components/keyboard-shortcut-help-modal/index.js +4 -25
  54. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  55. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
  56. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  57. package/build/components/keyboard-shortcuts/index.js +4 -23
  58. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  59. package/build/components/layout/actions-panel.js +7 -17
  60. package/build/components/layout/actions-panel.js.map +1 -1
  61. package/build/components/layout/index.js +50 -52
  62. package/build/components/layout/index.js.map +1 -1
  63. package/build/components/layout/index.native.js +5 -34
  64. package/build/components/layout/index.native.js.map +1 -1
  65. package/build/components/meta-boxes/index.js +4 -12
  66. package/build/components/meta-boxes/index.js.map +1 -1
  67. package/build/components/meta-boxes/meta-box-visibility.js +1 -12
  68. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  69. package/build/components/meta-boxes/meta-boxes-area/index.js +0 -10
  70. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  71. package/build/components/preferences-modal/index.js +1 -18
  72. package/build/components/preferences-modal/index.js.map +1 -1
  73. package/build/components/preferences-modal/meta-boxes-section.js +3 -13
  74. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  75. package/build/components/preferences-modal/options/enable-custom-fields.js +10 -11
  76. package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  77. package/build/components/preferences-modal/options/enable-feature.js +0 -7
  78. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  79. package/build/components/preferences-modal/options/enable-panel.js +0 -7
  80. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  81. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -6
  82. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  83. package/build/components/preferences-modal/options/enable-publish-sidebar.js +2 -8
  84. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  85. package/build/components/preferences-modal/options/index.js +0 -6
  86. package/build/components/preferences-modal/options/index.js.map +1 -1
  87. package/build/components/secondary-sidebar/inserter-sidebar.js +1 -9
  88. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  89. package/build/components/secondary-sidebar/list-view-outline.js +1 -8
  90. package/build/components/secondary-sidebar/list-view-outline.js.map +1 -1
  91. package/build/components/secondary-sidebar/list-view-sidebar.js +34 -46
  92. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  93. package/build/components/sidebar/discussion-panel/index.js +19 -30
  94. package/build/components/sidebar/discussion-panel/index.js.map +1 -1
  95. package/build/components/sidebar/featured-image/index.js +0 -15
  96. package/build/components/sidebar/featured-image/index.js.map +1 -1
  97. package/build/components/sidebar/last-revision/index.js +1 -5
  98. package/build/components/sidebar/last-revision/index.js.map +1 -1
  99. package/build/components/sidebar/page-attributes/index.js +0 -14
  100. package/build/components/sidebar/page-attributes/index.js.map +1 -1
  101. package/build/components/sidebar/plugin-document-setting-panel/index.js +44 -61
  102. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  103. package/build/components/sidebar/plugin-post-publish-panel/index.js +19 -25
  104. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  105. package/build/components/sidebar/plugin-post-status-info/index.js +2 -5
  106. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  107. package/build/components/sidebar/plugin-pre-publish-panel/index.js +19 -25
  108. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  109. package/build/components/sidebar/plugin-sidebar/index.js +0 -8
  110. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  111. package/build/components/sidebar/post-author/index.js +1 -5
  112. package/build/components/sidebar/post-author/index.js.map +1 -1
  113. package/build/components/sidebar/post-excerpt/index.js +0 -13
  114. package/build/components/sidebar/post-excerpt/index.js.map +1 -1
  115. package/build/components/sidebar/post-format/index.js +1 -5
  116. package/build/components/sidebar/post-format/index.js.map +1 -1
  117. package/build/components/sidebar/post-pending-status/index.js +1 -5
  118. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  119. package/build/components/sidebar/post-schedule/index.js +5 -9
  120. package/build/components/sidebar/post-schedule/index.js.map +1 -1
  121. package/build/components/sidebar/post-slug/index.js +1 -5
  122. package/build/components/sidebar/post-slug/index.js.map +1 -1
  123. package/build/components/sidebar/post-status/index.js +0 -24
  124. package/build/components/sidebar/post-status/index.js.map +1 -1
  125. package/build/components/sidebar/post-sticky/index.js +1 -5
  126. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  127. package/build/components/sidebar/post-taxonomies/index.js +1 -6
  128. package/build/components/sidebar/post-taxonomies/index.js.map +1 -1
  129. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +1 -11
  130. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  131. package/build/components/sidebar/post-template/create-modal.js +1 -16
  132. package/build/components/sidebar/post-template/create-modal.js.map +1 -1
  133. package/build/components/sidebar/post-template/form.js +3 -16
  134. package/build/components/sidebar/post-template/form.js.map +1 -1
  135. package/build/components/sidebar/post-template/index.js +5 -24
  136. package/build/components/sidebar/post-template/index.js.map +1 -1
  137. package/build/components/sidebar/post-trash/index.js +1 -3
  138. package/build/components/sidebar/post-trash/index.js.map +1 -1
  139. package/build/components/sidebar/post-url/index.js +5 -9
  140. package/build/components/sidebar/post-url/index.js.map +1 -1
  141. package/build/components/sidebar/post-visibility/index.js +5 -10
  142. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  143. package/build/components/sidebar/settings-header/index.js +12 -17
  144. package/build/components/sidebar/settings-header/index.js.map +1 -1
  145. package/build/components/sidebar/settings-sidebar/index.js +2 -29
  146. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  147. package/build/components/sidebar/template-summary/index.js +1 -9
  148. package/build/components/sidebar/template-summary/index.js.map +1 -1
  149. package/build/components/start-page-options/index.js +1 -15
  150. package/build/components/start-page-options/index.js.map +1 -1
  151. package/build/components/text-editor/index.js +1 -8
  152. package/build/components/text-editor/index.js.map +1 -1
  153. package/build/components/view-link/index.js +3 -10
  154. package/build/components/view-link/index.js.map +1 -1
  155. package/build/components/visual-editor/block-inspector-button.js +1 -11
  156. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  157. package/build/components/visual-editor/header.native.js +1 -12
  158. package/build/components/visual-editor/header.native.js.map +1 -1
  159. package/build/components/visual-editor/index.js +33 -53
  160. package/build/components/visual-editor/index.js.map +1 -1
  161. package/build/components/visual-editor/index.native.js +1 -9
  162. package/build/components/visual-editor/index.native.js.map +1 -1
  163. package/build/components/welcome-guide/default.js +1 -8
  164. package/build/components/welcome-guide/default.js.map +1 -1
  165. package/build/components/welcome-guide/image.js +0 -2
  166. package/build/components/welcome-guide/image.js.map +1 -1
  167. package/build/components/welcome-guide/index.js +1 -11
  168. package/build/components/welcome-guide/index.js.map +1 -1
  169. package/build/components/welcome-guide/template.js +1 -8
  170. package/build/components/welcome-guide/template.js.map +1 -1
  171. package/build/editor.js +9 -68
  172. package/build/editor.js.map +1 -1
  173. package/build/editor.native.js +10 -35
  174. package/build/editor.native.js.map +1 -1
  175. package/build/hooks/commands/use-common-commands.js +65 -22
  176. package/build/hooks/commands/use-common-commands.js.map +1 -1
  177. package/build/hooks/components/index.js +1 -3
  178. package/build/hooks/components/index.js.map +1 -1
  179. package/build/hooks/index.js +0 -1
  180. package/build/hooks/index.js.map +1 -1
  181. package/build/hooks/validate-multiple-use/index.js +10 -18
  182. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  183. package/build/index.js +16 -48
  184. package/build/index.js.map +1 -1
  185. package/build/index.native.js +0 -9
  186. package/build/index.native.js.map +1 -1
  187. package/build/lock-unlock.js +1 -2
  188. package/build/lock-unlock.js.map +1 -1
  189. package/build/plugins/copy-content-menu-item/index.js +1 -10
  190. package/build/plugins/copy-content-menu-item/index.js.map +1 -1
  191. package/build/plugins/index.js +5 -22
  192. package/build/plugins/index.js.map +1 -1
  193. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -10
  194. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  195. package/build/plugins/welcome-guide-menu-item/index.js +1 -6
  196. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  197. package/build/store/actions.js +53 -120
  198. package/build/store/actions.js.map +1 -1
  199. package/build/store/constants.js +2 -3
  200. package/build/store/constants.js.map +1 -1
  201. package/build/store/index.js +0 -9
  202. package/build/store/index.js.map +1 -1
  203. package/build/store/reducer.js +9 -42
  204. package/build/store/reducer.js.map +1 -1
  205. package/build/store/selectors.js +63 -91
  206. package/build/store/selectors.js.map +1 -1
  207. package/build/utils/meta-boxes.js +0 -4
  208. package/build/utils/meta-boxes.js.map +1 -1
  209. package/build-module/components/block-manager/category.js +1 -8
  210. package/build-module/components/block-manager/category.js.map +1 -1
  211. package/build-module/components/block-manager/checklist.js +0 -3
  212. package/build-module/components/block-manager/checklist.js.map +1 -1
  213. package/build-module/components/block-manager/index.js +11 -14
  214. package/build-module/components/block-manager/index.js.map +1 -1
  215. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +2 -8
  216. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  217. package/build-module/components/browser-url/index.js +7 -14
  218. package/build-module/components/browser-url/index.js.map +1 -1
  219. package/build-module/components/device-preview/index.js +1 -3
  220. package/build-module/components/device-preview/index.js.map +1 -1
  221. package/build-module/components/editor-initialization/index.js +1 -1
  222. package/build-module/components/editor-initialization/index.js.map +1 -1
  223. package/build-module/components/editor-initialization/listener-hooks.js +3 -5
  224. package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
  225. package/build-module/components/header/{document-title → document-actions}/index.js +11 -21
  226. package/build-module/components/header/document-actions/index.js.map +1 -0
  227. package/build-module/components/header/fullscreen-mode-close/index.js +4 -13
  228. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  229. package/build-module/components/header/header-toolbar/index.js +5 -13
  230. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  231. package/build-module/components/header/header-toolbar/index.native.js +5 -12
  232. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  233. package/build-module/components/header/index.js +6 -8
  234. package/build-module/components/header/index.js.map +1 -1
  235. package/build-module/components/header/index.native.js +2 -9
  236. package/build-module/components/header/index.native.js.map +1 -1
  237. package/build-module/components/header/main-dashboard-button/index.js +0 -5
  238. package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
  239. package/build-module/components/header/mode-switcher/index.js +25 -14
  240. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  241. package/build-module/components/header/more-menu/index.js +1 -4
  242. package/build-module/components/header/more-menu/index.js.map +1 -1
  243. package/build-module/components/header/plugin-more-menu-item/index.js +1 -2
  244. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  245. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +3 -2
  246. package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
  247. package/build-module/components/header/post-publish-button-or-toggle.js +2 -5
  248. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  249. package/build-module/components/header/preferences-menu-item/index.js +1 -2
  250. package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
  251. package/build-module/components/header/tools-more-menu-group/index.js +0 -3
  252. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  253. package/build-module/components/header/writing-menu/index.js +1 -8
  254. package/build-module/components/header/writing-menu/index.js.map +1 -1
  255. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  256. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
  257. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  258. package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
  259. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  260. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
  261. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  262. package/build-module/components/keyboard-shortcuts/index.js +4 -14
  263. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  264. package/build-module/components/layout/actions-panel.js +6 -8
  265. package/build-module/components/layout/actions-panel.js.map +1 -1
  266. package/build-module/components/layout/index.js +53 -28
  267. package/build-module/components/layout/index.js.map +1 -1
  268. package/build-module/components/layout/index.native.js +6 -20
  269. package/build-module/components/layout/index.native.js.map +1 -1
  270. package/build-module/components/meta-boxes/index.js +4 -6
  271. package/build-module/components/meta-boxes/index.js.map +1 -1
  272. package/build-module/components/meta-boxes/meta-box-visibility.js +1 -9
  273. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  274. package/build-module/components/meta-boxes/meta-boxes-area/index.js +3 -7
  275. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  276. package/build-module/components/preferences-modal/index.js +2 -5
  277. package/build-module/components/preferences-modal/index.js.map +1 -1
  278. package/build-module/components/preferences-modal/meta-boxes-section.js +3 -5
  279. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  280. package/build-module/components/preferences-modal/options/enable-custom-fields.js +9 -2
  281. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
  282. package/build-module/components/preferences-modal/options/enable-feature.js +1 -1
  283. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  284. package/build-module/components/preferences-modal/options/enable-panel.js +1 -1
  285. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  286. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +1 -4
  287. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +1 -1
  288. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js +2 -1
  289. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +1 -1
  290. package/build-module/components/preferences-modal/options/index.js.map +1 -1
  291. package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
  292. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  293. package/build-module/components/secondary-sidebar/list-view-outline.js +0 -3
  294. package/build-module/components/secondary-sidebar/list-view-outline.js.map +1 -1
  295. package/build-module/components/secondary-sidebar/list-view-sidebar.js +35 -33
  296. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  297. package/build-module/components/sidebar/discussion-panel/index.js +22 -25
  298. package/build-module/components/sidebar/discussion-panel/index.js.map +1 -1
  299. package/build-module/components/sidebar/featured-image/index.js +2 -7
  300. package/build-module/components/sidebar/featured-image/index.js.map +1 -1
  301. package/build-module/components/sidebar/last-revision/index.js +0 -3
  302. package/build-module/components/sidebar/last-revision/index.js.map +1 -1
  303. package/build-module/components/sidebar/page-attributes/index.js +2 -7
  304. package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
  305. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +46 -55
  306. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  307. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +19 -22
  308. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  309. package/build-module/components/sidebar/plugin-post-status-info/index.js +1 -3
  310. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  311. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +19 -22
  312. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  313. package/build-module/components/sidebar/plugin-sidebar/index.js +2 -3
  314. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  315. package/build-module/components/sidebar/post-author/index.js +0 -1
  316. package/build-module/components/sidebar/post-author/index.js.map +1 -1
  317. package/build-module/components/sidebar/post-excerpt/index.js +2 -7
  318. package/build-module/components/sidebar/post-excerpt/index.js.map +1 -1
  319. package/build-module/components/sidebar/post-format/index.js +0 -1
  320. package/build-module/components/sidebar/post-format/index.js.map +1 -1
  321. package/build-module/components/sidebar/post-pending-status/index.js +0 -1
  322. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  323. package/build-module/components/sidebar/post-schedule/index.js +4 -5
  324. package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
  325. package/build-module/components/sidebar/post-slug/index.js +0 -1
  326. package/build-module/components/sidebar/post-slug/index.js.map +1 -1
  327. package/build-module/components/sidebar/post-status/index.js +2 -6
  328. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  329. package/build-module/components/sidebar/post-sticky/index.js +0 -1
  330. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  331. package/build-module/components/sidebar/post-taxonomies/index.js +1 -4
  332. package/build-module/components/sidebar/post-taxonomies/index.js.map +1 -1
  333. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +1 -7
  334. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +1 -1
  335. package/build-module/components/sidebar/post-template/create-modal.js +1 -10
  336. package/build-module/components/sidebar/post-template/create-modal.js.map +1 -1
  337. package/build-module/components/sidebar/post-template/form.js +3 -6
  338. package/build-module/components/sidebar/post-template/form.js.map +1 -1
  339. package/build-module/components/sidebar/post-template/index.js +5 -16
  340. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  341. package/build-module/components/sidebar/post-trash/index.js +0 -1
  342. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  343. package/build-module/components/sidebar/post-url/index.js +4 -5
  344. package/build-module/components/sidebar/post-url/index.js.map +1 -1
  345. package/build-module/components/sidebar/post-visibility/index.js +4 -6
  346. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  347. package/build-module/components/sidebar/settings-header/index.js +12 -13
  348. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  349. package/build-module/components/sidebar/settings-sidebar/index.js +2 -9
  350. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  351. package/build-module/components/sidebar/template-summary/index.js +1 -6
  352. package/build-module/components/sidebar/template-summary/index.js.map +1 -1
  353. package/build-module/components/start-page-options/index.js +1 -8
  354. package/build-module/components/start-page-options/index.js.map +1 -1
  355. package/build-module/components/text-editor/index.js +1 -2
  356. package/build-module/components/text-editor/index.js.map +1 -1
  357. package/build-module/components/view-link/index.js +2 -3
  358. package/build-module/components/view-link/index.js.map +1 -1
  359. package/build-module/components/visual-editor/block-inspector-button.js +1 -5
  360. package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
  361. package/build-module/components/visual-editor/header.native.js +1 -4
  362. package/build-module/components/visual-editor/header.native.js.map +1 -1
  363. package/build-module/components/visual-editor/index.js +34 -43
  364. package/build-module/components/visual-editor/index.js.map +1 -1
  365. package/build-module/components/visual-editor/index.native.js +1 -5
  366. package/build-module/components/visual-editor/index.native.js.map +1 -1
  367. package/build-module/components/welcome-guide/default.js +1 -2
  368. package/build-module/components/welcome-guide/default.js.map +1 -1
  369. package/build-module/components/welcome-guide/image.js.map +1 -1
  370. package/build-module/components/welcome-guide/index.js +1 -6
  371. package/build-module/components/welcome-guide/index.js.map +1 -1
  372. package/build-module/components/welcome-guide/template.js +1 -2
  373. package/build-module/components/welcome-guide/template.js.map +1 -1
  374. package/build-module/editor.js +9 -52
  375. package/build-module/editor.js.map +1 -1
  376. package/build-module/editor.native.js +11 -23
  377. package/build-module/editor.native.js.map +1 -1
  378. package/build-module/hooks/commands/use-common-commands.js +66 -14
  379. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  380. package/build-module/hooks/components/index.js +0 -2
  381. package/build-module/hooks/components/index.js.map +1 -1
  382. package/build-module/hooks/index.js.map +1 -1
  383. package/build-module/hooks/validate-multiple-use/index.js +9 -11
  384. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  385. package/build-module/index.js +18 -26
  386. package/build-module/index.js.map +1 -1
  387. package/build-module/index.native.js +2 -3
  388. package/build-module/index.native.js.map +1 -1
  389. package/build-module/lock-unlock.js.map +1 -1
  390. package/build-module/plugins/copy-content-menu-item/index.js +0 -3
  391. package/build-module/plugins/copy-content-menu-item/index.js.map +1 -1
  392. package/build-module/plugins/index.js +5 -11
  393. package/build-module/plugins/index.js.map +1 -1
  394. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -2
  395. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  396. package/build-module/plugins/welcome-guide-menu-item/index.js +1 -2
  397. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  398. package/build-module/store/actions.js +55 -66
  399. package/build-module/store/actions.js.map +1 -1
  400. package/build-module/store/constants.js +2 -2
  401. package/build-module/store/constants.js.map +1 -1
  402. package/build-module/store/index.js +2 -2
  403. package/build-module/store/index.js.map +1 -1
  404. package/build-module/store/reducer.js +10 -33
  405. package/build-module/store/reducer.js.map +1 -1
  406. package/build-module/store/selectors.js +63 -64
  407. package/build-module/store/selectors.js.map +1 -1
  408. package/build-module/utils/meta-boxes.js +0 -2
  409. package/build-module/utils/meta-boxes.js.map +1 -1
  410. package/build-style/style-rtl.css +40 -27
  411. package/build-style/style.css +40 -27
  412. package/package.json +32 -32
  413. package/src/components/header/{document-title → document-actions}/index.js +22 -23
  414. package/src/components/header/{document-title → document-actions}/style.scss +25 -22
  415. package/src/components/header/header-toolbar/index.native.js +1 -0
  416. package/src/components/header/header-toolbar/style.scss +4 -0
  417. package/src/components/header/index.js +3 -3
  418. package/src/components/header/mode-switcher/index.js +23 -4
  419. package/src/components/header/style.scss +1 -1
  420. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +29 -0
  421. package/src/components/keyboard-shortcuts/index.js +2 -2
  422. package/src/components/layout/index.js +64 -3
  423. package/src/components/preferences-modal/options/enable-custom-fields.js +15 -4
  424. package/src/components/preferences-modal/options/test/enable-custom-fields.js +6 -1
  425. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +5 -2
  426. package/src/components/preferences-modal/test/index.js +4 -4
  427. package/src/components/secondary-sidebar/list-view-sidebar.js +3 -3
  428. package/src/components/sidebar/discussion-panel/index.js +15 -20
  429. package/src/components/sidebar/plugin-document-setting-panel/index.js +54 -65
  430. package/src/components/sidebar/plugin-post-publish-panel/index.js +23 -27
  431. package/src/components/sidebar/plugin-pre-publish-panel/index.js +25 -28
  432. package/src/components/sidebar/post-schedule/style.scss +2 -0
  433. package/src/components/visual-editor/index.js +9 -8
  434. package/src/components/visual-editor/style.scss +5 -1
  435. package/src/editor.js +2 -47
  436. package/src/hooks/commands/use-common-commands.js +84 -22
  437. package/src/index.js +5 -1
  438. package/src/store/selectors.js +10 -3
  439. package/src/style.scss +1 -1
  440. package/src/test/editor.native.js +4 -3
  441. package/build/components/header/document-title/index.js.map +0 -1
  442. package/build-module/components/header/document-title/index.js.map +0 -1
@@ -1,17 +1,15 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { compose } from '@wordpress/compose';
7
6
  import { PanelBody } from '@wordpress/components';
8
7
  import { withSelect, withDispatch } from '@wordpress/data';
8
+
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
-
13
12
  import { store as editPostStore } from '../../../store';
14
-
15
13
  function TaxonomyPanel({
16
14
  isEnabled,
17
15
  taxonomy,
@@ -22,20 +20,16 @@ function TaxonomyPanel({
22
20
  if (!isEnabled) {
23
21
  return null;
24
22
  }
25
-
26
23
  const taxonomyMenuName = taxonomy?.labels?.menu_name;
27
-
28
24
  if (!taxonomyMenuName) {
29
25
  return null;
30
26
  }
31
-
32
27
  return createElement(PanelBody, {
33
28
  title: taxonomyMenuName,
34
29
  opened: isOpened,
35
30
  onToggle: onTogglePanel
36
31
  }, children);
37
32
  }
38
-
39
33
  export default compose(withSelect((select, ownProps) => {
40
34
  const slug = ownProps.taxonomy?.slug;
41
35
  const panelName = slug ? `taxonomy-panel-${slug}` : '';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-taxonomies/taxonomy-panel.js"],"names":["compose","PanelBody","withSelect","withDispatch","store","editPostStore","TaxonomyPanel","isEnabled","taxonomy","isOpened","onTogglePanel","children","taxonomyMenuName","labels","menu_name","select","ownProps","slug","panelName","isEditorPanelEnabled","isEditorPanelOpened","dispatch","toggleEditorPanelOpened"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,uBAA1B;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,iBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,aAAT,CAAwB;AACvBC,EAAAA,SADuB;AAEvBC,EAAAA,QAFuB;AAGvBC,EAAAA,QAHuB;AAIvBC,EAAAA,aAJuB;AAKvBC,EAAAA;AALuB,CAAxB,EAMI;AACH,MAAK,CAAEJ,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMK,gBAAgB,GAAGJ,QAAQ,EAAEK,MAAV,EAAkBC,SAA3C;;AACA,MAAK,CAAEF,gBAAP,EAA0B;AACzB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGA,gBADT;AAEC,IAAA,MAAM,EAAGH,QAFV;AAGC,IAAA,QAAQ,EAAGC;AAHZ,KAKGC,QALH,CADD;AASA;;AAED,eAAeX,OAAO,CACrBE,UAAU,CAAE,CAAEa,MAAF,EAAUC,QAAV,KAAwB;AACnC,QAAMC,IAAI,GAAGD,QAAQ,CAACR,QAAT,EAAmBS,IAAhC;AACA,QAAMC,SAAS,GAAGD,IAAI,GAAI,kBAAkBA,IAAM,EAA5B,GAAgC,EAAtD;AACA,SAAO;AACNC,IAAAA,SADM;AAENX,IAAAA,SAAS,EAAEU,IAAI,GACZF,MAAM,CAAEV,aAAF,CAAN,CAAwBc,oBAAxB,CAA8CD,SAA9C,CADY,GAEZ,KAJG;AAKNT,IAAAA,QAAQ,EAAEQ,IAAI,GACXF,MAAM,CAAEV,aAAF,CAAN,CAAwBe,mBAAxB,CAA6CF,SAA7C,CADW,GAEX;AAPG,GAAP;AASA,CAZS,CADW,EAcrBf,YAAY,CAAE,CAAEkB,QAAF,EAAYL,QAAZ,MAA4B;AACzCN,EAAAA,aAAa,EAAE,MAAM;AACpBW,IAAAA,QAAQ,CAAEhB,aAAF,CAAR,CAA0BiB,uBAA1B,CACCN,QAAQ,CAACE,SADV;AAGA;AALwC,CAA5B,CAAF,CAdS,CAAP,CAqBZZ,aArBY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { PanelBody } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction TaxonomyPanel( {\n\tisEnabled,\n\ttaxonomy,\n\tisOpened,\n\tonTogglePanel,\n\tchildren,\n} ) {\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst taxonomyMenuName = taxonomy?.labels?.menu_name;\n\tif ( ! taxonomyMenuName ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ taxonomyMenuName }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, ownProps ) => {\n\t\tconst slug = ownProps.taxonomy?.slug;\n\t\tconst panelName = slug ? `taxonomy-panel-${ slug }` : '';\n\t\treturn {\n\t\t\tpanelName,\n\t\t\tisEnabled: slug\n\t\t\t\t? select( editPostStore ).isEditorPanelEnabled( panelName )\n\t\t\t\t: false,\n\t\t\tisOpened: slug\n\t\t\t\t? select( editPostStore ).isEditorPanelOpened( panelName )\n\t\t\t\t: false,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, ownProps ) => ( {\n\t\tonTogglePanel: () => {\n\t\t\tdispatch( editPostStore ).toggleEditorPanelOpened(\n\t\t\t\townProps.panelName\n\t\t\t);\n\t\t},\n\t} ) )\n)( TaxonomyPanel );\n"]}
1
+ {"version":3,"names":["compose","PanelBody","withSelect","withDispatch","store","editPostStore","TaxonomyPanel","isEnabled","taxonomy","isOpened","onTogglePanel","children","taxonomyMenuName","labels","menu_name","createElement","title","opened","onToggle","select","ownProps","slug","panelName","isEditorPanelEnabled","isEditorPanelOpened","dispatch","toggleEditorPanelOpened"],"sources":["@wordpress/edit-post/src/components/sidebar/post-taxonomies/taxonomy-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { PanelBody } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction TaxonomyPanel( {\n\tisEnabled,\n\ttaxonomy,\n\tisOpened,\n\tonTogglePanel,\n\tchildren,\n} ) {\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst taxonomyMenuName = taxonomy?.labels?.menu_name;\n\tif ( ! taxonomyMenuName ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ taxonomyMenuName }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ onTogglePanel }\n\t\t>\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select, ownProps ) => {\n\t\tconst slug = ownProps.taxonomy?.slug;\n\t\tconst panelName = slug ? `taxonomy-panel-${ slug }` : '';\n\t\treturn {\n\t\t\tpanelName,\n\t\t\tisEnabled: slug\n\t\t\t\t? select( editPostStore ).isEditorPanelEnabled( panelName )\n\t\t\t\t: false,\n\t\t\tisOpened: slug\n\t\t\t\t? select( editPostStore ).isEditorPanelOpened( panelName )\n\t\t\t\t: false,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, ownProps ) => ( {\n\t\tonTogglePanel: () => {\n\t\t\tdispatch( editPostStore ).toggleEditorPanelOpened(\n\t\t\t\townProps.panelName\n\t\t\t);\n\t\t},\n\t} ) )\n)( TaxonomyPanel );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,gBAAgB;AAEvD,SAASC,aAAaA,CAAE;EACvBC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,IAAK,CAAEJ,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,MAAMK,gBAAgB,GAAGJ,QAAQ,EAAEK,MAAM,EAAEC,SAAS;EACpD,IAAK,CAAEF,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OACCG,aAAA,CAACd,SAAS;IACTe,KAAK,EAAGJ,gBAAkB;IAC1BK,MAAM,EAAGR,QAAU;IACnBS,QAAQ,EAAGR;EAAe,GAExBC,QACQ,CAAC;AAEd;AAEA,eAAeX,OAAO,CACrBE,UAAU,CAAE,CAAEiB,MAAM,EAAEC,QAAQ,KAAM;EACnC,MAAMC,IAAI,GAAGD,QAAQ,CAACZ,QAAQ,EAAEa,IAAI;EACpC,MAAMC,SAAS,GAAGD,IAAI,GAAI,kBAAkBA,IAAM,EAAC,GAAG,EAAE;EACxD,OAAO;IACNC,SAAS;IACTf,SAAS,EAAEc,IAAI,GACZF,MAAM,CAAEd,aAAc,CAAC,CAACkB,oBAAoB,CAAED,SAAU,CAAC,GACzD,KAAK;IACRb,QAAQ,EAAEY,IAAI,GACXF,MAAM,CAAEd,aAAc,CAAC,CAACmB,mBAAmB,CAAEF,SAAU,CAAC,GACxD;EACJ,CAAC;AACF,CAAE,CAAC,EACHnB,YAAY,CAAE,CAAEsB,QAAQ,EAAEL,QAAQ,MAAQ;EACzCV,aAAa,EAAEA,CAAA,KAAM;IACpBe,QAAQ,CAAEpB,aAAc,CAAC,CAACqB,uBAAuB,CAChDN,QAAQ,CAACE,SACV,CAAC;EACF;AACD,CAAC,CAAG,CACL,CAAC,CAAEhB,aAAc,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -10,14 +9,12 @@ import { serialize, createBlock } from '@wordpress/blocks';
10
9
  import { Modal, TextControl, Button, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
11
10
  import { __ } from '@wordpress/i18n';
12
11
  import { cleanForSlug } from '@wordpress/url';
12
+
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
-
17
16
  import { store as editPostStore } from '../../../store';
18
-
19
17
  const DEFAULT_TITLE = __('Custom Template');
20
-
21
18
  export default function PostTemplateCreateModal({
22
19
  onClose
23
20
  }) {
@@ -28,19 +25,15 @@ export default function PostTemplateCreateModal({
28
25
  } = useDispatch(editPostStore);
29
26
  const [title, setTitle] = useState('');
30
27
  const [isBusy, setIsBusy] = useState(false);
31
-
32
28
  const cancel = () => {
33
29
  setTitle('');
34
30
  onClose();
35
31
  };
36
-
37
32
  const submit = async event => {
38
33
  event.preventDefault();
39
-
40
34
  if (isBusy) {
41
35
  return;
42
36
  }
43
-
44
37
  setIsBusy(true);
45
38
  const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : serialize([createBlock('core/group', {
46
39
  tagName: 'header',
@@ -65,10 +58,8 @@ export default function PostTemplateCreateModal({
65
58
  });
66
59
  setIsBusy(false);
67
60
  cancel();
68
-
69
61
  __unstableSwitchToTemplateMode(true);
70
62
  };
71
-
72
63
  return createElement(Modal, {
73
64
  title: __('Create custom template'),
74
65
  onRequestClose: cancel,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/create-modal.js"],"names":["useSelect","useDispatch","store","editorStore","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","editPostStore","DEFAULT_TITLE","PostTemplateCreateModal","onClose","defaultBlockTemplate","select","getEditorSettings","__unstableCreateTemplate","__unstableSwitchToTemplateMode","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,mBAAvC;AACA,SACCC,KADD,EAECC,WAFD,EAGCC,MAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,QAMO,uBANP;AAOA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AAC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AE,CAAE,QAAF,CADL,CADD,EAKC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGa,MAHV;AAIC,qBAAgBA;AAJjB,KAMGb,EAAE,CAAE,QAAF,CANL,CALD,CAZD,CAJD,CALD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\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 { store as editPostStore } from '../../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function PostTemplateCreateModal( { onClose } ) {\n\tconst defaultBlockTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().defaultBlockTemplate,\n\t\t[]\n\t);\n\n\tconst { __unstableCreateTemplate, __unstableSwitchToTemplateMode } =\n\t\tuseDispatch( editPostStore );\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\tawait __unstableCreateTemplate( {\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\tcancel();\n\n\t\t__unstableSwitchToTemplateMode( true );\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tclassName=\"edit-post-post-template__create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"edit-post-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"]}
1
+ {"version":3,"names":["useSelect","useDispatch","store","editorStore","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","editPostStore","DEFAULT_TITLE","PostTemplateCreateModal","onClose","defaultBlockTemplate","select","getEditorSettings","__unstableCreateTemplate","__unstableSwitchToTemplateMode","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content","createElement","onRequestClose","className","onSubmit","spacing","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","variant","onClick","type"],"sources":["@wordpress/edit-post/src/components/sidebar/post-template/create-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\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 { store as editPostStore } from '../../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function PostTemplateCreateModal( { onClose } ) {\n\tconst defaultBlockTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().defaultBlockTemplate,\n\t\t[]\n\t);\n\n\tconst { __unstableCreateTemplate, __unstableSwitchToTemplateMode } =\n\t\tuseDispatch( editPostStore );\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\tawait __unstableCreateTemplate( {\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\tcancel();\n\n\t\t__unstableSwitchToTemplateMode( true );\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tclassName=\"edit-post-post-template__create-modal\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"edit-post-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\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AG/B,EAAE,CAAE,MAAO,CAAG;IACtBgC,KAAK,EAAGrB,KAAO;IACfsB,QAAQ,EAAGrB,QAAU;IACrBsB,WAAW,EAAG/B,aAAe;IAC7BgC,QAAQ,EAAGtB,MAAQ;IACnBuB,IAAI,EAAGpC,EAAE,CACR,iHACD;EAAG,CACH,CAAC,EACFyB,aAAA,CAAC5B,MAAM;IAACwC,OAAO,EAAC;EAAO,GACtBZ,aAAA,CAAC9B,MAAM;IAAC2C,OAAO,EAAC,UAAU;IAACC,OAAO,EAAGxB;EAAQ,GAC1Cf,EAAE,CAAE,QAAS,CACR,CAAC,EAETyB,aAAA,CAAC9B,MAAM;IACN2C,OAAO,EAAC,SAAS;IACjBE,IAAI,EAAC,QAAQ;IACb3B,MAAM,EAAGA,MAAQ;IACjB,iBAAgBA;EAAQ,GAEtBb,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -11,17 +10,16 @@ import { Notice, SelectControl, Button } from '@wordpress/components';
11
10
  import { useSelect, useDispatch } from '@wordpress/data';
12
11
  import { store as editorStore } from '@wordpress/editor';
13
12
  import { store as coreStore } from '@wordpress/core-data';
13
+
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
-
18
17
  import { store as editPostStore } from '../../../store';
19
18
  import PostTemplateCreateModal from './create-modal';
20
19
  export default function PostTemplateForm({
21
20
  onClose
22
21
  }) {
23
22
  var _options$find, _selectedOption$value;
24
-
25
23
  const {
26
24
  isPostsPage,
27
25
  availableTemplates,
@@ -37,9 +35,7 @@ export default function PostTemplateForm({
37
35
  } = select(coreStore);
38
36
  const editorSettings = select(editorStore).getEditorSettings();
39
37
  const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
40
-
41
38
  const _isPostsPage = select(editorStore).getCurrentPostId() === siteSettings?.page_for_posts;
42
-
43
39
  const canCreateTemplates = canUser('create', 'templates');
44
40
  return {
45
41
  isPostsPage: _isPostsPage,
@@ -53,7 +49,8 @@ export default function PostTemplateForm({
53
49
  canEdit: canCreateTemplates && editorSettings.supportsTemplateMode && !!select(editPostStore).getEditedPostTemplate()
54
50
  };
55
51
  }, []);
56
- const options = useMemo(() => Object.entries({ ...availableTemplates,
52
+ const options = useMemo(() => Object.entries({
53
+ ...availableTemplates,
57
54
  ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({
58
55
  slug,
59
56
  title
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/form.js"],"names":["useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","addTemplate","Notice","SelectControl","Button","useSelect","useDispatch","store","editorStore","coreStore","editPostStore","PostTemplateCreateModal","PostTemplateForm","onClose","isPostsPage","availableTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","select","canUser","getEntityRecord","getEntityRecords","editorSettings","getEditorSettings","siteSettings","undefined","_isPostsPage","getCurrentPostId","page_for_posts","canCreateTemplates","post_type","getCurrentPostType","per_page","getEditedPostAttribute","supportsTemplateMode","getEditedPostTemplate","options","Object","entries","fromEntries","map","slug","title","rendered","value","label","selectedOption","find","option","editPost","__unstableSwitchToTemplateMode","isCreateModalOpen","setIsCreateModalOpen","icon","onClick","template"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,oCAAoC,IAAIC,sBAAjD,QAA+E,yBAA/E;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,SAASC,MAAT,EAAiBC,aAAjB,EAAgCC,MAAhC,QAA8C,uBAA9C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,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import { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { addTemplate } from '@wordpress/icons';\nimport { Notice, SelectControl, Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport PostTemplateCreateModal from './create-modal';\n\nexport default function PostTemplateForm( { onClose } ) {\n\tconst {\n\t\tisPostsPage,\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\tselect( coreStore );\n\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _isPostsPage =\n\t\t\tselect( editorStore ).getCurrentPostId() ===\n\t\t\tsiteSettings?.page_for_posts;\n\t\tconst canCreateTemplates = canUser( 'create', 'templates' );\n\n\t\treturn {\n\t\t\tisPostsPage: _isPostsPage,\n\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\tpost_type: select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t } )\n\t\t\t\t: undefined,\n\t\t\tselectedTemplateSlug:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\tcanCreate:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\t! _isPostsPage &&\n\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\tcanEdit:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t!! select( editPostStore ).getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { __unstableSwitchToTemplateMode } = useDispatch( editPostStore );\n\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"edit-post-post-template__form\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ isPostsPage ? (\n\t\t\t\t<Notice\n\t\t\t\t\tclassName=\"edit-post-post-template__notice\"\n\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<PostTemplateCreateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"names":["useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","addTemplate","Notice","SelectControl","Button","useSelect","useDispatch","store","editorStore","coreStore","editPostStore","PostTemplateCreateModal","PostTemplateForm","onClose","_options$find","_selectedOption$value","isPostsPage","availableTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","select","canUser","getEntityRecord","getEntityRecords","editorSettings","getEditorSettings","siteSettings","undefined","_isPostsPage","getCurrentPostId","page_for_posts","canCreateTemplates","post_type","getCurrentPostType","per_page","getEditedPostAttribute","supportsTemplateMode","getEditedPostTemplate","options","Object","entries","fromEntries","map","slug","title","rendered","value","label","selectedOption","find","option","editPost","__unstableSwitchToTemplateMode","isCreateModalOpen","setIsCreateModalOpen","createElement","className","help","actions","icon","onClick","status","isDismissible","__nextHasNoMarginBottom","hideLabelFromVision","onChange","template","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-template/form.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { addTemplate } from '@wordpress/icons';\nimport { Notice, SelectControl, Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport PostTemplateCreateModal from './create-modal';\n\nexport default function PostTemplateForm( { onClose } ) {\n\tconst {\n\t\tisPostsPage,\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEntityRecords } =\n\t\t\tselect( coreStore );\n\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\t\tconst _isPostsPage =\n\t\t\tselect( editorStore ).getCurrentPostId() ===\n\t\t\tsiteSettings?.page_for_posts;\n\t\tconst canCreateTemplates = canUser( 'create', 'templates' );\n\n\t\treturn {\n\t\t\tisPostsPage: _isPostsPage,\n\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\tpost_type: select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t } )\n\t\t\t\t: undefined,\n\t\t\tselectedTemplateSlug:\n\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\tcanCreate:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\t! _isPostsPage &&\n\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\tcanEdit:\n\t\t\t\tcanCreateTemplates &&\n\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t!! select( editPostStore ).getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { __unstableSwitchToTemplateMode } = useDispatch( editPostStore );\n\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"edit-post-post-template__form\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ isPostsPage ? (\n\t\t\t\t<Notice\n\t\t\t\t\tclassName=\"edit-post-post-template__notice\"\n\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\tisDismissible={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<PostTemplateCreateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,MAAM,EAAEC,aAAa,EAAEC,MAAM,QAAQ,uBAAuB;AACrE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,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,CAAE,UAAW,CAAG;IAC1B2D,IAAI,EAAG3D,EAAE,CACR,uEACD,CAAG;IACH4D,OAAO,EACNxC,SAAS,GACN,CACA;MACCyC,IAAI,EAAE5D,WAAW;MACjBgD,KAAK,EAAEjD,EAAE,CAAE,cAAe,CAAC;MAC3B8D,OAAO,EAAEA,CAAA,KAAMN,oBAAoB,CAAE,IAAK;IAC3C,CAAC,CACA,GACD,EACH;IACD3C,OAAO,EAAGA;EAAS,CACnB,CAAC,EACAG,WAAW,GACZyC,aAAA,CAACvD,MAAM;IACNwD,SAAS,EAAC,iCAAiC;IAC3CK,MAAM,EAAC,SAAS;IAChBC,aAAa,EAAG;EAAO,GAErBhE,EAAE,CAAE,4CAA6C,CAC5C,CAAC,GAETyD,aAAA,CAACtD,aAAa;IACb8D,uBAAuB;IACvBC,mBAAmB;IACnBjB,KAAK,EAAGjD,EAAE,CAAE,UAAW,CAAG;IAC1BgD,KAAK,GAAAjC,qBAAA,GAAGmC,cAAc,EAAEF,KAAK,cAAAjC,qBAAA,cAAAA,qBAAA,GAAI,EAAI;IACrCyB,OAAO,EAAGA,OAAS;IACnB2B,QAAQ,EAAKtB,IAAI,IAChBQ,QAAQ,CAAE;MAAEe,QAAQ,EAAEvB,IAAI,IAAI;IAAG,CAAE;EACnC,CACD,CACD,EACCxB,OAAO,IACRoC,aAAA,YACCA,aAAA,CAACrD,MAAM;IACNiE,OAAO,EAAC,MAAM;IACdP,OAAO,EAAGA,CAAA,KAAMR,8BAA8B,CAAC;EAAG,GAEhDtD,EAAE,CAAE,eAAgB,CACf,CACN,CACH,EACCuD,iBAAiB,IAClBE,aAAA,CAAC9C,uBAAuB;IACvBE,OAAO,EAAGA,CAAA,KAAM2C,oBAAoB,CAAE,KAAM;EAAG,CAC/C,CAEE,CAAC;AAER"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -9,50 +8,42 @@ import { __, sprintf } from '@wordpress/i18n';
9
8
  import { useSelect } from '@wordpress/data';
10
9
  import { store as editorStore } from '@wordpress/editor';
11
10
  import { store as coreStore } from '@wordpress/core-data';
11
+
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
-
16
15
  import PostTemplateForm from './form';
17
16
  import { store as editPostStore } from '../../../store';
18
17
  export default function PostTemplate() {
19
18
  // Use internal state instead of a ref to make sure that the component
20
19
  // re-renders when the popover's anchor updates.
21
- const [popoverAnchor, setPopoverAnchor] = useState(null); // Memoize popoverProps to avoid returning a new object every time.
22
-
20
+ const [popoverAnchor, setPopoverAnchor] = useState(null);
21
+ // Memoize popoverProps to avoid returning a new object every time.
23
22
  const popoverProps = useMemo(() => ({
24
23
  anchor: popoverAnchor,
25
24
  placement: 'bottom-end'
26
25
  }), [popoverAnchor]);
27
26
  const isVisible = useSelect(select => {
28
27
  var _select$canUser;
29
-
30
28
  const postTypeSlug = select(editorStore).getCurrentPostType();
31
29
  const postType = select(coreStore).getPostType(postTypeSlug);
32
-
33
30
  if (!postType?.viewable) {
34
31
  return false;
35
32
  }
36
-
37
33
  const settings = select(editorStore).getEditorSettings();
38
34
  const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0;
39
-
40
35
  if (hasTemplates) {
41
36
  return true;
42
37
  }
43
-
44
38
  if (!settings.supportsTemplateMode) {
45
39
  return false;
46
40
  }
47
-
48
41
  const canCreateTemplates = (_select$canUser = select(coreStore).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
49
42
  return canCreateTemplates;
50
43
  }, []);
51
-
52
44
  if (!isVisible) {
53
45
  return null;
54
46
  }
55
-
56
47
  return createElement(PanelRow, {
57
48
  className: "edit-post-post-template",
58
49
  ref: setPopoverAnchor
@@ -75,7 +66,6 @@ export default function PostTemplate() {
75
66
  })
76
67
  }));
77
68
  }
78
-
79
69
  function PostTemplateToggle({
80
70
  isOpen,
81
71
  onClick
@@ -86,11 +76,9 @@ function PostTemplateToggle({
86
76
  supportsTemplateMode,
87
77
  availableTemplates
88
78
  } = select(editorStore).getEditorSettings();
89
-
90
79
  if (!supportsTemplateMode && availableTemplates[templateSlug]) {
91
80
  return availableTemplates[templateSlug];
92
81
  }
93
-
94
82
  const template = select(coreStore).canUser('create', 'templates') && select(editPostStore).getEditedPostTemplate();
95
83
  return template?.title || template?.slug || availableTemplates?.[templateSlug];
96
84
  }, []);
@@ -98,7 +86,8 @@ function PostTemplateToggle({
98
86
  className: "edit-post-post-template__toggle",
99
87
  variant: "tertiary",
100
88
  "aria-expanded": isOpen,
101
- "aria-label": templateTitle ? sprintf( // translators: %s: Name of the currently selected template.
89
+ "aria-label": templateTitle ? sprintf(
90
+ // translators: %s: Name of the currently selected template.
102
91
  __('Select template: %s'), templateTitle) : __('Select template'),
103
92
  onClick: onClick
104
93
  }, templateTitle !== null && templateTitle !== void 0 ? templateTitle : __('Default template'));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-template/index.js"],"names":["useState","useMemo","PanelRow","Dropdown","Button","__","sprintf","useSelect","store","editorStore","coreStore","PostTemplateForm","editPostStore","PostTemplate","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","isVisible","select","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","getEditorSettings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","isOpen","onToggle","onClose","PostTemplateToggle","onClick","templateTitle","templateSlug","getEditedPostAttribute","template","getEditedPostTemplate","title","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,QAAT,EAAmBC,QAAnB,EAA6BC,MAA7B,QAA2C,uBAA3C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAA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CD,QAAQ,EAAEE,KAAV,IACAF,QAAQ,EAAEG,IADV,IAEAlB,kBAAkB,GAAIa,YAAJ,CAHnB;AAKA,GAjB8B,EAiB5B,EAjB4B,CAA/B;AAmBA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,OAAO,EAAC,UAFT;AAGC,qBAAgBN,MAHjB;AAIC,kBACCK,aAAa,GACVnC,OAAO,EACP;AACAD,IAAAA,EAAE,CAAE,qBAAF,CAFK,EAGPoC,aAHO,CADG,GAMVpC,EAAE,CAAE,iBAAF,CAXP;AAaC,IAAA,OAAO,EAAGmC;AAbX,KAeGC,aAfH,aAeGA,aAfH,cAeGA,aAfH,GAeoBpC,EAAE,CAAE,kBAAF,CAftB,CADD;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTemplateForm from './form';\nimport { store as editPostStore } from '../../../store';\n\nexport default function PostTemplate() {\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() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-post-template\" ref={ setPopoverAnchor }>\n\t\t\t<span>{ __( 'Template' ) }</span>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"edit-post-post-template__dropdown\"\n\t\t\t\tcontentClassName=\"edit-post-post-template__dialog\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostTemplateToggle\n\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<PostTemplateForm onClose={ onClose } />\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PanelRow>\n\t);\n}\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) &&\n\t\t\tselect( editPostStore ).getEditedPostTemplate();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-template__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\ttemplateTitle\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the currently selected template.\n\t\t\t\t\t\t\t__( 'Select template: %s' ),\n\t\t\t\t\t\t\ttemplateTitle\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Select template' )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n"]}
1
+ {"version":3,"names":["useState","useMemo","PanelRow","Dropdown","Button","__","sprintf","useSelect","store","editorStore","coreStore","PostTemplateForm","editPostStore","PostTemplate","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","isVisible","select","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","getEditorSettings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostTemplateToggle","onClick","renderContent","onClose","templateTitle","templateSlug","getEditedPostAttribute","template","getEditedPostTemplate","title","slug","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTemplateForm from './form';\nimport { store as editPostStore } from '../../../store';\n\nexport default function PostTemplate() {\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() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-post-template\" ref={ setPopoverAnchor }>\n\t\t\t<span>{ __( 'Template' ) }</span>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"edit-post-post-template__dropdown\"\n\t\t\t\tcontentClassName=\"edit-post-post-template__dialog\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostTemplateToggle\n\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<PostTemplateForm onClose={ onClose } />\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PanelRow>\n\t);\n}\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) &&\n\t\t\tselect( editPostStore ).getEditedPostTemplate();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-template__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\ttemplateTitle\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the currently selected template.\n\t\t\t\t\t\t\t__( 'Select template: %s' ),\n\t\t\t\t\t\t\ttemplateTitle\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Select template' )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,QAAQ;AACrC,SAASH,KAAK,IAAII,aAAa,QAAQ,gBAAgB;AAEvD,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MA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NkC,SAAS,EAAC,iCAAiC;IAC3CkB,OAAO,EAAC,UAAU;IAClB,iBAAgBb,MAAQ;IACxB,cACCM,aAAa,GACV3C,OAAO;IACP;IACAD,EAAE,CAAE,qBAAsB,CAAC,EAC3B4C,aACA,CAAC,GACD5C,EAAE,CAAE,iBAAkB,CACzB;IACDyC,OAAO,EAAGA;EAAS,GAEjBG,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI5C,EAAE,CAAE,kBAAmB,CACnC,CAAC;AAEX"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-trash/index.js"],"names":["PostTrash","PostTrashLink","PostTrashCheck"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,aAAtB,EAAqCC,cAArC,QAA2D,mBAA3D;AAEA,eAAe,SAASF,SAAT,GAAqB;AACnC,SACC,cAAC,cAAD,QACC,cAAC,aAAD,OADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';\n\nexport default function PostTrash() {\n\treturn (\n\t\t<PostTrashCheck>\n\t\t\t<PostTrashLink />\n\t\t</PostTrashCheck>\n\t);\n}\n"]}
1
+ {"version":3,"names":["PostTrash","PostTrashLink","PostTrashCheck","createElement"],"sources":["@wordpress/edit-post/src/components/sidebar/post-trash/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';\n\nexport default function PostTrash() {\n\treturn (\n\t\t<PostTrashCheck>\n\t\t\t<PostTrashLink />\n\t\t</PostTrashCheck>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,aAAa,EAAEC,cAAc,QAAQ,mBAAmB;AAE9E,eAAe,SAASF,SAASA,CAAA,EAAG;EACnC,OACCG,aAAA,CAACD,cAAc,QACdC,aAAA,CAACF,aAAa,MAAE,CACD,CAAC;AAEnB"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -10,8 +9,8 @@ import { PostURLCheck, PostURL as PostURLForm, usePostURLLabel } from '@wordpres
10
9
  export default function PostURL() {
11
10
  // Use internal state instead of a ref to make sure that the component
12
11
  // re-renders when the popover's anchor updates.
13
- const [popoverAnchor, setPopoverAnchor] = useState(null); // Memoize popoverProps to avoid returning a new object every time.
14
-
12
+ const [popoverAnchor, setPopoverAnchor] = useState(null);
13
+ // Memoize popoverProps to avoid returning a new object every time.
15
14
  const popoverProps = useMemo(() => ({
16
15
  anchor: popoverAnchor,
17
16
  placement: 'bottom-end'
@@ -38,7 +37,6 @@ export default function PostURL() {
38
37
  })
39
38
  })));
40
39
  }
41
-
42
40
  function PostURLToggle({
43
41
  isOpen,
44
42
  onClick
@@ -47,7 +45,8 @@ function PostURLToggle({
47
45
  return createElement(Button, {
48
46
  className: "edit-post-post-url__toggle",
49
47
  variant: "tertiary",
50
- "aria-expanded": isOpen // translators: %s: Current post URL.
48
+ "aria-expanded": isOpen
49
+ // translators: %s: Current post URL.
51
50
  ,
52
51
  "aria-label": sprintf(__('Change URL: %s'), label),
53
52
  onClick: onClick
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-url/index.js"],"names":["useMemo","useState","PanelRow","Dropdown","Button","__","sprintf","PostURLCheck","PostURL","PostURLForm","usePostURLLabel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","isOpen","onToggle","onClose","PostURLToggle","onClick","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SAASC,QAAT,EAAmBC,QAAnB,EAA6BC,MAA7B,QAA2C,uBAA3C;AACA,SAASC,EAAT,EAAa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AED,EAAE,CAAE,gBAAF,CAAJ,EAA0BgB,KAA1B,CALrB;AAMC,IAAA,OAAO,EAAGD;AANX,KAQGC,KARH,CADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tPostURLCheck,\n\tPostURL as PostURLForm,\n\tusePostURLLabel,\n} from '@wordpress/editor';\n\nexport default function PostURL() {\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() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PanelRow className=\"edit-post-post-url\" ref={ setPopoverAnchor }>\n\t\t\t\t<span>{ __( 'URL' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"edit-post-post-url__dropdown\"\n\t\t\t\t\tcontentClassName=\"edit-post-post-url__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<PostURLForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-url__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"]}
1
+ {"version":3,"names":["useMemo","useState","PanelRow","Dropdown","Button","__","sprintf","PostURLCheck","PostURL","PostURLForm","usePostURLLabel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","label","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tPostURLCheck,\n\tPostURL as PostURLForm,\n\tusePostURLLabel,\n} from '@wordpress/editor';\n\nexport default function PostURL() {\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() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PanelRow className=\"edit-post-post-url\" ref={ setPopoverAnchor }>\n\t\t\t\t<span>{ __( 'URL' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"edit-post-post-url__dropdown\"\n\t\t\t\t\tcontentClassName=\"edit-post-post-url__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<PostURLForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-url__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,YAAY,EACZC,OAAO,IAAIC,WAAW,EACtBC,eAAe,QACT,mBAAmB;AAE1B,eAAe,SAASF,OAAOA,CAAA,EAAG;EACjC;EACA;EACA,MAAM,CAAEG,aAAa,EAAEC,gBAAgB,CAAE,GAAGX,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMY,YAAY,GAAGb,OAAO,CAC3B,OAAQ;IAAEc,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACT,YAAY,QACZS,aAAA,CAACd,QAAQ;IAACe,SAAS,EAAC,oBAAoB;IAACC,GAAG,EAAGN;EAAkB,GAChEI,aAAA,eAAQX,EAAE,CAAE,KAAM,CAAS,CAAC,EAC5BW,aAAA,CAACb,QAAQ;IACRU,YAAY,EAAGA,YAAc;IAC7BI,SAAS,EAAC,8BAA8B;IACxCE,gBAAgB,EAAC,4BAA4B;IAC7CC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpCP,aAAA,CAACQ,aAAa;MAACF,MAAM,EAAGA,MAAQ;MAACG,OAAO,EAAGF;IAAU,CAAE,CACrD;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5BX,aAAA,CAACP,WAAW;MAACkB,OAAO,EAAGA;IAAS,CAAE;EAChC,CACH,CACQ,CACG,CAAC;AAEjB;AAEA,SAASH,aAAaA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAC7C,MAAMG,KAAK,GAAGlB,eAAe,CAAC,CAAC;EAC/B,OACCM,aAAA,CAACZ,MAAM;IACNa,SAAS,EAAC,4BAA4B;IACtCY,OAAO,EAAC,UAAU;IAClB,iBAAgBP;IAChB;IAAA;IACA,cAAahB,OAAO,CAAED,EAAE,CAAE,gBAAiB,CAAC,EAAEuB,KAAM,CAAG;IACvDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -10,8 +9,8 @@ import { useMemo, useState } from '@wordpress/element';
10
9
  export function PostVisibility() {
11
10
  // Use internal state instead of a ref to make sure that the component
12
11
  // re-renders when the popover's anchor updates.
13
- const [popoverAnchor, setPopoverAnchor] = useState(null); // Memoize popoverProps to avoid returning a new object every time.
14
-
12
+ const [popoverAnchor, setPopoverAnchor] = useState(null);
13
+ // Memoize popoverProps to avoid returning a new object every time.
15
14
  const popoverProps = useMemo(() => ({
16
15
  // Anchor the popover to the middle of the entire row so that it doesn't
17
16
  // move around when the label changes.
@@ -43,7 +42,6 @@ export function PostVisibility() {
43
42
  }))
44
43
  });
45
44
  }
46
-
47
45
  function PostVisibilityToggle({
48
46
  isOpen,
49
47
  onClick
@@ -52,12 +50,12 @@ function PostVisibilityToggle({
52
50
  return createElement(Button, {
53
51
  className: "edit-post-post-visibility__toggle",
54
52
  variant: "tertiary",
55
- "aria-expanded": isOpen // translators: %s: Current post visibility.
53
+ "aria-expanded": isOpen
54
+ // translators: %s: Current post visibility.
56
55
  ,
57
56
  "aria-label": sprintf(__('Select visibility: %s'), label),
58
57
  onClick: onClick
59
58
  }, label);
60
59
  }
61
-
62
60
  export default PostVisibility;
63
61
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/post-visibility/index.js"],"names":["__","sprintf","PanelRow","Dropdown","Button","PostVisibility","PostVisibilityForm","PostVisibilityLabel","PostVisibilityCheck","usePostVisibilityLabel","useMemo","useState","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","canEdit","isOpen","onToggle","onClose","PostVisibilityToggle","onClick","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,QAAnB,EAA6BC,MAA7B,QAA2C,uBAA3C;AACA,SACCC,cAAc,IAAIC,kBADnB,EAECC,mBAFD,EAGCC,mBAHD,EAICC,sBAJD,QAKO,mBALP;AAMA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AAEA,OAAO,SAASN,cAAT,GAA0B;AAChC;AACA;AACA,QAAM,CAAEO,aAAF,EAAiBC,gBAAjB,IAAsCF,QAAQ,CAAE,IAAF,CAApD,CAHgC,CAIhC;;AACA,QAAMG,YAAY,GAAGJ,OAAO,CAC3B,OAAQ;AACP;AACA;AACAK,IAAAA,MAAM,EAAEH,aAHD;AAIPI,IAAAA,SAAS,EAAE;AAJJ,GAAR,CAD2B,EAO3B,CAAEJ,aAAF,CAP2B,CAA5B;AAUA,SACC,cAAC,mBAAD;AACC,IAAA,MAAM,EAAG,CAAE;AAAEK,MAAAA;AAAF,KAAF,KACR,cAAC,QAAD;AACC,MAAA,GAAG,EAAGJ,gBADP;AAEC,MAAA,SAAS,EAAC;AAFX,OAIC,4BAAQb,EAAE,CAAE,YAAF,CAAV,CAJD,EAKG,CAAEiB,OAAF,IACD,4BACC,cAAC,mBAAD,OADD,CANF,EAUGA,OAAO,IACR,cAAC,QAAD;AACC,MAAA,gBAAgB,EAAC,mCADlB;AAEC,MAAA,YAAY,EAAGH,YAFhB;AAGC,MAAA,YAAY,MAHb;AAIC,MAAA,YAAY,EAAG,CAAE;AAAEI,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF,KACd,cAAC,oBAAD;AACC,QAAA,MAAM,EAAGD,MADV;AAEC,QAAA,OAAO,EAAGC;AAFX,QALF;AAUC,MAAA,aAAa,EAAG,CAAE;AAAEC,QAAAA;AAAF,OAAF,KACf,cAAC,kBAAD;AAAoB,QAAA,OAAO,EAAGA;AAA9B;AAXF,MAXF;AAFF,IADD;AAiCA;;AAED,SAASC,oBAAT,CAA+B;AAAEH,EAAAA,MAAF;AAAUI,EAAAA;AAAV,CAA/B,EAAqD;AACpD,QAAMC,KAAK,GAAGd,sBAAsB,EAApC;AACA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,OAAO,EAAC,UAFT;AAGC,qBAAgBS,MAHjB,CAIC;AAJD;AAKC,kBAAajB,OAAO,CAAED,EAAE,CAAE,uBAAF,CAAJ,EAAiCuB,KAAjC,CALrB;AAMC,IAAA,OAAO,EAAGD;AANX,KAQGC,KARH,CADD;AAYA;;AAED,eAAelB,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport {\n\tPostVisibility as PostVisibilityForm,\n\tPostVisibilityLabel,\n\tPostVisibilityCheck,\n\tusePostVisibilityLabel,\n} from '@wordpress/editor';\nimport { useMemo, useState } from '@wordpress/element';\n\nexport function PostVisibility() {\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: 'bottom-end',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostVisibilityCheck\n\t\t\trender={ ( { canEdit } ) => (\n\t\t\t\t<PanelRow\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tclassName=\"edit-post-post-visibility\"\n\t\t\t\t>\n\t\t\t\t\t<span>{ __( 'Visibility' ) }</span>\n\t\t\t\t\t{ ! canEdit && (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canEdit && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tcontentClassName=\"edit-post-post-visibility__dialog\"\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityToggle\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityForm onClose={ onClose } />\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</PanelRow>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction PostVisibilityToggle( { isOpen, onClick } ) {\n\tconst label = usePostVisibilityLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-visibility__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post visibility.\n\t\t\taria-label={ sprintf( __( 'Select visibility: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default PostVisibility;\n"]}
1
+ {"version":3,"names":["__","sprintf","PanelRow","Dropdown","Button","PostVisibility","PostVisibilityForm","PostVisibilityLabel","PostVisibilityCheck","usePostVisibilityLabel","useMemo","useState","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","render","canEdit","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostVisibilityToggle","onClick","renderContent","onClose","label","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-visibility/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport {\n\tPostVisibility as PostVisibilityForm,\n\tPostVisibilityLabel,\n\tPostVisibilityCheck,\n\tusePostVisibilityLabel,\n} from '@wordpress/editor';\nimport { useMemo, useState } from '@wordpress/element';\n\nexport function PostVisibility() {\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: 'bottom-end',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostVisibilityCheck\n\t\t\trender={ ( { canEdit } ) => (\n\t\t\t\t<PanelRow\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tclassName=\"edit-post-post-visibility\"\n\t\t\t\t>\n\t\t\t\t\t<span>{ __( 'Visibility' ) }</span>\n\t\t\t\t\t{ ! canEdit && (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canEdit && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tcontentClassName=\"edit-post-post-visibility__dialog\"\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityToggle\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityForm onClose={ onClose } />\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</PanelRow>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction PostVisibilityToggle( { isOpen, onClick } ) {\n\tconst label = usePostVisibilityLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-visibility__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post visibility.\n\t\t\taria-label={ sprintf( __( 'Select visibility: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default PostVisibility;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SACCC,cAAc,IAAIC,kBAAkB,EACpCC,mBAAmB,EACnBC,mBAAmB,EACnBC,sBAAsB,QAChB,mBAAmB;AAC1B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AAEtD,OAAO,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E,uBAAwB,CAAC,EAAE+B,KAAM,CAAG;IAC9DH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX;AAEA,eAAe1B,cAAc"}
@@ -1,5 +1,4 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
@@ -7,23 +6,19 @@ import { Button } from '@wordpress/components';
7
6
  import { __, _x, sprintf } from '@wordpress/i18n';
8
7
  import { useDispatch, useSelect } from '@wordpress/data';
9
8
  import { store as editorStore } from '@wordpress/editor';
9
+
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
-
14
13
  import { store as editPostStore } from '../../../store';
15
-
16
14
  const SettingsHeader = ({
17
15
  sidebarName
18
16
  }) => {
19
17
  const {
20
18
  openGeneralSidebar
21
19
  } = useDispatch(editPostStore);
22
-
23
20
  const openDocumentSettings = () => openGeneralSidebar('edit-post/document');
24
-
25
21
  const openBlockSettings = () => openGeneralSidebar('edit-post/block');
26
-
27
22
  const {
28
23
  documentLabel,
29
24
  isTemplateMode
@@ -35,14 +30,17 @@ const SettingsHeader = ({
35
30
  isTemplateMode: select(editPostStore).isEditingTemplate()
36
31
  };
37
32
  }, []);
38
- const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
33
+ const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ?
34
+ // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
39
35
  [sprintf(__('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, ''];
40
- const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
41
- [__('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
36
+ const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ?
37
+ // translators: ARIA label for the Block Settings Sidebar tab, selected.
38
+ [__('Block (selected)'), 'is-active'] :
39
+ // translators: ARIA label for the Block Settings Sidebar tab, not selected.
42
40
  [__('Block'), ''];
43
41
  const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [__('Template (selected)'), 'is-active'] : [__('Template'), ''];
44
- /* Use a list so screen readers will announce how many tabs there are. */
45
42
 
43
+ /* Use a list so screen readers will announce how many tabs there are. */
46
44
  return createElement("ul", null, !isTemplateMode && createElement("li", null, createElement(Button, {
47
45
  onClick: openDocumentSettings,
48
46
  className: `edit-post-sidebar__panel-tab ${documentActiveClass}`,
@@ -56,12 +54,13 @@ const SettingsHeader = ({
56
54
  }, __('Template'))), createElement("li", null, createElement(Button, {
57
55
  onClick: openBlockSettings,
58
56
  className: `edit-post-sidebar__panel-tab ${blockActiveClass}`,
59
- "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
57
+ "aria-label": blockAriaLabel
58
+ // translators: Data label for the Block Settings Sidebar tab.
60
59
  ,
61
60
  "data-label": __('Block')
62
- }, // translators: Text label for the Block Settings Sidebar tab.
61
+ },
62
+ // translators: Text label for the Block Settings Sidebar tab.
63
63
  __('Block'))));
64
64
  };
65
-
66
65
  export default SettingsHeader;
67
66
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/settings-header/index.js"],"names":["Button","__","_x","sprintf","useDispatch","useSelect","store","editorStore","editPostStore","SettingsHeader","sidebarName","openGeneralSidebar","openDocumentSettings","openBlockSettings","documentLabel","isTemplateMode","select","postTypeLabel","getPostTypeLabel","isEditingTemplate","documentAriaLabel","documentActiveClass","blockAriaLabel","blockActiveClass","templateAriaLabel","templateActiveClass"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAl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,WAA/B,CADH,GAEG,CAAEA,EAAE,CAAE,UAAF,CAAJ,EAAoB,EAApB,CAHJ;AAKA;;AACA,SACC,0BACG,CAAEc,cAAF,IACD,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGH,oBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCS,mBAAqB,EAFnE;AAGC,kBAAaD,iBAHd;AAIC,kBAAaN;AAJd,KAMGA,aANH,CADD,CAFF,EAaGC,cAAc,IACf,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGH,oBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCa,mBAAqB,EAFnE;AAGC,kBAAaD,iBAHd;AAIC,kBAAavB,EAAE,CAAE,UAAF;AAJhB,KAMGA,EAAE,CAAE,UAAF,CANL,CADD,CAdF,EAyBC,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGY,iBADX;AAEC,IAAA,SAAS,EAAI,gCAAgCU,gBAAkB,EAFhE;AAGC,kBAAaD,cAHd,CAIC;AAJD;AAKC,kBAAarB,EAAE,CAAE,OAAF;AALhB,KAQE;AACAA,EAAAA,EAAE,CAAE,OAAF,CATJ,CADD,CAzBD,CADD;AA0CA,CA7ED;;AA+EA,eAAeQ,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { openGeneralSidebar } = useDispatch( editPostStore );\n\tconst openDocumentSettings = () =>\n\t\topenGeneralSidebar( 'edit-post/document' );\n\tconst openBlockSettings = () => openGeneralSidebar( 'edit-post/block' );\n\n\tconst { documentLabel, isTemplateMode } = useSelect( ( select ) => {\n\t\tconst postTypeLabel = select( editorStore ).getPostTypeLabel();\n\n\t\treturn {\n\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst [ documentAriaLabel, documentActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.\n\t\t\t [ sprintf( __( '%s (selected)' ), documentLabel ), 'is-active' ]\n\t\t\t: [ documentLabel, '' ];\n\n\tconst [ blockAriaLabel, blockActiveClass ] =\n\t\tsidebarName === 'edit-post/block'\n\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t [ __( 'Block (selected)' ), 'is-active' ]\n\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t [ __( 'Block' ), '' ];\n\n\tconst [ templateAriaLabel, templateActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? [ __( 'Template (selected)' ), 'is-active' ]\n\t\t\t: [ __( 'Template' ), '' ];\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t{ ! isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ documentActiveClass }` }\n\t\t\t\t\t\taria-label={ documentAriaLabel }\n\t\t\t\t\t\tdata-label={ documentLabel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ documentLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t{ isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ templateActiveClass }` }\n\t\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\t\tdata-label={ __( 'Template' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ blockActiveClass }` }\n\t\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\t\t// translators: Data label for the Block Settings Sidebar tab.\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{\n\t\t\t\t\t\t// translators: Text label for the Block Settings Sidebar tab.\n\t\t\t\t\t\t__( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"]}
1
+ {"version":3,"names":["Button","__","_x","sprintf","useDispatch","useSelect","store","editorStore","editPostStore","SettingsHeader","sidebarName","openGeneralSidebar","openDocumentSettings","openBlockSettings","documentLabel","isTemplateMode","select","postTypeLabel","getPostTypeLabel","isEditingTemplate","documentAriaLabel","documentActiveClass","blockAriaLabel","blockActiveClass","templateAriaLabel","templateActiveClass","createElement","onClick","className"],"sources":["@wordpress/edit-post/src/components/sidebar/settings-header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { openGeneralSidebar } = useDispatch( editPostStore );\n\tconst openDocumentSettings = () =>\n\t\topenGeneralSidebar( 'edit-post/document' );\n\tconst openBlockSettings = () => openGeneralSidebar( 'edit-post/block' );\n\n\tconst { documentLabel, isTemplateMode } = useSelect( ( select ) => {\n\t\tconst postTypeLabel = select( editorStore ).getPostTypeLabel();\n\n\t\treturn {\n\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst [ documentAriaLabel, documentActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.\n\t\t\t [ sprintf( __( '%s (selected)' ), documentLabel ), 'is-active' ]\n\t\t\t: [ documentLabel, '' ];\n\n\tconst [ blockAriaLabel, blockActiveClass ] =\n\t\tsidebarName === 'edit-post/block'\n\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t [ __( 'Block (selected)' ), 'is-active' ]\n\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t [ __( 'Block' ), '' ];\n\n\tconst [ templateAriaLabel, templateActiveClass ] =\n\t\tsidebarName === 'edit-post/document'\n\t\t\t? [ __( 'Template (selected)' ), 'is-active' ]\n\t\t\t: [ __( 'Template' ), '' ];\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t{ ! isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ documentActiveClass }` }\n\t\t\t\t\t\taria-label={ documentAriaLabel }\n\t\t\t\t\t\tdata-label={ documentLabel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ documentLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t{ isTemplateMode && (\n\t\t\t\t<li>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ openDocumentSettings }\n\t\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ templateActiveClass }` }\n\t\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\t\tdata-label={ __( 'Template' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</li>\n\t\t\t) }\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ `edit-post-sidebar__panel-tab ${ blockActiveClass }` }\n\t\t\t\t\taria-label={ blockAriaLabel }\n\t\t\t\t\t// translators: Data label for the Block Settings Sidebar tab.\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{\n\t\t\t\t\t\t// translators: Text label for the Block Settings Sidebar tab.\n\t\t\t\t\t\t__( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,aAAa,QAAQ,gBAAgB;AAEvD,MAAMC,cAAc,GAAGA,CAAE;EAAEC;AAAY,CAAC,KAAM;EAC7C,MAAM;IAAEC;EAAmB,CAAC,GAAGP,WAAW,CAAEI,aAAc,CAAC;EAC3D,MAAMI,oBAAoB,GAAGA,CAAA,KAC5BD,kBAAkB,CAAE,oBAAqB,CAAC;EAC3C,MAAME,iBAAiB,GAAGA,CAAA,KAAMF,kBAAkB,CAAE,iBAAkB,CAAC;EAEvE,MAAM;IAAEG,aAAa;IAAEC;EAAe,CAAC,GAAGV,SAAS,CAAIW,MAAM,IAAM;IAClE,MAAMC,aAAa,GAAGD,MAAM,CAAET,WAAY,CAAC,CAACW,gBAAgB,CAAC,CAAC;IAE9D,OAAO;M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