Register undo redo command (#17948)

* register undo redo command
This commit is contained in:
Barbara Valdez
2021-12-16 11:35:22 -08:00
committed by GitHub
parent 8da859c166
commit a267e957b0

View File

@@ -57,9 +57,10 @@ import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { Emitter } from 'vs/base/common/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { KeyCode } from 'vs/base/common/keyCodes';
import { RedoCommand, UndoCommand } from 'vs/editor/browser/editorExtensions';
export const NOTEBOOK_SELECTOR: string = 'notebook-component';
const PRIORITY = 105;
@Component({
selector: NOTEBOOK_SELECTOR,
templateUrl: decodeURI(require.toUrl('./notebook.component.html'))
@@ -133,6 +134,18 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
}
}
}));
this._register(RedoCommand.addImplementation(PRIORITY, 'notebook-cells-undo-redo', () => {
if (this._model) {
this._model.redo();
}
return false;
}));
this._register(UndoCommand.addImplementation(PRIORITY, 'notebook-cells-undo-redo', () => {
if (this._model) {
this._model.undo();
}
return false;
}));
}
ngOnInit() {