move pilot code back into Ace

Conflicts:

	.gitmodules
	Makefile.dryice.js
	build_support/editor_textarea.html
	demo/demo.js
	kitchen-sink.html
	lib/ace/edit_session_test.js
	lib/ace/mode/coffee.js
	lib/ace/mode/coffee_highlight_rules.js
	lib/ace/mode/css.js
	lib/ace/mode/javascript.js
	lib/ace/model/window.js
	lib/ace/mouse/default_handlers.js
	lib/ace/theme/clouds.js
	lib/ace/theme/clouds_midnight.js
	lib/ace/theme/cobalt.js
	lib/ace/theme/crimson_editor.js
	lib/ace/theme/dawn.js
	lib/ace/theme/eclipse.js
	lib/ace/theme/idle_fingers.js
	lib/ace/theme/kr_theme.js
	lib/ace/theme/merbivore.js
	lib/ace/theme/merbivore_soft.js
	lib/ace/theme/mono_industrial.js
	lib/ace/theme/monokai.js
	lib/ace/theme/pastel_on_dark.js
	lib/ace/theme/solarized_dark.js
	lib/ace/theme/solarized_light.js
	lib/ace/theme/textmate.js
	lib/ace/theme/twilight.js
	lib/ace/theme/vibrant_ink.js
	lib/ace/view/measure_text.js
	lib/ace/virtual_renderer.js
	package.json
	support/paths.js
This commit is contained in:
Fabian Jakobs 2011-07-28 11:46:09 +02:00
commit b063b96230
110 changed files with 1532 additions and 236 deletions

5
.gitmodules vendored
View file

@ -3,7 +3,4 @@
url = git://github.com/ajaxorg/ace.wiki.git
[submodule "node_modules/dryice"]
path = node_modules/dryice
url = git://github.com/ajaxorg/dryice.git
[submodule "node_modules/pilot"]
path = node_modules/pilot
url = git://github.com/ajaxorg/pilot.git
url = git://github.com/ajaxorg/dryice.git

View file

@ -89,7 +89,6 @@ var aceHome = __dirname;
console.log('# ace ---------');
var aceProject = [
aceHome + '/node_modules/pilot/lib',
aceHome + '/lib',
aceHome
];
@ -135,7 +134,7 @@ copy({
copy.source.commonjs({
project: project,
require: [
"pilot/fixoldbrowsers",
"ace/lib/fixoldbrowsers",
"ace/ace"
]
})
@ -274,7 +273,6 @@ console.log('# ace worker ---------');
console.log("worker for " + mode + " mode");
var worker = copy.createDataObject();
var workerProject = copy.createCommonJsProject([
aceHome + '/node_modules/pilot/lib',
aceHome + '/lib'
]);
copy({
@ -282,9 +280,9 @@ console.log('# ace worker ---------');
copy.source.commonjs({
project: workerProject,
require: [
'pilot/fixoldbrowsers',
'pilot/event_emitter',
'pilot/oop',
'ace/lib/fixoldbrowsers',
'ace/lib/event_emitter',
'ace/lib/oop',
'ace/mode/' + mode + '_worker'
]
})

View file

@ -40,11 +40,9 @@
var require = window.__ace_shadowed__.require;
require("pilot/index");
var Dom = require("pilot/dom");
var Event = require("pilot/event");
var UA = require("pilot/useragent")
var Dom = require("ace/lib/dom");
var Event = require("ace/lib/event");
var UA = require("ace/lib/useragent")
var Editor = require("ace/editor").Editor;
var EditSession = require("ace/edit_session").EditSession;

View file

@ -84,7 +84,7 @@ function inject() {
load('ace.js', 'text!ace/css/editor.css', function() {
var ace = window.__ace_shadowed__;
ace.options.mode = "javascript";
var Event = ace.require('pilot/event');
var Event = ace.require("lib/ace/event");
var areas = document.getElementsByTagName("textarea");
for (var i = 0; i < areas.length; i++) {
Event.addListener(areas[i], "click", function(e) {

View file

@ -40,11 +40,11 @@
define(function(require, exports, module) {
require("pilot/fixoldbrowsers");
require("ace/lib/fixoldbrowsers");
var env = {};
var net = require("ace/lib/net");
var event = require("pilot/event");
var event = require("ace/lib/event");
var Range = require("ace/range").Range;
var Editor = require("ace/editor").Editor;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;

View file

@ -19,8 +19,7 @@
var require = {
paths: {
demo: "..",
ace: "../../lib/ace",
pilot: "../../support/pilot/lib/pilot"
ace: "../../lib/ace"
}
};
</script>
@ -32,7 +31,7 @@ require(["ace/ext/static_highlight", "ace/mode/javascript", "ace/theme/twilight"
var highlighter = require("ace/ext/static_highlight");
var JavaScriptMode = require("ace/mode/javascript").Mode;
var theme = require("ace/theme/twilight");
var dom = require("pilot/dom");
var dom = require("ace/lib/dom");
var codeEl = document.getElementById("code");
var data = document.body.innerHTML;

View file

@ -190,8 +190,7 @@
var require = {
baseUrl: "/" + window.location.pathname.split("/").slice(0, -1).join("/"),
paths: {
ace: "lib/ace",
pilot: "node_modules/pilot/lib/pilot"
ace: "lib/ace"
}
};
</script>

View file

@ -37,11 +37,10 @@
define(function(require, exports, module) {
require("pilot/index");
require("pilot/fixoldbrowsers");
require("ace/lib/fixoldbrowsers");
var Dom = require("pilot/dom");
var Event = require("pilot/event");
var Dom = require("ace/lib/dom");
var Event = require("ace/lib/event");
var Editor = require("ace/editor").Editor;
var EditSession = require("ace/edit_session").EditSession;

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
/**
* An Anchor is a floating pointer in the document. Whenever text is inserted or

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) {
var keyUtil = require('pilot/keys');
var useragent = require('pilot/useragent');
var keyUtil = require("ace/lib/keys");
var useragent = require("ace/lib/useragent");
var CommandManager = function(commands) {
this.commands = {};

View file

@ -40,7 +40,7 @@
define(function(require, exports, module) {
var lang = require("pilot/lang");
var lang = require("ace/lib/lang");
function bindKey(win, mac) {
return {

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var Range = require("ace/range").Range;
var Anchor = require("ace/anchor").Anchor;

View file

@ -40,9 +40,9 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var Selection = require("ace/selection").Selection;
var TextMode = require("ace/mode/text").Mode;
var Range = require("ace/range").Range;
@ -1738,4 +1738,4 @@ var EditSession = function(text, mode) {
require("ace/edit_session/folding").Folding.call(EditSession.prototype);
exports.EditSession = EditSession;
});
});

View file

@ -43,7 +43,7 @@ if (typeof process !== "undefined") {
define(function(require, exports, module) {
var lang = require("pilot/lang");
var lang = require("ace/lib/lang");
var EditSession = require("ace/edit_session").EditSession;
var Editor = require("ace/editor").Editor;
var UndoManager = require("ace/undomanager").UndoManager;

View file

@ -40,12 +40,12 @@
define(function(require, exports, module) {
require("pilot/fixoldbrowsers");
require("ace/lib/fixoldbrowsers");
var oop = require("pilot/oop");
var event = require("pilot/event");
var lang = require("pilot/lang");
var useragent = require("pilot/useragent");
var oop = require("ace/lib/oop");
var event = require("ace/lib/event");
var lang = require("ace/lib/lang");
var useragent = require("ace/lib/useragent");
var TextInput = require("ace/keyboard/textinput").TextInput;
var MouseHandler = require("ace/mouse/mouse_handler").MouseHandler;
//var TouchHandler = require("ace/touch_handler").TouchHandler;
@ -53,7 +53,7 @@ var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
var EditSession = require("ace/edit_session").EditSession;
var Search = require("ace/search").Search;
var Range = require("ace/range").Range;
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var CommandManager = require("ace/commands/command_manager").CommandManager;
var defaultCommands = require("ace/commands/default_commands").commands;

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var keyUtil = require("pilot/keys");
var keyUtil = require("ace/lib/keys");
function HashHandler(config) {
this.setConfig(config);

View file

@ -38,9 +38,9 @@
define(function(require, exports, module) {
var useragent = require("pilot/useragent");
var keyUtil = require("pilot/keys");
var event = require("pilot/event");
var useragent = require("ace/lib/useragent");
var keyUtil = require("ace/lib/keys");
var event = require("ace/lib/event");
require("ace/commands/default_commands");
var KeyBinding = function(editor) {

View file

@ -39,9 +39,9 @@
define(function(require, exports, module) {
var event = require("pilot/event");
var useragent = require("pilot/useragent");
var dom = require("pilot/dom");
var event = require("ace/lib/event");
var useragent = require("ace/lib/useragent");
var dom = require("ace/lib/dom");
var TextInput = function(parentNode, host) {

View file

@ -39,7 +39,7 @@
define(function(require, exports, module) {
var dom = require("pilot/dom");
var dom = require("ace/lib/dom");
var Cursor = function(parentEl) {
this.element = dom.createElement("div");

View file

@ -39,7 +39,7 @@
define(function(require, exports, module) {
var dom = require("pilot/dom");
var dom = require("ace/lib/dom");
var Gutter = function(parentEl) {
this.element = dom.createElement("div");

View file

@ -40,7 +40,7 @@
define(function(require, exports, module) {
var Range = require("ace/range").Range;
var dom = require("pilot/dom");
var dom = require("ace/lib/dom");
var Marker = function(parentEl) {
this.element = dom.createElement("div");

View file

@ -41,11 +41,11 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var dom = require("pilot/dom");
var lang = require("pilot/lang");
var useragent = require("pilot/useragent");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var dom = require("ace/lib/dom");
var lang = require("ace/lib/lang");
var useragent = require("ace/lib/useragent");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var Text = function(parentEl) {
this.element = dom.createElement("div");

View file

@ -20,7 +20,9 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
* Julian Viereck <julian.viereck@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -38,60 +40,65 @@
define(function(require, exports, module) {
var types = require('pilot/types')
var SelectionType = require('pilot/types/basic').SelectionType
var oop = require("ace/lib/oop");
var event = require("ace/lib/event");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var env
/**
* This class keeps track of the focus state of the given window.
* Focus changes for example when the user switches a browser tab,
* goes to the location bar or switches to another application.
*/
var BrowserFocus = function(win) {
win = win || window;
this.lastFocus = new Date().getTime();
this._isFocused = true;
var _self = this;
var settingTypes = {
selectionStyle: new SelectionType({
data: [ 'line', 'text' ]
})
}
// IE < 9 supports focusin and focusout events
if ("onfocusin" in win.document) {
event.addListener(win.document, "focusin", function(e) {
_self._setFocused(true);
});
var settings = {
printMargin: {
description: 'Position of the print margin column.',
type: 'number',
defaultValue: 80,
onChange: function onChange(event) {
if (env.editor) env.editor.setPrintMarginColumn(event.value)
}
},
showIvisibles: {
description: 'Whether or not to show invisible characters.',
type: 'bool',
defaultValue: false,
onChange: function onChange(event) {
if (env.editor) env.editor.setShowInvisibles(event.value)
}
},
highlightActiveLine: {
description: 'Whether or not highlight active line.',
type: 'bool',
defaultValue: true,
onChange: function onChange(event) {
if (env.editor) env.editor.setHighlightActiveLine(event.value)
}
},
selectionStyle: {
description: 'Type of text selection.',
type: 'selectionStyle',
defaultValue: 'line',
onChange: function onChange(event) {
if (env.editor) env.editor.setSelectionStyle(event.value)
}
event.addListener(win.document, "focusout", function(e) {
_self._setFocused(!!e.toElement);
});
}
}
else {
event.addListener(win, "blur", function(e) {
_self._setFocused(false);
});
exports.startup = function startup(data, reason) {
env = data.env
types.registerTypes(settingTypes)
data.env.settings.addSettings(settings)
}
event.addListener(win, "focus", function(e) {
_self._setFocused(true);
});
}
};
exports.shutdown = function shutdown(data, reason) {
data.env.settings.removeSettings(settings)
}
(function(){
})
oop.implement(this, EventEmitter);
this.isFocused = function() {
return this._isFocused;
};
this._setFocused = function(isFocused) {
if (this._isFocused == isFocused)
return;
if (isFocused)
this.lastFocus = new Date().getTime();
this._isFocused = isFocused;
this._emit("changeFocus");
};
}).call(BrowserFocus.prototype);
exports.BrowserFocus = BrowserFocus;
});

335
lib/ace/lib/dom.js Normal file
View file

@ -0,0 +1,335 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Mihai Sucan <mihai AT sucan AT gmail ODT com>
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var XHTML_NS = "http://www.w3.org/1999/xhtml";
exports.createElement = function(tag, ns) {
return document.createElementNS ?
document.createElementNS(ns || XHTML_NS, tag) :
document.createElement(tag);
};
exports.setText = function(elem, text) {
if (elem.innerText !== undefined) {
elem.innerText = text;
}
if (elem.textContent !== undefined) {
elem.textContent = text;
}
};
if (!document.documentElement.classList) {
exports.hasCssClass = function(el, name) {
var classes = el.className.split(/\s+/g);
return classes.indexOf(name) !== -1;
};
/**
* Add a CSS class to the list of classes on the given node
*/
exports.addCssClass = function(el, name) {
if (!exports.hasCssClass(el, name)) {
el.className += " " + name;
}
};
/**
* Remove a CSS class from the list of classes on the given node
*/
exports.removeCssClass = function(el, name) {
var classes = el.className.split(/\s+/g);
while (true) {
var index = classes.indexOf(name);
if (index == -1) {
break;
}
classes.splice(index, 1);
}
el.className = classes.join(" ");
};
exports.toggleCssClass = function(el, name) {
var classes = el.className.split(/\s+/g), add = true;
while (true) {
var index = classes.indexOf(name);
if (index == -1) {
break;
}
add = false;
classes.splice(index, 1);
}
if(add)
classes.push(name);
el.className = classes.join(" ");
return add;
};
} else {
exports.hasCssClass = function(el, name) {
return el.classList.contains(name);
};
exports.addCssClass = function(el, name) {
el.classList.add(name);
};
exports.removeCssClass = function(el, name) {
el.classList.remove(name);
};
exports.toggleCssClass = function(el, name) {
return el.classList.toggle(name);
};
}
/**
* Add or remove a CSS class from the list of classes on the given node
* depending on the value of <tt>include</tt>
*/
exports.setCssClass = function(node, className, include) {
if (include) {
exports.addCssClass(node, className);
} else {
exports.removeCssClass(node, className);
}
};
exports.hasCssString = function(id, doc) {
var index = 0, sheets;
doc = doc || document;
if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
while (index < sheets.length)
if (sheets[index++].title === id) return true;
} else if ((sheets = doc.getElementsByTagName("style"))) {
while (index < sheets.length)
if (sheets[index++].id === id) return true;
}
return false;
};
exports.importCssString = function importCssString(cssText, id, doc) {
doc = doc || document;
// If style is already imported return immediately.
if (id && exports.hasCssString(id, doc))
return null;
var style;
if (doc.createStyleSheet) {
style = doc.createStyleSheet();
style.cssText = cssText;
if (id)
style.title = id;
} else {
style = doc.createElementNS ?
doc.createElementNS(XHTML_NS, "style") :
doc.createElement("style");
style.appendChild(doc.createTextNode(cssText));
if (id)
style.id = id;
var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
head.appendChild(style);
}
};
exports.importCssStylsheet = function(uri, doc) {
if (doc.createStyleSheet) {
var sheet = doc.createStyleSheet(uri);
} else {
var link = exports.createElement('link');
link.rel = 'stylesheet';
link.href = uri;
var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
head.appendChild(link);
}
};
exports.getInnerWidth = function(element) {
return (parseInt(exports.computedStyle(element, "paddingLeft"))
+ parseInt(exports.computedStyle(element, "paddingRight")) + element.clientWidth);
};
exports.getInnerHeight = function(element) {
return (parseInt(exports.computedStyle(element, "paddingTop"))
+ parseInt(exports.computedStyle(element, "paddingBottom")) + element.clientHeight);
};
if (window.pageYOffset !== undefined) {
exports.getPageScrollTop = function() {
return window.pageYOffset;
};
exports.getPageScrollLeft = function() {
return window.pageXOffset;
};
}
else {
exports.getPageScrollTop = function() {
return document.body.scrollTop;
};
exports.getPageScrollLeft = function() {
return document.body.scrollLeft;
};
}
if (window.getComputedStyle)
exports.computedStyle = function(element, style) {
if (style)
return (window.getComputedStyle(element, "") || {})[style] || "";
return window.getComputedStyle(element, "") || {}
};
else
exports.computedStyle = function(element, style) {
if (style)
return element.currentStyle[style];
return element.currentStyle
};
exports.scrollbarWidth = function(document) {
var inner = exports.createElement("p");
inner.style.width = "100%";
inner.style.minWidth = "0px";
inner.style.height = "200px";
var outer = exports.createElement("div");
var style = outer.style;
style.position = "absolute";
style.left = "-10000px";
style.overflow = "hidden";
style.width = "200px";
style.minWidth = "0px";
style.height = "150px";
outer.appendChild(inner);
var body = document.body || document.documentElement;
body.appendChild(outer);
var noScrollbar = inner.offsetWidth;
style.overflow = "scroll";
var withScrollbar = inner.offsetWidth;
if (noScrollbar == withScrollbar) {
withScrollbar = outer.clientWidth;
}
body.removeChild(outer);
return noScrollbar-withScrollbar;
};
/**
* Optimized set innerHTML. This is faster than plain innerHTML if the element
* already contains a lot of child elements.
*
* See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details
*/
exports.setInnerHtml = function(el, innerHtml) {
var element = el.cloneNode(false);//document.createElement("div");
element.innerHTML = innerHtml;
el.parentNode.replaceChild(element, el);
return element;
};
exports.setInnerText = function(el, innerText) {
var document = el.ownerDocument;
if (document.body && "textContent" in document.body)
el.textContent = innerText;
else
el.innerText = innerText;
};
exports.getInnerText = function(el) {
var document = el.ownerDocument;
if (document.body && "textContent" in document.body)
return el.textContent;
else
return el.innerText || el.textContent || "";
};
exports.getParentWindow = function(document) {
return document.defaultView || document.parentWindow;
};
exports.getSelectionStart = function(textarea) {
// TODO IE
var start;
try {
start = textarea.selectionStart || 0;
} catch (e) {
start = 0;
}
return start;
};
exports.setSelectionStart = function(textarea, start) {
// TODO IE
return textarea.selectionStart = start;
};
exports.getSelectionEnd = function(textarea) {
// TODO IE
var end;
try {
end = textarea.selectionEnd || 0;
} catch (e) {
end = 0;
}
return end;
};
exports.setSelectionEnd = function(textarea, end) {
// TODO IE
return textarea.selectionEnd = end;
};
});

324
lib/ace/lib/event.js Normal file
View file

@ -0,0 +1,324 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var keys = require("ace/lib/keys");
var useragent = require("ace/lib/useragent");
var dom = require("ace/lib/dom");
exports.addListener = function(elem, type, callback) {
if (elem.addEventListener) {
return elem.addEventListener(type, callback, false);
}
if (elem.attachEvent) {
var wrapper = function() {
callback(window.event);
};
callback._wrapper = wrapper;
elem.attachEvent("on" + type, wrapper);
}
};
exports.removeListener = function(elem, type, callback) {
if (elem.removeEventListener) {
return elem.removeEventListener(type, callback, false);
}
if (elem.detachEvent) {
elem.detachEvent("on" + type, callback._wrapper || callback);
}
};
/**
* Prevents propagation and clobbers the default action of the passed event
*/
exports.stopEvent = function(e) {
exports.stopPropagation(e);
exports.preventDefault(e);
return false;
};
exports.stopPropagation = function(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
};
exports.preventDefault = function(e) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
};
exports.getDocumentX = function(e) {
if (e.clientX) {
return e.clientX + dom.getPageScrollLeft();
} else {
return e.pageX;
}
};
exports.getDocumentY = function(e) {
if (e.clientY) {
return e.clientY + dom.getPageScrollTop();
} else {
return e.pageY;
}
};
/**
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
*/
exports.getButton = function(e) {
if (e.type == "dblclick")
return 0;
else if (e.type == "contextmenu")
return 2;
// DOM Event
if (e.preventDefault) {
return e.button;
}
// old IE
else {
return {1:0, 2:2, 4:1}[e.button];
}
};
if (document.documentElement.setCapture) {
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseMove(e) {
eventHandler(e);
return exports.stopPropagation(e);
}
var called = false;
function onReleaseCapture(e) {
eventHandler(e);
if (!called) {
called = true;
releaseCaptureHandler(e);
}
exports.removeListener(el, "mousemove", eventHandler);
exports.removeListener(el, "mouseup", onReleaseCapture);
exports.removeListener(el, "losecapture", onReleaseCapture);
el.releaseCapture();
}
exports.addListener(el, "mousemove", eventHandler);
exports.addListener(el, "mouseup", onReleaseCapture);
exports.addListener(el, "losecapture", onReleaseCapture);
el.setCapture();
};
}
else {
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseMove(e) {
eventHandler(e);
e.stopPropagation();
}
function onMouseUp(e) {
eventHandler && eventHandler(e);
releaseCaptureHandler && releaseCaptureHandler(e);
document.removeEventListener("mousemove", onMouseMove, true);
document.removeEventListener("mouseup", onMouseUp, true);
e.stopPropagation();
}
document.addEventListener("mousemove", onMouseMove, true);
document.addEventListener("mouseup", onMouseUp, true);
};
}
exports.addMouseWheelListener = function(el, callback) {
var max = 0;
var listener = function(e) {
if (e.wheelDelta !== undefined) {
// some versions of Safari (e.g. 5.0.5) report insanely high
// scroll values. These browsers require a higher factor
if (Math.abs(e.wheelDeltaY) > max)
max = Math.abs(e.wheelDeltaY)
if (max > 5000)
factor = 400;
else
factor = 8;
if (e.wheelDeltaX !== undefined) {
e.wheelX = -e.wheelDeltaX / factor;
e.wheelY = -e.wheelDeltaY / factor;
} else {
e.wheelX = 0;
e.wheelY = -e.wheelDelta / factor;
}
}
else {
if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
e.wheelX = (e.detail || 0) * 5;
e.wheelY = 0;
} else {
e.wheelX = 0;
e.wheelY = (e.detail || 0) * 5;
}
}
callback(e);
};
exports.addListener(el, "DOMMouseScroll", listener);
exports.addListener(el, "mousewheel", listener);
};
exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
var clicks = 0;
var startX, startY;
var listener = function(e) {
clicks += 1;
if (clicks == 1) {
startX = e.clientX;
startY = e.clientY;
setTimeout(function() {
clicks = 0;
}, timeout || 600);
}
var isButton = exports.getButton(e) == button;
if (!isButton || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5)
clicks = 0;
if (clicks == count) {
clicks = 0;
callback(e);
}
if (isButton)
return exports.preventDefault(e);
};
exports.addListener(el, "mousedown", listener);
useragent.isOldIE && exports.addListener(el, "dblclick", listener);
};
function normalizeCommandKeys(callback, e, keyCode) {
var hashId = 0;
if (useragent.isOpera && useragent.isMac) {
hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
| (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
} else {
hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
| (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
}
if (keyCode in keys.MODIFIER_KEYS) {
switch (keys.MODIFIER_KEYS[keyCode]) {
case "Alt":
hashId = 2;
break;
case "Shift":
hashId = 4;
break
case "Ctrl":
hashId = 1;
break;
default:
hashId = 8;
break;
}
keyCode = 0;
}
if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
keyCode = 0;
}
// If there is no hashID and the keyCode is not a function key, then
// we don't call the callback as we don't handle a command key here
// (it's a normal key/character input).
if (!(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
return false;
}
return callback(e, hashId, keyCode);
}
exports.addCommandKeyListener = function(el, callback) {
var addListener = exports.addListener;
if (useragent.isOldGecko) {
// Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
// event if the user pressed the key for a longer time. Instead, the
// keydown event was fired once and later on only the keypress event.
// To emulate the 'right' keydown behavior, the keyCode of the initial
// keyDown event is stored and in the following keypress events the
// stores keyCode is used to emulate a keyDown event.
var lastKeyDownKeyCode = null;
addListener(el, "keydown", function(e) {
lastKeyDownKeyCode = e.keyCode;
});
addListener(el, "keypress", function(e) {
return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
});
} else {
var lastDown = null;
addListener(el, "keydown", function(e) {
lastDown = e.keyIdentifier || e.keyCode;
return normalizeCommandKeys(callback, e, e.keyCode);
});
// repeated keys are fired as keypress and not keydown events
if (useragent.isMac && useragent.isOpera) {
addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) {
return normalizeCommandKeys(callback, e, lastDown);
} else {
lastDown = null;
}
});
}
}
};
});

View file

@ -0,0 +1,120 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
* Mike de Boer <mike AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var EventEmitter = {};
EventEmitter._emit =
EventEmitter._dispatchEvent = function(eventName, e) {
this._eventRegistry = this._eventRegistry || {};
this._defaultHandlers = this._defaultHandlers || {};
var listeners = this._eventRegistry[eventName] || [];
var defaultHandler = this._defaultHandlers[eventName];
if (!listeners.length && !defaultHandler)
return;
e = e || {};
e.type = eventName;
if (!e.stopPropagation) {
e.stopPropagation = function() {
this.propagationStopped = true;
};
}
if (!e.preventDefault) {
e.preventDefault = function() {
this.defaultPrevented = true;
};
}
for (var i=0; i<listeners.length; i++) {
listeners[i](e);
if (e.propagationStopped)
break;
}
if (defaultHandler && !e.defaultPrevented)
defaultHandler(e);
};
EventEmitter.setDefaultHandler = function(eventName, callback) {
this._defaultHandlers = this._defaultHandlers || {};
if (this._defaultHandlers[eventName])
throw new Error("The default handler for '" + eventName + "' is already set");
this._defaultHandlers[eventName] = callback;
};
EventEmitter.on =
EventEmitter.addEventListener = function(eventName, callback) {
this._eventRegistry = this._eventRegistry || {};
var listeners = this._eventRegistry[eventName];
if (!listeners)
var listeners = this._eventRegistry[eventName] = [];
if (listeners.indexOf(callback) == -1)
listeners.push(callback);
};
EventEmitter.removeListener =
EventEmitter.removeEventListener = function(eventName, callback) {
this._eventRegistry = this._eventRegistry || {};
var listeners = this._eventRegistry[eventName];
if (!listeners)
return;
var index = listeners.indexOf(callback);
if (index !== -1)
listeners.splice(index, 1);
};
EventEmitter.removeAllListeners = function(eventName) {
if (this._eventRegistry) this._eventRegistry[eventName] = [];
};
exports.EventEmitter = EventEmitter;
});

View file

@ -0,0 +1,18 @@
// vim:set ts=4 sts=4 sw=4 st:
// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
// -- dantman Daniel Friesen Copyright(C) 2010 XXX No License Specified
// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
// -- Irakli Gozalishvili Copyright (C) 2010 MIT License
/*!
Copyright (c) 2009, 280 North Inc. http://280north.com/
MIT License. http://github.com/280north/narwhal/blob/master/README.md
*/
define(function(require, exports, module) {
require("ace/lib/regexp");
require("ace/lib/es5-shim");
});

118
lib/ace/lib/keys.js Normal file
View file

@ -0,0 +1,118 @@
/*! @license
==========================================================================
SproutCore -- JavaScript Application Framework
copyright 2006-2009, Sprout Systems Inc., Apple Inc. and contributors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
SproutCore and the SproutCore logo are trademarks of Sprout Systems, Inc.
For more information about SproutCore, visit http://www.sproutcore.com
==========================================================================
@license */
// Most of the following code is taken from SproutCore with a few changes.
define(function(require, exports, module) {
var oop = require("ace/lib/oop");
/**
* Helper functions and hashes for key handling.
*/
var Keys = (function() {
var ret = {
MODIFIER_KEYS: {
16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
},
KEY_MODS: {
"ctrl": 1, "alt": 2, "option" : 2,
"shift": 4, "meta": 8, "command": 8
},
FUNCTION_KEYS : {
8 : "Backspace",
9 : "Tab",
13 : "Return",
19 : "Pause",
27 : "Esc",
32 : "Space",
33 : "PageUp",
34 : "PageDown",
35 : "End",
36 : "Home",
37 : "Left",
38 : "Up",
39 : "Right",
40 : "Down",
44 : "Print",
45 : "Insert",
46 : "Delete",
112: "F1",
113: "F2",
114: "F3",
115: "F4",
116: "F5",
117: "F6",
118: "F7",
119: "F8",
120: "F9",
121: "F10",
122: "F11",
123: "F12",
144: "Numlock",
145: "Scrolllock"
},
PRINTABLE_KEYS: {
32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
221: ']', 222: '\"'
}
};
// A reverse map of FUNCTION_KEYS
for (var i in ret.FUNCTION_KEYS) {
var name = ret.FUNCTION_KEYS[i].toUpperCase();
ret[name] = parseInt(i, 10);
}
// Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY
// variables as well.
oop.mixin(ret, ret.MODIFIER_KEYS);
oop.mixin(ret, ret.PRINTABLE_KEYS);
oop.mixin(ret, ret.FUNCTION_KEYS);
return ret;
})();
oop.mixin(exports, Keys);
exports.keyCodeToString = function(keyCode) {
return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
}
});

149
lib/ace/lib/lang.js Normal file
View file

@ -0,0 +1,149 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
exports.stringReverse = function(string) {
return string.split("").reverse().join("");
};
exports.stringRepeat = function (string, count) {
return new Array(count + 1).join(string);
};
var trimBeginRegexp = /^\s\s*/;
var trimEndRegexp = /\s\s*$/;
exports.stringTrimLeft = function (string) {
return string.replace(trimBeginRegexp, '')
};
exports.stringTrimRight = function (string) {
return string.replace(trimEndRegexp, '');
};
exports.copyObject = function(obj) {
var copy = {};
for (var key in obj) {
copy[key] = obj[key];
}
return copy;
};
exports.copyArray = function(array){
var copy = [];
for (i=0, l=array.length; i<l; i++) {
if (array[i] && typeof array[i] == "object")
copy[i] = this.copyObject( array[i] );
else
copy[i] = array[i]
}
return copy;
};
exports.deepCopy = function (obj) {
if (typeof obj != "object") {
return obj;
}
var copy = obj.constructor();
for (var key in obj) {
if (typeof obj[key] == "object") {
copy[key] = this.deepCopy(obj[key]);
} else {
copy[key] = obj[key];
}
}
return copy;
}
exports.arrayToMap = function(arr) {
var map = {};
for (var i=0; i<arr.length; i++) {
map[arr[i]] = 1;
}
return map;
};
/**
* splice out of 'array' anything that === 'value'
*/
exports.arrayRemove = function(array, value) {
for (var i = 0; i <= array.length; i++) {
if (value === array[i]) {
array.splice(i, 1);
}
}
};
exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};
exports.deferredCall = function(fcn) {
var timer = null;
var callback = function() {
timer = null;
fcn();
};
var deferred = function(timeout) {
deferred.cancel();
timer = setTimeout(callback, timeout || 0);
return deferred;
}
deferred.schedule = deferred;
deferred.call = function() {
this.cancel();
fcn();
return deferred;
};
deferred.cancel = function() {
clearTimeout(timer);
timer = null;
return deferred;
};
return deferred;
};
});

60
lib/ace/lib/oop.js Normal file
View file

@ -0,0 +1,60 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
exports.inherits = (function() {
var tempCtor = function() {};
return function(ctor, superCtor) {
tempCtor.prototype = superCtor.prototype;
ctor.super_ = superCtor.prototype;
ctor.prototype = new tempCtor();
ctor.prototype.constructor = ctor;
}
}());
exports.mixin = function(obj, mixin) {
for (var key in mixin) {
obj[key] = mixin[key];
}
};
exports.implement = function(proto, mixin) {
exports.mixin(proto, mixin);
};
});

105
lib/ace/lib/useragent.js Normal file
View file

@ -0,0 +1,105 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
var ua = navigator.userAgent;
var av = navigator.appVersion;
/** Is the user using a browser that identifies itself as Windows */
exports.isWin = (os == "win");
/** Is the user using a browser that identifies itself as Mac OS */
exports.isMac = (os == "mac");
/** Is the user using a browser that identifies itself as Linux */
exports.isLinux = (os == "linux");
exports.isIE =
navigator.appName == "Microsoft Internet Explorer"
&& parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]);
exports.isOldIE = exports.isIE && exports.isIE < 9;
/** Is this Firefox or related? */
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
/** oldGecko == rev < 2.0 **/
exports.isOldGecko = exports.isGecko && /rv\:1/.test(navigator.userAgent);
/** Is this Opera */
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
/** Is the user using a browser that identifies itself as WebKit */
exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
exports.isIPad = ua.indexOf("iPad") >= 0;
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
/**
* I hate doing this, but we need some way to determine if the user is on a Mac
* The reason is that users have different expectations of their key combinations.
*
* Take copy as an example, Mac people expect to use CMD or APPLE + C
* Windows folks expect to use CTRL + C
*/
exports.OS = {
LINUX: 'LINUX',
MAC: 'MAC',
WINDOWS: 'WINDOWS'
};
/**
* Return an exports.OS constant
*/
exports.getOS = function() {
if (exports.isMac) {
return exports.OS['MAC'];
} else if (exports.isLinux) {
return exports.OS['LINUX'];
} else {
return exports.OS['WINDOWS'];
}
};
});

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var Behaviour = require('ace/mode/behaviour').Behaviour;
var CstyleBehaviour = function () {

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var Behaviour = require('ace/mode/behaviour').Behaviour;
var CstyleBehaviour = require('ace/mode/behaviour/cstyle').CstyleBehaviour;

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var c_cppHighlightRules = require("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules;

View file

@ -40,8 +40,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -39,7 +39,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var ClojureHighlightRules = require("ace/mode/clojure_highlight_rules").ClojureHighlightRules;

View file

@ -39,8 +39,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -43,7 +43,7 @@ var Outdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
var Range = require("ace/range").Range;
var TextMode = require("ace/mode/text").Mode;
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
function Mode() {
this.$tokenizer = new Tokenizer(new Rules().getRules());
@ -97,7 +97,7 @@ oop.inherits(Mode, TextMode);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace", "pilot"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker");
var worker = new WorkerClient(["ace"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("error", function(e) {

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var lang = require("pilot/lang");
var oop = require("pilot/oop");
var lang = require("ace/lib/lang");
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
oop.inherits(CoffeeHighlightRules, TextHighlightRules);

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var Mirror = require("ace/worker/mirror").Mirror;
var coffee = require("ace/mode/coffee/coffee-script");

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
var CssMode = require("ace/mode/css").Mode;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var CSharpHighlightRules = require("ace/mode/csharp_highlight_rules").CSharpHighlightRules;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
@ -78,7 +78,7 @@ oop.inherits(Mode, TextMode);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace", "pilot"], "worker-css.js", "ace/mode/css_worker", "Worker");
var worker = new WorkerClient(["ace"], "worker-css.js", "ace/mode/css_worker", "Worker");
worker.attachToDocument(session.getDocument());
worker.on("csslint", function(e) {

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() {

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var Mirror = require("ace/worker/mirror").Mirror;
var CSSLint = require("ace/mode/css/csslint").CSSLint;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var DocCommentHighlightRules = function() {

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var JavaScriptMode = require("ace/mode/javascript").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var GroovyHighlightRules = require("ace/mode/groovy_highlight_rules").GroovyHighlightRules;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
var CssMode = require("ace/mode/css").Mode;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
@ -195,4 +195,4 @@ var HtmlHighlightRules = function() {
oop.inherits(HtmlHighlightRules, TextHighlightRules);
exports.HtmlHighlightRules = HtmlHighlightRules;
});
});

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var JavaScriptMode = require("ace/mode/javascript").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var JavaHighlightRules = require("ace/mode/java_highlight_rules").JavaHighlightRules;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
@ -125,8 +125,8 @@ oop.inherits(Mode, TextMode);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace", "pilot"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
worker.attachToDocument(session.getDocument());
var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
worker.attachToDocument(session.getDocument());
worker.on("jslint", function(results) {
var errors = [];

View file

@ -38,8 +38,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var unicode = require("ace/unicode");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var Mirror = require("ace/worker/mirror").Mirror;
//var lint = require("ace/worker/jslint").JSLINT;
var lint = require("ace/worker/jshint").JSHINT;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var HighlightRules = require("ace/mode/json_highlight_rules").JsonHighlightRules;

View file

@ -38,8 +38,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var JsonHighlightRules = function() {

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var LatexHighlightRules = require("ace/mode/latex_highlight_rules").LatexHighlightRules;

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var LatexHighlightRules = function()

View file

@ -38,7 +38,7 @@
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var LuaHighlightRules = require("ace/mode/lua_highlight_rules").LuaHighlightRules;

View file

@ -39,8 +39,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var LuaHighlightRules = function() {

View file

@ -40,7 +40,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
var XmlMode = require("ace/mode/xml").Mode;

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
var XmlHighlightRules = require("ace/mode/xml_highlight_rules").XmlHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var OcamlHighlightRules = require("ace/mode/ocaml_highlight_rules").OcamlHighlightRules;

View file

@ -39,8 +39,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var OcamlHighlightRules = function() {

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var PerlHighlightRules = require("ace/mode/perl_highlight_rules").PerlHighlightRules;

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var PerlHighlightRules = function() {

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var PhpHighlightRules = require("ace/mode/php_highlight_rules").PhpHighlightRules;

View file

@ -38,8 +38,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var PowershellHighlightRules = require("ace/mode/powershell_highlight_rules").PowershellHighlightRules;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var PythonHighlightRules = require("ace/mode/python_highlight_rules").PythonHighlightRules;

View file

@ -41,8 +41,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var PythonHighlightRules = function() {

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var RubyHighlightRules = require("ace/mode/ruby_highlight_rules").RubyHighlightRules;

View file

@ -38,8 +38,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var RubyHighlightRules = function() {

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var scadHighlightRules = require("ace/mode/scad_highlight_rules").scadHighlightRules;

View file

@ -1,6 +1,6 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var JavaScriptMode = require("ace/mode/javascript").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var ScalaHighlightRules = require("ace/mode/scala_highlight_rules").ScalaHighlightRules;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var ScssHighlightRules = require("ace/mode/scss_highlight_rules").ScssHighlightRules;

View file

@ -37,8 +37,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var ScssHighlightRules = function() {

View file

@ -20,7 +20,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var SqlHighlightRules = require("ace/mode/sql_highlight_rules").SqlHighlightRules;

View file

@ -22,8 +22,8 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var SqlHighlightRules = function() {

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var XmlMode = require("ace/mode/text").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
var XmlHighlightRules = require("ace/mode/xml_highlight_rules").XmlHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var lang = require("pilot/lang");
var lang = require("ace/lib/lang");
var TextHighlightRules = function() {

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var TextileHighlightRules = require("ace/mode/textile_highlight_rules").TextileHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var TextileHighlightRules = function() {

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextMode = require("ace/mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer;
var XmlHighlightRules = require("ace/mode/xml_highlight_rules").XmlHighlightRules;

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var oop = require("ace/lib/oop");
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
var XmlHighlightRules = function() {

70
lib/ace/model/editor.js Normal file
View file

@ -0,0 +1,70 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var Editor = exports.Editor = function() {
this._buffers = [];
this._windows = [];
};
(function() {
oop.implement(this, EventEmitter);
this.addBuffer = function(buffer) {
this._buffers.push(buffer);
return this._buffers.length-1;
};
this.addWindow = function(win) {
this._windows.push(win);
return this._windows.length-1;
};
this.openInWindow = function(bufferId, winId) {
this._windows[winId || 0].setBuffer(this._buffers[bufferId]);
};
}).call(Editor.prototype);
});

View file

@ -39,10 +39,10 @@
define(function(require, exports, module) {
var event = require("pilot/event");
var dom = require("pilot/dom");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
var event = require("ace/lib/event");
var dom = require("ace/lib/dom");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var BrowserFocus = require("ace/lib/browser_focus").BrowserFocus;
var STATE_UNKNOWN = 0;
var STATE_SELECT = 1;

View file

@ -38,8 +38,8 @@
define(function(require, exports, module) {
var event = require("pilot/event");
var dom = require("pilot/dom");
var event = require("ace/lib/event");
var dom = require("ace/lib/dom");
/**
* Custom Ace mouse event

View file

@ -39,7 +39,7 @@
define(function(require, exports, module) {
var event = require("pilot/event");
var event = require("ace/lib/event");
var DefaultHandlers = require("ace/mouse/default_handlers").DefaultHandlers;
var MouseEvent = require("ace/mouse/mouse_event").MouseEvent;

View file

@ -38,7 +38,7 @@
define(function(require, exports, module) {
var event = require("pilot/event");
var event = require("ace/lib/event");
var RenderLoop = function(onRender, window) {
this.onRender = onRender;

View file

@ -38,10 +38,10 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var dom = require("pilot/dom");
var event = require("pilot/event");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var dom = require("ace/lib/dom");
var event = require("ace/lib/event");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var ScrollBar = function(parent) {
this.element = dom.createElement("div");

View file

@ -39,8 +39,8 @@
define(function(require, exports, module) {
var lang = require("pilot/lang");
var oop = require("pilot/oop");
var lang = require("ace/lib/lang");
var oop = require("ace/lib/oop");
var Range = require("ace/range").Range;
var Search = function() {

View file

@ -38,9 +38,9 @@
define(function(require, exports, module) {
var oop = require("pilot/oop");
var lang = require("pilot/lang");
var EventEmitter = require("pilot/event_emitter").EventEmitter;
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var EventEmitter = require("ace/lib/event_emitter").EventEmitter;
var Range = require("ace/range").Range;
/**

Some files were not shown because too many files have changed in this diff Show more