From a267e957b0ee17b0cbed11f5de3d81916726c08f Mon Sep 17 00:00:00 2001 From: Barbara Valdez <34872381+barbaravaldez@users.noreply.github.com> Date: Thu, 16 Dec 2021 11:35:22 -0800 Subject: [PATCH] Register undo redo command (#17948) * register undo redo command --- .../notebook/browser/notebook.component.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts index 8609c80218..792011f9d2 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts @@ -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() {