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 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue