mirror of
https://github.com/dream-num/univer.git
synced 2026-09-04 11:45:52 +08:00
fix: text under active input (#5849)
Co-authored-by: r.sergeev <r.sergeev@yadro.com>
This commit is contained in:
+13
-2
@@ -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 IRenderModu
|
||||
|
||||
const 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user