@wordpress/editor 14.45.0 → 14.45.2-next.v.202605131032.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 (623) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +12 -0
  3. package/build/components/collab-sidebar/index.cjs +42 -25
  4. package/build/components/collab-sidebar/index.cjs.map +2 -2
  5. package/build/components/collab-sidebar/note-thread.cjs +19 -9
  6. package/build/components/collab-sidebar/note-thread.cjs.map +2 -2
  7. package/build/components/collab-sidebar/notes.cjs +8 -6
  8. package/build/components/collab-sidebar/notes.cjs.map +2 -2
  9. package/build/components/collab-sidebar/utils.cjs +24 -9
  10. package/build/components/collab-sidebar/utils.cjs.map +2 -2
  11. package/build/components/collaborators-presence/index.cjs +0 -10
  12. package/build/components/collaborators-presence/index.cjs.map +3 -3
  13. package/build/components/collaborators-presence/list.cjs +0 -10
  14. package/build/components/collaborators-presence/list.cjs.map +3 -3
  15. package/build/components/post-last-revision/index.cjs +5 -0
  16. package/build/components/post-last-revision/index.cjs.map +2 -2
  17. package/build/components/post-publish-panel/index.cjs +112 -124
  18. package/build/components/post-publish-panel/index.cjs.map +3 -3
  19. package/build/components/post-revisions-preview/block-diff.cjs +91 -23
  20. package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
  21. package/build/components/post-revisions-preview/diff-markers.cjs +3 -2
  22. package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
  23. package/build/components/post-revisions-preview/revisions-slider.cjs +98 -50
  24. package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
  25. package/build/store/private-actions.cjs +21 -0
  26. package/build/store/private-actions.cjs.map +2 -2
  27. package/build/store/private-selectors.cjs +93 -42
  28. package/build/store/private-selectors.cjs.map +2 -2
  29. package/build/store/reducer.cjs +15 -0
  30. package/build/store/reducer.cjs.map +2 -2
  31. package/build/store/selectors.cjs.map +2 -2
  32. package/build-module/components/collab-sidebar/index.mjs +42 -25
  33. package/build-module/components/collab-sidebar/index.mjs.map +2 -2
  34. package/build-module/components/collab-sidebar/note-thread.mjs +24 -10
  35. package/build-module/components/collab-sidebar/note-thread.mjs.map +2 -2
  36. package/build-module/components/collab-sidebar/notes.mjs +8 -6
  37. package/build-module/components/collab-sidebar/notes.mjs.map +2 -2
  38. package/build-module/components/collab-sidebar/utils.mjs +22 -8
  39. package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
  40. package/build-module/components/collaborators-presence/index.mjs +0 -10
  41. package/build-module/components/collaborators-presence/index.mjs.map +3 -3
  42. package/build-module/components/collaborators-presence/list.mjs +0 -10
  43. package/build-module/components/collaborators-presence/list.mjs.map +3 -3
  44. package/build-module/components/post-last-revision/index.mjs +5 -0
  45. package/build-module/components/post-last-revision/index.mjs.map +2 -2
  46. package/build-module/components/post-publish-panel/index.mjs +120 -129
  47. package/build-module/components/post-publish-panel/index.mjs.map +2 -2
  48. package/build-module/components/post-revisions-preview/block-diff.mjs +91 -23
  49. package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
  50. package/build-module/components/post-revisions-preview/diff-markers.mjs +3 -2
  51. package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
  52. package/build-module/components/post-revisions-preview/revisions-slider.mjs +101 -53
  53. package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
  54. package/build-module/store/private-actions.mjs +20 -0
  55. package/build-module/store/private-actions.mjs.map +2 -2
  56. package/build-module/store/private-selectors.mjs +95 -43
  57. package/build-module/store/private-selectors.mjs.map +2 -2
  58. package/build-module/store/reducer.mjs +14 -0
  59. package/build-module/store/reducer.mjs.map +2 -2
  60. package/build-module/store/selectors.mjs.map +2 -2
  61. package/build-style/style-rtl.css +398 -33
  62. package/build-style/style.css +398 -33
  63. package/build-types/bindings/api.d.ts +1 -1
  64. package/build-types/bindings/api.d.ts.map +1 -1
  65. package/build-types/bindings/pattern-overrides.d.ts +8 -5
  66. package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
  67. package/build-types/bindings/post-data.d.ts +8 -5
  68. package/build-types/bindings/post-data.d.ts.map +1 -1
  69. package/build-types/bindings/post-meta.d.ts +10 -7
  70. package/build-types/bindings/post-meta.d.ts.map +1 -1
  71. package/build-types/bindings/term-data.d.ts +9 -6
  72. package/build-types/bindings/term-data.d.ts.map +1 -1
  73. package/build-types/components/autocompleters/index.d.ts +2 -2
  74. package/build-types/components/autocompleters/index.d.ts.map +1 -1
  75. package/build-types/components/autocompleters/link.d.ts +6 -10
  76. package/build-types/components/autocompleters/link.d.ts.map +1 -1
  77. package/build-types/components/autocompleters/user.d.ts +7 -12
  78. package/build-types/components/autocompleters/user.d.ts.map +1 -1
  79. package/build-types/components/autosave-monitor/index.d.ts +28 -4
  80. package/build-types/components/autosave-monitor/index.d.ts.map +1 -1
  81. package/build-types/components/block-removal-warnings/index.d.ts +3 -0
  82. package/build-types/components/block-removal-warnings/index.d.ts.map +1 -1
  83. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts +7 -7
  84. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -1
  85. package/build-types/components/block-visibility/index.d.ts.map +1 -1
  86. package/build-types/components/blog-title/index.d.ts.map +1 -1
  87. package/build-types/components/character-count/index.d.ts.map +1 -1
  88. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +2 -2
  89. package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -1
  90. package/build-types/components/collab-sidebar/add-note.d.ts +2 -2
  91. package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -1
  92. package/build-types/components/collab-sidebar/board-store.d.ts +1 -1
  93. package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -1
  94. package/build-types/components/collab-sidebar/constants.d.ts +3 -3
  95. package/build-types/components/collab-sidebar/constants.d.ts.map +1 -1
  96. package/build-types/components/collab-sidebar/floating-container.d.ts +3 -3
  97. package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -1
  98. package/build-types/components/collab-sidebar/hooks.d.ts +7 -7
  99. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  100. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  101. package/build-types/components/collab-sidebar/note-byline.d.ts +2 -2
  102. package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
  103. package/build-types/components/collab-sidebar/note-card.d.ts +3 -3
  104. package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -1
  105. package/build-types/components/collab-sidebar/note-form.d.ts +4 -4
  106. package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -1
  107. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +2 -2
  108. package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -1
  109. package/build-types/components/collab-sidebar/note-thread.d.ts +5 -5
  110. package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -1
  111. package/build-types/components/collab-sidebar/note.d.ts +4 -4
  112. package/build-types/components/collab-sidebar/note.d.ts.map +1 -1
  113. package/build-types/components/collab-sidebar/notes.d.ts +2 -2
  114. package/build-types/components/collab-sidebar/notes.d.ts.map +1 -1
  115. package/build-types/components/collab-sidebar/utils.d.ts +17 -24
  116. package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
  117. package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts.map +1 -1
  118. package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -1
  119. package/build-types/components/collaborators-overlay/index.d.ts +4 -1
  120. package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
  121. package/build-types/components/collaborators-overlay/overlay.d.ts +1 -1
  122. package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
  123. package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
  124. package/build-types/components/collaborators-presence/avatar-group/component.d.ts.map +1 -1
  125. package/build-types/components/collaborators-presence/index.d.ts +1 -2
  126. package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
  127. package/build-types/components/collaborators-presence/list.d.ts +1 -2
  128. package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
  129. package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -1
  130. package/build-types/components/commands/index.d.ts.map +1 -1
  131. package/build-types/components/deprecated.d.ts +82 -53
  132. package/build-types/components/deprecated.d.ts.map +1 -1
  133. package/build-types/components/document-bar/index.d.ts +3 -3
  134. package/build-types/components/document-bar/index.d.ts.map +1 -1
  135. package/build-types/components/document-bar/useEditedSectionDetails.d.ts.map +1 -1
  136. package/build-types/components/document-outline/check.d.ts +2 -2
  137. package/build-types/components/document-outline/check.d.ts.map +1 -1
  138. package/build-types/components/document-outline/index.d.ts +2 -2
  139. package/build-types/components/document-outline/index.d.ts.map +1 -1
  140. package/build-types/components/document-outline/item.d.ts +5 -5
  141. package/build-types/components/document-outline/item.d.ts.map +1 -1
  142. package/build-types/components/document-tools/index.d.ts +1 -1
  143. package/build-types/components/document-tools/index.d.ts.map +1 -1
  144. package/build-types/components/editor/index.d.ts +7 -7
  145. package/build-types/components/editor/index.d.ts.map +1 -1
  146. package/build-types/components/editor-history/redo.d.ts +11 -2
  147. package/build-types/components/editor-history/redo.d.ts.map +1 -1
  148. package/build-types/components/editor-history/undo.d.ts +11 -2
  149. package/build-types/components/editor-history/undo.d.ts.map +1 -1
  150. package/build-types/components/editor-interface/index.d.ts +5 -5
  151. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  152. package/build-types/components/editor-notices/index.d.ts +1 -1
  153. package/build-types/components/editor-notices/index.d.ts.map +1 -1
  154. package/build-types/components/editor-snackbars/index.d.ts.map +1 -1
  155. package/build-types/components/entities-saved-states/entity-record-item.d.ts +1 -1
  156. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
  157. package/build-types/components/entities-saved-states/entity-type-list.d.ts +2 -2
  158. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  159. package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts +10 -1
  160. package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -1
  161. package/build-types/components/entities-saved-states/index.d.ts +4 -4
  162. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  163. package/build-types/components/error-boundary/index.d.ts +18 -8
  164. package/build-types/components/error-boundary/index.d.ts.map +1 -1
  165. package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -1
  166. package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts +1 -1
  167. package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts.map +1 -1
  168. package/build-types/components/global-styles/block-link.d.ts +1 -1
  169. package/build-types/components/global-styles/block-link.d.ts.map +1 -1
  170. package/build-types/components/global-styles/header.d.ts +2 -2
  171. package/build-types/components/global-styles/header.d.ts.map +1 -1
  172. package/build-types/components/global-styles/hooks.d.ts +3 -3
  173. package/build-types/components/global-styles/hooks.d.ts.map +1 -1
  174. package/build-types/components/global-styles/index.d.ts +3 -3
  175. package/build-types/components/global-styles/index.d.ts.map +1 -1
  176. package/build-types/components/global-styles/menu.d.ts +2 -2
  177. package/build-types/components/global-styles/menu.d.ts.map +1 -1
  178. package/build-types/components/global-styles-provider/index.d.ts +1 -1
  179. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  180. package/build-types/components/global-styles-renderer/index.d.ts +1 -1
  181. package/build-types/components/global-styles-renderer/index.d.ts.map +1 -1
  182. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +6 -6
  183. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -1
  184. package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -1
  185. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +1 -1
  186. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -1
  187. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -1
  188. package/build-types/components/header/back-button.d.ts +3 -3
  189. package/build-types/components/header/back-button.d.ts.map +1 -1
  190. package/build-types/components/header/header-skeleton.d.ts +5 -5
  191. package/build-types/components/header/header-skeleton.d.ts.map +1 -1
  192. package/build-types/components/header/index.d.ts +2 -2
  193. package/build-types/components/header/index.d.ts.map +1 -1
  194. package/build-types/components/index.d.ts +94 -91
  195. package/build-types/components/index.d.ts.map +1 -1
  196. package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
  197. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +3 -3
  198. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -1
  199. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +1 -1
  200. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -1
  201. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +1 -1
  202. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -1
  203. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +3 -3
  204. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -1
  205. package/build-types/components/list-view-sidebar/index.d.ts.map +1 -1
  206. package/build-types/components/list-view-sidebar/list-view-outline.d.ts.map +1 -1
  207. package/build-types/components/local-autosave-monitor/index.d.ts +12 -0
  208. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  209. package/build-types/components/media/index.d.ts +2 -2
  210. package/build-types/components/media/index.d.ts.map +1 -1
  211. package/build-types/components/media/media-editor-modal.d.ts.map +1 -1
  212. package/build-types/components/media/metadata-panel.d.ts.map +1 -1
  213. package/build-types/components/media/preview.d.ts.map +1 -1
  214. package/build-types/components/media-categories/index.d.ts +11 -4
  215. package/build-types/components/media-categories/index.d.ts.map +1 -1
  216. package/build-types/components/mode-switcher/index.d.ts +1 -1
  217. package/build-types/components/mode-switcher/index.d.ts.map +1 -1
  218. package/build-types/components/more-menu/copy-content-menu-item.d.ts.map +1 -1
  219. package/build-types/components/more-menu/index.d.ts.map +1 -1
  220. package/build-types/components/more-menu/tools-more-menu-group.d.ts +2 -2
  221. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  222. package/build-types/components/more-menu/view-more-menu-group.d.ts +2 -2
  223. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  224. package/build-types/components/page-attributes/check.d.ts +3 -3
  225. package/build-types/components/page-attributes/check.d.ts.map +1 -1
  226. package/build-types/components/page-attributes/order.d.ts +1 -1
  227. package/build-types/components/page-attributes/order.d.ts.map +1 -1
  228. package/build-types/components/page-attributes/panel.d.ts +1 -1
  229. package/build-types/components/page-attributes/panel.d.ts.map +1 -1
  230. package/build-types/components/page-attributes/parent.d.ts +3 -3
  231. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  232. package/build-types/components/pattern-duplicate-modal/index.d.ts +1 -1
  233. package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -1
  234. package/build-types/components/pattern-overrides-panel/index.d.ts.map +1 -1
  235. package/build-types/components/pattern-rename-modal/index.d.ts +1 -1
  236. package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -1
  237. package/build-types/components/plugin-document-setting-panel/index.d.ts +8 -61
  238. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  239. package/build-types/components/plugin-more-menu-item/index.d.ts +5 -5
  240. package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
  241. package/build-types/components/plugin-post-publish-panel/index.d.ts +9 -40
  242. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  243. package/build-types/components/plugin-post-status-info/index.d.ts +6 -47
  244. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  245. package/build-types/components/plugin-pre-publish-panel/index.d.ts +9 -43
  246. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  247. package/build-types/components/plugin-preview-menu-item/index.d.ts +5 -5
  248. package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
  249. package/build-types/components/plugin-sidebar/index.d.ts +4 -4
  250. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  251. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts +3 -3
  252. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -1
  253. package/build-types/components/post-actions/actions.d.ts +3 -3
  254. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  255. package/build-types/components/post-actions/index.d.ts +4 -4
  256. package/build-types/components/post-actions/index.d.ts.map +1 -1
  257. package/build-types/components/post-actions/set-as-homepage.d.ts +2 -2
  258. package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
  259. package/build-types/components/post-actions/set-as-posts-page.d.ts +2 -2
  260. package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -1
  261. package/build-types/components/post-author/check.d.ts +2 -2
  262. package/build-types/components/post-author/check.d.ts.map +1 -1
  263. package/build-types/components/post-author/combobox.d.ts.map +1 -1
  264. package/build-types/components/post-author/constants.d.ts +10 -8
  265. package/build-types/components/post-author/constants.d.ts.map +1 -1
  266. package/build-types/components/post-author/hook.d.ts +1 -1
  267. package/build-types/components/post-author/hook.d.ts.map +1 -1
  268. package/build-types/components/post-author/index.d.ts +2 -2
  269. package/build-types/components/post-author/index.d.ts.map +1 -1
  270. package/build-types/components/post-author/panel.d.ts +1 -1
  271. package/build-types/components/post-author/panel.d.ts.map +1 -1
  272. package/build-types/components/post-author/select.d.ts.map +1 -1
  273. package/build-types/components/post-card-panel/index.d.ts +7 -7
  274. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  275. package/build-types/components/post-comments/index.d.ts +6 -1
  276. package/build-types/components/post-comments/index.d.ts.map +1 -1
  277. package/build-types/components/post-content-information/index.d.ts +1 -1
  278. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  279. package/build-types/components/post-discussion/panel.d.ts +1 -1
  280. package/build-types/components/post-discussion/panel.d.ts.map +1 -1
  281. package/build-types/components/post-excerpt/check.d.ts +3 -3
  282. package/build-types/components/post-excerpt/check.d.ts.map +1 -1
  283. package/build-types/components/post-excerpt/index.d.ts +3 -3
  284. package/build-types/components/post-excerpt/index.d.ts.map +1 -1
  285. package/build-types/components/post-excerpt/panel.d.ts +2 -2
  286. package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
  287. package/build-types/components/post-excerpt/plugin.d.ts +6 -43
  288. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  289. package/build-types/components/post-featured-image/check.d.ts +3 -3
  290. package/build-types/components/post-featured-image/check.d.ts.map +1 -1
  291. package/build-types/components/post-featured-image/index.d.ts +15 -0
  292. package/build-types/components/post-featured-image/index.d.ts.map +1 -1
  293. package/build-types/components/post-featured-image/panel.d.ts +1 -1
  294. package/build-types/components/post-featured-image/panel.d.ts.map +1 -1
  295. package/build-types/components/post-fields/index.d.ts +1 -1
  296. package/build-types/components/post-fields/index.d.ts.map +1 -1
  297. package/build-types/components/post-format/check.d.ts +2 -2
  298. package/build-types/components/post-format/check.d.ts.map +1 -1
  299. package/build-types/components/post-format/index.d.ts +12 -12
  300. package/build-types/components/post-format/index.d.ts.map +1 -1
  301. package/build-types/components/post-format/panel.d.ts +2 -2
  302. package/build-types/components/post-format/panel.d.ts.map +1 -1
  303. package/build-types/components/post-last-edited-panel/index.d.ts.map +1 -1
  304. package/build-types/components/post-last-revision/check.d.ts +3 -3
  305. package/build-types/components/post-last-revision/check.d.ts.map +1 -1
  306. package/build-types/components/post-last-revision/index.d.ts +3 -3
  307. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  308. package/build-types/components/post-last-revision/panel.d.ts +2 -2
  309. package/build-types/components/post-last-revision/panel.d.ts.map +1 -1
  310. package/build-types/components/post-locked-modal/index.d.ts +11 -5
  311. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  312. package/build-types/components/post-panel-row/index.d.ts +1 -1
  313. package/build-types/components/post-panel-row/index.d.ts.map +1 -1
  314. package/build-types/components/post-panel-section/index.d.ts +2 -2
  315. package/build-types/components/post-panel-section/index.d.ts.map +1 -1
  316. package/build-types/components/post-pending-status/check.d.ts +3 -3
  317. package/build-types/components/post-pending-status/check.d.ts.map +1 -1
  318. package/build-types/components/post-pending-status/index.d.ts +1 -1
  319. package/build-types/components/post-pending-status/index.d.ts.map +1 -1
  320. package/build-types/components/post-pingbacks/index.d.ts +7 -1
  321. package/build-types/components/post-pingbacks/index.d.ts.map +1 -1
  322. package/build-types/components/post-preview-button/index.d.ts +2 -2
  323. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  324. package/build-types/components/post-publish-button/index.d.ts +5 -5
  325. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  326. package/build-types/components/post-publish-button/label.d.ts.map +1 -1
  327. package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts +1 -1
  328. package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts.map +1 -1
  329. package/build-types/components/post-publish-panel/index.d.ts +17 -13
  330. package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
  331. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts +1 -1
  332. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  333. package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
  334. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts +1 -1
  335. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
  336. package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
  337. package/build-types/components/post-publish-panel/media-util.d.ts +2 -2
  338. package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -1
  339. package/build-types/components/post-publish-panel/postpublish.d.ts +2 -2
  340. package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -1
  341. package/build-types/components/post-publish-panel/prepublish.d.ts +1 -1
  342. package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -1
  343. package/build-types/components/post-revisions-panel/index.d.ts.map +1 -1
  344. package/build-types/components/post-revisions-preview/block-diff.d.ts +1 -1
  345. package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
  346. package/build-types/components/post-revisions-preview/diff-format-types.d.ts +2 -2
  347. package/build-types/components/post-revisions-preview/diff-format-types.d.ts.map +1 -1
  348. package/build-types/components/post-revisions-preview/diff-markers.d.ts +1 -1
  349. package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
  350. package/build-types/components/post-revisions-preview/index.d.ts +2 -2
  351. package/build-types/components/post-revisions-preview/index.d.ts.map +1 -1
  352. package/build-types/components/post-revisions-preview/preserve-client-ids.d.ts +1 -1
  353. package/build-types/components/post-revisions-preview/preserve-client-ids.d.ts.map +1 -1
  354. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +1 -1
  355. package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
  356. package/build-types/components/post-revisions-preview/revisions-header.d.ts +2 -2
  357. package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -1
  358. package/build-types/components/post-revisions-preview/revisions-slider.d.ts +3 -3
  359. package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
  360. package/build-types/components/post-saved-state/index.d.ts +1 -1
  361. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  362. package/build-types/components/post-schedule/check.d.ts +2 -2
  363. package/build-types/components/post-schedule/check.d.ts.map +1 -1
  364. package/build-types/components/post-schedule/index.d.ts +3 -3
  365. package/build-types/components/post-schedule/index.d.ts.map +1 -1
  366. package/build-types/components/post-schedule/label.d.ts +4 -4
  367. package/build-types/components/post-schedule/label.d.ts.map +1 -1
  368. package/build-types/components/post-schedule/panel.d.ts +1 -1
  369. package/build-types/components/post-schedule/panel.d.ts.map +1 -1
  370. package/build-types/components/post-status/index.d.ts +2 -2
  371. package/build-types/components/post-status/index.d.ts.map +1 -1
  372. package/build-types/components/post-sticky/check.d.ts +2 -2
  373. package/build-types/components/post-sticky/check.d.ts.map +1 -1
  374. package/build-types/components/post-sticky/index.d.ts +1 -1
  375. package/build-types/components/post-sticky/index.d.ts.map +1 -1
  376. package/build-types/components/post-sticky/panel.d.ts +1 -1
  377. package/build-types/components/post-sticky/panel.d.ts.map +1 -1
  378. package/build-types/components/post-switch-to-draft-button/index.d.ts +1 -1
  379. package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -1
  380. package/build-types/components/post-sync-status/index.d.ts +1 -1
  381. package/build-types/components/post-sync-status/index.d.ts.map +1 -1
  382. package/build-types/components/post-taxonomies/check.d.ts +2 -2
  383. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  384. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +4 -4
  385. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  386. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +6 -6
  387. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  388. package/build-types/components/post-taxonomies/index.d.ts +9 -1
  389. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  390. package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
  391. package/build-types/components/post-taxonomies/panel.d.ts +1 -1
  392. package/build-types/components/post-taxonomies/panel.d.ts.map +1 -1
  393. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  394. package/build-types/components/post-template/classic-theme.d.ts +8 -1
  395. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  396. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  397. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  398. package/build-types/components/post-template/hooks.d.ts +5 -5
  399. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  400. package/build-types/components/post-template/panel.d.ts +1 -1
  401. package/build-types/components/post-template/panel.d.ts.map +1 -1
  402. package/build-types/components/post-template/reset-default-template.d.ts.map +1 -1
  403. package/build-types/components/post-template/swap-template-button.d.ts +1 -1
  404. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
  405. package/build-types/components/post-text-editor/index.d.ts +1 -1
  406. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  407. package/build-types/components/post-title/constants.d.ts +2 -2
  408. package/build-types/components/post-title/constants.d.ts.map +1 -1
  409. package/build-types/components/post-title/index.d.ts +9 -1
  410. package/build-types/components/post-title/index.d.ts.map +1 -1
  411. package/build-types/components/post-title/post-title-raw.d.ts +1 -1
  412. package/build-types/components/post-title/use-post-title-focus.d.ts.map +1 -1
  413. package/build-types/components/post-title/use-post-title.d.ts.map +1 -1
  414. package/build-types/components/post-transform-panel/hooks.d.ts +1 -1
  415. package/build-types/components/post-transform-panel/hooks.d.ts.map +1 -1
  416. package/build-types/components/post-transform-panel/index.d.ts.map +1 -1
  417. package/build-types/components/post-trash/check.d.ts +2 -2
  418. package/build-types/components/post-trash/check.d.ts.map +1 -1
  419. package/build-types/components/post-trash/index.d.ts +1 -1
  420. package/build-types/components/post-trash/index.d.ts.map +1 -1
  421. package/build-types/components/post-type-support-check/index.d.ts +3 -3
  422. package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
  423. package/build-types/components/post-url/check.d.ts +2 -2
  424. package/build-types/components/post-url/check.d.ts.map +1 -1
  425. package/build-types/components/post-url/index.d.ts +1 -1
  426. package/build-types/components/post-url/index.d.ts.map +1 -1
  427. package/build-types/components/post-url/label.d.ts +2 -2
  428. package/build-types/components/post-url/label.d.ts.map +1 -1
  429. package/build-types/components/post-url/panel.d.ts +1 -1
  430. package/build-types/components/post-url/panel.d.ts.map +1 -1
  431. package/build-types/components/post-view-link/index.d.ts.map +1 -1
  432. package/build-types/components/post-visibility/check.d.ts +1 -1
  433. package/build-types/components/post-visibility/check.d.ts.map +1 -1
  434. package/build-types/components/post-visibility/index.d.ts +1 -1
  435. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  436. package/build-types/components/post-visibility/label.d.ts +1 -1
  437. package/build-types/components/post-visibility/label.d.ts.map +1 -1
  438. package/build-types/components/post-visibility/utils.d.ts +1 -1
  439. package/build-types/components/post-visibility/utils.d.ts.map +1 -1
  440. package/build-types/components/posts-per-page/index.d.ts.map +1 -1
  441. package/build-types/components/preferences-modal/enable-panel.d.ts.map +1 -1
  442. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts +4 -5
  443. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  444. package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts.map +1 -1
  445. package/build-types/components/preferences-modal/index.d.ts +3 -0
  446. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  447. package/build-types/components/preview-dropdown/index.d.ts +1 -1
  448. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  449. package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
  450. package/build-types/components/provider/index.d.ts +33 -33
  451. package/build-types/components/provider/index.d.ts.map +1 -1
  452. package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -1
  453. package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts +1 -1
  454. package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts.map +1 -1
  455. package/build-types/components/provider/use-block-editor-settings.d.ts +1 -1
  456. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  457. package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts +1 -1
  458. package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts.map +1 -1
  459. package/build-types/components/provider/use-post-content-block-types.d.ts.map +1 -1
  460. package/build-types/components/provider/use-revision-blocks.d.ts +1 -1
  461. package/build-types/components/provider/use-revision-blocks.d.ts.map +1 -1
  462. package/build-types/components/provider/use-upload-save-lock.d.ts.map +1 -1
  463. package/build-types/components/provider/with-registry-provider.d.ts +1 -1
  464. package/build-types/components/provider/with-registry-provider.d.ts.map +1 -1
  465. package/build-types/components/resizable-editor/index.d.ts +2 -2
  466. package/build-types/components/resizable-editor/index.d.ts.map +1 -1
  467. package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
  468. package/build-types/components/revision-author-panel/index.d.ts.map +1 -1
  469. package/build-types/components/revision-block-diff/index.d.ts.map +1 -1
  470. package/build-types/components/revision-created-panel/index.d.ts.map +1 -1
  471. package/build-types/components/revision-diff-panel/index.d.ts.map +1 -1
  472. package/build-types/components/revision-fields-diff/index.d.ts.map +1 -1
  473. package/build-types/components/save-publish-panels/index.d.ts +7 -7
  474. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  475. package/build-types/components/sidebar/constants.d.ts +4 -4
  476. package/build-types/components/sidebar/constants.d.ts.map +1 -1
  477. package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
  478. package/build-types/components/sidebar/header.d.ts +1 -1
  479. package/build-types/components/sidebar/index.d.ts +3 -3
  480. package/build-types/components/sidebar/index.d.ts.map +1 -1
  481. package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -1
  482. package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
  483. package/build-types/components/site-discussion/index.d.ts.map +1 -1
  484. package/build-types/components/start-page-options/index.d.ts +1 -1
  485. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  486. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  487. package/build-types/components/style-book/categories.d.ts +3 -0
  488. package/build-types/components/style-book/categories.d.ts.map +1 -1
  489. package/build-types/components/style-book/color-examples.d.ts.map +1 -1
  490. package/build-types/components/style-book/duotone-examples.d.ts.map +1 -1
  491. package/build-types/components/style-book/index.d.ts +19 -8
  492. package/build-types/components/style-book/index.d.ts.map +1 -1
  493. package/build-types/components/styles-canvas/index.d.ts +2 -2
  494. package/build-types/components/styles-canvas/index.d.ts.map +1 -1
  495. package/build-types/components/styles-canvas/revisions.d.ts +1 -1
  496. package/build-types/components/styles-canvas/style-book.d.ts +1 -1
  497. package/build-types/components/table-of-contents/index.d.ts +11 -1
  498. package/build-types/components/table-of-contents/index.d.ts.map +1 -1
  499. package/build-types/components/table-of-contents/panel.d.ts +1 -1
  500. package/build-types/components/table-of-contents/panel.d.ts.map +1 -1
  501. package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
  502. package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -1
  503. package/build-types/components/template-actions-panel/index.d.ts.map +1 -1
  504. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  505. package/build-types/components/template-part-content-panel/index.d.ts.map +1 -1
  506. package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
  507. package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts +1 -1
  508. package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts.map +1 -1
  509. package/build-types/components/template-part-menu-items/index.d.ts.map +1 -1
  510. package/build-types/components/template-validation-notice/index.d.ts.map +1 -1
  511. package/build-types/components/text-editor/index.d.ts.map +1 -1
  512. package/build-types/components/theme-support-check/index.d.ts +2 -2
  513. package/build-types/components/theme-support-check/index.d.ts.map +1 -1
  514. package/build-types/components/time-to-read/index.d.ts +1 -1
  515. package/build-types/components/time-to-read/index.d.ts.map +1 -1
  516. package/build-types/components/unsaved-changes-warning/index.d.ts +1 -1
  517. package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -1
  518. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +1 -1
  519. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  520. package/build-types/components/visual-editor/index.d.ts +4 -4
  521. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  522. package/build-types/components/visual-editor/use-edit-content-only-section-exit.d.ts +1 -1
  523. package/build-types/components/visual-editor/use-edit-content-only-section-exit.d.ts.map +1 -1
  524. package/build-types/components/visual-editor/use-padding-appender.d.ts +1 -1
  525. package/build-types/components/visual-editor/use-padding-appender.d.ts.map +1 -1
  526. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts +1 -1
  527. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts.map +1 -1
  528. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +1 -1
  529. package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -1
  530. package/build-types/components/word-count/index.d.ts +1 -1
  531. package/build-types/components/word-count/index.d.ts.map +1 -1
  532. package/build-types/components/zoom-out-toggle/index.d.ts +3 -3
  533. package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
  534. package/build-types/dataviews/api.d.ts +6 -6
  535. package/build-types/dataviews/api.d.ts.map +1 -1
  536. package/build-types/dataviews/fields/content-preview/index.d.ts.map +1 -1
  537. package/build-types/dataviews/store/private-actions.d.ts +5 -5
  538. package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
  539. package/build-types/dataviews/store/reducer.d.ts +2 -2
  540. package/build-types/dataviews/store/reducer.d.ts.map +1 -1
  541. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +3 -9
  542. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
  543. package/build-types/hooks/index.d.ts +10 -1
  544. package/build-types/hooks/index.d.ts.map +1 -1
  545. package/build-types/hooks/pattern-overrides.d.ts +1 -1
  546. package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
  547. package/build-types/hooks/use-global-styles-output.d.ts +2 -2
  548. package/build-types/hooks/use-global-styles-output.d.ts.map +1 -1
  549. package/build-types/index.d.ts +10 -5
  550. package/build-types/index.d.ts.map +1 -1
  551. package/build-types/lock-unlock.d.ts +1 -2
  552. package/build-types/lock-unlock.d.ts.map +1 -1
  553. package/build-types/private-apis.d.ts +1 -1
  554. package/build-types/private-apis.d.ts.map +1 -1
  555. package/build-types/store/actions.d.ts +330 -116
  556. package/build-types/store/actions.d.ts.map +1 -1
  557. package/build-types/store/constants.d.ts.map +1 -1
  558. package/build-types/store/defaults.d.ts +1 -1
  559. package/build-types/store/defaults.d.ts.map +1 -1
  560. package/build-types/store/index.d.ts +77 -9
  561. package/build-types/store/index.d.ts.map +1 -1
  562. package/build-types/store/local-autosave.d.ts +3 -3
  563. package/build-types/store/local-autosave.d.ts.map +1 -1
  564. package/build-types/store/private-actions.d.ts +106 -46
  565. package/build-types/store/private-actions.d.ts.map +1 -1
  566. package/build-types/store/private-selectors.d.ts +96 -68
  567. package/build-types/store/private-selectors.d.ts.map +1 -1
  568. package/build-types/store/reducer.d.ts +47 -52
  569. package/build-types/store/reducer.d.ts.map +1 -1
  570. package/build-types/store/selectors.d.ts +422 -429
  571. package/build-types/store/selectors.d.ts.map +1 -1
  572. package/build-types/store/utils/is-template-revertable.d.ts.map +1 -1
  573. package/build-types/store/utils/notice-builder.d.ts +3 -3
  574. package/build-types/store/utils/notice-builder.d.ts.map +1 -1
  575. package/build-types/utils/get-item-title.d.ts +1 -1
  576. package/build-types/utils/get-item-title.d.ts.map +1 -1
  577. package/build-types/utils/get-template-info.d.ts +11 -4
  578. package/build-types/utils/get-template-info.d.ts.map +1 -1
  579. package/build-types/utils/get-template-part-icon.d.ts +1 -1
  580. package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
  581. package/build-types/utils/index.d.ts +6 -3
  582. package/build-types/utils/index.d.ts.map +1 -1
  583. package/build-types/utils/media-finalize/index.d.ts.map +1 -1
  584. package/build-types/utils/media-sideload/index.d.ts +1 -1
  585. package/build-types/utils/media-sideload/index.d.ts.map +1 -1
  586. package/build-types/utils/media-upload/index.d.ts +1 -1
  587. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  588. package/build-types/utils/media-upload/on-success.d.ts.map +1 -1
  589. package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
  590. package/build-types/utils/search-templates.d.ts +1 -1
  591. package/build-types/utils/search-templates.d.ts.map +1 -1
  592. package/build-types/utils/set-nested-value.d.ts.map +1 -1
  593. package/build-types/utils/terms.d.ts +19 -4
  594. package/build-types/utils/terms.d.ts.map +1 -1
  595. package/build-types/utils/url.d.ts +1 -1
  596. package/build-types/utils/url.d.ts.map +1 -1
  597. package/package.json +48 -48
  598. package/src/components/block-visibility/style.scss +2 -2
  599. package/src/components/collab-sidebar/index.js +48 -36
  600. package/src/components/collab-sidebar/note-thread.js +28 -10
  601. package/src/components/collab-sidebar/notes.js +9 -6
  602. package/src/components/collab-sidebar/style.scss +4 -0
  603. package/src/components/collab-sidebar/utils.js +41 -14
  604. package/src/components/collaborators-presence/index.tsx +0 -2
  605. package/src/components/collaborators-presence/list.tsx +0 -2
  606. package/src/components/post-last-revision/index.js +5 -0
  607. package/src/components/post-publish-panel/index.js +149 -156
  608. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -26
  609. package/src/components/post-publish-panel/test/index.js +41 -23
  610. package/src/components/post-revisions-preview/block-diff.js +165 -41
  611. package/src/components/post-revisions-preview/diff-markers.js +12 -9
  612. package/src/components/post-revisions-preview/revisions-slider.js +130 -71
  613. package/src/components/post-revisions-preview/style.scss +3 -3
  614. package/src/components/post-revisions-preview/test/block-diff.js +133 -4
  615. package/src/components/post-template/style.scss +1 -1
  616. package/src/components/start-page-options/style.scss +2 -2
  617. package/src/components/start-template-options/style.scss +2 -2
  618. package/src/store/private-actions.js +34 -0
  619. package/src/store/private-selectors.js +127 -51
  620. package/src/store/reducer.js +21 -0
  621. package/src/store/selectors.js +6 -0
  622. package/src/store/test/private-selectors.js +107 -1
  623. package/src/style.scss +2 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 14.45.1-next.0 (2026-05-13)
6
+
7
+ ### Internal
8
+
9
+ - Update `date-fns` dependency to `v4.1.0` ([#78057](https://github.com/WordPress/gutenberg/pull/78057)).
10
+
5
11
  ## 14.45.0 (2026-04-29)
6
12
 
7
13
  ## 14.44.0 (2026-04-15)
package/README.md CHANGED
@@ -1250,6 +1250,18 @@ _Returns_
1250
1250
 
1251
1251
  Renders a panel for publishing a post.
1252
1252
 
1253
+ _Parameters_
1254
+
1255
+ - _props_ `Object`: Component props.
1256
+ - _props.forceIsDirty_ `[boolean]`: Whether to force the dirty state.
1257
+ - _props.onClose_ `()=>void`: Called when the panel requests to close.
1258
+ - _props.PostPublishExtension_ `[React.ComponentType]`: Component rendered after publishing.
1259
+ - _props.PrePublishExtension_ `[React.ComponentType]`: Component rendered before publishing.
1260
+
1261
+ _Returns_
1262
+
1263
+ - `React.JSX.Element`: The post publish panel.
1264
+
1253
1265
  ### PostSavedState
1254
1266
 
1255
1267
  Component showing whether the post is saved or not and providing save buttons.
@@ -87,31 +87,18 @@ function NotesSidebar({ postId }) {
87
87
  (0, import_hooks.useEnableFloatingSidebar)(
88
88
  showFloatingSidebar && (unresolvedNotes.length > 0 || selectedNote !== void 0)
89
89
  );
90
- (0, import_keyboard_shortcuts.useShortcut)(
91
- "core/editor/new-note",
92
- (event) => {
93
- event.preventDefault();
94
- openTheSidebar();
95
- },
96
- {
97
- // When multiple notes per block are supported. Remove note ID check.
98
- // See: https://github.com/WordPress/gutenberg/pull/75147.
99
- isDisabled: isDistractionFree || isClassicBlock || !clientId || !!noteId
90
+ async function focusNote({
91
+ targetClientId,
92
+ noteId: targetNoteId,
93
+ isApproved
94
+ }) {
95
+ if (!targetClientId) {
96
+ return;
100
97
  }
101
- );
102
- const { merged: GlobalStyles } = (0, import_global_styles_provider.useGlobalStylesContext)();
103
- const backgroundColor = GlobalStyles?.styles?.color?.background;
104
- const currentThread = noteId ? notes.find((thread) => thread.id === noteId) : null;
105
- async function openTheSidebar(selectedClientId) {
106
98
  const prevArea = await getActiveComplementaryArea("core");
107
- const activeNotesArea = import_constants.SIDEBARS.find((name) => name === prevArea);
108
- const targetClientId = selectedClientId && selectedClientId !== clientId ? selectedClientId : clientId;
109
- const targetNote = notes.find(
110
- (note) => note.blockClientId === targetClientId
111
- );
112
- if (targetNote?.status === "approved") {
99
+ if (isApproved) {
113
100
  enableComplementaryArea("core", import_constants.ALL_NOTES_SIDEBAR);
114
- } else if (!activeNotesArea || !showAllNotesSidebar) {
101
+ } else if (!import_constants.SIDEBARS.includes(prevArea) || !showAllNotesSidebar) {
115
102
  enableComplementaryArea(
116
103
  "core",
117
104
  showFloatingSidebar ? import_constants.FLOATING_NOTES_SIDEBAR : import_constants.ALL_NOTES_SIDEBAR
@@ -123,8 +110,33 @@ function NotesSidebar({ postId }) {
123
110
  }
124
111
  selectBlock(targetClientId, null);
125
112
  toggleBlockSpotlight(targetClientId, true);
126
- selectNote(targetNote ? targetNote.id : "new", { focus: true });
113
+ selectNote(targetNoteId, { focus: true });
114
+ }
115
+ function openNoteForBlock(targetClientId) {
116
+ const target = notes.find(
117
+ (note) => note.blockClientId === targetClientId
118
+ );
119
+ return focusNote({
120
+ targetClientId,
121
+ noteId: target?.id ?? "new",
122
+ isApproved: target?.status === "approved"
123
+ });
127
124
  }
125
+ (0, import_keyboard_shortcuts.useShortcut)(
126
+ "core/editor/new-note",
127
+ (event) => {
128
+ event.preventDefault();
129
+ openNoteForBlock(clientId);
130
+ },
131
+ {
132
+ // When multiple notes per block are supported. Remove note ID check.
133
+ // See: https://github.com/WordPress/gutenberg/pull/75147.
134
+ isDisabled: isDistractionFree || isClassicBlock || !clientId || !!noteId
135
+ }
136
+ );
137
+ const { merged: GlobalStyles } = (0, import_global_styles_provider.useGlobalStylesContext)();
138
+ const backgroundColor = GlobalStyles?.styles?.color?.background;
139
+ const currentThread = noteId ? notes.find((thread) => thread.id === noteId) : null;
128
140
  if (isDistractionFree) {
129
141
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_add_note_menu_item.AddNoteMenuItem, { isDistractionFree: true });
130
142
  }
@@ -133,10 +145,15 @@ function NotesSidebar({ postId }) {
133
145
  import_note_indicator_toolbar.NoteAvatarIndicator,
134
146
  {
135
147
  note: currentThread,
136
- onClick: openTheSidebar
148
+ onClick: () => openNoteForBlock(clientId)
149
+ }
150
+ ),
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ import_add_note_menu_item.AddNoteMenuItem,
153
+ {
154
+ onClick: (menuClientId) => openNoteForBlock(menuClientId)
137
155
  }
138
156
  ),
139
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_add_note_menu_item.AddNoteMenuItem, { onClick: openTheSidebar }),
140
157
  showAllNotesSidebar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
141
158
  import_plugin_sidebar.default,
142
159
  {
@@ -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 { 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;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AA,EAAqB,aAAY,gBACjC,sDAAC,gBAAa,QAAkB,GACjC;AAEF;",
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\tasync function focusNote( {\n\t\ttargetClientId,\n\t\tnoteId: targetNoteId,\n\t\tisApproved,\n\t} ) {\n\t\tif ( ! targetClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevArea = await getActiveComplementaryArea( 'core' );\n\t\tif ( isApproved ) {\n\t\t\tenableComplementaryArea( 'core', ALL_NOTES_SIDEBAR );\n\t\t} else if ( ! SIDEBARS.includes( prevArea ) || ! 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( targetNoteId, { focus: true } );\n\t}\n\n\tfunction openNoteForBlock( targetClientId ) {\n\t\tconst target = notes.find(\n\t\t\t( note ) => note.blockClientId === targetClientId\n\t\t);\n\t\treturn focusNote( {\n\t\t\ttargetClientId,\n\t\t\tnoteId: target?.id ?? 'new',\n\t\t\tisApproved: target?.status === 'approved',\n\t\t} );\n\t}\n\n\tuseShortcut(\n\t\t'core/editor/new-note',\n\t\t( event ) => {\n\t\t\tevent.preventDefault();\n\t\t\topenNoteForBlock( clientId );\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\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={ () => openNoteForBlock( clientId ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<AddNoteMenuItem\n\t\t\t\tonClick={ ( menuClientId ) => openNoteForBlock( menuClientId ) }\n\t\t\t/>\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": ";;;;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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
6
  "names": ["interfaceStore", "blockEditorStore", "editorStore", "preferencesStore", "PluginSidebar", "commentIcon", "PostTypeSupportCheck"]
7
7
  }
@@ -83,6 +83,12 @@ function NoteThread({
83
83
  }
84
84
  return () => unregisterThread?.(note.id);
85
85
  }, [relatedBlockElement, note.id, registerThread, unregisterThread]);
86
+ (0, import_element.useEffect)(() => {
87
+ if (!isSelected || note.id === "new") {
88
+ return;
89
+ }
90
+ (0, import_utils.scrollNoteThreadIntoView)(note.id, sidebarRef.current);
91
+ }, [isSelected, floating?.y, note.id, sidebarRef]);
86
92
  const onMouseEnter = () => {
87
93
  debouncedToggleBlockHighlight(note.blockClientId, true);
88
94
  };
@@ -111,22 +117,26 @@ function NoteThread({
111
117
  return;
112
118
  }
113
119
  toggleBlockHighlight(note.blockClientId, false);
114
- unselectNote();
120
+ onDeselectNote();
115
121
  };
116
- const handleNoteSelect = () => {
122
+ const onSelectNote = () => {
123
+ if (isSelected) {
124
+ return;
125
+ }
117
126
  selectNote(note.id);
127
+ (0, import_utils.focusNoteThread)(note.id, sidebarRef.current);
118
128
  toggleBlockSpotlight(note.blockClientId, true);
119
129
  if (!!note.blockClientId) {
120
130
  selectBlock(note.blockClientId, null);
121
131
  }
122
132
  };
123
- const unselectNote = () => {
133
+ const onDeselectNote = () => {
124
134
  selectNote(void 0);
125
135
  toggleBlockSpotlight(note.blockClientId, false);
126
136
  };
127
137
  const handleResolve = () => {
128
138
  onEditNote({ id: note.id, status: "approved" });
129
- unselectNote();
139
+ onDeselectNote();
130
140
  if (isFloating) {
131
141
  relatedBlockElement?.focus();
132
142
  } else {
@@ -168,7 +178,7 @@ function NoteThread({
168
178
  }),
169
179
  id: `note-thread-${note.id}`,
170
180
  gap: "md",
171
- onClick: handleNoteSelect,
181
+ onClick: onSelectNote,
172
182
  onMouseEnter,
173
183
  onMouseLeave,
174
184
  onFocus,
@@ -237,9 +247,9 @@ function NoteThread({
237
247
  size: "compact",
238
248
  variant: "tertiary",
239
249
  className: "editor-collab-sidebar-panel__more-reply-button",
240
- onClick: () => {
241
- selectNote(note.id);
242
- (0, import_utils.focusNoteThread)(note.id, sidebarRef.current);
250
+ onClick: (event) => {
251
+ event.stopPropagation();
252
+ onSelectNote();
243
253
  },
244
254
  children: (0, import_i18n.sprintf)(
245
255
  // translators: %s: number of replies.
@@ -283,7 +293,7 @@ function NoteThread({
283
293
  },
284
294
  onCancel: (event) => {
285
295
  event.stopPropagation();
286
- unselectNote();
296
+ onDeselectNote();
287
297
  (0, import_utils.focusNoteThread)(note.id, sidebarRef.current);
288
298
  },
289
299
  labels: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/collab-sidebar/note-thread.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useDebounce } from '@wordpress/compose';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { AddNote } from './add-note';\nimport { Note } from './note';\nimport { NoteCard } from './note-card';\nimport { NoteForm } from './note-form';\nimport { FloatingContainer } from './floating-container';\nimport { focusNoteThread, getNoteExcerpt } from './utils';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function NoteThread( {\n\tnote,\n\tonEditNote,\n\tonAddReply,\n\tonDeleteNote,\n\tisSelected,\n\tsidebarRef,\n\tfloating,\n\tonKeyDown,\n} ) {\n\tconst isFloating = !! floating;\n\tconst { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst relatedBlockElement = useBlockElement( note.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\tconst floatingRef = useRef( null );\n\tconst isKeyboardTabbingRef = useRef( false );\n\n\tconst registerThread = floating?.registerThread;\n\tconst unregisterThread = floating?.unregisterThread;\n\n\t// Register block + floating elements with the board.\n\t// The board's ResizeObserver and autoUpdate track changes automatically.\n\tuseEffect( () => {\n\t\tconst floatingEl = floatingRef.current;\n\t\tif ( floatingEl && registerThread ) {\n\t\t\tregisterThread( note.id, relatedBlockElement, floatingEl );\n\t\t}\n\t\treturn () => unregisterThread?.( note.id );\n\t}, [ relatedBlockElement, note.id, registerThread, unregisterThread ] );\n\n\tconst onMouseEnter = () => {\n\t\tdebouncedToggleBlockHighlight( note.blockClientId, true );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tdebouncedToggleBlockHighlight( note.blockClientId, false );\n\t};\n\n\tconst onFocus = () => {\n\t\ttoggleBlockHighlight( note.blockClientId, true );\n\t};\n\n\tconst onBlur = ( event ) => {\n\t\t// Don't deselect notes when the browser window/tab loses focus.\n\t\tif ( ! document.hasFocus() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isNoteFocused = event.relatedTarget?.closest(\n\t\t\t'.editor-collab-sidebar-panel__thread'\n\t\t);\n\t\tconst isDialogFocused =\n\t\t\tevent.relatedTarget?.closest( '[role=\"dialog\"]' );\n\t\tconst isTabbing = isKeyboardTabbingRef.current;\n\n\t\t// When another note is clicked, do nothing because the current note is automatically closed.\n\t\tif ( isNoteFocused && ! isTabbing ) {\n\t\t\treturn;\n\t\t}\n\t\t// When deleting a note, a dialog appears, but the note should not be collapsed.\n\t\tif ( isDialogFocused ) {\n\t\t\treturn;\n\t\t}\n\t\t// When tabbing, do nothing if the focus is within the current note.\n\t\tif (\n\t\t\tisTabbing &&\n\t\t\tevent.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Closes a note that has lost focus when any of the following conditions are met:\n\t\t// - An element other than a note is clicked.\n\t\t// - Focus was lost by tabbing.\n\t\ttoggleBlockHighlight( note.blockClientId, false );\n\t\tunselectNote();\n\t};\n\n\tconst handleNoteSelect = () => {\n\t\tselectNote( note.id );\n\t\ttoggleBlockSpotlight( note.blockClientId, true );\n\t\tif ( !! note.blockClientId ) {\n\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\tselectBlock( note.blockClientId, null );\n\t\t}\n\t};\n\n\tconst unselectNote = () => {\n\t\tselectNote( undefined );\n\t\ttoggleBlockSpotlight( note.blockClientId, false );\n\t};\n\n\tconst handleResolve = () => {\n\t\tonEditNote( { id: note.id, status: 'approved' } );\n\t\tunselectNote();\n\t\tif ( isFloating ) {\n\t\t\trelatedBlockElement?.focus();\n\t\t} else {\n\t\t\tfocusNoteThread( note.id, sidebarRef.current );\n\t\t}\n\t};\n\n\tconst allReplies = note?.reply || [];\n\tconst lastReply =\n\t\tallReplies.length > 0 ? allReplies[ allReplies.length - 1 ] : undefined;\n\tconst restReplies = allReplies.length > 0 ? allReplies.slice( 0, -1 ) : [];\n\n\tconst noteExcerpt = getNoteExcerpt(\n\t\tstripHTML( note.content?.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = !! note.blockClientId\n\t\t? sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Note: %s' ),\n\t\t\t\tnoteExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Original block deleted. Note: %s' ),\n\t\t\t\tnoteExcerpt\n\t\t );\n\n\tif ( isFloating && note.id === 'new' ) {\n\t\treturn (\n\t\t\t<AddNote\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tsidebarRef={ sidebarRef }\n\t\t\t\tfloating={ { y: floating.y, ref: floatingRef } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<FloatingContainer\n\t\t\tfloating={\n\t\t\t\tisFloating ? { y: floating.y, ref: floatingRef } : undefined\n\t\t\t}\n\t\t\tclassName={ clsx( 'editor-collab-sidebar-panel__thread', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tid={ `note-thread-${ note.id }` }\n\t\t\tgap=\"md\"\n\t\t\tonClick={ handleNoteSelect }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onFocus }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyUp={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = false;\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tonKeyDown( event );\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"treeitem\"\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-note\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tfocusNoteThread( note.id, sidebarRef.current, 'textarea' );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Add new reply' ) }\n\t\t\t</Button>\n\t\t\t{ ! note.blockClientId && (\n\t\t\t\t<p className=\"editor-collab-sidebar-panel__deleted-block-notice\">\n\t\t\t\t\t{ __( 'Original block deleted.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<Note\n\t\t\t\tnote={ note }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\tonDeleteNote={ onDeleteNote }\n\t\t\t\tonResolve={ handleResolve }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\tallReplies.map( ( reply ) => (\n\t\t\t\t\t<Note\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tnote={ reply }\n\t\t\t\t\t\tparentNote={ note }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\t\t\tonDeleteNote={ onDeleteNote }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isSelected && restReplies.length > 0 && (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-separator\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tselectNote( note.id );\n\t\t\t\t\t\t\tfocusNoteThread( note.id, sidebarRef.current );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t) }\n\t\t\t{ ! isSelected && lastReply && (\n\t\t\t\t<Note\n\t\t\t\t\tnote={ lastReply }\n\t\t\t\t\tparentNote={ note }\n\t\t\t\t\tisSelected={ false }\n\t\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\t\tonDeleteNote={ onDeleteNote }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<NoteCard role=\"treeitem\">\n\t\t\t\t\t<NoteForm\n\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\tif ( 'approved' === note.status ) {\n\t\t\t\t\t\t\t\t// For reopening, include the content in the reopen action.\n\t\t\t\t\t\t\t\tonEditNote( {\n\t\t\t\t\t\t\t\t\tid: note.id,\n\t\t\t\t\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// For regular replies, add as separate comment.\n\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\tparent: note.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\tonCancel={ ( event ) => {\n\t\t\t\t\t\t\t// Prevent the parent onClick from being triggered.\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tunselectNote();\n\t\t\t\t\t\t\tfocusNoteThread( note.id, sidebarRef.current );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\tsubmit:\n\t\t\t\t\t\t\t\t'approved' === note.status\n\t\t\t\t\t\t\t\t\t? __( 'Reopen & Reply' )\n\t\t\t\t\t\t\t\t\t: __( 'Reply' ),\n\t\t\t\t\t\t\tinput: sprintf(\n\t\t\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to note %1$s by %2$s' ),\n\t\t\t\t\t\t\t\tnote.id,\n\t\t\t\t\t\t\t\tnote.author_name\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</NoteCard>\n\t\t\t) }\n\t\t\t{ !! note.blockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-block\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back to block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</FloatingContainer>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkC;AAClC,wBAAuB;AACvB,gBAAsB;AACtB,qBAA4B;AAC5B,kBAAgC;AAChC,kBAA4B;AAC5B,iBAAiD;AACjD,0BAGO;AAKP,sBAAwB;AACxB,kBAAqB;AACrB,uBAAyB;AACzB,uBAAyB;AACzB,gCAAkC;AAClC,mBAAgD;AAChD,mBAAqC;AACrC,yBAAuB;AAuIpB;AArIH,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,WAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EAC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V,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,SAAU,CAAE,UAAW;AACtB,oBAAM,gBAAgB;AACtB,mCAAqB,MAAM;AAAA,YAC5B;AAAA,YAEE,8BAAI,eAAgB;AAAA;AAAA,QACvB;AAAA;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useDebounce } from '@wordpress/compose';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { AddNote } from './add-note';\nimport { Note } from './note';\nimport { NoteCard } from './note-card';\nimport { NoteForm } from './note-form';\nimport { FloatingContainer } from './floating-container';\nimport {\n\tfocusNoteThread,\n\tgetNoteExcerpt,\n\tscrollNoteThreadIntoView,\n} from './utils';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function NoteThread( {\n\tnote,\n\tonEditNote,\n\tonAddReply,\n\tonDeleteNote,\n\tisSelected,\n\tsidebarRef,\n\tfloating,\n\tonKeyDown,\n} ) {\n\tconst isFloating = !! floating;\n\tconst { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst relatedBlockElement = useBlockElement( note.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\tconst floatingRef = useRef( null );\n\tconst isKeyboardTabbingRef = useRef( false );\n\n\tconst registerThread = floating?.registerThread;\n\tconst unregisterThread = floating?.unregisterThread;\n\n\t// Register block + floating elements with the board.\n\t// The board's ResizeObserver and autoUpdate track changes automatically.\n\tuseEffect( () => {\n\t\tconst floatingEl = floatingRef.current;\n\t\tif ( floatingEl && registerThread ) {\n\t\t\tregisterThread( note.id, relatedBlockElement, floatingEl );\n\t\t}\n\t\treturn () => unregisterThread?.( note.id );\n\t}, [ relatedBlockElement, note.id, registerThread, unregisterThread ] );\n\n\t// Scroll the thread into view when it becomes selected, and re-scroll\n\t// when its floating position settles after `useFloatingBoard` recomputes.\n\tuseEffect( () => {\n\t\tif ( ! isSelected || note.id === 'new' ) {\n\t\t\treturn;\n\t\t}\n\t\tscrollNoteThreadIntoView( note.id, sidebarRef.current );\n\t}, [ isSelected, floating?.y, note.id, sidebarRef ] );\n\n\tconst onMouseEnter = () => {\n\t\tdebouncedToggleBlockHighlight( note.blockClientId, true );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tdebouncedToggleBlockHighlight( note.blockClientId, false );\n\t};\n\n\tconst onFocus = () => {\n\t\ttoggleBlockHighlight( note.blockClientId, true );\n\t};\n\n\tconst onBlur = ( event ) => {\n\t\t// Don't deselect notes when the browser window/tab loses focus.\n\t\tif ( ! document.hasFocus() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isNoteFocused = event.relatedTarget?.closest(\n\t\t\t'.editor-collab-sidebar-panel__thread'\n\t\t);\n\t\tconst isDialogFocused =\n\t\t\tevent.relatedTarget?.closest( '[role=\"dialog\"]' );\n\t\tconst isTabbing = isKeyboardTabbingRef.current;\n\n\t\t// When another note is clicked, do nothing because the current note is automatically closed.\n\t\tif ( isNoteFocused && ! isTabbing ) {\n\t\t\treturn;\n\t\t}\n\t\t// When deleting a note, a dialog appears, but the note should not be collapsed.\n\t\tif ( isDialogFocused ) {\n\t\t\treturn;\n\t\t}\n\t\t// When tabbing, do nothing if the focus is within the current note.\n\t\tif (\n\t\t\tisTabbing &&\n\t\t\tevent.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Closes a note that has lost focus when any of the following conditions are met:\n\t\t// - An element other than a note is clicked.\n\t\t// - Focus was lost by tabbing.\n\t\ttoggleBlockHighlight( note.blockClientId, false );\n\t\tonDeselectNote();\n\t};\n\n\tconst onSelectNote = () => {\n\t\tif ( isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tselectNote( note.id );\n\t\tfocusNoteThread( note.id, sidebarRef.current );\n\t\ttoggleBlockSpotlight( note.blockClientId, true );\n\t\tif ( !! note.blockClientId ) {\n\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\tselectBlock( note.blockClientId, null );\n\t\t}\n\t};\n\n\tconst onDeselectNote = () => {\n\t\tselectNote( undefined );\n\t\ttoggleBlockSpotlight( note.blockClientId, false );\n\t};\n\n\tconst handleResolve = () => {\n\t\tonEditNote( { id: note.id, status: 'approved' } );\n\t\tonDeselectNote();\n\t\tif ( isFloating ) {\n\t\t\trelatedBlockElement?.focus();\n\t\t} else {\n\t\t\tfocusNoteThread( note.id, sidebarRef.current );\n\t\t}\n\t};\n\n\tconst allReplies = note?.reply || [];\n\tconst lastReply =\n\t\tallReplies.length > 0 ? allReplies[ allReplies.length - 1 ] : undefined;\n\tconst restReplies = allReplies.length > 0 ? allReplies.slice( 0, -1 ) : [];\n\n\tconst noteExcerpt = getNoteExcerpt(\n\t\tstripHTML( note.content?.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = !! note.blockClientId\n\t\t? sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Note: %s' ),\n\t\t\t\tnoteExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Original block deleted. Note: %s' ),\n\t\t\t\tnoteExcerpt\n\t\t );\n\n\tif ( isFloating && note.id === 'new' ) {\n\t\treturn (\n\t\t\t<AddNote\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tsidebarRef={ sidebarRef }\n\t\t\t\tfloating={ { y: floating.y, ref: floatingRef } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<FloatingContainer\n\t\t\tfloating={\n\t\t\t\tisFloating ? { y: floating.y, ref: floatingRef } : undefined\n\t\t\t}\n\t\t\tclassName={ clsx( 'editor-collab-sidebar-panel__thread', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tid={ `note-thread-${ note.id }` }\n\t\t\tgap=\"md\"\n\t\t\tonClick={ onSelectNote }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onFocus }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyUp={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = false;\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tonKeyDown( event );\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"treeitem\"\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-note\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tfocusNoteThread( note.id, sidebarRef.current, 'textarea' );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Add new reply' ) }\n\t\t\t</Button>\n\t\t\t{ ! note.blockClientId && (\n\t\t\t\t<p className=\"editor-collab-sidebar-panel__deleted-block-notice\">\n\t\t\t\t\t{ __( 'Original block deleted.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<Note\n\t\t\t\tnote={ note }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\tonDeleteNote={ onDeleteNote }\n\t\t\t\tonResolve={ handleResolve }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\tallReplies.map( ( reply ) => (\n\t\t\t\t\t<Note\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tnote={ reply }\n\t\t\t\t\t\tparentNote={ note }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\t\t\tonDeleteNote={ onDeleteNote }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isSelected && restReplies.length > 0 && (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-separator\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-button\"\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonSelectNote();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t) }\n\t\t\t{ ! isSelected && lastReply && (\n\t\t\t\t<Note\n\t\t\t\t\tnote={ lastReply }\n\t\t\t\t\tparentNote={ note }\n\t\t\t\t\tisSelected={ false }\n\t\t\t\t\tonEditNote={ onEditNote }\n\t\t\t\t\tonDeleteNote={ onDeleteNote }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<NoteCard role=\"treeitem\">\n\t\t\t\t\t<NoteForm\n\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\tif ( 'approved' === note.status ) {\n\t\t\t\t\t\t\t\t// For reopening, include the content in the reopen action.\n\t\t\t\t\t\t\t\tonEditNote( {\n\t\t\t\t\t\t\t\t\tid: note.id,\n\t\t\t\t\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// For regular replies, add as separate comment.\n\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\tparent: note.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\tonCancel={ ( event ) => {\n\t\t\t\t\t\t\t// Prevent the parent onClick from being triggered.\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonDeselectNote();\n\t\t\t\t\t\t\tfocusNoteThread( note.id, sidebarRef.current );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\tsubmit:\n\t\t\t\t\t\t\t\t'approved' === note.status\n\t\t\t\t\t\t\t\t\t? __( 'Reopen & Reply' )\n\t\t\t\t\t\t\t\t\t: __( 'Reply' ),\n\t\t\t\t\t\t\tinput: sprintf(\n\t\t\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to note %1$s by %2$s' ),\n\t\t\t\t\t\t\t\tnote.id,\n\t\t\t\t\t\t\t\tnote.author_name\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</NoteCard>\n\t\t\t) }\n\t\t\t{ !! note.blockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-block\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back to block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</FloatingContainer>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkC;AAClC,wBAAuB;AACvB,gBAAsB;AACtB,qBAA4B;AAC5B,kBAAgC;AAChC,kBAA4B;AAC5B,iBAAiD;AACjD,0BAGO;AAKP,sBAAwB;AACxB,kBAAqB;AACrB,uBAAyB;AACzB,uBAAyB;AACzB,gCAAkC;AAClC,mBAIO;AACP,mBAAqC;AACrC,yBAAuB;AAqJpB;AAnJH,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,WAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,aAAa,CAAC,CAAE;AACtB,QAAM,EAAE,sBAAsB,aAAa,qBAAqB,QAAI;AAAA,QACnE,yBAAa,oBAAAC,KAAiB;AAAA,EAC/B;AACA,QAAM,EAAE,WAAW,QAAI,+BAAQ,yBAAa,aAAAC,KAAY,CAAE;AAC1D,QAAM,sBAAsB,gBAAiB,KAAK,aAAc;AAChE,QAAM,oCAAgC;AAAA,IACrC;AAAA,IACA;AAAA,EACD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A,YAEE,8BAAI,eAAgB;AAAA;AAAA,QACvB;AAAA;AAAA;AAAA,EAEF;AAEF;",
6
6
  "names": ["blockEditorPrivateApis", "blockEditorStore", "editorStore", "stripHTML", "clsx"]
7
7
  }
@@ -112,12 +112,14 @@ function Notes({ notes, sidebarRef, isFloating = false, styles }) {
112
112
  (0, import_utils.focusNoteThread)(note.parent, sidebarRef.current);
113
113
  return;
114
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);
115
+ const adjacentThread = nextThread ?? prevThread;
116
+ if (adjacentThread) {
117
+ selectNote(adjacentThread.id);
118
+ (0, import_utils.focusNoteThread)(adjacentThread.id, sidebarRef.current);
119
+ if (adjacentThread.blockClientId) {
120
+ toggleBlockSpotlight(adjacentThread.blockClientId, true);
121
+ selectBlock(adjacentThread.blockClientId, null);
122
+ }
121
123
  } else {
122
124
  selectNote(void 0);
123
125
  toggleBlockSpotlight(note.blockClientId, false);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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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YAA0B,IAE3D,4EACG;AAAA,SAAE,cAAc,iBAAiB,SAClC;AAAA,UAAC;AAAA;AAAA,YACA,UAAW;AAAA,YACX;AAAA;AAAA,QACD;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;",
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\tconst adjacentThread = nextThread ?? prevThread;\n\t\tif ( adjacentThread ) {\n\t\t\tselectNote( adjacentThread.id );\n\t\t\tfocusNoteThread( adjacentThread.id, sidebarRef.current );\n\t\t\tif ( adjacentThread.blockClientId ) {\n\t\t\t\ttoggleBlockSpotlight( adjacentThread.blockClientId, true );\n\t\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\t\tselectBlock( adjacentThread.blockClientId, null );\n\t\t\t}\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;AA0NjC;AAxNJ,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,YAAM,WAAW,yBAA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AAAA,YACX;AAAA;AAAA,QACD;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
6
  "names": ["blockEditorPrivateApis", "editorStore", "blockEditorStore"]
7
7
  }
@@ -24,7 +24,8 @@ __export(utils_exports, {
24
24
  focusNoteThread: () => focusNoteThread,
25
25
  getAvatarBorderColor: () => getAvatarBorderColor,
26
26
  getNoteExcerpt: () => getNoteExcerpt,
27
- sanitizeNoteContent: () => sanitizeNoteContent
27
+ sanitizeNoteContent: () => sanitizeNoteContent,
28
+ scrollNoteThreadIntoView: () => scrollNoteThreadIntoView
28
29
  });
29
30
  module.exports = __toCommonJS(utils_exports);
30
31
  var import_i18n = require("@wordpress/i18n");
@@ -137,9 +138,9 @@ function calculateNotePositions({
137
138
  }
138
139
  return { positions };
139
140
  }
140
- function focusNoteThread(noteId, container, additionalSelector) {
141
+ function findNoteThread(noteId, container, additionalSelector) {
141
142
  if (!container) {
142
- return;
143
+ return Promise.resolve(null);
143
144
  }
144
145
  const threadSelector = noteId && noteId !== "new" ? `[role=treeitem][id="note-thread-${noteId}"]` : "[role=treeitem]:not([id])";
145
146
  const selector = additionalSelector ? `${threadSelector} ${additionalSelector}` : threadSelector;
@@ -155,15 +156,28 @@ function focusNoteThread(noteId, container, additionalSelector) {
155
156
  resolve(container.querySelector(selector));
156
157
  }
157
158
  });
158
- observer.observe(container, {
159
- childList: true,
160
- subtree: true
161
- });
159
+ observer.observe(container, { childList: true, subtree: true });
162
160
  timer = setTimeout(() => {
163
161
  observer.disconnect();
164
162
  resolve(null);
165
163
  }, 3e3);
166
- }).then((element) => element?.focus());
164
+ });
165
+ }
166
+ function focusNoteThread(noteId, container, additionalSelector) {
167
+ return findNoteThread(noteId, container, additionalSelector).then(
168
+ (element) => {
169
+ if (!element) {
170
+ return;
171
+ }
172
+ element.focus();
173
+ element.scrollIntoView({ block: "nearest" });
174
+ }
175
+ );
176
+ }
177
+ function scrollNoteThreadIntoView(noteId, container) {
178
+ return findNoteThread(noteId, container).then((element) => {
179
+ element?.scrollIntoView({ block: "nearest" });
180
+ });
167
181
  }
168
182
  // Annotate the CommonJS export names for ESM import in node:
169
183
  0 && (module.exports = {
@@ -171,6 +185,7 @@ function focusNoteThread(noteId, container, additionalSelector) {
171
185
  focusNoteThread,
172
186
  getAvatarBorderColor,
173
187
  getNoteExcerpt,
174
- sanitizeNoteContent
188
+ sanitizeNoteContent,
189
+ scrollNoteThreadIntoView
175
190
  });
176
191
  //# sourceMappingURL=utils.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/collab-sidebar/utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Sanitizes a note string by removing non-printable ASCII characters.\n *\n * @param {string} str - The note string to sanitize.\n * @return {string} - The sanitized note string.\n */\nexport function sanitizeNoteContent( str ) {\n\treturn str.trim();\n}\n\nconst THREAD_ALIGN_OFFSET = -16;\nconst THREAD_GAP = 16;\nconst OVERLAP_MARGIN = 20;\n\n/**\n * Avatar border colors chosen to be visually distinct from each other and from\n * the editor's semantic UI colors (Delta E > 10 between all pairs).\n */\nconst AVATAR_BORDER_COLORS = [\n\t'#C36EFF', // Purple\n\t'#FF51A8', // Pink\n\t'#E4780A', // Orange\n\t'#FF35EE', // Magenta\n\t'#879F11', // Olive\n\t'#46A494', // Teal\n\t'#00A2C3', // Cyan\n];\n\n/**\n * Gets the border color for an avatar based on the user ID.\n *\n * @param {number} userId - The user ID.\n * @return {string} - The border color.\n */\nexport function getAvatarBorderColor( userId ) {\n\treturn AVATAR_BORDER_COLORS[ userId % AVATAR_BORDER_COLORS.length ];\n}\n\n/**\n * Generates a note excerpt from text based on word count type and length.\n *\n * @param {string} text - The note text to generate excerpt from.\n * @param {number} excerptLength - The maximum length for the note excerpt.\n * @return {string} - The generated note excerpt.\n */\nexport function getNoteExcerpt( text, excerptLength = 10 ) {\n\tif ( ! text ) {\n\t\treturn '';\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\tconst rawText = text.trim();\n\tlet trimmedExcerpt = '';\n\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawText.split( ' ', excerptLength ).join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the text at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the text\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst textWithSpaces = rawText.split( '', excerptLength ).join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\ttextWithSpaces.length - textWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawText\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawText.split( '', excerptLength ).join( '' );\n\t}\n\n\tconst isTrimmed = trimmedExcerpt !== rawText;\n\treturn isTrimmed ? trimmedExcerpt + '\u2026' : trimmedExcerpt;\n}\n\n/**\n * Calculate final top positions for all floating note threads in the\n * editor's content coordinate space. Adjusts positions to prevent overlapping\n * by pushing threads above the selected one upward and threads below it downward.\n *\n * @param {Object} params\n * @param {Array} params.threads Ordered list of thread objects.\n * @param {string|number|undefined} params.selectedNoteId ID of the currently selected thread.\n * @param {Object<string,DOMRect>} params.blockRects Pre-read bounding rects keyed by thread ID.\n * @param {Object<string,number>} params.heights Rendered heights keyed by thread ID.\n * @param {number} params.scrollTop Current scroll offset of the editor content.\n * @return {{ positions: Object<string,number> }} Computed top positions.\n */\nexport function calculateNotePositions( {\n\tthreads,\n\tselectedNoteId,\n\tblockRects,\n\theights,\n\tscrollTop = 0,\n} ) {\n\tconst offsets = {};\n\n\tconst anchorIndex = Math.max(\n\t\t0,\n\t\tthreads.findIndex( ( thread ) => thread.id === selectedNoteId )\n\t);\n\n\tconst anchorThread = threads[ anchorIndex ];\n\n\tif ( ! anchorThread || ! blockRects[ anchorThread.id ] ) {\n\t\treturn { positions: {} };\n\t}\n\n\tconst anchorRect = blockRects[ anchorThread.id ];\n\tconst anchorTop = anchorRect.top || 0;\n\tconst anchorHeight = heights[ anchorThread.id ] || 0;\n\n\toffsets[ anchorThread.id ] = THREAD_ALIGN_OFFSET;\n\n\t// Process threads after the anchor, offsetting overlapping threads downward.\n\tlet prevAdjustedTop = anchorTop + THREAD_ALIGN_OFFSET;\n\tlet prevHeight = anchorHeight;\n\n\tfor ( let i = anchorIndex + 1; i < threads.length; i++ ) {\n\t\tconst thread = threads[ i ];\n\t\tconst threadRect = blockRects[ thread.id ];\n\t\tif ( ! threadRect ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst threadTop = threadRect.top || 0;\n\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\tlet offset = THREAD_ALIGN_OFFSET;\n\n\t\tconst prevBottom = prevAdjustedTop + prevHeight;\n\t\tif ( threadTop < prevBottom + THREAD_GAP ) {\n\t\t\toffset = prevBottom - threadTop + OVERLAP_MARGIN;\n\t\t}\n\n\t\toffsets[ thread.id ] = offset;\n\n\t\tprevAdjustedTop = threadTop + offset;\n\t\tprevHeight = threadHeight;\n\t}\n\n\t// Process threads before the anchor, offsetting overlapping threads upward.\n\tlet belowAdjustedTop = anchorTop + THREAD_ALIGN_OFFSET;\n\n\tfor ( let i = anchorIndex - 1; i >= 0; i-- ) {\n\t\tconst thread = threads[ i ];\n\t\tconst threadRect = blockRects[ thread.id ];\n\t\tif ( ! threadRect ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst threadTop = threadRect.top || 0;\n\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\tlet offset = THREAD_ALIGN_OFFSET;\n\n\t\tconst threadBottom = threadTop + threadHeight;\n\n\t\tif ( threadBottom > belowAdjustedTop ) {\n\t\t\toffset =\n\t\t\t\tbelowAdjustedTop - threadTop - threadHeight - OVERLAP_MARGIN;\n\t\t}\n\n\t\toffsets[ thread.id ] = offset;\n\n\t\tbelowAdjustedTop = threadTop + offset;\n\t}\n\n\t// blockRect.top + scrollTop is the block's absolute y within the editor's\n\t// scroll content; CSS translates each thread by -scrollTop at render time.\n\tconst positions = {};\n\tfor ( const thread of threads ) {\n\t\tconst blockRect = blockRects[ thread.id ];\n\t\tif ( blockRect && offsets[ thread.id ] !== undefined ) {\n\t\t\tpositions[ thread.id ] =\n\t\t\t\tblockRect.top + scrollTop + offsets[ thread.id ];\n\t\t}\n\t}\n\n\treturn { positions };\n}\n\n/**\n * Shift focus to the note thread associated with a particular note ID.\n * If an additional selector is provided, the focus will be shifted to the element matching the selector.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {string} noteId The ID of the note thread to focus.\n * @param {?HTMLElement} container The container element to search within.\n * @param {string} additionalSelector The additional selector to focus on.\n */\nexport function focusNoteThread( noteId, container, additionalSelector ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\t// A thread without a noteId is a new note thread.\n\tconst threadSelector =\n\t\tnoteId && noteId !== 'new'\n\t\t\t? `[role=treeitem][id=\"note-thread-${ noteId }\"]`\n\t\t\t: '[role=treeitem]:not([id])';\n\tconst selector = additionalSelector\n\t\t? `${ threadSelector } ${ additionalSelector }`\n\t\t: threadSelector;\n\n\treturn new Promise( ( resolve ) => {\n\t\tif ( container.querySelector( selector ) ) {\n\t\t\treturn resolve( container.querySelector( selector ) );\n\t\t}\n\n\t\tlet timer = null;\n\t\t// Wait for the element to be added to the DOM.\n\t\tconst observer = new window.MutationObserver( () => {\n\t\t\tif ( container.querySelector( selector ) ) {\n\t\t\t\tclearTimeout( timer );\n\t\t\t\tobserver.disconnect();\n\t\t\t\tresolve( container.querySelector( selector ) );\n\t\t\t}\n\t\t} );\n\n\t\tobserver.observe( container, {\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t} );\n\n\t\t// Stop trying after 3 seconds.\n\t\ttimer = setTimeout( () => {\n\t\t\tobserver.disconnect();\n\t\t\tresolve( null );\n\t\t}, 3000 );\n\t} ).then( ( element ) => element?.focus() );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAQZ,SAAS,oBAAqB,KAAM;AAC1C,SAAO,IAAI,KAAK;AACjB;AAEA,IAAM,sBAAsB;AAC5B,IAAM,aAAa;AACnB,IAAM,iBAAiB;AAMvB,IAAM,uBAAuB;AAAA,EAC5B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACD;AAQO,SAAS,qBAAsB,QAAS;AAC9C,SAAO,qBAAsB,SAAS,qBAAqB,MAAO;AACnE;AASO,SAAS,eAAgB,MAAM,gBAAgB,IAAK;AAC1D,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AAOA,QAAM,oBAAgB,gBAAI,SAAS,oCAAqC;AAExE,QAA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,aAAO,QAAS,UAAU,cAAe,QAAS,CAAE;AAAA,IACrD;AAEA,QAAI,QAAQ;AAEZ,UAAM,WAAW,IAAI,OAAO,iBAAkB,MAAM;AACnD,UAAK,UAAU,cAAe,QAAS,GAAI;AAC1C,qBAAc,KAAM;AACpB,iBAAS,WAAW;AACpB,gBAAS,UAAU,cAAe,QAAS,CAAE;AAAA,MAC9C;AAAA,IACD,CAAE;AAEF,aAAS,QAAS,WAAW;AAAA,MAC5B,WAAW;AAAA,MACX,SAAS;AAAA,IACV,CAAE;AAGF,YAAQ,WAAY,MAAM;AACzB,eAAS,WAAW;AACpB,cAAS,IAAK;AAAA,IACf,GAAG,GAAK;AAAA,EACT,CAAE,EAAE,KAAM,CAAE,YAAa,SAAS,MAAM,CAAE;AAC3C;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Sanitizes a note string by removing non-printable ASCII characters.\n *\n * @param {string} str - The note string to sanitize.\n * @return {string} - The sanitized note string.\n */\nexport function sanitizeNoteContent( str ) {\n\treturn str.trim();\n}\n\nconst THREAD_ALIGN_OFFSET = -16;\nconst THREAD_GAP = 16;\nconst OVERLAP_MARGIN = 20;\n\n/**\n * Avatar border colors chosen to be visually distinct from each other and from\n * the editor's semantic UI colors (Delta E > 10 between all pairs).\n */\nconst AVATAR_BORDER_COLORS = [\n\t'#C36EFF', // Purple\n\t'#FF51A8', // Pink\n\t'#E4780A', // Orange\n\t'#FF35EE', // Magenta\n\t'#879F11', // Olive\n\t'#46A494', // Teal\n\t'#00A2C3', // Cyan\n];\n\n/**\n * Gets the border color for an avatar based on the user ID.\n *\n * @param {number} userId - The user ID.\n * @return {string} - The border color.\n */\nexport function getAvatarBorderColor( userId ) {\n\treturn AVATAR_BORDER_COLORS[ userId % AVATAR_BORDER_COLORS.length ];\n}\n\n/**\n * Generates a note excerpt from text based on word count type and length.\n *\n * @param {string} text - The note text to generate excerpt from.\n * @param {number} excerptLength - The maximum length for the note excerpt.\n * @return {string} - The generated note excerpt.\n */\nexport function getNoteExcerpt( text, excerptLength = 10 ) {\n\tif ( ! text ) {\n\t\treturn '';\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\tconst rawText = text.trim();\n\tlet trimmedExcerpt = '';\n\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawText.split( ' ', excerptLength ).join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the text at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the text\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst textWithSpaces = rawText.split( '', excerptLength ).join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\ttextWithSpaces.length - textWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawText\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawText.split( '', excerptLength ).join( '' );\n\t}\n\n\tconst isTrimmed = trimmedExcerpt !== rawText;\n\treturn isTrimmed ? trimmedExcerpt + '\u2026' : trimmedExcerpt;\n}\n\n/**\n * Calculate final top positions for all floating note threads in the\n * editor's content coordinate space. Adjusts positions to prevent overlapping\n * by pushing threads above the selected one upward and threads below it downward.\n *\n * @param {Object} params\n * @param {Array} params.threads Ordered list of thread objects.\n * @param {string|number|undefined} params.selectedNoteId ID of the currently selected thread.\n * @param {Object<string,DOMRect>} params.blockRects Pre-read bounding rects keyed by thread ID.\n * @param {Object<string,number>} params.heights Rendered heights keyed by thread ID.\n * @param {number} params.scrollTop Current scroll offset of the editor content.\n * @return {{ positions: Object<string,number> }} Computed top positions.\n */\nexport function calculateNotePositions( {\n\tthreads,\n\tselectedNoteId,\n\tblockRects,\n\theights,\n\tscrollTop = 0,\n} ) {\n\tconst offsets = {};\n\n\tconst anchorIndex = Math.max(\n\t\t0,\n\t\tthreads.findIndex( ( thread ) => thread.id === selectedNoteId )\n\t);\n\n\tconst anchorThread = threads[ anchorIndex ];\n\n\tif ( ! anchorThread || ! blockRects[ anchorThread.id ] ) {\n\t\treturn { positions: {} };\n\t}\n\n\tconst anchorRect = blockRects[ anchorThread.id ];\n\tconst anchorTop = anchorRect.top || 0;\n\tconst anchorHeight = heights[ anchorThread.id ] || 0;\n\n\toffsets[ anchorThread.id ] = THREAD_ALIGN_OFFSET;\n\n\t// Process threads after the anchor, offsetting overlapping threads downward.\n\tlet prevAdjustedTop = anchorTop + THREAD_ALIGN_OFFSET;\n\tlet prevHeight = anchorHeight;\n\n\tfor ( let i = anchorIndex + 1; i < threads.length; i++ ) {\n\t\tconst thread = threads[ i ];\n\t\tconst threadRect = blockRects[ thread.id ];\n\t\tif ( ! threadRect ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst threadTop = threadRect.top || 0;\n\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\tlet offset = THREAD_ALIGN_OFFSET;\n\n\t\tconst prevBottom = prevAdjustedTop + prevHeight;\n\t\tif ( threadTop < prevBottom + THREAD_GAP ) {\n\t\t\toffset = prevBottom - threadTop + OVERLAP_MARGIN;\n\t\t}\n\n\t\toffsets[ thread.id ] = offset;\n\n\t\tprevAdjustedTop = threadTop + offset;\n\t\tprevHeight = threadHeight;\n\t}\n\n\t// Process threads before the anchor, offsetting overlapping threads upward.\n\tlet belowAdjustedTop = anchorTop + THREAD_ALIGN_OFFSET;\n\n\tfor ( let i = anchorIndex - 1; i >= 0; i-- ) {\n\t\tconst thread = threads[ i ];\n\t\tconst threadRect = blockRects[ thread.id ];\n\t\tif ( ! threadRect ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst threadTop = threadRect.top || 0;\n\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\tlet offset = THREAD_ALIGN_OFFSET;\n\n\t\tconst threadBottom = threadTop + threadHeight;\n\n\t\tif ( threadBottom > belowAdjustedTop ) {\n\t\t\toffset =\n\t\t\t\tbelowAdjustedTop - threadTop - threadHeight - OVERLAP_MARGIN;\n\t\t}\n\n\t\toffsets[ thread.id ] = offset;\n\n\t\tbelowAdjustedTop = threadTop + offset;\n\t}\n\n\t// blockRect.top + scrollTop is the block's absolute y within the editor's\n\t// scroll content; CSS translates each thread by -scrollTop at render time.\n\tconst positions = {};\n\tfor ( const thread of threads ) {\n\t\tconst blockRect = blockRects[ thread.id ];\n\t\tif ( blockRect && offsets[ thread.id ] !== undefined ) {\n\t\t\tpositions[ thread.id ] =\n\t\t\t\tblockRect.top + scrollTop + offsets[ thread.id ];\n\t\t}\n\t}\n\n\treturn { positions };\n}\n\n/**\n * Resolve the DOM element for a note thread once it's mounted,\n * or `null` if not found within 3 seconds.\n *\n * @param {string} noteId Note thread ID.\n * @param {?HTMLElement} container Container to search within.\n * @param {string} additionalSelector Optional descendant selector.\n * @return {Promise<HTMLElement|null>} Resolved element, or `null` on timeout.\n */\nfunction findNoteThread( noteId, container, additionalSelector ) {\n\tif ( ! container ) {\n\t\treturn Promise.resolve( null );\n\t}\n\n\t// A thread without a noteId is a new note thread.\n\tconst threadSelector =\n\t\tnoteId && noteId !== 'new'\n\t\t\t? `[role=treeitem][id=\"note-thread-${ noteId }\"]`\n\t\t\t: '[role=treeitem]:not([id])';\n\tconst selector = additionalSelector\n\t\t? `${ threadSelector } ${ additionalSelector }`\n\t\t: threadSelector;\n\n\treturn new Promise( ( resolve ) => {\n\t\tif ( container.querySelector( selector ) ) {\n\t\t\treturn resolve( container.querySelector( selector ) );\n\t\t}\n\n\t\tlet timer = null;\n\t\t// Wait for the element to be added to the DOM.\n\t\tconst observer = new window.MutationObserver( () => {\n\t\t\tif ( container.querySelector( selector ) ) {\n\t\t\t\tclearTimeout( timer );\n\t\t\t\tobserver.disconnect();\n\t\t\t\tresolve( container.querySelector( selector ) );\n\t\t\t}\n\t\t} );\n\n\t\tobserver.observe( container, { childList: true, subtree: true } );\n\n\t\t// Stop trying after 3 seconds.\n\t\ttimer = setTimeout( () => {\n\t\t\tobserver.disconnect();\n\t\t\tresolve( null );\n\t\t}, 3000 );\n\t} );\n}\n\n/**\n * Focus a note thread (or a descendant) and scroll it into view.\n *\n * @param {string} noteId Note thread ID.\n * @param {?HTMLElement} container Container to search within.\n * @param {string} additionalSelector Optional descendant selector.\n */\nexport function focusNoteThread( noteId, container, additionalSelector ) {\n\treturn findNoteThread( noteId, container, additionalSelector ).then(\n\t\t( element ) => {\n\t\t\tif ( ! element ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telement.focus();\n\t\t\telement.scrollIntoView( { block: 'nearest' } );\n\t\t}\n\t);\n}\n\n/**\n * Scroll a note thread into view without changing focus.\n *\n * @param {string} noteId Note thread ID.\n * @param {?HTMLElement} container Container to search within.\n */\nexport function scrollNoteThreadIntoView( noteId, container ) {\n\treturn findNoteThread( noteId, container ).then( ( element ) => {\n\t\telement?.scrollIntoView( { block: 'nearest' } );\n\t} );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAQZ,SAAS,oBAAqB,KAAM;AAC1C,SAAO,IAAI,KAAK;AACjB;AAEA,IAAM,sBAAsB;AAC5B,IAAM,aAAa;AACnB,IAAM,iBAAiB;AAMvB,IAAM,uBAAuB;AAAA,EAC5B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACD;AAQO,SAAS,qBAAsB,QAA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,IAAK;AAAA,EAC9B;AAGA,QAAM,iBACL,UAAU,WAAW,QAClB,mCAAoC,MAAO,OAC3C;AACJ,QAAM,WAAW,qBACd,GAAI,cAAe,IAAK,kBAAmB,KAC3C;AAEH,SAAO,IAAI,QAAS,CAAE,YAAa;AAClC,QAAK,UAAU,cAAe,QAAS,GAAI;AAC1C,aAAO,QAAS,UAAU,cAAe,QAAS,CAAE;AAAA,IACrD;AAEA,QAAI,QAAQ;AAEZ,UAAM,WAAW,IAAI,OAAO,iBAAkB,MAAM;AACnD,UAAK,UAAU,cAAe,QAAS,GAAI;AAC1C,qBAAc,KAAM;AACpB,iBAAS,WAAW;AACpB,gBAAS,UAAU,cAAe,QAAS,CAAE;AAAA,MAC9C;AAAA,IACD,CAAE;AAEF,aAAS,QAAS,WAAW,EAAE,WAAW,MAAM,SAAS,KAAK,CAAE;AAGhE,YAAQ,WAAY,MAAM;AACzB,eAAS,WAAW;AACpB,cAAS,IAAK;AAAA,IACf,GAAG,GAAK;AAAA,EACT,CAAE;AACH;AASO,SAAS,gBAAiB,QAAQ,WAAW,oBAAqB;AACxE,SAAO,eAAgB,QAAQ,WAAW,kBAAmB,EAAE;AAAA,IAC9D,CAAE,YAAa;AACd,UAAK,CAAE,SAAU;AAChB;AAAA,MACD;AACA,cAAQ,MAAM;AACd,cAAQ,eAAgB,EAAE,OAAO,UAAU,CAAE;AAAA,IAC9C;AAAA,EACD;AACD;AAQO,SAAS,yBAA0B,QAAQ,WAAY;AAC7D,SAAO,eAAgB,QAAQ,SAAU,EAAE,KAAM,CAAE,YAAa;AAC/D,aAAS,eAAgB,EAAE,OAAO,UAAU,CAAE;AAAA,EAC/C,CAAE;AACH;",
6
6
  "names": []
7
7
  }
@@ -44,16 +44,6 @@ var import_lock_unlock = require("../../lock-unlock.cjs");
44
44
  var import_get_avatar_url = require("../collaborators-overlay/get-avatar-url.cjs");
45
45
  var import_utils = require("../collab-sidebar/utils.cjs");
46
46
  var import_cursor_registry = require("../collaborators-overlay/cursor-registry.cjs");
47
-
48
- // packages/editor/src/components/collaborators-presence/styles/collaborators-presence.scss
49
- if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='9907eeab15']")) {
50
- const style = document.createElement("style");
51
- style.setAttribute("data-wp-hash", "9907eeab15");
52
- style.appendChild(document.createTextNode(".editor-collaborators-presence{align-items:center;background:#f0f0f0;border-radius:4px;display:flex;flex-shrink:0;height:32px;margin-right:8px}.editor-collaborators-presence:has(.is-pressed),.editor-collaborators-presence:hover{background-color:#e0e0e0}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button{align-items:center;background:#0000;border-radius:4px;box-sizing:border-box;color:#2f2f2f;cursor:var(--wpds-cursor-control,pointer);display:flex;height:100%;padding:4px;position:relative}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button.is-pressed,.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button.is-pressed:hover,.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button:hover{background:#0000;color:#2f2f2f}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button:focus:not(:active){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus,2px) var(--wp-admin-theme-color,#007cba);outline:none}"));
53
- document.head.appendChild(style);
54
- }
55
-
56
- // packages/editor/src/components/collaborators-presence/index.tsx
57
47
  var import_collaborators_overlay = require("../collaborators-overlay/index.cjs");
58
48
  var import_jsx_runtime = require("react/jsx-runtime");
59
49
  var { useActiveCollaborators } = (0, import_lock_unlock.unlock)(import_core_data.privateApis);