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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix: optimize editor input (#5950)
wpxp12345635659680cc1e
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.tsindex 2231f44397..91e273db36 100644--- a/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts+++ b/packages/docs-ui/src/controllers/render-controllers/doc-editor-bridge.controller.ts@@ -17,7 +17,7 @@import type { DocumentDataModel, ICommandInfo, Nullable } from '@univerjs/core';import type { IRichTextEditingMutationParams } from '@univerjs/docs';import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';-import { checkForSubstrings, Disposable, DisposableCollection, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';+import { checkForSubstrings, Disposable, DisposableCollection, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';import { IRenderManagerService } from '@univerjs/engine-render';import { fromEvent } from 'rxjs';@@ -124,14 +124,7 @@ export class DocEditorBridgeController extends Disposable implements IRenderModuconst focusEditor = this._editorService.getFocusEditor();- const docSkeleton = this._getEditorSkeleton();- if (!docSkeleton) {- return;- }-- docSkeleton.resetInitialWidth();-- if (editor == null || !docSkeleton || editor.isSheetEditor() || (focusEditor && focusEditor.getEditorId() === unitId)) {+ if (editor == null || editor.isSheetEditor() || (focusEditor && focusEditor.getEditorId() === unitId)) {return;}@@ -216,8 +209,4 @@ export class DocEditorBridgeController extends Disposable implements IRenderModu}));}-- private _getEditorSkeleton() {- return this._renderManagerService.getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)?.with(DocSkeletonManagerService).getSkeleton();- }}diff --git a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts b/packages/sheets-ui/src/controllers/editor/editing.render-controller.tsindex 155e69382f..caeeb09fc6 100644--- a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts+++ b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts@@ -677,6 +677,10 @@ export class EditingRenderController extends Disposable {if (editorUnitId == null || !this._editorService.isSheetEditor(editorUnitId)) {return;}+ // Reset the width of the editor to the initial state after exiting the input.+ if (editorUnitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {+ this._getEditorSkeleton(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)?.resetInitialWidth();+ }this._undoRedoService.clearUndoRedo(editorUnitId);this._undoRedoService.clearUndoRedo(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);}