Fix/search text cell on edit (#9685)

* find in text cell changes

* remove prev decorations

* update find index on cell edit

* added test

* addressed comments

* emit error
This commit is contained in:
Maddy
2020-03-25 22:47:06 -07:00
committed by GitHub
parent 4241ca523e
commit 685e0ccf7e
12 changed files with 177 additions and 28 deletions

View File

@@ -71,7 +71,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
@ViewChild('bookNav', { read: ElementRef }) private bookNav: ElementRef;
@ViewChildren(CodeCellComponent) private codeCells: QueryList<CodeCellComponent>;
@ViewChildren(TextCellComponent) private textCells: QueryList<ICellEditorProvider>;
@ViewChildren(TextCellComponent) private textCells: QueryList<TextCellComponent>;
private _model: NotebookModel;
protected _actionBar: Taskbar;
@@ -150,6 +150,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
this.codeCells.toArray().forEach(cell => editors.push(...cell.cellEditors));
}
if (this.textCells) {
this.textCells.toArray().forEach(cell => editors.push(...cell.cellEditors));
editors.push(...this.textCells.toArray());
}
return editors;
@@ -157,12 +158,12 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
public deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void {
if (newDecorationRange && newDecorationRange.cell && newDecorationRange.cell.cellType === 'markdown') {
let cell = this.cellEditors.filter(c => c.cellGuid() === newDecorationRange.cell.cellGuid)[0];
cell.deltaDecorations(newDecorationRange, undefined);
let cell = this.cellEditors.filter(c => c.cellGuid() === newDecorationRange.cell.cellGuid);
cell[cell.length - 1].deltaDecorations(newDecorationRange, undefined);
}
if (oldDecorationRange && oldDecorationRange.cell && oldDecorationRange.cell.cellType === 'markdown') {
let cell = this.cellEditors.filter(c => c.cellGuid() === oldDecorationRange.cell.cellGuid)[0];
cell.deltaDecorations(undefined, oldDecorationRange);
let cell = this.cellEditors.filter(c => c.cellGuid() === oldDecorationRange.cell.cellGuid);
cell[cell.length - 1].deltaDecorations(undefined, oldDecorationRange);
}
}