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.

fix(sheet): editor set rich error (#1918)

Univerd4f67f818779
diff --git a/packages/ui/src/services/layout/layout.service.ts b/packages/ui/src/services/layout/layout.service.ts
index 9f5718a391..b82a71e00f 100644
--- a/packages/ui/src/services/layout/layout.service.ts
+++ b/packages/ui/src/services/layout/layout.service.ts
@@ -149,7 +149,7 @@ export class DesktopLayoutService extends Disposable implements ILayoutService {
fromEvent(window, 'focusin').subscribe((event) => {
const target = event.target as HTMLElement;
if (collectionOfCnForFocusableEle.some((item) => target.classList.contains(item))) {
- this._editorService.blur();
+ this._editorBlurListener();
queueMicrotask(() => this.focus());
return;
}
@@ -172,6 +172,13 @@ export class DesktopLayoutService extends Disposable implements ILayoutService {
getFocusingUniverEditorStatus()
);
}
+
+ private _editorBlurListener() {
+ const focusEditor = this._editorService.getFocusEditor();
+ if (focusEditor && focusEditor.isSheetEditor() !== true) {
+ this._editorService.blur();
+ }
+ }
}
function getFocusingUniverEditorStatus(): boolean {