From 81a76a1529c876777085f8380fcd5e32d31b9114 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Thu, 26 Sep 2019 16:58:21 -0400 Subject: [PATCH 1/2] re #1067, when a line or lines are highlighted, tab will indent them --- client/modules/IDE/components/Editor.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index cb330b32..738e7666 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -108,7 +108,16 @@ class Editor extends React.Component { delete this._cm.options.lint.options.errors; this._cm.setOption('extraKeys', { - Tab: cm => cm.replaceSelection(' '.repeat(INDENTATION_AMOUNT)), + Tab: (cm) => { + // might need to specify and indent more? + const selection = cm.doc.getSelection(); + if (selection.length > 0) { + cm.execCommand('indentMore'); + } else { + cm.replaceSelection(' '.repeat(INDENTATION_AMOUNT)); + } + }, + // Tab: 'indentMore', [`${metaKey}-Enter`]: () => null, [`Shift-${metaKey}-Enter`]: () => null, [`${metaKey}-F`]: 'findPersistent', From c925da8c175a97f71e69a9b637efff855ebaa515 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Wed, 2 Oct 2019 16:48:33 -0400 Subject: [PATCH 2/2] re #1067, remove lingering commented-out code --- client/modules/IDE/components/Editor.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index 738e7666..6200348c 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -117,7 +117,6 @@ class Editor extends React.Component { cm.replaceSelection(' '.repeat(INDENTATION_AMOUNT)); } }, - // Tab: 'indentMore', [`${metaKey}-Enter`]: () => null, [`Shift-${metaKey}-Enter`]: () => null, [`${metaKey}-F`]: 'findPersistent',