@univerjs/sheets-thread-comment 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.
package/lib/es/facade.js CHANGED
@@ -1,11 +1,13 @@
1
- import { CanceledError, ICommandService, IUniverInstanceService, Inject, Injector, Range, RichTextBuilder, RichTextValue, Tools, UniverInstanceType, UserManagerService, generateRandomId } from "@univerjs/core";
1
+ import * as UniverCore from "@univerjs/core";
2
+ import { CanceledError, ICommandService, IUniverInstanceService, Inject, Injector, RichTextBuilder, RichTextValue, Tools, UniverInstanceType, UserManagerService, generateRandomId } from "@univerjs/core";
2
3
  import { SheetsThreadCommentModel } from "@univerjs/sheets-thread-comment";
3
4
  import { FRange, FWorkbook, FWorksheet } from "@univerjs/sheets/facade";
5
+ import * as ThreadComment from "@univerjs/thread-comment";
4
6
  import { AddCommentCommand, DeleteCommentCommand, DeleteCommentTreeCommand, ResolveCommentCommand, ThreadCommentModel, UpdateCommentCommand, getDT } from "@univerjs/thread-comment";
5
7
  import { deserializeRangeWithSheet } from "@univerjs/engine-formula";
6
8
  import { FEventName, FUniver } from "@univerjs/core/facade";
7
9
 
8
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
10
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
9
11
  function _typeof(o) {
10
12
  "@babel/helpers - typeof";
11
13
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -16,7 +18,7 @@ function _typeof(o) {
16
18
  }
17
19
 
18
20
  //#endregion
19
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
21
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
20
22
  function toPrimitive(t, r) {
21
23
  if ("object" != _typeof(t) || !t) return t;
22
24
  var e = t[Symbol.toPrimitive];
@@ -29,14 +31,14 @@ function toPrimitive(t, r) {
29
31
  }
30
32
 
31
33
  //#endregion
32
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
34
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
33
35
  function toPropertyKey(t) {
34
36
  var i = toPrimitive(t, "string");
35
37
  return "symbol" == _typeof(i) ? i : i + "";
36
38
  }
37
39
 
38
40
  //#endregion
39
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
41
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
40
42
  function _defineProperty(e, r, t) {
41
43
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
44
  value: t,
@@ -47,7 +49,7 @@ function _defineProperty(e, r, t) {
47
49
  }
48
50
 
49
51
  //#endregion
50
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
52
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
51
53
  function __decorateParam(paramIndex, decorator) {
52
54
  return function(target, key) {
53
55
  decorator(target, key, paramIndex);
@@ -55,7 +57,7 @@ function __decorateParam(paramIndex, decorator) {
55
57
  }
56
58
 
57
59
  //#endregion
58
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
60
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
59
61
  function __decorate(decorators, target, key, desc) {
60
62
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
63
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -73,7 +75,7 @@ var _FThreadComment;
73
75
  var FTheadCommentItem = class FTheadCommentItem {
74
76
  /**
75
77
  * Create a new FTheadCommentItem
76
- * @param {IThreadComment|undefined} comment The comment
78
+ * @param {IThreadComment|undefined} [comment] The comment
77
79
  * @returns {FTheadCommentItem} A new instance of FTheadCommentItem
78
80
  * @example
79
81
  * ```ts
@@ -344,7 +346,8 @@ let FThreadComment = _FThreadComment = class FThreadComment {
344
346
  }
345
347
  _getRef() {
346
348
  var _this$_parent;
347
- return deserializeRangeWithSheet(((_this$_parent = this._parent) === null || _this$_parent === void 0 ? void 0 : _this$_parent.ref) || this._thread.ref).range;
349
+ const ref = ((_this$_parent = this._parent) === null || _this$_parent === void 0 ? void 0 : _this$_parent.ref) || this._thread.ref;
350
+ return deserializeRangeWithSheet(ref).range;
348
351
  }
349
352
  /**
350
353
  * Whether the comment is a root comment
@@ -383,7 +386,7 @@ let FThreadComment = _FThreadComment = class FThreadComment {
383
386
  }
384
387
  /**
385
388
  * Get the replies of the comment
386
- * @returns {FThreadComment[]} the replies of the comment
389
+ * @returns {FThreadComment[] | undefined} The loaded replies, or `undefined` when the thread or its replies are unavailable.
387
390
  * @example
388
391
  * ```ts
389
392
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -515,7 +518,7 @@ let FThreadComment = _FThreadComment = class FThreadComment {
515
518
  }
516
519
  /**
517
520
  * Resolve the comment
518
- * @param {boolean} resolved Whether the comment is resolved
521
+ * @param {boolean} [resolved] Whether the comment is resolved
519
522
  * @returns {Promise<boolean>} Set the comment to resolved or not operation result
520
523
  * @example
521
524
  * ```ts
@@ -605,69 +608,99 @@ FThreadComment = _FThreadComment = __decorate([
605
608
  //#endregion
606
609
  //#region src/facade/f-range.ts
607
610
  /**
611
+ * Copyright 2023-present DreamNum Co., Ltd.
612
+ *
613
+ * Licensed under the Apache License, Version 2.0 (the "License");
614
+ * you may not use this file except in compliance with the License.
615
+ * You may obtain a copy of the License at
616
+ *
617
+ * http://www.apache.org/licenses/LICENSE-2.0
618
+ *
619
+ * Unless required by applicable law or agreed to in writing, software
620
+ * distributed under the License is distributed on an "AS IS" BASIS,
621
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
622
+ * See the License for the specific language governing permissions and
623
+ * limitations under the License.
624
+ */
625
+ function firstNonEmpty(...values) {
626
+ for (const value of values) if (value) return value;
627
+ return UniverCore.generateRandomId();
628
+ }
629
+ /**
608
630
  * @ignore
609
631
  */
610
632
  var FRangeSheetsThreadCommentMixin = class extends FRange {
611
- getComment() {
612
- const sheetsTheadCommentModel = this._injector.get(SheetsThreadCommentModel);
613
- const unitId = this._workbook.getUnitId();
614
- const sheetId = this._worksheet.getSheetId();
615
- const commentId = sheetsTheadCommentModel.getByLocation(unitId, sheetId, this._range.startRow, this._range.startColumn);
616
- if (!commentId) return null;
617
- const comment = sheetsTheadCommentModel.getComment(unitId, sheetId, commentId);
618
- if (comment) return this._injector.createInstance(FThreadComment, comment);
619
- return null;
633
+ _initialize(injector) {
634
+ let dependencies;
635
+ Object.defineProperty(this, "_dependencies", { get: () => dependencies ??= {
636
+ commandService: injector.get(UniverCore.ICommandService),
637
+ model: injector.get(SheetsThreadCommentModel),
638
+ userManagerService: injector.get(UniverCore.UserManagerService)
639
+ } });
620
640
  }
621
- getComments() {
622
- const sheetsTheadCommentModel = this._injector.get(SheetsThreadCommentModel);
641
+ _getCommentDataInRange() {
642
+ const model = this._dependencies.model;
623
643
  const unitId = this._workbook.getUnitId();
624
644
  const sheetId = this._worksheet.getSheetId();
625
645
  const comments = [];
626
- Range.foreach(this._range, (row, col) => {
627
- const commentId = sheetsTheadCommentModel.getByLocation(unitId, sheetId, row, col);
628
- if (commentId) {
629
- const comment = sheetsTheadCommentModel.getComment(unitId, sheetId, commentId);
630
- if (comment) comments.push(this._injector.createInstance(FThreadComment, comment));
631
- }
646
+ UniverCore.Range.foreach(this._range, (row, col) => {
647
+ const commentId = model.getByLocation(unitId, sheetId, row, col);
648
+ const comment = commentId ? model.getComment(unitId, sheetId, commentId) : null;
649
+ if (comment) comments.push(comment);
632
650
  });
633
651
  return comments;
634
652
  }
635
- addCommentAsync(content) {
636
- var _this$getComment;
637
- const injector = this._injector;
638
- const currentComment = (_this$getComment = this.getComment()) === null || _this$getComment === void 0 ? void 0 : _this$getComment.getCommentData();
639
- const commentService = injector.get(ICommandService);
640
- const userService = injector.get(UserManagerService);
653
+ _getStartCellCommentData() {
654
+ const model = this._dependencies.model;
655
+ const unitId = this._workbook.getUnitId();
656
+ const sheetId = this._worksheet.getSheetId();
657
+ const commentId = model.getByLocation(unitId, sheetId, this._range.startRow, this._range.startColumn);
658
+ return commentId ? model.getComment(unitId, sheetId, commentId) ?? null : null;
659
+ }
660
+ getComment() {
661
+ const comment = this._getStartCellCommentData();
662
+ return comment ? this._injector.createInstance(FThreadComment, comment) : null;
663
+ }
664
+ getComments() {
665
+ return this._getCommentDataInRange().map((comment) => this._injector.createInstance(FThreadComment, comment));
666
+ }
667
+ addCommentAsync(content, options = {}) {
668
+ const { commandService, userManagerService } = this._dependencies;
669
+ const currentComment = this._getStartCellCommentData();
641
670
  const unitId = this._workbook.getUnitId();
642
671
  const sheetId = this._worksheet.getSheetId();
643
- const refStr = `${Tools.chatAtABC(this._range.startColumn)}${this._range.startRow + 1}`;
644
- const currentUser = userService.getCurrentUser();
645
- const commentData = content instanceof FTheadCommentBuilder ? content.build() : { text: content };
646
- return commentService.executeCommand(AddCommentCommand.id, {
672
+ const refStr = `${UniverCore.Tools.chatAtABC(this._range.startColumn)}${this._range.startRow + 1}`;
673
+ const currentUser = userManagerService.getCurrentUser();
674
+ let commentData = null;
675
+ let text;
676
+ if (content instanceof FTheadCommentBuilder) {
677
+ commentData = content.build();
678
+ text = commentData.text;
679
+ } else text = ThreadComment.normalizeThreadCommentContent(content);
680
+ return commandService.executeCommand(ThreadComment.AddCommentCommand.id, {
647
681
  unitId,
648
682
  subUnitId: sheetId,
649
683
  comment: {
650
- text: commentData.text,
651
- dT: commentData.dT || getDT(),
652
- attachments: [],
653
- id: commentData.id || generateRandomId(),
684
+ text,
685
+ dT: options.dateTime ? ThreadComment.getDT(options.dateTime) : (commentData === null || commentData === void 0 ? void 0 : commentData.dT) || ThreadComment.getDT(),
686
+ attachments: options.attachments ?? (commentData === null || commentData === void 0 ? void 0 : commentData.attachments) ?? [],
687
+ id: firstNonEmpty(options.id, commentData === null || commentData === void 0 ? void 0 : commentData.id),
654
688
  ref: refStr,
655
- personId: commentData.personId || currentUser.userID,
689
+ personId: firstNonEmpty(options.personId, commentData === null || commentData === void 0 ? void 0 : commentData.personId, currentUser.userID),
690
+ authorName: options.authorName ?? (commentData === null || commentData === void 0 ? void 0 : commentData.authorName),
656
691
  parentId: currentComment === null || currentComment === void 0 ? void 0 : currentComment.id,
657
692
  unitId,
658
693
  subUnitId: sheetId,
659
- threadId: (currentComment === null || currentComment === void 0 ? void 0 : currentComment.threadId) || generateRandomId()
694
+ threadId: firstNonEmpty(currentComment === null || currentComment === void 0 ? void 0 : currentComment.threadId, options.threadId, commentData === null || commentData === void 0 ? void 0 : commentData.threadId)
660
695
  }
661
696
  });
662
697
  }
663
698
  clearCommentAsync() {
664
- var _this$getComment2;
665
- const injector = this._injector;
666
- const currentComment = (_this$getComment2 = this.getComment()) === null || _this$getComment2 === void 0 ? void 0 : _this$getComment2.getCommentData();
667
- const commentService = injector.get(ICommandService);
699
+ const { commandService } = this._dependencies;
700
+ const currentComment = this._getStartCellCommentData();
668
701
  const unitId = this._workbook.getUnitId();
669
702
  const sheetId = this._worksheet.getSheetId();
670
- if (currentComment) return commentService.executeCommand(DeleteCommentTreeCommand.id, {
703
+ if (currentComment) return commandService.executeCommand(ThreadComment.DeleteCommentTreeCommand.id, {
671
704
  unitId,
672
705
  subUnitId: sheetId,
673
706
  threadId: currentComment.threadId,
@@ -675,9 +708,16 @@ var FRangeSheetsThreadCommentMixin = class extends FRange {
675
708
  });
676
709
  return Promise.resolve(true);
677
710
  }
678
- clearCommentsAsync() {
679
- const promises = this.getComments().map((comment) => comment.deleteAsync());
680
- return Promise.all(promises).then(() => true);
711
+ async clearCommentsAsync() {
712
+ const { commandService } = this._dependencies;
713
+ const unitId = this._workbook.getUnitId();
714
+ const subUnitId = this._worksheet.getSheetId();
715
+ return (await Promise.all(this._getCommentDataInRange().map((comment) => commandService.executeCommand(ThreadComment.DeleteCommentTreeCommand.id, {
716
+ unitId,
717
+ subUnitId,
718
+ threadId: comment.threadId,
719
+ commentId: comment.id
720
+ })))).every(Boolean);
681
721
  }
682
722
  };
683
723
  FRange.extend(FRangeSheetsThreadCommentMixin);
package/lib/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { DependentOn, Disposable, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, UniverInstanceType, generateRandomId, merge, sequenceExecuteAsync, toDisposable, touchDependencies } from "@univerjs/core";
1
+ import { DependentOn, Disposable, ICommandService, IConfigService, IResourceManagerService, IUniverInstanceService, Inject, Injector, ObjectMatrix, Plugin, UniverInstanceType, generateRandomId, merge, sequenceExecuteAsync, toDisposable, touchDependencies } from "@univerjs/core";
2
2
  import { serializeRange, singleReferenceToGrid } from "@univerjs/engine-formula";
3
3
  import { CopySheetCommand, RefRangeService, RemoveSheetCommand, SheetInterceptorService, SheetsSelectionsService, UniverSheetsPlugin, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests } from "@univerjs/sheets";
4
- import { AddCommentMutation, DeleteCommentMutation, IThreadCommentDataSourceService, ThreadCommentModel, UniverThreadCommentPlugin, UpdateCommentRefMutation } from "@univerjs/thread-comment";
4
+ import { AddCommentMutation, DeleteCommentMutation, IThreadCommentDataSourceService, TC_PLUGIN_NAME, ThreadCommentModel, UniverThreadCommentPlugin, UpdateCommentRefMutation, createThreadCommentResourceHook, deserializeThreadCommentAnchor } from "@univerjs/thread-comment";
5
5
  import { Subject } from "rxjs";
6
6
 
7
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
7
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
8
8
  function _typeof(o) {
9
9
  "@babel/helpers - typeof";
10
10
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -15,7 +15,7 @@ function _typeof(o) {
15
15
  }
16
16
 
17
17
  //#endregion
18
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
18
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
19
19
  function toPrimitive(t, r) {
20
20
  if ("object" != _typeof(t) || !t) return t;
21
21
  var e = t[Symbol.toPrimitive];
@@ -28,14 +28,14 @@ function toPrimitive(t, r) {
28
28
  }
29
29
 
30
30
  //#endregion
31
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
31
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
32
32
  function toPropertyKey(t) {
33
33
  var i = toPrimitive(t, "string");
34
34
  return "symbol" == _typeof(i) ? i : i + "";
35
35
  }
36
36
 
37
37
  //#endregion
38
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
38
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
39
39
  function _defineProperty(e, r, t) {
40
40
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41
41
  value: t,
@@ -46,7 +46,7 @@ function _defineProperty(e, r, t) {
46
46
  }
47
47
 
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
49
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
50
50
  function __decorateParam(paramIndex, decorator) {
51
51
  return function(target, key) {
52
52
  decorator(target, key, paramIndex);
@@ -54,7 +54,7 @@ function __decorateParam(paramIndex, decorator) {
54
54
  }
55
55
 
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
57
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
58
58
  function __decorate(decorators, target, key, desc) {
59
59
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
60
60
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -136,6 +136,7 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
136
136
  }
137
137
  }
138
138
  _addComment(unitId, subUnitId, comment) {
139
+ if (deserializeThreadCommentAnchor(comment.ref)) return;
139
140
  const location = singleReferenceToGrid(comment.ref);
140
141
  const parentId = comment.parentId;
141
142
  const { row, column } = location;
@@ -170,6 +171,7 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
170
171
  break;
171
172
  case "delete": {
172
173
  const { isRoot, comment } = update.payload;
174
+ if (deserializeThreadCommentAnchor(comment.ref)) return;
173
175
  if (isRoot) {
174
176
  const location = singleReferenceToGrid(comment.ref);
175
177
  const { row, column } = location;
@@ -185,6 +187,7 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
185
187
  const { commentId } = update.payload;
186
188
  const comment = this._threadCommentModel.getComment(unitId, subUnitId, commentId);
187
189
  if (!comment) return;
190
+ if (deserializeThreadCommentAnchor(comment.ref)) return;
188
191
  const location = singleReferenceToGrid(comment.ref);
189
192
  this._commentUpdate$.next({
190
193
  ...update,
@@ -193,6 +196,7 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
193
196
  break;
194
197
  }
195
198
  case "updateRef": {
199
+ if (deserializeThreadCommentAnchor(update.payload.ref)) return;
196
200
  const location = singleReferenceToGrid(update.payload.ref);
197
201
  const { commentId } = update.payload;
198
202
  const currentLoc = locationMap.get(commentId);
@@ -223,13 +227,13 @@ let SheetsThreadCommentModel = class SheetsThreadCommentModel extends Disposable
223
227
  });
224
228
  break;
225
229
  }
226
- default: break;
227
230
  }
228
231
  }));
229
232
  }
230
233
  getByLocation(unitId, subUnitId, row, column) {
231
- var _activeComments$;
232
- return (_activeComments$ = this.getAllByLocation(unitId, subUnitId, row, column).filter((comment) => !comment.resolved)[0]) === null || _activeComments$ === void 0 ? void 0 : _activeComments$.id;
234
+ var _activeComments;
235
+ const activeComments = this.getAllByLocation(unitId, subUnitId, row, column).filter((comment) => !comment.resolved);
236
+ return (_activeComments = activeComments[activeComments.length - 1]) === null || _activeComments === void 0 ? void 0 : _activeComments.id;
233
237
  }
234
238
  getAllByLocation(unitId, subUnitId, row, column) {
235
239
  const current = this._ensureCommentMatrix(unitId, subUnitId).getValue(row, column);
@@ -383,6 +387,7 @@ let SheetsThreadCommentRefRangeController = class SheetsThreadCommentRefRangeCon
383
387
  const datas = this._threadCommentModel.getAll();
384
388
  for (const data of datas) for (const thread of data.threads) {
385
389
  const { unitId, subUnitId, root } = thread;
390
+ if (deserializeThreadCommentAnchor(root.ref)) continue;
386
391
  const pos = singleReferenceToGrid(root.ref);
387
392
  const sheetComment = {
388
393
  ...root,
@@ -446,12 +451,7 @@ SheetsThreadCommentRefRangeController = __decorate([
446
451
  ], SheetsThreadCommentRefRangeController);
447
452
 
448
453
  //#endregion
449
- //#region package.json
450
- var name = "@univerjs/sheets-thread-comment";
451
- var version = "1.0.0-insiders.20260813-7c9aa50";
452
-
453
- //#endregion
454
- //#region src/config/config.ts
454
+ //#region src/types/const.ts
455
455
  /**
456
456
  * Copyright 2023-present DreamNum Co., Ltd.
457
457
  *
@@ -467,21 +467,25 @@ var version = "1.0.0-insiders.20260813-7c9aa50";
467
467
  * See the License for the specific language governing permissions and
468
468
  * limitations under the License.
469
469
  */
470
- const SHEETS_THREAD_COMMENT_PLUGIN_CONFIG_KEY = "sheets-thread-comment.config";
471
- const configSymbol = Symbol(SHEETS_THREAD_COMMENT_PLUGIN_CONFIG_KEY);
472
- const defaultPluginConfig = {};
470
+ const SHEET_THREAD_COMMENT_BASE = "SHEET_THREAD_COMMENT_BASE_PLUGIN";
471
+ const SHEET_UNIVER_THREAD_COMMENT_PLUGIN = `SHEET_${TC_PLUGIN_NAME}`;
473
472
 
474
473
  //#endregion
475
474
  //#region src/controllers/sheets-thread-comment-resource.controller.ts
476
475
  let SheetsThreadCommentResourceController = class SheetsThreadCommentResourceController extends Disposable {
477
- constructor(_univerInstanceService, _sheetInterceptorService, _threadCommentModel, _threadCommentDataSourceService) {
476
+ constructor(_resourceManagerService, _univerInstanceService, _sheetInterceptorService, _threadCommentModel, _threadCommentDataSourceService) {
478
477
  super();
478
+ this._resourceManagerService = _resourceManagerService;
479
479
  this._univerInstanceService = _univerInstanceService;
480
480
  this._sheetInterceptorService = _sheetInterceptorService;
481
481
  this._threadCommentModel = _threadCommentModel;
482
482
  this._threadCommentDataSourceService = _threadCommentDataSourceService;
483
+ this._initSnapshot();
483
484
  this._initSheetChange();
484
485
  }
486
+ _initSnapshot() {
487
+ this.disposeWithMe(this._resourceManagerService.registerPluginResource(createThreadCommentResourceHook(this._threadCommentModel, this._threadCommentDataSourceService, SHEET_UNIVER_THREAD_COMMENT_PLUGIN, [UniverInstanceType.UNIVER_SHEET])));
488
+ }
485
489
  _initSheetChange() {
486
490
  this.disposeWithMe(this._sheetInterceptorService.interceptCommand({ getMutations: (commandInfo) => {
487
491
  if (commandInfo.id === RemoveSheetCommand.id) {
@@ -577,14 +581,20 @@ let SheetsThreadCommentResourceController = class SheetsThreadCommentResourceCon
577
581
  }
578
582
  };
579
583
  SheetsThreadCommentResourceController = __decorate([
580
- __decorateParam(0, IUniverInstanceService),
581
- __decorateParam(1, Inject(SheetInterceptorService)),
582
- __decorateParam(2, Inject(ThreadCommentModel)),
583
- __decorateParam(3, IThreadCommentDataSourceService)
584
+ __decorateParam(0, IResourceManagerService),
585
+ __decorateParam(1, IUniverInstanceService),
586
+ __decorateParam(2, Inject(SheetInterceptorService)),
587
+ __decorateParam(3, Inject(ThreadCommentModel)),
588
+ __decorateParam(4, IThreadCommentDataSourceService)
584
589
  ], SheetsThreadCommentResourceController);
585
590
 
586
591
  //#endregion
587
- //#region src/types/const.ts
592
+ //#region package.json
593
+ var name = "@univerjs/sheets-thread-comment";
594
+ var version = "1.0.0";
595
+
596
+ //#endregion
597
+ //#region src/config/config.ts
588
598
  /**
589
599
  * Copyright 2023-present DreamNum Co., Ltd.
590
600
  *
@@ -600,7 +610,9 @@ SheetsThreadCommentResourceController = __decorate([
600
610
  * See the License for the specific language governing permissions and
601
611
  * limitations under the License.
602
612
  */
603
- const SHEET_THREAD_COMMENT_BASE = "SHEET_THREAD_COMMENT_BASE_PLUGIN";
613
+ const SHEETS_THREAD_COMMENT_PLUGIN_CONFIG_KEY = "sheets-thread-comment.config";
614
+ const configSymbol = Symbol(SHEETS_THREAD_COMMENT_PLUGIN_CONFIG_KEY);
615
+ const defaultPluginConfig = {};
604
616
 
605
617
  //#endregion
606
618
  //#region src/plugin.ts
@@ -637,4 +649,4 @@ UniverSheetsThreadCommentPlugin = __decorate([
637
649
  ], UniverSheetsThreadCommentPlugin);
638
650
 
639
651
  //#endregion
640
- export { SheetsThreadCommentModel, SheetsThreadCommentRefRangeController, UniverSheetsThreadCommentPlugin };
652
+ export { SHEET_UNIVER_THREAD_COMMENT_PLUGIN, SheetsThreadCommentModel, SheetsThreadCommentRefRangeController, SheetsThreadCommentResourceController, UniverSheetsThreadCommentPlugin };