@wordpress/editor 14.9.0 → 14.11.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 (518) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/build/bindings/api.js +0 -29
  4. package/build/bindings/api.js.map +1 -1
  5. package/build/bindings/post-meta.js +2 -1
  6. package/build/bindings/post-meta.js.map +1 -1
  7. package/build/components/autocompleters/user.js.map +1 -1
  8. package/build/components/block-manager/index.js +2 -2
  9. package/build/components/block-manager/index.js.map +1 -1
  10. package/build/components/collab-sidebar/add-comment.js +120 -0
  11. package/build/components/collab-sidebar/add-comment.js.map +1 -0
  12. package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
  13. package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
  14. package/build/components/collab-sidebar/comment-button.js +37 -0
  15. package/build/components/collab-sidebar/comment-button.js.map +1 -0
  16. package/build/components/collab-sidebar/comments.js +321 -0
  17. package/build/components/collab-sidebar/comments.js.map +1 -0
  18. package/build/components/collab-sidebar/constants.js +8 -0
  19. package/build/components/collab-sidebar/constants.js.map +1 -0
  20. package/build/components/collab-sidebar/index.js +272 -0
  21. package/build/components/collab-sidebar/index.js.map +1 -0
  22. package/build/components/collab-sidebar/utils.js +16 -0
  23. package/build/components/collab-sidebar/utils.js.map +1 -0
  24. package/build/components/commands/index.js +6 -6
  25. package/build/components/commands/index.js.map +1 -1
  26. package/build/components/create-template-part-modal/index.js.map +1 -1
  27. package/build/components/create-template-part-modal/utils.js.map +1 -1
  28. package/build/components/document-bar/index.js +8 -7
  29. package/build/components/document-bar/index.js.map +1 -1
  30. package/build/components/document-outline/index.js.map +1 -1
  31. package/build/components/document-outline/item.js.map +1 -1
  32. package/build/components/document-tools/index.js +2 -6
  33. package/build/components/document-tools/index.js.map +1 -1
  34. package/build/components/editor-interface/index.js +4 -14
  35. package/build/components/editor-interface/index.js.map +1 -1
  36. package/build/components/entities-saved-states/index.js +2 -2
  37. package/build/components/entities-saved-states/index.js.map +1 -1
  38. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  39. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  40. package/build/components/global-styles-provider/index.js +13 -3
  41. package/build/components/global-styles-provider/index.js.map +1 -1
  42. package/build/components/header/index.js +5 -2
  43. package/build/components/header/index.js.map +1 -1
  44. package/build/components/inserter-sidebar/index.js +2 -2
  45. package/build/components/inserter-sidebar/index.js.map +1 -1
  46. package/build/components/media-categories/index.js.map +1 -1
  47. package/build/components/page-attributes/parent.js +5 -5
  48. package/build/components/page-attributes/parent.js.map +1 -1
  49. package/build/components/plugin-document-setting-panel/index.js.map +1 -1
  50. package/build/components/plugin-more-menu-item/index.js +13 -11
  51. package/build/components/plugin-more-menu-item/index.js.map +1 -1
  52. package/build/components/plugin-preview-menu-item/index.js +15 -13
  53. package/build/components/plugin-preview-menu-item/index.js.map +1 -1
  54. package/build/components/plugin-sidebar/index.js +0 -15
  55. package/build/components/plugin-sidebar/index.js.map +1 -1
  56. package/build/components/post-actions/index.js +5 -5
  57. package/build/components/post-actions/index.js.map +1 -1
  58. package/build/components/post-author/panel.js +4 -4
  59. package/build/components/post-author/panel.js.map +1 -1
  60. package/build/components/post-card-panel/index.js +7 -36
  61. package/build/components/post-card-panel/index.js.map +1 -1
  62. package/build/components/post-content-information/index.js +2 -3
  63. package/build/components/post-content-information/index.js.map +1 -1
  64. package/build/components/post-featured-image/index.js +26 -7
  65. package/build/components/post-featured-image/index.js.map +1 -1
  66. package/build/components/post-format/index.js +1 -1
  67. package/build/components/post-format/index.js.map +1 -1
  68. package/build/components/post-last-revision/index.js +1 -1
  69. package/build/components/post-last-revision/index.js.map +1 -1
  70. package/build/components/post-locked-modal/index.js +2 -2
  71. package/build/components/post-locked-modal/index.js.map +1 -1
  72. package/build/components/post-preview-button/index.js +1 -1
  73. package/build/components/post-preview-button/index.js.map +1 -1
  74. package/build/components/post-publish-button/index.js.map +1 -1
  75. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  76. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  77. package/build/components/post-publish-panel/maybe-upload-media.js +1 -0
  78. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  79. package/build/components/post-publish-panel/media-util.js +1 -0
  80. package/build/components/post-publish-panel/media-util.js.map +1 -1
  81. package/build/components/post-publish-panel/postpublish.js +1 -1
  82. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  83. package/build/components/post-schedule/label.js +1 -1
  84. package/build/components/post-schedule/label.js.map +1 -1
  85. package/build/components/post-taxonomies/flat-term-selector.js +13 -5
  86. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  87. package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  88. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  89. package/build/components/post-taxonomies/index.js +1 -1
  90. package/build/components/post-taxonomies/index.js.map +1 -1
  91. package/build/components/post-taxonomies/panel.js.map +1 -1
  92. package/build/components/post-template/classic-theme.js +2 -4
  93. package/build/components/post-template/classic-theme.js.map +1 -1
  94. package/build/components/post-text-editor/index.js.map +1 -1
  95. package/build/components/post-title/index.js +15 -19
  96. package/build/components/post-title/index.js.map +1 -1
  97. package/build/components/post-title/index.native.js +2 -2
  98. package/build/components/post-title/index.native.js.map +1 -1
  99. package/build/components/post-url/index.js +76 -63
  100. package/build/components/post-url/index.js.map +1 -1
  101. package/build/components/post-url/panel.js +49 -29
  102. package/build/components/post-url/panel.js.map +1 -1
  103. package/build/components/post-visibility/index.js.map +1 -1
  104. package/build/components/preferences-modal/index.js.map +1 -1
  105. package/build/components/preview-dropdown/index.js +0 -4
  106. package/build/components/preview-dropdown/index.js.map +1 -1
  107. package/build/components/provider/index.js +10 -12
  108. package/build/components/provider/index.js.map +1 -1
  109. package/build/components/provider/use-block-editor-settings.js +1 -1
  110. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  111. package/build/components/resizable-editor/resize-handle.js.map +1 -1
  112. package/build/components/sidebar/header.js +2 -1
  113. package/build/components/sidebar/header.js.map +1 -1
  114. package/build/components/sidebar/index.js +3 -3
  115. package/build/components/sidebar/index.js.map +1 -1
  116. package/build/components/time-to-read/index.js +2 -2
  117. package/build/components/time-to-read/index.js.map +1 -1
  118. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -1
  119. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  120. package/build/components/visual-editor/index.js +24 -25
  121. package/build/components/visual-editor/index.js.map +1 -1
  122. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  123. package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
  124. package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
  125. package/build/components/zoom-out-toggle/index.js +37 -5
  126. package/build/components/zoom-out-toggle/index.js.map +1 -1
  127. package/build/dataviews/actions/duplicate-template-part.js +3 -3
  128. package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
  129. package/build/private-apis.js +0 -1
  130. package/build/private-apis.js.map +1 -1
  131. package/build/store/actions.js +30 -4
  132. package/build/store/actions.js.map +1 -1
  133. package/build/store/constants.js +1 -0
  134. package/build/store/constants.js.map +1 -1
  135. package/build/store/local-autosave.js.map +1 -1
  136. package/build/store/private-actions.js +8 -7
  137. package/build/store/private-actions.js.map +1 -1
  138. package/build/store/selectors.js +24 -2
  139. package/build/store/selectors.js.map +1 -1
  140. package/build/utils/media-upload/index.js.map +1 -1
  141. package/build/utils/pageTypeBadge.js +51 -0
  142. package/build/utils/pageTypeBadge.js.map +1 -0
  143. package/build/utils/terms.js +2 -2
  144. package/build/utils/terms.js.map +1 -1
  145. package/build-module/bindings/api.js +1 -29
  146. package/build-module/bindings/api.js.map +1 -1
  147. package/build-module/bindings/post-meta.js +2 -1
  148. package/build-module/bindings/post-meta.js.map +1 -1
  149. package/build-module/components/autocompleters/user.js +1 -3
  150. package/build-module/components/autocompleters/user.js.map +1 -1
  151. package/build-module/components/block-manager/category.js +1 -2
  152. package/build-module/components/block-manager/category.js.map +1 -1
  153. package/build-module/components/block-manager/checklist.js +1 -2
  154. package/build-module/components/block-manager/checklist.js.map +1 -1
  155. package/build-module/components/block-manager/index.js +3 -4
  156. package/build-module/components/block-manager/index.js.map +1 -1
  157. package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -3
  158. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  159. package/build-module/components/blog-title/index.js +1 -3
  160. package/build-module/components/blog-title/index.js.map +1 -1
  161. package/build-module/components/collab-sidebar/add-comment.js +114 -0
  162. package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
  163. package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
  164. package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
  165. package/build-module/components/collab-sidebar/comment-button.js +30 -0
  166. package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
  167. package/build-module/components/collab-sidebar/comments.js +314 -0
  168. package/build-module/components/collab-sidebar/comments.js.map +1 -0
  169. package/build-module/components/collab-sidebar/constants.js +2 -0
  170. package/build-module/components/collab-sidebar/constants.js.map +1 -0
  171. package/build-module/components/collab-sidebar/index.js +264 -0
  172. package/build-module/components/collab-sidebar/index.js.map +1 -0
  173. package/build-module/components/collab-sidebar/utils.js +10 -0
  174. package/build-module/components/collab-sidebar/utils.js.map +1 -0
  175. package/build-module/components/collapsible-block-toolbar/index.js +1 -3
  176. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  177. package/build-module/components/commands/index.js +6 -6
  178. package/build-module/components/commands/index.js.map +1 -1
  179. package/build-module/components/create-template-part-modal/index.js +1 -2
  180. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  181. package/build-module/components/create-template-part-modal/utils.js.map +1 -1
  182. package/build-module/components/document-bar/index.js +10 -10
  183. package/build-module/components/document-bar/index.js.map +1 -1
  184. package/build-module/components/document-outline/index.js +1 -2
  185. package/build-module/components/document-outline/index.js.map +1 -1
  186. package/build-module/components/document-outline/item.js +1 -2
  187. package/build-module/components/document-outline/item.js.map +1 -1
  188. package/build-module/components/document-tools/index.js +4 -10
  189. package/build-module/components/document-tools/index.js.map +1 -1
  190. package/build-module/components/editor/index.js +1 -3
  191. package/build-module/components/editor/index.js.map +1 -1
  192. package/build-module/components/editor-help/add-blocks.native.js +1 -3
  193. package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
  194. package/build-module/components/editor-help/customize-blocks.native.js +1 -3
  195. package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
  196. package/build-module/components/editor-help/help-detail-navigation-screen.native.js +1 -2
  197. package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
  198. package/build-module/components/editor-help/index.native.js +1 -3
  199. package/build-module/components/editor-help/index.native.js.map +1 -1
  200. package/build-module/components/editor-help/intro-to-blocks.native.js +1 -3
  201. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  202. package/build-module/components/editor-help/move-blocks.native.js +1 -3
  203. package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
  204. package/build-module/components/editor-help/remove-blocks.native.js +1 -3
  205. package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
  206. package/build-module/components/editor-help/view-sections.native.js +1 -2
  207. package/build-module/components/editor-help/view-sections.native.js.map +1 -1
  208. package/build-module/components/editor-interface/index.js +5 -17
  209. package/build-module/components/editor-interface/index.js.map +1 -1
  210. package/build-module/components/editor-notices/index.js +1 -3
  211. package/build-module/components/editor-notices/index.js.map +1 -1
  212. package/build-module/components/entities-saved-states/entity-record-item.js +1 -3
  213. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  214. package/build-module/components/entities-saved-states/entity-type-list.js +1 -2
  215. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  216. package/build-module/components/entities-saved-states/index.js +3 -4
  217. package/build-module/components/entities-saved-states/index.js.map +1 -1
  218. package/build-module/components/error-boundary/index.native.js +1 -2
  219. package/build-module/components/error-boundary/index.native.js.map +1 -1
  220. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  221. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  222. package/build-module/components/global-styles-provider/index.js +13 -3
  223. package/build-module/components/global-styles-provider/index.js.map +1 -1
  224. package/build-module/components/header/index.js +6 -4
  225. package/build-module/components/header/index.js.map +1 -1
  226. package/build-module/components/inserter-sidebar/index.js +2 -2
  227. package/build-module/components/inserter-sidebar/index.js.map +1 -1
  228. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
  229. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  230. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
  231. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  232. package/build-module/components/list-view-sidebar/list-view-outline.js +1 -3
  233. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
  234. package/build-module/components/media-categories/index.js.map +1 -1
  235. package/build-module/components/more-menu/index.js +1 -3
  236. package/build-module/components/more-menu/index.js.map +1 -1
  237. package/build-module/components/offline-status/index.native.js +1 -2
  238. package/build-module/components/offline-status/index.native.js.map +1 -1
  239. package/build-module/components/page-attributes/parent.js +6 -7
  240. package/build-module/components/page-attributes/parent.js.map +1 -1
  241. package/build-module/components/plugin-document-setting-panel/index.js +1 -3
  242. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
  243. package/build-module/components/plugin-more-menu-item/index.js +12 -10
  244. package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
  245. package/build-module/components/plugin-preview-menu-item/index.js +14 -12
  246. package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
  247. package/build-module/components/plugin-sidebar/index.js +0 -15
  248. package/build-module/components/plugin-sidebar/index.js.map +1 -1
  249. package/build-module/components/post-actions/index.js +6 -8
  250. package/build-module/components/post-actions/index.js.map +1 -1
  251. package/build-module/components/post-author/panel.js +5 -6
  252. package/build-module/components/post-author/panel.js.map +1 -1
  253. package/build-module/components/post-card-panel/index.js +9 -38
  254. package/build-module/components/post-card-panel/index.js.map +1 -1
  255. package/build-module/components/post-content-information/index.js +2 -3
  256. package/build-module/components/post-content-information/index.js.map +1 -1
  257. package/build-module/components/post-discussion/panel.js +1 -2
  258. package/build-module/components/post-discussion/panel.js.map +1 -1
  259. package/build-module/components/post-excerpt/panel.js +1 -3
  260. package/build-module/components/post-excerpt/panel.js.map +1 -1
  261. package/build-module/components/post-featured-image/index.js +27 -9
  262. package/build-module/components/post-featured-image/index.js.map +1 -1
  263. package/build-module/components/post-format/index.js +2 -3
  264. package/build-module/components/post-format/index.js.map +1 -1
  265. package/build-module/components/post-format/panel.js +1 -2
  266. package/build-module/components/post-format/panel.js.map +1 -1
  267. package/build-module/components/post-last-revision/index.js +1 -1
  268. package/build-module/components/post-last-revision/index.js.map +1 -1
  269. package/build-module/components/post-locked-modal/index.js +3 -5
  270. package/build-module/components/post-locked-modal/index.js.map +1 -1
  271. package/build-module/components/post-panel-row/index.js +1 -2
  272. package/build-module/components/post-panel-row/index.js.map +1 -1
  273. package/build-module/components/post-preview-button/index.js +2 -4
  274. package/build-module/components/post-preview-button/index.js.map +1 -1
  275. package/build-module/components/post-publish-button/index.js +1 -2
  276. package/build-module/components/post-publish-button/index.js.map +1 -1
  277. package/build-module/components/post-publish-panel/index.js +1 -3
  278. package/build-module/components/post-publish-panel/index.js.map +1 -1
  279. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -2
  280. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  281. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -3
  282. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  283. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -2
  284. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  285. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
  286. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  287. package/build-module/components/post-publish-panel/media-util.js +1 -0
  288. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  289. package/build-module/components/post-publish-panel/postpublish.js +2 -4
  290. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  291. package/build-module/components/post-publish-panel/prepublish.js +1 -3
  292. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  293. package/build-module/components/post-saved-state/index.js +1 -2
  294. package/build-module/components/post-saved-state/index.js.map +1 -1
  295. package/build-module/components/post-schedule/label.js +1 -1
  296. package/build-module/components/post-schedule/label.js.map +1 -1
  297. package/build-module/components/post-status/index.js +1 -3
  298. package/build-module/components/post-status/index.js.map +1 -1
  299. package/build-module/components/post-switch-to-draft-button/index.js +1 -3
  300. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  301. package/build-module/components/post-taxonomies/flat-term-selector.js +16 -10
  302. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  303. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -4
  304. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  305. package/build-module/components/post-taxonomies/index.js +1 -1
  306. package/build-module/components/post-taxonomies/index.js.map +1 -1
  307. package/build-module/components/post-taxonomies/most-used-terms.js +1 -2
  308. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  309. package/build-module/components/post-taxonomies/panel.js.map +1 -1
  310. package/build-module/components/post-template/block-theme.js +1 -3
  311. package/build-module/components/post-template/block-theme.js.map +1 -1
  312. package/build-module/components/post-template/classic-theme.js +3 -6
  313. package/build-module/components/post-template/classic-theme.js.map +1 -1
  314. package/build-module/components/post-template/create-new-template-modal.js +1 -2
  315. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  316. package/build-module/components/post-template/create-new-template.js +1 -3
  317. package/build-module/components/post-template/create-new-template.js.map +1 -1
  318. package/build-module/components/post-template/swap-template-button.js +1 -3
  319. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  320. package/build-module/components/post-text-editor/index.js +1 -3
  321. package/build-module/components/post-text-editor/index.js.map +1 -1
  322. package/build-module/components/post-title/index.js +15 -19
  323. package/build-module/components/post-title/index.js.map +1 -1
  324. package/build-module/components/post-title/index.native.js +2 -2
  325. package/build-module/components/post-title/index.native.js.map +1 -1
  326. package/build-module/components/post-trash/index.js +1 -2
  327. package/build-module/components/post-trash/index.js.map +1 -1
  328. package/build-module/components/post-url/index.js +78 -66
  329. package/build-module/components/post-url/index.js.map +1 -1
  330. package/build-module/components/post-url/panel.js +51 -31
  331. package/build-module/components/post-url/panel.js.map +1 -1
  332. package/build-module/components/post-visibility/index.js +1 -2
  333. package/build-module/components/post-visibility/index.js.map +1 -1
  334. package/build-module/components/posts-per-page/index.js +1 -3
  335. package/build-module/components/posts-per-page/index.js.map +1 -1
  336. package/build-module/components/preferences-modal/index.js +1 -3
  337. package/build-module/components/preferences-modal/index.js.map +1 -1
  338. package/build-module/components/preview-dropdown/index.js +1 -7
  339. package/build-module/components/preview-dropdown/index.js.map +1 -1
  340. package/build-module/components/provider/index.js +11 -15
  341. package/build-module/components/provider/index.js.map +1 -1
  342. package/build-module/components/provider/index.native.js +1 -3
  343. package/build-module/components/provider/index.native.js.map +1 -1
  344. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  345. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  346. package/build-module/components/resizable-editor/resize-handle.js +1 -3
  347. package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
  348. package/build-module/components/save-publish-panels/index.js +1 -3
  349. package/build-module/components/save-publish-panels/index.js.map +1 -1
  350. package/build-module/components/sidebar/header.js +3 -3
  351. package/build-module/components/sidebar/header.js.map +1 -1
  352. package/build-module/components/sidebar/index.js +5 -6
  353. package/build-module/components/sidebar/index.js.map +1 -1
  354. package/build-module/components/sidebar/post-summary.js +1 -3
  355. package/build-module/components/sidebar/post-summary.js.map +1 -1
  356. package/build-module/components/site-discussion/index.js +1 -3
  357. package/build-module/components/site-discussion/index.js.map +1 -1
  358. package/build-module/components/start-template-options/index.js +1 -2
  359. package/build-module/components/start-template-options/index.js.map +1 -1
  360. package/build-module/components/table-of-contents/panel.js +1 -3
  361. package/build-module/components/table-of-contents/panel.js.map +1 -1
  362. package/build-module/components/template-part-menu-items/convert-to-template-part.js +1 -3
  363. package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -1
  364. package/build-module/components/template-validation-notice/index.js +1 -3
  365. package/build-module/components/template-validation-notice/index.js.map +1 -1
  366. package/build-module/components/text-editor/index.js +1 -2
  367. package/build-module/components/text-editor/index.js.map +1 -1
  368. package/build-module/components/time-to-read/index.js +2 -2
  369. package/build-module/components/time-to-read/index.js.map +1 -1
  370. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -1
  371. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  372. package/build-module/components/visual-editor/index.js +26 -29
  373. package/build-module/components/visual-editor/index.js.map +1 -1
  374. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  375. package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
  376. package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
  377. package/build-module/components/zoom-out-toggle/index.js +37 -5
  378. package/build-module/components/zoom-out-toggle/index.js.map +1 -1
  379. package/build-module/dataviews/actions/duplicate-template-part.js +4 -4
  380. package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
  381. package/build-module/hooks/pattern-overrides.js +1 -3
  382. package/build-module/hooks/pattern-overrides.js.map +1 -1
  383. package/build-module/private-apis.js +1 -2
  384. package/build-module/private-apis.js.map +1 -1
  385. package/build-module/store/actions.js +30 -4
  386. package/build-module/store/actions.js.map +1 -1
  387. package/build-module/store/constants.js +1 -0
  388. package/build-module/store/constants.js.map +1 -1
  389. package/build-module/store/local-autosave.js.map +1 -1
  390. package/build-module/store/private-actions.js +9 -8
  391. package/build-module/store/private-actions.js.map +1 -1
  392. package/build-module/store/selectors.js +24 -2
  393. package/build-module/store/selectors.js.map +1 -1
  394. package/build-module/utils/media-upload/index.js.map +1 -1
  395. package/build-module/utils/pageTypeBadge.js +45 -0
  396. package/build-module/utils/pageTypeBadge.js.map +1 -0
  397. package/build-module/utils/terms.js +2 -2
  398. package/build-module/utils/terms.js.map +1 -1
  399. package/build-style/style-rtl.css +116 -59
  400. package/build-style/style.css +116 -59
  401. package/build-types/bindings/api.d.ts +0 -13
  402. package/build-types/bindings/api.d.ts.map +1 -1
  403. package/build-types/bindings/post-meta.d.ts.map +1 -1
  404. package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
  405. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
  406. package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
  407. package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
  408. package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
  409. package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
  410. package/build-types/components/collab-sidebar/comments.d.ts +19 -0
  411. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
  412. package/build-types/components/collab-sidebar/constants.d.ts +2 -0
  413. package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
  414. package/build-types/components/collab-sidebar/index.d.ts +5 -0
  415. package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
  416. package/build-types/components/collab-sidebar/utils.d.ts +8 -0
  417. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
  418. package/build-types/components/commands/index.d.ts.map +1 -1
  419. package/build-types/components/document-bar/index.d.ts.map +1 -1
  420. package/build-types/components/document-tools/index.d.ts.map +1 -1
  421. package/build-types/components/editor-interface/index.d.ts +1 -2
  422. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  423. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  424. package/build-types/components/header/index.d.ts.map +1 -1
  425. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  426. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  427. package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
  428. package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
  429. package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
  430. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
  431. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  432. package/build-types/components/post-author/panel.d.ts.map +1 -1
  433. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  434. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  435. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  436. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  437. package/build-types/components/post-url/index.d.ts.map +1 -1
  438. package/build-types/components/post-url/panel.d.ts.map +1 -1
  439. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  440. package/build-types/components/provider/index.d.ts.map +1 -1
  441. package/build-types/components/sidebar/index.d.ts.map +1 -1
  442. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  443. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  444. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
  445. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
  446. package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
  447. package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
  448. package/build-types/private-apis.d.ts.map +1 -1
  449. package/build-types/store/actions.d.ts +1 -4
  450. package/build-types/store/actions.d.ts.map +1 -1
  451. package/build-types/store/selectors.d.ts +21 -0
  452. package/build-types/store/selectors.d.ts.map +1 -1
  453. package/build-types/utils/pageTypeBadge.d.ts +5 -0
  454. package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
  455. package/build-types/utils/terms.d.ts.map +1 -1
  456. package/package.json +39 -38
  457. package/src/bindings/api.js +1 -32
  458. package/src/bindings/post-meta.js +1 -0
  459. package/src/components/collab-sidebar/add-comment.js +124 -0
  460. package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
  461. package/src/components/collab-sidebar/comment-button.js +31 -0
  462. package/src/components/collab-sidebar/comments.js +404 -0
  463. package/src/components/collab-sidebar/constants.js +1 -0
  464. package/src/components/collab-sidebar/index.js +307 -0
  465. package/src/components/collab-sidebar/style.scss +111 -0
  466. package/src/components/collab-sidebar/utils.js +9 -0
  467. package/src/components/commands/index.js +9 -7
  468. package/src/components/document-bar/index.js +15 -7
  469. package/src/components/document-bar/style.scss +0 -4
  470. package/src/components/document-tools/index.js +2 -8
  471. package/src/components/editor-interface/index.js +4 -18
  472. package/src/components/entities-saved-states/index.js +2 -2
  473. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
  474. package/src/components/global-styles-provider/index.js +20 -6
  475. package/src/components/header/index.js +3 -1
  476. package/src/components/header/style.scss +1 -0
  477. package/src/components/inserter-sidebar/index.js +3 -6
  478. package/src/components/page-attributes/parent.js +6 -4
  479. package/src/components/plugin-more-menu-item/index.js +12 -11
  480. package/src/components/plugin-preview-menu-item/index.js +14 -13
  481. package/src/components/plugin-sidebar/index.js +0 -13
  482. package/src/components/post-actions/index.js +8 -11
  483. package/src/components/post-author/panel.js +4 -2
  484. package/src/components/post-card-panel/index.js +9 -43
  485. package/src/components/post-card-panel/style.scss +1 -9
  486. package/src/components/post-content-information/index.js +1 -1
  487. package/src/components/post-featured-image/index.js +31 -16
  488. package/src/components/post-featured-image/style.scss +5 -2
  489. package/src/components/post-last-revision/index.js +1 -1
  490. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  491. package/src/components/post-schedule/label.js +1 -1
  492. package/src/components/post-sticky/test/index.js +6 -6
  493. package/src/components/post-taxonomies/flat-term-selector.js +15 -4
  494. package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  495. package/src/components/post-template/classic-theme.js +1 -2
  496. package/src/components/post-url/index.js +67 -55
  497. package/src/components/post-url/panel.js +61 -35
  498. package/src/components/post-url/style.scss +21 -3
  499. package/src/components/preview-dropdown/index.js +0 -2
  500. package/src/components/provider/index.js +32 -24
  501. package/src/components/provider/use-block-editor-settings.js +1 -1
  502. package/src/components/sidebar/header.js +3 -2
  503. package/src/components/sidebar/index.js +5 -3
  504. package/src/components/time-to-read/index.js +3 -3
  505. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  506. package/src/components/visual-editor/index.js +32 -39
  507. package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
  508. package/src/components/zoom-out-toggle/index.js +39 -5
  509. package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
  510. package/src/private-apis.js +1 -5
  511. package/src/store/actions.js +33 -4
  512. package/src/store/private-actions.js +3 -3
  513. package/src/store/selectors.js +24 -2
  514. package/src/style.scss +1 -0
  515. package/src/utils/pageTypeBadge.js +41 -0
  516. package/src/utils/terms.js +4 -2
  517. package/src/utils/test/terms.js +3 -3
  518. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockSectionRootClientId","inserterSidebarToggleRef","inserter","showMostUsedBlocks","sidebarIsOpened","useSelect","select","getInserterSidebarToggleRef","getInserter","isPublishSidebarOpened","editorStore","getBlockRootClientId","__unstableGetEditorMode","getSectionRootClientId","blockEditorStore","get","preferencesStore","getActiveComplementaryArea","interfaceStore","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","useDispatch","disableComplementaryArea","isMobileViewport","useViewportMatch","libraryRef","useRef","closeInserterSidebar","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","inserterContents","jsx","className","children","showInserterHelpPanel","shouldFocusBlock","rootClientId","onSelect","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","onPatternCategorySelection","undefined","ref","onClose","onKeyDown"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinserter,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInserter,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetSectionRootClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinserter: getInserter(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\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\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={ blockSectionRootClientId }\n\t\t\t\tonSelect={ inserter.onSelect }\n\t\t\t\t__experimentalInitialTab={ inserter.tab }\n\t\t\t\t__experimentalInitialCategory={ inserter.category }\n\t\t\t\t__experimentalFilterValue={ inserter.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ close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kCAAkC;IAAAC,QAAA,eAChD,IAAA9C,WAAA,CAAA4C,GAAA,EAAC3C,sBAAsB;MACtBO,kBAAkB,EAAGA,kBAAoB;MACzCuC,qBAAqB;MACrBC,gBAAgB,EAAGnB,gBAAkB;MACrCoB,YAAY,EAAG5C,wBAA0B;MACzC6C,QAAQ,EAAG3C,QAAQ,CAAC2C,QAAU;MAC9BC,wBAAwB,EAAG5C,QAAQ,CAAC6C,GAAK;MACzCC,6BAA6B,EAAG9C,QAAQ,CAAC+C,QAAU;MACnDC,yBAAyB,EAAGhD,QAAQ,CAACiD,WAAa;MAClDC,0BAA0B,EACzBhD,eAAe,GACZ,MAAMmB,wBAAwB,CAAE,MAAO,CAAC,GACxC8B,SACH;MACDC,GAAG,EAAG5B,UAAY;MAClB6B,OAAO,EAAG3B;IAAsB,CAChC;EAAC,CACE,CACL;EAED;IAAA;IACC;IACA,IAAAjC,WAAA,CAAA4C,GAAA;MAAKiB,SAAS,EAAGxB,aAAe;MAACQ,SAAS,EAAC,yBAAyB;MAAAC,QAAA,EACjEH;IAAgB,CACd;EAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockSectionRootClientId","inserterSidebarToggleRef","inserter","showMostUsedBlocks","sidebarIsOpened","useSelect","select","getInserterSidebarToggleRef","getInserter","isPublishSidebarOpened","editorStore","getBlockRootClientId","isZoomOut","getSectionRootClientId","blockEditorStore","get","preferencesStore","getActiveComplementaryArea","interfaceStore","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","useDispatch","disableComplementaryArea","isMobileViewport","useViewportMatch","libraryRef","useRef","closeInserterSidebar","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","inserterContents","jsx","className","children","showInserterHelpPanel","shouldFocusBlock","rootClientId","onSelect","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","onPatternCategorySelection","undefined","ref","onClose","onKeyDown"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinserter,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInserter,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getBlockRootClientId, isZoomOut, getSectionRootClientId } =\n\t\t\tunlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( isZoomOut() ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinserter: getInserter(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\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\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={ blockSectionRootClientId }\n\t\t\t\tonSelect={ inserter.onSelect }\n\t\t\t\t__experimentalInitialTab={ inserter.tab }\n\t\t\t\t__experimentalInitialCategory={ inserter.category }\n\t\t\t\t__experimentalFilterValue={ inserter.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape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,eAChD,IAAA9C,WAAA,CAAA4C,GAAA,EAAC3C,sBAAsB;MACtBO,kBAAkB,EAAGA,kBAAoB;MACzCuC,qBAAqB;MACrBC,gBAAgB,EAAGnB,gBAAkB;MACrCoB,YAAY,EAAG5C,wBAA0B;MACzC6C,QAAQ,EAAG3C,QAAQ,CAAC2C,QAAU;MAC9BC,wBAAwB,EAAG5C,QAAQ,CAAC6C,GAAK;MACzCC,6BAA6B,EAAG9C,QAAQ,CAAC+C,QAAU;MACnDC,yBAAyB,EAAGhD,QAAQ,CAACiD,WAAa;MAClDC,0BAA0B,EACzBhD,eAAe,GACZ,MAAMmB,wBAAwB,CAAE,MAAO,CAAC,GACxC8B,SACH;MACDC,GAAG,EAAG5B,UAAY;MAClB6B,OAAO,EAAG3B;IAAsB,CAChC;EAAC,CACE,CACL;EAED;IAAA;IACC;IACA,IAAAjC,WAAA,CAAA4C,GAAA;MAAKiB,SAAS,EAAGxB,aAAe;MAACQ,SAAS,EAAC,yBAAyB;MAAAC,QAAA,EACjEH;IAAgB,CACd;EAAC;AAER","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_htmlEntities","_coreData","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","decodeEntities","_caption","sprintf","_x","coreMediaFetch","query","mediaItems","resolveSelect","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","__","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource","_default","exports","default"],"sources":["@wordpress/editor/src/components/media-categories/index.js"],"sourcesContent":["/**\n * The `editor` settings here need to be in sync with the corresponding ones in `editor` package.\n * See `packages/editor/src/components/media-categories/index.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL( 'https://api.openverse.org/v1/images/' );\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":";;;;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,MAAMI,eAAe,GAAGA,CAAEC,GAAG,EAAEC,IAAI,KACjC,MAAMC,yBAAyB,CAAEF,GAAI,CAAG,IAAIC,IAAM,MAAK;AAEzD,MAAMC,yBAAyB,GAAKF,GAAG,IACrC,SAASA,GAAK,6CAA4C;AAE5D,MAAMG,mBAAmB,GAAGA,CAAEC,OAAO,EAAEC,cAAc,KAAM;EAC1D,IAAIC,WAAW,GAAGF,OAAO,CAACG,IAAI,CAAC,CAAC;EAChC;EACA,IAAKH,OAAO,KAAK,KAAK,EAAG;IACxBE,WAAW,GAAGF,OAAO,CAACI,WAAW,CAAC,CAAC,CAACC,OAAO,CAAE,UAAU,EAAE,UAAW,CAAC;EACtE;EACA;EACA;EACA;EACA,IAAKJ,cAAc,EAAG;IACrBC,WAAW,IAAK,IAAID,cAAgB,EAAC;EACtC;EACA;EACA,IAAK,CAAE,CAAE,KAAK,EAAE,KAAK,CAAE,CAACK,QAAQ,CAAEN,OAAQ,CAAC,EAAG;IAC7CE,WAAW,GAAI,MAAMA,WAAa,EAAC;EACpC;EACA,OAAO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reList":[]}
1
+ {"version":3,"names":["_i18n","require","_data","_htmlEntities","_coreData","getExternalLink","url","text","getExternalLinkAttributes","getOpenverseLicense","license","licenseVersion","licenseName","trim","toUpperCase","replace","includes","getOpenverseCaption","item","title","foreign_landing_url","foreignLandingUrl","creator","creator_url","creatorUrl","license_version","license_url","licenseUrl","fullLicense","_creator","decodeEntities","_caption","sprintf","_x","coreMediaFetch","query","mediaItems","resolveSelect","coreStore","getMediaItems","orderBy","search","map","mediaItem","alt","alt_text","source_url","previewUrl","media_details","sizes","medium","caption","raw","inserterMediaCategories","name","labels","__","search_items","mediaType","fetch","media_type","defaultArgs","mature","excluded_source","finalQuery","mapFromInserterMediaRequest","per_page","URL","Object","entries","forEach","key","value","queryKey","searchParams","set","response","window","headers","jsonResponse","json","results","result","toLowerCase","startsWith","slice","sourceId","id","undefined","thumbnail","getReportUrl","isExternalResource","_default","exports","default"],"sources":["@wordpress/editor/src/components/media-categories/index.js"],"sourcesContent":["/**\n * The `editor` settings here need to be in sync with the corresponding ones in `editor` package.\n * See `packages/editor/src/components/media-categories/index.js`.\n *\n * In the future we could consider creating an Openvese package that can be used in both `editor` and `site-editor`.\n * The rest of the settings would still need to be in sync though.\n */\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { resolveSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/block-editor').InserterMediaRequest} InserterMediaRequest */\n/** @typedef {import('@wordpress/block-editor').InserterMediaItem} InserterMediaItem */\n/** @typedef {import('@wordpress/block-editor').InserterMediaCategory} InserterMediaCategory */\n\nconst getExternalLink = ( url, text ) =>\n\t`<a ${ getExternalLinkAttributes( url ) }>${ text }</a>`;\n\nconst getExternalLinkAttributes = ( url ) =>\n\t`href=\"${ url }\" target=\"_blank\" rel=\"noreferrer noopener\"`;\n\nconst getOpenverseLicense = ( license, licenseVersion ) => {\n\tlet licenseName = license.trim();\n\t// PDM has no abbreviation\n\tif ( license !== 'pdm' ) {\n\t\tlicenseName = license.toUpperCase().replace( 'SAMPLING', 'Sampling' );\n\t}\n\t// If version is known, append version to the name.\n\t// The license has to have a version to be valid. Only\n\t// PDM (public domain mark) doesn't have a version.\n\tif ( licenseVersion ) {\n\t\tlicenseName += ` ${ licenseVersion }`;\n\t}\n\t// For licenses other than public-domain marks, prepend 'CC' to the name.\n\tif ( ! [ 'pdm', 'cc0' ].includes( license ) ) {\n\t\tlicenseName = `CC ${ licenseName }`;\n\t}\n\treturn licenseName;\n};\n\nconst getOpenverseCaption = ( item ) => {\n\tconst {\n\t\ttitle,\n\t\tforeign_landing_url: foreignLandingUrl,\n\t\tcreator,\n\t\tcreator_url: creatorUrl,\n\t\tlicense,\n\t\tlicense_version: licenseVersion,\n\t\tlicense_url: licenseUrl,\n\t} = item;\n\tconst fullLicense = getOpenverseLicense( license, licenseVersion );\n\tconst _creator = decodeEntities( creator );\n\tlet _caption;\n\tif ( _creator ) {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Name of the work's creator; %3s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\" by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Name of the work's creator; %3s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a> by %2$s/ %3$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tcreatorUrl\n\t\t\t\t\t\t? getExternalLink( creatorUrl, _creator )\n\t\t\t\t\t\t: _creator,\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t} else {\n\t\t_caption = title\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %1s: Title of a media work from Openverse; %2s: Work's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '\"%1$s\"/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLink(\n\t\t\t\t\t\tforeignLandingUrl,\n\t\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t\t),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: \"CC0 1.0\".\n\t\t\t\t\t_x( '<a %1$s>Work</a>/ %2$s', 'caption' ),\n\t\t\t\t\tgetExternalLinkAttributes( foreignLandingUrl ),\n\t\t\t\t\tlicenseUrl\n\t\t\t\t\t\t? getExternalLink(\n\t\t\t\t\t\t\t\t`${ licenseUrl }?ref=openverse`,\n\t\t\t\t\t\t\t\tfullLicense\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: fullLicense\n\t\t\t );\n\t}\n\treturn _caption.replace( /\\s{2}/g, ' ' );\n};\n\nconst coreMediaFetch = async ( query = {} ) => {\n\tconst mediaItems = await resolveSelect( coreStore ).getMediaItems( {\n\t\t...query,\n\t\torderBy: !! query?.search ? 'relevance' : 'date',\n\t} );\n\treturn mediaItems.map( ( mediaItem ) => ( {\n\t\t...mediaItem,\n\t\talt: mediaItem.alt_text,\n\t\turl: mediaItem.source_url,\n\t\tpreviewUrl: mediaItem.media_details?.sizes?.medium?.source_url,\n\t\tcaption: mediaItem.caption?.raw,\n\t} ) );\n};\n\n/** @type {InserterMediaCategory[]} */\nconst inserterMediaCategories = [\n\t{\n\t\tname: 'images',\n\t\tlabels: {\n\t\t\tname: __( 'Images' ),\n\t\t\tsearch_items: __( 'Search images' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'image' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'videos',\n\t\tlabels: {\n\t\t\tname: __( 'Videos' ),\n\t\t\tsearch_items: __( 'Search videos' ),\n\t\t},\n\t\tmediaType: 'video',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'video' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'audio',\n\t\tlabels: {\n\t\t\tname: __( 'Audio' ),\n\t\t\tsearch_items: __( 'Search audio' ),\n\t\t},\n\t\tmediaType: 'audio',\n\t\tasync fetch( query = {} ) {\n\t\t\treturn coreMediaFetch( { ...query, media_type: 'audio' } );\n\t\t},\n\t},\n\t{\n\t\tname: 'openverse',\n\t\tlabels: {\n\t\t\tname: __( 'Openverse' ),\n\t\t\tsearch_items: __( 'Search Openverse' ),\n\t\t},\n\t\tmediaType: 'image',\n\t\tasync fetch( query = {} ) {\n\t\t\tconst defaultArgs = {\n\t\t\t\tmature: false,\n\t\t\t\texcluded_source: 'flickr,inaturalist,wikimedia',\n\t\t\t\tlicense: 'pdm,cc0',\n\t\t\t};\n\t\t\tconst finalQuery = { ...query, ...defaultArgs };\n\t\t\tconst mapFromInserterMediaRequest = {\n\t\t\t\tper_page: 'page_size',\n\t\t\t\tsearch: 'q',\n\t\t\t};\n\t\t\tconst url = new URL( 'https://api.openverse.org/v1/images/' );\n\t\t\tObject.entries( finalQuery ).forEach( ( [ key, value ] ) => {\n\t\t\t\tconst queryKey = mapFromInserterMediaRequest[ key ] || key;\n\t\t\t\turl.searchParams.set( queryKey, value );\n\t\t\t} );\n\t\t\tconst response = await window.fetch( url, {\n\t\t\t\theaders: {\n\t\t\t\t\t'User-Agent': 'WordPress/inserter-media-fetch',\n\t\t\t\t},\n\t\t\t} );\n\t\t\tconst jsonResponse = await response.json();\n\t\t\tconst results = jsonResponse.results;\n\t\t\treturn results.map( ( result ) => ( {\n\t\t\t\t...result,\n\t\t\t\t// This is a temp solution for better titles, until Openverse API\n\t\t\t\t// completes the cleaning up of some titles of their upstream data.\n\t\t\t\ttitle: result.title?.toLowerCase().startsWith( 'file:' )\n\t\t\t\t\t? result.title.slice( 5 )\n\t\t\t\t\t: result.title,\n\t\t\t\tsourceId: result.id,\n\t\t\t\tid: undefined,\n\t\t\t\tcaption: getOpenverseCaption( result ),\n\t\t\t\tpreviewUrl: result.thumbnail,\n\t\t\t} ) );\n\t\t},\n\t\tgetReportUrl: ( { sourceId } ) =>\n\t\t\t`https://wordpress.org/openverse/image/${ sourceId }/report/`,\n\t\tisExternalResource: true,\n\t},\n];\n\nexport default inserterMediaCategories;\n"],"mappings":";;;;;;;AAWA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAKA,IAAAG,SAAA,GAAAH,OAAA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAEA,MAAMI,eAAe,GAAGA,CAAEC,GAAG,EAAEC,IAAI,KAClC,MAAOC,yBAAyB,CAAEF,GAAI,CAAC,IAAMC,IAAI,MAAO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MACT;MACA;MACA/D,KAAK,EAAE+D,MAAM,CAAC/D,KAAK,EAAEgE,WAAW,CAAC,CAAC,CAACC,UAAU,CAAE,OAAQ,CAAC,GACrDF,MAAM,CAAC/D,KAAK,CAACkE,KAAK,CAAE,CAAE,CAAC,GACvBH,MAAM,CAAC/D,KAAK;MACfmE,QAAQ,EAAEJ,MAAM,CAACK,EAAE;MACnBA,EAAE,EAAEC,SAAS;MACbrC,OAAO,EAAElC,mBAAmB,CAAEiE,MAAO,CAAC;MACtCnC,UAAU,EAAEmC,MAAM,CAACO;IACpB,CAAC,CAAG,CAAC;EACN,CAAC;EACDC,YAAY,EAAEA,CAAE;IAAEJ;EAAS,CAAC,KAC3B,yCAA0CA,QAAQ,UAAW;EAC9DK,kBAAkB,EAAE;AACrB,CAAC,CACD;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazC,uBAAuB","ignoreList":[]}
@@ -199,10 +199,10 @@ function PostParentToggle({
199
199
  size: "compact",
200
200
  className: "editor-post-parent__panel-toggle",
201
201
  variant: "tertiary",
202
- "aria-expanded": isOpen
202
+ "aria-expanded": isOpen,
203
+ "aria-label":
203
204
  // translators: %s: Current post parent.
204
- ,
205
- "aria-label": (0, _i18n.sprintf)((0, _i18n.__)('Change parent: %s'), parentTitle),
205
+ (0, _i18n.sprintf)((0, _i18n.__)('Change parent: %s'), parentTitle),
206
206
  onClick: onClick,
207
207
  children: parentTitle
208
208
  });
@@ -247,8 +247,8 @@ function ParentRow() {
247
247
  title: (0, _i18n.__)('Parent'),
248
248
  onClose: onClose
249
249
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
250
- children: [(0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: %1$s The home URL of the WordPress installation without the scheme. */
251
- (0, _i18n.__)('Child pages inherit characteristics from their parent, such as URL structure. For instance, if "Pricing" is a child of "Services", its URL would be %1$s<wbr />/services<wbr />/pricing.'), (0, _url.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), {
250
+ children: [(0, _element.createInterpolateElement)((0, _i18n.sprintf)(/* translators: %s: The home URL of the WordPress installation without the scheme. */
251
+ (0, _i18n.__)('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.'), (0, _url.filterURLForDisplay)(homeUrl).replace(/([/.])/g, '<wbr />$1')), {
252
252
  wbr: /*#__PURE__*/(0, _jsxRuntime.jsx)("wbr", {})
253
253
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
254
254
  children: (0, _element.createInterpolateElement)((0, _i18n.__)('They also show up as sub-items in the default navigation menu. <a>Learn more.</a>'), {
@@ -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 {Component|null} 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\t// translators: %s: Current post parent.\n\t\t\taria-label={ sprintf( __( 'Change parent: %s' ), parentTitle ) }\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: %1$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 %1$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,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAmD,IAAAa,WAAA,GAAAb,OAAA;AAhCnD;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;;AAKA,SAASc,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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","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 {Component|null} 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,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAAmD,IAAAa,WAAA,GAAAb,OAAA;AAhCnD;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;;AAKA,SAASc,QAAQA,CAAEC,IAAI,EAAG;EACzB,OAAOA,IAAI,EAAEC,KAAK,EAAEC,QAAQ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Y;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 +1 @@
1
- {"version":3,"names":["_components","require","_plugins","_data","_warning","_interopRequireDefault","_enablePluginDocumentSettingPanel","_store","_jsxRuntime","Fill","Slot","createSlotFill","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","usePluginContext","panelName","opened","isEnabled","useSelect","select","isEditorPanelOpened","isEditorPanelEnabled","editorStore","toggleEditorPanelOpened","useDispatch","undefined","globalThis","SCRIPT_DEBUG","warning","jsxs","Fragment","jsx","default","label","PanelBody","onToggle","_default","exports"],"sources":["@wordpress/editor/src/components/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport EnablePluginDocumentSettingPanelOption from '../preferences-modal/enable-plugin-document-setting-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/editor';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAKA,IAAAK,iCAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAZnD;AACA;AACA;;AAMA;AACA;AACA;;AAIA,MAAM;EAAEQ,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,4BAA6B,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAAE;EACpCC,IAAI;EACJC,SAAS;EACTC,KAAK;EACLC,IAAI;EACJC;AACD,CAAC,KAAM;EACN,MAAM;IA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BAA0B,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAA+B,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAExBzB,0BAA0B","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_plugins","_data","_warning","_interopRequireDefault","_enablePluginDocumentSettingPanel","_store","_jsxRuntime","Fill","Slot","createSlotFill","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","usePluginContext","panelName","opened","isEnabled","useSelect","select","isEditorPanelOpened","isEditorPanelEnabled","editorStore","toggleEditorPanelOpened","useDispatch","undefined","globalThis","SCRIPT_DEBUG","warning","jsxs","Fragment","jsx","default","label","PanelBody","onToggle","_default","exports"],"sources":["@wordpress/editor/src/components/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport EnablePluginDocumentSettingPanelOption from '../preferences-modal/enable-plugin-document-setting-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/editor';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAKA,IAAAK,iCAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAmD,IAAAO,WAAA,GAAAP,OAAA;AAZnD;AACA;AACA;;AAMA;AACA;AACA;;AAIA,MAAM;EAAEQ,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EAAE,4BAA6B,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CAAE;EACpCC,IAAI;EACJC,SAAS;EACTC,KAAK;EACLC,IAAI;EACJC;AACD,CAAC,KAAM;EACN,MAAM;IAAEJ,IAAI,EAAEK;EAAW,CAAC,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAC/C,MAAMC,SAAS,GAAG,GAAIF,UAAU,IAAML,IAAI,EAAG;EAC7C,MAAM;IAAEQ,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAS,EAC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7
- var _compose = require("@wordpress/compose");
6
+ exports.default = PluginMoreMenuItem;
8
7
  var _components = require("@wordpress/components");
9
8
  var _plugins = require("@wordpress/plugins");
10
9
  var _interface = require("@wordpress/interface");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
14
+
14
15
  /**
15
16
  * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
16
17
  * The text within the component appears as the menu item label.
@@ -66,13 +67,14 @@ var _interface = require("@wordpress/interface");
66
67
  * ```
67
68
  *
68
69
  * @return {Component} The component to be rendered.
69
- */
70
- var _default = exports.default = (0, _compose.compose)((0, _plugins.withPluginContext)((context, ownProps) => {
71
- var _ownProps$as;
72
- return {
73
- as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : _components.MenuItem,
74
- icon: ownProps.icon || context.icon,
75
- name: 'core/plugin-more-menu'
76
- };
77
- }))(_interface.ActionItem);
70
+ */function PluginMoreMenuItem(props) {
71
+ var _props$as;
72
+ const context = (0, _plugins.usePluginContext)();
73
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.ActionItem, {
74
+ name: "core/plugin-more-menu",
75
+ as: (_props$as = props.as) !== null && _props$as !== void 0 ? _props$as : _components.MenuItem,
76
+ icon: props.icon || context.icon,
77
+ ...props
78
+ });
79
+ }
78
80
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_components","_plugins","_interface","_default","exports","default","compose","withPluginContext","context","ownProps","_ownProps$as","as","MenuItem","icon","name","ActionItem"],"sources":["@wordpress/editor/src/components/plugin-more-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { MenuItem } from '@wordpress/components';\nimport { withPluginContext } from '@wordpress/plugins';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.\n * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * function MyButtonMoreMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginMoreMenuItem,\n * \t\t{\n * \t\t\ticon: moreIcon,\n * \t\t\tonClick: onButtonClick,\n * \t\t},\n * \t\t__( 'My button title' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginMoreMenuItem } from '@wordpress/editor';\n * import { more } from '@wordpress/icons';\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * const MyButtonMoreMenuItem = () => (\n * \t<PluginMoreMenuItem\n * \t\ticon={ more }\n * \t\tonClick={ onButtonClick }\n * \t>\n * \t\t{ __( 'My button title' ) }\n * \t</PluginMoreMenuItem>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nexport default compose(\n\twithPluginContext( ( context, ownProps ) => {\n\t\treturn {\n\t\t\tas: ownProps.as ?? MenuItem,\n\t\t\ticon: ownProps.icon || context.icon,\n\t\t\tname: 'core/plugin-more-menu',\n\t\t};\n\t} )\n)( ActionItem );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AANA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAvDA,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAwDe,IAAAC,gBAAO,EACrB,IAAAC,0BAAiB,EAAE,CAAEC,OAAO,EAAEC,QAAQ,KAAM;EAAA,IAAAC,YAAA;EAC3C,OAAO;IACNC,EAAE,GAAAD,YAAA,GAAED,QAAQ,CAACE,EAAE,cAAAD,YAAA,cAAAA,YAAA,GAAIE,oBAAQ;IAC3BC,IAAI,EAAEJ,QAAQ,CAACI,IAAI,IAAIL,OAAO,CAACK,IAAI;IACnCC,IAAI,EAAE;EACP,CAAC;AACF,CAAE,CACH,CAAC,CAAEC,qBAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_plugins","_interface","_jsxRuntime","PluginMoreMenuItem","props","_props$as","context","usePluginContext","jsx","ActionItem","name","as","MenuItem","icon"],"sources":["@wordpress/editor/src/components/plugin-more-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.\n * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginMoreMenuItem = wp.editor.PluginMoreMenuItem;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * function MyButtonMoreMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginMoreMenuItem,\n * \t\t{\n * \t\t\ticon: moreIcon,\n * \t\t\tonClick: onButtonClick,\n * \t\t},\n * \t\t__( 'My button title' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginMoreMenuItem } from '@wordpress/editor';\n * import { more } from '@wordpress/icons';\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * const MyButtonMoreMenuItem = () => (\n * \t<PluginMoreMenuItem\n * \t\ticon={ more }\n * \t\tonClick={ onButtonClick }\n * \t>\n * \t\t{ __( 'My button title' ) }\n * \t</PluginMoreMenuItem>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nexport default function PluginMoreMenuItem( props ) {\n\tconst context = usePluginContext();\n\treturn (\n\t\t<ActionItem\n\t\t\tname=\"core/plugin-more-menu\"\n\t\t\tas={ props.as ?? MenuItem }\n\t\t\ticon={ props.icon || context.icon }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAAkD,IAAAG,WAAA,GAAAH,OAAA;AALlD;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASI,kBAAkBA,CAAEC,KAAK,EAAG;EAAA,IAAAC,SAAA;EACnD,MAAMC,OAAO,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAClC,oBACC,IAAAL,WAAA,CAAAM,GAAA,EAACP,UAAA,CAAAQ,UAAU;IACVC,IAAI,EAAC,uBAAuB;IAC5BC,EAAE,GAAAN,SAAA,GAAGD,KAAK,CAACO,EAAE,cAAAN,SAAA,cAAAA,SAAA,GAAIO,oBAAU;IAC3BC,IAAI,EAAGT,KAAK,CAACS,IAAI,IAAIP,OAAO,CAACO,IAAM;IAAA,GAC9BT;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
@@ -3,14 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- var _compose = require("@wordpress/compose");
6
+ exports.default = PluginPreviewMenuItem;
8
7
  var _components = require("@wordpress/components");
9
8
  var _plugins = require("@wordpress/plugins");
10
9
  var _interface = require("@wordpress/interface");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
14
+
14
15
  /**
15
16
  * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided.
16
17
  * The text within the component appears as the menu item label.
@@ -32,12 +33,12 @@ var _interface = require("@wordpress/interface");
32
33
  * }
33
34
  *
34
35
  * const ExternalPreviewMenuItem = () => (
35
- * <PreviewDropdownMenuItem
36
+ * <PluginPreviewMenuItem
36
37
  * icon={ external }
37
38
  * onClick={ onPreviewClick }
38
39
  * >
39
40
  * { __( 'Preview in new tab' ) }
40
- * </PreviewDropdownMenuItem>
41
+ * </PluginPreviewMenuItem>
41
42
  * );
42
43
  * registerPlugin( 'external-preview-menu-item', {
43
44
  * render: ExternalPreviewMenuItem,
@@ -45,13 +46,14 @@ var _interface = require("@wordpress/interface");
45
46
  * ```
46
47
  *
47
48
  * @return {Component} The rendered menu item component.
48
- */
49
- var _default = exports.default = (0, _compose.compose)((0, _plugins.withPluginContext)((context, ownProps) => {
50
- var _ownProps$as;
51
- return {
52
- as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : _components.MenuItem,
53
- icon: ownProps.icon || context.icon,
54
- name: 'core/plugin-preview-menu'
55
- };
56
- }))(_interface.ActionItem);
49
+ */function PluginPreviewMenuItem(props) {
50
+ var _props$as;
51
+ const context = (0, _plugins.usePluginContext)();
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.ActionItem, {
53
+ name: "core/plugin-preview-menu",
54
+ as: (_props$as = props.as) !== null && _props$as !== void 0 ? _props$as : _components.MenuItem,
55
+ icon: props.icon || context.icon,
56
+ ...props
57
+ });
58
+ }
57
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_components","_plugins","_interface","_default","exports","default","compose","withPluginContext","context","ownProps","_ownProps$as","as","MenuItem","icon","name","ActionItem"],"sources":["@wordpress/editor/src/components/plugin-preview-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { MenuItem } from '@wordpress/components';\nimport { withPluginContext } from '@wordpress/plugins';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.\n * @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component.\n *\n * @example\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import { PluginPreviewMenuItem } from '@wordpress/editor';\n * import { external } from '@wordpress/icons';\n *\n * function onPreviewClick() {\n * // Handle preview action\n * }\n *\n * const ExternalPreviewMenuItem = () => (\n * <PreviewDropdownMenuItem\n * icon={ external }\n * onClick={ onPreviewClick }\n * >\n * { __( 'Preview in new tab' ) }\n * </PreviewDropdownMenuItem>\n * );\n * registerPlugin( 'external-preview-menu-item', {\n * render: ExternalPreviewMenuItem,\n * } );\n * ```\n *\n * @return {Component} The rendered menu item component.\n */\nexport default compose(\n\twithPluginContext( ( context, ownProps ) => {\n\t\treturn {\n\t\t\tas: ownProps.as ?? MenuItem,\n\t\t\ticon: ownProps.icon || context.icon,\n\t\t\tname: 'core/plugin-preview-menu',\n\t\t};\n\t} )\n)( ActionItem );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AANA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAlCA,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAmCe,IAAAC,gBAAO,EACrB,IAAAC,0BAAiB,EAAE,CAAEC,OAAO,EAAEC,QAAQ,KAAM;EAAA,IAAAC,YAAA;EAC3C,OAAO;IACNC,EAAE,GAAAD,YAAA,GAAED,QAAQ,CAACE,EAAE,cAAAD,YAAA,cAAAA,YAAA,GAAIE,oBAAQ;IAC3BC,IAAI,EAAEJ,QAAQ,CAACI,IAAI,IAAIL,OAAO,CAACK,IAAI;IACnCC,IAAI,EAAE;EACP,CAAC;AACF,CAAE,CACH,CAAC,CAAEC,qBAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_plugins","_interface","_jsxRuntime","PluginPreviewMenuItem","props","_props$as","context","usePluginContext","jsx","ActionItem","name","as","MenuItem","icon"],"sources":["@wordpress/editor/src/components/plugin-preview-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.\n * @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component.\n *\n * @example\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import { PluginPreviewMenuItem } from '@wordpress/editor';\n * import { external } from '@wordpress/icons';\n *\n * function onPreviewClick() {\n * // Handle preview action\n * }\n *\n * const ExternalPreviewMenuItem = () => (\n * <PluginPreviewMenuItem\n * icon={ external }\n * onClick={ onPreviewClick }\n * >\n * { __( 'Preview in new tab' ) }\n * </PluginPreviewMenuItem>\n * );\n * registerPlugin( 'external-preview-menu-item', {\n * render: ExternalPreviewMenuItem,\n * } );\n * ```\n *\n * @return {Component} The rendered menu item component.\n */\nexport default function PluginPreviewMenuItem( props ) {\n\tconst context = usePluginContext();\n\treturn (\n\t\t<ActionItem\n\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\tas={ props.as ?? MenuItem }\n\t\t\ticon={ props.icon || context.icon }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAAkD,IAAAG,WAAA,GAAAH,OAAA;AALlD;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASI,qBAAqBA,CAAEC,KAAK,EAAG;EAAA,IAAAC,SAAA;EACtD,MAAMC,OAAO,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EAClC,oBACC,IAAAL,WAAA,CAAAM,GAAA,EAACP,UAAA,CAAAQ,UAAU;IACVC,IAAI,EAAC,0BAA0B;IAC/BC,EAAE,GAAAN,SAAA,GAAGD,KAAK,CAACO,EAAE,cAAAN,SAAA,cAAAA,SAAA,GAAIO,oBAAU;IAC3BC,IAAI,EAAGT,KAAK,CAACS,IAAI,IAAIP,OAAO,CAACO,IAAM;IAAA,GAC9BT;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = PluginSidebar;
7
- var _data = require("@wordpress/data");
8
- var _i18n = require("@wordpress/i18n");
9
7
  var _interface = require("@wordpress/interface");
10
- var _store = require("../../store");
11
8
  var _jsxRuntime = require("react/jsx-runtime");
12
9
  /**
13
10
  * WordPress dependencies
14
11
  */
15
12
 
16
- /**
17
- * Internal dependencies
18
- */
19
-
20
13
  /**
21
14
  * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
22
15
  * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
@@ -85,17 +78,9 @@ var _jsxRuntime = require("react/jsx-runtime");
85
78
  className,
86
79
  ...props
87
80
  }) {
88
- const {
89
- postTitle
90
- } = (0, _data.useSelect)(select => {
91
- return {
92
- postTitle: select(_store.store).getEditedPostAttribute('title')
93
- };
94
- }, []);
95
81
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_interface.ComplementaryArea, {
96
82
  panelClassName: className,
97
83
  className: "editor-sidebar",
98
- smallScreenTitle: postTitle || (0, _i18n.__)('(no title)'),
99
84
  scope: "core",
100
85
  ...props
101
86
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_interface","_store","_jsxRuntime","PluginSidebar","className","props","postTitle","useSelect","select","editorStore","getEditedPostAttribute","jsx","ComplementaryArea","panelClassName","smallScreenTitle","__","scope"],"sources":["@wordpress/editor/src/components/plugin-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = React.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editor.PluginSidebar;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/editor';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebar( { className, ...props } ) {\n\tconst { postTitle } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostTitle: select( editorStore ).getEditedPostAttribute( 'title' ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"editor-sidebar\"\n\t\t\tsmallScreenTitle={ postTitle || __( '(no title)' ) }\n\t\t\tscope=\"core\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAAmD,IAAAI,WAAA,GAAAJ,OAAA;AAVnD;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASK,aAAaA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EAChE,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9C,OAAO;MACNF,SAAS,EAAEE,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,OAAQ;IAClE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,oBACC,IAAAR,WAAA,CAAAS,GAAA,EAACX,UAAA,CAAAY,iBAAiB;IACjBC,cAAc,EAAGT,SAAW;IAC5BA,SAAS,EAAC,gBAAgB;IAC1BU,gBAAgB,EAAGR,SAAS,IAAI,IAAAS,QAAE,EAAE,YAAa,CAAG;IACpDC,KAAK,EAAC,MAAM;IAAA,GACPX;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_interface","require","_jsxRuntime","PluginSidebar","className","props","jsx","ComplementaryArea","panelClassName","scope"],"sources":["@wordpress/editor/src/components/plugin-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = React.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editor.PluginSidebar;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/editor';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebar( { className, ...props } ) {\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"editor-sidebar\"\n\t\t\tscope=\"core\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAAyD,IAAAC,WAAA,GAAAD,OAAA;AAHzD;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASE,aAAaA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EAChE,oBACC,IAAAH,WAAA,CAAAI,GAAA,EAACN,UAAA,CAAAO,iBAAiB;IACjBC,cAAc,EAAGJ,SAAW;IAC5BA,SAAS,EAAC,gBAAgB;IAC1BK,KAAK,EAAC,MAAM;IAAA,GACPJ;EAAK,CACV,CAAC;AAEJ","ignoreList":[]}
@@ -22,7 +22,7 @@ var _jsxRuntime = require("react/jsx-runtime");
22
22
  */
23
23
 
24
24
  const {
25
- DropdownMenuV2,
25
+ Menu,
26
26
  kebabCase
27
27
  } = (0, _lockUnlock.unlock)(_components.privateApis);
28
28
  function PostActions({
@@ -59,7 +59,7 @@ function PostActions({
59
59
  return !action.isEligible || action.isEligible(itemWithPermissions);
60
60
  });
61
61
  }, [allActions, itemWithPermissions]);
62
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuV2, {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu, {
63
63
  open: isActionsMenuOpen,
64
64
  trigger: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
65
65
  size: "small",
@@ -94,10 +94,10 @@ function DropdownMenuItemTrigger({
94
94
  items
95
95
  }) {
96
96
  const label = typeof action.label === 'string' ? action.label : action.label(items);
97
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuV2.Item, {
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Item, {
98
98
  onClick: onClick,
99
99
  hideOnClick: !action.RenderModal,
100
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuV2.ItemLabel, {
100
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.ItemLabel, {
101
101
  children: label
102
102
  })
103
103
  });
@@ -151,7 +151,7 @@ function ActionsDropdownMenuGroup({
151
151
  item,
152
152
  onClose
153
153
  }) {
154
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(DropdownMenuV2.Group, {
154
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Menu.Group, {
155
155
  children: actions.map(action => {
156
156
  if (action.RenderModal) {
157
157
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ActionWithModal, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","DropdownMenuV2","kebabCase","unlock","componentsPrivateApis","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","useState","item","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","itemWithPermissions","useMemo","allActions","usePostActions","actions","filter","action","isEligible","jsx","open","trigger","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","Item","hideOnClick","RenderModal","ItemLabel","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","jsxs","Fragment","Modal","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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 { DropdownMenuV2, kebabCase } = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, 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\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\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 || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<DropdownMenuV2\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenuV2>\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\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuV2.Item\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuV2.ItemLabel>{ label }</DropdownMenuV2.ItemLabel>\n\t\t</DropdownMenuV2.Item>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuV2.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\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={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</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AAY,EAAC,qBAAqB;MAClCpC,IAAI,EAAC,OAAO;MAAAY,QAAA,eAEZ,IAAA3C,WAAA,CAAA2B,GAAA,EAACuB,WAAW;QACXH,KAAK,EAAG,CAAEnC,IAAI,CAAI;QAClBwD,UAAU,EAAGA,CAAA,KAAM;UAClBb,cAAc,CAAE,KAAM,CAAC;UACvBV,OAAO,CAAC,CAAC;QACV;MAAG,CACH;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL;;AAEA;AACA;AACA,SAASD,wBAAwBA,CAAE;EAAErB,OAAO;EAAEX,IAAI;EAAEiC;AAAQ,CAAC,EAAG;EAC/D,oBACC,IAAA7C,WAAA,CAAA2B,GAAA,EAAC1B,cAAc,CAACoE,KAAK;IAAA1B,QAAA,EAClBpB,OAAO,CAAC+C,GAAG,CAAI7C,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACyB,WAAW,EAAG;QACzB,oBACC,IAAAlD,WAAA,CAAA2B,GAAA,EAACyB,eAAe;UAEf3B,MAAM,EAAGA,MAAQ;UACjBb,IAAI,EAAGA,IAAM;UACbyC,aAAa,EAAGP,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbpB,MAAM,CAACyC,EAKb,CAAC;MAEJ;MACA,oBACC,IAAAlE,WAAA,CAAA2B,GAAA,EAACmB,uBAAuB;QAEvBrB,MAAM,EAAGA,MAAQ;QACjBe,OAAO,EAAGA,CAAA,KAAMf,MAAM,CAAC8C,QAAQ,CAAE,CAAE3D,IAAI,CAAG,CAAG;QAC7CmC,KAAK,EAAG,CAAEnC,IAAI;MAAI,GAHZa,MAAM,CAACyC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACkB,CAAC;AAEzB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_i18n","_components","_icons","_coreData","_lockUnlock","_actions","_jsxRuntime","Menu","kebabCase","unlock","componentsPrivateApis","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","useState","item","permissions","useSelect","select","getEditedEntityRecord","getEntityRecordPermissions","coreStore","itemWithPermissions","useMemo","allActions","usePostActions","actions","filter","action","isEligible","jsx","open","trigger","Button","size","icon","moreVertical","label","__","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","Item","hideOnClick","RenderModal","ItemLabel","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","jsxs","Fragment","Modal","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","Group","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, 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\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\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 || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<Menu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</Menu>\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\n// Copied as is from packages/dataviews/src/item-actions.js\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 } hideOnClick={ ! action.RenderModal }>\n\t\t\t<Menu.ItemLabel>{ label }</Menu.ItemLabel>\n\t\t</Menu.Item>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<Menu.Group>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuIt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