Skip to content

Commit

Permalink
fix: fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Jun 18, 2024
1 parent 721f501 commit ff8f0ca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/docs/src/commands/commands/delete.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/controllers/move-cursor.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/controllers/normal-input.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface IRenderManagerService extends IDisposable {
/** @deprecated */
createRender$: Observable<string>;
/** @deprecated this design is very very weird! Remove it. */
create(unitId: Nullable<string>): void;
create(unitId: string): void;

/** @deprecated There will be multi units to render at the same time, so there is no *current*. */
getCurrent(): Nullable<IRender>;
Expand Down Expand Up @@ -127,7 +127,7 @@ export class RenderManagerService extends Disposable implements IRenderManagerSe
return Array.from(this._renderControllers.get(type) ?? []);
}

create(unitId: Nullable<string>) {
create(unitId: string) {
this._createRender$.next(unitId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -245,7 +245,6 @@ export class ZenEditorController extends RxDisposable {
docViewModel.reset(docDataModel);

const currentRender = this._getDocObject();

if (currentRender == null) {
return;
}
Expand Down

0 comments on commit ff8f0ca

Please sign in to comment.