@wordpress/editor 14.17.1 → 14.19.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 (410) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -0
  3. package/build/bindings/pattern-overrides.js +0 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/bindings/post-meta.js +0 -1
  6. package/build/bindings/post-meta.js.map +1 -1
  7. package/build/components/autocompleters/user.js +0 -1
  8. package/build/components/autocompleters/user.js.map +1 -1
  9. package/build/components/block-removal-warnings/index.js +0 -1
  10. package/build/components/block-removal-warnings/index.js.map +1 -1
  11. package/build/components/block-settings-menu/content-only-settings-menu.js +0 -1
  12. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  13. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -1
  14. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  15. package/build/components/collab-sidebar/comments.js +0 -1
  16. package/build/components/collab-sidebar/comments.js.map +1 -1
  17. package/build/components/collab-sidebar/index.js +0 -1
  18. package/build/components/collab-sidebar/index.js.map +1 -1
  19. package/build/components/collab-sidebar/utils.js +0 -1
  20. package/build/components/collab-sidebar/utils.js.map +1 -1
  21. package/build/components/deprecated.js +0 -1
  22. package/build/components/deprecated.js.map +1 -1
  23. package/build/components/document-outline/index.js +16 -17
  24. package/build/components/document-outline/index.js.map +1 -1
  25. package/build/components/editor/index.js +9 -5
  26. package/build/components/editor/index.js.map +1 -1
  27. package/build/components/editor-help/index.native.js +0 -1
  28. package/build/components/editor-help/index.native.js.map +1 -1
  29. package/build/components/editor-notices/index.js +0 -1
  30. package/build/components/editor-notices/index.js.map +1 -1
  31. package/build/components/editor-snackbars/index.js +0 -1
  32. package/build/components/editor-snackbars/index.js.map +1 -1
  33. package/build/components/entities-saved-states/entity-record-item.js +2 -1
  34. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  35. package/build/components/entities-saved-states/entity-type-list.js +2 -2
  36. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  37. package/build/components/entities-saved-states/hooks/use-is-dirty.js +0 -1
  38. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  39. package/build/components/entities-saved-states/index.js +66 -43
  40. package/build/components/entities-saved-states/index.js.map +1 -1
  41. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  42. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  43. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -1
  44. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  45. package/build/components/list-view-sidebar/index.js +0 -1
  46. package/build/components/list-view-sidebar/index.js.map +1 -1
  47. package/build/components/local-autosave-monitor/index.js +0 -1
  48. package/build/components/local-autosave-monitor/index.js.map +1 -1
  49. package/build/components/mode-switcher/index.js +0 -1
  50. package/build/components/mode-switcher/index.js.map +1 -1
  51. package/build/components/page-attributes/parent.js +8 -5
  52. package/build/components/page-attributes/parent.js.map +1 -1
  53. package/build/components/post-actions/actions.js +0 -1
  54. package/build/components/post-actions/actions.js.map +1 -1
  55. package/build/components/post-actions/index.js +19 -29
  56. package/build/components/post-actions/index.js.map +1 -1
  57. package/build/components/post-author/check.js +3 -4
  58. package/build/components/post-author/check.js.map +1 -1
  59. package/build/components/post-author/combobox.js +4 -2
  60. package/build/components/post-author/combobox.js.map +1 -1
  61. package/build/components/post-author/hook.js +8 -5
  62. package/build/components/post-author/hook.js.map +1 -1
  63. package/build/components/post-card-panel/index.js +2 -2
  64. package/build/components/post-card-panel/index.js.map +1 -1
  65. package/build/components/post-featured-image/index.js +4 -2
  66. package/build/components/post-featured-image/index.js.map +1 -1
  67. package/build/components/post-fields/index.js +0 -1
  68. package/build/components/post-fields/index.js.map +1 -1
  69. package/build/components/post-format/index.js +0 -1
  70. package/build/components/post-format/index.js.map +1 -1
  71. package/build/components/post-format/panel.js +0 -1
  72. package/build/components/post-format/panel.js.map +1 -1
  73. package/build/components/post-publish-button/index.js +0 -1
  74. package/build/components/post-publish-button/index.js.map +1 -1
  75. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  76. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  77. package/build/components/post-publish-panel/maybe-post-format-panel.js +0 -1
  78. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  79. package/build/components/post-publish-panel/maybe-tags-panel.js +1 -1
  80. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  81. package/build/components/post-publish-panel/maybe-upload-media.js +0 -1
  82. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  83. package/build/components/post-publish-panel/media-util.js +0 -1
  84. package/build/components/post-publish-panel/media-util.js.map +1 -1
  85. package/build/components/post-saved-state/index.js +0 -1
  86. package/build/components/post-saved-state/index.js.map +1 -1
  87. package/build/components/post-schedule/index.js +0 -1
  88. package/build/components/post-schedule/index.js.map +1 -1
  89. package/build/components/post-taxonomies/check.js +1 -1
  90. package/build/components/post-taxonomies/check.js.map +1 -1
  91. package/build/components/post-taxonomies/flat-term-selector.js +2 -3
  92. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  93. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -3
  94. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  95. package/build/components/post-taxonomies/index.js +1 -2
  96. package/build/components/post-taxonomies/index.js.map +1 -1
  97. package/build/components/post-taxonomies/most-used-terms.js +0 -1
  98. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  99. package/build/components/post-template/block-theme.js +68 -48
  100. package/build/components/post-template/block-theme.js.map +1 -1
  101. package/build/components/post-template/classic-theme.js +30 -19
  102. package/build/components/post-template/classic-theme.js.map +1 -1
  103. package/build/components/post-template/create-new-template-modal.js +3 -1
  104. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  105. package/build/components/post-template/panel.js +3 -11
  106. package/build/components/post-template/panel.js.map +1 -1
  107. package/build/components/post-template/swap-template-button.js +0 -1
  108. package/build/components/post-template/swap-template-button.js.map +1 -1
  109. package/build/components/post-transform-panel/hooks.js +0 -1
  110. package/build/components/post-transform-panel/hooks.js.map +1 -1
  111. package/build/components/post-type-support-check/index.js +0 -1
  112. package/build/components/post-type-support-check/index.js.map +1 -1
  113. package/build/components/preferences-modal/block-visibility.js +2 -2
  114. package/build/components/preferences-modal/block-visibility.js.map +1 -1
  115. package/build/components/preferences-modal/index.js +1 -2
  116. package/build/components/preferences-modal/index.js.map +1 -1
  117. package/build/components/preview-dropdown/index.js +6 -3
  118. package/build/components/preview-dropdown/index.js.map +1 -1
  119. package/build/components/provider/disable-non-page-content-blocks.js +0 -1
  120. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  121. package/build/components/provider/index.js +19 -19
  122. package/build/components/provider/index.js.map +1 -1
  123. package/build/components/provider/index.native.js +0 -1
  124. package/build/components/provider/index.native.js.map +1 -1
  125. package/build/components/provider/use-block-editor-settings.js +0 -1
  126. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  127. package/build/components/sidebar/header.js +1 -1
  128. package/build/components/sidebar/header.js.map +1 -1
  129. package/build/components/sidebar/index.js +1 -2
  130. package/build/components/sidebar/index.js.map +1 -1
  131. package/build/components/start-page-options/index.js +148 -23
  132. package/build/components/start-page-options/index.js.map +1 -1
  133. package/build/components/start-template-options/index.js +0 -1
  134. package/build/components/start-template-options/index.js.map +1 -1
  135. package/build/components/template-part-content-panel/index.js +0 -1
  136. package/build/components/template-part-content-panel/index.js.map +1 -1
  137. package/build/components/theme-support-check/index.js +0 -1
  138. package/build/components/theme-support-check/index.js.map +1 -1
  139. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  140. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  141. package/build/components/visual-editor/use-select-nearest-editable-block.js +0 -1
  142. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  143. package/build/dataviews/store/private-actions.js +0 -1
  144. package/build/dataviews/store/private-actions.js.map +1 -1
  145. package/build/dataviews/store/reducer.js +0 -1
  146. package/build/dataviews/store/reducer.js.map +1 -1
  147. package/build/hooks/custom-sources-backwards-compatibility.js +0 -1
  148. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  149. package/build/hooks/pattern-overrides.js +0 -1
  150. package/build/hooks/pattern-overrides.js.map +1 -1
  151. package/build/store/actions.js +0 -1
  152. package/build/store/actions.js.map +1 -1
  153. package/build/store/private-actions.js +29 -3
  154. package/build/store/private-actions.js.map +1 -1
  155. package/build/store/private-selectors.js +44 -1
  156. package/build/store/private-selectors.js.map +1 -1
  157. package/build/store/reducer.js +0 -1
  158. package/build/store/reducer.js.map +1 -1
  159. package/build/store/reducer.native.js +0 -1
  160. package/build/store/reducer.native.js.map +1 -1
  161. package/build/store/selectors.js +0 -1
  162. package/build/store/selectors.js.map +1 -1
  163. package/build/utils/get-template-info.js +0 -1
  164. package/build/utils/get-template-info.js.map +1 -1
  165. package/build/utils/media-upload/index.js +5 -2
  166. package/build/utils/media-upload/index.js.map +1 -1
  167. package/build/utils/terms.js +0 -1
  168. package/build/utils/terms.js.map +1 -1
  169. package/build-module/bindings/pattern-overrides.js +0 -1
  170. package/build-module/bindings/pattern-overrides.js.map +1 -1
  171. package/build-module/bindings/post-meta.js +0 -1
  172. package/build-module/bindings/post-meta.js.map +1 -1
  173. package/build-module/components/autocompleters/user.js +0 -1
  174. package/build-module/components/autocompleters/user.js.map +1 -1
  175. package/build-module/components/block-removal-warnings/index.js +0 -1
  176. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  177. package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -1
  178. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  179. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -1
  180. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  181. package/build-module/components/collab-sidebar/comments.js +0 -1
  182. package/build-module/components/collab-sidebar/comments.js.map +1 -1
  183. package/build-module/components/collab-sidebar/index.js +0 -1
  184. package/build-module/components/collab-sidebar/index.js.map +1 -1
  185. package/build-module/components/collab-sidebar/utils.js +0 -1
  186. package/build-module/components/collab-sidebar/utils.js.map +1 -1
  187. package/build-module/components/deprecated.js +0 -1
  188. package/build-module/components/deprecated.js.map +1 -1
  189. package/build-module/components/document-outline/index.js +17 -18
  190. package/build-module/components/document-outline/index.js.map +1 -1
  191. package/build-module/components/editor/index.js +9 -5
  192. package/build-module/components/editor/index.js.map +1 -1
  193. package/build-module/components/editor-help/index.native.js +0 -1
  194. package/build-module/components/editor-help/index.native.js.map +1 -1
  195. package/build-module/components/editor-notices/index.js +0 -1
  196. package/build-module/components/editor-notices/index.js.map +1 -1
  197. package/build-module/components/editor-snackbars/index.js +0 -1
  198. package/build-module/components/editor-snackbars/index.js.map +1 -1
  199. package/build-module/components/entities-saved-states/entity-record-item.js +2 -1
  200. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  201. package/build-module/components/entities-saved-states/entity-type-list.js +2 -2
  202. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  203. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +0 -1
  204. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  205. package/build-module/components/entities-saved-states/index.js +67 -44
  206. package/build-module/components/entities-saved-states/index.js.map +1 -1
  207. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  208. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  209. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -1
  210. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  211. package/build-module/components/list-view-sidebar/index.js +0 -1
  212. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  213. package/build-module/components/local-autosave-monitor/index.js +0 -1
  214. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  215. package/build-module/components/mode-switcher/index.js +0 -1
  216. package/build-module/components/mode-switcher/index.js.map +1 -1
  217. package/build-module/components/page-attributes/parent.js +8 -5
  218. package/build-module/components/page-attributes/parent.js.map +1 -1
  219. package/build-module/components/post-actions/actions.js +0 -1
  220. package/build-module/components/post-actions/actions.js.map +1 -1
  221. package/build-module/components/post-actions/index.js +19 -29
  222. package/build-module/components/post-actions/index.js.map +1 -1
  223. package/build-module/components/post-author/check.js +3 -4
  224. package/build-module/components/post-author/check.js.map +1 -1
  225. package/build-module/components/post-author/combobox.js +4 -2
  226. package/build-module/components/post-author/combobox.js.map +1 -1
  227. package/build-module/components/post-author/hook.js +8 -5
  228. package/build-module/components/post-author/hook.js.map +1 -1
  229. package/build-module/components/post-card-panel/index.js +2 -2
  230. package/build-module/components/post-card-panel/index.js.map +1 -1
  231. package/build-module/components/post-featured-image/index.js +4 -2
  232. package/build-module/components/post-featured-image/index.js.map +1 -1
  233. package/build-module/components/post-fields/index.js +0 -1
  234. package/build-module/components/post-fields/index.js.map +1 -1
  235. package/build-module/components/post-format/index.js +0 -1
  236. package/build-module/components/post-format/index.js.map +1 -1
  237. package/build-module/components/post-format/panel.js +0 -1
  238. package/build-module/components/post-format/panel.js.map +1 -1
  239. package/build-module/components/post-publish-button/index.js +0 -1
  240. package/build-module/components/post-publish-button/index.js.map +1 -1
  241. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  242. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  243. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +0 -1
  244. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  245. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
  246. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  247. package/build-module/components/post-publish-panel/maybe-upload-media.js +0 -1
  248. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  249. package/build-module/components/post-publish-panel/media-util.js +0 -1
  250. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  251. package/build-module/components/post-saved-state/index.js +0 -1
  252. package/build-module/components/post-saved-state/index.js.map +1 -1
  253. package/build-module/components/post-schedule/index.js +0 -1
  254. package/build-module/components/post-schedule/index.js.map +1 -1
  255. package/build-module/components/post-taxonomies/check.js +1 -1
  256. package/build-module/components/post-taxonomies/check.js.map +1 -1
  257. package/build-module/components/post-taxonomies/flat-term-selector.js +2 -3
  258. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  259. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -3
  260. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  261. package/build-module/components/post-taxonomies/index.js +1 -2
  262. package/build-module/components/post-taxonomies/index.js.map +1 -1
  263. package/build-module/components/post-taxonomies/most-used-terms.js +0 -1
  264. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  265. package/build-module/components/post-template/block-theme.js +68 -48
  266. package/build-module/components/post-template/block-theme.js.map +1 -1
  267. package/build-module/components/post-template/classic-theme.js +30 -19
  268. package/build-module/components/post-template/classic-theme.js.map +1 -1
  269. package/build-module/components/post-template/create-new-template-modal.js +3 -1
  270. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  271. package/build-module/components/post-template/panel.js +3 -11
  272. package/build-module/components/post-template/panel.js.map +1 -1
  273. package/build-module/components/post-template/swap-template-button.js +0 -1
  274. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  275. package/build-module/components/post-transform-panel/hooks.js +0 -1
  276. package/build-module/components/post-transform-panel/hooks.js.map +1 -1
  277. package/build-module/components/post-type-support-check/index.js +0 -1
  278. package/build-module/components/post-type-support-check/index.js.map +1 -1
  279. package/build-module/components/preferences-modal/block-visibility.js +2 -2
  280. package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
  281. package/build-module/components/preferences-modal/index.js +1 -2
  282. package/build-module/components/preferences-modal/index.js.map +1 -1
  283. package/build-module/components/preview-dropdown/index.js +6 -3
  284. package/build-module/components/preview-dropdown/index.js.map +1 -1
  285. package/build-module/components/provider/disable-non-page-content-blocks.js +0 -1
  286. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  287. package/build-module/components/provider/index.js +19 -19
  288. package/build-module/components/provider/index.js.map +1 -1
  289. package/build-module/components/provider/index.native.js +0 -1
  290. package/build-module/components/provider/index.native.js.map +1 -1
  291. package/build-module/components/provider/use-block-editor-settings.js +0 -1
  292. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  293. package/build-module/components/sidebar/header.js +1 -1
  294. package/build-module/components/sidebar/header.js.map +1 -1
  295. package/build-module/components/sidebar/index.js +1 -2
  296. package/build-module/components/sidebar/index.js.map +1 -1
  297. package/build-module/components/start-page-options/index.js +148 -24
  298. package/build-module/components/start-page-options/index.js.map +1 -1
  299. package/build-module/components/start-template-options/index.js +0 -1
  300. package/build-module/components/start-template-options/index.js.map +1 -1
  301. package/build-module/components/template-part-content-panel/index.js +0 -1
  302. package/build-module/components/template-part-content-panel/index.js.map +1 -1
  303. package/build-module/components/theme-support-check/index.js +0 -1
  304. package/build-module/components/theme-support-check/index.js.map +1 -1
  305. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  306. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  307. package/build-module/components/visual-editor/use-select-nearest-editable-block.js +0 -1
  308. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  309. package/build-module/dataviews/store/private-actions.js +0 -1
  310. package/build-module/dataviews/store/private-actions.js.map +1 -1
  311. package/build-module/dataviews/store/reducer.js +0 -1
  312. package/build-module/dataviews/store/reducer.js.map +1 -1
  313. package/build-module/hooks/custom-sources-backwards-compatibility.js +0 -1
  314. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  315. package/build-module/hooks/pattern-overrides.js +0 -1
  316. package/build-module/hooks/pattern-overrides.js.map +1 -1
  317. package/build-module/store/actions.js +0 -1
  318. package/build-module/store/actions.js.map +1 -1
  319. package/build-module/store/private-actions.js +25 -1
  320. package/build-module/store/private-actions.js.map +1 -1
  321. package/build-module/store/private-selectors.js +43 -1
  322. package/build-module/store/private-selectors.js.map +1 -1
  323. package/build-module/store/reducer.js +0 -1
  324. package/build-module/store/reducer.js.map +1 -1
  325. package/build-module/store/reducer.native.js +0 -1
  326. package/build-module/store/reducer.native.js.map +1 -1
  327. package/build-module/store/selectors.js +0 -1
  328. package/build-module/store/selectors.js.map +1 -1
  329. package/build-module/utils/get-template-info.js +0 -1
  330. package/build-module/utils/get-template-info.js.map +1 -1
  331. package/build-module/utils/media-upload/index.js +5 -2
  332. package/build-module/utils/media-upload/index.js.map +1 -1
  333. package/build-module/utils/terms.js +0 -1
  334. package/build-module/utils/terms.js.map +1 -1
  335. package/build-style/style-rtl.css +49 -8
  336. package/build-style/style.css +49 -8
  337. package/build-types/components/document-outline/index.d.ts.map +1 -1
  338. package/build-types/components/editor/index.d.ts.map +1 -1
  339. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
  340. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  341. package/build-types/components/entities-saved-states/index.d.ts +6 -2
  342. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  343. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  344. package/build-types/components/post-actions/index.d.ts.map +1 -1
  345. package/build-types/components/post-author/check.d.ts.map +1 -1
  346. package/build-types/components/post-author/combobox.d.ts.map +1 -1
  347. package/build-types/components/post-author/hook.d.ts +1 -0
  348. package/build-types/components/post-author/hook.d.ts.map +1 -1
  349. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  350. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  351. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
  352. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  353. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  354. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  355. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  356. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  357. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  358. package/build-types/components/post-template/hooks.d.ts +1 -1
  359. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  360. package/build-types/components/post-template/panel.d.ts.map +1 -1
  361. package/build-types/components/preferences-modal/block-visibility.d.ts.map +1 -1
  362. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  363. package/build-types/components/provider/index.d.ts.map +1 -1
  364. package/build-types/components/start-page-options/index.d.ts +2 -1
  365. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  366. package/build-types/store/private-actions.d.ts +4 -0
  367. package/build-types/store/private-actions.d.ts.map +1 -1
  368. package/build-types/store/private-selectors.d.ts +13 -0
  369. package/build-types/store/private-selectors.d.ts.map +1 -1
  370. package/build-types/utils/media-upload/index.d.ts +3 -1
  371. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  372. package/package.json +37 -37
  373. package/src/components/document-outline/index.js +22 -16
  374. package/src/components/editor/index.js +24 -13
  375. package/src/components/entities-saved-states/entity-record-item.js +1 -0
  376. package/src/components/entities-saved-states/entity-type-list.js +6 -2
  377. package/src/components/entities-saved-states/index.js +98 -58
  378. package/src/components/entities-saved-states/style.scss +40 -5
  379. package/src/components/page-attributes/parent.js +55 -38
  380. package/src/components/post-actions/index.js +19 -37
  381. package/src/components/post-author/check.js +7 -4
  382. package/src/components/post-author/combobox.js +3 -1
  383. package/src/components/post-author/hook.js +4 -3
  384. package/src/components/post-card-panel/index.js +7 -5
  385. package/src/components/post-featured-image/index.js +2 -0
  386. package/src/components/post-publish-panel/maybe-category-panel.js +6 -2
  387. package/src/components/post-publish-panel/maybe-tags-panel.js +5 -1
  388. package/src/components/post-taxonomies/check.js +5 -3
  389. package/src/components/post-taxonomies/flat-term-selector.js +2 -2
  390. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  391. package/src/components/post-taxonomies/index.js +5 -1
  392. package/src/components/post-taxonomies/test/index.js +32 -18
  393. package/src/components/post-template/block-theme.js +76 -56
  394. package/src/components/post-template/classic-theme.js +31 -15
  395. package/src/components/post-template/create-new-template-modal.js +1 -0
  396. package/src/components/post-template/panel.js +2 -12
  397. package/src/components/post-text-editor/style.scss +0 -2
  398. package/src/components/preferences-modal/block-visibility.js +2 -1
  399. package/src/components/preferences-modal/index.js +1 -1
  400. package/src/components/preview-dropdown/index.js +8 -6
  401. package/src/components/provider/index.js +21 -30
  402. package/src/components/sidebar/header.js +1 -1
  403. package/src/components/sidebar/index.js +1 -1
  404. package/src/components/start-page-options/index.js +149 -23
  405. package/src/components/start-page-options/style.scss +27 -0
  406. package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
  407. package/src/store/private-actions.js +33 -0
  408. package/src/store/private-selectors.js +57 -0
  409. package/src/utils/media-upload/index.js +3 -0
  410. package/tsconfig.tsbuildinfo +1 -1
@@ -8,11 +8,13 @@ exports.default = BlockThemeControl;
8
8
  var _data = require("@wordpress/data");
9
9
  var _htmlEntities = require("@wordpress/html-entities");
10
10
  var _components = require("@wordpress/components");
11
+ var _element = require("@wordpress/element");
11
12
  var _i18n = require("@wordpress/i18n");
12
13
  var _coreData = require("@wordpress/core-data");
13
14
  var _icons = require("@wordpress/icons");
14
15
  var _notices = require("@wordpress/notices");
15
16
  var _preferences = require("@wordpress/preferences");
17
+ var _postPanelRow = _interopRequireDefault(require("../post-panel-row"));
16
18
  var _store = require("../../store");
17
19
  var _swapTemplateButton = _interopRequireDefault(require("./swap-template-button"));
18
20
  var _resetDefaultTemplate = _interopRequireDefault(require("./reset-default-template"));
@@ -27,10 +29,10 @@ var _jsxRuntime = require("react/jsx-runtime");
27
29
  * Internal dependencies
28
30
  */
29
31
 
30
- const POPOVER_PROPS = {
31
- className: 'editor-post-template__dropdown',
32
- placement: 'bottom-start'
33
- };
32
+ /**
33
+ * Internal dependencies
34
+ */
35
+
34
36
  function BlockThemeControl({
35
37
  id
36
38
  }) {
@@ -63,12 +65,24 @@ function BlockThemeControl({
63
65
  createSuccessNotice
64
66
  } = (0, _data.useDispatch)(_notices.store);
65
67
  const {
66
- setRenderingMode
67
- } = (0, _data.useDispatch)(_store.store);
68
+ setRenderingMode,
69
+ setDefaultRenderingMode
70
+ } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
68
71
  const canCreateTemplate = (0, _data.useSelect)(select => !!select(_coreData.store).canUser('create', {
69
72
  kind: 'postType',
70
73
  name: 'wp_template'
71
74
  }), []);
75
+ const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null);
76
+ // Memoize popoverProps to avoid returning a new object every time.
77
+ const popoverProps = (0, _element.useMemo)(() => ({
78
+ // Anchor the popover to the middle of the entire row so that it doesn't
79
+ // move around when the label changes.
80
+ anchor: popoverAnchor,
81
+ className: 'editor-post-template__dropdown',
82
+ placement: 'left-start',
83
+ offset: 36,
84
+ shift: true
85
+ }), [popoverAnchor]);
72
86
  if (!hasResolved) {
73
87
  return null;
74
88
  }
@@ -87,49 +101,55 @@ function BlockThemeControl({
87
101
  });
88
102
  }
89
103
  };
90
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
91
- popoverProps: POPOVER_PROPS,
92
- focusOnMount: true,
93
- toggleProps: {
94
- size: 'compact',
95
- variant: 'tertiary',
96
- tooltipPosition: 'middle left'
97
- },
98
- label: (0, _i18n.__)('Template options'),
99
- text: (0, _htmlEntities.decodeEntities)(template.title),
100
- icon: null,
101
- children: ({
102
- onClose
103
- }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
104
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.MenuGroup, {
105
- children: [canCreateTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
106
- onClick: () => {
107
- onNavigateToEntityRecord({
108
- postId: template.id,
109
- postType: 'wp_template'
110
- });
111
- onClose();
112
- mayShowTemplateEditNotice();
113
- },
114
- children: (0, _i18n.__)('Edit template')
115
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_swapTemplateButton.default, {
116
- onClick: onClose
117
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_resetDefaultTemplate.default, {
118
- onClick: onClose
119
- }), canCreateTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_createNewTemplate.default, {
120
- onClick: onClose
104
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPanelRow.default, {
105
+ label: (0, _i18n.__)('Template'),
106
+ ref: setPopoverAnchor,
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, {
108
+ popoverProps: popoverProps,
109
+ focusOnMount: true,
110
+ toggleProps: {
111
+ size: 'compact',
112
+ variant: 'tertiary',
113
+ tooltipPosition: 'middle left'
114
+ },
115
+ label: (0, _i18n.__)('Template options'),
116
+ text: (0, _htmlEntities.decodeEntities)(template.title),
117
+ icon: null,
118
+ children: ({
119
+ onClose
120
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
121
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.MenuGroup, {
122
+ children: [canCreateTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
123
+ onClick: () => {
124
+ onNavigateToEntityRecord({
125
+ postId: template.id,
126
+ postType: 'wp_template'
127
+ });
128
+ onClose();
129
+ mayShowTemplateEditNotice();
130
+ },
131
+ children: (0, _i18n.__)('Edit template')
132
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_swapTemplateButton.default, {
133
+ onClick: onClose
134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_resetDefaultTemplate.default, {
135
+ onClick: onClose
136
+ }), canCreateTemplate && /*#__PURE__*/(0, _jsxRuntime.jsx)(_createNewTemplate.default, {
137
+ onClick: onClose
138
+ })]
139
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuGroup, {
140
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
141
+ icon: !isTemplateHidden ? _icons.check : undefined,
142
+ isSelected: !isTemplateHidden,
143
+ role: "menuitemcheckbox",
144
+ onClick: () => {
145
+ const newRenderingMode = isTemplateHidden ? 'template-locked' : 'post-only';
146
+ setRenderingMode(newRenderingMode);
147
+ setDefaultRenderingMode(newRenderingMode);
148
+ },
149
+ children: (0, _i18n.__)('Show template')
150
+ })
121
151
  })]
122
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuGroup, {
123
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
124
- icon: !isTemplateHidden ? _icons.check : undefined,
125
- isSelected: !isTemplateHidden,
126
- role: "menuitemcheckbox",
127
- onClick: () => {
128
- setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only');
129
- },
130
- children: (0, _i18n.__)('Show template')
131
- })
132
- })]
152
+ })
133
153
  })
134
154
  });
135
155
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_htmlEntities","_components","_i18n","_coreData","_icons","_notices","_preferences","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","get","getPreference","preferencesStore","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","canCreateTemplate","coreStore","canUser","kind","name","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","jsx","DropdownMenu","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","children","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","default","check","isSelected","role"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\n\tconst mayShowTemplateEditNotice = () => {\n\t\tif ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', actions: notificationAction }\n\t\t\t);\n\t\t}\n\t};\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tsize: 'compact',\n\t\t\t\tvariant: 'tertiary',\n\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t} }\n\t\t\tlabel={ __( 'Template options' ) }\n\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\ticon={ null }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tmayShowTemplateEditNotice();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\t\tisTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,qBA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_element","_i18n","_coreData","_icons","_notices","_preferences","_postPanelRow","_interopRequireDefault","_store","_swapTemplateButton","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","_jsxRuntime","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","get","getPreference","preferencesStore","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","setDefaultRenderingMode","canCreateTemplate","coreStore","canUser","kind","name","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","className","placement","offset","shift","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","jsx","default","ref","children","DropdownMenu","focusOnMount","toggleProps","size","variant","tooltipPosition","text","decodeEntities","title","icon","onClose","jsxs","Fragment","MenuGroup","MenuItem","postId","postType","check","isSelected","role","newRenderingMode"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\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\tclassName: 'editor-post-template__dropdown',\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\n\tconst mayShowTemplateEditNotice = () => {\n\t\tif ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', actions: notificationAction }\n\t\t\t);\n\t\t}\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<DropdownMenu\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t\tvariant: 'tertiary',\n\t\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Template options' ) }\n\t\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\t\ticon={ null }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\tmayShowTemplateEditNotice();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,aAAA,GAAAC,sBAAA,CAAAV,OAAA;AAKA,IAAAW,MAAA,GAAA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IAAAjE,WAAA,CAAAmD,GAAA,EAACjE,WAAA,CAAAkF,SAAS;UAAAd,QAAA,eACT,IAAAtD,WAAA,CAAAmD,GAAA,EAACjE,WAAA,CAAAmF,QAAQ;YACRL,IAAI,EAAG,CAAE7D,gBAAgB,GAAGqE,YAAK,GAAGzB,SAAW;YAC/C0B,UAAU,EAAG,CAAEtE,gBAAkB;YACjCuE,IAAI,EAAC,kBAAkB;YACvB7B,OAAO,EAAGA,CAAA,KAAM;cACf,MAAM8B,gBAAgB,GAAGxE,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;cACdsB,gBAAgB,CAAEkD,gBAAiB,CAAC;cACpCjD,uBAAuB,CAAEiD,gBAAiB,CAAC;YAC5C,CAAG;YAAArB,QAAA,EAED,IAAAV,QAAE,EAAE,eAAgB;UAAC,CACd;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACF,CAAC;AAEjB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -17,6 +16,7 @@ var _notices = require("@wordpress/notices");
17
16
  var _store = require("../../store");
18
17
  var _createNewTemplateModal = _interopRequireDefault(require("./create-new-template-modal"));
19
18
  var _hooks = require("./hooks");
19
+ var _postPanelRow = _interopRequireDefault(require("../post-panel-row"));
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
21
  /**
22
22
  * WordPress dependencies
@@ -26,10 +26,6 @@ var _jsxRuntime = require("react/jsx-runtime");
26
26
  * Internal dependencies
27
27
  */
28
28
 
29
- const POPOVER_PROPS = {
30
- className: 'editor-post-template__dropdown',
31
- placement: 'bottom-start'
32
- };
33
29
  function PostTemplateToggle({
34
30
  isOpen,
35
31
  onClick
@@ -176,20 +172,35 @@ function PostTemplateDropdownContent({
176
172
  });
177
173
  }
178
174
  function ClassicThemeControl() {
179
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
180
- popoverProps: POPOVER_PROPS,
181
- focusOnMount: true,
182
- renderToggle: ({
183
- isOpen,
184
- onToggle
185
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PostTemplateToggle, {
186
- isOpen: isOpen,
187
- onClick: onToggle
188
- }),
189
- renderContent: ({
190
- onClose
191
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PostTemplateDropdownContent, {
192
- onClose: onClose
175
+ const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null);
176
+ // Memoize popoverProps to avoid returning a new object every time.
177
+ const popoverProps = (0, _element.useMemo)(() => ({
178
+ // Anchor the popover to the middle of the entire row so that it doesn't
179
+ // move around when the label changes.
180
+ anchor: popoverAnchor,
181
+ className: 'editor-post-template__dropdown',
182
+ placement: 'left-start',
183
+ offset: 36,
184
+ shift: true
185
+ }), [popoverAnchor]);
186
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPanelRow.default, {
187
+ label: (0, _i18n.__)('Template'),
188
+ ref: setPopoverAnchor,
189
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Dropdown, {
190
+ popoverProps: popoverProps,
191
+ focusOnMount: true,
192
+ renderToggle: ({
193
+ isOpen,
194
+ onToggle
195
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PostTemplateToggle, {
196
+ isOpen: isOpen,
197
+ onClick: onToggle
198
+ }),
199
+ renderContent: ({
200
+ onClose
201
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PostTemplateDropdownContent, {
202
+ onClose: onClose
203
+ })
193
204
  })
194
205
  });
195
206
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","kind","name","getCurrentTemplateId","title","slug","jsx","Button","__next40pxDefaultSize","variant","__","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","jsxs","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","default","ClassicThemeControl","Dropdown","popoverProps","focusOnMount","renderToggle","onToggle","renderContent","_default","exports"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\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', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\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\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {React.ReactNode} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\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 { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\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{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\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__next40pxDefaultSize\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 && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\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<CreateNewTemplateModal\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\nfunction ClassicThemeControl() {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<PostTemplateToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {React.ReactNode} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAA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AAA5F,WAAA,CAAAwB,GAAA,EAACpB,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGsF;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAE9D;IAAQ,CAAC,kBAC5B,IAAA/B,WAAA,CAAAwB,GAAA,EAACM,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAA+D,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAOeC,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","_postPanelRow","_jsxRuntime","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","kind","name","getCurrentTemplateId","title","slug","jsx","Button","__next40pxDefaultSize","variant","__","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","jsxs","className","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","default","ClassicThemeControl","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","Dropdown","focusOnMount","renderToggle","onToggle","renderContent","_default","exports"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\nimport PostPanelRow from '../post-panel-row';\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', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\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\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {React.ReactNode} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\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 { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\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{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\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__next40pxDefaultSize\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 && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\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<CreateNewTemplateModal\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\nfunction ClassicThemeControl() {\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\tclassName: 'editor-post-template__dropdown',\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\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<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {React.ReactNode} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAK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IAAA9B,QAAE,EAAE,UAAW,CAAG;IAACoE,GAAG,EAAGN,gBAAkB;IAAA7D,QAAA,eAChE,IAAA1B,WAAA,CAAAqB,GAAA,EAACjC,WAAA,CAAA0G,QAAQ;MACRN,YAAY,EAAGA,YAAc;MAC7BO,YAAY;MACZC,YAAY,EAAGA,CAAE;QAAE9F,MAAM;QAAE+F;MAAS,CAAC,kBACpC,IAAAjG,WAAA,CAAAqB,GAAA,EAACpB,kBAAkB;QAClBC,MAAM,EAAGA,MAAQ;QACjBC,OAAO,EAAG8F;MAAU,CACpB,CACC;MACHC,aAAa,EAAGA,CAAE;QAAEtE;MAAQ,CAAC,kBAC5B,IAAA5B,WAAA,CAAAqB,GAAA,EAACM,2BAA2B;QAACC,OAAO,EAAGA;MAAS,CAAE;IAChD,CACH;EAAC,CACW,CAAC;AAEjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAAuE,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAOeC,mBAAmB","ignoreList":[]}
@@ -100,7 +100,9 @@ function CreateNewTemplateModal({
100
100
  onChange: setTitle,
101
101
  placeholder: DEFAULT_TITLE,
102
102
  disabled: isBusy,
103
- help: (0, _i18n.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
103
+ help: (0, _i18n.__)(
104
+ // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
105
+ 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
104
106
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
105
107
  justify: "right",
106
108
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","_jsxRuntime","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","getTemplateId","createTemplate","unlock","useDispatch","title","setTitle","useState","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","serialize","createBlock","tagName","layout","inherit","newTemplate","slug","cleanForSlug","content","postId","id","postType","jsx","Modal","onRequestClose","focusOnMount","size","children","className","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAA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EAAC,mCAAmC;MAC7CC,QAAQ,EAAGvB,MAAQ;MAAAqB,QAAA,eAEnB,IAAA3C,WAAA,CAAA8C,IAAA,EAACnD,WAAA,CAAAoD,oBAAM;QAACC,OAAO,EAAC,GAAG;QAAAL,QAAA,gBAClB,IAAA3C,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAsD,WAAW;UACXC,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG,IAAAlD,QAAE,EAAE,MAAO,CAAG;UACtBmD,KAAK,EAAGrC,KAAO;UACfsC,QAAQ,EAAGrC,QAAU;UACrBsC,WAAW,EAAGtD,aAAe;UAC7BuD,QAAQ,EAAGrC,MAAQ;UACnBsC,IAAI,EAAG,IAAAvD,QAAE,EACR,iHACD;QAAG,CACH,CAAC,eACF,IAAAF,WAAA,CAAA8C,IAAA,EAACnD,WAAA,CAAA+D,oBAAM;UAACC,OAAO,EAAC,OAAO;UAAAhB,QAAA,gBACtB,IAAA3C,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGzC,MAAQ;YAAAsB,QAAA,EAEhB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC,eAET,IAAAF,WAAA,CAAAsC,GAAA,EAAC3C,WAAA,CAAAiE,MAAM;YACNV,qBAAqB;YACrBW,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACb5C,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAwB,QAAA,EAEtB,IAAAzC,QAAE,EAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","_jsxRuntime","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","getTemplateId","createTemplate","unlock","useDispatch","title","setTitle","useState","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","serialize","createBlock","tagName","layout","inherit","newTemplate","slug","cleanForSlug","content","postId","id","postType","jsx","Modal","onRequestClose","focusOnMount","size","children","className","onSubmit","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,I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 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = PostTemplatePanel;
8
8
  var _data = require("@wordpress/data");
9
- var _i18n = require("@wordpress/i18n");
10
9
  var _coreData = require("@wordpress/core-data");
11
10
  var _store = require("../../store");
12
11
  var _classicTheme = _interopRequireDefault(require("./classic-theme"));
13
12
  var _blockTheme = _interopRequireDefault(require("./block-theme"));
14
- var _postPanelRow = _interopRequireDefault(require("../post-panel-row"));
15
13
  var _jsxRuntime = require("react/jsx-runtime");
16
14
  /**
17
15
  * WordPress dependencies
@@ -68,17 +66,11 @@ var _jsxRuntime = require("react/jsx-runtime");
68
66
  })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
69
67
  }, []);
70
68
  if ((!isBlockTheme || !canViewTemplates) && isVisible) {
71
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPanelRow.default, {
72
- label: (0, _i18n.__)('Template'),
73
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_classicTheme.default, {})
74
- });
69
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_classicTheme.default, {});
75
70
  }
76
71
  if (isBlockTheme && !!templateId) {
77
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_postPanelRow.default, {
78
- label: (0, _i18n.__)('Template'),
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockTheme.default, {
80
- id: templateId
81
- })
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockTheme.default, {
73
+ id: templateId
82
74
  });
83
75
  }
84
76
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_coreData","_store","_classicTheme","_interopRequireDefault","_blockTheme","_postPanelRow","_jsxRuntime","PostTemplatePanel","templateId","isBlockTheme","useSelect","select","getCurrentTemplateId","getEditorSettings","editorStore","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","jsx","default","label","__","children","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {React.ReactNode} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\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', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( coreStore ).canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<ClassicThemeControl />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<BlockThemeControl id={ templateId } />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\treturn null;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,WAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,aAAA,GAAAF,sBAAA,CAAAL,OAAA;AAA6C,IAAAQ,WAAA,GAAAR,OAAA;AAb7C;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA,GACe,SAASS,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,UAAU;IAAEC;EAAa,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC7D,MAAM;MAAEC,oBAAoB;MAAEC;IAAkB,CAAC,GAChDF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNN,UAAU,EAAEI,oBAAoB,CAAC,CAAC;MAClCH,YAAY,EAAEI,iBAAiB,CAAC,CAAC,CAACE;IACnC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,SAAS,GAAG,IAAAN,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAM,eAAA;IAC1C,MAAMC,YAAY,GAAGP,MAAM,CAAEG,YAAY,CAAC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AAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;MAAAC,QAAA,eACvC,IAAAnC,WAAA,CAAA+B,GAAA,EAACnC,aAAA,CAAAoC,OAAmB,IAAE;IAAC,CACV,CAAC;EAEjB;EAEA,IAAK7B,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBACC,IAAAF,WAAA,CAAA+B,GAAA,EAAChC,aAAA,CAAAiC,OAAY;MAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW,CAAG;MAAAC,QAAA,eACvC,IAAAnC,WAAA,CAAA+B,GAAA,EAACjC,WAAA,CAAAkC,OAAiB;QAACI,EAAE,EAAGlC;MAAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_store","_classicTheme","_interopRequireDefault","_blockTheme","_jsxRuntime","PostTemplatePanel","templateId","isBlockTheme","useSelect","select","getCurrentTemplateId","getEditorSettings","editorStore","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","jsx","default","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {React.ReactNode} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\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', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( coreStore ).canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn <ClassicThemeControl />;\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n\t\treturn <BlockThemeControl id={ templateId } />;\n\t}\n\treturn null;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAA8C,IAAAM,WAAA,GAAAN,OAAA;AAX9C;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,GACe,SAASO,iBAAiBA,C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,MAAMI,gBAAgB,GAAG,IAAAzB,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAyB,gBAAA;IACjD,QAAAA,gBAAA,GACCzB,MAAM,CAAEU,eAAU,CAAC,CAACW,OAAO,CAAE,MAAM,EAAE;MACpCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,KAAK;EAEd,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAE,CAAE3B,YAAY,IAAI,CAAE0B,gBAAgB,KAAMnB,SAAS,EAAG;IAC5D,oBAAO,IAAAV,WAAA,CAAA+B,GAAA,EAAClC,aAAA,CAAAmC,OAAmB,IAAE,CAAC;EAC/B;EAEA,IAAK7B,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBAAO,IAAAF,WAAA,CAAA+B,GAAA,EAAChC,WAAA,CAAAiC,OAAiB;MAACC,EAAE,EAAG/B;IAAY,CAAE,CAAC;EAC/C;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_htmlEntities","_blockEditor","_components","_i18n","_data","_coreData","_blocks","_hooks","_jsxRuntime","SwapTemplateButton","onClick","showModal","setShowModal","useState","postType","postId","useEditedPostContext","availableTemplates","useAvailableTemplates","editEntityRecord","useDispatch","coreStore","length","onTemplateSelect","template","name","undoIgnore","jsxs","Fragment","children","jsx","MenuItem","__","Modal","title","onRequestClose","overlayClassName","isFullScreen","className","TemplatesList","onSelect","templatesAsPatterns","useMemo","map","slug","blocks","parse","content","raw","decodeEntities","rendered","id","__experimentalBlockPatternsList","label","blockPatterns","onClickPattern"],"sources":["@wordpress/editor/src/components/post-template/swap-template-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { MenuItem, Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useAvailableTemplates, useEditedPostContext } from './hooks';\n\nexport default function SwapTemplateButton( { onClick } ) {\n\tconst [ showModal, setShowModal ] = useState( false );\n\tconst { postType, postId } = useEditedPostContext();\n\tconst availableTemplates = useAvailableTemplates( postType );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tif ( ! availableTemplates?.length ) {\n\t\treturn null;\n\t}\n\tconst onTemplateSelect = async ( template ) => {\n\t\teditEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t\t{ template: template.name },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t\tsetShowModal( false ); // Close the template suggestions modal first.\n\t\tonClick();\n\t};\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setShowModal( true ) }>\n\t\t\t\t{ __( 'Change template' ) }\n\t\t\t</MenuItem>\n\t\t\t{ showModal && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Choose a template' ) }\n\t\t\t\t\tonRequestClose={ () => setShowModal( false ) }\n\t\t\t\t\toverlayClassName=\"editor-post-template__swap-template-modal\"\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<div className=\"editor-post-template__swap-template-modal-content\">\n\t\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatesList( { postType, onSelect } ) {\n\tconst availableTemplates = useAvailableTemplates( postType );\n\tconst templatesAsPatterns = useMemo(\n\t\t() =>\n\t\t\tavailableTemplates.map( ( template ) => ( {\n\t\t\t\tname: template.slug,\n\t\t\t\tblocks: parse( template.content.raw ),\n\t\t\t\ttitle: decodeEntities( template.title.rendered ),\n\t\t\t\tid: template.id,\n\t\t\t} ) ),\n\t\t[ availableTemplates ]\n\t);\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ templatesAsPatterns }\n\t\t\tonClickPattern={ onSelect }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AAAsE,IAAAS,WAAA,GAAAT,OAAA;AAftE;AACA;AACA;;AAUA;AACA;AACA;;AAGe,SAASU,kBAAkBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACzD,MAAM,CAAEC,SAAS,EAAEC,YAAY,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrD,MAAM;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAG,IAAAC,2BAAoB,EAAC,CAAC;EACnD,MAAMC,kBAAkB,GAAG,IAAAC,4BAAqB,EAAEJ,QAAS,CAAC;EAC5D,MAAM;IAAEK;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,eAAU,CAAC;EACrD,IAAK,CAAEJ,kBAAkB,EAAEK,MAAM,EAAG;IACnC,OAAO,IAAI;EACZ;EACA,MAAMC,gBAAgB,GAAG,MAAQC,QAAQ,IAAM;IAC9CL,gBAAgB,CACf,UAAU,EACVL,QAAQ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E,IAAAC,aAAK,EAAEtB,QAAQ,CAACuB,OAAO,CAACC,GAAI,CAAC;IACrCd,KAAK,EAAE,IAAAe,4BAAc,EAAEzB,QAAQ,CAACU,KAAK,CAACgB,QAAS,CAAC;IAChDC,EAAE,EAAE3B,QAAQ,CAAC2B;EACd,CAAC,CAAG,CAAC,EACN,CAAElC,kBAAkB,CACrB,CAAC;EACD,oBACC,IAAAT,WAAA,CAAAsB,GAAA,EAAC7B,YAAA,CAAAmD,+BAAiB;IACjBC,KAAK,EAAG,IAAArB,QAAE,EAAE,WAAY,CAAG;IAC3BsB,aAAa,EAAGb,mBAAqB;IACrCc,cAAc,EAAGf;EAAU,CAC3B,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_htmlEntities","_blockEditor","_components","_i18n","_data","_coreData","_blocks","_hooks","_jsxRuntime","SwapTemplateButton","onClick","showModal","setShowModal","useState","postType","postId","useEditedPostContext","availableTemplates","useAvailableTemplates","editEntityRecord","useDispatch","coreStore","length","onTemplateSelect","template","name","undoIgnore","jsxs","Fragment","children","jsx","MenuItem","__","Modal","title","onRequestClose","overlayClassName","isFullScreen","className","TemplatesList","onSelect","templatesAsPatterns","useMemo","map","slug","blocks","parse","content","raw","decodeEntities","rendered","id","__experimentalBlockPatternsList","label","blockPatterns","onClickPattern"],"sources":["@wordpress/editor/src/components/post-template/swap-template-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { MenuItem, Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useAvailableTemplates, useEditedPostContext } from './hooks';\n\nexport default function SwapTemplateButton( { onClick } ) {\n\tconst [ showModal, setShowModal ] = useState( false );\n\tconst { postType, postId } = useEditedPostContext();\n\tconst availableTemplates = useAvailableTemplates( postType );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tif ( ! availableTemplates?.length ) {\n\t\treturn null;\n\t}\n\tconst onTemplateSelect = async ( template ) => {\n\t\teditEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t\t{ template: template.name },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t\tsetShowModal( false ); // Close the template suggestions modal first.\n\t\tonClick();\n\t};\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setShowModal( true ) }>\n\t\t\t\t{ __( 'Change template' ) }\n\t\t\t</MenuItem>\n\t\t\t{ showModal && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Choose a template' ) }\n\t\t\t\t\tonRequestClose={ () => setShowModal( false ) }\n\t\t\t\t\toverlayClassName=\"editor-post-template__swap-template-modal\"\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<div className=\"editor-post-template__swap-template-modal-content\">\n\t\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatesList( { postType, onSelect } ) {\n\tconst availableTemplates = useAvailableTemplates( postType );\n\tconst templatesAsPatterns = useMemo(\n\t\t() =>\n\t\t\tavailableTemplates.map( ( template ) => ( {\n\t\t\t\tname: template.slug,\n\t\t\t\tblocks: parse( template.content.raw ),\n\t\t\t\ttitle: decodeEntities( template.title.rendered ),\n\t\t\t\tid: template.id,\n\t\t\t} ) ),\n\t\t[ availableTemplates ]\n\t);\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ templatesAsPatterns }\n\t\t\tonClick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AK,EAAG,IAAArB,QAAE,EAAE,WAAY,CAAG;IAC3BsB,aAAa,EAAGb,mBAAqB;IACrCc,cAAc,EAAGf;EAAU,CAC3B,CAAC;AAEJ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_coreData","_blocks","_patterns","_lockUnlock","_store","EXCLUDED_PATTERN_SOURCES","PATTERN_TYPES","unlock","patternsPrivateApis","injectThemeAttributeInBlockTemplateContent","block","currentThemeStylesheet","innerBlocks","map","innerBlock","name","attributes","theme","undefined","filterPatterns","patterns","template","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","filterOutExcludedPatternSources","pattern","includes","source","filterCompatiblePatterns","templateTypes","slug","blockTypes","area","filter","preparePatterns","keywords","type","blocks","parse","content","__unstableSkipMigrationLogs","useAvailablePatterns","blockPatterns","restBlockPatterns","useSelect","select","_settings$__experimen","getEditorSettings","editorStore","settings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","coreStore","getBlockPatterns","getCurrentTheme","stylesheet","useMemo","mergedPatterns","filteredPatterns"],"sources":["@wordpress/editor/src/components/post-transform-panel/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { parse } from '@wordpress/blocks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES } =\n\tunlock( patternsPrivateApis );\n\nfunction injectThemeAttributeInBlockTemplateContent(\n\tblock,\n\tcurrentThemeStylesheet\n) {\n\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\treturn injectThemeAttributeInBlockTemplateContent(\n\t\t\tinnerBlock,\n\t\t\tcurrentThemeStylesheet\n\t\t);\n\t} );\n\n\tif (\n\t\tblock.name === 'core/template-part' &&\n\t\tblock.attributes.theme === undefined\n\t) {\n\t\tblock.attributes.theme = currentThemeStylesheet;\n\t}\n\treturn block;\n}\n\n/**\n * Filter all patterns and return only the ones that are compatible with the current template.\n *\n * @param {Array} patterns An array of patterns.\n * @param {Object} template The current template.\n * @return {Array} Array of patterns that are compatible with the current template.\n */\nfunction filterPatterns( patterns, template ) {\n\t// Filter out duplicates.\n\tconst filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\t\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n\n\t// Filter out core/directory patterns not included in theme.json.\n\tconst filterOutExcludedPatternSources = ( pattern ) =>\n\t\t! EXCLUDED_PATTERN_SOURCES.includes( pattern.source );\n\n\t// Looks for patterns that have the same template type as the current template,\n\t// or have a block type that matches the current template area.\n\tconst filterCompatiblePatterns = ( pattern ) =>\n\t\tpattern.templateTypes?.includes( template.slug ) ||\n\t\tpattern.blockTypes?.includes( 'core/template-part/' + template.area );\n\n\treturn patterns.filter( ( pattern, index, items ) => {\n\t\treturn (\n\t\t\tfilterOutDuplicatesByName( pattern, index, items ) &&\n\t\t\tfilterOutExcludedPatternSources( pattern ) &&\n\t\t\tfilterCompatiblePatterns( pattern )\n\t\t);\n\t} );\n}\n\nfunction preparePatterns( patterns, currentThemeStylesheet ) {\n\treturn patterns.map( ( pattern ) => ( {\n\t\t...pattern,\n\t\tkeywords: pattern.keywords || [],\n\t\ttype: PATTERN_TYPES.theme,\n\t\tblocks: parse( pattern.content, {\n\t\t\t__unstableSkipMigrationLogs: true,\n\t\t} ).map( ( block ) =>\n\t\t\tinjectThemeAttributeInBlockTemplateContent(\n\t\t\t\tblock,\n\t\t\t\tcurrentThemeStylesheet\n\t\t\t)\n\t\t),\n\t} ) );\n}\n\nexport function useAvailablePatterns( template ) {\n\tconst { blockPatterns, restBlockPatterns, currentThemeStylesheet } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst settings = getEditorSettings();\n\n\t\t\treturn {\n\t\t\t\tblockPatterns:\n\t\t\t\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\t\t\t\tsettings.__experimentalBlockPatterns,\n\t\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\t\tcurrentThemeStylesheet:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme().stylesheet,\n\t\t\t};\n\t\t}, [] );\n\n\treturn useMemo( () => {\n\t\tconst mergedPatterns = [\n\t\t\t...( blockPatterns || [] ),\n\t\t\t...( restBlockPatterns || [] ),\n\t\t];\n\t\tconst filteredPatterns = filterPatterns( mergedPatterns, template );\n\t\treturn preparePatterns(\n\t\t\tfilteredPatterns,\n\t\t\ttemplate,\n\t\t\tcurrentThemeStylesheet\n\t\t);\n\t}, [ blockPatterns, restBlockPatterns, template, currentThemeStylesheet ] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAM;EAAEO,wBAAwB;EAAEC;AAAc,CAAC,GAChD,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAE9B,SAASC,0CAA0CA,CAClDC,KAAK,EACLC,sBAAsB,EACrB;EACDD,KAAK,CAACE,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACC,GAAG,CAAIC,UAAU,IAAM;IAC5D,OAAOL,0CAA0C,CAChDK,UAAU,EACVH,sBACD,CAAC;EACF,CAAE,CAAC;EAEH,IACCD,KAAK,CAACK,IAAI,KAAK,oBAAoB,I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,OAAO,CAACc,OAAO,EAAE;MAC/BC,2BAA2B,EAAE;IAC9B,CAAE,CAAC,CAAC/B,GAAG,CAAIH,KAAK,IACfD,0CAA0C,CACzCC,KAAK,EACLC,sBACD,CACD;EACD,CAAC,CAAG,CAAC;AACN;AAEO,SAASkC,oBAAoBA,CAAExB,QAAQ,EAAG;EAChD,MAAM;IAAEyB,aAAa;IAAEC,iBAAiB;IAAEpC;EAAuB,CAAC,GACjE,IAAAqC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACxB,MAAM;MAAEC;IAAkB,CAAC,GAAGF,MAAM,CAAEG,YAAY,CAAC;IACnD,MAAMC,QAAQ,GAAGF,iBAAiB,CAAC,CAAC;IAEpC,OAAO;MACNL,aAAa,GAAAI,qBAAA,GACZG,QAAQ,CAACC,qCAAqC,cAAAJ,qBAAA,cAAAA,qBAAA,GAC9CG,QAAQ,CAACE,2BAA2B;MACrCR,iBAAiB,EAAEE,MAAM,CAAEO,eAAU,CAAC,CAACC,gBAAgB,CAAC,CAAC;MACzD9C,sBAAsB,EACrBsC,MAAM,CAAEO,eAAU,CAAC,CAACE,eAAe,CAAC,CAAC,CAACC;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAER,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,MAAMC,cAAc,GAAG,CACtB,IAAKf,aAAa,IAAI,EAAE,CAAE,EAC1B,IAAKC,iBAAiB,IAAI,EAAE,CAAE,CAC9B;IACD,MAAMe,gBAAgB,GAAG3C,cAAc,CAAE0C,cAAc,EAAExC,QAAS,CAAC;IACnE,OAAOiB,eAAe,CACrBwB,gBAAgB,EAChBzC,QAAQ,EACRV,sBACD,CAAC;EACF,CAAC,EAAE,CAAEmC,aAAa,EAAEC,iBAAiB,EAAE1B,QAAQ,EAAEV,sBAAsB,CAAG,CAAC;AAC5E","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_coreData","_blocks","_patterns","_lockUnlock","_store","EXCLUDED_PATTERN_SOURCES","PATTERN_TYPES","unlock","patternsPrivateApis","injectThemeAttributeInBlockTemplateContent","block","currentThemeStylesheet","innerBlocks","map","innerBlock","name","attributes","theme","undefined","filterPatterns","patterns","template","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","filterOutExcludedPatternSources","pattern","includes","source","filterCompatiblePatterns","templateTypes","slug","blockTypes","area","filter","preparePatterns","keywords","type","blocks","parse","content","__unstableSkipMigrationLogs","useAvailablePatterns","blockPatterns","restBlockPatterns","useSelect","select","_settings$__experimen","getEditorSettings","editorStore","settings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","coreStore","getBlockPatterns","getCurrentTheme","stylesheet","useMemo","mergedPatterns","filteredPatterns"],"sources":["@wordpress/editor/src/components/post-transform-panel/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { parse } from '@wordpress/blocks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { EXCLUDED_PATTERN_SOURCES, PATTERN_TYPES } =\n\tunlock( patternsPrivateApis );\n\nfunction injectThemeAttributeInBlockTemplateContent(\n\tblock,\n\tcurrentThemeStylesheet\n) {\n\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\treturn injectThemeAttributeInBlockTemplateContent(\n\t\t\tinnerBlock,\n\t\t\tcurrentThemeStylesheet\n\t\t);\n\t} );\n\n\tif (\n\t\tblock.name === 'core/template-part' &&\n\t\tblock.attributes.theme === undefined\n\t) {\n\t\tblock.attributes.theme = currentThemeStylesheet;\n\t}\n\treturn block;\n}\n\n/**\n * Filter all patterns and return only the ones that are compatible with the current template.\n *\n * @param {Array} patterns An array of patterns.\n * @param {Object} template The current template.\n * @return {Array} Array of patterns that are compatible with the current template.\n */\nfunction filterPatterns( patterns, template ) {\n\t// Filter out duplicates.\n\tconst filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\t\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n\n\t// Filter out core/directory patterns not included in theme.json.\n\tconst filterOutExcludedPatternSources = ( pattern ) =>\n\t\t! EXCLUDED_PATTERN_SOURCES.includes( pattern.source );\n\n\t// Looks for patterns that have the same template type as the current template,\n\t// or have a block type that matches the current template area.\n\tconst filterCompatiblePatterns = ( pattern ) =>\n\t\tpattern.templateTypes?.includes( template.slug ) ||\n\t\tpattern.blockTypes?.includes( 'core/template-part/' + template.area );\n\n\treturn patterns.filter( ( pattern, index, items ) => {\n\t\treturn (\n\t\t\tfilterOutDuplicatesByName( pattern, index, items ) &&\n\t\t\tfilterOutExcludedPatternSources( pattern ) &&\n\t\t\tfilterCompatiblePatterns( pattern )\n\t\t);\n\t} );\n}\n\nfunction preparePatterns( patterns, currentThemeStylesheet ) {\n\treturn patterns.map( ( pattern ) => ( {\n\t\t...pattern,\n\t\tkeywords: pattern.keywords || [],\n\t\ttype: PATTERN_TYPES.theme,\n\t\tblocks: parse( pattern.content, {\n\t\t\t__unstableSkipMigrationLogs: true,\n\t\t} ).map( ( block ) =>\n\t\t\tinjectThemeAttributeInBlockTemplateContent(\n\t\t\t\tblock,\n\t\t\t\tcurrentThemeStylesheet\n\t\t\t)\n\t\t),\n\t} ) );\n}\n\nexport function useAvailablePatterns( template ) {\n\tconst { blockPatterns, restBlockPatterns, currentThemeStylesheet } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst settings = getEditorSettings();\n\n\t\t\treturn {\n\t\t\t\tblockPatterns:\n\t\t\t\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\t\t\t\tsettings.__experimentalBlockPatterns,\n\t\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\t\tcurrentThemeStylesheet:\n\t\t\t\t\tselect( coreStore ).getCurrentTheme().stylesheet,\n\t\t\t};\n\t\t}, [] );\n\n\treturn useMemo( () => {\n\t\tconst mergedPatterns = [\n\t\t\t...( blockPatterns || [] ),\n\t\t\t...( restBlockPatterns || [] ),\n\t\t];\n\t\tconst filteredPatterns = filterPatterns( mergedPatterns, template );\n\t\treturn preparePatterns(\n\t\t\tfilteredPatterns,\n\t\t\ttemplate,\n\t\t\tcurrentThemeStylesheet\n\t\t);\n\t}, [ blockPatterns, restBlockPatterns, template, currentThemeStylesheet ] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,MAAM;EAAEO,wBAAwB;EAAEC;AAAc,CAAC,GAChD,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAE9B,SAASC,0CAA0CA,CAClDC,KAAK,EACLC,sBAAsB,EACrB;EACDD,KAAK,CAACE,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACC,GAAG,CAAIC,UAAU,IAAM;IAC5D,OAAOL,0CAA0C,CAChDK,UAAU,EACVH,sBACD,CAAC;EACF,CAAE,CAAC;EAEH,IACCD,KAAK,CAACK,IAAI,KAAK,oBAAoB,IACnCL,KAAK,CAACM,UAAU,CAACC,KAAK,KAAKC,SAAS,EACnC;IACDR,KAAK,CAACM,UAAU,CAACC,KAAK,GAAGN,sBAAsB;EAChD;EACA,OAAOD,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASS,cAAcA,CAAEC,QAAQ,EAAEC,QAAQ,EAAG;EAC7C;EACA,MAAMC,yBAAyB,GAAGA,CAAEC,WAAW,EAAEC,KAAK,EAAEC,KA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AAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACxB,MAAM;MAAEC;IAAkB,CAAC,GAAGF,MAAM,CAAEG,YAAY,CAAC;IACnD,MAAMC,QAAQ,GAAGF,iBAAiB,CAAC,CAAC;IAEpC,OAAO;MACNL,aAAa,GAAAI,qBAAA,GACZG,QAAQ,CAACC,qCAAqC,cAAAJ,qBAAA,cAAAA,qBAAA,GAC9CG,QAAQ,CAACE,2BAA2B;MACrCR,iBAAiB,EAAEE,MAAM,CAAEO,eAAU,CAAC,CAACC,gBAAgB,CAAC,CAAC;MACzD9C,sBAAsB,EACrBsC,MAAM,CAAEO,eAAU,CAAC,CAACE,eAAe,CAAC,CAAC,CAACC;IACxC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAER,OAAO,IAAAC,gBAAO,EAAE,MAAM;IACrB,MAAMC,cAAc,GAAG,CACtB,IAAKf,aAAa,IAAI,EAAE,CAAE,EAC1B,IAAKC,iBAAiB,IAAI,EAAE,CAAE,CAC9B;IACD,MAAMe,gBAAgB,GAAG3C,cAAc,CAAE0C,cAAc,EAAExC,QAAS,CAAC;IACnE,OAAOiB,eAAe,CACrBwB,gBAAgB,EAChBzC,QAAQ,EACRV,sBACD,CAAC;EACF,CAAC,EAAE,CAAEmC,aAAa,EAAEC,iBAAiB,EAAE1B,QAAQ,EAAEV,sBAAsB,CAAG,CAAC;AAC5E","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_store","PostTypeSupportCheck","children","supportKeys","postType","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","isSupported","Array","isArray","some","key","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {React.ReactNode} The component to be rendered.\n */\nfunction PostTypeSupportCheck( { children, supportKeys } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn getPostType( getEditedPostAttribute( 'type' ) );\n\t}, [] );\n\tlet isSupported = !! postType;\n\tif ( postType ) {\n\t\tisSupported = (\n\t\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t\t).some( ( key ) => !! postType.supports[ key ] );\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostTypeSupportCheck;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,eAAU,CAAC;IAC3C,OAAOD,WAAW,CAAEF,sBAAsB,CAAE,MAAO,CAAE,CAAC;EACvD,CAAC,EAAE,EAAG,CAAC;EACP,IAAII,WAAW,GAAG,CAAC,CAAEP,QAAQ;EAC7B,IAAKA,QAAQ,EAAG;IACfO,WAAW,GAAG,CACbC,KAAK,CAACC,OAAO,CAAEV,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DW,IAAI,CAAIC,GAAG,IAAM,CAAC,CAAEX,QAAQ,CAACY,QAAQ,CAAED,GAAG,CAAG,CAAC;EACjD;EAEA,IAAK,CAAEJ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOT,QAAQ;AAChB;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclB,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_store","PostTypeSupportCheck","children","supportKeys","postType","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","isSupported","Array","isArray","some","key","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {React.ReactNode} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {React.ReactNode} The component to be rendered.\n */\nfunction PostTypeSupportCheck( { children, supportKeys } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn getPostType( getEditedPostAttribute( 'type' ) );\n\t}, [] );\n\tlet isSupported = !! postType;\n\tif ( postType ) {\n\t\tisSupported = (\n\t\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t\t).some( ( key ) => !! postType.supports[ key ] );\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostTypeSupportCheck;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,eAAU,CAAC;IAC3C,OAAOD,WAAW,CAAEF,sBAAsB,CAAE,MAAO,CAAE,CAAC;EACvD,CAAC,EAAE,EAAG,CAAC;EACP,IAAII,WAAW,GAAG,CAAC,CAAEP,QAAQ;EAC7B,IAAKA,QAAQ,EAAG;IACfO,WAAW,GAAG,CACbC,KAAK,CAACC,OAAO,CAAEV,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DW,IAAI,CAAIC,GAAG,IAAM,CAAC,CAAEX,QAAQ,CAACY,QAAQ,CAAED,GAAG,CAAG,CAAC;EACjD;EAEA,IAAK,CAAEJ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOT,QAAQ;AAChB;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclB,oBAAoB","ignoreList":[]}