Skip to content

Commit

Permalink
fix: auto focus after select menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs committed Sep 20, 2024
1 parent a697a49 commit 9e25efe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/sheets-ui/src/controllers/sheet-ui.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
})
Expand Down

0 comments on commit 9e25efe

Please sign in to comment.