2 Komitmen d0f2ea43d2 ... ced90d5188

Pembuat SHA1 Pesan Tanggal
  kilnonedre ced90d5188 Merge branch 'yili' of http://gogsb.soaringnova.com/ylproj/jupyterlab into yili 1 tahun lalu
  kilnonedre 657582655c '代码块的缩进:改' 1 tahun lalu
1 mengubah file dengan 13 tambahan dan 14 penghapusan
  1. 13 14
      packages/yili-dag/src/ScriptEditor.tsx

+ 13 - 14
packages/yili-dag/src/ScriptEditor.tsx

@@ -105,23 +105,22 @@ export default class ScriptEditor extends React.Component<any, any> {
         indentUnit: 4,
         tabSize: 4,
         extraKeys: {
-          Tab: (cm) => {
+          Tab: cm => {
             const indentUnit = cm.getOption('indentUnit') as number;
-            if (cm.somethingSelected()) {    
-                cm.indentSelection('add');  
-            } else {                   
-                cm.replaceSelection(Array(indentUnit + 1).join(" "));
-            }   
-        },  
-        "Shift-Tab": (cm) => {              
             if (cm.somethingSelected()) {
-                cm.indentSelection('subtract');  
+              cm.indentSelection('add');
             } else {
-                const cursor = cm.getCursor();
-                cm.setCursor({line: cursor.line, ch: cursor.ch - 4});  
-            }   
-            return ;
-        },  
+              cm.replaceSelection(Array(indentUnit + 1).join(' '));
+            }
+          },
+          'Shift-Tab': cm => {
+            if (cm.somethingSelected()) {
+              cm.indentSelection('subtract');
+            } else {
+              cm.indentLine(cm.getCursor().line, 'subtract');
+            }
+            return;
+          }
         }
       }
     );