@univerjs/docs-thread-comment-ui 1.0.0-alpha.7 → 1.0.0-alpha.8

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/cjs/index.js CHANGED
@@ -88,7 +88,7 @@ const DeleteDocCommentComment = {
88
88
  };
89
89
 
90
90
  //#endregion
91
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
91
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
92
92
  function _typeof(o) {
93
93
  "@babel/helpers - typeof";
94
94
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -99,7 +99,7 @@ function _typeof(o) {
99
99
  }
100
100
 
101
101
  //#endregion
102
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
102
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
103
103
  function toPrimitive(t, r) {
104
104
  if ("object" != _typeof(t) || !t) return t;
105
105
  var e = t[Symbol.toPrimitive];
@@ -112,14 +112,14 @@ function toPrimitive(t, r) {
112
112
  }
113
113
 
114
114
  //#endregion
115
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
115
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
116
116
  function toPropertyKey(t) {
117
117
  var i = toPrimitive(t, "string");
118
118
  return "symbol" == _typeof(i) ? i : i + "";
119
119
  }
120
120
 
121
121
  //#endregion
122
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
122
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
123
123
  function _defineProperty(e, r, t) {
124
124
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
125
125
  value: t,
@@ -130,7 +130,7 @@ function _defineProperty(e, r, t) {
130
130
  }
131
131
 
132
132
  //#endregion
133
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
133
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
134
134
  function __decorateParam(paramIndex, decorator) {
135
135
  return function(target, key) {
136
136
  decorator(target, key, paramIndex);
@@ -138,7 +138,7 @@ function __decorateParam(paramIndex, decorator) {
138
138
  }
139
139
 
140
140
  //#endregion
141
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
141
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
142
142
  function __decorate(decorators, target, key, desc) {
143
143
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
144
144
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -231,7 +231,7 @@ const StartAddCommentOperation = {
231
231
  const sidebarService = accessor.get(_univerjs_ui.ISidebarService);
232
232
  const textRange = docSelectionManagerService.getActiveTextRange();
233
233
  if (!doc || !textRange) return false;
234
- const docSelectionRenderManager = (_renderManagerService = renderManagerService.getRenderById(doc.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs_ui.DocSelectionRenderService);
234
+ const docSelectionRenderManager = (_renderManagerService = renderManagerService.getRenderUnitById(doc.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(_univerjs_docs_ui.DocSelectionRenderService);
235
235
  docSelectionRenderManager === null || docSelectionRenderManager === void 0 || docSelectionRenderManager.setReserveRangesStatus(true);
236
236
  if (textRange.collapsed) {
237
237
  if (panelService.panelVisible) {
@@ -332,7 +332,7 @@ const menuSchema = {
332
332
  //#endregion
333
333
  //#region package.json
334
334
  var name = "@univerjs/docs-thread-comment-ui";
335
- var version = "1.0.0-alpha.7";
335
+ var version = "1.0.0-alpha.8";
336
336
 
337
337
  //#endregion
338
338
  //#region src/config/config.ts
@@ -514,7 +514,7 @@ let DocThreadCommentSelectionController = class DocThreadCommentSelectionControl
514
514
  const doc = this._univerInstanceService.getUnit(activeComment.unitId);
515
515
  if (doc) {
516
516
  var _this$_renderManagerS, _doc$getBody3;
517
- const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocBackScrollRenderController);
517
+ const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocBackScrollRenderController);
518
518
  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);
519
519
  if (customRange && backScrollController) backScrollController.scrollToRange({
520
520
  startOffset: customRange.startIndex,
@@ -704,7 +704,7 @@ _defineProperty(UniverDocsThreadCommentUIPlugin, "packageName", name);
704
704
  _defineProperty(UniverDocsThreadCommentUIPlugin, "version", version);
705
705
  _defineProperty(UniverDocsThreadCommentUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_DOC);
706
706
  UniverDocsThreadCommentUIPlugin = __decorate([
707
- (0, _univerjs_core.DependentOn)(_univerjs_thread_comment_ui.UniverThreadCommentUIPlugin),
707
+ (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_thread_comment.UniverThreadCommentPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_ui.UniverUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin, _univerjs_thread_comment_ui.UniverThreadCommentUIPlugin),
708
708
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
709
709
  __decorateParam(2, _univerjs_engine_render.IRenderManagerService),
710
710
  __decorateParam(3, _univerjs_core.IConfigService)
package/lib/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
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, addCustomDecorationBySelectionFactory, deleteCustomDecorationFactory } from "@univerjs/docs-ui";
3
- import { AddCommentMutation, IThreadCommentDataSourceService, ThreadCommentModel, getDT } from "@univerjs/thread-comment";
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
4
  import { SetActiveCommentOperation, ThreadCommentPanel, ThreadCommentPanelService, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
5
- import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
6
- import { DocumentEditArea, IRenderManagerService, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
7
- import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
5
+ import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
6
+ import { DocumentEditArea, IRenderManagerService, UniverRenderEnginePlugin, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
7
+ import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonInsertGroup, UniverUIPlugin, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
8
8
  import { BehaviorSubject, Observable, debounceTime, filter, map } from "rxjs";
9
9
  import { CommentIcon } from "@univerjs/icons";
10
10
  import { useEffect, useMemo, useState } from "react";
@@ -87,7 +87,7 @@ const DeleteDocCommentComment = {
87
87
  };
88
88
 
89
89
  //#endregion
90
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
90
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
91
91
  function _typeof(o) {
92
92
  "@babel/helpers - typeof";
93
93
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -98,7 +98,7 @@ function _typeof(o) {
98
98
  }
99
99
 
100
100
  //#endregion
101
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
101
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
102
102
  function toPrimitive(t, r) {
103
103
  if ("object" != _typeof(t) || !t) return t;
104
104
  var e = t[Symbol.toPrimitive];
@@ -111,14 +111,14 @@ function toPrimitive(t, r) {
111
111
  }
112
112
 
113
113
  //#endregion
114
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
114
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
115
115
  function toPropertyKey(t) {
116
116
  var i = toPrimitive(t, "string");
117
117
  return "symbol" == _typeof(i) ? i : i + "";
118
118
  }
119
119
 
120
120
  //#endregion
121
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
121
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
122
122
  function _defineProperty(e, r, t) {
123
123
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
124
124
  value: t,
@@ -129,7 +129,7 @@ function _defineProperty(e, r, t) {
129
129
  }
130
130
 
131
131
  //#endregion
132
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
132
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
133
133
  function __decorateParam(paramIndex, decorator) {
134
134
  return function(target, key) {
135
135
  decorator(target, key, paramIndex);
@@ -137,7 +137,7 @@ function __decorateParam(paramIndex, decorator) {
137
137
  }
138
138
 
139
139
  //#endregion
140
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
140
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
141
141
  function __decorate(decorators, target, key, desc) {
142
142
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
143
143
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -230,7 +230,7 @@ const StartAddCommentOperation = {
230
230
  const sidebarService = accessor.get(ISidebarService);
231
231
  const textRange = docSelectionManagerService.getActiveTextRange();
232
232
  if (!doc || !textRange) return false;
233
- const docSelectionRenderManager = (_renderManagerService = renderManagerService.getRenderById(doc.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
233
+ const docSelectionRenderManager = (_renderManagerService = renderManagerService.getRenderUnitById(doc.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
234
234
  docSelectionRenderManager === null || docSelectionRenderManager === void 0 || docSelectionRenderManager.setReserveRangesStatus(true);
235
235
  if (textRange.collapsed) {
236
236
  if (panelService.panelVisible) {
@@ -331,7 +331,7 @@ const menuSchema = {
331
331
  //#endregion
332
332
  //#region package.json
333
333
  var name = "@univerjs/docs-thread-comment-ui";
334
- var version = "1.0.0-alpha.7";
334
+ var version = "1.0.0-alpha.8";
335
335
 
336
336
  //#endregion
337
337
  //#region src/config/config.ts
@@ -513,7 +513,7 @@ let DocThreadCommentSelectionController = class DocThreadCommentSelectionControl
513
513
  const doc = this._univerInstanceService.getUnit(activeComment.unitId);
514
514
  if (doc) {
515
515
  var _this$_renderManagerS, _doc$getBody3;
516
- const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
516
+ const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
517
517
  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);
518
518
  if (customRange && backScrollController) backScrollController.scrollToRange({
519
519
  startOffset: customRange.startIndex,
@@ -703,7 +703,7 @@ _defineProperty(UniverDocsThreadCommentUIPlugin, "packageName", name);
703
703
  _defineProperty(UniverDocsThreadCommentUIPlugin, "version", version);
704
704
  _defineProperty(UniverDocsThreadCommentUIPlugin, "type", UniverInstanceType.UNIVER_DOC);
705
705
  UniverDocsThreadCommentUIPlugin = __decorate([
706
- DependentOn(UniverThreadCommentUIPlugin),
706
+ DependentOn(UniverDocsPlugin, UniverThreadCommentPlugin, UniverRenderEnginePlugin, UniverUIPlugin, UniverDocsUIPlugin, UniverThreadCommentUIPlugin),
707
707
  __decorateParam(1, Inject(Injector)),
708
708
  __decorateParam(2, IRenderManagerService),
709
709
  __decorateParam(3, IConfigService)
package/lib/index.js CHANGED
@@ -1,10 +1,10 @@
1
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, addCustomDecorationBySelectionFactory, deleteCustomDecorationFactory } from "@univerjs/docs-ui";
3
- import { AddCommentMutation, IThreadCommentDataSourceService, ThreadCommentModel, getDT } from "@univerjs/thread-comment";
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
4
  import { SetActiveCommentOperation, ThreadCommentPanel, ThreadCommentPanelService, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
5
- import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
6
- import { DocumentEditArea, IRenderManagerService, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
7
- import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
5
+ import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation, UniverDocsPlugin } from "@univerjs/docs";
6
+ import { DocumentEditArea, IRenderManagerService, UniverRenderEnginePlugin, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
7
+ import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonInsertGroup, UniverUIPlugin, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
8
8
  import { BehaviorSubject, Observable, debounceTime, filter, map } from "rxjs";
9
9
  import { CommentIcon } from "@univerjs/icons";
10
10
  import { useEffect, useMemo, useState } from "react";
@@ -87,7 +87,7 @@ const DeleteDocCommentComment = {
87
87
  };
88
88
 
89
89
  //#endregion
90
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
90
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
91
91
  function _typeof(o) {
92
92
  "@babel/helpers - typeof";
93
93
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -98,7 +98,7 @@ function _typeof(o) {
98
98
  }
99
99
 
100
100
  //#endregion
101
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
101
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
102
102
  function toPrimitive(t, r) {
103
103
  if ("object" != _typeof(t) || !t) return t;
104
104
  var e = t[Symbol.toPrimitive];
@@ -111,14 +111,14 @@ function toPrimitive(t, r) {
111
111
  }
112
112
 
113
113
  //#endregion
114
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
114
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
115
115
  function toPropertyKey(t) {
116
116
  var i = toPrimitive(t, "string");
117
117
  return "symbol" == _typeof(i) ? i : i + "";
118
118
  }
119
119
 
120
120
  //#endregion
121
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
121
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
122
122
  function _defineProperty(e, r, t) {
123
123
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
124
124
  value: t,
@@ -129,7 +129,7 @@ function _defineProperty(e, r, t) {
129
129
  }
130
130
 
131
131
  //#endregion
132
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
132
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
133
133
  function __decorateParam(paramIndex, decorator) {
134
134
  return function(target, key) {
135
135
  decorator(target, key, paramIndex);
@@ -137,7 +137,7 @@ function __decorateParam(paramIndex, decorator) {
137
137
  }
138
138
 
139
139
  //#endregion
140
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
140
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
141
141
  function __decorate(decorators, target, key, desc) {
142
142
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
143
143
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -230,7 +230,7 @@ const StartAddCommentOperation = {
230
230
  const sidebarService = accessor.get(ISidebarService);
231
231
  const textRange = docSelectionManagerService.getActiveTextRange();
232
232
  if (!doc || !textRange) return false;
233
- const docSelectionRenderManager = (_renderManagerService = renderManagerService.getRenderById(doc.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
233
+ const docSelectionRenderManager = (_renderManagerService = renderManagerService.getRenderUnitById(doc.getUnitId())) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
234
234
  docSelectionRenderManager === null || docSelectionRenderManager === void 0 || docSelectionRenderManager.setReserveRangesStatus(true);
235
235
  if (textRange.collapsed) {
236
236
  if (panelService.panelVisible) {
@@ -331,7 +331,7 @@ const menuSchema = {
331
331
  //#endregion
332
332
  //#region package.json
333
333
  var name = "@univerjs/docs-thread-comment-ui";
334
- var version = "1.0.0-alpha.7";
334
+ var version = "1.0.0-alpha.8";
335
335
 
336
336
  //#endregion
337
337
  //#region src/config/config.ts
@@ -513,7 +513,7 @@ let DocThreadCommentSelectionController = class DocThreadCommentSelectionControl
513
513
  const doc = this._univerInstanceService.getUnit(activeComment.unitId);
514
514
  if (doc) {
515
515
  var _this$_renderManagerS, _doc$getBody3;
516
- const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
516
+ const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
517
517
  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);
518
518
  if (customRange && backScrollController) backScrollController.scrollToRange({
519
519
  startOffset: customRange.startIndex,
@@ -703,7 +703,7 @@ _defineProperty(UniverDocsThreadCommentUIPlugin, "packageName", name);
703
703
  _defineProperty(UniverDocsThreadCommentUIPlugin, "version", version);
704
704
  _defineProperty(UniverDocsThreadCommentUIPlugin, "type", UniverInstanceType.UNIVER_DOC);
705
705
  UniverDocsThreadCommentUIPlugin = __decorate([
706
- DependentOn(UniverThreadCommentUIPlugin),
706
+ DependentOn(UniverDocsPlugin, UniverThreadCommentPlugin, UniverRenderEnginePlugin, UniverUIPlugin, UniverDocsUIPlugin, UniverThreadCommentUIPlugin),
707
707
  __decorateParam(1, Inject(Injector)),
708
708
  __decorateParam(2, IRenderManagerService),
709
709
  __decorateParam(3, IConfigService)
package/lib/umd/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("rxjs"),require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/docs-ui`,`@univerjs/thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/docs`,`@univerjs/engine-render`,`@univerjs/ui`,`rxjs`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsThreadCommentUi={},e.UniverCore,e.UniverDocsUi,e.UniverThreadComment,e.UniverThreadCommentUi,e.UniverDocs,e.UniverEngineRender,e.UniverUi,e.rxjs,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let d=`univer.doc.thread-comment-panel`,f=`default_doc`,p={id:`docs.command.add-comment`,type:t.CommandType.COMMAND,async handler(e,a){if(!a)return!1;let{comment:o,unitId:s}=a,c=await e.get(r.IThreadCommentDataSourceService).addComment(o),l=e.get(t.ICommandService),u=(0,n.addCustomDecorationBySelectionFactory)(e,{id:c.threadId,type:t.CustomDecorationType.COMMENT,unitId:s});return u?(await(0,t.sequenceExecute)([{id:r.AddCommentMutation.id,params:{unitId:s,subUnitId:f,comment:c}},u,{id:i.SetActiveCommentOperation.id,params:{unitId:s,subUnitId:f,commentId:c.id}}],l)).result:!1}},m={id:`docs.command.delete-comment`,type:t.CommandType.COMMAND,async handler(e,r){if(!r)return!1;let{commentId:i,unitId:a}=r,o=e.get(t.ICommandService),s=(0,n.deleteCustomDecorationFactory)(e,{id:i,unitId:a});return s?(await(0,t.sequenceExecute)([s],o)).result:!1}};function h(e){"@babel/helpers - typeof";return h=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h(e)}function g(e,t){if(h(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(h(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _(e){var t=g(e,`string`);return h(t)==`symbol`?t:t+``}function v(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let x=class extends t.Disposable{get addingComment(){return this._addingComment$.getValue()}constructor(e,t){super(),this._sidebarService=e,this._threadCommentPanelService=t,v(this,`_addingComment$`,new c.BehaviorSubject(void 0)),v(this,`addingComment$`,this._addingComment$.asObservable()),this.disposeWithMe(()=>{this._addingComment$.complete()})}startAdd(e){this._addingComment$.next(e)}endAdd(){this._addingComment$.next(void 0)}};x=b([y(0,s.ISidebarService),y(1,(0,t.Inject)(i.ThreadCommentPanelService))],x);let S={id:`docs.operation.show-comment-panel`,type:t.CommandType.OPERATION,handler(e,t){var n;let r=e.get(i.ThreadCommentPanelService),a=e.get(s.ISidebarService);return(!r.panelVisible||((n=a.options.children)==null?void 0:n.label)!==`univer.doc.thread-comment-panel`)&&(a.open({header:{title:`docs-thread-comment-ui.panel.title`},children:{label:d},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},C={id:`docs.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){var t;let n=e.get(i.ThreadCommentPanelService),r=e.get(s.ISidebarService);return!n.panelVisible||((t=r.options.children)==null?void 0:t.label)!==`univer.doc.thread-comment-panel`?(r.open({header:{title:`docs-thread-comment-ui.panel.title`},children:{label:d},width:320,onClose:()=>n.setPanelVisible(!1)}),n.setPanelVisible(!0)):(r.close(),n.setPanelVisible(!1),n.setActiveComment(null)),!0}},w={id:`docs.operation.start-add-comment`,type:t.CommandType.OPERATION,handler(e){var c,l,u;let d=e.get(i.ThreadCommentPanelService),p=e.get(t.IUniverInstanceService).getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC),m=e.get(a.DocSelectionManagerService),h=e.get(o.IRenderManagerService),g=e.get(t.UserManagerService),_=e.get(x),v=e.get(t.ICommandService),y=e.get(s.ISidebarService),b=m.getActiveTextRange();if(!p||!b)return!1;let C=(c=h.getRenderById(p.getUnitId()))==null?void 0:c.with(n.DocSelectionRenderService);if(C==null||C.setReserveRangesStatus(!0),b.collapsed)return d.panelVisible?(d.setPanelVisible(!1),y.close()):v.executeCommand(S.id),!0;v.executeCommand(S.id);let w=p.getUnitId(),T=((l=(u=p.getBody())==null?void 0:u.dataStream)==null?``:l).slice(b.startOffset,b.endOffset),E=t.BuildTextUtils.transform.getPlainText(T),D=f,O={unitId:w,subUnitId:D,id:``,ref:E,dT:(0,r.getDT)(),personId:g.getCurrentUser().userID,text:{dataStream:`\r
2
- `},startOffset:b.startOffset,endOffset:b.endOffset,collapsed:!0,threadId:``};return C==null||C.blur(),_.startAdd(O),d.setActiveComment({unitId:w,subUnitId:D,commentId:``}),!0}},T=e=>{var n;let r=e.get(o.IRenderManagerService),i=e.get(a.DocSelectionManagerService),s=(n=(0,o.withCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_DOC,a.DocSkeletonManagerService,e.get(t.IUniverInstanceService),r))==null?void 0:n.getSkeleton(),c=s==null?void 0:s.getViewModel().getEditArea();if(c===o.DocumentEditArea.FOOTER||c===o.DocumentEditArea.HEADER)return!0;let l=i.getActiveTextRange();return!!(l==null||l.collapsed)};function E(e){return{id:w.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`docs-thread-comment-ui.panel.addComment`,tooltip:`docs-thread-comment-ui.panel.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_DOC,void 0,t.SHEET_EDITOR_UNITS),disabled$:new c.Observable(function(t){let n=e.get(a.DocSelectionManagerService).textSelection$.pipe((0,c.debounceTime)(16)).subscribe(()=>{t.next(T(e))});return()=>{n.unsubscribe()}})}}function D(e){return{id:C.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`docs-thread-comment-ui.panel.addComment`,tooltip:`docs-thread-comment-ui.panel.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_DOC)}}let O={[s.RibbonInsertGroup.MEDIA]:{[C.id]:{order:3,menuItemFactory:D}},[n.FLOAT_TOOLBAR_MENU_POSITION]:{[w.id]:{order:21,menuItemFactory:E}},[s.ContextMenuPosition.MAIN_AREA]:{[s.ContextMenuGroup.DATA]:{[w.id]:{order:1,menuItemFactory:E}}}};var k=`@univerjs/docs-thread-comment-ui`,A=`1.0.0-alpha.7`;let j={};function M({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,l.useRef)(`_${I()}`);return N(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function N(e,t,n,r,i){return(0,l.createElement)(e.tag,{key:t,...P(e,n,i),...r},(F(e,n).children||[]).map((r,a)=>N(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function P(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function F(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function I(){return Math.random().toString(36).substring(2,8)}M.displayName=`UniverIcon`;let L={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},R=(0,l.forwardRef)(function(e,t){return(0,l.createElement)(M,Object.assign({},e,{id:`comment-icon`,ref:t,icon:L}))});R.displayName=`CommentIcon`;let z=()=>{let e=(0,s.useDependency)(t.IUniverInstanceService),n=(0,s.useDependency)(t.Injector),r=(0,s.useObservable)((0,l.useMemo)(()=>e.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_DOC).pipe((0,c.filter)(e=>!!e&&!(0,t.isInternalEditorID)(e.getUnitId()))),[e])),o=(0,l.useMemo)(()=>new c.Observable(e=>e.next(f)),[]),d=(0,s.useDependency)(a.DocSelectionManagerService),h=(0,l.useMemo)(()=>d.textSelection$.pipe((0,c.debounceTime)(16)),[d.textSelection$]),g=(0,s.useObservable)(()=>h.pipe((0,c.map)(()=>T(n))),T(n),!1,[n,h]),_=(0,s.useDependency)(t.ICommandService),v=(0,s.useDependency)(x),y=(0,s.useObservable)(v.addingComment$),[b,S]=(0,l.useState)([]);if((0,l.useEffect)(()=>{var e;let t=new Set,n=r==null?void 0:r.getCustomDecorations();S((e=n==null?void 0:n.map(e=>e.id).filter(e=>{let n=t.has(e);return t.add(e),!n}))==null?[]:e);let i=_.onCommandExecuted(e=>{if(e.id===a.RichTextEditingMutation.id){var t;let e=new Set,n=r==null?void 0:r.getCustomDecorations();S((t=n==null?void 0:n.map(e=>e.id).filter(t=>{let n=e.has(t);return e.add(t),!n}))==null?[]:t)}});return()=>{i.dispose()}},[_,r]),!r)return null;let C=r.getUnitId();return(0,u.jsx)(i.ThreadCommentPanel,{unitId:C,subUnitId$:o,type:t.UniverInstanceType.UNIVER_DOC,onAdd:()=>{_.executeCommand(w.id)},getSubUnitName:()=>``,disableAdd:g,tempComment:y,onAddComment:e=>{if(!e.parentId){let t={unitId:C,range:y,comment:e};return _.executeCommand(p.id,t),v.endAdd(),!1}return!0},onDeleteComment:e=>{if(!e.parentId){let t={unitId:C,commentId:e.id};return _.executeCommand(m.id,t),!1}return!0},showComments:b})},B=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){[[d,z]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_registerIcons(){this.disposeWithMe(this._iconManager.register({CommentIcon:R}))}};B=b([y(0,(0,t.Inject)(s.ComponentManager)),y(1,(0,t.Inject)(s.IconManager))],B);let V=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=n,this._docThreadCommentService=r,this._renderManagerService=i,this._threadCommentModel=a,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===a.SetTextSelectionsOperation.id){let{unitId:a,ranges:s}=n.params;if((0,t.isInternalEditorID)(a))return;let c=this._univerInstanceService.getUnit(a,t.UniverInstanceType.UNIVER_DOC),l=s[0];if((e==null?void 0:e.startOffset)===(l==null?void 0:l.startOffset)&&(e==null?void 0:e.endOffset)===(l==null?void 0:l.endOffset))return;if(e=l,l&&c){let{startOffset:e,endOffset:t,collapsed:n}=l,i;if(n){var r;i=(r=c.getBody())==null||(r=r.customDecorations)==null?void 0:r.find(n=>n.startIndex<=e&&n.endIndex>=t-1)}else{var o;i=(o=c.getBody())==null||(o=o.customDecorations)==null?void 0:o.find(n=>n.startIndex<=e&&n.endIndex>=t-1)}if(i){let e=this._threadCommentModel.getComment(a,f,i.id);e&&!e.resolved&&this._commandService.executeCommand(S.id,{activeComment:{unitId:a,subUnitId:f,commentId:i.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;let u=this._docThreadCommentService.addingComment,d=this._threadCommentPanelService.activeCommentId;if(u&&(d==null?void 0:d.unitId)===u.unitId&&(d==null?void 0:d.subUnitId)===`default_doc`&&(d==null?void 0:d.commentId)===u.id)return;this._commandService.executeCommand(i.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t;if(e){let t=this._univerInstanceService.getUnit(e.unitId);if(t){var r,i;let a=(r=this._renderManagerService.getRenderById(e.unitId))==null?void 0:r.with(n.DocBackScrollRenderController),o=(i=t.getBody())==null||(i=i.customDecorations)==null?void 0:i.find(t=>t.id===e.commentId);o&&a&&a.scrollToRange({startOffset:o.startIndex,endOffset:o.endIndex,collapsed:!1})}}(!e||e.commentId!==((t=this._docThreadCommentService.addingComment)==null?void 0:t.id))&&this._docThreadCommentService.endAdd()}))}};V=b([y(0,(0,t.Inject)(i.ThreadCommentPanelService)),y(1,t.IUniverInstanceService),y(2,t.ICommandService),y(3,(0,t.Inject)(x)),y(4,o.IRenderManagerService),y(5,(0,t.Inject)(r.ThreadCommentModel))],V);let H=class extends t.Disposable{constructor(e,t,n,r,i,a,o){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=n,this._docRenderController=r,this._univerInstanceService=i,this._threadCommentModel=a,this._commandService=o,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var n;if(e){this._docRenderController.reRender(e.unitId);return}let r=(n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC))==null?void 0:n.getUnitId();r&&this._docRenderController.reRender(r)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type===`resolve`&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(a.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,n)=>{if(!e)return n(e);let{unitId:r,index:i,customDecorations:a}=t,{commentId:o,unitId:s}=this._threadCommentPanelService.activeCommentId||{},c=a.find(e=>e.id===o),l=this._threadCommentModel.getComment(r,f,e.id);if(!l)return n({...e,show:!1});let u=c&&i>=c.startIndex&&i<=c.endIndex,d=s===r&&e.id===o;return n({...e,active:d||u,show:!l.resolved})}})}_initSyncComments(){var e,n;let r=this._context.unit.getUnitId(),i=(e=(n=this._context.unit.getBody())==null||(n=n.customDecorations)==null?void 0:n.filter(e=>e.type===t.CustomDecorationType.COMMENT).map(e=>e.id))==null?[]:e;i.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),`default_doc`,i);let o=i.sort();this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===a.RichTextEditingMutation.id){var n,i;if(e.params.unitId!==this._context.unit.getUnitId())return;let a=(n=(i=this._context.unit.getBody())==null||(i=i.customDecorations)==null?void 0:i.filter(e=>e.type===t.CustomDecorationType.COMMENT).map(e=>e.id))==null?[]:n,s=a.sort();if(JSON.stringify(o)!==JSON.stringify(s)){let e=new Set(o),t=new Set;a.forEach(n=>{e.has(n)||t.add(n)}),o=s,this._threadCommentModel.syncThreadComments(r,`default_doc`,[...t])}}}))}};H=b([y(1,(0,t.Inject)(a.DocInterceptorService)),y(2,(0,t.Inject)(i.ThreadCommentPanelService)),y(3,(0,t.Inject)(n.DocRenderController)),y(4,t.IUniverInstanceService),y(5,(0,t.Inject)(r.ThreadCommentModel)),y(6,t.ICommandService)],H);let U=class extends t.Disposable{constructor(e,t){super(),this._commandService=e,this._menuManagerService=t,this._initCommands(),this._initMenus()}_initCommands(){[p,m,S,w,C].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.appendRootMenu({[n.FLOAT_TOOLBAR_MENU_POSITION]:{}}),this._menuManagerService.mergeMenu(O)}};U=b([y(0,t.ICommandService),y(1,s.IMenuManagerService)],U);let W=class extends t.Plugin{constructor(e=j,n,r,i){super(),this._config=e,this._injector=n,this._renderManagerSrv=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},j,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`docs-thread-comment-ui.config`,o)}onStarting(){this._injector.add([B]),this._injector.get(B),[[U],[V],[x]].forEach(e=>{this._injector.add(e)})}onRendered(){this._initRenderModule(),this._injector.get(V),this._injector.get(U)}_initRenderModule(){[H].forEach(e=>{this._renderManagerSrv.registerRenderModule(t.UniverInstanceType.UNIVER_DOC,e)})}};v(W,`pluginName`,`DOC_THREAD_COMMENT_UI_PLUGIN`),v(W,`packageName`,k),v(W,`version`,A),v(W,`type`,t.UniverInstanceType.UNIVER_DOC),W=b([(0,t.DependentOn)(i.UniverThreadCommentUIPlugin),y(1,(0,t.Inject)(t.Injector)),y(2,o.IRenderManagerService),y(3,t.IConfigService)],W),e.AddDocCommentComment=p,e.DeleteDocCommentComment=m,e.DocsThreadCommentUIMenuSchema=O,e.ShowCommentPanelOperation=S,e.StartAddCommentOperation=w,Object.defineProperty(e,"UniverDocsThreadCommentUIPlugin",{enumerable:!0,get:function(){return W}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("@univerjs/docs-ui"),require("@univerjs/thread-comment"),require("@univerjs/thread-comment-ui"),require("@univerjs/docs"),require("@univerjs/engine-render"),require("@univerjs/ui"),require("rxjs"),require("react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/docs-ui`,`@univerjs/thread-comment`,`@univerjs/thread-comment-ui`,`@univerjs/docs`,`@univerjs/engine-render`,`@univerjs/ui`,`rxjs`,`react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverDocsThreadCommentUi={},e.UniverCore,e.UniverDocsUi,e.UniverThreadComment,e.UniverThreadCommentUi,e.UniverDocs,e.UniverEngineRender,e.UniverUi,e.rxjs,e.React,e.React))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let d=`univer.doc.thread-comment-panel`,f=`default_doc`,p={id:`docs.command.add-comment`,type:t.CommandType.COMMAND,async handler(e,a){if(!a)return!1;let{comment:o,unitId:s}=a,c=await e.get(r.IThreadCommentDataSourceService).addComment(o),l=e.get(t.ICommandService),u=(0,n.addCustomDecorationBySelectionFactory)(e,{id:c.threadId,type:t.CustomDecorationType.COMMENT,unitId:s});return u?(await(0,t.sequenceExecute)([{id:r.AddCommentMutation.id,params:{unitId:s,subUnitId:f,comment:c}},u,{id:i.SetActiveCommentOperation.id,params:{unitId:s,subUnitId:f,commentId:c.id}}],l)).result:!1}},m={id:`docs.command.delete-comment`,type:t.CommandType.COMMAND,async handler(e,r){if(!r)return!1;let{commentId:i,unitId:a}=r,o=e.get(t.ICommandService),s=(0,n.deleteCustomDecorationFactory)(e,{id:i,unitId:a});return s?(await(0,t.sequenceExecute)([s],o)).result:!1}};function h(e){"@babel/helpers - typeof";return h=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h(e)}function g(e,t){if(h(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(h(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _(e){var t=g(e,`string`);return h(t)==`symbol`?t:t+``}function v(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){return function(n,r){t(n,r,e)}}function b(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let x=class extends t.Disposable{get addingComment(){return this._addingComment$.getValue()}constructor(e,t){super(),this._sidebarService=e,this._threadCommentPanelService=t,v(this,`_addingComment$`,new c.BehaviorSubject(void 0)),v(this,`addingComment$`,this._addingComment$.asObservable()),this.disposeWithMe(()=>{this._addingComment$.complete()})}startAdd(e){this._addingComment$.next(e)}endAdd(){this._addingComment$.next(void 0)}};x=b([y(0,s.ISidebarService),y(1,(0,t.Inject)(i.ThreadCommentPanelService))],x);let S={id:`docs.operation.show-comment-panel`,type:t.CommandType.OPERATION,handler(e,t){var n;let r=e.get(i.ThreadCommentPanelService),a=e.get(s.ISidebarService);return(!r.panelVisible||((n=a.options.children)==null?void 0:n.label)!==`univer.doc.thread-comment-panel`)&&(a.open({header:{title:`docs-thread-comment-ui.panel.title`},children:{label:d},width:320,onClose:()=>r.setPanelVisible(!1)}),r.setPanelVisible(!0)),t&&r.setActiveComment(t==null?void 0:t.activeComment),!0}},C={id:`docs.operation.toggle-comment-panel`,type:t.CommandType.OPERATION,handler(e){var t;let n=e.get(i.ThreadCommentPanelService),r=e.get(s.ISidebarService);return!n.panelVisible||((t=r.options.children)==null?void 0:t.label)!==`univer.doc.thread-comment-panel`?(r.open({header:{title:`docs-thread-comment-ui.panel.title`},children:{label:d},width:320,onClose:()=>n.setPanelVisible(!1)}),n.setPanelVisible(!0)):(r.close(),n.setPanelVisible(!1),n.setActiveComment(null)),!0}},w={id:`docs.operation.start-add-comment`,type:t.CommandType.OPERATION,handler(e){var c,l,u;let d=e.get(i.ThreadCommentPanelService),p=e.get(t.IUniverInstanceService).getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC),m=e.get(a.DocSelectionManagerService),h=e.get(o.IRenderManagerService),g=e.get(t.UserManagerService),_=e.get(x),v=e.get(t.ICommandService),y=e.get(s.ISidebarService),b=m.getActiveTextRange();if(!p||!b)return!1;let C=(c=h.getRenderUnitById(p.getUnitId()))==null?void 0:c.with(n.DocSelectionRenderService);if(C==null||C.setReserveRangesStatus(!0),b.collapsed)return d.panelVisible?(d.setPanelVisible(!1),y.close()):v.executeCommand(S.id),!0;v.executeCommand(S.id);let w=p.getUnitId(),T=((l=(u=p.getBody())==null?void 0:u.dataStream)==null?``:l).slice(b.startOffset,b.endOffset),E=t.BuildTextUtils.transform.getPlainText(T),D=f,O={unitId:w,subUnitId:D,id:``,ref:E,dT:(0,r.getDT)(),personId:g.getCurrentUser().userID,text:{dataStream:`\r
2
+ `},startOffset:b.startOffset,endOffset:b.endOffset,collapsed:!0,threadId:``};return C==null||C.blur(),_.startAdd(O),d.setActiveComment({unitId:w,subUnitId:D,commentId:``}),!0}},T=e=>{var n;let r=e.get(o.IRenderManagerService),i=e.get(a.DocSelectionManagerService),s=(n=(0,o.withCurrentTypeOfRenderer)(t.UniverInstanceType.UNIVER_DOC,a.DocSkeletonManagerService,e.get(t.IUniverInstanceService),r))==null?void 0:n.getSkeleton(),c=s==null?void 0:s.getViewModel().getEditArea();if(c===o.DocumentEditArea.FOOTER||c===o.DocumentEditArea.HEADER)return!0;let l=i.getActiveTextRange();return!!(l==null||l.collapsed)};function E(e){return{id:w.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`docs-thread-comment-ui.panel.addComment`,tooltip:`docs-thread-comment-ui.panel.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_DOC,void 0,t.SHEET_EDITOR_UNITS),disabled$:new c.Observable(function(t){let n=e.get(a.DocSelectionManagerService).textSelection$.pipe((0,c.debounceTime)(16)).subscribe(()=>{t.next(T(e))});return()=>{n.unsubscribe()}})}}function D(e){return{id:C.id,type:s.MenuItemType.BUTTON,icon:`CommentIcon`,title:`docs-thread-comment-ui.panel.addComment`,tooltip:`docs-thread-comment-ui.panel.addComment`,hidden$:(0,s.getMenuHiddenObservable)(e,t.UniverInstanceType.UNIVER_DOC)}}let O={[s.RibbonInsertGroup.MEDIA]:{[C.id]:{order:3,menuItemFactory:D}},[n.FLOAT_TOOLBAR_MENU_POSITION]:{[w.id]:{order:21,menuItemFactory:E}},[s.ContextMenuPosition.MAIN_AREA]:{[s.ContextMenuGroup.DATA]:{[w.id]:{order:1,menuItemFactory:E}}}};var k=`@univerjs/docs-thread-comment-ui`,A=`1.0.0-alpha.8`;let j={};function M({ref:e,...t}){let{icon:n,id:r,className:i,extend:a,...o}=t,s=`univerjs-icon univerjs-icon-${r} ${i||``}`.trim(),c=(0,l.useRef)(`_${I()}`);return N(n,`${r}`,{defIds:n.defIds,idSuffix:c.current},{ref:e,className:s,...o},a)}function N(e,t,n,r,i){return(0,l.createElement)(e.tag,{key:t,...P(e,n,i),...r},(F(e,n).children||[]).map((r,a)=>N(r,`${t}-${e.tag}-${a}`,n,void 0,i)))}function P(e,t,n){let r={...e.attrs};n!=null&&n.colorChannel1&&r.fill===`colorChannel1`&&(r.fill=n.colorChannel1),n!=null&&n.colorChannel1&&r.stroke===`colorChannel1`&&(r.stroke=n.colorChannel1),e.tag===`mask`&&r.id&&(r.id+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{e===`mask`&&typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))});let{defIds:i}=t;return!i||i.length===0?r:(e.tag===`use`&&r[`xlink:href`]&&(r[`xlink:href`]+=t.idSuffix),Object.entries(r).forEach(([e,n])=>{typeof n==`string`&&(r[e]=n.replace(/url\(#(.*)\)/,`url(#$1${t.idSuffix})`))}),r)}function F(e,t){var n;let{defIds:r}=t;return!r||r.length===0?e:e.tag===`defs`&&(n=e.children)!=null&&n.length?{...e,children:e.children.map(e=>typeof e.attrs.id==`string`&&r&&r.includes(e.attrs.id)?{...e,attrs:{...e.attrs,id:e.attrs.id+t.idSuffix}}:e)}:e}function I(){return Math.random().toString(36).substring(2,8)}M.displayName=`UniverIcon`;let L={tag:`svg`,attrs:{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 17 17`,width:`1em`,height:`1em`},children:[{tag:`path`,attrs:{fill:`currentColor`,d:`M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345ZM8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345ZM11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z`,fillRule:`evenodd`,clipRule:`evenodd`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M5.83725 6.78345C6.22188 6.78345 6.53368 7.10742 6.53368 7.50706V8.41159C6.53368 8.81123 6.22188 9.13521 5.83725 9.13521C5.45263 9.13521 5.14082 8.81123 5.14082 8.41159V7.50706C5.14082 7.10742 5.45263 6.78345 5.83725 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M8.73904 6.78345C9.12366 6.78345 9.43546 7.10742 9.43546 7.50706V8.41159C9.43546 8.81123 9.12366 9.13521 8.73904 9.13521C8.35441 9.13521 8.04261 8.81123 8.04261 8.41159V7.50706C8.04261 7.10742 8.35441 6.78345 8.73904 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M11.6408 6.78345C12.0254 6.78345 12.3372 7.10742 12.3372 7.50706V8.41159C12.3372 8.81123 12.0254 9.13521 11.6408 9.13521C11.2562 9.13521 10.9444 8.81123 10.9444 8.41159V7.50706C10.9444 7.10742 11.2562 6.78345 11.6408 6.78345Z`}},{tag:`path`,attrs:{fill:`currentColor`,d:`M1.84351 3.41861C1.84351 3.01861 2.15531 2.69434 2.53993 2.69434H14.9381C15.3228 2.69434 15.6346 3.01861 15.6346 3.41861V12.4611C15.6346 12.8612 15.3228 13.1854 14.9381 13.1854H8.82117L6.06643 14.6179C5.85054 14.7301 5.59416 14.7181 5.38884 14.5862C5.18352 14.4542 5.05855 14.2211 5.05855 13.9701V13.1854H2.53993C2.15531 13.1854 1.84351 12.8612 1.84351 12.4611L1.84351 3.41861ZM6.45141 12.7982L8.34531 12.0135C8.44201 11.9632 8.54864 11.9371 8.65676 11.9371H14.2417C14.3522 11.9371 14.4417 11.8475 14.4417 11.7371V4.14271C14.4417 4.03225 14.3522 3.94271 14.2417 3.94271H3.23636C3.12591 3.94271 3.03636 4.03225 3.03636 4.14271L3.03636 11.7371C3.03636 11.8475 3.12591 11.9371 3.23636 11.9371L5.75498 11.9371C6.1396 11.9371 6.45141 12.0611 6.45141 12.4611V12.7982Z`,fillRule:`evenodd`,clipRule:`evenodd`}}]},R=(0,l.forwardRef)(function(e,t){return(0,l.createElement)(M,Object.assign({},e,{id:`comment-icon`,ref:t,icon:L}))});R.displayName=`CommentIcon`;let z=()=>{let e=(0,s.useDependency)(t.IUniverInstanceService),n=(0,s.useDependency)(t.Injector),r=(0,s.useObservable)((0,l.useMemo)(()=>e.getCurrentTypeOfUnit$(t.UniverInstanceType.UNIVER_DOC).pipe((0,c.filter)(e=>!!e&&!(0,t.isInternalEditorID)(e.getUnitId()))),[e])),o=(0,l.useMemo)(()=>new c.Observable(e=>e.next(f)),[]),d=(0,s.useDependency)(a.DocSelectionManagerService),h=(0,l.useMemo)(()=>d.textSelection$.pipe((0,c.debounceTime)(16)),[d.textSelection$]),g=(0,s.useObservable)(()=>h.pipe((0,c.map)(()=>T(n))),T(n),!1,[n,h]),_=(0,s.useDependency)(t.ICommandService),v=(0,s.useDependency)(x),y=(0,s.useObservable)(v.addingComment$),[b,S]=(0,l.useState)([]);if((0,l.useEffect)(()=>{var e;let t=new Set,n=r==null?void 0:r.getCustomDecorations();S((e=n==null?void 0:n.map(e=>e.id).filter(e=>{let n=t.has(e);return t.add(e),!n}))==null?[]:e);let i=_.onCommandExecuted(e=>{if(e.id===a.RichTextEditingMutation.id){var t;let e=new Set,n=r==null?void 0:r.getCustomDecorations();S((t=n==null?void 0:n.map(e=>e.id).filter(t=>{let n=e.has(t);return e.add(t),!n}))==null?[]:t)}});return()=>{i.dispose()}},[_,r]),!r)return null;let C=r.getUnitId();return(0,u.jsx)(i.ThreadCommentPanel,{unitId:C,subUnitId$:o,type:t.UniverInstanceType.UNIVER_DOC,onAdd:()=>{_.executeCommand(w.id)},getSubUnitName:()=>``,disableAdd:g,tempComment:y,onAddComment:e=>{if(!e.parentId){let t={unitId:C,range:y,comment:e};return _.executeCommand(p.id,t),v.endAdd(),!1}return!0},onDeleteComment:e=>{if(!e.parentId){let t={unitId:C,commentId:e.id};return _.executeCommand(m.id,t),!1}return!0},showComments:b})},B=class extends t.Disposable{constructor(e,t){super(),this._componentManager=e,this._iconManager=t,this._registerComponents(),this._registerIcons()}_registerComponents(){[[d,z]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))})}_registerIcons(){this.disposeWithMe(this._iconManager.register({CommentIcon:R}))}};B=b([y(0,(0,t.Inject)(s.ComponentManager)),y(1,(0,t.Inject)(s.IconManager))],B);let V=class extends t.Disposable{constructor(e,t,n,r,i,a){super(),this._threadCommentPanelService=e,this._univerInstanceService=t,this._commandService=n,this._docThreadCommentService=r,this._renderManagerService=i,this._threadCommentModel=a,this._initSelectionChange(),this._initActiveCommandChange()}_initSelectionChange(){let e;this.disposeWithMe(this._commandService.onCommandExecuted(n=>{if(n.id===a.SetTextSelectionsOperation.id){let{unitId:a,ranges:s}=n.params;if((0,t.isInternalEditorID)(a))return;let c=this._univerInstanceService.getUnit(a,t.UniverInstanceType.UNIVER_DOC),l=s[0];if((e==null?void 0:e.startOffset)===(l==null?void 0:l.startOffset)&&(e==null?void 0:e.endOffset)===(l==null?void 0:l.endOffset))return;if(e=l,l&&c){let{startOffset:e,endOffset:t,collapsed:n}=l,i;if(n){var r;i=(r=c.getBody())==null||(r=r.customDecorations)==null?void 0:r.find(n=>n.startIndex<=e&&n.endIndex>=t-1)}else{var o;i=(o=c.getBody())==null||(o=o.customDecorations)==null?void 0:o.find(n=>n.startIndex<=e&&n.endIndex>=t-1)}if(i){let e=this._threadCommentModel.getComment(a,f,i.id);e&&!e.resolved&&this._commandService.executeCommand(S.id,{activeComment:{unitId:a,subUnitId:f,commentId:i.id}});return}}if(!this._threadCommentPanelService.activeCommentId)return;let u=this._docThreadCommentService.addingComment,d=this._threadCommentPanelService.activeCommentId;if(u&&(d==null?void 0:d.unitId)===u.unitId&&(d==null?void 0:d.subUnitId)===`default_doc`&&(d==null?void 0:d.commentId)===u.id)return;this._commandService.executeCommand(i.SetActiveCommentOperation.id)}}))}_initActiveCommandChange(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var t;if(e){let t=this._univerInstanceService.getUnit(e.unitId);if(t){var r,i;let a=(r=this._renderManagerService.getRenderUnitById(e.unitId))==null?void 0:r.with(n.DocBackScrollRenderController),o=(i=t.getBody())==null||(i=i.customDecorations)==null?void 0:i.find(t=>t.id===e.commentId);o&&a&&a.scrollToRange({startOffset:o.startIndex,endOffset:o.endIndex,collapsed:!1})}}(!e||e.commentId!==((t=this._docThreadCommentService.addingComment)==null?void 0:t.id))&&this._docThreadCommentService.endAdd()}))}};V=b([y(0,(0,t.Inject)(i.ThreadCommentPanelService)),y(1,t.IUniverInstanceService),y(2,t.ICommandService),y(3,(0,t.Inject)(x)),y(4,o.IRenderManagerService),y(5,(0,t.Inject)(r.ThreadCommentModel))],V);let H=class extends t.Disposable{constructor(e,t,n,r,i,a,o){super(),this._context=e,this._docInterceptorService=t,this._threadCommentPanelService=n,this._docRenderController=r,this._univerInstanceService=i,this._threadCommentModel=a,this._commandService=o,this._interceptorViewModel(),this._initReRender(),this._initSyncComments()}_initReRender(){this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(e=>{var n;if(e){this._docRenderController.reRender(e.unitId);return}let r=(n=this._univerInstanceService.getCurrentUnitOfType(t.UniverInstanceType.UNIVER_DOC))==null?void 0:n.getUnitId();r&&this._docRenderController.reRender(r)})),this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe(e=>{e.type===`resolve`&&this._docRenderController.reRender(e.unitId)}))}_interceptorViewModel(){this._docInterceptorService.intercept(a.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION,{handler:(e,t,n)=>{if(!e)return n(e);let{unitId:r,index:i,customDecorations:a}=t,{commentId:o,unitId:s}=this._threadCommentPanelService.activeCommentId||{},c=a.find(e=>e.id===o),l=this._threadCommentModel.getComment(r,f,e.id);if(!l)return n({...e,show:!1});let u=c&&i>=c.startIndex&&i<=c.endIndex,d=s===r&&e.id===o;return n({...e,active:d||u,show:!l.resolved})}})}_initSyncComments(){var e,n;let r=this._context.unit.getUnitId(),i=(e=(n=this._context.unit.getBody())==null||(n=n.customDecorations)==null?void 0:n.filter(e=>e.type===t.CustomDecorationType.COMMENT).map(e=>e.id))==null?[]:e;i.length&&this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(),`default_doc`,i);let o=i.sort();this.disposeWithMe(this._commandService.onCommandExecuted(e=>{if(e.id===a.RichTextEditingMutation.id){var n,i;if(e.params.unitId!==this._context.unit.getUnitId())return;let a=(n=(i=this._context.unit.getBody())==null||(i=i.customDecorations)==null?void 0:i.filter(e=>e.type===t.CustomDecorationType.COMMENT).map(e=>e.id))==null?[]:n,s=a.sort();if(JSON.stringify(o)!==JSON.stringify(s)){let e=new Set(o),t=new Set;a.forEach(n=>{e.has(n)||t.add(n)}),o=s,this._threadCommentModel.syncThreadComments(r,`default_doc`,[...t])}}}))}};H=b([y(1,(0,t.Inject)(a.DocInterceptorService)),y(2,(0,t.Inject)(i.ThreadCommentPanelService)),y(3,(0,t.Inject)(n.DocRenderController)),y(4,t.IUniverInstanceService),y(5,(0,t.Inject)(r.ThreadCommentModel)),y(6,t.ICommandService)],H);let U=class extends t.Disposable{constructor(e,t){super(),this._commandService=e,this._menuManagerService=t,this._initCommands(),this._initMenus()}_initCommands(){[p,m,S,w,C].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenus(){this._menuManagerService.appendRootMenu({[n.FLOAT_TOOLBAR_MENU_POSITION]:{}}),this._menuManagerService.mergeMenu(O)}};U=b([y(0,t.ICommandService),y(1,s.IMenuManagerService)],U);let W=class extends t.Plugin{constructor(e=j,n,r,i){super(),this._config=e,this._injector=n,this._renderManagerSrv=r,this._configService=i;let{menu:a,...o}=(0,t.merge)({},j,this._config);a&&this._configService.setConfig(`menu`,a,{merge:!0}),this._configService.setConfig(`docs-thread-comment-ui.config`,o)}onStarting(){this._injector.add([B]),this._injector.get(B),[[U],[V],[x]].forEach(e=>{this._injector.add(e)})}onRendered(){this._initRenderModule(),this._injector.get(V),this._injector.get(U)}_initRenderModule(){[H].forEach(e=>{this._renderManagerSrv.registerRenderModule(t.UniverInstanceType.UNIVER_DOC,e)})}};v(W,`pluginName`,`DOC_THREAD_COMMENT_UI_PLUGIN`),v(W,`packageName`,k),v(W,`version`,A),v(W,`type`,t.UniverInstanceType.UNIVER_DOC),W=b([(0,t.DependentOn)(a.UniverDocsPlugin,r.UniverThreadCommentPlugin,o.UniverRenderEnginePlugin,s.UniverUIPlugin,n.UniverDocsUIPlugin,i.UniverThreadCommentUIPlugin),y(1,(0,t.Inject)(t.Injector)),y(2,o.IRenderManagerService),y(3,t.IConfigService)],W),e.AddDocCommentComment=p,e.DeleteDocCommentComment=m,e.DocsThreadCommentUIMenuSchema=O,e.ShowCommentPanelOperation=S,e.StartAddCommentOperation=w,Object.defineProperty(e,"UniverDocsThreadCommentUIPlugin",{enumerable:!0,get:function(){return W}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/docs-thread-comment-ui",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.8",
4
4
  "private": false,
5
5
  "description": "Thread comment UI integration for Univer Docs.",
6
6
  "author": "DreamNum Co., Ltd. <developer@univer.ai>",
@@ -59,22 +59,22 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@univerjs/icons": "1.34.0",
62
- "@univerjs/core": "1.0.0-alpha.7",
63
- "@univerjs/docs": "1.0.0-alpha.7",
64
- "@univerjs/thread-comment": "1.0.0-alpha.7",
65
- "@univerjs/thread-comment-ui": "1.0.0-alpha.7",
66
- "@univerjs/docs-ui": "1.0.0-alpha.7",
67
- "@univerjs/ui": "1.0.0-alpha.7",
68
- "@univerjs/engine-render": "1.0.0-alpha.7"
62
+ "@univerjs/docs": "1.0.0-alpha.8",
63
+ "@univerjs/core": "1.0.0-alpha.8",
64
+ "@univerjs/engine-render": "1.0.0-alpha.8",
65
+ "@univerjs/thread-comment": "1.0.0-alpha.8",
66
+ "@univerjs/thread-comment-ui": "1.0.0-alpha.8",
67
+ "@univerjs/ui": "1.0.0-alpha.8",
68
+ "@univerjs/docs-ui": "1.0.0-alpha.8"
69
69
  },
70
70
  "devDependencies": {
71
- "postcss": "^8.5.19",
71
+ "postcss": "^8.5.23",
72
72
  "react": "18.3.1",
73
73
  "rxjs": "^7.8.2",
74
74
  "tailwindcss": "3.4.18",
75
75
  "typescript": "^6.0.3",
76
76
  "vitest": "^4.1.10",
77
- "@univerjs-infra/shared": "1.0.0-alpha.7"
77
+ "@univerjs-infra/shared": "1.0.0-alpha.8"
78
78
  },
79
79
  "scripts": {
80
80
  "test": "vitest run",