@univerjs/docs-thread-comment-ui 0.20.1 → 0.21.0-insiders.20260422-d7fcb4d
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 +717 -2
- package/lib/es/index.js +707 -2
- package/lib/index.js +707 -2
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -1,2 +1,717 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _univerjs_core = require("@univerjs/core");
|
|
3
|
+
let _univerjs_docs_ui = require("@univerjs/docs-ui");
|
|
4
|
+
let _univerjs_thread_comment = require("@univerjs/thread-comment");
|
|
5
|
+
let _univerjs_thread_comment_ui = require("@univerjs/thread-comment-ui");
|
|
6
|
+
let _univerjs_docs = require("@univerjs/docs");
|
|
7
|
+
let _univerjs_engine_render = require("@univerjs/engine-render");
|
|
8
|
+
let _univerjs_ui = require("@univerjs/ui");
|
|
9
|
+
let rxjs = require("rxjs");
|
|
10
|
+
let _univerjs_icons = require("@univerjs/icons");
|
|
11
|
+
let react = require("react");
|
|
12
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
//#region src/common/const.ts
|
|
15
|
+
/**
|
|
16
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
17
|
+
*
|
|
18
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License.
|
|
20
|
+
* You may obtain a copy of the License at
|
|
21
|
+
*
|
|
22
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
+
*
|
|
24
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
+
* See the License for the specific language governing permissions and
|
|
28
|
+
* limitations under the License.
|
|
29
|
+
*/
|
|
30
|
+
const DOCS_THREAD_COMMENT_PANEL = "univer.doc.thread-comment-panel";
|
|
31
|
+
const PLUGIN_NAME = "DOC_THREAD_COMMENT_UI_PLUGIN";
|
|
32
|
+
const DEFAULT_DOC_SUBUNIT_ID = "default_doc";
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/commands/commands/add-doc-comment.command.ts
|
|
36
|
+
const AddDocCommentComment = {
|
|
37
|
+
id: "docs.command.add-comment",
|
|
38
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
39
|
+
async handler(accessor, params) {
|
|
40
|
+
if (!params) return false;
|
|
41
|
+
const { comment: originComment, unitId } = params;
|
|
42
|
+
const comment = await accessor.get(_univerjs_thread_comment.IThreadCommentDataSourceService).addComment(originComment);
|
|
43
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
44
|
+
const doMutation = (0, _univerjs_docs_ui.addCustomDecorationBySelectionFactory)(accessor, {
|
|
45
|
+
id: comment.threadId,
|
|
46
|
+
type: _univerjs_core.CustomDecorationType.COMMENT,
|
|
47
|
+
unitId
|
|
48
|
+
});
|
|
49
|
+
if (doMutation) return (await (0, _univerjs_core.sequenceExecute)([
|
|
50
|
+
{
|
|
51
|
+
id: _univerjs_thread_comment.AddCommentMutation.id,
|
|
52
|
+
params: {
|
|
53
|
+
unitId,
|
|
54
|
+
subUnitId: DEFAULT_DOC_SUBUNIT_ID,
|
|
55
|
+
comment
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
doMutation,
|
|
59
|
+
{
|
|
60
|
+
id: _univerjs_thread_comment_ui.SetActiveCommentOperation.id,
|
|
61
|
+
params: {
|
|
62
|
+
unitId,
|
|
63
|
+
subUnitId: DEFAULT_DOC_SUBUNIT_ID,
|
|
64
|
+
commentId: comment.id
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
], commandService)).result;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/commands/commands/delete-doc-comment.command.ts
|
|
74
|
+
const DeleteDocCommentComment = {
|
|
75
|
+
id: "docs.command.delete-comment",
|
|
76
|
+
type: _univerjs_core.CommandType.COMMAND,
|
|
77
|
+
async handler(accessor, params) {
|
|
78
|
+
if (!params) return false;
|
|
79
|
+
const { commentId, unitId } = params;
|
|
80
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
81
|
+
const doMutation = (0, _univerjs_docs_ui.deleteCustomDecorationFactory)(accessor, {
|
|
82
|
+
id: commentId,
|
|
83
|
+
unitId
|
|
84
|
+
});
|
|
85
|
+
if (doMutation) return (await (0, _univerjs_core.sequenceExecute)([doMutation], commandService)).result;
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
|
|
92
|
+
function _typeof(o) {
|
|
93
|
+
"@babel/helpers - typeof";
|
|
94
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
95
|
+
return typeof o;
|
|
96
|
+
} : function(o) {
|
|
97
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
98
|
+
}, _typeof(o);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
|
|
103
|
+
function toPrimitive(t, r) {
|
|
104
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
105
|
+
var e = t[Symbol.toPrimitive];
|
|
106
|
+
if (void 0 !== e) {
|
|
107
|
+
var i = e.call(t, r || "default");
|
|
108
|
+
if ("object" != _typeof(i)) return i;
|
|
109
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
110
|
+
}
|
|
111
|
+
return ("string" === r ? String : Number)(t);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
|
|
116
|
+
function toPropertyKey(t) {
|
|
117
|
+
var i = toPrimitive(t, "string");
|
|
118
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
|
|
123
|
+
function _defineProperty(e, r, t) {
|
|
124
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
125
|
+
value: t,
|
|
126
|
+
enumerable: !0,
|
|
127
|
+
configurable: !0,
|
|
128
|
+
writable: !0
|
|
129
|
+
}) : e[r] = t, e;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/decorateParam.js
|
|
134
|
+
function __decorateParam(paramIndex, decorator) {
|
|
135
|
+
return function(target, key) {
|
|
136
|
+
decorator(target, key, paramIndex);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region \0@oxc-project+runtime@0.124.0/helpers/decorate.js
|
|
142
|
+
function __decorate(decorators, target, key, desc) {
|
|
143
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
144
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
145
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
146
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/services/doc-thread-comment.service.ts
|
|
151
|
+
let DocThreadCommentService = class DocThreadCommentService extends _univerjs_core.Disposable {
|
|
152
|
+
get addingComment() {
|
|
153
|
+
return this._addingComment$.getValue();
|
|
154
|
+
}
|
|
155
|
+
constructor(_sidebarService, _threadCommentPanelService) {
|
|
156
|
+
super();
|
|
157
|
+
this._sidebarService = _sidebarService;
|
|
158
|
+
this._threadCommentPanelService = _threadCommentPanelService;
|
|
159
|
+
_defineProperty(this, "_addingComment$", new rxjs.BehaviorSubject(void 0));
|
|
160
|
+
_defineProperty(this, "addingComment$", this._addingComment$.asObservable());
|
|
161
|
+
this.disposeWithMe(() => {
|
|
162
|
+
this._addingComment$.complete();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
startAdd(comment) {
|
|
166
|
+
this._addingComment$.next(comment);
|
|
167
|
+
}
|
|
168
|
+
endAdd() {
|
|
169
|
+
this._addingComment$.next(void 0);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
DocThreadCommentService = __decorate([__decorateParam(0, _univerjs_ui.ISidebarService), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_thread_comment_ui.ThreadCommentPanelService))], DocThreadCommentService);
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/commands/operations/show-comment-panel.operation.ts
|
|
176
|
+
const ShowCommentPanelOperation = {
|
|
177
|
+
id: "docs.operation.show-comment-panel",
|
|
178
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
179
|
+
handler(accessor, params) {
|
|
180
|
+
var _sidebarService$optio;
|
|
181
|
+
const panelService = accessor.get(_univerjs_thread_comment_ui.ThreadCommentPanelService);
|
|
182
|
+
const sidebarService = accessor.get(_univerjs_ui.ISidebarService);
|
|
183
|
+
if (!panelService.panelVisible || ((_sidebarService$optio = sidebarService.options.children) === null || _sidebarService$optio === void 0 ? void 0 : _sidebarService$optio.label) !== "univer.doc.thread-comment-panel") {
|
|
184
|
+
sidebarService.open({
|
|
185
|
+
header: { title: "threadCommentUI.panel.title" },
|
|
186
|
+
children: { label: DOCS_THREAD_COMMENT_PANEL },
|
|
187
|
+
width: 320,
|
|
188
|
+
onClose: () => panelService.setPanelVisible(false)
|
|
189
|
+
});
|
|
190
|
+
panelService.setPanelVisible(true);
|
|
191
|
+
}
|
|
192
|
+
if (params) panelService.setActiveComment(params === null || params === void 0 ? void 0 : params.activeComment);
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const ToggleCommentPanelOperation = {
|
|
197
|
+
id: "docs.operation.toggle-comment-panel",
|
|
198
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
199
|
+
handler(accessor) {
|
|
200
|
+
var _sidebarService$optio2;
|
|
201
|
+
const panelService = accessor.get(_univerjs_thread_comment_ui.ThreadCommentPanelService);
|
|
202
|
+
const sidebarService = accessor.get(_univerjs_ui.ISidebarService);
|
|
203
|
+
if (!panelService.panelVisible || ((_sidebarService$optio2 = sidebarService.options.children) === null || _sidebarService$optio2 === void 0 ? void 0 : _sidebarService$optio2.label) !== "univer.doc.thread-comment-panel") {
|
|
204
|
+
sidebarService.open({
|
|
205
|
+
header: { title: "threadCommentUI.panel.title" },
|
|
206
|
+
children: { label: DOCS_THREAD_COMMENT_PANEL },
|
|
207
|
+
width: 320,
|
|
208
|
+
onClose: () => panelService.setPanelVisible(false)
|
|
209
|
+
});
|
|
210
|
+
panelService.setPanelVisible(true);
|
|
211
|
+
} else {
|
|
212
|
+
sidebarService.close();
|
|
213
|
+
panelService.setPanelVisible(false);
|
|
214
|
+
panelService.setActiveComment(null);
|
|
215
|
+
}
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const StartAddCommentOperation = {
|
|
220
|
+
id: "docs.operation.start-add-comment",
|
|
221
|
+
type: _univerjs_core.CommandType.OPERATION,
|
|
222
|
+
handler(accessor) {
|
|
223
|
+
var _renderManagerService, _doc$getBody$dataStre, _doc$getBody;
|
|
224
|
+
const panelService = accessor.get(_univerjs_thread_comment_ui.ThreadCommentPanelService);
|
|
225
|
+
const doc = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitForType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
226
|
+
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
227
|
+
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
228
|
+
const userManagerService = accessor.get(_univerjs_core.UserManagerService);
|
|
229
|
+
const docCommentService = accessor.get(DocThreadCommentService);
|
|
230
|
+
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
231
|
+
const sidebarService = accessor.get(_univerjs_ui.ISidebarService);
|
|
232
|
+
const textRange = docSelectionManagerService.getActiveTextRange();
|
|
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);
|
|
235
|
+
docSelectionRenderManager === null || docSelectionRenderManager === void 0 || docSelectionRenderManager.setReserveRangesStatus(true);
|
|
236
|
+
if (textRange.collapsed) {
|
|
237
|
+
if (panelService.panelVisible) {
|
|
238
|
+
panelService.setPanelVisible(false);
|
|
239
|
+
sidebarService.close();
|
|
240
|
+
} else commandService.executeCommand(ShowCommentPanelOperation.id);
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
commandService.executeCommand(ShowCommentPanelOperation.id);
|
|
244
|
+
const unitId = doc.getUnitId();
|
|
245
|
+
const dataStream = ((_doc$getBody$dataStre = (_doc$getBody = doc.getBody()) === null || _doc$getBody === void 0 ? void 0 : _doc$getBody.dataStream) !== null && _doc$getBody$dataStre !== void 0 ? _doc$getBody$dataStre : "").slice(textRange.startOffset, textRange.endOffset);
|
|
246
|
+
const text = _univerjs_core.BuildTextUtils.transform.getPlainText(dataStream);
|
|
247
|
+
const subUnitId = DEFAULT_DOC_SUBUNIT_ID;
|
|
248
|
+
const commentId = "";
|
|
249
|
+
const comment = {
|
|
250
|
+
unitId,
|
|
251
|
+
subUnitId,
|
|
252
|
+
id: commentId,
|
|
253
|
+
ref: text,
|
|
254
|
+
dT: (0, _univerjs_thread_comment.getDT)(),
|
|
255
|
+
personId: userManagerService.getCurrentUser().userID,
|
|
256
|
+
text: { dataStream: "\r\n" },
|
|
257
|
+
startOffset: textRange.startOffset,
|
|
258
|
+
endOffset: textRange.endOffset,
|
|
259
|
+
collapsed: true,
|
|
260
|
+
threadId: commentId
|
|
261
|
+
};
|
|
262
|
+
docSelectionRenderManager === null || docSelectionRenderManager === void 0 || docSelectionRenderManager.blur();
|
|
263
|
+
docCommentService.startAdd(comment);
|
|
264
|
+
panelService.setActiveComment({
|
|
265
|
+
unitId,
|
|
266
|
+
subUnitId,
|
|
267
|
+
commentId
|
|
268
|
+
});
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
//#endregion
|
|
274
|
+
//#region package.json
|
|
275
|
+
var name = "@univerjs/docs-thread-comment-ui";
|
|
276
|
+
var version = "0.21.0-insiders.20260422-d7fcb4d";
|
|
277
|
+
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/config/config.ts
|
|
280
|
+
const DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY = "docs-thread-comment-ui.config";
|
|
281
|
+
const configSymbol = Symbol(DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY);
|
|
282
|
+
const defaultPluginConfig = {};
|
|
283
|
+
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/controllers/doc-thread-comment-selection.controller.ts
|
|
286
|
+
let DocThreadCommentSelectionController = class DocThreadCommentSelectionController extends _univerjs_core.Disposable {
|
|
287
|
+
constructor(_threadCommentPanelService, _univerInstanceService, _commandService, _docThreadCommentService, _renderManagerService, _threadCommentModel) {
|
|
288
|
+
super();
|
|
289
|
+
this._threadCommentPanelService = _threadCommentPanelService;
|
|
290
|
+
this._univerInstanceService = _univerInstanceService;
|
|
291
|
+
this._commandService = _commandService;
|
|
292
|
+
this._docThreadCommentService = _docThreadCommentService;
|
|
293
|
+
this._renderManagerService = _renderManagerService;
|
|
294
|
+
this._threadCommentModel = _threadCommentModel;
|
|
295
|
+
this._initSelectionChange();
|
|
296
|
+
this._initActiveCommandChange();
|
|
297
|
+
}
|
|
298
|
+
_initSelectionChange() {
|
|
299
|
+
let lastSelection;
|
|
300
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
301
|
+
if (commandInfo.id === _univerjs_docs.SetTextSelectionsOperation.id) {
|
|
302
|
+
const { unitId, ranges } = commandInfo.params;
|
|
303
|
+
if ((0, _univerjs_core.isInternalEditorID)(unitId)) return;
|
|
304
|
+
const doc = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
305
|
+
const primary = ranges[0];
|
|
306
|
+
if ((lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.startOffset) === (primary === null || primary === void 0 ? void 0 : primary.startOffset) && (lastSelection === null || lastSelection === void 0 ? void 0 : lastSelection.endOffset) === (primary === null || primary === void 0 ? void 0 : primary.endOffset)) return;
|
|
307
|
+
lastSelection = primary;
|
|
308
|
+
if (primary && doc) {
|
|
309
|
+
const { startOffset, endOffset, collapsed } = primary;
|
|
310
|
+
let customRange;
|
|
311
|
+
if (collapsed) {
|
|
312
|
+
var _doc$getBody;
|
|
313
|
+
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);
|
|
314
|
+
} else {
|
|
315
|
+
var _doc$getBody2;
|
|
316
|
+
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);
|
|
317
|
+
}
|
|
318
|
+
if (customRange) {
|
|
319
|
+
const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, customRange.id);
|
|
320
|
+
if (comment && !comment.resolved) this._commandService.executeCommand(ShowCommentPanelOperation.id, { activeComment: {
|
|
321
|
+
unitId,
|
|
322
|
+
subUnitId: DEFAULT_DOC_SUBUNIT_ID,
|
|
323
|
+
commentId: customRange.id
|
|
324
|
+
} });
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (!this._threadCommentPanelService.activeCommentId) return;
|
|
329
|
+
this._commandService.executeCommand(_univerjs_thread_comment_ui.SetActiveCommentOperation.id);
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
_initActiveCommandChange() {
|
|
334
|
+
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
|
|
335
|
+
var _this$_docThreadComme;
|
|
336
|
+
if (activeComment) {
|
|
337
|
+
const doc = this._univerInstanceService.getUnit(activeComment.unitId);
|
|
338
|
+
if (doc) {
|
|
339
|
+
var _this$_renderManagerS, _doc$getBody3;
|
|
340
|
+
const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs_ui.DocBackScrollRenderController);
|
|
341
|
+
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);
|
|
342
|
+
if (customRange && backScrollController) backScrollController.scrollToRange({
|
|
343
|
+
startOffset: customRange.startIndex,
|
|
344
|
+
endOffset: customRange.endIndex,
|
|
345
|
+
collapsed: false
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (!activeComment || activeComment.commentId !== ((_this$_docThreadComme = this._docThreadCommentService.addingComment) === null || _this$_docThreadComme === void 0 ? void 0 : _this$_docThreadComme.id)) this._docThreadCommentService.endAdd();
|
|
350
|
+
}));
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
DocThreadCommentSelectionController = __decorate([
|
|
354
|
+
__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_thread_comment_ui.ThreadCommentPanelService)),
|
|
355
|
+
__decorateParam(1, _univerjs_core.IUniverInstanceService),
|
|
356
|
+
__decorateParam(2, _univerjs_core.ICommandService),
|
|
357
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(DocThreadCommentService)),
|
|
358
|
+
__decorateParam(4, _univerjs_engine_render.IRenderManagerService),
|
|
359
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_thread_comment.ThreadCommentModel))
|
|
360
|
+
], DocThreadCommentSelectionController);
|
|
361
|
+
|
|
362
|
+
//#endregion
|
|
363
|
+
//#region src/menu/menu.ts
|
|
364
|
+
const shouldDisableAddComment = (accessor) => {
|
|
365
|
+
var _withCurrentTypeOfRen;
|
|
366
|
+
const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
|
|
367
|
+
const docSelectionManagerService = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
368
|
+
const skeleton = (_withCurrentTypeOfRen = (0, _univerjs_engine_render.withCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_DOC, _univerjs_docs.DocSkeletonManagerService, accessor.get(_univerjs_core.IUniverInstanceService), renderManagerService)) === null || _withCurrentTypeOfRen === void 0 ? void 0 : _withCurrentTypeOfRen.getSkeleton();
|
|
369
|
+
const editArea = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getViewModel().getEditArea();
|
|
370
|
+
if (editArea === _univerjs_engine_render.DocumentEditArea.FOOTER || editArea === _univerjs_engine_render.DocumentEditArea.HEADER) return true;
|
|
371
|
+
const range = docSelectionManagerService.getActiveTextRange();
|
|
372
|
+
if (range == null || range.collapsed) return true;
|
|
373
|
+
return false;
|
|
374
|
+
};
|
|
375
|
+
function AddDocCommentMenuItemFactory(accessor) {
|
|
376
|
+
return {
|
|
377
|
+
id: StartAddCommentOperation.id,
|
|
378
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
379
|
+
icon: "CommentIcon",
|
|
380
|
+
title: "threadCommentUI.panel.addComment",
|
|
381
|
+
tooltip: "threadCommentUI.panel.addComment",
|
|
382
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC, void 0, _univerjs_core.SHEET_EDITOR_UNITS),
|
|
383
|
+
disabled$: new rxjs.Observable(function(subscribe) {
|
|
384
|
+
const observer = accessor.get(_univerjs_docs.DocSelectionManagerService).textSelection$.pipe((0, rxjs.debounceTime)(16)).subscribe(() => {
|
|
385
|
+
subscribe.next(shouldDisableAddComment(accessor));
|
|
386
|
+
});
|
|
387
|
+
return () => {
|
|
388
|
+
observer.unsubscribe();
|
|
389
|
+
};
|
|
390
|
+
})
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function ToolbarDocCommentMenuItemFactory(accessor) {
|
|
394
|
+
return {
|
|
395
|
+
id: ToggleCommentPanelOperation.id,
|
|
396
|
+
type: _univerjs_ui.MenuItemType.BUTTON,
|
|
397
|
+
icon: "CommentIcon",
|
|
398
|
+
title: "threadCommentUI.panel.addComment",
|
|
399
|
+
tooltip: "threadCommentUI.panel.addComment",
|
|
400
|
+
hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC)
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/menu/schema.ts
|
|
406
|
+
const menuSchema = {
|
|
407
|
+
[_univerjs_ui.RibbonInsertGroup.MEDIA]: { [ToggleCommentPanelOperation.id]: {
|
|
408
|
+
order: 3,
|
|
409
|
+
menuItemFactory: ToolbarDocCommentMenuItemFactory
|
|
410
|
+
} },
|
|
411
|
+
[_univerjs_ui.ContextMenuPosition.MAIN_AREA]: { [_univerjs_ui.ContextMenuGroup.DATA]: { [StartAddCommentOperation.id]: {
|
|
412
|
+
order: 1,
|
|
413
|
+
menuItemFactory: AddDocCommentMenuItemFactory
|
|
414
|
+
} } }
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/views/doc-thread-comment-panel/index.tsx
|
|
419
|
+
const DocThreadCommentPanel = () => {
|
|
420
|
+
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
421
|
+
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
422
|
+
const doc = (0, _univerjs_ui.useObservable)((0, react.useMemo)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).pipe((0, rxjs.filter)((doc) => !!doc && !(0, _univerjs_core.isInternalEditorID)(doc.getUnitId()))), [univerInstanceService]));
|
|
423
|
+
const subUnitId$ = (0, react.useMemo)(() => new rxjs.Observable((sub) => sub.next(DEFAULT_DOC_SUBUNIT_ID)), []);
|
|
424
|
+
const docSelectionManagerService = (0, _univerjs_ui.useDependency)(_univerjs_docs.DocSelectionManagerService);
|
|
425
|
+
(0, _univerjs_ui.useObservable)((0, react.useMemo)(() => docSelectionManagerService.textSelection$.pipe((0, rxjs.debounceTime)(16)), [docSelectionManagerService.textSelection$]));
|
|
426
|
+
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
427
|
+
const docCommentService = (0, _univerjs_ui.useDependency)(DocThreadCommentService);
|
|
428
|
+
const tempComment = (0, _univerjs_ui.useObservable)(docCommentService.addingComment$);
|
|
429
|
+
const [commentIds, setCommentIds] = (0, react.useState)([]);
|
|
430
|
+
(0, react.useEffect)(() => {
|
|
431
|
+
var _customRanges$map$fil;
|
|
432
|
+
const set = /* @__PURE__ */ new Set();
|
|
433
|
+
const customRanges = doc === null || doc === void 0 ? void 0 : doc.getCustomDecorations();
|
|
434
|
+
setCommentIds((_customRanges$map$fil = customRanges === null || customRanges === void 0 ? void 0 : customRanges.map((r) => r.id).filter((i) => {
|
|
435
|
+
const hasRepeat = set.has(i);
|
|
436
|
+
set.add(i);
|
|
437
|
+
return !hasRepeat;
|
|
438
|
+
})) !== null && _customRanges$map$fil !== void 0 ? _customRanges$map$fil : []);
|
|
439
|
+
const dispose = commandService.onCommandExecuted((command) => {
|
|
440
|
+
if (command.id === _univerjs_docs.RichTextEditingMutation.id) {
|
|
441
|
+
var _customRanges$map$fil2;
|
|
442
|
+
const set = /* @__PURE__ */ new Set();
|
|
443
|
+
const customRanges = doc === null || doc === void 0 ? void 0 : doc.getCustomDecorations();
|
|
444
|
+
setCommentIds((_customRanges$map$fil2 = customRanges === null || customRanges === void 0 ? void 0 : customRanges.map((r) => r.id).filter((i) => {
|
|
445
|
+
const hasRepeat = set.has(i);
|
|
446
|
+
set.add(i);
|
|
447
|
+
return !hasRepeat;
|
|
448
|
+
})) !== null && _customRanges$map$fil2 !== void 0 ? _customRanges$map$fil2 : []);
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
return () => {
|
|
452
|
+
dispose.dispose();
|
|
453
|
+
};
|
|
454
|
+
}, [commandService, doc]);
|
|
455
|
+
if (!doc) return null;
|
|
456
|
+
const isInValidSelection = shouldDisableAddComment(injector);
|
|
457
|
+
const unitId = doc.getUnitId();
|
|
458
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_thread_comment_ui.ThreadCommentPanel, {
|
|
459
|
+
unitId,
|
|
460
|
+
subUnitId$,
|
|
461
|
+
type: _univerjs_core.UniverInstanceType.UNIVER_DOC,
|
|
462
|
+
onAdd: () => {
|
|
463
|
+
commandService.executeCommand(StartAddCommentOperation.id);
|
|
464
|
+
},
|
|
465
|
+
getSubUnitName: () => "",
|
|
466
|
+
disableAdd: isInValidSelection,
|
|
467
|
+
tempComment,
|
|
468
|
+
onAddComment: (comment) => {
|
|
469
|
+
if (!comment.parentId) {
|
|
470
|
+
const params = {
|
|
471
|
+
unitId,
|
|
472
|
+
range: tempComment,
|
|
473
|
+
comment
|
|
474
|
+
};
|
|
475
|
+
commandService.executeCommand(AddDocCommentComment.id, params);
|
|
476
|
+
docCommentService.endAdd();
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
return true;
|
|
480
|
+
},
|
|
481
|
+
onDeleteComment: (comment) => {
|
|
482
|
+
if (!comment.parentId) {
|
|
483
|
+
const params = {
|
|
484
|
+
unitId,
|
|
485
|
+
commentId: comment.id
|
|
486
|
+
};
|
|
487
|
+
commandService.executeCommand(DeleteDocCommentComment.id, params);
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
return true;
|
|
491
|
+
},
|
|
492
|
+
showComments: commentIds
|
|
493
|
+
});
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/controllers/doc-thread-comment-ui.controller.ts
|
|
498
|
+
/**
|
|
499
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
500
|
+
*
|
|
501
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
502
|
+
* you may not use this file except in compliance with the License.
|
|
503
|
+
* You may obtain a copy of the License at
|
|
504
|
+
*
|
|
505
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
506
|
+
*
|
|
507
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
508
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
509
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
510
|
+
* See the License for the specific language governing permissions and
|
|
511
|
+
* limitations under the License.
|
|
512
|
+
*/
|
|
513
|
+
let DocThreadCommentUIController = class DocThreadCommentUIController extends _univerjs_core.Disposable {
|
|
514
|
+
constructor(_commandService, _menuManagerService, _componentManager) {
|
|
515
|
+
super();
|
|
516
|
+
this._commandService = _commandService;
|
|
517
|
+
this._menuManagerService = _menuManagerService;
|
|
518
|
+
this._componentManager = _componentManager;
|
|
519
|
+
this._initCommands();
|
|
520
|
+
this._initMenus();
|
|
521
|
+
this._initComponents();
|
|
522
|
+
}
|
|
523
|
+
_initCommands() {
|
|
524
|
+
[
|
|
525
|
+
AddDocCommentComment,
|
|
526
|
+
DeleteDocCommentComment,
|
|
527
|
+
ShowCommentPanelOperation,
|
|
528
|
+
StartAddCommentOperation,
|
|
529
|
+
ToggleCommentPanelOperation
|
|
530
|
+
].forEach((command) => {
|
|
531
|
+
this.disposeWithMe(this._commandService.registerCommand(command));
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
_initMenus() {
|
|
535
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
536
|
+
}
|
|
537
|
+
_initComponents() {
|
|
538
|
+
[[DOCS_THREAD_COMMENT_PANEL, DocThreadCommentPanel], ["CommentIcon", _univerjs_icons.CommentIcon]].forEach(([id, comp]) => {
|
|
539
|
+
this.disposeWithMe(this._componentManager.register(id, comp));
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
DocThreadCommentUIController = __decorate([
|
|
544
|
+
__decorateParam(0, _univerjs_core.ICommandService),
|
|
545
|
+
__decorateParam(1, _univerjs_ui.IMenuManagerService),
|
|
546
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager))
|
|
547
|
+
], DocThreadCommentUIController);
|
|
548
|
+
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/controllers/render-controllers/render.controller.ts
|
|
551
|
+
let DocThreadCommentRenderController = class DocThreadCommentRenderController extends _univerjs_core.Disposable {
|
|
552
|
+
constructor(_context, _docInterceptorService, _threadCommentPanelService, _docRenderController, _univerInstanceService, _threadCommentModel, _commandService) {
|
|
553
|
+
super();
|
|
554
|
+
this._context = _context;
|
|
555
|
+
this._docInterceptorService = _docInterceptorService;
|
|
556
|
+
this._threadCommentPanelService = _threadCommentPanelService;
|
|
557
|
+
this._docRenderController = _docRenderController;
|
|
558
|
+
this._univerInstanceService = _univerInstanceService;
|
|
559
|
+
this._threadCommentModel = _threadCommentModel;
|
|
560
|
+
this._commandService = _commandService;
|
|
561
|
+
this._interceptorViewModel();
|
|
562
|
+
this._initReRender();
|
|
563
|
+
this._initSyncComments();
|
|
564
|
+
}
|
|
565
|
+
_initReRender() {
|
|
566
|
+
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
|
|
567
|
+
var _this$_univerInstance;
|
|
568
|
+
if (activeComment) {
|
|
569
|
+
this._docRenderController.reRender(activeComment.unitId);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const unitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitForType(_univerjs_core.UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
|
|
573
|
+
if (unitId) this._docRenderController.reRender(unitId);
|
|
574
|
+
}));
|
|
575
|
+
this.disposeWithMe(this._threadCommentModel.commentUpdate$.subscribe((update) => {
|
|
576
|
+
if (update.type === "resolve") this._docRenderController.reRender(update.unitId);
|
|
577
|
+
}));
|
|
578
|
+
}
|
|
579
|
+
_interceptorViewModel() {
|
|
580
|
+
this._docInterceptorService.intercept(_univerjs_docs.DOC_INTERCEPTOR_POINT.CUSTOM_DECORATION, { handler: (data, pos, next) => {
|
|
581
|
+
if (!data) return next(data);
|
|
582
|
+
const { unitId, index, customDecorations } = pos;
|
|
583
|
+
const { commentId, unitId: commentUnitID } = this._threadCommentPanelService.activeCommentId || {};
|
|
584
|
+
const activeCustomDecoration = customDecorations.find((i) => i.id === commentId);
|
|
585
|
+
const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, data.id);
|
|
586
|
+
if (!comment) return next({
|
|
587
|
+
...data,
|
|
588
|
+
show: false
|
|
589
|
+
});
|
|
590
|
+
const isActiveIndex = activeCustomDecoration && index >= activeCustomDecoration.startIndex && index <= activeCustomDecoration.endIndex;
|
|
591
|
+
const isActive = commentUnitID === unitId && data.id === commentId;
|
|
592
|
+
return next({
|
|
593
|
+
...data,
|
|
594
|
+
active: isActive || isActiveIndex,
|
|
595
|
+
show: !comment.resolved
|
|
596
|
+
});
|
|
597
|
+
} });
|
|
598
|
+
}
|
|
599
|
+
_initSyncComments() {
|
|
600
|
+
var _this$_context$unit$g, _this$_context$unit$g2;
|
|
601
|
+
const unitId = this._context.unit.getUnitId();
|
|
602
|
+
const subUnitId = DEFAULT_DOC_SUBUNIT_ID;
|
|
603
|
+
const threadIds = (_this$_context$unit$g = (_this$_context$unit$g2 = this._context.unit.getBody()) === null || _this$_context$unit$g2 === void 0 || (_this$_context$unit$g2 = _this$_context$unit$g2.customDecorations) === null || _this$_context$unit$g2 === void 0 ? void 0 : _this$_context$unit$g2.filter((i) => i.type === _univerjs_core.CustomDecorationType.COMMENT).map((i) => i.id)) !== null && _this$_context$unit$g !== void 0 ? _this$_context$unit$g : [];
|
|
604
|
+
threadIds.forEach((id) => {
|
|
605
|
+
if (!this._threadCommentModel.getComment(unitId, subUnitId, id)) this._threadCommentModel.addComment(unitId, subUnitId, {
|
|
606
|
+
id,
|
|
607
|
+
threadId: id,
|
|
608
|
+
ref: "",
|
|
609
|
+
dT: "",
|
|
610
|
+
personId: "",
|
|
611
|
+
text: { dataStream: "" },
|
|
612
|
+
unitId,
|
|
613
|
+
subUnitId
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
threadIds.length && this._threadCommentModel.syncThreadComments(this._context.unit.getUnitId(), "default_doc", threadIds);
|
|
617
|
+
let prevThreadIds = threadIds.sort();
|
|
618
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
619
|
+
if (commandInfo.id === _univerjs_docs.RichTextEditingMutation.id) {
|
|
620
|
+
var _this$_context$unit$g3, _this$_context$unit$g4;
|
|
621
|
+
if (commandInfo.params.unitId !== this._context.unit.getUnitId()) return;
|
|
622
|
+
const currentThreadIds = (_this$_context$unit$g3 = (_this$_context$unit$g4 = this._context.unit.getBody()) === null || _this$_context$unit$g4 === void 0 || (_this$_context$unit$g4 = _this$_context$unit$g4.customDecorations) === null || _this$_context$unit$g4 === void 0 ? void 0 : _this$_context$unit$g4.filter((i) => i.type === _univerjs_core.CustomDecorationType.COMMENT).map((i) => i.id)) !== null && _this$_context$unit$g3 !== void 0 ? _this$_context$unit$g3 : [];
|
|
623
|
+
const currentThreadIdsSorted = currentThreadIds.sort();
|
|
624
|
+
if (JSON.stringify(prevThreadIds) !== JSON.stringify(currentThreadIdsSorted)) {
|
|
625
|
+
const preIds = new Set(prevThreadIds);
|
|
626
|
+
const currentIds = new Set(currentThreadIdsSorted);
|
|
627
|
+
const addIds = /* @__PURE__ */ new Set();
|
|
628
|
+
const deleteIds = /* @__PURE__ */ new Set();
|
|
629
|
+
currentThreadIds.forEach((id) => {
|
|
630
|
+
if (!preIds.has(id)) addIds.add(id);
|
|
631
|
+
});
|
|
632
|
+
prevThreadIds.forEach((id) => {
|
|
633
|
+
if (!currentIds.has(id)) deleteIds.add(id);
|
|
634
|
+
});
|
|
635
|
+
prevThreadIds = currentThreadIdsSorted;
|
|
636
|
+
addIds.forEach((id) => {
|
|
637
|
+
if (!this._threadCommentModel.getComment(unitId, subUnitId, id)) this._threadCommentModel.addComment(unitId, subUnitId, {
|
|
638
|
+
id,
|
|
639
|
+
threadId: id,
|
|
640
|
+
ref: "",
|
|
641
|
+
dT: "",
|
|
642
|
+
personId: "",
|
|
643
|
+
text: { dataStream: "" },
|
|
644
|
+
unitId,
|
|
645
|
+
subUnitId
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
this._threadCommentModel.syncThreadComments(unitId, subUnitId, [...addIds]);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}));
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
DocThreadCommentRenderController = __decorate([
|
|
655
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_docs.DocInterceptorService)),
|
|
656
|
+
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_thread_comment_ui.ThreadCommentPanelService)),
|
|
657
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_docs_ui.DocRenderController)),
|
|
658
|
+
__decorateParam(4, _univerjs_core.IUniverInstanceService),
|
|
659
|
+
__decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_thread_comment.ThreadCommentModel)),
|
|
660
|
+
__decorateParam(6, _univerjs_core.ICommandService)
|
|
661
|
+
], DocThreadCommentRenderController);
|
|
662
|
+
|
|
663
|
+
//#endregion
|
|
664
|
+
//#region src/plugin.ts
|
|
665
|
+
let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin extends _univerjs_core.Plugin {
|
|
666
|
+
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
|
|
667
|
+
super();
|
|
668
|
+
this._config = _config;
|
|
669
|
+
this._injector = _injector;
|
|
670
|
+
this._renderManagerSrv = _renderManagerSrv;
|
|
671
|
+
this._configService = _configService;
|
|
672
|
+
const { menu, ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
|
|
673
|
+
if (menu) this._configService.setConfig("menu", menu, { merge: true });
|
|
674
|
+
this._configService.setConfig(DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY, rest);
|
|
675
|
+
}
|
|
676
|
+
onStarting() {
|
|
677
|
+
[
|
|
678
|
+
[DocThreadCommentUIController],
|
|
679
|
+
[DocThreadCommentSelectionController],
|
|
680
|
+
[DocThreadCommentService]
|
|
681
|
+
].forEach((dep) => {
|
|
682
|
+
this._injector.add(dep);
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
onRendered() {
|
|
686
|
+
this._initRenderModule();
|
|
687
|
+
this._injector.get(DocThreadCommentSelectionController);
|
|
688
|
+
this._injector.get(DocThreadCommentUIController);
|
|
689
|
+
}
|
|
690
|
+
_initRenderModule() {
|
|
691
|
+
[DocThreadCommentRenderController].forEach((dep) => {
|
|
692
|
+
this._renderManagerSrv.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_DOC, dep);
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
_defineProperty(UniverDocsThreadCommentUIPlugin, "pluginName", PLUGIN_NAME);
|
|
697
|
+
_defineProperty(UniverDocsThreadCommentUIPlugin, "packageName", name);
|
|
698
|
+
_defineProperty(UniverDocsThreadCommentUIPlugin, "version", version);
|
|
699
|
+
_defineProperty(UniverDocsThreadCommentUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
700
|
+
UniverDocsThreadCommentUIPlugin = __decorate([
|
|
701
|
+
(0, _univerjs_core.DependentOn)(_univerjs_thread_comment_ui.UniverThreadCommentUIPlugin),
|
|
702
|
+
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
703
|
+
__decorateParam(2, _univerjs_engine_render.IRenderManagerService),
|
|
704
|
+
__decorateParam(3, _univerjs_core.IConfigService)
|
|
705
|
+
], UniverDocsThreadCommentUIPlugin);
|
|
706
|
+
|
|
707
|
+
//#endregion
|
|
708
|
+
exports.AddDocCommentComment = AddDocCommentComment;
|
|
709
|
+
exports.DeleteDocCommentComment = DeleteDocCommentComment;
|
|
710
|
+
exports.ShowCommentPanelOperation = ShowCommentPanelOperation;
|
|
711
|
+
exports.StartAddCommentOperation = StartAddCommentOperation;
|
|
712
|
+
Object.defineProperty(exports, 'UniverDocsThreadCommentUIPlugin', {
|
|
713
|
+
enumerable: true,
|
|
714
|
+
get: function () {
|
|
715
|
+
return UniverDocsThreadCommentUIPlugin;
|
|
716
|
+
}
|
|
717
|
+
});
|