Merge pull request #2407 from xixixao/configure-block-select

Add configuration option for block select
This commit is contained in:
Harutyun Amirjanyan 2015-04-09 14:56:55 +04:00
commit 6070fe96f7
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
}
});