Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(docs-thread-comment-ui): doc datasource (#2851)

zhangwb3ae99a4d90e
diff --git a/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts b/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts
index 03a8a16b46..0808833cf5 100644
--- a/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts
+++ b/packages/docs-thread-comment-ui/src/commands/commands/add-doc-comment.command.ts
@@ -18,7 +18,7 @@ import type { ICommand, ITextRange } from '@univerjs/core';
import { CommandType, CustomDecorationType, ICommandService, sequenceExecuteAsync } from '@univerjs/core';
import { addCustomDecorationBySelectionFactory } from '@univerjs/docs';
import type { IThreadComment } from '@univerjs/thread-comment';
-import { AddCommentMutation, IThreadCommentDataSourceService } from '@univerjs/thread-comment';
+import { AddCommentCommand, IThreadCommentDataSourceService } from '@univerjs/thread-comment';
import { SetActiveCommentOperation } from '@univerjs/thread-comment-ui';
import { DEFAULT_DOC_SUBUNIT_ID } from '../../common/const';
@@ -48,8 +48,8 @@ export const AddDocCommentComment: ICommand<IAddDocCommentComment> = {
}
);
if (doMutation) {
- const commentMutation = {
- id: AddCommentMutation.id,
+ const addComment = {
+ id: AddCommentCommand.id,
params: {
unitId,
subUnitId: DEFAULT_DOC_SUBUNIT_ID,
@@ -66,7 +66,7 @@ export const AddDocCommentComment: ICommand<IAddDocCommentComment> = {
},
};
- return (await sequenceExecuteAsync([commentMutation, doMutation, activeOperation], commandService)).result;
+ return (await sequenceExecuteAsync([addComment, doMutation, activeOperation], commandService)).result;
}
return false;
diff --git a/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts b/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts
deleted file mode 100644
index 918b4d8cf7..0000000000
--- a/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { Disposable, Inject, LifecycleStages, LocaleService, OnLifecycle } from '@univerjs/core';
-
-@OnLifecycle(LifecycleStages.Starting, ThreadCommentUIController)
-export class ThreadCommentUIController extends Disposable {
- constructor(
- @Inject(LocaleService) private readonly _localeService: LocaleService
- ) {
- super();
- }
-}
diff --git a/packages/thread-comment-ui/src/plugin.ts b/packages/thread-comment-ui/src/plugin.ts
index d4226fdae7..558f06c75d 100644
--- a/packages/thread-comment-ui/src/plugin.ts
+++ b/packages/thread-comment-ui/src/plugin.ts
@@ -20,7 +20,6 @@ import { DependentOn, ICommandService, Inject, Injector, mergeOverrideWithDepend
import { PLUGIN_NAME } from './types/const';
import { ThreadCommentPanelService } from './services/thread-comment-panel.service';
import { SetActiveCommentOperation, ToggleSheetCommentPanelOperation } from './commands/operations/comment.operations';
-import { ThreadCommentUIController } from './controllers/thread-comment-ui.controller';
import { IThreadCommentMentionDataService, ThreadCommentMentionDataService } from './services/thread-comment-mention-data.service';
export interface IUniverThreadCommentUIConfig {
@@ -42,7 +41,6 @@ export class UniverThreadCommentUIPlugin extends Plugin {
override onStarting(injector: Injector): void {
(mergeOverrideWithDependencies([
- [ThreadCommentUIController],
[ThreadCommentPanelService],
[IThreadCommentMentionDataService, { useClass: ThreadCommentMentionDataService }],
], this._config?.overrides) as Dependency[]).forEach((dep) => {