Skip to content

Commit

Permalink
fix(ui): fix layout service throwing error (#1490)
Browse files Browse the repository at this point in the history
* fix(ui): fix layout service throwing error

* fix: handler not registered
  • Loading branch information
wzhudev committed Mar 6, 2024
1 parent c520ad7 commit c2ee6d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/docs-ui/src/controllers/doc-ui.controller.ts
Expand Up @@ -94,6 +94,7 @@ export class DocUIController extends Disposable {
this._initCustomComponents();
this._initMenus();
this._initDocBackground();
this._initFocusHandler();
}

private _initDocBackground() {
Expand Down
6 changes: 2 additions & 4 deletions packages/ui/src/services/layout/layout.service.ts
Expand Up @@ -87,11 +87,9 @@ export class DesktopLayoutService extends Disposable implements ILayoutService {
handler = this._focusHandlers.get(UniverInstanceType.SLIDE);
}

if (!handler) {
throw new Error('[DesktopLayoutService]: handler is not registered!');
if (handler) {
handler(currentFocused.getUnitId());
}

handler(currentFocused.getUnitId());
}

registerFocusHandler(type: UniverInstanceType, handler: FocusHandlerFn): IDisposable {
Expand Down

0 comments on commit c2ee6d2

Please sign in to comment.