make selected indenting and outdenting work on courseware HTML, JS and Bonfires
parent
f99718daa0
commit
191e38472e
|
@ -18,8 +18,20 @@ editor.setSize("100%", "auto");
|
|||
// Hijack tab key to enter two spaces intead
|
||||
editor.setOption("extraKeys", {
|
||||
Tab: function(cm) {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
if (cm.somethingSelected()){
|
||||
cm.indentSelection("add");
|
||||
} else {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
}
|
||||
},
|
||||
"Shift-Tab": function(cm) {
|
||||
if (cm.somethingSelected()){
|
||||
cm.indentSelection("subtract");
|
||||
} else {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
}
|
||||
},
|
||||
"Ctrl-Enter": function() {
|
||||
bonfireExecute();
|
||||
|
|
|
@ -22,10 +22,23 @@ var editor = myCodeMirror;
|
|||
// Hijack tab key to insert two spaces instead
|
||||
editor.setOption("extraKeys", {
|
||||
Tab: function(cm) {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
if (cm.somethingSelected()){
|
||||
cm.indentSelection("add");
|
||||
} else {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
}
|
||||
},
|
||||
"Shift-Tab": function(cm) {
|
||||
if (cm.somethingSelected()){
|
||||
cm.indentSelection("subtract");
|
||||
} else {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
}
|
||||
},
|
||||
"Ctrl-Enter": function() {
|
||||
bonfireExecute();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,8 +18,20 @@ editor.setSize("100%", "auto");
|
|||
// Hijack tab key to enter two spaces intead
|
||||
editor.setOption("extraKeys", {
|
||||
Tab: function(cm) {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
if (cm.somethingSelected()){
|
||||
cm.indentSelection("add");
|
||||
} else {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
}
|
||||
},
|
||||
"Shift-Tab": function(cm) {
|
||||
if (cm.somethingSelected()){
|
||||
cm.indentSelection("subtract");
|
||||
} else {
|
||||
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
}
|
||||
},
|
||||
"Ctrl-Enter": function() {
|
||||
bonfireExecute();
|
||||
|
|
Loading…
Reference in New Issue