dragging when ctrl/alt is pressed must copy selection
This commit is contained in:
parent
8a9488090d
commit
c5a53431e8
1 changed files with 9 additions and 4 deletions
|
|
@ -126,18 +126,18 @@ function DefaultHandlers(editor) {
|
||||||
mousePageY = event.getDocumentY(e);
|
mousePageY = event.getDocumentY(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
var onMouseSelectionEnd = function() {
|
var onMouseSelectionEnd = function(e) {
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
if (state == STATE_UNKNOWN)
|
if (state == STATE_UNKNOWN)
|
||||||
onStartSelect(pos);
|
onStartSelect(pos);
|
||||||
else if (state == STATE_DRAG)
|
else if (state == STATE_DRAG)
|
||||||
onMouseDragSelectionEnd();
|
onMouseDragSelectionEnd(e);
|
||||||
|
|
||||||
_self.$clickSelection = null;
|
_self.$clickSelection = null;
|
||||||
state = STATE_UNKNOWN;
|
state = STATE_UNKNOWN;
|
||||||
};
|
};
|
||||||
|
|
||||||
var onMouseDragSelectionEnd = function() {
|
var onMouseDragSelectionEnd = function(e) {
|
||||||
dom.removeCssClass(editor.container, "ace_dragging");
|
dom.removeCssClass(editor.container, "ace_dragging");
|
||||||
editor.session.removeMarker(dragSelectionMarker);
|
editor.session.removeMarker(dragSelectionMarker);
|
||||||
|
|
||||||
|
|
@ -157,7 +157,12 @@ function DefaultHandlers(editor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.clearSelection();
|
editor.clearSelection();
|
||||||
var newRange = editor.moveText(dragRange, dragCursor);
|
if (e && (e.ctrlKey || e.altKey)) {
|
||||||
|
var session = editor.session;
|
||||||
|
var newRange = session.insert(dragCursor, session.getTextRange(dragRange));
|
||||||
|
} else {
|
||||||
|
var newRange = editor.moveText(dragRange, dragCursor);
|
||||||
|
}
|
||||||
if (!newRange) {
|
if (!newRange) {
|
||||||
dragCursor = null;
|
dragCursor = null;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue