@univerjs/docs-thread-comment-ui 0.25.0-insiders.20260623-012b5a8 → 0.25.1
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/LICENSE +176 -0
- package/lib/cjs/index.js +130 -162
- package/lib/es/index.js +132 -164
- package/lib/index.js +132 -164
- package/lib/types/controllers/{ui.controller.d.ts → doc-thread-comment-ui.controller.d.ts} +4 -2
- package/lib/types/menu/menu.d.ts +2 -3
- package/lib/types/views/{DocThreadCommentPanel.d.ts → doc-thread-comment-panel/index.d.ts} +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
- package/lib/types/controllers/components.controller.d.ts +0 -24
- package/lib/types/locale/types.d.ts +0 -18
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,
|
|
2
|
+
import { DocBackScrollRenderController, DocRenderController, DocSelectionRenderService, addCustomDecorationBySelectionFactory, deleteCustomDecorationFactory } from "@univerjs/docs-ui";
|
|
3
3
|
import { AddCommentMutation, IThreadCommentDataSourceService, ThreadCommentModel, getDT } from "@univerjs/thread-comment";
|
|
4
4
|
import { SetActiveCommentOperation, ThreadCommentPanel, ThreadCommentPanelService, UniverThreadCommentUIPlugin } from "@univerjs/thread-comment-ui";
|
|
5
5
|
import { DOC_INTERCEPTOR_POINT, DocInterceptorService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, SetTextSelectionsOperation } from "@univerjs/docs";
|
|
6
6
|
import { DocumentEditArea, IRenderManagerService, withCurrentTypeOfRenderer } from "@univerjs/engine-render";
|
|
7
|
-
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService,
|
|
7
|
+
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, MenuItemType, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
8
8
|
import { BehaviorSubject, Observable, debounceTime, filter } 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.
|
|
90
|
+
//#region \0@oxc-project+runtime@0.133.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.
|
|
101
|
+
//#region \0@oxc-project+runtime@0.133.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.
|
|
114
|
+
//#region \0@oxc-project+runtime@0.133.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.
|
|
121
|
+
//#region \0@oxc-project+runtime@0.133.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.
|
|
132
|
+
//#region \0@oxc-project+runtime@0.133.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.
|
|
140
|
+
//#region \0@oxc-project+runtime@0.133.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);
|
|
@@ -272,7 +272,7 @@ const StartAddCommentOperation = {
|
|
|
272
272
|
//#endregion
|
|
273
273
|
//#region package.json
|
|
274
274
|
var name = "@univerjs/docs-thread-comment-ui";
|
|
275
|
-
var version = "0.25.
|
|
275
|
+
var version = "0.25.1";
|
|
276
276
|
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/config/config.ts
|
|
@@ -280,6 +280,87 @@ const DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY = "docs-thread-comment-ui.config"
|
|
|
280
280
|
const configSymbol = Symbol(DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY);
|
|
281
281
|
const defaultPluginConfig = {};
|
|
282
282
|
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/controllers/doc-thread-comment-selection.controller.ts
|
|
285
|
+
let DocThreadCommentSelectionController = class DocThreadCommentSelectionController extends Disposable {
|
|
286
|
+
constructor(_threadCommentPanelService, _univerInstanceService, _commandService, _docThreadCommentService, _renderManagerService, _threadCommentModel) {
|
|
287
|
+
super();
|
|
288
|
+
this._threadCommentPanelService = _threadCommentPanelService;
|
|
289
|
+
this._univerInstanceService = _univerInstanceService;
|
|
290
|
+
this._commandService = _commandService;
|
|
291
|
+
this._docThreadCommentService = _docThreadCommentService;
|
|
292
|
+
this._renderManagerService = _renderManagerService;
|
|
293
|
+
this._threadCommentModel = _threadCommentModel;
|
|
294
|
+
this._initSelectionChange();
|
|
295
|
+
this._initActiveCommandChange();
|
|
296
|
+
}
|
|
297
|
+
_initSelectionChange() {
|
|
298
|
+
let lastSelection;
|
|
299
|
+
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
300
|
+
if (commandInfo.id === SetTextSelectionsOperation.id) {
|
|
301
|
+
const { unitId, ranges } = commandInfo.params;
|
|
302
|
+
if (isInternalEditorID(unitId)) return;
|
|
303
|
+
const doc = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
304
|
+
const primary = ranges[0];
|
|
305
|
+
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;
|
|
306
|
+
lastSelection = primary;
|
|
307
|
+
if (primary && doc) {
|
|
308
|
+
const { startOffset, endOffset, collapsed } = primary;
|
|
309
|
+
let customRange;
|
|
310
|
+
if (collapsed) {
|
|
311
|
+
var _doc$getBody;
|
|
312
|
+
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);
|
|
313
|
+
} else {
|
|
314
|
+
var _doc$getBody2;
|
|
315
|
+
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);
|
|
316
|
+
}
|
|
317
|
+
if (customRange) {
|
|
318
|
+
const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, customRange.id);
|
|
319
|
+
if (comment && !comment.resolved) this._commandService.executeCommand(ShowCommentPanelOperation.id, { activeComment: {
|
|
320
|
+
unitId,
|
|
321
|
+
subUnitId: DEFAULT_DOC_SUBUNIT_ID,
|
|
322
|
+
commentId: customRange.id
|
|
323
|
+
} });
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (!this._threadCommentPanelService.activeCommentId) return;
|
|
328
|
+
const addingComment = this._docThreadCommentService.addingComment;
|
|
329
|
+
const activeComment = this._threadCommentPanelService.activeCommentId;
|
|
330
|
+
if (addingComment && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.unitId) === addingComment.unitId && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.subUnitId) === "default_doc" && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.commentId) === addingComment.id) return;
|
|
331
|
+
this._commandService.executeCommand(SetActiveCommentOperation.id);
|
|
332
|
+
}
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
_initActiveCommandChange() {
|
|
336
|
+
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
|
|
337
|
+
var _this$_docThreadComme;
|
|
338
|
+
if (activeComment) {
|
|
339
|
+
const doc = this._univerInstanceService.getUnit(activeComment.unitId);
|
|
340
|
+
if (doc) {
|
|
341
|
+
var _this$_renderManagerS, _doc$getBody3;
|
|
342
|
+
const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
|
|
343
|
+
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);
|
|
344
|
+
if (customRange && backScrollController) backScrollController.scrollToRange({
|
|
345
|
+
startOffset: customRange.startIndex,
|
|
346
|
+
endOffset: customRange.endIndex,
|
|
347
|
+
collapsed: false
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
if (!activeComment || activeComment.commentId !== ((_this$_docThreadComme = this._docThreadCommentService.addingComment) === null || _this$_docThreadComme === void 0 ? void 0 : _this$_docThreadComme.id)) this._docThreadCommentService.endAdd();
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
DocThreadCommentSelectionController = __decorate([
|
|
356
|
+
__decorateParam(0, Inject(ThreadCommentPanelService)),
|
|
357
|
+
__decorateParam(1, IUniverInstanceService),
|
|
358
|
+
__decorateParam(2, ICommandService),
|
|
359
|
+
__decorateParam(3, Inject(DocThreadCommentService)),
|
|
360
|
+
__decorateParam(4, IRenderManagerService),
|
|
361
|
+
__decorateParam(5, Inject(ThreadCommentModel))
|
|
362
|
+
], DocThreadCommentSelectionController);
|
|
363
|
+
|
|
283
364
|
//#endregion
|
|
284
365
|
//#region src/menu/menu.ts
|
|
285
366
|
const shouldDisableAddComment = (accessor) => {
|
|
@@ -323,7 +404,20 @@ function ToolbarDocCommentMenuItemFactory(accessor) {
|
|
|
323
404
|
}
|
|
324
405
|
|
|
325
406
|
//#endregion
|
|
326
|
-
//#region src/
|
|
407
|
+
//#region src/menu/schema.ts
|
|
408
|
+
const menuSchema = {
|
|
409
|
+
[RibbonInsertGroup.MEDIA]: { [ToggleCommentPanelOperation.id]: {
|
|
410
|
+
order: 3,
|
|
411
|
+
menuItemFactory: ToolbarDocCommentMenuItemFactory
|
|
412
|
+
} },
|
|
413
|
+
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [StartAddCommentOperation.id]: {
|
|
414
|
+
order: 1,
|
|
415
|
+
menuItemFactory: AddDocCommentMenuItemFactory
|
|
416
|
+
} } }
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/views/doc-thread-comment-panel/index.tsx
|
|
327
421
|
const DocThreadCommentPanel = () => {
|
|
328
422
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
329
423
|
const injector = useDependency(Injector);
|
|
@@ -402,7 +496,7 @@ const DocThreadCommentPanel = () => {
|
|
|
402
496
|
};
|
|
403
497
|
|
|
404
498
|
//#endregion
|
|
405
|
-
//#region src/controllers/
|
|
499
|
+
//#region src/controllers/doc-thread-comment-ui.controller.ts
|
|
406
500
|
/**
|
|
407
501
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
408
502
|
*
|
|
@@ -418,105 +512,41 @@ const DocThreadCommentPanel = () => {
|
|
|
418
512
|
* See the License for the specific language governing permissions and
|
|
419
513
|
* limitations under the License.
|
|
420
514
|
*/
|
|
421
|
-
let
|
|
422
|
-
constructor(
|
|
515
|
+
let DocThreadCommentUIController = class DocThreadCommentUIController extends Disposable {
|
|
516
|
+
constructor(_commandService, _menuManagerService, _componentManager) {
|
|
423
517
|
super();
|
|
518
|
+
this._commandService = _commandService;
|
|
519
|
+
this._menuManagerService = _menuManagerService;
|
|
424
520
|
this._componentManager = _componentManager;
|
|
425
|
-
this.
|
|
426
|
-
this.
|
|
427
|
-
this.
|
|
521
|
+
this._initCommands();
|
|
522
|
+
this._initMenus();
|
|
523
|
+
this._initComponents();
|
|
428
524
|
}
|
|
429
|
-
|
|
430
|
-
[
|
|
431
|
-
|
|
525
|
+
_initCommands() {
|
|
526
|
+
[
|
|
527
|
+
AddDocCommentComment,
|
|
528
|
+
DeleteDocCommentComment,
|
|
529
|
+
ShowCommentPanelOperation,
|
|
530
|
+
StartAddCommentOperation,
|
|
531
|
+
ToggleCommentPanelOperation
|
|
532
|
+
].forEach((command) => {
|
|
533
|
+
this.disposeWithMe(this._commandService.registerCommand(command));
|
|
432
534
|
});
|
|
433
535
|
}
|
|
434
|
-
|
|
435
|
-
this.
|
|
436
|
-
}
|
|
437
|
-
};
|
|
438
|
-
ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager)), __decorateParam(1, Inject(IconManager))], ComponentsController);
|
|
439
|
-
|
|
440
|
-
//#endregion
|
|
441
|
-
//#region src/controllers/doc-thread-comment-selection.controller.ts
|
|
442
|
-
let DocThreadCommentSelectionController = class DocThreadCommentSelectionController extends Disposable {
|
|
443
|
-
constructor(_threadCommentPanelService, _univerInstanceService, _commandService, _docThreadCommentService, _renderManagerService, _threadCommentModel) {
|
|
444
|
-
super();
|
|
445
|
-
this._threadCommentPanelService = _threadCommentPanelService;
|
|
446
|
-
this._univerInstanceService = _univerInstanceService;
|
|
447
|
-
this._commandService = _commandService;
|
|
448
|
-
this._docThreadCommentService = _docThreadCommentService;
|
|
449
|
-
this._renderManagerService = _renderManagerService;
|
|
450
|
-
this._threadCommentModel = _threadCommentModel;
|
|
451
|
-
this._initSelectionChange();
|
|
452
|
-
this._initActiveCommandChange();
|
|
453
|
-
}
|
|
454
|
-
_initSelectionChange() {
|
|
455
|
-
let lastSelection;
|
|
456
|
-
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
457
|
-
if (commandInfo.id === SetTextSelectionsOperation.id) {
|
|
458
|
-
const { unitId, ranges } = commandInfo.params;
|
|
459
|
-
if (isInternalEditorID(unitId)) return;
|
|
460
|
-
const doc = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
461
|
-
const primary = ranges[0];
|
|
462
|
-
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;
|
|
463
|
-
lastSelection = primary;
|
|
464
|
-
if (primary && doc) {
|
|
465
|
-
const { startOffset, endOffset, collapsed } = primary;
|
|
466
|
-
let customRange;
|
|
467
|
-
if (collapsed) {
|
|
468
|
-
var _doc$getBody;
|
|
469
|
-
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);
|
|
470
|
-
} else {
|
|
471
|
-
var _doc$getBody2;
|
|
472
|
-
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);
|
|
473
|
-
}
|
|
474
|
-
if (customRange) {
|
|
475
|
-
const comment = this._threadCommentModel.getComment(unitId, DEFAULT_DOC_SUBUNIT_ID, customRange.id);
|
|
476
|
-
if (comment && !comment.resolved) this._commandService.executeCommand(ShowCommentPanelOperation.id, { activeComment: {
|
|
477
|
-
unitId,
|
|
478
|
-
subUnitId: DEFAULT_DOC_SUBUNIT_ID,
|
|
479
|
-
commentId: customRange.id
|
|
480
|
-
} });
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
if (!this._threadCommentPanelService.activeCommentId) return;
|
|
485
|
-
const addingComment = this._docThreadCommentService.addingComment;
|
|
486
|
-
const activeComment = this._threadCommentPanelService.activeCommentId;
|
|
487
|
-
if (addingComment && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.unitId) === addingComment.unitId && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.subUnitId) === "default_doc" && (activeComment === null || activeComment === void 0 ? void 0 : activeComment.commentId) === addingComment.id) return;
|
|
488
|
-
this._commandService.executeCommand(SetActiveCommentOperation.id);
|
|
489
|
-
}
|
|
490
|
-
}));
|
|
536
|
+
_initMenus() {
|
|
537
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
491
538
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
const doc = this._univerInstanceService.getUnit(activeComment.unitId);
|
|
497
|
-
if (doc) {
|
|
498
|
-
var _this$_renderManagerS, _doc$getBody3;
|
|
499
|
-
const backScrollController = (_this$_renderManagerS = this._renderManagerService.getRenderById(activeComment.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocBackScrollRenderController);
|
|
500
|
-
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);
|
|
501
|
-
if (customRange && backScrollController) backScrollController.scrollToRange({
|
|
502
|
-
startOffset: customRange.startIndex,
|
|
503
|
-
endOffset: customRange.endIndex,
|
|
504
|
-
collapsed: false
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
if (!activeComment || activeComment.commentId !== ((_this$_docThreadComme = this._docThreadCommentService.addingComment) === null || _this$_docThreadComme === void 0 ? void 0 : _this$_docThreadComme.id)) this._docThreadCommentService.endAdd();
|
|
509
|
-
}));
|
|
539
|
+
_initComponents() {
|
|
540
|
+
[[DOCS_THREAD_COMMENT_PANEL, DocThreadCommentPanel], ["CommentIcon", CommentIcon]].forEach(([id, comp]) => {
|
|
541
|
+
this.disposeWithMe(this._componentManager.register(id, comp));
|
|
542
|
+
});
|
|
510
543
|
}
|
|
511
544
|
};
|
|
512
|
-
|
|
513
|
-
__decorateParam(0,
|
|
514
|
-
__decorateParam(1,
|
|
515
|
-
__decorateParam(2,
|
|
516
|
-
|
|
517
|
-
__decorateParam(4, IRenderManagerService),
|
|
518
|
-
__decorateParam(5, Inject(ThreadCommentModel))
|
|
519
|
-
], DocThreadCommentSelectionController);
|
|
545
|
+
DocThreadCommentUIController = __decorate([
|
|
546
|
+
__decorateParam(0, ICommandService),
|
|
547
|
+
__decorateParam(1, IMenuManagerService),
|
|
548
|
+
__decorateParam(2, Inject(ComponentManager))
|
|
549
|
+
], DocThreadCommentUIController);
|
|
520
550
|
|
|
521
551
|
//#endregion
|
|
522
552
|
//#region src/controllers/render-controllers/render.controller.ts
|
|
@@ -603,66 +633,6 @@ DocThreadCommentRenderController = __decorate([
|
|
|
603
633
|
__decorateParam(6, ICommandService)
|
|
604
634
|
], DocThreadCommentRenderController);
|
|
605
635
|
|
|
606
|
-
//#endregion
|
|
607
|
-
//#region src/menu/schema.ts
|
|
608
|
-
const menuSchema = {
|
|
609
|
-
[RibbonInsertGroup.MEDIA]: { [ToggleCommentPanelOperation.id]: {
|
|
610
|
-
order: 3,
|
|
611
|
-
menuItemFactory: ToolbarDocCommentMenuItemFactory
|
|
612
|
-
} },
|
|
613
|
-
[FLOAT_TOOLBAR_MENU_POSITION]: { [StartAddCommentOperation.id]: {
|
|
614
|
-
order: 21,
|
|
615
|
-
menuItemFactory: AddDocCommentMenuItemFactory
|
|
616
|
-
} },
|
|
617
|
-
[ContextMenuPosition.MAIN_AREA]: { [ContextMenuGroup.DATA]: { [StartAddCommentOperation.id]: {
|
|
618
|
-
order: 1,
|
|
619
|
-
menuItemFactory: AddDocCommentMenuItemFactory
|
|
620
|
-
} } }
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
//#endregion
|
|
624
|
-
//#region src/controllers/ui.controller.ts
|
|
625
|
-
/**
|
|
626
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
627
|
-
*
|
|
628
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
629
|
-
* you may not use this file except in compliance with the License.
|
|
630
|
-
* You may obtain a copy of the License at
|
|
631
|
-
*
|
|
632
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
633
|
-
*
|
|
634
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
635
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
636
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
637
|
-
* See the License for the specific language governing permissions and
|
|
638
|
-
* limitations under the License.
|
|
639
|
-
*/
|
|
640
|
-
let DocThreadCommentUIController = class DocThreadCommentUIController extends Disposable {
|
|
641
|
-
constructor(_commandService, _menuManagerService) {
|
|
642
|
-
super();
|
|
643
|
-
this._commandService = _commandService;
|
|
644
|
-
this._menuManagerService = _menuManagerService;
|
|
645
|
-
this._initCommands();
|
|
646
|
-
this._initMenus();
|
|
647
|
-
}
|
|
648
|
-
_initCommands() {
|
|
649
|
-
[
|
|
650
|
-
AddDocCommentComment,
|
|
651
|
-
DeleteDocCommentComment,
|
|
652
|
-
ShowCommentPanelOperation,
|
|
653
|
-
StartAddCommentOperation,
|
|
654
|
-
ToggleCommentPanelOperation
|
|
655
|
-
].forEach((command) => {
|
|
656
|
-
this.disposeWithMe(this._commandService.registerCommand(command));
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
_initMenus() {
|
|
660
|
-
this._menuManagerService.appendRootMenu({ [FLOAT_TOOLBAR_MENU_POSITION]: {} });
|
|
661
|
-
this._menuManagerService.mergeMenu(menuSchema);
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
DocThreadCommentUIController = __decorate([__decorateParam(0, ICommandService), __decorateParam(1, IMenuManagerService)], DocThreadCommentUIController);
|
|
665
|
-
|
|
666
636
|
//#endregion
|
|
667
637
|
//#region src/plugin.ts
|
|
668
638
|
let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin extends Plugin {
|
|
@@ -677,8 +647,6 @@ let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin exte
|
|
|
677
647
|
this._configService.setConfig(DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY, rest);
|
|
678
648
|
}
|
|
679
649
|
onStarting() {
|
|
680
|
-
this._injector.add([ComponentsController]);
|
|
681
|
-
this._injector.get(ComponentsController);
|
|
682
650
|
[
|
|
683
651
|
[DocThreadCommentUIController],
|
|
684
652
|
[DocThreadCommentSelectionController],
|