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:
parent
617d43bb13
commit
9eef8dfb9e
1 changed files with 7 additions and 1 deletions
|
|
@ -62,6 +62,7 @@ function DragdropHandler(mouseHandler) {
|
||||||
var timerId, range;
|
var timerId, range;
|
||||||
var dragCursor, counter = 0;
|
var dragCursor, counter = 0;
|
||||||
var dragOperation;
|
var dragOperation;
|
||||||
|
var isInternal;
|
||||||
var autoScrollStartTime;
|
var autoScrollStartTime;
|
||||||
var cursorMovedTime;
|
var cursorMovedTime;
|
||||||
var cursorPointOnCaretMoved;
|
var cursorPointOnCaretMoved;
|
||||||
|
|
@ -93,11 +94,13 @@ function DragdropHandler(mouseHandler) {
|
||||||
dataTransfer.clearData();
|
dataTransfer.clearData();
|
||||||
dataTransfer.setData("Text", editor.session.getTextRange());
|
dataTransfer.setData("Text", editor.session.getTextRange());
|
||||||
|
|
||||||
|
isInternal = true;
|
||||||
this.setState("drag");
|
this.setState("drag");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onDragEnd = function(e) {
|
this.onDragEnd = function(e) {
|
||||||
mouseTarget.draggable = false;
|
mouseTarget.draggable = false;
|
||||||
|
isInternal = false;
|
||||||
this.setState(null);
|
this.setState(null);
|
||||||
if (!editor.getReadOnly()) {
|
if (!editor.getReadOnly()) {
|
||||||
var dropEffect = e.dataTransfer.dropEffect;
|
var dropEffect = e.dataTransfer.dropEffect;
|
||||||
|
|
@ -150,7 +153,6 @@ function DragdropHandler(mouseHandler) {
|
||||||
if (!dragSelectionMarker)
|
if (!dragSelectionMarker)
|
||||||
return;
|
return;
|
||||||
var dataTransfer = e.dataTransfer;
|
var dataTransfer = e.dataTransfer;
|
||||||
var isInternal = this.state == "drag";
|
|
||||||
if (isInternal) {
|
if (isInternal) {
|
||||||
switch (dragOperation) {
|
switch (dragOperation) {
|
||||||
case "move":
|
case "move":
|
||||||
|
|
@ -259,6 +261,8 @@ function DragdropHandler(mouseHandler) {
|
||||||
range = editor.selection.toOrientedRange();
|
range = editor.selection.toOrientedRange();
|
||||||
dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
|
dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
|
||||||
editor.clearSelection();
|
editor.clearSelection();
|
||||||
|
if (editor.isFocused())
|
||||||
|
editor.renderer.$cursorLayer.setBlinking(false);
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
timerId = setInterval(onDragInterval, 20);
|
timerId = setInterval(onDragInterval, 20);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
|
@ -272,6 +276,8 @@ function DragdropHandler(mouseHandler) {
|
||||||
editor.$blockScrolling += 1;
|
editor.$blockScrolling += 1;
|
||||||
editor.selection.fromOrientedRange(range);
|
editor.selection.fromOrientedRange(range);
|
||||||
editor.$blockScrolling -= 1;
|
editor.$blockScrolling -= 1;
|
||||||
|
if (editor.isFocused() && !isInternal)
|
||||||
|
editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
|
||||||
range = null;
|
range = null;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
autoScrollStartTime = null;
|
autoScrollStartTime = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue