@univerjs/docs-thread-comment-ui 0.25.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +162 -130
- package/lib/es/index.js +164 -132
- package/lib/index.js +164 -132
- package/lib/types/controllers/components.controller.d.ts +24 -0
- package/lib/types/controllers/{doc-thread-comment-ui.controller.d.ts → ui.controller.d.ts} +2 -4
- package/lib/types/locale/types.d.ts +18 -0
- package/lib/types/menu/menu.d.ts +3 -2
- package/lib/types/views/{doc-thread-comment-panel/index.d.ts → DocThreadCommentPanel.d.ts} +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
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, addCustomDecorationBySelectionFactory, deleteCustomDecorationFactory } from "@univerjs/docs-ui";
|
|
2
|
+
import { DocBackScrollRenderController, DocRenderController, DocSelectionRenderService, FLOAT_TOOLBAR_MENU_POSITION, 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, MenuItemType, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
7
|
+
import { ComponentManager, ContextMenuGroup, ContextMenuPosition, IMenuManagerService, ISidebarService, IconManager, 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.137.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.137.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.137.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.137.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.137.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.137.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.
|
|
275
|
+
var version = "1.0.0-alpha.0";
|
|
276
276
|
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/config/config.ts
|
|
@@ -280,87 +280,6 @@ 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
|
-
|
|
364
283
|
//#endregion
|
|
365
284
|
//#region src/menu/menu.ts
|
|
366
285
|
const shouldDisableAddComment = (accessor) => {
|
|
@@ -404,20 +323,7 @@ function ToolbarDocCommentMenuItemFactory(accessor) {
|
|
|
404
323
|
}
|
|
405
324
|
|
|
406
325
|
//#endregion
|
|
407
|
-
//#region src/
|
|
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
|
|
326
|
+
//#region src/views/DocThreadCommentPanel.tsx
|
|
421
327
|
const DocThreadCommentPanel = () => {
|
|
422
328
|
const univerInstanceService = useDependency(IUniverInstanceService);
|
|
423
329
|
const injector = useDependency(Injector);
|
|
@@ -496,7 +402,7 @@ const DocThreadCommentPanel = () => {
|
|
|
496
402
|
};
|
|
497
403
|
|
|
498
404
|
//#endregion
|
|
499
|
-
//#region src/controllers/
|
|
405
|
+
//#region src/controllers/components.controller.ts
|
|
500
406
|
/**
|
|
501
407
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
502
408
|
*
|
|
@@ -512,41 +418,105 @@ const DocThreadCommentPanel = () => {
|
|
|
512
418
|
* See the License for the specific language governing permissions and
|
|
513
419
|
* limitations under the License.
|
|
514
420
|
*/
|
|
515
|
-
let
|
|
516
|
-
constructor(
|
|
421
|
+
let ComponentsController = class ComponentsController extends Disposable {
|
|
422
|
+
constructor(_componentManager, _iconManager) {
|
|
517
423
|
super();
|
|
518
|
-
this._commandService = _commandService;
|
|
519
|
-
this._menuManagerService = _menuManagerService;
|
|
520
424
|
this._componentManager = _componentManager;
|
|
521
|
-
this.
|
|
522
|
-
this.
|
|
523
|
-
this.
|
|
425
|
+
this._iconManager = _iconManager;
|
|
426
|
+
this._registerComponents();
|
|
427
|
+
this._registerIcons();
|
|
524
428
|
}
|
|
525
|
-
|
|
526
|
-
[
|
|
527
|
-
|
|
528
|
-
DeleteDocCommentComment,
|
|
529
|
-
ShowCommentPanelOperation,
|
|
530
|
-
StartAddCommentOperation,
|
|
531
|
-
ToggleCommentPanelOperation
|
|
532
|
-
].forEach((command) => {
|
|
533
|
-
this.disposeWithMe(this._commandService.registerCommand(command));
|
|
429
|
+
_registerComponents() {
|
|
430
|
+
[[DOCS_THREAD_COMMENT_PANEL, DocThreadCommentPanel]].forEach(([id, comp]) => {
|
|
431
|
+
this.disposeWithMe(this._componentManager.register(id, comp));
|
|
534
432
|
});
|
|
535
433
|
}
|
|
536
|
-
|
|
537
|
-
this.
|
|
434
|
+
_registerIcons() {
|
|
435
|
+
this.disposeWithMe(this._iconManager.register({ CommentIcon }));
|
|
538
436
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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
|
+
}));
|
|
491
|
+
}
|
|
492
|
+
_initActiveCommandChange() {
|
|
493
|
+
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe((activeComment) => {
|
|
494
|
+
var _this$_docThreadComme;
|
|
495
|
+
if (activeComment) {
|
|
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
|
+
}));
|
|
543
510
|
}
|
|
544
511
|
};
|
|
545
|
-
|
|
546
|
-
__decorateParam(0,
|
|
547
|
-
__decorateParam(1,
|
|
548
|
-
__decorateParam(2,
|
|
549
|
-
|
|
512
|
+
DocThreadCommentSelectionController = __decorate([
|
|
513
|
+
__decorateParam(0, Inject(ThreadCommentPanelService)),
|
|
514
|
+
__decorateParam(1, IUniverInstanceService),
|
|
515
|
+
__decorateParam(2, ICommandService),
|
|
516
|
+
__decorateParam(3, Inject(DocThreadCommentService)),
|
|
517
|
+
__decorateParam(4, IRenderManagerService),
|
|
518
|
+
__decorateParam(5, Inject(ThreadCommentModel))
|
|
519
|
+
], DocThreadCommentSelectionController);
|
|
550
520
|
|
|
551
521
|
//#endregion
|
|
552
522
|
//#region src/controllers/render-controllers/render.controller.ts
|
|
@@ -633,6 +603,66 @@ DocThreadCommentRenderController = __decorate([
|
|
|
633
603
|
__decorateParam(6, ICommandService)
|
|
634
604
|
], DocThreadCommentRenderController);
|
|
635
605
|
|
|
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
|
+
|
|
636
666
|
//#endregion
|
|
637
667
|
//#region src/plugin.ts
|
|
638
668
|
let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin extends Plugin {
|
|
@@ -647,6 +677,8 @@ let UniverDocsThreadCommentUIPlugin = class UniverDocsThreadCommentUIPlugin exte
|
|
|
647
677
|
this._configService.setConfig(DOCS_THREAD_COMMENT_UI_PLUGIN_CONFIG_KEY, rest);
|
|
648
678
|
}
|
|
649
679
|
onStarting() {
|
|
680
|
+
this._injector.add([ComponentsController]);
|
|
681
|
+
this._injector.get(ComponentsController);
|
|
650
682
|
[
|
|
651
683
|
[DocThreadCommentUIController],
|
|
652
684
|
[DocThreadCommentSelectionController],
|