diff --git a/src/vs/workbench/contrib/notebook/common/model/cellEdit.ts b/src/vs/workbench/contrib/notebook/common/model/cellEdit.ts index 9a9c8c2a3d6df45fde2ffff6e3d73b7c8e41f436..61453ae9a742bfb8e1e4412fd49cd7ef7e05bba3 100644 --- a/src/vs/workbench/contrib/notebook/common/model/cellEdit.ts +++ b/src/vs/workbench/contrib/notebook/common/model/cellEdit.ts @@ -18,70 +18,6 @@ export interface ITextCellEditingDelegate { updateCellMetadata?(index: number, newMetadata: NotebookCellMetadata): void; } - -export class InsertCellEdit implements IResourceUndoRedoElement { - type: UndoRedoElementType.Resource = UndoRedoElementType.Resource; - label: string = 'Insert Cell'; - constructor( - public resource: URI, - private insertIndex: number, - private cell: NotebookCellTextModel, - private editingDelegate: ITextCellEditingDelegate, - private beforedSelections: number[] | undefined, - private endSelections: number[] | undefined - ) { - } - - undo(): void { - if (!this.editingDelegate.deleteCell) { - throw new Error('Notebook Delete Cell not implemented for Undo/Redo'); - } - - this.editingDelegate.deleteCell(this.insertIndex, this.beforedSelections); - } - redo(): void { - if (!this.editingDelegate.insertCell) { - throw new Error('Notebook Insert Cell not implemented for Undo/Redo'); - } - - this.editingDelegate.insertCell(this.insertIndex, this.cell, this.endSelections); - } -} - -export class DeleteCellEdit implements IResourceUndoRedoElement { - type: UndoRedoElementType.Resource = UndoRedoElementType.Resource; - label: string = 'Delete Cell'; - constructor( - public resource: URI, - private insertIndex: number, - private _cell: NotebookCellTextModel, - private editingDelegate: ITextCellEditingDelegate, - private beforedSelections: number[] | undefined, - private endSelections: number[] | undefined - ) { - - // save inmem text to `ICell` - // no needed any more as the text buffer is transfered to `raw_cell` - // this._rawCell.source = [cell.getText()]; - } - - undo(): void { - if (!this.editingDelegate.insertCell) { - throw new Error('Notebook Insert Cell not implemented for Undo/Redo'); - } - - this.editingDelegate.insertCell(this.insertIndex, this._cell, this.beforedSelections); - } - - redo(): void { - if (!this.editingDelegate.deleteCell) { - throw new Error('Notebook Delete Cell not implemented for Undo/Redo'); - } - - this.editingDelegate.deleteCell(this.insertIndex, this.endSelections); - } -} - export class MoveCellEdit implements IResourceUndoRedoElement { type: UndoRedoElementType.Resource = UndoRedoElementType.Resource; label: string = 'Move Cell';