From 1a50e6a71a78c47de195bd203cf2cb6c6e2d6dd1 Mon Sep 17 00:00:00 2001 From: lumixraku Date: Sat, 23 Nov 2024 17:45:13 +0800 Subject: [PATCH] fix: mv SheetClipboardController out of render module --- .../clipboard/clipboard.controller.ts | 17 ++++++++--------- packages/sheets-ui/src/plugin.ts | 5 ++++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts index 98f5c04b77d..78936c76756 100644 --- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts +++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts @@ -152,16 +152,15 @@ export class SheetClipboardController extends RxDisposable { if (docSelectionRenderService) { sheetPasteShortKeyFn(docSelectionRenderService); - } else { - this._renderManagerService.created$.subscribe((renderer) => { - if (renderer.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) { - docSelectionRenderService = this._renderManagerService.getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)?.with(DocSelectionRenderService); - if (docSelectionRenderService) { - sheetPasteShortKeyFn(docSelectionRenderService); - } - } - }); } + this._renderManagerService.created$.subscribe((renderer) => { + if (renderer.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) { + docSelectionRenderService = this._renderManagerService.getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)?.with(DocSelectionRenderService); + if (docSelectionRenderService) { + sheetPasteShortKeyFn(docSelectionRenderService); + } + } + }); } private _init(): void { diff --git a/packages/sheets-ui/src/plugin.ts b/packages/sheets-ui/src/plugin.ts index a6e4b8758ba..2e94505b66f 100644 --- a/packages/sheets-ui/src/plugin.ts +++ b/packages/sheets-ui/src/plugin.ts @@ -169,6 +169,10 @@ export class UniverSheetsUIPlugin extends Plugin { this._initAutoFocus(); } + registerDependencies(this._injector, [ + [SheetClipboardController], + ]); + this._registerRenderBasics(); touchDependencies(this._injector, [ @@ -240,7 +244,6 @@ export class UniverSheetsUIPlugin extends Plugin { [MoveRangeRenderController], // editor - [SheetClipboardController], [EditorBridgeRenderController], [EditingRenderController],