@wordpress/editor 13.27.2 → 13.28.1

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 (365) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/index.js +2 -0
  3. package/build/bindings/index.js.map +1 -1
  4. package/build/bindings/pattern-overrides.js +17 -0
  5. package/build/bindings/pattern-overrides.js.map +1 -0
  6. package/build/bindings/post-meta.js +3 -5
  7. package/build/bindings/post-meta.js.map +1 -1
  8. package/build/components/autocompleters/user.js +1 -2
  9. package/build/components/autocompleters/user.js.map +1 -1
  10. package/build/components/autosave-monitor/index.js +1 -2
  11. package/build/components/autosave-monitor/index.js.map +1 -1
  12. package/build/components/block-manager/category.js +1 -2
  13. package/build/components/block-manager/category.js.map +1 -1
  14. package/build/components/block-manager/checklist.js +1 -2
  15. package/build/components/block-manager/checklist.js.map +1 -1
  16. package/build/components/block-manager/index.js +1 -2
  17. package/build/components/block-manager/index.js.map +1 -1
  18. package/build/components/deprecated.js +52 -104
  19. package/build/components/deprecated.js.map +1 -1
  20. package/build/components/document-bar/index.js +5 -6
  21. package/build/components/document-bar/index.js.map +1 -1
  22. package/build/components/document-outline/check.js +1 -2
  23. package/build/components/document-outline/check.js.map +1 -1
  24. package/build/components/document-outline/index.js +1 -2
  25. package/build/components/document-outline/index.js.map +1 -1
  26. package/build/components/document-outline/item.js +1 -2
  27. package/build/components/document-outline/item.js.map +1 -1
  28. package/build/components/document-tools/index.js +1 -2
  29. package/build/components/document-tools/index.js.map +1 -1
  30. package/build/components/editor-canvas/edit-template-blocks-notification.js +11 -18
  31. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  32. package/build/components/editor-canvas/index.js +28 -16
  33. package/build/components/editor-canvas/index.js.map +1 -1
  34. package/build/components/editor-help/add-blocks.native.js +1 -2
  35. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  36. package/build/components/editor-help/customize-blocks.native.js +1 -2
  37. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  38. package/build/components/editor-help/help-detail-navigation-screen.native.js +1 -2
  39. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  40. package/build/components/editor-help/help-get-support-button.native.js +1 -2
  41. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  42. package/build/components/editor-help/help-section-title.native.js +1 -2
  43. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  44. package/build/components/editor-help/help-topic-row.native.js +1 -2
  45. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  46. package/build/components/editor-help/icon-move-blocks.native.js +1 -2
  47. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  48. package/build/components/editor-help/index.native.js +1 -2
  49. package/build/components/editor-help/index.native.js.map +1 -1
  50. package/build/components/editor-help/intro-to-blocks.native.js +1 -2
  51. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  52. package/build/components/editor-help/move-blocks.native.js +1 -2
  53. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  54. package/build/components/editor-help/remove-blocks.native.js +1 -2
  55. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  56. package/build/components/editor-history/redo.js +1 -2
  57. package/build/components/editor-history/redo.js.map +1 -1
  58. package/build/components/editor-history/undo.js +1 -2
  59. package/build/components/editor-history/undo.js.map +1 -1
  60. package/build/components/editor-notices/index.js +1 -2
  61. package/build/components/editor-notices/index.js.map +1 -1
  62. package/build/components/editor-snackbars/index.js +3 -1
  63. package/build/components/editor-snackbars/index.js.map +1 -1
  64. package/build/components/entities-saved-states/entity-record-item.js +1 -1
  65. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  66. package/build/components/entities-saved-states/entity-type-list.js +7 -7
  67. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  68. package/build/components/entities-saved-states/index.js +4 -1
  69. package/build/components/entities-saved-states/index.js.map +1 -1
  70. package/build/components/error-boundary/index.js +1 -2
  71. package/build/components/error-boundary/index.js.map +1 -1
  72. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +1 -2
  73. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  74. package/build/components/index.js +4 -6
  75. package/build/components/index.js.map +1 -1
  76. package/build/components/list-view-sidebar/index.js +43 -36
  77. package/build/components/list-view-sidebar/index.js.map +1 -1
  78. package/build/components/local-autosave-monitor/index.js +1 -2
  79. package/build/components/local-autosave-monitor/index.js.map +1 -1
  80. package/build/components/media-categories/index.js +1 -2
  81. package/build/components/media-categories/index.js.map +1 -1
  82. package/build/components/offline-status/index.native.js +1 -2
  83. package/build/components/offline-status/index.native.js.map +1 -1
  84. package/build/components/page-attributes/check.js +1 -2
  85. package/build/components/page-attributes/check.js.map +1 -1
  86. package/build/components/page-attributes/panel.js +1 -2
  87. package/build/components/page-attributes/panel.js.map +1 -1
  88. package/build/components/page-attributes/parent.js +1 -2
  89. package/build/components/page-attributes/parent.js.map +1 -1
  90. package/build/components/post-author/combobox.js +6 -60
  91. package/build/components/post-author/combobox.js.map +1 -1
  92. package/build/components/post-author/constants.js +7 -5
  93. package/build/components/post-author/constants.js.map +1 -1
  94. package/build/components/post-author/hook.js +72 -0
  95. package/build/components/post-author/hook.js.map +1 -0
  96. package/build/components/post-author/index.js +1 -2
  97. package/build/components/post-author/index.js.map +1 -1
  98. package/build/components/post-author/panel.js +1 -2
  99. package/build/components/post-author/panel.js.map +1 -1
  100. package/build/components/post-author/select.js +6 -24
  101. package/build/components/post-author/select.js.map +1 -1
  102. package/build/components/post-comments/index.js +1 -2
  103. package/build/components/post-comments/index.js.map +1 -1
  104. package/build/components/post-discussion/panel.js +1 -2
  105. package/build/components/post-discussion/panel.js.map +1 -1
  106. package/build/components/post-excerpt/check.js +1 -2
  107. package/build/components/post-excerpt/check.js.map +1 -1
  108. package/build/components/post-excerpt/index.js +1 -2
  109. package/build/components/post-excerpt/index.js.map +1 -1
  110. package/build/components/post-excerpt/plugin.js +1 -2
  111. package/build/components/post-excerpt/plugin.js.map +1 -1
  112. package/build/components/post-featured-image/check.js +1 -2
  113. package/build/components/post-featured-image/check.js.map +1 -1
  114. package/build/components/post-featured-image/index.js +1 -2
  115. package/build/components/post-featured-image/index.js.map +1 -1
  116. package/build/components/post-featured-image/panel.js +1 -2
  117. package/build/components/post-featured-image/panel.js.map +1 -1
  118. package/build/components/post-format/check.js +1 -2
  119. package/build/components/post-format/check.js.map +1 -1
  120. package/build/components/post-format/index.js +1 -2
  121. package/build/components/post-format/index.js.map +1 -1
  122. package/build/components/post-last-revision/check.js +1 -2
  123. package/build/components/post-last-revision/check.js.map +1 -1
  124. package/build/components/post-last-revision/index.js +6 -5
  125. package/build/components/post-last-revision/index.js.map +1 -1
  126. package/build/components/post-last-revision/panel.js +1 -2
  127. package/build/components/post-last-revision/panel.js.map +1 -1
  128. package/build/components/post-panel-row/index.js +1 -2
  129. package/build/components/post-panel-row/index.js.map +1 -1
  130. package/build/components/post-pending-status/check.js +1 -2
  131. package/build/components/post-pending-status/check.js.map +1 -1
  132. package/build/components/post-pending-status/index.js +1 -2
  133. package/build/components/post-pending-status/index.js.map +1 -1
  134. package/build/components/post-pingbacks/index.js +1 -2
  135. package/build/components/post-pingbacks/index.js.map +1 -1
  136. package/build/components/post-publish-button/index.js +1 -2
  137. package/build/components/post-publish-button/index.js.map +1 -1
  138. package/build/components/post-publish-button/label.js +1 -2
  139. package/build/components/post-publish-button/label.js.map +1 -1
  140. package/build/components/post-publish-panel/index.js +1 -2
  141. package/build/components/post-publish-panel/index.js.map +1 -1
  142. package/build/components/post-publish-panel/maybe-category-panel.js +1 -2
  143. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  144. package/build/components/post-publish-panel/maybe-tags-panel.js +22 -26
  145. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  146. package/build/components/post-publish-panel/postpublish.js +1 -2
  147. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  148. package/build/components/post-publish-panel/prepublish.js +1 -2
  149. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  150. package/build/components/post-schedule/index.js +0 -1
  151. package/build/components/post-schedule/index.js.map +1 -1
  152. package/build/components/post-schedule/label.js +1 -1
  153. package/build/components/post-schedule/label.js.map +1 -1
  154. package/build/components/post-schedule/panel.js +1 -0
  155. package/build/components/post-schedule/panel.js.map +1 -1
  156. package/build/components/post-slug/index.js +1 -2
  157. package/build/components/post-slug/index.js.map +1 -1
  158. package/build/components/post-switch-to-draft-button/index.js +1 -0
  159. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  160. package/build/components/post-sync-status/index.js +1 -1
  161. package/build/components/post-sync-status/index.js.map +1 -1
  162. package/build/components/post-taxonomies/check.js +8 -15
  163. package/build/components/post-taxonomies/check.js.map +1 -1
  164. package/build/components/post-taxonomies/flat-term-selector.js +1 -2
  165. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  166. package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -2
  167. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  168. package/build/components/post-taxonomies/index.js +14 -15
  169. package/build/components/post-taxonomies/index.js.map +1 -1
  170. package/build/components/post-taxonomies/panel.js +1 -2
  171. package/build/components/post-taxonomies/panel.js.map +1 -1
  172. package/build/components/post-template/block-theme.js +12 -11
  173. package/build/components/post-template/block-theme.js.map +1 -1
  174. package/build/components/post-template/classic-theme.js +10 -11
  175. package/build/components/post-template/classic-theme.js.map +1 -1
  176. package/build/components/post-template/create-new-template-modal.js +4 -5
  177. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  178. package/build/components/post-template/panel.js +5 -1
  179. package/build/components/post-template/panel.js.map +1 -1
  180. package/build/components/post-title/constants.js +2 -4
  181. package/build/components/post-title/constants.js.map +1 -1
  182. package/build/components/post-title/index.js +2 -3
  183. package/build/components/post-title/index.js.map +1 -1
  184. package/build/components/post-title/index.native.js +1 -2
  185. package/build/components/post-title/index.native.js.map +1 -1
  186. package/build/components/post-title/post-title-raw.js +1 -2
  187. package/build/components/post-title/post-title-raw.js.map +1 -1
  188. package/build/components/post-trash/check.js +1 -2
  189. package/build/components/post-trash/check.js.map +1 -1
  190. package/build/components/post-trash/index.js +1 -0
  191. package/build/components/post-trash/index.js.map +1 -1
  192. package/build/components/post-type-support-check/index.js +1 -2
  193. package/build/components/post-type-support-check/index.js.map +1 -1
  194. package/build/components/post-url/panel.js +1 -0
  195. package/build/components/post-url/panel.js.map +1 -1
  196. package/build/components/post-visibility/utils.js +1 -2
  197. package/build/components/post-visibility/utils.js.map +1 -1
  198. package/build/components/preferences-modal/enable-panel.js +1 -2
  199. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  200. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js +1 -2
  201. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  202. package/build/components/preferences-modal/index.js +0 -1
  203. package/build/components/preferences-modal/index.js.map +1 -1
  204. package/build/components/provider/constants.js +1 -2
  205. package/build/components/provider/constants.js.map +1 -1
  206. package/build/components/provider/index.js +12 -6
  207. package/build/components/provider/index.js.map +1 -1
  208. package/build/components/provider/index.native.js +4 -6
  209. package/build/components/provider/index.native.js.map +1 -1
  210. package/build/components/provider/use-block-editor-settings.js +2 -3
  211. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  212. package/build/components/provider/use-block-editor-settings.native.js +1 -2
  213. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  214. package/build/components/provider/with-registry-provider.js +1 -2
  215. package/build/components/provider/with-registry-provider.js.map +1 -1
  216. package/build/components/table-of-contents/index.js +1 -2
  217. package/build/components/table-of-contents/index.js.map +1 -1
  218. package/build/components/table-of-contents/panel.js +1 -2
  219. package/build/components/table-of-contents/panel.js.map +1 -1
  220. package/build/components/template-validation-notice/index.js +1 -2
  221. package/build/components/template-validation-notice/index.js.map +1 -1
  222. package/build/components/theme-support-check/index.js +1 -2
  223. package/build/components/theme-support-check/index.js.map +1 -1
  224. package/build/hooks/pattern-partial-syncing.js +9 -2
  225. package/build/hooks/pattern-partial-syncing.js.map +1 -1
  226. package/build/private-apis.js +1 -2
  227. package/build/private-apis.js.map +1 -1
  228. package/build/store/actions.js +32 -63
  229. package/build/store/actions.js.map +1 -1
  230. package/build/store/constants.js +7 -14
  231. package/build/store/constants.js.map +1 -1
  232. package/build/store/defaults.js +1 -2
  233. package/build/store/defaults.js.map +1 -1
  234. package/build/store/index.js +4 -6
  235. package/build/store/index.js.map +1 -1
  236. package/build/store/private-selectors.js +1 -2
  237. package/build/store/private-selectors.js.map +1 -1
  238. package/build/store/reducer.js +2 -3
  239. package/build/store/reducer.js.map +1 -1
  240. package/build/store/reducer.native.js +2 -4
  241. package/build/store/reducer.native.js.map +1 -1
  242. package/build/store/selectors.js +72 -144
  243. package/build/store/selectors.js.map +1 -1
  244. package/build/store/selectors.native.js +1 -2
  245. package/build/store/selectors.native.js.map +1 -1
  246. package/build-module/bindings/index.js +2 -0
  247. package/build-module/bindings/index.js.map +1 -1
  248. package/build-module/bindings/pattern-overrides.js +11 -0
  249. package/build-module/bindings/pattern-overrides.js.map +1 -0
  250. package/build-module/bindings/post-meta.js +3 -4
  251. package/build-module/bindings/post-meta.js.map +1 -1
  252. package/build-module/components/document-bar/index.js +5 -6
  253. package/build-module/components/document-bar/index.js.map +1 -1
  254. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +11 -18
  255. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  256. package/build-module/components/editor-canvas/index.js +27 -14
  257. package/build-module/components/editor-canvas/index.js.map +1 -1
  258. package/build-module/components/editor-snackbars/index.js +4 -1
  259. package/build-module/components/editor-snackbars/index.js.map +1 -1
  260. package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
  261. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  262. package/build-module/components/entities-saved-states/entity-type-list.js +8 -8
  263. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  264. package/build-module/components/entities-saved-states/index.js +6 -3
  265. package/build-module/components/entities-saved-states/index.js.map +1 -1
  266. package/build-module/components/list-view-sidebar/index.js +44 -37
  267. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  268. package/build-module/components/post-author/combobox.js +8 -61
  269. package/build-module/components/post-author/combobox.js.map +1 -1
  270. package/build-module/components/post-author/constants.js +5 -2
  271. package/build-module/components/post-author/constants.js.map +1 -1
  272. package/build-module/components/post-author/hook.js +65 -0
  273. package/build-module/components/post-author/hook.js.map +1 -0
  274. package/build-module/components/post-author/select.js +7 -24
  275. package/build-module/components/post-author/select.js.map +1 -1
  276. package/build-module/components/post-last-revision/index.js +6 -4
  277. package/build-module/components/post-last-revision/index.js.map +1 -1
  278. package/build-module/components/post-publish-panel/maybe-tags-panel.js +24 -27
  279. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  280. package/build-module/components/post-schedule/index.js +0 -1
  281. package/build-module/components/post-schedule/index.js.map +1 -1
  282. package/build-module/components/post-schedule/label.js +1 -1
  283. package/build-module/components/post-schedule/label.js.map +1 -1
  284. package/build-module/components/post-schedule/panel.js +1 -0
  285. package/build-module/components/post-schedule/panel.js.map +1 -1
  286. package/build-module/components/post-switch-to-draft-button/index.js +1 -0
  287. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  288. package/build-module/components/post-sync-status/index.js +1 -1
  289. package/build-module/components/post-sync-status/index.js.map +1 -1
  290. package/build-module/components/post-taxonomies/check.js +9 -14
  291. package/build-module/components/post-taxonomies/check.js.map +1 -1
  292. package/build-module/components/post-taxonomies/index.js +15 -15
  293. package/build-module/components/post-taxonomies/index.js.map +1 -1
  294. package/build-module/components/post-template/block-theme.js +12 -11
  295. package/build-module/components/post-template/block-theme.js.map +1 -1
  296. package/build-module/components/post-template/classic-theme.js +9 -9
  297. package/build-module/components/post-template/classic-theme.js.map +1 -1
  298. package/build-module/components/post-template/create-new-template-modal.js +4 -5
  299. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  300. package/build-module/components/post-template/panel.js +5 -1
  301. package/build-module/components/post-template/panel.js.map +1 -1
  302. package/build-module/components/post-title/index.js +1 -2
  303. package/build-module/components/post-title/index.js.map +1 -1
  304. package/build-module/components/post-trash/index.js +1 -0
  305. package/build-module/components/post-trash/index.js.map +1 -1
  306. package/build-module/components/post-url/panel.js +1 -0
  307. package/build-module/components/post-url/panel.js.map +1 -1
  308. package/build-module/components/preferences-modal/index.js +0 -1
  309. package/build-module/components/preferences-modal/index.js.map +1 -1
  310. package/build-module/components/provider/index.js +10 -2
  311. package/build-module/components/provider/index.js.map +1 -1
  312. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  313. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  314. package/build-module/components/table-of-contents/panel.js +0 -1
  315. package/build-module/components/table-of-contents/panel.js.map +1 -1
  316. package/build-module/hooks/pattern-partial-syncing.js +9 -2
  317. package/build-module/hooks/pattern-partial-syncing.js.map +1 -1
  318. package/build-module/store/actions.js +1 -1
  319. package/build-module/store/actions.js.map +1 -1
  320. package/build-module/store/reducer.js +1 -1
  321. package/build-module/store/reducer.js.map +1 -1
  322. package/build-style/style-rtl.css +28 -22
  323. package/build-style/style.css +28 -22
  324. package/package.json +32 -32
  325. package/src/bindings/index.js +2 -0
  326. package/src/bindings/pattern-overrides.js +11 -0
  327. package/src/bindings/post-meta.js +2 -3
  328. package/src/components/document-bar/index.js +22 -17
  329. package/src/components/editor-canvas/edit-template-blocks-notification.js +31 -30
  330. package/src/components/editor-canvas/index.js +39 -10
  331. package/src/components/editor-snackbars/index.js +6 -3
  332. package/src/components/entities-saved-states/entity-record-item.js +1 -4
  333. package/src/components/entities-saved-states/entity-type-list.js +8 -8
  334. package/src/components/entities-saved-states/index.js +17 -4
  335. package/src/components/entities-saved-states/style.scss +5 -0
  336. package/src/components/list-view-sidebar/index.js +60 -47
  337. package/src/components/list-view-sidebar/style.scss +20 -20
  338. package/src/components/post-author/combobox.js +5 -61
  339. package/src/components/post-author/constants.js +6 -2
  340. package/src/components/post-author/hook.js +63 -0
  341. package/src/components/post-author/select.js +5 -25
  342. package/src/components/post-last-revision/index.js +6 -6
  343. package/src/components/post-last-revision/style.scss +3 -6
  344. package/src/components/post-panel-row/style.scss +3 -3
  345. package/src/components/post-publish-panel/maybe-tags-panel.js +27 -37
  346. package/src/components/post-publish-panel/style.scss +3 -1
  347. package/src/components/post-schedule/label.js +1 -1
  348. package/src/components/post-schedule/panel.js +1 -0
  349. package/src/components/post-schedule/test/label.js +19 -7
  350. package/src/components/post-switch-to-draft-button/index.js +1 -0
  351. package/src/components/post-sync-status/index.js +8 -2
  352. package/src/components/post-taxonomies/check.js +11 -15
  353. package/src/components/post-taxonomies/index.js +15 -22
  354. package/src/components/post-taxonomies/test/index.js +37 -51
  355. package/src/components/post-template/block-theme.js +29 -22
  356. package/src/components/post-template/classic-theme.js +10 -13
  357. package/src/components/post-template/create-new-template-modal.js +7 -9
  358. package/src/components/post-template/panel.js +5 -1
  359. package/src/components/post-trash/index.js +1 -0
  360. package/src/components/post-url/panel.js +1 -0
  361. package/src/components/provider/index.js +22 -2
  362. package/src/components/provider/use-block-editor-settings.js +1 -1
  363. package/src/hooks/pattern-partial-syncing.js +23 -4
  364. package/src/store/actions.js +1 -1
  365. package/src/store/reducer.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_compose","_coreData","_hierarchicalTermSelector","_interopRequireDefault","_flatTermSelector","_store","identity","x","PostTaxonomies","postType","taxonomies","taxonomyWrapper","availableTaxonomies","filter","taxonomy","types","includes","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","_react","createElement","Fragment","key","slug","_default","compose","withSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = ( taxonomies ?? [] ).filter( ( taxonomy ) =>\n\t\ttaxonomy.types.includes( postType )\n\t);\n\tconst visibleTaxonomies = availableTaxonomies.filter(\n\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t( taxonomy ) => taxonomy.visibility?.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,yBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAbA;AACA;AACA;;AAMA;AACA;AAC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1
+ {"version":3,"names":["_element","require","_data","_coreData","_hierarchicalTermSelector","_interopRequireDefault","_flatTermSelector","_store","identity","x","PostTaxonomies","taxonomyWrapper","postType","taxonomies","useSelect","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page","visibleTaxonomies","filter","taxonomy","types","includes","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","_react","createElement","Fragment","key","slug","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nconst identity = ( x ) => x;\n\nexport function PostTaxonomies( { taxonomyWrapper = identity } ) {\n\tconst { postType, taxonomies } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t}, [] );\n\tconst visibleTaxonomies = ( taxonomies ?? [] ).filter(\n\t\t( taxonomy ) =>\n\t\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t\ttaxonomy.types.includes( postType ) && taxonomy.visibility?.show_ui\n\t);\n\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n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AAAsB,MAAA,CAAAC,aAAA,EAACL,iBAAiB;MAACQ,IAAI,EAAGd,QAAQ,CAACc;IAAM,CAAE,CAAC,EAC5Cd,QACD,CACS,CAAC;EAEb,CAAE,CAAC;AACJ;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc9B,cAAc"}
@@ -63,6 +63,5 @@ function PostTaxonomies() {
63
63
  }
64
64
  }));
65
65
  }
66
- var _default = PostTaxonomies;
67
- exports.default = _default;
66
+ var _default = exports.default = PostTaxonomies;
68
67
  //# sourceMappingURL=panel.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_data","_store","_index","_interopRequireDefault","_check","TaxonomyPanel","taxonomy","children","slug","panelName","isEnabled","isOpened","useSelect","select","isEditorPanelEnabled","isEditorPanelOpened","editorStore","toggleEditorPanelOpened","useDispatch","taxonomyMenuName","labels","menu_name","_react","createElement","PanelBody","title","opened","onToggle","PostTaxonomies","default","taxonomyWrapper","content","_default","exports"],"sources":["@wordpress/editor/src/components/post-taxonomies/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTaxonomiesForm from './index';\nimport PostTaxonomiesCheck from './check';\n\nfunction TaxonomyPanel( { taxonomy, children } ) {\n\tconst slug = taxonomy?.slug;\n\tconst panelName = slug ? `taxonomy-panel-${ slug }` : '';\n\tconst { isEnabled, isOpened } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisEnabled: slug ? isEditorPanelEnabled( panelName ) : false,\n\t\t\t\tisOpened: slug ? isEditorPanelOpened( panelName ) : false,\n\t\t\t};\n\t\t},\n\t\t[ panelName, slug ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst taxonomyMenuName = taxonomy?.labels?.menu_name;\n\tif ( ! taxonomyMenuName ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ taxonomyMenuName }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t>\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n}\n\nfunction PostTaxonomies() {\n\treturn (\n\t\t<PostTaxonomiesCheck>\n\t\t\t<PostTaxonomiesForm\n\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TaxonomyPanel taxonomy={ taxonomy }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</TaxonomyPanel>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</PostTaxonomiesCheck>\n\t);\n}\n\nexport default PostTaxonomies;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,SAASM,aAAaA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EAChD,MAAMC,IAAI,GAAGF,QAAQ,EAAEE,IAAI;EAC3B,MAAMC,SAAS,GAAGD,IAAI,GAAI,kBAAkBA,IAAM,EAAC,GAAG,EAAE;EACxD,MAAM;IAAEE,SAAS;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EACtCC,MAAM,IAAM;IACb,MAAM;MAAEC,oBAAoB;MAAEC;IAAoB,CAAC,GAClDF,MAAM,CAAEG,YAAY,CAAC;IACtB,OAAO;MACNN,SAAS,EAAEF,IAAI,GAAGM,oBAAoB,CAAEL,SAAU,CAAC,GAAG,KAAK;MAC3DE,QAAQ,EAAEH,IAAI,GAAGO,mBAAmB,CAAEN,SAAU,CAAC,GAAG;IACrD,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,EAAED,IAAI,CAClB,CAAC;EACD,MAAM;IAAES;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEF,YAAY,CAAC;EAE9D,IAAK,CAAEN,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,MAAMS,gBAAgB,GAAGb,QAAQ,EAAEc,MAAM,EAAEC,SAAS;EACpD,IAAK,CAAEF,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACzB,WAAA,CAAA0B,SAAS;IACTC,KAAK,EAAGN,gBAAkB;IAC1BO,MAAM,EAAGf,QAAU;IACnBgB,QAAQ,EAAGA,CAAA,KAAMV,uBAAuB,CAAER,SAAU;EAAG,GAErDF,QACQ,CAAC;AAEd;AAEA,SAASqB,cAAcA,CAAA,EAAG;EACzB,OACC,IAAAN,MAAA,CAAAC,aAAA,EAACnB,MAAA,CAAAyB,OAAmB,QACnB,IAAAP,MAAA,CAAAC,aAAA,EAACrB,MAAA,CAAA2B,OAAkB;IAClBC,eAAe,EAAGA,CAAEC,OAAO,EAAEzB,QAAQ,KAAM;MAC1C,OACC,IAAAgB,MAAA,CAAAC,aAAA,EAAClB,aAAa;QAACC,QAAQ,EAAGA;MAAU,GACjCyB,OACY,CAAC;IAElB;EAAG,CACH,CACmB,CAAC;AAExB;AAAC,IAAAC,QAAA,GAEcJ,cAAc;AAAAK,OAAA,CAAAJ,OAAA,GAAAG,QAAA"}
1
+ {"version":3,"names":["_components","require","_data","_store","_index","_interopRequireDefault","_check","TaxonomyPanel","taxonomy","children","slug","panelName","isEnabled","isOpened","useSelect","select","isEditorPanelEnabled","isEditorPanelOpened","editorStore","toggleEditorPanelOpened","useDispatch","taxonomyMenuName","labels","menu_name","_react","createElement","PanelBody","title","opened","onToggle","PostTaxonomies","default","taxonomyWrapper","content","_default","exports"],"sources":["@wordpress/editor/src/components/post-taxonomies/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostTaxonomiesForm from './index';\nimport PostTaxonomiesCheck from './check';\n\nfunction TaxonomyPanel( { taxonomy, children } ) {\n\tconst slug = taxonomy?.slug;\n\tconst panelName = slug ? `taxonomy-panel-${ slug }` : '';\n\tconst { isEnabled, isOpened } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisEnabled: slug ? isEditorPanelEnabled( panelName ) : false,\n\t\t\t\tisOpened: slug ? isEditorPanelOpened( panelName ) : false,\n\t\t\t};\n\t\t},\n\t\t[ panelName, slug ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst taxonomyMenuName = taxonomy?.labels?.menu_name;\n\tif ( ! taxonomyMenuName ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ taxonomyMenuName }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t>\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n}\n\nfunction PostTaxonomies() {\n\treturn (\n\t\t<PostTaxonomiesCheck>\n\t\t\t<PostTaxonomiesForm\n\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TaxonomyPanel taxonomy={ taxonomy }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</TaxonomyPanel>\n\t\t\t\t\t);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C1BO,MAAM,EAAGf,QAAU;IACnBgB,QAAQ,EAAGA,CAAA,KAAMV,uBAAuB,CAAER,SAAU;EAAG,GAErDF,QACQ,CAAC;AAEd;AAEA,SAASqB,cAAcA,CAAA,EAAG;EACzB,OACC,IAAAN,MAAA,CAAAC,aAAA,EAACnB,MAAA,CAAAyB,OAAmB,QACnB,IAAAP,MAAA,CAAAC,aAAA,EAACrB,MAAA,CAAA2B,OAAkB;IAClBC,eAAe,EAAGA,CAAEC,OAAO,EAAEzB,QAAQ,KAAM;MAC1C,OACC,IAAAgB,MAAA,CAAAC,aAAA,EAAClB,aAAa;QAACC,QAAQ,EAAGA;MAAU,GACjCyB,OACY,CAAC;IAElB;EAAG,CACH,CACmB,CAAC;AAExB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcD,cAAc"}
@@ -35,7 +35,7 @@ function BlockThemeControl({
35
35
  }) {
36
36
  const {
37
37
  isTemplateHidden,
38
- getPostLinkProps,
38
+ onNavigateToEntityRecord,
39
39
  getEditorSettings,
40
40
  hasGoBack
41
41
  } = (0, _data.useSelect)(select => {
@@ -46,9 +46,9 @@ function BlockThemeControl({
46
46
  const editorSettings = _getEditorSettings();
47
47
  return {
48
48
  isTemplateHidden: getRenderingMode() === 'post-only',
49
- getPostLinkProps: editorSettings.getPostLinkProps,
49
+ onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
50
50
  getEditorSettings: _getEditorSettings,
51
- hasGoBack: editorSettings.hasOwnProperty('goBack')
51
+ hasGoBack: editorSettings.hasOwnProperty('onNavigateToPreviousEntityRecord')
52
52
  };
53
53
  }, []);
54
54
  const {
@@ -61,23 +61,21 @@ function BlockThemeControl({
61
61
  const {
62
62
  setRenderingMode
63
63
  } = (0, _data.useDispatch)(_store.store);
64
- const editTemplate = getPostLinkProps ? getPostLinkProps({
65
- postId: template.id,
66
- postType: 'wp_template'
67
- }) : {};
68
64
  if (!hasResolved) {
69
65
  return null;
70
66
  }
71
- // The site editor does not have a `goBack` setting as it uses its own routing
67
+
68
+ // The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing
72
69
  // and assigns its own backlink to focusMode pages.
73
70
  const notificationAction = hasGoBack ? [{
74
71
  label: (0, _i18n.__)('Go back'),
75
- onClick: () => getEditorSettings().goBack()
72
+ onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
76
73
  }] : undefined;
77
74
  return (0, _react.createElement)(_components.DropdownMenu, {
78
75
  popoverProps: POPOVER_PROPS,
79
76
  focusOnMount: true,
80
77
  toggleProps: {
78
+ __next40pxDefaultSize: true,
81
79
  variant: 'tertiary'
82
80
  },
83
81
  label: (0, _i18n.__)('Template options'),
@@ -86,8 +84,11 @@ function BlockThemeControl({
86
84
  }, ({
87
85
  onClose
88
86
  }) => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.MenuGroup, null, (0, _react.createElement)(_components.MenuItem, {
89
- onClick: event => {
90
- editTemplate.onClick(event);
87
+ onClick: () => {
88
+ onNavigateToEntityRecord({
89
+ postId: template.id,
90
+ postType: 'wp_template'
91
+ });
91
92
  onClose();
92
93
  createSuccessNotice((0, _i18n.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
93
94
  type: 'snackbar',
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_htmlEntities","_components","_i18n","_coreData","_icons","_notices","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","getPostLinkProps","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","editTemplate","postId","postType","notificationAction","label","__","onClick","goBack","undefined","_react","createElement","DropdownMenu","popoverProps","focusOnMount","toggleProps","variant","text","decodeEntities","title","icon","onClose","Fragment","MenuGroup","MenuItem","event","type","actions","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 } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\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 { isTemplateHidden, getPostLinkProps, getEditorSettings, hasGoBack } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\t\tunlock( select( editorStore ) );\n\t\t\tconst editorSettings = _getEditorSettings();\n\t\t\treturn {\n\t\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\t\tgetPostLinkProps: editorSettings.getPostLinkProps,\n\t\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\t\thasGoBack: editorSettings.hasOwnProperty( 'goBack' ),\n\t\t\t};\n\t\t}, [] );\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\tconst editTemplate = getPostLinkProps\n\t\t? getPostLinkProps( {\n\t\t\t\tpostId: template.id,\n\t\t\t\tpostType: 'wp_template',\n\t\t } )\n\t\t: {};\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\t// The site editor does not have a `goBack` 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: () => getEditorSettings().goBack(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tvariant: 'tertiary',\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<MenuItem\n\t\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t\teditTemplate.onClick( event );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t__(\n\t\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\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\tactions: notificationAction,\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\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t</MenuItem>\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<CreateNewTemplate onClick={ onClose } />\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{ __( 'Template preview' ) }\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;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAH,sBAAA,CAAAT,OAAA;AAlBA;AACA;AACA;;AASA;AACA;AACA;;AAOA,MAAMa,aAAa,GAAG;EACrBC,SAAS,EAAE,gCAAgC;EAC3CC,SAAS,EAAE;AACZ,CAAC;AAEc,SAASC,iBAAiBA,CAAE;EAAEC;AAAG,CAAC,EAAG;EACnD,MAAM;IAAEC,gBAAgB;IAAEC,gBAAgB;IAAEC,iBAAiB;IAAEC;EAAU,CAAC,GACzE,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxB,MAAM;MAAEC,gBAAgB;MAAEJ,iBAAiB,EAAE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,iBAAiB,GACjB,WACJ,CAAC;IACF;EAAG,GAED,IAAAyB,QAAE,EAAE,kBAAmB,CAChB,CACA,CACV,CAEU,CAAC;AAEjB"}
1
+ {"version":3,"names":["_data","require","_htmlEntities","_components","_i18n","_coreData","_icons","_notices","_store","_swapTemplateButton","_interopRequireDefault","_resetDefaultTemplate","_lockUnlock","_createNewTemplate","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","useSelect","select","getRenderingMode","_getEditorSettings","unlock","editorStore","editorSettings","hasOwnProperty","editedRecord","template","hasResolved","useEntityRecord","createSuccessNotice","useDispatch","noticesStore","setRenderingMode","notificationAction","label","__","onClick","onNavigateToPreviousEntityRecord","undefined","_react","createElement","DropdownMenu","popoverProps","focusOnMount","toggleProps","__next40pxDefaultSize","variant","text","decodeEntities","title","icon","onClose","Fragment","MenuGroup","MenuItem","postId","postType","type","actions","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 } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\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 { 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\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\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\t__next40pxDefaultSize: true,\n\t\t\t\tvariant: 'tertiary',\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<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\t__(\n\t\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\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\tactions: notificationAction,\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\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t</MenuItem>\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<CreateNewTemplate onClick={ onClose } />\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{ __( 'Template preview' ) }\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,IA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AI,MAAA,CAAAC,aAAA,EAACrC,mBAAA,CAAAwD,OAAkB;IAACvB,OAAO,EAAGe;EAAS,CAAE,CAAC,EAC1C,IAAAZ,MAAA,CAAAC,aAAA,EAACnC,qBAAA,CAAAsD,OAAoB;IAACvB,OAAO,EAAGe;EAAS,CAAE,CAAC,EAC5C,IAAAZ,MAAA,CAAAC,aAAA,EAACjC,kBAAA,CAAAoD,OAAiB;IAACvB,OAAO,EAAGe;EAAS,CAAE,CAC9B,CAAC,EACZ,IAAAZ,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAAwD,SAAS,QACT,IAAAd,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAAyD,QAAQ;IACRJ,IAAI,EAAG,CAAErC,gBAAgB,GAAG+C,YAAK,GAAGtB,SAAW;IAC/CuB,UAAU,EAAG,CAAEhD,gBAAkB;IACjCiD,IAAI,EAAC,kBAAkB;IACvB1B,OAAO,EAAGA,CAAA,KAAM;MACfJ,gBAAgB,CACfnB,gBAAgB,GACb,iBAAiB,GACjB,WACJ,CAAC;IACF;EAAG,GAED,IAAAsB,QAAE,EAAE,kBAAmB,CAChB,CACA,CACV,CAEU,CAAC;AAEjB"}
@@ -46,6 +46,7 @@ function PostTemplateToggle({
46
46
  return template?.title || template?.slug || availableTemplates?.[templateSlug];
47
47
  }, []);
48
48
  return (0, _react.createElement)(_components.Button, {
49
+ __next40pxDefaultSize: true,
49
50
  className: "edit-post-post-template__toggle",
50
51
  variant: "tertiary",
51
52
  "aria-expanded": isOpen,
@@ -65,7 +66,7 @@ function PostTemplateDropdownContent({
65
66
  canCreate,
66
67
  canEdit,
67
68
  currentTemplateId,
68
- getPostLinkProps,
69
+ onNavigateToEntityRecord,
69
70
  getEditorSettings
70
71
  } = (0, _data.useSelect)(select => {
71
72
  const {
@@ -85,14 +86,10 @@ function PostTemplateDropdownContent({
85
86
  canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode,
86
87
  canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId,
87
88
  currentTemplateId: _currentTemplateId,
88
- getPostLinkProps: editorSettings.getPostLinkProps,
89
+ onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
89
90
  getEditorSettings: select(_store.store).getEditorSettings
90
91
  };
91
92
  }, [allowSwitchingTemplate]);
92
- const editTemplate = getPostLinkProps && currentTemplateId ? getPostLinkProps({
93
- postId: currentTemplateId,
94
- postType: 'wp_template'
95
- }) : {};
96
93
  const options = (0, _element.useMemo)(() => Object.entries({
97
94
  ...availableTemplates,
98
95
  ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({
@@ -136,16 +133,19 @@ function PostTemplateDropdownContent({
136
133
  onChange: slug => editPost({
137
134
  template: slug || ''
138
135
  })
139
- }), canEdit && (0, _react.createElement)("p", null, (0, _react.createElement)(_components.Button, {
136
+ }), canEdit && onNavigateToEntityRecord && (0, _react.createElement)("p", null, (0, _react.createElement)(_components.Button, {
140
137
  variant: "link",
141
138
  onClick: () => {
142
- editTemplate.onClick();
139
+ onNavigateToEntityRecord({
140
+ postId: currentTemplateId,
141
+ postType: 'wp_template'
142
+ });
143
143
  onClose();
144
144
  createSuccessNotice((0, _i18n.__)('Editing template. Changes made here affect all posts and pages that use the template.'), {
145
145
  type: 'snackbar',
146
146
  actions: [{
147
147
  label: (0, _i18n.__)('Go back'),
148
- onClick: () => getEditorSettings().goBack()
148
+ onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
149
149
  }]
150
150
  });
151
151
  }
@@ -171,6 +171,5 @@ function ClassicThemeControl() {
171
171
  })
172
172
  });
173
173
  }
174
- var _default = ClassicThemeControl;
175
- exports.default = _default;
174
+ var _default = exports.default = ClassicThemeControl;
176
175
  //# sourceMappingURL=classic-theme.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","getCurrentTemplateId","title","slug","_react","createElement","Button","variant","__","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","getPostLinkProps","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","editTemplate","postId","postType","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__next40pxDefaultSize","__nextHasNoMarginBottom","hideLabelFromVision","onChange","type","goBack","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', 'templates' ) &&\n\t\t\tselect( 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\tclassName=\"edit-post-post-template__toggle\"\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\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\tgetPostLinkProps,\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', 'templates' );\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\tgetPostLinkProps: editorSettings.getPostLinkProps,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst editTemplate =\n\t\tgetPostLinkProps && currentTemplateId\n\t\t\t? getPostLinkProps( {\n\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t } )\n\t\t\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 && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\teditTemplate.onClick();\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().goBack(),\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\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;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,u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AAM;MACfyC,YAAY,CAACzC,OAAO,CAAC,CAAC;MACtBsB,OAAO,CAAC,CAAC;MACToC,mBAAmB,CAClB,IAAAtC,QAAE,EACD,uFACD,CAAC,EACD;QACCwD,IAAI,EAAE,UAAU;QAChBX,OAAO,EAAE,CACR;UACCb,KAAK,EAAE,IAAAhC,QAAE,EAAE,SAAU,CAAC;UACtBpB,OAAO,EAAEA,CAAA,KACRS,iBAAiB,CAAC,CAAC,CAACoE,MAAM,CAAC;QAC7B,CAAC;MAEH,CACD,CAAC;IACF;EAAG,GAED,IAAAzD,QAAE,EAAE,eAAgB,CACf,CACN,CACH,EACCwC,iBAAiB,IAClB,IAAA5C,MAAA,CAAAC,aAAA,EAACzB,uBAAA,CAAAsF,OAAsB;IACtBxD,OAAO,EAAGA,CAAA,KAAMuC,oBAAoB,CAAE,KAAM;EAAG,CAC/C,CAEE,CAAC;AAER;AAEA,SAASkB,mBAAmBA,CAAA,EAAG;EAC9B,OACC,IAAA/D,MAAA,CAAAC,aAAA,EAACjC,WAAA,CAAAgG,QAAQ;IACRC,YAAY,EAAGtF,aAAe;IAC9BuF,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEpF,MAAM;MAAEqF;IAAS,CAAC,KACpC,IAAApE,MAAA,CAAAC,aAAA,EAACnB,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGoF;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAE/D;IAAQ,CAAC,KAC5B,IAAAN,MAAA,CAAAC,aAAA,EAACI,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;AAAC,IAAAgE,QAAA,GAEcP,mBAAmB;AAAAQ,OAAA,CAAAT,OAAA,GAAAQ,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","getCurrentTemplateId","title","slug","_react","createElement","Button","__next40pxDefaultSize","variant","__","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","__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', 'templates' ) &&\n\t\t\tselect( 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\tclassName=\"edit-post-post-template__toggle\"\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\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', 'templates' );\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\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\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;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAA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,mBAAmB,CAClB,IAAAnC,QAAE,EACD,uFACD,CAAC,EACD;QACCsD,IAAI,EAAE,UAAU;QAChBZ,OAAO,EAAE,CACR;UACCb,KAAK,EAAE,IAAA7B,QAAE,EAAE,SAAU,CAAC;UACtBrB,OAAO,EAAEA,CAAA,KACRS,iBAAiB,CAAC,CAAC,CAACmE,gCAAgC,CAAC;QACvD,CAAC;MAEH,CACD,CAAC;IACF;EAAG,GAED,IAAAvD,QAAE,EAAE,eAAgB,CACf,CACN,CACH,EACCqC,iBAAiB,IAClB,IAAA1C,MAAA,CAAAC,aAAA,EAACzB,uBAAA,CAAAqF,OAAsB;IACtBtD,OAAO,EAAGA,CAAA,KAAMoC,oBAAoB,CAAE,KAAM;EAAG,CAC/C,CAEE,CAAC;AAER;AAEA,SAASmB,mBAAmBA,CAAA,EAAG;EAC9B,OACC,IAAA9D,MAAA,CAAAC,aAAA,EAACjC,WAAA,CAAA+F,QAAQ;IACRC,YAAY,EAAGrF,aAAe;IAC9BsF,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEnF,MAAM;MAAEoF;IAAS,CAAC,KACpC,IAAAnE,MAAA,CAAAC,aAAA,EAACnB,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGmF;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAE7D;IAAQ,CAAC,KAC5B,IAAAP,MAAA,CAAAC,aAAA,EAACK,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;AAAC,IAAA8D,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAEcC,mBAAmB"}
@@ -27,7 +27,7 @@ function CreateNewTemplateModal({
27
27
  }) {
28
28
  const {
29
29
  defaultBlockTemplate,
30
- getPostLinkProps
30
+ onNavigateToEntityRecord
31
31
  } = (0, _data.useSelect)(select => {
32
32
  const {
33
33
  getEditorSettings,
@@ -35,7 +35,7 @@ function CreateNewTemplateModal({
35
35
  } = select(_store.store);
36
36
  return {
37
37
  defaultBlockTemplate: getEditorSettings().defaultBlockTemplate,
38
- getPostLinkProps: getEditorSettings().getPostLinkProps,
38
+ onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord,
39
39
  getTemplateId: getCurrentTemplateId
40
40
  };
41
41
  });
@@ -76,11 +76,10 @@ function CreateNewTemplateModal({
76
76
  title: title || DEFAULT_TITLE
77
77
  });
78
78
  setIsBusy(false);
79
- const editTemplate = getPostLinkProps ? getPostLinkProps({
79
+ onNavigateToEntityRecord({
80
80
  postId: newTemplate.id,
81
81
  postType: 'wp_template'
82
- }) : {};
83
- editTemplate.onClick();
82
+ });
84
83
  cancel();
85
84
  };
86
85
  return (0, _react.createElement)(_components.Modal, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","DEFAULT_TITLE","__","CreateNewTemplateModal","onClose","defaultBlockTemplate","getPostLinkProps","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","editTemplate","postId","id","postType","onClick","_react","createElement","Modal","onRequestClose","className","onSubmit","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","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, getPostLinkProps } = 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\tgetPostLinkProps: getEditorSettings().getPostLinkProps,\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\tconst editTemplate = getPostLinkProps\n\t\t\t? getPostLinkProps( {\n\t\t\t\t\tpostId: newTemplate.id,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t } )\n\t\t\t: {};\n\t\teditTemplate.onClick();\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>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ cancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\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zC,MAAM,EAAGA,MAAQ;IACjB,iBAAgBA;EAAQ,GAEtB,IAAAjB,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
1
+ {"version":3,"names":["_data","require","_element","_blocks","_components","_i18n","_url","_lockUnlock","_store","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","_react","createElement","Modal","onRequestClose","className","onSubmit","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","__experimentalHStack","justify","Button","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ cancel }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,I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AgB,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAAgD,oBAAM;IAACC,OAAO,EAAC;EAAG,GAClB,IAAAP,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAAkD,WAAW;IACXC,uBAAuB;IACvBC,KAAK,EAAG,IAAA9C,QAAE,EAAE,MAAO,CAAG;IACtB+C,KAAK,EAAGjC,KAAO;IACfkC,QAAQ,EAAGjC,QAAU;IACrBkC,WAAW,EAAGlD,aAAe;IAC7BmD,QAAQ,EAAGjC,MAAQ;IACnBkC,IAAI,EAAG,IAAAnD,QAAE,EACR,iHACD;EAAG,CACH,CAAC,EACF,IAAAoC,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAA0D,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAAjB,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAA4D,MAAM;IAACC,OAAO,EAAC,UAAU;IAACC,OAAO,EAAGrC;EAAQ,GAC1C,IAAAnB,QAAE,EAAE,QAAS,CACR,CAAC,EAET,IAAAoC,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAA4D,MAAM;IACNC,OAAO,EAAC,SAAS;IACjBE,IAAI,EAAC,QAAQ;IACbxC,MAAM,EAAGA,MAAQ;IACjB,iBAAgBA;EAAQ,GAEtB,IAAAjB,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
@@ -53,7 +53,11 @@ function PostTemplatePanel() {
53
53
  const canCreateTemplates = (_select$canUser = select(_coreData.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
54
54
  return canCreateTemplates;
55
55
  }, []);
56
- if (!isBlockTheme && isVisible) {
56
+ const canViewTemplates = (0, _data.useSelect)(select => {
57
+ var _select$canUser2;
58
+ return (_select$canUser2 = select(_coreData.store).canUser('read', 'templates')) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
59
+ }, []);
60
+ if ((!isBlockTheme || !canViewTemplates) && isVisible) {
57
61
  return (0, _react.createElement)(_postPanelRow.default, {
58
62
  label: (0, _i18n.__)('Template')
59
63
  }, (0, _react.createElement)(_classicTheme.default, null));
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_coreData","_store","_classicTheme","_interopRequireDefault","_blockTheme","_postPanelRow","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","_react","createElement","default","label","__","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\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', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tif ( ! isBlockTheme && 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;AAbA;AACA;AACA;;AAKA;AACA;AACA;;AAMe,SAASQ,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,CAACK,kBAAkB,CAAC,CAA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C;EAEjB;EACA,OAAO,IAAI;AACZ"}
1
+ {"version":3,"names":["_data","require","_i18n","_coreData","_store","_classicTheme","_interopRequireDefault","_blockTheme","_postPanelRow","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","canViewTemplates","_select$canUser2","_react","createElement","default","label","__","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\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', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn select( coreStore ).canUser( 'read', 'templates' ) ?? false;\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;AAbA;AACA;AACA;;AAKA;AACA;AACA;;AAMe,SAASQ,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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AA,EAACjC,aAAA,CAAAkC,OAAmB,MAAE,CACT,CAAC;EAEjB;EAEA,IAAK5B,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,OACC,IAAA2B,MAAA,CAAAC,aAAA,EAAC9B,aAAA,CAAA+B,OAAY;MAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,UAAW;IAAG,GACvC,IAAAJ,MAAA,CAAAC,aAAA,EAAC/B,WAAA,CAAAgC,OAAiB;MAACG,EAAE,EAAGhC;IAAY,CAAE,CACzB,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ"}
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.REGEXP_NEWLINES = exports.DEFAULT_CLASSNAMES = void 0;
7
- const DEFAULT_CLASSNAMES = 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text';
8
- exports.DEFAULT_CLASSNAMES = DEFAULT_CLASSNAMES;
9
- const REGEXP_NEWLINES = /[\r\n]+/g;
10
- exports.REGEXP_NEWLINES = REGEXP_NEWLINES;
7
+ const DEFAULT_CLASSNAMES = exports.DEFAULT_CLASSNAMES = 'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text';
8
+ const REGEXP_NEWLINES = exports.REGEXP_NEWLINES = /[\r\n]+/g;
11
9
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_CLASSNAMES","exports","REGEXP_NEWLINES"],"sources":["@wordpress/editor/src/components/post-title/constants.js"],"sourcesContent":["export const DEFAULT_CLASSNAMES =\n\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text';\n\nexport const REGEXP_NEWLINES = /[\\r\\n]+/g;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAC9B,kHAAkH;AAACC,OAAA,CAAAD,kBAAA,GAAAA,kBAAA;AAE7G,MAAME,eAAe,GAAG,UAAU;AAACD,OAAA,CAAAC,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["DEFAULT_CLASSNAMES","exports","REGEXP_NEWLINES"],"sources":["@wordpress/editor/src/components/post-title/constants.js"],"sourcesContent":["export const DEFAULT_CLASSNAMES =\n\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text';\n\nexport const REGEXP_NEWLINES = /[\\r\\n]+/g;\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC9B,kHAAkH;AAE5G,MAAME,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,UAAU"}
@@ -194,7 +194,7 @@ function PostTitle(_, forwardedRef) {
194
194
  'is-selected': isSelected,
195
195
  'has-fixed-toolbar': hasFixedToolbar
196
196
  });
197
- return (/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
197
+ return /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */(
198
198
  (0, _react.createElement)(_postTypeSupportCheck.default, {
199
199
  supportKeys: "title"
200
200
  }, (0, _react.createElement)("h1", {
@@ -213,6 +213,5 @@ function PostTitle(_, forwardedRef) {
213
213
  /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
214
214
  );
215
215
  }
216
- var _default = (0, _element.forwardRef)(PostTitle);
217
- exports.default = _default;
216
+ var _default = exports.default = (0, _element.forwardRef)(PostTitle);
218
217
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_store","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","PostTitle","_","forwardedRef","placeholder","hasFixedToolbar","useSelect","select","getEditedPostAttribute","editorStore","getSettings","blockEditorStore","titlePlaceholder","_hasFixedToolbar","title","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","onChange","value","replace","REGEXP_NEWLINES","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","classnames","DEFAULT_CLASSNAMES","_react","createElement","default","supportKeys","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","forwardRef","exports"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ENTER } from '@wordpress/keycodes';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { DEFAULT_CLASSNAMES, REGEXP_NEWLINES } from './constants';\nimport usePostTitleFocus from './use-post-title-focus';\nimport usePostTitle from './use-post-title';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst { placeholder, hasFixedToolbar } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\tgetSettings();\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\n\tconst { ref: focusRef } = usePostTitleFocus( forwardedRef );\n\n\tconst { title, setTitle: onUpdate } = usePostTitle();\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tconst { clearSelectedBlock, insertBlocks, insertDefaultBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t\t// is undesirable.\n\t\t\t\tconst contentNoHTML = stripHTML(\n\t\t\t\t\tfirstBlock.attributes.content\n\t\t\t\t);\n\t\t\t\tonUpdate( contentNoHTML );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\n\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t// is undesirable.\n\t\t\tconst contentNoHTML = stripHTML( content );\n\n\t\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: false,\n\t} );\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t} );\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, focusRef ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t);\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,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AC;IAAO,GACxC,IAAAH,MAAA,CAAAC,aAAA;MACCrE,GAAG,EAAG,IAAAwE,qBAAY,EAAE,CAAEhB,WAAW,EAAEvD,QAAQ,CAAG,CAAG;MACjDwE,eAAe;MACfR,SAAS,EAAGA,SAAW;MACvB,cAAaZ,kBAAoB;MACjCqB,IAAI,EAAC,SAAS;MACd,kBAAe,MAAM;MACrBC,OAAO,EAAGzD,QAAU;MACpB0D,MAAM,EAAGzD,UAAY;MACrBG,SAAS,EAAGA,SAAW;MACvBuD,UAAU,EAAG1D,UAAY;MACzBQ,OAAO,EAAGA;IAAS,CACnB,CACoB;IACtB;EAAA;AAEF;AAAC,IAAAmD,QAAA,GAEc,IAAAC,mBAAU,EAAEhG,SAAU,CAAC;AAAAiG,OAAA,CAAAV,OAAA,GAAAQ,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_store","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","PostTitle","_","forwardedRef","placeholder","hasFixedToolbar","useSelect","select","getEditedPostAttribute","editorStore","getSettings","blockEditorStore","titlePlaceholder","_hasFixedToolbar","title","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","onChange","value","replace","REGEXP_NEWLINES","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","classnames","DEFAULT_CLASSNAMES","_react","createElement","default","supportKeys","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { forwardRef, useState } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ENTER } from '@wordpress/keycodes';\nimport { pasteHandler } from '@wordpress/blocks';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { DEFAULT_CLASSNAMES, REGEXP_NEWLINES } from './constants';\nimport usePostTitleFocus from './use-post-title-focus';\nimport usePostTitle from './use-post-title';\nimport PostTypeSupportCheck from '../post-type-support-check';\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst { placeholder, hasFixedToolbar } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\tgetSettings();\n\n\t\treturn {\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tplaceholder: titlePlaceholder,\n\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t};\n\t}, [] );\n\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\n\tconst { ref: focusRef } = usePostTitleFocus( forwardedRef );\n\n\tconst { title, setTitle: onUpdate } = usePostTitle();\n\n\tconst [ selection, setSelection ] = useState( {} );\n\n\tconst { clearSelectedBlock, insertBlocks, insertDefaultBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tfunction onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onSelect() {\n\t\tsetIsSelected( true );\n\t\tclearSelectedBlock();\n\t}\n\n\tfunction onUnselect() {\n\t\tsetIsSelected( false );\n\t\tsetSelection( {} );\n\t}\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t\t// is undesirable.\n\t\t\t\tconst contentNoHTML = stripHTML(\n\t\t\t\t\tfirstBlock.attributes.content\n\t\t\t\t);\n\t\t\t\tonUpdate( contentNoHTML );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\n\t\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t\t// is undesirable.\n\t\t\tconst contentNoHTML = stripHTML( content );\n\n\t\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: false,\n\t} );\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t} );\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, focusRef ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\t);\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAMA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AAKA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,kBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,aAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,qBAAA,GAAAhB,sBAAA,CAAAC,OAAA;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IAAAU,mBAAU,EAAEjG,SAAU,CAAC"}
@@ -168,7 +168,7 @@ class PostTitle extends _element.Component {
168
168
  }));
169
169
  }
170
170
  }
171
- var _default = (0, _compose.compose)((0, _data.withSelect)(select => {
171
+ var _default = exports.default = (0, _compose.compose)((0, _data.withSelect)(select => {
172
172
  const {
173
173
  isPostTitleSelected,
174
174
  getEditedPostAttribute
@@ -224,5 +224,4 @@ var _default = (0, _compose.compose)((0, _data.withSelect)(select => {
224
224
  }
225
225
  };
226
226
  }), _compose.withInstanceId, _components.withFocusOutside)(PostTitle);
227
- exports.default = _default;
228
227
  //# sourceMappingURL=index.native.js.map