Merge branch 'refs/heads/master' into eddy
This commit is contained in:
commit
c49eecc080
6 changed files with 41 additions and 64 deletions
|
|
@ -136,6 +136,7 @@
|
|||
require(
|
||||
{baseUrl: "../src"},
|
||||
[
|
||||
"ace/lib/event",
|
||||
"ace/Editor",
|
||||
"ace/VirtualRenderer",
|
||||
"ace/theme/TextMate",
|
||||
|
|
@ -146,9 +147,8 @@ require(
|
|||
"ace/mode/Xml",
|
||||
"ace/mode/Text",
|
||||
"ace/UndoManager"
|
||||
], function(Editor, Renderer, theme, Document, JavaScriptMode, CssMode, HtmlMode, XmlMode, TextMode, UndoManager) {
|
||||
], function(event, Editor, Renderer, theme, Document, JavaScriptMode, CssMode, HtmlMode, XmlMode, TextMode, UndoManager) {
|
||||
|
||||
var ace = require("ace/ace");
|
||||
var docs = {}
|
||||
|
||||
docs.js = new Document(document.getElementById("jstext").innerHTML);
|
||||
|
|
@ -252,15 +252,15 @@ function onResize() {
|
|||
window.onresize = onResize;
|
||||
onResize();
|
||||
|
||||
ace.addListener(container, "dragover", function(e) {
|
||||
return ace.preventDefault(e);
|
||||
event.addListener(container, "dragover", function(e) {
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
ace.addListener(container, "drop", function(e) {
|
||||
event.addListener(container, "drop", function(e) {
|
||||
try {
|
||||
var file = e.dataTransfer.files[0];
|
||||
} catch(e) {
|
||||
return ace.stopEvent();
|
||||
return event.stopEvent();
|
||||
}
|
||||
|
||||
if (window.FileReader) {
|
||||
|
|
@ -287,7 +287,7 @@ ace.addListener(container, "drop", function(e) {
|
|||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
return ace.preventDefault(e);
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
require.def("ace/Editor",
|
||||
[
|
||||
"ace/ace",
|
||||
"ace/lib/oop",
|
||||
"ace/lib/event",
|
||||
"ace/lib/lang",
|
||||
"ace/TextInput",
|
||||
|
|
@ -17,7 +17,7 @@ require.def("ace/Editor",
|
|||
"ace/BackgroundTokenizer",
|
||||
"ace/Range",
|
||||
"ace/MEventEmitter"
|
||||
], function(ace, event, lang, TextInput, KeyBinding, Document, Search, BackgroundTokenizer, Range, MEventEmitter) {
|
||||
], function(oop, event, lang, TextInput, KeyBinding, Document, Search, BackgroundTokenizer, Range, MEventEmitter) {
|
||||
|
||||
var Editor = function(renderer, doc) {
|
||||
var container = renderer.getContainerElement();
|
||||
|
|
@ -27,19 +27,19 @@ var Editor = function(renderer, doc) {
|
|||
this.textInput = new TextInput(container, this);
|
||||
this.keyBinding = new KeyBinding(container, this);
|
||||
var self = this;
|
||||
ace.addListener(container, "mousedown", function(e) {
|
||||
event.addListener(container, "mousedown", function(e) {
|
||||
setTimeout(function() {self.focus();});
|
||||
return ace.preventDefault(e);
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
ace.addListener(container, "selectstart", function(e) {
|
||||
return ace.preventDefault(e);
|
||||
event.addListener(container, "selectstart", function(e) {
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
var mouseTarget = renderer.getMouseEventTarget();
|
||||
ace.addListener(mouseTarget, "mousedown", ace.bind(this.onMouseDown, this));
|
||||
ace.addMultiMouseDownListener(mouseTarget, 2, 500, ace.bind(this.onMouseDoubleClick, this));
|
||||
ace.addMultiMouseDownListener(mouseTarget, 3, 600, ace.bind(this.onMouseTripleClick, this));
|
||||
ace.addMouseWheelListener(mouseTarget, ace.bind(this.onMouseWheel, this));
|
||||
event.addListener(mouseTarget, "mousedown", lang.bind(this.onMouseDown, this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 2, 500, lang.bind(this.onMouseDoubleClick, this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 3, 600, lang.bind(this.onMouseTripleClick, this));
|
||||
event.addMouseWheelListener(mouseTarget, lang.bind(this.onMouseWheel, this));
|
||||
|
||||
this.$selectionMarker = null;
|
||||
this.$highlightLineMarker = null;
|
||||
|
|
@ -55,7 +55,7 @@ var Editor = function(renderer, doc) {
|
|||
|
||||
(function(){
|
||||
|
||||
ace.implement(this, MEventEmitter);
|
||||
oop.implement(this, MEventEmitter);
|
||||
|
||||
this.$forwardEvents = {
|
||||
gutterclick: 1,
|
||||
|
|
@ -99,26 +99,26 @@ var Editor = function(renderer, doc) {
|
|||
|
||||
this.doc = doc;
|
||||
|
||||
this.$onDocumentChange = ace.bind(this.onDocumentChange, this);
|
||||
this.$onDocumentChange = lang.bind(this.onDocumentChange, this);
|
||||
doc.addEventListener("change", this.$onDocumentChange);
|
||||
this.renderer.setDocument(doc);
|
||||
|
||||
this.$onDocumentModeChange = ace.bind(this.onDocumentModeChange, this);
|
||||
this.$onDocumentModeChange = lang.bind(this.onDocumentModeChange, this);
|
||||
doc.addEventListener("changeMode", this.$onDocumentModeChange);
|
||||
|
||||
this.$onDocumentChangeTabSize = ace.bind(this.renderer.updateText, this.renderer);
|
||||
this.$onDocumentChangeTabSize = lang.bind(this.renderer.updateText, this.renderer);
|
||||
doc.addEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||
|
||||
this.$onDocumentChangeBreakpoint = ace.bind(this.onDocumentChangeBreakpoint, this);
|
||||
this.$onDocumentChangeBreakpoint = lang.bind(this.onDocumentChangeBreakpoint, this);
|
||||
this.doc.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
||||
|
||||
this.selection = doc.getSelection();
|
||||
this.$desiredColumn = 0;
|
||||
|
||||
this.$onCursorChange = ace.bind(this.onCursorChange, this);
|
||||
this.$onCursorChange = lang.bind(this.onCursorChange, this);
|
||||
this.selection.addEventListener("changeCursor", this.$onCursorChange);
|
||||
|
||||
this.$onSelectionChange = ace.bind(this.onSelectionChange, this);
|
||||
this.$onSelectionChange = lang.bind(this.onSelectionChange, this);
|
||||
this.selection.addEventListener("changeSelection", this.$onSelectionChange);
|
||||
|
||||
this.onDocumentModeChange();
|
||||
|
|
@ -255,7 +255,7 @@ var Editor = function(renderer, doc) {
|
|||
var tokenizer = mode.getTokenizer();
|
||||
|
||||
if (!this.bgTokenizer) {
|
||||
var onUpdate = ace.bind(this.onTokenizerUpdate, this);
|
||||
var onUpdate = lang.bind(this.onTokenizerUpdate, this);
|
||||
this.bgTokenizer = new BackgroundTokenizer(tokenizer, this);
|
||||
this.bgTokenizer.addEventListener("update", onUpdate);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -6,18 +6,19 @@
|
|||
* @author Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*/
|
||||
require.def("ace/KeyBinding",
|
||||
["ace/ace",
|
||||
["ace/lib/core",
|
||||
"ace/lib/event",
|
||||
"ace/conf/keybindings/default_mac",
|
||||
"ace/conf/keybindings/default_win",
|
||||
"ace/PluginManager",
|
||||
"ace/commands/DefaultCommands"],
|
||||
function(ace, default_mac, default_win, PluginManager) {
|
||||
function(core, event, default_mac, default_win, PluginManager) {
|
||||
|
||||
var KeyBinding = function(element, editor, config) {
|
||||
this.setConfig(config);
|
||||
|
||||
var _self = this;
|
||||
ace.addKeyListener(element, function(e) {
|
||||
event.addKeyListener(element, function(e) {
|
||||
var hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
|
||||
| (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
|
||||
var key = _self.keyNames[e.keyCode];
|
||||
|
|
@ -28,7 +29,7 @@ var KeyBinding = function(element, editor, config) {
|
|||
|
||||
if (command) {
|
||||
command(editor, editor.getSelection());
|
||||
return ace.stopEvent(e);
|
||||
return event.stopEvent(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -109,7 +110,7 @@ var KeyBinding = function(element, editor, config) {
|
|||
}
|
||||
|
||||
this.setConfig = function(config) {
|
||||
this.config = config || (ace.isMac
|
||||
this.config = config || (core.isMac
|
||||
? default_mac
|
||||
: default_win);
|
||||
if (typeof this.config.reverse == "undefined")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,13 @@
|
|||
* @license LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
* @author Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*/
|
||||
require.def("ace/ScrollBar", ["ace/ace", "ace/MEventEmitter"], function(ace, MEventEmitter) {
|
||||
require.def("ace/ScrollBar", [
|
||||
"ace/lib/oop",
|
||||
"ace/lib/lang",
|
||||
"ace/lib/dom",
|
||||
"ace/lib/event",
|
||||
"ace/MEventEmitter"
|
||||
], function(oop, lang, dom, event, MEventEmitter) {
|
||||
|
||||
var ScrollBar = function(parent) {
|
||||
this.element = document.createElement("div");
|
||||
|
|
@ -16,14 +22,14 @@ var ScrollBar = function(parent) {
|
|||
|
||||
parent.appendChild(this.element);
|
||||
|
||||
this.width = ace.scrollbarWidth();
|
||||
this.width = dom.scrollbarWidth();
|
||||
this.element.style.width = this.width;
|
||||
|
||||
ace.addListener(this.element, "scroll", ace.bind(this.onScroll, this));
|
||||
event.addListener(this.element, "scroll", lang.bind(this.onScroll, this));
|
||||
};
|
||||
|
||||
(function() {
|
||||
ace.implement(this, MEventEmitter);
|
||||
oop.implement(this, MEventEmitter);
|
||||
|
||||
this.onScroll = function() {
|
||||
this.$dispatchEvent("scroll", {data: this.element.scrollTop});
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* Ajax.org Code Editor (ACE)
|
||||
*
|
||||
* @copyright 2010, Ajax.org Services B.V.
|
||||
* @license LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
* @author Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*/
|
||||
|
||||
if (!require.def) require.def = require("requireJS-node")(module);
|
||||
|
||||
require.def("ace/ace", [
|
||||
"ace/lib/core",
|
||||
"ace/lib/dom",
|
||||
"ace/lib/event",
|
||||
"ace/lib/lang",
|
||||
"ace/lib/oop"
|
||||
], function(core, dom, evt, lang, oop) {
|
||||
|
||||
var ace = {};
|
||||
|
||||
oop.mixin(ace, core);
|
||||
oop.mixin(ace, dom);
|
||||
oop.mixin(ace, evt);
|
||||
oop.mixin(ace, lang);
|
||||
oop.mixin(ace, oop);
|
||||
|
||||
return ace;
|
||||
});
|
||||
|
|
@ -30,7 +30,6 @@ var Marker = function(parentEl) {
|
|||
clazz : clazz
|
||||
};
|
||||
|
||||
this.update();
|
||||
return id;
|
||||
};
|
||||
|
||||
|
|
@ -38,7 +37,6 @@ var Marker = function(parentEl) {
|
|||
var marker = this.markers[markerId];
|
||||
if (marker) {
|
||||
delete (this.markers[markerId]);
|
||||
this.update();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue