|
@@ -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;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
);
|