Fix issue with blinking cursor on drag over

This happens when dragging from another app. Editor can get focused on app icon hovering (on a Windows taskbar).
This commit is contained in:
DanyaPostfactum 2013-10-02 02:52:49 +10:00
commit 9eef8dfb9e

View file

@ -62,6 +62,7 @@ function DragdropHandler(mouseHandler) {
var timerId, range;
var dragCursor, counter = 0;
var dragOperation;
var isInternal;
var autoScrollStartTime;
var cursorMovedTime;
var cursorPointOnCaretMoved;
@ -93,11 +94,13 @@ function DragdropHandler(mouseHandler) {
dataTransfer.clearData();
dataTransfer.setData("Text", editor.session.getTextRange());
isInternal = true;
this.setState("drag");
};
this.onDragEnd = function(e) {
mouseTarget.draggable = false;
isInternal = false;
this.setState(null);
if (!editor.getReadOnly()) {
var dropEffect = e.dataTransfer.dropEffect;
@ -150,7 +153,6 @@ function DragdropHandler(mouseHandler) {
if (!dragSelectionMarker)
return;
var dataTransfer = e.dataTransfer;
var isInternal = this.state == "drag";
if (isInternal) {
switch (dragOperation) {
case "move":
@ -259,6 +261,8 @@ function DragdropHandler(mouseHandler) {
range = editor.selection.toOrientedRange();
dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
editor.clearSelection();
if (editor.isFocused())
editor.renderer.$cursorLayer.setBlinking(false);
clearInterval(timerId);
timerId = setInterval(onDragInterval, 20);
counter = 0;
@ -272,6 +276,8 @@ function DragdropHandler(mouseHandler) {
editor.$blockScrolling += 1;
editor.selection.fromOrientedRange(range);
editor.$blockScrolling -= 1;
if (editor.isFocused() && !isInternal)
editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
range = null;
counter = 0;
autoScrollStartTime = null;