Add configuration option for block select

This commit is contained in:
xixixao 2015-03-18 21:09:45 +00:00
commit cb83a974b4
2 changed files with 10 additions and 3 deletions

View file

@ -84,14 +84,14 @@ function onMouseDown(e) {
if (editor.$mouseHandler.$enableJumpToDef) {
if (ctrl && alt || accel && alt)
selectionMode = "add";
else if (alt)
else if (alt && editor.$blockSelectEnabled)
selectionMode = "block";
} else {
if (accel && !alt) {
selectionMode = "add";
if (!isMultiSelect && shift)
return;
} else if (alt) {
} else if (alt && editor.$blockSelectEnabled) {
selectionMode = "block";
}
}

View file

@ -924,7 +924,8 @@ function addAltCursorListeners(editor){
var el = editor.textInput.getElement();
var altCursor = false;
event.addListener(el, "keydown", function(e) {
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey);
if (editor.$blockSelectEnabled && altDown) {
if (!altCursor) {
editor.renderer.setMouseCursor("crosshair");
altCursor = true;
@ -962,6 +963,12 @@ require("./config").defineOptions(Editor.prototype, "editor", {
}
},
value: true
},
enableBlockSelect: {
set: function(val) {
this.$blockSelectEnabled = val;
},
value: true
}
});