Parcourir la source

Merge pull request #731 from blink1073/undo-shortcut

Clean up Notebook Shortcut Mapping
Jason Grout il y a 8 ans
Parent
commit
88c755d1d8

+ 0 - 1
src/notebook/cells/widget.ts

@@ -220,7 +220,6 @@ class BaseCellWidget extends Widget {
   toggleInput(value: boolean): void {
     if (value) {
       this._input.show();
-      this.activate();
     } else {
       this._input.hide();
     }

+ 1 - 0
src/notebook/notebook/widget.ts

@@ -1012,6 +1012,7 @@ class Notebook extends StaticNotebook {
     let widget = layout.widgets.at(i) as MarkdownCellWidget;
     if (cell.type === 'markdown') {
       widget.rendered = false;
+      widget.activate();
       return;
     } else if (target.localName === 'img') {
       target.classList.toggle(UNCONFINED_CLASS);

+ 2 - 2
src/shortcuts/plugin.ts

@@ -98,7 +98,7 @@ const SHORTCUTS = [
   {
     command: 'notebook-cells:to-code',
     selector: '.jp-Notebook.jp-mod-commandMode',
-    keys: ['E']
+    keys: ['Y']
   },
   {
     command: 'notebook-cells:to-markdown',
@@ -173,7 +173,7 @@ const SHORTCUTS = [
   {
     command: 'notebook-cells:redo',
     selector: '.jp-Notebook.jp-mod-commandMode',
-    keys: ['Y'],
+    keys: ['Shift Z'],
   },
   {
     command: 'notebook-cells:cut',

+ 2 - 0
test/src/notebook/notebook/actions.spec.ts

@@ -218,12 +218,14 @@ describe('notebook/notebook/actions', () => {
         NotebookActions.mergeCells(widget);
         cell = widget.activeCell as MarkdownCellWidget;
         expect(cell.rendered).to.be(false);
+        expect(widget.mode).to.be('command');
       });
 
       it('should preserve the cell type of the active cell', () => {
         NotebookActions.changeCellType(widget, 'raw');
         NotebookActions.mergeCells(widget);
         expect(widget.activeCell).to.be.a(RawCellWidget);
+        expect(widget.mode).to.be('command');
       });
 
     });