mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-01 19:10:22 +02:00
Fix issue 546: Tab key not working in JS editor when using CodeMirror
- The check for the Emmet option was short-circuiting the logic for inserting a Tab. Note that the emmet option is only enabled on HTML and CSS editors, (and not the JS editor), which is why the `Tab` key works in those editors, but not the JS editor.
This commit is contained in:
@@ -344,18 +344,18 @@ export default class CodeEditor extends Component {
|
|||||||
if (didEmmetWork === true) {
|
if (didEmmetWork === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const input = $('[data-setting=indentWith]:checked');
|
}
|
||||||
if (
|
const input = $('[data-setting=indentWith]:checked');
|
||||||
!editor.somethingSelected() &&
|
if (
|
||||||
(!prefs.indentWith || prefs.indentWith === 'spaces')
|
!editor.somethingSelected() &&
|
||||||
) {
|
(!prefs.indentWith || prefs.indentWith === 'spaces')
|
||||||
// softtabs adds spaces. This is required because by default tab key will put tab, but we want
|
) {
|
||||||
// to indent with spaces if `spaces` is preferred mode of indentation.
|
// softtabs adds spaces. This is required because by default tab key will put tab, but we want
|
||||||
// `somethingSelected` needs to be checked otherwise, all selected code is replaced with softtab.
|
// to indent with spaces if `spaces` is preferred mode of indentation.
|
||||||
CodeMirror.commands.insertSoftTab(editor);
|
// `somethingSelected` needs to be checked otherwise, all selected code is replaced with softtab.
|
||||||
} else {
|
CodeMirror.commands.insertSoftTab(editor);
|
||||||
CodeMirror.commands.defaultTab(editor);
|
} else {
|
||||||
}
|
CodeMirror.commands.defaultTab(editor);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Enter: 'emmetInsertLineBreak'
|
Enter: 'emmetInsertLineBreak'
|
||||||
|
Reference in New Issue
Block a user