@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
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 14.11.0 (2024-10-30)
6
+
7
+ ### Bug Fixes
8
+
9
+ - `Post Featured Image`: Fix `Set featured image` button's `box-shadow` transition to prevent border from flashing when focused.
10
+
11
+ ## 14.10.0 (2024-10-16)
12
+
5
13
  ## 14.9.0 (2024-10-03)
6
14
 
7
15
  ## 14.8.0 (2024-09-19)
package/README.md CHANGED
@@ -878,9 +878,9 @@ function onPreviewClick() {
878
878
  }
879
879
 
880
880
  const ExternalPreviewMenuItem = () => (
881
- <PreviewDropdownMenuItem icon={ external } onClick={ onPreviewClick }>
881
+ <PluginPreviewMenuItem icon={ external } onClick={ onPreviewClick }>
882
882
  { __( 'Preview in new tab' ) }
883
- </PreviewDropdownMenuItem>
883
+ </PluginPreviewMenuItem>
884
884
  );
885
885
  registerPlugin( 'external-preview-menu-item', {
886
886
  render: ExternalPreviewMenuItem,
@@ -4,13 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.bootstrapBlockBindingsSourcesFromServer = bootstrapBlockBindingsSourcesFromServer;
8
7
  exports.registerCoreBlockBindingsSources = registerCoreBlockBindingsSources;
9
8
  var _blocks = require("@wordpress/blocks");
10
- var _data = require("@wordpress/data");
11
9
  var _patternOverrides = _interopRequireDefault(require("./pattern-overrides"));
12
10
  var _postMeta = _interopRequireDefault(require("./post-meta"));
13
- var _lockUnlock = require("../lock-unlock");
14
11
  /**
15
12
  * WordPress dependencies
16
13
  */
@@ -33,30 +30,4 @@ function registerCoreBlockBindingsSources() {
33
30
  (0, _blocks.registerBlockBindingsSource)(_patternOverrides.default);
34
31
  (0, _blocks.registerBlockBindingsSource)(_postMeta.default);
35
32
  }
36
-
37
- /**
38
- * Function to bootstrap core block bindings sources defined in the server.
39
- *
40
- * @param {Object} sources Object containing the sources to bootstrap.
41
- *
42
- * @example
43
- * ```js
44
- * import { bootstrapBlockBindingsSourcesFromServer } from '@wordpress/editor';
45
- *
46
- * bootstrapBlockBindingsSourcesFromServer( sources );
47
- * ```
48
- */
49
- function bootstrapBlockBindingsSourcesFromServer(sources) {
50
- if (sources) {
51
- const {
52
- addBootstrappedBlockBindingsSource
53
- } = (0, _lockUnlock.unlock)((0, _data.dispatch)(_blocks.store));
54
- for (const [name, args] of Object.entries(sources)) {
55
- addBootstrappedBlockBindingsSource({
56
- name,
57
- ...args
58
- });
59
- }
60
- }
61
- }
62
33
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_patternOverrides","_interopRequireDefault","_postMeta","_lockUnlock","registerCoreBlockBindingsSources","registerBlockBindingsSource","patternOverrides","postMeta","bootstrapBlockBindingsSourcesFromServer","sources","addBootstrappedBlockBindingsSource","unlock","dispatch","blocksStore","name","args","Object","entries"],"sources":["@wordpress/editor/src/bindings/api.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore as blocksStore,\n\tregisterBlockBindingsSource,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport patternOverrides from './pattern-overrides';\nimport postMeta from './post-meta';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Function to register core block bindings sources provided by the editor.\n *\n * @example\n * ```js\n * import { registerCoreBlockBindingsSources } from '@wordpress/editor';\n *\n * registerCoreBlockBindingsSources();\n * ```\n */\nexport function registerCoreBlockBindingsSources() {\n\tregisterBlockBindingsSource( patternOverrides );\n\tregisterBlockBindingsSource( postMeta );\n}\n\n/**\n * Function to bootstrap core block bindings sources defined in the server.\n *\n * @param {Object} sources Object containing the sources to bootstrap.\n *\n * @example\n * ```js\n * import { bootstrapBlockBindingsSourcesFromServer } from '@wordpress/editor';\n *\n * bootstrapBlockBindingsSourcesFromServer( sources );\n * ```\n */\nexport function bootstrapBlockBindingsSourcesFromServer( sources ) {\n\tif ( sources ) {\n\t\tconst { addBootstrappedBlockBindingsSource } = unlock(\n\t\t\tdispatch( blocksStore )\n\t\t);\n\t\tfor ( const [ name, args ] of Object.entries( sources ) ) {\n\t\t\taddBootstrappedBlockBindingsSource( {\n\t\t\t\tname,\n\t\t\t\t...args,\n\t\t\t} );\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,gCAAgCA,CAAA,EAAG;EAClD,IAAAC,mCAA2B,EAAEC,yBAAiB,CAAC;EAC/C,IAAAD,mCAA2B,EAAEE,iBAAS,CAAC;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uCAAuCA,CAAEC,OAAO,EAAG;EAClE,IAAKA,OAAO,EAAG;IACd,MAAM;MAAEC;IAAmC,CAAC,GAAG,IAAAC,kBAAM,EACpD,IAAAC,cAAQ,EAAEC,aAAY,CACvB,CAAC;IACD,KAAM,MAAM,CAAEC,IAAI,EAAEC,IAAI,CAAE,IAAIC,MAAM,CAACC,OAAO,CAAER,OAAQ,CAAC,EAAG;MACzDC,kCAAkC,CAAE;QACnCI,IAAI;QACJ,GAAGC;MACJ,CAAE,CAAC;IACJ;EACD;AACD","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_patternOverrides","_interopRequireDefault","_postMeta","registerCoreBlockBindingsSources","registerBlockBindingsSource","patternOverrides","postMeta"],"sources":["@wordpress/editor/src/bindings/api.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport patternOverrides from './pattern-overrides';\nimport postMeta from './post-meta';\n\n/**\n * Function to register core block bindings sources provided by the editor.\n *\n * @example\n * ```js\n * import { registerCoreBlockBindingsSources } from '@wordpress/editor';\n *\n * registerCoreBlockBindingsSources();\n * ```\n */\nexport function registerCoreBlockBindingsSources() {\n\tregisterBlockBindingsSource( patternOverrides );\n\tregisterBlockBindingsSource( postMeta );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,gCAAgCA,CAAA,EAAG;EAClD,IAAAC,mCAA2B,EAAEC,yBAAiB,CAAC;EAC/C,IAAAD,mCAA2B,EAAEE,iBAAS,CAAC;AACxC","ignoreList":[]}
@@ -63,7 +63,8 @@ function getPostMetaFields(select, context) {
63
63
  value: // When using the entity value, an empty string IS a valid value.
64
64
  (_entityMetaValues$key = entityMetaValues?.[key]) !== null && _entityMetaValues$key !== void 0 ? _entityMetaValues$key :
65
65
  // When using the default, an empty string IS NOT a valid value.
66
- props.default || undefined
66
+ props.default || undefined,
67
+ type: props.type
67
68
  };
68
69
  }
69
70
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_store","_lockUnlock","getPostMetaFields","select","context","getEditedEntityRecord","coreDataStore","getRegisteredPostMeta","unlock","entityMetaValues","postType","postId","meta","registeredFields","metaFields","Object","entries","forEach","key","props","charAt","_entityMetaValues$key","label","title","value","default","undefined","keys","length","_default","exports","name","getValues","bindings","newValues","attributeName","source","_ref","fieldKey","args","fieldValue","fieldLabel","setValues","dispatch","newMeta","values","newValue","editEntityRecord","canUserEditValue","query","queryId","editorStore","getCurrentPostType","areCustomFieldsEnabled","getEditorSettings","enableCustomFields","canUserEdit","canUser","kind","id","getFieldsList"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Gets a list of post meta fields with their values and labels\n * to be consumed in the needed callbacks.\n * If the value is not available based on context, like in templates,\n * it falls back to the default value, label, or key.\n *\n * @param {Object} select The select function from the data store.\n * @param {Object} context The context provided.\n * @return {Object} List of post meta fields with their value and label.\n *\n * @example\n * ```js\n * {\n * field_1_key: {\n * label: 'Field 1 Label',\n * value: 'Field 1 Value',\n * },\n * field_2_key: {\n * label: 'Field 2 Label',\n * value: 'Field 2 Value',\n * },\n * ...\n * }\n * ```\n */\nfunction getPostMetaFields( select, context ) {\n\tconst { getEditedEntityRecord } = select( coreDataStore );\n\tconst { getRegisteredPostMeta } = unlock( select( coreDataStore ) );\n\n\tlet entityMetaValues;\n\t// Try to get the current entity meta values.\n\tif ( context?.postType && context?.postId ) {\n\t\tentityMetaValues = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tcontext?.postType,\n\t\t\tcontext?.postId\n\t\t).meta;\n\t}\n\n\tconst registeredFields = getRegisteredPostMeta( context?.postType );\n\tconst metaFields = {};\n\tObject.entries( registeredFields || {} ).forEach( ( [ key, props ] ) => {\n\t\t// Don't include footnotes or private fields.\n\t\tif ( key !== 'footnotes' && key.charAt( 0 ) !== '_' ) {\n\t\t\tmetaFields[ key ] = {\n\t\t\t\tlabel: props.title || key,\n\t\t\t\tvalue:\n\t\t\t\t\t// When using the entity value, an empty string IS a valid value.\n\t\t\t\t\tentityMetaValues?.[ key ] ??\n\t\t\t\t\t// When using the default, an empty string IS NOT a valid value.\n\t\t\t\t\t( props.default || undefined ),\n\t\t\t};\n\t\t}\n\t} );\n\n\tif ( ! Object.keys( metaFields || {} ).length ) {\n\t\treturn null;\n\t}\n\n\treturn metaFields;\n}\n\nexport default {\n\tname: 'core/post-meta',\n\tgetValues( { select, context, bindings } ) {\n\t\tconst metaFields = getPostMetaFields( select, context );\n\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, source ] of Object.entries( bindings ) ) {\n\t\t\t// Use the value, the field label, or the field key.\n\t\t\tconst fieldKey = source.args.key;\n\t\t\tconst { value: fieldValue, label: fieldLabel } =\n\t\t\t\tmetaFields?.[ fieldKey ] || {};\n\t\t\tnewValues[ attributeName ] = fieldValue ?? fieldLabel ?? fieldKey;\n\t\t}\n\t\treturn newValues;\n\t},\n\tsetValues( { dispatch, context, bindings } ) {\n\t\tconst newMeta = {};\n\t\tObject.values( bindings ).forEach( ( { args, newValue } ) => {\n\t\t\tnewMeta[ args.key ] = newValue;\n\t\t} );\n\n\t\tdispatch( coreDataStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\tcontext?.postType,\n\t\t\tcontext?.postId,\n\t\t\t{\n\t\t\t\tmeta: newMeta,\n\t\t\t}\n\t\t);\n\t},\n\tcanUserEditValue( { select, context, args } ) {\n\t\t// Lock editing in query loop.\n\t\tif ( context?.query || context?.queryId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst postType =\n\t\t\tcontext?.postType || select( editorStore ).getCurrentPostType();\n\n\t\t// Check that editing is happening in the post editor and not a template.\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fieldValue = getPostMetaFields( select, context )?.[ args.key ]\n\t\t\t?.value;\n\t\t// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.\n\t\tif ( fieldValue === undefined ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check that custom fields metabox is not enabled.\n\t\tconst areCustomFieldsEnabled =\n\t\t\tselect( editorStore ).getEditorSettings().enableCustomFields;\n\t\tif ( areCustomFieldsEnabled ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the user has the capability to edit post meta.\n\t\tconst canUserEdit = select( coreDataStore ).canUser( 'update', {\n\t\t\tkind: 'postType',\n\t\t\tname: context?.postType,\n\t\t\tid: context?.postId,\n\t\t} );\n\t\tif ( ! canUserEdit ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\tgetFieldsList( { select, context } ) {\n\t\treturn getPostMetaFields( select, context );\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;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,SAASG,iBAAiBA,CAAEC,MAAM,EAAEC,OAAO,EAAG;EAC7C,MAAM;IAAEC;EAAsB,CAAC,GAAGF,MAAM,CAAEG,eAAc,CAA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AO,KAAK;IACb;IAEA,MAAMxC,QAAQ,GACbN,OAAO,EAAEM,QAAQ,IAAIP,MAAM,CAAEgD,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC;;IAEhE;IACA,IAAK1C,QAAQ,KAAK,aAAa,EAAG;MACjC,OAAO,KAAK;IACb;IAEA,MAAM8B,UAAU,GAAGtC,iBAAiB,CAAEC,MAAM,EAAEC,OAAQ,CAAC,GAAImC,IAAI,CAACrB,GAAG,CAAE,EAClEM,KAAK;IACR;IACA,IAAKgB,UAAU,KAAKd,SAAS,EAAG;MAC/B,OAAO,KAAK;IACb;IACA;IACA,MAAM2B,sBAAsB,GAC3BlD,MAAM,CAAEgD,YAAY,CAAC,CAACG,iBAAiB,CAAC,CAAC,CAACC,kBAAkB;IAC7D,IAAKF,sBAAsB,EAAG;MAC7B,OAAO,KAAK;IACb;;IAEA;IACA,MAAMG,WAAW,GAAGrD,MAAM,CAAEG,eAAc,CAAC,CAACmD,OAAO,CAAE,QAAQ,EAAE;MAC9DC,IAAI,EAAE,UAAU;MAChB3B,IAAI,EAAE3B,OAAO,EAAEM,QAAQ;MACvBiD,EAAE,EAAEvD,OAAO,EAAEO;IACd,CAAE,CAAC;IACH,IAAK,CAAE6C,WAAW,EAAG;MACpB,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAC;EACDI,aAAaA,CAAE;IAAEzD,MAAM;IAAEC;EAAQ,CAAC,EAAG;IACpC,OAAOF,iBAAiB,CAAEC,MAAM,EAAEC,OAAQ,CAAC;EAC5C;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_store","_lockUnlock","getPostMetaFields","select","context","getEditedEntityRecord","coreDataStore","getRegisteredPostMeta","unlock","entityMetaValues","postType","postId","meta","registeredFields","metaFields","Object","entries","forEach","key","props","charAt","_entityMetaValues$key","label","title","value","default","undefined","type","keys","length","_default","exports","name","getValues","bindings","newValues","attributeName","source","_ref","fieldKey","args","fieldValue","fieldLabel","setValues","dispatch","newMeta","values","newValue","editEntityRecord","canUserEditValue","query","queryId","editorStore","getCurrentPostType","areCustomFieldsEnabled","getEditorSettings","enableCustomFields","canUserEdit","canUser","kind","id","getFieldsList"],"sources":["@wordpress/editor/src/bindings/post-meta.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Gets a list of post meta fields with their values and labels\n * to be consumed in the needed callbacks.\n * If the value is not available based on context, like in templates,\n * it falls back to the default value, label, or key.\n *\n * @param {Object} select The select function from the data store.\n * @param {Object} context The context provided.\n * @return {Object} List of post meta fields with their value and label.\n *\n * @example\n * ```js\n * {\n * field_1_key: {\n * label: 'Field 1 Label',\n * value: 'Field 1 Value',\n * },\n * field_2_key: {\n * label: 'Field 2 Label',\n * value: 'Field 2 Value',\n * },\n * ...\n * }\n * ```\n */\nfunction getPostMetaFields( select, context ) {\n\tconst { getEditedEntityRecord } = select( coreDataStore );\n\tconst { getRegisteredPostMeta } = unlock( select( coreDataStore ) );\n\n\tlet entityMetaValues;\n\t// Try to get the current entity meta values.\n\tif ( context?.postType && context?.postId ) {\n\t\tentityMetaValues = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tcontext?.postType,\n\t\t\tcontext?.postId\n\t\t).meta;\n\t}\n\n\tconst registeredFields = getRegisteredPostMeta( context?.postType );\n\tconst metaFields = {};\n\tObject.entries( registeredFields || {} ).forEach( ( [ key, props ] ) => {\n\t\t// Don't include footnotes or private fields.\n\t\tif ( key !== 'footnotes' && key.charAt( 0 ) !== '_' ) {\n\t\t\tmetaFields[ key ] = {\n\t\t\t\tlabel: props.title || key,\n\t\t\t\tvalue:\n\t\t\t\t\t// When using the entity value, an empty string IS a valid value.\n\t\t\t\t\tentityMetaValues?.[ key ] ??\n\t\t\t\t\t// When using the default, an empty string IS NOT a valid value.\n\t\t\t\t\t( props.default || undefined ),\n\t\t\t\ttype: props.type,\n\t\t\t};\n\t\t}\n\t} );\n\n\tif ( ! Object.keys( metaFields || {} ).length ) {\n\t\treturn null;\n\t}\n\n\treturn metaFields;\n}\n\nexport default {\n\tname: 'core/post-meta',\n\tgetValues( { select, context, bindings } ) {\n\t\tconst metaFields = getPostMetaFields( select, context );\n\n\t\tconst newValues = {};\n\t\tfor ( const [ attributeName, source ] of Object.entries( bindings ) ) {\n\t\t\t// Use the value, the field label, or the field key.\n\t\t\tconst fieldKey = source.args.key;\n\t\t\tconst { value: fieldValue, label: fieldLabel } =\n\t\t\t\tmetaFields?.[ fieldKey ] || {};\n\t\t\tnewValues[ attributeName ] = fieldValue ?? fieldLabel ?? fieldKey;\n\t\t}\n\t\treturn newValues;\n\t},\n\tsetValues( { dispatch, context, bindings } ) {\n\t\tconst newMeta = {};\n\t\tObject.values( bindings ).forEach( ( { args, newValue } ) => {\n\t\t\tnewMeta[ args.key ] = newValue;\n\t\t} );\n\n\t\tdispatch( coreDataStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\tcontext?.postType,\n\t\t\tcontext?.postId,\n\t\t\t{\n\t\t\t\tmeta: newMeta,\n\t\t\t}\n\t\t);\n\t},\n\tcanUserEditValue( { select, context, args } ) {\n\t\t// Lock editing in query loop.\n\t\tif ( context?.query || context?.queryId ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst postType =\n\t\t\tcontext?.postType || select( editorStore ).getCurrentPostType();\n\n\t\t// Check that editing is happening in the post editor and not a template.\n\t\tif ( postType === 'wp_template' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst fieldValue = getPostMetaFields( select, context )?.[ args.key ]\n\t\t\t?.value;\n\t\t// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.\n\t\tif ( fieldValue === undefined ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Check that custom fields metabox is not enabled.\n\t\tconst areCustomFieldsEnabled =\n\t\t\tselect( editorStore ).getEditorSettings().enableCustomFields;\n\t\tif ( areCustomFieldsEnabled ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Check that the user has the capability to edit post meta.\n\t\tconst canUserEdit = select( coreDataStore ).canUser( 'update', {\n\t\t\tkind: 'postType',\n\t\t\tname: context?.postType,\n\t\t\tid: context?.postId,\n\t\t} );\n\t\tif ( ! canUserEdit ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\tgetFieldsList( { select, context } ) {\n\t\treturn getPostMetaFields( select, context );\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;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,SAASG,iBAAiBA,CAAEC,MAAM,EAAEC,OAAO,EAAG;EAC7C,MAAM;IAAEC;EAAsB,CAAC,GAAGF,MAAM,CAAEG,eAAc,CAAC;EACzD,MAAM;IAAEC;EAAsB,CAAC,GAAG,IAAAC,kBAAM,EAAEL,MAAM,CAAEG,eAAc,CAAE,CAAC;EAEnE,IAAIG,gBAAgB;EACpB;EACA,IAAKL,OAAO,EAAEM,QAAQ,IAAIN,OAAO,EAAEO,MAAM,EAAG;IAC3CF,gBAAgB,GAAGJ,qBAAqB,CACvC,UAAU,EACVD,OAAO,EAAEM,QAAQ,EACjBN,OAAO,EAAEO,MACV,CAAC,CAACC,IAAI;EACP;EAEA,MAAMC,gBAAgB,GAAGN,qBAAqB,CAAEH,OAAO,EAAEM,QAAS,CAAC;EACnE,MAAMI,UAAU,GAAG,CAAC,CAAC;EACrBC,MAAM,CAACC,OAAO,CAAEH,gBAAgB,IAAI,CAAC,CAAE,CAAC,CAACI,OAAO,CAAE,CAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE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F,sBAAsB,EAAG;MAC7B,OAAO,KAAK;IACb;;IAEA;IACA,MAAMG,WAAW,GAAGtD,MAAM,CAAEG,eAAc,CAAC,CAACoD,OAAO,CAAE,QAAQ,EAAE;MAC9DC,IAAI,EAAE,UAAU;MAChB3B,IAAI,EAAE5B,OAAO,EAAEM,QAAQ;MACvBkD,EAAE,EAAExD,OAAO,EAAEO;IACd,CAAE,CAAC;IACH,IAAK,CAAE8C,WAAW,EAAG;MACpB,OAAO,KAAK;IACb;IAEA,OAAO,IAAI;EACZ,CAAC;EACDI,aAAaA,CAAE;IAAE1D,MAAM;IAAEC;EAAQ,CAAC,EAAG;IACpC,OAAOF,iBAAiB,CAAEC,MAAM,EAAEC,OAAQ,CAAC;EAC5C;AACD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_coreData","_jsxRuntime","getUserLabel","user","avatar","avatar_urls","jsx","className","alt","src","jsxs","Fragment","children","name","slug","_default","exports","default","triggerPrefix","useItems","filterValue","users","useSelect","select","getUsers","coreStore","context","search","encodeURIComponent","options","useMemo","map","key","value","label","getOptionCompletion"],"sources":["@wordpress/editor/src/components/autocompleters/user.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */\n\nexport function getUserLabel( user ) {\n\tconst avatar =\n\t\tuser.avatar_urls && user.avatar_urls[ 24 ] ? (\n\t\t\t<img\n\t\t\t\tclassName=\"editor-autocompleters__user-avatar\"\n\t\t\t\talt=\"\"\n\t\t\t\tsrc={ user.avatar_urls[ 24 ] }\n\t\t\t/>\n\t\t) : (\n\t\t\t<span className=\"editor-autocompleters__no-avatar\"></span>\n\t\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ avatar }\n\t\t\t<span className=\"editor-autocompleters__user-name\">\n\t\t\t\t{ user.name }\n\t\t\t</span>\n\t\t\t<span className=\"editor-autocompleters__user-slug\">\n\t\t\t\t{ user.slug }\n\t\t\t</span>\n\t\t</>\n\t);\n}\n\n/**\n * A user mentions completer.\n *\n * @type {WPCompleter}\n */\nexport default {\n\tname: 'users',\n\tclassName: 'editor-autocompleters__user',\n\ttriggerPrefix: '@',\n\n\tuseItems( filterValue ) {\n\t\tconst users = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getUsers } = select( coreStore );\n\t\t\t\treturn getUsers( {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tsearch: encodeURIComponent( filterValue ),\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ filterValue ]\n\t\t);\n\n\t\tconst options = useMemo(\n\t\t\t() =>\n\t\t\t\tusers\n\t\t\t\t\t? users.map( ( user ) => ( {\n\t\t\t\t\t\t\tkey: `user-${ user.slug }`,\n\t\t\t\t\t\t\tvalue: user,\n\t\t\t\t\t\t\tlabel: getUserLabel( user ),\n\t\t\t\t\t } ) )\n\t\t\t\t\t: [],\n\t\t\t[ users ]\n\t\t);\n\n\t\treturn [ options ];\n\t},\n\n\tgetOptionCompletion( user ) {\n\t\treturn `@${ user.slug }`;\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAA0D,IAAAG,WAAA,GAAAH,OAAA;AAL1D;AACA;AACA;;AAKA;;AAEO,SAASI,YAAYA,CAAEC,IAAI,EAAG;EACpC,MAAMC,MAAM,GACXD,IAAI,CAACE,WAAW,IAAIF,IAAI,CAACE,WAAW,CAAE,EAAE,CAAE,gBACzC,IAAAJ,WAAA,CAAAK,GAAA;IACCC,SAAS,EAAC,oCAAoC;IAC9CC,GAAG,EAAC,EAAE;IACNC,GAAG,EAAGN,IAAI,CAACE,WAAW,CAAE,EAAE;EAAI,CAC9B,CAAC,gBAEF,IAAAJ,WAAA,CAAAK,GAA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AI,CAACW,IAAM,EAAC;EACzB;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_jsxRuntime","getUserLabel","user","avatar","avatar_urls","jsx","className","alt","src","jsxs","Fragment","children","name","slug","_default","exports","default","triggerPrefix","useItems","filterValue","users","useSelect","select","getUsers","coreStore","context","search","encodeURIComponent","options","useMemo","map","key","value","label","getOptionCompletion"],"sources":["@wordpress/editor/src/components/autocompleters/user.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */\n\nexport function getUserLabel( user ) {\n\tconst avatar =\n\t\tuser.avatar_urls && user.avatar_urls[ 24 ] ? (\n\t\t\t<img\n\t\t\t\tclassName=\"editor-autocompleters__user-avatar\"\n\t\t\t\talt=\"\"\n\t\t\t\tsrc={ user.avatar_urls[ 24 ] }\n\t\t\t/>\n\t\t) : (\n\t\t\t<span className=\"editor-autocompleters__no-avatar\"></span>\n\t\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ avatar }\n\t\t\t<span className=\"editor-autocompleters__user-name\">\n\t\t\t\t{ user.name }\n\t\t\t</span>\n\t\t\t<span className=\"editor-autocompleters__user-slug\">\n\t\t\t\t{ user.slug }\n\t\t\t</span>\n\t\t</>\n\t);\n}\n\n/**\n * A user mentions completer.\n *\n * @type {WPCompleter}\n */\nexport default {\n\tname: 'users',\n\tclassName: 'editor-autocompleters__user',\n\ttriggerPrefix: '@',\n\n\tuseItems( filterValue ) {\n\t\tconst users = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getUsers } = select( coreStore );\n\t\t\t\treturn getUsers( {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tsearch: encodeURIComponent( filterValue ),\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ filterValue ]\n\t\t);\n\n\t\tconst options = useMemo(\n\t\t\t() =>\n\t\t\t\tusers\n\t\t\t\t\t? users.map( ( user ) => ( {\n\t\t\t\t\t\t\tkey: `user-${ user.slug }`,\n\t\t\t\t\t\t\tvalue: user,\n\t\t\t\t\t\t\tlabel: getUserLabel( user ),\n\t\t\t\t\t } ) )\n\t\t\t\t\t: [],\n\t\t\t[ users ]\n\t\t);\n\n\t\treturn [ options ];\n\t},\n\n\tgetOptionCompletion( user ) {\n\t\treturn `@${ user.slug }`;\n\t},\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAA0D,IAAAG,WAAA,GAAAH,OAAA;AAL1D;AACA;AACA;;AAKA;;AAEO,SAASI,YAAYA,CAAEC,IAAI,EAAG;EACpC,MAAMC,MAAM,GACXD,IAAI,CAACE,WAAW,IAAIF,IAAI,CAACE,WAAW,CAAE,EAAE,CAAE,gBACzC,IAAAJ,WAAA,CAAAK,GAAA;IACCC,SAAS,EAAC,oCAAoC;IAC9CC,GAAG,EAAC,EAAE;IACNC,GAAG,EAAGN,IAAI,CAACE,WAAW,CAAE,EAAE;EAAI,CAC9B,CAAC,gBAEF,IAAAJ,WAAA,CAAAK,GAAA;IAAMC,SAAS,EAAC;EAAkC,CAAO,CACzD;EAEF,oBACC,IAAAN,WAAA,CAAAS,IAAA,EAAAT,WAAA,CAAAU,QAAA;IAAAC,QAAA,GACGR,MAAM,eACR,IAAAH,WAAA,CAAAK,GAAA;MAAMC,SAAS,EAAC,kCAAkC;MAAAK,QAAA,EAC/CT,IAAI,CAACU;IAAI,CACN,CAAC,eACP,IAAAZ,WAAA,CAAAK,GAAA;MAAMC,SAAS,EAAC,kCAAkC;MAAAK,QAAA,EAC/CT,IAAI,CAACW;IAAI,CACN,CAAC;EAAA,CACN,CAAC;AAEL;;AAEA;AACA;AACA;AACA;AACA;AAJA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACdJ,IAAI,EAAE,OAAO;EACbN,SAAS,EAAE,6BAA6B;EACxCW,aAAa,EAAE,GAAG;EAElBC,QAAQA,CAAEC,WAAW,EAAG;IACvB,MAAMC,KAAK,GAAG,IAAAC,eAAS,EACpBC,MAAM,IAAM;MACb,MAAM;QAAEC;MAAS,CAAC,GAAGD,MAAM,CAAEE,eAAU,CAAC;MACxC,OAAOD,QAAQ,CAAE;QAChBE,OAAO,EAAE,MAAM;QACfC,MAAM,EAAEC,kBAAkB,CAAER,WAAY;MACzC,CAAE,CAAC;IACJ,CAAC,EACD,CAAEA,WAAW,CACd,CAAC;IAED,MAAMS,OAAO,GAAG,IAAAC,gBAAO,EACtB,MACCT,KAAK,GACFA,KAAK,CAACU,GAAG,CAAI5B,IAAI,KAAQ;MACzB6B,GAAG,EAAE,QAAS7B,IAAI,CAACW,IAAI,EAAG;MAC1BmB,KAAK,EAAE9B,IAAI;MACX+B,KAAK,EAAEhC,YAAY,CAAEC,IAAK;IAC1B,CAAC,CAAG,CAAC,GACL,EAAE,EACN,CAAEkB,KAAK,CACR,CAAC;IAED,OAAO,CAAEQ,OAAO,CAAE;EACnB,CAAC;EAEDM,mBAAmBA,CAAEhC,IAAI,EAAG;IAC3B,OAAO,IAAKA,IAAI,CAACW,IAAI,EAAG;EACzB;AACD,CAAC","ignoreList":[]}
@@ -70,7 +70,7 @@ function BlockManager() {
70
70
  return;
71
71
  }
72
72
  const count = filteredBlockTypes.length;
73
- const resultsFoundMessage = (0, _i18n.sprintf)( /* translators: %d: number of results. */
73
+ const resultsFoundMessage = (0, _i18n.sprintf)(/* translators: %d: number of results. */
74
74
  (0, _i18n._n)('%d result found.', '%d results found.', count), count);
75
75
  debouncedSpeak(resultsFoundMessage);
76
76
  }, [filteredBlockTypes?.length, search, debouncedSpeak]);
@@ -78,7 +78,7 @@ function BlockManager() {
78
78
  className: "editor-block-manager__content",
79
79
  children: [!!numberOfHiddenBlocks && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
80
  className: "editor-block-manager__disabled-blocks-count",
81
- children: [(0, _i18n.sprintf)( /* translators: %d: number of blocks. */
81
+ children: [(0, _i18n.sprintf)(/* translators: %d: number of blocks. */
82
82
  (0, _i18n._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
83
83
  __next40pxDefaultSize: true,
84
84
  variant: "link",
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_preferences","_lockUnlock","_store","_category","_interopRequireDefault","_jsxRuntime","BlockManager","debouncedSpeak","useDebounce","speak","search","setSearch","useState","showBlockTypes","unlock","useDispatch","editorStore","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","useSelect","select","_select$get","_blockTypes","blocksStore","getBlockTypes","hiddenBlockTypes","preferencesStore","get","filter","hiddenBlock","some","registeredBlock","name","getCategories","Array","isArray","length","enableAllBlockTypes","newBlockTypes","blockNames","map","filteredBlockTypes","blockType","parent","includes","useEffect","count","resultsFoundMessage","sprintf","_n","jsxs","className","children","jsx","Button","__next40pxDefaultSize","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","category","default","title","slug"],"sources":["@wordpress/editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport BlockManagerCategory from './category';\n\nexport default function BlockManager() {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst { showBlockTypes } = unlock( useDispatch( editorStore ) );\n\n\tconst {\n\t\tblockTypes,\n\t\tcategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t} = useSelect( ( select ) => {\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst _blockTypes = select( blocksStore ).getBlockTypes();\n\t\tconst hiddenBlockTypes = (\n\t\t\tselect( preferencesStore ).get( 'core', 'hiddenBlockTypes' ) ?? []\n\t\t).filter( ( hiddenBlock ) => {\n\t\t\treturn _blockTypes.some(\n\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t);\n\t\t} );\n\n\t\treturn {\n\t\t\tblockTypes: _blockTypes,\n\t\t\tcategories: select( blocksStore ).getCategories(),\n\t\t\thasBlockSupport: select( blocksStore ).hasBlockSupport,\n\t\t\tisMatchingSearchTerm: select( blocksStore ).isMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks:\n\t\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length,\n\t\t};\n\t}, [] );\n\n\tfunction enableAllBlockTypes( newBlockTypes ) {\n\t\tconst blockNames = newBlockTypes.map( ( { name } ) => name );\n\t\tshowBlockTypes( blockNames );\n\t}\n\n\tconst filteredBlockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filteredBlockTypes?.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tenableAllBlockTypes( filteredBlockTypes )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filteredBlockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filteredBlockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAC,sBAAA,CAAAX,OAAA;AAA8C,IAAAY,WAAA,GAAAZ,OAAA;AAjB9C;AACA;AACA;;AAUA;AACA;AACA;;AAKe,SAASa,YAAYA,CAAA,EAAG;EACtC,MAAMC,cAAc,GAAG,IAAAC,oBAAW,EAAEC,WAAK,EAAE,GAAI,CAAC;EAChD,MAAM,CAAEC,MAAM,EAAEC,SAAS,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC5C,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iB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WAAW,EAAG,IAAAJ,QAAE,EAAE,oBAAqB,CAAG;MAC1CK,KAAK,EAAGxD,MAAQ;MAChByD,QAAQ,EAAKC,UAAU,IAAMzD,SAAS,CAAEyD,UAAW,CAAG;MACtDd,SAAS,EAAC;IAA8B,CACxC,CAAC,eACF,IAAAjD,WAAA,CAAAgD,IAAA;MACCgB,QAAQ,EAAC,GAAG;MACZC,IAAI,EAAC,QAAQ;MACb,cAAa,IAAAT,QAAE,EAAE,uBAAwB,CAAG;MAC5CP,SAAS,EAAC,+BAA+B;MAAAC,QAAA,GAEvCX,kBAAkB,CAACL,MAAM,KAAK,CAAC,iBAChC,IAAAlC,WAAA,CAAAmD,GAAA;QAAGF,SAAS,EAAC,kCAAkC;QAAAC,QAAA,EAC5C,IAAAM,QAAE,EAAE,kBAAmB;MAAC,CACxB,CACH,EACC3C,UAAU,CAACyB,GAAG,CAAI4B,QAAQ,iBAC3B,IAAAlE,WAAA,CAAAmD,GAAA,EAACrD,SAAA,CAAAqE,OAAoB;QAEpBC,KAAK,EAAGF,QAAQ,CAACE,KAAO;QACxBxD,UAAU,EAAG2B,kBAAkB,CAACb,MAAM,CACnCc,SAAS,IACVA,SAAS,CAAC0B,QAAQ,KAAKA,QAAQ,CAACG,IAClC;MAAG,GALGH,QAAQ,CAACG,IAMf,CACA,CAAC,eACH,IAAArE,WAAA,CAAAmD,GAAA,EAACrD,SAAA,CAAAqE,OAAoB;QACpBC,KAAK,EAAG,IAAAZ,QAAE,EAAE,eAAgB,CAAG;QAC/B5C,UAAU,EAAG2B,kBAAkB,CAACb,MAAM,CACrC,CAAE;UAAEwC;QAAS,CAAC,KAAM,CAAEA,QACvB;MAAG,CACH,CAAC;IAAA,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_preferences","_lockUnlock","_store","_category","_interopRequireDefault","_jsxRuntime","BlockManager","debouncedSpeak","useDebounce","speak","search","setSearch","useState","showBlockTypes","unlock","useDispatch","editorStore","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","useSelect","select","_select$get","_blockTypes","blocksStore","getBlockTypes","hiddenBlockTypes","preferencesStore","get","filter","hiddenBlock","some","registeredBlock","name","getCategories","Array","isArray","length","enableAllBlockTypes","newBlockTypes","blockNames","map","filteredBlockTypes","blockType","parent","includes","useEffect","count","resultsFoundMessage","sprintf","_n","jsxs","className","children","jsx","Button","__next40pxDefaultSize","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","category","default","title","slug"],"sources":["@wordpress/editor/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport BlockManagerCategory from './category';\n\nexport default function BlockManager() {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst { showBlockTypes } = unlock( useDispatch( editorStore ) );\n\n\tconst {\n\t\tblockTypes,\n\t\tcategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t} = useSelect( ( select ) => {\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst _blockTypes = select( blocksStore ).getBlockTypes();\n\t\tconst hiddenBlockTypes = (\n\t\t\tselect( preferencesStore ).get( 'core', 'hiddenBlockTypes' ) ?? []\n\t\t).filter( ( hiddenBlock ) => {\n\t\t\treturn _blockTypes.some(\n\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t);\n\t\t} );\n\n\t\treturn {\n\t\t\tblockTypes: _blockTypes,\n\t\t\tcategories: select( blocksStore ).getCategories(),\n\t\t\thasBlockSupport: select( blocksStore ).hasBlockSupport,\n\t\t\tisMatchingSearchTerm: select( blocksStore ).isMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks:\n\t\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length,\n\t\t};\n\t}, [] );\n\n\tfunction enableAllBlockTypes( newBlockTypes ) {\n\t\tconst blockNames = newBlockTypes.map( ( { name } ) => name );\n\t\tshowBlockTypes( blockNames );\n\t}\n\n\tconst filteredBlockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filteredBlockTypes?.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"editor-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"editor-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tenableAllBlockTypes( filteredBlockTypes )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"editor-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"editor-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"editor-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filteredBlockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filteredBlockTypes.filter(\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GF,SAAS,EAAC,kCAAkC;QAAAC,QAAA,EAC5C,IAAAM,QAAE,EAAE,kBAAmB;MAAC,CACxB,CACH,EACC3C,UAAU,CAACyB,GAAG,CAAI4B,QAAQ,iBAC3B,IAAAlE,WAAA,CAAAmD,GAAA,EAACrD,SAAA,CAAAqE,OAAoB;QAEpBC,KAAK,EAAGF,QAAQ,CAACE,KAAO;QACxBxD,UAAU,EAAG2B,kBAAkB,CAACb,MAAM,CACnCc,SAAS,IACVA,SAAS,CAAC0B,QAAQ,KAAKA,QAAQ,CAACG,IAClC;MAAG,GALGH,QAAQ,CAACG,IAMf,CACA,CAAC,eACH,IAAArE,WAAA,CAAAmD,GAAA,EAACrD,SAAA,CAAAqE,OAAoB;QACpBC,KAAK,EAAG,IAAAZ,QAAE,EAAE,eAAgB,CAAG;QAC/B5C,UAAU,EAAG2B,kBAAkB,CAACb,MAAM,CACrC,CAAE;UAAEwC;QAAS,CAAC,KAAM,CAAEA,QACvB;MAAG,CACH,CAAC;IAAA,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AddComment = AddComment;
7
+ var _i18n = require("@wordpress/i18n");
8
+ var _data = require("@wordpress/data");
9
+ var _element = require("@wordpress/element");
10
+ var _components = require("@wordpress/components");
11
+ var _blockEditor = require("@wordpress/block-editor");
12
+ var _coreData = require("@wordpress/core-data");
13
+ var _utils = require("./utils");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ /**
16
+ * WordPress dependencies
17
+ */
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
23
+ /**
24
+ * Renders the UI for adding a comment in the Gutenberg editor's collaboration sidebar.
25
+ *
26
+ * @param {Object} props - The component props.
27
+ * @param {Function} props.onSubmit - A callback function to be called when the user submits a comment.
28
+ * @param {boolean} props.showCommentBoard - The function to edit the comment.
29
+ * @param {Function} props.setShowCommentBoard - The function to delete the comment.
30
+ * @return {JSX.Element} The rendered comment input UI.
31
+ */
32
+ function AddComment({
33
+ onSubmit,
34
+ showCommentBoard,
35
+ setShowCommentBoard
36
+ }) {
37
+ var _currentUser$name;
38
+ // State to manage the comment thread.
39
+ const [inputComment, setInputComment] = (0, _element.useState)('');
40
+ const {
41
+ defaultAvatar,
42
+ clientId,
43
+ blockCommentId,
44
+ showAddCommentBoard,
45
+ currentUser
46
+ } = (0, _data.useSelect)(select => {
47
+ const {
48
+ getSettings
49
+ } = select(_blockEditor.store);
50
+ const {
51
+ __experimentalDiscussionSettings
52
+ } = getSettings();
53
+ const selectedBlock = select(_blockEditor.store).getSelectedBlock();
54
+ const userData = select(_coreData.store).getCurrentUser();
55
+ return {
56
+ defaultAvatar: __experimentalDiscussionSettings?.avatarURL,
57
+ clientId: selectedBlock?.clientId,
58
+ blockCommentId: selectedBlock?.attributes?.blockCommentId,
59
+ showAddCommentBoard: showCommentBoard,
60
+ currentUser: userData
61
+ };
62
+ });
63
+ const userAvatar = currentUser && currentUser.avatar_urls && currentUser.avatar_urls[48] ? currentUser.avatar_urls[48] : defaultAvatar;
64
+ (0, _element.useEffect)(() => {
65
+ setInputComment('');
66
+ }, [clientId]);
67
+ const handleCancel = () => {
68
+ setShowCommentBoard(false);
69
+ setInputComment('');
70
+ };
71
+ if (!showAddCommentBoard || !clientId || undefined !== blockCommentId) {
72
+ return null;
73
+ }
74
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
75
+ spacing: "3",
76
+ className: "editor-collab-sidebar-panel__thread editor-collab-sidebar-panel__active-thread",
77
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
78
+ alignment: "left",
79
+ spacing: "3",
80
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
81
+ src: userAvatar
82
+ // translators: alt text for user avatar image
83
+ ,
84
+ alt: (0, _i18n.__)('User Avatar'),
85
+ className: "editor-collab-sidebar-panel__user-avatar",
86
+ width: 32,
87
+ height: 32
88
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
89
+ className: "editor-collab-sidebar-panel__user-name",
90
+ children: (_currentUser$name = currentUser?.name) !== null && _currentUser$name !== void 0 ? _currentUser$name : ''
91
+ })]
92
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
93
+ __next40pxDefaultSize: true,
94
+ __nextHasNoMarginBottom: true,
95
+ value: inputComment,
96
+ onChange: setInputComment,
97
+ placeholder: (0, _i18n._x)('Comment', 'noun')
98
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
99
+ alignment: "right",
100
+ spacing: "3",
101
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
102
+ __next40pxDefaultSize: true,
103
+ variant: "tertiary",
104
+ text: (0, _i18n._x)('Cancel', 'Cancel comment button'),
105
+ onClick: handleCancel
106
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
107
+ __next40pxDefaultSize: true,
108
+ accessibleWhenDisabled: true,
109
+ variant: "primary",
110
+ text: (0, _i18n._x)('Comment', 'Add comment button'),
111
+ disabled: 0 === (0, _utils.sanitizeCommentString)(inputComment).length,
112
+ onClick: () => {
113
+ onSubmit(inputComment);
114
+ setInputComment('');
115
+ }
116
+ })]
117
+ })]
118
+ });
119
+ }
120
+ //# sourceMappingURL=add-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_data","_element","_components","_blockEditor","_coreData","_utils","_jsxRuntime","AddComment","onSubmit","showCommentBoard","setShowCommentBoard","_currentUser$name","inputComment","setInputComment","useState","defaultAvatar","clientId","blockCommentId","showAddCommentBoard","currentUser","useSelect","select","getSettings","blockEditorStore","__experimentalDiscussionSettings","selectedBlock","getSelectedBlock","userData","coreStore","getCurrentUser","avatarURL","attributes","userAvatar","avatar_urls","useEffect","handleCancel","undefined","jsxs","__experimentalVStack","spacing","className","children","__experimentalHStack","alignment","jsx","src","alt","__","width","height","name","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","value","onChange","placeholder","_x","Button","variant","text","onClick","accessibleWhenDisabled","disabled","sanitizeCommentString","length"],"sources":["@wordpress/editor/src/components/collab-sidebar/add-comment.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useEffect } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n} from '@wordpress/components';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { sanitizeCommentString } from './utils';\n\n/**\n * Renders the UI for adding a comment in the Gutenberg editor's collaboration sidebar.\n *\n * @param {Object} props - The component props.\n * @param {Function} props.onSubmit - A callback function to be called when the user submits a comment.\n * @param {boolean} props.showCommentBoard - The function to edit the comment.\n * @param {Function} props.setShowCommentBoard - The function to delete the comment.\n * @return {JSX.Element} The rendered comment input UI.\n */\nexport function AddComment( {\n\tonSubmit,\n\tshowCommentBoard,\n\tsetShowCommentBoard,\n} ) {\n\t// State to manage the comment thread.\n\tconst [ inputComment, setInputComment ] = useState( '' );\n\n\tconst {\n\t\tdefaultAvatar,\n\t\tclientId,\n\t\tblockCommentId,\n\t\tshowAddCommentBoard,\n\t\tcurrentUser,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\tconst selectedBlock = select( blockEditorStore ).getSelectedBlock();\n\t\tconst userData = select( coreStore ).getCurrentUser();\n\t\treturn {\n\t\t\tdefaultAvatar: __experimentalDiscussionSettings?.avatarURL,\n\t\t\tclientId: selectedBlock?.clientId,\n\t\t\tblockCommentId: selectedBlock?.attributes?.blockCommentId,\n\t\t\tshowAddCommentBoard: showCommentBoard,\n\t\t\tcurrentUser: userData,\n\t\t};\n\t} );\n\n\tconst userAvatar =\n\t\tcurrentUser && currentUser.avatar_urls && currentUser.avatar_urls[ 48 ]\n\t\t\t? currentUser.avatar_urls[ 48 ]\n\t\t\t: defaultAvatar;\n\n\tuseEffect( () => {\n\t\tsetInputComment( '' );\n\t}, [ clientId ] );\n\n\tconst handleCancel = () => {\n\t\tsetShowCommentBoard( false );\n\t\tsetInputComment( '' );\n\t};\n\n\tif ( ! showAddCommentBoard || ! clientId || undefined !== blockCommentId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing=\"3\"\n\t\t\tclassName=\"editor-collab-sidebar-panel__thread editor-collab-sidebar-panel__active-thread\"\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\">\n\t\t\t\t<img\n\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\t\talt={ __( 'User Avatar' ) }\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t\twidth={ 32 }\n\t\t\t\t\theight={ 32 }\n\t\t\t\t/>\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ currentUser?.name ?? '' }\n\t\t\t\t</span>\n\t\t\t</HStack>\n\t\t\t<TextControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ inputComment }\n\t\t\t\tonChange={ setInputComment }\n\t\t\t\tplaceholder={ _x( 'Comment', 'noun' ) }\n\t\t\t/>\n\t\t\t<HStack alignment=\"right\" spacing=\"3\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\ttext={ _x( 'Cancel', 'Cancel comment button' ) }\n\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\ttext={ _x( 'Comment', 'Add comment button' ) }\n\t\t\t\t\tdisabled={\n\t\t\t\t\t\t0 === sanitizeCommentString( inputComment ).length\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonSubmit( inputComment );\n\t\t\t\t\t\tsetInputComment( '' );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAAgD,IAAAO,WAAA,GAAAP,OAAA;AAlBhD;AACA;AACA;;AAaA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,UAAUA,CAAE;EAC3BC,QAAQ;EACRC,gBAAgB;EAChBC;AACD,CAAC,EAAG;EAAA,IAAAC,iBAAA;EACH;EACA,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAExD,MAAM;IACLC,aAAa;IACbC,QAAQ;IACRC,cAAc;IACdC,mBAAmB;IACnBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5B,MAAM;MAAEC;IAAY,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IAClD,MAAM;MAAEC;IAAiC,CAAC,GAAGF,WAAW,CAAC,CAAC;IAC1D,MAAMG,aAAa,GAAGJ,MAAM,CAAEE,kBAAiB,CAAC,CAACG,gBAAgB,CAAC,CAAC;IACnE,MAAMC,QAAQ,GAAGN,MAAM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
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _components = require("@wordpress/components");
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _icons = require("@wordpress/icons");
10
+ var _blockEditor = require("@wordpress/block-editor");
11
+ var _lockUnlock = require("../../lock-unlock");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+
21
+ const {
22
+ __unstableCommentIconToolbarFill
23
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
24
+ const AddCommentToolbarButton = ({
25
+ onClick
26
+ }) => {
27
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(__unstableCommentIconToolbarFill, {
28
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
29
+ accessibleWhenDisabled: true,
30
+ icon: _icons.comment,
31
+ label: (0, _i18n._x)('Comment', 'View comment'),
32
+ onClick: onClick
33
+ })
34
+ });
35
+ };
36
+ var _default = exports.default = AddCommentToolbarButton;
37
+ //# sourceMappingURL=comment-button-toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","_icons","_blockEditor","_lockUnlock","_jsxRuntime","__unstableCommentIconToolbarFill","unlock","blockEditorPrivateApis","AddCommentToolbarButton","onClick","jsx","children","ToolbarButton","accessibleWhenDisabled","icon","commentIcon","label","_x","_default","exports","default"],"sources":["@wordpress/editor/src/components/collab-sidebar/comment-button-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { __unstableCommentIconToolbarFill } = unlock( blockEditorPrivateApis );\n\nconst AddCommentToolbarButton = ( { onClick } ) => {\n\treturn (\n\t\t<__unstableCommentIconToolbarFill>\n\t\t\t<ToolbarButton\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tlabel={ _x( 'Comment', 'View comment' ) }\n\t\t\t\tonClick={ onClick }\n\t\t\t/>\n\t\t</__unstableCommentIconToolbarFill>\n\t);\n};\n\nexport default AddCommentToolbarButton;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAX3C;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAM;EAAEM;AAAiC,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE7E,MAAMC,uBAAuB,GAAGA,CAAE;EAAEC;AAAQ,CAAC,KAAM;EAClD,oBACC,IAAAL,WAAA,CAAAM,GAAA,EAACL,gCAAgC;IAAAM,QAAA,eAChC,IAAAP,WAAA,CAAAM,GAAA,EAACZ,WAAA,CAAAc,aAAa;MACbC,sBAAsB;MACtBC,IAAI,EAAGC,cAAa;MACpBC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAS,EAAE,cAAe,CAAG;MACzCR,OAAO,EAAGA;IAAS,CACnB;EAAC,CAC+B,CAAC;AAErC,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaZ,uBAAuB","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _components = require("@wordpress/components");
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _icons = require("@wordpress/icons");
10
+ var _blockEditor = require("@wordpress/block-editor");
11
+ var _lockUnlock = require("../../lock-unlock");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ /**
14
+ * WordPress dependencies
15
+ */
16
+
17
+ /**
18
+ * Internal dependencies
19
+ */
20
+
21
+ const {
22
+ __unstableCommentIconFill
23
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
24
+ const AddCommentButton = ({
25
+ onClick
26
+ }) => {
27
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(__unstableCommentIconFill, {
28
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
29
+ icon: _icons.comment,
30
+ onClick: onClick,
31
+ "aria-haspopup": "dialog",
32
+ children: (0, _i18n._x)('Comment', 'Add comment button')
33
+ })
34
+ });
35
+ };
36
+ var _default = exports.default = AddCommentButton;
37
+ //# sourceMappingURL=comment-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","_icons","_blockEditor","_lockUnlock","_jsxRuntime","__unstableCommentIconFill","unlock","blockEditorPrivateApis","AddCommentButton","onClick","jsx","children","MenuItem","icon","commentIcon","_x","_default","exports","default"],"sources":["@wordpress/editor/src/components/collab-sidebar/comment-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\nimport { comment as commentIcon } from '@wordpress/icons';\n\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { __unstableCommentIconFill } = unlock( blockEditorPrivateApis );\n\nconst AddCommentButton = ( { onClick } ) => {\n\treturn (\n\t\t<__unstableCommentIconFill>\n\t\t\t<MenuItem\n\t\t\t\ticon={ commentIcon }\n\t\t\t\tonClick={ onClick }\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t>\n\t\t\t\t{ _x( 'Comment', 'Add comment button' ) }\n\t\t\t</MenuItem>\n\t\t</__unstableCommentIconFill>\n\t);\n};\n\nexport default AddCommentButton;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAZ3C;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAM;EAAEM;AAA0B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEtE,MAAMC,gBAAgB,GAAGA,CAAE;EAAEC;AAAQ,CAAC,KAAM;EAC3C,oBACC,IAAAL,WAAA,CAAAM,GAAA,EAACL,yBAAyB;IAAAM,QAAA,eACzB,IAAAP,WAAA,CAAAM,GAAA,EAACZ,WAAA,CAAAc,QAAQ;MACRC,IAAI,EAAGC,cAAa;MACpBL,OAAO,EAAGA,OAAS;MACnB,iBAAc,QAAQ;MAAAE,QAAA,EAEpB,IAAAI,QAAE,EAAE,SAAS,EAAE,oBAAqB;IAAC,CAC9B;EAAC,CACe,CAAC;AAE9B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaV,gBAAgB","ignoreList":[]}