@wordpress/editor 13.32.0 → 13.33.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 (589) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +225 -2
  3. package/build/bindings/index.js.map +1 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/bindings/post-meta.js +12 -30
  6. package/build/bindings/post-meta.js.map +1 -1
  7. package/build/components/autocompleters/index.js.map +1 -1
  8. package/build/components/autocompleters/user.js.map +1 -1
  9. package/build/components/autosave-monitor/index.js +10 -0
  10. package/build/components/autosave-monitor/index.js.map +1 -1
  11. package/build/components/block-manager/category.js.map +1 -1
  12. package/build/components/block-manager/checklist.js.map +1 -1
  13. package/build/components/block-manager/index.js.map +1 -1
  14. package/build/components/block-removal-warnings/index.js.map +1 -1
  15. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  16. package/build/components/character-count/index.js.map +1 -1
  17. package/build/components/commands/index.js +19 -0
  18. package/build/components/commands/index.js.map +1 -1
  19. package/build/components/commands/index.native.js.map +1 -1
  20. package/build/components/deprecated.js.map +1 -1
  21. package/build/components/deprecated.native.js.map +1 -1
  22. package/build/components/document-bar/index.js.map +1 -1
  23. package/build/components/document-outline/check.js.map +1 -1
  24. package/build/components/document-outline/index.js.map +1 -1
  25. package/build/components/document-outline/item.js.map +1 -1
  26. package/build/components/document-tools/index.js +1 -1
  27. package/build/components/document-tools/index.js.map +1 -1
  28. package/build/components/editor-canvas/edit-template-blocks-notification.js +13 -2
  29. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  30. package/build/components/editor-canvas/index.js +2 -2
  31. package/build/components/editor-canvas/index.js.map +1 -1
  32. package/build/components/editor-help/add-blocks.native.js.map +1 -1
  33. package/build/components/editor-help/customize-blocks.native.js.map +1 -1
  34. package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  35. package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
  36. package/build/components/editor-help/help-section-title.native.js.map +1 -1
  37. package/build/components/editor-help/help-topic-row.native.js.map +1 -1
  38. package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
  39. package/build/components/editor-help/index.native.js.map +1 -1
  40. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  41. package/build/components/editor-help/move-blocks.native.js.map +1 -1
  42. package/build/components/editor-help/remove-blocks.native.js.map +1 -1
  43. package/build/components/editor-help/view-sections.native.js.map +1 -1
  44. package/build/components/editor-history/redo.js.map +1 -1
  45. package/build/components/editor-history/undo.js.map +1 -1
  46. package/build/components/editor-notices/index.js.map +1 -1
  47. package/build/components/editor-snackbars/index.js.map +1 -1
  48. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  49. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  50. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  51. package/build/components/entities-saved-states/index.js.map +1 -1
  52. package/build/components/error-boundary/index.js.map +1 -1
  53. package/build/components/error-boundary/index.native.js.map +1 -1
  54. package/build/components/global-keyboard-shortcuts/index.js +24 -0
  55. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  56. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
  57. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  58. package/build/components/index.js +33 -1
  59. package/build/components/index.js.map +1 -1
  60. package/build/components/index.native.js.map +1 -1
  61. package/build/components/inserter-sidebar/index.js.map +1 -1
  62. package/build/components/keyboard-shortcut-help-modal/config.js +78 -0
  63. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  64. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +49 -0
  65. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  66. package/build/components/keyboard-shortcut-help-modal/index.js +126 -0
  67. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  68. package/build/components/keyboard-shortcut-help-modal/shortcut.js +55 -0
  69. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  70. package/build/components/list-view-sidebar/index.js.map +1 -1
  71. package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
  72. package/build/components/local-autosave-monitor/index.js.map +1 -1
  73. package/build/components/media-categories/index.js.map +1 -1
  74. package/build/components/mode-switcher/index.js.map +1 -1
  75. package/build/components/offline-status/index.native.js.map +1 -1
  76. package/build/components/page-attributes/check.js.map +1 -1
  77. package/build/components/page-attributes/order.js.map +1 -1
  78. package/build/components/page-attributes/panel.js.map +1 -1
  79. package/build/components/page-attributes/parent.js.map +1 -1
  80. package/build/components/pattern-overrides-panel/index.js.map +1 -1
  81. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  82. package/build/components/plugin-more-menu-item/index.js +78 -0
  83. package/build/components/plugin-more-menu-item/index.js.map +1 -0
  84. package/build/components/plugin-post-publish-panel/index.js.map +1 -1
  85. package/build/components/plugin-post-status-info/index.js +73 -0
  86. package/build/components/plugin-post-status-info/index.js.map +1 -0
  87. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  88. package/build/components/plugin-sidebar/index.js +108 -0
  89. package/build/components/plugin-sidebar/index.js.map +1 -0
  90. package/build/components/plugin-sidebar-more-menu-item/index.js +71 -0
  91. package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
  92. package/build/components/post-actions/actions.js +218 -17
  93. package/build/components/post-actions/actions.js.map +1 -1
  94. package/build/components/post-actions/index.js +137 -0
  95. package/build/components/post-actions/index.js.map +1 -0
  96. package/build/components/post-author/check.js.map +1 -1
  97. package/build/components/post-author/combobox.js.map +1 -1
  98. package/build/components/post-author/constants.js.map +1 -1
  99. package/build/components/post-author/hook.js.map +1 -1
  100. package/build/components/post-author/index.js.map +1 -1
  101. package/build/components/post-author/panel.js.map +1 -1
  102. package/build/components/post-author/select.js.map +1 -1
  103. package/build/components/post-card-panel/index.js +40 -6
  104. package/build/components/post-card-panel/index.js.map +1 -1
  105. package/build/components/post-comments/index.js.map +1 -1
  106. package/build/components/post-discussion/panel.js.map +1 -1
  107. package/build/components/post-excerpt/check.js +8 -0
  108. package/build/components/post-excerpt/check.js.map +1 -1
  109. package/build/components/post-excerpt/index.js.map +1 -1
  110. package/build/components/post-excerpt/panel.js.map +1 -1
  111. package/build/components/post-excerpt/plugin.js.map +1 -1
  112. package/build/components/post-featured-image/check.js.map +1 -1
  113. package/build/components/post-featured-image/index.js.map +1 -1
  114. package/build/components/post-featured-image/panel.js.map +1 -1
  115. package/build/components/post-format/check.js.map +1 -1
  116. package/build/components/post-format/index.js.map +1 -1
  117. package/build/components/post-last-revision/check.js.map +1 -1
  118. package/build/components/post-last-revision/index.js.map +1 -1
  119. package/build/components/post-last-revision/panel.js.map +1 -1
  120. package/build/components/post-locked-modal/index.js.map +1 -1
  121. package/build/components/post-panel-row/index.js.map +1 -1
  122. package/build/components/post-pending-status/check.js.map +1 -1
  123. package/build/components/post-pending-status/index.js.map +1 -1
  124. package/build/components/post-pingbacks/index.js.map +1 -1
  125. package/build/components/post-preview-button/index.js.map +1 -1
  126. package/build/components/post-publish-button/index.js +31 -31
  127. package/build/components/post-publish-button/index.js.map +1 -1
  128. package/build/components/post-publish-button/label.js +51 -43
  129. package/build/components/post-publish-button/label.js.map +1 -1
  130. package/build/components/post-publish-panel/index.js.map +1 -1
  131. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  132. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  133. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  134. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  135. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  136. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  137. package/build/components/post-saved-state/index.js +10 -6
  138. package/build/components/post-saved-state/index.js.map +1 -1
  139. package/build/components/post-schedule/check.js.map +1 -1
  140. package/build/components/post-schedule/index.js.map +1 -1
  141. package/build/components/post-schedule/label.js.map +1 -1
  142. package/build/components/post-schedule/panel.js +8 -0
  143. package/build/components/post-schedule/panel.js.map +1 -1
  144. package/build/components/post-slug/check.js.map +1 -1
  145. package/build/components/post-slug/index.js +43 -68
  146. package/build/components/post-slug/index.js.map +1 -1
  147. package/build/components/post-status/index.js +239 -0
  148. package/build/components/post-status/index.js.map +1 -0
  149. package/build/components/post-sticky/check.js.map +1 -1
  150. package/build/components/post-sticky/index.js.map +1 -1
  151. package/build/components/post-switch-to-draft-button/index.js +6 -1
  152. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  153. package/build/components/post-sync-status/index.js.map +1 -1
  154. package/build/components/post-taxonomies/check.js.map +1 -1
  155. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  156. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  157. package/build/components/post-taxonomies/index.js.map +1 -1
  158. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  159. package/build/components/post-taxonomies/panel.js.map +1 -1
  160. package/build/components/post-template/block-theme.js +6 -2
  161. package/build/components/post-template/block-theme.js.map +1 -1
  162. package/build/components/post-template/classic-theme.js.map +1 -1
  163. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  164. package/build/components/post-template/create-new-template.js.map +1 -1
  165. package/build/components/post-template/hooks.js.map +1 -1
  166. package/build/components/post-template/panel.js.map +1 -1
  167. package/build/components/post-template/reset-default-template.js.map +1 -1
  168. package/build/components/post-template/swap-template-button.js.map +1 -1
  169. package/build/components/post-text-editor/index.js.map +1 -1
  170. package/build/components/post-title/constants.js.map +1 -1
  171. package/build/components/post-title/index.js.map +1 -1
  172. package/build/components/post-title/index.native.js.map +1 -1
  173. package/build/components/post-title/post-title-raw.js.map +1 -1
  174. package/build/components/post-title/use-post-title-focus.js.map +1 -1
  175. package/build/components/post-title/use-post-title.js.map +1 -1
  176. package/build/components/post-trash/check.js +23 -25
  177. package/build/components/post-trash/check.js.map +1 -1
  178. package/build/components/post-trash/index.js +2 -1
  179. package/build/components/post-trash/index.js.map +1 -1
  180. package/build/components/post-type-support-check/index.js.map +1 -1
  181. package/build/components/post-url/check.js.map +1 -1
  182. package/build/components/post-url/index.js +44 -19
  183. package/build/components/post-url/index.js.map +1 -1
  184. package/build/components/post-url/label.js.map +1 -1
  185. package/build/components/post-url/panel.js +14 -7
  186. package/build/components/post-url/panel.js.map +1 -1
  187. package/build/components/post-view-link/index.js.map +1 -1
  188. package/build/components/post-visibility/check.js.map +1 -1
  189. package/build/components/post-visibility/index.js +2 -1
  190. package/build/components/post-visibility/index.js.map +1 -1
  191. package/build/components/post-visibility/label.js.map +1 -1
  192. package/build/components/post-visibility/utils.js.map +1 -1
  193. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  194. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  195. package/build/components/preferences-modal/index.js +19 -17
  196. package/build/components/preferences-modal/index.js.map +1 -1
  197. package/build/components/preview-dropdown/index.js.map +1 -1
  198. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  199. package/build/components/provider/index.js +4 -2
  200. package/build/components/provider/index.js.map +1 -1
  201. package/build/components/provider/index.native.js +6 -1
  202. package/build/components/provider/index.native.js.map +1 -1
  203. package/build/components/provider/navigation-block-editing-mode.js.map +1 -1
  204. package/build/components/provider/use-auto-switch-editor-sidebars.js +52 -0
  205. package/build/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
  206. package/build/components/provider/use-block-editor-settings.js +64 -43
  207. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  208. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  209. package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  210. package/build/components/provider/with-registry-provider.js +1 -0
  211. package/build/components/provider/with-registry-provider.js.map +1 -1
  212. package/build/components/start-page-options/index.js +139 -0
  213. package/build/components/start-page-options/index.js.map +1 -0
  214. package/build/components/table-of-contents/index.js.map +1 -1
  215. package/build/components/table-of-contents/panel.js.map +1 -1
  216. package/build/components/template-areas/index.js.map +1 -1
  217. package/build/components/template-validation-notice/index.js +23 -29
  218. package/build/components/template-validation-notice/index.js.map +1 -1
  219. package/build/components/theme-support-check/index.js +10 -16
  220. package/build/components/theme-support-check/index.js.map +1 -1
  221. package/build/components/time-to-read/index.js.map +1 -1
  222. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  223. package/build/components/word-count/index.js.map +1 -1
  224. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  225. package/build/hooks/default-autocompleters.js.map +1 -1
  226. package/build/hooks/index.js.map +1 -1
  227. package/build/hooks/index.native.js.map +1 -1
  228. package/build/hooks/pattern-overrides.js +22 -10
  229. package/build/hooks/pattern-overrides.js.map +1 -1
  230. package/build/hooks/use-select-nearest-editable-block.js.map +1 -1
  231. package/build/index.js.map +1 -1
  232. package/build/index.native.js.map +1 -1
  233. package/build/lock-unlock.js.map +1 -1
  234. package/build/private-apis.js +20 -1
  235. package/build/private-apis.js.map +1 -1
  236. package/build/store/actions.js.map +1 -1
  237. package/build/store/actions.native.js.map +1 -1
  238. package/build/store/constants.js +8 -1
  239. package/build/store/constants.js.map +1 -1
  240. package/build/store/defaults.js.map +1 -1
  241. package/build/store/index.js +1 -1
  242. package/build/store/index.js.map +1 -1
  243. package/build/store/local-autosave.js.map +1 -1
  244. package/build/store/private-actions.js +177 -4
  245. package/build/store/private-actions.js.map +1 -1
  246. package/build/store/private-selectors.js +1 -7
  247. package/build/store/private-selectors.js.map +1 -1
  248. package/build/store/reducer.js.map +1 -1
  249. package/build/store/reducer.native.js.map +1 -1
  250. package/build/store/selectors.js +5 -10
  251. package/build/store/selectors.js.map +1 -1
  252. package/build/store/selectors.native.js.map +1 -1
  253. package/build/store/utils/get-filtered-template-parts.js.map +1 -1
  254. package/build/store/utils/is-template-revertable.js +28 -0
  255. package/build/store/utils/is-template-revertable.js.map +1 -0
  256. package/build/store/utils/notice-builder.js.map +1 -1
  257. package/build/utils/get-template-part-icon.js.map +1 -1
  258. package/build/utils/index.js.map +1 -1
  259. package/build/utils/index.native.js.map +1 -1
  260. package/build/utils/media-upload/index.js.map +1 -1
  261. package/build/utils/media-upload/index.native.js.map +1 -1
  262. package/build/utils/terms.js.map +1 -1
  263. package/build/utils/url.js.map +1 -1
  264. package/build-module/bindings/index.js.map +1 -1
  265. package/build-module/bindings/pattern-overrides.js.map +1 -1
  266. package/build-module/bindings/post-meta.js +14 -31
  267. package/build-module/bindings/post-meta.js.map +1 -1
  268. package/build-module/components/autocompleters/index.js.map +1 -1
  269. package/build-module/components/autocompleters/user.js.map +1 -1
  270. package/build-module/components/autosave-monitor/index.js +10 -0
  271. package/build-module/components/autosave-monitor/index.js.map +1 -1
  272. package/build-module/components/block-manager/category.js.map +1 -1
  273. package/build-module/components/block-manager/checklist.js.map +1 -1
  274. package/build-module/components/block-manager/index.js.map +1 -1
  275. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  276. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  277. package/build-module/components/character-count/index.js.map +1 -1
  278. package/build-module/components/commands/index.js +20 -1
  279. package/build-module/components/commands/index.js.map +1 -1
  280. package/build-module/components/commands/index.native.js.map +1 -1
  281. package/build-module/components/deprecated.js.map +1 -1
  282. package/build-module/components/deprecated.native.js.map +1 -1
  283. package/build-module/components/document-bar/index.js.map +1 -1
  284. package/build-module/components/document-outline/check.js.map +1 -1
  285. package/build-module/components/document-outline/index.js.map +1 -1
  286. package/build-module/components/document-outline/item.js.map +1 -1
  287. package/build-module/components/document-tools/index.js +1 -1
  288. package/build-module/components/document-tools/index.js.map +1 -1
  289. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +13 -2
  290. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
  291. package/build-module/components/editor-canvas/index.js +2 -2
  292. package/build-module/components/editor-canvas/index.js.map +1 -1
  293. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  294. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  295. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  296. package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
  297. package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
  298. package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
  299. package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
  300. package/build-module/components/editor-help/index.native.js.map +1 -1
  301. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  302. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  303. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  304. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  305. package/build-module/components/editor-history/redo.js.map +1 -1
  306. package/build-module/components/editor-history/undo.js.map +1 -1
  307. package/build-module/components/editor-notices/index.js.map +1 -1
  308. package/build-module/components/editor-snackbars/index.js.map +1 -1
  309. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  310. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  311. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  312. package/build-module/components/entities-saved-states/index.js.map +1 -1
  313. package/build-module/components/error-boundary/index.js.map +1 -1
  314. package/build-module/components/error-boundary/index.native.js.map +1 -1
  315. package/build-module/components/global-keyboard-shortcuts/index.js +24 -0
  316. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  317. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
  318. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  319. package/build-module/components/index.js +4 -0
  320. package/build-module/components/index.js.map +1 -1
  321. package/build-module/components/index.native.js.map +1 -1
  322. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  323. package/build-module/components/keyboard-shortcut-help-modal/config.js +71 -0
  324. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  325. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  326. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  327. package/build-module/components/keyboard-shortcut-help-modal/index.js +118 -0
  328. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  329. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +48 -0
  330. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  331. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  332. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  333. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  334. package/build-module/components/media-categories/index.js.map +1 -1
  335. package/build-module/components/mode-switcher/index.js.map +1 -1
  336. package/build-module/components/offline-status/index.native.js.map +1 -1
  337. package/build-module/components/page-attributes/check.js.map +1 -1
  338. package/build-module/components/page-attributes/order.js.map +1 -1
  339. package/build-module/components/page-attributes/panel.js.map +1 -1
  340. package/build-module/components/page-attributes/parent.js.map +1 -1
  341. package/build-module/components/pattern-overrides-panel/index.js.map +1 -1
  342. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  343. package/build-module/components/plugin-more-menu-item/index.js +73 -0
  344. package/build-module/components/plugin-more-menu-item/index.js.map +1 -0
  345. package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
  346. package/build-module/components/plugin-post-status-info/index.js +66 -0
  347. package/build-module/components/plugin-post-status-info/index.js.map +1 -0
  348. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  349. package/build-module/components/plugin-sidebar/index.js +102 -0
  350. package/build-module/components/plugin-sidebar/index.js.map +1 -0
  351. package/build-module/components/plugin-sidebar-more-menu-item/index.js +65 -0
  352. package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
  353. package/build-module/components/post-actions/actions.js +219 -15
  354. package/build-module/components/post-actions/actions.js.map +1 -1
  355. package/build-module/components/post-actions/index.js +130 -0
  356. package/build-module/components/post-actions/index.js.map +1 -0
  357. package/build-module/components/post-author/check.js.map +1 -1
  358. package/build-module/components/post-author/combobox.js.map +1 -1
  359. package/build-module/components/post-author/constants.js.map +1 -1
  360. package/build-module/components/post-author/hook.js.map +1 -1
  361. package/build-module/components/post-author/index.js.map +1 -1
  362. package/build-module/components/post-author/panel.js.map +1 -1
  363. package/build-module/components/post-author/select.js.map +1 -1
  364. package/build-module/components/post-card-panel/index.js +42 -8
  365. package/build-module/components/post-card-panel/index.js.map +1 -1
  366. package/build-module/components/post-comments/index.js.map +1 -1
  367. package/build-module/components/post-discussion/panel.js.map +1 -1
  368. package/build-module/components/post-excerpt/check.js +9 -0
  369. package/build-module/components/post-excerpt/check.js.map +1 -1
  370. package/build-module/components/post-excerpt/index.js.map +1 -1
  371. package/build-module/components/post-excerpt/panel.js.map +1 -1
  372. package/build-module/components/post-excerpt/plugin.js.map +1 -1
  373. package/build-module/components/post-featured-image/check.js.map +1 -1
  374. package/build-module/components/post-featured-image/index.js.map +1 -1
  375. package/build-module/components/post-featured-image/panel.js.map +1 -1
  376. package/build-module/components/post-format/check.js.map +1 -1
  377. package/build-module/components/post-format/index.js.map +1 -1
  378. package/build-module/components/post-last-revision/check.js.map +1 -1
  379. package/build-module/components/post-last-revision/index.js.map +1 -1
  380. package/build-module/components/post-last-revision/panel.js.map +1 -1
  381. package/build-module/components/post-locked-modal/index.js.map +1 -1
  382. package/build-module/components/post-panel-row/index.js.map +1 -1
  383. package/build-module/components/post-pending-status/check.js.map +1 -1
  384. package/build-module/components/post-pending-status/index.js.map +1 -1
  385. package/build-module/components/post-pingbacks/index.js.map +1 -1
  386. package/build-module/components/post-preview-button/index.js.map +1 -1
  387. package/build-module/components/post-publish-button/index.js +31 -31
  388. package/build-module/components/post-publish-button/index.js.map +1 -1
  389. package/build-module/components/post-publish-button/label.js +51 -42
  390. package/build-module/components/post-publish-button/label.js.map +1 -1
  391. package/build-module/components/post-publish-panel/index.js.map +1 -1
  392. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  393. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  394. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  395. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  396. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  397. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  398. package/build-module/components/post-saved-state/index.js +10 -6
  399. package/build-module/components/post-saved-state/index.js.map +1 -1
  400. package/build-module/components/post-schedule/check.js.map +1 -1
  401. package/build-module/components/post-schedule/index.js.map +1 -1
  402. package/build-module/components/post-schedule/label.js.map +1 -1
  403. package/build-module/components/post-schedule/panel.js +8 -0
  404. package/build-module/components/post-schedule/panel.js.map +1 -1
  405. package/build-module/components/post-slug/check.js.map +1 -1
  406. package/build-module/components/post-slug/index.js +44 -68
  407. package/build-module/components/post-slug/index.js.map +1 -1
  408. package/build-module/components/post-status/index.js +231 -0
  409. package/build-module/components/post-status/index.js.map +1 -0
  410. package/build-module/components/post-sticky/check.js.map +1 -1
  411. package/build-module/components/post-sticky/index.js.map +1 -1
  412. package/build-module/components/post-switch-to-draft-button/index.js +7 -1
  413. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  414. package/build-module/components/post-sync-status/index.js.map +1 -1
  415. package/build-module/components/post-taxonomies/check.js.map +1 -1
  416. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  417. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  418. package/build-module/components/post-taxonomies/index.js.map +1 -1
  419. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  420. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  421. package/build-module/components/post-template/block-theme.js +7 -3
  422. package/build-module/components/post-template/block-theme.js.map +1 -1
  423. package/build-module/components/post-template/classic-theme.js.map +1 -1
  424. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  425. package/build-module/components/post-template/create-new-template.js.map +1 -1
  426. package/build-module/components/post-template/hooks.js.map +1 -1
  427. package/build-module/components/post-template/panel.js.map +1 -1
  428. package/build-module/components/post-template/reset-default-template.js.map +1 -1
  429. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  430. package/build-module/components/post-text-editor/index.js.map +1 -1
  431. package/build-module/components/post-title/constants.js.map +1 -1
  432. package/build-module/components/post-title/index.js.map +1 -1
  433. package/build-module/components/post-title/index.native.js.map +1 -1
  434. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  435. package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
  436. package/build-module/components/post-title/use-post-title.js.map +1 -1
  437. package/build-module/components/post-trash/check.js +24 -26
  438. package/build-module/components/post-trash/check.js.map +1 -1
  439. package/build-module/components/post-trash/index.js +2 -1
  440. package/build-module/components/post-trash/index.js.map +1 -1
  441. package/build-module/components/post-type-support-check/index.js.map +1 -1
  442. package/build-module/components/post-url/check.js.map +1 -1
  443. package/build-module/components/post-url/index.js +46 -21
  444. package/build-module/components/post-url/index.js.map +1 -1
  445. package/build-module/components/post-url/label.js.map +1 -1
  446. package/build-module/components/post-url/panel.js +14 -7
  447. package/build-module/components/post-url/panel.js.map +1 -1
  448. package/build-module/components/post-view-link/index.js.map +1 -1
  449. package/build-module/components/post-visibility/check.js.map +1 -1
  450. package/build-module/components/post-visibility/index.js +2 -1
  451. package/build-module/components/post-visibility/index.js.map +1 -1
  452. package/build-module/components/post-visibility/label.js.map +1 -1
  453. package/build-module/components/post-visibility/utils.js.map +1 -1
  454. package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
  455. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
  456. package/build-module/components/preferences-modal/index.js +19 -17
  457. package/build-module/components/preferences-modal/index.js.map +1 -1
  458. package/build-module/components/preview-dropdown/index.js.map +1 -1
  459. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  460. package/build-module/components/provider/index.js +5 -3
  461. package/build-module/components/provider/index.js.map +1 -1
  462. package/build-module/components/provider/index.native.js.map +1 -1
  463. package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -1
  464. package/build-module/components/provider/use-auto-switch-editor-sidebars.js +46 -0
  465. package/build-module/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
  466. package/build-module/components/provider/use-block-editor-settings.js +66 -45
  467. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  468. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  469. package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  470. package/build-module/components/provider/with-registry-provider.js +1 -0
  471. package/build-module/components/provider/with-registry-provider.js.map +1 -1
  472. package/build-module/components/start-page-options/index.js +132 -0
  473. package/build-module/components/start-page-options/index.js.map +1 -0
  474. package/build-module/components/table-of-contents/index.js.map +1 -1
  475. package/build-module/components/table-of-contents/panel.js.map +1 -1
  476. package/build-module/components/template-areas/index.js.map +1 -1
  477. package/build-module/components/template-validation-notice/index.js +25 -31
  478. package/build-module/components/template-validation-notice/index.js.map +1 -1
  479. package/build-module/components/theme-support-check/index.js +11 -16
  480. package/build-module/components/theme-support-check/index.js.map +1 -1
  481. package/build-module/components/time-to-read/index.js.map +1 -1
  482. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  483. package/build-module/components/word-count/index.js.map +1 -1
  484. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  485. package/build-module/hooks/default-autocompleters.js.map +1 -1
  486. package/build-module/hooks/index.js.map +1 -1
  487. package/build-module/hooks/index.native.js.map +1 -1
  488. package/build-module/hooks/pattern-overrides.js +22 -10
  489. package/build-module/hooks/pattern-overrides.js.map +1 -1
  490. package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -1
  491. package/build-module/index.js.map +1 -1
  492. package/build-module/index.native.js.map +1 -1
  493. package/build-module/lock-unlock.js.map +1 -1
  494. package/build-module/private-apis.js +18 -1
  495. package/build-module/private-apis.js.map +1 -1
  496. package/build-module/store/actions.js.map +1 -1
  497. package/build-module/store/actions.native.js.map +1 -1
  498. package/build-module/store/constants.js +7 -0
  499. package/build-module/store/constants.js.map +1 -1
  500. package/build-module/store/defaults.js.map +1 -1
  501. package/build-module/store/index.js.map +1 -1
  502. package/build-module/store/local-autosave.js.map +1 -1
  503. package/build-module/store/private-actions.js +174 -4
  504. package/build-module/store/private-actions.js.map +1 -1
  505. package/build-module/store/private-selectors.js +1 -6
  506. package/build-module/store/private-selectors.js.map +1 -1
  507. package/build-module/store/reducer.js.map +1 -1
  508. package/build-module/store/reducer.native.js.map +1 -1
  509. package/build-module/store/selectors.js +1 -6
  510. package/build-module/store/selectors.js.map +1 -1
  511. package/build-module/store/selectors.native.js.map +1 -1
  512. package/build-module/store/utils/get-filtered-template-parts.js.map +1 -1
  513. package/build-module/store/utils/is-template-revertable.js +22 -0
  514. package/build-module/store/utils/is-template-revertable.js.map +1 -0
  515. package/build-module/store/utils/notice-builder.js.map +1 -1
  516. package/build-module/utils/get-template-part-icon.js.map +1 -1
  517. package/build-module/utils/index.js.map +1 -1
  518. package/build-module/utils/index.native.js.map +1 -1
  519. package/build-module/utils/media-upload/index.js.map +1 -1
  520. package/build-module/utils/media-upload/index.native.js.map +1 -1
  521. package/build-module/utils/terms.js.map +1 -1
  522. package/build-module/utils/url.js.map +1 -1
  523. package/build-style/style-rtl.css +498 -25
  524. package/build-style/style.css +498 -25
  525. package/package.json +35 -35
  526. package/src/bindings/post-meta.js +11 -27
  527. package/src/components/autosave-monitor/index.js +9 -0
  528. package/src/components/commands/index.js +20 -1
  529. package/src/components/document-tools/index.js +16 -14
  530. package/src/components/editor-canvas/edit-template-blocks-notification.js +16 -2
  531. package/src/components/editor-canvas/index.js +4 -4
  532. package/src/components/error-boundary/style.native.scss +1 -1
  533. package/src/components/global-keyboard-shortcuts/index.js +25 -0
  534. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +20 -0
  535. package/src/components/index.js +4 -0
  536. package/src/components/keyboard-shortcut-help-modal/config.js +53 -0
  537. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +43 -0
  538. package/src/components/keyboard-shortcut-help-modal/index.js +160 -0
  539. package/src/components/keyboard-shortcut-help-modal/shortcut.js +67 -0
  540. package/src/components/keyboard-shortcut-help-modal/style.scss +61 -0
  541. package/src/components/plugin-more-menu-item/index.js +73 -0
  542. package/src/components/plugin-post-status-info/index.js +63 -0
  543. package/src/components/plugin-sidebar/index.js +98 -0
  544. package/src/components/plugin-sidebar-more-menu-item/index.js +64 -0
  545. package/src/components/post-actions/actions.js +294 -14
  546. package/src/components/post-actions/index.js +156 -0
  547. package/src/components/post-actions/style.scss +3 -0
  548. package/src/components/post-card-panel/index.js +69 -9
  549. package/src/components/post-excerpt/check.js +8 -0
  550. package/src/components/post-publish-button/index.js +23 -36
  551. package/src/components/post-publish-button/label.js +54 -39
  552. package/src/components/post-publish-button/test/index.js +15 -26
  553. package/src/components/post-publish-button/test/label.js +44 -21
  554. package/src/components/post-saved-state/index.js +13 -6
  555. package/src/components/post-saved-state/test/index.js +4 -0
  556. package/src/components/post-schedule/panel.js +22 -0
  557. package/src/components/post-slug/index.js +50 -68
  558. package/src/components/post-slug/test/index.js +29 -6
  559. package/src/components/post-status/index.js +310 -0
  560. package/src/components/post-status/style.scss +75 -0
  561. package/src/components/post-switch-to-draft-button/index.js +5 -0
  562. package/src/components/post-template/block-theme.js +31 -22
  563. package/src/components/post-trash/check.js +19 -19
  564. package/src/components/post-trash/index.js +1 -0
  565. package/src/components/post-url/index.js +131 -101
  566. package/src/components/post-url/panel.js +20 -7
  567. package/src/components/post-url/style.scss +8 -6
  568. package/src/components/post-visibility/index.js +1 -0
  569. package/src/components/preferences-modal/index.js +26 -22
  570. package/src/components/provider/index.js +17 -8
  571. package/src/components/provider/use-auto-switch-editor-sidebars.js +49 -0
  572. package/src/components/provider/use-block-editor-settings.js +59 -33
  573. package/src/components/provider/with-registry-provider.js +1 -0
  574. package/src/components/start-page-options/index.js +135 -0
  575. package/src/components/start-page-options/style.scss +26 -0
  576. package/src/components/template-validation-notice/index.js +48 -50
  577. package/src/components/theme-support-check/index.js +9 -16
  578. package/src/components/theme-support-check/test/index.js +44 -43
  579. package/src/hooks/pattern-overrides.js +25 -14
  580. package/src/private-apis.js +15 -0
  581. package/src/store/constants.js +7 -0
  582. package/src/store/private-actions.js +269 -4
  583. package/src/store/private-selectors.js +1 -6
  584. package/src/store/selectors.js +1 -6
  585. package/src/store/utils/is-template-revertable.js +23 -0
  586. package/src/style.scss +6 -2
  587. package/src/components/post-publish-button/style.scss +0 -8
  588. package/src/components/provider/test/disable-non-page-content-blocks.js +0 -111
  589. package/src/components/template-validation-notice/style.scss +0 -9
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = StartPageOptions;
7
+ var _react = require("react");
8
+ var _components = require("@wordpress/components");
9
+ var _i18n = require("@wordpress/i18n");
10
+ var _element = require("@wordpress/element");
11
+ var _blockEditor = require("@wordpress/block-editor");
12
+ var _data = require("@wordpress/data");
13
+ var _compose = require("@wordpress/compose");
14
+ var _coreData = require("@wordpress/core-data");
15
+ var _store = require("../../store");
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+
24
+ function useStartPatterns() {
25
+ // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
26
+ // and it has no postTypes declared and the current post type is page or if
27
+ // the current post type is part of the postTypes declared.
28
+ const {
29
+ blockPatternsWithPostContentBlockType,
30
+ postType
31
+ } = (0, _data.useSelect)(select => {
32
+ const {
33
+ getPatternsByBlockTypes,
34
+ getBlocksByName
35
+ } = select(_blockEditor.store);
36
+ const {
37
+ getCurrentPostType,
38
+ getRenderingMode
39
+ } = select(_store.store);
40
+ const rootClientId = getRenderingMode() === 'post-only' ? '' : getBlocksByName('core/post-content')?.[0];
41
+ return {
42
+ blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content', rootClientId),
43
+ postType: getCurrentPostType()
44
+ };
45
+ }, []);
46
+ return (0, _element.useMemo)(() => {
47
+ // filter patterns without postTypes declared if the current postType is page
48
+ // or patterns that declare the current postType in its post type array.
49
+ return blockPatternsWithPostContentBlockType.filter(pattern => {
50
+ return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType);
51
+ });
52
+ }, [postType, blockPatternsWithPostContentBlockType]);
53
+ }
54
+ function PatternSelection({
55
+ blockPatterns,
56
+ onChoosePattern
57
+ }) {
58
+ const shownBlockPatterns = (0, _compose.useAsyncList)(blockPatterns);
59
+ const {
60
+ editEntityRecord
61
+ } = (0, _data.useDispatch)(_coreData.store);
62
+ const {
63
+ postType,
64
+ postId
65
+ } = (0, _data.useSelect)(select => {
66
+ const {
67
+ getCurrentPostType,
68
+ getCurrentPostId
69
+ } = select(_store.store);
70
+ return {
71
+ postType: getCurrentPostType(),
72
+ postId: getCurrentPostId()
73
+ };
74
+ }, []);
75
+ return (0, _react.createElement)(_blockEditor.__experimentalBlockPatternsList, {
76
+ blockPatterns: blockPatterns,
77
+ shownPatterns: shownBlockPatterns,
78
+ onClickPattern: (_pattern, blocks) => {
79
+ editEntityRecord('postType', postType, postId, {
80
+ blocks
81
+ });
82
+ onChoosePattern();
83
+ }
84
+ });
85
+ }
86
+ function StartPageOptionsModal({
87
+ onClose
88
+ }) {
89
+ const startPatterns = useStartPatterns();
90
+ const hasStartPattern = startPatterns.length > 0;
91
+ if (!hasStartPattern) {
92
+ return null;
93
+ }
94
+ return (0, _react.createElement)(_components.Modal, {
95
+ title: (0, _i18n.__)('Choose a pattern'),
96
+ isFullScreen: true,
97
+ onRequestClose: onClose
98
+ }, (0, _react.createElement)("div", {
99
+ className: "editor-start-page-options__modal-content"
100
+ }, (0, _react.createElement)(PatternSelection, {
101
+ blockPatterns: startPatterns,
102
+ onChoosePattern: onClose
103
+ })));
104
+ }
105
+ function StartPageOptions() {
106
+ const [isClosed, setIsClosed] = (0, _element.useState)(false);
107
+ const {
108
+ shouldEnableModal,
109
+ postType,
110
+ postId
111
+ } = (0, _data.useSelect)(select => {
112
+ const {
113
+ isEditedPostDirty,
114
+ isEditedPostEmpty,
115
+ getCurrentPostType,
116
+ getCurrentPostId,
117
+ getEditorSettings
118
+ } = select(_store.store);
119
+ const {
120
+ __unstableIsPreviewMode: isPreviewMode
121
+ } = getEditorSettings();
122
+ return {
123
+ shouldEnableModal: !isPreviewMode && !isEditedPostDirty() && isEditedPostEmpty(),
124
+ postType: getCurrentPostType(),
125
+ postId: getCurrentPostId()
126
+ };
127
+ }, []);
128
+ (0, _element.useEffect)(() => {
129
+ // Should reset the modal state when navigating to a new page/post.
130
+ setIsClosed(false);
131
+ }, [postType, postId]);
132
+ if (!shouldEnableModal || isClosed) {
133
+ return null;
134
+ }
135
+ return (0, _react.createElement)(StartPageOptionsModal, {
136
+ onClose: () => setIsClosed(true)
137
+ });
138
+ }
139
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_coreData","_store","useStartPatterns","blockPatternsWithPostContentBlockType","postType","useSelect","select","getPatternsByBlockTypes","getBlocksByName","blockEditorStore","getCurrentPostType","getRenderingMode","editorStore","rootClientId","useMemo","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","useAsyncList","editEntityRecord","useDispatch","coreStore","postId","getCurrentPostId","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","Modal","title","__","isFullScreen","onRequestClose","className","StartPageOptions","isClosed","setIsClosed","useState","shouldEnableModal","isEditedPostDirty","isEditedPostEmpty","getEditorSettings","__unstableIsPreviewMode","isPreviewMode","useEffect"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, { blocks } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldEnableModal, postType, postId } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditedPostDirty,\n\t\t\tisEditedPostEmpty,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { __unstableIsPreviewMode: isPreviewMode } = getEditorSettings();\n\n\t\treturn {\n\t\t\tshouldEnableModal:\n\t\t\t\t! isPreviewMode && ! isEditedPostDirty() && isEditedPostEmpty(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGA,SAASQ,gBAAgBA,CAAA,EAAG;EAC3B;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAClEC,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAgB,CAAC,GACjDF,MAAM,CAAEG,kBAAiB,CAAC;IAC3B,MAAM;MAAEC,kBAAkB;MAAEC;IAAiB,CAAC,GAC7CL,MAAM,CAAEM,YAAY,CAAC;IACtB,MAAMC,YAAY,GACjBF,gBAAgB,CAAC,CAAC,KAAK,WAAW,GAC/B,EAAE,GACFH,eAAe,CAAE,mBAAoB,CAAC,GAAI,CAAC,CAAE;IACjD,OAAO;MACNL,qCAAqC,EAAEI,uBAAuB,CAC7D,mBAAmB,EACnBM,YACD,CAAC;MACDT,QAAQ,EAAEM,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,OAAO,IAAAI,gBAAO,EAAE,MAAM;IACrB;IACA;IACA,OAAOX,qCAAqC,CAACY,MAAM,CAAIC,OAAO,IAAM;MACnE,OACGZ,QAAQ,KAAK,MAAM,IAAI,CAAEY,OAAO,CAACC,SAAS,IAC1CC,KAAK,CAACC,OAAO,CAAEH,OAAO,CAACC,SAAU,CAAC,IACn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,OAAO,EAAGA,CAAA,KAAMY,WAAW,CAAE,IAAK;EAAG,CAAE,CAAC;AACvE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_icons","_element","_blockEditor","_panel","_interopRequireDefault","TableOfContents","hasOutlineItemsDisabled","repositionDropdown","props","ref","hasBlocks","useSelect","select","blockEditorStore","getBlockCount","_react","createElement","Dropdown","popoverProps","placement","className","contentClassName","renderToggle","isOpen","onToggle","Button","onClick","undefined","icon","info","label","__","tooltipPosition","renderContent","onClose","default","onRequestClose","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( TableOfContents );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASQ,eAAeA,CACvB;EAAEC,uBAAuB;EAAEC,kBAAkB;EAAE,GAAGC;AAAM,CAAC,EACzDC,GAAG,EACF;EACD,MAAMC,SAAS,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,EAC3D,EACD,CAAC;EACD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,QAAQ;IACRC,YAAY,EAAG;MACdC,SAAS,EAAEZ,kBAAkB,GAAG,OAAO,GAAG;IAC3C,CAAG;IACHa,SAAS,EAAC,mBAAmB;IAC7BC,gBAAgB,EAAC,4BAA4B;IAC7CC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpC,IAAAT,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAA2B,MAAM;MAAA,GACDjB,KAAK;MACVC,GAAG,EAAGA,GAAK;MACXiB,OAAO,EAAGhB,SAAS,GAAGc,QAAQ,GAAGG,SAAW;MAC5CC,IAAI,EAAGC,WAAM;MACb,iBAAgBN,MAAQ;MACxB,iBAAc;MACd;MACAO,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;MACzBC,eAAe,EAAC,QAAQ;MACxB,iBAAgB,CAAEtB;IAAW,CAC7B,CACC;IACHuB,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5B,IAAAnB,MAAA,CAAAC,aAAA,EAACb,MAAA,CAAAgC,OAAoB;MACpBC,cAAc,EAAGF,OAAS;MAC1B5B,uBAAuB,EAAGA;IAAyB,CACnD;EACC,CACH,CAAC;AAEJ;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc,IAAAI,mBAAU,EAAElC,eAAgB,CAAC"}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_icons","_element","_blockEditor","_panel","_interopRequireDefault","TableOfContents","hasOutlineItemsDisabled","repositionDropdown","props","ref","hasBlocks","useSelect","select","blockEditorStore","getBlockCount","_react","createElement","Dropdown","popoverProps","placement","className","contentClassName","renderToggle","isOpen","onToggle","Button","onClick","undefined","icon","info","label","__","tooltipPosition","renderContent","onClose","default","onRequestClose","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( TableOfContents );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASQ,eAAeA,CACvB;EAAEC,uBAAuB;EAAEC,kBAAkB;EAAE,GAAGC;AAAM,CAAC,EACzDC,GAAG,EACF;EACD,MAAMC,SAAS,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,EAC3D,EACD,CAAC;EACD,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAmB,QAAQ;IACRC,YAAY,EAAG;MACdC,SAAS,EAAEZ,kBAAkB,GAAG,OAAO,GAAG;IAC3C,CAAG;IACHa,SAAS,EAAC,mBAAmB;IAC7BC,gBAAgB,EAAC,4BAA4B;IAC7CC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpC,IAAAT,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAA2B,MAAM;MAAA,GACDjB,KAAK;MACVC,GAAG,EAAGA,GAAK;MACXiB,OAAO,EAAGhB,SAAS,GAAGc,QAAQ,GAAGG,SAAW;MAC5CC,IAAI,EAAGC,WAAM;MACb,iBAAgBN,MAAQ;MACxB,iBAAc;MACd;MACAO,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;MACzBC,eAAe,EAAC,QAAQ;MACxB,iBAAgB,CAAEtB;IAAW,CAC7B,CACC;IACHuB,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5B,IAAAnB,MAAA,CAAAC,aAAA,EAACb,MAAA,CAAAgC,OAAoB;MACpBC,cAAc,EAAGF,OAAS;MAC1B5B,uBAAuB,EAAGA;IAAyB,CACnD;EACC,CACH,CAAC;AAEJ;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEc,IAAAI,mBAAU,EAAElC,eAAgB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_blockEditor","_wordCount","_interopRequireDefault","_timeToRead","_documentOutline","_characterCount","TableOfContentsPanel","hasOutlineItemsDisabled","onRequestClose","headingCount","paragraphCount","numberOfBlocks","useSelect","select","getGlobalBlockCount","blockEditorStore","_react","createElement","Fragment","className","role","__","tabIndex","default","onSelect","_default","exports"],"sources":["@wordpress/editor/src/components/table-of-contents/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport WordCount from '../word-count';\nimport TimeToRead from '../time-to-read';\nimport DocumentOutline from '../document-outline';\nimport CharacterCount from '../character-count';\n\nfunction TableOfContentsPanel( { hasOutlineItemsDisabled, onRequestClose } ) {\n\tconst { headingCount, paragraphCount, numberOfBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\theadingCount: getGlobalBlockCount( 'core/heading' ),\n\t\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t\t\tnumberOfBlocks: getGlobalBlockCount(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t/*\n\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t */\n\t\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"table-of-contents__wrapper\"\n\t\t\t\trole=\"note\"\n\t\t\t\taria-label={ __( 'Document Statistics' ) }\n\t\t\t\ttabIndex=\"0\"\n\t\t\t>\n\t\t\t\t<ul role=\"list\" className=\"table-of-contents__counts\">\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Words' ) }\n\t\t\t\t\t\t<WordCount />\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Characters' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t<CharacterCount />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Time to read' ) }\n\t\t\t\t\t\t<TimeToRead />\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Headings' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ headingCount }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Paragraphs' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ paragraphCount }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Blocks' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ numberOfBlocks }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t{ headingCount > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t<hr />\n\t\t\t\t\t<h2 className=\"table-of-contents__title\">\n\t\t\t\t\t\t{ __( 'Document Outline' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<DocumentOutline\n\t\t\t\t\t\tonSelect={ onRequestClose }\n\t\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-redundant-roles */\n\t);\n}\n\nexport default TableOfContentsPanel;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,gBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,eAAA,GAAAH,sBAAA,CAAAJ,OAAA;AAbA;AACA;AACA;;AAKA;AACA;AACA;;AAMA,SAASQ,oBAAoBA,CAAE;EAAEC,uB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AAC,aAAA,EAACd,WAAA,CAAAoB,OAAU,MAAE,CACV,CAAC,EACL,IAAAP,MAAA,CAAAC,aAAA;MAAIE,SAAS,EAAC;IAA0B,GACrC,IAAAE,QAAE,EAAE,UAAW,CAAC,EAClB,IAAAL,MAAA,CAAAC,aAAA;MAAME,SAAS,EAAC;IAA2B,GACxCV,YACG,CACH,CAAC,EACL,IAAAO,MAAA,CAAAC,aAAA;MAAIE,SAAS,EAAC;IAA0B,GACrC,IAAAE,QAAE,EAAE,YAAa,CAAC,EACpB,IAAAL,MAAA,CAAAC,aAAA;MAAME,SAAS,EAAC;IAA2B,GACxCT,cACG,CACH,CAAC,EACL,IAAAM,MAAA,CAAAC,aAAA;MAAIE,SAAS,EAAC;IAA0B,GACrC,IAAAE,QAAE,EAAE,QAAS,CAAC,EAChB,IAAAL,MAAA,CAAAC,aAAA;MAAME,SAAS,EAAC;IAA2B,GACxCR,cACG,CACH,CACD,CACA,CAAC,EACJF,YAAY,GAAG,CAAC,IACjB,IAAAO,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,YAAK,CAAC,EACN,IAAAD,MAAA,CAAAC,aAAA;MAAIE,SAAS,EAAC;IAA0B,GACrC,IAAAE,QAAE,EAAE,kBAAmB,CACtB,CAAC,EACL,IAAAL,MAAA,CAAAC,aAAA,EAACb,gBAAA,CAAAmB,OAAe;MACfC,QAAQ,EAAGhB,cAAgB;MAC3BD,uBAAuB,EAAGA;IAAyB,CACnD,CACA,CAEF;IACF;EAAA;AAEF;AAAC,IAAAkB,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAEcjB,oBAAoB"}
1
+ {"version":3,"names":["_i18n","require","_data","_blockEditor","_wordCount","_interopRequireDefault","_timeToRead","_documentOutline","_characterCount","TableOfContentsPanel","hasOutlineItemsDisabled","onRequestClose","headingCount","paragraphCount","numberOfBlocks","useSelect","select","getGlobalBlockCount","blockEditorStore","_react","createElement","Fragment","className","role","__","tabIndex","default","onSelect","_default","exports"],"sources":["@wordpress/editor/src/components/table-of-contents/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport WordCount from '../word-count';\nimport TimeToRead from '../time-to-read';\nimport DocumentOutline from '../document-outline';\nimport CharacterCount from '../character-count';\n\nfunction TableOfContentsPanel( { hasOutlineItemsDisabled, onRequestClose } ) {\n\tconst { headingCount, paragraphCount, numberOfBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getGlobalBlockCount } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\theadingCount: getGlobalBlockCount( 'core/heading' ),\n\t\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t\t\tnumberOfBlocks: getGlobalBlockCount(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\treturn (\n\t\t/*\n\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t */\n\t\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName=\"table-of-contents__wrapper\"\n\t\t\t\trole=\"note\"\n\t\t\t\taria-label={ __( 'Document Statistics' ) }\n\t\t\t\ttabIndex=\"0\"\n\t\t\t>\n\t\t\t\t<ul role=\"list\" className=\"table-of-contents__counts\">\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Words' ) }\n\t\t\t\t\t\t<WordCount />\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Characters' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t<CharacterCount />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Time to read' ) }\n\t\t\t\t\t\t<TimeToRead />\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Headings' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ headingCount }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Paragraphs' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ paragraphCount }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li className=\"table-of-contents__count\">\n\t\t\t\t\t\t{ __( 'Blocks' ) }\n\t\t\t\t\t\t<span className=\"table-of-contents__number\">\n\t\t\t\t\t\t\t{ numberOfBlocks }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t{ headingCount > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t<hr />\n\t\t\t\t\t<h2 className=\"table-of-contents__title\">\n\t\t\t\t\t\t{ __( 'Document Outline' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<DocumentOutline\n\t\t\t\t\t\tonSelect={ onRequestClose }\n\t\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-redundant-roles */\n\t);\n}\n\nexport default TableOfContentsPanel;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,g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["_data","require","_components","_blockEditor","_i18n","_store","_lockUnlock","TemplateAreaItem","area","clientId","selectBlock","toggleBlockHighlight","useDispatch","blockEditorStore","templatePartArea","useSelect","select","defaultAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","highlightBlock","cancelHighlightBlock","_react","createElement","Button","className","icon","onMouseOver","onMouseLeave","onFocus","onBlur","onClick","label","TemplateAreas","templateParts","unlock","getCurrentTemplateTemplateParts","length","__experimentalHeading","level","__","map","templatePart","block","key"],"sources":["@wordpress/editor/src/components/template-areas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\n\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction TemplateAreaItem( { area, clientId } ) {\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas =\n\t\t\t\tselect(\n\t\t\t\t\teditorStore\n\t\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === area\n\t\t\t);\n\t\t},\n\t\t[ area ]\n\t);\n\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-template-areas__item\"\n\t\t\ticon={ templatePartArea?.icon }\n\t\t\tonMouseOver={ highlightBlock }\n\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\tonFocus={ highlightBlock }\n\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t} }\n\t\t>\n\t\t\t{ templatePartArea?.label }\n\t\t</Button>\n\t);\n}\n\nexport default function TemplateAreas() {\n\tconst templateParts = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( editorStore ) ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<section className=\"editor-template-areas\">\n\t\t\t<Heading level={ 3 } className=\"editor-template-areas__title\">\n\t\t\t\t{ __( 'Areas' ) }\n\t\t\t</Heading>\n\n\t\t\t<ul className=\"editor-template-areas__list\">\n\t\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t\t<li key={ block.clientId }>\n\t\t\t\t\t\t<TemplateAreaItem\n\t\t\t\t\t\t\tarea={ templatePart.area }\n\t\t\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</section>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAIA,SAASM,gBAAgBA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAM;IAAEC,WAAW;IAAEC;EAAqB,CAAC,GAC1C,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAChC,MAAMC,gBAAgB,GAAG,IAAAC,eAAS,EAC/BC,MAAM,IAAM;IACb,MAAMC,YAAY,GACjBD,MAAM,CACLE,YACD,CAAC,CAACC,yCAAyC,CAAC,CAAC;IAE9C,OAAOF,YAAY,CAACG,IAAI,CACrBC,WAAW,IAAMA,WAAW,CAACb,IAAI,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AAIqB,GAAG,EAAGD,KAAK,CAACpC;EAAU,GACzB,IAAAe,MAAA,CAAAC,aAAA,EAAClB,gBAAgB;IAChBC,IAAI,EAAGoC,YAAY,CAACpC,IAAM;IAC1BC,QAAQ,EAAGoC,KAAK,CAACpC;EAAU,CAC3B,CACE,CACH,CACC,CACI,CAAC;AAEZ"}
1
+ {"version":3,"names":["_data","require","_components","_blockEditor","_i18n","_store","_lockUnlock","TemplateAreaItem","area","clientId","selectBlock","toggleBlockHighlight","useDispatch","blockEditorStore","templatePartArea","useSelect","select","defaultAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","highlightBlock","cancelHighlightBlock","_react","createElement","Button","className","icon","onMouseOver","onMouseLeave","onFocus","onBlur","onClick","label","TemplateAreas","templateParts","unlock","getCurrentTemplateTemplateParts","length","__experimentalHeading","level","__","map","templatePart","block","key"],"sources":["@wordpress/editor/src/components/template-areas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\n\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction TemplateAreaItem( { area, clientId } ) {\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas =\n\t\t\t\tselect(\n\t\t\t\t\teditorStore\n\t\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === area\n\t\t\t);\n\t\t},\n\t\t[ area ]\n\t);\n\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"editor-template-areas__item\"\n\t\t\ticon={ templatePartArea?.icon }\n\t\t\tonMouseOver={ highlightBlock }\n\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\tonFocus={ highlightBlock }\n\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t} }\n\t\t>\n\t\t\t{ templatePartArea?.label }\n\t\t</Button>\n\t);\n}\n\nexport default function TemplateAreas() {\n\tconst templateParts = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( editorStore ) ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<section className=\"editor-template-areas\">\n\t\t\t<Heading level={ 3 } className=\"editor-template-areas__title\">\n\t\t\t\t{ __( 'Areas' ) }\n\t\t\t</Heading>\n\n\t\t\t<ul className=\"editor-template-areas__list\">\n\t\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t\t<li key={ block.clientId }>\n\t\t\t\t\t\t<TemplateAreaItem\n\t\t\t\t\t\t\tarea={ templatePart.area }\n\t\t\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</section>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAIA,SAASM,gBAAgBA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAM;IAAEC,WAAW;IAAEC;EAAqB,CAAC,GAC1C,IAAAC,iBAAW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,SAAS,EAAC;EAA8B,GAC1D,IAAAe,QAAE,EAAE,OAAQ,CACN,CAAC,EAEV,IAAAlB,MAAA,CAAAC,aAAA;IAAIE,SAAS,EAAC;EAA6B,GACxCS,aAAa,CAACO,GAAG,CAAE,CAAE;IAAEC,YAAY;IAAEC;EAAM,CAAC,KAC7C,IAAArB,MAAA,CAAAC,aAAA;IAAIqB,GAAG,EAAGD,KAAK,CAACpC;EAAU,GACzB,IAAAe,MAAA,CAAAC,aAAA,EAAClB,gBAAgB;IAChBC,IAAI,EAAGoC,YAAY,CAACpC,IAAM;IAC1BC,QAAQ,EAAGoC,KAAK,CAACpC;EAAU,CAC3B,CACE,CACH,CACC,CACI,CAAC;AAEZ","ignoreList":[]}
@@ -3,54 +3,48 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = TemplateValidationNotice;
7
7
  var _react = require("react");
8
8
  var _components = require("@wordpress/components");
9
9
  var _i18n = require("@wordpress/i18n");
10
10
  var _data = require("@wordpress/data");
11
- var _compose = require("@wordpress/compose");
11
+ var _element = require("@wordpress/element");
12
12
  var _blockEditor = require("@wordpress/block-editor");
13
13
  /**
14
14
  * WordPress dependencies
15
15
  */
16
16
 
17
- function TemplateValidationNotice({
18
- isValid,
19
- ...props
20
- }) {
17
+ function TemplateValidationNotice() {
18
+ const [showConfirmDialog, setShowConfirmDialog] = (0, _element.useState)(false);
19
+ const isValid = (0, _data.useSelect)(select => {
20
+ return select(_blockEditor.store).isValidTemplate();
21
+ }, []);
22
+ const {
23
+ setTemplateValidity,
24
+ synchronizeTemplate
25
+ } = (0, _data.useDispatch)(_blockEditor.store);
21
26
  if (isValid) {
22
27
  return null;
23
28
  }
24
- const confirmSynchronization = () => {
25
- if (
26
- // eslint-disable-next-line no-alert
27
- window.confirm((0, _i18n.__)('Resetting the template may result in loss of content, do you want to continue?'))) {
28
- props.synchronizeTemplate();
29
- }
30
- };
31
- return (0, _react.createElement)(_components.Notice, {
29
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.Notice, {
32
30
  className: "editor-template-validation-notice",
33
31
  isDismissible: false,
34
32
  status: "warning",
35
33
  actions: [{
36
34
  label: (0, _i18n.__)('Keep it as is'),
37
- onClick: props.resetTemplateValidity
35
+ onClick: () => setTemplateValidity(true)
38
36
  }, {
39
37
  label: (0, _i18n.__)('Reset the template'),
40
- onClick: confirmSynchronization
38
+ onClick: () => setShowConfirmDialog(true)
41
39
  }]
42
- }, (0, _i18n.__)('The content of your post doesn’t match the template assigned to your post type.'));
40
+ }, (0, _i18n.__)('The content of your post doesn’t match the template assigned to your post type.')), (0, _react.createElement)(_components.__experimentalConfirmDialog, {
41
+ isOpen: showConfirmDialog,
42
+ confirmButtonText: (0, _i18n.__)('Reset'),
43
+ onConfirm: () => {
44
+ setShowConfirmDialog(false);
45
+ synchronizeTemplate();
46
+ },
47
+ onCancel: () => setShowConfirmDialog(false)
48
+ }, (0, _i18n.__)('Resetting the template may result in loss of content, do you want to continue?')));
43
49
  }
44
- var _default = exports.default = (0, _compose.compose)([(0, _data.withSelect)(select => ({
45
- isValid: select(_blockEditor.store).isValidTemplate()
46
- })), (0, _data.withDispatch)(dispatch => {
47
- const {
48
- setTemplateValidity,
49
- synchronizeTemplate
50
- } = dispatch(_blockEditor.store);
51
- return {
52
- resetTemplateValidity: () => setTemplateValidity(true),
53
- synchronizeTemplate
54
- };
55
- })])(TemplateValidationNotice);
56
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_compose","_blockEditor","TemplateValidationNotice","isValid","props","confirmSynchronization","window","confirm","__","synchronizeTemplate","_react","createElement","Notice","className","isDismissible","status","actions","label","onClick","resetTemplateValidity","_default","exports","default","compose","withSelect","select","blockEditorStore","isValidTemplate","withDispatch","dispatch","setTemplateValidity"],"sources":["@wordpress/editor/src/components/template-validation-notice/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Notice } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction TemplateValidationNotice( { isValid, ...props } ) {\n\tif ( isValid ) {\n\t\treturn null;\n\t}\n\n\tconst confirmSynchronization = () => {\n\t\tif (\n\t\t\t// eslint-disable-next-line no-alert\n\t\t\twindow.confirm(\n\t\t\t\t__(\n\t\t\t\t\t'Resetting the template may result in loss of content, do you want to continue?'\n\t\t\t\t)\n\t\t\t)\n\t\t) {\n\t\t\tprops.synchronizeTemplate();\n\t\t}\n\t};\n\n\treturn (\n\t\t<Notice\n\t\t\tclassName=\"editor-template-validation-notice\"\n\t\t\tisDismissible={ false }\n\t\t\tstatus=\"warning\"\n\t\t\tactions={ [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Keep it as is' ),\n\t\t\t\t\tonClick: props.resetTemplateValidity,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Reset the template' ),\n\t\t\t\t\tonClick: confirmSynchronization,\n\t\t\t\t},\n\t\t\t] }\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'The content of your post doesn’t match the template assigned to your post type.'\n\t\t\t) }\n\t\t</Notice>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tisValid: select( blockEditorStore ).isValidTemplate(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { setTemplateValidity, synchronizeTemplate } =\n\t\t\tdispatch( blockEditorStore );\n\t\treturn {\n\t\t\tresetTemplateValidity: () => setTemplateValidity( true ),\n\t\t\tsynchronizeTemplate,\n\t\t};\n\t} ),\n] )( TemplateValidationNotice );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAA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"}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_blockEditor","TemplateValidationNotice","showConfirmDialog","setShowConfirmDialog","useState","isValid","useSelect","select","blockEditorStore","isValidTemplate","setTemplateValidity","synchronizeTemplate","useDispatch","_react","createElement","Fragment","Notice","className","isDismissible","status","actions","label","__","onClick","__experimentalConfirmDialog","isOpen","confirmButtonText","onConfirm","onCancel"],"sources":["@wordpress/editor/src/components/template-validation-notice/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tNotice,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function TemplateValidationNotice() {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\tconst isValid = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).isValidTemplate();\n\t}, [] );\n\tconst { setTemplateValidity, synchronizeTemplate } =\n\t\tuseDispatch( blockEditorStore );\n\n\tif ( isValid ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Notice\n\t\t\t\tclassName=\"editor-template-validation-notice\"\n\t\t\t\tisDismissible={ false }\n\t\t\t\tstatus=\"warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Keep it as is' ),\n\t\t\t\t\t\tonClick: () => setTemplateValidity( true ),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Reset the template' ),\n\t\t\t\t\t\tonClick: () => setShowConfirmDialog( true ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'The content of your post doesn’t match the template assigned to your post type.'\n\t\t\t\t) }\n\t\t\t</Notice>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tconfirmButtonText={ __( 'Reset' ) }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\tsetShowConfirmDialog( false );\n\t\t\t\t\tsynchronizeTemplate();\n\t\t\t\t} }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Resetting the template may result in loss of content, do you want to continue?'\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAUe,SAASK,wBAAwBA,CAAA,EAAG;EAClD,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrE,MAAMC,OAAO,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxC,OAAOA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,eAAe,CAAC,CAAC;EACpD,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC,mBAAmB;IAAEC;EAAoB,CAAC,GACjD,IAAAC,iBAAW,EAAEJ,kBAAiB,CAAC;EAEhC,IAAKH,OAAO,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,OACC,IAAAQ,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAAqB,MAAM;IACNC,SAAS,EAAC,mCAAmC;IAC7CC,aAAa,EAAG,KAAO;IACvBC,MAAM,EAAC,SAAS;IAChBC,OAAO,EAAG,CACT;MACCC,KAAK,EAAE,IAAAC,QAAE,EAAE,eAAgB,CAAC;MAC5BC,OAAO,EAAEA,CAAA,KAAMb,mBAAmB,CAAE,IAAK;IAC1C,CAAC,EACD;MACCW,KAAK,EAAE,IAAAC,QAAE,EAAE,oBAAqB,CAAC;MACjCC,OAAO,EAAEA,CAAA,KAAMpB,oBAAoB,CAAE,IAAK;IAC3C,CAAC;EACC,GAED,IAAAmB,QAAE,EACH,iFACD,CACO,CAAC,EACT,IAAAT,MAAA,CAAAC,aAAA,EAACnB,WAAA,CAAA6B,2BAAa;IACbC,MAAM,EAAGvB,iBAAmB;IAC5BwB,iBAAiB,EAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAG;IACnCK,SAAS,EAAGA,CAAA,KAAM;MACjBxB,oBAAoB,CAAE,KAAM,CAAC;MAC7BQ,mBAAmB,CAAC,CAAC;IACtB,CAAG;IACHiB,QAAQ,EAAGA,CAAA,KAAMzB,oBAAoB,CAAE,KAAM;EAAG,GAE9C,IAAAmB,QAAE,EACH,gFACD,CACc,CACd,CAAC;AAEL","ignoreList":[]}
@@ -3,8 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ThemeSupportCheck = ThemeSupportCheck;
7
- exports.default = void 0;
6
+ exports.default = ThemeSupportCheck;
8
7
  var _data = require("@wordpress/data");
9
8
  var _coreData = require("@wordpress/core-data");
10
9
  var _store = require("../../store");
@@ -17,11 +16,18 @@ var _store = require("../../store");
17
16
  */
18
17
 
19
18
  function ThemeSupportCheck({
20
- themeSupports,
21
19
  children,
22
- postType,
23
20
  supportKeys
24
21
  }) {
22
+ const {
23
+ postType,
24
+ themeSupports
25
+ } = (0, _data.useSelect)(select => {
26
+ return {
27
+ postType: select(_store.store).getEditedPostAttribute('type'),
28
+ themeSupports: select(_coreData.store).getThemeSupports()
29
+ };
30
+ }, []);
25
31
  const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
26
32
  var _themeSupports$key;
27
33
  const supported = (_themeSupports$key = themeSupports?.[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false;
@@ -39,16 +45,4 @@ function ThemeSupportCheck({
39
45
  }
40
46
  return children;
41
47
  }
42
- var _default = exports.default = (0, _data.withSelect)(select => {
43
- const {
44
- getThemeSupports
45
- } = select(_coreData.store);
46
- const {
47
- getEditedPostAttribute
48
- } = select(_store.store);
49
- return {
50
- postType: getEditedPostAttribute('type'),
51
- themeSupports: getThemeSupports()
52
- };
53
- })(ThemeSupportCheck);
54
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_store","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes","_default","exports","default","withSelect","select","getThemeSupports","coreStore","getEditedPostAttribute","editorStore"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } 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 ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASG,iBAAiBA,CAAE;EAClCC,aAAa;EACbC,QAAQ;EACRC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAEH,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DI,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGT,aAAa,GAAIQ,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAET,QAAS,CAAC;IACtC;IACA,OAAOQ,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOH,QAAQ;AAChB;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EACxC,MAAM;IAAEC;EAAiB,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;EAChD,MAAM;IAAEC;EAAuB,CAAC,GAAGH,MAAM,CAAEI,YAAY,CAAC;EACxD,OAAO;IACNlB,QAAQ,EAAEiB,sBAAsB,CAAE,MAAO,CAAC;IAC1CnB,aAAa,EAAEiB,gBAAgB,CAAC;EACjC,CAAC;AACF,CAAE,CAAC,CAAElB,iBAAkB,CAAC"}
1
+ {"version":3,"names":["_data","require","_coreData","_store","ThemeSupportCheck","children","supportKeys","postType","themeSupports","useSelect","select","editorStore","getEditedPostAttribute","coreStore","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-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\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASG,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5D,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,MAAO,CAAC;MAChEJ,aAAa,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,gBAAgB,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAEX,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DY,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGZ,aAAa,GAAIW,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAEf,QAAS,CAAC;IACtC;IACA,OAAOc,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOV,QAAQ;AAChB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_wordcount","_element","_store","AVERAGE_READING_RATE","TimeToRead","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","minutesToRead","Math","round","wordCount","minutesToReadString","createInterpolateElement","__","span","_react","createElement","sprintf","_n","className"],"sources":["@wordpress/editor/src/components/time-to-read/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x, _n, __, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Average reading rate - based on average taken from\n * https://irisreading.com/average-reading-speed-in-various-languages/\n * (Characters/minute used for Chinese rather than words).\n *\n * @type {number} A rough estimate of the average reading rate across multiple languages.\n */\nconst AVERAGE_READING_RATE = 189;\n\nexport default function TimeToRead() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst minutesToRead = Math.round(\n\t\twordCount( content, wordCountType ) / AVERAGE_READING_RATE\n\t);\n\tconst minutesToReadString =\n\t\tminutesToRead === 0\n\t\t\t? createInterpolateElement( __( '<span>< 1</span> minute' ), {\n\t\t\t\t\tspan: <span />,\n\t\t\t } )\n\t\t\t: createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s is the number of minutes the post will take to read. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'<span>%d</span> minute',\n\t\t\t\t\t\t\t'<span>%d</span> minutes',\n\t\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t\t),\n\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t}\n\t\t\t );\n\n\treturn <span className=\"time-to-read\">{ minutesToReadString }</span>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,oBAAoB,GAAG,GAAG;AAEjB,SAASC,UAAUA,CAAA,EAAG;EACpC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAC/B,IAAAC,gBAAS,EAAEV,OAAO,EAAEK,aAAc,CAAC,GAAGP,oBACvC,CAAC;EACD,MAAMa,mBAAmB,GACxBJ,aAAa,KAAK,CAAC,GAChB,IAAAK,iCAAwB,EAAE,IAAAC,QAAE,EAAE,yBAA0B,CAAC,EAAE;IAC3DC,IAAI,EAAE,IAAAC,MAAA,CAAAC,aAAA,cAAO;EACb,CAAE,CAAC,GACH,IAAAJ,iCAAwB,EACxB,IAAAK,aAAO,GACN;EACA,IAAAC,QAAE,EACD,wBAAwB,EACxB,yBAAyB,EACzBX,aACD,CAAC,EACDA,aACD,CAAC,EACD;IACCO,IAAI,EAAE,IAAAC,MAAA,CAAAC,aAAA,cAAO;EACd,CACA,CAAC;EAEL,OAAO,IAAAD,MAAA,CAAAC,aAAA;IAAMG,SAAS,EAAC;EAAc,GAAGR,mBAA2B,CAAC;AACrE"}
1
+ {"version":3,"names":["_data","require","_i18n","_wordcount","_element","_store","AVERAGE_READING_RATE","TimeToRead","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","minutesToRead","Math","round","wordCount","minutesToReadString","createInterpolateElement","__","span","_react","createElement","sprintf","_n","className"],"sources":["@wordpress/editor/src/components/time-to-read/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x, _n, __, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Average reading rate - based on average taken from\n * https://irisreading.com/average-reading-speed-in-various-languages/\n * (Characters/minute used for Chinese rather than words).\n *\n * @type {number} A rough estimate of the average reading rate across multiple languages.\n */\nconst AVERAGE_READING_RATE = 189;\n\nexport default function TimeToRead() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst minutesToRead = Math.round(\n\t\twordCount( content, wordCountType ) / AVERAGE_READING_RATE\n\t);\n\tconst minutesToReadString =\n\t\tminutesToRead === 0\n\t\t\t? createInterpolateElement( __( '<span>< 1</span> minute' ), {\n\t\t\t\t\tspan: <span />,\n\t\t\t } )\n\t\t\t: createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s is the number of minutes the post will take to read. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'<span>%d</span> minute',\n\t\t\t\t\t\t\t'<span>%d</span> minutes',\n\t\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t\t),\n\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t}\n\t\t\t );\n\n\treturn <span className=\"time-to-read\">{ minutesToReadString }</span>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,oBAAoB,GAAG,GAAG;AAEjB,SAASC,UAAUA,CAAA,EAAG;EACpC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAC/B,IAAAC,gBAAS,EAAEV,OAAO,EAAEK,aAAc,CAAC,GAAGP,oBACvC,CAAC;EACD,MAAMa,mBAAmB,GACxBJ,aAAa,KAAK,CAAC,GAChB,IAAAK,iCAAwB,EAAE,IAAAC,QAAE,EAAE,yBAA0B,CAAC,EAAE;IAC3DC,IAAI,EAAE,IAAAC,MAAA,CAAAC,aAAA,cAAO;EACb,CAAE,CAAC,GACH,IAAAJ,iCAAwB,EACxB,IAAAK,aAAO,GACN;EACA,IAAAC,QAAE,EACD,wBAAwB,EACxB,yBAAyB,EACzBX,aACD,CAAC,EACDA,aACD,CAAC,EACD;IACCO,IAAI,EAAE,IAAAC,MAAA,CAAAC,aAAA,cAAO;EACd,CACA,CAAC;EAEL,OAAO,IAAAD,MAAA,CAAAC,aAAA;IAAMG,SAAS,EAAC;EAAc,GAAGR,mBAA2B,CAAC;AACrE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_element","_data","_coreData","UnsavedChangesWarning","__experimentalGetDirtyEntityRecords","useSelect","coreStore","useEffect","warnIfUnsavedChanges","event","dirtyEntityRecords","length","returnValue","__","window","addEventListener","removeEventListener"],"sources":["@wordpress/editor/src/components/unsaved-changes-warning/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n * Compatible with Post Editor and Site Editor.\n *\n * @return {Component} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst { __experimentalGetDirtyEntityRecords } = useSelect( coreStore );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\t// We need to call the selector directly in the listener to avoid race\n\t\t\t// conditions with `BrowserURL` where `componentDidUpdate` gets the\n\t\t\t// new value of `isEditedPostDirty` before this component does,\n\t\t\t// causing this component to incorrectly think a trashed post is still dirty.\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tif ( dirtyEntityRecords.length > 0 ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ __experimentalGetDirtyEntityRecords ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,qBAAqBA,CAAA,EAAG;EAC/C,MAAM;IAAEC;EAAoC,CAAC,GAAG,IAAAC,eAAS,EAAEC,eAAU,CAAC;EAEtE,IAAAC,kBAAS,EAAE,MAAM;IAChB;AACF;AACA;AACA;AACA;AACA;AACA;IACE,MAAMC,oBAAoB,GAAKC,KAAK,IAAM;MACzC;MACA;MACA;MACA;MACA,MAAMC,kBAAkB,GAAGN,mCAAmC,CAAC,CAAC;MAChE,IAAKM,kBAAkB,CAACC,MAAM,GAAG,CAAC,EAAG;QACpCF,KAAK,CAACG,WAAW,GAAG,IAAAC,QAAE,EACrB,8DACD,CAAC;QACD,OAAOJ,KAAK,CAACG,WAAW;MACzB;IACD,CAAC;IAEDE,MAAM,CAACC,gBAAgB,CAAE,cAAc,EAAEP,oBAAqB,CAAC;IAE/D,OAAO,MAAM;MACZM,MAAM,CAACE,mBAAmB,CAAE,cAAc,EAAER,oBAAqB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,CAAEJ,mCAAmC,CAAG,CAAC;EAE5C,OAAO,IAAI;AACZ"}
1
+ {"version":3,"names":["_i18n","require","_element","_data","_coreData","UnsavedChangesWarning","__experimentalGetDirtyEntityRecords","useSelect","coreStore","useEffect","warnIfUnsavedChanges","event","dirtyEntityRecords","length","returnValue","__","window","addEventListener","removeEventListener"],"sources":["@wordpress/editor/src/components/unsaved-changes-warning/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n * Compatible with Post Editor and Site Editor.\n *\n * @return {Component} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst { __experimentalGetDirtyEntityRecords } = useSelect( coreStore );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\t// We need to call the selector directly in the listener to avoid race\n\t\t\t// conditions with `BrowserURL` where `componentDidUpdate` gets the\n\t\t\t// new value of `isEditedPostDirty` before this component does,\n\t\t\t// causing this component to incorrectly think a trashed post is still dirty.\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tif ( dirtyEntityRecords.length > 0 ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ __experimentalGetDirtyEntityRecords ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,qBAAqBA,CAAA,EAAG;EAC/C,MAAM;IAAEC;EAAoC,CAAC,GAAG,IAAAC,eAAS,EAAEC,eAAU,CAAC;EAEtE,IAAAC,kBAAS,EAAE,MAAM;IAChB;AACF;AACA;AACA;AACA;AACA;AACA;IACE,MAAMC,oBAAoB,GAAKC,KAAK,IAAM;MACzC;MACA;MACA;MACA;MACA,MAAMC,kBAAkB,GAAGN,mCAAmC,CAAC,CAAC;MAChE,IAAKM,kBAAkB,CAACC,MAAM,GAAG,CAAC,EAAG;QACpCF,KAAK,CAACG,WAAW,GAAG,IAAAC,QAAE,EACrB,8DACD,CAAC;QACD,OAAOJ,KAAK,CAACG,WAAW;MACzB;IACD,CAAC;IAEDE,MAAM,CAACC,gBAAgB,CAAE,cAAc,EAAEP,oBAAqB,CAAC;IAE/D,OAAO,MAAM;MACZM,MAAM,CAACE,mBAAmB,CAAE,cAAc,EAAER,oBAAqB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,CAAEJ,mCAAmC,CAAG,CAAC;EAE5C,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_wordcount","_store","WordCount","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","_react","createElement","className","wordCount"],"sources":["@wordpress/editor/src/components/word-count/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function WordCount() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\treturn (\n\t\t<span className=\"word-count\">\n\t\t\t{ wordCount( content, wordCountType ) }\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,SAASA,CAAA,EAAG;EACnC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EAEzE,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAAY,GACzB,IAAAC,gBAAS,EAAEV,OAAO,EAAEK,aAAc,CAC/B,CAAC;AAET"}
1
+ {"version":3,"names":["_data","require","_i18n","_wordcount","_store","WordCount","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","_react","createElement","className","wordCount"],"sources":["@wordpress/editor/src/components/word-count/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function WordCount() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\treturn (\n\t\t<span className=\"word-count\">\n\t\t\t{ wordCount( content, wordCountType ) }\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGe,SAASI,SAASA,CAAA,EAAG;EACnC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EAEzE,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAMC,SAAS,EAAC;EAAY,GACzB,IAAAC,gBAAS,EAAEV,OAAO,EAAEK,aAAc,CAC/B,CAAC;AAET","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_element","_compose","_hooks","_store","createWithMetaAttributeSource","metaAttributes","createHigherOrderComponent","BlockEdit","attributes","setAttributes","props","postType","useSelect","select","editorStore","getCurrentPostType","meta","setMeta","useEntityProp","mergedAttributes","useMemo","Object","fromEntries","entries","map","attributeKey","metaKey","_react","createElement","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","_settings$attributes","source","edit","addFilter"],"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":";;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,6BAA6B,GAAKC,cAAc,IACrD,IAAAC,mCAA0B,EACvBC,SAAS,IACV,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC9C,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EACvBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,EACxD,EACD,CAAC;EACD,MAAM,CAAEC,IAAI,EAAEC,OAAO,CAAE,GAAG,IAAAC,uBAAa,EACtC,UAAU,EACVP,QAAQ,EACR,MACD,CAAC;EAED,MAAMQ,gBAAgB,GAAG,IAAAC,gBAAO,EAC/B,OAAQ;IACP,GAAGZ,UA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AM,CAAE,CAAE,GAAI;IAAEO;EAAO,CAAC,CAAE,KAAMA,MAAM,KAAK,MAAO,CAAC,CACnDd,GAAG,CAAE,CAAE,CAAEC,YAAY,EAAE;IAAET;EAAK,CAAC,CAAE,KAAM,CAAES,YAAY,EAAET,IAAI,CAAG,CACjE,CAAC;EACD,IAAKK,MAAM,CAACE,OAAO,CAAElB,cAAe,CAAC,CAAC6B,MAAM,EAAG;IAC9CE,QAAQ,CAACG,IAAI,GAAGnC,6BAA6B,CAAEC,cAAe,CAAC,CAC9D+B,QAAQ,CAACG,IACV,CAAC;EACF;EAEA,OAAOH,QAAQ;AAChB;AAEA,IAAAI,gBAAS,EACR,0BAA0B,EAC1B,0EAA0E,EAC1EL,mBACD,CAAC"}
1
+ {"version":3,"names":["_data","require","_coreData","_element","_compose","_hooks","_store","createWithMetaAttributeSource","metaAttributes","createHigherOrderComponent","BlockEdit","attributes","setAttributes","props","postType","useSelect","select","editorStore","getCurrentPostType","meta","setMeta","useEntityProp","mergedAttributes","useMemo","Object","fromEntries","entries","map","attributeKey","metaKey","_react","createElement","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","_settings$attributes","source","edit","addFilter"],"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":";;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,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YAAY,EAAEQ,KAAK,CAAE,KAAM;MACpC;MACA5B,cAAc,CAAEoB,YAAY,CAAE,EAC9BQ,KAAK,CACJ,CACJ,CAAC;MAED,IAAKZ,MAAM,CAACE,OAAO,CAAEO,QAAS,CAAC,CAACI,MAAM,EAAG;QACxCjB,OAAO,CAAEa,QAAS,CAAC;MACpB;MAEArB,aAAa,CAAEoB,cAAe,CAAC;IAChC,CAAG;IAAA,GACEnB;EAAK,CACV,CAAC;AAEJ,CAAC,EACF,yBACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASyB,mBAAmBA,CAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA;EACxC;EACA,MAAMhC,cAAc,GAAGgB,MAAM,CAACC,WAAW,CACxCD,MAAM,CAACE,OAAO,EAAAc,oBAAA,GAAED,QAAQ,CAAC5B,UAAU,cAAA6B,oBAAA,cAAAA,oBAAA,GAAI,CAAC,CAAE,CAAC,CACzCN,MAAM,CAAE,CAAE,GAAI;IAAEO;EAAO,CAAC,CAAE,KAAMA,MAAM,KAAK,MAAO,CAAC,CACnDd,GAAG,CAAE,CAAE,CAAEC,YAAY,EAAE;IAAET;EAAK,CAAC,CAAE,KAAM,CAAES,YAAY,EAAET,IAAI,CAAG,CACjE,CAAC;EACD,IAAKK,MAAM,CAACE,OAAO,CAAElB,cAAe,CAAC,CAAC6B,MAAM,EAAG;IAC9CE,QAAQ,CAACG,IAAI,GAAGnC,6BAA6B,CAAEC,cAAe,CAAC,CAC9D+B,QAAQ,CAACG,IACV,CAAC;EACF;EAEA,OAAOH,QAAQ;AAChB;AAEA,IAAAI,gBAAS,EACR,0BAA0B,EAC1B,0EAA0E,EAC1EL,mBACD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_components","setDefaultCompleters","completers","push","userAutocompleter","addFilter"],"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( { ...userAutocompleter } );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASE,oBAAoBA,CAAEC,UAAU,GAAG,EAAE,EAAG;EAChD;EACAA,UAAU,CAACC,IAAI,CAAE;IAAE,GAAGC;EAAkB,CAAE,CAAC;EAE3C,OAAOF,UAAU;AAClB;AAEA,IAAAG,gBAAS,EACR,gCAAgC,EAChC,8CAA8C,EAC9CJ,oBACD,CAAC"}
1
+ {"version":3,"names":["_hooks","require","_components","setDefaultCompleters","completers","push","userAutocompleter","addFilter"],"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( { ...userAutocompleter } );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,SAASE,oBAAoBA,CAAEC,UAAU,GAAG,EAAE,EAAG;EAChD;EACAA,UAAU,CAACC,IAAI,CAAE;IAAE,GAAGC;EAAkB,CAAE,CAAC;EAE3C,OAAOF,UAAU;AAClB;AAEA,IAAAG,gBAAS,EACR,gCAAgC,EAChC,8CAA8C,EAC9CJ,oBACD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["require"],"sources":["@wordpress/editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\nimport './pattern-overrides';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA"}
1
+ {"version":3,"names":["require"],"sources":["@wordpress/editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\nimport './pattern-overrides';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/editor/src/hooks/index.native.js"],"sourcesContent":[""],"mappings":""}
1
+ {"version":3,"names":[],"sources":["@wordpress/editor/src/hooks/index.native.js"],"sourcesContent":[""],"mappings":"","ignoreList":[]}
@@ -6,6 +6,7 @@ var _patterns = require("@wordpress/patterns");
6
6
  var _compose = require("@wordpress/compose");
7
7
  var _blockEditor = require("@wordpress/block-editor");
8
8
  var _data = require("@wordpress/data");
9
+ var _blocks = require("@wordpress/blocks");
9
10
  var _store = require("../store");
10
11
  var _lockUnlock = require("../lock-unlock");
11
12
  /**
@@ -17,7 +18,7 @@ var _lockUnlock = require("../lock-unlock");
17
18
  */
18
19
 
19
20
  const {
20
- useSetPatternBindings,
21
+ PatternOverridesControls,
21
22
  ResetOverridesControl,
22
23
  PATTERN_TYPES,
23
24
  PARTIAL_SYNCING_SUPPORTED_BLOCKS
@@ -36,27 +37,38 @@ const withPatternOverrideControls = (0, _compose.createHigherOrderComponent)(Blo
36
37
  const isSupportedBlock = Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes(props.name);
37
38
  return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(BlockEdit, {
38
39
  ...props
39
- }), isSupportedBlock && (0, _react.createElement)(BindingUpdater, {
40
- ...props
41
40
  }), props.isSelected && isSupportedBlock && (0, _react.createElement)(ControlsWithStoreSubscription, {
42
41
  ...props
43
42
  }));
44
43
  });
45
- function BindingUpdater(props) {
46
- const postType = (0, _data.useSelect)(select => select(_store.store).getCurrentPostType(), []);
47
- useSetPatternBindings(props, postType);
48
- return null;
49
- }
50
44
 
51
45
  // Split into a separate component to avoid a store subscription
52
46
  // on every block.
53
47
  function ControlsWithStoreSubscription(props) {
54
48
  const blockEditingMode = (0, _blockEditor.useBlockEditingMode)();
55
- const isEditingPattern = (0, _data.useSelect)(select => select(_store.store).getCurrentPostType() === PATTERN_TYPES.user, []);
49
+ const {
50
+ hasPatternOverridesSource,
51
+ isEditingPattern
52
+ } = (0, _data.useSelect)(select => {
53
+ const {
54
+ getBlockBindingsSource
55
+ } = (0, _lockUnlock.unlock)(select(_blocks.store));
56
+ return {
57
+ // For editing link to the site editor if the theme and user permissions support it.
58
+ hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides'),
59
+ isEditingPattern: select(_store.store).getCurrentPostType() === PATTERN_TYPES.user
60
+ };
61
+ }, []);
56
62
  const bindings = props.attributes.metadata?.bindings;
57
63
  const hasPatternBindings = !!bindings && Object.values(bindings).some(binding => binding.source === 'core/pattern-overrides');
64
+ const shouldShowPatternOverridesControls = isEditingPattern && blockEditingMode === 'default';
58
65
  const shouldShowResetOverridesControl = !isEditingPattern && !!props.attributes.metadata?.name && blockEditingMode !== 'disabled' && hasPatternBindings;
59
- return (0, _react.createElement)(_react.Fragment, null, shouldShowResetOverridesControl && (0, _react.createElement)(ResetOverridesControl, {
66
+ if (!hasPatternOverridesSource) {
67
+ return null;
68
+ }
69
+ return (0, _react.createElement)(_react.Fragment, null, shouldShowPatternOverridesControls && (0, _react.createElement)(PatternOverridesControls, {
70
+ ...props
71
+ }), shouldShowResetOverridesControl && (0, _react.createElement)(ResetOverridesControl, {
60
72
  ...props
61
73
  }));
62
74
  }