Make editor container to be drop zone
This commit is contained in:
parent
b6dab9eb45
commit
624eb7c117
2 changed files with 12 additions and 12 deletions
|
|
@ -16,7 +16,6 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
z-index: 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_content {
|
.ace_content {
|
||||||
|
|
@ -27,12 +26,12 @@
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_content[draggable="true"] {
|
.ace_dragging, .ace_dragging * {
|
||||||
cursor: default;
|
cursor: default !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_selecting, .ace_selecting .ace_gutter{
|
.ace_selecting, .ace_selecting * {
|
||||||
cursor: text;
|
cursor: text !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_gutter {
|
.ace_gutter {
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,10 @@ function DragdropHandler(mouseHandler) {
|
||||||
exports.forEach(function(x) {
|
exports.forEach(function(x) {
|
||||||
mouseHandler[x] = this[x];
|
mouseHandler[x] = this[x];
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var mouseTarget = editor.renderer.getMouseEventTarget();
|
|
||||||
editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler));
|
editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler));
|
||||||
|
|
||||||
|
|
||||||
|
var mouseTarget = editor.container;
|
||||||
var dragSelectionMarker, x, y;
|
var dragSelectionMarker, x, y;
|
||||||
var timerId, range;
|
var timerId, range;
|
||||||
var dragCursor, counter = 0;
|
var dragCursor, counter = 0;
|
||||||
|
|
@ -99,6 +99,7 @@ function DragdropHandler(mouseHandler) {
|
||||||
editor.session.remove(editor.getSelectionRange());
|
editor.session.remove(editor.getSelectionRange());
|
||||||
editor.renderer.$cursorLayer.setBlinking(true);
|
editor.renderer.$cursorLayer.setBlinking(true);
|
||||||
}
|
}
|
||||||
|
this.editor.unsetStyle("ace_dragging");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onDragEnter = function(e) {
|
this.onDragEnter = function(e) {
|
||||||
|
|
@ -218,7 +219,6 @@ function DragdropHandler(mouseHandler) {
|
||||||
timerId = setInterval(onDragInterval, 20);
|
timerId = setInterval(onDragInterval, 20);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
event.addListener(document, "mousemove", onMouseMove);
|
event.addListener(document, "mousemove", onMouseMove);
|
||||||
editor.setStyle("ace_dragging");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearDragMarker() {
|
function clearDragMarker() {
|
||||||
|
|
@ -231,7 +231,6 @@ function DragdropHandler(mouseHandler) {
|
||||||
range = null;
|
range = null;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
event.removeListener(document, "mousemove", onMouseMove);
|
event.removeListener(document, "mousemove", onMouseMove);
|
||||||
editor.unsetStyle("ace_dragging");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sometimes other code on the page can stop dragleave event leaving editor stuck in the drag state
|
// sometimes other code on the page can stop dragleave event leaving editor stuck in the drag state
|
||||||
|
|
@ -295,10 +294,11 @@ function DragdropHandler(mouseHandler) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.startDrag = function(){
|
this.startDrag = function(){
|
||||||
var target = this.editor.renderer.getMouseEventTarget();
|
var target = this.editor.container;
|
||||||
this.setState("dragReady");
|
this.setState("dragReady");
|
||||||
this.editor.renderer.$cursorLayer.setBlinking(false);
|
this.editor.renderer.$cursorLayer.setBlinking(false);
|
||||||
target.draggable = true;
|
target.draggable = true;
|
||||||
|
this.editor.setStyle("ace_dragging");
|
||||||
if (useragent.isIE) {
|
if (useragent.isIE) {
|
||||||
// IE does not handle [draggable] attribute set after mousedown
|
// IE does not handle [draggable] attribute set after mousedown
|
||||||
event.addListener(target, "mousemove", forceDragIE);
|
event.addListener(target, "mousemove", forceDragIE);
|
||||||
|
|
@ -306,8 +306,9 @@ function DragdropHandler(mouseHandler) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dragReadyEnd = function(e) {
|
this.dragReadyEnd = function(e) {
|
||||||
var target = this.editor.renderer.getMouseEventTarget();
|
var target = this.editor.container;
|
||||||
target.draggable = false;
|
target.draggable = false;
|
||||||
|
this.editor.unsetStyle("ace_dragging");
|
||||||
if (useragent.isIE) {
|
if (useragent.isIE) {
|
||||||
event.removeListener(target, "mousemove", forceDragIE);
|
event.removeListener(target, "mousemove", forceDragIE);
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +332,7 @@ function DragdropHandler(mouseHandler) {
|
||||||
if (useragent.isWebKit) {
|
if (useragent.isWebKit) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.cancelDrag = true;
|
self.cancelDrag = true;
|
||||||
var mouseTarget = editor.renderer.getMouseEventTarget();
|
var mouseTarget = editor.container;
|
||||||
mouseTarget.draggable = true;
|
mouseTarget.draggable = true;
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
self.cancelDrag = false;
|
self.cancelDrag = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue