diff --git a/packages/docs/src/commands/commands/delete.command.ts b/packages/docs/src/commands/commands/delete.command.ts index 4d95eb371e21..fce46dda91c1 100644 --- a/packages/docs/src/commands/commands/delete.command.ts +++ b/packages/docs/src/commands/commands/delete.command.ts @@ -55,7 +55,7 @@ export const DeleteLeftCommand: ICommand = { const docSkeletonManagerService = getCommandSkeleton(accessor, unitId); const activeRange = textSelectionManagerService.getActiveRange(); const ranges = textSelectionManagerService.getSelections(); - const skeleton = docSkeletonManagerService?.getSkeleton()?.skeleton; + const skeleton = docSkeletonManagerService?.getSkeleton(); if (activeRange == null || skeleton == null || ranges == null) { return false; } @@ -202,7 +202,7 @@ export const DeleteRightCommand: ICommand = { const activeRange = textSelectionManagerService.getActiveRange(); const ranges = textSelectionManagerService.getSelections(); - const skeleton = docSkeletonManagerService?.getSkeleton()?.skeleton; + const skeleton = docSkeletonManagerService?.getSkeleton(); if (activeRange == null || skeleton == null || ranges == null) { return false; } diff --git a/packages/docs/src/controllers/move-cursor.controller.ts b/packages/docs/src/controllers/move-cursor.controller.ts index 09f0fecc357f..0ad442bf90b6 100644 --- a/packages/docs/src/controllers/move-cursor.controller.ts +++ b/packages/docs/src/controllers/move-cursor.controller.ts @@ -99,7 +99,7 @@ export class MoveCursorController extends Disposable { } const skeleton = this._renderManagerService.getRenderById(docDataModel.getUnitId()) - ?.with(DocSkeletonManagerService).getSkeleton()?.skeleton; + ?.with(DocSkeletonManagerService).getSkeleton(); const docObject = this._getDocObject(); if (activeRange == null || skeleton == null || docObject == null) { @@ -203,7 +203,7 @@ export class MoveCursorController extends Disposable { } const skeleton = this._renderManagerService.getRenderById(docDataModel.getUnitId()) - ?.with(DocSkeletonManagerService).getSkeleton()?.skeleton; + ?.with(DocSkeletonManagerService).getSkeleton(); const docObject = this._getDocObject(); if (activeRange == null || skeleton == null || docObject == null || allRanges == null) { diff --git a/packages/docs/src/controllers/normal-input.controller.ts b/packages/docs/src/controllers/normal-input.controller.ts index 07f2af54debf..5397a01ed0e9 100644 --- a/packages/docs/src/controllers/normal-input.controller.ts +++ b/packages/docs/src/controllers/normal-input.controller.ts @@ -65,7 +65,7 @@ export class NormalInputController extends Disposable { const e = event as InputEvent; const skeleton = this._renderManagerService.getRenderById(documentModel.getUnitId()) - ?.with(DocSkeletonManagerService).getSkeleton()?.skeleton; + ?.with(DocSkeletonManagerService).getSkeleton(); if (e.data == null || skeleton == null) { return; diff --git a/packages/engine-render/src/render-manager/render-manager.service.ts b/packages/engine-render/src/render-manager/render-manager.service.ts index 241cd85ce26e..affb011471ef 100644 --- a/packages/engine-render/src/render-manager/render-manager.service.ts +++ b/packages/engine-render/src/render-manager/render-manager.service.ts @@ -50,7 +50,7 @@ export interface IRenderManagerService extends IDisposable { /** @deprecated */ createRender$: Observable; /** @deprecated this design is very very weird! Remove it. */ - create(unitId: Nullable): void; + create(unitId: string): void; /** @deprecated There will be multi units to render at the same time, so there is no *current*. */ getCurrent(): Nullable; @@ -127,7 +127,7 @@ export class RenderManagerService extends Disposable implements IRenderManagerSe return Array.from(this._renderControllers.get(type) ?? []); } - create(unitId: Nullable) { + create(unitId: string) { this._createRender$.next(unitId); } diff --git a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts index 73b702228f85..b59750ad15b3 100644 --- a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts +++ b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts @@ -126,7 +126,7 @@ export class ZenEditorController extends RxDisposable { const { engine } = editorObject; - const skeleton = this._docSkeletonManagerService.getSkeletonByUnitId(DOCS_ZEN_EDITOR_UNIT_ID_KEY)?.skeleton; + const skeleton = this._renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY)?.with(DocSkeletonManagerService).getSkeleton(); // Update page size when container resized. // zenEditorDataModel.updateDocumentDataPageSize(width); @@ -220,7 +220,7 @@ export class ZenEditorController extends RxDisposable { DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, ]; - const skeleton = this._renderManagerService.getRenderById(unitId)?.with(DocSkeletonManagerService); + const skeleton = this._renderManagerService.getRenderById(unitId)?.with(DocSkeletonManagerService).getSkeleton(); const docDataModel = this._univerInstanceService.getUniverDocInstance(unitId); const docViewModel = this._docViewModelManagerService.getViewModel(unitId); @@ -245,7 +245,6 @@ export class ZenEditorController extends RxDisposable { docViewModel.reset(docDataModel); const currentRender = this._getDocObject(); - if (currentRender == null) { return; }