commit
2956f1b61f
8 changed files with 83 additions and 20 deletions
|
|
@ -729,7 +729,7 @@ function Folding() {
|
|||
} else {
|
||||
if (addSubfolds)
|
||||
this.foldAll(row + 1, this.getLength());
|
||||
e.target.className += " invalid"
|
||||
(e.target || e.srcElement).className += " invalid"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,24 @@ var TextInput = function(parentNode, host) {
|
|||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
|
||||
event.addListener(text, "input", onTextInput);
|
||||
|
||||
if (useragent.isOldIE) {
|
||||
var keytable = { 13:1, 27:1 };
|
||||
event.addListener(text, "keyup", function (e) {
|
||||
if (inCompostion && (!text.value || keytable[e.keyCode]))
|
||||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
}
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
|
||||
event.addListener(text, "propertychange", function() {
|
||||
if (text.value != PLACEHOLDER)
|
||||
setTimeout(sendText, 0);
|
||||
});
|
||||
}
|
||||
|
||||
event.addListener(text, "paste", function(e) {
|
||||
// Mark that the next input text comes from past.
|
||||
|
|
@ -268,11 +285,14 @@ var TextInput = function(parentNode, host) {
|
|||
tempStyle = text.style.cssText;
|
||||
|
||||
text.style.cssText =
|
||||
"position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"position:fixed; z-index:100000;" +
|
||||
(useragent.isIE ? "background:rgba(0, 0, 0, 0.03); opacity:0.1;" : "") + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
|
||||
|
||||
if (host.selection.isEmpty())
|
||||
text.value = "";
|
||||
else
|
||||
reset(true);
|
||||
|
||||
if (e.type != "mousedown")
|
||||
return;
|
||||
|
|
@ -281,7 +301,7 @@ var TextInput = function(parentNode, host) {
|
|||
host.renderer.$keepTextAreaAtCursor = null;
|
||||
|
||||
// on windows context menu is opened after mouseup
|
||||
if (useragent.isGecko && useragent.isWin)
|
||||
if (useragent.isWin && (useragent.isGecko || useragent.isIE))
|
||||
event.capture(host.container, function(e) {
|
||||
text.style.left = e.clientX - 2 + "px";
|
||||
text.style.top = e.clientY - 2 + "px";
|
||||
|
|
|
|||
|
|
@ -174,12 +174,32 @@ var Gutter = function(parentEl) {
|
|||
dom.removeCssClass(this.element, "ace_folding-enabled");
|
||||
|
||||
this.$showFoldWidgets = show;
|
||||
this.$padding = null;
|
||||
};
|
||||
|
||||
this.getShowFoldWidgets = function() {
|
||||
return this.$showFoldWidgets;
|
||||
};
|
||||
|
||||
this.$computePadding = function() {
|
||||
if (!this.element.firstChild)
|
||||
return {left: 0, right: 0};
|
||||
var style = dom.computedStyle(this.element.firstChild);
|
||||
this.$padding = {}
|
||||
this.$padding.left = parseInt(style.paddingLeft) + 1;
|
||||
this.$padding.right = parseInt(style.paddingRight);
|
||||
return this.$padding;
|
||||
};
|
||||
|
||||
this.getRegion = function(point) {
|
||||
var padding = this.$padding || this.$computePadding();
|
||||
var rect = this.element.getBoundingClientRect();
|
||||
if (point.x < padding.left + rect.left)
|
||||
return "markers";
|
||||
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
|
||||
return "foldWidgets";
|
||||
};
|
||||
|
||||
}).call(Gutter.prototype);
|
||||
|
||||
exports.Gutter = Gutter;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
|||
4: "quadclick"
|
||||
};
|
||||
|
||||
var listener = function(e) {
|
||||
exports.addListener(el, "mousedown", function(e) {
|
||||
if (exports.getButton(e) != 0) {
|
||||
clicks = 0;
|
||||
} else {
|
||||
|
|
@ -219,10 +219,18 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
|||
clicks = 0;
|
||||
else if (clicks > 1)
|
||||
return eventHandler[callbackName](eventNames[clicks], e);
|
||||
};
|
||||
});
|
||||
|
||||
exports.addListener(el, "mousedown", listener);
|
||||
useragent.isOldIE && exports.addListener(el, "dblclick", listener);
|
||||
if (useragent.isOldIE) {
|
||||
exports.addListener(el, "dblclick", function(e) {
|
||||
clicks = 2;
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
|
||||
eventHandler[callbackName]("mousedown", e);
|
||||
eventHandler[callbackName](eventNames[clicks], e);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function normalizeCommandKeys(callback, e, keyCode) {
|
||||
|
|
@ -292,7 +300,7 @@ exports.addCommandKeyListener = function(el, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
if (window.postMessage) {
|
||||
if (window.postMessage && !useragent.isOldIE) {
|
||||
var postMessageId = 1;
|
||||
exports.nextTick = function(callback, win) {
|
||||
win = win || window;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* based on code from:
|
||||
*
|
||||
*
|
||||
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var useragent = require("ace/lib/useragent");
|
||||
|
||||
exports.get = function (url, callback) {
|
||||
var xhr = exports.createXhr();
|
||||
xhr.open('GET', url, true);
|
||||
|
|
@ -55,8 +57,13 @@ exports.loadScript = function(path, callback) {
|
|||
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = callback;
|
||||
|
||||
if (useragent.isOldIE)
|
||||
s.onreadystatechange = function () {
|
||||
this.readyState == 'loaded' && callback();
|
||||
};
|
||||
else
|
||||
s.onload = callback;
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,15 +44,11 @@ function GutterHandler(mouseHandler) {
|
|||
var editor = mouseHandler.editor;
|
||||
|
||||
mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
|
||||
var target = e.domEvent.target;
|
||||
if (target.className.indexOf("ace_gutter-cell") == -1)
|
||||
return;
|
||||
|
||||
if (!editor.isFocused())
|
||||
return;
|
||||
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
||||
|
||||
var padding = parseInt(dom.computedStyle(target).paddingLeft);
|
||||
if (e.x < padding + target.getBoundingClientRect().left + 1)
|
||||
if (gutterRegion)
|
||||
return;
|
||||
|
||||
var row = e.getDocumentPosition().row;
|
||||
|
|
|
|||
|
|
@ -58,9 +58,12 @@ function FoldHandler(editor) {
|
|||
});
|
||||
|
||||
editor.on("gutterclick", function(e) {
|
||||
if (e.domEvent.target.className.indexOf("ace_fold-widget") != -1) {
|
||||
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
||||
|
||||
if (gutterRegion == "foldWidgets") {
|
||||
var row = e.getDocumentPosition().row;
|
||||
editor.session.onFoldWidgetClick(row, e.domEvent);
|
||||
if (editor.session.foldWidgets[row])
|
||||
editor.session.onFoldWidgetClick(row, e);
|
||||
e.stop();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var event = require("../lib/event");
|
||||
var useragent = require("../lib/useragent");
|
||||
var DefaultHandlers = require("./default_handlers").DefaultHandlers;
|
||||
var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
|
||||
var MouseEvent = require("./mouse_event").MouseEvent;
|
||||
|
|
@ -148,6 +149,14 @@ var MouseHandler = function(editor) {
|
|||
var onCaptureInterval = function() {
|
||||
self[self.state] && self[self.state]();
|
||||
}
|
||||
|
||||
if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
|
||||
setTimeout(function() {
|
||||
onCaptureInterval();
|
||||
onCaptureEnd(ev.domEvent);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
event.capture(this.editor.container, onMouseMove, onCaptureEnd);
|
||||
var timerId = setInterval(onCaptureInterval, 20);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue