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: text under active input (#5849)
Roman Sergeevad3f67b68269
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 91e273db36..2231f44397 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, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';+import { checkForSubstrings, Disposable, DisposableCollection, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';import { IRenderManagerService } from '@univerjs/engine-render';import { fromEvent } from 'rxjs';@@ -124,7 +124,14 @@ export class DocEditorBridgeController extends Disposable implements IRenderModuconst focusEditor = this._editorService.getFocusEditor();- if (editor == null || editor.isSheetEditor() || (focusEditor && focusEditor.getEditorId() === unitId)) {+ const docSkeleton = this._getEditorSkeleton();+ if (!docSkeleton) {+ return;+ }++ docSkeleton.resetInitialWidth();++ if (editor == null || !docSkeleton || editor.isSheetEditor() || (focusEditor && focusEditor.getEditorId() === unitId)) {return;}@@ -209,4 +216,8 @@ 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/engine-render/src/components/docs/layout/doc-skeleton.ts b/packages/engine-render/src/components/docs/layout/doc-skeleton.tsindex 517088af1d..8d23371271 100644--- a/packages/engine-render/src/components/docs/layout/doc-skeleton.ts+++ b/packages/engine-render/src/components/docs/layout/doc-skeleton.ts@@ -124,6 +124,8 @@ export class DocumentSkeleton extends Skeleton {private _iteratorCount = 0;+ private _initialWidth = 0;+constructor(private _docViewModel: DocumentViewModel,localeService: LocaleService@@ -140,6 +142,7 @@ export class DocumentSkeleton extends Skeleton {this._skeletonData = null;this._findLiquid = null as unknown as Liquid;this._docViewModel.dispose();+ this._initialWidth = 0;}getViewModel() {@@ -167,16 +170,19 @@ export class DocumentSkeleton extends Skeleton {return this._skeletonData;}+ resetInitialWidth() {+ this._initialWidth = 0;+ }+getActualSize() {const skeletonData = this.getSkeletonData();-- let actualWidth = Number.NEGATIVE_INFINITY;+ let actualWidth = 0;let actualHeight = 0;skeletonData?.pages.forEach((page) => {const { width, height } = page;- actualWidth = Math.max(actualWidth, width);-+ actualWidth = Math.max(this._initialWidth, width);+ this._initialWidth = actualWidth;actualHeight += height;});@@ -1165,7 +1171,6 @@ export class DocumentSkeleton extends Skeleton {// TODO: 10 is too small?if (ctx.isDirty && this._iteratorCount < 10) {this._iteratorCount++;-resetContext(ctx);return this._createSkeleton(ctx, _bounds);} else {