@wordpress/editor 13.19.3 → 13.20.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 (274) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +6 -6
  3. package/build/components/autocompleters/user.js +5 -4
  4. package/build/components/autocompleters/user.js.map +1 -1
  5. package/build/components/deprecated.js +3 -2
  6. package/build/components/deprecated.js.map +1 -1
  7. package/build/components/document-outline/index.js +11 -11
  8. package/build/components/document-outline/index.js.map +1 -1
  9. package/build/components/document-outline/item.js +6 -6
  10. package/build/components/document-outline/item.js.map +1 -1
  11. package/build/components/editor-help/add-blocks.native.js +5 -5
  12. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  13. package/build/components/editor-help/customize-blocks.native.js +5 -5
  14. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  15. package/build/components/editor-help/help-detail-navigation-screen.native.js +8 -7
  16. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  17. package/build/components/editor-help/help-get-support-button.native.js +3 -3
  18. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  19. package/build/components/editor-help/help-section-title.native.js +3 -3
  20. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  21. package/build/components/editor-help/help-topic-row.native.js +3 -3
  22. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  23. package/build/components/editor-help/icon-move-blocks.native.js +3 -3
  24. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  25. package/build/components/editor-help/index.native.js +19 -19
  26. package/build/components/editor-help/index.native.js.map +1 -1
  27. package/build/components/editor-help/intro-to-blocks.native.js +15 -15
  28. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  29. package/build/components/editor-help/move-blocks.native.js +9 -9
  30. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  31. package/build/components/editor-help/remove-blocks.native.js +4 -4
  32. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  33. package/build/components/editor-help/view-sections.native.js +8 -8
  34. package/build/components/editor-help/view-sections.native.js.map +1 -1
  35. package/build/components/editor-history/redo.js +3 -2
  36. package/build/components/editor-history/redo.js.map +1 -1
  37. package/build/components/editor-history/undo.js +3 -2
  38. package/build/components/editor-history/undo.js.map +1 -1
  39. package/build/components/editor-notices/index.js +4 -4
  40. package/build/components/editor-notices/index.js.map +1 -1
  41. package/build/components/editor-snackbars/index.js +2 -2
  42. package/build/components/editor-snackbars/index.js.map +1 -1
  43. package/build/components/entities-saved-states/entity-record-item.js +3 -3
  44. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  45. package/build/components/entities-saved-states/entity-type-list.js +4 -4
  46. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  47. package/build/components/entities-saved-states/index.js +10 -9
  48. package/build/components/entities-saved-states/index.js.map +1 -1
  49. package/build/components/error-boundary/index.js +5 -4
  50. package/build/components/error-boundary/index.js.map +1 -1
  51. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +2 -1
  52. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  53. package/build/components/local-autosave-monitor/index.js +2 -1
  54. package/build/components/local-autosave-monitor/index.js.map +1 -1
  55. package/build/components/page-attributes/order.js +5 -4
  56. package/build/components/page-attributes/order.js.map +1 -1
  57. package/build/components/page-attributes/parent.js +3 -2
  58. package/build/components/page-attributes/parent.js.map +1 -1
  59. package/build/components/post-author/check.js +2 -2
  60. package/build/components/post-author/check.js.map +1 -1
  61. package/build/components/post-author/combobox.js +3 -2
  62. package/build/components/post-author/combobox.js.map +1 -1
  63. package/build/components/post-author/index.js +3 -3
  64. package/build/components/post-author/index.js.map +1 -1
  65. package/build/components/post-author/select.js +3 -2
  66. package/build/components/post-author/select.js.map +1 -1
  67. package/build/components/post-comments/index.js +2 -2
  68. package/build/components/post-comments/index.js.map +1 -1
  69. package/build/components/post-excerpt/check.js +2 -2
  70. package/build/components/post-excerpt/check.js.map +1 -1
  71. package/build/components/post-excerpt/index.js +4 -4
  72. package/build/components/post-excerpt/index.js.map +1 -1
  73. package/build/components/post-featured-image/check.js +3 -3
  74. package/build/components/post-featured-image/check.js.map +1 -1
  75. package/build/components/post-featured-image/index.js +15 -14
  76. package/build/components/post-featured-image/index.js.map +1 -1
  77. package/build/components/post-format/check.js +2 -2
  78. package/build/components/post-format/check.js.map +1 -1
  79. package/build/components/post-format/index.js +5 -5
  80. package/build/components/post-format/index.js.map +1 -1
  81. package/build/components/post-last-revision/check.js +2 -2
  82. package/build/components/post-last-revision/check.js.map +1 -1
  83. package/build/components/post-last-revision/index.js +2 -2
  84. package/build/components/post-last-revision/index.js.map +1 -1
  85. package/build/components/post-locked-modal/index.js +14 -13
  86. package/build/components/post-locked-modal/index.js.map +1 -1
  87. package/build/components/post-pending-status/index.js +2 -2
  88. package/build/components/post-pending-status/index.js.map +1 -1
  89. package/build/components/post-pingbacks/index.js +2 -2
  90. package/build/components/post-pingbacks/index.js.map +1 -1
  91. package/build/components/post-preview-button/index.js +8 -7
  92. package/build/components/post-preview-button/index.js.map +1 -1
  93. package/build/components/post-publish-button/index.js +4 -3
  94. package/build/components/post-publish-button/index.js.map +1 -1
  95. package/build/components/post-publish-panel/index.js +13 -12
  96. package/build/components/post-publish-panel/index.js.map +1 -1
  97. package/build/components/post-publish-panel/maybe-category-panel.js +5 -4
  98. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  99. package/build/components/post-publish-panel/maybe-post-format-panel.js +5 -5
  100. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  101. package/build/components/post-publish-panel/maybe-tags-panel.js +6 -5
  102. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  103. package/build/components/post-publish-panel/maybe-upload-media.js +9 -8
  104. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  105. package/build/components/post-publish-panel/postpublish.js +15 -14
  106. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  107. package/build/components/post-publish-panel/prepublish.js +15 -15
  108. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  109. package/build/components/post-saved-state/index.js +5 -4
  110. package/build/components/post-saved-state/index.js.map +1 -1
  111. package/build/components/post-schedule/index.js +3 -2
  112. package/build/components/post-schedule/index.js.map +1 -1
  113. package/build/components/post-slug/check.js +2 -2
  114. package/build/components/post-slug/check.js.map +1 -1
  115. package/build/components/post-slug/index.js +3 -2
  116. package/build/components/post-slug/index.js.map +1 -1
  117. package/build/components/post-sticky/check.js +12 -14
  118. package/build/components/post-sticky/check.js.map +1 -1
  119. package/build/components/post-sticky/index.js +14 -24
  120. package/build/components/post-sticky/index.js.map +1 -1
  121. package/build/components/post-switch-to-draft-button/index.js +35 -43
  122. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  123. package/build/components/post-sync-status/index.js +10 -9
  124. package/build/components/post-sync-status/index.js.map +1 -1
  125. package/build/components/post-taxonomies/flat-term-selector.js +4 -3
  126. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  127. package/build/components/post-taxonomies/hierarchical-term-selector.js +15 -14
  128. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  129. package/build/components/post-taxonomies/index.js +3 -2
  130. package/build/components/post-taxonomies/index.js.map +1 -1
  131. package/build/components/post-taxonomies/most-used-terms.js +6 -6
  132. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  133. package/build/components/post-template/index.js +2 -2
  134. package/build/components/post-template/index.js.map +1 -1
  135. package/build/components/post-text-editor/index.js +4 -3
  136. package/build/components/post-text-editor/index.js.map +1 -1
  137. package/build/components/post-title/index.js +4 -3
  138. package/build/components/post-title/index.js.map +1 -1
  139. package/build/components/post-title/index.native.js +4 -3
  140. package/build/components/post-title/index.native.js.map +1 -1
  141. package/build/components/post-trash/index.js +14 -4
  142. package/build/components/post-trash/index.js.map +1 -1
  143. package/build/components/post-type-support-check/index.js +2 -2
  144. package/build/components/post-type-support-check/index.js.map +1 -1
  145. package/build/components/post-url/index.js +11 -10
  146. package/build/components/post-url/index.js.map +1 -1
  147. package/build/components/post-visibility/index.js +17 -16
  148. package/build/components/post-visibility/index.js.map +1 -1
  149. package/build/components/provider/index.js +7 -6
  150. package/build/components/provider/index.js.map +1 -1
  151. package/build/components/provider/index.native.js +4 -3
  152. package/build/components/provider/index.native.js.map +1 -1
  153. package/build/components/provider/with-registry-provider.js +4 -3
  154. package/build/components/provider/with-registry-provider.js.map +1 -1
  155. package/build/components/table-of-contents/index.js +5 -4
  156. package/build/components/table-of-contents/index.js.map +1 -1
  157. package/build/components/table-of-contents/panel.js +15 -15
  158. package/build/components/table-of-contents/panel.js.map +1 -1
  159. package/build/components/template-validation-notice/index.js +2 -2
  160. package/build/components/template-validation-notice/index.js.map +1 -1
  161. package/build/components/time-to-read/index.js +5 -4
  162. package/build/components/time-to-read/index.js.map +1 -1
  163. package/build/components/unsaved-changes-warning/index.js +1 -1
  164. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  165. package/build/components/word-count/index.js +2 -2
  166. package/build/components/word-count/index.js.map +1 -1
  167. package/build/hooks/custom-sources-backwards-compatibility.js +3 -2
  168. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  169. package/build-module/components/autocompleters/user.js +1 -1
  170. package/build-module/components/deprecated.js +1 -1
  171. package/build-module/components/document-outline/index.js +1 -1
  172. package/build-module/components/document-outline/item.js +1 -1
  173. package/build-module/components/editor-help/add-blocks.native.js +1 -1
  174. package/build-module/components/editor-help/customize-blocks.native.js +1 -1
  175. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -1
  176. package/build-module/components/editor-help/help-get-support-button.native.js +1 -1
  177. package/build-module/components/editor-help/help-section-title.native.js +1 -1
  178. package/build-module/components/editor-help/help-topic-row.native.js +1 -1
  179. package/build-module/components/editor-help/icon-move-blocks.native.js +1 -1
  180. package/build-module/components/editor-help/index.native.js +1 -1
  181. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
  182. package/build-module/components/editor-help/move-blocks.native.js +1 -1
  183. package/build-module/components/editor-help/remove-blocks.native.js +1 -1
  184. package/build-module/components/editor-help/view-sections.native.js +1 -1
  185. package/build-module/components/editor-history/redo.js +1 -1
  186. package/build-module/components/editor-history/undo.js +1 -1
  187. package/build-module/components/editor-notices/index.js +1 -1
  188. package/build-module/components/editor-snackbars/index.js +1 -1
  189. package/build-module/components/entities-saved-states/entity-record-item.js +1 -1
  190. package/build-module/components/entities-saved-states/entity-type-list.js +1 -1
  191. package/build-module/components/entities-saved-states/index.js +1 -1
  192. package/build-module/components/error-boundary/index.js +1 -1
  193. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
  194. package/build-module/components/local-autosave-monitor/index.js +1 -1
  195. package/build-module/components/page-attributes/order.js +1 -1
  196. package/build-module/components/page-attributes/parent.js +1 -1
  197. package/build-module/components/post-author/check.js +1 -1
  198. package/build-module/components/post-author/combobox.js +1 -1
  199. package/build-module/components/post-author/index.js +1 -1
  200. package/build-module/components/post-author/select.js +1 -1
  201. package/build-module/components/post-comments/index.js +1 -1
  202. package/build-module/components/post-excerpt/check.js +1 -1
  203. package/build-module/components/post-excerpt/index.js +1 -1
  204. package/build-module/components/post-featured-image/check.js +1 -1
  205. package/build-module/components/post-featured-image/index.js +1 -1
  206. package/build-module/components/post-format/check.js +1 -1
  207. package/build-module/components/post-format/index.js +1 -1
  208. package/build-module/components/post-last-revision/check.js +1 -1
  209. package/build-module/components/post-last-revision/index.js +1 -1
  210. package/build-module/components/post-locked-modal/index.js +1 -1
  211. package/build-module/components/post-pending-status/index.js +1 -1
  212. package/build-module/components/post-pingbacks/index.js +1 -1
  213. package/build-module/components/post-preview-button/index.js +1 -1
  214. package/build-module/components/post-publish-button/index.js +1 -1
  215. package/build-module/components/post-publish-panel/index.js +1 -1
  216. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -1
  217. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  218. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
  219. package/build-module/components/post-publish-panel/maybe-upload-media.js +1 -1
  220. package/build-module/components/post-publish-panel/postpublish.js +1 -1
  221. package/build-module/components/post-publish-panel/prepublish.js +1 -1
  222. package/build-module/components/post-saved-state/index.js +2 -2
  223. package/build-module/components/post-saved-state/index.js.map +1 -1
  224. package/build-module/components/post-schedule/index.js +1 -1
  225. package/build-module/components/post-slug/check.js +1 -1
  226. package/build-module/components/post-slug/index.js +1 -1
  227. package/build-module/components/post-sticky/check.js +13 -13
  228. package/build-module/components/post-sticky/check.js.map +1 -1
  229. package/build-module/components/post-sticky/index.js +13 -21
  230. package/build-module/components/post-sticky/index.js.map +1 -1
  231. package/build-module/components/post-switch-to-draft-button/index.js +32 -40
  232. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  233. package/build-module/components/post-sync-status/index.js +1 -1
  234. package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
  235. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  236. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  237. package/build-module/components/post-taxonomies/index.js +1 -1
  238. package/build-module/components/post-taxonomies/most-used-terms.js +1 -1
  239. package/build-module/components/post-template/index.js +1 -1
  240. package/build-module/components/post-text-editor/index.js +1 -1
  241. package/build-module/components/post-title/index.js +1 -1
  242. package/build-module/components/post-title/index.native.js +1 -1
  243. package/build-module/components/post-trash/index.js +15 -5
  244. package/build-module/components/post-trash/index.js.map +1 -1
  245. package/build-module/components/post-type-support-check/index.js +2 -2
  246. package/build-module/components/post-type-support-check/index.js.map +1 -1
  247. package/build-module/components/post-url/index.js +1 -1
  248. package/build-module/components/post-visibility/index.js +1 -1
  249. package/build-module/components/provider/index.js +1 -1
  250. package/build-module/components/provider/index.native.js +1 -1
  251. package/build-module/components/provider/with-registry-provider.js +1 -1
  252. package/build-module/components/table-of-contents/index.js +1 -1
  253. package/build-module/components/table-of-contents/panel.js +1 -1
  254. package/build-module/components/template-validation-notice/index.js +1 -1
  255. package/build-module/components/time-to-read/index.js +1 -1
  256. package/build-module/components/unsaved-changes-warning/index.js +1 -1
  257. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  258. package/build-module/components/word-count/index.js +1 -1
  259. package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -1
  260. package/build-style/style-rtl.css +1 -1
  261. package/build-style/style.css +1 -1
  262. package/package.json +31 -31
  263. package/src/components/post-featured-image/README.md +3 -3
  264. package/src/components/post-saved-state/index.js +1 -1
  265. package/src/components/post-sticky/check.js +10 -13
  266. package/src/components/post-sticky/index.js +10 -20
  267. package/src/components/post-sticky/test/index.js +31 -16
  268. package/src/components/post-switch-to-draft-button/index.js +20 -35
  269. package/src/components/post-taxonomies/README.md +2 -2
  270. package/src/components/post-taxonomies/hierarchical-term-selector.js +1 -1
  271. package/src/components/post-trash/index.js +34 -11
  272. package/src/components/post-type-support-check/README.md +1 -1
  273. package/src/components/post-type-support-check/index.js +2 -2
  274. package/src/components/unsaved-changes-warning/index.js +1 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.PostTemplate = PostTemplate;
7
7
  exports.default = void 0;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _components = require("@wordpress/components");
11
11
  var _data = require("@wordpress/data");
@@ -46,7 +46,7 @@ function PostTemplate() {
46
46
  if (!isViewable || !availableTemplates || !Object.keys(availableTemplates).length) {
47
47
  return null;
48
48
  }
49
- return (0, _element.createElement)(_components.SelectControl, {
49
+ return (0, _react.createElement)(_components.SelectControl, {
50
50
  __nextHasNoMarginBottom: true,
51
51
  label: (0, _i18n.__)('Template:'),
52
52
  value: selectedTemplate,
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_coreData","_store","PostTemplate","availableTemplates","selectedTemplate","isViewable","useSelect","select","_getPostType$viewable","getEditedPostAttribute","getEditorSettings","getCurrentPostType","editorStore","getPostType","coreStore","viewable","editPost","useDispatch","Object","keys","length","_element","createElement","SelectControl","__nextHasNoMarginBottom","label","__","value","onChange","templateSlug","template","options","entries","map","templateName","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif (\n\t\t! isViewable ||\n\t\t! availableTemplates ||\n\t\t! Object.keys( availableTemplates ).length\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ Object.entries( availableTemplates ?? {} ).map(\n\t\t\t\t( [ templateSlug, templateName ] ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n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CAAE;QACTc,QAAQ,EAAED,YAAY,IAAI;MAC3B,CAAE,CAAC;IACJ,CAAG;IACHE,OAAO,EAAGb,MAAM,CAACc,OAAO,CAAE7B,kBAAkB,aAAlBA,kBAAkB,cAAlBA,kBAAkB,GAAI,CAAC,CAAE,CAAC,CAAC8B,GAAG,CACvD,CAAE,CAAEJ,YAAY,EAAEK,YAAY,CAAE,MAAQ;MACvCP,KAAK,EAAEE,YAAY;MACnBJ,KAAK,EAAES;IACR,CAAC,CACF;EAAG,CACH,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEcjC,YAAY;AAAAkC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_coreData","_store","PostTemplate","availableTemplates","selectedTemplate","isViewable","useSelect","select","_getPostType$viewable","getEditedPostAttribute","getEditorSettings","getCurrentPostType","editorStore","getPostType","coreStore","viewable","editPost","useDispatch","Object","keys","length","_react","createElement","SelectControl","__nextHasNoMarginBottom","label","__","value","onChange","templateSlug","template","options","entries","map","templateName","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostTemplate() {\n\tconst { availableTemplates, selectedTemplate, isViewable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetEditorSettings,\n\t\t\t\tgetCurrentPostType,\n\t\t\t} = select( editorStore );\n\t\t\tconst { getPostType } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tselectedTemplate: getEditedPostAttribute( 'template' ),\n\t\t\t\tavailableTemplates: getEditorSettings().availableTemplates,\n\t\t\t\tisViewable:\n\t\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tif (\n\t\t! isViewable ||\n\t\t! availableTemplates ||\n\t\t! Object.keys( availableTemplates ).length\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Template:' ) }\n\t\t\tvalue={ selectedTemplate }\n\t\t\tonChange={ ( templateSlug ) => {\n\t\t\t\teditPost( {\n\t\t\t\t\ttemplate: templateSlug || '',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\toptions={ Object.entries( availableTemplates ?? {} ).map(\n\t\t\t\t( [ templateSlug, templateName ] ) => ( {\n\t\t\t\t\tvalue: templateSlug,\n\t\t\t\t\tlabel: templateName,\n\t\t\t\t} )\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default PostTemplate;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGO,SAASK,YAAYA,CAAA,EAAG;EAC9B,MAAM;IAAEC,kBAAkB;IAAEC,gBAAgB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EACnEC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MACLC,sBAAsB;MACtBC,iBAAiB;MACjBC;IACD,CAAC,GAAGJ,MAAM,CAAEK,YAAY,CAAC;IACzB,MAAM;MAAEC;IAAY,CAAC,GAAGN,MAAM,CAAEO,eAAU,CAAC;IAE3C,OAAO;MACNV,gBAAgB,EAAEK,sBAAsB,CAAE,UAAW,CAAC;MACtDN,kBAAkB,EAAEO,iBAAiB,CAAC,CAAC,CAACP,kBAAkB;MAC1DE,UAAU,GAAAG,qBAAA,GACTK,WAAW,CAAEF,kBAAkB,CAAC,CAAE,CAAC,EAAEI,QAAQ,cAAAP,qBAAA,cAAAA,qBAAA,GAAI;IACnD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEQ;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEL,YAAY,CAAC;EAE/C,IACC,CAAEP,UAAU,IACZ,CAAEF,kBAAkB,IACpB,CAAEe,MAAM,CAACC,IAAI,CAAEhB,kBAAmB,CAAC,CAACiB,MAAM,EACzC;IACD,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAyB,aAAa;IACbC,uBAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,WAAY,CAAG;IAC3BC,KAAK,EAAGvB,gBAAkB;IAC1BwB,QAAQ,EAAKC,YAAY,IAAM;MAC9Bb,QAAQ,CAAE;QACTc,QAAQ,EAAED,YAAY,IAAI;MAC3B,CAAE,CAAC;IACJ,CAAG;IACHE,OAAO,EAAGb,MAAM,CAACc,OAAO,CAAE7B,kBAAkB,aAAlBA,kBAAkB,cAAlBA,kBAAkB,GAAI,CAAC,CAAE,CAAC,CAAC8B,GAAG,CACvD,CAAE,CAAEJ,YAAY,EAAEK,YAAY,CAAE,MAAQ;MACvCP,KAAK,EAAEE,YAAY;MACnBJ,KAAK,EAAES;IACR,CAAC,CACF;EAAG,CACH,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEcjC,YAAY;AAAAkC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = PostTextEditor;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _reactAutosizeTextarea = _interopRequireDefault(require("react-autosize-textarea"));
10
10
  var _i18n = require("@wordpress/i18n");
11
11
  var _coreData = require("@wordpress/core-data");
12
+ var _element = require("@wordpress/element");
12
13
  var _blocks = require("@wordpress/blocks");
13
14
  var _data = require("@wordpress/data");
14
15
  var _compose = require("@wordpress/compose");
@@ -68,10 +69,10 @@ function PostTextEditor() {
68
69
  }
69
70
  return content;
70
71
  }, [content, blocks]);
71
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.VisuallyHidden, {
72
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.VisuallyHidden, {
72
73
  as: "label",
73
74
  htmlFor: `post-content-${instanceId}`
74
- }, (0, _i18n.__)('Type text or HTML')), (0, _element.createElement)(_reactAutosizeTextarea.default, {
75
+ }, (0, _i18n.__)('Type text or HTML')), (0, _react.createElement)(_reactAutosizeTextarea.default, {
75
76
  autoComplete: "off",
76
77
  dir: "auto",
77
78
  value: value,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_reactAutosizeTextarea","_interopRequireDefault","_i18n","_coreData","_blocks","_data","_compose","_components","_store","PostTextEditor","instanceId","useInstanceId","content","blocks","type","id","useSelect","select","getEditedEntityRecord","coreStore","getCurrentPostType","getCurrentPostId","editorStore","_type","_id","editedRecord","editEntityRecord","useDispatch","value","useMemo","Function","__unstableSerializeAndClean","createElement","Fragment","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\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":";;;;;;;AAUA,IAAAA,QAAA,GAAA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AEC;MAAO,CAAE,CAAC;IAC7B,CAAC,MAAM,IAAKA,MAAM,EAAG;MACpB;MACA;MACA;MACA,OAAO,IAAAkB,mCAA2B,EAAElB,MAAO,CAAC;IAC7C;IACA,OAAOD,OAAO;EACf,CAAC,EAAE,CAAEA,OAAO,EAAEC,MAAM,CAAG,CAAC;EAExB,OACC,IAAAf,QAAA,CAAAkC,aAAA,EAAAlC,QAAA,CAAAmC,QAAA,QACC,IAAAnC,QAAA,CAAAkC,aAAA,EAACzB,WAAA,CAAA2B,cAAc;IACdC,EAAE,EAAC,OAAO;IACVC,OAAO,EAAI,gBAAgB1B,UAAY;EAAG,GAExC,IAAA2B,QAAE,EAAE,mBAAoB,CACX,CAAC,EACjB,IAAAvC,QAAA,CAAAkC,aAAA,EAAChC,sBAAA,CAAAsC,OAAQ;IACRC,YAAY,EAAC,KAAK;IAClBC,GAAG,EAAC,MAAM;IACVZ,KAAK,EAAGA,KAAO;IACfa,QAAQ,EAAKC,KAAK,IAAM;MACvBhB,gBAAgB,CAAE,UAAU,EAAEZ,IAAI,EAAEC,EAAE,EAAE;QACvCH,OAAO,EAAE8B,KAAK,CAACC,MAAM,CAACf,KAAK;QAC3Bf,MAAM,EAAE+B,SAAS;QACjBC,SAAS,EAAED;MACZ,CAAE,CAAC;IACJ,CAAG;IACHE,SAAS,EAAC,yBAAyB;IACnC/B,EAAE,EAAI,gBAAgBL,UAAY,EAAG;IACrCqC,WAAW,EAAG,IAAAV,QAAE,EAAE,iCAAkC;EAAG,CACvD,CACA,CAAC;AAEL"}
1
+ {"version":3,"names":["_reactAutosizeTextarea","_interopRequireDefault","require","_i18n","_coreData","_element","_blocks","_data","_compose","_components","_store","PostTextEditor","instanceId","useInstanceId","content","blocks","type","id","useSelect","select","getEditedEntityRecord","coreStore","getCurrentPostType","getCurrentPostId","editorStore","_type","_id","editedRecord","editEntityRecord","useDispatch","value","useMemo","Function","__unstableSerializeAndClean","_react","createElement","Fragment","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\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;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAGe,SAASS,cAAcA,CAAA,EAAG;EACxC,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEF,cAAe,CAAC;EAClD,MAAM;IAAEG,OAAO;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAG,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9D,MAAM;MAAEC;IAAsB,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;IACrD,MAAM;MAAEC,kBAAkB;MAAEC;IAAiB,CAAC,GAAGJ,MAAM,CAAEK,YAAY,CAAC;IACtE,MAAMC,KAAK,GAAGH,kBAAkB,CAAC,CAAC;IAClC,MAAMI,GAAG,GAAGH,gBAAgB,CAAC,CAAC;IAC9B,MA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AE,CAAC;IACJ,CAAG;IACHE,SAAS,EAAC,yBAAyB;IACnChC,EAAE,EAAI,gBAAgBL,UAAY,EAAG;IACrCsC,WAAW,EAAG,IAAAV,QAAE,EAAE,iCAAkC;EAAG,CACvD,CACA,CAAC;AAEL"}
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _i18n = require("@wordpress/i18n");
11
+ var _element = require("@wordpress/element");
11
12
  var _htmlEntities = require("@wordpress/html-entities");
12
13
  var _keycodes = require("@wordpress/keycodes");
13
14
  var _data = require("@wordpress/data");
@@ -224,9 +225,9 @@ function PostTitle(_, forwardedRef) {
224
225
  });
225
226
 
226
227
  /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
227
- return (0, _element.createElement)(_postTypeSupportCheck.default, {
228
+ return (0, _react.createElement)(_postTypeSupportCheck.default, {
228
229
  supportKeys: "title"
229
- }, (0, _element.createElement)("h1", {
230
+ }, (0, _react.createElement)("h1", {
230
231
  ref: (0, _compose.useMergeRefs)([richTextRef, ref]),
231
232
  contentEditable: true,
232
233
  className: className,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_htmlEntities","_keycodes","_data","_blocks","_blockEditor","_richText","_compose","_dom","_postTypeSupportCheck","_store","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","useRef","isSelected","setIsSelected","useState","editPost","useDispatch","editorStore","insertDefaultBlock","clearSelectedBlock","insertBlocks","blockEditorStore","isCleanNewPost","title","placeholder","hasFixedToolbar","useSelect","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","useImperativeHandle","focus","current","useEffect","defaultView","ownerDocument","name","parent","document","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","className","classnames","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace","createElement","default","supportKeys","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","forwardRef","exports"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { insertDefaultBlock, clearSelectedBlock, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { isCleanNewPost, title, placeholder, hasFixedToolbar } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, isCleanNewPost: _isCleanNewPost } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\t\tgetSettings();\n\n\t\t\treturn {\n\t\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\t\tplaceholder: titlePlaceholder,\n\t\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseImperativeHandle( forwardedRef, () => ( {\n\t\tfocus: () => {\n\t\t\tref?.current?.focus();\n\t\t},\n\t} ) );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = ref.current.ownerDocument;\n\t\tconst { name, parent } = defaultView;\n\t\tconst ownerDocument =\n\t\t\tname === 'editor-canvas' ? parent.document : defaultView.document;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\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 onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( stripHTML( firstBlock.attributes.content ) );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\t\t\tconst newValue = insert(\n\t\t\t\tvalue,\n\t\t\t\tcreate( { html: stripHTML( content ) } )\n\t\t\t);\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t\tpreserveWhiteSpace: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAQA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AAMA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,IAAA,GAAAX,OAAA;AAKA,IAAAY,qBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AAlCA;AACA;AACA;;AAGA;AACA;AACA;;AAuBA;AACA;AACA;;AAIA;AACA;AACA;AACA,MAAMc,eAAe,GAAG,UAAU;AAElC,SAASC,SAASA,CAAEC,CAAC,EAAEC,YAAY,EAAG;EACrC,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACvD,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/C,MAAM;IAAEC,kBAAkB;IAAEC,kBAAkB;IAAEC;EAAa,CAAC,GAC7D,IAAAJ,iBAAW,EAAEK,kBAAiB,CAAC;EAChC,MAAM;IAAEC,cAAc;IAAEC,KAAK;IAAEC,WAAW;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EACtEC,MAAM,I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AW;IACvB,cAAaE,kBAAoB;IACjCkB,IAAI,EAAC,SAAS;IACd,kBAAe,MAAM;IACrBC,OAAO,EAAGvD,QAAU;IACpBwD,MAAM,EAAGvD,UAAY;IACrBI,SAAS,EAAGA,SAAW;IACvBoD,UAAU,EAAGxD,UAAY;IACzBS,OAAO,EAAGA;EAAS,CACnB,CACoB,CAAC;EAExB;AACD;AAAC,IAAAgD,QAAA,GAEc,IAAAC,mBAAU,EAAExG,SAAU,CAAC;AAAAyG,OAAA,CAAAV,OAAA,GAAAQ,QAAA"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_element","_htmlEntities","_keycodes","_data","_blocks","_blockEditor","_richText","_compose","_dom","_postTypeSupportCheck","_store","REGEXP_NEWLINES","PostTitle","_","forwardedRef","ref","useRef","isSelected","setIsSelected","useState","editPost","useDispatch","editorStore","insertDefaultBlock","clearSelectedBlock","insertBlocks","blockEditorStore","isCleanNewPost","title","placeholder","hasFixedToolbar","useSelect","select","getEditedPostAttribute","_isCleanNewPost","getSettings","titlePlaceholder","_hasFixedToolbar","useImperativeHandle","focus","current","useEffect","defaultView","ownerDocument","name","parent","document","activeElement","body","onEnterPress","undefined","onInsertBlockAfter","blocks","onUpdate","newTitle","selection","setSelection","onSelect","onUnselect","onChange","value","replace","onKeyDown","event","keyCode","ENTER","preventDefault","onPaste","clipboardData","plainText","html","getData","error1","error2","window","console","log","content","pasteHandler","HTML","length","firstBlock","stripHTML","attributes","slice","create","newValue","insert","toHTMLString","start","end","className","classnames","decodedPlaceholder","decodeEntities","__","richTextRef","useRichText","selectionStart","selectionEnd","onSelectionChange","newStart","newEnd","sel","__unstableDisableFormats","preserveWhiteSpace","_react","createElement","default","supportKeys","useMergeRefs","contentEditable","role","onFocus","onBlur","onKeyPress","_default","forwardRef","exports"],"sources":["@wordpress/editor/src/components/post-title/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { ENTER } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pasteHandler } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\t__unstableUseRichText as useRichText,\n\tcreate,\n\ttoHTMLString,\n\tinsert,\n} from '@wordpress/rich-text';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Constants\n */\nconst REGEXP_NEWLINES = /[\\r\\n]+/g;\n\nfunction PostTitle( _, forwardedRef ) {\n\tconst ref = useRef();\n\tconst [ isSelected, setIsSelected ] = useState( false );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { insertDefaultBlock, clearSelectedBlock, insertBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { isCleanNewPost, title, placeholder, hasFixedToolbar } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostAttribute, isCleanNewPost: _isCleanNewPost } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { titlePlaceholder, hasFixedToolbar: _hasFixedToolbar } =\n\t\t\t\tgetSettings();\n\n\t\t\treturn {\n\t\t\t\tisCleanNewPost: _isCleanNewPost(),\n\t\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\t\tplaceholder: titlePlaceholder,\n\t\t\t\thasFixedToolbar: _hasFixedToolbar,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseImperativeHandle( forwardedRef, () => ( {\n\t\tfocus: () => {\n\t\t\tref?.current?.focus();\n\t\t},\n\t} ) );\n\n\tuseEffect( () => {\n\t\tif ( ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { defaultView } = ref.current.ownerDocument;\n\t\tconst { name, parent } = defaultView;\n\t\tconst ownerDocument =\n\t\t\tname === 'editor-canvas' ? parent.document : defaultView.document;\n\t\tconst { activeElement, body } = ownerDocument;\n\n\t\t// Only autofocus the title when the post is entirely empty. This should\n\t\t// only happen for a new post, which means we focus the title on new\n\t\t// post so the author can start typing right away, without needing to\n\t\t// click anything.\n\t\tif ( isCleanNewPost && ( ! activeElement || body === activeElement ) ) {\n\t\t\tref.current.focus();\n\t\t}\n\t}, [ isCleanNewPost ] );\n\n\tfunction onEnterPress() {\n\t\tinsertDefaultBlock( undefined, undefined, 0 );\n\t}\n\n\tfunction onInsertBlockAfter( blocks ) {\n\t\tinsertBlocks( blocks, 0 );\n\t}\n\n\tfunction onUpdate( newTitle ) {\n\t\teditPost( { title: newTitle } );\n\t}\n\n\tconst [ selection, setSelection ] = useState( {} );\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 onChange( value ) {\n\t\tonUpdate( value.replace( REGEXP_NEWLINES, ' ' ) );\n\t}\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tonEnterPress();\n\t\t}\n\t}\n\n\tfunction onPaste( event ) {\n\t\tconst clipboardData = event.clipboardData;\n\n\t\tlet plainText = '';\n\t\tlet html = '';\n\n\t\t// IE11 only supports `Text` as an argument for `getData` and will\n\t\t// otherwise throw an invalid argument error, so we try the standard\n\t\t// arguments first, then fallback to `Text` if they fail.\n\t\ttry {\n\t\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\t\thtml = clipboardData.getData( 'text/html' );\n\t\t} catch ( error1 ) {\n\t\t\ttry {\n\t\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t\t} catch ( error2 ) {\n\t\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t\t// behaviour.\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Allows us to ask for this information when we get a report.\n\t\twindow.console.log( 'Received HTML:\\n\\n', html );\n\t\twindow.console.log( 'Received plain text:\\n\\n', plainText );\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tevent.preventDefault();\n\n\t\tif ( ! content.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( typeof content !== 'string' ) {\n\t\t\tconst [ firstBlock ] = content;\n\n\t\t\tif (\n\t\t\t\t! title &&\n\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t) {\n\t\t\t\tonUpdate( stripHTML( firstBlock.attributes.content ) );\n\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t} else {\n\t\t\t\tonInsertBlockAfter( content );\n\t\t\t}\n\t\t} else {\n\t\t\tconst value = {\n\t\t\t\t...create( { html: title } ),\n\t\t\t\t...selection,\n\t\t\t};\n\t\t\tconst newValue = insert(\n\t\t\t\tvalue,\n\t\t\t\tcreate( { html: stripHTML( content ) } )\n\t\t\t);\n\t\t\tonUpdate( toHTMLString( { value: newValue } ) );\n\t\t\tsetSelection( {\n\t\t\t\tstart: newValue.start,\n\t\t\t\tend: newValue.end,\n\t\t\t} );\n\t\t}\n\t}\n\n\t// The wp-block className is important for editor styles.\n\t// This same block is used in both the visual and the code editor.\n\tconst className = classnames(\n\t\t'wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text',\n\t\t{\n\t\t\t'is-selected': isSelected,\n\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t}\n\t);\n\tconst decodedPlaceholder =\n\t\tdecodeEntities( placeholder ) || __( 'Add title' );\n\tconst { ref: richTextRef } = useRichText( {\n\t\tvalue: title,\n\t\tonChange,\n\t\tplaceholder: decodedPlaceholder,\n\t\tselectionStart: selection.start,\n\t\tselectionEnd: selection.end,\n\t\tonSelectionChange( newStart, newEnd ) {\n\t\t\tsetSelection( ( sel ) => {\n\t\t\t\tconst { start, end } = sel;\n\t\t\t\tif ( start === newStart && end === newEnd ) {\n\t\t\t\t\treturn sel;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tstart: newStart,\n\t\t\t\t\tend: newEnd,\n\t\t\t\t};\n\t\t\t} );\n\t\t},\n\t\t__unstableDisableFormats: true,\n\t\tpreserveWhiteSpace: true,\n\t} );\n\n\t/* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"title\">\n\t\t\t<h1\n\t\t\t\tref={ useMergeRefs( [ richTextRef, ref ] ) }\n\t\t\t\tcontentEditable\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ decodedPlaceholder }\n\t\t\t\trole=\"textbox\"\n\t\t\t\taria-multiline=\"true\"\n\t\t\t\tonFocus={ onSelect }\n\t\t\t\tonBlur={ onUnselect }\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tonKeyPress={ onUnselect }\n\t\t\t\tonPaste={ onPaste }\n\t\t\t/>\n\t\t</PostTypeSupportCheck>\n\t);\n\t/* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( PostTitle );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO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ACR9B,WAAW,EAAEgE,kBAAkB;IAC/BK,cAAc,EAAE3C,SAAS,CAACkC,KAAK;IAC/BU,YAAY,EAAE5C,SAAS,CAACmC,GAAG;IAC3BU,iBAAiBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;MACrC9C,YAAY,CAAI+C,GAAG,IAAM;QACxB,MAAM;UAAEd,KAAK;UAAEC;QAAI,CAAC,GAAGa,GAAG;QAC1B,IAAKd,KAAK,KAAKY,QAAQ,IAAIX,GAAG,KAAKY,MAAM,EAAG;UAC3C,OAAOC,GAAG;QACX;QACA,OAAO;UACNd,KAAK,EAAEY,QAAQ;UACfX,GAAG,EAAEY;QACN,CAAC;MACF,CAAE,CAAC;IACJ,CAAC;IACDE,wBAAwB,EAAE,IAAI;IAC9BC,kBAAkB,EAAE;EACrB,CAAE,CAAC;;EAEH;EACA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAClG,qBAAA,CAAAmG,OAAoB;IAACC,WAAW,EAAC;EAAO,GACxC,IAAAH,MAAA,CAAAC,aAAA;IACC5F,GAAG,EAAG,IAAA+F,qBAAY,EAAE,CAAEd,WAAW,EAAEjF,GAAG,CAAG,CAAG;IAC5CgG,eAAe;IACfpB,SAAS,EAAGA,SAAW;IACvB,cAAaE,kBAAoB;IACjCmB,IAAI,EAAC,SAAS;IACd,kBAAe,MAAM;IACrBC,OAAO,EAAGxD,QAAU;IACpByD,MAAM,EAAGxD,UAAY;IACrBI,SAAS,EAAGA,SAAW;IACvBqD,UAAU,EAAGzD,UAAY;IACzBS,OAAO,EAAGA;EAAS,CACnB,CACoB,CAAC;EAExB;AACD;AAAC,IAAAiD,QAAA,GAEc,IAAAC,mBAAU,EAAEzG,SAAU,CAAC;AAAA0G,OAAA,CAAAV,OAAA,GAAAQ,QAAA"}
@@ -5,8 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _element = require("@wordpress/element");
8
+ var _react = require("react");
9
9
  var _reactNative = require("react-native");
10
+ var _element = require("@wordpress/element");
10
11
  var _richText = require("@wordpress/rich-text");
11
12
  var _htmlEntities = require("@wordpress/html-entities");
12
13
  var _data = require("@wordpress/data");
@@ -120,7 +121,7 @@ class PostTitle extends _element.Component {
120
121
  placeholderColor: globalStyles.text
121
122
  })
122
123
  };
123
- return (0, _element.createElement)(_reactNative.View, {
124
+ return (0, _react.createElement)(_reactNative.View, {
124
125
  testID: "post-title",
125
126
  style: [_style.default.titleContainer, borderStyle, {
126
127
  borderColor
@@ -128,7 +129,7 @@ class PostTitle extends _element.Component {
128
129
  accessible: !this.props.isSelected,
129
130
  accessibilityLabel: this.getTitle(title, postType),
130
131
  accessibilityHint: (0, _i18n.__)('Updates the title.')
131
- }, (0, _element.createElement)(_richText.__experimentalRichText, {
132
+ }, (0, _react.createElement)(_richText.__experimentalRichText, {
132
133
  setRef: this.setRef,
133
134
  accessibilityLabel: this.getTitle(title, postType),
134
135
  tagName: 'p',
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_reactNative","_richText","_htmlEntities","_data","_components","_compose","_i18n","_blocks","_blockEditor","_editor","_style","_interopRequireDefault","PostTitle","Component","constructor","props","setRef","bind","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","value","onChange","plainText","html","title","onInsertBlockAfter","onUpdate","content","pasteHandler","HTML","length","valueToInsert","create","insert","firstBlock","name","attributes","slice","richText","getTitle","postType","__","sprintf","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","decodeEntities","borderColor","titleStyles","text","color","placeholderColor","createElement","View","testID","styles","titleContainer","dimmed","accessible","accessibilityLabel","accessibilityHint","__experimentalRichText","tagName","tagsToEliminate","unstableOnFocus","onBlur","multiline","fontSize","lineHeight","fontWeight","deleteEnter","onSelectionChange","onEnter","onEnterPress","disableEditingMenu","__unstableIsSelected","__unstableOnCreateUndoLevel","_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","exports","default"],"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 {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} 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 } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\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, onChange, plainText, html } ) {\n\t\tconst { title, onInsertBlockAfter, onUpdate } = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( content.length ) {\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else {\n\t\t\t\tconst [ firstBlock ] = content;\n\t\t\t\tif (\n\t\t\t\t\t! title &&\n\t\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t\t) {\n\t\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t\t} else {\n\t\t\t\t\tonInsertBlockAfter( content );\n\t\t\t\t}\n\t\t\t}\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\n\t\t\t\t\tsetRef={ 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\tmultiline={ false }\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={ true }\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={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\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\twithInstan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AAC;IAC1B;EACD,CAAC;AACF,CAAE,CAAC,EACHC,uBAAc,EACdC,4BACD,CAAC,CAAE7G,SAAU,CAAC;AAAA8G,OAAA,CAAAC,OAAA,GAAA9B,QAAA"}
1
+ {"version":3,"names":["_reactNative","require","_element","_richText","_htmlEntities","_data","_components","_compose","_i18n","_blocks","_blockEditor","_editor","_style","_interopRequireDefault","PostTitle","Component","constructor","props","setRef","bind","onPaste","componentDidUpdate","prevProps","isSelected","isAnyBlockSelected","richTextRef","blur","onUnselect","componentDidMount","innerRef","handleFocusOutside","focus","onSelect","value","onChange","plainText","html","title","onInsertBlockAfter","onUpdate","content","pasteHandler","HTML","length","valueToInsert","create","insert","firstBlock","name","attributes","slice","richText","getTitle","postType","__","sprintf","render","placeholder","style","focusedBorderColor","borderStyle","isDimmed","globalStyles","decodedPlaceholder","decodeEntities","borderColor","titleStyles","text","color","placeholderColor","_react","createElement","View","testID","styles","titleContainer","dimmed","accessible","accessibilityLabel","accessibilityHint","__experimentalRichText","tagName","tagsToEliminate","unstableOnFocus","onBlur","multiline","fontSize","lineHeight","fontWeight","deleteEnter","onSelectionChange","onEnter","onEnterPress","disableEditingMenu","__unstableIsSelected","__unstableOnCreateUndoLevel","_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","exports","default"],"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 {\n\t__experimentalRichText as RichText,\n\tcreate,\n\tinsert,\n} 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 } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\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, onChange, plainText, html } ) {\n\t\tconst { title, onInsertBlockAfter, onUpdate } = this.props;\n\n\t\tconst content = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t} );\n\n\t\tif ( content.length ) {\n\t\t\tif ( typeof content === 'string' ) {\n\t\t\t\tconst valueToInsert = create( { html: content } );\n\t\t\t\tonChange( insert( value, valueToInsert ) );\n\t\t\t} else {\n\t\t\t\tconst [ firstBlock ] = content;\n\t\t\t\tif (\n\t\t\t\t\t! title &&\n\t\t\t\t\t( firstBlock.name === 'core/heading' ||\n\t\t\t\t\t\tfirstBlock.name === 'core/paragraph' )\n\t\t\t\t) {\n\t\t\t\t\tonUpdate( firstBlock.attributes.content );\n\t\t\t\t\tonInsertBlockAfter( content.slice( 1 ) );\n\t\t\t\t} else {\n\t\t\t\t\tonInsertBlockAfter( content );\n\t\t\t\t}\n\t\t\t}\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\n\t\t\t\t\tsetRef={ 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\tmultiline={ false }\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={ true }\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={ true }\n\t\t\t\t\t__unstableIsSelected={ this.props.isSelected }\n\t\t\t\t\t__unstableOnCreateUndoLevel={ () => {} }\n\t\t\t\t></RichText>\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;AAKA,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;AAKA,IAAAW,MAAA,GAAAC,sBAAA,CAAAZ,OAAA;AA1BA;AACA;AACA;;AAGA;AAC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AAE,CAAC,EACH,IAAAgD,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;IACNd,YAAYA,CAAA,EAAG;MACdyB,kBAAkB,CAAEE,SAAS,EAAEA,SAAS,EAAE,CAAE,CAAC;IAC9C,CAAC;IACDC,MAAM,EAAER,IAAI;IACZS,MAAM,EAAER,IAAI;IACZjF,QAAQA,CAAA,EAAG;MACVkF,wBAAwB,CAAE,IAAK,CAAC;MAChCE,kBAAkB,CAAC,CAAC;IACrB,CAAC;IACDzF,UAAUA,CAAA,EAAG;MACZuF,wBAAwB,CAAE,KAAM,CAAC;IAClC,CAAC;IACD3E,QAAQA,CAAEF,KAAK,EAAG;MACjB8E,QAAQ,CAAE;QAAE9E;MAAM,CAAE,CAAC;IACtB,CAAC;IACDC,kBAAkBA,CAAEoF,MAAM,EAAG;MAC5BJ,YAAY,CAAEI,MAAM,EAAE,CAAE,CAAC;IAC1B;EACD,CAAC;AACF,CAAE,CAAC,EACHC,uBAAc,EACdC,4BACD,CAAC,CAAE9G,SAAU,CAAC;AAAA+G,OAAA,CAAAC,OAAA,GAAA9B,QAAA"}
@@ -4,10 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = PostTrash;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _i18n = require("@wordpress/i18n");
9
9
  var _components = require("@wordpress/components");
10
10
  var _data = require("@wordpress/data");
11
+ var _element = require("@wordpress/element");
11
12
  var _store = require("../../store");
12
13
  /**
13
14
  * WordPress dependencies
@@ -33,16 +34,25 @@ function PostTrash() {
33
34
  const {
34
35
  trashPost
35
36
  } = (0, _data.useDispatch)(_store.store);
37
+ const [showConfirmDialog, setShowConfirmDialog] = (0, _element.useState)(false);
36
38
  if (isNew || !postId) {
37
39
  return null;
38
40
  }
39
- return (0, _element.createElement)(_components.Button, {
41
+ const handleConfirm = () => {
42
+ setShowConfirmDialog(false);
43
+ trashPost();
44
+ };
45
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.Button, {
40
46
  className: "editor-post-trash",
41
47
  isDestructive: true,
42
48
  variant: "secondary",
43
49
  isBusy: isDeleting,
44
50
  "aria-disabled": isDeleting,
45
- onClick: isDeleting ? undefined : () => trashPost()
46
- }, (0, _i18n.__)('Move to trash'));
51
+ onClick: isDeleting ? undefined : () => setShowConfirmDialog(true)
52
+ }, (0, _i18n.__)('Move to trash')), (0, _react.createElement)(_components.__experimentalConfirmDialog, {
53
+ isOpen: showConfirmDialog,
54
+ onConfirm: handleConfirm,
55
+ onCancel: () => setShowConfirmDialog(false)
56
+ }, (0, _i18n.__)('Are you sure you want to move this post to the trash?')));
47
57
  }
48
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_store","PostTrash","isNew","isDeleting","postId","useSelect","select","store","editorStore","isEditedPostNew","isDeletingPost","getCurrentPostId","trashPost","useDispatch","_element","createElement","Button","className","isDestructive","variant","isBusy","onClick","undefined","__"],"sources":["@wordpress/editor/src/components/post-trash/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostTrash() {\n\tconst { isNew, isDeleting, postId } = useSelect( ( select ) => {\n\t\tconst store = select( editorStore );\n\t\treturn {\n\t\t\tisNew: store.isEditedPostNew(),\n\t\t\tisDeleting: store.isDeletingPost(),\n\t\t\tpostId: store.getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { trashPost } = useDispatch( editorStore );\n\n\tif ( isNew || ! postId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-post-trash\"\n\t\t\tisDestructive\n\t\t\tvariant=\"secondary\"\n\t\t\tisBusy={ isDeleting }\n\t\t\taria-disabled={ isDeleting }\n\t\t\tonClick={ isDeleting ? undefined : () => trashPost() }\n\t\t>\n\t\t\t{ __( 'Move to trash' ) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,SAASA,CAAA,EAAG;EACnC,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9D,MAAMC,KAAK,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACnC,OAAO;MACNN,KAAK,EAAEK,KAAK,CAACE,eAAe,CAAC,CAAC;MAC9BN,UAAU,EAAEI,KAAK,CAACG,cAAc,CAAC,CAAC;MAClCN,MAAM,EAAEG,KAAK,CAACI,gBAAgB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,iBAAW,EAAEL,YAAY,CAAC;EAEhD,IAAKN,KAAK,IAAI,CAAEE,MAAM,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAU,QAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAkB,MAAM;IACNC,SAAS,EAAC,mBAAmB;IAC7BC,aAAa;IACbC,OAAO,EAAC,WAAW;IACnBC,MAAM,EAAGjB,UAAY;IACrB,iBAAgBA,UAAY;IAC5BkB,OAAO,EAAGlB,UAAU,GAAGmB,SAAS,GAAG,MAAMV,SAAS,CAAC;EAAG,GAEpD,IAAAW,QAAE,EAAE,eAAgB,CACf,CAAC;AAEX"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_element","_store","PostTrash","isNew","isDeleting","postId","useSelect","select","store","editorStore","isEditedPostNew","isDeletingPost","getCurrentPostId","trashPost","useDispatch","showConfirmDialog","setShowConfirmDialog","useState","handleConfirm","_react","createElement","Fragment","Button","className","isDestructive","variant","isBusy","onClick","undefined","__","__experimentalConfirmDialog","isOpen","onConfirm","onCancel"],"sources":["@wordpress/editor/src/components/post-trash/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostTrash() {\n\tconst { isNew, isDeleting, postId } = useSelect( ( select ) => {\n\t\tconst store = select( editorStore );\n\t\treturn {\n\t\t\tisNew: store.isEditedPostNew(),\n\t\t\tisDeleting: store.isDeletingPost(),\n\t\t\tpostId: store.getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { trashPost } = useDispatch( editorStore );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tif ( isNew || ! postId ) {\n\t\treturn null;\n\t}\n\n\tconst handleConfirm = () => {\n\t\tsetShowConfirmDialog( false );\n\t\ttrashPost();\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-post-trash\"\n\t\t\t\tisDestructive\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isDeleting }\n\t\t\t\taria-disabled={ isDeleting }\n\t\t\t\tonClick={\n\t\t\t\t\tisDeleting ? undefined : () => setShowConfirmDialog( true )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Move to trash' ) }\n\t\t\t</Button>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ handleConfirm }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Are you sure you want to move this post to the trash?'\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGe,SAASK,SAASA,CAAA,EAAG;EACnC,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9D,MAAMC,KAAK,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACnC,OAAO;MACNN,KAAK,EAAEK,KAAK,CAACE,eAAe,CAAC,CAAC;MAC9BN,UAAU,EAAEI,KAAK,CAACG,cAAc,CAAC,CAAC;MAClCN,MAAM,EAAEG,KAAK,CAACI,gBAAgB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,iBAAW,EAAEL,YAAY,CAAC;EAChD,MAAM,CAAEM,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAErE,IAAKd,KAAK,IAAI,CAAEE,MAAM,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,MAAMa,aAAa,GAAGA,CAAA,KAAM;IAC3BF,oBAAoB,CAAE,KAAM,CAAC;IAC7BH,SAAS,CAAC,CAAC;EACZ,CAAC;EAED,OACC,IAAAM,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAAwB,MAAM;IACNC,SAAS,EAAC,mBAAmB;IAC7BC,aAAa;IACbC,OAAO,EAAC,WAAW;IACnBC,MAAM,EAAGtB,UAAY;IACrB,iBAAgBA,UAAY;IAC5BuB,OAAO,EACNvB,UAAU,GAAGwB,SAAS,GAAG,MAAMZ,oBAAoB,CAAE,IAAK;EAC1D,GAEC,IAAAa,QAAE,EAAE,eAAgB,CACf,CAAC,EACT,IAAAV,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAAgC,2BAAa;IACbC,MAAM,EAAGhB,iBAAmB;IAC5BiB,SAAS,EAAGd,aAAe;IAC3Be,QAAQ,EAAGA,CAAA,KAAMjB,oBAAoB,CAAE,KAAM;EAAG,GAE9C,IAAAa,QAAE,EACH,uDACD,CACc,CACd,CAAC;AAEL"}
@@ -20,12 +20,12 @@ var _store = require("../../store");
20
20
  * type supports one of the given `supportKeys` prop.
21
21
  *
22
22
  * @param {Object} props Props.
23
- * @param {WPElement} props.children Children to be rendered if post
23
+ * @param {Element} props.children Children to be rendered if post
24
24
  * type supports.
25
25
  * @param {(string|string[])} props.supportKeys String or string array of keys
26
26
  * to test.
27
27
  *
28
- * @return {WPComponent} The component to be rendered.
28
+ * @return {Component} The component to be rendered.
29
29
  */
30
30
  function PostTypeSupportCheck({
31
31
  children,
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_store","PostTypeSupportCheck","children","supportKeys","postType","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","isSupported","Array","isArray","some","key","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {WPElement} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {WPComponent} The component to be rendered.\n */\nfunction PostTypeSupportCheck( { children, supportKeys } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn getPostType( getEditedPostAttribute( 'type' ) );\n\t}, [] );\n\tlet isSupported = true;\n\tif ( postType ) {\n\t\tisSupported = (\n\t\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t\t).some( ( key ) => !! postType.supports[ key ] );\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostTypeSupportCheck;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,eAAU,CAAC;IAC3C,OAAOD,WAAW,CAAEF,sBAAsB,CAAE,MAAO,CAAE,CAAC;EACvD,CAAC,EAAE,EAAG,CAAC;EACP,IAAII,WAAW,GAAG,IAAI;EACtB,IAAKP,QAAQ,EAAG;IACfO,WAAW,GAAG,CACbC,KAAK,CAACC,OAAO,CAAEV,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DW,IAAI,CAAIC,GAAG,IAAM,CAAC,CAAEX,QAAQ,CAACY,QAAQ,CAAED,GAAG,CAAG,CAAC;EACjD;EAEA,IAAK,CAAEJ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOT,QAAQ;AAChB;AAAC,IAAAe,QAAA,GAEchB,oBAAoB;AAAAiB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_data","require","_coreData","_store","PostTypeSupportCheck","children","supportKeys","postType","useSelect","select","getEditedPostAttribute","editorStore","getPostType","coreStore","isSupported","Array","isArray","some","key","supports","_default","exports","default"],"sources":["@wordpress/editor/src/components/post-type-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * A component which renders its own children only if the current editor post\n * type supports one of the given `supportKeys` prop.\n *\n * @param {Object} props Props.\n * @param {Element} props.children Children to be rendered if post\n * type supports.\n * @param {(string|string[])} props.supportKeys String or string array of keys\n * to test.\n *\n * @return {Component} The component to be rendered.\n */\nfunction PostTypeSupportCheck( { children, supportKeys } ) {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn getPostType( getEditedPostAttribute( 'type' ) );\n\t}, [] );\n\tlet isSupported = true;\n\tif ( postType ) {\n\t\tisSupported = (\n\t\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t\t).some( ( key ) => !! postType.supports[ key ] );\n\t}\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default PostTypeSupportCheck;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAuB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IACxD,MAAM;MAAEC;IAAY,CAAC,GAAGH,MAAM,CAAEI,eAAU,CAAC;IAC3C,OAAOD,WAAW,CAAEF,sBAAsB,CAAE,MAAO,CAAE,CAAC;EACvD,CAAC,EAAE,EAAG,CAAC;EACP,IAAII,WAAW,GAAG,IAAI;EACtB,IAAKP,QAAQ,EAAG;IACfO,WAAW,GAAG,CACbC,KAAK,CAACC,OAAO,CAAEV,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DW,IAAI,CAAIC,GAAG,IAAM,CAAC,CAAEX,QAAQ,CAACY,QAAQ,CAAED,GAAG,CAAG,CAAC;EACjD;EAEA,IAAK,CAAEJ,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOT,QAAQ;AAChB;AAAC,IAAAe,QAAA,GAEchB,oBAAoB;AAAAiB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,9 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = PostURL;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _data = require("@wordpress/data");
9
9
  var _url = require("@wordpress/url");
10
+ var _element = require("@wordpress/element");
10
11
  var _blockEditor = require("@wordpress/block-editor");
11
12
  var _i18n = require("@wordpress/i18n");
12
13
  var _components = require("@wordpress/components");
@@ -50,18 +51,18 @@ function PostURL({
50
51
  editPost
51
52
  } = (0, _data.useDispatch)(_store.store);
52
53
  const [forceEmptyField, setForceEmptyField] = (0, _element.useState)(false);
53
- return (0, _element.createElement)("div", {
54
+ return (0, _react.createElement)("div", {
54
55
  className: "editor-post-url"
55
- }, (0, _element.createElement)(_blockEditor.__experimentalInspectorPopoverHeader, {
56
+ }, (0, _react.createElement)(_blockEditor.__experimentalInspectorPopoverHeader, {
56
57
  title: (0, _i18n.__)('URL'),
57
58
  onClose: onClose
58
- }), isEditable && (0, _element.createElement)(_components.TextControl, {
59
+ }), isEditable && (0, _react.createElement)(_components.TextControl, {
59
60
  __nextHasNoMarginBottom: true,
60
61
  label: (0, _i18n.__)('Permalink'),
61
62
  value: forceEmptyField ? '' : postSlug,
62
63
  autoComplete: "off",
63
64
  spellCheck: "false",
64
- help: (0, _element.createElement)(_element.Fragment, null, (0, _i18n.__)('The last part of the URL.'), ' ', (0, _element.createElement)(_components.ExternalLink, {
65
+ help: (0, _react.createElement)(_react.Fragment, null, (0, _i18n.__)('The last part of the URL.'), ' ', (0, _react.createElement)(_components.ExternalLink, {
65
66
  href: (0, _i18n.__)('https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink')
66
67
  }, (0, _i18n.__)('Learn more.'))),
67
68
  onChange: newValue => {
@@ -90,17 +91,17 @@ function PostURL({
90
91
  setForceEmptyField(false);
91
92
  }
92
93
  }
93
- }), isEditable && (0, _element.createElement)("h3", {
94
+ }), isEditable && (0, _react.createElement)("h3", {
94
95
  className: "editor-post-url__link-label"
95
- }, viewPostLabel !== null && viewPostLabel !== void 0 ? viewPostLabel : (0, _i18n.__)('View post')), (0, _element.createElement)("p", null, (0, _element.createElement)(_components.ExternalLink, {
96
+ }, viewPostLabel !== null && viewPostLabel !== void 0 ? viewPostLabel : (0, _i18n.__)('View post')), (0, _react.createElement)("p", null, (0, _react.createElement)(_components.ExternalLink, {
96
97
  className: "editor-post-url__link",
97
98
  href: postLink,
98
99
  target: "_blank"
99
- }, isEditable ? (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("span", {
100
+ }, isEditable ? (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("span", {
100
101
  className: "editor-post-url__link-prefix"
101
- }, permalinkPrefix), (0, _element.createElement)("span", {
102
+ }, permalinkPrefix), (0, _react.createElement)("span", {
102
103
  className: "editor-post-url__link-slug"
103
- }, postSlug), (0, _element.createElement)("span", {
104
+ }, postSlug), (0, _react.createElement)("span", {
104
105
  className: "editor-post-url__link-suffix"
105
106
  }, permalinkSuffix)) : postLink)));
106
107
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_url","_blockEditor","_i18n","_components","_coreData","_store","PostURL","onClose","isEditable","postSlug","viewPostLabel","postLink","permalinkPrefix","permalinkSuffix","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","labels","view_item","link","prefix","suffix","editPost","useDispatch","forceEmptyField","setForceEmptyField","useState","createElement","className","__experimentalInspectorPopoverHeader","title","__","TextControl","__nextHasNoMarginBottom","label","value","autoComplete","spellCheck","help","Fragment","ExternalLink","href","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 } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tviewPostLabel,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\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};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader title={ __( 'URL' ) } onClose={ onClose } />\n\t\t\t{ isEditable && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Permalink' ) }\n\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __( 'The last part of the URL.' ) }{ ' ' }\n\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\thref={ __(\n\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) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Learn more.' ) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEditable && (\n\t\t\t\t<h3 className=\"editor-post-url__link-label\">\n\t\t\t\t\t{ viewPostLabel ?? __( 'View post' ) }\n\t\t\t\t</h3>\n\t\t\t) }\n\t\t\t<p>\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\thref={ postLink }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t>\n\t\t\t\t\t{ isEditable ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t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,IAAI,EAAED;MAAS,CAAE,CAAC;MAC9B;MACA;MACA;MACA;MACA,IAAK,CAAEA,QAAQ,EAAG;QACjB,IAAK,CAAEnB,eAAe,EAAG;UACxBC,kBAAkB,CAAE,IAAK,CAAC;QAC3B;QACA;MACD;MACA,IAAKD,eAAe,EAAG;QACtBC,kBAAkB,CAAE,KAAM,CAAC;MAC5B;IACD,CAAG;IACHoB,MAAM,EAAKC,KAAK,IAAM;MACrBxB,QAAQ,CAAE;QACTsB,IAAI,EAAE,IAAAG,iBAAY,EAAED,KAAK,CAACE,MAAM,CAACb,KAAM;MACxC,CAAE,CAAC;MACH,IAAKX,eAAe,EAAG;QACtBC,kBAAkB,CAAE,KAAM,CAAC;MAC5B;IACD;EAAG,CACH,CACD,EACChC,UAAU,IACX,IAAAX,QAAA,CAAA6C,aAAA;IAAIC,SAAS,EAAC;EAA6B,GACxCjC,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI,IAAAoC,QAAE,EAAE,WAAY,CAChC,CACJ,EACD,IAAAjD,QAAA,CAAA6C,aAAA,aACC,IAAA7C,QAAA,CAAA6C,aAAA,EAACvC,WAAA,CAAAoD,YAAY;IACZZ,SAAS,EAAC,uBAAuB;IACjCa,IAAI,EAAG7C,QAAU;IACjBoD,MAAM,EAAC;EAAQ,GAEbvD,UAAU,GACX,IAAAX,QAAA,CAAA6C,aAAA,EAAA7C,QAAA,CAAAyD,QAAA,QACC,IAAAzD,QAAA,CAAA6C,aAAA;IAAMC,SAAS,EAAC;EAA8B,GAC3C/B,eACG,CAAC,EACP,IAAAf,QAAA,CAAA6C,aAAA;IAAMC,SAAS,EAAC;EAA4B,GACzClC,QACG,CAAC,EACP,IAAAZ,QAAA,CAAA6C,aAAA;IAAMC,SAAS,EAAC;EAA8B,GAC3C9B,eACG,CACL,CAAC,GAEHF,QAEY,CACZ,CACC,CAAC;AAER"}
1
+ {"version":3,"names":["_data","require","_url","_element","_blockEditor","_i18n","_components","_coreData","_store","PostURL","onClose","isEditable","postSlug","viewPostLabel","postLink","permalinkPrefix","permalinkSuffix","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","postTypeSlug","getCurrentPostType","postType","coreStore","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","safeDecodeURIComponent","getEditedPostSlug","labels","view_item","link","prefix","suffix","editPost","useDispatch","forceEmptyField","setForceEmptyField","useState","_react","createElement","className","__experimentalInspectorPopoverHeader","title","__","TextControl","__nextHasNoMarginBottom","label","value","autoComplete","spellCheck","help","Fragment","ExternalLink","href","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 } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tviewPostLabel,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\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};\n\t}, [] );\n\n\tconst { editPost } = useDispatch( editorStore );\n\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader title={ __( 'URL' ) } onClose={ onClose } />\n\t\t\t{ isEditable && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Permalink' ) }\n\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __( 'The last part of the URL.' ) }{ ' ' }\n\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\thref={ __(\n\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) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Learn more.' ) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEditable && (\n\t\t\t\t<h3 className=\"editor-post-url__link-label\">\n\t\t\t\t\t{ viewPostLabel ?? __( 'View post' ) }\n\t\t\t\t</h3>\n\t\t\t) }\n\t\t\t<p>\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\thref={ postLink }\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t>\n\t\t\t\t\t{ isEditable ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tpostLink\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\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,IAA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AE,IAAAG,iBAAY,EAAED,KAAK,CAACE,MAAM,CAACb,KAAM;MACxC,CAAE,CAAC;MACH,IAAKZ,eAAe,EAAG;QACtBC,kBAAkB,CAAE,KAAM,CAAC;MAC5B;IACD;EAAG,CACH,CACD,EACChC,UAAU,IACX,IAAAkC,MAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAA6B,GACxClC,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI,IAAAqC,QAAE,EAAE,WAAY,CAChC,CACJ,EACD,IAAAL,MAAA,CAAAC,aAAA,aACC,IAAAD,MAAA,CAAAC,aAAA,EAACxC,WAAA,CAAAqD,YAAY;IACZZ,SAAS,EAAC,uBAAuB;IACjCa,IAAI,EAAG9C,QAAU;IACjBqD,MAAM,EAAC;EAAQ,GAEbxD,UAAU,GACX,IAAAkC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAa,QAAA,QACC,IAAAb,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAA8B,GAC3ChC,eACG,CAAC,EACP,IAAA8B,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAA4B,GACzCnC,QACG,CAAC,EACP,IAAAiC,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAA8B,GAC3C/B,eACG,CACL,CAAC,GAEHF,QAEY,CACZ,CACC,CAAC;AAER"}
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = PostVisibility;
7
- var _element = require("@wordpress/element");
7
+ var _react = require("react");
8
8
  var _i18n = require("@wordpress/i18n");
9
+ var _element = require("@wordpress/element");
9
10
  var _components = require("@wordpress/components");
10
11
  var _compose = require("@wordpress/compose");
11
12
  var _data = require("@wordpress/data");
@@ -73,50 +74,50 @@ function PostVisibility({
73
74
  password: event.target.value
74
75
  });
75
76
  };
76
- return (0, _element.createElement)("div", {
77
+ return (0, _react.createElement)("div", {
77
78
  className: "editor-post-visibility"
78
- }, (0, _element.createElement)(_blockEditor.__experimentalInspectorPopoverHeader, {
79
+ }, (0, _react.createElement)(_blockEditor.__experimentalInspectorPopoverHeader, {
79
80
  title: (0, _i18n.__)('Visibility'),
80
81
  help: (0, _i18n.__)('Control how this post is viewed.'),
81
82
  onClose: onClose
82
- }), (0, _element.createElement)("fieldset", {
83
+ }), (0, _react.createElement)("fieldset", {
83
84
  className: "editor-post-visibility__fieldset"
84
- }, (0, _element.createElement)(_components.VisuallyHidden, {
85
+ }, (0, _react.createElement)(_components.VisuallyHidden, {
85
86
  as: "legend"
86
- }, (0, _i18n.__)('Visibility')), (0, _element.createElement)(PostVisibilityChoice, {
87
+ }, (0, _i18n.__)('Visibility')), (0, _react.createElement)(PostVisibilityChoice, {
87
88
  instanceId: instanceId,
88
89
  value: "public",
89
90
  label: _utils.visibilityOptions.public.label,
90
91
  info: _utils.visibilityOptions.public.info,
91
92
  checked: visibility === 'public' && !hasPassword,
92
93
  onChange: setPublic
93
- }), (0, _element.createElement)(PostVisibilityChoice, {
94
+ }), (0, _react.createElement)(PostVisibilityChoice, {
94
95
  instanceId: instanceId,
95
96
  value: "private",
96
97
  label: _utils.visibilityOptions.private.label,
97
98
  info: _utils.visibilityOptions.private.info,
98
99
  checked: visibility === 'private',
99
100
  onChange: setPrivate
100
- }), (0, _element.createElement)(PostVisibilityChoice, {
101
+ }), (0, _react.createElement)(PostVisibilityChoice, {
101
102
  instanceId: instanceId,
102
103
  value: "password",
103
104
  label: _utils.visibilityOptions.password.label,
104
105
  info: _utils.visibilityOptions.password.info,
105
106
  checked: hasPassword,
106
107
  onChange: setPasswordProtected
107
- }), hasPassword && (0, _element.createElement)("div", {
108
+ }), hasPassword && (0, _react.createElement)("div", {
108
109
  className: "editor-post-visibility__password"
109
- }, (0, _element.createElement)(_components.VisuallyHidden, {
110
+ }, (0, _react.createElement)(_components.VisuallyHidden, {
110
111
  as: "label",
111
112
  htmlFor: `editor-post-visibility__password-input-${instanceId}`
112
- }, (0, _i18n.__)('Create password')), (0, _element.createElement)("input", {
113
+ }, (0, _i18n.__)('Create password')), (0, _react.createElement)("input", {
113
114
  className: "editor-post-visibility__password-input",
114
115
  id: `editor-post-visibility__password-input-${instanceId}`,
115
116
  type: "text",
116
117
  onChange: updatePassword,
117
118
  value: password,
118
119
  placeholder: (0, _i18n.__)('Use a secure password')
119
- }))), (0, _element.createElement)(_components.__experimentalConfirmDialog, {
120
+ }))), (0, _react.createElement)(_components.__experimentalConfirmDialog, {
120
121
  isOpen: showPrivateConfirmDialog,
121
122
  onConfirm: confirmPrivate,
122
123
  onCancel: handleDialogCancel
@@ -129,9 +130,9 @@ function PostVisibilityChoice({
129
130
  info,
130
131
  ...props
131
132
  }) {
132
- return (0, _element.createElement)("div", {
133
+ return (0, _react.createElement)("div", {
133
134
  className: "editor-post-visibility__choice"
134
- }, (0, _element.createElement)("input", {
135
+ }, (0, _react.createElement)("input", {
135
136
  type: "radio",
136
137
  name: `editor-post-visibility__setting-${instanceId}`,
137
138
  value: value,
@@ -139,10 +140,10 @@ function PostVisibilityChoice({
139
140
  "aria-describedby": `editor-post-${value}-${instanceId}-description`,
140
141
  className: "editor-post-visibility__radio",
141
142
  ...props
142
- }), (0, _element.createElement)("label", {
143
+ }), (0, _react.createElement)("label", {
143
144
  htmlFor: `editor-post-${value}-${instanceId}`,
144
145
  className: "editor-post-visibility__label"
145
- }, label), (0, _element.createElement)("p", {
146
+ }, label), (0, _react.createElement)("p", {
146
147
  id: `editor-post-${value}-${instanceId}-description`,
147
148
  className: "editor-post-visibility__info"
148
149
  }, info));