diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts index b3aa4d8b908..5246a1d705f 100644 --- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts +++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { connectInjector, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject, Injector, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core'; +import { connectInjector, Disposable, ICommandService, Inject, Injector, LifecycleStages, OnLifecycle, UniverInstanceType } from '@univerjs/core'; import { DocSelectionRenderService } from '@univerjs/docs-ui'; import { IRenderManagerService } from '@univerjs/engine-render'; @@ -352,7 +352,9 @@ export class SheetUIController extends Disposable { this._layoutService.registerFocusHandler(UniverInstanceType.UNIVER_SHEET, (_unitId: string) => { // DEBT: `_unitId` is not used hence we cannot support Univer mode now const renderManagerService = this._injector.get(IRenderManagerService); - const docSelectionRenderService = renderManagerService.getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)?.with(DocSelectionRenderService); + + const currentEditorRender = renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC); + const docSelectionRenderService = currentEditorRender?.with(DocSelectionRenderService); docSelectionRenderService?.focus(); })