@wordpress/editor 14.17.0 → 14.18.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 (322) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/pattern-overrides.js +0 -1
  3. package/build/bindings/pattern-overrides.js.map +1 -1
  4. package/build/bindings/post-meta.js +0 -1
  5. package/build/bindings/post-meta.js.map +1 -1
  6. package/build/components/autocompleters/user.js +0 -1
  7. package/build/components/autocompleters/user.js.map +1 -1
  8. package/build/components/block-removal-warnings/index.js +0 -1
  9. package/build/components/block-removal-warnings/index.js.map +1 -1
  10. package/build/components/block-settings-menu/content-only-settings-menu.js +0 -1
  11. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  12. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -1
  13. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  14. package/build/components/collab-sidebar/comments.js +0 -1
  15. package/build/components/collab-sidebar/comments.js.map +1 -1
  16. package/build/components/collab-sidebar/index.js +0 -1
  17. package/build/components/collab-sidebar/index.js.map +1 -1
  18. package/build/components/collab-sidebar/utils.js +0 -1
  19. package/build/components/collab-sidebar/utils.js.map +1 -1
  20. package/build/components/deprecated.js +0 -1
  21. package/build/components/deprecated.js.map +1 -1
  22. package/build/components/document-outline/index.js +0 -1
  23. package/build/components/document-outline/index.js.map +1 -1
  24. package/build/components/editor/index.js +9 -5
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/editor-help/index.native.js +0 -1
  27. package/build/components/editor-help/index.native.js.map +1 -1
  28. package/build/components/editor-notices/index.js +0 -1
  29. package/build/components/editor-notices/index.js.map +1 -1
  30. package/build/components/editor-snackbars/index.js +0 -1
  31. package/build/components/editor-snackbars/index.js.map +1 -1
  32. package/build/components/entities-saved-states/entity-type-list.js +0 -1
  33. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  34. package/build/components/entities-saved-states/hooks/use-is-dirty.js +0 -1
  35. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  36. package/build/components/entities-saved-states/index.js +0 -1
  37. package/build/components/entities-saved-states/index.js.map +1 -1
  38. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  39. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  40. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -1
  41. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  42. package/build/components/list-view-sidebar/index.js +0 -1
  43. package/build/components/list-view-sidebar/index.js.map +1 -1
  44. package/build/components/local-autosave-monitor/index.js +0 -1
  45. package/build/components/local-autosave-monitor/index.js.map +1 -1
  46. package/build/components/mode-switcher/index.js +0 -1
  47. package/build/components/mode-switcher/index.js.map +1 -1
  48. package/build/components/page-attributes/parent.js +8 -5
  49. package/build/components/page-attributes/parent.js.map +1 -1
  50. package/build/components/post-actions/actions.js +0 -1
  51. package/build/components/post-actions/actions.js.map +1 -1
  52. package/build/components/post-actions/index.js +0 -1
  53. package/build/components/post-actions/index.js.map +1 -1
  54. package/build/components/post-author/check.js +3 -4
  55. package/build/components/post-author/check.js.map +1 -1
  56. package/build/components/post-author/combobox.js +4 -2
  57. package/build/components/post-author/combobox.js.map +1 -1
  58. package/build/components/post-author/hook.js +8 -5
  59. package/build/components/post-author/hook.js.map +1 -1
  60. package/build/components/post-fields/index.js +0 -1
  61. package/build/components/post-fields/index.js.map +1 -1
  62. package/build/components/post-format/index.js +0 -1
  63. package/build/components/post-format/index.js.map +1 -1
  64. package/build/components/post-format/panel.js +0 -1
  65. package/build/components/post-format/panel.js.map +1 -1
  66. package/build/components/post-publish-button/index.js +0 -1
  67. package/build/components/post-publish-button/index.js.map +1 -1
  68. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  69. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  70. package/build/components/post-publish-panel/maybe-post-format-panel.js +0 -1
  71. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  72. package/build/components/post-publish-panel/maybe-tags-panel.js +1 -1
  73. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  74. package/build/components/post-publish-panel/maybe-upload-media.js +0 -1
  75. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  76. package/build/components/post-publish-panel/media-util.js +0 -1
  77. package/build/components/post-publish-panel/media-util.js.map +1 -1
  78. package/build/components/post-saved-state/index.js +0 -1
  79. package/build/components/post-saved-state/index.js.map +1 -1
  80. package/build/components/post-schedule/index.js +0 -1
  81. package/build/components/post-schedule/index.js.map +1 -1
  82. package/build/components/post-taxonomies/check.js +1 -1
  83. package/build/components/post-taxonomies/check.js.map +1 -1
  84. package/build/components/post-taxonomies/flat-term-selector.js +2 -3
  85. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  86. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -3
  87. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  88. package/build/components/post-taxonomies/index.js +1 -2
  89. package/build/components/post-taxonomies/index.js.map +1 -1
  90. package/build/components/post-taxonomies/most-used-terms.js +0 -1
  91. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  92. package/build/components/post-template/classic-theme.js +0 -1
  93. package/build/components/post-template/classic-theme.js.map +1 -1
  94. package/build/components/post-template/swap-template-button.js +0 -1
  95. package/build/components/post-template/swap-template-button.js.map +1 -1
  96. package/build/components/post-transform-panel/hooks.js +0 -1
  97. package/build/components/post-transform-panel/hooks.js.map +1 -1
  98. package/build/components/post-type-support-check/index.js +0 -1
  99. package/build/components/post-type-support-check/index.js.map +1 -1
  100. package/build/components/preferences-modal/block-visibility.js +0 -1
  101. package/build/components/preferences-modal/block-visibility.js.map +1 -1
  102. package/build/components/preferences-modal/index.js +0 -1
  103. package/build/components/preferences-modal/index.js.map +1 -1
  104. package/build/components/provider/disable-non-page-content-blocks.js +0 -1
  105. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  106. package/build/components/provider/index.js +0 -1
  107. package/build/components/provider/index.js.map +1 -1
  108. package/build/components/provider/index.native.js +0 -1
  109. package/build/components/provider/index.native.js.map +1 -1
  110. package/build/components/provider/use-block-editor-settings.js +0 -1
  111. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  112. package/build/components/sidebar/index.js +0 -1
  113. package/build/components/sidebar/index.js.map +1 -1
  114. package/build/components/start-template-options/index.js +0 -1
  115. package/build/components/start-template-options/index.js.map +1 -1
  116. package/build/components/template-part-content-panel/index.js +0 -1
  117. package/build/components/template-part-content-panel/index.js.map +1 -1
  118. package/build/components/theme-support-check/index.js +0 -1
  119. package/build/components/theme-support-check/index.js.map +1 -1
  120. package/build/components/visual-editor/use-select-nearest-editable-block.js +0 -1
  121. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  122. package/build/dataviews/store/private-actions.js +0 -1
  123. package/build/dataviews/store/private-actions.js.map +1 -1
  124. package/build/dataviews/store/reducer.js +0 -1
  125. package/build/dataviews/store/reducer.js.map +1 -1
  126. package/build/hooks/custom-sources-backwards-compatibility.js +0 -1
  127. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  128. package/build/hooks/pattern-overrides.js +0 -1
  129. package/build/hooks/pattern-overrides.js.map +1 -1
  130. package/build/private-apis.js +2 -0
  131. package/build/private-apis.js.map +1 -1
  132. package/build/store/actions.js +0 -1
  133. package/build/store/actions.js.map +1 -1
  134. package/build/store/private-actions.js +0 -1
  135. package/build/store/private-actions.js.map +1 -1
  136. package/build/store/private-selectors.js +0 -1
  137. package/build/store/private-selectors.js.map +1 -1
  138. package/build/store/reducer.js +0 -1
  139. package/build/store/reducer.js.map +1 -1
  140. package/build/store/reducer.native.js +0 -1
  141. package/build/store/reducer.native.js.map +1 -1
  142. package/build/store/selectors.js +0 -1
  143. package/build/store/selectors.js.map +1 -1
  144. package/build/utils/get-template-info.js +0 -1
  145. package/build/utils/get-template-info.js.map +1 -1
  146. package/build/utils/terms.js +0 -1
  147. package/build/utils/terms.js.map +1 -1
  148. package/build-module/bindings/pattern-overrides.js +0 -1
  149. package/build-module/bindings/pattern-overrides.js.map +1 -1
  150. package/build-module/bindings/post-meta.js +0 -1
  151. package/build-module/bindings/post-meta.js.map +1 -1
  152. package/build-module/components/autocompleters/user.js +0 -1
  153. package/build-module/components/autocompleters/user.js.map +1 -1
  154. package/build-module/components/block-removal-warnings/index.js +0 -1
  155. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  156. package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -1
  157. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  158. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -1
  159. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  160. package/build-module/components/collab-sidebar/comments.js +0 -1
  161. package/build-module/components/collab-sidebar/comments.js.map +1 -1
  162. package/build-module/components/collab-sidebar/index.js +0 -1
  163. package/build-module/components/collab-sidebar/index.js.map +1 -1
  164. package/build-module/components/collab-sidebar/utils.js +0 -1
  165. package/build-module/components/collab-sidebar/utils.js.map +1 -1
  166. package/build-module/components/deprecated.js +0 -1
  167. package/build-module/components/deprecated.js.map +1 -1
  168. package/build-module/components/document-outline/index.js +0 -1
  169. package/build-module/components/document-outline/index.js.map +1 -1
  170. package/build-module/components/editor/index.js +9 -5
  171. package/build-module/components/editor/index.js.map +1 -1
  172. package/build-module/components/editor-help/index.native.js +0 -1
  173. package/build-module/components/editor-help/index.native.js.map +1 -1
  174. package/build-module/components/editor-notices/index.js +0 -1
  175. package/build-module/components/editor-notices/index.js.map +1 -1
  176. package/build-module/components/editor-snackbars/index.js +0 -1
  177. package/build-module/components/editor-snackbars/index.js.map +1 -1
  178. package/build-module/components/entities-saved-states/entity-type-list.js +0 -1
  179. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  180. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +0 -1
  181. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  182. package/build-module/components/entities-saved-states/index.js +0 -1
  183. package/build-module/components/entities-saved-states/index.js.map +1 -1
  184. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  185. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  186. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -1
  187. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  188. package/build-module/components/list-view-sidebar/index.js +0 -1
  189. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  190. package/build-module/components/local-autosave-monitor/index.js +0 -1
  191. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  192. package/build-module/components/mode-switcher/index.js +0 -1
  193. package/build-module/components/mode-switcher/index.js.map +1 -1
  194. package/build-module/components/page-attributes/parent.js +8 -5
  195. package/build-module/components/page-attributes/parent.js.map +1 -1
  196. package/build-module/components/post-actions/actions.js +0 -1
  197. package/build-module/components/post-actions/actions.js.map +1 -1
  198. package/build-module/components/post-actions/index.js +0 -1
  199. package/build-module/components/post-actions/index.js.map +1 -1
  200. package/build-module/components/post-author/check.js +3 -4
  201. package/build-module/components/post-author/check.js.map +1 -1
  202. package/build-module/components/post-author/combobox.js +4 -2
  203. package/build-module/components/post-author/combobox.js.map +1 -1
  204. package/build-module/components/post-author/hook.js +8 -5
  205. package/build-module/components/post-author/hook.js.map +1 -1
  206. package/build-module/components/post-fields/index.js +0 -1
  207. package/build-module/components/post-fields/index.js.map +1 -1
  208. package/build-module/components/post-format/index.js +0 -1
  209. package/build-module/components/post-format/index.js.map +1 -1
  210. package/build-module/components/post-format/panel.js +0 -1
  211. package/build-module/components/post-format/panel.js.map +1 -1
  212. package/build-module/components/post-publish-button/index.js +0 -1
  213. package/build-module/components/post-publish-button/index.js.map +1 -1
  214. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  215. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  216. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +0 -1
  217. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  218. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
  219. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  220. package/build-module/components/post-publish-panel/maybe-upload-media.js +0 -1
  221. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  222. package/build-module/components/post-publish-panel/media-util.js +0 -1
  223. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  224. package/build-module/components/post-saved-state/index.js +0 -1
  225. package/build-module/components/post-saved-state/index.js.map +1 -1
  226. package/build-module/components/post-schedule/index.js +0 -1
  227. package/build-module/components/post-schedule/index.js.map +1 -1
  228. package/build-module/components/post-taxonomies/check.js +1 -1
  229. package/build-module/components/post-taxonomies/check.js.map +1 -1
  230. package/build-module/components/post-taxonomies/flat-term-selector.js +2 -3
  231. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  232. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -3
  233. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  234. package/build-module/components/post-taxonomies/index.js +1 -2
  235. package/build-module/components/post-taxonomies/index.js.map +1 -1
  236. package/build-module/components/post-taxonomies/most-used-terms.js +0 -1
  237. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  238. package/build-module/components/post-template/classic-theme.js +0 -1
  239. package/build-module/components/post-template/classic-theme.js.map +1 -1
  240. package/build-module/components/post-template/swap-template-button.js +0 -1
  241. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  242. package/build-module/components/post-transform-panel/hooks.js +0 -1
  243. package/build-module/components/post-transform-panel/hooks.js.map +1 -1
  244. package/build-module/components/post-type-support-check/index.js +0 -1
  245. package/build-module/components/post-type-support-check/index.js.map +1 -1
  246. package/build-module/components/preferences-modal/block-visibility.js +0 -1
  247. package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
  248. package/build-module/components/preferences-modal/index.js +0 -1
  249. package/build-module/components/preferences-modal/index.js.map +1 -1
  250. package/build-module/components/provider/disable-non-page-content-blocks.js +0 -1
  251. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  252. package/build-module/components/provider/index.js +0 -1
  253. package/build-module/components/provider/index.js.map +1 -1
  254. package/build-module/components/provider/index.native.js +0 -1
  255. package/build-module/components/provider/index.native.js.map +1 -1
  256. package/build-module/components/provider/use-block-editor-settings.js +0 -1
  257. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  258. package/build-module/components/sidebar/index.js +0 -1
  259. package/build-module/components/sidebar/index.js.map +1 -1
  260. package/build-module/components/start-template-options/index.js +0 -1
  261. package/build-module/components/start-template-options/index.js.map +1 -1
  262. package/build-module/components/template-part-content-panel/index.js +0 -1
  263. package/build-module/components/template-part-content-panel/index.js.map +1 -1
  264. package/build-module/components/theme-support-check/index.js +0 -1
  265. package/build-module/components/theme-support-check/index.js.map +1 -1
  266. package/build-module/components/visual-editor/use-select-nearest-editable-block.js +0 -1
  267. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  268. package/build-module/dataviews/store/private-actions.js +0 -1
  269. package/build-module/dataviews/store/private-actions.js.map +1 -1
  270. package/build-module/dataviews/store/reducer.js +0 -1
  271. package/build-module/dataviews/store/reducer.js.map +1 -1
  272. package/build-module/hooks/custom-sources-backwards-compatibility.js +0 -1
  273. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  274. package/build-module/hooks/pattern-overrides.js +0 -1
  275. package/build-module/hooks/pattern-overrides.js.map +1 -1
  276. package/build-module/private-apis.js +3 -1
  277. package/build-module/private-apis.js.map +1 -1
  278. package/build-module/store/actions.js +0 -1
  279. package/build-module/store/actions.js.map +1 -1
  280. package/build-module/store/private-actions.js +0 -1
  281. package/build-module/store/private-actions.js.map +1 -1
  282. package/build-module/store/private-selectors.js +0 -1
  283. package/build-module/store/private-selectors.js.map +1 -1
  284. package/build-module/store/reducer.js +0 -1
  285. package/build-module/store/reducer.js.map +1 -1
  286. package/build-module/store/reducer.native.js +0 -1
  287. package/build-module/store/reducer.native.js.map +1 -1
  288. package/build-module/store/selectors.js +0 -1
  289. package/build-module/store/selectors.js.map +1 -1
  290. package/build-module/utils/get-template-info.js +0 -1
  291. package/build-module/utils/get-template-info.js.map +1 -1
  292. package/build-module/utils/terms.js +0 -1
  293. package/build-module/utils/terms.js.map +1 -1
  294. package/build-types/components/editor/index.d.ts.map +1 -1
  295. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  296. package/build-types/components/post-author/check.d.ts.map +1 -1
  297. package/build-types/components/post-author/combobox.d.ts.map +1 -1
  298. package/build-types/components/post-author/hook.d.ts +1 -0
  299. package/build-types/components/post-author/hook.d.ts.map +1 -1
  300. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  301. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
  302. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  303. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  304. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  305. package/build-types/components/post-template/hooks.d.ts +1 -1
  306. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  307. package/build-types/private-apis.d.ts.map +1 -1
  308. package/package.json +37 -37
  309. package/src/components/editor/index.js +24 -13
  310. package/src/components/page-attributes/parent.js +55 -38
  311. package/src/components/post-author/check.js +7 -4
  312. package/src/components/post-author/combobox.js +3 -1
  313. package/src/components/post-author/hook.js +4 -3
  314. package/src/components/post-publish-panel/maybe-category-panel.js +6 -2
  315. package/src/components/post-publish-panel/maybe-tags-panel.js +5 -1
  316. package/src/components/post-taxonomies/check.js +5 -3
  317. package/src/components/post-taxonomies/flat-term-selector.js +2 -2
  318. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  319. package/src/components/post-taxonomies/index.js +5 -1
  320. package/src/components/post-taxonomies/test/index.js +32 -18
  321. package/src/private-apis.js +7 -1
  322. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_keyboardShortcuts","_data","_interface","_config","_shortcut","_dynamicShortcut","_jsxRuntime","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","ShortcutList","shortcuts","jsx","className","role","children","map","shortcut","index","default","name","ShortcutSection","title","jsxs","clsx","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","useSelect","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","interfaceStore","openModal","closeModal","useDispatch","toggleModal","useShortcut","Modal","__","closeButtonLabel","onRequestClose","keyCombination","character","description","ariaLabel","textFormattingShortcuts","_default","exports"],"sources":["@wordpress/editor/src/components/keyboard-shortcut-help-modal/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'editor/keyboard-shortcut-help';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ clsx(\n\t\t\t'editor-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"editor-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nfunction KeyboardShortcutHelpModal() {\n\tconst isModalActive = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).isModalActive(\n\t\t\t\tKEYBOARD_SHORTCUT_HELP_MODAL_NAME\n\t\t\t),\n\t\t[]\n\t);\n\tconst { openModal, closeModal } = useDispatch( interfaceStore );\n\tconst toggleModal = () => {\n\t\tif ( isModalActive ) {\n\t\t\tcloseModal();\n\t\t} else {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t}\n\t};\n\tuseShortcut( 'core/editor/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tcloseButtonLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/editor/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'List View shortcuts' ) }\n\t\t\t\tcategoryName=\"list-view\"\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n\nexport default KeyboardShortcutHelpModal;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,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clsx","_interopRequireDefault","require","_components","_i18n","_keyboardShortcuts","_data","_interface","_config","_shortcut","_dynamicShortcut","_jsxRuntime","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","ShortcutList","shortcuts","jsx","className","role","children","map","shortcut","index","default","name","ShortcutSection","title","jsxs","clsx","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","useSelect","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","interfaceStore","openModal","closeModal","useDispatch","toggleModal","useShortcut","Modal","__","closeButtonLabel","onRequestClose","keyCombination","character","description","ariaLabel","textFormattingShortcuts","_default","exports"],"sources":["@wordpress/editor/src/components/keyboard-shortcut-help-modal/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'editor/keyboard-shortcut-help';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ clsx(\n\t\t\t'editor-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"editor-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nfunction KeyboardShortcutHelpModal() {\n\tconst isModalActive = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).isModalActive(\n\t\t\t\tKEYBOARD_SHORTCUT_HELP_MODAL_NAME\n\t\t\t),\n\t\t[]\n\t);\n\tconst { openModal, closeModal } = useDispatch( interfaceStore );\n\tconst toggleModal = () => {\n\t\tif ( isModalActive ) {\n\t\t\tcloseModal();\n\t\t} else {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t}\n\t};\n\tuseShortcut( 'core/editor/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tcloseButtonLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/editor/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'List View shortcuts' ) }\n\t\t\t\tcategoryName=\"list-view\"\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n\nexport default KeyboardShortcutHelpModal;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAIA,IAAAI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 -1 +1 @@
1
- {"version":3,"names":["_element","require","_keycodes","_jsxRuntime","KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","jsx","className","children","Array","isArray","map","index","Fragment","Shortcut","description","aliases","jsxs","alias","_default","exports","default"],"sources":["@wordpress/editor/src/components/keyboard-shortcut-help-modal/shortcut.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"editor-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"editor-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAA6E,IAAAE,WAAA,GAAAF,OAAA;AAJ7E;AACA;AACA;;AAIA,SAASG,cAAcA,CAAE;EAAEC,cAAc;EAAEC;AAAe,CAAC,EAAG;EAC7D,MAAMC,QAAQ,GAAGF,cAAc,CAACG,QAAQ,GACrCC,6BAAmB,CAAEJ,cAAc,CAACG,QAAQ,CAAE,CAC9CH,cAAc,CAACK,SACf,CAAC,GACDL,cAAc,CAACK,SAAS;EAC3B,MAAMC,SAAS,GAAGN,cAAc,CAACG,QAAQ,GACtCI,2BAAiB,CAAEP,cAAc,CAACG,QAAQ,CAAE,CAC5CH,cAAc,CAACK,SACf,CAAC,GACDL,cAAc,CAACK,SAAS;EAE3B,oBACC,IAAAP,WAAA,CAAAU,GAAA;IACCC,SAAS,EAAC,+DAA+D;IACzE,cAAaR,cAAc,IAAIK,SAAW;IAAAI,QAAA,EAExC,CAAEC,KAAK,CAACC,OAAO,CAAEV,QAAS,CAAC,GAAGA,QAAQ,GAAG,CAAEA,QAAQ,CAAE,EAAGW,GAAG,CAC5D,CAAER,SAAS,EAAES,KAAK,KAAM;MACvB,IAAKT,SAAS,KAAK,GAAG,EAAG;QACxB,oBAAO,IAAAP,WAAA,CAAAU,GAAA,EAACb,QAAA,CAAAoB,QAAQ;UAAAL,QAAA,EAAiBL;QAAS,GAAnBS,KAA+B,CAAC;MACxD;MAEA,oBACC,IAAAhB,WAAA,CAAAU,GAAA;QAECC,SAAS,EAAC,mDAAmD;QAAAC,QAAA,EAE3DL;MAAS,GAHLS,KAIF,CAAC;IAER,CACD;EAAC,CACG,CAAC;AAER;AAEA,SAASE,QAAQA,CAAE;EAAEC,WAAW;EAAEjB,cAAc;EAAEkB,OAAO,GAAG,EAAE;EAAEZ;AAAU,CAAC,EAAG;EAC7E,oBACC,IAAAR,WAAA,CAAAqB,IAAA,EAAArB,WAAA,CAAAiB,QAAA;IAAAL,QAAA,gBACC,IAAAZ,WAAA,CAAAU,GAAA;MAAKC,SAAS,EAAC,2DAA2D;MAAAC,QAAA,EACvEO;IAAW,CACT,CAAC,eACN,IAAAnB,WAAA,CAAAqB,IAAA;MAAKV,SAAS,EAAC,oDAAoD;MAAAC,QAAA,gBAClE,IAAAZ,WAAA,CAAAU,GAAA,EAACT,cAAc;QACdC,cAAc,EAAGA,cAAgB;QACjCC,cAAc,EAAGK;MAAW,CAC5B,CAAC,EACAY,OAAO,CAACL,GAAG,CAAE,CAAEO,KAAK,EAAEN,KAAK,kBAC5B,IAAAhB,WAAA,CAAAU,GAAA,EAACT,cAAc;QACdC,cAAc,EAAGoB,KAAO;QACxBnB,cAAc,EAAGK;MAAW,GACtBQ,KACN,CACA,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_keycodes","_jsxRuntime","KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","displayShortcutList","character","ariaLabel","shortcutAriaLabel","jsx","className","children","Array","isArray","map","index","Fragment","Shortcut","description","aliases","jsxs","alias","_default","exports","default"],"sources":["@wordpress/editor/src/components/keyboard-shortcut-help-modal/shortcut.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"editor-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"editor-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"editor-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\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G,CAAC;AAER;AAEA,SAASE,QAAQA,CAAE;EAAEC,WAAW;EAAEjB,cAAc;EAAEkB,OAAO,GAAG,EAAE;EAAEZ;AAAU,CAAC,EAAG;EAC7E,oBACC,IAAAR,WAAA,CAAAqB,IAAA,EAAArB,WAAA,CAAAiB,QAAA;IAAAL,QAAA,gBACC,IAAAZ,WAAA,CAAAU,GAAA;MAAKC,SAAS,EAAC,2DAA2D;MAAAC,QAAA,EACvEO;IAAW,CACT,CAAC,eACN,IAAAnB,WAAA,CAAAqB,IAAA;MAAKV,SAAS,EAAC,oDAAoD;MAAAC,QAAA,gBAClE,IAAAZ,WAAA,CAAAU,GAAA,EAACT,cAAc;QACdC,cAAc,EAAGA,cAAgB;QACjCC,cAAc,EAAGK;MAAW,CAC5B,CAAC,EACAY,OAAO,CAACL,GAAG,CAAE,CAAEO,KAAK,EAAEN,KAAK,kBAC5B,IAAAhB,WAAA,CAAAU,GAAA,EAACT,cAAc;QACdC,cAAc,EAAGoB,KAAO;QACxBnB,cAAc,EAAGK;MAAW,GACtBQ,KACN,CACA,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,QAAQ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_compose","_data","_dom","_element","_i18n","_keyboardShortcuts","_keycodes","_listViewOutline","_interopRequireDefault","_lockUnlock","_store","_jsxRuntime","TabbedSidebar","unlock","blockEditorPrivateApis","ListViewSidebar","setIsListViewOpened","useDispatch","editorStore","getListViewToggleRef","useSelect","focusOnMountRef","useFocusOnMount","closeListView","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","useState","tab","setTab","sidebarRef","useRef","tabsRef","listViewRef","listViewContainerRef","useMergeRefs","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","listViewApplicationFocus","listViewFocusArea","contains","handleToggleListViewShortcut","ownerDocument","activeElement","useShortcut","jsx","className","onKeyDown","ref","children","tabs","name","title","_x","panel","__experimentalListView","panelRef","default","onClose","onSelect","tabName","defaultTabId","closeButtonLabel","__"],"sources":["@wordpress/editor/src/components/list-view-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewOutline from './list-view-outline';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { TabbedSidebar } = unlock( blockEditorPrivateApis );\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editorStore ) );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\t// Tracks our current tab.\n\tconst [ tab, setTab ] = useState( 'list-view' );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the tab panel.\n\tconst tabsRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t// Must merge the refs together so focus can be handled properly in the next function.\n\tconst listViewContainerRef = useMergeRefs( [\n\t\tfocusOnMountRef,\n\t\tlistViewRef,\n\t\tsetDropZoneElement,\n\t] );\n\n\t/*\n\t * Callback function to handle list view or outline focus.\n\t *\n\t * @param {string} currentTab The current tab. Either list view or outline.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus( currentTab ) {\n\t\t// Tab panel focus.\n\t\tconst tabPanelFocus = focus.tabbable.find( tabsRef.current )[ 0 ];\n\t\t// List view tab is selected.\n\t\tif ( currentTab === 'list-view' ) {\n\t\t\t// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.\n\t\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\t\tlistViewRef.current\n\t\t\t)[ 0 ];\n\t\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\t\tlistViewApplicationFocus\n\t\t\t)\n\t\t\t\t? listViewApplicationFocus\n\t\t\t\t: tabPanelFocus;\n\t\t\tlistViewFocusArea.focus();\n\t\t\t// Outline tab is selected.\n\t\t} else {\n\t\t\ttabPanelFocus.focus();\n\t\t}\n\t}\n\n\tconst handleToggleListViewShortcut = useCallback( () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcloseListView();\n\t\t} else {\n\t\t\t// If the list view or outline does not have focus, focus should be moved to it.\n\t\t\thandleSidebarFocus( tab );\n\t\t}\n\t}, [ closeListView, tab ] );\n\n\t// This only fires when the sidebar is open because of the conditional rendering.\n\t// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut( 'core/editor/toggle-list-view', handleToggleListViewShortcut );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"editor-list-view-sidebar\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<TabbedSidebar\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'list-view',\n\t\t\t\t\t\ttitle: _x( 'List View', 'Post overview' ),\n\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-container\">\n\t\t\t\t\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-panel-content\">\n\t\t\t\t\t\t\t\t\t<ListView\n\t\t\t\t\t\t\t\t\t\tdropZoneElement={ dropZoneElement }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpanelRef: listViewContainerRef,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'outline',\n\t\t\t\t\t\ttitle: _x( 'Outline', 'Post overview' ),\n\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-container\">\n\t\t\t\t\t\t\t\t<ListViewOutline />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t\tonClose={ closeListView }\n\t\t\t\tonSelect={ ( tabName ) => setTab( tabName ) }\n\t\t\t\tdefaultTabId=\"list-view\"\n\t\t\t\tref={ tabsRef }\n\t\t\t\tcloseButtonLabel={ __( 'Close' ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,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;QACxBb,GAAG,EAAGnB,OAAS;QACfiC,gBAAgB,EAAG,IAAAC,QAAE,EAAE,OAAQ;MAAG,CAClC;IAAC,CACE;EAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_compose","_data","_dom","_element","_i18n","_keyboardShortcuts","_keycodes","_listViewOutline","_interopRequireDefault","_lockUnlock","_store","_jsxRuntime","TabbedSidebar","unlock","blockEditorPrivateApis","ListViewSidebar","setIsListViewOpened","useDispatch","editorStore","getListViewToggleRef","useSelect","focusOnMountRef","useFocusOnMount","closeListView","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","useState","tab","setTab","sidebarRef","useRef","tabsRef","listViewRef","listViewContainerRef","useMergeRefs","handleSidebarFocus","currentTab","tabPanelFocus","tabbable","find","listViewApplicationFocus","listViewFocusArea","contains","handleToggleListViewShortcut","ownerDocument","activeElement","useShortcut","jsx","className","onKeyDown","ref","children","tabs","name","title","_x","panel","__experimentalListView","panelRef","default","onClose","onSelect","tabName","defaultTabId","closeButtonLabel","__"],"sources":["@wordpress/editor/src/components/list-view-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport ListViewOutline from './list-view-outline';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { TabbedSidebar } = unlock( blockEditorPrivateApis );\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editorStore ) );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\t// Tracks our current tab.\n\tconst [ tab, setTab ] = useState( 'list-view' );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the tab panel.\n\tconst tabsRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t// Must merge the refs together so focus can be handled properly in the next function.\n\tconst listViewContainerRef = useMergeRefs( [\n\t\tfocusOnMountRef,\n\t\tlistViewRef,\n\t\tsetDropZoneElement,\n\t] );\n\n\t/*\n\t * Callback function to handle list view or outline focus.\n\t *\n\t * @param {string} currentTab The current tab. Either list view or outline.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus( currentTab ) {\n\t\t// Tab panel focus.\n\t\tconst tabPanelFocus = focus.tabbable.find( tabsRef.current )[ 0 ];\n\t\t// List view tab is selected.\n\t\tif ( currentTab === 'list-view' ) {\n\t\t\t// Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks.\n\t\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\t\tlistViewRef.current\n\t\t\t)[ 0 ];\n\t\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\t\tlistViewApplicationFocus\n\t\t\t)\n\t\t\t\t? listViewApplicationFocus\n\t\t\t\t: tabPanelFocus;\n\t\t\tlistViewFocusArea.focus();\n\t\t\t// Outline tab is selected.\n\t\t} else {\n\t\t\ttabPanelFocus.focus();\n\t\t}\n\t}\n\n\tconst handleToggleListViewShortcut = useCallback( () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcloseListView();\n\t\t} else {\n\t\t\t// If the list view or outline does not have focus, focus should be moved to it.\n\t\t\thandleSidebarFocus( tab );\n\t\t}\n\t}, [ closeListView, tab ] );\n\n\t// This only fires when the sidebar is open because of the conditional rendering.\n\t// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut( 'core/editor/toggle-list-view', handleToggleListViewShortcut );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"editor-list-view-sidebar\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<TabbedSidebar\n\t\t\t\ttabs={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'list-view',\n\t\t\t\t\t\ttitle: _x( 'List View', 'Post overview' ),\n\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-container\">\n\t\t\t\t\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-panel-content\">\n\t\t\t\t\t\t\t\t\t<ListView\n\t\t\t\t\t\t\t\t\t\tdropZoneElement={ dropZoneElement }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tpanelRef: listViewContainerRef,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'outline',\n\t\t\t\t\t\ttitle: _x( 'Outline', 'Post overview' ),\n\t\t\t\t\t\tpanel: (\n\t\t\t\t\t\t\t<div className=\"editor-list-view-sidebar__list-view-container\">\n\t\t\t\t\t\t\t\t<ListViewOutline />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t\tonClose={ closeListView }\n\t\t\t\tonSelect={ ( tabName ) => setTab( tabName ) }\n\t\t\t\tdefaultTabId=\"list-view\"\n\t\t\t\tref={ tabsRef }\n\t\t\t\tcloseButtonLabel={ __( 'Close' ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAKA,IAAAQ,gBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAAmD,IAAAY,WAAA,GAAAZ,OAAA;AApBnD;AACA;AACA;;AAaA;AACA;AACA;;AAKA,MAAM;EAAEa;AAAc,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE3C,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC1D,MAAM;IAAEC;EAAqB,CAAC,GAAG,IAAAN,kBAAM,EAAE,IAAAO,eAAS,EAAEF,YAAY,CAAE,CAAC;;EAEnE;EACA,MAAMG,eAAe,GAAG,IAAAC,wBAAe,EAAE,cAAe,CAAC;;EAEzD;EACA,MAAMC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C,CACE;UAAC,CACF,CACL;UACDkC,QAAQ,EAAEzB;QACX,CAAC,EACD;UACCoB,IAAI,EAAE,SAAS;UACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,SAAS,EAAE,eAAgB,CAAC;UACvCC,KAAK,eACJ,IAAAtD,WAAA,CAAA6C,GAAA;YAAKC,SAAS,EAAC,+CAA+C;YAAAG,QAAA,eAC7D,IAAAjD,WAAA,CAAA6C,GAAA,EAACjD,gBAAA,CAAA6D,OAAe,IAAE;UAAC,CACf;QAEP,CAAC,CACC;QACHC,OAAO,EAAG9C,aAAe;QACzB+C,QAAQ,EAAKC,OAAO,IAAMlC,MAAM,CAAEkC,OAAQ,CAAG;QAC7CC,YAAY,EAAC,WAAW;QACxBb,GAAG,EAAGnB,OAAS;QACfiC,gBAAgB,EAAG,IAAAC,QAAE,EAAE,OAAQ;MAAG,CAClC;IAAC,CACE;EAAC;AAER","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_compose","_data","_i18n","_blocks","_notices","_autosaveMonitor","_interopRequireDefault","_localAutosave","_store","_jsxRuntime","requestIdleCallback","window","requestAnimationFrame","hasStorageSupport","hasSessionStorageSupport","undefined","sessionStorage","setItem","removeItem","useAutosaveNotice","postId","isEditedPostNew","hasRemoteAutosave","useSelect","select","editorStore","getCurrentPostId","getEditorSettings","autosave","getEditedPostAttribute","createWarningNotice","removeNotice","useDispatch","noticesStore","editPost","resetEditorBlocks","useEffect","localAutosave","localAutosaveGet","JSON","parse","post_title","title","content","excerpt","edits","hasDifference","Object","keys","some","key","localAutosaveClear","id","__","actions","label","onClick","editsContent","editsWithoutContent","useAutosavePurge","isDirty","isAutosaving","didError","isEditedPostDirty","isAutosavingPost","didPostSaveRequestFail","lastIsDirtyRef","useRef","lastIsAutosavingRef","current","wasEditedPostNew","usePrevious","prevPostId","LocalAutosaveMonitor","deferredAutosave","useCallback","local","localAutosaveInterval","jsx","default","interval","_default","exports","ifCondition"],"sources":["@wordpress/editor/src/components/local-autosave-monitor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { ifCondition, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AutosaveMonitor from '../autosave-monitor';\nimport {\n\tlocalAutosaveGet,\n\tlocalAutosaveClear,\n} from '../../store/local-autosave';\nimport { store as editorStore } from '../../store';\n\nconst requestIdleCallback = window.requestIdleCallback\n\t? window.requestIdleCallback\n\t: window.requestAnimationFrame;\n\nlet hasStorageSupport;\n\n/**\n * Function which returns true if the current environment supports browser\n * sessionStorage, or false otherwise. The result of this function is cached and\n * reused in subsequent invocations.\n */\nconst hasSessionStorageSupport = () => {\n\tif ( hasStorageSupport !== undefined ) {\n\t\treturn hasStorageSupport;\n\t}\n\n\ttry {\n\t\t// Private Browsing in Safari 10 and earlier will throw an error when\n\t\t// attempting to set into sessionStorage. The test here is intentional in\n\t\t// causing a thrown error as condition bailing from local autosave.\n\t\twindow.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );\n\t\twindow.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );\n\t\thasStorageSupport = true;\n\t} catch {\n\t\thasStorageSupport = false;\n\t}\n\n\treturn hasStorageSupport;\n};\n\n/**\n * Custom hook which manages the creation of a notice prompting the user to\n * restore a local autosave, if one exists.\n */\nfunction useAutosaveNotice() {\n\tconst { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\thasRemoteAutosave:\n\t\t\t\t!! select( editorStore ).getEditorSettings().autosave,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { editPost, resetEditorBlocks } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tlet localAutosave = localAutosaveGet( postId, isEditedPostNew );\n\t\tif ( ! localAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlocalAutosave = JSON.parse( localAutosave );\n\t\t} catch {\n\t\t\t// Not usable if it can't be parsed.\n\t\t\treturn;\n\t\t}\n\n\t\tconst { post_title: title, content, excerpt } = localAutosave;\n\t\tconst edits = { title, content, excerpt };\n\n\t\t{\n\t\t\t// Only display a notice if there is a difference between what has been\n\t\t\t// saved and that which is stored in sessionStorage.\n\t\t\tconst hasDifference = Object.keys( edits ).some( ( key ) => {\n\t\t\t\treturn edits[ key ] !== getEditedPostAttribute( key );\n\t\t\t} );\n\n\t\t\tif ( ! hasDifference ) {\n\t\t\t\t// If there is no difference, it can be safely ejected from storage.\n\t\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( hasRemoteAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst id = 'wpEditorAutosaveRestore';\n\n\t\tcreateWarningNotice(\n\t\t\t__(\n\t\t\t\t'The backup of this post in your browser is different from the version below.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tid,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Restore the backup' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tcontent: editsContent,\n\t\t\t\t\t\t\t\t...editsWithoutContent\n\t\t\t\t\t\t\t} = edits;\n\t\t\t\t\t\t\teditPost( editsWithoutContent );\n\t\t\t\t\t\t\tresetEditorBlocks( parse( edits.content ) );\n\t\t\t\t\t\t\tremoveNotice( id );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ isEditedPostNew, postId ] );\n}\n\n/**\n * Custom hook which ejects a local autosave after a successful save occurs.\n */\nfunction useAutosavePurge() {\n\tconst { postId, isEditedPostNew, isDirty, isAutosaving, didError } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\t\tisDirty: select( editorStore ).isEditedPostDirty(),\n\t\t\t\tisAutosaving: select( editorStore ).isAutosavingPost(),\n\t\t\t\tdidError: select( editorStore ).didPostSaveRequestFail(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\tconst lastIsDirtyRef = useRef( isDirty );\n\tconst lastIsAutosavingRef = useRef( isAutosaving );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! didError &&\n\t\t\t( ( lastIsAutosavingRef.current && ! isAutosaving ) ||\n\t\t\t\t( lastIsDirtyRef.current && ! isDirty ) )\n\t\t) {\n\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t}\n\n\t\tlastIsDirtyRef.current = isDirty;\n\t\tlastIsAutosavingRef.current = isAutosaving;\n\t}, [ isDirty, isAutosaving, didError ] );\n\n\t// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.\n\tconst wasEditedPostNew = usePrevious( isEditedPostNew );\n\tconst prevPostId = usePrevious( postId );\n\tuseEffect( () => {\n\t\tif ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {\n\t\t\tlocalAutosaveClear( postId, true );\n\t\t}\n\t}, [ isEditedPostNew, postId ] );\n}\n\nfunction LocalAutosaveMonitor() {\n\tconst { autosave } = useDispatch( editorStore );\n\tconst deferredAutosave = useCallback( () => {\n\t\trequestIdleCallback( () => autosave( { local: true } ) );\n\t}, [] );\n\tuseAutosaveNotice();\n\tuseAutosavePurge();\n\n\tconst localAutosaveInterval = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().localAutosaveInterval,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<AutosaveMonitor\n\t\t\tinterval={ localAutosaveInterval }\n\t\t\tautosave={ deferredAutosave }\n\t\t/>\n\t);\n}\n\n/**\n * Monitors local autosaves of a post in the editor.\n * It uses several hooks and functions to manage autosave behavior:\n * - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.\n * - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.\n * - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.\n * - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.\n *\n * The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.\n *\n * @module LocalAutosaveMonitor\n */\nexport default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,gBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAIA,IAAAS,MAAA,GAAAT,OAAA;AAAmD,IAAAU,WAAA,GAAAV,OAAA;AAlBnD;AACA;AACA;;AAQA;AACA;AACA;;AAQA,MAAMW,mBAAmB,GAAGC,MAAM,CAACD,mBAAmB,GACnDC,MAAM,CAACD,mBAAmB,GAC1BC,MAAM,CAACC,qBAAqB;AAE/B,IAAIC,iBAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,GAAGA,CAAA,KAAM;EACtC,IAAKD,iBAAiB,KAAKE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M,CAAG,CAAC;AACjC;AAEA,SAASqD,oBAAoBA,CAAA,EAAG;EAC/B,MAAM;IAAE7C;EAAS,CAAC,GAAG,IAAAI,iBAAW,EAAEP,YAAY,CAAC;EAC/C,MAAMiD,gBAAgB,GAAG,IAAAC,oBAAW,EAAE,MAAM;IAC3CjE,mBAAmB,CAAE,MAAMkB,QAAQ,CAAE;MAAEgD,KAAK,EAAE;IAAK,CAAE,CAAE,CAAC;EACzD,CAAC,EAAE,EAAG,CAAC;EACPzD,iBAAiB,CAAC,CAAC;EACnBwC,gBAAgB,CAAC,CAAC;EAElB,MAAMkB,qBAAqB,GAAG,IAAAtD,eAAS,EACpCC,MAAM,IACPA,MAAM,CAAEC,YAAY,CAAC,CAACE,iBAAiB,CAAC,CAAC,CAACkD,qBAAqB,EAChE,EACD,CAAC;EAED,oBACC,IAAApE,WAAA,CAAAqE,GAAA,EAACzE,gBAAA,CAAA0E,OAAe;IACfC,QAAQ,EAAGH,qBAAuB;IAClCjD,QAAQ,EAAG8C;EAAkB,CAC7B,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA,IAAAO,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAYe,IAAAI,oBAAW,EAAErE,wBAAyB,CAAC,CAAE2D,oBAAqB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_compose","_data","_i18n","_blocks","_notices","_autosaveMonitor","_interopRequireDefault","_localAutosave","_store","_jsxRuntime","requestIdleCallback","window","requestAnimationFrame","hasStorageSupport","hasSessionStorageSupport","undefined","sessionStorage","setItem","removeItem","useAutosaveNotice","postId","isEditedPostNew","hasRemoteAutosave","useSelect","select","editorStore","getCurrentPostId","getEditorSettings","autosave","getEditedPostAttribute","createWarningNotice","removeNotice","useDispatch","noticesStore","editPost","resetEditorBlocks","useEffect","localAutosave","localAutosaveGet","JSON","parse","post_title","title","content","excerpt","edits","hasDifference","Object","keys","some","key","localAutosaveClear","id","__","actions","label","onClick","editsContent","editsWithoutContent","useAutosavePurge","isDirty","isAutosaving","didError","isEditedPostDirty","isAutosavingPost","didPostSaveRequestFail","lastIsDirtyRef","useRef","lastIsAutosavingRef","current","wasEditedPostNew","usePrevious","prevPostId","LocalAutosaveMonitor","deferredAutosave","useCallback","local","localAutosaveInterval","jsx","default","interval","_default","exports","ifCondition"],"sources":["@wordpress/editor/src/components/local-autosave-monitor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { ifCondition, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { parse } from '@wordpress/blocks';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AutosaveMonitor from '../autosave-monitor';\nimport {\n\tlocalAutosaveGet,\n\tlocalAutosaveClear,\n} from '../../store/local-autosave';\nimport { store as editorStore } from '../../store';\n\nconst requestIdleCallback = window.requestIdleCallback\n\t? window.requestIdleCallback\n\t: window.requestAnimationFrame;\n\nlet hasStorageSupport;\n\n/**\n * Function which returns true if the current environment supports browser\n * sessionStorage, or false otherwise. The result of this function is cached and\n * reused in subsequent invocations.\n */\nconst hasSessionStorageSupport = () => {\n\tif ( hasStorageSupport !== undefined ) {\n\t\treturn hasStorageSupport;\n\t}\n\n\ttry {\n\t\t// Private Browsing in Safari 10 and earlier will throw an error when\n\t\t// attempting to set into sessionStorage. The test here is intentional in\n\t\t// causing a thrown error as condition bailing from local autosave.\n\t\twindow.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );\n\t\twindow.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );\n\t\thasStorageSupport = true;\n\t} catch {\n\t\thasStorageSupport = false;\n\t}\n\n\treturn hasStorageSupport;\n};\n\n/**\n * Custom hook which manages the creation of a notice prompting the user to\n * restore a local autosave, if one exists.\n */\nfunction useAutosaveNotice() {\n\tconst { postId, isEditedPostNew, hasRemoteAutosave } = useSelect(\n\t\t( select ) => ( {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\thasRemoteAutosave:\n\t\t\t\t!! select( editorStore ).getEditorSettings().autosave,\n\t\t} ),\n\t\t[]\n\t);\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticesStore );\n\tconst { editPost, resetEditorBlocks } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tlet localAutosave = localAutosaveGet( postId, isEditedPostNew );\n\t\tif ( ! localAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlocalAutosave = JSON.parse( localAutosave );\n\t\t} catch {\n\t\t\t// Not usable if it can't be parsed.\n\t\t\treturn;\n\t\t}\n\n\t\tconst { post_title: title, content, excerpt } = localAutosave;\n\t\tconst edits = { title, content, excerpt };\n\n\t\t{\n\t\t\t// Only display a notice if there is a difference between what has been\n\t\t\t// saved and that which is stored in sessionStorage.\n\t\t\tconst hasDifference = Object.keys( edits ).some( ( key ) => {\n\t\t\t\treturn edits[ key ] !== getEditedPostAttribute( key );\n\t\t\t} );\n\n\t\t\tif ( ! hasDifference ) {\n\t\t\t\t// If there is no difference, it can be safely ejected from storage.\n\t\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif ( hasRemoteAutosave ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst id = 'wpEditorAutosaveRestore';\n\n\t\tcreateWarningNotice(\n\t\t\t__(\n\t\t\t\t'The backup of this post in your browser is different from the version below.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tid,\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Restore the backup' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\tcontent: editsContent,\n\t\t\t\t\t\t\t\t...editsWithoutContent\n\t\t\t\t\t\t\t} = edits;\n\t\t\t\t\t\t\teditPost( editsWithoutContent );\n\t\t\t\t\t\t\tresetEditorBlocks( parse( edits.content ) );\n\t\t\t\t\t\t\tremoveNotice( id );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ isEditedPostNew, postId ] );\n}\n\n/**\n * Custom hook which ejects a local autosave after a successful save occurs.\n */\nfunction useAutosavePurge() {\n\tconst { postId, isEditedPostNew, isDirty, isAutosaving, didError } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t\t\tisEditedPostNew: select( editorStore ).isEditedPostNew(),\n\t\t\t\tisDirty: select( editorStore ).isEditedPostDirty(),\n\t\t\t\tisAutosaving: select( editorStore ).isAutosavingPost(),\n\t\t\t\tdidError: select( editorStore ).didPostSaveRequestFail(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\n\tconst lastIsDirtyRef = useRef( isDirty );\n\tconst lastIsAutosavingRef = useRef( isAutosaving );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\t! didError &&\n\t\t\t( ( lastIsAutosavingRef.current && ! isAutosaving ) ||\n\t\t\t\t( lastIsDirtyRef.current && ! isDirty ) )\n\t\t) {\n\t\t\tlocalAutosaveClear( postId, isEditedPostNew );\n\t\t}\n\n\t\tlastIsDirtyRef.current = isDirty;\n\t\tlastIsAutosavingRef.current = isAutosaving;\n\t}, [ isDirty, isAutosaving, didError ] );\n\n\t// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.\n\tconst wasEditedPostNew = usePrevious( isEditedPostNew );\n\tconst prevPostId = usePrevious( postId );\n\tuseEffect( () => {\n\t\tif ( prevPostId === postId && wasEditedPostNew && ! isEditedPostNew ) {\n\t\t\tlocalAutosaveClear( postId, true );\n\t\t}\n\t}, [ isEditedPostNew, postId ] );\n}\n\nfunction LocalAutosaveMonitor() {\n\tconst { autosave } = useDispatch( editorStore );\n\tconst deferredAutosave = useCallback( () => {\n\t\trequestIdleCallback( () => autosave( { local: true } ) );\n\t}, [] );\n\tuseAutosaveNotice();\n\tuseAutosavePurge();\n\n\tconst localAutosaveInterval = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().localAutosaveInterval,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<AutosaveMonitor\n\t\t\tinterval={ localAutosaveInterval }\n\t\t\tautosave={ deferredAutosave }\n\t\t/>\n\t);\n}\n\n/**\n * Monitors local autosaves of a post in the editor.\n * It uses several hooks and functions to manage autosave behavior:\n * - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.\n * - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.\n * - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.\n * - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.\n *\n * The module also checks for sessionStorage support and conditionally exports the `LocalAutosaveMonitor` component based on that.\n *\n * @module LocalAutosaveMonitor\n */\nexport default ifCondition( hasSessionStorageSupport )( LocalAutosaveMonitor );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,gBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAIA,IAAAS,MAAA,GAAAT,OAAA;AAAmD,IAAAU,WAAA,GAAAV,OAAA;AAlBnD;AACA;AACA;;AAQA;AACA;AACA;;AAQA,MAAMW,mBAAmB,GAAGC,MAAM,CAACD,mBAAmB,GACnDC,MAAM,CAACD,mBAAmB,G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IAAIkD,gBAAgB,IAAI,CAAEjD,eAAe,EAAG;MACrE,IAAA8B,iCAAkB,EAAE/B,MAAM,EAAE,IAAK,CAAC;IACnC;EACD,CAAC,EAAE,CAAEC,eAAe,EAAED,MAAM,CAAG,CAAC;AACjC;AAEA,SAASqD,oBAAoBA,CAAA,EAAG;EAC/B,MAAM;IAAE7C;EAAS,CAAC,GAAG,IAAAI,iBAAW,EAAEP,YAAY,CAAC;EAC/C,MAAMiD,gBAAgB,GAAG,IAAAC,oBAAW,EAAE,MAAM;IAC3CjE,mBAAmB,CAAE,MAAMkB,QAAQ,CAAE;MAAEgD,KAAK,EAAE;IAAK,CAAE,CAAE,CAAC;EACzD,CAAC,EAAE,EAAG,CAAC;EACPzD,iBAAiB,CAAC,CAAC;EACnBwC,gBAAgB,CAAC,CAAC;EAElB,MAAMkB,qBAAqB,GAAG,IAAAtD,eAAS,EACpCC,MAAM,IACPA,MAAM,CAAEC,YAAY,CAAC,CAACE,iBAAiB,CAAC,CAAC,CAACkD,qBAAqB,EAChE,EACD,CAAC;EAED,oBACC,IAAApE,WAAA,CAAAqE,GAAA,EAACzE,gBAAA,CAAA0E,OAAe;IACfC,QAAQ,EAAGH,qBAAuB;IAClCjD,QAAQ,EAAG8C;EAAkB,CAC7B,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAXA,IAAAO,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAYe,IAAAI,oBAAW,EAAErE,wBAAyB,CAAC,CAAE2D,oBAAqB,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_keyboardShortcuts","_store","_jsxRuntime","MODES","value","label","__","ModeSwitcher","shortcut","isRichEditingEnabled","isCodeEditingEnabled","mode","useSelect","select","keyboardShortcutsStore","getShortcutRepresentation","editorStore","getEditorSettings","richEditingEnabled","codeEditingEnabled","getEditorMode","switchEditorMode","useDispatch","selectedMode","choices","map","choice","disabled","info","jsx","MenuGroup","children","MenuItemsChoice","onSelect","_default","exports","default"],"sources":["@wordpress/editor/src/components/mode-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItemsChoice, MenuGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Set of available mode options.\n *\n * @type {Array}\n */\nconst MODES = [\n\t{\n\t\tvalue: 'visual',\n\t\tlabel: __( 'Visual editor' ),\n\t},\n\t{\n\t\tvalue: 'text',\n\t\tlabel: __( 'Code editor' ),\n\t},\n];\n\nfunction ModeSwitcher() {\n\tconst { shortcut, isRichEditingEnabled, isCodeEditingEnabled, mode } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tshortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getShortcutRepresentation( 'core/editor/toggle-mode' ),\n\t\t\t\tisRichEditingEnabled:\n\t\t\t\t\tselect( editorStore ).getEditorSettings()\n\t\t\t\t\t\t.richEditingEnabled,\n\t\t\t\tisCodeEditingEnabled:\n\t\t\t\t\tselect( editorStore ).getEditorSettings()\n\t\t\t\t\t\t.codeEditingEnabled,\n\t\t\t\tmode: select( editorStore ).getEditorMode(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { switchEditorMode } = useDispatch( editorStore );\n\n\tlet selectedMode = mode;\n\tif ( ! isRichEditingEnabled && mode === 'visual' ) {\n\t\tselectedMode = 'text';\n\t}\n\tif ( ! isCodeEditingEnabled && mode === 'text' ) {\n\t\tselectedMode = 'visual';\n\t}\n\n\tconst choices = MODES.map( ( choice ) => {\n\t\tif ( ! isCodeEditingEnabled && choice.value === 'text' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t}\n\t\tif ( ! isRichEditingEnabled && choice.value === 'visual' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t\tinfo: __(\n\t\t\t\t\t'You can enable the visual editor in your profile settings.'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif ( choice.value !== selectedMode && ! choice.disabled ) {\n\t\t\treturn { ...choice, shortcut };\n\t\t}\n\t\treturn choice;\n\t} );\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Editor' ) }>\n\t\t\t<MenuItemsChoice\n\t\t\t\tchoices={ choices }\n\t\t\t\tvalue={ selectedMode }\n\t\t\t\tonSelect={ switchEditorMode }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default ModeSwitcher;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAmD,IAAAK,WAAA,GAAAL,OAAA;AAXnD;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,GACA,MAAMM,KAAK,GAAG,CACb;EACCC,KAAK,EAAE,QAAQ;EACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,eAAgB;AAC5B,CAAC,EACD;EACCF,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc;AAC1B,CAAC,CACD;AAED,SAASC,YAAYA,CAAA,EAAG;EACvB,MAAM;IAAEC,QAAQ;IAAEC,oBAAoB;IAAEC,oBAAoB;IAAEC;EAAK,CAAC,GACnE,IAAAC,eAAS,EACNC,MAAM,KAAQ;IACfL,QAAQ,EAAEK,MAAM,CACfC,wBACD,CAAC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A,EAAC/B,WAAA,CAAAgC,SAAS;IAACzB,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IAAAyB,QAAA,eAClC,IAAA7B,WAAA,CAAA2B,GAAA,EAAC/B,WAAA,CAAAkC,eAAe;MACfR,OAAO,EAAGA,OAAS;MACnBpB,KAAK,EAAGmB,YAAc;MACtBU,QAAQ,EAAGZ;IAAkB,CAC7B;EAAC,CACQ,CAAC;AAEd;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc7B,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_data","_keyboardShortcuts","_store","_jsxRuntime","MODES","value","label","__","ModeSwitcher","shortcut","isRichEditingEnabled","isCodeEditingEnabled","mode","useSelect","select","keyboardShortcutsStore","getShortcutRepresentation","editorStore","getEditorSettings","richEditingEnabled","codeEditingEnabled","getEditorMode","switchEditorMode","useDispatch","selectedMode","choices","map","choice","disabled","info","jsx","MenuGroup","children","MenuItemsChoice","onSelect","_default","exports","default"],"sources":["@wordpress/editor/src/components/mode-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItemsChoice, MenuGroup } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Set of available mode options.\n *\n * @type {Array}\n */\nconst MODES = [\n\t{\n\t\tvalue: 'visual',\n\t\tlabel: __( 'Visual editor' ),\n\t},\n\t{\n\t\tvalue: 'text',\n\t\tlabel: __( 'Code editor' ),\n\t},\n];\n\nfunction ModeSwitcher() {\n\tconst { shortcut, isRichEditingEnabled, isCodeEditingEnabled, mode } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\tshortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getShortcutRepresentation( 'core/editor/toggle-mode' ),\n\t\t\t\tisRichEditingEnabled:\n\t\t\t\t\tselect( editorStore ).getEditorSettings()\n\t\t\t\t\t\t.richEditingEnabled,\n\t\t\t\tisCodeEditingEnabled:\n\t\t\t\t\tselect( editorStore ).getEditorSettings()\n\t\t\t\t\t\t.codeEditingEnabled,\n\t\t\t\tmode: select( editorStore ).getEditorMode(),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { switchEditorMode } = useDispatch( editorStore );\n\n\tlet selectedMode = mode;\n\tif ( ! isRichEditingEnabled && mode === 'visual' ) {\n\t\tselectedMode = 'text';\n\t}\n\tif ( ! isCodeEditingEnabled && mode === 'text' ) {\n\t\tselectedMode = 'visual';\n\t}\n\n\tconst choices = MODES.map( ( choice ) => {\n\t\tif ( ! isCodeEditingEnabled && choice.value === 'text' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t};\n\t\t}\n\t\tif ( ! isRichEditingEnabled && choice.value === 'visual' ) {\n\t\t\tchoice = {\n\t\t\t\t...choice,\n\t\t\t\tdisabled: true,\n\t\t\t\tinfo: __(\n\t\t\t\t\t'You can enable the visual editor in your profile settings.'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\tif ( choice.value !== selectedMode && ! choice.disabled ) {\n\t\t\treturn { ...choice, shortcut };\n\t\t}\n\t\treturn choice;\n\t} );\n\n\treturn (\n\t\t<MenuGroup label={ __( 'Editor' ) }>\n\t\t\t<MenuItemsChoice\n\t\t\t\tchoices={ choices }\n\t\t\t\tvalue={ selectedMode }\n\t\t\t\tonSelect={ switchEditorMode }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default ModeSwitcher;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAA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EAAG;MACxDsB,MAAM,GAAG;QACR,GAAGA,MAAM;QACTC,QAAQ,EAAE;MACX,CAAC;IACF;IACA,IAAK,CAAElB,oBAAoB,IAAIiB,MAAM,CAACtB,KAAK,KAAK,QAAQ,EAAG;MAC1DsB,MAAM,GAAG;QACR,GAAGA,MAAM;QACTC,QAAQ,EAAE,IAAI;QACdC,IAAI,EAAE,IAAAtB,QAAE,EACP,4DACD;MACD,CAAC;IACF;IACA,IAAKoB,MAAM,CAACtB,KAAK,KAAKmB,YAAY,IAAI,CAAEG,MAAM,CAACC,QAAQ,EAAG;MACzD,OAAO;QAAE,GAAGD,MAAM;QAAElB;MAAS,CAAC;IAC/B;IACA,OAAOkB,MAAM;EACd,CAAE,CAAC;EAEH,oBACC,IAAAxB,WAAA,CAAA2B,GAAA,EAAC/B,WAAA,CAAAgC,SAAS;IAACzB,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IAAAyB,QAAA,eAClC,IAAA7B,WAAA,CAAA2B,GAAA,EAAC/B,WAAA,CAAAkC,eAAe;MACfR,OAAO,EAAGA,OAAS;MACnBpB,KAAK,EAAGmB,YAAc;MACtBU,QAAQ,EAAGZ;IAAkB,CAC7B;EAAC,CACQ,CAAC;AAEd;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc7B,YAAY","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -65,13 +64,15 @@ function PageAttributesParent() {
65
64
  isHierarchical,
66
65
  parentPostId,
67
66
  parentPostTitle,
68
- pageItems
67
+ pageItems,
68
+ isLoading
69
69
  } = (0, _data.useSelect)(select => {
70
70
  var _pType$hierarchical;
71
71
  const {
72
72
  getPostType,
73
73
  getEntityRecords,
74
- getEntityRecord
74
+ getEntityRecord,
75
+ isResolving
75
76
  } = select(_coreData.store);
76
77
  const {
77
78
  getCurrentPostId,
@@ -100,7 +101,8 @@ function PageAttributesParent() {
100
101
  isHierarchical: postIsHierarchical,
101
102
  parentPostId: pageId,
102
103
  parentPostTitle: parentPost ? getTitle(parentPost) : '',
103
- pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null
104
+ pageItems: postIsHierarchical ? getEntityRecords('postType', postTypeSlug, query) : null,
105
+ isLoading: postIsHierarchical ? isResolving('getEntityRecords', ['postType', postTypeSlug, query]) : false
104
106
  };
105
107
  }, [fieldValue]);
106
108
  const parentOptions = (0, _element.useMemo)(() => {
@@ -174,7 +176,8 @@ function PageAttributesParent() {
174
176
  options: parentOptions,
175
177
  onFilterValueChange: (0, _compose.debounce)(handleKeydown, 300),
176
178
  onChange: handleChange,
177
- hideLabelFromVision: true
179
+ hideLabelFromVision: true,
180
+ isLoading: isLoading
178
181
  });
179
182
  }
180
183
  function PostParentToggle({
@@ -1 +1 @@
1
- {"version":3,"names":["_removeAccents","_interopRequireDefault","require","_i18n","_components","_compose","_element","_data","_htmlEntities","_coreData","_blockEditor","_url","_postPanelRow","_terms","_store","_jsxRuntime","getTitle","post","title","rendered","decodeEntities","id","__","getItemPriority","name","searchValue","normalizedName","removeAccents","toLowerCase","normalizedSearch","startsWith","length","Infinity","exports","PageAttributesParent","editPost","useDispatch","editorStore","fieldValue","setFieldValue","useState","isHierarchical","parentPostId","parentPostTitle","pageItems","useSelect","select","_pType$hierarchical","getPostType","getEntityRecords","getEntityRecord","coreStore","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPost","parentOptions","useMemo","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","buildTermsTree","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId","jsx","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","help","options","onFilterValueChange","debounce","onChange","hideLabelFromVision","PostParentToggle","isOpen","onClick","parentTitle","Button","size","variant","sprintf","ParentRow","homeUrl","home","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","default","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","jsxs","__experimentalInspectorPopoverHeader","createInterpolateElement","filterURLForDisplay","replace","wbr","ExternalLink","href","_default"],"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdown,\n\tComboboxControl,\n\tExternalLink,\n} from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport {\n\tcreateInterpolateElement,\n\tuseState,\n\tuseMemo,\n} from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\n/**\n * Renders the Page Attributes Parent component. A dropdown menu in an editor interface\n * for selecting the parent page of a given page.\n *\n * @return {React.ReactNode} The component to be rendered. Return null if post type is not hierarchical.\n */\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst { isHierarchical, parentPostId, parentPostTitle, pageItems } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getPostType, getEntityRecords, getEntityRecord } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\t\tselect( editorStore );\n\t\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\t\tconst query = {\n\t\t\t\t\tper_page: 100,\n\t\t\t\t\texclude: postId,\n\t\t\t\t\tparent_exclude: postId,\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: 'id,title,parent',\n\t\t\t\t};\n\n\t\t\t\t// Perform a search when the field is changed.\n\t\t\t\tif ( !! fieldValue ) {\n\t\t\t\t\tquery.search = fieldValue;\n\t\t\t\t}\n\n\t\t\t\tconst parentPost = pageId\n\t\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t\t: null;\n\n\t\t\t\treturn {\n\t\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\t\tparentPostId: pageId,\n\t\t\t\t\tparentPostTitle: parentPost ? getTitle( parentPost ) : '',\n\t\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ fieldValue ]\n\t\t);\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tif ( ! pageItems ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPostTitle && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: parentPostTitle,\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue, parentPostTitle, parentPostId ] );\n\n\tif ( ! isHierarchical ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ __( 'Parent' ) }\n\t\t\thelp={ __( 'Choose a parent page.' ) }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t\thideLabelFromVision\n\t\t/>\n\t);\n}\n\nfunction PostParentToggle( { isOpen, onClick } ) {\n\tconst parentPost = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst parentPostId = getEditedPostAttribute( 'parent' );\n\t\tif ( ! parentPostId ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\treturn getEntityRecord( 'postType', postTypeSlug, parentPostId );\n\t}, [] );\n\tconst parentTitle = useMemo(\n\t\t() => ( ! parentPost ? __( 'None' ) : getTitle( parentPost ) ),\n\t\t[ parentPost ]\n\t);\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-parent__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\t// translators: %s: Current post parent.\n\t\t\t\tsprintf( __( 'Change parent: %s' ), parentTitle )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ parentTitle }\n\t\t</Button>\n\t);\n}\n\nexport function ParentRow() {\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\treturn (\n\t\t<PostPanelRow label={ __( 'Parent' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"editor-post-parent__panel-dropdown\"\n\t\t\t\tcontentClassName=\"editor-post-parent__panel-dialog\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostParentToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<div className=\"editor-post-parent\">\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Parent' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: The home URL of the WordPress installation without the scheme. */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Child pages inherit characteristics from their parent, such as URL structure. For instance, if \"Pricing\" is a child of \"Services\", its URL would be %s<wbr />/services<wbr />/pricing.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tfilterURLForDisplay( homeUrl ).replace(\n\t\t\t\t\t\t\t\t\t\t/([/.])/g,\n\t\t\t\t\t\t\t\t\t\t'<wbr />$1'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\twbr: <wbr />,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<PageAttributesParent />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n\nexport default PageAttributesParent;\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AAKA,IAAAU,aAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,MAAA,GAA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F,GAAA,WAAM;UACZ,CACD,CAAC,eACD,IAAArF,WAAA,CAAAqF,GAAA;YAAAnB,QAAA,EACG,IAAA2D,iCAAwB,EACzB,IAAAtH,QAAE,EACD,mFACD,CAAC,EACD;cACC8D,CAAC,eACA,IAAArE,WAAA,CAAAqF,GAAA,EAAChG,WAAA,CAAA4I,YAAY;gBACZC,IAAI,EAAG,IAAA3H,QAAE,EACR,yFACD;cAAG,CACH;YAEH,CACD;UAAC,CACC,CAAC;QAAA,CACA,CAAC,eACN,IAAAP,WAAA,CAAAqF,GAAA,EAAClE,oBAAoB,IAAE,CAAC;MAAA,CACpB;IACH,CACH;EAAC,CACW,CAAC;AAEjB;AAAC,IAAAgH,QAAA,GAAAjH,OAAA,CAAAgG,OAAA,GAEc/F,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["_removeAccents","_interopRequireDefault","require","_i18n","_components","_compose","_element","_data","_htmlEntities","_coreData","_blockEditor","_url","_postPanelRow","_terms","_store","_jsxRuntime","getTitle","post","title","rendered","decodeEntities","id","__","getItemPriority","name","searchValue","normalizedName","removeAccents","toLowerCase","normalizedSearch","startsWith","length","Infinity","exports","PageAttributesParent","editPost","useDispatch","editorStore","fieldValue","setFieldValue","useState","isHierarchical","parentPostId","parentPostTitle","pageItems","isLoading","useSelect","select","_pType$hierarchical","getPostType","getEntityRecords","getEntityRecord","isResolving","coreStore","getCurrentPostId","getEditedPostAttribute","postTypeSlug","pageId","pType","postId","postIsHierarchical","hierarchical","query","per_page","exclude","parent_exclude","orderby","order","_fields","search","parentPost","parentOptions","useMemo","getOptionsFromTree","tree","level","mappedNodes","map","treeNode","value","label","repeat","rawName","children","sortedNodes","sort","a","b","priorityA","priorityB","flat","item","parent","buildTermsTree","opts","optsHasParent","find","unshift","handleKeydown","inputValue","handleChange","selectedPostId","jsx","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","help","options","onFilterValueChange","debounce","onChange","hideLabelFromVision","PostParentToggle","isOpen","onClick","parentTitle","Button","size","variant","sprintf","ParentRow","homeUrl","home","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","default","ref","Dropdown","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","jsxs","__experimentalInspectorPopoverHeader","createInterpolateElement","filterURLForDisplay","replace","wbr","ExternalLink","href","_default"],"sources":["@wordpress/editor/src/components/page-attributes/parent.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdown,\n\tComboboxControl,\n\tExternalLink,\n} from '@wordpress/components';\nimport { debounce } from '@wordpress/compose';\nimport {\n\tcreateInterpolateElement,\n\tuseState,\n\tuseMemo,\n} from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\nfunction getTitle( post ) {\n\treturn post?.title?.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post.id } (${ __( 'no title' ) })`;\n}\n\nexport const getItemPriority = ( name, searchValue ) => {\n\tconst normalizedName = removeAccents( name || '' ).toLowerCase();\n\tconst normalizedSearch = removeAccents( searchValue || '' ).toLowerCase();\n\tif ( normalizedName === normalizedSearch ) {\n\t\treturn 0;\n\t}\n\n\tif ( normalizedName.startsWith( normalizedSearch ) ) {\n\t\treturn normalizedName.length;\n\t}\n\n\treturn Infinity;\n};\n\n/**\n * Renders the Page Attributes Parent component. A dropdown menu in an editor interface\n * for selecting the parent page of a given page.\n *\n * @return {React.ReactNode} The component to be rendered. Return null if post type is not hierarchical.\n */\nexport function PageAttributesParent() {\n\tconst { editPost } = useDispatch( editorStore );\n\tconst [ fieldValue, setFieldValue ] = useState( false );\n\tconst {\n\t\tisHierarchical,\n\t\tparentPostId,\n\t\tparentPostTitle,\n\t\tpageItems,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetPostType,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst { getCurrentPostId, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\t\tconst pageId = getEditedPostAttribute( 'parent' );\n\t\t\tconst pType = getPostType( postTypeSlug );\n\t\t\tconst postId = getCurrentPostId();\n\t\t\tconst postIsHierarchical = pType?.hierarchical ?? false;\n\t\t\tconst query = {\n\t\t\t\tper_page: 100,\n\t\t\t\texclude: postId,\n\t\t\t\tparent_exclude: postId,\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: 'id,title,parent',\n\t\t\t};\n\n\t\t\t// Perform a search when the field is changed.\n\t\t\tif ( !! fieldValue ) {\n\t\t\t\tquery.search = fieldValue;\n\t\t\t}\n\n\t\t\tconst parentPost = pageId\n\t\t\t\t? getEntityRecord( 'postType', postTypeSlug, pageId )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tisHierarchical: postIsHierarchical,\n\t\t\t\tparentPostId: pageId,\n\t\t\t\tparentPostTitle: parentPost ? getTitle( parentPost ) : '',\n\t\t\t\tpageItems: postIsHierarchical\n\t\t\t\t\t? getEntityRecords( 'postType', postTypeSlug, query )\n\t\t\t\t\t: null,\n\t\t\t\tisLoading: postIsHierarchical\n\t\t\t\t\t? isResolving( 'getEntityRecords', [\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpostTypeSlug,\n\t\t\t\t\t\t\tquery,\n\t\t\t\t\t ] )\n\t\t\t\t\t: false,\n\t\t\t};\n\t\t},\n\t\t[ fieldValue ]\n\t);\n\n\tconst parentOptions = useMemo( () => {\n\t\tconst getOptionsFromTree = ( tree, level = 0 ) => {\n\t\t\tconst mappedNodes = tree.map( ( treeNode ) => [\n\t\t\t\t{\n\t\t\t\t\tvalue: treeNode.id,\n\t\t\t\t\tlabel:\n\t\t\t\t\t\t'— '.repeat( level ) + decodeEntities( treeNode.name ),\n\t\t\t\t\trawName: treeNode.name,\n\t\t\t\t},\n\t\t\t\t...getOptionsFromTree( treeNode.children || [], level + 1 ),\n\t\t\t] );\n\n\t\t\tconst sortedNodes = mappedNodes.sort( ( [ a ], [ b ] ) => {\n\t\t\t\tconst priorityA = getItemPriority( a.rawName, fieldValue );\n\t\t\t\tconst priorityB = getItemPriority( b.rawName, fieldValue );\n\t\t\t\treturn priorityA >= priorityB ? 1 : -1;\n\t\t\t} );\n\n\t\t\treturn sortedNodes.flat();\n\t\t};\n\n\t\tif ( ! pageItems ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet tree = pageItems.map( ( item ) => ( {\n\t\t\tid: item.id,\n\t\t\tparent: item.parent,\n\t\t\tname: getTitle( item ),\n\t\t} ) );\n\n\t\t// Only build a hierarchical tree when not searching.\n\t\tif ( ! fieldValue ) {\n\t\t\ttree = buildTermsTree( tree );\n\t\t}\n\n\t\tconst opts = getOptionsFromTree( tree );\n\n\t\t// Ensure the current parent is in the options list.\n\t\tconst optsHasParent = opts.find(\n\t\t\t( item ) => item.value === parentPostId\n\t\t);\n\t\tif ( parentPostTitle && ! optsHasParent ) {\n\t\t\topts.unshift( {\n\t\t\t\tvalue: parentPostId,\n\t\t\t\tlabel: parentPostTitle,\n\t\t\t} );\n\t\t}\n\t\treturn opts;\n\t}, [ pageItems, fieldValue, parentPostTitle, parentPostId ] );\n\n\tif ( ! isHierarchical ) {\n\t\treturn null;\n\t}\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {Object} selectedPostId The selected Author.\n\t */\n\tconst handleChange = ( selectedPostId ) => {\n\t\teditPost( { parent: selectedPostId } );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"editor-page-attributes__parent\"\n\t\t\tlabel={ __( 'Parent' ) }\n\t\t\thelp={ __( 'Choose a parent page.' ) }\n\t\t\tvalue={ parentPostId }\n\t\t\toptions={ parentOptions }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleChange }\n\t\t\thideLabelFromVision\n\t\t\tisLoading={ isLoading }\n\t\t/>\n\t);\n}\n\nfunction PostParentToggle( { isOpen, onClick } ) {\n\tconst parentPost = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst parentPostId = getEditedPostAttribute( 'parent' );\n\t\tif ( ! parentPostId ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getEditedPostAttribute( 'type' );\n\t\treturn getEntityRecord( 'postType', postTypeSlug, parentPostId );\n\t}, [] );\n\tconst parentTitle = useMemo(\n\t\t() => ( ! parentPost ? __( 'None' ) : getTitle( parentPost ) ),\n\t\t[ parentPost ]\n\t);\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-parent__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\t// translators: %s: Current post parent.\n\t\t\t\tsprintf( __( 'Change parent: %s' ), parentTitle )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ parentTitle }\n\t\t</Button>\n\t);\n}\n\nexport function ParentRow() {\n\tconst homeUrl = useSelect( ( select ) => {\n\t\t// Site index.\n\t\treturn select( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t?.home;\n\t}, [] );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\treturn (\n\t\t<PostPanelRow label={ __( 'Parent' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"editor-post-parent__panel-dropdown\"\n\t\t\t\tcontentClassName=\"editor-post-parent__panel-dialog\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostParentToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<div className=\"editor-post-parent\">\n\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\ttitle={ __( 'Parent' ) }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: The home URL of the WordPress installation without the scheme. */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Child pages inherit characteristics from their parent, such as URL structure. For instance, if \"Pricing\" is a child of \"Services\", its URL would be %s<wbr />/services<wbr />/pricing.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tfilterURLForDisplay( homeUrl ).replace(\n\t\t\t\t\t\t\t\t\t\t/([/.])/g,\n\t\t\t\t\t\t\t\t\t\t'<wbr />$1'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\twbr: <wbr />,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#page-attributes'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<PageAttributesParent />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n\nexport default PageAttributesParent;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,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;UACxBqH,OAAO,EAAGA;QAAS,CACnB,CAAC,eACF,IAAA5H,WAAA,CAAA6H,IAAA;UAAAzD,QAAA,GACG,IAAA2D,iCAAwB,EACzB,IAAAtB,aAAO,EACN;UACA,IAAAlG,QAAE,EACD,wLACD,CAAC,EACD,IAAAyH,wBAAmB,EAAErB,OAAQ,CAAC,CAACsB,OAAO,CACrC,SAAS,EACT,WACD,CACD,CAAC,EACD;YACCC,GAAG,eAAE,IAAAlI,WAAA,CAAAuF,GAAA,WAAM;UACZ,CACD,CAAC,eACD,IAAAvF,WAAA,CAAAuF,GAAA;YAAAnB,QAAA,EACG,IAAA2D,iCAAwB,EACzB,IAAAxH,QAAE,EACD,mFACD,CAAC,EACD;cACCgE,CAAC,eACA,IAAAvE,WAAA,CAAAuF,GAAA,EAAClG,WAAA,CAAA8I,YAAY;gBACZC,IAAI,EAAG,IAAA7H,QAAE,EACR,yFACD;cAAG,CACH;YAEH,CACD;UAAC,CACC,CAAC;QAAA,CACA,CAAC,eACN,IAAAP,WAAA,CAAAuF,GAAA,EAACpE,oBAAoB,IAAE,CAAC;MAAA,CACpB;IACH,CACH;EAAC,CACW,CAAC;AAEjB;AAAC,IAAAkH,QAAA,GAAAnH,OAAA,CAAAkG,OAAA,GAEcjG,oBAAoB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_coreData","_store","_lockUnlock","_setAsHomepage","_setAsPostsPage","_jsxRuntime","usePostActions","postType","onActionPerformed","context","defaultActions","useSelect","select","getEntityActions","unlock","editorStore","canManageOptions","hasFrontPageTemplate","getEntityRecords","coreStore","templates","per_page","canUser","kind","name","find","template","slug","setAsHomepageAction","useSetAsHomepageAction","setAsPostsPageAction","useSetAsPostsPageAction","shouldShowHomepageActions","registerPostTypeSchema","useDispatch","useEffect","useMemo","actions","push","sort","a","b","id","filter","action","i","length","callback","existingCallback","items","argsObject","_items","RenderModal","ExistingRenderModal","props","jsx"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useSetAsHomepageAction } from './set-as-homepage';\nimport { useSetAsPostsPageAction } from './set-as-posts-page';\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst { canManageOptions, hasFrontPageTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tcanManageOptions: select( coreStore ).canUser( 'update', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'site',\n\t\t\t\t} ),\n\t\t\t\thasFrontPageTemplate: !! templates?.find(\n\t\t\t\t\t( template ) => template?.slug === 'front-page'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst setAsHomepageAction = useSetAsHomepageAction();\n\tconst setAsPostsPageAction = useSetAsPostsPageAction();\n\tconst shouldShowHomepageActions =\n\t\tcanManageOptions && ! hasFrontPageTemplate;\n\n\tconst { registerPostTypeSchema } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeSchema( postType );\n\t}, [ registerPostTypeSchema, postType ] );\n\n\treturn useMemo( () => {\n\t\tlet actions = [ ...defaultActions ];\n\t\tif ( shouldShowHomepageActions ) {\n\t\t\tactions.push( setAsHomepageAction, setAsPostsPageAction );\n\t\t}\n\n\t\t// Ensure \"Move to trash\" is always the last action.\n\t\tactions = actions.sort( ( a, b ) =>\n\t\t\tb.id === 'move-to-trash' ? -1 : 0\n\t\t);\n\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [\n\t\tcontext,\n\t\tdefaultActions,\n\t\tonActionPerformed,\n\t\tsetAsHomepageAction,\n\t\tsetAsPostsPageAction,\n\t\tshouldShowHomepageActions,\n\t] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AAA8D,IAAAO,WAAA,GAAAP,OAAA;AAb9D;AACA;AACA;;AAKA;AACA;AACA;;AAMO,SAASQ,cAAcA,CAAE;EAAEC,QAAQ;EAAEC,iBAAiB;EAAEC;AAAQ,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EACjCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEF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,OAAO,CAAEQ,CAAC,CAAE,CAACO,WAAW;UACpDf,OAAO,CAAEQ,CAAC,CAAE,GAAG;YACd,GAAGR,OAAO,CAAEQ,CAAC,CAAE;YACfO,WAAW,EAAIE,KAAK,IAAM;cACzB,oBACC,IAAAjD,WAAA,CAAAkD,GAAA,EAACF,mBAAmB;gBAAA,GACdC,KAAK;gBACV9C,iBAAiB,EAAK2C,MAAM,IAAM;kBACjC,IAAKG,KAAK,CAAC9C,iBAAiB,EAAG;oBAC9B8C,KAAK,CAAC9C,iBAAiB,CAAE2C,MAAO,CAAC;kBAClC;kBACA3C,iBAAiB,CAChB6B,OAAO,CAAEQ,CAAC,CAAE,CAACH,EAAE,EACfS,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOd,OAAO;EACf,CAAC,EAAE,CACF5B,OAAO,EACPC,cAAc,EACdF,iBAAiB,EACjBoB,mBAAmB,EACnBE,oBAAoB,EACpBE,yBAAyB,CACxB,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_coreData","_store","_lockUnlock","_setAsHomepage","_setAsPostsPage","_jsxRuntime","usePostActions","postType","onActionPerformed","context","defaultActions","useSelect","select","getEntityActions","unlock","editorStore","canManageOptions","hasFrontPageTemplate","getEntityRecords","coreStore","templates","per_page","canUser","kind","name","find","template","slug","setAsHomepageAction","useSetAsHomepageAction","setAsPostsPageAction","useSetAsPostsPageAction","shouldShowHomepageActions","registerPostTypeSchema","useDispatch","useEffect","useMemo","actions","push","sort","a","b","id","filter","action","i","length","callback","existingCallback","items","argsObject","_items","RenderModal","ExistingRenderModal","props","jsx"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useSetAsHomepageAction } from './set-as-homepage';\nimport { useSetAsPostsPageAction } from './set-as-posts-page';\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst { canManageOptions, hasFrontPageTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tcanManageOptions: select( coreStore ).canUser( 'update', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'site',\n\t\t\t\t} ),\n\t\t\t\thasFrontPageTemplate: !! templates?.find(\n\t\t\t\t\t( template ) => template?.slug === 'front-page'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst setAsHomepageAction = useSetAsHomepageAction();\n\tconst setAsPostsPageAction = useSetAsPostsPageAction();\n\tconst shouldShowHomepageActions =\n\t\tcanManageOptions && ! hasFrontPageTemplate;\n\n\tconst { registerPostTypeSchema } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeSchema( postType );\n\t}, [ registerPostTypeSchema, postType ] );\n\n\treturn useMemo( () => {\n\t\tlet actions = [ ...defaultActions ];\n\t\tif ( shouldShowHomepageActions ) {\n\t\t\tactions.push( setAsHomepageAction, setAsPostsPageAction );\n\t\t}\n\n\t\t// Ensure \"Move to trash\" is always the last action.\n\t\tactions = actions.sort( ( a, b ) =>\n\t\t\tb.id === 'move-to-trash' ? -1 : 0\n\t\t);\n\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [\n\t\tcontext,\n\t\tdefaultActions,\n\t\tonActionPerformed,\n\t\tsetAsHomepageAction,\n\t\tsetAsPostsPageAction,\n\t\tshouldShowHomepageActions,\n\t] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AAA8D,IAAAO,WAAA,GAAAP,OAAA;AAb9D;AACA;AACA;;AAKA;AACA;AACA;;AAMO,SAASQ,cAAcA,CAAE;EAAEC,QAAQ;EAAEC,iBAAiB;EAAEC;AAAQ,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EACjCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEF,MAAM,CAAEG,YAAY,CAAE,CAAC;IAC5D,OAAO;MACNL,cAAc,EAAEG,gBAAgB,CAAE,UAAU,EAAEN,QAAS;IACxD,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EAED,MAAM;IAAES,gBAAgB;IAAEC;EAAqB,CAAC,GAAG,IAAAN,eAAS,EACzDC,MAAM,IAAM;IACb,MAAM;MAA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AAM,IAAM;kBACjC,IAAKG,KAAK,CAAC9C,iBAAiB,EAAG;oBAC9B8C,KAAK,CAAC9C,iBAAiB,CAAE2C,MAAO,CAAC;kBAClC;kBACA3C,iBAAiB,CAChB6B,OAAO,CAAEQ,CAAC,CAAE,CAACH,EAAE,EACfS,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOd,OAAO;EACf,CAAC,EAAE,CACF5B,OAAO,EACPC,cAAc,EACdF,iBAAiB,EACjBoB,mBAAmB,EACnBE,oBAAoB,EACpBE,yBAAyB,CACxB,CAAC;AACJ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  "use strict";
3
2
 
4
3
  Object.defineProperty(exports, "__esModule", {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","Menu","kebabCase","unlock","componentsPrivateApis","useEditedEntityRecordsWithPermissions","postType","postIds","items","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","map","postId","useMemo","item","index","PostActions","onActionPerformed","activeModalAction","setActiveModalAction","useState","_postIds","Array","isArray","itemsWithPermissions","allActions","usePostActions","actions","filter","action","isEligible","some","itemWithPermissions","length","supportsBulk","jsxs","Fragment","children","placement","jsx","TriggerButton","render","Button","size","icon","moreVertical","label","__","disabled","accessibleWhenDisabled","className","Popover","ActionsDropdownMenuGroup","ActionModal","closeModal","DropdownMenuItemTrigger","onClick","Item","ItemLabel","Modal","title","modalHeader","__experimentalHideHeader","hideModalHeader","onRequestClose","focusOnMount","overlayClassName","id","RenderModal","registry","useRegistry","Group","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nfunction useEditedEntityRecordsWithPermissions( postType, postIds ) {\n\tconst { items, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titems: postIds.map( ( postId ) =>\n\t\t\t\t\tgetEditedEntityRecord( 'postType', postType, postId )\n\t\t\t\t),\n\t\t\t\tpermissions: postIds.map( ( postId ) =>\n\t\t\t\t\tgetEntityRecordPermissions( 'postType', postType, postId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\treturn useMemo( () => {\n\t\treturn items.map( ( item, index ) => ( {\n\t\t\t...item,\n\t\t\tpermissions: permissions[ index ],\n\t\t} ) );\n\t}, [ items, permissions ] );\n}\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState( null );\n\tconst _postIds = useMemo( () => {\n\t\tif ( Array.isArray( postId ) ) {\n\t\t\treturn postId;\n\t\t}\n\t\treturn postId ? [ postId ] : [];\n\t}, [ postId ] );\n\n\tconst itemsWithPermissions = useEditedEntityRecordsWithPermissions(\n\t\tpostType,\n\t\t_postIds\n\t);\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t( ! action.isEligible ||\n\t\t\t\t\titemsWithPermissions.some( ( itemWithPermissions ) =>\n\t\t\t\t\t\taction.isEligible( itemWithPermissions )\n\t\t\t\t\t) ) &&\n\t\t\t\t( itemsWithPermissions.length < 2 || action.supportsBulk )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemsWithPermissions ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\titems={ itemsWithPermissions }\n\t\t\t\t\t\tsetActiveModalAction={ setActiveModalAction }\n\t\t\t\t\t/>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ itemsWithPermissions }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item onClick={ onClick }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\nexport function ActionModal( { action, items, closeModal } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ action.modalHeader || label }\n\t\t\t__experimentalHideHeader={ !! action.hideModalHeader }\n\t\t\tonRequestClose={ closeModal ?? ( () => {} ) }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\taction.id\n\t\t\t) }` }\n\t\t>\n\t\t\t<action.RenderModal items={ items } closeModal={ closeModal } />\n\t\t</Modal>\n\t);\n}\n\nfunction ActionsDropdownMenuGroup( { actions, items, setActiveModalAction } ) {\n\tconst registry = useRegistry();\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taction.callback( items, { registry } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\titems={ items }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Menu.Group>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAlB3C;AACA;AACA;;AAYA;AACA;AACA;;AAIA,MAAM;EAAES,IAAI;EAAEC;AAAU,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAE3D,SA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AAU,GAAM,MAAM,CAAC,CAAK;IAC7CW,YAAY,EAAC,qBAAqB;IAClCtB,IAAI,EAAC,QAAQ;IACbuB,gBAAgB,EAAG,4CAA6CpE,SAAS,CACxE+B,MAAM,CAACsC,EACR,CAAC,EAAK;IAAA9B,QAAA,eAEN,IAAAzC,WAAA,CAAA2C,GAAA,EAACV,MAAM,CAACuC,WAAW;MAAChE,KAAK,EAAGA,KAAO;MAACkD,UAAU,EAAGA;IAAY,CAAE;EAAC,CAC1D,CAAC;AAEV;AAEA,SAASF,wBAAwBA,CAAE;EAAEzB,OAAO;EAAEvB,KAAK;EAAEe;AAAqB,CAAC,EAAG;EAC7E,MAAMkD,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,oBACC,IAAA1E,WAAA,CAAA2C,GAAA,EAAC1C,IAAI,CAAC0E,KAAK;IAAAlC,QAAA,EACRV,OAAO,CAAChB,GAAG,CAAIkB,MAAM,IAAM;MAC5B,oBACC,IAAAjC,WAAA,CAAA2C,GAAA,EAACgB,uBAAuB;QAEvB1B,MAAM,EAAGA,MAAQ;QACjB2B,OAAO,EAAGA,CAAA,KAAM;UACf,IAAK,aAAa,IAAI3B,MAAM,EAAG;YAC9BV,oBAAoB,CAAEU,MAAO,CAAC;YAC9B;UACD;UACAA,MAAM,CAAC2C,QAAQ,CAAEpE,KAAK,EAAE;YAAEiE;UAAS,CAAE,CAAC;QACvC,CAAG;QACHjE,KAAK,EAAGA;MAAO,GATTyB,MAAM,CAACsC,EAUb,CAAC;IAEJ,CAAE;EAAC,CACQ,CAAC;AAEf","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","Menu","kebabCase","unlock","componentsPrivateApis","useEditedEntityRecordsWithPermissions","postType","postIds","items","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","map","postId","useMemo","item","index","PostActions","onActionPerformed","activeModalAction","setActiveModalAction","useState","_postIds","Array","isArray","itemsWithPermissions","allActions","usePostActions","actions","filter","action","isEligible","some","itemWithPermissions","length","supportsBulk","jsxs","Fragment","children","placement","jsx","TriggerButton","render","Button","size","icon","moreVertical","label","__","disabled","accessibleWhenDisabled","className","Popover","ActionsDropdownMenuGroup","ActionModal","closeModal","DropdownMenuItemTrigger","onClick","Item","ItemLabel","Modal","title","modalHeader","__experimentalHideHeader","hideModalHeader","onRequestClose","focusOnMount","overlayClassName","id","RenderModal","registry","useRegistry","Group","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst { Menu, kebabCase } = unlock( componentsPrivateApis );\n\nfunction useEditedEntityRecordsWithPermissions( postType, postIds ) {\n\tconst { items, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titems: postIds.map( ( postId ) =>\n\t\t\t\t\tgetEditedEntityRecord( 'postType', postType, postId )\n\t\t\t\t),\n\t\t\t\tpermissions: postIds.map( ( postId ) =>\n\t\t\t\t\tgetEntityRecordPermissions( 'postType', postType, postId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postIds, postType ]\n\t);\n\n\treturn useMemo( () => {\n\t\treturn items.map( ( item, index ) => ( {\n\t\t\t...item,\n\t\t\tpermissions: permissions[ index ],\n\t\t} ) );\n\t}, [ items, permissions ] );\n}\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ activeModalAction, setActiveModalAction ] = useState( null );\n\tconst _postIds = useMemo( () => {\n\t\tif ( Array.isArray( postId ) ) {\n\t\t\treturn postId;\n\t\t}\n\t\treturn postId ? [ postId ] : [];\n\t}, [ postId ] );\n\n\tconst itemsWithPermissions = useEditedEntityRecordsWithPermissions(\n\t\tpostType,\n\t\t_postIds\n\t);\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t( ! action.isEligible ||\n\t\t\t\t\titemsWithPermissions.some( ( itemWithPermissions ) =>\n\t\t\t\t\t\taction.isEligible( itemWithPermissions )\n\t\t\t\t\t) ) &&\n\t\t\t\t( itemsWithPermissions.length < 2 || action.supportsBulk )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemsWithPermissions ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover>\n\t\t\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\t\t\tactions={ actions }\n\t\t\t\t\t\titems={ itemsWithPermissions }\n\t\t\t\t\t\tsetActiveModalAction={ setActiveModalAction }\n\t\t\t\t\t/>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t\t{ !! activeModalAction && (\n\t\t\t\t<ActionModal\n\t\t\t\t\taction={ activeModalAction }\n\t\t\t\t\titems={ itemsWithPermissions }\n\t\t\t\t\tcloseModal={ () => setActiveModalAction( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Menu.Item onClick={ onClick }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\nexport function ActionModal( { action, items, closeModal } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ action.modalHeader || label }\n\t\t\t__experimentalHideHeader={ !! action.hideModalHeader }\n\t\t\tonRequestClose={ closeModal ?? ( () => {} ) }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\taction.id\n\t\t\t) }` }\n\t\t>\n\t\t\t<action.RenderModal items={ items } closeModal={ closeModal } />\n\t\t</Modal>\n\t);\n}\n\nfunction ActionsDropdownMenuGroup( { actions, items, setActiveModalAction } ) {\n\tconst registry = useRegistry();\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( 'RenderModal' in action ) {\n\t\t\t\t\t\t\t\tsetActiveModalAction( action );\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taction.callback( items, { registry } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\titems={ items }\n\t\t\t\t\t/>\n\t\t\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AG;YAC9BV,oBAAoB,CAAEU,MAAO,CAAC;YAC9B;UACD;UACAA,MAAM,CAAC2C,QAAQ,CAAEpE,KAAK,EAAE;YAAEiE;UAAS,CAAE,CAAC;QACvC,CAAG;QACHjE,KAAK,EAAGA;MAAO,GATTyB,MAAM,CAACsC,EAUb,CAAC;IAEJ,CAAE;EAAC,CACQ,CAAC;AAEf","ignoreList":[]}
@@ -34,12 +34,11 @@ var _jsxRuntime = require("react/jsx-runtime");
34
34
  hasAssignAuthorAction,
35
35
  hasAuthors
36
36
  } = (0, _data.useSelect)(select => {
37
- var _post$_links$wpActio;
38
37
  const post = select(_store.store).getCurrentPost();
39
- const authors = select(_coreData.store).getUsers(_constants.AUTHORS_QUERY);
38
+ const canAssignAuthor = post?._links?.['wp:action-assign-author'] ? true : false;
40
39
  return {
41
- hasAssignAuthorAction: (_post$_links$wpActio = post._links?.['wp:action-assign-author']) !== null && _post$_links$wpActio !== void 0 ? _post$_links$wpActio : false,
42
- hasAuthors: authors?.length >= 1
40
+ hasAssignAuthorAction: canAssignAuthor,
41
+ hasAuthors: canAssignAuthor ? select(_coreData.store).getUsers(_constants.AUTHORS_QUERY)?.length >= 1 : false
43
42
  };
44
43
  }, []);
45
44
  if (!hasAssignAuthorAction || !hasAuthors) {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_postTypeSupportCheck","_interopRequireDefault","_store","_constants","_jsxRuntime","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","useSelect","select","_post$_links$wpActio","post","editorStore","getCurrentPost","authors","coreStore","getUsers","AUTHORS_QUERY","_links","length","jsx","default","supportKeys"],"sources":["@wordpress/editor/src/components/post-author/check.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 PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\n/**\n * Wrapper component that renders its children only if the post type supports the author.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The component to be rendered. Return `null` if the post type doesn't\n * supports the author or if there are no authors available.\n */\nexport default function PostAuthorCheck( { children } ) {\n\tconst { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst authors = select( coreStore ).getUsers( AUTHORS_QUERY );\n\t\treturn {\n\t\t\thasAssignAuthorAction:\n\t\t\t\tpost._links?.[ 'wp:action-assign-author' ] ?? false,\n\t\t\thasAuthors: authors?.length >= 1,\n\t\t};\n\t}, [] );\n\n\tif ( ! hasAssignAuthorAction || ! hasAuthors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"author\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAAA;AAX5C;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASO,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,qBAAqB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,oBAAA;IACtE,MAAMC,IAAI,GAAGF,MAAM,CAAEG,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;IACnD,MAAMC,OAAO,GAAGL,MAAM,CAAEM,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc,CAAC;IAC7D,OAAO;MACNX,qBAAqB,GAAAI,oBAAA,GACpBC,IAAI,CAACO,MAAM,GAAI,yBAAyB,CAAE,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,KAAK;MACpDH,UAAU,EAAEO,OAAO,EAAEK,MAAM,IAAI;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEb,qBAAqB,IAAI,CAAEC,UAAU,EAAG;IAC9C,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAJ,WAAA,CAAAiB,GAAA,EAACrB,qBAAA,CAAAsB,OAAoB;IAACC,WAAW,EAAC,QAAQ;IAAAjB,QAAA,EACvCA;EAAQ,CACW,CAAC;AAEzB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_postTypeSupportCheck","_interopRequireDefault","_store","_constants","_jsxRuntime","PostAuthorCheck","children","hasAssignAuthorAction","hasAuthors","useSelect","select","post","editorStore","getCurrentPost","canAssignAuthor","_links","coreStore","getUsers","AUTHORS_QUERY","length","jsx","default","supportKeys"],"sources":["@wordpress/editor/src/components/post-author/check.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 PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY } from './constants';\n\n/**\n * Wrapper component that renders its children only if the post type supports the author.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children Children to be rendered.\n *\n * @return {React.ReactNode} The component to be rendered. Return `null` if the post type doesn't\n * supports the author or if there are no authors available.\n */\nexport default function PostAuthorCheck( { children } ) {\n\tconst { hasAssignAuthorAction, hasAuthors } = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst canAssignAuthor = post?._links?.[ 'wp:action-assign-author' ]\n\t\t\t? true\n\t\t\t: false;\n\t\treturn {\n\t\t\thasAssignAuthorAction: canAssignAuthor,\n\t\t\thasAuthors: canAssignAuthor\n\t\t\t\t? select( coreStore ).getUsers( AUTHORS_QUERY )?.length >= 1\n\t\t\t\t: false,\n\t\t};\n\t}, [] );\n\n\tif ( ! hasAssignAuthorAction || ! hasAuthors ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"author\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAAA;AAX5C;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASO,eAAeA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,qBAAqB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACtE,MAAMC,IAAI,GAAGD,MAAM,CAAEE,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC;IACnD,MAAMC,eAAe,GAAGH,IAAI,EAAEI,MAAM,GAAI,yBAAyB,CAAE,GAChE,IAAI,GACJ,KAAK;IACR,OAAO;MACNR,qBAAqB,EAAEO,eAAe;MACtCN,UAAU,EAAEM,eAAe,GACxBJ,MAAM,CAAEM,eAAU,CAAC,CAACC,QAAQ,CAAEC,wBAAc,CAAC,EAAEC,MAAM,IAAI,CAAC,GAC1D;IACJ,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEZ,qBAAqB,IAAI,CAAEC,UAAU,EAAG;IAC9C,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAJ,WAAA,CAAAgB,GAAA,EAACpB,qBAAA,CAAAqB,OAAoB;IAACC,WAAW,EAAC,QAAQ;IAAAhB,QAAA,EACvCA;EAAQ,CACW,CAAC;AAEzB","ignoreList":[]}
@@ -27,7 +27,8 @@ function PostAuthorCombobox() {
27
27
  } = (0, _data.useDispatch)(_store.store);
28
28
  const {
29
29
  authorId,
30
- authorOptions
30
+ authorOptions,
31
+ isLoading
31
32
  } = (0, _hook.useAuthorsQuery)(fieldValue);
32
33
 
33
34
  /**
@@ -61,7 +62,8 @@ function PostAuthorCombobox() {
61
62
  onFilterValueChange: (0, _compose.debounce)(handleKeydown, 300),
62
63
  onChange: handleSelect,
63
64
  allowReset: false,
64
- hideLabelFromVision: true
65
+ hideLabelFromVision: true,
66
+ isLoading: isLoading
65
67
  });
66
68
  }
67
69
  //# sourceMappingURL=combobox.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_element","_data","_i18n","_components","_store","_hook","_jsxRuntime","PostAuthorCombobox","fieldValue","setFieldValue","useState","editPost","useDispatch","editorStore","authorId","authorOptions","useAuthorsQuery","handleSelect","postAuthorId","author","handleKeydown","inputValue","jsx","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","__","options","value","onFilterValueChange","debounce","onChange","allowReset","hideLabelFromVision"],"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { useAuthorsQuery } from './hook';\n\nexport default function PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { authorId, authorOptions } = useAuthorsQuery( fieldValue );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tallowReset={ false }\n\t\t\thideLabelFromVision\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAAyC,IAAAO,WAAA,GAAAP,OAAA;AAbzC;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASQ,kBAAkBA,CAAA,EAAG;EAC5C,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAG,IAAAC,iBAAQ,EAAC,CAAC;EAEhD,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/C,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,qBAAe,EAAER,UAAW,CAAC;;EAEjE;AACD;AACA;AACA;AACA;EACC,MAAMS,YAAY,GAAKC,YAAY,IAAM;IACxC,IAAK,CAAEA,YAAY,EAAG;MACrB;IACD;IACAP,QAAQ,CAAE;MAAEQ,MAAM,EAAED;IAAa,CAAE,CAAC;EACrC,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAME,aAAa,GAAKC,UAAU,IAAM;IACvCZ,aAAa,CAAEY,UAAW,CAAC;EAC5B,CAAC;EAED,oBACC,IAAAf,WAAA,CAAAgB,GAAA,EAACnB,WAAA,CAAAoB,eAAe;IACfC,uBAAuB;IACvBC,qBAAqB;IACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IACxBC,OAAO,EAAGb,aAAe;IACzBc,KAAK,EAAGf,QAAU;IAClBgB,mBAAmB,EAAG,IAAAC,iBAAQ,EAAEX,aAAa,EAAE,GAAI,CAAG;IACtDY,QAAQ,EAAGf,YAAc;IACzBgB,UAAU,EAAG,KAAO;IACpBC,mBAAmB;EAAA,CACnB,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_compose","require","_element","_data","_i18n","_components","_store","_hook","_jsxRuntime","PostAuthorCombobox","fieldValue","setFieldValue","useState","editPost","useDispatch","editorStore","authorId","authorOptions","isLoading","useAuthorsQuery","handleSelect","postAuthorId","author","handleKeydown","inputValue","jsx","ComboboxControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","__","options","value","onFilterValueChange","debounce","onChange","allowReset","hideLabelFromVision"],"sources":["@wordpress/editor/src/components/post-author/combobox.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComboboxControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { useAuthorsQuery } from './hook';\n\nexport default function PostAuthorCombobox() {\n\tconst [ fieldValue, setFieldValue ] = useState();\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { authorId, authorOptions, isLoading } =\n\t\tuseAuthorsQuery( fieldValue );\n\n\t/**\n\t * Handle author selection.\n\t *\n\t * @param {number} postAuthorId The selected Author.\n\t */\n\tconst handleSelect = ( postAuthorId ) => {\n\t\tif ( ! postAuthorId ) {\n\t\t\treturn;\n\t\t}\n\t\teditPost( { author: postAuthorId } );\n\t};\n\n\t/**\n\t * Handle user input.\n\t *\n\t * @param {string} inputValue The current value of the input field.\n\t */\n\tconst handleKeydown = ( inputValue ) => {\n\t\tsetFieldValue( inputValue );\n\t};\n\n\treturn (\n\t\t<ComboboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Author' ) }\n\t\t\toptions={ authorOptions }\n\t\t\tvalue={ authorId }\n\t\t\tonFilterValueChange={ debounce( handleKeydown, 300 ) }\n\t\t\tonChange={ handleSelect }\n\t\t\tallowReset={ false }\n\t\t\thideLabelFromVision\n\t\t\tisLoading={ isLoading }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAAyC,IAAAO,WAAA,GAAAP,OAAA;AAbzC;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASQ,kBAAkBA,CAAA,EAAG;EAC5C,MAAM,CAAEC,UAAU,EAAEC,aAAa,CAAE,GAAG,IAAAC,iBAAQ,EAAC,CAAC;EAEhD,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAY,CAAC;EAC/C,MAAM;IAAEC,QAAQ;IAAEC,aAAa;IAAEC;EAAU,CAAC,GAC3C,IAAAC,qBAAe,EAAET,UAAW,CAAC;;EAE9B;AACD;AACA;AACA;AACA;EACC,MAAMU,YAAY,GAAKC,YAAY,IAAM;IACxC,IAAK,CAAEA,YAAY,EAAG;MACrB;IACD;IACAR,QAAQ,CAAE;MAAES,MAAM,EAAED;IAAa,CAAE,CAAC;EACrC,CAAC;;EAED;A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