ReadOnly fixes
This commit is contained in:
parent
99f8aba562
commit
88a566977b
3 changed files with 14 additions and 3 deletions
|
|
@ -1015,6 +1015,8 @@ var Editor = function(renderer, session) {
|
||||||
**/
|
**/
|
||||||
this.setReadOnly = function(readOnly) {
|
this.setReadOnly = function(readOnly) {
|
||||||
this.$readOnly = readOnly;
|
this.$readOnly = readOnly;
|
||||||
|
this.textInput.setReadOnly(readOnly);
|
||||||
|
this.renderer.$cursorLayer.setBlinking(!readOnly);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -355,11 +355,14 @@ var TextInput = function(parentNode, host) {
|
||||||
event.addListener(text, "keyup", onCompositionUpdate);
|
event.addListener(text, "keyup", onCompositionUpdate);
|
||||||
event.addListener(text, "compositionend", onCompositionEnd);
|
event.addListener(text, "compositionend", onCompositionEnd);
|
||||||
|
|
||||||
// CONTEXTMENU
|
|
||||||
this.getElement = function() {
|
this.getElement = function() {
|
||||||
return text;
|
return text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setReadOnly = function(readOnly) {
|
||||||
|
text.readOnly = readOnly;
|
||||||
|
};
|
||||||
|
|
||||||
this.onContextMenu = function(e) {
|
this.onContextMenu = function(e) {
|
||||||
if (!tempStyle)
|
if (!tempStyle)
|
||||||
tempStyle = text.style.cssText;
|
tempStyle = text.style.cssText;
|
||||||
|
|
|
||||||
10
lib/ace/mouse/dragdrop.js
vendored
10
lib/ace/mouse/dragdrop.js
vendored
|
|
@ -41,6 +41,8 @@ var DragdropHandler = function(mouseHandler) {
|
||||||
|
|
||||||
var mouseTarget = editor.container;
|
var mouseTarget = editor.container;
|
||||||
event.addListener(mouseTarget, "dragenter", function(e) {
|
event.addListener(mouseTarget, "dragenter", function(e) {
|
||||||
|
if (editor.getReadOnly())
|
||||||
|
return;
|
||||||
counter++;
|
counter++;
|
||||||
if (!dragSelectionMarker) {
|
if (!dragSelectionMarker) {
|
||||||
range = editor.getSelectionRange();
|
range = editor.getSelectionRange();
|
||||||
|
|
@ -55,6 +57,8 @@ var DragdropHandler = function(mouseHandler) {
|
||||||
});
|
});
|
||||||
|
|
||||||
event.addListener(mouseTarget, "dragover", function(e) {
|
event.addListener(mouseTarget, "dragover", function(e) {
|
||||||
|
if (editor.getReadOnly())
|
||||||
|
return;
|
||||||
x = e.clientX;
|
x = e.clientX;
|
||||||
y = e.clientY;
|
y = e.clientY;
|
||||||
return event.preventDefault(e);
|
return event.preventDefault(e);
|
||||||
|
|
@ -67,10 +71,11 @@ var DragdropHandler = function(mouseHandler) {
|
||||||
};
|
};
|
||||||
|
|
||||||
event.addListener(mouseTarget, "dragleave", function(e) {
|
event.addListener(mouseTarget, "dragleave", function(e) {
|
||||||
|
if (editor.getReadOnly())
|
||||||
|
return;
|
||||||
counter--;
|
counter--;
|
||||||
if (counter > 0)
|
if (counter > 0)
|
||||||
return;
|
return;
|
||||||
console.log(e.type, counter,e.target);
|
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
editor.session.removeMarker(dragSelectionMarker);
|
editor.session.removeMarker(dragSelectionMarker);
|
||||||
dragSelectionMarker = null;
|
dragSelectionMarker = null;
|
||||||
|
|
@ -79,7 +84,8 @@ var DragdropHandler = function(mouseHandler) {
|
||||||
});
|
});
|
||||||
|
|
||||||
event.addListener(mouseTarget, "drop", function(e) {
|
event.addListener(mouseTarget, "drop", function(e) {
|
||||||
console.log(e.type, counter,e.target);
|
if (editor.getReadOnly())
|
||||||
|
return;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
editor.session.removeMarker(dragSelectionMarker);
|
editor.session.removeMarker(dragSelectionMarker);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue