@wordpress/editor 14.44.1-next.v.202604201441.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 (322) 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-comment.cjs → add-note.cjs} +28 -41
  5. package/build/components/collab-sidebar/add-note.cjs.map +7 -0
  6. package/build/components/collab-sidebar/board-store.cjs +3 -0
  7. package/build/components/collab-sidebar/board-store.cjs.map +2 -2
  8. package/build/components/collab-sidebar/floating-container.cjs +4 -3
  9. package/build/components/collab-sidebar/floating-container.cjs.map +3 -3
  10. package/build/components/collab-sidebar/hooks.cjs +92 -135
  11. package/build/components/collab-sidebar/hooks.cjs.map +3 -3
  12. package/build/components/collab-sidebar/index.cjs +28 -79
  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} +45 -36
  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 +23 -25
  29. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  30. package/build/components/document-bar/index.cjs.map +3 -3
  31. package/build/components/error-boundary/index.cjs.map +3 -3
  32. package/build/components/list-view-sidebar/list-view-outline.cjs.map +3 -3
  33. package/build/components/media/media-editor-modal.cjs +93 -0
  34. package/build/components/media/media-editor-modal.cjs.map +7 -0
  35. package/build/components/more-menu/index.cjs +3 -2
  36. package/build/components/more-menu/index.cjs.map +2 -2
  37. package/build/components/post-actions/set-as-homepage.cjs.map +3 -3
  38. package/build/components/post-actions/set-as-posts-page.cjs.map +3 -3
  39. package/build/components/post-card-panel/index.cjs +2 -2
  40. package/build/components/post-card-panel/index.cjs.map +3 -3
  41. package/build/components/post-content-information/index.cjs.map +3 -3
  42. package/build/components/post-excerpt/panel.cjs.map +3 -3
  43. package/build/components/post-last-edited-panel/index.cjs.map +3 -3
  44. package/build/components/post-preview-button/index.cjs +3 -2
  45. package/build/components/post-preview-button/index.cjs.map +2 -2
  46. package/build/components/post-publish-button/index.cjs +2 -2
  47. package/build/components/post-publish-button/index.cjs.map +2 -2
  48. package/build/components/post-publish-button/label.cjs +4 -2
  49. package/build/components/post-publish-button/label.cjs.map +2 -2
  50. package/build/components/post-publish-panel/postpublish.cjs +3 -2
  51. package/build/components/post-publish-panel/postpublish.cjs.map +2 -2
  52. package/build/components/post-revisions-panel/index.cjs +2 -2
  53. package/build/components/post-revisions-panel/index.cjs.map +2 -2
  54. package/build/components/post-revisions-preview/diff-markers.cjs +1 -1
  55. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  56. package/build/components/post-revisions-preview/revisions-slider.cjs +1 -0
  57. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  58. package/build/components/post-saved-state/index.cjs +4 -1
  59. package/build/components/post-saved-state/index.cjs.map +2 -2
  60. package/build/components/post-text-editor/index.cjs +3 -4
  61. package/build/components/post-text-editor/index.cjs.map +2 -2
  62. package/build/components/preview-dropdown/index.cjs +3 -2
  63. package/build/components/preview-dropdown/index.cjs.map +2 -2
  64. package/build/components/provider/index.cjs +3 -1
  65. package/build/components/provider/index.cjs.map +3 -3
  66. package/build/components/provider/use-block-editor-settings.cjs +7 -1
  67. package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
  68. package/build/components/provider/use-upload-save-lock.cjs +2 -12
  69. package/build/components/provider/use-upload-save-lock.cjs.map +2 -2
  70. package/build/components/resizable-editor/resize-handle.cjs +2 -1
  71. package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
  72. package/build/components/revision-created-panel/index.cjs.map +3 -3
  73. package/build/components/site-discussion/index.cjs.map +2 -2
  74. package/build/components/template-actions-panel/classic-theme-content.cjs.map +2 -2
  75. package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
  76. package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
  77. package/build/components/visual-editor/index.cjs +5 -22
  78. package/build/components/visual-editor/index.cjs.map +2 -2
  79. package/build/store/private-actions.cjs +0 -8
  80. package/build/store/private-actions.cjs.map +2 -2
  81. package/build/store/private-selectors.cjs +0 -5
  82. package/build/store/private-selectors.cjs.map +2 -2
  83. package/build/store/reducer.cjs +0 -10
  84. package/build/store/reducer.cjs.map +2 -2
  85. package/build/utils/media-finalize/index.cjs +3 -2
  86. package/build/utils/media-finalize/index.cjs.map +2 -2
  87. package/build/utils/media-upload/index.cjs +14 -25
  88. package/build/utils/media-upload/index.cjs.map +2 -2
  89. package/build-module/components/collab-sidebar/{comment-menu-item.mjs → add-note-menu-item.mjs} +10 -11
  90. package/build-module/components/collab-sidebar/add-note-menu-item.mjs.map +7 -0
  91. package/build-module/components/collab-sidebar/{add-comment.mjs → add-note.mjs} +26 -29
  92. package/build-module/components/collab-sidebar/add-note.mjs.map +7 -0
  93. package/build-module/components/collab-sidebar/board-store.mjs +3 -0
  94. package/build-module/components/collab-sidebar/board-store.mjs.map +2 -2
  95. package/build-module/components/collab-sidebar/floating-container.mjs +4 -3
  96. package/build-module/components/collab-sidebar/floating-container.mjs.map +2 -2
  97. package/build-module/components/collab-sidebar/hooks.mjs +91 -137
  98. package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
  99. package/build-module/components/collab-sidebar/index.mjs +29 -84
  100. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  101. package/build-module/components/collab-sidebar/{comment-author-info.mjs → note-byline.mjs} +7 -7
  102. package/build-module/components/collab-sidebar/note-byline.mjs.map +7 -0
  103. package/build-module/components/collab-sidebar/note-card.mjs +33 -0
  104. package/build-module/components/collab-sidebar/note-card.mjs.map +7 -0
  105. package/build-module/components/collab-sidebar/note-form.mjs +84 -0
  106. package/build-module/components/collab-sidebar/note-form.mjs.map +7 -0
  107. package/build-module/components/collab-sidebar/{comment-indicator-toolbar.mjs → note-indicator-toolbar.mjs} +25 -29
  108. package/build-module/components/collab-sidebar/note-indicator-toolbar.mjs.map +7 -0
  109. package/build-module/components/collab-sidebar/note-thread.mjs +289 -0
  110. package/build-module/components/collab-sidebar/note-thread.mjs.map +7 -0
  111. package/build-module/components/collab-sidebar/note.mjs +176 -0
  112. package/build-module/components/collab-sidebar/note.mjs.map +7 -0
  113. package/build-module/components/collab-sidebar/notes.mjs +215 -0
  114. package/build-module/components/collab-sidebar/notes.mjs.map +7 -0
  115. package/build-module/components/collab-sidebar/utils.mjs +19 -21
  116. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  117. package/build-module/components/document-bar/index.mjs +3 -3
  118. package/build-module/components/document-bar/index.mjs.map +2 -2
  119. package/build-module/components/error-boundary/index.mjs +2 -2
  120. package/build-module/components/error-boundary/index.mjs.map +2 -2
  121. package/build-module/components/list-view-sidebar/list-view-outline.mjs +5 -5
  122. package/build-module/components/list-view-sidebar/list-view-outline.mjs.map +2 -2
  123. package/build-module/components/media/media-editor-modal.mjs +62 -0
  124. package/build-module/components/media/media-editor-modal.mjs.map +7 -0
  125. package/build-module/components/more-menu/index.mjs +3 -7
  126. package/build-module/components/more-menu/index.mjs.map +2 -2
  127. package/build-module/components/post-actions/set-as-homepage.mjs +2 -2
  128. package/build-module/components/post-actions/set-as-homepage.mjs.map +2 -2
  129. package/build-module/components/post-actions/set-as-posts-page.mjs +2 -2
  130. package/build-module/components/post-actions/set-as-posts-page.mjs.map +2 -2
  131. package/build-module/components/post-card-panel/index.mjs +5 -5
  132. package/build-module/components/post-card-panel/index.mjs.map +2 -2
  133. package/build-module/components/post-content-information/index.mjs +2 -2
  134. package/build-module/components/post-content-information/index.mjs.map +2 -2
  135. package/build-module/components/post-excerpt/panel.mjs +2 -2
  136. package/build-module/components/post-excerpt/panel.mjs.map +2 -2
  137. package/build-module/components/post-last-edited-panel/index.mjs +2 -2
  138. package/build-module/components/post-last-edited-panel/index.mjs.map +2 -2
  139. package/build-module/components/post-preview-button/index.mjs +3 -2
  140. package/build-module/components/post-preview-button/index.mjs.map +2 -2
  141. package/build-module/components/post-publish-button/index.mjs +2 -2
  142. package/build-module/components/post-publish-button/index.mjs.map +2 -2
  143. package/build-module/components/post-publish-button/label.mjs +4 -2
  144. package/build-module/components/post-publish-button/label.mjs.map +2 -2
  145. package/build-module/components/post-publish-panel/postpublish.mjs +3 -3
  146. package/build-module/components/post-publish-panel/postpublish.mjs.map +2 -2
  147. package/build-module/components/post-revisions-panel/index.mjs +2 -2
  148. package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
  149. package/build-module/components/post-revisions-preview/diff-markers.mjs +1 -1
  150. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  151. package/build-module/components/post-revisions-preview/revisions-slider.mjs +1 -0
  152. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  153. package/build-module/components/post-saved-state/index.mjs +4 -1
  154. package/build-module/components/post-saved-state/index.mjs.map +2 -2
  155. package/build-module/components/post-text-editor/index.mjs +2 -3
  156. package/build-module/components/post-text-editor/index.mjs.map +2 -2
  157. package/build-module/components/preview-dropdown/index.mjs +2 -2
  158. package/build-module/components/preview-dropdown/index.mjs.map +2 -2
  159. package/build-module/components/provider/index.mjs +3 -1
  160. package/build-module/components/provider/index.mjs.map +2 -2
  161. package/build-module/components/provider/use-block-editor-settings.mjs +7 -1
  162. package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
  163. package/build-module/components/provider/use-upload-save-lock.mjs +2 -12
  164. package/build-module/components/provider/use-upload-save-lock.mjs.map +2 -2
  165. package/build-module/components/resizable-editor/resize-handle.mjs +2 -5
  166. package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
  167. package/build-module/components/revision-created-panel/index.mjs +2 -2
  168. package/build-module/components/revision-created-panel/index.mjs.map +2 -2
  169. package/build-module/components/site-discussion/index.mjs +2 -2
  170. package/build-module/components/site-discussion/index.mjs.map +2 -2
  171. package/build-module/components/template-actions-panel/classic-theme-content.mjs +2 -2
  172. package/build-module/components/template-actions-panel/classic-theme-content.mjs.map +2 -2
  173. package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
  174. package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
  175. package/build-module/components/visual-editor/index.mjs +5 -22
  176. package/build-module/components/visual-editor/index.mjs.map +2 -2
  177. package/build-module/store/private-actions.mjs +0 -7
  178. package/build-module/store/private-actions.mjs.map +2 -2
  179. package/build-module/store/private-selectors.mjs +0 -4
  180. package/build-module/store/private-selectors.mjs.map +2 -2
  181. package/build-module/store/reducer.mjs +0 -9
  182. package/build-module/store/reducer.mjs.map +2 -2
  183. package/build-module/utils/media-finalize/index.mjs +3 -2
  184. package/build-module/utils/media-finalize/index.mjs.map +2 -2
  185. package/build-module/utils/media-upload/index.mjs +14 -25
  186. package/build-module/utils/media-upload/index.mjs.map +2 -2
  187. package/build-style/style-rtl.css +386 -142
  188. package/build-style/style.css +386 -142
  189. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
  190. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
  191. package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
  192. package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
  193. package/build-types/components/collab-sidebar/board-store.d.ts +1 -0
  194. package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -1
  195. package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -1
  196. package/build-types/components/collab-sidebar/hooks.d.ts +8 -21
  197. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  198. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  199. package/build-types/components/collab-sidebar/note-byline.d.ts +7 -0
  200. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
  201. package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
  202. package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
  203. package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
  204. package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
  205. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
  206. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
  207. package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
  208. package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
  209. package/build-types/components/collab-sidebar/note.d.ts +9 -0
  210. package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
  211. package/build-types/components/collab-sidebar/notes.d.ts +7 -0
  212. package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
  213. package/build-types/components/collab-sidebar/utils.d.ts +21 -20
  214. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  215. package/build-types/components/media/media-editor-modal.d.ts +11 -0
  216. package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
  217. package/build-types/components/more-menu/index.d.ts.map +1 -1
  218. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  219. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  220. package/build-types/components/post-publish-button/label.d.ts.map +1 -1
  221. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  222. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  223. package/build-types/components/provider/index.d.ts.map +1 -1
  224. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  225. package/build-types/components/provider/use-upload-save-lock.d.ts +0 -2
  226. package/build-types/components/provider/use-upload-save-lock.d.ts.map +1 -1
  227. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  228. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
  229. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  230. package/build-types/store/private-actions.d.ts +0 -7
  231. package/build-types/store/private-actions.d.ts.map +1 -1
  232. package/build-types/store/private-selectors.d.ts +0 -7
  233. package/build-types/store/private-selectors.d.ts.map +1 -1
  234. package/build-types/store/reducer.d.ts +0 -10
  235. package/build-types/store/reducer.d.ts.map +1 -1
  236. package/build-types/utils/media-finalize/index.d.ts +1 -1
  237. package/build-types/utils/media-finalize/index.d.ts.map +1 -1
  238. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  239. package/package.json +46 -46
  240. package/src/components/collab-sidebar/README.md +117 -0
  241. package/src/components/collab-sidebar/{comment-menu-item.js → add-note-menu-item.js} +8 -10
  242. package/src/components/collab-sidebar/{add-comment.js → add-note.js} +20 -21
  243. package/src/components/collab-sidebar/board-store.js +4 -2
  244. package/src/components/collab-sidebar/floating-container.js +5 -4
  245. package/src/components/collab-sidebar/hooks.js +115 -175
  246. package/src/components/collab-sidebar/index.js +35 -95
  247. package/src/components/collab-sidebar/{comment-author-info.js → note-byline.js} +5 -6
  248. package/src/components/collab-sidebar/note-card.js +36 -0
  249. package/src/components/collab-sidebar/{comment-form.js → note-form.js} +25 -27
  250. package/src/components/collab-sidebar/{comment-indicator-toolbar.js → note-indicator-toolbar.js} +29 -32
  251. package/src/components/collab-sidebar/note-thread.js +331 -0
  252. package/src/components/collab-sidebar/note.js +209 -0
  253. package/src/components/collab-sidebar/notes.js +276 -0
  254. package/src/components/collab-sidebar/style.scss +21 -11
  255. package/src/components/collab-sidebar/test/utils.js +65 -63
  256. package/src/components/collab-sidebar/utils.js +33 -35
  257. package/src/components/document-bar/index.js +4 -4
  258. package/src/components/error-boundary/index.js +3 -3
  259. package/src/components/list-view-sidebar/list-view-outline.js +6 -6
  260. package/src/components/media/media-editor-modal.js +95 -0
  261. package/src/components/more-menu/index.js +3 -7
  262. package/src/components/post-actions/set-as-homepage.js +2 -2
  263. package/src/components/post-actions/set-as-posts-page.js +2 -2
  264. package/src/components/post-card-panel/index.js +7 -7
  265. package/src/components/post-content-information/index.js +3 -3
  266. package/src/components/post-excerpt/panel.js +3 -3
  267. package/src/components/post-last-edited-panel/index.js +3 -3
  268. package/src/components/post-preview-button/index.js +3 -2
  269. package/src/components/post-publish-button/index.js +6 -5
  270. package/src/components/post-publish-button/label.js +3 -1
  271. package/src/components/post-publish-panel/postpublish.js +2 -2
  272. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +8 -14
  273. package/src/components/post-revisions-panel/index.js +3 -3
  274. package/src/components/post-revisions-preview/diff-markers.js +1 -1
  275. package/src/components/post-revisions-preview/revisions-slider.js +1 -0
  276. package/src/components/post-saved-state/index.js +4 -1
  277. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -1
  278. package/src/components/post-text-editor/index.js +3 -3
  279. package/src/components/preview-dropdown/index.js +2 -2
  280. package/src/components/provider/index.js +4 -0
  281. package/src/components/provider/use-block-editor-settings.js +10 -0
  282. package/src/components/provider/use-upload-save-lock.js +2 -17
  283. package/src/components/resizable-editor/resize-handle.js +2 -5
  284. package/src/components/revision-created-panel/index.js +3 -3
  285. package/src/components/site-discussion/index.js +3 -3
  286. package/src/components/template-actions-panel/classic-theme-content.js +3 -3
  287. package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
  288. package/src/components/visual-editor/index.js +2 -29
  289. package/src/store/private-actions.js +0 -13
  290. package/src/store/private-selectors.js +0 -10
  291. package/src/store/reducer.js +0 -16
  292. package/src/utils/media-finalize/index.js +2 -1
  293. package/src/utils/media-finalize/test/index.js +25 -1
  294. package/src/utils/media-upload/index.js +26 -29
  295. package/build/components/collab-sidebar/add-comment.cjs.map +0 -7
  296. package/build/components/collab-sidebar/comment-author-info.cjs.map +0 -7
  297. package/build/components/collab-sidebar/comment-form.cjs.map +0 -7
  298. package/build/components/collab-sidebar/comment-indicator-toolbar.cjs.map +0 -7
  299. package/build/components/collab-sidebar/comment-menu-item.cjs.map +0 -7
  300. package/build/components/collab-sidebar/comments.cjs +0 -696
  301. package/build/components/collab-sidebar/comments.cjs.map +0 -7
  302. package/build-module/components/collab-sidebar/add-comment.mjs.map +0 -7
  303. package/build-module/components/collab-sidebar/comment-author-info.mjs.map +0 -7
  304. package/build-module/components/collab-sidebar/comment-form.mjs +0 -82
  305. package/build-module/components/collab-sidebar/comment-form.mjs.map +0 -7
  306. package/build-module/components/collab-sidebar/comment-indicator-toolbar.mjs.map +0 -7
  307. package/build-module/components/collab-sidebar/comment-menu-item.mjs.map +0 -7
  308. package/build-module/components/collab-sidebar/comments.mjs +0 -678
  309. package/build-module/components/collab-sidebar/comments.mjs.map +0 -7
  310. package/build-types/components/collab-sidebar/add-comment.d.ts +0 -6
  311. package/build-types/components/collab-sidebar/add-comment.d.ts.map +0 -1
  312. package/build-types/components/collab-sidebar/comment-author-info.d.ts +0 -8
  313. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +0 -1
  314. package/build-types/components/collab-sidebar/comment-form.d.ts +0 -9
  315. package/build-types/components/collab-sidebar/comment-form.d.ts.map +0 -1
  316. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +0 -6
  317. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +0 -1
  318. package/build-types/components/collab-sidebar/comment-menu-item.d.ts +0 -6
  319. package/build-types/components/collab-sidebar/comment-menu-item.d.ts.map +0 -1
  320. package/build-types/components/collab-sidebar/comments.d.ts +0 -10
  321. package/build-types/components/collab-sidebar/comments.d.ts.map +0 -1
  322. package/src/components/collab-sidebar/comments.js +0 -812
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/collab-sidebar/hooks.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tuseFloating,\n\toffset as offsetMiddleware,\n\tautoUpdate,\n} from '@floating-ui/react-dom';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseMemo,\n\tuseSyncExternalStore,\n} from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { FLOATING_NOTES_SIDEBAR } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { createBoardStore } from './board-store';\nimport { calculateAllOffsets } from './utils';\n\nconst { useBlockElement, cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nexport function useBlockComments( postId ) {\n\tconst queryArgs = {\n\t\tpost: postId,\n\t\ttype: 'note',\n\t\tstatus: 'all',\n\t\tper_page: -1,\n\t};\n\n\tconst { records: threads } = useEntityRecords(\n\t\t'root',\n\t\t'comment',\n\t\tqueryArgs,\n\t\t{ enabled: !! postId && typeof postId === 'number' }\n\t);\n\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\tconst { clientIds } = useSelect( ( select ) => {\n\t\tconst { getClientIdsWithDescendants } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientIds: getClientIdsWithDescendants(),\n\t\t};\n\t}, [] );\n\n\t// Process comments to build the tree structure.\n\tconst { resultComments, unresolvedSortedThreads } = useMemo( () => {\n\t\tif ( ! threads || threads.length === 0 ) {\n\t\t\treturn { resultComments: [], unresolvedSortedThreads: [] };\n\t\t}\n\n\t\tconst blocksWithComments = clientIds.reduce( ( results, clientId ) => {\n\t\t\tconst commentId = getBlockAttributes( clientId )?.metadata?.noteId;\n\t\t\tif ( commentId ) {\n\t\t\t\tresults[ clientId ] = commentId;\n\t\t\t}\n\t\t\treturn results;\n\t\t}, {} );\n\n\t\t// Create a compare to store the references to all objects by id.\n\t\tconst compare = {};\n\t\tconst result = [];\n\n\t\t// Create a reverse map for faster lookup.\n\t\tconst commentIdToBlockClientId = Object.keys(\n\t\t\tblocksWithComments\n\t\t).reduce( ( mapping, clientId ) => {\n\t\t\tmapping[ blocksWithComments[ clientId ] ] = clientId;\n\t\t\treturn mapping;\n\t\t}, {} );\n\n\t\t// Initialize each object with an empty `reply` array and map blockClientId.\n\t\tthreads.forEach( ( item ) => {\n\t\t\tconst itemBlock = commentIdToBlockClientId[ item.id ];\n\n\t\t\tcompare[ item.id ] = {\n\t\t\t\t...item,\n\t\t\t\treply: [],\n\t\t\t\tblockClientId: item.parent === 0 ? itemBlock : null,\n\t\t\t};\n\t\t} );\n\n\t\t// Iterate over the data to build the tree structure.\n\t\tthreads.forEach( ( item ) => {\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\t// If parent is 0, it's a root item, push it to the result array.\n\t\t\t\tresult.push( compare[ item.id ] );\n\t\t\t} else if ( compare[ item.parent ] ) {\n\t\t\t\t// Otherwise, find its parent and push it to the parent's `reply` array.\n\t\t\t\tcompare[ item.parent ].reply.push( compare[ item.id ] );\n\t\t\t}\n\t\t} );\n\n\t\tif ( 0 === result?.length ) {\n\t\t\treturn { resultComments: [], unresolvedSortedThreads: [] };\n\t\t}\n\n\t\tconst updatedResult = result.map( ( item ) => ( {\n\t\t\t...item,\n\t\t\treply: [ ...item.reply ].reverse(),\n\t\t} ) );\n\n\t\tconst threadIdMap = new Map(\n\t\t\tupdatedResult.map( ( thread ) => [ String( thread.id ), thread ] )\n\t\t);\n\n\t\t// Prepare sets to determine which threads are linked to existing blocks.\n\t\tconst mappedIds = new Set(\n\t\t\tObject.values( blocksWithComments ).map( ( id ) => String( id ) )\n\t\t);\n\n\t\t// Get comments by block order, first unresolved, then resolved.\n\t\tconst unresolvedSortedComments = Object.values( blocksWithComments )\n\t\t\t.map( ( commentId ) => threadIdMap.get( String( commentId ) ) )\n\t\t\t.filter(\n\t\t\t\t( thread ) => thread !== undefined && thread.status === 'hold'\n\t\t\t);\n\n\t\tconst resolvedSortedComments = Object.values( blocksWithComments )\n\t\t\t.map( ( commentId ) => threadIdMap.get( String( commentId ) ) )\n\t\t\t.filter(\n\t\t\t\t( thread ) =>\n\t\t\t\t\tthread !== undefined && thread.status === 'approved'\n\t\t\t);\n\n\t\t// Append orphaned notes (whose related block was deleted or missing).\n\t\tconst orphanedComments = updatedResult.filter(\n\t\t\t( thread ) => ! mappedIds.has( String( thread.id ) )\n\t\t);\n\n\t\tconst allSortedComments = [\n\t\t\t...unresolvedSortedComments,\n\t\t\t...resolvedSortedComments,\n\t\t\t...orphanedComments,\n\t\t];\n\n\t\treturn {\n\t\t\tresultComments: allSortedComments,\n\t\t\tunresolvedSortedThreads: unresolvedSortedComments,\n\t\t};\n\t}, [ clientIds, threads, getBlockAttributes ] );\n\n\treturn {\n\t\tresultComments,\n\t\tunresolvedSortedThreads,\n\t};\n}\n\nexport function useBlockCommentsActions() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onError = ( error ) => {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? decodeEntities( error.message )\n\t\t\t\t: __( 'An error occurred while performing an update.' );\n\t\tcreateNotice( 'error', errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t\tisDismissible: true,\n\t\t} );\n\t};\n\n\tconst onCreate = async ( { content, parent } ) => {\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tparent: parent || 0,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// If it's a main comment, update the block attributes with the comment id.\n\t\t\tif ( ! parent && savedRecord?.id ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: savedRecord.id,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparent ? __( 'Reply added.' ) : __( 'Note added.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn savedRecord;\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onEdit = async ( { id, content, status } ) => {\n\t\tconst messageType = status ? status : 'updated';\n\t\tconst messages = {\n\t\t\tapproved: __( 'Note marked as resolved.' ),\n\t\t\thold: __( 'Note reopened.' ),\n\t\t\tupdated: __( 'Note updated.' ),\n\t\t};\n\n\t\ttry {\n\t\t\t// For resolution or reopen actions, create a new note with metadata.\n\t\t\tif ( status === 'approved' || status === 'hold' ) {\n\t\t\t\t// First, update the thread status.\n\t\t\t\tawait saveEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'comment',\n\t\t\t\t\t{\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Then create a new comment with the metadata.\n\t\t\t\tconst newCommentData = {\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent: content || '', // Empty content for resolve, content for reopen.\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tstatus,\n\t\t\t\t\tparent: id,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\t_wp_note_status:\n\t\t\t\t\t\t\tstatus === 'approved' ? 'resolved' : 'reopen',\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', newCommentData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst updateData = {\n\t\t\t\t\tid,\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus,\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', updateData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tmessages[ messageType ] ?? __( 'Note updated.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onDelete = async ( comment ) => {\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\tcomment.id,\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( ! comment.parent ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice( 'snackbar', __( 'Note deleted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\treturn { onCreate, onEdit, onDelete };\n}\n\nexport function useEnableFloatingSidebar( enabled = false ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getActiveComplementaryArea } =\n\t\t\tregistry.select( interfaceStore );\n\t\tconst { disableComplementaryArea, enableComplementaryArea } =\n\t\t\tregistry.dispatch( interfaceStore );\n\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Return `null` to indicate the user hid the complementary area.\n\t\t\tif ( getActiveComplementaryArea( 'core' ) === null ) {\n\t\t\t\tenableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunsubscribe();\n\t\t\tif (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) === FLOATING_NOTES_SIDEBAR\n\t\t\t) {\n\t\t\t\tdisableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t};\n\t}, [ enabled, registry ] );\n}\n\nexport function useFloatingBoard( { threads, selectedNoteId, isFloating } ) {\n\tconst [ boardOffsets, setBoardOffsets ] = useState( {} );\n\tconst [ store ] = useState( createBoardStore );\n\tconst { setCanvasMinHeight } = unlock( useDispatch( editorStore ) );\n\n\tconst heights = useSyncExternalStore( store.subscribe, store.getSnapshot );\n\n\t// Recalc is deferred to a rAF; the cleanup cancels the pending frame\n\t// when deps change, so back-to-back updates collapse into one paint.\n\tuseEffect( () => {\n\t\tif ( ! isFloating ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rafId = window.requestAnimationFrame( () => {\n\t\t\tconst { offsets, minHeight } = calculateAllOffsets( {\n\t\t\t\tthreads,\n\t\t\t\tselectedNoteId,\n\t\t\t\tblockRects: store.getBlockRects(),\n\t\t\t\theights,\n\t\t\t} );\n\t\t\tsetBoardOffsets( offsets );\n\t\t\tsetCanvasMinHeight( minHeight );\n\t\t} );\n\n\t\treturn () => window.cancelAnimationFrame( rafId );\n\t}, [\n\t\theights,\n\t\tisFloating,\n\t\tselectedNoteId,\n\t\tsetCanvasMinHeight,\n\t\tstore,\n\t\tthreads,\n\t] );\n\n\treturn {\n\t\tboardOffsets,\n\t\tregisterThread: store.registerThread,\n\t\tunregisterThread: store.unregisterThread,\n\t};\n}\n\nexport function useFloatingThread( {\n\tthread,\n\tcalculatedOffset,\n\tregisterThread,\n\tunregisterThread,\n} ) {\n\tconst blockElement = useBlockElement( thread.blockClientId );\n\n\t// Use floating-ui to track the block element's position with the calculated offset.\n\tconst { y, refs } = useFloating( {\n\t\tplacement: 'right-start',\n\t\tmiddleware: [\n\t\t\toffsetMiddleware( {\n\t\t\t\tcrossAxis: calculatedOffset || -16,\n\t\t\t} ),\n\t\t],\n\t\twhileElementsMounted: autoUpdate,\n\t} );\n\n\t// Set the floating-ui reference element.\n\tuseEffect( () => {\n\t\tif ( blockElement ) {\n\t\t\trefs.setReference( blockElement );\n\t\t}\n\t}, [ blockElement, refs ] );\n\n\t// Register block + floating elements with the board.\n\t// The board's ResizeObserver tracks height changes automatically.\n\tuseEffect( () => {\n\t\tconst floatingEl = refs.floating?.current;\n\t\tif ( floatingEl && registerThread ) {\n\t\t\tregisterThread( thread.id, blockElement, floatingEl );\n\t\t}\n\t\treturn () => unregisterThread?.( thread.id );\n\t}, [\n\t\tblockElement,\n\t\tthread.id,\n\t\trefs.floating,\n\t\tregisterThread,\n\t\tunregisterThread,\n\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OAAO,aAAc;AAG3D,QAAM,EAAE,GAAG,KAAK,QAAI,8BAAa;AAAA,IAChC,WAAW;AAAA,IACX,YAAY;AAAA,UACX,iBAAAE,QAAkB;AAAA,QACjB,WAAW,oBAAoB;AAAA,MAChC,CAAE;AAAA,IACH;AAAA,IACA,sBAAsB;AAAA,EACvB,CAAE;AAGF,gCAAW,MAAM;AAChB,QAAK,cAAe;AACnB,WAAK,aAAc,YAAa;AAAA,IACjC;AAAA,EACD,GAAG,CAAE,cAAc,IAAK,CAAE;AAI1B,gCAAW,MAAM;AAChB,UAAM,aAAa,KAAK,UAAU;AAClC,QAAK,cAAc,gBAAiB;AACnC,qBAAgB,OAAO,IAAI,cAAc,UAAW;AAAA,IACrD;AACA,WAAO,MAAM,mBAAoB,OAAO,EAAG;AAAA,EAC5C,GAAG;AAAA,IACF;AAAA,IACA,OAAO;AAAA,IACP,KAAK;AAAA,IACL;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
- "names": ["blockEditorPrivateApis", "blockEditorStore", "noticesStore", "coreStore", "editorStore", "interfaceStore", "offsetMiddleware"]
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseMemo,\n\tuseSyncExternalStore,\n} from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { FLOATING_NOTES_SIDEBAR } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { createBoardStore } from './board-store';\nimport { calculateNotePositions } from './utils';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nexport function useNoteThreads( postId ) {\n\tconst queryArgs = {\n\t\tpost: postId,\n\t\ttype: 'note',\n\t\tstatus: 'all',\n\t\tper_page: -1,\n\t};\n\n\tconst { records: threads } = useEntityRecords(\n\t\t'root',\n\t\t'comment',\n\t\tqueryArgs,\n\t\t{ enabled: !! postId && typeof postId === 'number' }\n\t);\n\n\tconst { getBlockAttributes } = useSelect( blockEditorStore );\n\tconst { clientIds } = useSelect( ( select ) => {\n\t\tconst { getClientIdsWithDescendants } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientIds: getClientIdsWithDescendants(),\n\t\t};\n\t}, [] );\n\n\t// Process notes to build the tree structure.\n\tconst { notes, unresolvedNotes } = useMemo( () => {\n\t\tif ( ! threads || threads.length === 0 ) {\n\t\t\treturn { notes: [], unresolvedNotes: [] };\n\t\t}\n\n\t\t// Single pass over clientIds: build clientId->noteId map AND reverse lookup.\n\t\tconst blocksWithNotes = {};\n\t\tconst clientIdByNoteId = new Map();\n\t\tfor ( const clientId of clientIds ) {\n\t\t\tconst noteId = getBlockAttributes( clientId )?.metadata?.noteId;\n\t\t\tif ( noteId ) {\n\t\t\t\tconst key = String( noteId );\n\t\t\t\tblocksWithNotes[ clientId ] = key;\n\t\t\t\tclientIdByNoteId.set( key, clientId );\n\t\t\t}\n\t\t}\n\n\t\t// Materialize threads; collect roots; replies linked in a second pass\n\t\t// via unshift to invert order (matches prior reverse semantics).\n\t\tconst threadsById = new Map();\n\t\tconst rootThreads = [];\n\t\tfor ( const item of threads ) {\n\t\t\tconst thread = {\n\t\t\t\t...item,\n\t\t\t\treply: [],\n\t\t\t\tblockClientId:\n\t\t\t\t\titem.parent === 0\n\t\t\t\t\t\t? clientIdByNoteId.get( String( item.id ) ) ?? null\n\t\t\t\t\t\t: null,\n\t\t\t};\n\t\t\tthreadsById.set( item.id, thread );\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\trootThreads.push( thread );\n\t\t\t}\n\t\t}\n\t\tfor ( const item of threads ) {\n\t\t\tif ( item.parent !== 0 ) {\n\t\t\t\tthreadsById\n\t\t\t\t\t.get( item.parent )\n\t\t\t\t\t?.reply.unshift( threadsById.get( item.id ) );\n\t\t\t}\n\t\t}\n\n\t\tif ( rootThreads.length === 0 ) {\n\t\t\treturn { notes: [], unresolvedNotes: [] };\n\t\t}\n\n\t\t// Single partition over notes-in-block-order.\n\t\tconst unresolved = [];\n\t\tconst resolved = [];\n\t\tfor ( const noteId of Object.values( blocksWithNotes ) ) {\n\t\t\tconst thread =\n\t\t\t\tthreadsById.get( Number( noteId ) ) ??\n\t\t\t\tthreadsById.get( noteId );\n\t\t\tif ( ! thread ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif ( thread.status === 'hold' ) {\n\t\t\t\tunresolved.push( thread );\n\t\t\t} else if ( thread.status === 'approved' ) {\n\t\t\t\tresolved.push( thread );\n\t\t\t}\n\t\t}\n\n\t\t// Orphans: root threads without a linked block. They only need to come last.\n\t\tconst orphans = rootThreads.filter(\n\t\t\t( thread ) => ! thread.blockClientId\n\t\t);\n\n\t\treturn {\n\t\t\tnotes: [ ...unresolved, ...resolved, ...orphans ],\n\t\t\tunresolvedNotes: unresolved,\n\t\t};\n\t}, [ clientIds, threads, getBlockAttributes ] );\n\n\treturn {\n\t\tnotes,\n\t\tunresolvedNotes,\n\t};\n}\n\nexport function useNoteActions() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst { getBlockAttributes, getSelectedBlockClientId } =\n\t\tuseSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst onError = ( error ) => {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? decodeEntities( error.message )\n\t\t\t\t: __( 'An error occurred while performing an update.' );\n\t\tcreateNotice( 'error', errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t\tisDismissible: true,\n\t\t} );\n\t};\n\n\tconst onCreate = async ( { content, parent } ) => {\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'comment',\n\t\t\t\t{\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tparent: parent || 0,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// If it's a top-level note, update the block attributes with the note id.\n\t\t\tif ( ! parent && savedRecord?.id ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: savedRecord.id,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparent ? __( 'Reply added.' ) : __( 'Note added.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn savedRecord;\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onEdit = async ( { id, content, status } ) => {\n\t\tconst messageType = status ? status : 'updated';\n\t\tconst messages = {\n\t\t\tapproved: __( 'Note marked as resolved.' ),\n\t\t\thold: __( 'Note reopened.' ),\n\t\t\tupdated: __( 'Note updated.' ),\n\t\t};\n\n\t\ttry {\n\t\t\t// For resolution or reopen actions, create a new note with metadata.\n\t\t\tif ( status === 'approved' || status === 'hold' ) {\n\t\t\t\t// First, update the thread status.\n\t\t\t\tawait saveEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'comment',\n\t\t\t\t\t{\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tthrowOnError: true,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Then create a new note with the metadata.\n\t\t\t\tconst newNoteData = {\n\t\t\t\t\tpost: getCurrentPostId(),\n\t\t\t\t\tcontent: content || '', // Empty content for resolve, content for reopen.\n\t\t\t\t\ttype: 'note',\n\t\t\t\t\tstatus,\n\t\t\t\t\tparent: id,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\t_wp_note_status:\n\t\t\t\t\t\t\tstatus === 'approved' ? 'resolved' : 'reopen',\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', newNoteData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst updateData = {\n\t\t\t\t\tid,\n\t\t\t\t\tcontent,\n\t\t\t\t\tstatus,\n\t\t\t\t};\n\n\t\t\t\tawait saveEntityRecord( 'root', 'comment', updateData, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tmessages[ messageType ] ?? __( 'Note updated.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\tconst onDelete = async ( note ) => {\n\t\ttry {\n\t\t\tawait deleteEntityRecord( 'root', 'comment', note.id, undefined, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\n\t\t\tif ( ! note.parent ) {\n\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\tconst metadata = getBlockAttributes( clientId )?.metadata;\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...metadata,\n\t\t\t\t\t\tnoteId: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice( 'snackbar', __( 'Note deleted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tonError( error );\n\t\t}\n\t};\n\n\treturn { onCreate, onEdit, onDelete };\n}\n\nexport function useEnableFloatingSidebar( enabled = false ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getActiveComplementaryArea } =\n\t\t\tregistry.select( interfaceStore );\n\t\tconst { disableComplementaryArea, enableComplementaryArea } =\n\t\t\tregistry.dispatch( interfaceStore );\n\n\t\tconst unsubscribe = registry.subscribe( () => {\n\t\t\t// Return `null` to indicate the user hid the complementary area.\n\t\t\tif ( getActiveComplementaryArea( 'core' ) === null ) {\n\t\t\t\tenableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tunsubscribe();\n\t\t\tif (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) === FLOATING_NOTES_SIDEBAR\n\t\t\t) {\n\t\t\t\tdisableComplementaryArea( 'core', FLOATING_NOTES_SIDEBAR );\n\t\t\t}\n\t\t};\n\t}, [ enabled, registry ] );\n}\n\nexport function useFloatingBoard( {\n\tthreads,\n\tselectedNoteId,\n\tisFloating,\n\tsidebarRef,\n} ) {\n\tconst [ notePositions, setNotePositions ] = useState( {} );\n\tconst [ store ] = useState( createBoardStore );\n\n\tconst heights = useSyncExternalStore( store.subscribe, store.getSnapshot );\n\n\t// Notes are positioned in canvas content-space; CSS inherits\n\t// `--canvas-scroll` to translate each thread in sync with the canvas.\n\tuseEffect( () => {\n\t\tif ( ! isFloating || ! sidebarRef?.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst panel = sidebarRef.current;\n\t\tconst blockEl = store.getFirstBlockElement();\n\t\t// Climb to the block-list root so nested scroll containers\n\t\t// (e.g. a Group with overflow:auto) don't shadow the canvas.\n\t\tconst rootEl = blockEl?.closest( '.is-root-container' ) ?? blockEl;\n\t\tconst canvas = rootEl ? getScrollContainer( rootEl ) : null;\n\n\t\tconst applyScroll = () => {\n\t\t\tpanel.style.setProperty(\n\t\t\t\t'--canvas-scroll',\n\t\t\t\t`${ -( canvas?.scrollTop ?? 0 ) }px`\n\t\t\t);\n\t\t};\n\n\t\t// Recalc is deferred to a rAF; back-to-back updates collapse into one paint.\n\t\tconst rafId = window.requestAnimationFrame( () => {\n\t\t\tconst result = calculateNotePositions( {\n\t\t\t\tthreads,\n\t\t\t\tselectedNoteId,\n\t\t\t\tblockRects: store.getBlockRects(),\n\t\t\t\theights,\n\t\t\t\tscrollTop: canvas?.scrollTop ?? 0,\n\t\t\t} );\n\n\t\t\tsetNotePositions( result.positions );\n\t\t\tapplyScroll();\n\t\t} );\n\n\t\t// Root scrolling elements (documentElement/body) don't fire scroll\n\t\t// on themselves; capture on the window catches them in either canvas.\n\t\tconst view = canvas?.ownerDocument?.defaultView;\n\t\tconst listenerOptions = { passive: true, capture: true };\n\t\tview?.addEventListener( 'scroll', applyScroll, listenerOptions );\n\n\t\treturn () => {\n\t\t\twindow.cancelAnimationFrame( rafId );\n\t\t\tview?.removeEventListener( 'scroll', applyScroll, listenerOptions );\n\t\t};\n\t}, [ sidebarRef, heights, isFloating, selectedNoteId, store, threads ] );\n\n\treturn {\n\t\tnotePositions,\n\t\tregisterThread: store.registerThread,\n\t\tunregisterThread: store.unregisterThread,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,qBAKO;AACP,uBAAqD;AACr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,SAAS,aAAS,+BAAoB,MAAO,IAAI;AAEvD,UAAM,cAAc,MAAM;AACzB,YAAM,MAAM;AAAA,QACX;AAAA,QACA,GAAI,EAAG,QAAQ,aAAa,EAAI;AAAA,MACjC;AAAA,IACD;AAGA,UAAM,QAAQ,OAAO,sBAAuB,MAAM;AACjD,YAAM,aAAS,qCAAwB;AAAA,QACtC;AAAA,QACA;AAAA,QACA,YAAY,MAAM,cAAc;AAAA,QAChC;AAAA,QACA,WAAW,QAAQ,aAAa;AAAA,MACjC,CAAE;AAEF,uBAAkB,OAAO,SAAU;AACnC,kBAAY;AAAA,IACb,CAAE;AAIF,UAAM,OAAO,QAAQ,eAAe;AACpC,UAAM,kBAAkB,EAAE,SAAS,MAAM,SAAS,KAAK;AACvD,UAAM,iBAAkB,UAAU,aAAa,eAAgB;AAE/D,WAAO,MAAM;AACZ,aAAO,qBAAsB,KAAM;AACnC,YAAM,oBAAqB,UAAU,aAAa,eAAgB;AAAA,IACnE;AAAA,EACD,GAAG,CAAE,YAAY,SAAS,YAAY,gBAAgB,OAAO,OAAQ,CAAE;AAEvE,SAAO;AAAA,IACN;AAAA,IACA,gBAAgB,MAAM;AAAA,IACtB,kBAAkB,MAAM;AAAA,EACzB;AACD;",
6
+ "names": ["blockEditorPrivateApis", "blockEditorStore", "noticesStore", "coreStore", "editorStore", "interfaceStore"]
7
7
  }
@@ -35,7 +35,6 @@ __export(collab_sidebar_exports, {
35
35
  module.exports = __toCommonJS(collab_sidebar_exports);
36
36
  var import_i18n = require("@wordpress/i18n");
37
37
  var import_data = require("@wordpress/data");
38
- var import_components = require("@wordpress/components");
39
38
  var import_element = require("@wordpress/element");
40
39
  var import_compose = require("@wordpress/compose");
41
40
  var import_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
@@ -45,50 +44,15 @@ var import_interface = require("@wordpress/interface");
45
44
  var import_preferences = require("@wordpress/preferences");
46
45
  var import_plugin_sidebar = __toESM(require("../plugin-sidebar/index.cjs"));
47
46
  var import_constants = require("./constants.cjs");
48
- var import_comments = require("./comments.cjs");
47
+ var import_notes = require("./notes.cjs");
49
48
  var import_store = require("../../store/index.cjs");
50
- var import_comment_menu_item = __toESM(require("./comment-menu-item.cjs"));
51
- var import_comment_indicator_toolbar = __toESM(require("./comment-indicator-toolbar.cjs"));
49
+ var import_add_note_menu_item = require("./add-note-menu-item.cjs");
50
+ var import_note_indicator_toolbar = require("./note-indicator-toolbar.cjs");
52
51
  var import_global_styles_provider = require("../global-styles-provider/index.cjs");
53
52
  var import_hooks = require("./hooks.cjs");
54
53
  var import_post_type_support_check = __toESM(require("../post-type-support-check/index.cjs"));
55
54
  var import_lock_unlock = require("../../lock-unlock.cjs");
56
55
  var import_jsx_runtime = require("react/jsx-runtime");
57
- function NotesSidebarContent({
58
- styles,
59
- comments,
60
- commentSidebarRef,
61
- isFloating = false
62
- }) {
63
- const { onCreate, onEdit, onDelete } = (0, import_hooks.useBlockCommentsActions)();
64
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
- import_components.__experimentalVStack,
66
- {
67
- className: "editor-collab-sidebar-panel",
68
- style: styles,
69
- role: "tree",
70
- spacing: "3",
71
- justify: "flex-start",
72
- ref: (node) => {
73
- if (node) {
74
- commentSidebarRef.current = node;
75
- }
76
- },
77
- "aria-label": isFloating ? (0, import_i18n.__)("Unresolved notes") : (0, import_i18n.__)("All notes"),
78
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
- import_comments.Comments,
80
- {
81
- threads: comments,
82
- onEditComment: onEdit,
83
- onAddReply: onCreate,
84
- onCommentDelete: onDelete,
85
- commentSidebarRef,
86
- isFloating
87
- }
88
- )
89
- }
90
- );
91
- }
92
56
  function NotesSidebar({ postId }) {
93
57
  const { getActiveComplementaryArea } = (0, import_data.useSelect)(import_interface.store);
94
58
  const { enableComplementaryArea } = (0, import_data.useDispatch)(import_interface.store);
@@ -97,23 +61,16 @@ function NotesSidebar({ postId }) {
97
61
  );
98
62
  const { selectNote } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
99
63
  const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
100
- const commentSidebarRef = (0, import_element.useRef)(null);
101
- const { clientId, blockCommentId, isClassicBlock } = (0, import_data.useSelect)(
102
- (select) => {
103
- const {
104
- getBlockAttributes,
105
- getSelectedBlockClientId,
106
- getBlockName
107
- } = select(import_block_editor.store);
108
- const _clientId = getSelectedBlockClientId();
109
- return {
110
- clientId: _clientId,
111
- blockCommentId: _clientId ? getBlockAttributes(_clientId)?.metadata?.noteId : null,
112
- isClassicBlock: _clientId ? getBlockName(_clientId) === "core/freeform" : false
113
- };
114
- },
115
- []
116
- );
64
+ const sidebarRef = (0, import_element.useRef)(null);
65
+ const { clientId, noteId, isClassicBlock } = (0, import_data.useSelect)((select) => {
66
+ const { getBlockAttributes, getSelectedBlockClientId, getBlockName } = select(import_block_editor.store);
67
+ const _clientId = getSelectedBlockClientId();
68
+ return {
69
+ clientId: _clientId,
70
+ noteId: _clientId ? getBlockAttributes(_clientId)?.metadata?.noteId : null,
71
+ isClassicBlock: _clientId ? getBlockName(_clientId) === "core/freeform" : false
72
+ };
73
+ }, []);
117
74
  const { isDistractionFree } = (0, import_data.useSelect)((select) => {
118
75
  const { get } = select(import_preferences.store);
119
76
  return {
@@ -124,11 +81,11 @@ function NotesSidebar({ postId }) {
124
81
  (select) => (0, import_lock_unlock.unlock)(select(import_store.store)).getSelectedNote(),
125
82
  []
126
83
  );
127
- const { resultComments, unresolvedSortedThreads } = (0, import_hooks.useBlockComments)(postId);
84
+ const { notes, unresolvedNotes } = (0, import_hooks.useNoteThreads)(postId);
128
85
  const showFloatingSidebar = isLargeViewport;
129
- const showAllNotesSidebar = resultComments.length > 0 || !showFloatingSidebar;
86
+ const showAllNotesSidebar = notes.length > 0 || !showFloatingSidebar;
130
87
  (0, import_hooks.useEnableFloatingSidebar)(
131
- showFloatingSidebar && (unresolvedSortedThreads.length > 0 || selectedNote !== void 0)
88
+ showFloatingSidebar && (unresolvedNotes.length > 0 || selectedNote !== void 0)
132
89
  );
133
90
  (0, import_keyboard_shortcuts.useShortcut)(
134
91
  "core/editor/new-note",
@@ -139,17 +96,17 @@ function NotesSidebar({ postId }) {
139
96
  {
140
97
  // When multiple notes per block are supported. Remove note ID check.
141
98
  // See: https://github.com/WordPress/gutenberg/pull/75147.
142
- isDisabled: isDistractionFree || isClassicBlock || !clientId || !!blockCommentId
99
+ isDisabled: isDistractionFree || isClassicBlock || !clientId || !!noteId
143
100
  }
144
101
  );
145
102
  const { merged: GlobalStyles } = (0, import_global_styles_provider.useGlobalStylesContext)();
146
103
  const backgroundColor = GlobalStyles?.styles?.color?.background;
147
- const currentThread = blockCommentId ? resultComments.find((thread) => thread.id === blockCommentId) : null;
104
+ const currentThread = noteId ? notes.find((thread) => thread.id === noteId) : null;
148
105
  async function openTheSidebar(selectedClientId) {
149
106
  const prevArea = await getActiveComplementaryArea("core");
150
107
  const activeNotesArea = import_constants.SIDEBARS.find((name) => name === prevArea);
151
108
  const targetClientId = selectedClientId && selectedClientId !== clientId ? selectedClientId : clientId;
152
- const targetNote = resultComments.find(
109
+ const targetNote = notes.find(
153
110
  (note) => note.blockClientId === targetClientId
154
111
  );
155
112
  if (targetNote?.status === "approved") {
@@ -169,17 +126,17 @@ function NotesSidebar({ postId }) {
169
126
  selectNote(targetNote ? targetNote.id : "new", { focus: true });
170
127
  }
171
128
  if (isDistractionFree) {
172
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_menu_item.default, { isDistractionFree: true });
129
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_add_note_menu_item.AddNoteMenuItem, { isDistractionFree: true });
173
130
  }
174
131
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
175
132
  !!currentThread && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
- import_comment_indicator_toolbar.default,
133
+ import_note_indicator_toolbar.NoteAvatarIndicator,
177
134
  {
178
- thread: currentThread,
135
+ note: currentThread,
179
136
  onClick: openTheSidebar
180
137
  }
181
138
  ),
182
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_comment_menu_item.default, { onClick: openTheSidebar }),
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_add_note_menu_item.AddNoteMenuItem, { onClick: openTheSidebar }),
183
140
  showAllNotesSidebar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
184
141
  import_plugin_sidebar.default,
185
142
  {
@@ -189,13 +146,7 @@ function NotesSidebar({ postId }) {
189
146
  header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "interface-complementary-area-header__title", children: (0, import_i18n.__)("All notes") }),
190
147
  icon: import_icons.comment,
191
148
  closeLabel: (0, import_i18n.__)("Close Notes"),
192
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
193
- NotesSidebarContent,
194
- {
195
- comments: resultComments,
196
- commentSidebarRef
197
- }
198
- )
149
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_notes.Notes, { notes, sidebarRef })
199
150
  }
200
151
  ),
201
152
  isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -208,13 +159,11 @@ function NotesSidebar({ postId }) {
208
159
  headerClassName: "editor-collab-sidebar__header",
209
160
  backgroundColor,
210
161
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
211
- NotesSidebarContent,
162
+ import_notes.Notes,
212
163
  {
213
- comments: unresolvedSortedThreads,
214
- commentSidebarRef,
215
- styles: {
216
- backgroundColor
217
- },
164
+ notes: unresolvedNotes,
165
+ sidebarRef,
166
+ styles: { backgroundColor },
218
167
  isFloating: true
219
168
  }
220
169
  )
@@ -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\tisFloating = false,\n} ) {\n\tconst { onCreate, onEdit, onDelete } = useBlockCommentsActions();\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\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 { resultComments, unresolvedSortedThreads } =\n\t\tuseBlockComments( 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\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;AA6BpB;AA3BH,SAAS,oBAAqB;AAAA,EAC7B;A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,SAAR,wBAAyC;AAC/C,QAAM,EAAE,QAAQ,YAAY,cAAc,QAAI,uBAAW,CAAE,WAAY;AACtE,UAAM,EAAE,kBAAkB,eAAe,gBAAgB,QAAI;AAAA,MAC5D,OAAQ,aAAAJ,KAAY;AAAA,IACrB;AACA,WAAO;AAAA,MACN,QAAQ,iBAAiB;AAAA,MACzB,YAAY,cAAc;AAAA,MAC1B,eAAe,gBAAgB;AAAA,IAChC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAGA,MAAK,eAAe,UAAU,eAAgB;AAC7C,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,+BAAAM,SAAA,EAAqB,aAAY,gBACjC,sDAAC,gBAAa,QAAkB,GACjC;AAEF;",
6
- "names": ["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;AACvC,qBAAuB;AACvB,qBAAiC;AACjC,gCAA4B;AAC5B,mBAAuC;AACvC,0BAA0C;AAC1C,uBAAwC;AACxC,yBAA0C;AAK1C,4BAA0B;AAC1B,uBAIO;AACP,mBAAsB;AACtB,mBAAqC;AACrC,gCAAgC;AAChC,oCAAoC;AACpC,oCAAuC;AACvC,mBAAyD;AACzD,qCAAiC;AACjC,yBAAuB;AAyGd;AAvGT,SAAS,aAAc,EAAE,OAAO,GAAI;AACnC,QAAM,EAAE,2BAA2B,QAAI,uBAAW,iBAAAA,KAAe;AACjE,QAAM,EAAE,wBAAwB,QAAI,yBAAa,iBAAAA,KAAe;AAChE,QAAM,EAAE,sBAAsB,YAAY,QAAI;AAAA,QAC7C,yBAAa,oBAAAC,KAAiB;AAAA,EAC/B;AACA,QAAM,EAAE,WAAW,QAAI,+BAAQ,yBAAa,aAAAC,KAAY,CAAE;AAC1D,QAAM,sBAAkB,iCAAkB,QAAS;AACnD,QAAM,iBAAa,uBAAQ,IAAK;AAEhC,QAAM,EAAE,UAAU,QAAQ,eAAe,QAAI,uBAAW,CAAE,WAAY;AACrE,UAAM,EAAE,oBAAoB,0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OAAQ;AAAA,YACR;AAAA,YACA,QAAS,EAAE,gBAAgB;AAAA,YAC3B,YAAU;AAAA;AAAA,QACX;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;AAEe,SAAR,wBAAyC;AAC/C,QAAM,EAAE,QAAQ,YAAY,cAAc,QAAI,uBAAW,CAAE,WAAY;AACtE,UAAM,EAAE,kBAAkB,eAAe,gBAAgB,QAAI;AAAA,MAC5D,OAAQ,aAAAF,KAAY;AAAA,IACrB;AACA,WAAO;AAAA,MACN,QAAQ,iBAAiB;AAAA,MACzB,YAAY,cAAc;AAAA,MAC1B,eAAe,gBAAgB;AAAA,IAChC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAGA,MAAK,eAAe,UAAU,eAAgB;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,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AU,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,45 +27,41 @@ 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
- }) {
45
+ function NoteForm({ onSubmit, onCancel, note, labels }) {
51
46
  const [inputComment, setInputComment] = (0, import_element.useState)(
52
- thread?.content?.raw ?? ""
47
+ note?.content?.raw ?? ""
53
48
  );
54
- const inputId = (0, import_compose.useInstanceId)(CommentForm, "comment-input");
55
- 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;
56
51
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
57
- import_components.__experimentalVStack,
52
+ import_ui.Stack,
58
53
  {
59
- className: "editor-collab-sidebar-panel__comment-form",
60
- spacing: "4",
61
- 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", {}),
62
58
  onSubmit: (event) => {
63
59
  event.preventDefault();
64
60
  onSubmit(inputComment);
65
61
  setInputComment("");
66
62
  },
67
63
  children: [
68
- /* @__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") }),
69
65
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
66
  import_react_autosize_textarea.default,
71
67
  {
@@ -85,23 +81,36 @@ function CommentForm({
85
81
  }
86
82
  }
87
83
  ),
88
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: "2", justify: "flex-end", wrap: true, children: [
89
- /* @__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") }) }),
90
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
- import_components.Button,
92
- {
93
- size: "compact",
94
- accessibleWhenDisabled: true,
95
- variant: "primary",
96
- type: "submit",
97
- disabled: isDisabled,
98
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: submitButtonText })
99
- }
100
- )
101
- ] })
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
+ )
102
108
  ]
103
109
  }
104
110
  );
105
111
  }
106
- var comment_form_default = CommentForm;
107
- //# 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