@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
@@ -38,6 +38,7 @@ function PostTemplateToggle({
38
38
  return template?.title || template?.slug || availableTemplates?.[templateSlug];
39
39
  }, []);
40
40
  return createElement(Button, {
41
+ __next40pxDefaultSize: true,
41
42
  className: "edit-post-post-template__toggle",
42
43
  variant: "tertiary",
43
44
  "aria-expanded": isOpen,
@@ -57,7 +58,7 @@ function PostTemplateDropdownContent({
57
58
  canCreate,
58
59
  canEdit,
59
60
  currentTemplateId,
60
- getPostLinkProps,
61
+ onNavigateToEntityRecord,
61
62
  getEditorSettings
62
63
  } = useSelect(select => {
63
64
  const {
@@ -77,14 +78,10 @@ function PostTemplateDropdownContent({
77
78
  canCreate: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode,
78
79
  canEdit: allowSwitchingTemplate && canCreateTemplates && editorSettings.supportsTemplateMode && !!_currentTemplateId,
79
80
  currentTemplateId: _currentTemplateId,
80
- getPostLinkProps: editorSettings.getPostLinkProps,
81
+ onNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,
81
82
  getEditorSettings: select(editorStore).getEditorSettings
82
83
  };
83
84
  }, [allowSwitchingTemplate]);
84
- const editTemplate = getPostLinkProps && currentTemplateId ? getPostLinkProps({
85
- postId: currentTemplateId,
86
- postType: 'wp_template'
87
- }) : {};
88
85
  const options = useMemo(() => Object.entries({
89
86
  ...availableTemplates,
90
87
  ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({
@@ -128,16 +125,19 @@ function PostTemplateDropdownContent({
128
125
  onChange: slug => editPost({
129
126
  template: slug || ''
130
127
  })
131
- }), canEdit && createElement("p", null, createElement(Button, {
128
+ }), canEdit && onNavigateToEntityRecord && createElement("p", null, createElement(Button, {
132
129
  variant: "link",
133
130
  onClick: () => {
134
- editTemplate.onClick();
131
+ onNavigateToEntityRecord({
132
+ postId: currentTemplateId,
133
+ postType: 'wp_template'
134
+ });
135
135
  onClose();
136
136
  createSuccessNotice(__('Editing template. Changes made here affect all posts and pages that use the template.'), {
137
137
  type: 'snackbar',
138
138
  actions: [{
139
139
  label: __('Go back'),
140
- onClick: () => getEditorSettings().goBack()
140
+ onClick: () => getEditorSettings().onNavigateToPreviousEntityRecord()
141
141
  }]
142
142
  });
143
143
  }
@@ -1 +1 @@
1
- {"version":3,"names":["__","SelectControl","Dropdown","Button","Notice","useSelect","useDispatch","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useState","useMemo","addTemplate","noticesStore","editorStore","CreateNewTemplateModal","useAllowSwitchingTemplates","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","select","templateSlug","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","canUser","getCurrentTemplateId","title","slug","createElement","variant","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","getPostLinkProps","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","editTemplate","postId","postType","options","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","createSuccessNotice","isCreateModalOpen","setIsCreateModalOpen","help","actions","icon","status","isDismissible","__next40pxDefaultSize","__nextHasNoMarginBottom","hideLabelFromVision","onChange","type","goBack","ClassicThemeControl","popoverProps","focusOnMount","renderToggle","onToggle","renderContent"],"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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASN,KAAK,IAAIO,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAClD,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAEpD,MAAMC,aAAa,GAAG;EACrBC,SAAS,EAAE,gCA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AAGA,CAAA,KAAMmC,oBAAoB,CAAE,KAAM;EAAG,CAC/C,CAEE,CAAC;AAER;AAEA,SAASY,mBAAmBA,CAAA,EAAG;EAC9B,OACClD,aAAA,CAAClC,QAAQ;IACRqF,YAAY,EAAGrE,aAAe;IAC9BsE,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEnE,MAAM;MAAEoE;IAAS,CAAC,KACpCtD,aAAA,CAACf,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGmE;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAEpD;IAAQ,CAAC,KAC5BH,aAAA,CAACE,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;AAEA,eAAe+C,mBAAmB"}
1
+ {"version":3,"names":["__","SelectControl","Dropdown","Button","Notice","useSelect","useDispatch","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useState","useMemo","addTemplate","noticesStore","editorStore","CreateNewTemplateModal","useAllowSwitchingTemplates","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","select","templateSlug","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","canUser","getCurrentTemplateId","title","slug","createElement","__next40pxDefaultSize","variant","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","createSuccessNotice","isCreateModalOpen","setIsCreateModalOpen","help","actions","icon","status","isDismissible","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","ClassicThemeControl","popoverProps","focusOnMount","renderToggle","onToggle","renderContent"],"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":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASN,KAAK,IAAIO,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAClD,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAEpD,MAAMC,aAAa,GAAG;EACrBC,SAAS,EAAE,gCAAgC;EAC3CC,SAAS,EAAE;AACZ,CAAC;AAED,SAASC,kBAAkBA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAClD,MAAMC,aAAa,GAAGnB,SAAS,CAAIoB,MAAM,IAAM;IAC9C,MAAMC,YAAY,GACjBD,MAAM,CAAEV,WAAY,CAAC,CAACY,sBAAsB,CAAE,UAAW,CAAC;IAE3D,MAAM;MAAEC,oBAAoB;MAAEC;IAAmB,CAAC,GACjDJ,MAAM,CAAEV,WAAY,CAAC,CAACe,iBAAiB,CAAC,CAAC;IAC1C,IAAK,CAAEF,oBAAoB,IAAIC,kBAAkB,CAAEH,YAA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AAe6C,mBAAmB"}
@@ -20,7 +20,7 @@ export default function CreateNewTemplateModal({
20
20
  }) {
21
21
  const {
22
22
  defaultBlockTemplate,
23
- getPostLinkProps
23
+ onNavigateToEntityRecord
24
24
  } = useSelect(select => {
25
25
  const {
26
26
  getEditorSettings,
@@ -28,7 +28,7 @@ export default function CreateNewTemplateModal({
28
28
  } = select(editorStore);
29
29
  return {
30
30
  defaultBlockTemplate: getEditorSettings().defaultBlockTemplate,
31
- getPostLinkProps: getEditorSettings().getPostLinkProps,
31
+ onNavigateToEntityRecord: getEditorSettings().onNavigateToEntityRecord,
32
32
  getTemplateId: getCurrentTemplateId
33
33
  };
34
34
  });
@@ -69,11 +69,10 @@ export default function CreateNewTemplateModal({
69
69
  title: title || DEFAULT_TITLE
70
70
  });
71
71
  setIsBusy(false);
72
- const editTemplate = getPostLinkProps ? getPostLinkProps({
72
+ onNavigateToEntityRecord({
73
73
  postId: newTemplate.id,
74
74
  postType: 'wp_template'
75
- }) : {};
76
- editTemplate.onClick();
75
+ });
77
76
  cancel();
78
77
  };
79
78
  return createElement(Modal, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","unlock","store","editorStore","DEFAULT_TITLE","CreateNewTemplateModal","onClose","defaultBlockTemplate","getPostLinkProps","select","getEditorSettings","getCurrentTemplateId","getTemplateId","createTemplate","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","newTemplate","slug","content","editTemplate","postId","id","postType","onClick","createElement","onRequestClose","className","onSubmit","spacing","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","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\"\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":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,mBAAmB;AAC1D,SACCC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,MAAMC,aAAa,GAAGL,EAAE,CAAE,iBAAkB,CAAC;AAE7C,eAAe,SAASM,sBAAsBA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EAC7D,MAAM;IAAEC,oBAAoB;IAAEC;EAAiB,CAAC,GAAGrB,SAAS,CACzDsB,MAAM,IAAM;IACb,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEN,WAAY,CAAC;IACtB,OAAO;MACNI,oBAAoB,EAAEG,iBAAiB,CAAC,CAAC,CAACH,oBAAoB;MAC9DC,gBAAgB,EAA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EAAQ,GAEtBjB,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
1
+ {"version":3,"names":["useSelect","useDispatch","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","unlock","store","editorStore","DEFAULT_TITLE","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","select","getEditorSettings","getCurrentTemplateId","getTemplateId","createTemplate","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","newTemplate","slug","content","postId","id","postType","createElement","onRequestClose","className","onSubmit","spacing","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","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":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,mBAAmB;AAC1D,SACCC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9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AO,CAAG;IACtBwC,KAAK,EAAGzB,KAAO;IACf0B,QAAQ,EAAGzB,QAAU;IACrB0B,WAAW,EAAGrC,aAAe;IAC7BsC,QAAQ,EAAG1B,MAAQ;IACnB2B,IAAI,EAAG5C,EAAE,CACR,iHACD;EAAG,CACH,CAAC,EACFiC,aAAA,CAACpC,MAAM;IAACgD,OAAO,EAAC;EAAO,GACtBZ,aAAA,CAACtC,MAAM;IAACmD,OAAO,EAAC,UAAU;IAACC,OAAO,EAAG5B;EAAQ,GAC1CnB,EAAE,CAAE,QAAS,CACR,CAAC,EAETiC,aAAA,CAACtC,MAAM;IACNmD,OAAO,EAAC,SAAS;IACjBE,IAAI,EAAC,QAAQ;IACb/B,MAAM,EAAGA,MAAQ;IACjB,iBAAgBA;EAAQ,GAEtBjB,EAAE,CAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
@@ -45,7 +45,11 @@ export default function PostTemplatePanel() {
45
45
  const canCreateTemplates = (_select$canUser = select(coreStore).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false;
46
46
  return canCreateTemplates;
47
47
  }, []);
48
- if (!isBlockTheme && isVisible) {
48
+ const canViewTemplates = useSelect(select => {
49
+ var _select$canUser2;
50
+ return (_select$canUser2 = select(coreStore).canUser('read', 'templates')) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
51
+ }, []);
52
+ if ((!isBlockTheme || !canViewTemplates) && isVisible) {
49
53
  return createElement(PostPanelRow, {
50
54
  label: __('Template')
51
55
  }, createElement(ClassicThemeControl, null));
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","createElement","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</PostPanel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,EAAG;MACnB,OAAO,IAAI;IACZ;IAEA,IAAK,CAAED,QAAQ,CAACM,oBAAoB,EAAG;MACtC,OAAO,KAAK;IACb;IAEA,MAAMC,kBAAkB,IAAAb,eAAA,GACvBL,MAAM,CAAER,SAAU,CAAC,CAAC2B,OAAO,CAAE,QAAQ,EAAE,WAAY,CAAC,cAAAd,eAAA,cAAAA,eAAA,GAAI,KAAK;IAC9D,OAAOa,kBAAkB;EAC1B,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEnB,YAAY,IAAIK,SAAS,EAAG;IAClC,OACCgB,aAAA,CAACxB,YAAY;MAACyB,KAAK,EAAG/B,EAAE,CAAE,UAAW;IAAG,GACvC8B,aAAA,CAAC1B,mBAAmB,MAAE,CACT,CAAC;EAEjB;EAEA,IAAKK,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,OACCsB,aAAA,CAACxB,YAAY;MAACyB,KAAK,EAAG/B,EAAE,CAAE,UAAW;IAAG,GACvC8B,aAAA,CAACzB,iBAAiB;MAAC2B,EAAE,EAAGxB;IAAY,CAAE,CACzB,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ"}
1
+ {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","canViewTemplates","_select$canUser2","createElement","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":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,K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L,MAAM,CAAER,SAAU,CAAC,CAAC2B,OAAO,CAAE,QAAQ,EAAE,WAAY,CAAC,cAAAd,eAAA,cAAAA,eAAA,GAAI,KAAK;IAC9D,OAAOa,kBAAkB;EAC1B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,gBAAgB,GAAG/B,SAAS,CAAIW,MAAM,IAAM;IAAA,IAAAqB,gBAAA;IACjD,QAAAA,gBAAA,GAAOrB,MAAM,CAAER,SAAU,CAAC,CAAC2B,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,KAAK;EACnE,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAE,CAAEtB,YAAY,IAAI,CAAEqB,gBAAgB,KAAMhB,SAAS,EAAG;IAC5D,OACCkB,aAAA,CAAC1B,YAAY;MAAC2B,KAAK,EAAGjC,EAAE,CAAE,UAAW;IAAG,GACvCgC,aAAA,CAAC5B,mBAAmB,MAAE,CACT,CAAC;EAEjB;EAEA,IAAKK,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,OACCwB,aAAA,CAAC1B,YAAY;MAAC2B,KAAK,EAAGjC,EAAE,CAAE,UAAW;IAAG,GACvCgC,aAAA,CAAC3B,iBAAiB;MAAC6B,EAAE,EAAG1B;IAAY,CAAE,CACzB,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ"}
@@ -186,7 +186,7 @@ function PostTitle(_, forwardedRef) {
186
186
  'is-selected': isSelected,
187
187
  'has-fixed-toolbar': hasFixedToolbar
188
188
  });
189
- return (/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
189
+ return /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */(
190
190
  createElement(PostTypeSupportCheck, {
191
191
  supportKeys: "title"
192
192
  }, createElement("h1", {
@@ -205,6 +205,5 @@ function PostTitle(_, forwardedRef) {
205
205
  /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
206
206
  );
207
207
  }
208
-
209
208
  export default forwardRef(PostTitle);
210
209
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__","forwardRef","useState","decodeEntities","useSelect","useDispatch","store","blockEditorStore","ENTER","pasteHandler","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","editorStore","DEFAULT_CLASSNAMES","REGEXP_NEWLINES","usePostTitleFocus","usePostTitle","PostTypeSupportCheck","PostTitle","_","forwardedRef","placeholder","hasFixedToolbar","select","getEditedPostAttribute","getSettings","titlePlaceholder","_hasFixedToolbar","title","isSelected","setIsSelected","ref","focusRef","setTitle","onUpdate","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","onChange","value","replace","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","contentNoHTML","attributes","slice","newValue","start","end","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","createElement","supportKeys","contentEditable","role","onFocus","onBlur","onKeyPress"],"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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SACCC,qBAAqB,IAAIC,WAAW,EACpCC,MAAM,EACNC,YAAY,EACZC,MAAM,QACA,sBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;;AAEjE;AACA;AACA;AACA,SAASX,KAAK,IAAIY,WAAW,QAAQ,aAAa;AAClD,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,aAAa;AACjE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,oBAAoB,MAAM,4BAA4B;AAE7D,SAASC,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAM;IAAEC,WAAW;IAAEC;EAAgB,CAAC,GAAGxB,SAAS,CAAIyB,MAAM,IAAM;IACjE,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEX,WAAY,CAAC;IACxD,MAAM;MAAEa;IAAY,CAAC,GAAGF,MAAM,CAAEtB,gBAAiB,CAAC;IAClD,MAAM;MAAEyB,gBAAgB;MAAEJ,eAAe,EAAEK;IAAiB,CAAC,GAC5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MACF,CAAE,CAAC;IACJ,CAAC;IACDE,wBAAwB,EAAE;EAC3B,CAAE,CAAC;;EAEH;EACA;EACA,MAAMC,SAAS,GAAG1F,UAAU,CAAEoB,kBAAkB,EAAE;IACjD,aAAa,EAAEgB,UAAU;IACzB,mBAAmB,EAAEP;EACtB,CAAE,CAAC;EAEH,OACC;IACA8D,aAAA,CAACnE,oBAAoB;MAACoE,WAAW,EAAC;IAAO,GACxCD,aAAA;MACCrD,GAAG,EAAGtB,YAAY,CAAE,CAAEkE,WAAW,EAAE3C,QAAQ,CAAG,CAAG;MACjDsD,eAAe;MACfH,SAAS,EAAGA,SAAW;MACvB,cAAaT,kBAAoB;MACjCa,IAAI,EAAC,SAAS;MACd,kBAAe,MAAM;MACrBC,OAAO,EAAG3C,QAAU;MACpB4C,MAAM,EAAG3C,UAAY;MACrBG,SAAS,EAAGA,SAAW;MACvByC,UAAU,EAAG5C,UAAY;MACzBO,OAAO,EAAGA;IAAS,CACnB,CACoB;IACtB;EAAA;AAEF;;AAEA,eAAe1D,UAAU,CAAEuB,SAAU,CAAC"}
1
+ {"version":3,"names":["classnames","__","forwardRef","useState","decodeEntities","useSelect","useDispatch","store","blockEditorStore","ENTER","pasteHandler","__unstableUseRichText","useRichText","create","toHTMLString","insert","useMergeRefs","__unstableStripHTML","stripHTML","editorStore","DEFAULT_CLASSNAMES","REGEXP_NEWLINES","usePostTitleFocus","usePostTitle","PostTypeSupportCheck","PostTitle","_","forwardedRef","placeholder","hasFixedToolbar","select","getEditedPostAttribute","getSettings","titlePlaceholder","_hasFixedToolbar","title","isSelected","setIsSelected","ref","focusRef","setTitle","onUpdate","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","onChange","value","replace","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","HTML","length","firstBlock","name","contentNoHTML","attributes","slice","newValue","start","end","decodedPlaceholder","richTextRef","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","className","createElement","supportKeys","contentEditable","role","onFocus","onBlur","onKeyPress"],"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":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SACCC,qBAAqB,IAAIC,WAAW,EACpCC,MAAM,EACNC,YAAY,EACZC,MAAM,QACA,sBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;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,7 @@ export default function PostTrash() {
36
36
  trashPost();
37
37
  };
38
38
  return createElement(Fragment, null, createElement(Button, {
39
+ __next40pxDefaultSize: true,
39
40
  className: "editor-post-trash",
40
41
  isDestructive: true,
41
42
  variant: "secondary",
@@ -1 +1 @@
1
- {"version":3,"names":["__","Button","__experimentalConfirmDialog","ConfirmDialog","useSelect","useDispatch","useState","store","editorStore","PostTrash","isNew","isDeleting","postId","select","isEditedPostNew","isDeletingPost","getCurrentPostId","trashPost","showConfirmDialog","setShowConfirmDialog","handleConfirm","createElement","Fragment","className","isDestructive","variant","isBusy","onClick","undefined","isOpen","onConfirm","onCancel"],"sources":["@wordpress/editor/src/components/post-trash/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostTrash() {\n\tconst { isNew, isDeleting, postId } = useSelect( ( select ) => {\n\t\tconst store = select( editorStore );\n\t\treturn {\n\t\t\tisNew: store.isEditedPostNew(),\n\t\t\tisDeleting: store.isDeletingPost(),\n\t\t\tpostId: store.getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { trashPost } = useDispatch( editorStore );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( isNew || ! postId ) {\n\t\treturn null;\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\ttrashPost();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-trash\"\n\t\t\t\tisDestructive\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isDeleting }\n\t\t\t\taria-disabled={ isDeleting }\n\t\t\t\tonClick={\n\t\t\t\t\tisDeleting ? undefined : () => setShowConfirmDialog( true )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Move to trash' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Are you sure you want to move this post to the trash?'\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,MAAM,EACNC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IAC9D,MAAMN,KAAK,GAAGM,MAAM,CAAEL,WAAY,CAAC;IACnC,OAAO;MACNE,KAAK,EAAEH,KAAK,CAACO,eAAe,CAAC,CAAC;MAC9BH,UAAU,EAAEJ,KAAK,CAACQ,cAAc,CAAC,CAAC;MAClCH,MAAM,EAAEL,KAAK,CAACS,gBAAgB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAU,CAAC,GAAGZ,WAAW,CAAEG,WAAY,CAAC;EAChD,MAAM,CAAEU,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGb,QAAQ,CAAE,KAAM,CAAC;EAErE,IAAKI,KAAK,IAAI,CAAEE,MAAM,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,MAAMQ,aAAa,GAAGA,CAAA,KAAM;IAC3BD,oBAAoB,CAAE,KAAM,CAAC;IAC7BF,SAAS,CAAC,CAAC;EACZ,CAAC;EAED,OACCI,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACpB,MAAM;IACNsB,SAAS,EAAC,mBAAmB;IAC7BC,aAAa;IACbC,OAAO,EAAC,WAAW;IACnBC,MAAM,EAAGf,UAAY;IACrB,iBAAgBA,UAAY;IAC5BgB,OAAO,EACNhB,UAAU,GAAGiB,SAAS,GAAG,MAAMT,oBAAoB,CAAE,IAAK;EAC1D,GAECnB,EAAE,CAAE,eAAgB,CACf,CAAC,EACTqB,aAAA,CAAClB,aAAa;IACb0B,MAAM,EAAGX,iBAAmB;IAC5BY,SAAS,EAAGV,aAAe;IAC3BW,QAAQ,EAAGA,CAAA,KAAMZ,oBAAoB,CAAE,KAAM;EAAG,GAE9CnB,EAAE,CACH,uDACD,CACc,CACd,CAAC;AAEL"}
1
+ {"version":3,"names":["__","Button","__experimentalConfirmDialog","ConfirmDialog","useSelect","useDispatch","useState","store","editorStore","PostTrash","isNew","isDeleting","postId","select","isEditedPostNew","isDeletingPost","getCurrentPostId","trashPost","showConfirmDialog","setShowConfirmDialog","handleConfirm","createElement","Fragment","__next40pxDefaultSize","className","isDestructive","variant","isBusy","onClick","undefined","isOpen","onConfirm","onCancel"],"sources":["@wordpress/editor/src/components/post-trash/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostTrash() {\n\tconst { isNew, isDeleting, postId } = useSelect( ( select ) => {\n\t\tconst store = select( editorStore );\n\t\treturn {\n\t\t\tisNew: store.isEditedPostNew(),\n\t\t\tisDeleting: store.isDeletingPost(),\n\t\t\tpostId: store.getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { trashPost } = useDispatch( editorStore );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( isNew || ! postId ) {\n\t\treturn null;\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\ttrashPost();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"editor-post-trash\"\n\t\t\t\tisDestructive\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isDeleting }\n\t\t\t\taria-disabled={ isDeleting }\n\t\t\t\tonClick={\n\t\t\t\t\tisDeleting ? undefined : () => setShowConfirmDialog( true )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Move to trash' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Are you sure you want to move this post to the trash?'\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,MAAM,EACNC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IAC9D,MAAMN,KAAK,GAAGM,MAAM,CAAEL,WAAY,CAAC;IACnC,OAAO;MACNE,KAAK,EAAEH,KAAK,CAACO,eAAe,CAAC,CAAC;MAC9BH,UAAU,EAAEJ,KAAK,CAACQ,cAAc,CAAC,CAAC;MAClCH,MAAM,EAAEL,KAAK,CAACS,gBAAgB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAU,CAAC,GAAGZ,WAAW,CAAEG,WAAY,CAAC;EAChD,MAAM,CAAEU,iBAAiB,EAAEC,oBAAoB,CAAE,GAAGb,QAAQ,CAAE,KAAM,CAAC;EAErE,IAAKI,KAAK,IAAI,CAAEE,MAAM,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,MAAMQ,aAAa,GAAGA,CAAA,KAAM;IAC3BD,oBAAoB,CAAE,KAAM,CAAC;IAC7BF,SAAS,CAAC,CAAC;EACZ,CAAC;EAED,OACCI,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACpB,MAAM;IACNsB,qBAAqB;IACrBC,SAAS,EAAC,mBAAmB;IAC7BC,aAAa;IACbC,OAAO,EAAC,WAAW;IACnBC,MAAM,EAAGhB,UAAY;IACrB,iBAAgBA,UAAY;IAC5BiB,OAAO,EACNjB,UAAU,GAAGkB,SAAS,GAAG,MAAMV,oBAAoB,CAAE,IAAK;EAC1D,GAECnB,EAAE,CAAE,eAAgB,CACf,CAAC,EACTqB,aAAA,CAAClB,aAAa;IACb2B,MAAM,EAAGZ,iBAAmB;IAC5Ba,SAAS,EAAGX,aAAe;IAC3BY,QAAQ,EAAGA,CAAA,KAAMb,oBAAoB,CAAE,KAAM;EAAG,GAE9CnB,EAAE,CACH,uDACD,CACc,CACd,CAAC;AAEL"}
@@ -50,6 +50,7 @@ function PostURLToggle({
50
50
  }) {
51
51
  const label = usePostURLLabel();
52
52
  return createElement(Button, {
53
+ __next40pxDefaultSize: true,
53
54
  className: "editor-post-url__panel-toggle",
54
55
  variant: "tertiary",
55
56
  "aria-expanded": isOpen
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useState","Dropdown","Button","__","sprintf","PostURLCheck","PostURL","usePostURLLabel","PostPanelRow","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","label","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport { usePostURLLabel } from './label';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'URL' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,SAAS;AAClC,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,eAAe,QAAQ,SAAS;AACzC,OAAOC,YAAY,MAAM,mBAAmB;AAE5C,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGX,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMY,YAAY,GAAGb,OAAO,CAC3B,OAAQ;IAAEc,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACV,YAAY,QACZU,aAAA,CAACP,YAAY;IAACQ,KAAK,EAAGb,EAAE,CAAE,KAAM,CAAG;IAACc,GAAG,EAAGN;EAAkB,GAC3DI,aAAA,CAACd,QAAQ;IACRW,YAAY,EAAGA,YAAc;IAC7BM,SAAS,EAAC,iCAAiC;IAC3CC,gBAAgB,EAAC,+BAA+B;IAChDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpCR,aAAA,CAACS,aAAa;MAACF,MAAM,EAAGA,MAAQ;MAACG,OAAO,EAAGF;IAAU,CAAE,CACrD;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5BZ,aAAA,CAACT,OAAO;MAACqB,OAAO,EAAGA;IAAS,CAAE;EAC5B,CACH,CACY,CACD,CAAC;AAEjB;AAEA,SAASH,aAAaA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAC7C,MAAMT,KAAK,GAAGT,eAAe,CAAC,CAAC;EAC/B,OACCQ,aAAA,CAACb,MAAM;IACNgB,SAAS,EAAC,+BAA+B;IACzCU,OAAO,EAAC,UAAU;IAClB,iBAAgBN;IAChB;IAAA;IACA,cAAalB,OAAO,CAAED,EAAE,CAAE,gBAAiB,CAAC,EAAEa,KAAM,CAAG;IACvDS,OAAO,EAAGA;EAAS,GAEjBT,KACK,CAAC;AAEX"}
1
+ {"version":3,"names":["useMemo","useState","Dropdown","Button","__","sprintf","PostURLCheck","PostURL","usePostURLLabel","PostPanelRow","PostURLPanel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","label","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","__next40pxDefaultSize","variant"],"sources":["@wordpress/editor/src/components/post-url/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostURLCheck from './check';\nimport PostURL from './index';\nimport { usePostURLLabel } from './label';\nimport PostPanelRow from '../post-panel-row';\n\nexport default function PostURLPanel() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostURLCheck>\n\t\t\t<PostPanelRow label={ __( 'URL' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"editor-post-url__panel-dropdown\"\n\t\t\t\t\tcontentClassName=\"editor-post-url__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURL onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"editor-post-url__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,SAAS;AAClC,OAAOC,OAAO,MAAM,SAAS;AAC7B,SAASC,eAAe,QAAQ,SAAS;AACzC,OAAOC,YAAY,MAAM,mBAAmB;AAE5C,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGX,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMY,YAAY,GAAGb,OAAO,CAC3B,OAAQ;IAAEc,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACV,YAAY,QACZU,aAAA,CAACP,YAAY;IAACQ,KAAK,EAAGb,EAAE,CAAE,KAAM,CAAG;IAACc,GAAG,EAAGN;EAAkB,GAC3DI,aAAA,CAACd,QAAQ;IACRW,YAAY,EAAGA,YAAc;IAC7BM,SAAS,EAAC,iCAAiC;IAC3CC,gBAAgB,EAAC,+BAA+B;IAChDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpCR,aAAA,CAACS,aAAa;MAACF,MAAM,EAAGA,MAAQ;MAACG,OAAO,EAAGF;IAAU,CAAE,CACrD;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5BZ,aAAA,CAACT,OAAO;MAACqB,OAAO,EAAGA;IAAS,CAAE;EAC5B,CACH,CACY,CACD,CAAC;AAEjB;AAEA,SAASH,aAAaA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAC7C,MAAMT,KAAK,GAAGT,eAAe,CAAC,CAAC;EAC/B,OACCQ,aAAA,CAACb,MAAM;IACN0B,qBAAqB;IACrBV,SAAS,EAAC,+BAA+B;IACzCW,OAAO,EAAC,UAAU;IAClB,iBAAgBP;IAChB;IAAA;IACA,cAAalB,OAAO,CAAED,EAAE,CAAE,gBAAiB,CAAC,EAAEa,KAAM,CAAG;IACvDS,OAAO,EAAGA;EAAS,GAEjBT,KACK,CAAC;AAEX"}
@@ -62,7 +62,6 @@ export default function EditorPreferencesModal({
62
62
  setIsListViewOpened(false);
63
63
  // Todo: Check sidebar when closing/opening distraction free.
64
64
  };
65
-
66
65
  const turnOffDistractionFree = () => {
67
66
  setPreference('core', 'distractionFree', false);
68
67
  };
@@ -1 +1 @@
1
- {"version":3,"names":["__","useViewportMatch","useSelect","useDispatch","useMemo","store","preferencesStore","privateApis","preferencesPrivateApis","EnablePanelOption","EnablePluginDocumentSettingPanelOption","BlockManager","PostTaxonomies","PostFeaturedImageCheck","PostExcerptCheck","PageAttributesCheck","PostTypeSupportCheck","editorStore","unlock","PreferencesModal","PreferencesModalTabs","PreferencesModalSection","PreferenceToggleControl","EditorPreferencesModal","extraSections","isActive","onClose","isLargeViewport","showBlockBreadcrumbsOption","select","getEditorSettings","get","isRichEditingEnabled","richEditingEnabled","isDistractionFreeEnabled","setIsListViewOpened","setIsInserterOpened","set","setPreference","toggleDistractionFree","turnOffDistractionFree","sections","name","tabLabel","content","createElement","Fragment","title","scope","featureName","help","label","description","Slot","taxonomyWrapper","taxonomy","labels","menu_name","panelName","slug","supportKeys","general","onToggle","appearance","closeModal"],"sources":["@wordpress/editor/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tstore as preferencesStore,\n\tprivateApis as preferencesPrivateApis,\n} from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnablePanelOption from './enable-panel';\nimport EnablePluginDocumentSettingPanelOption from './enable-plugin-document-setting-panel';\nimport BlockManager from '../block-manager';\nimport PostTaxonomies from '../post-taxonomies';\nimport PostFeaturedImageCheck from '../post-featured-image/check';\nimport PostExcerptCheck from '../post-excerpt/check';\nimport PageAttributesCheck from '../page-attributes/check';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n\tPreferenceToggleControl,\n} = unlock( preferencesPrivateApis );\n\nexport default function EditorPreferencesModal( {\n\textraSections = {},\n\tisActive,\n\tonClose,\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { showBlockBreadcrumbsOption } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst isDistractionFreeEnabled = get( 'core', 'distractionFree' );\n\t\t\treturn {\n\t\t\t\tshowBlockBreadcrumbsOption:\n\t\t\t\t\t! isDistractionFreeEnabled &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisRichEditingEnabled,\n\t\t\t};\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\n\tconst { setIsListViewOpened, setIsInserterOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tsetPreference( 'core', 'fixedToolbar', true );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\t// Todo: Check sidebar when closing/opening distraction free.\n\t};\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\tconst sections = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'general',\n\t\t\t\ttabLabel: __( 'General' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showListViewByDefault\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Opens the block list view sidebar by default.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Always open list view' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ showBlockBreadcrumbsOption && (\n\t\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Display the block hierarchy trail at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Show block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"allowRightClickOverrides\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Allows contextual list view menus via right-click, overriding browser defaults.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Allow right-click contextual menus'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Document settings' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Select what settings are shown in the document panel.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnablePluginDocumentSettingPanelOption.Slot />\n\t\t\t\t\t\t\t<PostTaxonomies\n\t\t\t\t\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => (\n\t\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\t\tlabel={ taxonomy.labels.menu_name }\n\t\t\t\t\t\t\t\t\t\tpanelName={ `taxonomy-panel-${ taxonomy.slug }` }\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\t<PostFeaturedImageCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"featured-image\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostFeaturedImageCheck>\n\t\t\t\t\t\t\t<PostExcerptCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Excerpt' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-excerpt\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostExcerptCheck>\n\t\t\t\t\t\t\t<PostTypeSupportCheck\n\t\t\t\t\t\t\t\tsupportKeys={ [ 'comments', 'trackbacks' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Discussion' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"discussion-panel\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t\t\t<PageAttributesCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Page attributes' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"page-attributes\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PageAttributesCheck>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t{ extraSections?.general }\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'appearance',\n\t\t\t\ttabLabel: __( 'Appearance' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t'Customize the editor interface to suit your needs.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"fixedToolbar\"\n\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Access all block and document tools in a single place.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"distractionFree\"\n\t\t\t\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ extraSections?.appearance }\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'accessibility',\n\t\t\t\ttabLabel: __( 'Accessibility' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Optimize the editing experience for enhanced control.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Show text instead of icons on buttons across the interface.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'blocks',\n\t\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Inserter' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"mostUsedBlocks\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Adds a category with the most frequently used blocks in the inserter.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Show most used blocks' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Manage block visibility' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockManager />\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t],\n\t\t[ isLargeViewport, showBlockBreadcrumbsOption, extraSections ]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal closeModal={ onClose }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,wBAAwB;;AAE/B;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,gBAAgB;AAC9C,OAAOC,sCAAsC,MAAM,wCAAwC;AAC3F,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,sBAAsB,MAAM,8BAA8B;AACjE,OAAOC,gBAAgB,MAAM,uBAAuB;AACpD,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,oBAAoB,MAAM,4BAA4B;AAC7D,SAASX,KAAK,IAAIY,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EACLC,gBAAgB;EAChBC,oBAAoB;EACpBC,uBAAuB;EACvBC;AACD,CAAC,GAAGJ,MAAM,CAAEV,sBAAuB,CAAC;AAEpC,eAAe,SAASe,sBAAsBA,CAAE;EAC/CC,aAAa,GAAG,CAAC,CAAC;EAClBC,QAAQ;EACR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A,CAACxB,uBAAuB;MACvB0B,KAAK,EAAG/C,EAAE,CAAE,yBAA0B,CAAG;MACzCoD,WAAW,EAAGpD,EAAE,CACf,yGACD;IAAG,GAEH6C,aAAA,CAAClC,YAAY,MAAE,CACS,CACxB;EAEJ,CAAC,CACD,EACD,CAAEgB,eAAe,EAAEC,0BAA0B,EAAEJ,aAAa,CAC7D,CAAC;EAED,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACCoB,aAAA,CAAC1B,gBAAgB;IAAC6C,UAAU,EAAGtC;EAAS,GACvCmB,aAAA,CAACzB,oBAAoB;IAACqB,QAAQ,EAAGA;EAAU,CAAE,CAC5B,CAAC;AAErB"}
1
+ {"version":3,"names":["__","useViewportMatch","useSelect","useDispatch","useMemo","store","preferencesStore","privateApis","preferencesPrivateApis","EnablePanelOption","EnablePluginDocumentSettingPanelOption","BlockManager","PostTaxonomies","PostFeaturedImageCheck","PostExcerptCheck","PageAttributesCheck","PostTypeSupportCheck","editorStore","unlock","PreferencesModal","PreferencesModalTabs","PreferencesModalSection","PreferenceToggleControl","EditorPreferencesModal","extraSections","isActive","onClose","isLargeViewport","showBlockBreadcrumbsOption","select","getEditorSettings","get","isRichEditingEnabled","richEditingEnabled","isDistractionFreeEnabled","setIsListViewOpened","setIsInserterOpened","set","setPreference","toggleDistractionFree","turnOffDistractionFree","sections","name","tabLabel","content","createElement","Fragment","title","scope","featureName","help","label","description","Slot","taxonomyWrapper","taxonomy","labels","menu_name","panelName","slug","supportKeys","general","onToggle","appearance","closeModal"],"sources":["@wordpress/editor/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tstore as preferencesStore,\n\tprivateApis as preferencesPrivateApis,\n} from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnablePanelOption from './enable-panel';\nimport EnablePluginDocumentSettingPanelOption from './enable-plugin-document-setting-panel';\nimport BlockManager from '../block-manager';\nimport PostTaxonomies from '../post-taxonomies';\nimport PostFeaturedImageCheck from '../post-featured-image/check';\nimport PostExcerptCheck from '../post-excerpt/check';\nimport PageAttributesCheck from '../page-attributes/check';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n\tPreferenceToggleControl,\n} = unlock( preferencesPrivateApis );\n\nexport default function EditorPreferencesModal( {\n\textraSections = {},\n\tisActive,\n\tonClose,\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { showBlockBreadcrumbsOption } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst isDistractionFreeEnabled = get( 'core', 'distractionFree' );\n\t\t\treturn {\n\t\t\t\tshowBlockBreadcrumbsOption:\n\t\t\t\t\t! isDistractionFreeEnabled &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisRichEditingEnabled,\n\t\t\t};\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\n\tconst { setIsListViewOpened, setIsInserterOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tsetPreference( 'core', 'fixedToolbar', true );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\t// Todo: Check sidebar when closing/opening distraction free.\n\t};\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\tconst sections = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'general',\n\t\t\t\ttabLabel: __( 'General' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showListViewByDefault\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Opens the block list view sidebar by default.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Always open list view' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ showBlockBreadcrumbsOption && (\n\t\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Display the block hierarchy trail at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Show block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"allowRightClickOverrides\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Allows contextual list view menus via right-click, overriding browser defaults.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Allow right-click contextual menus'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Document settings' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Select what settings are shown in the document panel.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnablePluginDocumentSettingPanelOption.Slot />\n\t\t\t\t\t\t\t<PostTaxonomies\n\t\t\t\t\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => (\n\t\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\t\tlabel={ taxonomy.labels.menu_name }\n\t\t\t\t\t\t\t\t\t\tpanelName={ `taxonomy-panel-${ taxonomy.slug }` }\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\t<PostFeaturedImageCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"featured-image\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostFeaturedImageCheck>\n\t\t\t\t\t\t\t<PostExcerptCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Excerpt' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-excerpt\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostExcerptCheck>\n\t\t\t\t\t\t\t<PostTypeSupportCheck\n\t\t\t\t\t\t\t\tsupportKeys={ [ 'comments', 'trackbacks' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Discussion' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"discussion-panel\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t\t\t<PageAttributesCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Page attributes' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"page-attributes\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PageAttributesCheck>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t{ extraSections?.general }\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'appearance',\n\t\t\t\ttabLabel: __( 'Appearance' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t'Customize the editor interface to suit your needs.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"fixedToolbar\"\n\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Access all block and document tools in a single place.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"distractionFree\"\n\t\t\t\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ extraSections?.appearance }\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'accessibility',\n\t\t\t\ttabLabel: __( 'Accessibility' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Optimize the editing experience for enhanced control.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Show text instead of icons on buttons across the interface.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'blocks',\n\t\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Inserter' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"mostUsedBlocks\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Adds a category with the most frequently used blocks in the inserter.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Show most used blocks' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Manage block visibility' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockManager />\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t],\n\t\t[ isLargeViewport, showBlockBreadcrumbsOption, extraSections ]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal closeModal={ onClose }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,wBAAwB;;AAE/B;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,gBAAgB;AAC9C,OAAOC,sCAAsC,MA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nD,EAAE,CAAE,yBAA0B,CAAG;MACzCkD,IAAI,EAAGlD,EAAE,CACR,6DACD;IAAG,CACH,CACuB,CACxB;EAEJ,CAAC,EACD;IACC0C,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAE3C,EAAE,CAAE,QAAS,CAAC;IACxB4C,OAAO,EACNC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACxB,uBAAuB;MAAC0B,KAAK,EAAG/C,EAAE,CAAE,UAAW;IAAG,GAClD6C,aAAA,CAACvB,uBAAuB;MACvB0B,KAAK,EAAC,MAAM;MACZC,WAAW,EAAC,gBAAgB;MAC5BC,IAAI,EAAGlD,EAAE,CACR,uEACD,CAAG;MACHmD,KAAK,EAAGnD,EAAE,CAAE,uBAAwB;IAAG,CACvC,CACuB,CAAC,EAC1B6C,aAAA,CAACxB,uBAAuB;MACvB0B,KAAK,EAAG/C,EAAE,CAAE,yBAA0B,CAAG;MACzCoD,WAAW,EAAGpD,EAAE,CACf,yGACD;IAAG,GAEH6C,aAAA,CAAClC,YAAY,MAAE,CACS,CACxB;EAEJ,CAAC,CACD,EACD,CAAEgB,eAAe,EAAEC,0BAA0B,EAAEJ,aAAa,CAC7D,CAAC;EAED,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACCoB,aAAA,CAAC1B,gBAAgB;IAAC6C,UAAU,EAAGtC;EAAS,GACvCmB,aAAA,CAACzB,oBAAoB;IAACqB,QAAQ,EAAGA;EAAU,CAAE,CAC5B,CAAC;AAErB"}
@@ -28,6 +28,14 @@ const {
28
28
  } = unlock(editPatternsPrivateApis);
29
29
  const noop = () => {};
30
30
 
31
+ /**
32
+ * These are global entities that are only there to split blocks into logical units
33
+ * They don't provide a "context" for the current post/page being rendered.
34
+ * So we should not use their ids as post context. This is important to allow post blocks
35
+ * (post content, post title) to be used within them without issues.
36
+ */
37
+ const NON_CONTEXTUAL_POST_TYPES = ['wp_block', 'wp_template', 'wp_navigation', 'wp_template_part'];
38
+
31
39
  /**
32
40
  * Depending on the post, template and template mode,
33
41
  * returns the appropriate blocks and change handlers for the block editor provider.
@@ -91,7 +99,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(({
91
99
  const shouldRenderTemplate = !!template && mode !== 'post-only';
92
100
  const rootLevelPost = shouldRenderTemplate ? template : post;
93
101
  const defaultBlockContext = useMemo(() => {
94
- const postContext = rootLevelPost.type !== 'wp_template' || shouldRenderTemplate ? {
102
+ const postContext = !NON_CONTEXTUAL_POST_TYPES.includes(rootLevelPost.type) || shouldRenderTemplate ? {
95
103
  postId: post.id,
96
104
  postType: post.type
97
105
  } : {};
@@ -99,7 +107,7 @@ export const ExperimentalEditorProvider = withRegistryProvider(({
99
107
  ...postContext,
100
108
  templateSlug: rootLevelPost.type === 'wp_template' ? rootLevelPost.slug : undefined
101
109
  };
102
- }, [post.id, post.type, rootLevelPost.type, rootLevelPost.slug]);
110
+ }, [shouldRenderTemplate, post.id, post.type, rootLevelPost.type, rootLevelPost.slug]);
103
111
  const {
104
112
  editorSettings,
105
113
  selection,