reveal cell is async

This commit is contained in:
rebornix 2023-11-13 21:13:14 -08:00
parent 1d150d7168
commit 055662fd90
No known key found for this signature in database
GPG key ID: 181FC90D15393C20
3 changed files with 6 additions and 6 deletions

View file

@ -592,7 +592,7 @@ export interface INotebookEditor {
/**
* Reveal cell into viewport.
*/
revealInView(cell: ICellViewModel): void;
revealInView(cell: ICellViewModel): Promise<void>;
/**
* Reveal cell into the top of viewport.

View file

@ -2066,7 +2066,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
}
revealInView(cell: ICellViewModel) {
this._list.revealCell(cell, CellRevealType.Default);
return this._list.revealCell(cell, CellRevealType.Default);
}
revealInViewAtTop(cell: ICellViewModel) {
@ -2347,7 +2347,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
const firstSelectionPosition = selectionsStartPosition[0];
await this.revealRangeInViewAsync(cell, Range.fromPositions(firstSelectionPosition, firstSelectionPosition));
} else {
this.revealInView(cell);
await this.revealInView(cell);
}
}
@ -2385,11 +2385,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
if (!options?.skipReveal) {
if (typeof options?.focusEditorLine === 'number') {
this._cursorNavMode.set(true);
this.revealInView(cell);
await this.revealInView(cell);
} else if (options?.revealBehavior === ScrollToRevealBehavior.firstLine) {
this.revealFirstLineIfOutsideViewport(cell);
} else if (options?.revealBehavior === ScrollToRevealBehavior.fullCell) {
this.revealInView(cell);
await this.revealInView(cell);
} else {
this.revealInCenterIfOutsideViewport(cell);
}

View file

@ -66,7 +66,7 @@ export interface INotebookCellList {
getFocusedElements(): ICellViewModel[];
getSelectedElements(): ICellViewModel[];
scrollToBottom(): void;
revealCell(cell: ICellViewModel, revealType: CellRevealType): void;
revealCell(cell: ICellViewModel, revealType: CellRevealType): Promise<void>;
revealCells(range: ICellRange): void;
revealRangeInCell(cell: ICellViewModel, range: Selection | Range, revealType: CellRevealRangeType): Promise<void>;
revealCellOffsetInCenter(element: ICellViewModel, offset: number): void;