@univerjs/thread-comment-ui 1.0.0-insiders.20260813-7c9aa50 → 1.0.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 (100) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +0 -1
  3. package/lib/cjs/index.js +850 -139
  4. package/lib/cjs/locale/ar-SA.js +3 -3
  5. package/lib/cjs/locale/ca-ES.js +3 -3
  6. package/lib/cjs/locale/de-DE.js +3 -3
  7. package/lib/cjs/locale/en-US.js +3 -3
  8. package/lib/cjs/locale/es-ES.js +3 -3
  9. package/lib/cjs/locale/fa-IR.js +3 -3
  10. package/lib/cjs/locale/fr-FR.js +3 -3
  11. package/lib/cjs/locale/id-ID.js +3 -3
  12. package/lib/cjs/locale/it-IT.js +4 -4
  13. package/lib/cjs/locale/ja-JP.js +3 -3
  14. package/lib/cjs/locale/ko-KR.js +3 -3
  15. package/lib/cjs/locale/pl-PL.js +3 -3
  16. package/lib/cjs/locale/pt-BR.js +3 -3
  17. package/lib/cjs/locale/ru-RU.js +3 -3
  18. package/lib/cjs/locale/sk-SK.js +3 -3
  19. package/lib/cjs/locale/vi-VN.js +3 -3
  20. package/lib/cjs/locale/zh-CN.js +3 -3
  21. package/lib/cjs/locale/zh-HK.js +3 -3
  22. package/lib/cjs/locale/zh-TW.js +3 -3
  23. package/lib/es/index.js +842 -146
  24. package/lib/es/locale/ar-SA.js +3 -2
  25. package/lib/es/locale/ca-ES.js +3 -2
  26. package/lib/es/locale/de-DE.js +3 -2
  27. package/lib/es/locale/en-US.js +3 -2
  28. package/lib/es/locale/es-ES.js +3 -2
  29. package/lib/es/locale/fa-IR.js +3 -2
  30. package/lib/es/locale/fr-FR.js +3 -2
  31. package/lib/es/locale/id-ID.js +3 -2
  32. package/lib/es/locale/it-IT.js +4 -3
  33. package/lib/es/locale/ja-JP.js +3 -2
  34. package/lib/es/locale/ko-KR.js +3 -2
  35. package/lib/es/locale/pl-PL.js +3 -2
  36. package/lib/es/locale/pt-BR.js +3 -2
  37. package/lib/es/locale/ru-RU.js +3 -2
  38. package/lib/es/locale/sk-SK.js +3 -2
  39. package/lib/es/locale/vi-VN.js +3 -2
  40. package/lib/es/locale/zh-CN.js +3 -2
  41. package/lib/es/locale/zh-HK.js +3 -2
  42. package/lib/es/locale/zh-TW.js +3 -2
  43. package/lib/index.css +170 -17
  44. package/lib/index.js +842 -146
  45. package/lib/locale/ar-SA.js +3 -2
  46. package/lib/locale/ca-ES.js +3 -2
  47. package/lib/locale/de-DE.js +3 -2
  48. package/lib/locale/en-US.js +3 -2
  49. package/lib/locale/es-ES.js +3 -2
  50. package/lib/locale/fa-IR.js +3 -2
  51. package/lib/locale/fr-FR.js +3 -2
  52. package/lib/locale/id-ID.js +3 -2
  53. package/lib/locale/it-IT.js +4 -3
  54. package/lib/locale/ja-JP.js +3 -2
  55. package/lib/locale/ko-KR.js +3 -2
  56. package/lib/locale/pl-PL.js +3 -2
  57. package/lib/locale/pt-BR.js +3 -2
  58. package/lib/locale/ru-RU.js +3 -2
  59. package/lib/locale/sk-SK.js +3 -2
  60. package/lib/locale/vi-VN.js +3 -2
  61. package/lib/locale/zh-CN.js +3 -2
  62. package/lib/locale/zh-HK.js +3 -2
  63. package/lib/locale/zh-TW.js +3 -2
  64. package/lib/types/index.d.ts +7 -0
  65. package/lib/types/locale/en-US.d.ts +4 -1
  66. package/lib/types/mobile-plugin.d.ts +29 -0
  67. package/lib/types/render-objects/thread-comment-canvas-overlay.d.ts +66 -0
  68. package/lib/types/services/thread-comment-draft.service.d.ts +39 -0
  69. package/lib/types/services/thread-comment-panel.service.d.ts +7 -3
  70. package/lib/types/views/ThreadCommentEditor.d.ts +3 -1
  71. package/lib/types/views/ThreadCommentPanel.d.ts +4 -0
  72. package/lib/types/views/ThreadCommentTree.d.ts +10 -2
  73. package/lib/types/views/mobile/MobileThreadCommentEditor.d.ts +17 -0
  74. package/lib/types/views/mobile/MobileThreadCommentPanel.d.ts +17 -0
  75. package/lib/types/views/mobile/MobileThreadCommentTree.d.ts +17 -0
  76. package/lib/types/views/thread-comment-editor/index.d.ts +37 -0
  77. package/lib/types/views/thread-comment-panel/index.d.ts +37 -0
  78. package/lib/types/views/thread-comment-panel/util.d.ts +8 -0
  79. package/lib/types/views/thread-comment-tree/index.d.ts +59 -0
  80. package/lib/umd/index.js +11 -4
  81. package/lib/umd/locale/ar-SA.js +1 -1
  82. package/lib/umd/locale/ca-ES.js +1 -1
  83. package/lib/umd/locale/de-DE.js +1 -1
  84. package/lib/umd/locale/en-US.js +1 -1
  85. package/lib/umd/locale/es-ES.js +1 -1
  86. package/lib/umd/locale/fa-IR.js +1 -1
  87. package/lib/umd/locale/fr-FR.js +1 -1
  88. package/lib/umd/locale/id-ID.js +1 -1
  89. package/lib/umd/locale/it-IT.js +1 -1
  90. package/lib/umd/locale/ja-JP.js +1 -1
  91. package/lib/umd/locale/ko-KR.js +1 -1
  92. package/lib/umd/locale/pl-PL.js +1 -1
  93. package/lib/umd/locale/pt-BR.js +1 -1
  94. package/lib/umd/locale/ru-RU.js +1 -1
  95. package/lib/umd/locale/sk-SK.js +1 -1
  96. package/lib/umd/locale/vi-VN.js +1 -1
  97. package/lib/umd/locale/zh-CN.js +1 -1
  98. package/lib/umd/locale/zh-HK.js +1 -1
  99. package/lib/umd/locale/zh-TW.js +1 -1
  100. package/package.json +11 -11
package/lib/cjs/index.js CHANGED
@@ -4,12 +4,13 @@ let _univerjs_ui = require("@univerjs/ui");
4
4
  let rxjs = require("rxjs");
5
5
  let _univerjs_docs_ui = require("@univerjs/docs-ui");
6
6
  let _univerjs_thread_comment = require("@univerjs/thread-comment");
7
+ let _univerjs_engine_render = require("@univerjs/engine-render");
7
8
  let _univerjs_design = require("@univerjs/design");
8
9
  let _univerjs_icons = require("@univerjs/icons");
9
10
  let react = require("react");
10
11
  let react_jsx_runtime = require("react/jsx-runtime");
11
12
 
12
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
13
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
13
14
  function _typeof(o) {
14
15
  "@babel/helpers - typeof";
15
16
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -20,7 +21,7 @@ function _typeof(o) {
20
21
  }
21
22
 
22
23
  //#endregion
23
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
24
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
24
25
  function toPrimitive(t, r) {
25
26
  if ("object" != _typeof(t) || !t) return t;
26
27
  var e = t[Symbol.toPrimitive];
@@ -33,14 +34,14 @@ function toPrimitive(t, r) {
33
34
  }
34
35
 
35
36
  //#endregion
36
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
37
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
37
38
  function toPropertyKey(t) {
38
39
  var i = toPrimitive(t, "string");
39
40
  return "symbol" == _typeof(i) ? i : i + "";
40
41
  }
41
42
 
42
43
  //#endregion
43
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
44
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
44
45
  function _defineProperty(e, r, t) {
45
46
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
46
47
  value: t,
@@ -51,7 +52,7 @@ function _defineProperty(e, r, t) {
51
52
  }
52
53
 
53
54
  //#endregion
54
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
55
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
55
56
  function __decorateParam(paramIndex, decorator) {
56
57
  return function(target, key) {
57
58
  decorator(target, key, paramIndex);
@@ -59,7 +60,7 @@ function __decorateParam(paramIndex, decorator) {
59
60
  }
60
61
 
61
62
  //#endregion
62
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
63
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
63
64
  function __decorate(decorators, target, key, desc) {
64
65
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
65
66
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -70,19 +71,22 @@ function __decorate(decorators, target, key, desc) {
70
71
  //#endregion
71
72
  //#region src/services/thread-comment-panel.service.ts
72
73
  let ThreadCommentPanelService = class ThreadCommentPanelService extends _univerjs_core.Disposable {
73
- constructor(_sidebarService, _univerInstanceService) {
74
+ constructor(_sidebarService) {
74
75
  super();
75
76
  this._sidebarService = _sidebarService;
76
- this._univerInstanceService = _univerInstanceService;
77
77
  _defineProperty(this, "_panelVisible", false);
78
78
  _defineProperty(this, "_panelVisible$", new rxjs.BehaviorSubject(false));
79
79
  _defineProperty(this, "_activeCommentId", void 0);
80
80
  _defineProperty(this, "_activeCommentId$", new rxjs.BehaviorSubject(void 0));
81
+ _defineProperty(this, "_hoveredCommentId", void 0);
82
+ _defineProperty(this, "_hoveredCommentId$", new rxjs.BehaviorSubject(void 0));
81
83
  _defineProperty(this, "panelVisible$", this._panelVisible$.asObservable());
82
84
  _defineProperty(this, "activeCommentId$", this._activeCommentId$.asObservable());
85
+ _defineProperty(this, "hoveredCommentId$", this._hoveredCommentId$.asObservable());
83
86
  this._init();
84
87
  this.disposeWithMe(() => {
85
88
  this._activeCommentId$.complete();
89
+ this._hoveredCommentId$.complete();
86
90
  this._panelVisible$.complete();
87
91
  });
88
92
  }
@@ -90,9 +94,6 @@ let ThreadCommentPanelService = class ThreadCommentPanelService extends _univerj
90
94
  this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((opt) => {
91
95
  if (!opt.visible) this.setPanelVisible(false);
92
96
  }));
93
- this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET).pipe((0, rxjs.filter)((sheet) => !sheet)).subscribe(() => {
94
- this._sidebarService.close();
95
- }));
96
97
  }
97
98
  get panelVisible() {
98
99
  return this._panelVisible;
@@ -100,16 +101,24 @@ let ThreadCommentPanelService = class ThreadCommentPanelService extends _univerj
100
101
  get activeCommentId() {
101
102
  return this._activeCommentId;
102
103
  }
104
+ get hoveredCommentId() {
105
+ return this._hoveredCommentId;
106
+ }
103
107
  setPanelVisible(visible) {
104
108
  this._panelVisible = visible;
105
109
  this._panelVisible$.next(visible);
110
+ if (!visible) this.setHoveredComment(void 0);
106
111
  }
107
112
  setActiveComment(commentInfo) {
108
113
  this._activeCommentId = commentInfo;
109
114
  this._activeCommentId$.next(commentInfo);
110
115
  }
116
+ setHoveredComment(commentInfo) {
117
+ this._hoveredCommentId = commentInfo;
118
+ this._hoveredCommentId$.next(commentInfo);
119
+ }
111
120
  };
112
- ThreadCommentPanelService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ISidebarService)), __decorateParam(1, _univerjs_core.IUniverInstanceService)], ThreadCommentPanelService);
121
+ ThreadCommentPanelService = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ISidebarService))], ThreadCommentPanelService);
113
122
 
114
123
  //#endregion
115
124
  //#region src/commands/operations/comment.operations.ts
@@ -125,7 +134,7 @@ const SetActiveCommentOperation = {
125
134
  //#endregion
126
135
  //#region package.json
127
136
  var name = "@univerjs/thread-comment-ui";
128
- var version = "1.0.0-insiders.20260813-7c9aa50";
137
+ var version = "1.0.0";
129
138
 
130
139
  //#endregion
131
140
  //#region src/config/config.ts
@@ -133,6 +142,72 @@ const THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY = "thread-comment-ui.config";
133
142
  const configSymbol = Symbol(THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY);
134
143
  const defaultPluginConfig = {};
135
144
 
145
+ //#endregion
146
+ //#region src/services/thread-comment-draft.service.ts
147
+ let ThreadCommentDraftService = class ThreadCommentDraftService extends _univerjs_core.Disposable {
148
+ constructor(instanceService, _userManagerService) {
149
+ super();
150
+ this._userManagerService = _userManagerService;
151
+ _defineProperty(this, "_placementType$", new rxjs.BehaviorSubject(null));
152
+ _defineProperty(this, "_draft$", new rxjs.BehaviorSubject(null));
153
+ _defineProperty(this, "_placementUnitId", void 0);
154
+ _defineProperty(this, "_ownerUserId", void 0);
155
+ _defineProperty(this, "placementType$", this._placementType$.asObservable());
156
+ _defineProperty(this, "draft$", this._draft$.asObservable());
157
+ this.disposeWithMe(instanceService.unitDisposed$.subscribe((unit) => {
158
+ var _this$draft;
159
+ if (((_this$draft = this.draft) === null || _this$draft === void 0 ? void 0 : _this$draft.unitId) === unit.getUnitId() || this._placementUnitId === unit.getUnitId()) this.cancel();
160
+ }));
161
+ this.disposeWithMe(instanceService.focused$.subscribe((unitId) => {
162
+ if (unitId && this._placementUnitId && unitId !== this._placementUnitId) this.cancel();
163
+ }));
164
+ this.disposeWithMe(this._userManagerService.currentUser$.subscribe((user) => {
165
+ if (this._ownerUserId && (user === null || user === void 0 ? void 0 : user.userID) !== this._ownerUserId) this.cancel();
166
+ }));
167
+ if (typeof window !== "undefined") {
168
+ const cancelPlacement = (event) => {
169
+ if (event.key === "Escape" && (this.placementType || this.draft)) this.cancel();
170
+ };
171
+ window.addEventListener("keydown", cancelPlacement);
172
+ this.disposeWithMe((0, _univerjs_core.toDisposable)(() => window.removeEventListener("keydown", cancelPlacement)));
173
+ }
174
+ }
175
+ get placementType() {
176
+ return this._placementType$.value;
177
+ }
178
+ get draft() {
179
+ return this._draft$.value;
180
+ }
181
+ startPlacement(type, unitId) {
182
+ if (this.placementType === type && this._placementUnitId === unitId) {
183
+ this.cancel();
184
+ return;
185
+ }
186
+ this._ownerUserId = this._userManagerService.getCurrentUser().userID;
187
+ this._placementUnitId = unitId;
188
+ this._draft$.next(null);
189
+ this._placementType$.next(type);
190
+ }
191
+ place(draft) {
192
+ this._ownerUserId = this._userManagerService.getCurrentUser().userID;
193
+ this._placementUnitId = void 0;
194
+ this._placementType$.next(null);
195
+ this._draft$.next(draft);
196
+ }
197
+ cancel() {
198
+ this._ownerUserId = void 0;
199
+ this._placementUnitId = void 0;
200
+ this._placementType$.next(null);
201
+ this._draft$.next(null);
202
+ }
203
+ dispose() {
204
+ this._placementType$.complete();
205
+ this._draft$.complete();
206
+ super.dispose();
207
+ }
208
+ };
209
+ ThreadCommentDraftService = __decorate([__decorateParam(0, _univerjs_core.IUniverInstanceService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.UserManagerService))], ThreadCommentDraftService);
210
+
136
211
  //#endregion
137
212
  //#region src/types/const.ts
138
213
  /**
@@ -152,6 +227,38 @@ const defaultPluginConfig = {};
152
227
  */
153
228
  const PLUGIN_NAME = "UNIVER_THREAD_COMMENT_UI_PLUGIN";
154
229
 
230
+ //#endregion
231
+ //#region src/mobile-plugin.ts
232
+ let UniverThreadCommentMobileUIPlugin = class UniverThreadCommentMobileUIPlugin extends _univerjs_core.Plugin {
233
+ constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
234
+ super();
235
+ this._config = _config;
236
+ this._injector = _injector;
237
+ this._commandService = _commandService;
238
+ this._configService = _configService;
239
+ const { menu, ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
240
+ if (menu) this._configService.setConfig("menu", menu, { merge: true });
241
+ this._configService.setConfig(THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY, rest);
242
+ }
243
+ onStarting() {
244
+ var _this$_config;
245
+ (0, _univerjs_core.mergeOverrideWithDependencies)([[ThreadCommentDraftService], [ThreadCommentPanelService]], (_this$_config = this._config) === null || _this$_config === void 0 ? void 0 : _this$_config.overrides).forEach((dependency) => {
246
+ this._injector.add(dependency);
247
+ });
248
+ this._commandService.registerCommand(SetActiveCommentOperation);
249
+ }
250
+ };
251
+ _defineProperty(UniverThreadCommentMobileUIPlugin, "pluginName", PLUGIN_NAME);
252
+ _defineProperty(UniverThreadCommentMobileUIPlugin, "packageName", name);
253
+ _defineProperty(UniverThreadCommentMobileUIPlugin, "version", version);
254
+ _defineProperty(UniverThreadCommentMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_UNKNOWN);
255
+ UniverThreadCommentMobileUIPlugin = __decorate([
256
+ (0, _univerjs_core.DependentOn)(_univerjs_thread_comment.UniverThreadCommentPlugin, _univerjs_docs_ui.UniverDocsUIPlugin, _univerjs_ui.UniverMobileUIPlugin),
257
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
258
+ __decorateParam(2, _univerjs_core.ICommandService),
259
+ __decorateParam(3, _univerjs_core.IConfigService)
260
+ ], UniverThreadCommentMobileUIPlugin);
261
+
155
262
  //#endregion
156
263
  //#region src/plugin.ts
157
264
  let UniverThreadCommentUIPlugin = class UniverThreadCommentUIPlugin extends _univerjs_core.Plugin {
@@ -167,7 +274,7 @@ let UniverThreadCommentUIPlugin = class UniverThreadCommentUIPlugin extends _uni
167
274
  }
168
275
  onStarting() {
169
276
  var _this$_config;
170
- (0, _univerjs_core.mergeOverrideWithDependencies)([[ThreadCommentPanelService]], (_this$_config = this._config) === null || _this$_config === void 0 ? void 0 : _this$_config.overrides).forEach((dep) => {
277
+ (0, _univerjs_core.mergeOverrideWithDependencies)([[ThreadCommentDraftService], [ThreadCommentPanelService]], (_this$_config = this._config) === null || _this$_config === void 0 ? void 0 : _this$_config.overrides).forEach((dep) => {
171
278
  this._injector.add(dep);
172
279
  });
173
280
  [SetActiveCommentOperation].forEach((command) => {
@@ -186,8 +293,175 @@ UniverThreadCommentUIPlugin = __decorate([
186
293
  __decorateParam(3, _univerjs_core.IConfigService)
187
294
  ], UniverThreadCommentUIPlugin);
188
295
 
296
+ //#endregion
297
+ //#region src/render-objects/thread-comment-canvas-overlay.ts
298
+ const MARKER_SIZE = 24;
299
+ const MARKER_IDLE_OPACITY = .58;
300
+ const MARKER_PREVIEW_OPACITY = .42;
301
+ const UNDERLINE_WIDTH = 2;
302
+ const UNDERLINE_HIT_PADDING = 4;
303
+ const OUTLINE_PADDING = 2;
304
+ var ThreadCommentCanvasOverlay = class extends _univerjs_engine_render.BaseObject {
305
+ constructor(key, state) {
306
+ super(key);
307
+ _defineProperty(this, "_state", void 0);
308
+ _defineProperty(this, "_hoveredCommentId", null);
309
+ _defineProperty(this, "_hitCommentId", null);
310
+ this.evented = true;
311
+ this._state = state;
312
+ this.show();
313
+ }
314
+ get hitCommentId() {
315
+ return this._hitCommentId;
316
+ }
317
+ updateState(state) {
318
+ this._state = {
319
+ ...this._state,
320
+ ...state
321
+ };
322
+ if (this._hitCommentId && !this._containsComment(this._hitCommentId)) this._hitCommentId = null;
323
+ if (this._hoveredCommentId && !this._containsComment(this._hoveredCommentId)) this._hoveredCommentId = null;
324
+ if ("previewMarker" in state || "previewUnderline" in state) this.makeDirtyNoDebounce(true);
325
+ else this.makeDirty(true);
326
+ }
327
+ clearHover() {
328
+ if (this._hoveredCommentId) {
329
+ this._hoveredCommentId = null;
330
+ this.makeDirty(true);
331
+ }
332
+ this._hitCommentId = null;
333
+ }
334
+ isHit(coord) {
335
+ const zoomRatio = this._getZoomRatio();
336
+ const halfSize = MARKER_SIZE / zoomRatio / 2;
337
+ let marker;
338
+ for (let index = this._state.markers.length - 1; index >= 0; index -= 1) {
339
+ const item = this._state.markers[index];
340
+ if (!item) continue;
341
+ if (coord.x >= item.x - halfSize && coord.x <= item.x + halfSize && coord.y >= item.y - halfSize && coord.y <= item.y + halfSize) {
342
+ marker = item;
343
+ break;
344
+ }
345
+ }
346
+ let underline;
347
+ if (!marker) for (let index = this._state.underlines.length - 1; index >= 0; index -= 1) {
348
+ const item = this._state.underlines[index];
349
+ if (!item) continue;
350
+ if (coord.x >= item.left && coord.x <= item.left + item.width && Math.abs(coord.y - item.top) <= UNDERLINE_HIT_PADDING / zoomRatio) {
351
+ underline = item;
352
+ break;
353
+ }
354
+ }
355
+ const commentId = (marker === null || marker === void 0 ? void 0 : marker.commentId) ?? (underline === null || underline === void 0 ? void 0 : underline.commentId) ?? null;
356
+ this._hitCommentId = commentId;
357
+ if (commentId !== this._hoveredCommentId) {
358
+ this._hoveredCommentId = commentId;
359
+ this.makeDirty(true);
360
+ }
361
+ return commentId !== null;
362
+ }
363
+ render(ctx, _bounds) {
364
+ var _this$_state$focusOut;
365
+ const zoomRatio = this._getZoomRatio();
366
+ this._state.underlines.forEach((underline) => this._renderUnderline(ctx, underline, zoomRatio, 1));
367
+ (_this$_state$focusOut = this._state.focusOutlines) === null || _this$_state$focusOut === void 0 || _this$_state$focusOut.forEach((outline) => this._renderOutline(ctx, outline, zoomRatio));
368
+ if (this._state.previewUnderline) this._renderUnderline(ctx, this._state.previewUnderline, zoomRatio, MARKER_PREVIEW_OPACITY);
369
+ this._state.markers.forEach((marker) => {
370
+ var _this$_state$focusedC;
371
+ return this._renderMarker(ctx, marker, zoomRatio, this._markerContainsComment(marker, this._hoveredCommentId) || ((_this$_state$focusedC = this._state.focusedCommentIds) === null || _this$_state$focusedC === void 0 ? void 0 : _this$_state$focusedC.some((commentId) => this._markerContainsComment(marker, commentId))) ? 1 : MARKER_IDLE_OPACITY);
372
+ });
373
+ if (this._state.previewMarker) this._renderMarker(ctx, this._state.previewMarker, zoomRatio, MARKER_PREVIEW_OPACITY);
374
+ this.makeDirty(false);
375
+ return this;
376
+ }
377
+ _getZoomRatio() {
378
+ return Number.isFinite(this._state.zoomRatio) && this._state.zoomRatio > 0 ? this._state.zoomRatio : 1;
379
+ }
380
+ _containsComment(commentId) {
381
+ return this._state.markers.some((marker) => this._markerContainsComment(marker, commentId)) || this._state.underlines.some((underline) => underline.commentId === commentId);
382
+ }
383
+ _markerContainsComment(marker, commentId) {
384
+ var _marker$commentIds;
385
+ return commentId != null && (marker.commentId === commentId || ((_marker$commentIds = marker.commentIds) === null || _marker$commentIds === void 0 ? void 0 : _marker$commentIds.includes(commentId)) === true);
386
+ }
387
+ _renderUnderline(ctx, underline, zoomRatio, opacity) {
388
+ ctx.save();
389
+ ctx.globalAlpha = opacity;
390
+ ctx.strokeStyle = this._state.accentColor;
391
+ ctx.lineWidth = UNDERLINE_WIDTH / zoomRatio;
392
+ ctx.beginPath();
393
+ ctx.moveTo(underline.left, underline.top);
394
+ ctx.lineTo(underline.left + underline.width, underline.top);
395
+ ctx.stroke();
396
+ ctx.restore();
397
+ }
398
+ _renderOutline(ctx, outline, zoomRatio) {
399
+ const padding = OUTLINE_PADDING / zoomRatio;
400
+ ctx.save();
401
+ ctx.strokeStyle = this._state.accentColor;
402
+ ctx.lineWidth = UNDERLINE_WIDTH / zoomRatio;
403
+ ctx.strokeRect(outline.left - padding, outline.top - padding, outline.width + padding * 2, outline.height + padding * 2);
404
+ ctx.restore();
405
+ }
406
+ _renderMarker(ctx, marker, zoomRatio, opacity) {
407
+ const size = MARKER_SIZE / zoomRatio;
408
+ const left = marker.x - size / 2;
409
+ const top = marker.y - size / 2;
410
+ const radius = 4 / zoomRatio;
411
+ const tail = 4 / zoomRatio;
412
+ ctx.save();
413
+ ctx.globalAlpha = opacity;
414
+ ctx.fillStyle = this._state.accentColor;
415
+ ctx.strokeStyle = this._state.outlineColor;
416
+ ctx.lineWidth = 1.5 / zoomRatio;
417
+ ctx.beginPath();
418
+ ctx.moveTo(left + radius, top);
419
+ ctx.lineTo(left + size - radius, top);
420
+ ctx.quadraticCurveTo(left + size, top, left + size, top + radius);
421
+ ctx.lineTo(left + size, top + size - tail - radius);
422
+ ctx.quadraticCurveTo(left + size, top + size - tail, left + size - radius, top + size - tail);
423
+ ctx.lineTo(left + size / 2 + tail, top + size - tail);
424
+ ctx.lineTo(left + size / 2, top + size);
425
+ ctx.lineTo(left + size / 2 - tail, top + size - tail);
426
+ ctx.lineTo(left + radius, top + size - tail);
427
+ ctx.quadraticCurveTo(left, top + size - tail, left, top + size - tail - radius);
428
+ ctx.lineTo(left, top + radius);
429
+ ctx.quadraticCurveTo(left, top, left + radius, top);
430
+ ctx.closePath();
431
+ ctx.fill();
432
+ ctx.stroke();
433
+ ctx.fillStyle = this._state.foregroundColor;
434
+ if ((marker.count ?? 1) > 1) {
435
+ ctx.font = `600 ${11 / zoomRatio}px ${_univerjs_engine_render.DEFAULT_FONTFACE_PLANE}`;
436
+ ctx.textAlign = "center";
437
+ ctx.textBaseline = "middle";
438
+ ctx.fillText(String(marker.count), marker.x, top + size * .42);
439
+ } else {
440
+ const dotRadius = 1.2 / zoomRatio;
441
+ const dotY = top + size * .43;
442
+ [
443
+ .32,
444
+ .5,
445
+ .68
446
+ ].forEach((ratio) => {
447
+ ctx.beginPath();
448
+ ctx.arc(left + size * ratio, dotY, dotRadius, 0, Math.PI * 2);
449
+ ctx.fill();
450
+ });
451
+ }
452
+ ctx.restore();
453
+ }
454
+ };
455
+
189
456
  //#endregion
190
457
  //#region src/views/thread-comment-panel/util.ts
458
+ function isSameThreadCommentTarget(active, comment) {
459
+ return (active === null || active === void 0 ? void 0 : active.unitId) === comment.unitId && active.subUnitId === comment.subUnitId && active.commentId === comment.id;
460
+ }
461
+ function shouldClearThreadCommentTarget(active, currentUnitId, commentExists) {
462
+ if (!active) return false;
463
+ return active.unitId !== currentUnitId || !commentExists;
464
+ }
191
465
  function getThreadCommentPanelItemKey(comment, index, section) {
192
466
  if (comment.id) return comment.id;
193
467
  return [
@@ -233,7 +507,8 @@ const transformDocument2TextNodes = (doc) => {
233
507
  if (!doc) return [];
234
508
  const { paragraphs = [] } = doc;
235
509
  return paragraphs.map((paragraph, index) => {
236
- const body = (0, _univerjs_core.getBodySlice)(doc, index === 0 ? 0 : paragraphs[index - 1].startIndex + 1, paragraph.startIndex);
510
+ const lastIndex = index === 0 ? 0 : paragraphs[index - 1].startIndex + 1;
511
+ const body = (0, _univerjs_core.getBodySlice)(doc, lastIndex, paragraph.startIndex);
237
512
  return transformDocument2TextNodesInParagraph(body);
238
513
  });
239
514
  };
@@ -259,7 +534,6 @@ const transformTextNodes2Document = (nodes) => {
259
534
  });
260
535
  break;
261
536
  }
262
- default: break;
263
537
  }
264
538
  });
265
539
  str += "\r\n";
@@ -300,29 +574,60 @@ function getSnapshot(body) {
300
574
  };
301
575
  }
302
576
  const ThreadCommentEditor = (0, react.forwardRef)((props, ref) => {
303
- const { comment, onSave, id, onCancel, autoFocus, unitId, type, editorId } = props;
577
+ const { comment, onSave, id, onCancel, autoFocus, unitId, type, editorId, ActionRowComponent = _univerjs_design.ActionRow } = props;
304
578
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
305
579
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
306
580
  const [editing, setEditing] = (0, react.useState)(false);
581
+ const [submitting, setSubmitting] = (0, react.useState)(false);
582
+ const submittingRef = (0, react.useRef)(false);
583
+ const mountedRef = (0, react.useRef)(true);
307
584
  const editorService = (0, _univerjs_ui.useDependency)(_univerjs_docs_ui.IEditorService);
308
- const editor = (0, react.useRef)(null);
585
+ const editorRef = (0, react.useRef)(null);
309
586
  const rootEditorId = type === _univerjs_core.UniverInstanceType.UNIVER_DOC ? _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY : unitId;
310
587
  const [canSubmit, setCanSubmit] = (0, react.useState)(() => {
311
588
  var _comment$text;
312
589
  return _univerjs_core.BuildTextUtils.transform.getPlainText((comment === null || comment === void 0 || (_comment$text = comment.text) === null || _comment$text === void 0 ? void 0 : _comment$text.dataStream) ?? "");
313
590
  });
314
591
  const keyboardEventConfig = (0, react.useMemo)(() => ({
315
- keyCodes: [{ keyCode: _univerjs_ui.KeyCode.ENTER }],
592
+ keyCodes: [
593
+ { keyCode: _univerjs_ui.KeyCode.ENTER },
594
+ { keyCode: _univerjs_ui.KeyCode.BACKSPACE },
595
+ { keyCode: _univerjs_ui.KeyCode.DELETE }
596
+ ],
316
597
  handler: (keyCode) => {
317
- if (keyCode === _univerjs_ui.KeyCode.ENTER) commandService.executeCommand(_univerjs_docs_ui.BreakLineCommand.id);
598
+ let commandId;
599
+ switch (keyCode) {
600
+ case _univerjs_ui.KeyCode.ENTER:
601
+ commandId = _univerjs_docs_ui.BreakLineCommand.id;
602
+ break;
603
+ case _univerjs_ui.KeyCode.BACKSPACE:
604
+ commandId = _univerjs_docs_ui.DeleteLeftCommand.id;
605
+ break;
606
+ case _univerjs_ui.KeyCode.DELETE:
607
+ commandId = _univerjs_docs_ui.DeleteRightCommand.id;
608
+ break;
609
+ default: return;
610
+ }
611
+ focusThreadCommentEditor(editorService, editorId, editorRef.current);
612
+ commandService.executeCommand(commandId).then(() => {
613
+ if (keyCode !== _univerjs_ui.KeyCode.ENTER && mountedRef.current) {
614
+ var _editorRef$current;
615
+ const dataStream = ((_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.getDocumentData().body) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.dataStream) ?? "";
616
+ setCanSubmit(_univerjs_core.BuildTextUtils.transform.getPlainText(dataStream));
617
+ }
618
+ });
318
619
  }
319
- }), [commandService]);
620
+ }), [
621
+ commandService,
622
+ editorId,
623
+ editorService
624
+ ]);
320
625
  (0, react.useImperativeHandle)(ref, () => ({ reply(text) {
321
- var _editor$current;
322
- if (!editor.current) return;
323
- focusThreadCommentEditor(editorService, editorId, editor.current);
626
+ var _editorRef$current2;
627
+ if (!editorRef.current) return;
628
+ focusThreadCommentEditor(editorService, editorId, editorRef.current);
324
629
  const documentData = getSnapshot(text);
325
- (_editor$current = editor.current) === null || _editor$current === void 0 || _editor$current.setDocumentData(documentData, [{
630
+ (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 || _editorRef$current2.setDocumentData(documentData, [{
326
631
  startOffset: documentData.body.dataStream.length - 2,
327
632
  endOffset: documentData.body.dataStream.length - 2,
328
633
  collapsed: true
@@ -330,29 +635,44 @@ const ThreadCommentEditor = (0, react.forwardRef)((props, ref) => {
330
635
  setCanSubmit(_univerjs_core.BuildTextUtils.transform.getPlainText(documentData.body.dataStream));
331
636
  setEditing(true);
332
637
  } }));
333
- const handleSave = () => {
334
- const currentEditor = editor.current;
335
- if (currentEditor) {
336
- const newText = _univerjs_core.Tools.deepClone(currentEditor.getDocumentData().body);
638
+ const handleSave = async () => {
639
+ const currentEditor = editorRef.current;
640
+ if (!currentEditor || submittingRef.current) return;
641
+ const newText = _univerjs_core.Tools.deepClone(currentEditor.getDocumentData().body);
642
+ submittingRef.current = true;
643
+ setSubmitting(true);
644
+ try {
645
+ if (await (onSave === null || onSave === void 0 ? void 0 : onSave({
646
+ ...comment,
647
+ text: newText
648
+ })) === false) return;
649
+ if (!mountedRef.current) return;
337
650
  currentEditor.blur();
338
651
  currentEditor.replaceText("", false);
339
652
  currentEditor.setSelectionRanges([], false);
340
653
  setCanSubmit("");
341
654
  setEditing(false);
342
- onSave === null || onSave === void 0 || onSave({
343
- ...comment,
344
- text: newText
345
- });
655
+ } catch {
656
+ return;
657
+ } finally {
658
+ submittingRef.current = false;
659
+ if (mountedRef.current) setSubmitting(false);
346
660
  }
347
661
  };
348
662
  const handleEditorMouseDown = () => {
349
- focusThreadCommentEditor(editorService, editorId, editor.current);
663
+ focusThreadCommentEditor(editorService, editorId, editorRef.current);
350
664
  setEditing(true);
351
665
  };
666
+ (0, react.useEffect)(() => {
667
+ mountedRef.current = true;
668
+ return () => {
669
+ mountedRef.current = false;
670
+ };
671
+ }, []);
352
672
  (0, react.useEffect)(() => {
353
673
  if (!autoFocus) return;
354
674
  const timer = setTimeout(() => {
355
- focusThreadCommentEditor(editorService, editorId, editor.current);
675
+ focusThreadCommentEditor(editorService, editorId, editorRef.current);
356
676
  });
357
677
  return () => clearTimeout(timer);
358
678
  }, [
@@ -366,7 +686,7 @@ const ThreadCommentEditor = (0, react.forwardRef)((props, ref) => {
366
686
  onMouseDown: handleEditorMouseDown,
367
687
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_docs_ui.RichTextEditor, {
368
688
  className: "univer-w-full",
369
- editorRef: editor,
689
+ editorRef,
370
690
  editorId,
371
691
  preserveHostFocus: true,
372
692
  autoFocus,
@@ -386,12 +706,12 @@ const ThreadCommentEditor = (0, react.forwardRef)((props, ref) => {
386
706
  }, 30);
387
707
  }
388
708
  })
389
- }), editing ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
709
+ }), editing ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ActionRowComponent, {
390
710
  className: "univer-mt-3 univer-flex univer-flex-row univer-justify-end univer-gap-2",
391
711
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
392
712
  type: "button",
393
713
  onClick: () => {
394
- const currentEditor = editor.current;
714
+ const currentEditor = editorRef.current;
395
715
  currentEditor === null || currentEditor === void 0 || currentEditor.blur();
396
716
  currentEditor === null || currentEditor === void 0 || currentEditor.replaceText("", false);
397
717
  currentEditor === null || currentEditor === void 0 || currentEditor.setSelectionRanges([], false);
@@ -404,7 +724,7 @@ const ThreadCommentEditor = (0, react.forwardRef)((props, ref) => {
404
724
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
405
725
  type: "button",
406
726
  variant: "primary",
407
- disabled: !canSubmit,
727
+ disabled: !canSubmit || submitting,
408
728
  onClick: handleSave,
409
729
  children: localeService.t(id ? "thread-comment-ui.editor.save" : "thread-comment-ui.editor.reply")
410
730
  })]
@@ -434,11 +754,12 @@ function formatCommentDateTime(value, region) {
434
754
  });
435
755
  }
436
756
  const ThreadCommentItem = (props) => {
437
- const { item, unitId, subUnitId, editing, onEditingChange, onReply, resolved, isRoot, onClose, onDeleteComment, type, threadCommentEditorId } = props;
757
+ const { item, unitId, subUnitId, editing, onEditingChange, onReply, resolved, isRoot, onClose, onDeleteComment, onAfterDeleteComment, type, threadCommentEditorId, DropdownComponent, EditorComponent } = props;
438
758
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
439
759
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
440
760
  const regionService = (0, _univerjs_ui.useDependency)(_univerjs_core.RegionService);
441
761
  const userManagerService = (0, _univerjs_ui.useDependency)(_univerjs_core.UserManagerService);
762
+ (0, _univerjs_ui.useObservable)(userManagerService.userChange$);
442
763
  const user = userManagerService.getUser(item.personId);
443
764
  const currentUser = (0, _univerjs_ui.useObservable)(userManagerService.currentUser$);
444
765
  const isCommentBySelf = (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID) === item.personId;
@@ -449,14 +770,20 @@ const ThreadCommentItem = (props) => {
449
770
  const currentRegion = (0, _univerjs_ui.useObservable)(regionService.currentRegion$, regionService.getCurrentRegion());
450
771
  const direction = (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection());
451
772
  const dateText = isMock ? null : formatCommentDateTime(item.dT, currentRegion);
452
- const handleDeleteItem = () => {
773
+ const handleDeleteItem = async () => {
453
774
  if ((onDeleteComment === null || onDeleteComment === void 0 ? void 0 : onDeleteComment(item)) === false) return;
454
- commandService.executeCommand(isRoot ? _univerjs_thread_comment.DeleteCommentTreeCommand.id : _univerjs_thread_comment.DeleteCommentCommand.id, {
455
- unitId,
456
- subUnitId,
457
- commentId: item.id
458
- });
459
- if (isRoot) onClose === null || onClose === void 0 || onClose();
775
+ try {
776
+ if (await commandService.executeCommand(isRoot ? _univerjs_thread_comment.DeleteCommentTreeCommand.id : _univerjs_thread_comment.DeleteCommentCommand.id, {
777
+ unitId,
778
+ subUnitId,
779
+ commentId: item.id
780
+ })) {
781
+ try {
782
+ await (onAfterDeleteComment === null || onAfterDeleteComment === void 0 ? void 0 : onAfterDeleteComment(item));
783
+ } catch {}
784
+ if (isRoot) onClose === null || onClose === void 0 || onClose();
785
+ }
786
+ } catch {}
460
787
  };
461
788
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
462
789
  className: "univer-relative univer-mb-3 univer-pl-[30px] rtl:univer-pl-0 rtl:univer-pr-[30px]",
@@ -467,44 +794,52 @@ const ThreadCommentItem = (props) => {
467
794
  className: "univer-absolute univer-left-0 univer-top-0 univer-size-6 univer-rounded-full univer-bg-cover univer-bg-center univer-bg-no-repeat rtl:univer-left-auto rtl:univer-right-0",
468
795
  style: { backgroundImage: `url(${(user === null || user === void 0 ? void 0 : user.avatar) || avatarFallback})` }
469
796
  }),
470
- user ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
797
+ user || item.authorName ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
471
798
  className: "univer-mb-1 univer-flex univer-h-6 univer-items-center univer-justify-between",
472
799
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
473
800
  className: "univer-text-sm univer-font-medium univer-leading-5",
474
- children: (user === null || user === void 0 ? void 0 : user.name) || " "
475
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [isMock || resolved ? null : showReply && user ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
476
- className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
801
+ children: (user === null || user === void 0 ? void 0 : user.name) || item.authorName || " "
802
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [isMock || resolved ? null : showReply && user ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
803
+ type: "button",
804
+ "aria-label": localeService.t("thread-comment-ui.editor.reply"),
805
+ className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
477
806
  onClick: () => onReply(user),
478
807
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ReplyToCommentIcon, {})
479
- }) : null, isCommentBySelf && !isMock && !resolved ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
808
+ }) : null, isCommentBySelf && !isMock && !resolved ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownComponent, {
480
809
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
481
810
  dir: direction,
482
811
  className: "univer-rounded-lg",
483
812
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ul", {
484
- className: "univer-m-0 univer-box-border univer-grid univer-list-none univer-p-1.5 univer-text-sm rtl:univer-text-right [&_a]:univer-block [&_a]:univer-cursor-pointer [&_a]:univer-rounded [&_a]:univer-px-2 [&_a]:univer-py-1.5 [&_a]:univer-transition-colors",
485
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
813
+ className: "univer-m-0 univer-box-border univer-grid univer-list-none univer-p-1.5 univer-text-sm rtl:univer-text-right [&_button]:univer-block [&_button]:univer-w-full [&_button]:univer-cursor-pointer [&_button]:univer-rounded [&_button]:univer-border-0 [&_button]:univer-bg-transparent [&_button]:univer-px-2 [&_button]:univer-py-1.5 [&_button]:univer-text-left [&_button]:univer-transition-colors rtl:[&_button]:univer-text-right",
814
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
815
+ type: "button",
486
816
  className: "hover:univer-bg-gray-200",
487
817
  onClick: () => onEditingChange === null || onEditingChange === void 0 ? void 0 : onEditingChange(true),
488
818
  children: localeService.t("thread-comment-ui.item.edit")
489
- }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
819
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
820
+ type: "button",
490
821
  className: "hover:univer-bg-gray-200",
491
822
  onClick: handleDeleteItem,
492
823
  children: localeService.t("thread-comment-ui.item.delete")
493
824
  }) })]
494
825
  })
495
826
  }),
496
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
497
- className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
827
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
828
+ type: "button",
829
+ "aria-label": localeService.t("thread-comment-ui.item.more"),
830
+ className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
498
831
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreHorizontalIcon, {})
499
832
  })
500
833
  }) : null] })]
501
834
  }) : null,
502
835
  dateText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
503
- dir: "ltr",
504
836
  className: "univer-mb-1 univer-block univer-text-xs/normal univer-text-gray-600 rtl:univer-text-right dark:!univer-text-gray-200",
505
- children: dateText
837
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("bdo", {
838
+ dir: "ltr",
839
+ children: dateText
840
+ })
506
841
  }),
507
- editing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentEditor, {
842
+ editing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorComponent, {
508
843
  type,
509
844
  id: item.id,
510
845
  comment: item,
@@ -513,9 +848,8 @@ const ThreadCommentItem = (props) => {
513
848
  unitId,
514
849
  subUnitId,
515
850
  editorId: threadCommentEditorId,
516
- onSave: ({ text, attachments }) => {
517
- onEditingChange === null || onEditingChange === void 0 || onEditingChange(false);
518
- commandService.executeCommand(_univerjs_thread_comment.UpdateCommentCommand.id, {
851
+ onSave: async ({ text, attachments }) => {
852
+ const success = await commandService.executeCommand(_univerjs_thread_comment.UpdateCommentCommand.id, {
519
853
  unitId,
520
854
  subUnitId,
521
855
  payload: {
@@ -524,27 +858,35 @@ const ThreadCommentItem = (props) => {
524
858
  attachments
525
859
  }
526
860
  });
861
+ if (success) onEditingChange === null || onEditingChange === void 0 || onEditingChange(false);
862
+ return success;
527
863
  }
528
864
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
529
- className: "univer-text-sm univer-text-gray-900 dark:!univer-text-white",
530
- children: transformDocument2TextNodes(item.text).map((paragraph, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
531
- className: "univer-break-words",
532
- children: paragraph.map((item, i) => {
533
- switch (item.type) {
534
- case "mention": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
535
- className: "univer-text-primary-600",
536
- children: [item.content.label, " "]
537
- }, i);
538
- default: return item.content;
539
- }
540
- })
541
- }, i))
865
+ className: "univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0",
866
+ children: transformDocument2TextNodes(item.text).map((paragraph, paragraphIndex) => {
867
+ var _item$text$paragraphs;
868
+ let offset = 0;
869
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
870
+ className: "univer-break-words",
871
+ children: paragraph.map((node) => {
872
+ const key = offset;
873
+ offset += node.type === "mention" ? node.content.label.length : node.content.length;
874
+ switch (node.type) {
875
+ case "mention": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
876
+ className: "univer-text-primary-600",
877
+ children: [node.content.label, " "]
878
+ }, key);
879
+ default: return node.content;
880
+ }
881
+ })
882
+ }, (_item$text$paragraphs = item.text.paragraphs) === null || _item$text$paragraphs === void 0 || (_item$text$paragraphs = _item$text$paragraphs[paragraphIndex]) === null || _item$text$paragraphs === void 0 ? void 0 : _item$text$paragraphs.paragraphId);
883
+ })
542
884
  })
543
885
  ]
544
886
  });
545
887
  };
546
888
  const ThreadCommentTree = (props) => {
547
- const { id, unitId, subUnitId, refStr, showEdit = true, onClick, showHighlight, onClose, getSubUnitName, location, autoFocus, onMouseEnter, onMouseLeave, onAddComment, onDeleteComment, onResolve, type, style, full } = props;
889
+ const { id, unitId, subUnitId, refStr, displayRef, showEdit = true, onClick, showHighlight, onClose, getSubUnitName, location, autoFocus, onMouseEnter, onMouseLeave, onAddComment, onDeleteComment, onAfterDeleteComment, onResolve, type, style, full, DropdownComponent = _univerjs_design.Dropdown, EditorComponent = ThreadCommentEditor } = props;
548
890
  const threadCommentModel = (0, _univerjs_ui.useDependency)(_univerjs_thread_comment.ThreadCommentModel);
549
891
  const [isHover, setIsHover] = (0, react.useState)(false);
550
892
  const [editingId, setEditingId] = (0, react.useState)("");
@@ -557,6 +899,7 @@ const ThreadCommentTree = (props) => {
557
899
  updte$
558
900
  ]);
559
901
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
902
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
560
903
  const userManagerService = (0, _univerjs_ui.useDependency)(_univerjs_core.UserManagerService);
561
904
  const resolved = comments === null || comments === void 0 ? void 0 : comments.root.resolved;
562
905
  const currentUser = (0, _univerjs_ui.useObservable)(userManagerService.currentUser$);
@@ -572,40 +915,49 @@ const ThreadCommentTree = (props) => {
572
915
  subUnitId,
573
916
  threadId: ""
574
917
  }], ...(comments === null || comments === void 0 ? void 0 : comments.children) ?? []];
575
- const scroller = (0, react.useRef)(null);
576
- const handleResolve = (e) => {
918
+ const scrollerRef = (0, react.useRef)(null);
919
+ const handleMouseLeave = (0, _univerjs_ui.useEvent)(onMouseLeave);
920
+ const handleResolve = async (e) => {
577
921
  e.stopPropagation();
578
- if (!resolved) commandService.executeCommand(SetActiveCommentOperation.id);
579
- else commandService.executeCommand(SetActiveCommentOperation.id, {
580
- unitId,
581
- subUnitId,
582
- commentId: id
583
- });
584
- commandService.executeCommand(_univerjs_thread_comment.ResolveCommentCommand.id, {
585
- unitId,
586
- subUnitId,
587
- commentId: id,
588
- resolved: !resolved
589
- });
590
- onResolve === null || onResolve === void 0 || onResolve(!resolved);
922
+ try {
923
+ if (!await commandService.executeCommand(_univerjs_thread_comment.ResolveCommentCommand.id, {
924
+ unitId,
925
+ subUnitId,
926
+ commentId: id,
927
+ resolved: !resolved
928
+ })) return;
929
+ await commandService.executeCommand(SetActiveCommentOperation.id, resolved ? {
930
+ unitId,
931
+ subUnitId,
932
+ commentId: id
933
+ } : void 0);
934
+ onResolve === null || onResolve === void 0 || onResolve(!resolved);
935
+ } catch {}
591
936
  };
592
- const handleDeleteRoot = (e) => {
937
+ const handleDeleteRoot = async (e) => {
593
938
  e.stopPropagation();
594
- commandService.executeCommand(SetActiveCommentOperation.id);
595
- if ((comments === null || comments === void 0 ? void 0 : comments.root) && (onDeleteComment === null || onDeleteComment === void 0 ? void 0 : onDeleteComment(comments.root)) === false) return;
596
- commandService.executeCommand(_univerjs_thread_comment.DeleteCommentTreeCommand.id, {
597
- unitId,
598
- subUnitId,
599
- commentId: id
600
- });
601
- onClose === null || onClose === void 0 || onClose();
939
+ const root = comments === null || comments === void 0 ? void 0 : comments.root;
940
+ if (!root || (onDeleteComment === null || onDeleteComment === void 0 ? void 0 : onDeleteComment(root)) === false) return;
941
+ try {
942
+ if (await commandService.executeCommand(_univerjs_thread_comment.DeleteCommentTreeCommand.id, {
943
+ unitId,
944
+ subUnitId,
945
+ commentId: id
946
+ })) {
947
+ try {
948
+ await (onAfterDeleteComment === null || onAfterDeleteComment === void 0 ? void 0 : onAfterDeleteComment(root));
949
+ } catch {}
950
+ await commandService.executeCommand(SetActiveCommentOperation.id);
951
+ onClose === null || onClose === void 0 || onClose();
952
+ }
953
+ } catch {}
602
954
  };
603
955
  (0, react.useEffect)(() => {
604
- return onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
605
- }, []);
956
+ return handleMouseLeave;
957
+ }, [handleMouseLeave]);
606
958
  const subUnitName = getSubUnitName((comments === null || comments === void 0 ? void 0 : comments.root.subUnitId) ?? subUnitId);
607
959
  const editorVisible = showEdit && !editingId && !resolved;
608
- const title = `${refStr || (comments === null || comments === void 0 ? void 0 : comments.root.ref) || ""}${subUnitName ? " · " : ""}${subUnitName}`;
960
+ const title = `${displayRef ?? refStr ?? (comments === null || comments === void 0 ? void 0 : comments.root.ref) ?? ""}${subUnitName ? " · " : ""}${subUnitName}`;
609
961
  const threadCommentEditorId = getThreadCommentEditorId({
610
962
  location,
611
963
  unitId,
@@ -615,7 +967,7 @@ const ThreadCommentTree = (props) => {
615
967
  });
616
968
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
617
969
  id: `${location}-${unitId}-${subUnitId}-${id}`,
618
- className: (0, _univerjs_design.clsx)("univer-relative univer-box-border univer-rounded-md univer-bg-white univer-p-4 univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white", _univerjs_design.borderClassName, {
970
+ className: (0, _univerjs_design.clsx)("univer-relative univer-box-border univer-rounded-md univer-bg-gray-0 univer-p-4 univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-gray-0", _univerjs_design.borderClassName, {
619
971
  "univer-w-[278px]": !full,
620
972
  "univer-w-full": full,
621
973
  "univer-shadow": !resolved && (showHighlight || isHover || location === "CELL")
@@ -646,19 +998,23 @@ const ThreadCommentTree = (props) => {
646
998
  })]
647
999
  }), !!comments && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
648
1000
  className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row",
649
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
650
- className: (0, _univerjs_design.clsx)("univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800", { "univer-text-green-500": resolved }),
1001
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1002
+ type: "button",
1003
+ "aria-label": localeService.t(resolved ? "thread-comment-ui.filter.status.unsolved" : "thread-comment-ui.filter.status.resolved"),
1004
+ className: (0, _univerjs_design.clsx)("univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800", { "univer-text-green-500": resolved }),
651
1005
  onClick: handleResolve,
652
1006
  children: resolved ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SuccessIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SuccessOutlineIcon, {})
653
- }), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID) === comments.root.personId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
654
- className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
1007
+ }), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID) === comments.root.personId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1008
+ type: "button",
1009
+ "aria-label": localeService.t("thread-comment-ui.item.delete"),
1010
+ className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
655
1011
  onClick: handleDeleteRoot,
656
1012
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteIcon, {})
657
1013
  }) : null]
658
1014
  })]
659
1015
  }),
660
1016
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
661
- ref: scroller,
1017
+ ref: scrollerRef,
662
1018
  className: (0, _univerjs_design.clsx)("univer-max-h-80 univer-overflow-y-auto univer-overflow-x-hidden", _univerjs_design.scrollbarClassName, location === "PANEL" && "-univer-mx-4 univer-px-4"),
663
1019
  children: renderComments.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentItem, {
664
1020
  unitId,
@@ -669,6 +1025,8 @@ const ThreadCommentTree = (props) => {
669
1025
  resolved: comments === null || comments === void 0 ? void 0 : comments.root.resolved,
670
1026
  type,
671
1027
  threadCommentEditorId,
1028
+ DropdownComponent,
1029
+ EditorComponent,
672
1030
  onClose,
673
1031
  onEditingChange: (editing) => {
674
1032
  if (editing) setEditingId(item.id);
@@ -690,11 +1048,11 @@ const ThreadCommentTree = (props) => {
690
1048
  }]));
691
1049
  });
692
1050
  },
693
- onAddComment,
694
- onDeleteComment
1051
+ onDeleteComment,
1052
+ onAfterDeleteComment
695
1053
  }, item.id))
696
1054
  }),
697
- editorVisible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentEditor, {
1055
+ editorVisible && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EditorComponent, {
698
1056
  ref: editorRef,
699
1057
  type,
700
1058
  unitId,
@@ -713,13 +1071,18 @@ const ThreadCommentTree = (props) => {
713
1071
  subUnitId,
714
1072
  threadId: (comments === null || comments === void 0 ? void 0 : comments.root.threadId) ?? ""
715
1073
  };
716
- if ((onAddComment === null || onAddComment === void 0 ? void 0 : onAddComment(comment)) === false) return;
717
- await commandService.executeCommand(_univerjs_thread_comment.AddCommentCommand.id, {
1074
+ if (await (onAddComment === null || onAddComment === void 0 ? void 0 : onAddComment(comment)) === false) {
1075
+ if (!comments) onClose === null || onClose === void 0 || onClose();
1076
+ return true;
1077
+ }
1078
+ const success = await commandService.executeCommand(_univerjs_thread_comment.AddCommentCommand.id, {
718
1079
  unitId,
719
1080
  subUnitId,
720
1081
  comment
721
1082
  });
722
- if (scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight;
1083
+ if (success && scrollerRef.current) scrollerRef.current.scrollTop = scrollerRef.current.scrollHeight;
1084
+ if (success && !comments) onClose === null || onClose === void 0 || onClose();
1085
+ return success;
723
1086
  },
724
1087
  autoFocus: autoFocus || !comments,
725
1088
  onCancel: () => {
@@ -730,25 +1093,317 @@ const ThreadCommentTree = (props) => {
730
1093
  });
731
1094
  };
732
1095
 
1096
+ //#endregion
1097
+ //#region src/views/mobile/MobileThreadCommentEditor.tsx
1098
+ const MobileThreadCommentEditor = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentEditor, {
1099
+ ...props,
1100
+ ref,
1101
+ ActionRowComponent: _univerjs_design.MobileActionRowGroup
1102
+ }));
1103
+
1104
+ //#endregion
1105
+ //#region src/views/mobile/MobileThreadCommentTree.tsx
1106
+ function MobileThreadCommentTree(props) {
1107
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentTree, {
1108
+ ...props,
1109
+ DropdownComponent: _univerjs_design.MobileDropdown,
1110
+ EditorComponent: MobileThreadCommentEditor
1111
+ });
1112
+ }
1113
+
1114
+ //#endregion
1115
+ //#region src/views/mobile/MobileThreadCommentPanel.tsx
1116
+ function MobileCommentFilter({ value, options = [], onChange }) {
1117
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1118
+ className: "univer-flex univer-gap-1 univer-overflow-x-auto univer-rounded-xl univer-bg-gray-100 univer-p-1 dark:!univer-bg-gray-800",
1119
+ children: options.flatMap((option) => option.options ?? [option]).map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1120
+ type: "button",
1121
+ "aria-pressed": option.value === value,
1122
+ className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, "univer-h-10 univer-shrink-0 univer-rounded-lg univer-px-3 univer-text-sm univer-text-gray-700 active:univer-scale-95 dark:!univer-text-gray-200", option.value === value && "univer-bg-gray-0 univer-font-medium univer-text-primary-600 univer-shadow-sm dark:!univer-bg-gray-700 dark:!univer-text-primary-300"),
1123
+ onClick: () => option.value != null && (onChange === null || onChange === void 0 ? void 0 : onChange(option.value)),
1124
+ children: option.label
1125
+ }, option.value))
1126
+ });
1127
+ }
1128
+ function MobileCommentHeader({ comment: activeComment, displayRef }) {
1129
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1130
+ const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
1131
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1132
+ className: "univer-mt-2 univer-flex univer-min-h-12 univer-items-center univer-gap-2 univer-border-0 univer-border-b univer-border-solid univer-border-gray-200 univer-pb-2 dark:!univer-border-gray-700",
1133
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1134
+ type: "button",
1135
+ "aria-label": localeService.t("thread-comment-ui.mobile.back"),
1136
+ className: `
1137
+ ${_univerjs_design.resetButtonClassName}
1138
+ univer-flex univer-size-12 univer-shrink-0 univer-items-center univer-justify-center univer-rounded-xl
1139
+ univer-text-2xl univer-text-gray-700
1140
+ active:univer-bg-gray-100
1141
+ dark:!univer-text-gray-200
1142
+ dark:active:!univer-bg-gray-700
1143
+ `,
1144
+ onClick: () => commandService.executeCommand(SetActiveCommentOperation.id),
1145
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, {})
1146
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1147
+ className: "univer-min-w-0 univer-flex-1",
1148
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1149
+ className: "univer-truncate univer-text-base univer-font-semibold univer-text-gray-900 dark:!univer-text-gray-0",
1150
+ children: localeService.t("thread-comment-ui.panel.title")
1151
+ }), activeComment.ref && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1152
+ className: "univer-truncate univer-text-xs univer-text-gray-500 dark:!univer-text-gray-400",
1153
+ children: displayRef ?? activeComment.ref
1154
+ })]
1155
+ })]
1156
+ });
1157
+ }
1158
+ function MobileAddComment({ onAdd }) {
1159
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1160
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileActionRowGroup, {
1161
+ className: "univer-mt-3",
1162
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.Button, {
1163
+ className: "univer-w-full",
1164
+ onClick: onAdd,
1165
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.IncreaseIcon, { className: "univer-mr-1.5" }), localeService.t("thread-comment-ui.panel.addComment")]
1166
+ })
1167
+ });
1168
+ }
1169
+ function MobileThreadCommentPanel(props) {
1170
+ const { unitId, subUnitId$, type, onAdd, getSubUnitName, onResolve, sortComments, onItemLeave, onItemEnter, disableAdd, tempComment, onAddComment, onDeleteComment, onAfterDeleteComment, showComments, formatRef, onTempCommentClose, autoFocusActiveComment = false } = props;
1171
+ const [unit, setUnit] = (0, react.useState)("all");
1172
+ const [status, setStatus] = (0, react.useState)("all");
1173
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
1174
+ const userService = (0, _univerjs_ui.useDependency)(_univerjs_core.UserManagerService);
1175
+ const threadCommentModel = (0, _univerjs_ui.useDependency)(_univerjs_thread_comment.ThreadCommentModel);
1176
+ const panelService = (0, _univerjs_ui.useDependency)(ThreadCommentPanelService);
1177
+ const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
1178
+ const activeCommentId = (0, _univerjs_ui.useObservable)(panelService.activeCommentId$);
1179
+ (0, _univerjs_ui.useObservable)(threadCommentModel.commentUpdate$);
1180
+ const subUnitId = (0, _univerjs_ui.useObservable)(subUnitId$);
1181
+ const currentUser = (0, _univerjs_ui.useObservable)(userService.currentUser$);
1182
+ const shouldScrollRef = (0, react.useRef)(true);
1183
+ const location = "PANEL";
1184
+ const unitComments = threadCommentModel.getUnit(unitId);
1185
+ const scopedTempComment = (tempComment === null || tempComment === void 0 ? void 0 : tempComment.unitId) === unitId ? tempComment : null;
1186
+ const activeExists = activeCommentId ? Boolean(threadCommentModel.getComment(activeCommentId.unitId, activeCommentId.subUnitId, activeCommentId.commentId) || scopedTempComment && isSameThreadCommentTarget(activeCommentId, scopedTempComment)) : false;
1187
+ const shouldClearActiveTarget = shouldClearThreadCommentTarget(activeCommentId, unitId, activeExists);
1188
+ const comments = (0, react.useMemo)(() => {
1189
+ const allComments = unit === "all" && type !== _univerjs_core.UniverInstanceType.UNIVER_SLIDE ? unitComments : unitComments.filter((comment) => comment.subUnitId === subUnitId);
1190
+ const sortedComments = sortComments ?? ((commentList) => commentList);
1191
+ const result = allComments.map((comment) => ({
1192
+ ...comment.root,
1193
+ children: comment.children ?? [],
1194
+ users: comment.relativeUsers
1195
+ }));
1196
+ if (!showComments) return sortedComments(result);
1197
+ const commentMap = new Map(result.map((comment) => [comment.id, comment]));
1198
+ return [...showComments, ""].map((id) => commentMap.get(id)).filter(Boolean);
1199
+ }, [
1200
+ showComments,
1201
+ sortComments,
1202
+ subUnitId,
1203
+ type,
1204
+ unit,
1205
+ unitComments
1206
+ ]);
1207
+ const commentsSorted = (0, react.useMemo)(() => [...comments.filter((comment) => !comment.resolved), ...comments.filter((comment) => comment.resolved)], [comments]);
1208
+ const statusComments = (0, react.useMemo)(() => {
1209
+ if (status === "resolved") return commentsSorted.filter((comment) => comment.resolved);
1210
+ if (status === "unsolved") return commentsSorted.filter((comment) => !comment.resolved);
1211
+ if (status === "concern_me" && (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID)) return commentsSorted.filter((comment) => comment.users.has(currentUser.userID));
1212
+ return commentsSorted;
1213
+ }, [
1214
+ commentsSorted,
1215
+ currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID,
1216
+ status
1217
+ ]);
1218
+ const renderComments = scopedTempComment ? [scopedTempComment, ...statusComments] : statusComments;
1219
+ const activeComment = activeCommentId ? renderComments.find((comment) => isSameThreadCommentTarget(activeCommentId, comment)) : void 0;
1220
+ const visibleComments = activeComment ? [activeComment] : renderComments;
1221
+ const unsolvedComments = visibleComments.filter((comment) => !comment.resolved);
1222
+ const solvedComments = visibleComments.filter((comment) => comment.resolved);
1223
+ const isFiltering = status !== "all" || unit !== "all";
1224
+ const unitFilterOptions = [{
1225
+ value: "current",
1226
+ label: localeService.t("thread-comment-ui.filter.sheet.current")
1227
+ }, {
1228
+ value: "all",
1229
+ label: localeService.t("thread-comment-ui.filter.sheet.all")
1230
+ }];
1231
+ const statusFilterOptions = [
1232
+ {
1233
+ value: "all",
1234
+ label: localeService.t("thread-comment-ui.filter.status.all")
1235
+ },
1236
+ {
1237
+ value: "resolved",
1238
+ label: localeService.t("thread-comment-ui.filter.status.resolved")
1239
+ },
1240
+ {
1241
+ value: "unsolved",
1242
+ label: localeService.t("thread-comment-ui.filter.status.unsolved")
1243
+ },
1244
+ {
1245
+ value: "concern_me",
1246
+ label: localeService.t("thread-comment-ui.filter.status.concernMe")
1247
+ }
1248
+ ];
1249
+ const handleReset = () => {
1250
+ setStatus("all");
1251
+ setUnit("all");
1252
+ };
1253
+ (0, react.useEffect)(() => {
1254
+ if (shouldClearActiveTarget) panelService.setActiveComment(void 0);
1255
+ }, [panelService, shouldClearActiveTarget]);
1256
+ (0, react.useEffect)(() => {
1257
+ if (tempComment && (tempComment.unitId !== unitId || subUnitId && tempComment.subUnitId !== subUnitId)) onTempCommentClose === null || onTempCommentClose === void 0 || onTempCommentClose();
1258
+ }, [
1259
+ onTempCommentClose,
1260
+ subUnitId,
1261
+ tempComment,
1262
+ unitId
1263
+ ]);
1264
+ (0, react.useEffect)(() => {
1265
+ if (!activeCommentId) return;
1266
+ const handlePointerDown = (event) => {
1267
+ const activeTarget = panelService.activeCommentId;
1268
+ const target = event.target;
1269
+ if (event.button !== 0 || !activeTarget || !(target instanceof Element)) return;
1270
+ const activeElement = document.getElementById(`${location}-${activeTarget.unitId}-${activeTarget.subUnitId}-${activeTarget.commentId}`);
1271
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.contains(target)) || target.closest("button, input, textarea, select, a, [contenteditable=\"true\"], [role=\"menu\"], [role=\"menuitem\"], [role=\"option\"], [role=\"listbox\"], [role=\"combobox\"], [role=\"separator\"]")) return;
1272
+ commandService.executeCommand(SetActiveCommentOperation.id);
1273
+ if (scopedTempComment && isSameThreadCommentTarget(activeTarget, scopedTempComment)) onTempCommentClose === null || onTempCommentClose === void 0 || onTempCommentClose();
1274
+ };
1275
+ document.addEventListener("pointerdown", handlePointerDown, true);
1276
+ return () => document.removeEventListener("pointerdown", handlePointerDown, true);
1277
+ }, [
1278
+ activeCommentId,
1279
+ commandService,
1280
+ location,
1281
+ onTempCommentClose,
1282
+ panelService,
1283
+ scopedTempComment
1284
+ ]);
1285
+ (0, react.useEffect)(() => {
1286
+ var _document$getElementB;
1287
+ if (!activeCommentId) return;
1288
+ if (!shouldScrollRef.current) {
1289
+ shouldScrollRef.current = true;
1290
+ return;
1291
+ }
1292
+ const { unitId: activeUnitId, subUnitId: activeSubUnitId, commentId } = activeCommentId;
1293
+ (_document$getElementB = document.getElementById(`${location}-${activeUnitId}-${activeSubUnitId}-${commentId}`)) === null || _document$getElementB === void 0 || _document$getElementB.scrollIntoView({ block: "center" });
1294
+ }, [activeCommentId, location]);
1295
+ const renderComment = (section) => (comment, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileThreadCommentTree, {
1296
+ full: true,
1297
+ location,
1298
+ getSubUnitName,
1299
+ id: comment.id,
1300
+ unitId: comment.unitId,
1301
+ subUnitId: comment.subUnitId,
1302
+ refStr: comment.ref,
1303
+ displayRef: formatRef === null || formatRef === void 0 ? void 0 : formatRef(comment),
1304
+ type,
1305
+ showEdit: !comment.id || isSameThreadCommentTarget(activeCommentId, comment),
1306
+ showHighlight: isSameThreadCommentTarget(activeCommentId, comment),
1307
+ autoFocus: autoFocusActiveComment && isSameThreadCommentTarget(activeCommentId, comment),
1308
+ onClick: () => {
1309
+ shouldScrollRef.current = false;
1310
+ if (comment.resolved) {
1311
+ commandService.executeCommand(SetActiveCommentOperation.id);
1312
+ return;
1313
+ }
1314
+ commandService.executeCommand(SetActiveCommentOperation.id, {
1315
+ unitId: comment.unitId,
1316
+ subUnitId: comment.subUnitId,
1317
+ commentId: comment.id,
1318
+ temp: false
1319
+ });
1320
+ },
1321
+ onMouseEnter: () => {
1322
+ panelService.setHoveredComment({
1323
+ unitId: comment.unitId,
1324
+ subUnitId: comment.subUnitId,
1325
+ commentId: comment.id,
1326
+ trigger: "panel-hover"
1327
+ });
1328
+ onItemEnter === null || onItemEnter === void 0 || onItemEnter(comment);
1329
+ },
1330
+ onMouseLeave: () => {
1331
+ if (isSameThreadCommentTarget(panelService.hoveredCommentId, comment)) panelService.setHoveredComment(void 0);
1332
+ onItemLeave === null || onItemLeave === void 0 || onItemLeave(comment);
1333
+ },
1334
+ onAddComment,
1335
+ onDeleteComment,
1336
+ onAfterDeleteComment,
1337
+ onResolve: (resolved) => onResolve === null || onResolve === void 0 ? void 0 : onResolve(comment.id, resolved),
1338
+ onClose: !comment.id ? onTempCommentClose : void 0
1339
+ }, getThreadCommentPanelItemKey(comment, index, section));
1340
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1341
+ className: "univer-flex univer-min-h-full univer-flex-col univer-pb-3",
1342
+ children: [
1343
+ activeComment && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileCommentHeader, {
1344
+ comment: activeComment,
1345
+ displayRef: formatRef === null || formatRef === void 0 ? void 0 : formatRef(activeComment)
1346
+ }),
1347
+ !activeComment && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1348
+ className: "univer-mt-3 univer-flex univer-flex-col univer-gap-2",
1349
+ children: [type === _univerjs_core.UniverInstanceType.UNIVER_SHEET && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileCommentFilter, {
1350
+ value: unit,
1351
+ options: unitFilterOptions,
1352
+ onChange: setUnit
1353
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileCommentFilter, {
1354
+ value: status,
1355
+ options: statusFilterOptions,
1356
+ onChange: setStatus
1357
+ })]
1358
+ }),
1359
+ !activeComment && !disableAdd && !scopedTempComment && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileAddComment, { onAdd }),
1360
+ visibleComments.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1361
+ className: "univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
1362
+ children: [localeService.t("thread-comment-ui.panel.empty"), isFiltering ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileActionRowGroup, {
1363
+ className: "univer-mt-2 univer-flex univer-flex-row",
1364
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
1365
+ onClick: handleReset,
1366
+ children: localeService.t("thread-comment-ui.panel.reset")
1367
+ })
1368
+ }) : null]
1369
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1370
+ className: "univer-mt-3 univer-flex univer-flex-col univer-gap-3",
1371
+ children: [
1372
+ unsolvedComments.map(renderComment("unsolved")),
1373
+ solvedComments.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1374
+ className: "univer-text-xs",
1375
+ children: localeService.t("thread-comment-ui.panel.solved")
1376
+ }),
1377
+ solvedComments.map(renderComment("solved"))
1378
+ ]
1379
+ })
1380
+ ]
1381
+ });
1382
+ }
1383
+
733
1384
  //#endregion
734
1385
  //#region src/views/ThreadCommentPanel.tsx
735
1386
  const ThreadCommentPanel = (props) => {
736
- const { unitId, subUnitId$, type, onAdd, getSubUnitName, onResolve, sortComments, onItemLeave, onItemEnter, disableAdd, tempComment, onAddComment, onDeleteComment, showComments } = props;
1387
+ const { unitId, subUnitId$, type, onAdd, getSubUnitName, onResolve, sortComments, onItemLeave, onItemEnter, disableAdd, tempComment, onAddComment, onDeleteComment, onAfterDeleteComment, showComments, formatRef, onTempCommentClose, autoFocusActiveComment = false } = props;
737
1388
  const [unit, setUnit] = (0, react.useState)("all");
738
1389
  const [status, setStatus] = (0, react.useState)("all");
739
1390
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
740
1391
  const userService = (0, _univerjs_ui.useDependency)(_univerjs_core.UserManagerService);
741
1392
  const threadCommentModel = (0, _univerjs_ui.useDependency)(_univerjs_thread_comment.ThreadCommentModel);
742
- const [unitComments, setUnitComments] = (0, react.useState)(() => threadCommentModel.getUnit(unitId));
743
- const activeCommentId = (0, _univerjs_ui.useObservable)((0, _univerjs_ui.useDependency)(ThreadCommentPanelService).activeCommentId$);
744
- const update = (0, _univerjs_ui.useObservable)(threadCommentModel.commentUpdate$);
1393
+ const panelService = (0, _univerjs_ui.useDependency)(ThreadCommentPanelService);
1394
+ const activeCommentId = (0, _univerjs_ui.useObservable)(panelService.activeCommentId$);
1395
+ (0, _univerjs_ui.useObservable)(threadCommentModel.commentUpdate$);
1396
+ const unitComments = threadCommentModel.getUnit(unitId);
1397
+ const scopedTempComment = (tempComment === null || tempComment === void 0 ? void 0 : tempComment.unitId) === unitId ? tempComment : null;
1398
+ const activeExists = activeCommentId ? Boolean(threadCommentModel.getComment(activeCommentId.unitId, activeCommentId.subUnitId, activeCommentId.commentId) || scopedTempComment && isSameThreadCommentTarget(activeCommentId, scopedTempComment)) : false;
1399
+ const shouldClearActiveTarget = shouldClearThreadCommentTarget(activeCommentId, unitId, activeExists);
745
1400
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
746
1401
  const subUnitId = (0, _univerjs_ui.useObservable)(subUnitId$);
747
- const shouldScroll = (0, react.useRef)(true);
1402
+ const shouldScrollRef = (0, react.useRef)(true);
748
1403
  const location = "PANEL";
749
1404
  const currentUser = (0, _univerjs_ui.useObservable)(userService.currentUser$);
750
1405
  const comments = (0, react.useMemo)(() => {
751
- const allComments = unit === "all" ? unitComments : unitComments.filter((i) => i.subUnitId === subUnitId) ?? [];
1406
+ const allComments = unit === "all" && type !== _univerjs_core.UniverInstanceType.UNIVER_SLIDE ? unitComments : unitComments.filter((i) => i.subUnitId === subUnitId);
752
1407
  const sort = sortComments ?? ((a) => a);
753
1408
  const res = allComments.map((i) => ({
754
1409
  ...i.root,
@@ -767,7 +1422,8 @@ const ThreadCommentPanel = (props) => {
767
1422
  unit,
768
1423
  unitComments,
769
1424
  sortComments,
770
- subUnitId
1425
+ subUnitId,
1426
+ type
771
1427
  ]);
772
1428
  const commentsSorted = (0, react.useMemo)(() => [...comments.filter((comment) => !comment.resolved), ...comments.filter((comment) => comment.resolved)], [comments]);
773
1429
  const statuedComments = (0, react.useMemo)(() => {
@@ -783,7 +1439,7 @@ const ThreadCommentPanel = (props) => {
783
1439
  currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID,
784
1440
  status
785
1441
  ]);
786
- const renderComments = tempComment ? [tempComment, ...statuedComments] : statuedComments;
1442
+ const renderComments = scopedTempComment ? [scopedTempComment, ...statuedComments] : statuedComments;
787
1443
  const unSolvedComments = renderComments.filter((comment) => !comment.resolved);
788
1444
  const solvedComments = renderComments.filter((comment) => comment.resolved);
789
1445
  const isFiltering = status !== "all" || unit !== "all";
@@ -792,23 +1448,48 @@ const ThreadCommentPanel = (props) => {
792
1448
  setUnit("all");
793
1449
  };
794
1450
  (0, react.useEffect)(() => {
795
- if (unitId) setUnitComments(threadCommentModel.getUnit(unitId));
1451
+ if (shouldClearActiveTarget) panelService.setActiveComment(void 0);
1452
+ }, [panelService, shouldClearActiveTarget]);
1453
+ (0, react.useEffect)(() => {
1454
+ if (tempComment && (tempComment.unitId !== unitId || subUnitId && tempComment.subUnitId !== subUnitId)) onTempCommentClose === null || onTempCommentClose === void 0 || onTempCommentClose();
796
1455
  }, [
797
- unitId,
798
- threadCommentModel,
799
- update
1456
+ onTempCommentClose,
1457
+ subUnitId,
1458
+ tempComment,
1459
+ unitId
1460
+ ]);
1461
+ (0, react.useEffect)(() => {
1462
+ if (!activeCommentId) return;
1463
+ const handlePointerDown = (event) => {
1464
+ const activeComment = panelService.activeCommentId;
1465
+ const target = event.target;
1466
+ if (event.button !== 0 || !activeComment || !(target instanceof Element)) return;
1467
+ const activeElement = document.getElementById(`${location}-${activeComment.unitId}-${activeComment.subUnitId}-${activeComment.commentId}`);
1468
+ if ((activeElement === null || activeElement === void 0 ? void 0 : activeElement.contains(target)) || target.closest("button, input, textarea, select, a, [contenteditable=\"true\"], [role=\"menu\"], [role=\"menuitem\"], [role=\"option\"], [role=\"listbox\"], [role=\"combobox\"], [role=\"separator\"]")) return;
1469
+ commandService.executeCommand(SetActiveCommentOperation.id);
1470
+ if (scopedTempComment && isSameThreadCommentTarget(activeComment, scopedTempComment)) onTempCommentClose === null || onTempCommentClose === void 0 || onTempCommentClose();
1471
+ };
1472
+ document.addEventListener("pointerdown", handlePointerDown, true);
1473
+ return () => document.removeEventListener("pointerdown", handlePointerDown, true);
1474
+ }, [
1475
+ activeCommentId,
1476
+ commandService,
1477
+ location,
1478
+ onTempCommentClose,
1479
+ panelService,
1480
+ scopedTempComment
800
1481
  ]);
801
1482
  (0, react.useEffect)(() => {
802
1483
  var _document$getElementB;
803
1484
  if (!activeCommentId) return;
804
- if (!shouldScroll.current) {
805
- shouldScroll.current = true;
1485
+ if (!shouldScrollRef.current) {
1486
+ shouldScrollRef.current = true;
806
1487
  return;
807
1488
  }
808
1489
  const { unitId, subUnitId, commentId } = activeCommentId;
809
1490
  const id = `${location}-${unitId}-${subUnitId}-${commentId}`;
810
1491
  (_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 || _document$getElementB.scrollIntoView({ block: "center" });
811
- }, [activeCommentId]);
1492
+ }, [activeCommentId, location]);
812
1493
  const renderComment = (section) => (comment, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentTree, {
813
1494
  full: true,
814
1495
  location,
@@ -817,11 +1498,13 @@ const ThreadCommentPanel = (props) => {
817
1498
  unitId: comment.unitId,
818
1499
  subUnitId: comment.subUnitId,
819
1500
  refStr: comment.ref,
1501
+ displayRef: formatRef === null || formatRef === void 0 ? void 0 : formatRef(comment),
820
1502
  type,
821
- showEdit: (activeCommentId === null || activeCommentId === void 0 ? void 0 : activeCommentId.commentId) === comment.id,
822
- showHighlight: (activeCommentId === null || activeCommentId === void 0 ? void 0 : activeCommentId.commentId) === comment.id,
1503
+ showEdit: !comment.id || isSameThreadCommentTarget(activeCommentId, comment),
1504
+ showHighlight: isSameThreadCommentTarget(activeCommentId, comment),
1505
+ autoFocus: autoFocusActiveComment && isSameThreadCommentTarget(activeCommentId, comment),
823
1506
  onClick: () => {
824
- shouldScroll.current = false;
1507
+ shouldScrollRef.current = false;
825
1508
  if (!comment.resolved) commandService.executeCommand(SetActiveCommentOperation.id, {
826
1509
  unitId: comment.unitId,
827
1510
  subUnitId: comment.subUnitId,
@@ -830,11 +1513,24 @@ const ThreadCommentPanel = (props) => {
830
1513
  });
831
1514
  else commandService.executeCommand(SetActiveCommentOperation.id);
832
1515
  },
833
- onMouseEnter: () => onItemEnter === null || onItemEnter === void 0 ? void 0 : onItemEnter(comment),
834
- onMouseLeave: () => onItemLeave === null || onItemLeave === void 0 ? void 0 : onItemLeave(comment),
1516
+ onMouseEnter: () => {
1517
+ panelService.setHoveredComment({
1518
+ unitId: comment.unitId,
1519
+ subUnitId: comment.subUnitId,
1520
+ commentId: comment.id,
1521
+ trigger: "panel-hover"
1522
+ });
1523
+ onItemEnter === null || onItemEnter === void 0 || onItemEnter(comment);
1524
+ },
1525
+ onMouseLeave: () => {
1526
+ if (isSameThreadCommentTarget(panelService.hoveredCommentId, comment)) panelService.setHoveredComment(void 0);
1527
+ onItemLeave === null || onItemLeave === void 0 || onItemLeave(comment);
1528
+ },
835
1529
  onAddComment,
836
1530
  onDeleteComment,
837
- onResolve: (resolved) => onResolve === null || onResolve === void 0 ? void 0 : onResolve(comment.id, resolved)
1531
+ onAfterDeleteComment,
1532
+ onResolve: (resolved) => onResolve === null || onResolve === void 0 ? void 0 : onResolve(comment.id, resolved),
1533
+ onClose: !comment.id ? onTempCommentClose : void 0
838
1534
  }, getThreadCommentPanelItemKey(comment, index, section));
839
1535
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
840
1536
  className: "univer-flex univer-min-h-full univer-flex-col univer-pb-3",
@@ -876,13 +1572,13 @@ const ThreadCommentPanel = (props) => {
876
1572
  })]
877
1573
  }), renderComments.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
878
1574
  className: "univer-flex univer-flex-1 univer-flex-col univer-items-center univer-justify-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
879
- children: [localeService.t("thread-comment-ui.panel.empty"), isFiltering ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1575
+ children: [localeService.t("thread-comment-ui.panel.empty"), isFiltering ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ActionRow, {
880
1576
  className: "univer-mt-2 univer-flex univer-flex-row",
881
1577
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
882
1578
  onClick: onReset,
883
1579
  children: localeService.t("thread-comment-ui.panel.reset")
884
1580
  })
885
- }) : !disableAdd ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1581
+ }) : !disableAdd ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.ActionRow, {
886
1582
  className: "univer-mt-2 univer-flex univer-flex-row",
887
1583
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.Button, {
888
1584
  onClick: onAdd,
@@ -904,7 +1600,16 @@ const ThreadCommentPanel = (props) => {
904
1600
  };
905
1601
 
906
1602
  //#endregion
1603
+ exports.MobileThreadCommentPanel = MobileThreadCommentPanel;
1604
+ exports.MobileThreadCommentTree = MobileThreadCommentTree;
907
1605
  exports.SetActiveCommentOperation = SetActiveCommentOperation;
1606
+ exports.ThreadCommentCanvasOverlay = ThreadCommentCanvasOverlay;
1607
+ Object.defineProperty(exports, 'ThreadCommentDraftService', {
1608
+ enumerable: true,
1609
+ get: function () {
1610
+ return ThreadCommentDraftService;
1611
+ }
1612
+ });
908
1613
  exports.ThreadCommentPanel = ThreadCommentPanel;
909
1614
  Object.defineProperty(exports, 'ThreadCommentPanelService', {
910
1615
  enumerable: true,
@@ -914,6 +1619,12 @@ Object.defineProperty(exports, 'ThreadCommentPanelService', {
914
1619
  });
915
1620
  exports.ThreadCommentTree = ThreadCommentTree;
916
1621
  exports.ThreadCommentTreeLocation = ThreadCommentTreeLocation;
1622
+ Object.defineProperty(exports, 'UniverThreadCommentMobileUIPlugin', {
1623
+ enumerable: true,
1624
+ get: function () {
1625
+ return UniverThreadCommentMobileUIPlugin;
1626
+ }
1627
+ });
917
1628
  Object.defineProperty(exports, 'UniverThreadCommentUIPlugin', {
918
1629
  enumerable: true,
919
1630
  get: function () {