@wordpress/editor 14.44.0 → 14.45.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 (363) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/collab-sidebar/{comment-menu-item.cjs → add-note-menu-item.cjs} +17 -14
  3. package/build/components/collab-sidebar/add-note-menu-item.cjs.map +7 -0
  4. package/build/components/collab-sidebar/add-note.cjs +100 -0
  5. package/build/components/collab-sidebar/add-note.cjs.map +7 -0
  6. package/build/components/collab-sidebar/board-store.cjs +106 -0
  7. package/build/components/collab-sidebar/board-store.cjs.map +7 -0
  8. package/build/components/collab-sidebar/floating-container.cjs +63 -0
  9. package/build/components/collab-sidebar/floating-container.cjs.map +7 -0
  10. package/build/components/collab-sidebar/hooks.cjs +105 -140
  11. package/build/components/collab-sidebar/hooks.cjs.map +3 -3
  12. package/build/components/collab-sidebar/index.cjs +28 -90
  13. package/build/components/collab-sidebar/index.cjs.map +3 -3
  14. package/build/components/collab-sidebar/{comment-author-info.cjs → note-byline.cjs} +13 -9
  15. package/build/components/collab-sidebar/note-byline.cjs.map +7 -0
  16. package/build/components/collab-sidebar/note-card.cjs +58 -0
  17. package/build/components/collab-sidebar/note-card.cjs.map +7 -0
  18. package/build/components/collab-sidebar/{comment-form.cjs → note-form.cjs} +46 -45
  19. package/build/components/collab-sidebar/note-form.cjs.map +7 -0
  20. package/build/components/collab-sidebar/{comment-indicator-toolbar.cjs → note-indicator-toolbar.cjs} +31 -27
  21. package/build/components/collab-sidebar/note-indicator-toolbar.cjs.map +7 -0
  22. package/build/components/collab-sidebar/note-thread.cjs +321 -0
  23. package/build/components/collab-sidebar/note-thread.cjs.map +7 -0
  24. package/build/components/collab-sidebar/note.cjs +207 -0
  25. package/build/components/collab-sidebar/note.cjs.map +7 -0
  26. package/build/components/collab-sidebar/notes.cjs +237 -0
  27. package/build/components/collab-sidebar/notes.cjs.map +7 -0
  28. package/build/components/collab-sidebar/utils.cjs +80 -14
  29. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  30. package/build/components/collaborators-presence/avatar/component.cjs.map +1 -1
  31. package/build/components/collaborators-presence/index.cjs +3 -3
  32. package/build/components/collaborators-presence/index.cjs.map +2 -2
  33. package/build/components/collaborators-presence/list.cjs +3 -3
  34. package/build/components/collaborators-presence/list.cjs.map +2 -2
  35. package/build/components/document-bar/index.cjs.map +3 -3
  36. package/build/components/error-boundary/index.cjs.map +3 -3
  37. package/build/components/list-view-sidebar/list-view-outline.cjs.map +3 -3
  38. package/build/components/media/media-editor-modal.cjs +93 -0
  39. package/build/components/media/media-editor-modal.cjs.map +7 -0
  40. package/build/components/media-categories/index.cjs +1 -1
  41. package/build/components/media-categories/index.cjs.map +1 -1
  42. package/build/components/more-menu/index.cjs +4 -3
  43. package/build/components/more-menu/index.cjs.map +2 -2
  44. package/build/components/post-actions/set-as-homepage.cjs.map +3 -3
  45. package/build/components/post-actions/set-as-posts-page.cjs.map +3 -3
  46. package/build/components/post-card-panel/index.cjs +2 -2
  47. package/build/components/post-card-panel/index.cjs.map +3 -3
  48. package/build/components/post-content-information/index.cjs.map +3 -3
  49. package/build/components/post-excerpt/panel.cjs.map +3 -3
  50. package/build/components/post-last-edited-panel/index.cjs.map +3 -3
  51. package/build/components/post-preview-button/index.cjs +3 -2
  52. package/build/components/post-preview-button/index.cjs.map +2 -2
  53. package/build/components/post-publish-button/index.cjs +2 -2
  54. package/build/components/post-publish-button/index.cjs.map +2 -2
  55. package/build/components/post-publish-button/label.cjs +4 -2
  56. package/build/components/post-publish-button/label.cjs.map +2 -2
  57. package/build/components/post-publish-panel/maybe-upload-media.cjs +1 -1
  58. package/build/components/post-publish-panel/maybe-upload-media.cjs.map +1 -1
  59. package/build/components/post-publish-panel/postpublish.cjs +3 -2
  60. package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
  61. package/build/components/post-revisions-panel/index.cjs +2 -2
  62. package/build/components/post-revisions-panel/index.cjs.map +2 -2
  63. package/build/components/post-revisions-preview/diff-markers.cjs +1 -1
  64. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  65. package/build/components/post-revisions-preview/revisions-slider.cjs +1 -0
  66. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  67. package/build/components/post-saved-state/index.cjs +4 -1
  68. package/build/components/post-saved-state/index.cjs.map +2 -2
  69. package/build/components/post-text-editor/index.cjs +3 -4
  70. package/build/components/post-text-editor/index.cjs.map +2 -2
  71. package/build/components/preview-dropdown/index.cjs +3 -2
  72. package/build/components/preview-dropdown/index.cjs.map +2 -2
  73. package/build/components/provider/index.cjs +3 -1
  74. package/build/components/provider/index.cjs.map +3 -3
  75. package/build/components/provider/use-block-editor-settings.cjs +7 -1
  76. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  77. package/build/components/provider/use-upload-save-lock.cjs +2 -12
  78. package/build/components/provider/use-upload-save-lock.cjs.map +2 -2
  79. package/build/components/resizable-editor/resize-handle.cjs +2 -1
  80. package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
  81. package/build/components/revision-created-panel/index.cjs.map +3 -3
  82. package/build/components/site-discussion/index.cjs.map +2 -2
  83. package/build/components/style-book/constants.cjs +1 -1
  84. package/build/components/style-book/constants.cjs.map +1 -1
  85. package/build/components/style-book/index.cjs +1 -1
  86. package/build/components/style-book/index.cjs.map +1 -1
  87. package/build/components/template-actions-panel/classic-theme-content.cjs.map +2 -2
  88. package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
  89. package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
  90. package/build/components/visual-editor/index.cjs +5 -22
  91. package/build/components/visual-editor/index.cjs.map +2 -2
  92. package/build/store/private-actions.cjs +0 -8
  93. package/build/store/private-actions.cjs.map +2 -2
  94. package/build/store/private-selectors.cjs +0 -5
  95. package/build/store/private-selectors.cjs.map +2 -2
  96. package/build/store/reducer.cjs +0 -10
  97. package/build/store/reducer.cjs.map +2 -2
  98. package/build/utils/media-finalize/index.cjs +3 -2
  99. package/build/utils/media-finalize/index.cjs.map +2 -2
  100. package/build/utils/media-upload/index.cjs +14 -25
  101. package/build/utils/media-upload/index.cjs.map +2 -2
  102. package/build-module/components/collab-sidebar/{comment-menu-item.mjs → add-note-menu-item.mjs} +10 -11
  103. package/build-module/components/collab-sidebar/add-note-menu-item.mjs.map +7 -0
  104. package/build-module/components/collab-sidebar/add-note.mjs +78 -0
  105. package/build-module/components/collab-sidebar/add-note.mjs.map +7 -0
  106. package/build-module/components/collab-sidebar/board-store.mjs +81 -0
  107. package/build-module/components/collab-sidebar/board-store.mjs.map +7 -0
  108. package/build-module/components/collab-sidebar/floating-container.mjs +28 -0
  109. package/build-module/components/collab-sidebar/floating-container.mjs.map +7 -0
  110. package/build-module/components/collab-sidebar/hooks.mjs +105 -144
  111. package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
  112. package/build-module/components/collab-sidebar/index.mjs +29 -95
  113. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  114. package/build-module/components/collab-sidebar/{comment-author-info.mjs → note-byline.mjs} +7 -7
  115. package/build-module/components/collab-sidebar/note-byline.mjs.map +7 -0
  116. package/build-module/components/collab-sidebar/note-card.mjs +33 -0
  117. package/build-module/components/collab-sidebar/note-card.mjs.map +7 -0
  118. package/build-module/components/collab-sidebar/note-form.mjs +84 -0
  119. package/build-module/components/collab-sidebar/note-form.mjs.map +7 -0
  120. package/build-module/components/collab-sidebar/{comment-indicator-toolbar.mjs → note-indicator-toolbar.mjs} +25 -29
  121. package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +7 -0
  122. package/build-module/components/collab-sidebar/note-thread.mjs +289 -0
  123. package/build-module/components/collab-sidebar/note-thread.mjs.map +7 -0
  124. package/build-module/components/collab-sidebar/note.mjs +176 -0
  125. package/build-module/components/collab-sidebar/note.mjs.map +7 -0
  126. package/build-module/components/collab-sidebar/notes.mjs +215 -0
  127. package/build-module/components/collab-sidebar/notes.mjs.map +7 -0
  128. package/build-module/components/collab-sidebar/utils.mjs +76 -10
  129. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  130. package/build-module/components/collaborators-presence/avatar/component.mjs.map +1 -1
  131. package/build-module/components/collaborators-presence/index.mjs +3 -3
  132. package/build-module/components/collaborators-presence/index.mjs.map +2 -2
  133. package/build-module/components/collaborators-presence/list.mjs +3 -3
  134. package/build-module/components/collaborators-presence/list.mjs.map +2 -2
  135. package/build-module/components/document-bar/index.mjs +3 -3
  136. package/build-module/components/document-bar/index.mjs.map +2 -2
  137. package/build-module/components/error-boundary/index.mjs +2 -2
  138. package/build-module/components/error-boundary/index.mjs.map +2 -2
  139. package/build-module/components/list-view-sidebar/list-view-outline.mjs +5 -5
  140. package/build-module/components/list-view-sidebar/list-view-outline.mjs.map +2 -2
  141. package/build-module/components/media/media-editor-modal.mjs +62 -0
  142. package/build-module/components/media/media-editor-modal.mjs.map +7 -0
  143. package/build-module/components/media-categories/index.mjs +1 -1
  144. package/build-module/components/media-categories/index.mjs.map +1 -1
  145. package/build-module/components/more-menu/index.mjs +4 -8
  146. package/build-module/components/more-menu/index.mjs.map +2 -2
  147. package/build-module/components/post-actions/set-as-homepage.mjs +2 -2
  148. package/build-module/components/post-actions/set-as-homepage.mjs.map +2 -2
  149. package/build-module/components/post-actions/set-as-posts-page.mjs +2 -2
  150. package/build-module/components/post-actions/set-as-posts-page.mjs.map +2 -2
  151. package/build-module/components/post-card-panel/index.mjs +5 -5
  152. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  153. package/build-module/components/post-content-information/index.mjs +2 -2
  154. package/build-module/components/post-content-information/index.mjs.map +2 -2
  155. package/build-module/components/post-excerpt/panel.mjs +2 -2
  156. package/build-module/components/post-excerpt/panel.mjs.map +2 -2
  157. package/build-module/components/post-last-edited-panel/index.mjs +2 -2
  158. package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
  159. package/build-module/components/post-preview-button/index.mjs +3 -2
  160. package/build-module/components/post-preview-button/index.mjs.map +2 -2
  161. package/build-module/components/post-publish-button/index.mjs +2 -2
  162. package/build-module/components/post-publish-button/index.mjs.map +2 -2
  163. package/build-module/components/post-publish-button/label.mjs +4 -2
  164. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  165. package/build-module/components/post-publish-panel/maybe-upload-media.mjs +1 -1
  166. package/build-module/components/post-publish-panel/maybe-upload-media.mjs.map +1 -1
  167. package/build-module/components/post-publish-panel/postpublish.mjs +3 -3
  168. package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
  169. package/build-module/components/post-revisions-panel/index.mjs +2 -2
  170. package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
  171. package/build-module/components/post-revisions-preview/diff-markers.mjs +1 -1
  172. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  173. package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -0
  174. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  175. package/build-module/components/post-saved-state/index.mjs +4 -1
  176. package/build-module/components/post-saved-state/index.mjs.map +2 -2
  177. package/build-module/components/post-text-editor/index.mjs +2 -3
  178. package/build-module/components/post-text-editor/index.mjs.map +2 -2
  179. package/build-module/components/preview-dropdown/index.mjs +2 -2
  180. package/build-module/components/preview-dropdown/index.mjs.map +2 -2
  181. package/build-module/components/provider/index.mjs +3 -1
  182. package/build-module/components/provider/index.mjs.map +2 -2
  183. package/build-module/components/provider/use-block-editor-settings.mjs +7 -1
  184. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  185. package/build-module/components/provider/use-upload-save-lock.mjs +2 -12
  186. package/build-module/components/provider/use-upload-save-lock.mjs.map +2 -2
  187. package/build-module/components/resizable-editor/resize-handle.mjs +2 -5
  188. package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
  189. package/build-module/components/revision-created-panel/index.mjs +2 -2
  190. package/build-module/components/revision-created-panel/index.mjs.map +2 -2
  191. package/build-module/components/site-discussion/index.mjs +2 -2
  192. package/build-module/components/site-discussion/index.mjs.map +2 -2
  193. package/build-module/components/style-book/constants.mjs +1 -1
  194. package/build-module/components/style-book/constants.mjs.map +1 -1
  195. package/build-module/components/style-book/index.mjs +1 -1
  196. package/build-module/components/style-book/index.mjs.map +1 -1
  197. package/build-module/components/template-actions-panel/classic-theme-content.mjs +2 -2
  198. package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +2 -2
  199. package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
  200. package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
  201. package/build-module/components/visual-editor/index.mjs +5 -22
  202. package/build-module/components/visual-editor/index.mjs.map +2 -2
  203. package/build-module/store/private-actions.mjs +0 -7
  204. package/build-module/store/private-actions.mjs.map +2 -2
  205. package/build-module/store/private-selectors.mjs +0 -4
  206. package/build-module/store/private-selectors.mjs.map +2 -2
  207. package/build-module/store/reducer.mjs +0 -9
  208. package/build-module/store/reducer.mjs.map +2 -2
  209. package/build-module/utils/media-finalize/index.mjs +3 -2
  210. package/build-module/utils/media-finalize/index.mjs.map +2 -2
  211. package/build-module/utils/media-upload/index.mjs +14 -25
  212. package/build-module/utils/media-upload/index.mjs.map +2 -2
  213. package/build-style/style-rtl.css +397 -171
  214. package/build-style/style.css +397 -171
  215. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
  216. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
  217. package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
  218. package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
  219. package/build-types/components/collab-sidebar/board-store.d.ts +9 -0
  220. package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
  221. package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
  222. package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
  223. package/build-types/components/collab-sidebar/hooks.d.ts +13 -22
  224. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  225. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  226. package/build-types/components/collab-sidebar/note-byline.d.ts +7 -0
  227. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
  228. package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
  229. package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
  230. package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
  231. package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
  232. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
  233. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
  234. package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
  235. package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
  236. package/build-types/components/collab-sidebar/note.d.ts +9 -0
  237. package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
  238. package/build-types/components/collab-sidebar/notes.d.ts +7 -0
  239. package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
  240. package/build-types/components/collab-sidebar/utils.d.ts +41 -17
  241. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  242. package/build-types/components/media/media-editor-modal.d.ts +11 -0
  243. package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
  244. package/build-types/components/more-menu/index.d.ts.map +1 -1
  245. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  246. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  247. package/build-types/components/post-publish-button/label.d.ts.map +1 -1
  248. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  249. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  250. package/build-types/components/provider/index.d.ts.map +1 -1
  251. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  252. package/build-types/components/provider/use-upload-save-lock.d.ts +0 -2
  253. package/build-types/components/provider/use-upload-save-lock.d.ts.map +1 -1
  254. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  255. package/build-types/components/style-book/constants.d.ts +1 -1
  256. package/build-types/components/style-book/constants.d.ts.map +1 -1
  257. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
  258. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  259. package/build-types/store/private-actions.d.ts +0 -7
  260. package/build-types/store/private-actions.d.ts.map +1 -1
  261. package/build-types/store/private-selectors.d.ts +0 -7
  262. package/build-types/store/private-selectors.d.ts.map +1 -1
  263. package/build-types/store/reducer.d.ts +0 -10
  264. package/build-types/store/reducer.d.ts.map +1 -1
  265. package/build-types/utils/media-finalize/index.d.ts +1 -1
  266. package/build-types/utils/media-finalize/index.d.ts.map +1 -1
  267. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  268. package/package.json +46 -46
  269. package/src/components/collab-sidebar/README.md +117 -0
  270. package/src/components/collab-sidebar/{comment-menu-item.js → add-note-menu-item.js} +8 -10
  271. package/src/components/collab-sidebar/{add-comment.js → add-note.js} +26 -49
  272. package/src/components/collab-sidebar/board-store.js +85 -0
  273. package/src/components/collab-sidebar/floating-container.js +30 -0
  274. package/src/components/collab-sidebar/hooks.js +130 -178
  275. package/src/components/collab-sidebar/index.js +35 -106
  276. package/src/components/collab-sidebar/{comment-author-info.js → note-byline.js} +5 -6
  277. package/src/components/collab-sidebar/note-card.js +36 -0
  278. package/src/components/collab-sidebar/{comment-form.js → note-form.js} +29 -40
  279. package/src/components/collab-sidebar/{comment-indicator-toolbar.js → note-indicator-toolbar.js} +29 -32
  280. package/src/components/collab-sidebar/note-thread.js +331 -0
  281. package/src/components/collab-sidebar/note.js +209 -0
  282. package/src/components/collab-sidebar/notes.js +276 -0
  283. package/src/components/collab-sidebar/style.scss +21 -11
  284. package/src/components/collab-sidebar/test/utils.js +155 -0
  285. package/src/components/collab-sidebar/utils.js +125 -19
  286. package/src/components/collaborators-presence/avatar/component.tsx +1 -1
  287. package/src/components/collaborators-presence/styles/collaborators-list.scss +1 -1
  288. package/src/components/collaborators-presence/styles/collaborators-presence.scss +1 -1
  289. package/src/components/document-bar/index.js +4 -4
  290. package/src/components/document-outline/style.scss +1 -1
  291. package/src/components/error-boundary/index.js +3 -3
  292. package/src/components/list-view-sidebar/list-view-outline.js +6 -6
  293. package/src/components/media/media-editor-modal.js +95 -0
  294. package/src/components/media-categories/index.js +1 -1
  295. package/src/components/more-menu/index.js +4 -8
  296. package/src/components/post-actions/set-as-homepage.js +2 -2
  297. package/src/components/post-actions/set-as-posts-page.js +2 -2
  298. package/src/components/post-card-panel/index.js +7 -7
  299. package/src/components/post-content-information/index.js +3 -3
  300. package/src/components/post-excerpt/panel.js +3 -3
  301. package/src/components/post-last-edited-panel/index.js +3 -3
  302. package/src/components/post-preview-button/index.js +3 -2
  303. package/src/components/post-publish-button/index.js +6 -5
  304. package/src/components/post-publish-button/label.js +3 -1
  305. package/src/components/post-publish-panel/maybe-upload-media.js +1 -1
  306. package/src/components/post-publish-panel/postpublish.js +2 -2
  307. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +10 -16
  308. package/src/components/post-revisions-panel/index.js +3 -3
  309. package/src/components/post-revisions-preview/diff-markers.js +1 -1
  310. package/src/components/post-revisions-preview/revisions-slider.js +1 -0
  311. package/src/components/post-revisions-preview/style.scss +1 -1
  312. package/src/components/post-saved-state/index.js +4 -1
  313. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -1
  314. package/src/components/post-text-editor/index.js +3 -3
  315. package/src/components/preview-dropdown/index.js +2 -2
  316. package/src/components/provider/index.js +4 -0
  317. package/src/components/provider/use-block-editor-settings.js +10 -0
  318. package/src/components/provider/use-upload-save-lock.js +2 -17
  319. package/src/components/resizable-editor/resize-handle.js +2 -5
  320. package/src/components/revision-created-panel/index.js +3 -3
  321. package/src/components/site-discussion/index.js +3 -3
  322. package/src/components/style-book/constants.ts +1 -1
  323. package/src/components/style-book/index.js +1 -1
  324. package/src/components/template-actions-panel/classic-theme-content.js +3 -3
  325. package/src/components/template-actions-panel/style.scss +1 -1
  326. package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
  327. package/src/components/visual-editor/index.js +2 -29
  328. package/src/store/private-actions.js +0 -13
  329. package/src/store/private-selectors.js +0 -10
  330. package/src/store/reducer.js +0 -16
  331. package/src/utils/media-finalize/index.js +2 -1
  332. package/src/utils/media-finalize/test/index.js +25 -1
  333. package/src/utils/media-upload/index.js +26 -29
  334. package/build/components/collab-sidebar/add-comment.cjs +0 -129
  335. package/build/components/collab-sidebar/add-comment.cjs.map +0 -7
  336. package/build/components/collab-sidebar/comment-author-info.cjs.map +0 -7
  337. package/build/components/collab-sidebar/comment-form.cjs.map +0 -7
  338. package/build/components/collab-sidebar/comment-indicator-toolbar.cjs.map +0 -7
  339. package/build/components/collab-sidebar/comment-menu-item.cjs.map +0 -7
  340. package/build/components/collab-sidebar/comments.cjs +0 -816
  341. package/build/components/collab-sidebar/comments.cjs.map +0 -7
  342. package/build-module/components/collab-sidebar/add-comment.mjs +0 -100
  343. package/build-module/components/collab-sidebar/add-comment.mjs.map +0 -7
  344. package/build-module/components/collab-sidebar/comment-author-info.mjs.map +0 -7
  345. package/build-module/components/collab-sidebar/comment-form.mjs +0 -90
  346. package/build-module/components/collab-sidebar/comment-form.mjs.map +0 -7
  347. package/build-module/components/collab-sidebar/comment-indicator-toolbar.mjs.map +0 -7
  348. package/build-module/components/collab-sidebar/comment-menu-item.mjs.map +0 -7
  349. package/build-module/components/collab-sidebar/comments.mjs +0 -799
  350. package/build-module/components/collab-sidebar/comments.mjs.map +0 -7
  351. package/build-types/components/collab-sidebar/add-comment.d.ts +0 -10
  352. package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
  353. package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
  354. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
  355. package/build-types/components/collab-sidebar/comment-form.d.ts +0 -11
  356. package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
  357. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
  358. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
  359. package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
  360. package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
  361. package/build-types/components/collab-sidebar/comments.d.ts +0 -12
  362. package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
  363. package/src/components/collab-sidebar/comments.js +0 -985
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/collab-sidebar/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport {\n\tALL_NOTES_SIDEBAR,\n\tFLOATING_NOTES_SIDEBAR,\n\tSIDEBARS,\n} from './constants';\nimport { Comments } from './comments';\nimport { store as editorStore } from '../../store';\nimport AddCommentMenuItem from './comment-menu-item';\nimport CommentAvatarIndicator from './comment-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport {\n\tuseBlockComments,\n\tuseBlockCommentsActions,\n\tuseEnableFloatingSidebar,\n} from './hooks';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { unlock } from '../../lock-unlock';\n\nfunction NotesSidebarContent( {\n\tstyles,\n\tcomments,\n\tcommentSidebarRef,\n\treflowComments,\n\tcommentLastUpdated,\n\tisFloating = false,\n} ) {\n\tconst { onCreate, onEdit, onDelete } =\n\t\tuseBlockCommentsActions( reflowComments );\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"editor-collab-sidebar-panel\"\n\t\t\tstyle={ styles }\n\t\t\trole=\"tree\"\n\t\t\tspacing=\"3\"\n\t\t\tjustify=\"flex-start\"\n\t\t\tref={ ( node ) => {\n\t\t\t\t// Sometimes previous sidebar unmounts after the new one mounts.\n\t\t\t\t// This ensures we always have the latest reference.\n\t\t\t\tif ( node ) {\n\t\t\t\t\t// eslint-disable-next-line react-compiler/react-compiler\n\t\t\t\t\tcommentSidebarRef.current = node;\n\t\t\t\t}\n\t\t\t} }\n\t\t\taria-label={\n\t\t\t\tisFloating ? __( 'Unresolved notes' ) : __( 'All notes' )\n\t\t\t}\n\t\t>\n\t\t\t<Comments\n\t\t\t\tthreads={ comments }\n\t\t\t\tonEditComment={ onEdit }\n\t\t\t\tonAddReply={ onCreate }\n\t\t\t\tonCommentDelete={ onDelete }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n\nfunction NotesSidebar( { postId } ) {\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst { toggleBlockSpotlight, selectBlock } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst commentSidebarRef = useRef( null );\n\n\tconst { clientId, blockCommentId, isClassicBlock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst _clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tclientId: _clientId,\n\t\t\t\tblockCommentId: _clientId\n\t\t\t\t\t? getBlockAttributes( _clientId )?.metadata?.noteId\n\t\t\t\t\t: null,\n\t\t\t\tisClassicBlock: _clientId\n\t\t\t\t\t? getBlockName( _clientId ) === 'core/freeform'\n\t\t\t\t\t: false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { isDistractionFree } = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t};\n\t}, [] );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\n\tconst {\n\t\tresultComments,\n\t\tunresolvedSortedThreads,\n\t\treflowComments,\n\t\tcommentLastUpdated,\n\t} = useBlockComments( postId );\n\n\t// Only enable the floating sidebar for large viewports.\n\tconst showFloatingSidebar = isLargeViewport;\n\t// Fallback to \"All notes\" sidebar on smaller viewports.\n\tconst showAllNotesSidebar =\n\t\tresultComments.length > 0 || ! showFloatingSidebar;\n\tuseEnableFloatingSidebar(\n\t\tshowFloatingSidebar &&\n\t\t\t( unresolvedSortedThreads.length > 0 || selectedNote !== undefined )\n\t);\n\n\tuseShortcut(\n\t\t'core/editor/new-note',\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\topenTheSidebar();\n\t\t},\n\t\t{\n\t\t\t// When multiple notes per block are supported. Remove note ID check.\n\t\t\t// See: https://github.com/WordPress/gutenberg/pull/75147.\n\t\t\tisDisabled:\n\t\t\t\tisDistractionFree ||\n\t\t\t\tisClassicBlock ||\n\t\t\t\t! clientId ||\n\t\t\t\t!! blockCommentId,\n\t\t}\n\t);\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = blockCommentId\n\t\t? resultComments.find( ( thread ) => thread.id === blockCommentId )\n\t\t: null;\n\n\tasync function openTheSidebar( selectedClientId ) {\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tconst activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );\n\t\tconst targetClientId =\n\t\t\tselectedClientId && selectedClientId !== clientId\n\t\t\t\t? selectedClientId\n\t\t\t\t: clientId;\n\t\tconst targetNote = resultComments.find(\n\t\t\t( note ) => note.blockClientId === targetClientId\n\t\t);\n\n\t\tif ( targetNote?.status === 'approved' ) {\n\t\t\tenableComplementaryArea( 'core', ALL_NOTES_SIDEBAR );\n\t\t} else if ( ! activeNotesArea || ! showAllNotesSidebar ) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core',\n\t\t\t\tshowFloatingSidebar ? FLOATING_NOTES_SIDEBAR : ALL_NOTES_SIDEBAR\n\t\t\t);\n\t\t}\n\n\t\tconst currentArea = await getActiveComplementaryArea( 'core' );\n\t\t// Bail out if the current active area is not one of note sidebars.\n\t\tif ( ! SIDEBARS.includes( currentArea ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// A special case for the List View, where block selection isn't required to trigger an action.\n\t\t// The action won't do anything if the block is already selected.\n\t\tselectBlock( targetClientId, null );\n\t\ttoggleBlockSpotlight( targetClientId, true );\n\t\tselectNote( targetNote ? targetNote.id : 'new', { focus: true } );\n\t}\n\n\tif ( isDistractionFree ) {\n\t\treturn <AddCommentMenuItem isDistractionFree />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ !! currentThread && (\n\t\t\t\t<CommentAvatarIndicator\n\t\t\t\t\tthread={ currentThread }\n\t\t\t\t\tonClick={ openTheSidebar }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddCommentMenuItem onClick={ openTheSidebar } />\n\t\t\t{ showAllNotesSidebar && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tidentifier={ ALL_NOTES_SIDEBAR }\n\t\t\t\t\tname={ ALL_NOTES_SIDEBAR }\n\t\t\t\t\ttitle={ __( 'All notes' ) }\n\t\t\t\t\theader={\n\t\t\t\t\t\t<h2 className=\"interface-complementary-area-header__title\">\n\t\t\t\t\t\t\t{ __( 'All notes' ) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t}\n\t\t\t\t\ticon={ commentIcon }\n\t\t\t\t\tcloseLabel={ __( 'Close Notes' ) }\n\t\t\t\t>\n\t\t\t\t\t<NotesSidebarContent\n\t\t\t\t\t\tcomments={ resultComments }\n\t\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\t/>\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tisPinnable={ false }\n\t\t\t\t\theader={ false }\n\t\t\t\t\tidentifier={ FLOATING_NOTES_SIDEBAR }\n\t\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t\t\tbackgroundColor={ backgroundColor }\n\t\t\t\t>\n\t\t\t\t\t<NotesSidebarContent\n\t\t\t\t\t\tcomments={ unresolvedSortedThreads }\n\t\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\t\tstyles={ {\n\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisFloating\n\t\t\t\t\t/>\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function NotesSidebarContainer() {\n\tconst { postId, editorMode, revisionsMode } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getEditorMode, isRevisionsMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\trevisionsMode: isRevisionsMode(),\n\t\t};\n\t}, [] );\n\n\tif ( ! postId || typeof postId !== 'number' ) {\n\t\treturn null;\n\t}\n\n\t// Hide Notes sidebar for Code Editor and in-editor revision mode.\n\tif ( editorMode === 'text' || revisionsMode ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"editor.notes\">\n\t\t\t<NotesSidebar postId={ postId } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AACvC,wBAA+C;AAC/C,qBAAuB;AACvB,qBAAiC;AACjC,gCAA4B;AAC5B,mBAAuC;AACvC,0BAA0C;AAC1C,uBAAwC;AACxC,yBAA0C;AAK1C,4BAA0B;AAC1B,uBAIO;AACP,sBAAyB;AACzB,mBAAqC;AACrC,+BAA+B;AAC/B,uCAAmC;AACnC,oCAAuC;AACvC,mBAIO;AACP,qCAAiC;AACjC,yBAAuB;AAgCpB;AA9BH,SAAS,oBAAqB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AACd,GAAI;AACH,QAAM,EAAE,UAAU,QAAQ,SAAS,QAClC,sCAAyB,cAAe;AAEzC,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,OAAQ;AAAA,MACR,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,SAAQ;AAAA,MACR,KAAM,CAAE,SAAU;AAGjB,YAAK,MAAO;AAEX,4BAAkB,UAAU;AAAA,QAC7B;AAAA,MACD;AAAA,MACA,cACC,iBAAa,gBAAI,kBAAmB,QAAI,gBAAI,WAAY;AAAA,MAGzD;AAAA,QAAC;AAAA;AAAA,UACA,SAAU;AAAA,UACV,eAAgB;AAAA,UAChB,YAAa;AAAA,UACb,iBAAkB;AAAA,UAClB;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,aAAc,EAAE,O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["VStack", "interfaceStore", "blockEditorStore", "editorStore", "preferencesStore", "AddCommentMenuItem", "CommentAvatarIndicator", "PluginSidebar", "commentIcon", "PostTypeSupportCheck"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport {\n\tALL_NOTES_SIDEBAR,\n\tFLOATING_NOTES_SIDEBAR,\n\tSIDEBARS,\n} from './constants';\nimport { Notes } from './notes';\nimport { store as editorStore } from '../../store';\nimport { AddNoteMenuItem } from './add-note-menu-item';\nimport { NoteAvatarIndicator } from './note-indicator-toolbar';\nimport { useGlobalStylesContext } from '../global-styles-provider';\nimport { useNoteThreads, useEnableFloatingSidebar } from './hooks';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { unlock } from '../../lock-unlock';\n\nfunction NotesSidebar( { postId } ) {\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst { toggleBlockSpotlight, selectBlock } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst sidebarRef = useRef( null );\n\n\tconst { clientId, noteId, isClassicBlock } = useSelect( ( select ) => {\n\t\tconst { getBlockAttributes, getSelectedBlockClientId, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst _clientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tclientId: _clientId,\n\t\t\tnoteId: _clientId\n\t\t\t\t? getBlockAttributes( _clientId )?.metadata?.noteId\n\t\t\t\t: null,\n\t\t\tisClassicBlock: _clientId\n\t\t\t\t? getBlockName( _clientId ) === 'core/freeform'\n\t\t\t\t: false,\n\t\t};\n\t}, [] );\n\tconst { isDistractionFree } = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t};\n\t}, [] );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\n\tconst { notes, unresolvedNotes } = useNoteThreads( postId );\n\n\t// Only enable the floating sidebar for large viewports.\n\tconst showFloatingSidebar = isLargeViewport;\n\t// Fallback to \"All notes\" sidebar on smaller viewports.\n\tconst showAllNotesSidebar = notes.length > 0 || ! showFloatingSidebar;\n\tuseEnableFloatingSidebar(\n\t\tshowFloatingSidebar &&\n\t\t\t( unresolvedNotes.length > 0 || selectedNote !== undefined )\n\t);\n\n\tuseShortcut(\n\t\t'core/editor/new-note',\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\topenTheSidebar();\n\t\t},\n\t\t{\n\t\t\t// When multiple notes per block are supported. Remove note ID check.\n\t\t\t// See: https://github.com/WordPress/gutenberg/pull/75147.\n\t\t\tisDisabled:\n\t\t\t\tisDistractionFree || isClassicBlock || ! clientId || !! noteId,\n\t\t}\n\t);\n\n\t// Get the global styles to set the background color of the sidebar.\n\tconst { merged: GlobalStyles } = useGlobalStylesContext();\n\tconst backgroundColor = GlobalStyles?.styles?.color?.background;\n\n\t// Find the current thread for the selected block.\n\tconst currentThread = noteId\n\t\t? notes.find( ( thread ) => thread.id === noteId )\n\t\t: null;\n\n\tasync function openTheSidebar( selectedClientId ) {\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tconst activeNotesArea = SIDEBARS.find( ( name ) => name === prevArea );\n\t\tconst targetClientId =\n\t\t\tselectedClientId && selectedClientId !== clientId\n\t\t\t\t? selectedClientId\n\t\t\t\t: clientId;\n\t\tconst targetNote = notes.find(\n\t\t\t( note ) => note.blockClientId === targetClientId\n\t\t);\n\n\t\tif ( targetNote?.status === 'approved' ) {\n\t\t\tenableComplementaryArea( 'core', ALL_NOTES_SIDEBAR );\n\t\t} else if ( ! activeNotesArea || ! showAllNotesSidebar ) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core',\n\t\t\t\tshowFloatingSidebar ? FLOATING_NOTES_SIDEBAR : ALL_NOTES_SIDEBAR\n\t\t\t);\n\t\t}\n\n\t\tconst currentArea = await getActiveComplementaryArea( 'core' );\n\t\t// Bail out if the current active area is not one of note sidebars.\n\t\tif ( ! SIDEBARS.includes( currentArea ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// A special case for the List View, where block selection isn't required to trigger an action.\n\t\t// The action won't do anything if the block is already selected.\n\t\tselectBlock( targetClientId, null );\n\t\ttoggleBlockSpotlight( targetClientId, true );\n\t\tselectNote( targetNote ? targetNote.id : 'new', { focus: true } );\n\t}\n\n\tif ( isDistractionFree ) {\n\t\treturn <AddNoteMenuItem isDistractionFree />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ !! currentThread && (\n\t\t\t\t<NoteAvatarIndicator\n\t\t\t\t\tnote={ currentThread }\n\t\t\t\t\tonClick={ openTheSidebar }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddNoteMenuItem onClick={ openTheSidebar } />\n\t\t\t{ showAllNotesSidebar && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tidentifier={ ALL_NOTES_SIDEBAR }\n\t\t\t\t\tname={ ALL_NOTES_SIDEBAR }\n\t\t\t\t\ttitle={ __( 'All notes' ) }\n\t\t\t\t\theader={\n\t\t\t\t\t\t<h2 className=\"interface-complementary-area-header__title\">\n\t\t\t\t\t\t\t{ __( 'All notes' ) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t}\n\t\t\t\t\ticon={ commentIcon }\n\t\t\t\t\tcloseLabel={ __( 'Close Notes' ) }\n\t\t\t\t>\n\t\t\t\t\t<Notes notes={ notes } sidebarRef={ sidebarRef } />\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t\t{ isLargeViewport && (\n\t\t\t\t<PluginSidebar\n\t\t\t\t\tisPinnable={ false }\n\t\t\t\t\theader={ false }\n\t\t\t\t\tidentifier={ FLOATING_NOTES_SIDEBAR }\n\t\t\t\t\tclassName=\"editor-collab-sidebar\"\n\t\t\t\t\theaderClassName=\"editor-collab-sidebar__header\"\n\t\t\t\t\tbackgroundColor={ backgroundColor }\n\t\t\t\t>\n\t\t\t\t\t<Notes\n\t\t\t\t\t\tnotes={ unresolvedNotes }\n\t\t\t\t\t\tsidebarRef={ sidebarRef }\n\t\t\t\t\t\tstyles={ { backgroundColor } }\n\t\t\t\t\t\tisFloating\n\t\t\t\t\t/>\n\t\t\t\t</PluginSidebar>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function NotesSidebarContainer() {\n\tconst { postId, editorMode, revisionsMode } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getEditorMode, isRevisionsMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\trevisionsMode: isRevisionsMode(),\n\t\t};\n\t}, [] );\n\n\tif ( ! postId || typeof postId !== 'number' ) {\n\t\treturn null;\n\t}\n\n\t// Hide Notes sidebar for Code Editor and in-editor revision mode.\n\tif ( editorMode === 'text' || revisionsMode ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"editor.notes\">\n\t\t\t<NotesSidebar postId={ postId } />\n\t\t</PostTypeSupportCheck>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AAC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gB;AAC7C,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,+BAAAI,SAAA,EAAqB,aAAY,gBACjC,sDAAC,gBAAa,QAAkB,GACjC;AAEF;",
6
+ "names": ["interfaceStore", "blockEditorStore", "editorStore", "preferencesStore", "PluginSidebar", "commentIcon", "PostTypeSupportCheck"]
7
7
  }
@@ -17,13 +17,14 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/editor/src/components/collab-sidebar/comment-author-info.js
21
- var comment_author_info_exports = {};
22
- __export(comment_author_info_exports, {
23
- default: () => comment_author_info_default
20
+ // packages/editor/src/components/collab-sidebar/note-byline.js
21
+ var note_byline_exports = {};
22
+ __export(note_byline_exports, {
23
+ NoteByline: () => NoteByline
24
24
  });
25
- module.exports = __toCommonJS(comment_author_info_exports);
25
+ module.exports = __toCommonJS(note_byline_exports);
26
26
  var import_components = require("@wordpress/components");
27
+ var import_ui = require("@wordpress/ui");
27
28
  var import_i18n = require("@wordpress/i18n");
28
29
  var import_date = require("@wordpress/date");
29
30
  var import_core_data = require("@wordpress/core-data");
@@ -31,7 +32,7 @@ var import_data = require("@wordpress/data");
31
32
  var import_block_editor = require("@wordpress/block-editor");
32
33
  var import_utils = require("./utils.cjs");
33
34
  var import_jsx_runtime = require("react/jsx-runtime");
34
- function CommentAuthorInfo({ avatar, name, date, userId }) {
35
+ function NoteByline({ avatar, name, date, userId }) {
35
36
  const hasAvatar = !!avatar;
36
37
  const dateSettings = (0, import_date.getSettings)();
37
38
  const {
@@ -89,7 +90,7 @@ function CommentAuthorInfo({ avatar, name, date, userId }) {
89
90
  }
90
91
  }
91
92
  ),
92
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: "0", children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", children: [
93
94
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "editor-collab-sidebar-panel__user-name", children: name ?? currentUserName }),
94
95
  date && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Tooltip, { text: tooltipText, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
96
  "time",
@@ -102,5 +103,8 @@ function CommentAuthorInfo({ avatar, name, date, userId }) {
102
103
  ] })
103
104
  ] });
104
105
  }
105
- var comment_author_info_default = CommentAuthorInfo;
106
- //# sourceMappingURL=comment-author-info.cjs.map
106
+ // Annotate the CommonJS export names for ESM import in node:
107
+ 0 && (module.exports = {
108
+ NoteByline
109
+ });
110
+ //# sourceMappingURL=note-byline.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collab-sidebar/note-byline.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Tooltip } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tdateI18n,\n\tgetSettings as getDateSettings,\n\thumanTimeDiff,\n\tgetDate,\n} from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getAvatarBorderColor } from './utils';\n\nexport function NoteByline( { avatar, name, date, userId } ) {\n\tconst hasAvatar = !! avatar;\n\tconst dateSettings = getDateSettings();\n\tconst {\n\t\tcurrentUserAvatar,\n\t\tcurrentUserName,\n\t\tcurrentUserId,\n\t\tdateFormat = dateSettings.formats.date,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getCurrentUser, getEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tif ( hasAvatar ) {\n\t\t\t\treturn {\n\t\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\tconst { __experimentalDiscussionSettings } = getSettings();\n\t\t\tconst defaultAvatar = __experimentalDiscussionSettings?.avatarURL;\n\t\t\tconst userData = getCurrentUser();\n\t\t\treturn {\n\t\t\t\tcurrentUserAvatar:\n\t\t\t\t\tuserData?.avatar_urls?.[ 48 ] ?? defaultAvatar,\n\t\t\t\tcurrentUserName: userData?.name,\n\t\t\t\tcurrentUserId: userData?.id,\n\t\t\t\tdateFormat: siteSettings?.date_format,\n\t\t\t};\n\t\t},\n\t\t[ hasAvatar ]\n\t);\n\n\tconst commentDate = getDate( date );\n\tconst commentDateTime = dateI18n( 'c', commentDate );\n\tconst shouldShowHumanTimeDiff =\n\t\tMath.floor( ( new Date() - commentDate ) / ( 1000 * 60 * 60 * 24 ) ) <\n\t\t30;\n\n\tconst commentDateText = shouldShowHumanTimeDiff\n\t\t? humanTimeDiff( commentDate )\n\t\t: dateI18n( dateFormat, commentDate );\n\n\tconst tooltipText = dateI18n(\n\t\t// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.\n\t\t_x( 'F j, Y g:i\\xa0a', 'Note date full date format' ),\n\t\tdate\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ avatar || currentUserAvatar }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\tuserId ?? currentUserId\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Stack direction=\"column\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ name ?? currentUserName }\n\t\t\t\t</span>\n\t\t\t\t{ date && (\n\t\t\t\t\t<Tooltip text={ tooltipText }>\n\t\t\t\t\t\t<time\n\t\t\t\t\t\t\tdateTime={ commentDateTime }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ commentDateText }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAwB;AACxB,gBAAsB;AACtB,kBAAuB;AACvB,kBAKO;AACP,uBAAmC;AACnC,kBAA0B;AAC1B,0BAA0C;AAK1C,mBAAqC;AA2DnC;AAzDK,SAAS,WAAY,EAAE,QAAQ,MAAM,MAAM,OAAO,GAAI;AAC5D,QAAM,YAAY,CAAC,CAAE;AACrB,QAAM,mBAAe,YAAAA,aAAgB;AACrC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,aAAa,QAAQ;AAAA,EACnC,QAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM,EAAE,SAAS,gBAAgB,gBAAgB,IAChD,OAAQ,iBAAAC,KAAU;AACnB,YAAM,eAAe,QAAS,QAAQ;AAAA,QACrC,MAAM;AAAA,QACN,MAAM;AAAA,MACP,CAAE,IACC,gBAAiB,QAAQ,MAAO,IAChC;AAEH,UAAK,WAAY;AAChB,eAAO;AAAA,UACN,YAAY,cAAc;AAAA,QAC3B;AAAA,MACD;AAEA,YAAM,EAAE,YAAY,IAAI,OAAQ,oBAAAC,KAAiB;AACjD,YAAM,EAAE,iCAAiC,IAAI,YAAY;AACzD,YAAM,gBAAgB,kCAAkC;AACxD,YAAM,WAAW,eAAe;AAChC,aAAO;AAAA,QACN,mBACC,UAAU,cAAe,EAAG,KAAK;AAAA,QAClC,iBAAiB,UAAU;AAAA,QAC3B,eAAe,UAAU;AAAA,QACzB,YAAY,cAAc;AAAA,MAC3B;AAAA,IACD;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,kBAAc,qBAAS,IAAK;AAClC,QAAM,sBAAkB,sBAAU,KAAK,WAAY;AACnD,QAAM,0BACL,KAAK,OAAS,oBAAI,KAAK,IAAI,gBAAkB,MAAO,KAAK,KAAK,GAAK,IACnE;AAED,QAAM,kBAAkB,8BACrB,2BAAe,WAAY,QAC3B,sBAAU,YAAY,WAAY;AAErC,QAAM,kBAAc;AAAA;AAAA,QAEnB,gBAAI,mBAAmB,4BAA6B;AAAA,IACpD;AAAA,EACD;AAEA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,KAAM,UAAU;AAAA,QAChB,WAAU;AAAA,QAEV,SAAM,gBAAI,aAAc;AAAA,QACxB,OAAQ;AAAA,QACR,QAAS;AAAA,QACT,OAAQ;AAAA,UACP,iBAAa;AAAA,YACZ,UAAU;AAAA,UACX;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACA,6CAAC,mBAAM,WAAU,UAChB;AAAA,kDAAC,UAAK,WAAU,0CACb,kBAAQ,iBACX;AAAA,MACE,QACD,4CAAC,6BAAQ,MAAO,aACf;AAAA,QAAC;AAAA;AAAA,UACA,UAAW;AAAA,UACX,WAAU;AAAA,UAER;AAAA;AAAA,MACH,GACD;AAAA,OAEF;AAAA,KACD;AAEF;",
6
+ "names": ["getDateSettings", "coreStore", "blockEditorStore"]
7
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/editor/src/components/collab-sidebar/note-card.js
21
+ var note_card_exports = {};
22
+ __export(note_card_exports, {
23
+ NoteCard: () => NoteCard
24
+ });
25
+ module.exports = __toCommonJS(note_card_exports);
26
+ var import_components = require("@wordpress/components");
27
+ var import_ui = require("@wordpress/ui");
28
+ var import_note_byline = require("./note-byline.cjs");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ function NoteCard({ note, actions, className, children, ...props }) {
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "column", gap: "sm", className, ...props, children: [
32
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "row", align: "center", justify: "flex-start", gap: "md", children: [
33
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
34
+ import_note_byline.NoteByline,
35
+ {
36
+ avatar: note?.author_avatar_urls?.[48],
37
+ name: note?.author_name,
38
+ date: note?.date,
39
+ userId: note?.author
40
+ }
41
+ ),
42
+ actions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
43
+ import_components.FlexItem,
44
+ {
45
+ className: "editor-collab-sidebar-panel__note-actions",
46
+ onClick: (event) => event.stopPropagation(),
47
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Stack, { direction: "row", align: "center", children: actions })
48
+ }
49
+ )
50
+ ] }),
51
+ children
52
+ ] });
53
+ }
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ NoteCard
57
+ });
58
+ //# sourceMappingURL=note-card.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collab-sidebar/note-card.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { FlexItem } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { NoteByline } from './note-byline';\n\nexport function NoteCard( { note, actions, className, children, ...props } ) {\n\treturn (\n\t\t<Stack direction=\"column\" gap=\"sm\" className={ className } { ...props }>\n\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"flex-start\" gap=\"md\">\n\t\t\t\t<NoteByline\n\t\t\t\t\tavatar={ note?.author_avatar_urls?.[ 48 ] }\n\t\t\t\t\tname={ note?.author_name }\n\t\t\t\t\tdate={ note?.date }\n\t\t\t\t\tuserId={ note?.author }\n\t\t\t\t/>\n\t\t\t\t{ actions && (\n\t\t\t\t\t<FlexItem\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__note-actions\"\n\t\t\t\t\t\tonClick={ ( event ) => event.stopPropagation() }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack direction=\"row\" align=\"center\">\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</Stack>\n\t\t\t{ children }\n\t\t</Stack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAyB;AACzB,gBAAsB;AAKtB,yBAA2B;AAKxB;AAHI,SAAS,SAAU,EAAE,MAAM,SAAS,WAAW,UAAU,GAAG,MAAM,GAAI;AAC5E,SACC,6CAAC,mBAAM,WAAU,UAAS,KAAI,MAAK,WAA0B,GAAG,OAC/D;AAAA,iDAAC,mBAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,cAAa,KAAI,MAC9D;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,QAAS,MAAM,qBAAsB,EAAG;AAAA,UACxC,MAAO,MAAM;AAAA,UACb,MAAO,MAAM;AAAA,UACb,QAAS,MAAM;AAAA;AAAA,MAChB;AAAA,MACE,WACD;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,SAAU,CAAE,UAAW,MAAM,gBAAgB;AAAA,UAE7C,sDAAC,mBAAM,WAAU,OAAM,OAAM,UAC1B,mBACH;AAAA;AAAA,MACD;AAAA,OAEF;AAAA,IACE;AAAA,KACH;AAEF;",
6
+ "names": []
7
+ }
@@ -27,59 +27,47 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // packages/editor/src/components/collab-sidebar/comment-form.js
31
- var comment_form_exports = {};
32
- __export(comment_form_exports, {
33
- default: () => comment_form_default
30
+ // packages/editor/src/components/collab-sidebar/note-form.js
31
+ var note_form_exports = {};
32
+ __export(note_form_exports, {
33
+ NoteForm: () => NoteForm
34
34
  });
35
- module.exports = __toCommonJS(comment_form_exports);
35
+ module.exports = __toCommonJS(note_form_exports);
36
36
  var import_react_autosize_textarea = __toESM(require("react-autosize-textarea"));
37
37
  var import_element = require("@wordpress/element");
38
38
  var import_components = require("@wordpress/components");
39
+ var import_ui = require("@wordpress/ui");
39
40
  var import_i18n = require("@wordpress/i18n");
40
41
  var import_compose = require("@wordpress/compose");
41
42
  var import_keycodes = require("@wordpress/keycodes");
42
43
  var import_utils = require("./utils.cjs");
43
44
  var import_jsx_runtime = require("react/jsx-runtime");
44
- function CommentForm({
45
- onSubmit,
46
- onCancel,
47
- thread,
48
- submitButtonText,
49
- labelText,
50
- reflowComments = import_utils.noop
51
- }) {
45
+ function NoteForm({ onSubmit, onCancel, note, labels }) {
52
46
  const [inputComment, setInputComment] = (0, import_element.useState)(
53
- thread?.content?.raw ?? ""
47
+ note?.content?.raw ?? ""
54
48
  );
55
- const debouncedCommentUpdated = (0, import_compose.useDebounce)(reflowComments, 100);
56
- const updateComment = (value) => {
57
- setInputComment(value);
58
- };
59
- const inputId = (0, import_compose.useInstanceId)(CommentForm, "comment-input");
60
- const isDisabled = inputComment === thread?.content?.raw || !(0, import_utils.sanitizeCommentString)(inputComment).length;
49
+ const inputId = (0, import_compose.useInstanceId)(NoteForm, "comment-input");
50
+ const isDisabled = inputComment === note?.content?.raw || !(0, import_utils.sanitizeNoteContent)(inputComment).length;
61
51
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
62
- import_components.__experimentalVStack,
52
+ import_ui.Stack,
63
53
  {
64
- className: "editor-collab-sidebar-panel__comment-form",
65
- spacing: "4",
66
- as: "form",
54
+ className: "editor-collab-sidebar-panel__note-form",
55
+ direction: "column",
56
+ gap: "lg",
57
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {}),
67
58
  onSubmit: (event) => {
68
59
  event.preventDefault();
69
60
  onSubmit(inputComment);
70
61
  setInputComment("");
71
62
  },
72
63
  children: [
73
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.VisuallyHidden, { as: "label", htmlFor: inputId, children: labelText ?? (0, import_i18n.__)("Note") }),
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: inputId }), children: labels?.input ?? (0, import_i18n.__)("Note") }),
74
65
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
66
  import_react_autosize_textarea.default,
76
67
  {
77
68
  id: inputId,
78
69
  value: inputComment ?? "",
79
- onChange: (comment) => {
80
- updateComment(comment.target.value);
81
- debouncedCommentUpdated();
82
- },
70
+ onChange: (comment) => setInputComment(comment.target.value),
83
71
  rows: 1,
84
72
  maxRows: 20,
85
73
  onKeyDown: (event) => {
@@ -93,23 +81,36 @@ function CommentForm({
93
81
  }
94
82
  }
95
83
  ),
96
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "2", justify: "flex-end", wrap: true, children: [
97
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Button, { size: "compact", variant: "tertiary", onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: (0, import_i18n.__)("Cancel") }) }),
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
- import_components.Button,
100
- {
101
- size: "compact",
102
- accessibleWhenDisabled: true,
103
- variant: "primary",
104
- type: "submit",
105
- disabled: isDisabled,
106
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: submitButtonText })
107
- }
108
- )
109
- ] })
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
85
+ import_ui.Stack,
86
+ {
87
+ direction: "row",
88
+ align: "center",
89
+ justify: "flex-end",
90
+ gap: "sm",
91
+ wrap: "wrap",
92
+ children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Button, { size: "compact", variant: "tertiary", onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: (0, import_i18n.__)("Cancel") }) }),
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
+ import_components.Button,
96
+ {
97
+ size: "compact",
98
+ accessibleWhenDisabled: true,
99
+ variant: "primary",
100
+ type: "submit",
101
+ disabled: isDisabled,
102
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: labels?.submit ?? (0, import_i18n.__)("Add note") })
103
+ }
104
+ )
105
+ ]
106
+ }
107
+ )
110
108
  ]
111
109
  }
112
110
  );
113
111
  }
114
- var comment_form_default = CommentForm;
115
- //# sourceMappingURL=comment-form.cjs.map
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ NoteForm
115
+ });
116
+ //# sourceMappingURL=note-form.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collab-sidebar/note-form.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport TextareaAutosize from 'react-autosize-textarea';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\t__experimentalTruncate as Truncate,\n\tButton,\n} from '@wordpress/components';\nimport { Stack, VisuallyHidden } from '@wordpress/ui';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { sanitizeNoteContent } from './utils';\n\nexport function NoteForm( { onSubmit, onCancel, note, labels } ) {\n\tconst [ inputComment, setInputComment ] = useState(\n\t\tnote?.content?.raw ?? ''\n\t);\n\n\tconst inputId = useInstanceId( NoteForm, 'comment-input' );\n\tconst isDisabled =\n\t\tinputComment === note?.content?.raw ||\n\t\t! sanitizeNoteContent( inputComment ).length;\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"editor-collab-sidebar-panel__note-form\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"lg\"\n\t\t\trender={ <form /> }\n\t\t\tonSubmit={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonSubmit( inputComment );\n\t\t\t\tsetInputComment( '' );\n\t\t\t} }\n\t\t>\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/label-has-associated-control */ }\n\t\t\t<VisuallyHidden render={ <label htmlFor={ inputId } /> }>\n\t\t\t\t{ labels?.input ?? __( 'Note' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<TextareaAutosize\n\t\t\t\tid={ inputId }\n\t\t\t\tvalue={ inputComment ?? '' }\n\t\t\t\tonChange={ ( comment ) =>\n\t\t\t\t\tsetInputComment( comment.target.value )\n\t\t\t\t}\n\t\t\t\trows={ 1 }\n\t\t\t\tmaxRows={ 20 }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tisKeyboardEvent.primary( event, 'Enter' ) &&\n\t\t\t\t\t\t! isDisabled\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.target.parentNode.requestSubmit();\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t// Passing event for reply forms.\n\t\t\t\t\t\tonCancel( event );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\tgap=\"sm\"\n\t\t\t\twrap=\"wrap\"\n\t\t\t>\n\t\t\t\t<Button size=\"compact\" variant=\"tertiary\" onClick={ onCancel }>\n\t\t\t\t\t<Truncate>{ __( 'Cancel' ) }</Truncate>\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t>\n\t\t\t\t\t<Truncate>{ labels?.submit ?? __( 'Add note' ) }</Truncate>\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</Stack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qCAA6B;AAK7B,qBAAyB;AACzB,wBAGO;AACP,gBAAsC;AACtC,kBAAmB;AACnB,qBAA8B;AAC9B,sBAAgC;AAKhC,mBAAoC;AAiBxB;AAfL,SAAS,SAAU,EAAE,UAAU,UAAU,MAAM,OAAO,GAAI;AAChE,QAAM,CAAE,cAAc,eAAgB,QAAI;AAAA,IACzC,MAAM,SAAS,OAAO;AAAA,EACvB;AAEA,QAAM,cAAU,8BAAe,UAAU,eAAgB;AACzD,QAAM,aACL,iBAAiB,MAAM,SAAS,OA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AAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF;",
6
+ "names": ["TextareaAutosize", "Truncate"]
7
+ }
@@ -17,42 +17,43 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/editor/src/components/collab-sidebar/comment-indicator-toolbar.js
21
- var comment_indicator_toolbar_exports = {};
22
- __export(comment_indicator_toolbar_exports, {
23
- default: () => comment_indicator_toolbar_default
20
+ // packages/editor/src/components/collab-sidebar/note-indicator-toolbar.js
21
+ var note_indicator_toolbar_exports = {};
22
+ __export(note_indicator_toolbar_exports, {
23
+ NoteAvatarIndicator: () => NoteAvatarIndicator
24
24
  });
25
- module.exports = __toCommonJS(comment_indicator_toolbar_exports);
25
+ module.exports = __toCommonJS(note_indicator_toolbar_exports);
26
26
  var import_components = require("@wordpress/components");
27
+ var import_ui = require("@wordpress/ui");
27
28
  var import_i18n = require("@wordpress/i18n");
28
29
  var import_element = require("@wordpress/element");
29
30
  var import_block_editor = require("@wordpress/block-editor");
30
31
  var import_lock_unlock = require("../../lock-unlock.cjs");
31
32
  var import_utils = require("./utils.cjs");
32
33
  var import_jsx_runtime = require("react/jsx-runtime");
33
- var { CommentIconToolbarSlotFill } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
34
- var CommentAvatarIndicator = ({ onClick, thread }) => {
34
+ var { NoteIconToolbarSlotFill } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
35
+ function NoteAvatarIndicator({ onClick, note }) {
35
36
  const threadParticipants = (0, import_element.useMemo)(() => {
36
- if (!thread) {
37
+ if (!note) {
37
38
  return [];
38
39
  }
39
40
  const participantsMap = /* @__PURE__ */ new Map();
40
- const allComments = [thread, ...thread.reply];
41
- allComments.sort((a, b) => new Date(a.date) - new Date(b.date));
42
- allComments.forEach((comment) => {
43
- if (comment.author_name && comment.author_avatar_urls) {
44
- if (!participantsMap.has(comment.author)) {
45
- participantsMap.set(comment.author, {
46
- name: comment.author_name,
47
- avatar: comment.author_avatar_urls?.["48"] || comment.author_avatar_urls?.["96"],
48
- id: comment.author,
49
- date: comment.date
41
+ const allNotes = [note, ...note.reply];
42
+ allNotes.sort((a, b) => new Date(a.date) - new Date(b.date));
43
+ allNotes.forEach((entry) => {
44
+ if (entry.author_name && entry.author_avatar_urls) {
45
+ if (!participantsMap.has(entry.author)) {
46
+ participantsMap.set(entry.author, {
47
+ name: entry.author_name,
48
+ avatar: entry.author_avatar_urls?.["48"] || entry.author_avatar_urls?.["96"],
49
+ id: entry.author,
50
+ date: entry.date
50
51
  });
51
52
  }
52
53
  }
53
54
  });
54
55
  return Array.from(participantsMap.values());
55
- }, [thread]);
56
+ }, [note]);
56
57
  if (!threadParticipants.length) {
57
58
  return null;
58
59
  }
@@ -69,20 +70,20 @@ var CommentAvatarIndicator = ({ onClick, thread }) => {
69
70
  (0, import_i18n.__)("+%s"),
70
71
  overflowCount
71
72
  );
72
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CommentIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NoteIconToolbarSlotFill.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
74
  import_components.ToolbarButton,
74
75
  {
75
- className: "comment-avatar-indicator",
76
+ className: "editor-note-indicator",
76
77
  label: (0, import_i18n.__)("View notes"),
77
78
  onClick: () => onClick(),
78
79
  showTooltip: true,
79
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "1", children: [
80
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "row", align: "center", gap: "xs", children: [
80
81
  visibleParticipants.map((participant) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
82
  "img",
82
83
  {
83
84
  src: participant.avatar,
84
85
  alt: participant.name,
85
- className: "comment-avatar",
86
+ className: "editor-note-indicator__avatar",
86
87
  style: {
87
88
  borderColor: (0, import_utils.getAvatarBorderColor)(
88
89
  participant.id
@@ -91,10 +92,13 @@ var CommentAvatarIndicator = ({ onClick, thread }) => {
91
92
  },
92
93
  participant.id
93
94
  )),
94
- overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { weight: 500, children: overflowText })
95
+ overflowCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "editor-note-indicator__overflow", children: overflowText })
95
96
  ] })
96
97
  }
97
98
  ) });
98
- };
99
- var comment_indicator_toolbar_default = CommentAvatarIndicator;
100
- //# sourceMappingURL=comment-indicator-toolbar.cjs.map
99
+ }
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ NoteAvatarIndicator
103
+ });
104
+ //# sourceMappingURL=note-indicator-toolbar.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collab-sidebar/note-indicator-toolbar.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarBorderColor } from './utils';\n\nconst { NoteIconToolbarSlotFill } = unlock( blockEditorPrivateApis );\n\nexport function NoteAvatarIndicator( { onClick, note } ) {\n\tconst threadParticipants = useMemo( () => {\n\t\tif ( ! note ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst participantsMap = new Map();\n\t\tconst allNotes = [ note, ...note.reply ];\n\n\t\t// Sort by date to show participants in chronological order.\n\t\tallNotes.sort( ( a, b ) => new Date( a.date ) - new Date( b.date ) );\n\n\t\tallNotes.forEach( ( entry ) => {\n\t\t\t// Track thread participants (original author + repliers).\n\t\t\tif ( entry.author_name && entry.author_avatar_urls ) {\n\t\t\t\tif ( ! participantsMap.has( entry.author ) ) {\n\t\t\t\t\tparticipantsMap.set( entry.author, {\n\t\t\t\t\t\tname: entry.author_name,\n\t\t\t\t\t\tavatar:\n\t\t\t\t\t\t\tentry.author_avatar_urls?.[ '48' ] ||\n\t\t\t\t\t\t\tentry.author_avatar_urls?.[ '96' ],\n\t\t\t\t\t\tid: entry.author,\n\t\t\t\t\t\tdate: entry.date,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\treturn Array.from( participantsMap.values() );\n\t}, [ note ] );\n\n\tif ( ! threadParticipants.length ) {\n\t\treturn null;\n\t}\n\n\t// If there are more than 3 participants, show 2 avatars and a \"+n\" number.\n\tconst maxAvatars = 3;\n\tconst isOverflow = threadParticipants.length > maxAvatars;\n\tconst visibleParticipants = isOverflow\n\t\t? threadParticipants.slice( 0, maxAvatars - 1 )\n\t\t: threadParticipants;\n\tconst overflowCount = Math.max(\n\t\t0,\n\t\tthreadParticipants.length - visibleParticipants.length\n\t);\n\tconst threadHasMoreParticipants = threadParticipants.length > 100;\n\n\t// If we hit the note limit, show \"100+\" instead of exact overflow count.\n\tconst overflowText =\n\t\tthreadHasMoreParticipants && overflowCount > 0\n\t\t\t? __( '100+' )\n\t\t\t: sprintf(\n\t\t\t\t\t// translators: %s: Number of participants.\n\t\t\t\t\t__( '+%s' ),\n\t\t\t\t\toverflowCount\n\t\t\t );\n\n\treturn (\n\t\t<NoteIconToolbarSlotFill.Fill>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"editor-note-indicator\"\n\t\t\t\tlabel={ __( 'View notes' ) }\n\t\t\t\tonClick={ () => onClick() }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" align=\"center\" gap=\"xs\">\n\t\t\t\t\t{ visibleParticipants.map( ( participant ) => (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tkey={ participant.id }\n\t\t\t\t\t\t\tsrc={ participant.avatar }\n\t\t\t\t\t\t\talt={ participant.name }\n\t\t\t\t\t\t\tclassName=\"editor-note-indicator__avatar\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tborderColor: getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\tparticipant.id\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ overflowCount > 0 && (\n\t\t\t\t\t\t<span className=\"editor-note-indicator__overflow\">\n\t\t\t\t\t\t\t{ overflowText }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Stack>\n\t\t\t</ToolbarButton>\n\t\t</NoteIconToolbarSlotFill.Fill>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,gBAAsB;AACtB,kBAA4B;AAC5B,qBAAwB;AACxB,0BAAsD;AAKtD,yBAAuB;AACvB,mBAAqC;AAqEjC;AAnEJ,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,oBAAAA,WAAuB;AAE5D,SAAS,oBAAqB,EAAE,SAAS,KAAK,GAAI;AACxD,QAAM,yBAAqB,wBAAS,MAAM;AACzC,QAAK,CAAE,MAAO;AACb,aAAO,CAAC;AAAA,IACT;AAEA,UAAM,kBAAkB,oBAAI,IAAI;AAChC,UAAM,WAAW,CAAE,MAAM,GAAG,KAAK,KAAM;AAGvC,aAAS,KAAM,CAAE,GAAG,MAAO,IAAI,KAAM,EAAE,IAAK,IAAI,IAAI,KAAM,EAAE,IAAK,CAAE;AAEnE,aAAS,QAAS,CAAE,UAAW;AAE9B,UAAK,MAAM,eAAe,MAAM,oBAAqB;AACpD,YAAK,CAAE,gBAAgB,IAAK,MAAM,MAAO,GAAI;AAC5C,0BAAgB,IAAK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