@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
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/editor/src/components/collab-sidebar/note.js
31
+ var note_exports = {};
32
+ __export(note_exports, {
33
+ Note: () => Note
34
+ });
35
+ module.exports = __toCommonJS(note_exports);
36
+ var import_clsx = __toESM(require("clsx"));
37
+ var import_element = require("@wordpress/element");
38
+ var import_components = require("@wordpress/components");
39
+ var import_i18n = require("@wordpress/i18n");
40
+ var import_icons = require("@wordpress/icons");
41
+ var import_note_card = require("./note-card.cjs");
42
+ var import_note_form = require("./note-form.cjs");
43
+ var import_lock_unlock = require("../../lock-unlock.cjs");
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var { Menu } = (0, import_lock_unlock.unlock)(import_components.privateApis);
46
+ function NoteActionsMenu({ items, buttonRef }) {
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Menu, { placement: "bottom-end", children: [
48
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
+ Menu.TriggerButton,
50
+ {
51
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
+ import_components.Button,
53
+ {
54
+ ref: buttonRef,
55
+ size: "small",
56
+ icon: import_icons.moreVertical,
57
+ label: (0, import_i18n.__)("Actions"),
58
+ disabled: !items.length,
59
+ accessibleWhenDisabled: true
60
+ }
61
+ )
62
+ }
63
+ ),
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ Menu.Popover,
66
+ {
67
+ modal: false,
68
+ children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.Item, { onClick: item.onClick, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Menu.ItemLabel, { children: item.title }) }, item.id))
69
+ }
70
+ )
71
+ ] });
72
+ }
73
+ function Note({
74
+ note,
75
+ parentNote,
76
+ isSelected,
77
+ onEditNote,
78
+ onDeleteNote,
79
+ onResolve
80
+ }) {
81
+ const [actionState, setActionState] = (0, import_element.useState)(null);
82
+ const actionButtonRef = (0, import_element.useRef)(null);
83
+ const canResolve = note.parent === 0;
84
+ const isResolutionNote = note.type === "note" && note.meta && (note.meta._wp_note_status === "resolved" || note.meta._wp_note_status === "reopen");
85
+ const menuItems = [
86
+ {
87
+ id: "edit",
88
+ title: (0, import_i18n.__)("Edit"),
89
+ isEligible: ({ status }) => status !== "approved",
90
+ onClick: () => setActionState("edit")
91
+ },
92
+ {
93
+ id: "reopen",
94
+ title: (0, import_i18n._x)("Reopen", "Reopen note"),
95
+ isEligible: ({ status }) => status === "approved",
96
+ onClick: () => onEditNote({ id: note.id, status: "hold" })
97
+ },
98
+ {
99
+ id: "delete",
100
+ title: (0, import_i18n.__)("Delete"),
101
+ isEligible: () => true,
102
+ onClick: () => setActionState("delete")
103
+ }
104
+ ];
105
+ const availableItems = parentNote?.status !== "approved" ? menuItems.filter((item) => item.isEligible(note)) : [];
106
+ const deleteConfirmMessage = note.parent === 0 ? (0, import_i18n.__)(
107
+ "Are you sure you want to delete this note? This will also delete all of this note's replies."
108
+ ) : (0, import_i18n.__)("Are you sure you want to delete this reply?");
109
+ const handleCancel = () => {
110
+ setActionState(null);
111
+ actionButtonRef.current?.focus();
112
+ };
113
+ let body;
114
+ if (actionState === "edit") {
115
+ body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ import_note_form.NoteForm,
117
+ {
118
+ onSubmit: (value) => {
119
+ onEditNote({ id: note.id, content: value });
120
+ setActionState(null);
121
+ actionButtonRef.current?.focus();
122
+ },
123
+ onCancel: handleCancel,
124
+ note,
125
+ labels: {
126
+ submit: (0, import_i18n._x)("Update", "verb"),
127
+ input: (0, import_i18n.sprintf)(
128
+ // translators: %1$s: note identifier, %2$s: author name.
129
+ (0, import_i18n.__)("Edit note %1$s by %2$s"),
130
+ note.id,
131
+ note.author_name
132
+ )
133
+ }
134
+ }
135
+ );
136
+ } else if (isResolutionNote) {
137
+ const actionText = note.meta._wp_note_status === "resolved" ? (0, import_i18n.__)("Marked as resolved") : (0, import_i18n.__)("Reopened");
138
+ const raw = note?.content?.raw;
139
+ const text = raw && typeof raw === "string" && raw.trim() !== "" ? (0, import_i18n.sprintf)(
140
+ // translators: %1$s: action label ("Marked as resolved" or "Reopened"); %2$s: note text.
141
+ (0, import_i18n.__)("%1$s: %2$s"),
142
+ actionText,
143
+ raw
144
+ ) : actionText;
145
+ body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
146
+ import_element.RawHTML,
147
+ {
148
+ className: (0, import_clsx.default)(
149
+ "editor-collab-sidebar-panel__note-content",
150
+ "editor-collab-sidebar-panel__resolution-text"
151
+ ),
152
+ children: text
153
+ }
154
+ );
155
+ } else {
156
+ body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.RawHTML, { className: "editor-collab-sidebar-panel__note-content", children: note?.content?.rendered });
157
+ }
158
+ const actions = isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
159
+ canResolve && onResolve && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
160
+ import_components.Button,
161
+ {
162
+ label: (0, import_i18n._x)("Resolve", "Mark note as resolved"),
163
+ size: "small",
164
+ icon: import_icons.published,
165
+ disabled: note.status === "approved",
166
+ accessibleWhenDisabled: note.status === "approved",
167
+ onClick: onResolve
168
+ }
169
+ ),
170
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
171
+ NoteActionsMenu,
172
+ {
173
+ items: availableItems,
174
+ buttonRef: actionButtonRef
175
+ }
176
+ )
177
+ ] }) : null;
178
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
179
+ import_note_card.NoteCard,
180
+ {
181
+ note,
182
+ actions,
183
+ role: note.parent !== 0 ? "treeitem" : void 0,
184
+ children: [
185
+ body,
186
+ actionState === "delete" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
187
+ import_components.__experimentalConfirmDialog,
188
+ {
189
+ isOpen: true,
190
+ onConfirm: () => {
191
+ onDeleteNote(note);
192
+ setActionState(null);
193
+ },
194
+ onCancel: handleCancel,
195
+ confirmButtonText: (0, import_i18n.__)("Delete"),
196
+ children: deleteConfirmMessage
197
+ }
198
+ )
199
+ ]
200
+ }
201
+ );
202
+ }
203
+ // Annotate the CommonJS export names for ESM import in node:
204
+ 0 && (module.exports = {
205
+ Note
206
+ });
207
+ //# sourceMappingURL=note.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collab-sidebar/note.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { RawHTML, useRef, useState } from '@wordpress/element';\nimport {\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { moreVertical, published } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { NoteCard } from './note-card';\nimport { NoteForm } from './note-form';\nimport { unlock } from '../../lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nfunction NoteActionsMenu( { items, buttonRef } ) {\n\treturn (\n\t\t<Menu placement=\"bottom-end\">\n\t\t\t<Menu.TriggerButton\n\t\t\t\trender={\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\tdisabled={ ! items.length }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Menu.Popover\n\t\t\t\t// The menu popover is rendered in a portal, which causes focus to be\n\t\t\t\t// lost and the note to be collapsed unintentionally. To prevent this,\n\t\t\t\t// the popover should be rendered as an inline.\n\t\t\t\tmodal={ false }\n\t\t\t>\n\t\t\t\t{ items.map( ( item ) => (\n\t\t\t\t\t<Menu.Item key={ item.id } onClick={ item.onClick }>\n\t\t\t\t\t\t<Menu.ItemLabel>{ item.title }</Menu.ItemLabel>\n\t\t\t\t\t</Menu.Item>\n\t\t\t\t) ) }\n\t\t\t</Menu.Popover>\n\t\t</Menu>\n\t);\n}\n\nexport function Note( {\n\tnote,\n\tparentNote,\n\tisSelected,\n\tonEditNote,\n\tonDeleteNote,\n\tonResolve,\n} ) {\n\tconst [ actionState, setActionState ] = useState( null );\n\tconst actionButtonRef = useRef( null );\n\n\tconst canResolve = note.parent === 0;\n\tconst isResolutionNote =\n\t\tnote.type === 'note' &&\n\t\tnote.meta &&\n\t\t( note.meta._wp_note_status === 'resolved' ||\n\t\t\tnote.meta._wp_note_status === 'reopen' );\n\n\tconst menuItems = [\n\t\t{\n\t\t\tid: 'edit',\n\t\t\ttitle: __( 'Edit' ),\n\t\t\tisEligible: ( { status } ) => status !== 'approved',\n\t\t\tonClick: () => setActionState( 'edit' ),\n\t\t},\n\t\t{\n\t\t\tid: 'reopen',\n\t\t\ttitle: _x( 'Reopen', 'Reopen note' ),\n\t\t\tisEligible: ( { status } ) => status === 'approved',\n\t\t\tonClick: () => onEditNote( { id: note.id, status: 'hold' } ),\n\t\t},\n\t\t{\n\t\t\tid: 'delete',\n\t\t\ttitle: __( 'Delete' ),\n\t\t\tisEligible: () => true,\n\t\t\tonClick: () => setActionState( 'delete' ),\n\t\t},\n\t];\n\tconst availableItems =\n\t\tparentNote?.status !== 'approved'\n\t\t\t? menuItems.filter( ( item ) => item.isEligible( note ) )\n\t\t\t: [];\n\n\tconst deleteConfirmMessage =\n\t\tnote.parent === 0\n\t\t\t? __(\n\t\t\t\t\t\"Are you sure you want to delete this note? This will also delete all of this note's replies.\"\n\t\t\t )\n\t\t\t: __( 'Are you sure you want to delete this reply?' );\n\n\tconst handleCancel = () => {\n\t\tsetActionState( null );\n\t\tactionButtonRef.current?.focus();\n\t};\n\n\tlet body;\n\tif ( actionState === 'edit' ) {\n\t\tbody = (\n\t\t\t<NoteForm\n\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\tonEditNote( { id: note.id, content: value } );\n\t\t\t\t\tsetActionState( null );\n\t\t\t\t\tactionButtonRef.current?.focus();\n\t\t\t\t} }\n\t\t\t\tonCancel={ handleCancel }\n\t\t\t\tnote={ note }\n\t\t\t\tlabels={ {\n\t\t\t\t\tsubmit: _x( 'Update', 'verb' ),\n\t\t\t\t\tinput: sprintf(\n\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name.\n\t\t\t\t\t\t__( 'Edit note %1$s by %2$s' ),\n\t\t\t\t\t\tnote.id,\n\t\t\t\t\t\tnote.author_name\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else if ( isResolutionNote ) {\n\t\tconst actionText =\n\t\t\tnote.meta._wp_note_status === 'resolved'\n\t\t\t\t? __( 'Marked as resolved' )\n\t\t\t\t: __( 'Reopened' );\n\t\tconst raw = note?.content?.raw;\n\t\tconst text =\n\t\t\traw && typeof raw === 'string' && raw.trim() !== ''\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: action label (\"Marked as resolved\" or \"Reopened\"); %2$s: note text.\n\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\tactionText,\n\t\t\t\t\t\traw\n\t\t\t\t )\n\t\t\t\t: actionText;\n\t\tbody = (\n\t\t\t<RawHTML\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'editor-collab-sidebar-panel__note-content',\n\t\t\t\t\t'editor-collab-sidebar-panel__resolution-text'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ text }\n\t\t\t</RawHTML>\n\t\t);\n\t} else {\n\t\tbody = (\n\t\t\t<RawHTML className=\"editor-collab-sidebar-panel__note-content\">\n\t\t\t\t{ note?.content?.rendered }\n\t\t\t</RawHTML>\n\t\t);\n\t}\n\n\tconst actions = isSelected ? (\n\t\t<>\n\t\t\t{ canResolve && onResolve && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ _x( 'Resolve', 'Mark note as resolved' ) }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ published }\n\t\t\t\t\tdisabled={ note.status === 'approved' }\n\t\t\t\t\taccessibleWhenDisabled={ note.status === 'approved' }\n\t\t\t\t\tonClick={ onResolve }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<NoteActionsMenu\n\t\t\t\titems={ availableItems }\n\t\t\t\tbuttonRef={ actionButtonRef }\n\t\t\t/>\n\t\t</>\n\t) : null;\n\n\treturn (\n\t\t<NoteCard\n\t\t\tnote={ note }\n\t\t\tactions={ actions }\n\t\t\trole={ note.parent !== 0 ? 'treeitem' : undefined }\n\t\t>\n\t\t\t{ body }\n\t\t\t{ actionState === 'delete' && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen\n\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\tonDeleteNote( note );\n\t\t\t\t\t\tsetActionState( null );\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ handleCancel }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t>\n\t\t\t\t\t{ deleteConfirmMessage }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</NoteCard>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA0C;AAC1C,wBAIO;AACP,kBAAgC;AAChC,mBAAwC;AAKxC,uBAAyB;AACzB,uBAAyB;AACzB,yBAAuB;AAMrB;AAJF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,SAAS,gBAAiB,EAAE,OAAO,UAAU,GAAI;AAChD,SACC,6CAAC,QAAK,WAAU,cACf;AAAA;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QACA,QACC;AAAA,UAAC;AAAA;AAAA,YACA,KAAM;AAAA,YACN,MAAK;AAAA,YACL,MAAO;AAAA,YACP,WAAQ,gBAAI,SAAU;AAAA,YACtB,UAAW,CAAE,MAAM;AAAA,YACnB,wBAAsB;AAAA;AAAA,QACvB;AAAA;AAAA,IAEF;AAAA,IACA;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QAIA,OAAQ;AAAA,QAEN,gBAAM,IAAK,CAAE,SACd,4CAAC,KAAK,MAAL,EAA0B,SAAU,KAAK,SACzC,sDAAC,KAAK,WAAL,EAAiB,eAAK,OAAO,KADd,KAAK,EAEtB,CACC;AAAA;AAAA,IACH;AAAA,KACD;AAEF;AAEO,SAAS,KAAM;AA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A;AAAA,YACA,QAAM;AAAA,YACN,WAAY,MAAM;AACjB,2BAAc,IAAK;AACnB,6BAAgB,IAAK;AAAA,YACtB;AAAA,YACA,UAAW;AAAA,YACX,uBAAoB,gBAAI,QAAS;AAAA,YAE/B;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEF;AAEF;",
6
+ "names": ["componentsPrivateApis", "clsx", "ConfirmDialog"]
7
+ }
@@ -0,0 +1,237 @@
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/notes.js
21
+ var notes_exports = {};
22
+ __export(notes_exports, {
23
+ Notes: () => Notes
24
+ });
25
+ module.exports = __toCommonJS(notes_exports);
26
+ var import_element = require("@wordpress/element");
27
+ var import_i18n = require("@wordpress/i18n");
28
+ var import_data = require("@wordpress/data");
29
+ var import_ui = require("@wordpress/ui");
30
+ var import_block_editor = require("@wordpress/block-editor");
31
+ var import_lock_unlock = require("../../lock-unlock.cjs");
32
+ var import_note_thread = require("./note-thread.cjs");
33
+ var import_utils = require("./utils.cjs");
34
+ var import_hooks = require("./hooks.cjs");
35
+ var import_add_note = require("./add-note.cjs");
36
+ var import_store = require("../../store/index.cjs");
37
+ var import_jsx_runtime = require("react/jsx-runtime");
38
+ var { useBlockElement } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
39
+ function Notes({ notes, sidebarRef, isFloating = false, styles }) {
40
+ const {
41
+ onCreate: onAddReply,
42
+ onEdit: onEditNote,
43
+ onDelete
44
+ } = (0, import_hooks.useNoteActions)();
45
+ const { selectNote } = (0, import_lock_unlock.unlock)((0, import_data.useDispatch)(import_store.store));
46
+ const { selectBlock, toggleBlockSpotlight } = (0, import_lock_unlock.unlock)(
47
+ (0, import_data.useDispatch)(import_block_editor.store)
48
+ );
49
+ const { blockNoteId, selectedBlockClientId, orderedBlockIds } = (0, import_data.useSelect)(
50
+ (select) => {
51
+ const {
52
+ getBlockAttributes,
53
+ getSelectedBlockClientId,
54
+ getClientIdsWithDescendants
55
+ } = select(import_block_editor.store);
56
+ const clientId = getSelectedBlockClientId();
57
+ return {
58
+ blockNoteId: clientId ? getBlockAttributes(clientId)?.metadata?.noteId : null,
59
+ selectedBlockClientId: clientId,
60
+ orderedBlockIds: getClientIdsWithDescendants()
61
+ };
62
+ },
63
+ []
64
+ );
65
+ const { selectedNote, noteFocused } = (0, import_data.useSelect)((select) => {
66
+ const { getSelectedNote, isNoteFocused } = (0, import_lock_unlock.unlock)(
67
+ select(import_store.store)
68
+ );
69
+ return {
70
+ selectedNote: getSelectedNote(),
71
+ noteFocused: isNoteFocused()
72
+ };
73
+ }, []);
74
+ const relatedBlockElement = useBlockElement(selectedBlockClientId);
75
+ const threads = (0, import_element.useMemo)(() => {
76
+ if (!isFloating || selectedNote !== "new") {
77
+ return notes;
78
+ }
79
+ const newNoteThread = {
80
+ id: "new",
81
+ blockClientId: selectedBlockClientId,
82
+ content: { rendered: "" }
83
+ };
84
+ const out = [];
85
+ orderedBlockIds.forEach((blockId) => {
86
+ if (blockId === selectedBlockClientId) {
87
+ out.push(newNoteThread);
88
+ } else {
89
+ const threadForBlock = notes.find(
90
+ (t) => t.blockClientId === blockId
91
+ );
92
+ if (threadForBlock) {
93
+ out.push(threadForBlock);
94
+ }
95
+ }
96
+ });
97
+ return out;
98
+ }, [
99
+ notes,
100
+ isFloating,
101
+ selectedNote,
102
+ selectedBlockClientId,
103
+ orderedBlockIds
104
+ ]);
105
+ const handleDelete = async (note) => {
106
+ const currentIndex = threads.findIndex((t) => t.id === note.id);
107
+ const nextThread = threads[currentIndex + 1];
108
+ const prevThread = threads[currentIndex - 1];
109
+ await onDelete(note);
110
+ if (note.parent !== 0) {
111
+ selectNote(note.parent);
112
+ (0, import_utils.focusNoteThread)(note.parent, sidebarRef.current);
113
+ return;
114
+ }
115
+ if (nextThread) {
116
+ selectNote(nextThread.id);
117
+ (0, import_utils.focusNoteThread)(nextThread.id, sidebarRef.current);
118
+ } else if (prevThread) {
119
+ selectNote(prevThread.id);
120
+ (0, import_utils.focusNoteThread)(prevThread.id, sidebarRef.current);
121
+ } else {
122
+ selectNote(void 0);
123
+ toggleBlockSpotlight(note.blockClientId, false);
124
+ relatedBlockElement?.focus();
125
+ }
126
+ };
127
+ (0, import_element.useEffect)(() => {
128
+ selectNote(blockNoteId ?? void 0);
129
+ }, [blockNoteId, selectNote]);
130
+ (0, import_element.useEffect)(() => {
131
+ if (noteFocused && selectedNote) {
132
+ (0, import_utils.focusNoteThread)(
133
+ selectedNote,
134
+ sidebarRef.current,
135
+ selectedNote === "new" ? "textarea" : void 0
136
+ );
137
+ selectNote(selectedNote);
138
+ }
139
+ }, [noteFocused, selectedNote, selectNote, sidebarRef]);
140
+ const { notePositions, registerThread, unregisterThread } = (0, import_hooks.useFloatingBoard)({
141
+ threads,
142
+ selectedNoteId: selectedNote,
143
+ isFloating,
144
+ sidebarRef
145
+ });
146
+ const hasThreads = Array.isArray(threads) && threads.length > 0;
147
+ const navigate = (event, thread, isSelected) => {
148
+ if (event.defaultPrevented) {
149
+ return;
150
+ }
151
+ const currentIndex = threads.findIndex((t) => t.id === thread.id);
152
+ const isSelfTarget = event.currentTarget === event.target;
153
+ if ((event.key === "Enter" || event.key === "ArrowRight") && isSelfTarget && !isSelected) {
154
+ selectNote(thread.id);
155
+ if (!!thread.blockClientId) {
156
+ selectBlock(thread.blockClientId, null);
157
+ toggleBlockSpotlight(thread.blockClientId, true);
158
+ }
159
+ } else if ((event.key === "Enter" || event.key === "ArrowLeft") && isSelfTarget && isSelected || event.key === "Escape") {
160
+ selectNote(void 0);
161
+ if (thread.blockClientId) {
162
+ toggleBlockSpotlight(thread.blockClientId, false);
163
+ }
164
+ (0, import_utils.focusNoteThread)(thread.id, sidebarRef.current);
165
+ } else if (event.key === "ArrowDown" && currentIndex < threads.length - 1 && isSelfTarget) {
166
+ (0, import_utils.focusNoteThread)(
167
+ threads[currentIndex + 1].id,
168
+ sidebarRef.current
169
+ );
170
+ } else if (event.key === "ArrowUp" && currentIndex > 0 && isSelfTarget) {
171
+ (0, import_utils.focusNoteThread)(
172
+ threads[currentIndex - 1].id,
173
+ sidebarRef.current
174
+ );
175
+ } else if (event.key === "Home" && isSelfTarget) {
176
+ (0, import_utils.focusNoteThread)(threads[0].id, sidebarRef.current);
177
+ } else if (event.key === "End" && isSelfTarget) {
178
+ (0, import_utils.focusNoteThread)(
179
+ threads[threads.length - 1].id,
180
+ sidebarRef.current
181
+ );
182
+ }
183
+ };
184
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
185
+ import_ui.Stack,
186
+ {
187
+ className: "editor-collab-sidebar-panel",
188
+ style: styles,
189
+ role: "tree",
190
+ direction: "column",
191
+ gap: "md",
192
+ justify: "flex-start",
193
+ ref: (node) => {
194
+ if (node) {
195
+ sidebarRef.current = node;
196
+ }
197
+ },
198
+ "aria-label": isFloating ? (0, import_i18n.__)("Unresolved notes") : (0, import_i18n.__)("All notes"),
199
+ children: !hasThreads && !isFloating ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_add_note.AddNote, { onSubmit: onAddReply, sidebarRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
200
+ !isFloating && selectedNote === "new" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
201
+ import_add_note.AddNote,
202
+ {
203
+ onSubmit: onAddReply,
204
+ sidebarRef
205
+ }
206
+ ),
207
+ threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
208
+ import_note_thread.NoteThread,
209
+ {
210
+ note: thread,
211
+ onAddReply,
212
+ onDeleteNote: handleDelete,
213
+ onEditNote,
214
+ isSelected: selectedNote === thread.id,
215
+ sidebarRef,
216
+ floating: isFloating ? {
217
+ y: notePositions[thread.id],
218
+ registerThread,
219
+ unregisterThread
220
+ } : void 0,
221
+ onKeyDown: (event) => navigate(
222
+ event,
223
+ thread,
224
+ selectedNote === thread.id
225
+ )
226
+ },
227
+ thread.id
228
+ ))
229
+ ] })
230
+ }
231
+ );
232
+ }
233
+ // Annotate the CommonJS export names for ESM import in node:
234
+ 0 && (module.exports = {
235
+ Notes
236
+ });
237
+ //# sourceMappingURL=notes.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/collab-sidebar/notes.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Stack } from '@wordpress/ui';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { NoteThread } from './note-thread';\nimport { focusNoteThread } from './utils';\nimport { useFloatingBoard, useNoteActions } from './hooks';\nimport { AddNote } from './add-note';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function Notes( { notes, sidebarRef, isFloating = false, styles } ) {\n\tconst {\n\t\tonCreate: onAddReply,\n\t\tonEdit: onEditNote,\n\t\tonDelete,\n\t} = useNoteActions();\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst { selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst { blockNoteId, selectedBlockClientId, orderedBlockIds } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tblockNoteId: clientId\n\t\t\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t\t\t: null,\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t\torderedBlockIds: getClientIdsWithDescendants(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { selectedNote, noteFocused } = useSelect( ( select ) => {\n\t\tconst { getSelectedNote, isNoteFocused } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tselectedNote: getSelectedNote(),\n\t\t\tnoteFocused: isNoteFocused(),\n\t\t};\n\t}, [] );\n\n\tconst relatedBlockElement = useBlockElement( selectedBlockClientId );\n\n\tconst threads = useMemo( () => {\n\t\t// In floating mode with a pending new note, splice a placeholder\n\t\t// entry at the selected block's position so the board can float it\n\t\t// alongside regular threads.\n\t\tif ( ! isFloating || selectedNote !== 'new' ) {\n\t\t\treturn notes;\n\t\t}\n\t\tconst newNoteThread = {\n\t\t\tid: 'new',\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tcontent: { rendered: '' },\n\t\t};\n\t\tconst out = [];\n\t\torderedBlockIds.forEach( ( blockId ) => {\n\t\t\tif ( blockId === selectedBlockClientId ) {\n\t\t\t\tout.push( newNoteThread );\n\t\t\t} else {\n\t\t\t\tconst threadForBlock = notes.find(\n\t\t\t\t\t( t ) => t.blockClientId === blockId\n\t\t\t\t);\n\t\t\t\tif ( threadForBlock ) {\n\t\t\t\t\tout.push( threadForBlock );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t\treturn out;\n\t}, [\n\t\tnotes,\n\t\tisFloating,\n\t\tselectedNote,\n\t\tselectedBlockClientId,\n\t\torderedBlockIds,\n\t] );\n\n\tconst handleDelete = async ( note ) => {\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === note.id );\n\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\tconst prevThread = threads[ currentIndex - 1 ];\n\n\t\tawait onDelete( note );\n\n\t\tif ( note.parent !== 0 ) {\n\t\t\t// Move focus to the parent thread when a reply was deleted.\n\t\t\tselectNote( note.parent );\n\t\t\tfocusNoteThread( note.parent, sidebarRef.current );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nextThread ) {\n\t\t\tselectNote( nextThread.id );\n\t\t\tfocusNoteThread( nextThread.id, sidebarRef.current );\n\t\t} else if ( prevThread ) {\n\t\t\tselectNote( prevThread.id );\n\t\t\tfocusNoteThread( prevThread.id, sidebarRef.current );\n\t\t} else {\n\t\t\tselectNote( undefined );\n\t\t\ttoggleBlockSpotlight( note.blockClientId, false );\n\t\t\t// Move focus to the related block.\n\t\t\trelatedBlockElement?.focus();\n\t\t}\n\t};\n\n\t// Auto-select the related note thread when a block is selected.\n\tuseEffect( () => {\n\t\tselectNote( blockNoteId ?? undefined );\n\t}, [ blockNoteId, selectNote ] );\n\n\t// Focus the selected note when requested.\n\tuseEffect( () => {\n\t\tif ( noteFocused && selectedNote ) {\n\t\t\tfocusNoteThread(\n\t\t\t\tselectedNote,\n\t\t\t\tsidebarRef.current,\n\t\t\t\tselectedNote === 'new' ? 'textarea' : undefined\n\t\t\t);\n\t\t\t// Clear focus flag to avoid re-triggering.\n\t\t\tselectNote( selectedNote );\n\t\t}\n\t}, [ noteFocused, selectedNote, selectNote, sidebarRef ] );\n\n\tconst { notePositions, registerThread, unregisterThread } =\n\t\tuseFloatingBoard( {\n\t\t\tthreads,\n\t\t\tselectedNoteId: selectedNote,\n\t\t\tisFloating,\n\t\t\tsidebarRef,\n\t\t} );\n\n\tconst hasThreads = Array.isArray( threads ) && threads.length > 0;\n\n\tconst navigate = ( event, thread, isSelected ) => {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === thread.id );\n\t\tconst isSelfTarget = event.currentTarget === event.target;\n\n\t\tif (\n\t\t\t( event.key === 'Enter' || event.key === 'ArrowRight' ) &&\n\t\t\tisSelfTarget &&\n\t\t\t! isSelected\n\t\t) {\n\t\t\t// Expand thread.\n\t\t\tselectNote( thread.id );\n\t\t\tif ( !! thread.blockClientId ) {\n\t\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\t\tselectBlock( thread.blockClientId, null );\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\t\t}\n\t\t} else if (\n\t\t\t( ( event.key === 'Enter' || event.key === 'ArrowLeft' ) &&\n\t\t\t\tisSelfTarget &&\n\t\t\t\tisSelected ) ||\n\t\t\tevent.key === 'Escape'\n\t\t) {\n\t\t\t// Collapse thread.\n\t\t\tselectNote( undefined );\n\t\t\tif ( thread.blockClientId ) {\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t\t\t}\n\t\t\tfocusNoteThread( thread.id, sidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowDown' &&\n\t\t\tcurrentIndex < threads.length - 1 &&\n\t\t\tisSelfTarget\n\t\t) {\n\t\t\tfocusNoteThread(\n\t\t\t\tthreads[ currentIndex + 1 ].id,\n\t\t\t\tsidebarRef.current\n\t\t\t);\n\t\t} else if (\n\t\t\tevent.key === 'ArrowUp' &&\n\t\t\tcurrentIndex > 0 &&\n\t\t\tisSelfTarget\n\t\t) {\n\t\t\tfocusNoteThread(\n\t\t\t\tthreads[ currentIndex - 1 ].id,\n\t\t\t\tsidebarRef.current\n\t\t\t);\n\t\t} else if ( event.key === 'Home' && isSelfTarget ) {\n\t\t\tfocusNoteThread( threads[ 0 ].id, sidebarRef.current );\n\t\t} else if ( event.key === 'End' && isSelfTarget ) {\n\t\t\tfocusNoteThread(\n\t\t\t\tthreads[ threads.length - 1 ].id,\n\t\t\t\tsidebarRef.current\n\t\t\t);\n\t\t}\n\t};\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName=\"editor-collab-sidebar-panel\"\n\t\t\tstyle={ styles }\n\t\t\trole=\"tree\"\n\t\t\tdirection=\"column\"\n\t\t\tgap=\"md\"\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\tsidebarRef.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{ ! hasThreads && ! isFloating ? (\n\t\t\t\t<AddNote onSubmit={ onAddReply } sidebarRef={ sidebarRef } />\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{ ! isFloating && selectedNote === 'new' && (\n\t\t\t\t\t\t<AddNote\n\t\t\t\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\t\t\t\tsidebarRef={ sidebarRef }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ threads.map( ( thread ) => (\n\t\t\t\t\t\t<NoteThread\n\t\t\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\t\t\tnote={ thread }\n\t\t\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\t\t\tonDeleteNote={ handleDelete }\n\t\t\t\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\t\t\t\tisSelected={ selectedNote === thread.id }\n\t\t\t\t\t\t\tsidebarRef={ sidebarRef }\n\t\t\t\t\t\t\tfloating={\n\t\t\t\t\t\t\t\tisFloating\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\ty: notePositions[ thread.id ],\n\t\t\t\t\t\t\t\t\t\t\tregisterThread,\n\t\t\t\t\t\t\t\t\t\t\tunregisterThread,\n\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonKeyDown={ ( event ) =>\n\t\t\t\t\t\t\t\tnavigate(\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t\tthread,\n\t\t\t\t\t\t\t\t\tselectedNote === thread.id\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmC;AACnC,kBAAmB;AACnB,kBAAuC;AACvC,gBAAsB;AACtB,0BAGO;AAKP,yBAAuB;AACvB,yBAA2B;AAC3B,mBAAgC;AAChC,mBAAiD;AACjD,sBAAwB;AACxB,mBAAqC;AAuNjC;AArNJ,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,MAAO,EAAE,OAAO,YAAY,aAAa,OAAO,OAAO,GAAI;AAC1E,QAAM;AAAA,IACL,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,EACD,QAAI,6BAAe;AACnB,QAAM,EAAE,WAAW,QAAI,+BAAQ,yBAAa,aAAAC,KAAY,CAAE;AAC1D,QAAM,EAAE,aAAa,qBAAqB,QAAI;AAAA,QAC7C,yBAAa,oBAAAC,KAAiB;AAAA,EAC/B;AAEA,QAAM,EAAE,aAAa,uBAAuB,gBAAgB,QAAI;AAAA,IAC/D,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,oBAAAA,KAAiB;AAC7B,YAA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;AAAA,QAEC,QAAQ,IAAK,CAAE,WAChB;AAAA,UAAC;AAAA;AAAA,YAEA,MAAO;AAAA,YACP;AAAA,YACA,cAAe;AAAA,YACf;AAAA,YACA,YAAa,iBAAiB,OAAO;AAAA,YACrC;AAAA,YACA,UACC,aACG;AAAA,cACA,GAAG,cAAe,OAAO,EAAG;AAAA,cAC5B;AAAA,cACA;AAAA,YACA,IACA;AAAA,YAEJ,WAAY,CAAE,UACb;AAAA,cACC;AAAA,cACA;AAAA,cACA,iBAAiB,OAAO;AAAA,YACzB;AAAA;AAAA,UArBK,OAAO;AAAA,QAuBd,CACC;AAAA,SACH;AAAA;AAAA,EAEF;AAEF;",
6
+ "names": ["blockEditorPrivateApis", "editorStore", "blockEditorStore"]
7
+ }
@@ -20,21 +20,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // packages/editor/src/components/collab-sidebar/utils.js
21
21
  var utils_exports = {};
22
22
  __export(utils_exports, {
23
- calculateAllOffsets: () => calculateAllOffsets,
24
- focusCommentThread: () => focusCommentThread,
23
+ calculateNotePositions: () => calculateNotePositions,
24
+ focusNoteThread: () => focusNoteThread,
25
25
  getAvatarBorderColor: () => getAvatarBorderColor,
26
- getCommentExcerpt: () => getCommentExcerpt,
27
- sanitizeCommentString: () => sanitizeCommentString
26
+ getNoteExcerpt: () => getNoteExcerpt,
27
+ sanitizeNoteContent: () => sanitizeNoteContent
28
28
  });
29
29
  module.exports = __toCommonJS(utils_exports);
30
30
  var import_i18n = require("@wordpress/i18n");
31
- function sanitizeCommentString(str) {
31
+ function sanitizeNoteContent(str) {
32
32
  return str.trim();
33
33
  }
34
34
  var THREAD_ALIGN_OFFSET = -16;
35
35
  var THREAD_GAP = 16;
36
36
  var OVERLAP_MARGIN = 20;
37
- var BOARD_BOTTOM_PADDING = 32;
38
37
  var AVATAR_BORDER_COLORS = [
39
38
  "#C36EFF",
40
39
  // Purple
@@ -54,7 +53,7 @@ var AVATAR_BORDER_COLORS = [
54
53
  function getAvatarBorderColor(userId) {
55
54
  return AVATAR_BORDER_COLORS[userId % AVATAR_BORDER_COLORS.length];
56
55
  }
57
- function getCommentExcerpt(text, excerptLength = 10) {
56
+ function getNoteExcerpt(text, excerptLength = 10) {
58
57
  if (!text) {
59
58
  return "";
60
59
  }
@@ -73,11 +72,12 @@ function getCommentExcerpt(text, excerptLength = 10) {
73
72
  const isTrimmed = trimmedExcerpt !== rawText;
74
73
  return isTrimmed ? trimmedExcerpt + "\u2026" : trimmedExcerpt;
75
74
  }
76
- function calculateAllOffsets({
75
+ function calculateNotePositions({
77
76
  threads,
78
77
  selectedNoteId,
79
78
  blockRects,
80
- heights
79
+ heights,
80
+ scrollTop = 0
81
81
  }) {
82
82
  const offsets = {};
83
83
  const anchorIndex = Math.max(
@@ -86,7 +86,7 @@ function calculateAllOffsets({
86
86
  );
87
87
  const anchorThread = threads[anchorIndex];
88
88
  if (!anchorThread || !blockRects[anchorThread.id]) {
89
- return { offsets, minHeight: 0 };
89
+ return { positions: {} };
90
90
  }
91
91
  const anchorRect = blockRects[anchorThread.id];
92
92
  const anchorTop = anchorRect.top || 0;
@@ -128,22 +128,20 @@ function calculateAllOffsets({
128
128
  offsets[thread.id] = offset;
129
129
  belowAdjustedTop = threadTop + offset;
130
130
  }
131
- let editorMinHeight = 0;
132
- const lastThread = threads[threads.length - 1];
133
- const lastBlockRect = blockRects[lastThread.id];
134
- if (lastBlockRect) {
135
- const lastThreadTop = lastBlockRect.top || 0;
136
- const lastThreadHeight = heights[lastThread.id] || 0;
137
- const lastThreadOffset = offsets[lastThread.id] || 0;
138
- editorMinHeight = lastThreadTop + lastThreadHeight + lastThreadOffset + BOARD_BOTTOM_PADDING;
131
+ const positions = {};
132
+ for (const thread of threads) {
133
+ const blockRect = blockRects[thread.id];
134
+ if (blockRect && offsets[thread.id] !== void 0) {
135
+ positions[thread.id] = blockRect.top + scrollTop + offsets[thread.id];
136
+ }
139
137
  }
140
- return { offsets, minHeight: editorMinHeight };
138
+ return { positions };
141
139
  }
142
- function focusCommentThread(commentId, container, additionalSelector) {
140
+ function focusNoteThread(noteId, container, additionalSelector) {
143
141
  if (!container) {
144
142
  return;
145
143
  }
146
- const threadSelector = commentId && commentId !== "new" ? `[role=treeitem][id="comment-thread-${commentId}"]` : "[role=treeitem]:not([id])";
144
+ const threadSelector = noteId && noteId !== "new" ? `[role=treeitem][id="note-thread-${noteId}"]` : "[role=treeitem]:not([id])";
147
145
  const selector = additionalSelector ? `${threadSelector} ${additionalSelector}` : threadSelector;
148
146
  return new Promise((resolve) => {
149
147
  if (container.querySelector(selector)) {
@@ -169,10 +167,10 @@ function focusCommentThread(commentId, container, additionalSelector) {
169
167
  }
170
168
  // Annotate the CommonJS export names for ESM import in node:
171
169
  0 && (module.exports = {
172
- calculateAllOffsets,
173
- focusCommentThread,
170
+ calculateNotePositions,
171
+ focusNoteThread,
174
172
  getAvatarBorderColor,
175
- getCommentExcerpt,
176
- sanitizeCommentString
173
+ getNoteExcerpt,
174
+ sanitizeNoteContent
177
175
  });
178
176
  //# sourceMappingURL=utils.cjs.map