@wordpress/editor 14.9.0 → 14.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/api.js +0 -29
  3. package/build/bindings/api.js.map +1 -1
  4. package/build/components/autocompleters/user.js.map +1 -1
  5. package/build/components/block-manager/index.js +2 -2
  6. package/build/components/block-manager/index.js.map +1 -1
  7. package/build/components/commands/index.js.map +1 -1
  8. package/build/components/create-template-part-modal/index.js.map +1 -1
  9. package/build/components/create-template-part-modal/utils.js.map +1 -1
  10. package/build/components/document-outline/index.js.map +1 -1
  11. package/build/components/document-outline/item.js.map +1 -1
  12. package/build/components/document-tools/index.js +1 -1
  13. package/build/components/document-tools/index.js.map +1 -1
  14. package/build/components/editor-interface/index.js +1 -12
  15. package/build/components/editor-interface/index.js.map +1 -1
  16. package/build/components/entities-saved-states/index.js +1 -1
  17. package/build/components/entities-saved-states/index.js.map +1 -1
  18. package/build/components/media-categories/index.js.map +1 -1
  19. package/build/components/page-attributes/parent.js +1 -1
  20. package/build/components/page-attributes/parent.js.map +1 -1
  21. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  22. package/build/components/post-actions/index.js.map +1 -1
  23. package/build/components/post-content-information/index.js +1 -1
  24. package/build/components/post-content-information/index.js.map +1 -1
  25. package/build/components/post-featured-image/index.js.map +1 -1
  26. package/build/components/post-format/index.js +1 -1
  27. package/build/components/post-format/index.js.map +1 -1
  28. package/build/components/post-last-revision/index.js +1 -1
  29. package/build/components/post-last-revision/index.js.map +1 -1
  30. package/build/components/post-locked-modal/index.js +2 -2
  31. package/build/components/post-locked-modal/index.js.map +1 -1
  32. package/build/components/post-preview-button/index.js +1 -1
  33. package/build/components/post-preview-button/index.js.map +1 -1
  34. package/build/components/post-publish-button/index.js.map +1 -1
  35. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  36. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  37. package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
  38. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  39. package/build/components/post-publish-panel/media-util.js +1 -0
  40. package/build/components/post-publish-panel/media-util.js.map +1 -1
  41. package/build/components/post-publish-panel/postpublish.js +1 -1
  42. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  43. package/build/components/post-schedule/label.js.map +1 -1
  44. package/build/components/post-taxonomies/flat-term-selector.js +4 -4
  45. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  46. package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  47. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  48. package/build/components/post-taxonomies/index.js +1 -1
  49. package/build/components/post-taxonomies/index.js.map +1 -1
  50. package/build/components/post-taxonomies/panel.js.map +1 -1
  51. package/build/components/post-template/classic-theme.js +2 -4
  52. package/build/components/post-template/classic-theme.js.map +1 -1
  53. package/build/components/post-text-editor/index.js.map +1 -1
  54. package/build/components/post-title/index.js +15 -19
  55. package/build/components/post-title/index.js.map +1 -1
  56. package/build/components/post-title/index.native.js +2 -2
  57. package/build/components/post-title/index.native.js.map +1 -1
  58. package/build/components/post-url/index.js +76 -63
  59. package/build/components/post-url/index.js.map +1 -1
  60. package/build/components/post-url/panel.js +46 -26
  61. package/build/components/post-url/panel.js.map +1 -1
  62. package/build/components/post-visibility/index.js.map +1 -1
  63. package/build/components/preferences-modal/index.js.map +1 -1
  64. package/build/components/preview-dropdown/index.js.map +1 -1
  65. package/build/components/provider/index.js +1 -1
  66. package/build/components/provider/index.js.map +1 -1
  67. package/build/components/resizable-editor/resize-handle.js.map +1 -1
  68. package/build/components/time-to-read/index.js +1 -1
  69. package/build/components/time-to-read/index.js.map +1 -1
  70. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -1
  71. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  72. package/build/components/visual-editor/index.js +4 -3
  73. package/build/components/visual-editor/index.js.map +1 -1
  74. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  75. package/build/dataviews/actions/duplicate-template-part.js +1 -1
  76. package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
  77. package/build/private-apis.js +0 -1
  78. package/build/private-apis.js.map +1 -1
  79. package/build/store/actions.js +26 -1
  80. package/build/store/actions.js.map +1 -1
  81. package/build/store/constants.js +1 -0
  82. package/build/store/constants.js.map +1 -1
  83. package/build/store/local-autosave.js.map +1 -1
  84. package/build/store/private-actions.js +7 -6
  85. package/build/store/private-actions.js.map +1 -1
  86. package/build/store/selectors.js +21 -0
  87. package/build/store/selectors.js.map +1 -1
  88. package/build/utils/media-upload/index.js.map +1 -1
  89. package/build-module/bindings/api.js +1 -29
  90. package/build-module/bindings/api.js.map +1 -1
  91. package/build-module/components/autocompleters/user.js +1 -3
  92. package/build-module/components/autocompleters/user.js.map +1 -1
  93. package/build-module/components/block-manager/category.js +1 -2
  94. package/build-module/components/block-manager/category.js.map +1 -1
  95. package/build-module/components/block-manager/checklist.js +1 -2
  96. package/build-module/components/block-manager/checklist.js.map +1 -1
  97. package/build-module/components/block-manager/index.js +3 -4
  98. package/build-module/components/block-manager/index.js.map +1 -1
  99. package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -3
  100. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  101. package/build-module/components/blog-title/index.js +1 -3
  102. package/build-module/components/blog-title/index.js.map +1 -1
  103. package/build-module/components/collapsible-block-toolbar/index.js +1 -3
  104. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  105. package/build-module/components/commands/index.js.map +1 -1
  106. package/build-module/components/create-template-part-modal/index.js +1 -2
  107. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  108. package/build-module/components/create-template-part-modal/utils.js.map +1 -1
  109. package/build-module/components/document-bar/index.js +1 -2
  110. package/build-module/components/document-bar/index.js.map +1 -1
  111. package/build-module/components/document-outline/index.js +1 -2
  112. package/build-module/components/document-outline/index.js.map +1 -1
  113. package/build-module/components/document-outline/item.js +1 -2
  114. package/build-module/components/document-outline/item.js.map +1 -1
  115. package/build-module/components/document-tools/index.js +2 -4
  116. package/build-module/components/document-tools/index.js.map +1 -1
  117. package/build-module/components/editor/index.js +1 -3
  118. package/build-module/components/editor/index.js.map +1 -1
  119. package/build-module/components/editor-help/add-blocks.native.js +1 -3
  120. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  121. package/build-module/components/editor-help/customize-blocks.native.js +1 -3
  122. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  123. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -2
  124. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  125. package/build-module/components/editor-help/index.native.js +1 -3
  126. package/build-module/components/editor-help/index.native.js.map +1 -1
  127. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -3
  128. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  129. package/build-module/components/editor-help/move-blocks.native.js +1 -3
  130. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  131. package/build-module/components/editor-help/remove-blocks.native.js +1 -3
  132. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  133. package/build-module/components/editor-help/view-sections.native.js +1 -2
  134. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  135. package/build-module/components/editor-interface/index.js +2 -15
  136. package/build-module/components/editor-interface/index.js.map +1 -1
  137. package/build-module/components/editor-notices/index.js +1 -3
  138. package/build-module/components/editor-notices/index.js.map +1 -1
  139. package/build-module/components/entities-saved-states/entity-record-item.js +1 -3
  140. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  141. package/build-module/components/entities-saved-states/entity-type-list.js +1 -2
  142. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  143. package/build-module/components/entities-saved-states/index.js +2 -3
  144. package/build-module/components/entities-saved-states/index.js.map +1 -1
  145. package/build-module/components/error-boundary/index.native.js +1 -2
  146. package/build-module/components/error-boundary/index.native.js.map +1 -1
  147. package/build-module/components/header/index.js +1 -2
  148. package/build-module/components/header/index.js.map +1 -1
  149. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
  150. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  151. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
  152. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  153. package/build-module/components/list-view-sidebar/list-view-outline.js +1 -3
  154. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  155. package/build-module/components/media-categories/index.js.map +1 -1
  156. package/build-module/components/more-menu/index.js +1 -3
  157. package/build-module/components/more-menu/index.js.map +1 -1
  158. package/build-module/components/offline-status/index.native.js +1 -2
  159. package/build-module/components/offline-status/index.native.js.map +1 -1
  160. package/build-module/components/page-attributes/parent.js +2 -3
  161. package/build-module/components/page-attributes/parent.js.map +1 -1
  162. package/build-module/components/plugin-document-setting-panel/index.js +1 -3
  163. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  164. package/build-module/components/post-actions/index.js +1 -3
  165. package/build-module/components/post-actions/index.js.map +1 -1
  166. package/build-module/components/post-author/panel.js +1 -2
  167. package/build-module/components/post-author/panel.js.map +1 -1
  168. package/build-module/components/post-card-panel/index.js +1 -2
  169. package/build-module/components/post-card-panel/index.js.map +1 -1
  170. package/build-module/components/post-content-information/index.js +1 -1
  171. package/build-module/components/post-content-information/index.js.map +1 -1
  172. package/build-module/components/post-discussion/panel.js +1 -2
  173. package/build-module/components/post-discussion/panel.js.map +1 -1
  174. package/build-module/components/post-excerpt/panel.js +1 -3
  175. package/build-module/components/post-excerpt/panel.js.map +1 -1
  176. package/build-module/components/post-featured-image/index.js +1 -2
  177. package/build-module/components/post-featured-image/index.js.map +1 -1
  178. package/build-module/components/post-format/index.js +2 -3
  179. package/build-module/components/post-format/index.js.map +1 -1
  180. package/build-module/components/post-format/panel.js +1 -2
  181. package/build-module/components/post-format/panel.js.map +1 -1
  182. package/build-module/components/post-last-revision/index.js +1 -1
  183. package/build-module/components/post-last-revision/index.js.map +1 -1
  184. package/build-module/components/post-locked-modal/index.js +3 -5
  185. package/build-module/components/post-locked-modal/index.js.map +1 -1
  186. package/build-module/components/post-panel-row/index.js +1 -2
  187. package/build-module/components/post-panel-row/index.js.map +1 -1
  188. package/build-module/components/post-preview-button/index.js +2 -4
  189. package/build-module/components/post-preview-button/index.js.map +1 -1
  190. package/build-module/components/post-publish-button/index.js +1 -2
  191. package/build-module/components/post-publish-button/index.js.map +1 -1
  192. package/build-module/components/post-publish-panel/index.js +1 -3
  193. package/build-module/components/post-publish-panel/index.js.map +1 -1
  194. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -2
  195. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  196. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  197. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  198. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -2
  199. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  200. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
  201. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  202. package/build-module/components/post-publish-panel/media-util.js +1 -0
  203. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  204. package/build-module/components/post-publish-panel/postpublish.js +2 -4
  205. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  206. package/build-module/components/post-publish-panel/prepublish.js +1 -3
  207. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  208. package/build-module/components/post-saved-state/index.js +1 -2
  209. package/build-module/components/post-saved-state/index.js.map +1 -1
  210. package/build-module/components/post-schedule/label.js.map +1 -1
  211. package/build-module/components/post-status/index.js +1 -3
  212. package/build-module/components/post-status/index.js.map +1 -1
  213. package/build-module/components/post-switch-to-draft-button/index.js +1 -3
  214. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  215. package/build-module/components/post-taxonomies/flat-term-selector.js +5 -7
  216. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  217. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -4
  218. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  219. package/build-module/components/post-taxonomies/index.js +1 -1
  220. package/build-module/components/post-taxonomies/index.js.map +1 -1
  221. package/build-module/components/post-taxonomies/most-used-terms.js +1 -2
  222. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  223. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  224. package/build-module/components/post-template/block-theme.js +1 -3
  225. package/build-module/components/post-template/block-theme.js.map +1 -1
  226. package/build-module/components/post-template/classic-theme.js +3 -6
  227. package/build-module/components/post-template/classic-theme.js.map +1 -1
  228. package/build-module/components/post-template/create-new-template-modal.js +1 -2
  229. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  230. package/build-module/components/post-template/create-new-template.js +1 -3
  231. package/build-module/components/post-template/create-new-template.js.map +1 -1
  232. package/build-module/components/post-template/swap-template-button.js +1 -3
  233. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  234. package/build-module/components/post-text-editor/index.js +1 -3
  235. package/build-module/components/post-text-editor/index.js.map +1 -1
  236. package/build-module/components/post-title/index.js +15 -19
  237. package/build-module/components/post-title/index.js.map +1 -1
  238. package/build-module/components/post-title/index.native.js +2 -2
  239. package/build-module/components/post-title/index.native.js.map +1 -1
  240. package/build-module/components/post-trash/index.js +1 -2
  241. package/build-module/components/post-trash/index.js.map +1 -1
  242. package/build-module/components/post-url/index.js +78 -66
  243. package/build-module/components/post-url/index.js.map +1 -1
  244. package/build-module/components/post-url/panel.js +48 -28
  245. package/build-module/components/post-url/panel.js.map +1 -1
  246. package/build-module/components/post-visibility/index.js +1 -2
  247. package/build-module/components/post-visibility/index.js.map +1 -1
  248. package/build-module/components/posts-per-page/index.js +1 -3
  249. package/build-module/components/posts-per-page/index.js.map +1 -1
  250. package/build-module/components/preferences-modal/index.js +1 -3
  251. package/build-module/components/preferences-modal/index.js.map +1 -1
  252. package/build-module/components/preview-dropdown/index.js +1 -3
  253. package/build-module/components/preview-dropdown/index.js.map +1 -1
  254. package/build-module/components/provider/index.js +2 -4
  255. package/build-module/components/provider/index.js.map +1 -1
  256. package/build-module/components/provider/index.native.js +1 -3
  257. package/build-module/components/provider/index.native.js.map +1 -1
  258. package/build-module/components/resizable-editor/resize-handle.js +1 -3
  259. package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
  260. package/build-module/components/save-publish-panels/index.js +1 -3
  261. package/build-module/components/save-publish-panels/index.js.map +1 -1
  262. package/build-module/components/sidebar/header.js +1 -2
  263. package/build-module/components/sidebar/header.js.map +1 -1
  264. package/build-module/components/sidebar/index.js +1 -2
  265. package/build-module/components/sidebar/index.js.map +1 -1
  266. package/build-module/components/sidebar/post-summary.js +1 -3
  267. package/build-module/components/sidebar/post-summary.js.map +1 -1
  268. package/build-module/components/site-discussion/index.js +1 -3
  269. package/build-module/components/site-discussion/index.js.map +1 -1
  270. package/build-module/components/start-template-options/index.js +1 -2
  271. package/build-module/components/start-template-options/index.js.map +1 -1
  272. package/build-module/components/table-of-contents/panel.js +1 -3
  273. package/build-module/components/table-of-contents/panel.js.map +1 -1
  274. package/build-module/components/template-part-menu-items/convert-to-template-part.js +1 -3
  275. package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -1
  276. package/build-module/components/template-validation-notice/index.js +1 -3
  277. package/build-module/components/template-validation-notice/index.js.map +1 -1
  278. package/build-module/components/text-editor/index.js +1 -2
  279. package/build-module/components/text-editor/index.js.map +1 -1
  280. package/build-module/components/time-to-read/index.js +1 -1
  281. package/build-module/components/time-to-read/index.js.map +1 -1
  282. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -1
  283. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  284. package/build-module/components/visual-editor/index.js +5 -6
  285. package/build-module/components/visual-editor/index.js.map +1 -1
  286. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  287. package/build-module/dataviews/actions/duplicate-template-part.js +1 -1
  288. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
  289. package/build-module/hooks/pattern-overrides.js +1 -3
  290. package/build-module/hooks/pattern-overrides.js.map +1 -1
  291. package/build-module/private-apis.js +1 -2
  292. package/build-module/private-apis.js.map +1 -1
  293. package/build-module/store/actions.js +26 -1
  294. package/build-module/store/actions.js.map +1 -1
  295. package/build-module/store/constants.js +1 -0
  296. package/build-module/store/constants.js.map +1 -1
  297. package/build-module/store/local-autosave.js.map +1 -1
  298. package/build-module/store/private-actions.js +7 -6
  299. package/build-module/store/private-actions.js.map +1 -1
  300. package/build-module/store/selectors.js +21 -0
  301. package/build-module/store/selectors.js.map +1 -1
  302. package/build-module/utils/media-upload/index.js.map +1 -1
  303. package/build-style/style-rtl.css +20 -5
  304. package/build-style/style.css +20 -5
  305. package/build-types/bindings/api.d.ts +0 -13
  306. package/build-types/bindings/api.d.ts.map +1 -1
  307. package/build-types/components/editor-interface/index.d.ts +1 -2
  308. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  309. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  310. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  311. package/build-types/components/post-url/index.d.ts.map +1 -1
  312. package/build-types/components/post-url/panel.d.ts.map +1 -1
  313. package/build-types/components/provider/index.d.ts.map +1 -1
  314. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  315. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  316. package/build-types/private-apis.d.ts.map +1 -1
  317. package/build-types/store/actions.d.ts +1 -4
  318. package/build-types/store/actions.d.ts.map +1 -1
  319. package/build-types/store/selectors.d.ts +21 -0
  320. package/build-types/store/selectors.d.ts.map +1 -1
  321. package/package.json +38 -38
  322. package/src/bindings/api.js +1 -32
  323. package/src/components/document-tools/index.js +1 -1
  324. package/src/components/editor-interface/index.js +0 -15
  325. package/src/components/header/style.scss +1 -0
  326. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  327. package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -0
  328. package/src/components/post-template/classic-theme.js +1 -2
  329. package/src/components/post-url/index.js +67 -55
  330. package/src/components/post-url/panel.js +57 -33
  331. package/src/components/post-url/style.scss +21 -3
  332. package/src/components/provider/index.js +1 -0
  333. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  334. package/src/components/visual-editor/index.js +3 -1
  335. package/src/private-apis.js +1 -5
  336. package/src/store/actions.js +28 -1
  337. package/src/store/selectors.js +21 -0
  338. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","kind","name","getCurrentTemplateId","title","slug","jsx","Button","__next40pxDefaultSize","variant","__","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","jsxs","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","default","ClassicThemeControl","Dropdown","popoverProps","focusOnMount","renderToggle","onToggle","renderContent","_default","exports"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {JSX.Element} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction ClassicThemeControl() {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<PostTemplateToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {JSX.Element} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAqD,IAAAY,WAAA,GAAAZ,OAAA;AAjBrD;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAMa,aAAa,GAAG;EACrBC,SAAS,EAAE,gCAAgC;EAC3CC,SAAS,EAAE;AACZ,CAAC;AAED,SAASC,kBAAk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ACHpD,OAAO,CAAC,CAAC;UACTiC,mBAAmB,CAClB,IAAApC,QAAE,EACD,uFACD,CAAC,EACD;YACCwD,IAAI,EAAE,UAAU;YAChBZ,OAAO,EAAE,CACR;cACCd,KAAK,EAAE,IAAA9B,QAAE,EAAE,SAAU,CAAC;cACtBtB,OAAO,EAAEA,CAAA,KACRS,iBAAiB,CAAC,CAAC,CAACsE,gCAAgC,CAAC;YACvD,CAAC;UAEH,CACD,CAAC;QACF,CAAG;QAAAxD,QAAA,EAED,IAAAD,QAAE,EAAE,eAAgB;MAAC,CAChB;IAAC,CACP,CACH,EACCsC,iBAAiB,iBAClB,IAAAlE,WAAA,CAAAwB,GAAA,EAAC3B,uBAAA,CAAAyF,OAAsB;MACtBvD,OAAO,EAAGA,CAAA,KAAMoC,oBAAoB,CAAE,KAAM;IAAG,CAC/C,CACD;EAAA,CACG,CAAC;AAER;AAEA,SAASoB,mBAAmBA,CAAA,EAAG;EAC9B,oBACC,IAAAvF,WAAA,CAAAwB,GAAA,EAACnC,WAAA,CAAAmG,QAAQ;IACRC,YAAY,EAAGxF,aAAe;IAC9ByF,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEtF,MAAM;MAAEuF;IAAS,CAAC,kBACpC,IAAA5F,WAAA,CAAAwB,GAAA,EAACpB,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGsF;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAE9D;IAAQ,CAAC,kBAC5B,IAAA/B,WAAA,CAAAwB,GAAA,EAACM,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAA+D,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAOeC,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_coreData","_blockEditor","_element","_icons","_notices","_store","_createNewTemplateModal","_interopRequireDefault","_hooks","_jsxRuntime","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","useSelect","select","templateSlug","editorStore","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","coreStore","canUser","kind","name","getCurrentTemplateId","title","slug","jsx","Button","__next40pxDefaultSize","variant","__","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","useAllowSwitchingTemplates","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","useMemo","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","useDispatch","createSuccessNotice","noticesStore","isCreateModalOpen","setIsCreateModalOpen","useState","jsxs","__experimentalInspectorPopoverHeader","help","actions","icon","addTemplate","Notice","status","isDismissible","SelectControl","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","default","ClassicThemeControl","Dropdown","popoverProps","focusOnMount","renderToggle","onToggle","renderContent","_default","exports"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {JSX.Element} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction ClassicThemeControl() {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<PostTemplateToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n *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AAAmG,QAAQ;IACRC,YAAY,EAAGxF,aAAe;IAC9ByF,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEtF,MAAM;MAAEuF;IAAS,CAAC,kBACpC,IAAA5F,WAAA,CAAAwB,GAAA,EAACpB,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGsF;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAE9D;IAAQ,CAAC,kBAC5B,IAAA/B,WAAA,CAAAwB,GAAA,EAACM,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAA+D,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAOeC,mBAAmB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactAutosizeTextarea","_interopRequireDefault","require","_i18n","_coreData","_element","_blocks","_data","_compose","_components","_store","_jsxRuntime","PostTextEditor","instanceId","useInstanceId","content","blocks","type","id","useSelect","select","getEditedEntityRecord","coreStore","getCurrentPostType","getCurrentPostId","editorStore","_type","_id","editedRecord","editEntityRecord","useDispatch","value","useMemo","Function","__unstableSerializeAndClean","jsxs","Fragment","children","jsx","VisuallyHidden","as","htmlFor","__","default","autoComplete","dir","onChange","event","target","undefined","selection","className","placeholder"],"sources":["@wordpress/editor/src/components/post-text-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Displays the Post Text Editor along with content in Visual and Text mode.\n *\n * @return {JSX.Element|null} The rendered PostTextEditor component.\n */\nexport default function PostTextEditor() {\n\tconst instanceId = useInstanceId( PostTextEditor );\n\tconst { content, blocks, type, id } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst _type = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst editedRecord = getEditedEntityRecord( 'postType', _type, _id );\n\n\t\treturn {\n\t\t\tcontent: editedRecord?.content,\n\t\t\tblocks: editedRecord?.blocks,\n\t\t\ttype: _type,\n\t\t\tid: _id,\n\t\t};\n\t}, [] );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\t// Replicates the logic found in getEditedPostContent().\n\tconst value = useMemo( () => {\n\t\tif ( content instanceof Function ) {\n\t\t\treturn content( { blocks } );\n\t\t} else if ( blocks ) {\n\t\t\t// If we have parsed blocks already, they should be our source of truth.\n\t\t\t// Parsing applies block deprecations and legacy block conversions that\n\t\t\t// unparsed content will not have.\n\t\t\treturn __unstableSerializeAndClean( blocks );\n\t\t}\n\t\treturn content;\n\t}, [ content, blocks ] );\n\n\treturn (\n\t\t<>\n\t\t\t<VisuallyHidden\n\t\t\t\tas=\"label\"\n\t\t\t\thtmlFor={ `post-content-${ instanceId }` }\n\t\t\t>\n\t\t\t\t{ __( 'Type text or HTML' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<Textarea\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tdir=\"auto\"\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ ( event ) => {\n\t\t\t\t\teditEntityRecord( 'postType', type, id, {\n\t\t\t\t\t\tcontent: event.target.value,\n\t\t\t\t\t\tblocks: undefined,\n\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tclassName=\"editor-post-text-editor\"\n\t\t\t\tid={ `post-content-${ instanceId }` }\n\t\t\t\tplaceholder={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","_blocks","_data","_compose","_components","_store","_jsxRuntime","PostTextEditor","instanceId","useInstanceId","content","blocks","type","id","useSelect","select","getEditedEntityRecord","coreStore","getCurrentPostType","getCurrentPostId","editorStore","_type","_id","editedRecord","editEntityRecord","useDispatch","value","useMemo","Function","__unstableSerializeAndClean","jsxs","Fragment","children","jsx","VisuallyHidden","as","htmlFor","__","default","autoComplete","dir","onChange","event","target","undefined","selection","className","placeholder"],"sources":["@wordpress/editor/src/components/post-text-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport Textarea from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Displays the Post Text Editor along with content in Visual and Text mode.\n *\n * @return {JSX.Element|null} The rendered PostTextEditor component.\n */\nexport default function PostTextEditor() {\n\tconst instanceId = useInstanceId( PostTextEditor );\n\tconst { content, blocks, type, id } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst _type = getCurrentPostType();\n\t\tconst _id = getCurrentPostId();\n\t\tconst editedRecord = getEditedEntityRecord( 'postType', _type, _id );\n\n\t\treturn {\n\t\t\tcontent: editedRecord?.content,\n\t\t\tblocks: editedRecord?.blocks,\n\t\t\ttype: _type,\n\t\t\tid: _id,\n\t\t};\n\t}, [] );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\t// Replicates the logic found in getEditedPostContent().\n\tconst value = useMemo( () => {\n\t\tif ( content instanceof Function ) {\n\t\t\treturn content( { blocks } );\n\t\t} else if ( blocks ) {\n\t\t\t// If we have parsed blocks already, they should be our source of truth.\n\t\t\t// Parsing applies block deprecations and legacy block conversions that\n\t\t\t// unparsed content will not have.\n\t\t\treturn __unstableSerializeAndClean( blocks );\n\t\t}\n\t\treturn content;\n\t}, [ content, blocks ] );\n\n\treturn (\n\t\t<>\n\t\t\t<VisuallyHidden\n\t\t\t\tas=\"label\"\n\t\t\t\thtmlFor={ `post-content-${ instanceId }` }\n\t\t\t>\n\t\t\t\t{ __( 'Type text or HTML' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<Textarea\n\t\t\t\tautoComplete=\"off\"\n\t\t\t\tdir=\"auto\"\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ ( event ) => {\n\t\t\t\t\teditEntityRecord( 'postType', type, id, {\n\t\t\t\t\t\tcontent: event.target.value,\n\t\t\t\t\t\tblocks: undefined,\n\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tclassName=\"editor-post-text-editor\"\n\t\t\t\tid={ `post-content-${ instanceId }` }\n\t\t\t\tplaceholder={ __( 'Start writing with text or HTML' ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAnBnD;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,GACe,SAASU,cAAcA,CAAA,EAAG;EACxC,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEF,cAAe,CAA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wB,QAAA,EAExC,IAAAK,QAAE,EAAE,mBAAoB;IAAC,CACZ,CAAC,eACjB,IAAA/B,WAAA,CAAA2B,GAAA,EAACtC,sBAAA,CAAA2C,OAAQ;MACRC,YAAY,EAAC,KAAK;MAClBC,GAAG,EAAC,MAAM;MACVd,KAAK,EAAGA,KAAO;MACfe,QAAQ,EAAKC,KAAK,IAAM;QACvBlB,gBAAgB,CAAE,UAAU,EAAEZ,IAAI,EAAEC,EAAE,EAAE;UACvCH,OAAO,EAAEgC,KAAK,CAACC,MAAM,CAACjB,KAAK;UAC3Bf,MAAM,EAAEiC,SAAS;UACjBC,SAAS,EAAED;QACZ,CAAE,CAAC;MACJ,CAAG;MACHE,SAAS,EAAC,yBAAyB;MACnCjC,EAAE,EAAG,gBAAiBL,UAAU,EAAK;MACrCuC,WAAW,EAAG,IAAAV,QAAE,EAAE,iCAAkC;IAAG,CACvD,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
@@ -164,26 +164,22 @@ function PostTitle(_, forwardedRef) {
164
164
  const className = (0, _clsx.default)(_constants.DEFAULT_CLASSNAMES, {
165
165
  'is-selected': isSelected
166
166
  });
167
- return (
168
- /*#__PURE__*/
169
- /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
170
- (0, _jsxRuntime.jsx)(_postTypeSupportCheck.default, {
171
- supportKeys: "title",
172
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
173
- ref: (0, _compose.useMergeRefs)([richTextRef, focusRef]),
174
- contentEditable: true,
175
- className: className,
176
- "aria-label": decodedPlaceholder,
177
- role: "textbox",
178
- "aria-multiline": "true",
179
- onFocus: onSelect,
180
- onBlur: onUnselect,
181
- onKeyDown: onKeyDown,
182
- onPaste: onPaste
183
- })
167
+ return /*#__PURE__*/ /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */(0, _jsxRuntime.jsx)(_postTypeSupportCheck.default, {
168
+ supportKeys: "title",
169
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
170
+ ref: (0, _compose.useMergeRefs)([richTextRef, focusRef]),
171
+ contentEditable: true,
172
+ className: className,
173
+ "aria-label": decodedPlaceholder,
174
+ role: "textbox",
175
+ "aria-multiline": "true",
176
+ onFocus: onSelect,
177
+ onBlur: onUnselect,
178
+ onKeyDown: onKeyDown,
179
+ onPaste: onPaste
184
180
  })
185
- /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
186
- );
181
+ })
182
+ /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */;
187
183
  }
188
184
 
189
185
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","_jsxRuntime","PostTitle","_","forwardedRef","placeholder","useSelect","select","getSettings","blockEditorStore","titlePlaceholder","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","title","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","decodedPlaceholder","decodeEntities","__","value","onChange","richTextRef","useRichText","newValue","replace","REGEXP_NEWLINES","selectionStart","start","selectionEnd","end","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","insert","create","className","clsx","DEFAULT_CLASSNAMES","jsx","default","supportKeys","children","useMergeRefs","contentEditable","role","onFocus","onBlur","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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\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 { 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 } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder } = getSettings();\n\n\t\treturn {\n\t\t\tplaceholder: titlePlaceholder,\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\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst {\n\t\tvalue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: title,\n\t\tonChange( newValue ) {\n\t\t\tonUpdate( newValue.replace( REGEXP_NEWLINES, ' ' ) );\n\t\t},\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\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\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error ) {\n\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t// behaviour.\n\t\t\treturn;\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\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\t\t\tonChange( insert( value, create( { html: contentNoHTML } ) ) );\n\t\t}\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 = clsx( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\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\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\n/**\n * Renders the `PostTitle` component.\n *\n * @param {Object} _ Unused parameter.\n * @param {Element} forwardedRef Forwarded ref for the component.\n *\n * @return {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Qe,IAAAU,mBAAU,EAAE1F,SAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_data","_blockEditor","_keycodes","_blocks","_richText","_compose","_dom","_constants","_usePostTitleFocus","_usePostTitle","_postTypeSupportCheck","_jsxRuntime","PostTitle","_","forwardedRef","placeholder","useSelect","select","getSettings","blockEditorStore","titlePlaceholder","isSelected","setIsSelected","useState","ref","focusRef","usePostTitleFocus","title","setTitle","onUpdate","usePostTitle","selection","setSelection","clearSelectedBlock","insertBlocks","insertDefaultBlock","useDispatch","decodedPlaceholder","decodeEntities","__","value","onChange","richTextRef","useRichText","newValue","replace","REGEXP_NEWLINES","selectionStart","start","selectionEnd","end","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","onInsertBlockAfter","blocks","onSelect","onUnselect","onEnterPress","undefined","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error","window","console","log","content","pasteHandler","HTML","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","insert","create","className","clsx","DEFAULT_CLASSNAMES","jsx","default","supportKeys","children","useMergeRefs","contentEditable","role","onFocus","onBlur","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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\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 { 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 } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { titlePlaceholder } = getSettings();\n\n\t\treturn {\n\t\t\tplaceholder: titlePlaceholder,\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\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\n\tconst {\n\t\tvalue,\n\t\tonChange,\n\t\tref: richTextRef,\n\t} = useRichText( {\n\t\tvalue: title,\n\t\tonChange( newValue ) {\n\t\t\tonUpdate( newValue.replace( REGEXP_NEWLINES, ' ' ) );\n\t\t},\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\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\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error ) {\n\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t// behaviour.\n\t\t\treturn;\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\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\t\t\tonChange( insert( value, create( { html: contentNoHTML } ) ) );\n\t\t}\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 = clsx( DEFAULT_CLASSNAMES, {\n\t\t'is-selected': isSelected,\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\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\n/**\n * Renders the `PostTitle` component.\n *\n * @param {Object} _ Unused parameter.\n * @param {Element} forwardedRef Forwarded ref for the component.\n *\n * @return {Component} The rendered PostTitle component.\n */\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAA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AC;MAC1CnC,QAAQ,CAAE,IAAA6C,gBAAM,EAAE9C,KAAK,EAAE,IAAA+C,gBAAM,EAAE;QAAEjB,IAAI,EAAEY;MAAc,CAAE,CAAE,CAAE,CAAC;IAC/D;EACD;;EAEA;EACA;EACA,MAAMM,SAAS,GAAG,IAAAC,aAAI,EAAEC,6BAAkB,EAAE;IAC3C,aAAa,EAAErE;EAChB,CAAE,CAAC;EAEH,qBACC,yGACA,IAAAV,WAAA,CAAAgF,GAAA,EAACjF,qBAAA,CAAAkF,OAAoB;IAACC,WAAW,EAAC,OAAO;IAAAC,QAAA,eACxC,IAAAnF,WAAA,CAAAgF,GAAA;MACCnE,GAAG,EAAG,IAAAuE,qBAAY,EAAE,CAAErD,WAAW,EAAEjB,QAAQ,CAAG,CAAG;MACjDuE,eAAe;MACfR,SAAS,EAAGA,SAAW;MACvB,cAAanD,kBAAoB;MACjC4D,IAAI,EAAC,SAAS;MACd,kBAAe,MAAM;MACrBC,OAAO,EAAGxC,QAAU;MACpByC,MAAM,EAAGxC,UAAY;MACrBG,SAAS,EAAGA,SAAW;MACvBK,OAAO,EAAGA;IAAS,CACnB;EAAC,CACmB;EACtB;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAiC,QAAA,GAAAC,OAAA,CAAAT,OAAA,GAQe,IAAAU,mBAAU,EAAE1F,SAAU,CAAC","ignoreList":[]}
@@ -128,11 +128,11 @@ class PostTitle extends _element.Component {
128
128
  getTitle(title, postType) {
129
129
  if ('page' === postType) {
130
130
  return !title ? /* translators: accessibility text. empty page title. */
131
- (0, _i18n.__)('Page title. Empty') : (0, _i18n.sprintf)( /* translators: accessibility text. %s: text content of the page title. */
131
+ (0, _i18n.__)('Page title. Empty') : (0, _i18n.sprintf)(/* translators: accessibility text. %s: text content of the page title. */
132
132
  (0, _i18n.__)('Page title. %s'), title);
133
133
  }
134
134
  return !title ? /* translators: accessibility text. empty post title. */
135
- (0, _i18n.__)('Post title. Empty') : (0, _i18n.sprintf)( /* translators: accessibility text. %s: text content of the post title. */
135
+ (0, _i18n.__)('Post title. Empty') : (0, _i18n.sprintf)(/* translators: accessibility text. %s: text content of the post title. */
136
136
  (0, _i18n.__)('Post title. %s'), title);
137
137
  }
138
138
  render() {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_element","_richText","_htmlEntities","_data","_components","_compose","_i18n","_blocks","_blockEditor","_editor","_dom","_style","_interopRequireDefault","_jsxRuntime","insertContentWithTitle","title","content","onUpdateTitle","onUpdateContent","value","create","text","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","newValue","insert","html","toHTMLString","PostTitle","Component","constructor","props","setRef","bind","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","plainText","onInsertBlockAfter","onInsertBlocks","onUpdate","pasteHandler","HTML","richText","getTitle","postType","__","sprintf","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","decodeEntities","borderColor","titleStyles","color","placeholderColor","jsx","View","testID","styles","titleContainer","dimmed","accessible","accessibilityLabel","accessibilityHint","children","RichText","Raw","ref","tagName","tagsToEliminate","unstableOnFocus","onBlur","fontSize","lineHeight","fontWeight","deleteEnter","onChange","onSelectionChange","onEnter","onEnterPress","disableEditingMenu","__unstableIsSelected","__unstableOnCreateUndoLevel","_default","exports","default","compose","withSelect","select","isPostTitleSelected","getEditedPostAttribute","editorStore","getSelectedBlockClientId","getBlockRootClientId","getSettings","blockEditorStore","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","withDispatch","dispatch","undo","redo","togglePostTitleSelection","editPost","clearSelectedBlock","insertDefaultBlock","insertBlocks","undefined","onUndo","onRedo","blocks","withInstanceId","withFocusOutside"],"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { create, toHTMLString, insert } from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore, RichText } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/** @typedef {import('./types').RichTextValue} RichTextValue */\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\n/**\n * Inserts content with title\n *\n * This function processes the given content and title, updating the title\n * and content based on certain conditions. If the content is an array of\n * blocks, it will check the first block for a heading or paragraph to use\n * as the title. If the content is a string, it will strip HTML and update\n * the title and content accordingly.\n *\n * @param {string} title The post title.\n * @param {Array | string} content The content to be processed. It can be an array of blocks or a string.\n * @param {Function} onUpdateTitle Callback function to update the title.\n * @param {Function} onUpdateContent Callback function to update the content.\n * @param {RichTextValue} value The initial value object, default is an object with empty text.\n */\nexport function insertContentWithTitle(\n\ttitle,\n\tcontent,\n\tonUpdateTitle,\n\tonUpdateContent,\n\tvalue = create( { text: '' } )\n) {\n\tif ( ! content.length ) {\n\t\treturn;\n\t}\n\n\tif ( typeof content !== 'string' ) {\n\t\tconst [ firstBlock ] = content;\n\n\t\tif (\n\t\t\t! title &&\n\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t) {\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( firstBlock.attributes.content );\n\t\t\tonUpdateTitle( contentNoHTML );\n\t\t\tonUpdateContent( content.slice( 1 ) );\n\t\t} else {\n\t\t\tonUpdateContent( content );\n\t\t}\n\t} else {\n\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t// is undesirable.\n\t\tconst contentNoHTML = stripHTML( content );\n\n\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\tonUpdateTitle( toHTMLString( { value: newValue } ) );\n\t}\n}\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText.\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, plainText, html } ) {\n\t\tconst {\n\t\t\ttitle,\n\t\t\tonInsertBlockAfter: onInsertBlocks,\n\t\t\tonUpdate,\n\t\t} = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tinsertContentWithTitle(\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\tonUpdate,\n\t\t\tonInsertBlocks,\n\t\t\tvalue\n\t\t);\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn ! title\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn ! title\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\ttestID=\"post-title\"\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText.Raw\n\t\t\t\t\tref={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\tfontWeight=\"bold\"\n\t\t\t\t\tdeleteEnter\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst { getSelectedBlockClientId, getBlockRootClientId, getSettings } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection, editPost } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock, insertBlocks } =\n\t\t\tdispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tonUpdate( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\tonInsertBlockAfter( blocks ) {\n\t\t\t\tinsertBlocks( blocks, 0 );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,IAAA,GAAAX,OAAA;AAOA,IAAAY,MAAA,GAAAC,sBAAA,CAAAb,OAAA;AAAkC,IAAAc,WAAA,GAAAd,OAAA;AAzBlC;AACA;AACA;;AAGA;AACA;AACA;;AAaA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASe,sBAAsBA,CACrCC,KAAK,EACLC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,KAAK,GAAG,IAAAC,gBAAM,EAAE;EAAEC,IAAI,EAAE;AAAG,CAAE,CAAC,EAC7B;EACD,IAAK,CAAEL,OAAO,CAACM,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;IACNd,QAAQ,EAAEmD,sBAAsB,CAAE,MAAO,CAAC;IAC1ChG,KAAK,EAAEgG,sBAAsB,CAAE,OAAQ,CAAC;IACxCpE,kBAAkB,EAAE,CAAC,CAAE0E,UAAU;IACjC3E,UAAU,EAAEoE,mBAAmB,CAAC,CAAC;IACjC1C,QAAQ,EAAEkD,iBAAiB;IAC3BjD;EACD,CAAC;AACF,CAAE,CAAC,EACH,IAAAmD,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAEC,IAAI;IAAEC,IAAI;IAAEC,wBAAwB;IAAEC;EAAS,CAAC,GACvDJ,QAAQ,CAAET,aAAY,CAAC;EAExB,MAAM;IAAEc,kBAAkB;IAAEC,kBAAkB;IAAEC;EAAa,CAAC,GAC7DP,QAAQ,CAAEL,kBAAiB,CAAC;EAE7B,OAAO;IACNhB,YAAYA,CAAA,EAAG;MACd2B,kBAAkB,CAAEE,SAAS,EAAEA,SAAS,EAAE,CAAE,CAAC;IAC9C,CAAC;IACDC,MAAM,EAAER,IAAI;IACZS,MAAM,EAAER,IAAI;IACZxE,QAAQA,CAAA,EAAG;MACVyE,wBAAwB,CAAE,IAAK,CAAC;MAChCE,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDhF,UAAUA,CAAA,EAAG;MACZ8E,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACDrE,QAAQA,CAAExC,KAAK,EAAG;MACjB8G,QAAQ,CAAE;QAAE9G;MAAM,CAAE,CAAC;IACtB,CAAC;IACDsC,kBAAkBA,CAAE+E,MAAM,EAAG;MAC5BJ,YAAY,CAAEI,MAAM,EAAE,CAAE,CAAC;IAC1B;EACD,CAAC;AACF,CAAE,CAAC,EACHC,uBAAc,EACdC,4BACD,CAAC,CAAErG,SAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_element","_richText","_htmlEntities","_data","_components","_compose","_i18n","_blocks","_blockEditor","_editor","_dom","_style","_interopRequireDefault","_jsxRuntime","insertContentWithTitle","title","content","onUpdateTitle","onUpdateContent","value","create","text","length","firstBlock","name","contentNoHTML","stripHTML","attributes","slice","newValue","insert","html","toHTMLString","PostTitle","Component","constructor","props","setRef","bind","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","plainText","onInsertBlockAfter","onInsertBlocks","onUpdate","pasteHandler","HTML","richText","getTitle","postType","__","sprintf","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","decodeEntities","borderColor","titleStyles","color","placeholderColor","jsx","View","testID","styles","titleContainer","dimmed","accessible","accessibilityLabel","accessibilityHint","children","RichText","Raw","ref","tagName","tagsToEliminate","unstableOnFocus","onBlur","fontSize","lineHeight","fontWeight","deleteEnter","onChange","onSelectionChange","onEnter","onEnterPress","disableEditingMenu","__unstableIsSelected","__unstableOnCreateUndoLevel","_default","exports","default","compose","withSelect","select","isPostTitleSelected","getEditedPostAttribute","editorStore","getSelectedBlockClientId","getBlockRootClientId","getSettings","blockEditorStore","selectedId","selectionIsNested","__experimentalGlobalStylesBaseStyles","withDispatch","dispatch","undo","redo","togglePostTitleSelection","editPost","clearSelectedBlock","insertDefaultBlock","insertBlocks","undefined","onUndo","onRedo","blocks","withInstanceId","withFocusOutside"],"sources":["@wordpress/editor/src/components/post-title/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { create, toHTMLString, insert } from '@wordpress/rich-text';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { withFocusOutside } from '@wordpress/components';\nimport { withInstanceId, compose } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore, RichText } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/** @typedef {import('./types').RichTextValue} RichTextValue */\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\n/**\n * Inserts content with title\n *\n * This function processes the given content and title, updating the title\n * and content based on certain conditions. If the content is an array of\n * blocks, it will check the first block for a heading or paragraph to use\n * as the title. If the content is a string, it will strip HTML and update\n * the title and content accordingly.\n *\n * @param {string} title The post title.\n * @param {Array | string} content The content to be processed. It can be an array of blocks or a string.\n * @param {Function} onUpdateTitle Callback function to update the title.\n * @param {Function} onUpdateContent Callback function to update the content.\n * @param {RichTextValue} value The initial value object, default is an object with empty text.\n */\nexport function insertContentWithTitle(\n\ttitle,\n\tcontent,\n\tonUpdateTitle,\n\tonUpdateContent,\n\tvalue = create( { text: '' } )\n) {\n\tif ( ! content.length ) {\n\t\treturn;\n\t}\n\n\tif ( typeof content !== 'string' ) {\n\t\tconst [ firstBlock ] = content;\n\n\t\tif (\n\t\t\t! title &&\n\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t) {\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( firstBlock.attributes.content );\n\t\t\tonUpdateTitle( contentNoHTML );\n\t\t\tonUpdateContent( content.slice( 1 ) );\n\t\t} else {\n\t\t\tonUpdateContent( content );\n\t\t}\n\t} else {\n\t\t// Strip HTML to avoid unwanted HTML being added to the title.\n\t\t// In the majority of cases it is assumed that HTML in the title\n\t\t// is undesirable.\n\t\tconst contentNoHTML = stripHTML( content );\n\n\t\tconst newValue = insert( value, create( { html: contentNoHTML } ) );\n\t\tonUpdateTitle( toHTMLString( { value: newValue } ) );\n\t}\n}\n\nclass PostTitle extends Component {\n\tconstructor( props ) {\n\t\tsuper( props );\n\n\t\tthis.setRef = this.setRef.bind( this );\n\t\tthis.onPaste = this.onPaste.bind( this );\n\t}\n\tcomponentDidUpdate( prevProps ) {\n\t\t// Unselect if any other block is selected and blur the RichText.\n\t\tif (\n\t\t\tthis.props.isSelected &&\n\t\t\t! prevProps.isAnyBlockSelected &&\n\t\t\tthis.props.isAnyBlockSelected\n\t\t) {\n\t\t\tif ( this.richTextRef ) {\n\t\t\t\tthis.richTextRef.blur();\n\t\t\t}\n\t\t\tthis.props.onUnselect();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tif ( this.props.innerRef ) {\n\t\t\tthis.props.innerRef( this );\n\t\t}\n\t}\n\n\thandleFocusOutside() {\n\t\tthis.props.onUnselect();\n\t}\n\n\tfocus() {\n\t\tthis.props.onSelect();\n\t}\n\n\tonPaste( { value, plainText, html } ) {\n\t\tconst {\n\t\t\ttitle,\n\t\t\tonInsertBlockAfter: onInsertBlocks,\n\t\t\tonUpdate,\n\t\t} = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tinsertContentWithTitle(\n\t\t\ttitle,\n\t\t\tcontent,\n\t\t\tonUpdate,\n\t\t\tonInsertBlocks,\n\t\t\tvalue\n\t\t);\n\t}\n\n\tsetRef( richText ) {\n\t\tthis.richTextRef = richText;\n\t}\n\n\tgetTitle( title, postType ) {\n\t\tif ( 'page' === postType ) {\n\t\t\treturn ! title\n\t\t\t\t? /* translators: accessibility text. empty page title. */\n\t\t\t\t __( 'Page title. Empty' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. %s: text content of the page title. */\n\t\t\t\t\t\t__( 'Page title. %s' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t );\n\t\t}\n\n\t\treturn ! title\n\t\t\t? /* translators: accessibility text. empty post title. */\n\t\t\t __( 'Post title. Empty' )\n\t\t\t: sprintf(\n\t\t\t\t\t/* translators: accessibility text. %s: text content of the post title. */\n\t\t\t\t\t__( 'Post title. %s' ),\n\t\t\t\t\ttitle\n\t\t\t );\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tstyle,\n\t\t\ttitle,\n\t\t\tfocusedBorderColor,\n\t\t\tborderStyle,\n\t\t\tisDimmed,\n\t\t\tpostType,\n\t\t\tglobalStyles,\n\t\t} = this.props;\n\n\t\tconst decodedPlaceholder = decodeEntities( placeholder );\n\t\tconst borderColor = this.props.isSelected\n\t\t\t? focusedBorderColor\n\t\t\t: 'transparent';\n\t\tconst titleStyles = {\n\t\t\t...style,\n\t\t\t...( globalStyles?.text && {\n\t\t\t\tcolor: globalStyles.text,\n\t\t\t\tplaceholderColor: globalStyles.text,\n\t\t\t} ),\n\t\t};\n\n\t\treturn (\n\t\t\t<View\n\t\t\t\ttestID=\"post-title\"\n\t\t\t\tstyle={ [\n\t\t\t\t\tstyles.titleContainer,\n\t\t\t\t\tborderStyle,\n\t\t\t\t\t{ borderColor },\n\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t] }\n\t\t\t\taccessible={ ! this.props.isSelected }\n\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\taccessibilityHint={ __( 'Updates the title.' ) }\n\t\t\t>\n\t\t\t\t<RichText.Raw\n\t\t\t\t\tref={ this.setRef }\n\t\t\t\t\taccessibilityLabel={ this.getTitle( title, postType ) }\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\ttagsToEliminate={ [ 'strong' ] }\n\t\t\t\t\tunstableOnFocus={ this.props.onSelect }\n\t\t\t\t\tonBlur={ this.props.onBlur } // Always assign onBlur as a props.\n\t\t\t\t\tstyle={ titleStyles }\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tfontSize={ 24 }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\tfontWeight=\"bold\"\n\t\t\t\t\tdeleteEnter\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tthis.props.onUpdate( value );\n\t\t\t\t\t} }\n\t\t\t\t\tonPaste={ this.onPaste }\n\t\t\t\t\tplaceholder={ decodedPlaceholder }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonSelectionChange={ () => {} }\n\t\t\t\t\tonEnter={ this.props.onEnterPress }\n\t\t\t\t\tdisableEditingMenu\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t);\n\t}\n}\n\nexport default compose(\n\twithSelect( ( select ) => {\n\t\tconst { isPostTitleSelected, getEditedPostAttribute } =\n\t\t\tselect( editorStore );\n\t\tconst { getSelectedBlockClientId, getBlockRootClientId, getSettings } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst selectedId = getSelectedBlockClientId();\n\t\tconst selectionIsNested = !! getBlockRootClientId( selectedId );\n\t\tconst globalStyles =\n\t\t\tgetSettings()?.__experimentalGlobalStylesBaseStyles?.color;\n\n\t\treturn {\n\t\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tisAnyBlockSelected: !! selectedId,\n\t\t\tisSelected: isPostTitleSelected(),\n\t\t\tisDimmed: selectionIsNested,\n\t\t\tglobalStyles,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { undo, redo, togglePostTitleSelection, editPost } =\n\t\t\tdispatch( editorStore );\n\n\t\tconst { clearSelectedBlock, insertDefaultBlock, insertBlocks } =\n\t\t\tdispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tonEnterPress() {\n\t\t\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t\t\t},\n\t\t\tonUndo: undo,\n\t\t\tonRedo: redo,\n\t\t\tonSelect() {\n\t\t\t\ttogglePostTitleSelection( true );\n\t\t\t\tclearSelectedBlock();\n\t\t\t},\n\t\t\tonUnselect() {\n\t\t\t\ttogglePostTitleSelection( false );\n\t\t\t},\n\t\t\tonUpdate( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\tonInsertBlockAfter( blocks ) {\n\t\t\t\tinsertBlocks( blocks, 0 );\n\t\t\t},\n\t\t};\n\t} ),\n\twithInstanceId,\n\twithFocusOutside\n)( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,IAAA,GAAAX,OAAA;AAOA,IAAAY,MAAA,GAAAC,sBAAA,CAAAb,OAAA;AAAkC,IAAAc,WAAA,GAAAd,OAAA;AAzBlC;AACA;AACA;;AAGA;AACA;AACA;;AAaA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASe,sBAAsBA,CACrCC,KAAK,EACLC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,KAAK,GAAG,IAAAC,gBAAM,EAAE;EAAEC,IAAI,EAAE;AAAG,CAAE,CAAC,EAC7B;EACD,IAAK,CAAEL,OAAO,CAACM,MAAM,EAAG;IACvB;EACD;EAEA,IAAK,OAAON,OAAO,KAAK,QAAQ,EAAG;IAClC,MAAM,CAAEO,UAAU,CAAE,GAAGP,OAAO;IAE9B,IACC,CAAED,KAAK,KACLQ,UAAU,CAACC,IAAI,KAAK,cAAc,IACnCD,UAAU,CAACC,IAAI,KAAK,gBAAgB,CAAE,EACtC;MACD;MACA;MACA;MACA,MAAMC,aAAa,GAAG,IAAAC,wBAAS,EAAEH,UAAU,CAACI,U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;EAC7B,MAAM;IAAEC,IAAI;IAAEC,IAAI;IAAEC,wBAAwB;IAAEC;EAAS,CAAC,GACvDJ,QAAQ,CAAET,aAAY,CAAC;EAExB,MAAM;IAAEc,kBAAkB;IAAEC,kBAAkB;IAAEC;EAAa,CAAC,GAC7DP,QAAQ,CAAEL,kBAAiB,CAAC;EAE7B,OAAO;IACNhB,YAAYA,CAAA,EAAG;MACd2B,kBAAkB,CAAEE,SAAS,EAAEA,SAAS,EAAE,CAAE,CAAC;IAC9C,CAAC;IACDC,MAAM,EAAER,IAAI;IACZS,MAAM,EAAER,IAAI;IACZxE,QAAQA,CAAA,EAAG;MACVyE,wBAAwB,CAAE,IAAK,CAAC;MAChCE,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDhF,UAAUA,CAAA,EAAG;MACZ8E,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACDrE,QAAQA,CAAExC,KAAK,EAAG;MACjB8G,QAAQ,CAAE;QAAE9G;MAAM,CAAE,CAAC;IACtB,CAAC;IACDsC,kBAAkBA,CAAE+E,MAAM,EAAG;MAC5BJ,YAAY,CAAEI,MAAM,EAAE,CAAE,CAAC;IAC1B;EACD,CAAC;AACF,CAAE,CAAC,EACHC,uBAAc,EACdC,4BACD,CAAC,CAAErG,SAAU,CAAC","ignoreList":[]}
@@ -70,87 +70,100 @@ var _jsxRuntime = require("react/jsx-runtime");
70
70
  } = (0, _data.useDispatch)(_notices.store);
71
71
  const [forceEmptyField, setForceEmptyField] = (0, _element.useState)(false);
72
72
  const copyButtonRef = (0, _compose.useCopyToClipboard)(permalink, () => {
73
- createNotice('info', (0, _i18n.__)('Copied URL to clipboard.'), {
73
+ createNotice('info', (0, _i18n.__)('Copied Permalink to clipboard.'), {
74
74
  isDismissible: true,
75
75
  type: 'snackbar'
76
76
  });
77
77
  });
78
+ const postUrlSlugDescriptionId = 'editor-post-url__slug-descriotion-' + (0, _compose.useInstanceId)(PostURL);
78
79
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
79
80
  className: "editor-post-url",
80
81
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalInspectorPopoverHeader, {
81
- title: (0, _i18n.__)('Link'),
82
+ title: (0, _i18n.__)('Slug'),
82
83
  onClose: onClose
83
84
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
84
85
  spacing: 3,
85
- children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
86
- children: (0, _element.createInterpolateElement)((0, _i18n.__)('Customize the last part of the URL. <a>Learn more.</a>'), {
86
+ children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
87
+ className: "editor-post-url__intro",
88
+ children: (0, _element.createInterpolateElement)((0, _i18n.__)('<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>'), {
89
+ span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
90
+ id: postUrlSlugDescriptionId
91
+ }),
87
92
  a: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
88
93
  href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink')
89
94
  })
90
95
  })
91
96
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
92
- children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
93
- __next40pxDefaultSize: true,
94
- prefix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControlPrefixWrapper, {
95
- children: "/"
96
- }),
97
- suffix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControlSuffixWrapper, {
98
- variant: "control",
99
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
100
- icon: _icons.copySmall,
101
- ref: copyButtonRef,
102
- size: "small",
103
- label: "Copy"
104
- })
105
- }),
106
- label: (0, _i18n.__)('Link'),
107
- hideLabelFromVision: true,
108
- value: forceEmptyField ? '' : postSlug,
109
- autoComplete: "off",
110
- spellCheck: "false",
111
- type: "text",
112
- className: "editor-post-url__input",
113
- onChange: newValue => {
114
- editPost({
115
- slug: newValue
116
- });
117
- // When we delete the field the permalink gets
118
- // reverted to the original value.
119
- // The forceEmptyField logic allows the user to have
120
- // the field temporarily empty while typing.
121
- if (!newValue) {
122
- if (!forceEmptyField) {
123
- setForceEmptyField(true);
97
+ children: [isEditable && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
98
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
99
+ __next40pxDefaultSize: true,
100
+ prefix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControlPrefixWrapper, {
101
+ children: "/"
102
+ }),
103
+ suffix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControlSuffixWrapper, {
104
+ variant: "control",
105
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
106
+ icon: _icons.copySmall,
107
+ ref: copyButtonRef,
108
+ size: "small",
109
+ label: "Copy"
110
+ })
111
+ }),
112
+ label: (0, _i18n.__)('Slug'),
113
+ hideLabelFromVision: true,
114
+ value: forceEmptyField ? '' : postSlug,
115
+ autoComplete: "off",
116
+ spellCheck: "false",
117
+ type: "text",
118
+ className: "editor-post-url__input",
119
+ onChange: newValue => {
120
+ editPost({
121
+ slug: newValue
122
+ });
123
+ // When we delete the field the permalink gets
124
+ // reverted to the original value.
125
+ // The forceEmptyField logic allows the user to have
126
+ // the field temporarily empty while typing.
127
+ if (!newValue) {
128
+ if (!forceEmptyField) {
129
+ setForceEmptyField(true);
130
+ }
131
+ return;
124
132
  }
125
- return;
126
- }
127
- if (forceEmptyField) {
128
- setForceEmptyField(false);
129
- }
130
- },
131
- onBlur: event => {
132
- editPost({
133
- slug: (0, _url.cleanForSlug)(event.target.value)
134
- });
135
- if (forceEmptyField) {
136
- setForceEmptyField(false);
137
- }
138
- },
139
- help: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.ExternalLink, {
140
- className: "editor-post-url__link",
141
- href: postLink,
142
- target: "_blank",
133
+ if (forceEmptyField) {
134
+ setForceEmptyField(false);
135
+ }
136
+ },
137
+ onBlur: event => {
138
+ editPost({
139
+ slug: (0, _url.cleanForSlug)(event.target.value)
140
+ });
141
+ if (forceEmptyField) {
142
+ setForceEmptyField(false);
143
+ }
144
+ },
145
+ "aria-describedby": postUrlSlugDescriptionId
146
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
147
+ className: "editor-post-url__permalink",
143
148
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
144
- className: "editor-post-url__link-prefix",
145
- children: permalinkPrefix
146
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
147
- className: "editor-post-url__link-slug",
148
- children: postSlug
149
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
150
- className: "editor-post-url__link-suffix",
151
- children: permalinkSuffix
149
+ className: "editor-post-url__permalink-visual-label",
150
+ children: (0, _i18n.__)('Permalink:')
151
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.ExternalLink, {
152
+ className: "editor-post-url__link",
153
+ href: postLink,
154
+ target: "_blank",
155
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
156
+ className: "editor-post-url__link-prefix",
157
+ children: permalinkPrefix
158
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
159
+ className: "editor-post-url__link-slug",
160
+ children: postSlug
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
162
+ className: "editor-post-url__link-suffix",
163
+ children: permalinkSuffix
164
+ })]
152
165
  })]
153
- })
166
+ })]
154
167
  }), !isEditable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
155
168
  className: "editor-post-url__link",
156
169
  href: postLink,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_notices","_icons","_coreData","_compose","_store","_jsxRuntime","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","useDispatch","createNotice","noticesStore","forceEmptyField","setForceEmptyField","useState","copyButtonRef","useCopyToClipboard","__","isDismissible","type","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","createInterpolateElement","a","ExternalLink","href","__experimentalInputControl","__next40pxDefaultSize","__experimentalInputControlPrefixWrapper","__experimentalInputControlSuffixWrapper","variant","Button","icon","copySmall","ref","size","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","cleanForSlug","target","help"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Customize the last part of the URL. <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tlabel=\"Copy\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLink }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAQA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAxBnD;AACA;AACA;;AAmBA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASY,OAAOA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EAC9C,MAAM;IACLC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC,eAAe;IACfC,eAAe;IACfC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,oBAAA;IAC5B,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,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AAMF,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3CzC;YAAe,CACZ,CAAC;UAAA,CACM;QACd,CACD,CACD,EACC,CAAEJ,UAAU,iBACb,IAAAH,WAAA,CAAAiD,GAAA,EAACvD,WAAA,CAAA8D,YAAY;UACZT,SAAS,EAAC,uBAAuB;UACjCU,IAAI,EAAGpD,QAAU;UACjB0E,MAAM,EAAC,QAAQ;UAAA/B,QAAA,EAEb3C;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_notices","_icons","_coreData","_compose","_store","_jsxRuntime","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","useDispatch","createNotice","noticesStore","forceEmptyField","setForceEmptyField","useState","copyButtonRef","useCopyToClipboard","__","isDismissible","type","postUrlSlugDescriptionId","useInstanceId","jsxs","className","children","jsx","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","createInterpolateElement","span","id","a","ExternalLink","href","Fragment","__experimentalInputControl","__next40pxDefaultSize","__experimentalInputControlPrefixWrapper","__experimentalInputControlSuffixWrapper","variant","Button","icon","copySmall","ref","size","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","cleanForSlug","target"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard, useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied Permalink to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\tconst postUrlSlugDescriptionId =\n\t\t'editor-post-url__slug-descriotion-' + useInstanceId( PostURL );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Slug' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<p className=\"editor-post-url__intro\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'<span>Customize the last part of the Permalink.</span> <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span id={ postUrlSlugDescriptionId } />,\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\tlabel=\"Copy\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabel={ __( 'Slug' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\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\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\t\tslug: cleanForSlug(\n\t\t\t\t\t\t\t\t\t\t\tevent.target.value\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\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\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\taria-describedby={ postUrlSlugDescriptionId }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p className=\"editor-post-url__permalink\">\n\t\t\t\t\t\t\t\t<span className=\"editor-post-url__permalink-visual-label\">\n\t\t\t\t\t\t\t\t\t{ __( 'Permalink:' ) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postLink }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAQA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAxBnD;AACA;AACA;;AAmBA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASY,OAAOA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EAC9C,MAAM;IACLC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC,eAAe;IACfC,eAAe;IACfC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,oBAAA;IAC5B,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;IACnD,MAAMC,YAAY,GAAGL,MAAM,CAAEG,YAAY,CAAC,CAACG,kBAAkB,CAAC,CAAC;IAC/D,MAAMC,QAAQ,GAAGP,MAAM,CAAEQ,eAAU,CAAC,CAACC,WAAW,CAAEJ,YAAa,CAAC;IAChE,MAAMK,cAAc,GAAGV,MAAM,CAAEG,YA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