@univerjs/docs-thread-comment-ui 1.0.0-insiders.20260809-70eefdd → 1.0.0-rc.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 (91) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +22 -6
  3. package/lib/cjs/index.js +346 -127
  4. package/lib/cjs/locale/ar-SA.js +2 -1
  5. package/lib/cjs/locale/ca-ES.js +2 -1
  6. package/lib/cjs/locale/de-DE.js +2 -1
  7. package/lib/cjs/locale/en-US.js +2 -1
  8. package/lib/cjs/locale/es-ES.js +2 -1
  9. package/lib/cjs/locale/fa-IR.js +2 -1
  10. package/lib/cjs/locale/fr-FR.js +2 -1
  11. package/lib/cjs/locale/id-ID.js +2 -1
  12. package/lib/cjs/locale/it-IT.js +2 -1
  13. package/lib/cjs/locale/ja-JP.js +2 -1
  14. package/lib/cjs/locale/ko-KR.js +2 -1
  15. package/lib/cjs/locale/pl-PL.js +2 -1
  16. package/lib/cjs/locale/pt-BR.js +2 -1
  17. package/lib/cjs/locale/ru-RU.js +2 -1
  18. package/lib/cjs/locale/sk-SK.js +2 -1
  19. package/lib/cjs/locale/vi-VN.js +2 -1
  20. package/lib/cjs/locale/zh-CN.js +2 -1
  21. package/lib/cjs/locale/zh-HK.js +2 -1
  22. package/lib/cjs/locale/zh-TW.js +2 -1
  23. package/lib/es/index.js +347 -128
  24. package/lib/es/locale/ar-SA.js +2 -1
  25. package/lib/es/locale/ca-ES.js +2 -1
  26. package/lib/es/locale/de-DE.js +2 -1
  27. package/lib/es/locale/en-US.js +2 -1
  28. package/lib/es/locale/es-ES.js +2 -1
  29. package/lib/es/locale/fa-IR.js +2 -1
  30. package/lib/es/locale/fr-FR.js +2 -1
  31. package/lib/es/locale/id-ID.js +2 -1
  32. package/lib/es/locale/it-IT.js +2 -1
  33. package/lib/es/locale/ja-JP.js +2 -1
  34. package/lib/es/locale/ko-KR.js +2 -1
  35. package/lib/es/locale/pl-PL.js +2 -1
  36. package/lib/es/locale/pt-BR.js +2 -1
  37. package/lib/es/locale/ru-RU.js +2 -1
  38. package/lib/es/locale/sk-SK.js +2 -1
  39. package/lib/es/locale/vi-VN.js +2 -1
  40. package/lib/es/locale/zh-CN.js +2 -1
  41. package/lib/es/locale/zh-HK.js +2 -1
  42. package/lib/es/locale/zh-TW.js +2 -1
  43. package/lib/index.js +347 -128
  44. package/lib/locale/ar-SA.js +2 -1
  45. package/lib/locale/ca-ES.js +2 -1
  46. package/lib/locale/de-DE.js +2 -1
  47. package/lib/locale/en-US.js +2 -1
  48. package/lib/locale/es-ES.js +2 -1
  49. package/lib/locale/fa-IR.js +2 -1
  50. package/lib/locale/fr-FR.js +2 -1
  51. package/lib/locale/id-ID.js +2 -1
  52. package/lib/locale/it-IT.js +2 -1
  53. package/lib/locale/ja-JP.js +2 -1
  54. package/lib/locale/ko-KR.js +2 -1
  55. package/lib/locale/pl-PL.js +2 -1
  56. package/lib/locale/pt-BR.js +2 -1
  57. package/lib/locale/ru-RU.js +2 -1
  58. package/lib/locale/sk-SK.js +2 -1
  59. package/lib/locale/vi-VN.js +2 -1
  60. package/lib/locale/zh-CN.js +2 -1
  61. package/lib/locale/zh-HK.js +2 -1
  62. package/lib/locale/zh-TW.js +2 -1
  63. package/lib/types/commands/commands/add-doc-comment.command.d.ts +4 -7
  64. package/lib/types/commands/operations/show-comment-panel.operation.d.ts +1 -0
  65. package/lib/types/common/const.d.ts +0 -1
  66. package/lib/types/controllers/doc-thread-comment-selection.controller.d.ts +1 -0
  67. package/lib/types/controllers/render-controllers/render.controller.d.ts +11 -4
  68. package/lib/types/locale/en-US.d.ts +1 -0
  69. package/lib/types/menu/menu.d.ts +30 -6
  70. package/lib/types/views/DocThreadCommentPanel.d.ts +4 -0
  71. package/lib/umd/index.js +3 -2
  72. package/lib/umd/locale/ar-SA.js +1 -1
  73. package/lib/umd/locale/ca-ES.js +1 -1
  74. package/lib/umd/locale/de-DE.js +1 -1
  75. package/lib/umd/locale/en-US.js +1 -1
  76. package/lib/umd/locale/es-ES.js +1 -1
  77. package/lib/umd/locale/fa-IR.js +1 -1
  78. package/lib/umd/locale/fr-FR.js +1 -1
  79. package/lib/umd/locale/id-ID.js +1 -1
  80. package/lib/umd/locale/it-IT.js +1 -1
  81. package/lib/umd/locale/ja-JP.js +1 -1
  82. package/lib/umd/locale/ko-KR.js +1 -1
  83. package/lib/umd/locale/pl-PL.js +1 -1
  84. package/lib/umd/locale/pt-BR.js +1 -1
  85. package/lib/umd/locale/ru-RU.js +1 -1
  86. package/lib/umd/locale/sk-SK.js +1 -1
  87. package/lib/umd/locale/vi-VN.js +1 -1
  88. package/lib/umd/locale/zh-CN.js +1 -1
  89. package/lib/umd/locale/zh-HK.js +1 -1
  90. package/lib/umd/locale/zh-TW.js +1 -1
  91. package/package.json +15 -12
package/lib/es/index.js CHANGED
@@ -1,70 +1,48 @@
1
- import { BuildTextUtils, CommandType, CustomDecorationType, DependentOn, Disposable, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, Plugin, SHEET_EDITOR_UNITS, UniverInstanceType, UserManagerService, isInternalEditorID, merge, sequenceExecute } from "@univerjs/core";
2
- import { DocBackScrollRenderController, DocRenderController, DocSelectionRenderService, FLOAT_TOOLBAR_MENU_POSITION, UniverDocsUIPlugin, addCustomDecorationBySelectionFactory, deleteCustomDecorationFactory } from "@univerjs/docs-ui";
3
- import { AddCommentMutation, IThreadCommentDataSourceService, ThreadCommentModel, UniverThreadCommentPlugin, getDT } from "@univerjs/thread-comment";
4
- import { SetActiveCommentOperation, ThreadCommentPanel, ThreadCommentPanelService, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
5
- import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
1
+ import { BuildTextUtils, CommandType, CustomDecorationType, DependentOn, Disposable, ICommandService, IConfigService, IPermissionService, IUniverInstanceService, Inject, Injector, Plugin, SHEET_EDITOR_UNITS, ThemeService, UniverInstanceType, UserManagerService, isInternalEditorID, merge, sequenceExecute, toDisposable } from "@univerjs/core";
2
+ import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin, getDocumentPermissionValue } from "@univerjs/docs";
3
+ import { DEFAULT_DOC_SUBUNIT_ID, UniverDocsThreadCommentPlugin, prepareDocTextRangeComment } from "@univerjs/docs-thread-comment";
4
+ import { SetActiveCommentOperation, ThreadCommentCanvasOverlay, ThreadCommentDraftService, ThreadCommentPanel, ThreadCommentPanelService, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
5
+ import { DocBackScrollRenderController, DocSelectionRenderService, FLOAT_TOOLBAR_MENU_POSITION, UniverDocsUIPlugin, deleteCustomDecorationFactory } from "@univerjs/docs-ui";
6
+ import { IDrawingManagerService, UniverDrawingPlugin, getDrawingShapeKeyByDrawingSearch } from "@univerjs/drawing";
6
7
  import { DocumentEditArea, IRenderManagerService, UniverRenderEnginePlugin, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
7
- import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
8
- import { BehaviorSubject, Observable, debounceTime, filter, map } from "rxjs";
9
- import { CommentIcon } from "@univerjs/icons";
8
+ import { ThreadCommentAnchorKind, ThreadCommentModel, UniverThreadCommentPlugin, deserializeThreadCommentAnchor, getDT, serializeThreadCommentAnchor } from "@univerjs/thread-comment";
9
+ import { ComponentManager, ContextMenuGroup, ContextMenuPosition, FloatingObjectToolbarPosition, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
10
+ import { BehaviorSubject, Observable, combineLatest, debounceTime, filter, map, merge as merge$1, pairwise, skip, startWith } from "rxjs";
11
+ import { UnitAction } from "@univerjs/protocol";
12
+ import { CommentIcon, InsertCommentDoubleIcon } from "@univerjs/icons";
10
13
  import { useEffect, useMemo, useState } from "react";
11
14
  import { jsx } from "react/jsx-runtime";
12
15
 
13
- //#region src/common/const.ts
14
- /**
15
- * Copyright 2023-present DreamNum Co., Ltd.
16
- *
17
- * Licensed under the Apache License, Version 2.0 (the "License");
18
- * you may not use this file except in compliance with the License.
19
- * You may obtain a copy of the License at
20
- *
21
- * http://www.apache.org/licenses/LICENSE-2.0
22
- *
23
- * Unless required by applicable law or agreed to in writing, software
24
- * distributed under the License is distributed on an "AS IS" BASIS,
25
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- * See the License for the specific language governing permissions and
27
- * limitations under the License.
28
- */
29
- const DOCS_THREAD_COMMENT_PANEL = "univer.doc.thread-comment-panel";
30
- const PLUGIN_NAME = "DOC_THREAD_COMMENT_UI_PLUGIN";
31
- const DEFAULT_DOC_SUBUNIT_ID = "default_doc";
32
-
33
- //#endregion
34
16
  //#region src/commands/commands/add-doc-comment.command.ts
17
+ /** Adds a document comment and activates it in the UI comment panel. */
35
18
  const AddDocCommentComment = {
36
19
  id: "docs.command.add-comment",
37
20
  type: CommandType.COMMAND,
38
21
  async handler(accessor, params) {
39
22
  if (!params) return false;
40
- const { comment: originComment, unitId } = params;
41
- const comment = await accessor.get(IThreadCommentDataSourceService).addComment(originComment);
42
- const commandService = accessor.get(ICommandService);
43
- const doMutation = addCustomDecorationBySelectionFactory(accessor, {
44
- id: comment.threadId,
45
- type: CustomDecorationType.COMMENT,
46
- unitId
47
- });
48
- if (doMutation) return (await sequenceExecute([
49
- {
50
- id: AddCommentMutation.id,
51
- params: {
52
- unitId,
53
- subUnitId: DEFAULT_DOC_SUBUNIT_ID,
54
- comment
55
- }
56
- },
57
- doMutation,
58
- {
59
- id: SetActiveCommentOperation.id,
60
- params: {
61
- unitId,
62
- subUnitId: DEFAULT_DOC_SUBUNIT_ID,
63
- commentId: comment.id
64
- }
23
+ const prepared = await prepareDocTextRangeComment(accessor, params);
24
+ if (!prepared) return false;
25
+ const activeOperation = {
26
+ id: SetActiveCommentOperation.id,
27
+ params: {
28
+ unitId: prepared.comment.unitId,
29
+ subUnitId: prepared.comment.subUnitId,
30
+ commentId: prepared.comment.id
65
31
  }
66
- ], commandService)).result;
67
- return false;
32
+ };
33
+ const decorationMutation = {
34
+ id: RichTextEditingMutation.id,
35
+ params: {
36
+ ...prepared.decorationMutationParams,
37
+ textRanges: null,
38
+ noNeedSetTextRange: true
39
+ }
40
+ };
41
+ return (await sequenceExecute([
42
+ prepared.commentMutation,
43
+ decorationMutation,
44
+ activeOperation
45
+ ], accessor.get(ICommandService))).result;
68
46
  }
69
47
  };
70
48
 
@@ -86,6 +64,26 @@ const DeleteDocCommentComment = {
86
64
  }
87
65
  };
88
66
 
67
+ //#endregion
68
+ //#region src/common/const.ts
69
+ /**
70
+ * Copyright 2023-present DreamNum Co., Ltd.
71
+ *
72
+ * Licensed under the Apache License, Version 2.0 (the "License");
73
+ * you may not use this file except in compliance with the License.
74
+ * You may obtain a copy of the License at
75
+ *
76
+ * http://www.apache.org/licenses/LICENSE-2.0
77
+ *
78
+ * Unless required by applicable law or agreed to in writing, software
79
+ * distributed under the License is distributed on an "AS IS" BASIS,
80
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
81
+ * See the License for the specific language governing permissions and
82
+ * limitations under the License.
83
+ */
84
+ const DOCS_THREAD_COMMENT_PANEL = "univer.doc.thread-comment-panel";
85
+ const PLUGIN_NAME = "DOC_THREAD_COMMENT_UI_PLUGIN";
86
+
89
87
  //#endregion
90
88
  //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
91
89
  function _typeof(o) {
@@ -268,14 +266,76 @@ const StartAddCommentOperation = {
268
266
  return true;
269
267
  }
270
268
  };
269
+ const AddDocDrawingCommentOperation = {
270
+ id: "docs.operation.add-drawing-comment",
271
+ type: CommandType.OPERATION,
272
+ handler(accessor) {
273
+ const drawing = accessor.get(IDrawingManagerService).getFocusDrawings()[0];
274
+ const doc = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
275
+ if (!drawing || !doc || drawing.unitId !== doc.getUnitId()) return false;
276
+ accessor.get(ThreadCommentDraftService).place({
277
+ unitId: drawing.unitId,
278
+ subUnitId: drawing.subUnitId,
279
+ anchor: {
280
+ kind: ThreadCommentAnchorKind.DOC_DRAWING,
281
+ pageId: drawing.subUnitId,
282
+ elementId: drawing.drawingId
283
+ }
284
+ });
285
+ const panelService = accessor.get(ThreadCommentPanelService);
286
+ accessor.get(ISidebarService).open({
287
+ header: { title: "docs-thread-comment-ui.panel.title" },
288
+ children: { label: DOCS_THREAD_COMMENT_PANEL },
289
+ width: 320,
290
+ onClose: () => panelService.setPanelVisible(false)
291
+ });
292
+ panelService.setPanelVisible(true);
293
+ return true;
294
+ }
295
+ };
271
296
 
272
297
  //#endregion
273
298
  //#region src/menu/menu.ts
299
+ /**
300
+ * Copyright 2023-present DreamNum Co., Ltd.
301
+ *
302
+ * Licensed under the Apache License, Version 2.0 (the "License");
303
+ * you may not use this file except in compliance with the License.
304
+ * You may obtain a copy of the License at
305
+ *
306
+ * http://www.apache.org/licenses/LICENSE-2.0
307
+ *
308
+ * Unless required by applicable law or agreed to in writing, software
309
+ * distributed under the License is distributed on an "AS IS" BASIS,
310
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
311
+ * See the License for the specific language governing permissions and
312
+ * limitations under the License.
313
+ */
314
+ function getCommentPermissionDisabled$(accessor) {
315
+ const instanceService = accessor.get(IUniverInstanceService);
316
+ const permissionService = accessor.get(IPermissionService);
317
+ return combineLatest([instanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), permissionService.permissionPointUpdate$.pipe(startWith(void 0))]).pipe(map(([document]) => !document || !getDocumentPermissionValue(permissionService, document.getUnitId(), document.getUnitId(), UnitAction.Comment)));
318
+ }
319
+ function AddDocDrawingCommentMenuItemFactory(accessor) {
320
+ return {
321
+ id: AddDocDrawingCommentOperation.id,
322
+ type: MenuItemType.BUTTON,
323
+ icon: "InsertCommentDoubleIcon",
324
+ title: "docs-thread-comment-ui.panel.addComment",
325
+ tooltip: "docs-thread-comment-ui.panel.addComment",
326
+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),
327
+ disabled$: getCommentPermissionDisabled$(accessor)
328
+ };
329
+ }
274
330
  const shouldDisableAddComment = (accessor) => {
275
331
  var _withCurrentTypeOfRen;
276
332
  const renderManagerService = accessor.get(IRenderManagerService);
277
333
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
278
- const skeleton = (_withCurrentTypeOfRen = withCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC, DocSkeletonManagerService, accessor.get(IUniverInstanceService), renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getSkeleton();
334
+ const instanceService = accessor.get(IUniverInstanceService);
335
+ const permissionService = accessor.get(IPermissionService);
336
+ const document = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
337
+ if (!document || !getDocumentPermissionValue(permissionService, document.getUnitId(), document.getUnitId(), UnitAction.Comment)) return true;
338
+ const skeleton = (_withCurrentTypeOfRen = withCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC, DocSkeletonManagerService, instanceService, renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getSkeleton();
279
339
  const editArea = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getViewModel().getEditArea();
280
340
  if (editArea === DocumentEditArea.FOOTER || editArea === DocumentEditArea.HEADER) return true;
281
341
  const range = docSelectionManagerService.getActiveTextRange();
@@ -286,18 +346,11 @@ function AddDocCommentMenuItemFactory(accessor) {
286
346
  return {
287
347
  id: StartAddCommentOperation.id,
288
348
  type: MenuItemType.BUTTON,
289
- icon: "CommentIcon",
349
+ icon: "InsertCommentDoubleIcon",
290
350
  title: "docs-thread-comment-ui.panel.addComment",
291
351
  tooltip: "docs-thread-comment-ui.panel.addComment",
292
352
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, void 0, SHEET_EDITOR_UNITS),
293
- disabled$: new Observable(function(subscribe) {
294
- const observer = accessor.get(DocSelectionManagerService).textSelection$.pipe(debounceTime(16)).subscribe(() => {
295
- subscribe.next(shouldDisableAddComment(accessor));
296
- });
297
- return () => {
298
- observer.unsubscribe();
299
- };
300
- })
353
+ disabled$: combineLatest([accessor.get(DocSelectionManagerService).textSelection$.pipe(debounceTime(16), map(() => shouldDisableAddComment(accessor)), startWith(shouldDisableAddComment(accessor))), getCommentPermissionDisabled$(accessor)]).pipe(map(([selectionDisabled, permissionDisabled]) => selectionDisabled || permissionDisabled))
301
354
  };
302
355
  }
303
356
  function ToolbarDocCommentMenuItemFactory(accessor) {
@@ -305,8 +358,8 @@ function ToolbarDocCommentMenuItemFactory(accessor) {
305
358
  id: ToggleCommentPanelOperation.id,
306
359
  type: MenuItemType.BUTTON,
307
360
  icon: "CommentIcon",
308
- title: "docs-thread-comment-ui.panel.addComment",
309
- tooltip: "docs-thread-comment-ui.panel.addComment",
361
+ title: "docs-thread-comment-ui.panel.openComments",
362
+ tooltip: "docs-thread-comment-ui.panel.openComments",
310
363
  hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC)
311
364
  };
312
365
  }
@@ -314,24 +367,48 @@ function ToolbarDocCommentMenuItemFactory(accessor) {
314
367
  //#endregion
315
368
  //#region src/menu/schema.ts
316
369
  const menuSchema = {
317
- [RibbonInsertGroup.MEDIA]: { [ToggleCommentPanelOperation.id]: {
318
- order: 3,
319
- menuItemFactory: ToolbarDocCommentMenuItemFactory
320
- } },
370
+ [RibbonInsertGroup.MEDIA]: {
371
+ [ToggleCommentPanelOperation.id]: {
372
+ order: 3,
373
+ gridLayout: {
374
+ row: 1,
375
+ column: 4,
376
+ showLabel: true
377
+ },
378
+ menuItemFactory: ToolbarDocCommentMenuItemFactory
379
+ },
380
+ [StartAddCommentOperation.id]: {
381
+ order: 3.1,
382
+ gridLayout: {
383
+ row: 2,
384
+ column: 4,
385
+ showLabel: true
386
+ },
387
+ menuItemFactory: AddDocCommentMenuItemFactory
388
+ }
389
+ },
321
390
  [FLOAT_TOOLBAR_MENU_POSITION]: { [StartAddCommentOperation.id]: {
322
391
  order: 21,
323
392
  menuItemFactory: AddDocCommentMenuItemFactory
324
393
  } },
394
+ [FloatingObjectToolbarPosition.DOC]: { [AddDocDrawingCommentOperation.id]: {
395
+ order: 10,
396
+ menuItemFactory: AddDocDrawingCommentMenuItemFactory
397
+ } },
325
398
  [ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [StartAddCommentOperation.id]: {
326
399
  order: 1,
327
400
  menuItemFactory: AddDocCommentMenuItemFactory
401
+ } } },
402
+ [ContextMenuPosition.DRAWING]: { [ContextMenuGroup.DATA]: { [AddDocDrawingCommentOperation.id]: {
403
+ order: 1,
404
+ menuItemFactory: AddDocDrawingCommentMenuItemFactory
328
405
  } } }
329
406
  };
330
407
 
331
408
  //#endregion
332
409
  //#region package.json
333
410
  var name = "@univerjs/docs-thread-comment-ui";
334
- var version = "1.0.0-insiders.20260809-70eefdd";
411
+ var version = "1.0.0-rc.0";
335
412
 
336
413
  //#endregion
337
414
  //#region src/config/config.ts
@@ -341,17 +418,44 @@ const defaultPluginConfig = {};
341
418
 
342
419
  //#endregion
343
420
  //#region src/views/DocThreadCommentPanel.tsx
421
+ function getDocCommentPanelSubUnitId(draft, unitId) {
422
+ return draft && draft.unitId === unitId ? draft.subUnitId : DEFAULT_DOC_SUBUNIT_ID;
423
+ }
344
424
  const DocThreadCommentPanel = () => {
345
425
  const univerInstanceService = useDependency(IUniverInstanceService);
346
426
  const injector = useDependency(Injector);
347
427
  const doc = useObservable(useMemo(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(filter((doc) => !!doc && !isInternalEditorID(doc.getUnitId()))), [univerInstanceService]));
348
- const subUnitId$ = useMemo(() => new Observable((sub) => sub.next(DEFAULT_DOC_SUBUNIT_ID)), []);
428
+ const draftService = useDependency(ThreadCommentDraftService);
429
+ const drawingDraft = useObservable(draftService.draft$, draftService.draft);
430
+ const subUnitId$ = useMemo(() => new Observable((sub) => sub.next(getDocCommentPanelSubUnitId(drawingDraft, doc === null || doc === void 0 ? void 0 : doc.getUnitId()))), [doc, drawingDraft]);
349
431
  const docSelectionManagerService = useDependency(DocSelectionManagerService);
350
432
  const selectionChange$ = useMemo(() => docSelectionManagerService.textSelection$.pipe(debounceTime(16)), [docSelectionManagerService.textSelection$]);
351
- const disableAdd = useObservable(() => selectionChange$.pipe(map(() => shouldDisableAddComment(injector))), shouldDisableAddComment(injector), false, [injector, selectionChange$]);
433
+ const permissionService = useDependency(IPermissionService);
434
+ const disableAddChange$ = useMemo(() => merge$1(selectionChange$, permissionService.permissionPointUpdate$), [permissionService.permissionPointUpdate$, selectionChange$]);
435
+ const disableAdd = useObservable(() => disableAddChange$.pipe(map(() => shouldDisableAddComment(injector))), shouldDisableAddComment(injector), false, [disableAddChange$, injector]);
352
436
  const commandService = useDependency(ICommandService);
437
+ const threadCommentModel = useDependency(ThreadCommentModel);
438
+ useObservable(threadCommentModel.commentUpdate$);
353
439
  const docCommentService = useDependency(DocThreadCommentService);
354
- const tempComment = useObservable(docCommentService.addingComment$);
440
+ const textTempComment = useObservable(docCommentService.addingComment$);
441
+ const userManagerService = useDependency(UserManagerService);
442
+ const drawingTempComment = (drawingDraft === null || drawingDraft === void 0 ? void 0 : drawingDraft.anchor.kind) === ThreadCommentAnchorKind.DOC_DRAWING && drawingDraft.unitId === (doc === null || doc === void 0 ? void 0 : doc.getUnitId()) ? {
443
+ id: "",
444
+ threadId: "",
445
+ unitId: drawingDraft.unitId,
446
+ subUnitId: drawingDraft.subUnitId,
447
+ ref: serializeThreadCommentAnchor(drawingDraft.anchor),
448
+ dT: "",
449
+ personId: userManagerService.getCurrentUser().userID,
450
+ text: { dataStream: "\r\n" }
451
+ } : null;
452
+ const tempComment = drawingTempComment ?? textTempComment;
453
+ const drawingIds = new Set(Object.keys((doc === null || doc === void 0 ? void 0 : doc.getSnapshot().drawings) ?? {}));
454
+ const isDrawingComment = (comment) => {
455
+ const anchor = deserializeThreadCommentAnchor(comment.ref);
456
+ return (anchor === null || anchor === void 0 ? void 0 : anchor.kind) === ThreadCommentAnchorKind.DOC_DRAWING || comment.ref.startsWith("#") && drawingIds.has(comment.ref.slice(1));
457
+ };
458
+ const drawingCommentIds = doc ? threadCommentModel.getUnit(doc.getUnitId()).filter((thread) => isDrawingComment(thread.root)).map((thread) => thread.root.id) : [];
355
459
  const [commentIds, setCommentIds] = useState([]);
356
460
  useEffect(() => {
357
461
  const set = /* @__PURE__ */ new Set();
@@ -388,31 +492,36 @@ const DocThreadCommentPanel = () => {
388
492
  getSubUnitName: () => "",
389
493
  disableAdd,
390
494
  tempComment,
391
- onAddComment: (comment) => {
495
+ onAddComment: async (comment) => {
496
+ if (drawingTempComment && !comment.parentId) return true;
392
497
  if (!comment.parentId) {
393
498
  const params = {
394
499
  unitId,
395
- range: tempComment,
500
+ range: textTempComment,
396
501
  comment
397
502
  };
398
- commandService.executeCommand(AddDocCommentComment.id, params);
503
+ if (!await commandService.executeCommand(AddDocCommentComment.id, params)) throw new Error("Failed to add document comment.");
399
504
  docCommentService.endAdd();
400
505
  return false;
401
506
  }
402
507
  return true;
403
508
  },
404
- onDeleteComment: (comment) => {
509
+ onAfterDeleteComment: async (comment) => {
405
510
  if (!comment.parentId) {
511
+ if (isDrawingComment(comment)) return;
406
512
  const params = {
407
513
  unitId,
408
514
  commentId: comment.id
409
515
  };
410
- commandService.executeCommand(DeleteDocCommentComment.id, params);
411
- return false;
516
+ await commandService.executeCommand(DeleteDocCommentComment.id, params);
412
517
  }
413
- return true;
414
518
  },
415
- showComments: commentIds
519
+ showComments: [...commentIds, ...drawingCommentIds],
520
+ onTempCommentClose: () => draftService.cancel(),
521
+ formatRef: (comment) => {
522
+ const anchor = deserializeThreadCommentAnchor(comment.ref);
523
+ return (anchor === null || anchor === void 0 ? void 0 : anchor.kind) === ThreadCommentAnchorKind.DOC_DRAWING ? `#${anchor.elementId}` : comment.ref;
524
+ }
416
525
  });
417
526
  };
418
527
 
@@ -447,7 +556,10 @@ let ComponentsController = class ComponentsController extends Disposable {
447
556
  });
448
557
  }
449
558
  _registerIcons() {
450
- this.disposeWithMe(this._iconManager.register({ CommentIcon }));
559
+ this.disposeWithMe(this._iconManager.register({
560
+ CommentIcon,
561
+ InsertCommentDoubleIcon
562
+ }));
451
563
  }
452
564
  };
453
565
  ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
@@ -478,17 +590,10 @@ let DocThreadCommentSelectionController = class DocThreadCommentSelectionControl
478
590
  lastSelection = primary;
479
591
  if (primary && doc) {
480
592
  const { startOffset, endOffset, collapsed } = primary;
481
- let customRange;
482
- if (collapsed) {
483
- var _doc$getBody;
484
- customRange = (_doc$getBody = doc.getBody()) === null || _doc$getBody === void 0 || (_doc$getBody = _doc$getBody.customDecorations) === null || _doc$getBody === void 0 ? void 0 : _doc$getBody.find((value) => value.startIndex <= startOffset && value.endIndex >= endOffset - 1);
485
- } else {
486
- var _doc$getBody2;
487
- customRange = (_doc$getBody2 = doc.getBody()) === null || _doc$getBody2 === void 0 || (_doc$getBody2 = _doc$getBody2.customDecorations) === null || _doc$getBody2 === void 0 ? void 0 : _doc$getBody2.find((value) => value.startIndex <= startOffset && value.endIndex >= endOffset - 1);
488
- }
593
+ const selectionEnd = collapsed ? startOffset : endOffset - 1;
594
+ const customRange = this._findActiveCommentDecoration(doc, unitId, startOffset, selectionEnd);
489
595
  if (customRange) {
490
- const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, customRange.id);
491
- if (comment && !comment.resolved) this._commandService.executeCommand(ShowCommentPanelOperation.id, { activeComment: {
596
+ this._commandService.executeCommand(ShowCommentPanelOperation.id, { activeComment: {
492
597
  unitId,
493
598
  subUnitId: DEFAULT_DOC_SUBUNIT_ID,
494
599
  commentId: customRange.id
@@ -499,20 +604,27 @@ let DocThreadCommentSelectionController = class DocThreadCommentSelectionControl
499
604
  if (!this._threadCommentPanelService.activeCommentId) return;
500
605
  const addingComment = this._docThreadCommentService.addingComment;
501
606
  const activeComment = this._threadCommentPanelService.activeCommentId;
502
- if (addingComment && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.unitId) === addingComment.unitId && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.subUnitId) === "default_doc" && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.commentId) === addingComment.id) return;
607
+ if (addingComment && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.unitId) === addingComment.unitId && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.subUnitId) === DEFAULT_DOC_SUBUNIT_ID && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.commentId) === addingComment.id) return;
503
608
  this._commandService.executeCommand(SetActiveCommentOperation.id);
504
609
  }
505
610
  }));
506
611
  }
612
+ _findActiveCommentDecoration(doc, unitId, selectionStart, selectionEnd) {
613
+ var _doc$getBody;
614
+ return [...((_doc$getBody = doc.getBody()) === null || _doc$getBody === void 0 ? void 0 : _doc$getBody.customDecorations) ?? []].reverse().filter((decoration) => decoration.type === CustomDecorationType.COMMENT && decoration.startIndex <= selectionStart && decoration.endIndex >= selectionEnd).sort((left, right) => left.endIndex - left.startIndex - (right.endIndex - right.startIndex)).find((decoration) => {
615
+ const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, decoration.id);
616
+ return comment && !comment.resolved;
617
+ });
618
+ }
507
619
  _initActiveCommandChange() {
508
620
  this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
509
621
  var _this$_docThreadComme;
510
622
  if (activeComment) {
511
623
  const doc = this._univerInstanceService.getUnit(activeComment.unitId);
512
624
  if (doc) {
513
- var _this$_renderManagerS, _doc$getBody3;
625
+ var _this$_renderManagerS, _doc$getBody2;
514
626
  const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
515
- const customRange = (_doc$getBody3 = doc.getBody()) === null || _doc$getBody3 === void 0 || (_doc$getBody3 = _doc$getBody3.customDecorations) === null || _doc$getBody3 === void 0 ? void 0 : _doc$getBody3.find((range) => range.id === activeComment.commentId);
627
+ const customRange = (_doc$getBody2 = doc.getBody()) === null || _doc$getBody2 === void 0 || (_doc$getBody2 = _doc$getBody2.customDecorations) === null || _doc$getBody2 === void 0 ? void 0 : _doc$getBody2.find((range) => range.id === activeComment.commentId);
516
628
  if (customRange && backScrollController) backScrollController.scrollToRange({
517
629
  startOffset: customRange.startIndex,
518
630
  endOffset: customRange.endIndex,
@@ -535,50 +647,156 @@ DocThreadCommentSelectionController = __decorate([
535
647
 
536
648
  //#endregion
537
649
  //#region src/controllers/render-controllers/render.controller.ts
650
+ const DOC_COMMENT_DRAWING_OVERLAY_KEY = "doc-thread-comment-drawing-overlay";
651
+ const DOC_COMMENT_DRAWING_OVERLAY_LAYER_INDEX = 10100;
538
652
  let DocThreadCommentRenderController = class DocThreadCommentRenderController extends Disposable {
539
- constructor(_context, _docInterceptorService, _threadCommentPanelService, _docRenderController, _univerInstanceService, _threadCommentModel, _commandService) {
653
+ constructor(_context, _docInterceptorService, _threadCommentPanelService, _univerInstanceService, _threadCommentModel, _commandService, _drawingManagerService, _themeService) {
540
654
  super();
541
655
  this._context = _context;
542
656
  this._docInterceptorService = _docInterceptorService;
543
657
  this._threadCommentPanelService = _threadCommentPanelService;
544
- this._docRenderController = _docRenderController;
545
658
  this._univerInstanceService = _univerInstanceService;
546
659
  this._threadCommentModel = _threadCommentModel;
547
660
  this._commandService = _commandService;
661
+ this._drawingManagerService = _drawingManagerService;
662
+ this._themeService = _themeService;
663
+ _defineProperty(this, "_drawingOverlay", void 0);
664
+ _defineProperty(this, "_drawingCommentSubUnits", /* @__PURE__ */ new Map());
665
+ this._drawingOverlay = new ThreadCommentCanvasOverlay(DOC_COMMENT_DRAWING_OVERLAY_KEY, {
666
+ ...this._getDrawingOverlayColors(),
667
+ zoomRatio: 1,
668
+ markers: [],
669
+ underlines: []
670
+ });
671
+ this._context.scene.addObject(this._drawingOverlay, DOC_COMMENT_DRAWING_OVERLAY_LAYER_INDEX);
548
672
  this._interceptorViewModel();
549
673
  this._initReRender();
550
674
  this._initSyncComments();
675
+ this._initDrawingOverlay();
551
676
  }
552
677
  _initReRender() {
553
- this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
678
+ [this._threadCommentPanelService.activeCommentId$, this._threadCommentPanelService.hoveredCommentId$].forEach((observable) => this.disposeWithMe(observable.pipe(skip(1), startWith(void 0), pairwise()).subscribe(([previous, current]) => {
554
679
  var _this$_univerInstance;
555
- if (activeComment) {
556
- this._docRenderController.reRender(activeComment.unitId);
557
- return;
680
+ const currentUnitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
681
+ if ((/* @__PURE__ */ new Set([
682
+ previous === null || previous === void 0 ? void 0 : previous.unitId,
683
+ current === null || current === void 0 ? void 0 : current.unitId,
684
+ currentUnitId
685
+ ])).has(this._context.unitId)) {
686
+ var _this$_context$mainCo;
687
+ (_this$_context$mainCo = this._context.mainComponent) === null || _this$_context$mainCo === void 0 || _this$_context$mainCo.makeDirty(true);
558
688
  }
559
- const unitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
560
- if (unitId) this._docRenderController.reRender(unitId);
561
- }));
689
+ })));
562
690
  this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe((update) => {
563
- if (update.type === "resolve") this._docRenderController.reRender(update.unitId);
691
+ if (update.type === "resolve" && update.unitId === this._context.unitId) {
692
+ var _this$_context$mainCo2;
693
+ (_this$_context$mainCo2 = this._context.mainComponent) === null || _this$_context$mainCo2 === void 0 || _this$_context$mainCo2.makeDirty(true);
694
+ }
695
+ if (update.unitId === this._context.unitId) this._syncDrawingOverlay();
564
696
  }));
565
697
  }
698
+ _initDrawingOverlay() {
699
+ this.disposeWithMe(toDisposable(this._drawingOverlay.onPointerDown$.subscribeEvent((_event, state) => {
700
+ const commentId = this._drawingOverlay.hitCommentId;
701
+ const subUnitId = commentId && this._drawingCommentSubUnits.get(commentId);
702
+ if (!commentId || !subUnitId) return;
703
+ state.stopPropagation();
704
+ this._commandService.executeCommand(ShowCommentPanelOperation.id, { activeComment: {
705
+ unitId: this._context.unitId,
706
+ subUnitId,
707
+ commentId,
708
+ trigger: "doc-canvas"
709
+ } });
710
+ })));
711
+ this.disposeWithMe(toDisposable(this._context.engine.onTransformChange$.subscribeEvent(() => this._syncDrawingOverlay())));
712
+ [this._threadCommentPanelService.activeCommentId$, this._threadCommentPanelService.hoveredCommentId$].forEach((observable) => this.disposeWithMe(observable.subscribe(() => this._syncDrawingOverlay())));
713
+ [
714
+ this._drawingManagerService.add$,
715
+ this._drawingManagerService.update$,
716
+ this._drawingManagerService.remove$
717
+ ].forEach((observable) => this.disposeWithMe(observable.subscribe((drawings) => {
718
+ if (drawings.some((drawing) => drawing.unitId === this._context.unitId)) this._syncDrawingOverlay();
719
+ })));
720
+ this.disposeWithMe(this._themeService.currentTheme$.subscribe(() => this._syncDrawingOverlay()));
721
+ this._syncDrawingOverlay();
722
+ }
723
+ _syncDrawingOverlay() {
724
+ const underlines = /* @__PURE__ */ new Map();
725
+ this._drawingCommentSubUnits.clear();
726
+ this._threadCommentModel.query({
727
+ unitIds: [this._context.unitId],
728
+ anchorKinds: [ThreadCommentAnchorKind.DOC_DRAWING],
729
+ resolved: false
730
+ }).forEach(({ root, subUnitId }) => {
731
+ const anchor = deserializeThreadCommentAnchor(root.ref);
732
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) !== ThreadCommentAnchorKind.DOC_DRAWING) return;
733
+ const outline = this._getDrawingOutline(anchor.pageId ?? subUnitId, anchor.elementId);
734
+ if (!outline) return;
735
+ this._drawingCommentSubUnits.set(root.id, subUnitId);
736
+ underlines.set(`${anchor.pageId ?? subUnitId}\0${anchor.elementId}`, {
737
+ commentId: root.id,
738
+ left: outline.left,
739
+ top: outline.top + outline.height + 2,
740
+ width: outline.width
741
+ });
742
+ });
743
+ const focusedCommentIds = [];
744
+ const focusOutlines = /* @__PURE__ */ new Map();
745
+ [this._threadCommentPanelService.activeCommentId, this._threadCommentPanelService.hoveredCommentId].forEach((target) => {
746
+ if (!target || target.unitId !== this._context.unitId) return;
747
+ const comment = this._threadCommentModel.getComment(target.unitId, target.subUnitId, target.commentId);
748
+ const anchor = comment && deserializeThreadCommentAnchor(comment.ref);
749
+ if ((anchor === null || anchor === void 0 ? void 0 : anchor.kind) !== ThreadCommentAnchorKind.DOC_DRAWING) return;
750
+ focusedCommentIds.push(target.commentId);
751
+ const outline = this._getDrawingOutline(anchor.pageId ?? target.subUnitId, anchor.elementId);
752
+ if (outline) focusOutlines.set(`${anchor.pageId ?? target.subUnitId}\0${anchor.elementId}`, outline);
753
+ });
754
+ this._drawingOverlay.updateState({
755
+ ...this._getDrawingOverlayColors(),
756
+ markers: [],
757
+ underlines: Array.from(underlines.values()),
758
+ focusedCommentIds,
759
+ focusOutlines: Array.from(focusOutlines.values())
760
+ });
761
+ }
762
+ _getDrawingOutline(subUnitId, drawingId) {
763
+ var _this$_context$scene$, _this$_context$scene;
764
+ const objectKey = getDrawingShapeKeyByDrawingSearch({
765
+ unitId: this._context.unitId,
766
+ subUnitId,
767
+ drawingId
768
+ });
769
+ 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);
770
+ if (!object) return null;
771
+ const bounds = object.getRealBound();
772
+ return {
773
+ left: bounds.left,
774
+ top: bounds.top,
775
+ width: bounds.width,
776
+ height: bounds.height
777
+ };
778
+ }
779
+ _getDrawingOverlayColors() {
780
+ return {
781
+ accentColor: this._themeService.getColorFromTheme("yellow.400"),
782
+ foregroundColor: this._themeService.getColorFromTheme("gray.900"),
783
+ outlineColor: this._themeService.getColorFromTheme("white")
784
+ };
785
+ }
566
786
  _interceptorViewModel() {
567
787
  this._docInterceptorService.intercept(DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION, { handler: (data, pos, next) => {
568
788
  if (!data) return next(data);
569
- const { unitId, index, customDecorations } = pos;
570
- const { commentId, unitId: commentUnitID } = this._threadCommentPanelService.activeCommentId || {};
571
- const activeCustomDecoration = customDecorations.find((i) => i.id === commentId);
789
+ const { unitId } = pos;
790
+ const focusedComments = [this._threadCommentPanelService.activeCommentId, this._threadCommentPanelService.hoveredCommentId];
572
791
  const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, data.id);
573
792
  if (!comment) return next({
574
793
  ...data,
575
794
  show: false
576
795
  });
577
- const isActiveIndex = activeCustomDecoration && index >= activeCustomDecoration.startIndex && index <= activeCustomDecoration.endIndex;
578
- const isActive = commentUnitID === unitId && data.id === commentId;
796
+ const isActive = focusedComments.some((focusedComment) => (focusedComment === null || focusedComment === void 0 ? void 0 : focusedComment.unitId) === unitId && focusedComment.subUnitId === DEFAULT_DOC_SUBUNIT_ID && focusedComment.commentId === data.id);
579
797
  return next({
580
798
  ...data,
581
- active: isActive || isActiveIndex,
799
+ active: isActive,
582
800
  show: !comment.resolved
583
801
  });
584
802
  } });
@@ -588,7 +806,7 @@ let DocThreadCommentRenderController = class DocThreadCommentRenderController ex
588
806
  const unitId = this._context.unit.getUnitId();
589
807
  const subUnitId = DEFAULT_DOC_SUBUNIT_ID;
590
808
  const threadIds = ((_this$_context$unit$g = this._context.unit.getBody()) === null || _this$_context$unit$g === void 0 || (_this$_context$unit$g = _this$_context$unit$g.customDecorations) === null || _this$_context$unit$g === void 0 ? void 0 : _this$_context$unit$g.filter((i) => i.type === CustomDecorationType.COMMENT).map((i) => i.id)) ?? [];
591
- threadIds.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), "default_doc", threadIds);
809
+ threadIds.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), DEFAULT_DOC_SUBUNIT_ID, threadIds);
592
810
  let prevThreadIds = threadIds.sort();
593
811
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
594
812
  if (commandInfo.id === RichTextEditingMutation.id) {
@@ -612,10 +830,11 @@ let DocThreadCommentRenderController = class DocThreadCommentRenderController ex
612
830
  DocThreadCommentRenderController = __decorate([
613
831
  __decorateParam(1, Inject(DocInterceptorService)),
614
832
  __decorateParam(2, Inject(ThreadCommentPanelService)),
615
- __decorateParam(3, Inject(DocRenderController)),
616
- __decorateParam(4, IUniverInstanceService),
617
- __decorateParam(5, Inject(ThreadCommentModel)),
618
- __decorateParam(6, ICommandService)
833
+ __decorateParam(3, IUniverInstanceService),
834
+ __decorateParam(4, Inject(ThreadCommentModel)),
835
+ __decorateParam(5, ICommandService),
836
+ __decorateParam(6, IDrawingManagerService),
837
+ __decorateParam(7, Inject(ThemeService))
619
838
  ], DocThreadCommentRenderController);
620
839
 
621
840
  //#endregion
@@ -645,6 +864,7 @@ let DocThreadCommentUIController = class DocThreadCommentUIController extends Di
645
864
  }
646
865
  _initCommands() {
647
866
  [
867
+ AddDocDrawingCommentOperation,
648
868
  AddDocCommentComment,
649
869
  DeleteDocCommentComment,
650
870
  ShowCommentPanelOperation,
@@ -663,6 +883,11 @@ DocThreadCommentUIController = __decorate([__decorateParam(0, ICommandService),
663
883
 
664
884
  //#endregion
665
885
  //#region src/plugin.ts
886
+ const STARTING_DEPENDENCIES = [
887
+ [DocThreadCommentUIController],
888
+ [DocThreadCommentSelectionController],
889
+ [DocThreadCommentService]
890
+ ];
666
891
  let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin extends Plugin {
667
892
  constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
668
893
  super();
@@ -677,11 +902,7 @@ let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin exte
677
902
  onStarting() {
678
903
  this._injector.add([ComponentsController]);
679
904
  this._injector.get(ComponentsController);
680
- [
681
- [DocThreadCommentUIController],
682
- [DocThreadCommentSelectionController],
683
- [DocThreadCommentService]
684
- ].forEach((dep) => {
905
+ STARTING_DEPENDENCIES.forEach((dep) => {
685
906
  this._injector.add(dep);
686
907
  });
687
908
  }
@@ -691,9 +912,7 @@ let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin exte
691
912
  this._injector.get(DocThreadCommentUIController);
692
913
  }
693
914
  _initRenderModule() {
694
- [DocThreadCommentRenderController].forEach((dep) => {
695
- this._renderManagerSrv.registerRenderModule(UniverInstanceType.UNIVER_DOC, dep);
696
- });
915
+ this._renderManagerSrv.registerRenderModule(UniverInstanceType.UNIVER_DOC, [DocThreadCommentRenderController]);
697
916
  }
698
917
  };
699
918
  _defineProperty(UniverDocsThreadCommentUIPlugin, "pluginName", PLUGIN_NAME);
@@ -701,7 +920,7 @@ _defineProperty(UniverDocsThreadCommentUIPlugin, "packageName", name);
701
920
  _defineProperty(UniverDocsThreadCommentUIPlugin, "version", version);
702
921
  _defineProperty(UniverDocsThreadCommentUIPlugin, "type", UniverInstanceType.UNIVER_DOC);
703
922
  UniverDocsThreadCommentUIPlugin = __decorate([
704
- DependentOn(UniverDocsPlugin, UniverThreadCommentPlugin, UniverRenderEnginePlugin, UniverDocsUIPlugin, UniverThreadCommentUIPlugin),
923
+ DependentOn(UniverDocsPlugin, UniverDocsThreadCommentPlugin, UniverThreadCommentPlugin, UniverDrawingPlugin, UniverRenderEnginePlugin, UniverDocsUIPlugin, UniverThreadCommentUIPlugin),
705
924
  __decorateParam(1, Inject(Injector)),
706
925
  __decorateParam(2, IRenderManagerService),
707
926
  __decorateParam(3, IConfigService)