@univerjs/sheets-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 (103) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +16 -8
  3. package/lib/cjs/index.js +684 -164
  4. package/lib/cjs/locale/ar-SA.js +1 -1
  5. package/lib/cjs/locale/ca-ES.js +1 -1
  6. package/lib/cjs/locale/de-DE.js +1 -1
  7. package/lib/cjs/locale/en-US.js +1 -1
  8. package/lib/cjs/locale/es-ES.js +1 -1
  9. package/lib/cjs/locale/fa-IR.js +1 -1
  10. package/lib/cjs/locale/fr-FR.js +1 -1
  11. package/lib/cjs/locale/id-ID.js +1 -1
  12. package/lib/cjs/locale/it-IT.js +1 -1
  13. package/lib/cjs/locale/ja-JP.js +1 -1
  14. package/lib/cjs/locale/ko-KR.js +1 -1
  15. package/lib/cjs/locale/pl-PL.js +1 -1
  16. package/lib/cjs/locale/pt-BR.js +1 -1
  17. package/lib/cjs/locale/ru-RU.js +1 -1
  18. package/lib/cjs/locale/sk-SK.js +1 -1
  19. package/lib/cjs/locale/vi-VN.js +1 -1
  20. package/lib/cjs/locale/zh-CN.js +1 -1
  21. package/lib/cjs/locale/zh-HK.js +1 -1
  22. package/lib/cjs/locale/zh-TW.js +1 -1
  23. package/lib/es/index.js +685 -171
  24. package/lib/es/locale/ar-SA.js +1 -0
  25. package/lib/es/locale/ca-ES.js +1 -0
  26. package/lib/es/locale/de-DE.js +1 -0
  27. package/lib/es/locale/en-US.js +1 -0
  28. package/lib/es/locale/es-ES.js +1 -0
  29. package/lib/es/locale/fa-IR.js +1 -0
  30. package/lib/es/locale/fr-FR.js +1 -0
  31. package/lib/es/locale/id-ID.js +1 -0
  32. package/lib/es/locale/it-IT.js +1 -0
  33. package/lib/es/locale/ja-JP.js +1 -0
  34. package/lib/es/locale/ko-KR.js +1 -0
  35. package/lib/es/locale/pl-PL.js +1 -0
  36. package/lib/es/locale/pt-BR.js +1 -0
  37. package/lib/es/locale/ru-RU.js +1 -0
  38. package/lib/es/locale/sk-SK.js +1 -0
  39. package/lib/es/locale/vi-VN.js +1 -0
  40. package/lib/es/locale/zh-CN.js +1 -0
  41. package/lib/es/locale/zh-HK.js +1 -0
  42. package/lib/es/locale/zh-TW.js +1 -0
  43. package/lib/index.js +685 -171
  44. package/lib/locale/ar-SA.js +1 -0
  45. package/lib/locale/ca-ES.js +1 -0
  46. package/lib/locale/de-DE.js +1 -0
  47. package/lib/locale/en-US.js +1 -0
  48. package/lib/locale/es-ES.js +1 -0
  49. package/lib/locale/fa-IR.js +1 -0
  50. package/lib/locale/fr-FR.js +1 -0
  51. package/lib/locale/id-ID.js +1 -0
  52. package/lib/locale/it-IT.js +1 -0
  53. package/lib/locale/ja-JP.js +1 -0
  54. package/lib/locale/ko-KR.js +1 -0
  55. package/lib/locale/pl-PL.js +1 -0
  56. package/lib/locale/pt-BR.js +1 -0
  57. package/lib/locale/ru-RU.js +1 -0
  58. package/lib/locale/sk-SK.js +1 -0
  59. package/lib/locale/vi-VN.js +1 -0
  60. package/lib/locale/zh-CN.js +1 -0
  61. package/lib/locale/zh-HK.js +1 -0
  62. package/lib/locale/zh-TW.js +1 -0
  63. package/lib/types/commands/operations/comment.operation.d.ts +5 -0
  64. package/lib/types/commands/operations/mobile/show-add-sheet-comment.operation.d.ts +17 -0
  65. package/lib/types/controllers/mobile/components.controller.d.ts +22 -0
  66. package/lib/types/controllers/mobile/sheets-thread-comment.controller.d.ts +20 -0
  67. package/lib/types/controllers/render-controllers/drawing.render-controller.d.ts +35 -0
  68. package/lib/types/controllers/sheets-thread-comment-permission.controller.d.ts +1 -0
  69. package/lib/types/controllers/sheets-thread-comment-popup.controller.d.ts +2 -0
  70. package/lib/types/index.d.ts +1 -0
  71. package/lib/types/locale/en-US.d.ts +1 -0
  72. package/lib/types/menu/menu.d.ts +11 -0
  73. package/lib/types/menu/mobile-menu.d.ts +35 -0
  74. package/lib/types/menu/mobile-schema.d.ts +17 -0
  75. package/lib/types/mobile-plugin.d.ts +31 -0
  76. package/lib/types/plugin.d.ts +3 -1
  77. package/lib/types/services/mobile/mobile-sheet-comment-draft.service.d.ts +31 -0
  78. package/lib/types/types/const.d.ts +1 -0
  79. package/lib/types/views/SheetsThreadCommentPanel.d.ts +5 -1
  80. package/lib/types/views/mobile/MobileSheetsThreadCommentPanel.d.ts +16 -0
  81. package/lib/types/views/sheets-thread-comment-cell/index.d.ts +16 -0
  82. package/lib/types/views/sheets-thread-comment-panel/index.d.ts +16 -0
  83. package/lib/umd/index.js +3 -1
  84. package/lib/umd/locale/ar-SA.js +1 -1
  85. package/lib/umd/locale/ca-ES.js +1 -1
  86. package/lib/umd/locale/de-DE.js +1 -1
  87. package/lib/umd/locale/en-US.js +1 -1
  88. package/lib/umd/locale/es-ES.js +1 -1
  89. package/lib/umd/locale/fa-IR.js +1 -1
  90. package/lib/umd/locale/fr-FR.js +1 -1
  91. package/lib/umd/locale/id-ID.js +1 -1
  92. package/lib/umd/locale/it-IT.js +1 -1
  93. package/lib/umd/locale/ja-JP.js +1 -1
  94. package/lib/umd/locale/ko-KR.js +1 -1
  95. package/lib/umd/locale/pl-PL.js +1 -1
  96. package/lib/umd/locale/pt-BR.js +1 -1
  97. package/lib/umd/locale/ru-RU.js +1 -1
  98. package/lib/umd/locale/sk-SK.js +1 -1
  99. package/lib/umd/locale/vi-VN.js +1 -1
  100. package/lib/umd/locale/zh-CN.js +1 -1
  101. package/lib/umd/locale/zh-HK.js +1 -1
  102. package/lib/umd/locale/zh-TW.js +1 -1
  103. package/package.json +15 -14
package/lib/cjs/index.js CHANGED
@@ -1,17 +1,18 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  let _univerjs_core = require("@univerjs/core");
3
+ let _univerjs_drawing = require("@univerjs/drawing");
3
4
  let _univerjs_sheets = require("@univerjs/sheets");
4
5
  let _univerjs_sheets_thread_comment = require("@univerjs/sheets-thread-comment");
6
+ let _univerjs_thread_comment = require("@univerjs/thread-comment");
5
7
  let _univerjs_thread_comment_ui = require("@univerjs/thread-comment-ui");
6
8
  let _univerjs_ui = require("@univerjs/ui");
7
9
  let _univerjs_sheets_ui = require("@univerjs/sheets-ui");
8
10
  let rxjs = require("rxjs");
9
11
  let _univerjs_engine_render = require("@univerjs/engine-render");
10
- let _univerjs_thread_comment = require("@univerjs/thread-comment");
11
12
  let _univerjs_icons = require("@univerjs/icons");
12
- let react_jsx_runtime = require("react/jsx-runtime");
13
13
  let _univerjs_engine_formula = require("@univerjs/engine-formula");
14
14
  let react = require("react");
15
+ let react_jsx_runtime = require("react/jsx-runtime");
15
16
 
16
17
  //#region src/types/const.ts
17
18
  /**
@@ -31,10 +32,11 @@ let react = require("react");
31
32
  */
32
33
  const SHEETS_THREAD_COMMENT_MODAL = "univer.sheet.thread-comment-modal";
33
34
  const SHEETS_THREAD_COMMENT_PANEL = "univer.sheet.thread-comment-panel";
35
+ const SHOW_ADD_SHEET_COMMENT_OPERATION_ID = "sheet.operation.show-comment-modal";
34
36
  const PLUGIN_NAME = "SHEET_THREAD_COMMENT_UI_PLUGIN";
35
37
 
36
38
  //#endregion
37
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
39
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
38
40
  function _typeof(o) {
39
41
  "@babel/helpers - typeof";
40
42
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -45,7 +47,7 @@ function _typeof(o) {
45
47
  }
46
48
 
47
49
  //#endregion
48
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
50
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
49
51
  function toPrimitive(t, r) {
50
52
  if ("object" != _typeof(t) || !t) return t;
51
53
  var e = t[Symbol.toPrimitive];
@@ -58,14 +60,14 @@ function toPrimitive(t, r) {
58
60
  }
59
61
 
60
62
  //#endregion
61
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
63
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
62
64
  function toPropertyKey(t) {
63
65
  var i = toPrimitive(t, "string");
64
66
  return "symbol" == _typeof(i) ? i : i + "";
65
67
  }
66
68
 
67
69
  //#endregion
68
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
70
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
69
71
  function _defineProperty(e, r, t) {
70
72
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
71
73
  value: t,
@@ -76,7 +78,7 @@ function _defineProperty(e, r, t) {
76
78
  }
77
79
 
78
80
  //#endregion
79
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
81
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
80
82
  function __decorateParam(paramIndex, decorator) {
81
83
  return function(target, key) {
82
84
  decorator(target, key, paramIndex);
@@ -84,7 +86,7 @@ function __decorateParam(paramIndex, decorator) {
84
86
  }
85
87
 
86
88
  //#endregion
87
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
89
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
88
90
  function __decorate(decorators, target, key, desc) {
89
91
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
90
92
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -169,7 +171,7 @@ SheetsThreadCommentPopupService = __decorate([__decorateParam(0, (0, _univerjs_c
169
171
  //#region src/commands/operations/comment.operation.ts
170
172
  const ShowAddSheetCommentModalOperation = {
171
173
  type: _univerjs_core.CommandType.OPERATION,
172
- id: "sheet.operation.show-comment-modal",
174
+ id: SHOW_ADD_SHEET_COMMENT_OPERATION_ID,
173
175
  handler(accessor) {
174
176
  var _selectionManagerServ;
175
177
  const selectionManagerService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
@@ -210,26 +212,84 @@ const ToggleSheetCommentPanelOperation = {
210
212
  if (panelService.panelVisible) {
211
213
  sidebarService.close();
212
214
  panelService.setPanelVisible(false);
213
- } else {
214
- sidebarService.open({
215
- header: { title: "sheets-thread-comment-ui.panel.title" },
216
- children: { label: SHEETS_THREAD_COMMENT_PANEL },
217
- width: 360
218
- });
219
- panelService.setPanelVisible(true);
220
- }
215
+ } else openSheetCommentPanel(sidebarService, panelService);
216
+ return true;
217
+ }
218
+ };
219
+ const OpenSheetCommentPanelOperation = {
220
+ id: "sheet.operation.open-comment-panel",
221
+ type: _univerjs_core.CommandType.OPERATION,
222
+ handler(accessor) {
223
+ openSheetCommentPanel(accessor.get(_univerjs_ui.ISidebarService), accessor.get(_univerjs_thread_comment_ui.ThreadCommentPanelService));
224
+ return true;
225
+ }
226
+ };
227
+ function openSheetCommentPanel(sidebarService, panelService) {
228
+ var _sidebarService$optio;
229
+ if (!panelService.panelVisible || ((_sidebarService$optio = sidebarService.options.children) === null || _sidebarService$optio === void 0 ? void 0 : _sidebarService$optio.label) !== "univer.sheet.thread-comment-panel") sidebarService.open({
230
+ header: { title: "sheets-thread-comment-ui.panel.title" },
231
+ children: { label: SHEETS_THREAD_COMMENT_PANEL },
232
+ width: 360,
233
+ onClose: () => panelService.setPanelVisible(false)
234
+ });
235
+ panelService.setPanelVisible(true);
236
+ }
237
+ const AddSheetDrawingCommentOperation = {
238
+ id: "sheet.operation.add-drawing-comment",
239
+ type: _univerjs_core.CommandType.OPERATION,
240
+ handler(accessor) {
241
+ var _workbook$getActiveSh;
242
+ const drawing = accessor.get(_univerjs_drawing.IDrawingManagerService).getFocusDrawings()[0];
243
+ const workbook = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
244
+ if (!drawing || !workbook || drawing.unitId !== workbook.getUnitId() || drawing.subUnitId !== ((_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId())) return false;
245
+ accessor.get(_univerjs_thread_comment_ui.ThreadCommentDraftService).place({
246
+ unitId: drawing.unitId,
247
+ subUnitId: drawing.subUnitId,
248
+ anchor: {
249
+ kind: _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING,
250
+ pageId: drawing.subUnitId,
251
+ elementId: drawing.drawingId
252
+ }
253
+ });
254
+ const panelService = accessor.get(_univerjs_thread_comment_ui.ThreadCommentPanelService);
255
+ accessor.get(_univerjs_ui.ISidebarService).open({
256
+ header: { title: "sheets-thread-comment-ui.panel.title" },
257
+ children: { label: SHEETS_THREAD_COMMENT_PANEL },
258
+ width: 360,
259
+ onClose: () => panelService.setPanelVisible(false)
260
+ });
261
+ panelService.setPanelVisible(true);
221
262
  return true;
222
263
  }
223
264
  };
224
265
 
225
266
  //#endregion
226
267
  //#region src/menu/menu.ts
268
+ function getDrawingCommentDisable$(accessor) {
269
+ const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
270
+ const permissionService = accessor.get(_univerjs_core.IPermissionService);
271
+ return (0, _univerjs_sheets_ui.deriveStateFromActiveSheet$)(univerInstanceService, true, ({ workbook, worksheet }) => {
272
+ const unitId = workbook.getUnitId();
273
+ const subUnitId = worksheet.getSheetId();
274
+ return permissionService.composePermission$([new _univerjs_sheets.WorkbookCommentPermission(unitId).id, new _univerjs_sheets.WorksheetViewPermission(unitId, subUnitId).id]).pipe((0, rxjs.map)((permissions) => permissions.some((permission) => permission.value === false)));
275
+ });
276
+ }
277
+ const drawingCommentMenuFactory = (accessor) => ({
278
+ id: AddSheetDrawingCommentOperation.id,
279
+ type: _univerjs_ui.MenuItemType.BUTTON,
280
+ icon: "InsertCommentDoubleIcon",
281
+ title: "sheets-thread-comment-ui.menu.addComment",
282
+ tooltip: "sheets-thread-comment-ui.menu.addComment",
283
+ hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
284
+ disabled$: getDrawingCommentDisable$(accessor)
285
+ });
227
286
  const threadCommentMenuFactory = (accessor) => {
228
287
  return {
229
288
  id: ShowAddSheetCommentModalOperation.id,
230
289
  type: _univerjs_ui.MenuItemType.BUTTON,
231
- icon: "CommentIcon",
290
+ icon: "InsertCommentDoubleIcon",
232
291
  title: "sheets-thread-comment-ui.menu.addComment",
292
+ tooltip: "sheets-thread-comment-ui.menu.addComment",
233
293
  hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
234
294
  disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
235
295
  workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
@@ -243,7 +303,8 @@ const threadPanelMenuFactory = (accessor) => {
243
303
  id: ToggleSheetCommentPanelOperation.id,
244
304
  type: _univerjs_ui.MenuItemType.BUTTON,
245
305
  icon: "CommentIcon",
246
- tooltip: "sheets-thread-comment-ui.menu.commentManagement",
306
+ title: "sheets-thread-comment-ui.menu.openComments",
307
+ tooltip: "sheets-thread-comment-ui.menu.openComments",
247
308
  disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
248
309
  workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
249
310
  worksheetTypes: [_univerjs_sheets.WorksheetViewPermission],
@@ -261,26 +322,103 @@ const AddCommentShortcut = {
261
322
  //#endregion
262
323
  //#region src/menu/schema.ts
263
324
  const menuSchema = {
264
- [_univerjs_ui.RibbonInsertGroup.MEDIA]: { [ToggleSheetCommentPanelOperation.id]: {
265
- order: 2,
266
- gridLayout: {
267
- row: 1,
268
- column: 3,
269
- rowSpan: 2,
270
- showLabel: true
325
+ [_univerjs_ui.RibbonInsertGroup.MEDIA]: {
326
+ [ToggleSheetCommentPanelOperation.id]: {
327
+ order: 2,
328
+ gridLayout: {
329
+ row: 1,
330
+ column: 3,
331
+ showLabel: true
332
+ },
333
+ menuItemFactory: threadPanelMenuFactory
271
334
  },
272
- menuItemFactory: threadPanelMenuFactory
273
- } },
335
+ [ShowAddSheetCommentModalOperation.id]: {
336
+ order: 2.1,
337
+ gridLayout: {
338
+ row: 2,
339
+ column: 3,
340
+ showLabel: true
341
+ },
342
+ menuItemFactory: threadCommentMenuFactory
343
+ }
344
+ },
274
345
  [_univerjs_ui.ContextMenuPosition.MAIN_AREA]: { [_univerjs_ui.ContextMenuGroup.OTHERS]: { [ShowAddSheetCommentModalOperation.id]: {
275
346
  order: 0,
276
347
  menuItemFactory: threadCommentMenuFactory
348
+ } } },
349
+ [_univerjs_ui.FloatingObjectToolbarPosition.SHEET]: { [AddSheetDrawingCommentOperation.id]: {
350
+ order: 10,
351
+ menuItemFactory: drawingCommentMenuFactory
352
+ } },
353
+ [_univerjs_ui.ContextMenuPosition.DRAWING]: { [_univerjs_ui.ContextMenuGroup.OTHERS]: { [AddSheetDrawingCommentOperation.id]: {
354
+ order: 0,
355
+ menuItemFactory: drawingCommentMenuFactory
277
356
  } } }
278
357
  };
279
358
 
280
359
  //#endregion
281
360
  //#region package.json
282
361
  var name = "@univerjs/sheets-thread-comment-ui";
283
- var version = "1.0.0-insiders.20260813-7c9aa50";
362
+ var version = "1.0.0";
363
+
364
+ //#endregion
365
+ //#region src/services/mobile/mobile-sheet-comment-draft.service.ts
366
+ var MobileSheetCommentDraftService = class extends _univerjs_core.Disposable {
367
+ constructor() {
368
+ super();
369
+ _defineProperty(this, "_draft$", new rxjs.BehaviorSubject(null));
370
+ _defineProperty(this, "draft$", this._draft$.asObservable());
371
+ this.disposeWithMe(() => this._draft$.complete());
372
+ }
373
+ get draft() {
374
+ return this._draft$.getValue();
375
+ }
376
+ place(draft) {
377
+ this._draft$.next(draft);
378
+ }
379
+ cancel() {
380
+ this._draft$.next(null);
381
+ }
382
+ };
383
+
384
+ //#endregion
385
+ //#region src/commands/operations/mobile/show-add-sheet-comment.operation.ts
386
+ const ShowAddSheetCommentMobileOperation = {
387
+ type: _univerjs_core.CommandType.OPERATION,
388
+ id: SHOW_ADD_SHEET_COMMENT_OPERATION_ID,
389
+ handler(accessor) {
390
+ var _accessor$get$getCurr;
391
+ const activeCell = (_accessor$get$getCurr = accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentLastSelection()) === null || _accessor$get$getCurr === void 0 ? void 0 : _accessor$get$getCurr.primary;
392
+ if (!activeCell) return false;
393
+ const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
394
+ if (!target) return false;
395
+ const { unitId, subUnitId } = target;
396
+ const row = activeCell.startRow;
397
+ const column = activeCell.startColumn;
398
+ const panelService = accessor.get(_univerjs_thread_comment_ui.ThreadCommentPanelService);
399
+ const mobileDraftService = accessor.get(MobileSheetCommentDraftService);
400
+ const rootId = accessor.get(_univerjs_sheets_thread_comment.SheetsThreadCommentModel).getByLocation(unitId, subUnitId, row, column);
401
+ accessor.get(_univerjs_thread_comment_ui.ThreadCommentDraftService).cancel();
402
+ if (rootId) {
403
+ mobileDraftService.cancel();
404
+ panelService.setActiveComment({
405
+ unitId,
406
+ subUnitId,
407
+ commentId: rootId
408
+ });
409
+ } else {
410
+ panelService.setActiveComment(void 0);
411
+ mobileDraftService.place({
412
+ unitId,
413
+ subUnitId,
414
+ row,
415
+ column
416
+ });
417
+ }
418
+ openSheetCommentPanel(accessor.get(_univerjs_ui.ISidebarService), panelService);
419
+ return true;
420
+ }
421
+ };
284
422
 
285
423
  //#endregion
286
424
  //#region src/config/config.ts
@@ -288,43 +426,9 @@ const SHEETS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY = "sheets-thread-comment.config
288
426
  const configSymbol = Symbol(SHEETS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY);
289
427
  const defaultPluginConfig = {};
290
428
 
291
- //#endregion
292
- //#region src/views/SheetsThreadCommentCell.tsx
293
- const SheetsThreadCommentCell = () => {
294
- const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
295
- const sheetsThreadCommentPopupService = (0, _univerjs_ui.useDependency)(SheetsThreadCommentPopupService);
296
- const activePopup = (0, _univerjs_ui.useObservable)(sheetsThreadCommentPopupService.activePopup$);
297
- const sheetThreadCommentModel = (0, _univerjs_ui.useDependency)(_univerjs_sheets_thread_comment.SheetsThreadCommentModel);
298
- const rootId = (0, _univerjs_ui.useObservable)(activePopup ? () => sheetThreadCommentModel.commentUpdate$.pipe((0, rxjs.map)(() => sheetThreadCommentModel.getByLocation(activePopup.unitId, activePopup.subUnitId, activePopup.row, activePopup.col)), (0, rxjs.startWith)(sheetThreadCommentModel.getByLocation(activePopup.unitId, activePopup.subUnitId, activePopup.row, activePopup.col))) : null, void 0, false, [activePopup, sheetThreadCommentModel]);
299
- if (!activePopup) return null;
300
- const { row, col, unitId, subUnitId, trigger } = activePopup;
301
- const ref = `${_univerjs_core.Tools.chatAtABC(col)}${row + 1}`;
302
- const onClose = () => {
303
- sheetsThreadCommentPopupService.hidePopup();
304
- };
305
- const getSubUnitName = (id) => {
306
- var _univerInstanceServic;
307
- return ((_univerInstanceServic = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _univerInstanceServic === void 0 || (_univerInstanceServic = _univerInstanceServic.getSheetBySheetId(id)) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.getName()) ?? "";
308
- };
309
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_thread_comment_ui.ThreadCommentTree, {
310
- onClick: () => {
311
- sheetsThreadCommentPopupService.persistPopup();
312
- },
313
- location: _univerjs_thread_comment_ui.ThreadCommentTreeLocation.CELL,
314
- id: rootId,
315
- unitId,
316
- subUnitId,
317
- type: _univerjs_core.UniverInstanceType.UNIVER_SHEET,
318
- refStr: ref,
319
- onClose,
320
- getSubUnitName,
321
- autoFocus: trigger === "context-menu"
322
- });
323
- };
324
-
325
429
  //#endregion
326
430
  //#region src/views/SheetsThreadCommentPanel.tsx
327
- const SheetsThreadCommentPanel = () => {
431
+ const SheetsThreadCommentPanel = ({ ThreadCommentPanelComponent = _univerjs_thread_comment_ui.ThreadCommentPanel } = {}) => {
328
432
  var _workbook$getActiveSh;
329
433
  const markSelectionService = (0, _univerjs_ui.useDependency)(_univerjs_sheets_ui.IMarkSelectionService);
330
434
  const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
@@ -332,6 +436,19 @@ const SheetsThreadCommentPanel = () => {
332
436
  const workbook = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
333
437
  const unitId = workbook.getUnitId();
334
438
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
439
+ const draftService = (0, _univerjs_ui.useDependency)(_univerjs_thread_comment_ui.ThreadCommentDraftService);
440
+ const userManagerService = (0, _univerjs_ui.useDependency)(_univerjs_core.UserManagerService);
441
+ const draft = (0, _univerjs_ui.useObservable)(draftService.draft$, draftService.draft);
442
+ const tempDrawingComment = (draft === null || draft === void 0 ? void 0 : draft.anchor.kind) === _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING && draft.unitId === unitId ? {
443
+ id: "",
444
+ threadId: "",
445
+ unitId: draft.unitId,
446
+ subUnitId: draft.subUnitId,
447
+ ref: (0, _univerjs_thread_comment.serializeThreadCommentAnchor)(draft.anchor),
448
+ dT: "",
449
+ personId: userManagerService.getCurrentUser().userID,
450
+ text: { dataStream: "\r\n" }
451
+ } : null;
335
452
  const subUnitId$ = (0, react.useMemo)(() => workbook.activeSheet$.pipe((0, rxjs.map)((i) => i === null || i === void 0 ? void 0 : i.getSheetId())), [workbook.activeSheet$]);
336
453
  const subUnitId = (0, _univerjs_ui.useObservable)(subUnitId$, (_workbook$getActiveSh = workbook.getActiveSheet()) === null || _workbook$getActiveSh === void 0 ? void 0 : _workbook$getActiveSh.getSheetId());
337
454
  const hoverShapeId = (0, react.useRef)(null);
@@ -346,6 +463,15 @@ const SheetsThreadCommentPanel = () => {
346
463
  });
347
464
  const sort = (comments) => {
348
465
  return comments.map((comment) => {
466
+ const anchor = (0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(comment.ref);
467
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) === _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING) return {
468
+ ...comment,
469
+ p: [
470
+ sheetIndex[comment.subUnitId] ?? 0,
471
+ Number.MAX_SAFE_INTEGER,
472
+ 0
473
+ ]
474
+ };
349
475
  const ref = (0, _univerjs_engine_formula.singleReferenceToGrid)(comment.ref);
350
476
  const p = [
351
477
  sheetIndex[comment.subUnitId] ?? 0,
@@ -367,6 +493,7 @@ const SheetsThreadCommentPanel = () => {
367
493
  return [...sort(comments.filter((comment) => !comment.resolved)), ...sort(comments.filter((comment) => comment.resolved))];
368
494
  }, [workbook]);
369
495
  const showShape = (0, react.useCallback)((comment) => {
496
+ if ((0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(comment.ref)) return null;
370
497
  if (comment.unitId === unitId && comment.subUnitId === subUnitId && !comment.resolved) {
371
498
  const { row, column } = (0, _univerjs_engine_formula.singleReferenceToGrid)(comment.ref);
372
499
  const worksheet = workbook.getSheetBySheetId(comment.subUnitId);
@@ -423,7 +550,7 @@ const SheetsThreadCommentPanel = () => {
423
550
  hoverShapeId.current = null;
424
551
  }
425
552
  }, [markSelectionService, panelVisible]);
426
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_thread_comment_ui.ThreadCommentPanel, {
553
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThreadCommentPanelComponent, {
427
554
  unitId,
428
555
  subUnitId$,
429
556
  type: _univerjs_core.UniverInstanceType.UNIVER_SHEET,
@@ -436,12 +563,50 @@ const SheetsThreadCommentPanel = () => {
436
563
  onDeleteComment: () => {
437
564
  handleLeave();
438
565
  return true;
566
+ },
567
+ tempComment: tempDrawingComment,
568
+ onTempCommentClose: () => draftService.cancel(),
569
+ formatRef: (comment) => {
570
+ const anchor = (0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(comment.ref);
571
+ return (anchor === null || anchor === void 0 ? void 0 : anchor.kind) === _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING ? `#${anchor.elementId}` : comment.ref;
439
572
  }
440
573
  });
441
574
  };
442
575
 
443
576
  //#endregion
444
- //#region src/controllers/components.controller.ts
577
+ //#region src/views/mobile/MobileSheetsThreadCommentPanel.tsx
578
+ function MobileSheetsThreadCommentPanelContent(props) {
579
+ const draftService = (0, _univerjs_ui.useDependency)(MobileSheetCommentDraftService);
580
+ const userManagerService = (0, _univerjs_ui.useDependency)(_univerjs_core.UserManagerService);
581
+ const draft = (0, _univerjs_ui.useObservable)(draftService.draft$, draftService.draft);
582
+ const tempCellComment = (draft === null || draft === void 0 ? void 0 : draft.unitId) === props.unitId ? {
583
+ id: "",
584
+ threadId: "",
585
+ unitId: draft.unitId,
586
+ subUnitId: draft.subUnitId,
587
+ ref: `${_univerjs_core.Tools.chatAtABC(draft.column)}${draft.row + 1}`,
588
+ dT: "",
589
+ personId: userManagerService.getCurrentUser().userID,
590
+ text: { dataStream: "\r\n" }
591
+ } : null;
592
+ const handleTempCommentClose = () => {
593
+ var _props$onTempCommentC;
594
+ draftService.cancel();
595
+ (_props$onTempCommentC = props.onTempCommentClose) === null || _props$onTempCommentC === void 0 || _props$onTempCommentC.call(props);
596
+ };
597
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_thread_comment_ui.MobileThreadCommentPanel, {
598
+ ...props,
599
+ tempComment: props.tempComment ?? tempCellComment,
600
+ onTempCommentClose: handleTempCommentClose,
601
+ autoFocusActiveComment: true
602
+ });
603
+ }
604
+ function MobileSheetsThreadCommentPanel() {
605
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetsThreadCommentPanel, { ThreadCommentPanelComponent: MobileSheetsThreadCommentPanelContent });
606
+ }
607
+
608
+ //#endregion
609
+ //#region src/controllers/mobile/components.controller.ts
445
610
  /**
446
611
  * Copyright 2023-present DreamNum Co., Ltd.
447
612
  *
@@ -457,24 +622,108 @@ const SheetsThreadCommentPanel = () => {
457
622
  * See the License for the specific language governing permissions and
458
623
  * limitations under the License.
459
624
  */
460
- let ComponentsController = class ComponentsController extends _univerjs_core.Disposable {
625
+ let MobileComponentsController = class MobileComponentsController extends _univerjs_core.Disposable {
461
626
  constructor(_componentManager, _iconManager) {
462
627
  super();
463
628
  this._componentManager = _componentManager;
464
629
  this._iconManager = _iconManager;
465
- this._registerComponents();
466
- this._registerIcons();
467
- }
468
- _registerComponents() {
469
- [[SHEETS_THREAD_COMMENT_MODAL, SheetsThreadCommentCell], [SHEETS_THREAD_COMMENT_PANEL, SheetsThreadCommentPanel]].forEach(([key, comp]) => {
470
- this.disposeWithMe(this._componentManager.register(key, comp));
471
- });
630
+ this.disposeWithMe(this._componentManager.register(SHEETS_THREAD_COMMENT_PANEL, MobileSheetsThreadCommentPanel));
631
+ this.disposeWithMe(this._iconManager.register({
632
+ CommentIcon: _univerjs_icons.CommentIcon,
633
+ InsertCommentDoubleIcon: _univerjs_icons.InsertCommentDoubleIcon
634
+ }));
472
635
  }
473
- _registerIcons() {
474
- this.disposeWithMe(this._iconManager.register({ CommentIcon: _univerjs_icons.CommentIcon }));
636
+ };
637
+ MobileComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.IconManager))], MobileComponentsController);
638
+
639
+ //#endregion
640
+ //#region src/menu/mobile-menu.ts
641
+ function getMobileThreadCommentMenuTitle(accessor) {
642
+ var _selectionService$get;
643
+ const selectionService = accessor.get(_univerjs_sheets.SheetsSelectionsService);
644
+ const selection = (_selectionService$get = selectionService.getCurrentLastSelection()) === null || _selectionService$get === void 0 ? void 0 : _selectionService$get.primary;
645
+ const selectionParam = selectionService.currentSelectionParam;
646
+ if (!selection || !selectionParam) return "sheets-thread-comment-ui.menu.addComment";
647
+ return accessor.get(_univerjs_sheets_thread_comment.SheetsThreadCommentModel).getByLocation(selectionParam.unitId, selectionParam.sheetId, selection.startRow, selection.startColumn) ? "sheets-thread-comment-ui.menu.openComments" : "sheets-thread-comment-ui.menu.addComment";
648
+ }
649
+ const mobileThreadCommentMenuFactory = (accessor) => ({
650
+ id: ShowAddSheetCommentMobileOperation.id,
651
+ type: _univerjs_ui.MenuItemType.BUTTON,
652
+ icon: "InsertCommentDoubleIcon",
653
+ title: "sheets-thread-comment-ui.menu.addComment",
654
+ hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_SHEET),
655
+ disabled$: (0, _univerjs_sheets_ui.getCurrentRangeDisable$)(accessor, {
656
+ workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
657
+ worksheetTypes: [_univerjs_sheets.WorksheetViewPermission],
658
+ rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
659
+ })
660
+ });
661
+ const mobileContextThreadCommentMenuFactory = (accessor) => ({
662
+ ...mobileThreadCommentMenuFactory(accessor),
663
+ title: getMobileThreadCommentMenuTitle(accessor)
664
+ });
665
+
666
+ //#endregion
667
+ //#region src/menu/mobile-schema.ts
668
+ const mobileMenuSchema = {
669
+ [_univerjs_ui.RibbonInsertGroup.MEDIA]: {
670
+ [ToggleSheetCommentPanelOperation.id]: {
671
+ order: 2,
672
+ gridLayout: {
673
+ row: 1,
674
+ column: 3,
675
+ showLabel: true
676
+ },
677
+ menuItemFactory: threadPanelMenuFactory
678
+ },
679
+ [ShowAddSheetCommentMobileOperation.id]: {
680
+ order: 2.1,
681
+ gridLayout: {
682
+ row: 2,
683
+ column: 3,
684
+ showLabel: true
685
+ },
686
+ menuItemFactory: mobileThreadCommentMenuFactory
687
+ }
688
+ },
689
+ [_univerjs_ui.ContextMenuPosition.MAIN_AREA]: { [_univerjs_ui.ContextMenuGroup.OTHERS]: { [ShowAddSheetCommentMobileOperation.id]: {
690
+ order: 0,
691
+ menuItemFactory: mobileContextThreadCommentMenuFactory
692
+ } } },
693
+ [_univerjs_ui.FloatingObjectToolbarPosition.SHEET]: { [AddSheetDrawingCommentOperation.id]: {
694
+ order: 10,
695
+ menuItemFactory: drawingCommentMenuFactory
696
+ } },
697
+ [_univerjs_ui.ContextMenuPosition.DRAWING]: { [_univerjs_ui.ContextMenuGroup.OTHERS]: { [AddSheetDrawingCommentOperation.id]: {
698
+ order: 0,
699
+ menuItemFactory: drawingCommentMenuFactory
700
+ } } }
701
+ };
702
+
703
+ //#endregion
704
+ //#region src/controllers/mobile/sheets-thread-comment.controller.ts
705
+ /**
706
+ * Copyright 2023-present DreamNum Co., Ltd.
707
+ *
708
+ * Licensed under the Apache License, Version 2.0 (the "License");
709
+ * you may not use this file except in compliance with the License.
710
+ * You may obtain a copy of the License at
711
+ *
712
+ * http://www.apache.org/licenses/LICENSE-2.0
713
+ *
714
+ * Unless required by applicable law or agreed to in writing, software
715
+ * distributed under the License is distributed on an "AS IS" BASIS,
716
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717
+ * See the License for the specific language governing permissions and
718
+ * limitations under the License.
719
+ */
720
+ let SheetsThreadCommentMobileController = class SheetsThreadCommentMobileController extends _univerjs_core.Disposable {
721
+ constructor(menuManagerService) {
722
+ super();
723
+ menuManagerService.mergeMenu(mobileMenuSchema);
475
724
  }
476
725
  };
477
- ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.IconManager))], ComponentsController);
726
+ SheetsThreadCommentMobileController = __decorate([__decorateParam(0, _univerjs_ui.IMenuManagerService)], SheetsThreadCommentMobileController);
478
727
 
479
728
  //#endregion
480
729
  //#region src/controllers/render-controllers/render.controller.ts
@@ -536,12 +785,13 @@ const transformRef = (ref, source, target) => {
536
785
  const refObj = (0, _univerjs_engine_formula.singleReferenceToGrid)(ref);
537
786
  const offsetRow = target.row - source.row;
538
787
  const offsetCol = target.column - source.column;
539
- return (0, _univerjs_engine_formula.serializeRange)({
788
+ const targetRange = {
540
789
  startColumn: refObj.column + offsetCol,
541
790
  startRow: refObj.row + offsetRow,
542
791
  endColumn: refObj.column + offsetCol,
543
792
  endRow: refObj.row + offsetRow
544
- });
793
+ };
794
+ return (0, _univerjs_engine_formula.serializeRange)(targetRange);
545
795
  };
546
796
  let SheetsThreadCommentCopyPasteController = class SheetsThreadCommentCopyPasteController extends _univerjs_core.Disposable {
547
797
  constructor(_sheetClipboardService, _sheetsThreadCommentModel, _threadCommentDataSourceService) {
@@ -653,6 +903,331 @@ SheetsThreadCommentCopyPasteController = __decorate([
653
903
  __decorateParam(2, _univerjs_thread_comment.IThreadCommentDataSourceService)
654
904
  ], SheetsThreadCommentCopyPasteController);
655
905
 
906
+ //#endregion
907
+ //#region src/controllers/sheets-thread-comment-permission.controller.ts
908
+ let SheetsThreadCommentPermissionController = class SheetsThreadCommentPermissionController extends _univerjs_core.Disposable {
909
+ constructor(_localeService, _commandService, _sheetPermissionCheckController, _sheetsThreadCommentModel) {
910
+ super();
911
+ this._localeService = _localeService;
912
+ this._commandService = _commandService;
913
+ this._sheetPermissionCheckController = _sheetPermissionCheckController;
914
+ this._sheetsThreadCommentModel = _sheetsThreadCommentModel;
915
+ this._commandExecutedListener();
916
+ }
917
+ _commandExecutedListener() {
918
+ this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
919
+ const { id } = command;
920
+ if (id === AddSheetDrawingCommentOperation.id || id === ShowAddSheetCommentModalOperation.id || id === ToggleSheetCommentPanelOperation.id) {
921
+ if (!this._sheetPermissionCheckController.permissionCheckWithoutRange({
922
+ workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
923
+ worksheetTypes: [_univerjs_sheets.WorksheetViewPermission]
924
+ })) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
925
+ } else if (id === _univerjs_thread_comment.AddCommentCommand.id) {
926
+ const { unitId, subUnitId, comment } = command.params;
927
+ if (!this._hasCommentPermission(unitId, subUnitId, comment.ref)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
928
+ } else if (id === _univerjs_thread_comment.UpdateCommentCommand.id) {
929
+ const { unitId, subUnitId, payload } = command.params;
930
+ const { commentId } = payload;
931
+ const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
932
+ if (comment && !this._hasCommentPermission(unitId, subUnitId, comment.ref)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
933
+ } else if (id === _univerjs_thread_comment.ResolveCommentCommand.id || id === _univerjs_thread_comment.DeleteCommentCommand.id || id === _univerjs_thread_comment.DeleteCommentTreeCommand.id) {
934
+ const { unitId, subUnitId, commentId } = command.params;
935
+ const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
936
+ if (comment && !this._hasCommentPermission(unitId, subUnitId, comment.ref)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
937
+ }
938
+ }));
939
+ }
940
+ _hasCommentPermission(unitId, subUnitId, ref) {
941
+ const permissionTypes = {
942
+ workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
943
+ worksheetTypes: [_univerjs_sheets.WorksheetViewPermission]
944
+ };
945
+ const anchor = (0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(ref);
946
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) === _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING) return this._sheetPermissionCheckController.permissionCheckWithoutRange(permissionTypes, unitId, subUnitId);
947
+ const { row, column } = (0, _univerjs_engine_formula.singleReferenceToGrid)(ref);
948
+ if (!Number.isFinite(row) || !Number.isFinite(column)) return false;
949
+ return this._sheetPermissionCheckController.permissionCheckWithRanges({
950
+ ...permissionTypes,
951
+ rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
952
+ }, [{
953
+ startRow: row,
954
+ startColumn: column,
955
+ endRow: row,
956
+ endColumn: column
957
+ }], unitId, subUnitId);
958
+ }
959
+ };
960
+ SheetsThreadCommentPermissionController = __decorate([
961
+ __decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
962
+ __decorateParam(1, _univerjs_core.ICommandService),
963
+ __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetPermissionCheckController)),
964
+ __decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets_thread_comment.SheetsThreadCommentModel))
965
+ ], SheetsThreadCommentPermissionController);
966
+
967
+ //#endregion
968
+ //#region src/mobile-plugin.ts
969
+ let UniverSheetsThreadCommentMobileUIPlugin = class UniverSheetsThreadCommentMobileUIPlugin extends _univerjs_core.Plugin {
970
+ constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
971
+ super();
972
+ this._config = _config;
973
+ this._injector = _injector;
974
+ this._commandService = _commandService;
975
+ this._configService = _configService;
976
+ const { menu, ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
977
+ if (menu) this._configService.setConfig("menu", menu, { merge: true });
978
+ this._configService.setConfig(SHEETS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY, rest);
979
+ }
980
+ onStarting() {
981
+ [
982
+ [MobileComponentsController],
983
+ [SheetsThreadCommentMobileController],
984
+ [SheetsThreadCommentRenderController],
985
+ [SheetsThreadCommentCopyPasteController],
986
+ [SheetsThreadCommentPopupService],
987
+ [SheetsThreadCommentPermissionController],
988
+ [MobileSheetCommentDraftService]
989
+ ].forEach((dependency) => this._injector.add(dependency));
990
+ this._injector.get(MobileComponentsController);
991
+ [
992
+ AddSheetDrawingCommentOperation,
993
+ OpenSheetCommentPanelOperation,
994
+ ShowAddSheetCommentMobileOperation,
995
+ ToggleSheetCommentPanelOperation
996
+ ].forEach((command) => this._commandService.registerCommand(command));
997
+ this._injector.get(SheetsThreadCommentMobileController);
998
+ }
999
+ onReady() {
1000
+ this._injector.get(SheetsThreadCommentRenderController);
1001
+ }
1002
+ onRendered() {
1003
+ this._injector.get(SheetsThreadCommentCopyPasteController);
1004
+ this._injector.get(SheetsThreadCommentPermissionController);
1005
+ }
1006
+ };
1007
+ _defineProperty(UniverSheetsThreadCommentMobileUIPlugin, "pluginName", PLUGIN_NAME);
1008
+ _defineProperty(UniverSheetsThreadCommentMobileUIPlugin, "packageName", name);
1009
+ _defineProperty(UniverSheetsThreadCommentMobileUIPlugin, "version", version);
1010
+ _defineProperty(UniverSheetsThreadCommentMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
1011
+ UniverSheetsThreadCommentMobileUIPlugin = __decorate([
1012
+ (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_thread_comment.UniverThreadCommentPlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_thread_comment_ui.UniverThreadCommentMobileUIPlugin, _univerjs_sheets_thread_comment.UniverSheetsThreadCommentPlugin, _univerjs_ui.UniverMobileUIPlugin, _univerjs_sheets_ui.UniverSheetsMobileUIPlugin),
1013
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1014
+ __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
1015
+ __decorateParam(3, _univerjs_core.IConfigService)
1016
+ ], UniverSheetsThreadCommentMobileUIPlugin);
1017
+
1018
+ //#endregion
1019
+ //#region src/views/SheetsThreadCommentCell.tsx
1020
+ const SheetsThreadCommentCell = () => {
1021
+ const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
1022
+ const sheetsThreadCommentPopupService = (0, _univerjs_ui.useDependency)(SheetsThreadCommentPopupService);
1023
+ const activePopup = (0, _univerjs_ui.useObservable)(sheetsThreadCommentPopupService.activePopup$);
1024
+ const sheetThreadCommentModel = (0, _univerjs_ui.useDependency)(_univerjs_sheets_thread_comment.SheetsThreadCommentModel);
1025
+ const getRootId = () => {
1026
+ if (!activePopup) return;
1027
+ const { unitId, subUnitId, row, col, commentId } = activePopup;
1028
+ const activeComment = commentId ? sheetThreadCommentModel.getAllByLocation(unitId, subUnitId, row, col).find((comment) => comment.id === commentId) : void 0;
1029
+ return activeComment && !activeComment.resolved ? activeComment.id : sheetThreadCommentModel.getByLocation(unitId, subUnitId, row, col);
1030
+ };
1031
+ const rootId = (0, _univerjs_ui.useObservable)(activePopup ? () => sheetThreadCommentModel.commentUpdate$.pipe((0, rxjs.map)(() => getRootId()), (0, rxjs.startWith)(getRootId())) : null, void 0, false, [activePopup, sheetThreadCommentModel]);
1032
+ if (!activePopup) return null;
1033
+ const { row, col, unitId, subUnitId, trigger } = activePopup;
1034
+ const ref = `${_univerjs_core.Tools.chatAtABC(col)}${row + 1}`;
1035
+ const onClose = () => {
1036
+ sheetsThreadCommentPopupService.hidePopup();
1037
+ };
1038
+ const getSubUnitName = (id) => {
1039
+ var _univerInstanceServic;
1040
+ return ((_univerInstanceServic = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET)) === null || _univerInstanceServic === void 0 || (_univerInstanceServic = _univerInstanceServic.getSheetBySheetId(id)) === null || _univerInstanceServic === void 0 ? void 0 : _univerInstanceServic.getName()) ?? "";
1041
+ };
1042
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_thread_comment_ui.ThreadCommentTree, {
1043
+ onClick: () => {
1044
+ sheetsThreadCommentPopupService.persistPopup();
1045
+ },
1046
+ location: _univerjs_thread_comment_ui.ThreadCommentTreeLocation.CELL,
1047
+ id: rootId,
1048
+ unitId,
1049
+ subUnitId,
1050
+ type: _univerjs_core.UniverInstanceType.UNIVER_SHEET,
1051
+ refStr: ref,
1052
+ onClose,
1053
+ getSubUnitName,
1054
+ autoFocus: trigger === "context-menu"
1055
+ });
1056
+ };
1057
+
1058
+ //#endregion
1059
+ //#region src/controllers/components.controller.ts
1060
+ /**
1061
+ * Copyright 2023-present DreamNum Co., Ltd.
1062
+ *
1063
+ * Licensed under the Apache License, Version 2.0 (the "License");
1064
+ * you may not use this file except in compliance with the License.
1065
+ * You may obtain a copy of the License at
1066
+ *
1067
+ * http://www.apache.org/licenses/LICENSE-2.0
1068
+ *
1069
+ * Unless required by applicable law or agreed to in writing, software
1070
+ * distributed under the License is distributed on an "AS IS" BASIS,
1071
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1072
+ * See the License for the specific language governing permissions and
1073
+ * limitations under the License.
1074
+ */
1075
+ let ComponentsController = class ComponentsController extends _univerjs_core.Disposable {
1076
+ constructor(_componentManager, _iconManager) {
1077
+ super();
1078
+ this._componentManager = _componentManager;
1079
+ this._iconManager = _iconManager;
1080
+ this._registerComponents();
1081
+ this._registerIcons();
1082
+ }
1083
+ _registerComponents() {
1084
+ [[SHEETS_THREAD_COMMENT_MODAL, SheetsThreadCommentCell], [SHEETS_THREAD_COMMENT_PANEL, SheetsThreadCommentPanel]].forEach(([key, comp]) => {
1085
+ this.disposeWithMe(this._componentManager.register(key, comp));
1086
+ });
1087
+ }
1088
+ _registerIcons() {
1089
+ this.disposeWithMe(this._iconManager.register({
1090
+ CommentIcon: _univerjs_icons.CommentIcon,
1091
+ InsertCommentDoubleIcon: _univerjs_icons.InsertCommentDoubleIcon
1092
+ }));
1093
+ }
1094
+ };
1095
+ ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_ui.IconManager))], ComponentsController);
1096
+
1097
+ //#endregion
1098
+ //#region src/controllers/render-controllers/drawing.render-controller.ts
1099
+ const SHEET_COMMENT_DRAWING_OVERLAY_KEY = "sheet-thread-comment-drawing-overlay";
1100
+ const SHEET_COMMENT_DRAWING_OVERLAY_LAYER_INDEX = 10100;
1101
+ let SheetsThreadCommentDrawingRenderController = class SheetsThreadCommentDrawingRenderController extends _univerjs_core.RxDisposable {
1102
+ constructor(_context, _commandService, _drawingManagerService, _commentModel, _panelService, _themeService) {
1103
+ super();
1104
+ this._context = _context;
1105
+ this._commandService = _commandService;
1106
+ this._drawingManagerService = _drawingManagerService;
1107
+ this._commentModel = _commentModel;
1108
+ this._panelService = _panelService;
1109
+ this._themeService = _themeService;
1110
+ _defineProperty(this, "_overlay", void 0);
1111
+ this._overlay = new _univerjs_thread_comment_ui.ThreadCommentCanvasOverlay(SHEET_COMMENT_DRAWING_OVERLAY_KEY, {
1112
+ ...this._getColors(),
1113
+ zoomRatio: 1,
1114
+ markers: [],
1115
+ underlines: []
1116
+ });
1117
+ this._context.scene.addObject(this._overlay, SHEET_COMMENT_DRAWING_OVERLAY_LAYER_INDEX);
1118
+ this.disposeWithMe((0, _univerjs_core.toDisposable)(this._overlay.onPointerDown$.subscribeEvent((_event, state) => this._onOverlayPointerDown(state))));
1119
+ this.disposeWithMe((0, _univerjs_core.toDisposable)(this._context.engine.onTransformChange$.subscribeEvent(() => this._syncOverlay())));
1120
+ this.disposeWithMe(this._context.unit.activeSheet$.subscribe(() => this._syncOverlay()));
1121
+ this.disposeWithMe(this._commentModel.commentUpdate$.subscribe((update) => {
1122
+ if (update.unitId === this._context.unitId) this._syncOverlay();
1123
+ }));
1124
+ [this._panelService.activeCommentId$, this._panelService.hoveredCommentId$].forEach((observable) => this.disposeWithMe(observable.subscribe(() => this._syncOverlay())));
1125
+ [
1126
+ this._drawingManagerService.add$,
1127
+ this._drawingManagerService.update$,
1128
+ this._drawingManagerService.remove$
1129
+ ].forEach((observable) => this.disposeWithMe(observable.subscribe((drawings) => {
1130
+ if (drawings.some((drawing) => drawing.unitId === this._context.unitId)) this._syncOverlay();
1131
+ })));
1132
+ this.disposeWithMe(this._themeService.currentTheme$.subscribe(() => this._syncOverlay()));
1133
+ this._syncOverlay();
1134
+ }
1135
+ _onOverlayPointerDown(state) {
1136
+ var _this$_context$unit$g;
1137
+ const commentId = this._overlay.hitCommentId;
1138
+ const subUnitId = (_this$_context$unit$g = this._context.unit.getActiveSheet()) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.getSheetId();
1139
+ if (!commentId || !subUnitId) return;
1140
+ state.stopPropagation();
1141
+ this._panelService.setActiveComment({
1142
+ unitId: this._context.unitId,
1143
+ subUnitId,
1144
+ commentId,
1145
+ trigger: "sheet-canvas"
1146
+ });
1147
+ this._commandService.executeCommand(OpenSheetCommentPanelOperation.id).catch(() => void 0);
1148
+ }
1149
+ _syncOverlay() {
1150
+ const worksheet = this._context.unit.getActiveSheet();
1151
+ const subUnitId = worksheet === null || worksheet === void 0 ? void 0 : worksheet.getSheetId();
1152
+ if (!worksheet || !subUnitId) {
1153
+ this._overlay.updateState({
1154
+ markers: [],
1155
+ underlines: [],
1156
+ focusedCommentIds: [],
1157
+ focusOutlines: []
1158
+ });
1159
+ return;
1160
+ }
1161
+ const underlines = /* @__PURE__ */ new Map();
1162
+ this._commentModel.query({
1163
+ unitIds: [this._context.unitId],
1164
+ subUnitIds: [subUnitId],
1165
+ anchorKinds: [_univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING],
1166
+ resolved: false
1167
+ }).forEach(({ root }) => {
1168
+ const anchor = (0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(root.ref);
1169
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) !== _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING) return;
1170
+ const outline = this._getDrawingOutline(subUnitId, anchor.elementId);
1171
+ if (outline) underlines.set(anchor.elementId, {
1172
+ commentId: root.id,
1173
+ left: outline.left,
1174
+ top: outline.top + outline.height + 2 / worksheet.getZoomRatio(),
1175
+ width: outline.width
1176
+ });
1177
+ });
1178
+ const focusedCommentIds = [];
1179
+ const focusOutlines = /* @__PURE__ */ new Map();
1180
+ [this._panelService.activeCommentId, this._panelService.hoveredCommentId].forEach((target) => {
1181
+ if (!target || target.unitId !== this._context.unitId || target.subUnitId !== subUnitId) return;
1182
+ const comment = this._commentModel.getComment(target.unitId, target.subUnitId, target.commentId);
1183
+ const anchor = comment && (0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(comment.ref);
1184
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) !== _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING) return;
1185
+ focusedCommentIds.push(target.commentId);
1186
+ const outline = this._getDrawingOutline(subUnitId, anchor.elementId);
1187
+ if (outline) focusOutlines.set(anchor.elementId, outline);
1188
+ });
1189
+ this._overlay.updateState({
1190
+ ...this._getColors(),
1191
+ zoomRatio: worksheet.getZoomRatio(),
1192
+ markers: [],
1193
+ underlines: Array.from(underlines.values()),
1194
+ focusedCommentIds,
1195
+ focusOutlines: Array.from(focusOutlines.values())
1196
+ });
1197
+ }
1198
+ _getDrawingOutline(subUnitId, drawingId) {
1199
+ var _this$_context$scene$, _this$_context$scene;
1200
+ const objectKey = (0, _univerjs_drawing.getDrawingShapeKeyByDrawingSearch)({
1201
+ unitId: this._context.unitId,
1202
+ subUnitId,
1203
+ drawingId
1204
+ });
1205
+ const object = ((_this$_context$scene$ = (_this$_context$scene = this._context.scene).getObjectIncludeInGroup) === null || _this$_context$scene$ === void 0 ? void 0 : _this$_context$scene$.call(_this$_context$scene, objectKey)) ?? this._context.scene.getObject(objectKey);
1206
+ if (!object) return null;
1207
+ const bounds = object.getRealBound();
1208
+ return {
1209
+ left: bounds.left,
1210
+ top: bounds.top,
1211
+ width: bounds.width,
1212
+ height: bounds.height
1213
+ };
1214
+ }
1215
+ _getColors() {
1216
+ return {
1217
+ accentColor: this._themeService.getColorFromTheme("yellow.400"),
1218
+ foregroundColor: this._themeService.getColorFromTheme("gray.900"),
1219
+ outlineColor: this._themeService.getColorFromTheme("white")
1220
+ };
1221
+ }
1222
+ };
1223
+ SheetsThreadCommentDrawingRenderController = __decorate([
1224
+ __decorateParam(1, _univerjs_core.ICommandService),
1225
+ __decorateParam(2, _univerjs_drawing.IDrawingManagerService),
1226
+ __decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_thread_comment.ThreadCommentModel)),
1227
+ __decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_thread_comment_ui.ThreadCommentPanelService)),
1228
+ __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService))
1229
+ ], SheetsThreadCommentDrawingRenderController);
1230
+
656
1231
  //#endregion
657
1232
  //#region src/controllers/sheets-thread-comment-hover.controller.ts
658
1233
  /**
@@ -718,84 +1293,11 @@ SheetsThreadCommentHoverController = __decorate([
718
1293
  __decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetPermissionCheckController))
719
1294
  ], SheetsThreadCommentHoverController);
720
1295
 
721
- //#endregion
722
- //#region src/controllers/sheets-thread-comment-permission.controller.ts
723
- let SheetsThreadCommentPermissionController = class SheetsThreadCommentPermissionController extends _univerjs_core.Disposable {
724
- constructor(_localeService, _commandService, _sheetPermissionCheckController, _sheetsThreadCommentModel) {
725
- super();
726
- this._localeService = _localeService;
727
- this._commandService = _commandService;
728
- this._sheetPermissionCheckController = _sheetPermissionCheckController;
729
- this._sheetsThreadCommentModel = _sheetsThreadCommentModel;
730
- this._commandExecutedListener();
731
- }
732
- _commandExecutedListener() {
733
- this.disposeWithMe(this._commandService.beforeCommandExecuted((command) => {
734
- const { id } = command;
735
- if (id === ShowAddSheetCommentModalOperation.id || id === ToggleSheetCommentPanelOperation.id) {
736
- if (!this._sheetPermissionCheckController.permissionCheckWithoutRange({
737
- workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
738
- worksheetTypes: [_univerjs_sheets.WorksheetViewPermission]
739
- })) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
740
- } else if (id === _univerjs_thread_comment.AddCommentCommand.id) {
741
- const { unitId, subUnitId, comment } = command.params;
742
- const { row, column } = (0, _univerjs_engine_formula.singleReferenceToGrid)(comment.ref);
743
- if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
744
- workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
745
- worksheetTypes: [_univerjs_sheets.WorksheetViewPermission],
746
- rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
747
- }, [{
748
- startRow: row,
749
- startColumn: column,
750
- endRow: row,
751
- endColumn: column
752
- }], unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
753
- } else if (id === _univerjs_thread_comment.UpdateCommentCommand.id) {
754
- const { unitId, subUnitId, payload } = command.params;
755
- const { commentId } = payload;
756
- const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
757
- if (comment) {
758
- const { row, column } = (0, _univerjs_engine_formula.singleReferenceToGrid)(comment.ref);
759
- if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
760
- workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
761
- worksheetTypes: [_univerjs_sheets.WorksheetViewPermission],
762
- rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
763
- }, [{
764
- startRow: row,
765
- startColumn: column,
766
- endRow: row,
767
- endColumn: column
768
- }], unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
769
- }
770
- } else if (id === _univerjs_thread_comment.ResolveCommentCommand.id || id === _univerjs_thread_comment.DeleteCommentCommand.id || id === _univerjs_thread_comment.DeleteCommentTreeCommand.id) {
771
- const { unitId, subUnitId, commentId } = command.params;
772
- const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
773
- if (comment) {
774
- const { row, column } = (0, _univerjs_engine_formula.singleReferenceToGrid)(comment.ref);
775
- if (!this._sheetPermissionCheckController.permissionCheckWithRanges({
776
- workbookTypes: [_univerjs_sheets.WorkbookCommentPermission],
777
- worksheetTypes: [_univerjs_sheets.WorksheetViewPermission],
778
- rangeTypes: [_univerjs_sheets.RangeProtectionPermissionViewPoint]
779
- }, [{
780
- startRow: row,
781
- startColumn: column,
782
- endRow: row,
783
- endColumn: column
784
- }], unitId, subUnitId)) this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("sheets-thread-comment-ui.permission.commentErr"));
785
- }
786
- }
787
- }));
788
- }
789
- };
790
- SheetsThreadCommentPermissionController = __decorate([
791
- __decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
792
- __decorateParam(1, _univerjs_core.ICommandService),
793
- __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_sheets.SheetPermissionCheckController)),
794
- __decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_sheets_thread_comment.SheetsThreadCommentModel))
795
- ], SheetsThreadCommentPermissionController);
796
-
797
1296
  //#endregion
798
1297
  //#region src/controllers/sheets-thread-comment-popup.controller.ts
1298
+ function resolveFocusedSheetComment(activeComment, hoveredComment, unitId, subUnitId) {
1299
+ for (const comment of [hoveredComment, activeComment]) if (comment && comment.unitId === unitId && comment.subUnitId === subUnitId) return comment;
1300
+ }
799
1301
  let SheetsThreadCommentPopupController = class SheetsThreadCommentPopupController extends _univerjs_core.Disposable {
800
1302
  constructor(_commandService, _sheetsThreadCommentPopupService, _sheetsThreadCommentModel, _threadCommentPanelService, _univerInstanceService, _sheetPermissionCheckController, _markSelectionService, _sheetSelectionService, _editorBridgeService, _renderManagerService) {
801
1303
  super();
@@ -873,6 +1375,8 @@ let SheetsThreadCommentPopupController = class SheetsThreadCommentPopupControlle
873
1375
  const { unitId, subUnitId, commentId, trigger } = commentInfo;
874
1376
  const comment = this._sheetsThreadCommentModel.getComment(unitId, subUnitId, commentId);
875
1377
  if (!comment || comment.resolved) return;
1378
+ const anchor = (0, _univerjs_thread_comment.deserializeThreadCommentAnchor)(comment.ref);
1379
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) === _univerjs_thread_comment.ThreadCommentAnchorKind.SHEET_DRAWING) return;
876
1380
  const currentUnit = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
877
1381
  if (!currentUnit) return;
878
1382
  if (currentUnit.getUnitId() !== unitId) return;
@@ -914,16 +1418,18 @@ let SheetsThreadCommentPopupController = class SheetsThreadCommentPopupControlle
914
1418
  }));
915
1419
  }
916
1420
  _initMarkSelection() {
917
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.pipe((0, rxjs.debounceTime)(100)).subscribe((activeComment) => {
918
- var _this$_univerInstance;
919
- if (!activeComment) {
1421
+ this.disposeWithMe((0, rxjs.combineLatest)([this._threadCommentPanelService.activeCommentId$, this._threadCommentPanelService.hoveredCommentId$]).pipe((0, rxjs.debounceTime)(100)).subscribe(([activeComment, hoveredComment]) => {
1422
+ var _currentUnit$getActiv2, _this$_univerInstance;
1423
+ const currentUnit = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
1424
+ const focusedComment = resolveFocusedSheetComment(activeComment, hoveredComment, currentUnit === null || currentUnit === void 0 ? void 0 : currentUnit.getUnitId(), currentUnit === null || currentUnit === void 0 || (_currentUnit$getActiv2 = currentUnit.getActiveSheet()) === null || _currentUnit$getActiv2 === void 0 ? void 0 : _currentUnit$getActiv2.getSheetId());
1425
+ if (!focusedComment) {
920
1426
  if (this._selectionShapeInfo) {
921
1427
  this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId);
922
1428
  this._selectionShapeInfo = null;
923
1429
  }
924
1430
  return;
925
1431
  }
926
- const { unitId, subUnitId, commentId } = activeComment;
1432
+ const { unitId, subUnitId, commentId } = focusedComment;
927
1433
  if (this._selectionShapeInfo) {
928
1434
  this._markSelectionService.removeShape(this._selectionShapeInfo.shapeId);
929
1435
  this._selectionShapeInfo = null;
@@ -951,7 +1457,7 @@ let SheetsThreadCommentPopupController = class SheetsThreadCommentPopupControlle
951
1457
  }, [], -1);
952
1458
  if (!shapeId) return;
953
1459
  this._selectionShapeInfo = {
954
- ...activeComment,
1460
+ ...focusedComment,
955
1461
  shapeId
956
1462
  };
957
1463
  }));
@@ -1007,11 +1513,12 @@ SheetsThreadCommentController = __decorate([__decorateParam(0, _univerjs_ui.IMen
1007
1513
  //#endregion
1008
1514
  //#region src/plugin.ts
1009
1515
  let UniverSheetsThreadCommentUIPlugin = class UniverSheetsThreadCommentUIPlugin extends _univerjs_core.Plugin {
1010
- constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
1516
+ constructor(_config = defaultPluginConfig, _injector, _commandService, _renderManagerService, _configService) {
1011
1517
  super();
1012
1518
  this._config = _config;
1013
1519
  this._injector = _injector;
1014
1520
  this._commandService = _commandService;
1521
+ this._renderManagerService = _renderManagerService;
1015
1522
  this._configService = _configService;
1016
1523
  const { menu, ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
1017
1524
  if (menu) this._configService.setConfig("menu", menu, { merge: true });
@@ -1031,7 +1538,12 @@ let UniverSheetsThreadCommentUIPlugin = class UniverSheetsThreadCommentUIPlugin
1031
1538
  ].forEach((dep) => {
1032
1539
  this._injector.add(dep);
1033
1540
  });
1034
- [ShowAddSheetCommentModalOperation, ToggleSheetCommentPanelOperation].forEach((command) => {
1541
+ [
1542
+ AddSheetDrawingCommentOperation,
1543
+ OpenSheetCommentPanelOperation,
1544
+ ShowAddSheetCommentModalOperation,
1545
+ ToggleSheetCommentPanelOperation
1546
+ ].forEach((command) => {
1035
1547
  this._commandService.registerCommand(command);
1036
1548
  });
1037
1549
  this._injector.get(SheetsThreadCommentController);
@@ -1040,6 +1552,7 @@ let UniverSheetsThreadCommentUIPlugin = class UniverSheetsThreadCommentUIPlugin
1040
1552
  this._injector.get(SheetsThreadCommentRenderController);
1041
1553
  }
1042
1554
  onRendered() {
1555
+ this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_SHEET, [SheetsThreadCommentDrawingRenderController]);
1043
1556
  this._injector.get(SheetsThreadCommentCopyPasteController);
1044
1557
  this._injector.get(SheetsThreadCommentHoverController);
1045
1558
  this._injector.get(SheetsThreadCommentPopupController);
@@ -1051,10 +1564,11 @@ _defineProperty(UniverSheetsThreadCommentUIPlugin, "packageName", name);
1051
1564
  _defineProperty(UniverSheetsThreadCommentUIPlugin, "version", version);
1052
1565
  _defineProperty(UniverSheetsThreadCommentUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
1053
1566
  UniverSheetsThreadCommentUIPlugin = __decorate([
1054
- (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_thread_comment.UniverThreadCommentPlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_thread_comment_ui.UniverThreadCommentUIPlugin, _univerjs_sheets_thread_comment.UniverSheetsThreadCommentPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin),
1567
+ (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_thread_comment.UniverThreadCommentPlugin, _univerjs_drawing.UniverDrawingPlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_thread_comment_ui.UniverThreadCommentUIPlugin, _univerjs_sheets_thread_comment.UniverSheetsThreadCommentPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin),
1055
1568
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1056
1569
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
1057
- __decorateParam(3, _univerjs_core.IConfigService)
1570
+ __decorateParam(3, _univerjs_engine_render.IRenderManagerService),
1571
+ __decorateParam(4, _univerjs_core.IConfigService)
1058
1572
  ], UniverSheetsThreadCommentUIPlugin);
1059
1573
 
1060
1574
  //#endregion
@@ -1067,6 +1581,12 @@ Object.defineProperty(exports, 'SheetsThreadCommentPopupService', {
1067
1581
  exports.SheetsThreadCommentUIMenuSchema = menuSchema;
1068
1582
  exports.ShowAddSheetCommentModalOperation = ShowAddSheetCommentModalOperation;
1069
1583
  exports.ToggleSheetCommentPanelOperation = ToggleSheetCommentPanelOperation;
1584
+ Object.defineProperty(exports, 'UniverSheetsThreadCommentMobileUIPlugin', {
1585
+ enumerable: true,
1586
+ get: function () {
1587
+ return UniverSheetsThreadCommentMobileUIPlugin;
1588
+ }
1589
+ });
1070
1590
  Object.defineProperty(exports, 'UniverSheetsThreadCommentUIPlugin', {
1071
1591
  enumerable: true,
1072
1592
  get: function () {