Merge branch 'master' into gh-pages
This commit is contained in:
commit
ae848cad71
200 changed files with 37322 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.DS_Store
|
||||
.settings.xml
|
||||
.settings.xml.old
|
||||
12
.gitmodules
vendored
Normal file
12
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[submodule "tool/support/node-o3-xml"]
|
||||
path = tool/support/node-o3-xml
|
||||
url = git://github.com/ajaxorg/node-o3-xml.git
|
||||
[submodule "tool/support/async"]
|
||||
path = tool/support/async
|
||||
url = git://github.com/fjakobs/async.js.git
|
||||
[submodule "support/requirejs"]
|
||||
path = support/requirejs
|
||||
url = git://github.com/jrburke/requirejs.git
|
||||
[submodule "support/node-o3-xml"]
|
||||
path = support/node-o3-xml
|
||||
url = git://github.com/ajaxorg/node-o3-xml.git
|
||||
17
.project
Normal file
17
.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>editor</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
165
LICENSE
Normal file
165
LICENSE
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
3
Makefile
Normal file
3
Makefile
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
package:
|
||||
rm -rf build
|
||||
support/requirejs/build/build.sh build.js
|
||||
79
build.js
Normal file
79
build.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
baseUrl: "./lib",
|
||||
dir: "build",
|
||||
|
||||
//- "closure": uses Google's Closure Compiler in simple optimization
|
||||
//mode to minify the code.
|
||||
//- "closure.keepLines": Same as closure option, but keeps line returns
|
||||
//in the minified files.
|
||||
//- "none": no minification will be done.
|
||||
optimize: "closure.keepLines",
|
||||
inlineText: true,
|
||||
useStrict: false,
|
||||
|
||||
pragmas: {
|
||||
jquery: false,
|
||||
requireExcludeModify: true,
|
||||
requireExcludePlugin: false,
|
||||
requireExcludePageLoad: false
|
||||
},
|
||||
|
||||
skipPragmas: false,
|
||||
execModules: false,
|
||||
skipModuleInsertion: false,
|
||||
|
||||
modules: [
|
||||
{
|
||||
name: "ace/Editor",
|
||||
include: [
|
||||
"ace/Document",
|
||||
"ace/UndoManager",
|
||||
"ace/VirtualRenderer",
|
||||
|
||||
"ace/mode/JavaScript",
|
||||
"ace/theme/TextMate"
|
||||
],
|
||||
includeRequire: false
|
||||
},
|
||||
|
||||
{
|
||||
name: "ace/theme/Eclipse",
|
||||
exclude: [
|
||||
"ace/lib/lang",
|
||||
"ace/lib/dom",
|
||||
"ace/lib/oop"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "ace/mode/Xml",
|
||||
exclude: [
|
||||
"ace/lib/oop",
|
||||
"ace/Tokenizer",
|
||||
"ace/mode/Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "ace/mode/Css",
|
||||
exclude: [
|
||||
"ace/lib/oop",
|
||||
"ace/lib/lang",
|
||||
"ace/Tokenizer",
|
||||
"ace/Range",
|
||||
"ace/mode/Text"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "ace/mode/Html",
|
||||
exclude: [
|
||||
"ace/lib/oop",
|
||||
"ace/lib/lang",
|
||||
"ace/Tokenizer",
|
||||
"ace/Range",
|
||||
"ace/mode/Text",
|
||||
"ace/mode/JavaScript",
|
||||
"ace/mode/Css",
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
81
build/ace/BackgroundTokenizer.js
Normal file
81
build/ace/BackgroundTokenizer.js
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/BackgroundTokenizer", ["ace/lib/oop", "ace/MEventEmitter"], function(i, j) {
|
||||
var h = function(a, c) {
|
||||
this.running = false;
|
||||
this.textLines = [];
|
||||
this.lines = [];
|
||||
this.currentLine = 0;
|
||||
this.tokenizer = a;
|
||||
var b = this;
|
||||
this.$worker = function() {
|
||||
if(b.running) {
|
||||
for(var e = new Date, f = b.currentLine, d = b.textLines, g = 0, k = c.getLastVisibleRow();b.currentLine < d.length;) {
|
||||
b.lines[b.currentLine] = b.$tokenizeRows(b.currentLine, b.currentLine)[0];
|
||||
b.currentLine++;
|
||||
g += 1;
|
||||
if(g % 5 == 0 && new Date - e > 20) {
|
||||
b.fireUpdateEvent(f, b.currentLine - 1);
|
||||
b.running = setTimeout(b.$worker, b.currentLine < k ? 20 : 100);
|
||||
return
|
||||
}
|
||||
}b.running = false;
|
||||
b.fireUpdateEvent(f, d.length - 1)
|
||||
}
|
||||
}
|
||||
};
|
||||
(function() {
|
||||
i.implement(this, j);
|
||||
this.setTokenizer = function(a) {
|
||||
this.tokenizer = a;
|
||||
this.lines = [];
|
||||
this.start(0)
|
||||
};
|
||||
this.setLines = function(a) {
|
||||
this.textLines = a;
|
||||
this.lines = [];
|
||||
this.stop()
|
||||
};
|
||||
this.fireUpdateEvent = function(a, c) {
|
||||
this.$dispatchEvent("update", {data:{first:a, last:c}})
|
||||
};
|
||||
this.start = function(a) {
|
||||
this.currentLine = Math.min(a || 0, this.currentLine, this.textLines.length);
|
||||
this.lines.splice(this.currentLine, this.lines.length);
|
||||
this.stop();
|
||||
this.running = setTimeout(this.$worker, 700)
|
||||
};
|
||||
this.stop = function() {
|
||||
this.running && clearTimeout(this.running);
|
||||
this.running = false
|
||||
};
|
||||
this.getTokens = function(a, c, b) {
|
||||
b(this.$tokenizeRows(a, c))
|
||||
};
|
||||
this.getState = function(a, c) {
|
||||
c(this.$tokenizeRows(a, a)[0].state)
|
||||
};
|
||||
this.$tokenizeRows = function(a, c) {
|
||||
var b = [], e = "start", f = false;
|
||||
if(a > 0 && this.lines[a - 1]) {
|
||||
e = this.lines[a - 1].state;
|
||||
f = true
|
||||
}for(a = a;a <= c;a++) {
|
||||
if(this.lines[a]) {
|
||||
d = this.lines[a];
|
||||
e = d.state;
|
||||
b.push(d)
|
||||
}else {
|
||||
var d = this.tokenizer.getLineTokens(this.textLines[a] || "", e);
|
||||
e = d.state;
|
||||
b.push(d);
|
||||
if(f) {
|
||||
this.lines[a] = d
|
||||
}
|
||||
}
|
||||
}return b
|
||||
}
|
||||
}).call(h.prototype);
|
||||
return h
|
||||
});
|
||||
461
build/ace/Document.js
Normal file
461
build/ace/Document.js
Normal file
|
|
@ -0,0 +1,461 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/Document", ["ace/lib/oop", "ace/lib/lang", "ace/MEventEmitter", "ace/Selection", "ace/mode/Text", "ace/Range"], function(l, i, m, n, o, g) {
|
||||
var j = function(a, b) {
|
||||
this.modified = true;
|
||||
this.lines = [];
|
||||
this.selection = new n(this);
|
||||
this.$breakpoints = [];
|
||||
this.listeners = [];
|
||||
b && this.setMode(b);
|
||||
i.isArray(a) ? this.$insertLines(0, a) : this.$insert({row:0, column:0}, a)
|
||||
};
|
||||
(function() {
|
||||
l.implement(this, m);
|
||||
this.$undoManager = null;
|
||||
this.$split = function(a) {
|
||||
return a.split(/\r\n|\r|\n/)
|
||||
};
|
||||
this.setValue = function(a) {
|
||||
var b = [0, this.lines.length];
|
||||
b.push.apply(b, this.$split(a));
|
||||
this.lines.splice.apply(this.lines, b);
|
||||
this.modified = true;
|
||||
this.fireChangeEvent(0)
|
||||
};
|
||||
this.toString = function() {
|
||||
return this.lines.join(this.$getNewLineCharacter())
|
||||
};
|
||||
this.getSelection = function() {
|
||||
return this.selection
|
||||
};
|
||||
this.fireChangeEvent = function(a, b) {
|
||||
this.$dispatchEvent("change", {data:{firstRow:a, lastRow:b}})
|
||||
};
|
||||
this.setUndoManager = function(a) {
|
||||
this.$undoManager = a;
|
||||
this.$deltas = [];
|
||||
this.$informUndoManager && this.$informUndoManager.cancel();
|
||||
if(a) {
|
||||
var b = this;
|
||||
this.$informUndoManager = i.deferredCall(function() {
|
||||
b.$deltas.length > 0 && a.execute({action:"aceupdate", args:[b.$deltas, b]});
|
||||
b.$deltas = []
|
||||
})
|
||||
}
|
||||
};
|
||||
this.$defaultUndoManager = {undo:function() {
|
||||
}, redo:function() {
|
||||
}};
|
||||
this.getUndoManager = function() {
|
||||
return this.$undoManager || this.$defaultUndoManager
|
||||
};
|
||||
this.getTabString = function() {
|
||||
return this.getUseSoftTabs() ? i.stringRepeat(" ", this.getTabSize()) : "\t"
|
||||
};
|
||||
this.$useSoftTabs = true;
|
||||
this.setUseSoftTabs = function(a) {
|
||||
if(this.$useSoftTabs !== a) {
|
||||
this.$useSoftTabs = a
|
||||
}
|
||||
};
|
||||
this.getUseSoftTabs = function() {
|
||||
return this.$useSoftTabs
|
||||
};
|
||||
this.$tabSize = 4;
|
||||
this.setTabSize = function(a) {
|
||||
if(!(isNaN(a) || this.$tabSize === a)) {
|
||||
this.modified = true;
|
||||
this.$tabSize = a;
|
||||
this.$dispatchEvent("changeTabSize")
|
||||
}
|
||||
};
|
||||
this.getTabSize = function() {
|
||||
return this.$tabSize
|
||||
};
|
||||
this.getBreakpoints = function() {
|
||||
return this.$breakpoints
|
||||
};
|
||||
this.setBreakpoints = function(a) {
|
||||
this.$breakpoints = [];
|
||||
for(var b = 0;b < a.length;b++) {
|
||||
this.$breakpoints[a[b]] = true
|
||||
}this.$dispatchEvent("changeBreakpoint", {})
|
||||
};
|
||||
this.clearBreakpoints = function() {
|
||||
this.$breakpoints = [];
|
||||
this.$dispatchEvent("changeBreakpoint", {})
|
||||
};
|
||||
this.setBreakpoint = function(a) {
|
||||
this.$breakpoints[a] = true;
|
||||
this.$dispatchEvent("changeBreakpoint", {})
|
||||
};
|
||||
this.clearBreakpoint = function(a) {
|
||||
delete this.$breakpoints[a];
|
||||
this.$dispatchEvent("changeBreakpoint", {})
|
||||
};
|
||||
this.$detectNewLine = function(a) {
|
||||
this.$autoNewLine = (a = a.match(/^.*?(\r?\n)/m)) ? a[1] : "\n"
|
||||
};
|
||||
this.tokenRe = /^[\w\d]+/g;
|
||||
this.nonTokenRe = /^[^\w\d]+/g;
|
||||
this.getWordRange = function(a, b) {
|
||||
var c = this.getLine(a), d = false;
|
||||
if(b > 0) {
|
||||
d = !!c.charAt(b - 1).match(this.tokenRe)
|
||||
}d || (d = !!c.charAt(b).match(this.tokenRe));
|
||||
d = d ? this.tokenRe : this.nonTokenRe;
|
||||
var e = b;
|
||||
if(e > 0) {
|
||||
do {
|
||||
e--
|
||||
}while(e >= 0 && c.charAt(e).match(d));
|
||||
e++
|
||||
}for(b = b;b < c.length && c.charAt(b).match(d);) {
|
||||
b++
|
||||
}return new g(a, e, a, b)
|
||||
};
|
||||
this.$getNewLineCharacter = function() {
|
||||
switch(this.$newLineMode) {
|
||||
case "windows":
|
||||
return"\r\n";
|
||||
case "unix":
|
||||
return"\n";
|
||||
case "auto":
|
||||
return this.$autoNewLine
|
||||
}
|
||||
};
|
||||
this.$autoNewLine = "\n";
|
||||
this.$newLineMode = "auto";
|
||||
this.setNewLineMode = function(a) {
|
||||
if(this.$newLineMode !== a) {
|
||||
this.$newLineMode = a
|
||||
}
|
||||
};
|
||||
this.getNewLineMode = function() {
|
||||
return this.$newLineMode
|
||||
};
|
||||
this.$mode = null;
|
||||
this.setMode = function(a) {
|
||||
if(this.$mode !== a) {
|
||||
this.$mode = a;
|
||||
this.$dispatchEvent("changeMode")
|
||||
}
|
||||
};
|
||||
this.getMode = function() {
|
||||
if(!this.$mode) {
|
||||
this.$mode = new o
|
||||
}return this.$mode
|
||||
};
|
||||
this.$scrollTop = 0;
|
||||
this.setScrollTopRow = function(a) {
|
||||
if(this.$scrollTop !== a) {
|
||||
this.$scrollTop = a;
|
||||
this.$dispatchEvent("changeScrollTop")
|
||||
}
|
||||
};
|
||||
this.getScrollTopRow = function() {
|
||||
return this.$scrollTop
|
||||
};
|
||||
this.getWidth = function() {
|
||||
this.$computeWidth();
|
||||
return this.width
|
||||
};
|
||||
this.getScreenWidth = function() {
|
||||
this.$computeWidth();
|
||||
return this.screenWith
|
||||
};
|
||||
this.$computeWidth = function() {
|
||||
if(this.modified) {
|
||||
this.modified = false;
|
||||
for(var a = this.lines, b = 0, c = 0, d = this.getTabSize(), e = 0;e < a.length;e++) {
|
||||
var f = a[e].length;
|
||||
b = Math.max(b, f);
|
||||
a[e].replace("\t", function(h) {
|
||||
f += d - 1;
|
||||
return h
|
||||
});
|
||||
c = Math.max(c, f)
|
||||
}this.width = b;
|
||||
this.screenWith = c
|
||||
}
|
||||
};
|
||||
this.getLine = function(a) {
|
||||
return this.lines[a] || ""
|
||||
};
|
||||
this.getDisplayLine = function(a) {
|
||||
var b = (new Array(this.getTabSize() + 1)).join(" ");
|
||||
return this.lines[a].replace(/\t/g, b)
|
||||
};
|
||||
this.getLines = function(a, b) {
|
||||
return this.lines.slice(a, b + 1)
|
||||
};
|
||||
this.getLength = function() {
|
||||
return this.lines.length
|
||||
};
|
||||
this.getTextRange = function(a) {
|
||||
if(a.start.row == a.end.row) {
|
||||
return this.lines[a.start.row].substring(a.start.column, a.end.column)
|
||||
}else {
|
||||
var b = [];
|
||||
b.push(this.lines[a.start.row].substring(a.start.column));
|
||||
b.push.apply(b, this.getLines(a.start.row + 1, a.end.row - 1));
|
||||
b.push(this.lines[a.end.row].substring(0, a.end.column));
|
||||
return b.join(this.$getNewLineCharacter())
|
||||
}
|
||||
};
|
||||
this.findMatchingBracket = function(a) {
|
||||
if(a.column == 0) {
|
||||
return null
|
||||
}var b = this.getLine(a.row).charAt(a.column - 1);
|
||||
if(b == "") {
|
||||
return null
|
||||
}b = b.match(/([\(\[\{])|([\)\]\}])/);
|
||||
if(!b) {
|
||||
return null
|
||||
}return b[1] ? this.$findClosingBracket(b[1], a) : this.$findOpeningBracket(b[2], a)
|
||||
};
|
||||
this.$brackets = {")":"(", "(":")", "]":"[", "[":"]", "{":"}", "}":"{"};
|
||||
this.$findOpeningBracket = function(a, b) {
|
||||
var c = this.$brackets[a], d = b.column - 2;
|
||||
b = b.row;
|
||||
for(var e = 1, f = this.getLine(b);;) {
|
||||
for(;d >= 0;) {
|
||||
var h = f.charAt(d);
|
||||
if(h == c) {
|
||||
e -= 1;
|
||||
if(e == 0) {
|
||||
return{row:b, column:d}
|
||||
}
|
||||
}else {
|
||||
if(h == a) {
|
||||
e += 1
|
||||
}
|
||||
}d -= 1
|
||||
}b -= 1;
|
||||
if(b < 0) {
|
||||
break
|
||||
}f = this.getLine(b);
|
||||
d = f.length - 1
|
||||
}return null
|
||||
};
|
||||
this.$findClosingBracket = function(a, b) {
|
||||
var c = this.$brackets[a], d = b.column;
|
||||
b = b.row;
|
||||
for(var e = 1, f = this.getLine(b), h = this.getLength();;) {
|
||||
for(;d < f.length;) {
|
||||
var k = f.charAt(d);
|
||||
if(k == c) {
|
||||
e -= 1;
|
||||
if(e == 0) {
|
||||
return{row:b, column:d}
|
||||
}
|
||||
}else {
|
||||
if(k == a) {
|
||||
e += 1
|
||||
}
|
||||
}d += 1
|
||||
}b += 1;
|
||||
if(b >= h) {
|
||||
break
|
||||
}f = this.getLine(b);
|
||||
d = 0
|
||||
}return null
|
||||
};
|
||||
this.insert = function(a, b, c) {
|
||||
b = this.$insert(a, b, c);
|
||||
this.fireChangeEvent(a.row, a.row == b.row ? a.row : undefined);
|
||||
return b
|
||||
};
|
||||
this.$insertLines = function(a, b, c) {
|
||||
if(b.length != 0) {
|
||||
var d = [a, 0];
|
||||
d.push.apply(d, b);
|
||||
this.lines.splice.apply(this.lines, d);
|
||||
if(!c && this.$undoManager) {
|
||||
c = this.$getNewLineCharacter();
|
||||
this.$deltas.push({action:"insertText", range:new g(a, 0, a + b.length, 0), text:b.join(c) + c});
|
||||
this.$informUndoManager.schedule()
|
||||
}
|
||||
}
|
||||
};
|
||||
this.$insert = function(a, b, c) {
|
||||
if(b.length == 0) {
|
||||
return a
|
||||
}this.modified = true;
|
||||
this.lines.length <= 1 && this.$detectNewLine(b);
|
||||
var d = this.$split(b);
|
||||
if(this.$isNewLine(b)) {
|
||||
var e = this.lines[a.row] || "";
|
||||
this.lines[a.row] = e.substring(0, a.column);
|
||||
this.lines.splice(a.row + 1, 0, e.substring(a.column));
|
||||
d = {row:a.row + 1, column:0}
|
||||
}else {
|
||||
if(d.length == 1) {
|
||||
e = this.lines[a.row] || "";
|
||||
this.lines[a.row] = e.substring(0, a.column) + b + e.substring(a.column);
|
||||
d = {row:a.row, column:a.column + b.length}
|
||||
}else {
|
||||
e = this.lines[a.row] || "";
|
||||
var f = e.substring(0, a.column) + d[0];
|
||||
e = d[d.length - 1] + e.substring(a.column);
|
||||
this.lines[a.row] = f;
|
||||
this.$insertLines(a.row + 1, [e], true);
|
||||
d.length > 2 && this.$insertLines(a.row + 1, d.slice(1, -1), true);
|
||||
d = {row:a.row + d.length - 1, column:d[d.length - 1].length}
|
||||
}
|
||||
}if(!c && this.$undoManager) {
|
||||
this.$deltas.push({action:"insertText", range:g.fromPoints(a, d), text:b});
|
||||
this.$informUndoManager.schedule()
|
||||
}return d
|
||||
};
|
||||
this.$isNewLine = function(a) {
|
||||
return a == "\r\n" || a == "\r" || a == "\n"
|
||||
};
|
||||
this.remove = function(a, b) {
|
||||
if(a.isEmpty()) {
|
||||
return a.start
|
||||
}this.$remove(a, b);
|
||||
this.fireChangeEvent(a.start.row, a.isMultiLine() ? undefined : a.start.row);
|
||||
return a.start
|
||||
};
|
||||
this.$remove = function(a, b) {
|
||||
if(!a.isEmpty()) {
|
||||
if(!b && this.$undoManager) {
|
||||
this.$getNewLineCharacter();
|
||||
this.$deltas.push({action:"removeText", range:a.clone(), text:this.getTextRange(a)});
|
||||
this.$informUndoManager.schedule()
|
||||
}this.modified = true;
|
||||
b = a.start.row;
|
||||
var c = a.end.row, d = this.getLine(b).substring(0, a.start.column) + this.getLine(c).substring(a.end.column);
|
||||
this.lines.splice(b, c - b + 1, d);
|
||||
return a.start
|
||||
}
|
||||
};
|
||||
this.undoChanges = function(a) {
|
||||
this.selection.clearSelection();
|
||||
for(var b = a.length - 1;b >= 0;b--) {
|
||||
var c = a[b];
|
||||
if(c.action == "insertText") {
|
||||
this.remove(c.range, true);
|
||||
this.selection.moveCursorToPosition(c.range.start)
|
||||
}else {
|
||||
this.insert(c.range.start, c.text, true);
|
||||
this.selection.clearSelection()
|
||||
}
|
||||
}
|
||||
};
|
||||
this.redoChanges = function(a) {
|
||||
this.selection.clearSelection();
|
||||
for(var b = 0;b < a.length;b++) {
|
||||
var c = a[b];
|
||||
if(c.action == "insertText") {
|
||||
this.insert(c.range.start, c.text, true);
|
||||
this.selection.setSelectionRange(c.range)
|
||||
}else {
|
||||
this.remove(c.range, true);
|
||||
this.selection.moveCursorToPosition(c.range.start)
|
||||
}
|
||||
}
|
||||
};
|
||||
this.replace = function(a, b) {
|
||||
this.$remove(a);
|
||||
b = b ? this.$insert(a.start, b) : a.start;
|
||||
var c = a.end.column == 0 ? a.end.column - 1 : a.end.column;
|
||||
this.fireChangeEvent(a.start.row, c == b.row ? c : undefined);
|
||||
return b
|
||||
};
|
||||
this.indentRows = function(a, b) {
|
||||
b.replace("\t", this.getTabString());
|
||||
for(var c = a.start.row;c <= a.end.row;c++) {
|
||||
this.$insert({row:c, column:0}, b)
|
||||
}this.fireChangeEvent(a.start.row, a.end.row);
|
||||
return b.length
|
||||
};
|
||||
this.outdentRows = function(a) {
|
||||
for(var b = new g(0, 0, 0, 0), c = this.getTabSize(), d = a.start.row;d <= a.end.row;++d) {
|
||||
var e = this.getLine(d);
|
||||
b.start.row = d;
|
||||
b.end.row = d;
|
||||
for(var f = 0;f < c;++f) {
|
||||
if(e.charAt(f) != " ") {
|
||||
break
|
||||
}
|
||||
}if(f < c && e.charAt(f) == "\t") {
|
||||
b.start.column = f;
|
||||
b.end.column = f + 1
|
||||
}else {
|
||||
b.start.column = 0;
|
||||
b.end.column = f
|
||||
}if(d == a.start.row) {
|
||||
a.start.column -= b.end.column - b.start.column
|
||||
}if(d == a.end.row) {
|
||||
a.end.column -= b.end.column - b.start.column
|
||||
}this.$remove(b)
|
||||
}this.fireChangeEvent(a.start.row, a.end.row);
|
||||
return a
|
||||
};
|
||||
this.moveLinesUp = function(a, b) {
|
||||
if(a <= 0) {
|
||||
return 0
|
||||
}var c = this.lines.slice(a, b + 1);
|
||||
this.$remove(new g(a, 0, b + 1, 0));
|
||||
this.$insertLines(a - 1, c);
|
||||
this.fireChangeEvent(a - 1, b);
|
||||
return-1
|
||||
};
|
||||
this.moveLinesDown = function(a, b) {
|
||||
if(b >= this.lines.length - 1) {
|
||||
return 0
|
||||
}var c = this.lines.slice(a, b + 1);
|
||||
this.$remove(new g(a, 0, b + 1, 0));
|
||||
this.$insertLines(a + 1, c);
|
||||
this.fireChangeEvent(a, b + 1);
|
||||
return 1
|
||||
};
|
||||
this.duplicateLines = function(a, b) {
|
||||
a = this.$clipRowToDocument(a);
|
||||
b = this.$clipRowToDocument(b);
|
||||
var c = this.getLines(a, b);
|
||||
this.$insertLines(a, c);
|
||||
b = b - a + 1;
|
||||
this.fireChangeEvent(a);
|
||||
return b
|
||||
};
|
||||
this.$clipRowToDocument = function(a) {
|
||||
return Math.max(0, Math.min(a, this.lines.length - 1))
|
||||
};
|
||||
this.documentToScreenColumn = function(a, b) {
|
||||
var c = this.getTabSize(), d = 0;
|
||||
b = b;
|
||||
a = this.getLine(a).split("\t");
|
||||
for(var e = 0;e < a.length;e++) {
|
||||
var f = a[e].length;
|
||||
if(b > f) {
|
||||
b -= f + 1;
|
||||
d += f + c
|
||||
}else {
|
||||
d += b;
|
||||
break
|
||||
}
|
||||
}return d
|
||||
};
|
||||
this.screenToDocumentColumn = function(a, b) {
|
||||
var c = this.getTabSize(), d = 0;
|
||||
b = b;
|
||||
a = this.getLine(a).split("\t");
|
||||
for(var e = 0;e < a.length;e++) {
|
||||
var f = a[e].length;
|
||||
if(b >= f + c) {
|
||||
b -= f + c;
|
||||
d += f + 1
|
||||
}else {
|
||||
d += b > f ? f : b;
|
||||
break
|
||||
}
|
||||
}return d
|
||||
}
|
||||
}).call(j.prototype);
|
||||
return j
|
||||
});
|
||||
3436
build/ace/Editor.js
Normal file
3436
build/ace/Editor.js
Normal file
File diff suppressed because it is too large
Load diff
57
build/ace/KeyBinding.js
Normal file
57
build/ace/KeyBinding.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/KeyBinding", ["ace/lib/core", "ace/lib/event", "ace/conf/keybindings/default_mac", "ace/conf/keybindings/default_win", "ace/PluginManager", "ace/commands/DefaultCommands"], function(m, k, n, o, p) {
|
||||
var l = function(i, g, j) {
|
||||
this.setConfig(j);
|
||||
var a = this;
|
||||
k.addKeyListener(i, function(b) {
|
||||
var c = (a.config.reverse[0 | (b.ctrlKey ? 1 : 0) | (b.altKey ? 2 : 0) | (b.shiftKey ? 4 : 0) | (b.metaKey ? 8 : 0)] || {})[(a.keyNames[b.keyCode] || String.fromCharCode(b.keyCode)).toLowerCase()];
|
||||
if(c = p.commands[c]) {
|
||||
c(g, g.getSelection());
|
||||
return k.stopEvent(b)
|
||||
}
|
||||
})
|
||||
};
|
||||
(function() {
|
||||
function i(a, b, c, e) {
|
||||
return(e && a.toLowerCase() || a).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + b + "[\\s ]*", "g"), c || 999)
|
||||
}
|
||||
function g(a, b, c) {
|
||||
var e, f = 0;
|
||||
a = i(a, "\\-", null, true);
|
||||
for(var d = 0, h = a.length;d < h;++d) {
|
||||
if(this.keyMods[a[d]]) {
|
||||
f |= this.keyMods[a[d]]
|
||||
}else {
|
||||
e = a[d] || "-"
|
||||
}
|
||||
}(c[f] || (c[f] = {}))[e] = b;
|
||||
return c
|
||||
}
|
||||
function j(a, b) {
|
||||
var c, e, f, d, h = {};
|
||||
for(c in a) {
|
||||
d = a[c];
|
||||
if(b && typeof d == "string") {
|
||||
d = d.split(b);
|
||||
e = 0;
|
||||
for(f = d.length;e < f;++e) {
|
||||
g.call(this, d[e], c, h)
|
||||
}
|
||||
}else {
|
||||
g.call(this, d, c, h)
|
||||
}
|
||||
}return h
|
||||
}
|
||||
this.keyMods = {ctrl:1, alt:2, option:2, shift:4, meta:8, command:8};
|
||||
this.keyNames = {"8":"Backspace", "9":"Tab", "13":"Enter", "27":"Esc", "32":"Space", "33":"PageUp", "34":"PageDown", "35":"End", "36":"Home", "37":"Left", "38":"Up", "39":"Right", "40":"Down", "45":"Insert", "46":"Delete", "107":"+", "112":"F1", "113":"F2", "114":"F3", "115":"F4", "116":"F5", "117":"F6", "118":"F7", "119":"F8", "120":"F9", "121":"F10", "122":"F11", "123":"F12"};
|
||||
this.setConfig = function(a) {
|
||||
this.config = a || (m.isMac ? n : o);
|
||||
if(typeof this.config.reverse == "undefined") {
|
||||
this.config.reverse = j.call(this, this.config, "|")
|
||||
}
|
||||
}
|
||||
}).call(l.prototype);
|
||||
return l
|
||||
});
|
||||
33
build/ace/MEventEmitter.js
Normal file
33
build/ace/MEventEmitter.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
if(!require.def) {
|
||||
require.def = require("requireJS-node")(module, require)
|
||||
}require.def("ace/MEventEmitter", ["ace/lib/lang"], function(e) {
|
||||
var d = {};
|
||||
d.$dispatchEvent = function(a, b) {
|
||||
this.$eventRegistry = this.$eventRegistry || {};
|
||||
var c = this.$eventRegistry[a];
|
||||
if(c && c.length) {
|
||||
b = b || {};
|
||||
b.type = a;
|
||||
for(a = 0;a < c.length;a++) {
|
||||
c[a](b)
|
||||
}
|
||||
}
|
||||
};
|
||||
d.on = d.addEventListener = function(a, b) {
|
||||
this.$eventRegistry = this.$eventRegistry || {};
|
||||
var c = this.$eventRegistry[a];
|
||||
c || (c = this.$eventRegistry[a] = []);
|
||||
e.arrayIndexOf(c, b) == -1 && c.push(b)
|
||||
};
|
||||
d.removeEventListener = function(a, b) {
|
||||
this.$eventRegistry = this.$eventRegistry || {};
|
||||
if(a = this.$eventRegistry[a]) {
|
||||
b = e.arrayIndexOf(a, b);
|
||||
b !== -1 && a.splice(b, 1)
|
||||
}
|
||||
};
|
||||
return d
|
||||
});
|
||||
8
build/ace/PluginManager.js
Normal file
8
build/ace/PluginManager.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/PluginManager", [], function() {
|
||||
return{commands:{}, registerCommand:function(a, b) {
|
||||
this.commands[a] = b
|
||||
}}
|
||||
});
|
||||
71
build/ace/Range.js
Normal file
71
build/ace/Range.js
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/Range", function() {
|
||||
var c = function(a, b, d, e) {
|
||||
this.start = {row:a, column:b};
|
||||
this.end = {row:d, column:e}
|
||||
};
|
||||
(function() {
|
||||
this.toString = function() {
|
||||
return"Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]"
|
||||
};
|
||||
this.contains = function(a, b) {
|
||||
return this.compare(a, b) == 0
|
||||
};
|
||||
this.compare = function(a, b) {
|
||||
if(!this.isMultiLine()) {
|
||||
if(a === this.start.row) {
|
||||
return b < this.start.column ? -1 : b > this.end.column ? 1 : 0
|
||||
}
|
||||
}if(a < this.start.row) {
|
||||
return-1
|
||||
}if(a > this.end.row) {
|
||||
return 1
|
||||
}if(this.start.row === a) {
|
||||
return b >= this.start.column ? 0 : -1
|
||||
}if(this.end.row === a) {
|
||||
return b <= this.end.column ? 0 : 1
|
||||
}return 0
|
||||
};
|
||||
this.clipRows = function(a, b) {
|
||||
if(this.end.row > b) {
|
||||
var d = {row:b + 1, column:0}
|
||||
}if(this.start.row > b) {
|
||||
var e = {row:b + 1, column:0}
|
||||
}if(this.start.row < a) {
|
||||
e = {row:a, column:0}
|
||||
}if(this.end.row < a) {
|
||||
d = {row:a, column:0}
|
||||
}return c.fromPoints(e || this.start, d || this.end)
|
||||
};
|
||||
this.extend = function(a, b) {
|
||||
var d = this.compare(a, b);
|
||||
if(d == 0) {
|
||||
return this
|
||||
}else {
|
||||
if(d == -1) {
|
||||
var e = {row:a, column:b}
|
||||
}else {
|
||||
var f = {row:a, column:b}
|
||||
}
|
||||
}return c.fromPoints(e || this.start, f || this.end)
|
||||
};
|
||||
this.isEmpty = function() {
|
||||
return this.start.row == this.end.row && this.start.column == this.end.column
|
||||
};
|
||||
this.isMultiLine = function() {
|
||||
return this.start.row !== this.end.row
|
||||
};
|
||||
this.clone = function() {
|
||||
return c.fromPoints(this.start, this.end)
|
||||
};
|
||||
this.toScreenRange = function(a) {
|
||||
return new c(this.start.row, a.documentToScreenColumn(this.start.row, this.start.column), this.end.row, a.documentToScreenColumn(this.end.row, this.end.column))
|
||||
}
|
||||
}).call(c.prototype);
|
||||
c.fromPoints = function(a, b) {
|
||||
return new c(a.row, a.column, b.row, b.column)
|
||||
};
|
||||
return c
|
||||
});
|
||||
45
build/ace/RenderLoop.js
Normal file
45
build/ace/RenderLoop.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/RenderLoop", function() {
|
||||
var d = function(b) {
|
||||
this.onRender = b;
|
||||
this.pending = false;
|
||||
this.changes = 0
|
||||
};
|
||||
(function() {
|
||||
this.schedule = function(b) {
|
||||
this.changes |= b;
|
||||
if(!this.pending) {
|
||||
this.pending = true;
|
||||
var a = this;
|
||||
this.setTimeoutZero(function() {
|
||||
a.pending = false;
|
||||
a.onRender(a.changes);
|
||||
a.changes = 0
|
||||
})
|
||||
}
|
||||
};
|
||||
if(window.postMessage) {
|
||||
this.messageName = "zero-timeout-message";
|
||||
this.setTimeoutZero = function(b) {
|
||||
if(!this.attached) {
|
||||
var a = this;
|
||||
window.addEventListener("message", function(c) {
|
||||
if(c.source == window && a.callback && c.data == a.messageName) {
|
||||
c.stopPropagation();
|
||||
a.callback()
|
||||
}
|
||||
}, false);
|
||||
this.attached = true
|
||||
}this.callback = b;
|
||||
window.postMessage(this.messageName, "*")
|
||||
}
|
||||
}else {
|
||||
this.setTimeoutZero = function(b) {
|
||||
setTimeout(b, 0)
|
||||
}
|
||||
}
|
||||
}).call(d.prototype);
|
||||
return d
|
||||
});
|
||||
34
build/ace/ScrollBar.js
Normal file
34
build/ace/ScrollBar.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/ScrollBar", ["ace/lib/oop", "ace/lib/lang", "ace/lib/dom", "ace/lib/event", "ace/MEventEmitter"], function(c, d, e, f, g) {
|
||||
var b = function(a) {
|
||||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_sb";
|
||||
this.inner = document.createElement("div");
|
||||
this.element.appendChild(this.inner);
|
||||
a.appendChild(this.element);
|
||||
this.width = e.scrollbarWidth();
|
||||
this.element.style.width = this.width;
|
||||
f.addListener(this.element, "scroll", d.bind(this.onScroll, this))
|
||||
};
|
||||
(function() {
|
||||
c.implement(this, g);
|
||||
this.onScroll = function() {
|
||||
this.$dispatchEvent("scroll", {data:this.element.scrollTop})
|
||||
};
|
||||
this.getWidth = function() {
|
||||
return this.width
|
||||
};
|
||||
this.setHeight = function(a) {
|
||||
this.element.style.height = Math.max(0, a - this.width) + "px"
|
||||
};
|
||||
this.setInnerHeight = function(a) {
|
||||
this.inner.style.height = a + "px"
|
||||
};
|
||||
this.setScrollTop = function(a) {
|
||||
this.element.scrollTop = a
|
||||
}
|
||||
}).call(b.prototype);
|
||||
return b
|
||||
});
|
||||
152
build/ace/Search.js
Normal file
152
build/ace/Search.js
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/Search", ["ace/lib/lang", "ace/lib/oop", "ace/Range"], function(o, q, r) {
|
||||
var l = function() {
|
||||
this.$options = {needle:"", backwards:false, wrap:false, caseSensitive:false, wholeWord:false, scope:l.ALL, regExp:false}
|
||||
};
|
||||
l.ALL = 1;
|
||||
l.SELECTION = 2;
|
||||
(function() {
|
||||
this.set = function(a) {
|
||||
q.mixin(this.$options, a);
|
||||
return this
|
||||
};
|
||||
this.getOptions = function() {
|
||||
return o.copyObject(this.$options)
|
||||
};
|
||||
this.find = function(a) {
|
||||
if(!this.$options.needle) {
|
||||
return null
|
||||
}var b = null;
|
||||
(this.$options.backwards ? this.$backwardMatchIterator(a) : this.$forwardMatchIterator(a)).forEach(function(c) {
|
||||
b = c;
|
||||
return true
|
||||
});
|
||||
return b
|
||||
};
|
||||
this.findAll = function(a) {
|
||||
if(!this.$options.needle) {
|
||||
return[]
|
||||
}var b = [];
|
||||
(this.$options.backwards ? this.$backwardMatchIterator(a) : this.$forwardMatchIterator(a)).forEach(function(c) {
|
||||
b.push(c)
|
||||
});
|
||||
return b
|
||||
};
|
||||
this.replace = function(a, b) {
|
||||
var c = this.$assembleRegExp(), g = c.exec(a);
|
||||
return g && g[0].length == a.length ? this.$options.regExp ? a.replace(c, b) : b : null
|
||||
};
|
||||
this.$forwardMatchIterator = function(a) {
|
||||
var b = this.$assembleRegExp(), c = this;
|
||||
return{forEach:function(g) {
|
||||
c.$forwardLineIterator(a).forEach(function(d, i, k) {
|
||||
if(i) {
|
||||
d = d.substring(i)
|
||||
}var j = [];
|
||||
d.replace(b, function(e) {
|
||||
j.push({str:e, offset:i + arguments[arguments.length - 2]});
|
||||
return e
|
||||
});
|
||||
for(d = 0;d < j.length;d++) {
|
||||
var h = j[d];
|
||||
h = c.$rangeFromMatch(k, h.offset, h.str.length);
|
||||
if(g(h)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
})
|
||||
}}
|
||||
};
|
||||
this.$backwardMatchIterator = function(a) {
|
||||
var b = this.$assembleRegExp(), c = this;
|
||||
return{forEach:function(g) {
|
||||
c.$backwardLineIterator(a).forEach(function(d, i, k) {
|
||||
if(i) {
|
||||
d = d.substring(i)
|
||||
}var j = [];
|
||||
d.replace(b, function(e, f) {
|
||||
j.push({str:e, offset:i + f});
|
||||
return e
|
||||
});
|
||||
for(d = j.length - 1;d >= 0;d--) {
|
||||
var h = j[d];
|
||||
h = c.$rangeFromMatch(k, h.offset, h.str.length);
|
||||
if(g(h)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
})
|
||||
}}
|
||||
};
|
||||
this.$rangeFromMatch = function(a, b, c) {
|
||||
return new r(a, b, a, b + c)
|
||||
};
|
||||
this.$assembleRegExp = function() {
|
||||
var a = this.$options.regExp ? this.$options.needle : o.escapeRegExp(this.$options.needle);
|
||||
if(this.$options.wholeWord) {
|
||||
a = "\\b" + a + "\\b"
|
||||
}var b = "g";
|
||||
this.$options.caseSensitive || (b += "i");
|
||||
return new RegExp(a, b)
|
||||
};
|
||||
this.$forwardLineIterator = function(a) {
|
||||
function b(e) {
|
||||
var f = a.getLine(e);
|
||||
if(c && e == g.end.row) {
|
||||
f = f.substring(0, g.end.column)
|
||||
}return f
|
||||
}
|
||||
var c = this.$options.scope == l.SELECTION, g = a.getSelection().getRange(), d = a.getSelection().getCursor(), i = c ? g.start.row : 0, k = c ? g.start.column : 0, j = c ? g.end.row : a.getLength() - 1, h = this.$options.wrap;
|
||||
return{forEach:function(e) {
|
||||
for(var f = d.row, m = b(f), n = d.column, p = false;!e(m, n, f);) {
|
||||
if(p) {
|
||||
return
|
||||
}f++;
|
||||
n = 0;
|
||||
if(f > j) {
|
||||
if(h) {
|
||||
f = i;
|
||||
n = k
|
||||
}else {
|
||||
return
|
||||
}
|
||||
}if(f == d.row) {
|
||||
p = true
|
||||
}m = b(f)
|
||||
}
|
||||
}}
|
||||
};
|
||||
this.$backwardLineIterator = function(a) {
|
||||
var b = this.$options.scope == l.SELECTION, c = a.getSelection().getRange(), g = b ? c.end : c.start, d = b ? c.start.row : 0, i = b ? c.start.column : 0, k = b ? c.end.row : a.getLength() - 1, j = this.$options.wrap;
|
||||
return{forEach:function(h) {
|
||||
for(var e = g.row, f = a.getLine(e).substring(0, g.column), m = 0, n = false;!h(f, m, e);) {
|
||||
if(n) {
|
||||
return
|
||||
}e--;
|
||||
m = 0;
|
||||
if(e < d) {
|
||||
if(j) {
|
||||
e = k
|
||||
}else {
|
||||
return
|
||||
}
|
||||
}if(e == g.row) {
|
||||
n = true
|
||||
}f = a.getLine(e);
|
||||
if(b) {
|
||||
if(e == d) {
|
||||
m = i
|
||||
}else {
|
||||
if(e == k) {
|
||||
f = f.substring(0, c.end.column)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
}).call(l.prototype);
|
||||
return l
|
||||
});
|
||||
257
build/ace/Selection.js
Normal file
257
build/ace/Selection.js
Normal file
|
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/Selection", ["ace/lib/oop", "ace/lib/lang", "ace/MEventEmitter", "ace/Range"], function(g, h, i, e) {
|
||||
var f = function(a) {
|
||||
this.doc = a;
|
||||
this.clearSelection();
|
||||
this.selectionLead = {row:0, column:0}
|
||||
};
|
||||
(function() {
|
||||
g.implement(this, i);
|
||||
this.isEmpty = function() {
|
||||
return!this.selectionAnchor || this.selectionAnchor.row == this.selectionLead.row && this.selectionAnchor.column == this.selectionLead.column
|
||||
};
|
||||
this.isMultiLine = function() {
|
||||
if(this.isEmpty()) {
|
||||
return false
|
||||
}return this.getRange().isMultiLine()
|
||||
};
|
||||
this.getCursor = function() {
|
||||
return this.selectionLead
|
||||
};
|
||||
this.setSelectionAnchor = function(a, b) {
|
||||
a = this.$clipPositionToDocument(a, b);
|
||||
if(this.selectionAnchor) {
|
||||
if(this.selectionAnchor.row !== a.row || this.selectionAnchor.column !== a.column) {
|
||||
this.selectionAnchor = a;
|
||||
this.$dispatchEvent("changeSelection", {})
|
||||
}
|
||||
}else {
|
||||
this.selectionAnchor = a;
|
||||
this.$dispatchEvent("changeSelection", {})
|
||||
}
|
||||
};
|
||||
this.getSelectionAnchor = function() {
|
||||
return this.selectionAnchor ? this.$clone(this.selectionAnchor) : this.$clone(this.selectionLead)
|
||||
};
|
||||
this.getSelectionLead = function() {
|
||||
return this.$clone(this.selectionLead)
|
||||
};
|
||||
this.shiftSelection = function(a) {
|
||||
if(this.isEmpty()) {
|
||||
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + a)
|
||||
}else {
|
||||
var b = this.getSelectionAnchor(), c = this.getSelectionLead(), d = this.isBackwards();
|
||||
if(!d || b.column !== 0) {
|
||||
this.setSelectionAnchor(b.row, b.column + a)
|
||||
}if(d || c.column !== 0) {
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorTo(c.row, c.column + a)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
this.isBackwards = function() {
|
||||
var a = this.selectionAnchor || this.selectionLead, b = this.selectionLead;
|
||||
return a.row > b.row || a.row == b.row && a.column > b.column
|
||||
};
|
||||
this.getRange = function() {
|
||||
var a = this.selectionAnchor || this.selectionLead, b = this.selectionLead;
|
||||
return this.isBackwards() ? e.fromPoints(b, a) : e.fromPoints(a, b)
|
||||
};
|
||||
this.clearSelection = function() {
|
||||
if(this.selectionAnchor) {
|
||||
this.selectionAnchor = null;
|
||||
this.$dispatchEvent("changeSelection", {})
|
||||
}
|
||||
};
|
||||
this.selectAll = function() {
|
||||
var a = this.doc.getLength() - 1;
|
||||
this.setSelectionAnchor(a, this.doc.getLine(a).length);
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorTo(0, 0)
|
||||
})
|
||||
};
|
||||
this.setSelectionRange = function(a, b) {
|
||||
if(b) {
|
||||
this.setSelectionAnchor(a.end.row, a.end.column);
|
||||
this.selectTo(a.start.row, a.start.column)
|
||||
}else {
|
||||
this.setSelectionAnchor(a.start.row, a.start.column);
|
||||
this.selectTo(a.end.row, a.end.column)
|
||||
}
|
||||
};
|
||||
this.$moveSelection = function(a) {
|
||||
var b = false;
|
||||
if(!this.selectionAnchor) {
|
||||
b = true;
|
||||
this.selectionAnchor = this.$clone(this.selectionLead)
|
||||
}var c = this.$clone(this.selectionLead);
|
||||
a.call(this);
|
||||
if(c.row !== this.selectionLead.row || c.column !== this.selectionLead.column) {
|
||||
b = true
|
||||
}b && this.$dispatchEvent("changeSelection", {})
|
||||
};
|
||||
this.selectTo = function(a, b) {
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorTo(a, b)
|
||||
})
|
||||
};
|
||||
this.selectToPosition = function(a) {
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorToPosition(a)
|
||||
})
|
||||
};
|
||||
this.selectUp = function() {
|
||||
this.$moveSelection(this.moveCursorUp)
|
||||
};
|
||||
this.selectDown = function() {
|
||||
this.$moveSelection(this.moveCursorDown)
|
||||
};
|
||||
this.selectRight = function() {
|
||||
this.$moveSelection(this.moveCursorRight)
|
||||
};
|
||||
this.selectLeft = function() {
|
||||
this.$moveSelection(this.moveCursorLeft)
|
||||
};
|
||||
this.selectLineStart = function() {
|
||||
this.$moveSelection(this.moveCursorLineStart)
|
||||
};
|
||||
this.selectLineEnd = function() {
|
||||
this.$moveSelection(this.moveCursorLineEnd)
|
||||
};
|
||||
this.selectFileEnd = function() {
|
||||
this.$moveSelection(this.moveCursorFileEnd)
|
||||
};
|
||||
this.selectFileStart = function() {
|
||||
this.$moveSelection(this.moveCursorFileStart)
|
||||
};
|
||||
this.selectWordRight = function() {
|
||||
this.$moveSelection(this.moveCursorWordRight)
|
||||
};
|
||||
this.selectWordLeft = function() {
|
||||
this.$moveSelection(this.moveCursorWordLeft)
|
||||
};
|
||||
this.selectWord = function() {
|
||||
var a = this.selectionLead;
|
||||
this.setSelectionRange(this.doc.getWordRange(a.row, a.column))
|
||||
};
|
||||
this.selectLine = function() {
|
||||
this.setSelectionAnchor(this.selectionLead.row, 0);
|
||||
this.$moveSelection(function() {
|
||||
this.moveCursorTo(this.selectionLead.row + 1, 0)
|
||||
})
|
||||
};
|
||||
this.moveCursorUp = function() {
|
||||
this.moveCursorBy(-1, 0)
|
||||
};
|
||||
this.moveCursorDown = function() {
|
||||
this.moveCursorBy(1, 0)
|
||||
};
|
||||
this.moveCursorLeft = function() {
|
||||
if(this.selectionLead.column == 0) {
|
||||
this.selectionLead.row > 0 && this.moveCursorTo(this.selectionLead.row - 1, this.doc.getLine(this.selectionLead.row - 1).length)
|
||||
}else {
|
||||
this.moveCursorBy(0, -1)
|
||||
}
|
||||
};
|
||||
this.moveCursorRight = function() {
|
||||
if(this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) {
|
||||
this.selectionLead.row < this.doc.getLength() - 1 && this.moveCursorTo(this.selectionLead.row + 1, 0)
|
||||
}else {
|
||||
this.moveCursorBy(0, 1)
|
||||
}
|
||||
};
|
||||
this.moveCursorLineStart = function() {
|
||||
var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a).slice(0, b).match(/^\s*/);
|
||||
if(c[0].length == 0) {
|
||||
this.moveCursorTo(a, this.doc.getLine(a).match(/^\s*/)[0].length)
|
||||
}else {
|
||||
c[0].length >= b ? this.moveCursorTo(a, 0) : this.moveCursorTo(a, c[0].length)
|
||||
}
|
||||
};
|
||||
this.moveCursorLineEnd = function() {
|
||||
this.moveCursorTo(this.selectionLead.row, this.doc.getLine(this.selectionLead.row).length)
|
||||
};
|
||||
this.moveCursorFileEnd = function() {
|
||||
var a = this.doc.getLength() - 1, b = this.doc.getLine(a).length;
|
||||
this.moveCursorTo(a, b)
|
||||
};
|
||||
this.moveCursorFileStart = function() {
|
||||
this.moveCursorTo(0, 0)
|
||||
};
|
||||
this.moveCursorWordRight = function() {
|
||||
var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a), d = c.substring(b);
|
||||
this.doc.nonTokenRe.lastIndex = 0;
|
||||
this.doc.tokenRe.lastIndex = 0;
|
||||
if(b == c.length) {
|
||||
this.moveCursorRight()
|
||||
}else {
|
||||
if(this.doc.nonTokenRe.exec(d)) {
|
||||
b += this.doc.nonTokenRe.lastIndex;
|
||||
this.doc.nonTokenRe.lastIndex = 0
|
||||
}else {
|
||||
if(this.doc.tokenRe.exec(d)) {
|
||||
b += this.doc.tokenRe.lastIndex;
|
||||
this.doc.tokenRe.lastIndex = 0
|
||||
}
|
||||
}this.moveCursorTo(a, b)
|
||||
}
|
||||
};
|
||||
this.moveCursorWordLeft = function() {
|
||||
var a = this.selectionLead.row, b = this.selectionLead.column, c = this.doc.getLine(a);
|
||||
c = h.stringReverse(c.substring(0, b));
|
||||
this.doc.nonTokenRe.lastIndex = 0;
|
||||
this.doc.tokenRe.lastIndex = 0;
|
||||
if(b == 0) {
|
||||
this.moveCursorLeft()
|
||||
}else {
|
||||
if(this.doc.nonTokenRe.exec(c)) {
|
||||
b -= this.doc.nonTokenRe.lastIndex;
|
||||
this.doc.nonTokenRe.lastIndex = 0
|
||||
}else {
|
||||
if(this.doc.tokenRe.exec(c)) {
|
||||
b -= this.doc.tokenRe.lastIndex;
|
||||
this.doc.tokenRe.lastIndex = 0
|
||||
}
|
||||
}this.moveCursorTo(a, b)
|
||||
}
|
||||
};
|
||||
this.moveCursorBy = function(a, b) {
|
||||
this.moveCursorTo(this.selectionLead.row + a, this.selectionLead.column + b)
|
||||
};
|
||||
this.moveCursorToPosition = function(a) {
|
||||
this.moveCursorTo(a.row, a.column)
|
||||
};
|
||||
this.moveCursorTo = function(a, b) {
|
||||
a = this.$clipPositionToDocument(a, b);
|
||||
if(a.row !== this.selectionLead.row || a.column !== this.selectionLead.column) {
|
||||
this.selectionLead = a;
|
||||
this.$dispatchEvent("changeCursor", {data:this.getCursor()})
|
||||
}
|
||||
};
|
||||
this.moveCursorUp = function() {
|
||||
this.moveCursorBy(-1, 0)
|
||||
};
|
||||
this.$clipPositionToDocument = function(a, b) {
|
||||
var c = {};
|
||||
if(a >= this.doc.getLength()) {
|
||||
c.row = Math.max(0, this.doc.getLength() - 1);
|
||||
c.column = this.doc.getLine(c.row).length
|
||||
}else {
|
||||
if(a < 0) {
|
||||
c.row = 0;
|
||||
c.column = 0
|
||||
}else {
|
||||
c.row = a;
|
||||
c.column = Math.min(this.doc.getLine(c.row).length, Math.max(0, b))
|
||||
}
|
||||
}return c
|
||||
};
|
||||
this.$clone = function(a) {
|
||||
return{row:a.row, column:a.column}
|
||||
}
|
||||
}).call(f.prototype);
|
||||
return f
|
||||
});
|
||||
81
build/ace/TextInput.js
Normal file
81
build/ace/TextInput.js
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/TextInput", ["ace/lib/event"], function(b) {
|
||||
return function(l, c) {
|
||||
function e() {
|
||||
if(!f) {
|
||||
var d = a.value;
|
||||
if(d) {
|
||||
if(d.charCodeAt(d.length - 1) == j.charCodeAt(0)) {
|
||||
(d = d.slice(0, -1)) && c.onTextInput(d)
|
||||
}else {
|
||||
c.onTextInput(d)
|
||||
}
|
||||
}
|
||||
}f = false;
|
||||
a.value = j;
|
||||
a.select()
|
||||
}
|
||||
var a = document.createElement("textarea"), h = a.style;
|
||||
h.position = "absolute";
|
||||
h.left = "-10000px";
|
||||
h.top = "-10000px";
|
||||
l.appendChild(a);
|
||||
var j = String.fromCharCode(0);
|
||||
e();
|
||||
var i = false, f = false, g = function() {
|
||||
setTimeout(function() {
|
||||
i || e()
|
||||
}, 0)
|
||||
}, k = function() {
|
||||
c.onCompositionUpdate(a.value)
|
||||
};
|
||||
b.addListener(a, "keypress", g);
|
||||
b.addListener(a, "textInput", g);
|
||||
b.addListener(a, "paste", g);
|
||||
b.addListener(a, "propertychange", g);
|
||||
b.addListener(a, "copy", function() {
|
||||
f = true;
|
||||
a.value = c.getCopyText();
|
||||
a.select();
|
||||
f = true;
|
||||
setTimeout(e, 0)
|
||||
});
|
||||
b.addListener(a, "cut", function() {
|
||||
f = true;
|
||||
a.value = c.getCopyText();
|
||||
c.onCut();
|
||||
a.select();
|
||||
setTimeout(e, 0)
|
||||
});
|
||||
b.addListener(a, "compositionstart", function() {
|
||||
i = true;
|
||||
e();
|
||||
a.value = "";
|
||||
c.onCompositionStart();
|
||||
setTimeout(k, 0)
|
||||
});
|
||||
b.addListener(a, "compositionupdate", k);
|
||||
b.addListener(a, "compositionend", function() {
|
||||
i = false;
|
||||
c.onCompositionEnd();
|
||||
g()
|
||||
});
|
||||
b.addListener(a, "blur", function() {
|
||||
c.onBlur()
|
||||
});
|
||||
b.addListener(a, "focus", function() {
|
||||
c.onFocus();
|
||||
a.select()
|
||||
});
|
||||
this.focus = function() {
|
||||
c.onFocus();
|
||||
a.select();
|
||||
a.focus()
|
||||
};
|
||||
this.blur = function() {
|
||||
a.blur()
|
||||
}
|
||||
}
|
||||
});
|
||||
49
build/ace/Tokenizer.js
Normal file
49
build/ace/Tokenizer.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/Tokenizer", [], function() {
|
||||
var k = function(f) {
|
||||
this.rules = f;
|
||||
this.regExps = {};
|
||||
for(var a in this.rules) {
|
||||
f = this.rules[a];
|
||||
for(var b = [], c = 0;c < f.length;c++) {
|
||||
b.push(f[c].regex)
|
||||
}this.regExps[a] = new RegExp("(?:(" + b.join(")|(") + ")|(.))", "g")
|
||||
}
|
||||
};
|
||||
(function() {
|
||||
this.getLineTokens = function(f, a) {
|
||||
a = a;
|
||||
var b = this.rules[a], c = this.regExps[a];
|
||||
c.lastIndex = 0;
|
||||
for(var g, h = [], i = 0, e = {type:null, value:""};g = c.exec(f);) {
|
||||
var j = "text", l = g[0];
|
||||
if(c.lastIndex == i) {
|
||||
throw new Error("tokenizer error");
|
||||
}i = c.lastIndex;
|
||||
window.LOG && console.log(a, g);
|
||||
for(var d = 0;d < b.length;d++) {
|
||||
if(g[d + 1]) {
|
||||
j = typeof b[d].token == "function" ? b[d].token(g[0]) : b[d].token;
|
||||
if(b[d].next && b[d].next !== a) {
|
||||
a = b[d].next;
|
||||
b = this.rules[a];
|
||||
i = c.lastIndex;
|
||||
c = this.regExps[a];
|
||||
c.lastIndex = i
|
||||
}break
|
||||
}
|
||||
}if(e.type !== j) {
|
||||
e.type && h.push(e);
|
||||
e = {type:j, value:l}
|
||||
}else {
|
||||
e.value += l
|
||||
}
|
||||
}e.type && h.push(e);
|
||||
window.LOG && console.log(h, a);
|
||||
return{tokens:h, state:a}
|
||||
}
|
||||
}).call(k.prototype);
|
||||
return k
|
||||
});
|
||||
31
build/ace/UndoManager.js
Normal file
31
build/ace/UndoManager.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/UndoManager", function() {
|
||||
var b = function() {
|
||||
this.$undoStack = [];
|
||||
this.$redoStack = []
|
||||
};
|
||||
(function() {
|
||||
this.execute = function(a) {
|
||||
var c = a.args[0];
|
||||
this.$doc = a.args[1];
|
||||
this.$undoStack.push(c)
|
||||
};
|
||||
this.undo = function() {
|
||||
var a = this.$undoStack.pop();
|
||||
if(a) {
|
||||
this.$doc.undoChanges(a);
|
||||
this.$redoStack.push(a)
|
||||
}
|
||||
};
|
||||
this.redo = function() {
|
||||
var a = this.$redoStack.pop();
|
||||
if(a) {
|
||||
this.$doc.redoChanges(a);
|
||||
this.$undoStack.push(a)
|
||||
}
|
||||
}
|
||||
}).call(b.prototype);
|
||||
return b
|
||||
});
|
||||
378
build/ace/VirtualRenderer.js
Normal file
378
build/ace/VirtualRenderer.js
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/VirtualRenderer", ["ace/lib/oop", "ace/lib/lang", "ace/lib/dom", "ace/lib/event", "ace/layer/Gutter", "ace/layer/Marker", "ace/layer/Text", "ace/layer/Cursor", "ace/ScrollBar", "ace/RenderLoop", "ace/MEventEmitter", 'text!ace/css/editor.css!.ace_editor {\n position: absolute;\n overflow: hidden;\n\n font-family: "Menlo", "Monaco", "Courier New", monospace;\n font-size: 12px; \n}\n\n.ace_scroller {\n position: absolute;\n overflow-x: scroll;\n overflow-y: hidden; \n}\n\n.ace_gutter {\n position: absolute;\n overflow-x: hidden;\n overflow-y: hidden;\n height: 100%;\n}\n\n.ace_editor .ace_sb {\n position: absolute;\n overflow-x: hidden;\n overflow-y: scroll;\n right: 0;\n}\n\n.ace_editor .ace_sb div {\n position: absolute;\n width: 1px;\n left: 0px;\n}\n\n.ace_editor .ace_printMargin {\n position: absolute;\n height: 100%;\n}\n\n.ace_layer {\n z-index: 0;\n position: absolute;\n overflow: hidden; \n white-space: nowrap;\n height: 100%;\n}\n\n.ace_text-layer {\n font-family: Monaco, "Courier New", monospace;\n color: black;\n}\n\n.ace_cursor-layer {\n cursor: text;\n}\n\n.ace_cursor {\n z-index: 3;\n position: absolute;\n}\n\n.ace_line {\n white-space: nowrap;\n}\n\n.ace_marker-layer {\n}\n\n.ace_marker-layer .ace_step {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 4;\n}\n\n.ace_marker-layer .ace_active_line {\n position: absolute;\n z-index: 1;\n}'],
|
||||
function(k, h, e, i, l, m, n, o, p, q, r, j) {
|
||||
e.importCssString(j);
|
||||
j = function(a, b) {
|
||||
this.container = a;
|
||||
e.addCssClass(this.container, "ace_editor");
|
||||
this.setTheme(b);
|
||||
this.scroller = document.createElement("div");
|
||||
this.scroller.className = "ace_scroller";
|
||||
this.container.appendChild(this.scroller);
|
||||
this.$gutter = document.createElement("div");
|
||||
this.$gutter.className = "ace_gutter";
|
||||
this.container.appendChild(this.$gutter);
|
||||
this.content = document.createElement("div");
|
||||
this.content.style.position = "absolute";
|
||||
this.scroller.appendChild(this.content);
|
||||
this.$gutterLayer = new l(this.$gutter);
|
||||
this.$markerLayer = new m(this.content);
|
||||
var c = this.$textLayer = new n(this.content);
|
||||
this.canvas = c.element;
|
||||
this.characterWidth = c.getCharacterWidth();
|
||||
this.lineHeight = c.getLineHeight();
|
||||
this.$cursorLayer = new o(this.content);
|
||||
this.layers = [this.$markerLayer, c, this.$cursorLayer];
|
||||
this.scrollBar = new p(a);
|
||||
this.scrollBar.addEventListener("scroll", h.bind(this.onScroll, this));
|
||||
this.scrollTop = 0;
|
||||
this.cursorPos = {row:0, column:0};
|
||||
var d = this;
|
||||
this.$textLayer.addEventListener("changeCharaterSize", function() {
|
||||
d.characterWidth = c.getCharacterWidth();
|
||||
d.lineHeight = c.getLineHeight();
|
||||
d.$loop.schedule(d.CHANGE_FULL)
|
||||
});
|
||||
i.addListener(this.$gutter, "click", h.bind(this.$onGutterClick, this));
|
||||
i.addListener(this.$gutter, "dblclick", h.bind(this.$onGutterClick, this));
|
||||
this.$size = {width:0, height:0, scrollerHeight:0, scrollerWidth:0};
|
||||
this.$loop = new q(h.bind(this.$renderChanges, this));
|
||||
this.$loop.schedule(this.CHANGE_FULL);
|
||||
this.$updatePrintMargin();
|
||||
this.setPadding(4)
|
||||
};
|
||||
(function() {
|
||||
this.showGutter = true;
|
||||
this.CHANGE_CURSOR = 1;
|
||||
this.CHANGE_MARKER = 2;
|
||||
this.CHANGE_GUTTER = 4;
|
||||
this.CHANGE_SCROLL = 8;
|
||||
this.CHANGE_LINES = 16;
|
||||
this.CHANGE_TEXT = 32;
|
||||
this.CHANGE_SIZE = 64;
|
||||
this.CHANGE_FULL = 128;
|
||||
k.implement(this, r);
|
||||
this.setDocument = function(a) {
|
||||
this.lines = a.lines;
|
||||
this.doc = a;
|
||||
this.$cursorLayer.setDocument(a);
|
||||
this.$markerLayer.setDocument(a);
|
||||
this.$textLayer.setDocument(a);
|
||||
this.$loop.schedule(this.CHANGE_FULL)
|
||||
};
|
||||
this.updateLines = function(a, b) {
|
||||
if(b === undefined) {
|
||||
b = Infinity
|
||||
}if(this.$changedLines) {
|
||||
if(this.$changedLines.firstRow > a) {
|
||||
this.$changedLines.firstRow = a
|
||||
}if(this.$changedLines.lastRow < b) {
|
||||
this.$changedLines.lastRow = b
|
||||
}
|
||||
}else {
|
||||
this.$changedLines = {firstRow:a, lastRow:b}
|
||||
}this.$loop.schedule(this.CHANGE_LINES)
|
||||
};
|
||||
this.updateText = function() {
|
||||
this.$loop.schedule(this.CHANGE_TEXT)
|
||||
};
|
||||
this.updateFull = function() {
|
||||
this.$loop.schedule(this.CHANGE_FULL)
|
||||
};
|
||||
this.onResize = function() {
|
||||
this.$loop.schedule(this.CHANGE_SIZE);
|
||||
var a = e.getInnerHeight(this.container);
|
||||
if(this.$size.height != a) {
|
||||
this.$size.height = a;
|
||||
this.scroller.style.height = a + "px";
|
||||
this.scrollBar.setHeight(a);
|
||||
if(this.doc) {
|
||||
this.scrollToY(this.getScrollTop());
|
||||
this.$loop.schedule(this.CHANGE_FULL)
|
||||
}
|
||||
}a = e.getInnerWidth(this.container);
|
||||
if(this.$size.width != a) {
|
||||
this.$size.width = a;
|
||||
var b = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.scroller.style.left = b + "px";
|
||||
this.scroller.style.width = Math.max(0, a - b - this.scrollBar.getWidth()) + "px"
|
||||
}this.$size.scrollerWidth = this.scroller.clientWidth;
|
||||
this.$size.scrollerHeight = this.scroller.clientHeight
|
||||
};
|
||||
this.setTokenizer = function(a) {
|
||||
this.$tokenizer = a;
|
||||
this.$textLayer.setTokenizer(a);
|
||||
this.$loop.schedule(this.CHANGE_TEXT)
|
||||
};
|
||||
this.$onGutterClick = function(a) {
|
||||
var b = i.getDocumentX(a), c = i.getDocumentY(a);
|
||||
this.$dispatchEvent("gutter" + a.type, {row:this.screenToTextCoordinates(b, c).row, htmlEvent:a})
|
||||
};
|
||||
this.$showInvisibles = true;
|
||||
this.setShowInvisibles = function(a) {
|
||||
this.$showInvisibles = a;
|
||||
this.$textLayer.setShowInvisibles(a);
|
||||
this.$loop.schedule(this.CHANGE_TEXT)
|
||||
};
|
||||
this.getShowInvisibles = function() {
|
||||
return this.$showInvisibles
|
||||
};
|
||||
this.$showPrintMargin = true;
|
||||
this.setShowPrintMargin = function(a) {
|
||||
this.$showPrintMargin = a;
|
||||
this.$updatePrintMargin()
|
||||
};
|
||||
this.getShowPrintMargin = function() {
|
||||
return this.$showPrintMargin
|
||||
};
|
||||
this.$printMarginColumn = 80;
|
||||
this.setPrintMarginColumn = function(a) {
|
||||
this.$printMarginColumn = a;
|
||||
this.$updatePrintMargin()
|
||||
};
|
||||
this.getPrintMarginColumn = function() {
|
||||
return this.$printMarginColumn
|
||||
};
|
||||
this.setShowGutter = function(a) {
|
||||
this.$gutter.style.display = a ? "block" : "none";
|
||||
this.showGutter = a;
|
||||
this.onResize()
|
||||
};
|
||||
this.$updatePrintMargin = function() {
|
||||
if(this.$showPrintMargin || this.$printMarginEl) {
|
||||
if(!this.$printMarginEl) {
|
||||
this.$printMarginEl = document.createElement("div");
|
||||
this.$printMarginEl.className = "ace_printMargin";
|
||||
this.content.insertBefore(this.$printMarginEl, this.$textLayer.element)
|
||||
}var a = this.$printMarginEl.style;
|
||||
a.left = this.characterWidth * this.$printMarginColumn + "px";
|
||||
a.visibility = this.$showPrintMargin ? "visible" : "hidden"
|
||||
}
|
||||
};
|
||||
this.getContainerElement = function() {
|
||||
return this.container
|
||||
};
|
||||
this.getMouseEventTarget = function() {
|
||||
return this.content
|
||||
};
|
||||
this.getFirstVisibleRow = function() {
|
||||
return(this.layerConfig || {}).firstRow || 0
|
||||
};
|
||||
this.getFirstFullyVisibleRow = function() {
|
||||
if(!this.layerConfig) {
|
||||
return 0
|
||||
}return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1)
|
||||
};
|
||||
this.getLastFullyVisibleRow = function() {
|
||||
if(!this.layerConfig) {
|
||||
return 0
|
||||
}return this.layerConfig.firstRow - 1 + Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight)
|
||||
};
|
||||
this.getLastVisibleRow = function() {
|
||||
return(this.layerConfig || {}).lastRow || 0
|
||||
};
|
||||
this.$padding = null;
|
||||
this.setPadding = function(a) {
|
||||
this.$padding = a;
|
||||
this.content.style.padding = "0 " + a + "px";
|
||||
this.$loop.schedule(this.CHANGE_FULL)
|
||||
};
|
||||
this.onScroll = function(a) {
|
||||
this.scrollToY(a.data)
|
||||
};
|
||||
this.$updateScrollBar = function() {
|
||||
this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight);
|
||||
this.scrollBar.setScrollTop(this.scrollTop)
|
||||
};
|
||||
this.$renderChanges = function(a) {
|
||||
if(!(!a || !this.doc || !this.$tokenizer)) {
|
||||
if(!this.layerConfig || a & this.CHANGE_FULL || a & this.CHANGE_SIZE || a & this.CHANGE_TEXT || a & this.CHANGE_LINES || a & this.CHANGE_SCROLL) {
|
||||
this.$computeLayerConfig()
|
||||
}if(a & this.CHANGE_FULL) {
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
this.showGutter && this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerLayer.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$updateScrollBar()
|
||||
}else {
|
||||
if(a & this.CHANGE_SCROLL) {
|
||||
a & this.CHANGE_TEXT || a & this.CHANGE_LINES ? this.$textLayer.scrollLines(this.layerConfig) : this.$textLayer.update(this.layerConfig);
|
||||
this.showGutter && this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerLayer.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$updateScrollBar()
|
||||
}else {
|
||||
if(a & this.CHANGE_TEXT) {
|
||||
this.$textLayer.update(this.layerConfig);
|
||||
this.showGutter && this.$gutterLayer.update(this.layerConfig)
|
||||
}else {
|
||||
if(a & this.CHANGE_LINES) {
|
||||
this.$updateLines();
|
||||
this.$updateScrollBar()
|
||||
}else {
|
||||
if(a & this.CHANGE_SCROLL) {
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
this.showGutter && this.$gutterLayer.update(this.layerConfig)
|
||||
}
|
||||
}
|
||||
}a & this.CHANGE_GUTTER && this.showGutter && this.$gutterLayer.update(this.layerConfig);
|
||||
a & this.CHANGE_CURSOR && this.$cursorLayer.update(this.layerConfig);
|
||||
a & this.CHANGE_MARKER && this.$markerLayer.update(this.layerConfig);
|
||||
a & this.CHANGE_SIZE && this.$updateScrollBar()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.$computeLayerConfig = function() {
|
||||
var a = this.scrollTop % this.lineHeight, b = this.$size.scrollerHeight + this.lineHeight, c = this.$getLongestLine(), d = !this.layerConfig ? true : this.layerConfig.width != c, g = Math.ceil(b / this.lineHeight), f = Math.max(0, Math.round((this.scrollTop - a) / this.lineHeight));
|
||||
g = Math.min(this.lines.length, f + g) - 1;
|
||||
this.layerConfig = {width:c, padding:this.$padding, firstRow:f, lastRow:g, lineHeight:this.lineHeight, characterWidth:this.characterWidth, minHeight:b, offset:a, height:this.$size.scrollerHeight};
|
||||
for(f = 0;f < this.layers.length;f++) {
|
||||
g = this.layers[f];
|
||||
if(d) {
|
||||
g.element.style.width = c + "px"
|
||||
}
|
||||
}this.$gutterLayer.element.style.marginTop = -a + "px";
|
||||
this.content.style.marginTop = -a + "px";
|
||||
this.content.style.width = c + "px";
|
||||
this.content.style.height = b + "px"
|
||||
};
|
||||
this.$updateLines = function() {
|
||||
var a = this.$changedLines.firstRow, b = this.$changedLines.lastRow;
|
||||
this.$changedLines = null;
|
||||
var c = this.layerConfig;
|
||||
if(c.width != this.$getLongestLine()) {
|
||||
return this.$textLayer.update(c)
|
||||
}if(!(a > c.lastRow + 1)) {
|
||||
if(!(b < c.firstRow)) {
|
||||
if(b === Infinity) {
|
||||
this.showGutter && this.$gutterLayer.update(c);
|
||||
this.$textLayer.update(c)
|
||||
}else {
|
||||
this.$textLayer.updateLines(c, a, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.$getLongestLine = function() {
|
||||
var a = this.doc.getScreenWidth();
|
||||
if(this.$showInvisibles) {
|
||||
a += 1
|
||||
}return Math.max(this.$size.scrollerWidth - this.$padding * 2, Math.round(a * this.characterWidth))
|
||||
};
|
||||
this.addMarker = function(a, b, c) {
|
||||
a = this.$markerLayer.addMarker(a, b, c);
|
||||
this.$loop.schedule(this.CHANGE_MARKER);
|
||||
return a
|
||||
};
|
||||
this.removeMarker = function(a) {
|
||||
this.$markerLayer.removeMarker(a);
|
||||
this.$loop.schedule(this.CHANGE_MARKER)
|
||||
};
|
||||
this.addGutterDecoration = function(a, b) {
|
||||
this.$gutterLayer.addGutterDecoration(a, b);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER)
|
||||
};
|
||||
this.removeGutterDecoration = function(a, b) {
|
||||
this.$gutterLayer.removeGutterDecoration(a, b);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER)
|
||||
};
|
||||
this.setBreakpoints = function(a) {
|
||||
this.$gutterLayer.setBreakpoints(a);
|
||||
this.$loop.schedule(this.CHANGE_GUTTER)
|
||||
};
|
||||
this.updateCursor = function(a, b) {
|
||||
this.$cursorLayer.setCursor(a, b);
|
||||
this.$loop.schedule(this.CHANGE_CURSOR)
|
||||
};
|
||||
this.hideCursor = function() {
|
||||
this.$cursorLayer.hideCursor()
|
||||
};
|
||||
this.showCursor = function() {
|
||||
this.$cursorLayer.showCursor()
|
||||
};
|
||||
this.scrollCursorIntoView = function() {
|
||||
var a = this.$cursorLayer.getPixelPosition(), b = a.left + this.$padding;
|
||||
a = a.top;
|
||||
this.getScrollTop() > a && this.scrollToY(a);
|
||||
this.getScrollTop() + this.$size.scrollerHeight < a + this.lineHeight && this.scrollToY(a + this.lineHeight - this.$size.scrollerHeight);
|
||||
this.scroller.scrollLeft > b && this.scrollToX(b);
|
||||
this.scroller.scrollLeft + this.$size.scrollerWidth < b + this.characterWidth && this.scrollToX(Math.round(b + this.characterWidth - this.$size.scrollerWidth))
|
||||
};
|
||||
this.getScrollTop = function() {
|
||||
return this.scrollTop
|
||||
};
|
||||
this.getScrollLeft = function() {
|
||||
return this.scroller.scrollLeft
|
||||
};
|
||||
this.getScrollTopRow = function() {
|
||||
return this.scrollTop / this.lineHeight
|
||||
};
|
||||
this.scrollToRow = function(a) {
|
||||
this.scrollToY(a * this.lineHeight)
|
||||
};
|
||||
this.scrollToY = function(a) {
|
||||
a = Math.max(0, Math.min(this.lines.length * this.lineHeight - this.$size.scrollerHeight, a));
|
||||
if(this.scrollTop !== a) {
|
||||
this.scrollTop = a;
|
||||
this.$loop.schedule(this.CHANGE_SCROLL)
|
||||
}
|
||||
};
|
||||
this.scrollToX = function(a) {
|
||||
if(a <= this.$padding) {
|
||||
a = 0
|
||||
}this.scroller.scrollLeft = a
|
||||
};
|
||||
this.scrollBy = function(a, b) {
|
||||
b && this.scrollToY(this.scrollTop + b);
|
||||
a && this.scrollToX(this.scroller.scrollLeft + a)
|
||||
};
|
||||
this.screenToTextCoordinates = function(a, b) {
|
||||
var c = this.scroller.getBoundingClientRect();
|
||||
a = Math.round((a + this.scroller.scrollLeft - c.left - this.$padding) / this.characterWidth);
|
||||
b = Math.floor((b + this.scrollTop - c.top) / this.lineHeight);
|
||||
return{row:b, column:this.doc.screenToDocumentColumn(Math.max(0, Math.min(b, this.doc.getLength() - 1)), a)}
|
||||
};
|
||||
this.textToScreenCoordinates = function(a, b) {
|
||||
var c = this.scroller.getBoundingClientRect();
|
||||
b = this.padding + Math.round(this.doc.documentToScreenColumn(a, b) * this.characterWidth);
|
||||
a = a * this.lineHeight;
|
||||
return{pageX:c.left + b - this.getScrollLeft(), pageY:c.top + a - this.getScrollTop()}
|
||||
};
|
||||
this.visualizeFocus = function() {
|
||||
e.addCssClass(this.container, "ace_focus")
|
||||
};
|
||||
this.visualizeBlur = function() {
|
||||
e.removeCssClass(this.container, "ace_focus")
|
||||
};
|
||||
this.showComposition = function() {
|
||||
};
|
||||
this.setCompositionText = function() {
|
||||
};
|
||||
this.hideComposition = function() {
|
||||
};
|
||||
this.setTheme = function(a) {
|
||||
function b(d) {
|
||||
c.$theme && e.removeCssClass(c.container, c.$theme);
|
||||
c.$theme = d ? d.cssClass : null;
|
||||
c.$theme && e.addCssClass(c.container, c.$theme);
|
||||
if(c.$size) {
|
||||
c.$size.width = 0;
|
||||
c.onResize()
|
||||
}
|
||||
}
|
||||
var c = this;
|
||||
if(!a || typeof a == "string") {
|
||||
a = a || "ace/theme/TextMate";
|
||||
require([a], function(d) {
|
||||
b(d)
|
||||
})
|
||||
}else {
|
||||
b(a)
|
||||
}c = this
|
||||
}
|
||||
}).call(j.prototype);
|
||||
return j
|
||||
});
|
||||
154
build/ace/commands/DefaultCommands.js
Normal file
154
build/ace/commands/DefaultCommands.js
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/commands/DefaultCommands", ["ace/PluginManager"], function(b) {
|
||||
b.registerCommand("selectall", function(a, c) {
|
||||
c.selectAll()
|
||||
});
|
||||
b.registerCommand("removeline", function(a) {
|
||||
a.removeLines()
|
||||
});
|
||||
b.registerCommand("gotoline", function(a) {
|
||||
var c = parseInt(prompt("Enter line number:"));
|
||||
isNaN(c) || a.gotoLine(c)
|
||||
});
|
||||
b.registerCommand("togglecomment", function(a) {
|
||||
a.toggleCommentLines()
|
||||
});
|
||||
b.registerCommand("findnext", function(a) {
|
||||
a.findNext()
|
||||
});
|
||||
b.registerCommand("findprevious", function(a) {
|
||||
a.findPrevious()
|
||||
});
|
||||
b.registerCommand("find", function(a) {
|
||||
var c = prompt("Find:");
|
||||
a.find(c)
|
||||
});
|
||||
b.registerCommand("undo", function(a) {
|
||||
a.undo()
|
||||
});
|
||||
b.registerCommand("redo", function(a) {
|
||||
a.redo()
|
||||
});
|
||||
b.registerCommand("redo", function(a) {
|
||||
a.redo()
|
||||
});
|
||||
b.registerCommand("overwrite", function(a) {
|
||||
a.toggleOverwrite()
|
||||
});
|
||||
b.registerCommand("copylinesup", function(a) {
|
||||
a.copyLinesUp()
|
||||
});
|
||||
b.registerCommand("movelinesup", function(a) {
|
||||
a.moveLinesUp()
|
||||
});
|
||||
b.registerCommand("selecttostart", function(a, c) {
|
||||
c.selectFileStart()
|
||||
});
|
||||
b.registerCommand("gotostart", function(a) {
|
||||
a.navigateFileStart()
|
||||
});
|
||||
b.registerCommand("selectup", function(a, c) {
|
||||
c.selectUp()
|
||||
});
|
||||
b.registerCommand("golineup", function(a) {
|
||||
a.navigateUp()
|
||||
});
|
||||
b.registerCommand("copylinesdown", function(a) {
|
||||
a.copyLinesDown()
|
||||
});
|
||||
b.registerCommand("movelinesdown", function(a) {
|
||||
a.moveLinesDown()
|
||||
});
|
||||
b.registerCommand("selecttoend", function(a, c) {
|
||||
c.selectFileEnd()
|
||||
});
|
||||
b.registerCommand("gotoend", function(a) {
|
||||
a.navigateFileEnd()
|
||||
});
|
||||
b.registerCommand("selectdown", function(a, c) {
|
||||
c.selectDown()
|
||||
});
|
||||
b.registerCommand("godown", function(a) {
|
||||
a.navigateDown()
|
||||
});
|
||||
b.registerCommand("selectwordleft", function(a, c) {
|
||||
c.selectWordLeft()
|
||||
});
|
||||
b.registerCommand("gotowordleft", function(a) {
|
||||
a.navigateWordLeft()
|
||||
});
|
||||
b.registerCommand("selecttolinestart", function(a, c) {
|
||||
c.selectLineStart()
|
||||
});
|
||||
b.registerCommand("gotolinestart", function(a) {
|
||||
a.navigateLineStart()
|
||||
});
|
||||
b.registerCommand("selectleft", function(a, c) {
|
||||
c.selectLeft()
|
||||
});
|
||||
b.registerCommand("gotoleft", function(a) {
|
||||
a.navigateLeft()
|
||||
});
|
||||
b.registerCommand("selectwordright", function(a, c) {
|
||||
c.selectWordRight()
|
||||
});
|
||||
b.registerCommand("gotowordright", function(a) {
|
||||
a.navigateWordRight()
|
||||
});
|
||||
b.registerCommand("selecttolineend", function(a, c) {
|
||||
c.selectLineEnd()
|
||||
});
|
||||
b.registerCommand("gotolineend", function(a) {
|
||||
a.navigateLineEnd()
|
||||
});
|
||||
b.registerCommand("selectright", function(a, c) {
|
||||
c.selectRight()
|
||||
});
|
||||
b.registerCommand("gotoright", function(a) {
|
||||
a.navigateRight()
|
||||
});
|
||||
b.registerCommand("selectpagedown", function(a) {
|
||||
a.selectPageDown()
|
||||
});
|
||||
b.registerCommand("pagedown", function(a) {
|
||||
a.scrollPageDown()
|
||||
});
|
||||
b.registerCommand("gotopagedown", function(a) {
|
||||
a.gotoPageDown()
|
||||
});
|
||||
b.registerCommand("selectpageup", function(a) {
|
||||
a.selectPageUp()
|
||||
});
|
||||
b.registerCommand("pageup", function(a) {
|
||||
a.scrollPageUp()
|
||||
});
|
||||
b.registerCommand("gotopageup", function(a) {
|
||||
a.gotoPageUp()
|
||||
});
|
||||
b.registerCommand("selectlinestart", function(a, c) {
|
||||
c.selectLineStart()
|
||||
});
|
||||
b.registerCommand("gotolinestart", function(a) {
|
||||
a.navigateLineStart()
|
||||
});
|
||||
b.registerCommand("selectlineend", function(a, c) {
|
||||
c.selectLineEnd()
|
||||
});
|
||||
b.registerCommand("gotolineend", function(a) {
|
||||
a.navigateLineEnd()
|
||||
});
|
||||
b.registerCommand("del", function(a) {
|
||||
a.removeRight()
|
||||
});
|
||||
b.registerCommand("backspace", function(a) {
|
||||
a.removeLeft()
|
||||
});
|
||||
b.registerCommand("outdent", function(a) {
|
||||
a.blockOutdent()
|
||||
});
|
||||
b.registerCommand("indent", function(a) {
|
||||
a.indent()
|
||||
})
|
||||
});
|
||||
8
build/ace/conf/keybindings/default_mac.js
Normal file
8
build/ace/conf/keybindings/default_mac.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/conf/keybindings/default_mac", function() {
|
||||
return{selectall:"Command-A", removeline:"Command-D", gotoline:"Command-L", togglecomment:"Command-7", findnext:"Command-K", findprevious:"Command-Shift-K", find:"Command-F", replace:"Command-R", undo:"Command-Z", redo:"Command-Shift-Z|Command-Y", overwrite:"Insert", copylinesup:"Command-Option-Up", movelinesup:"Option-Up", selecttostart:"Command-Shift-Up", gotostart:"Command-Home|Command-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Command-Option-Down", movelinesdown:"Option-Down",
|
||||
selecttoend:"Command-Shift-Down", gotoend:"Command-End|Command-Down", selectdown:"Shift-Down", godown:"Down", selectwordleft:"Option-Shift-Left", gotowordleft:"Option-Left", selecttolinestart:"Command-Shift-Left", gotolinestart:"Command-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Option-Shift-Right", gotowordright:"Option-Right", selecttolineend:"Command-Shift-Right", gotolineend:"Command-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown",
|
||||
pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home", selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"}
|
||||
});
|
||||
8
build/ace/conf/keybindings/default_win.js
Normal file
8
build/ace/conf/keybindings/default_win.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/conf/keybindings/default_win", function() {
|
||||
return{selectall:"Ctrl-A", removeline:"Ctrl-D", gotoline:"Ctrl-L", togglecomment:"Ctrl-7", findnext:"Ctrl-K", findprevious:"Ctrl-Shift-K", find:"Ctrl-F", replace:"Ctrl-R", undo:"Ctrl-Z", redo:"Ctrl-Shift-Z|Ctrl-Y", overwrite:"Insert", copylinesup:"Ctrl-Alt-Up", movelinesup:"Alt-Up", selecttostart:"Ctrl-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Ctrl-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down",
|
||||
selectdown:"Shift-Down", godown:"Down", selectwordleft:"Alt-Shift-Left", gotowordleft:"Alt-Left", selecttolinestart:"Ctrl-Shift-Left", gotolinestart:"Ctrl-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Alt-Shift-Right", gotowordright:"Alt-Right", selecttolineend:"Ctrl-Shift-Right", gotolineend:"Ctrl-Right|End", selectright:"Shift-Right", gotoright:"Right", selectpagedown:"Shift-PageDown", pagedown:"PageDown", selectpageup:"Shift-PageUp", pageup:"PageUp", selectlinestart:"Shift-Home",
|
||||
selectlineend:"Shift-End", del:"Delete", backspace:"Backspace", outdent:"Shift-Tab", indent:"Tab"}
|
||||
});
|
||||
71
build/ace/css/editor.css
Normal file
71
build/ace/css/editor.css
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
.ace_editor {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
.ace_scroller {
|
||||
position: absolute;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.ace_gutter {
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
.ace_editor .ace_sb {
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
right: 0;
|
||||
}
|
||||
.ace_editor .ace_sb div {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
left: 0px;
|
||||
}
|
||||
.ace_editor .ace_printMargin {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
}
|
||||
.ace_layer {
|
||||
z-index: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
height: 100%;
|
||||
}
|
||||
.ace_text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
color: black;
|
||||
}
|
||||
.ace_cursor-layer {
|
||||
cursor: text;
|
||||
}
|
||||
.ace_cursor {
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
}
|
||||
.ace_line {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ace_marker-layer {
|
||||
}
|
||||
.ace_marker-layer .ace_step {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
.ace_marker-layer .ace_selection {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
}
|
||||
.ace_marker-layer .ace_bracket {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
}
|
||||
.ace_marker-layer .ace_active_line {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
65
build/ace/layer/Cursor.js
Normal file
65
build/ace/layer/Cursor.js
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/layer/Cursor", ["ace/lib/dom"], function(c) {
|
||||
var d = function(a) {
|
||||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_layer ace_cursor-layer";
|
||||
a.appendChild(this.element);
|
||||
this.cursor = document.createElement("div");
|
||||
this.cursor.className = "ace_cursor";
|
||||
this.isVisible = false
|
||||
};
|
||||
(function() {
|
||||
this.setDocument = function(a) {
|
||||
this.doc = a
|
||||
};
|
||||
this.setCursor = function(a, b) {
|
||||
this.position = {row:a.row, column:this.doc.documentToScreenColumn(a.row, a.column)};
|
||||
b ? c.addCssClass(this.cursor, "ace_overwrite") : c.removeCssClass(this.cursor, "ace_overwrite")
|
||||
};
|
||||
this.hideCursor = function() {
|
||||
this.isVisible = false;
|
||||
this.cursor.parentNode && this.cursor.parentNode.removeChild(this.cursor);
|
||||
clearInterval(this.blinkId)
|
||||
};
|
||||
this.showCursor = function() {
|
||||
this.isVisible = true;
|
||||
this.element.appendChild(this.cursor);
|
||||
this.cursor.style.visibility = "visible";
|
||||
this.restartTimer()
|
||||
};
|
||||
this.restartTimer = function() {
|
||||
clearInterval(this.blinkId);
|
||||
if(this.isVisible) {
|
||||
var a = this.cursor;
|
||||
this.blinkId = setInterval(function() {
|
||||
a.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
a.style.visibility = "visible"
|
||||
}, 400)
|
||||
}, 1E3)
|
||||
}
|
||||
};
|
||||
this.getPixelPosition = function() {
|
||||
if(!this.config || !this.position) {
|
||||
return{left:0, top:0}
|
||||
}var a = this.position.row * this.config.lineHeight;
|
||||
return{left:Math.round(this.position.column * this.config.characterWidth), top:a}
|
||||
};
|
||||
this.update = function(a) {
|
||||
if(this.position) {
|
||||
this.config = a;
|
||||
var b = Math.round(this.position.column * a.characterWidth), e = this.position.row * a.lineHeight;
|
||||
this.pixelPos = {left:b, top:e};
|
||||
this.cursor.style.left = b + "px";
|
||||
this.cursor.style.top = e - a.firstRow * a.lineHeight + "px";
|
||||
this.cursor.style.width = a.characterWidth + "px";
|
||||
this.cursor.style.height = a.lineHeight + "px";
|
||||
this.isVisible && this.element.appendChild(this.cursor);
|
||||
this.restartTimer()
|
||||
}
|
||||
}
|
||||
}).call(d.prototype);
|
||||
return d
|
||||
});
|
||||
33
build/ace/layer/Gutter.js
Normal file
33
build/ace/layer/Gutter.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/layer/Gutter", [], function() {
|
||||
var d = function(a) {
|
||||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_layer ace_gutter-layer";
|
||||
a.appendChild(this.element);
|
||||
this.$breakpoints = [];
|
||||
this.$decorations = []
|
||||
};
|
||||
(function() {
|
||||
this.addGutterDecoration = function(a, b) {
|
||||
this.$decorations[a] || (this.$decorations[a] = "");
|
||||
this.$decorations[a] += " ace_" + b
|
||||
};
|
||||
this.removeGutterDecoration = function(a, b) {
|
||||
this.$decorations[a] = this.$decorations[a].replace(" ace_" + b, "")
|
||||
};
|
||||
this.setBreakpoints = function(a) {
|
||||
this.$breakpoints = a.concat()
|
||||
};
|
||||
this.update = function(a) {
|
||||
this.$config = a;
|
||||
for(var b = [], c = a.firstRow;c <= a.lastRow;c++) {
|
||||
b.push("<div class='ace_gutter-cell", this.$decorations[c] || "", this.$breakpoints[c] ? " ace_breakpoint" : "", "' style='height:", a.lineHeight, "px;'>", c + 1, "</div>");
|
||||
b.push("</div>")
|
||||
}this.element.innerHTML = b.join("");
|
||||
this.element.style.height = a.minHeight + "px"
|
||||
}
|
||||
}).call(d.prototype);
|
||||
return d
|
||||
});
|
||||
74
build/ace/layer/Marker.js
Normal file
74
build/ace/layer/Marker.js
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/layer/Marker", ["ace/Range"], function(h) {
|
||||
var i = function(c) {
|
||||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_layer ace_marker-layer";
|
||||
c.appendChild(this.element);
|
||||
this.markers = {};
|
||||
this.$markerId = 1
|
||||
};
|
||||
(function() {
|
||||
this.setDocument = function(c) {
|
||||
this.doc = c
|
||||
};
|
||||
this.addMarker = function(c, a, e) {
|
||||
var b = this.$markerId++;
|
||||
this.markers[b] = {range:c, type:e || "line", clazz:a};
|
||||
return b
|
||||
};
|
||||
this.removeMarker = function(c) {
|
||||
this.markers[c] && delete this.markers[c]
|
||||
};
|
||||
this.update = function(c) {
|
||||
if(c = c || this.config) {
|
||||
this.config = c;
|
||||
var a = [];
|
||||
for(var e in this.markers) {
|
||||
var b = this.markers[e], d = b.range.clipRows(c.firstRow, c.lastRow);
|
||||
if(!d.isEmpty()) {
|
||||
if(d.isMultiLine()) {
|
||||
b.type == "text" ? this.drawTextMarker(a, d, b.clazz, c) : this.drawMultiLineMarker(a, d, b.clazz, c)
|
||||
}else {
|
||||
this.drawSingleLineMarker(a, d, b.clazz, c)
|
||||
}
|
||||
}
|
||||
}this.element.innerHTML = a.join("")
|
||||
}
|
||||
};
|
||||
this.drawTextMarker = function(c, a, e, b) {
|
||||
var d = a.start.row, f = new h(d, a.start.column, d, this.doc.getLine(d).length);
|
||||
this.drawSingleLineMarker(c, f, e, b);
|
||||
d = a.end.row;
|
||||
f = new h(d, 0, d, a.end.column);
|
||||
this.drawSingleLineMarker(c, f, e, b);
|
||||
for(d = a.start.row + 1;d < a.end.row;d++) {
|
||||
f.start.row = d;
|
||||
f.end.row = d;
|
||||
f.end.column = this.doc.getLine(d).length;
|
||||
this.drawSingleLineMarker(c, f, e, b)
|
||||
}
|
||||
};
|
||||
this.drawMultiLineMarker = function(c, a, e, b) {
|
||||
a = a.toScreenRange(this.doc);
|
||||
var d = b.lineHeight, f = Math.round(b.width - a.start.column * b.characterWidth), g = (a.start.row - b.firstRow) * b.lineHeight, j = Math.round(a.start.column * b.characterWidth);
|
||||
c.push("<div class='", e, "' style='", "height:", d, "px;", "width:", f, "px;", "top:", g, "px;", "left:", j, "px;'></div>");
|
||||
g = (a.end.row - b.firstRow) * b.lineHeight;
|
||||
f = Math.round(a.end.column * b.characterWidth);
|
||||
c.push("<div class='", e, "' style='", "height:", d, "px;", "top:", g, "px;", "width:", f, "px;'></div>");
|
||||
d = (a.end.row - a.start.row - 1) * b.lineHeight;
|
||||
if(!(d < 0)) {
|
||||
g = (a.start.row + 1 - b.firstRow) * b.lineHeight;
|
||||
c.push("<div class='", e, "' style='", "height:", d, "px;", "width:", b.width, "px;", "top:", g, "px;'></div>")
|
||||
}
|
||||
};
|
||||
this.drawSingleLineMarker = function(c, a, e, b) {
|
||||
a = a.toScreenRange(this.doc);
|
||||
var d = b.lineHeight, f = Math.round((a.end.column - a.start.column) * b.characterWidth), g = (a.start.row - b.firstRow) * b.lineHeight;
|
||||
a = Math.round(a.start.column * b.characterWidth);
|
||||
c.push("<div class='", e, "' style='", "height:", d, "px;", "width:", f, "px;", "top:", g, "px;", "left:", a, "px;'></div>")
|
||||
}
|
||||
}).call(i.prototype);
|
||||
return i
|
||||
});
|
||||
158
build/ace/layer/Text.js
Normal file
158
build/ace/layer/Text.js
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/layer/Text", ["ace/lib/oop", "ace/lib/dom", "ace/MEventEmitter"], function(m, n, o) {
|
||||
var k = function(a) {
|
||||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_layer ace_text-layer";
|
||||
a.appendChild(this.element);
|
||||
this.$characterSize = this.$measureSizes();
|
||||
this.$pollSizeChanges()
|
||||
};
|
||||
(function() {
|
||||
m.implement(this, o);
|
||||
this.EOF_CHAR = "¶";
|
||||
this.EOL_CHAR = "¬";
|
||||
this.TAB_CHAR = "→";
|
||||
this.SPACE_CHAR = "·";
|
||||
this.setTokenizer = function(a) {
|
||||
this.tokenizer = a
|
||||
};
|
||||
this.getLineHeight = function() {
|
||||
return this.$characterSize.height || 1
|
||||
};
|
||||
this.getCharacterWidth = function() {
|
||||
return this.$characterSize.width || 1
|
||||
};
|
||||
this.$pollSizeChanges = function() {
|
||||
var a = this;
|
||||
setInterval(function() {
|
||||
var b = a.$measureSizes();
|
||||
if(a.$characterSize.width !== b.width || a.$characterSize.height !== b.height) {
|
||||
a.$characterSize = b;
|
||||
a.$dispatchEvent("changeCharaterSize", {data:b})
|
||||
}
|
||||
}, 500)
|
||||
};
|
||||
this.$fontStyles = {fontFamily:1, fontSize:1, fontWeight:1, fontStyle:1, lineHeight:1};
|
||||
this.$measureSizes = function() {
|
||||
var a = document.createElement("div"), b = a.style;
|
||||
b.width = b.height = "auto";
|
||||
b.left = b.top = "-1000px";
|
||||
b.visibility = "hidden";
|
||||
b.position = "absolute";
|
||||
b.overflow = "visible";
|
||||
for(var e in this.$fontStyles) {
|
||||
var f = n.computedStyle(this.element, e);
|
||||
b[e] = f
|
||||
}a.innerHTML = (new Array(1E3)).join("Xy");
|
||||
document.body.insertBefore(a, document.body.firstChild);
|
||||
b = {height:a.offsetHeight, width:a.offsetWidth / 2E3};
|
||||
document.body.removeChild(a);
|
||||
return b
|
||||
};
|
||||
this.setDocument = function(a) {
|
||||
this.doc = a
|
||||
};
|
||||
this.$showInvisibles = false;
|
||||
this.setShowInvisibles = function(a) {
|
||||
this.$showInvisibles = a
|
||||
};
|
||||
this.$computeTabString = function() {
|
||||
var a = this.doc.getTabSize();
|
||||
if(this.$showInvisibles) {
|
||||
a = a / 2;
|
||||
this.$tabString = "<span class='ace_invisible'>" + (new Array(Math.floor(a))).join(" ") + this.TAB_CHAR + (new Array(Math.ceil(a) + 1)).join(" ") + "</span>"
|
||||
}else {
|
||||
this.$tabString = (new Array(a + 1)).join(" ")
|
||||
}
|
||||
};
|
||||
this.updateLines = function(a, b, e) {
|
||||
this.$computeTabString();
|
||||
var f = Math.max(b, a.firstRow), c = Math.min(e, a.lastRow), d = this.element.childNodes, h = this;
|
||||
this.tokenizer.getTokens(f, c, function(i) {
|
||||
for(var g = f;g <= c;g++) {
|
||||
var j = d[g - a.firstRow];
|
||||
if(j) {
|
||||
var l = [];
|
||||
h.$renderLine(l, g, i[g - f].tokens);
|
||||
j.innerHTML = l.join("")
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
this.scrollLines = function(a) {
|
||||
function b(i) {
|
||||
a.firstRow < c.firstRow ? f.$renderLinesFragment(a, a.firstRow, c.firstRow - 1, function(g) {
|
||||
d.firstChild ? d.insertBefore(g, d.firstChild) : d.appendChild(g);
|
||||
i()
|
||||
}) : i()
|
||||
}
|
||||
function e() {
|
||||
a.lastRow > c.lastRow && f.$renderLinesFragment(a, c.lastRow + 1, a.lastRow, function(i) {
|
||||
d.appendChild(i)
|
||||
})
|
||||
}
|
||||
var f = this;
|
||||
this.$computeTabString();
|
||||
var c = this.config;
|
||||
this.config = a;
|
||||
if(!c || c.lastRow < a.firstRow) {
|
||||
return this.update(a)
|
||||
}if(a.lastRow < c.firstRow) {
|
||||
return this.update(a)
|
||||
}var d = this.element;
|
||||
if(c.firstRow < a.firstRow) {
|
||||
for(var h = c.firstRow;h < a.firstRow;h++) {
|
||||
d.removeChild(d.firstChild)
|
||||
}
|
||||
}if(c.lastRow > a.lastRow) {
|
||||
for(h = a.lastRow + 1;h <= c.lastRow;h++) {
|
||||
d.removeChild(d.lastChild)
|
||||
}
|
||||
}b(e)
|
||||
};
|
||||
this.$renderLinesFragment = function(a, b, e, f) {
|
||||
var c = document.createDocumentFragment(), d = this;
|
||||
this.tokenizer.getTokens(b, e, function(h) {
|
||||
for(var i = b;i <= e;i++) {
|
||||
var g = document.createElement("div");
|
||||
g.className = "ace_line";
|
||||
var j = g.style;
|
||||
j.height = d.$characterSize.height + "px";
|
||||
j.width = a.width + "px";
|
||||
j = [];
|
||||
d.$renderLine(j, i, h[i - b].tokens);
|
||||
g.innerHTML = j.join("");
|
||||
c.appendChild(g)
|
||||
}f(c)
|
||||
})
|
||||
};
|
||||
this.update = function(a) {
|
||||
this.$computeTabString();
|
||||
var b = [], e = this;
|
||||
this.tokenizer.getTokens(a.firstRow, a.lastRow, function(f) {
|
||||
for(var c = a.firstRow;c <= a.lastRow;c++) {
|
||||
b.push("<div class='ace_line' style='height:" + e.$characterSize.height + "px;", "width:", a.width, "px'>");
|
||||
e.$renderLine(b, c, f[c - a.firstRow].tokens);
|
||||
b.push("</div>")
|
||||
}e.element.innerHTML = b.join("")
|
||||
})
|
||||
};
|
||||
this.$textToken = {text:true, rparen:true, lparen:true};
|
||||
this.$renderLine = function(a, b, e) {
|
||||
for(var f = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g, c = 0;c < e.length;c++) {
|
||||
var d = e[c], h = d.value.replace(/&/g, "&").replace(/</g, "<").replace(f, " ").replace(/\t/g, this.$tabString);
|
||||
if(this.$textToken[d.type]) {
|
||||
a.push(h)
|
||||
}else {
|
||||
d = "ace_" + d.type.replace(/\./g, " ace_");
|
||||
a.push("<span class='", d, "'>", h, "</span>")
|
||||
}
|
||||
}if(this.$showInvisibles) {
|
||||
b !== this.doc.getLength() - 1 ? a.push("<span class='ace_invisible'>" + this.EOL_CHAR + "</span>") : a.push("<span class='ace_invisible'>" + this.EOF_CHAR + "</span>")
|
||||
}
|
||||
}
|
||||
}).call(k.prototype);
|
||||
return k
|
||||
});
|
||||
22
build/ace/lib/core.js
Normal file
22
build/ace/lib/core.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
if(!require.def) {
|
||||
require.def = require("requireJS-node")(module, require)
|
||||
}require.def("ace/lib/core", function() {
|
||||
var a = {}, d = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
||||
a.isWin = d == "win";
|
||||
a.isMac = d == "mac";
|
||||
a.isLinux = d == "linux";
|
||||
a.isIE = !+"\u000b1";
|
||||
a.isGecko = window.controllers && window.navigator.product === "Gecko";
|
||||
a.provide = function(b) {
|
||||
b = b.split(".");
|
||||
for(var c = window, e = 0;e < b.length;e++) {
|
||||
var f = b[e];
|
||||
c[f] || (c[f] = {});
|
||||
c = c[f]
|
||||
}
|
||||
};
|
||||
return a
|
||||
});
|
||||
70
build/ace/lib/dom.js
Normal file
70
build/ace/lib/dom.js
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
if(!require.def) {
|
||||
require.def = require("requireJS-node")(module, require)
|
||||
}require.def("ace/lib/dom", ["ace/lib/lang"], function(f) {
|
||||
var c = {};
|
||||
c.setText = function(a, b) {
|
||||
if(a.innerText !== undefined) {
|
||||
a.innerText = b
|
||||
}if(a.textContent !== undefined) {
|
||||
a.textContent = b
|
||||
}
|
||||
};
|
||||
c.hasCssClass = function(a, b) {
|
||||
a = a.className.split(/\s+/g);
|
||||
return f.arrayIndexOf(a, b) !== -1
|
||||
};
|
||||
c.addCssClass = function(a, b) {
|
||||
c.hasCssClass(a, b) || (a.className += " " + b)
|
||||
};
|
||||
c.removeCssClass = function(a, b) {
|
||||
for(var d = a.className.split(/\s+/g);;) {
|
||||
var e = f.arrayIndexOf(d, b);
|
||||
if(e == -1) {
|
||||
break
|
||||
}d.splice(e, 1)
|
||||
}a.className = d.join(" ")
|
||||
};
|
||||
c.importCssString = function(a, b) {
|
||||
b = b || document;
|
||||
if(b.createStyleSheet) {
|
||||
b.createStyleSheet().cssText = a
|
||||
}else {
|
||||
var d = b.createElement("style");
|
||||
d.appendChild(b.createTextNode(a));
|
||||
b.getElementsByTagName("head")[0].appendChild(d)
|
||||
}
|
||||
};
|
||||
c.getInnerWidth = function(a) {
|
||||
return parseInt(c.computedStyle(a, "paddingLeft")) + parseInt(c.computedStyle(a, "paddingRight")) + a.clientWidth
|
||||
};
|
||||
c.getInnerHeight = function(a) {
|
||||
return parseInt(c.computedStyle(a, "paddingTop")) + parseInt(c.computedStyle(a, "paddingBottom")) + a.clientHeight
|
||||
};
|
||||
c.computedStyle = function(a, b) {
|
||||
return window.getComputedStyle ? (window.getComputedStyle(a, "") || {})[b] || "" : a.currentStyle[b]
|
||||
};
|
||||
c.scrollbarWidth = function() {
|
||||
var a = document.createElement("p");
|
||||
a.style.width = "100%";
|
||||
a.style.height = "200px";
|
||||
var b = document.createElement("div"), d = b.style;
|
||||
d.position = "absolute";
|
||||
d.left = "-10000px";
|
||||
d.overflow = "hidden";
|
||||
d.width = "200px";
|
||||
d.height = "150px";
|
||||
b.appendChild(a);
|
||||
document.body.appendChild(b);
|
||||
var e = a.offsetWidth;
|
||||
d.overflow = "scroll";
|
||||
a = a.offsetWidth;
|
||||
if(e == a) {
|
||||
a = b.clientWidth
|
||||
}document.body.removeChild(b);
|
||||
return e - a
|
||||
};
|
||||
return c
|
||||
});
|
||||
139
build/ace/lib/event.js
Normal file
139
build/ace/lib/event.js
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
if(!require.def) {
|
||||
require.def = require("requireJS-node")(module, require)
|
||||
}require.def("ace/lib/event", ["ace/lib/core"], function(i) {
|
||||
var c = {};
|
||||
c.addListener = function(a, e, d) {
|
||||
if(a.addEventListener) {
|
||||
return a.addEventListener(e, d, false)
|
||||
}if(a.attachEvent) {
|
||||
var b = function() {
|
||||
d(window.event)
|
||||
};
|
||||
d.$$wrapper = b;
|
||||
a.attachEvent("on" + e, b)
|
||||
}
|
||||
};
|
||||
c.removeListener = function(a, e, d) {
|
||||
if(a.removeEventListener) {
|
||||
return a.removeEventListener(e, d, false)
|
||||
}if(a.detachEvent) {
|
||||
a.detachEvent("on" + e, d.$$wrapper || d)
|
||||
}
|
||||
};
|
||||
c.stopEvent = function(a) {
|
||||
c.stopPropagation(a);
|
||||
c.preventDefault(a);
|
||||
return false
|
||||
};
|
||||
c.stopPropagation = function(a) {
|
||||
if(a.stopPropagation) {
|
||||
a.stopPropagation()
|
||||
}else {
|
||||
a.cancelBubble = true
|
||||
}
|
||||
};
|
||||
c.preventDefault = function(a) {
|
||||
if(a.preventDefault) {
|
||||
a.preventDefault()
|
||||
}else {
|
||||
a.returnValue = false
|
||||
}
|
||||
};
|
||||
c.getDocumentX = function(a) {
|
||||
return a.clientX ? a.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) : a.pageX
|
||||
};
|
||||
c.getDocumentY = function(a) {
|
||||
return a.clientY ? a.clientY + (document.documentElement.scrollTop || document.body.scrollTop) : a.pageX
|
||||
};
|
||||
c.getButton = function(a) {
|
||||
return a.preventDefault ? a.button : Math.max(a.button - 1, 2)
|
||||
};
|
||||
c.capture = document.documentElement.setCapture ? function(a, e, d) {
|
||||
function b(h) {
|
||||
e && e(h);
|
||||
d && d();
|
||||
c.removeListener(a, "mousemove", e);
|
||||
c.removeListener(a, "mouseup", b);
|
||||
c.removeListener(a, "losecapture", b);
|
||||
a.releaseCapture()
|
||||
}
|
||||
c.addListener(a, "mousemove", e);
|
||||
c.addListener(a, "mouseup", b);
|
||||
c.addListener(a, "losecapture", b);
|
||||
a.setCapture()
|
||||
} : function(a, e, d) {
|
||||
function b(f) {
|
||||
e(f);
|
||||
f.stopPropagation()
|
||||
}
|
||||
function h(f) {
|
||||
e && e(f);
|
||||
d && d();
|
||||
document.removeEventListener("mousemove", b, true);
|
||||
document.removeEventListener("mouseup", h, true);
|
||||
f.stopPropagation()
|
||||
}
|
||||
document.addEventListener("mousemove", b, true);
|
||||
document.addEventListener("mouseup", h, true)
|
||||
};
|
||||
c.addMouseWheelListener = function(a, e) {
|
||||
var d = function(b) {
|
||||
if(b.wheelDelta !== undefined) {
|
||||
if(b.wheelDeltaX !== undefined) {
|
||||
b.wheelX = -b.wheelDeltaX / 8;
|
||||
b.wheelY = -b.wheelDeltaY / 8
|
||||
}else {
|
||||
b.wheelX = 0;
|
||||
b.wheelY = -b.wheelDelta / 8
|
||||
}
|
||||
}else {
|
||||
if(b.axis && b.axis == b.HORIZONTAL_AXIS) {
|
||||
b.wheelX = (b.detail || 0) * 5;
|
||||
b.wheelY = 0
|
||||
}else {
|
||||
b.wheelX = 0;
|
||||
b.wheelY = (b.detail || 0) * 5
|
||||
}
|
||||
}e(b)
|
||||
};
|
||||
c.addListener(a, "DOMMouseScroll", d);
|
||||
c.addListener(a, "mousewheel", d)
|
||||
};
|
||||
c.addMultiMouseDownListener = function(a, e, d, b, h) {
|
||||
var f = 0, j, k, l = function(g) {
|
||||
f += 1;
|
||||
if(f == 1) {
|
||||
j = g.clientX;
|
||||
k = g.clientY;
|
||||
setTimeout(function() {
|
||||
f = 0
|
||||
}, b || 600)
|
||||
}if(c.getButton(g) != e || Math.abs(g.clientX - j) > 5 || Math.abs(g.clientY - k) > 5) {
|
||||
f = 0
|
||||
}if(f == d) {
|
||||
f = 0;
|
||||
h(g)
|
||||
}return c.preventDefault(g)
|
||||
};
|
||||
c.addListener(a, "mousedown", l);
|
||||
i.isIE && c.addListener(a, "dblclick", l)
|
||||
};
|
||||
c.addKeyListener = function(a, e) {
|
||||
var d = null;
|
||||
c.addListener(a, "keydown", function(b) {
|
||||
d = b.keyIdentifier || b.keyCode;
|
||||
return e(b)
|
||||
});
|
||||
i.isMac && i.isGecko && c.addListener(a, "keypress", function(b) {
|
||||
if(d !== (b.keyIdentifier || b.keyCode)) {
|
||||
return e(b)
|
||||
}else {
|
||||
d = null
|
||||
}
|
||||
})
|
||||
};
|
||||
return c
|
||||
});
|
||||
61
build/ace/lib/lang.js
Normal file
61
build/ace/lib/lang.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
if(!require.def) {
|
||||
require.def = require("requireJS-node")(module, require)
|
||||
}require.def("ace/lib/lang", function() {
|
||||
var d = {};
|
||||
d.stringReverse = function(a) {
|
||||
return a.split("").reverse().join("")
|
||||
};
|
||||
d.stringRepeat = function(a, b) {
|
||||
return(new Array(b + 1)).join(a)
|
||||
};
|
||||
d.arrayIndexOf = Array.prototype.indexOf ? function(a, b) {
|
||||
return a.indexOf(b)
|
||||
} : function(a, b) {
|
||||
for(var c = 0;c < a.length;c++) {
|
||||
if(a[c] == b) {
|
||||
return c
|
||||
}
|
||||
}return-1
|
||||
};
|
||||
d.isArray = function(a) {
|
||||
return Object.prototype.toString.call(a) == "[object Array]"
|
||||
};
|
||||
d.copyObject = function(a) {
|
||||
var b = {};
|
||||
for(var c in a) {
|
||||
b[c] = a[c]
|
||||
}return b
|
||||
};
|
||||
d.arrayToMap = function(a) {
|
||||
for(var b = {}, c = 0;c < a.length;c++) {
|
||||
b[a[c]] = 1
|
||||
}return b
|
||||
};
|
||||
d.escapeRegExp = function(a) {
|
||||
return a.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1")
|
||||
};
|
||||
d.bind = function(a, b) {
|
||||
return function() {
|
||||
return a.apply(b, arguments)
|
||||
}
|
||||
};
|
||||
d.deferredCall = function(a) {
|
||||
var b = null, c = function() {
|
||||
b = null;
|
||||
a()
|
||||
};
|
||||
return{schedule:function() {
|
||||
b || (b = setTimeout(c, 0))
|
||||
}, call:function() {
|
||||
d.cancel();
|
||||
a()
|
||||
}, cancel:function() {
|
||||
clearTimeout(b);
|
||||
b = null
|
||||
}}
|
||||
};
|
||||
return d
|
||||
});
|
||||
25
build/ace/lib/oop.js
Normal file
25
build/ace/lib/oop.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
if(!require.def) {
|
||||
require.def = require("requireJS-node")(module, require)
|
||||
}require.def("ace/lib/oop", function() {
|
||||
var c = {};
|
||||
c.inherits = function(a, b) {
|
||||
var d = function() {
|
||||
};
|
||||
d.prototype = b.prototype;
|
||||
a.super_ = b.prototype;
|
||||
a.prototype = new d;
|
||||
a.prototype.constructor = a
|
||||
};
|
||||
c.mixin = function(a, b) {
|
||||
for(var d in b) {
|
||||
a[d] = b[d]
|
||||
}
|
||||
};
|
||||
c.implement = function(a, b) {
|
||||
c.mixin(a, b)
|
||||
};
|
||||
return c
|
||||
});
|
||||
81
build/ace/mode/Css.js
Normal file
81
build/ace/mode/Css.js
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/CssHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/TextHighlightRules"], function(j, f, b) {
|
||||
var e = function() {
|
||||
function a(c) {
|
||||
var l = [];
|
||||
c = c.split("");
|
||||
for(var k = 0;k < c.length;k++) {
|
||||
l.push("[", c[k].toLowerCase(), c[k].toUpperCase(), "]")
|
||||
}return l.join("")
|
||||
}
|
||||
var d = f.arrayToMap("azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|-moz-border-radius|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index".split("|")),
|
||||
g = f.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), h = f.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero".split("|")),
|
||||
i = f.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|"));
|
||||
this.$rules = {start:[{token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("em")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ex")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("px")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" +
|
||||
a("cm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("mm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("in")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pt")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pc")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("deg")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" +
|
||||
a("rad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("grad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ms")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("s")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("hz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("khz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))%"},
|
||||
{token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{6}"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{3}"}, {token:"lparen", regex:"{"}, {token:"rparen", regex:"}"}, {token:function(c) {
|
||||
return d[c.toLowerCase()] ? "support.type" : g[c.toLowerCase()] ? "support.function" : h[c.toLowerCase()] ? "support.constant" : i[c.toLowerCase()] ? "support.constant.color" : "text"
|
||||
}, regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}]}
|
||||
};
|
||||
j.inherits(e, b);
|
||||
return e
|
||||
});
|
||||
require.def("ace/mode/MatchingBraceOutdent", ["ace/Range"], function(j) {
|
||||
var f = function() {
|
||||
};
|
||||
(function() {
|
||||
this.checkOutdent = function(b, e) {
|
||||
if(!/^\s+$/.test(b)) {
|
||||
return false
|
||||
}return/^\s*\}/.test(e)
|
||||
};
|
||||
this.autoOutdent = function(b, e) {
|
||||
var a = b.getLine(e).match(/^(\s*\})/);
|
||||
if(!a) {
|
||||
return 0
|
||||
}a = a[1].length;
|
||||
var d = b.findMatchingBracket({row:e, column:a});
|
||||
if(!d || d.row == e) {
|
||||
return 0
|
||||
}d = this.$getIndent(b.getLine(d.row));
|
||||
b.replace(new j(e, 0, e, a - 1), d);
|
||||
return d.length - (a - 1)
|
||||
};
|
||||
this.$getIndent = function(b) {
|
||||
if(b = b.match(/^(\s+)/)) {
|
||||
return b[1]
|
||||
}return""
|
||||
}
|
||||
}).call(f.prototype);
|
||||
return f
|
||||
});
|
||||
require.def("ace/mode/Css", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/CssHighlightRules", "ace/mode/MatchingBraceOutdent"], function(j, f, b, e, a) {
|
||||
var d = function() {
|
||||
this.$tokenizer = new b((new e).getRules());
|
||||
this.$outdent = new a
|
||||
};
|
||||
j.inherits(d, f);
|
||||
(function() {
|
||||
this.getNextLineIndent = function(g, h, i) {
|
||||
var c = this.$getIndent(h);
|
||||
g = this.$tokenizer.getLineTokens(h, g).tokens;
|
||||
if(g.length && g[g.length - 1].type == "comment") {
|
||||
return c
|
||||
}if(h.match(/^.*\{\s*$/)) {
|
||||
c += i
|
||||
}return c
|
||||
};
|
||||
this.checkOutdent = function(g, h, i) {
|
||||
return this.$outdent.checkOutdent(h, i)
|
||||
};
|
||||
this.autoOutdent = function(g, h, i) {
|
||||
return this.$outdent.autoOutdent(h, i)
|
||||
}
|
||||
}).call(d.prototype);
|
||||
return d
|
||||
});
|
||||
25
build/ace/mode/CssHighlightRules.js
Normal file
25
build/ace/mode/CssHighlightRules.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/CssHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/TextHighlightRules"], function(g, c, h) {
|
||||
var f = function() {
|
||||
function a(b) {
|
||||
var e = [];
|
||||
b = b.split("");
|
||||
for(var d = 0;d < b.length;d++) {
|
||||
e.push("[", b[d].toLowerCase(), b[d].toUpperCase(), "]")
|
||||
}return e.join("")
|
||||
}
|
||||
var i = c.arrayToMap("azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|-moz-border-radius|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index".split("|")),
|
||||
j = c.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), k = c.arrayToMap("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero".split("|")),
|
||||
l = c.arrayToMap("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow".split("|"));
|
||||
this.$rules = {start:[{token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("em")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ex")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("px")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" +
|
||||
a("cm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("mm")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("in")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pt")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("pc")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("deg")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" +
|
||||
a("rad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("grad")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("ms")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("s")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("hz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))" + a("khz")}, {token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))%"},
|
||||
{token:"constant.numeric", regex:"\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{6}"}, {token:"constant.numeric", regex:"#[a-fA-F0-9]{3}"}, {token:"lparen", regex:"{"}, {token:"rparen", regex:"}"}, {token:function(b) {
|
||||
return i[b.toLowerCase()] ? "support.type" : j[b.toLowerCase()] ? "support.function" : k[b.toLowerCase()] ? "support.constant" : l[b.toLowerCase()] ? "support.constant.color" : "text"
|
||||
}, regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}]}
|
||||
};
|
||||
g.inherits(f, h);
|
||||
return f
|
||||
});
|
||||
15
build/ace/mode/DocCommentHighlightRules.js
Normal file
15
build/ace/mode/DocCommentHighlightRules.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/DocCommentHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(b, c) {
|
||||
var a = function() {
|
||||
this.$rules = {start:[{token:"comment.doc", regex:"\\*\\/", next:"start"}, {token:"comment.doc.tag", regex:"@[\\w\\d_]+"}, {token:"comment.doc", regex:"s+"}, {token:"comment.doc", regex:"[^@\\*]+"}, {token:"comment.doc", regex:"."}]}
|
||||
};
|
||||
b.inherits(a, c);
|
||||
(function() {
|
||||
this.getStartRule = function(d) {
|
||||
return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:d}
|
||||
}
|
||||
}).call(a.prototype);
|
||||
return a
|
||||
});
|
||||
58
build/ace/mode/Html.js
Normal file
58
build/ace/mode/Html.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/HtmlHighlightRules", ["ace/lib/oop", "ace/mode/CssHighlightRules", "ace/mode/JavaScriptHighlightRules", "ace/mode/TextHighlightRules"], function(e, f, g, h) {
|
||||
var c = function() {
|
||||
this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<(?=s*script)", next:"script"}, {token:"text", regex:"<(?=s*style)", next:"css"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], script:[{token:"text", regex:">", next:"js-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"},
|
||||
{token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], css:[{token:"text", regex:">", next:"css-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", next:"start"},
|
||||
{token:"text", regex:"\\s+"}, {token:"text", regex:".+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]};
|
||||
this.addRules((new g).getRules(), "js-");
|
||||
this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"});
|
||||
this.addRules((new f).getRules(), "css-");
|
||||
this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"})
|
||||
};
|
||||
e.inherits(c, h);
|
||||
return c
|
||||
});
|
||||
require.def("ace/mode/Html", ["ace/lib/oop", "ace/mode/Text", "ace/mode/JavaScript", "ace/mode/Css", "ace/Tokenizer", "ace/mode/HtmlHighlightRules"], function(e, f, g, h, c, l) {
|
||||
var i = function() {
|
||||
this.$tokenizer = new c((new l).getRules());
|
||||
this.$js = new g;
|
||||
this.$css = new h
|
||||
};
|
||||
e.inherits(i, f);
|
||||
(function() {
|
||||
this.toggleCommentLines = function() {
|
||||
return this.$delegate("toggleCommentLines", arguments, function() {
|
||||
return 0
|
||||
})
|
||||
};
|
||||
this.getNextLineIndent = function(j, a) {
|
||||
var d = this;
|
||||
return this.$delegate("getNextLineIndent", arguments, function() {
|
||||
return d.$getIndent(a)
|
||||
})
|
||||
};
|
||||
this.checkOutdent = function() {
|
||||
return this.$delegate("checkOutdent", arguments, function() {
|
||||
return false
|
||||
})
|
||||
};
|
||||
this.autoOutdent = function() {
|
||||
return this.$delegate("autoOutdent", arguments)
|
||||
};
|
||||
this.$delegate = function(j, a, d) {
|
||||
var k = a[0], b = k.split("js-");
|
||||
if(!b[0] && b[1]) {
|
||||
a[0] = b[1];
|
||||
return this.$js[j].apply(this.$js, a)
|
||||
}b = k.split("css-");
|
||||
if(!b[0] && b[1]) {
|
||||
a[0] = b[1];
|
||||
return this.$css[j].apply(this.$css, a)
|
||||
}return d ? d() : undefined
|
||||
}
|
||||
}).call(i.prototype);
|
||||
return i
|
||||
});
|
||||
16
build/ace/mode/HtmlHighlightRules.js
Normal file
16
build/ace/mode/HtmlHighlightRules.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/HtmlHighlightRules", ["ace/lib/oop", "ace/mode/CssHighlightRules", "ace/mode/JavaScriptHighlightRules", "ace/mode/TextHighlightRules"], function(b, c, d, e) {
|
||||
var a = function() {
|
||||
this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<(?=s*script)", next:"script"}, {token:"text", regex:"<(?=s*style)", next:"css"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], script:[{token:"text", regex:">", next:"js-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"},
|
||||
{token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], css:[{token:"text", regex:">", next:"css-start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>", next:"start"},
|
||||
{token:"text", regex:"\\s+"}, {token:"text", regex:".+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]};
|
||||
this.addRules((new d).getRules(), "js-");
|
||||
this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"});
|
||||
this.addRules((new c).getRules(), "css-");
|
||||
this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"})
|
||||
};
|
||||
b.inherits(a, e);
|
||||
return a
|
||||
});
|
||||
61
build/ace/mode/JavaScript.js
Normal file
61
build/ace/mode/JavaScript.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/JavaScript", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/JavaScriptHighlightRules", "ace/mode/MatchingBraceOutdent", "ace/Range"], function(h, i, j, k, l, m) {
|
||||
var g = function() {
|
||||
this.$tokenizer = new j((new k).getRules());
|
||||
this.$outdent = new l
|
||||
};
|
||||
h.inherits(g, i);
|
||||
(function() {
|
||||
this.toggleCommentLines = function(d, b, e) {
|
||||
var c = true;
|
||||
d = /^(\s*)\/\//;
|
||||
for(var a = e.start.row;a <= e.end.row;a++) {
|
||||
if(!d.test(b.getLine(a))) {
|
||||
c = false;
|
||||
break
|
||||
}
|
||||
}if(c) {
|
||||
c = new m(0, 0, 0, 0);
|
||||
for(a = e.start.row;a <= e.end.row;a++) {
|
||||
var f = b.getLine(a).replace(d, "$1");
|
||||
c.start.row = a;
|
||||
c.end.row = a;
|
||||
c.end.column = f.length + 2;
|
||||
b.replace(c, f)
|
||||
}return-2
|
||||
}else {
|
||||
return b.indentRows(e, "//")
|
||||
}
|
||||
};
|
||||
this.getNextLineIndent = function(d, b, e) {
|
||||
var c = this.$getIndent(b), a = this.$tokenizer.getLineTokens(b, d), f = a.tokens;
|
||||
a = a.state;
|
||||
if(f.length && f[f.length - 1].type == "comment") {
|
||||
return c
|
||||
}if(d == "start") {
|
||||
if(d = b.match(/^.*[\{\(\[]\s*$/)) {
|
||||
c += e
|
||||
}
|
||||
}else {
|
||||
if(d == "doc-start") {
|
||||
if(a == "start") {
|
||||
return""
|
||||
}if(d = b.match(/^\s*(\/?)\*/)) {
|
||||
if(d[1]) {
|
||||
c += " "
|
||||
}c += "* "
|
||||
}
|
||||
}
|
||||
}return c
|
||||
};
|
||||
this.checkOutdent = function(d, b, e) {
|
||||
return this.$outdent.checkOutdent(b, e)
|
||||
};
|
||||
this.autoOutdent = function(d, b, e) {
|
||||
return this.$outdent.autoOutdent(b, e)
|
||||
}
|
||||
}).call(g.prototype);
|
||||
return g
|
||||
});
|
||||
17
build/ace/mode/JavaScriptHighlightRules.js
Normal file
17
build/ace/mode/JavaScriptHighlightRules.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/JavaScriptHighlightRules", ["ace/lib/oop", "ace/lib/lang", "ace/mode/DocCommentHighlightRules", "ace/mode/TextHighlightRules"], function(d, b, e, f) {
|
||||
JavaScriptHighlightRules = function() {
|
||||
var c = new e, g = b.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with".split("|")), h = b.arrayToMap("true|false|null|undefined|Infinity|NaN|undefined".split("|")), i = b.arrayToMap("abstract|boolean|byte|char|class|const|enum|export|extends|final|float|goto|implements|int|interface|long|native|package|private|protected|short|static|super|synchronized|throws|transient|volatiledouble|import|public".split("|"));
|
||||
this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, c.getStartRule("doc-start"), {token:"comment", regex:"\\/\\*", next:"comment"}, {token:"string.regexp", regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"}, {token:"string", regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'}, {token:"string", regex:'["].*\\\\$', next:"qqstring"}, {token:"string", regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"}, {token:"string", regex:"['].*\\\\$", next:"qstring"}, {token:"constant.numeric",
|
||||
regex:"0[xX][0-9a-fA-F]+\\b"}, {token:"constant.numeric", regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, {token:function(a) {
|
||||
return a == "this" ? "variable.language" : g[a] ? "keyword" : h[a] ? "constant.language" : i[a] ? "invalid.illegal" : a == "debugger" ? "invalid.deprecated" : "identifier"
|
||||
}, regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"}, {token:"keyword.operator", regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(in|instanceof|new|delete|typeof|void)"}, {token:"lparen", regex:"[\\[\\(\\{]"}, {token:"rparen", regex:"[\\]\\)\\}]"}, {token:"text", regex:"\\s+"}], comment:[{token:"comment", regex:".*?\\*\\/", next:"start"}, {token:"comment", regex:".+"}], qqstring:[{token:"string", regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
||||
next:"start"}, {token:"string", regex:".+"}], qstring:[{token:"string", regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'", next:"start"}, {token:"string", regex:".+"}]};
|
||||
this.addRules(c.getRules(), "doc-");
|
||||
this.$rules["doc-start"][0].next = "start"
|
||||
};
|
||||
d.inherits(JavaScriptHighlightRules, f);
|
||||
return JavaScriptHighlightRules
|
||||
});
|
||||
32
build/ace/mode/MatchingBraceOutdent.js
Normal file
32
build/ace/mode/MatchingBraceOutdent.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/MatchingBraceOutdent", ["ace/Range"], function(f) {
|
||||
var e = function() {
|
||||
};
|
||||
(function() {
|
||||
this.checkOutdent = function(a, b) {
|
||||
if(!/^\s+$/.test(a)) {
|
||||
return false
|
||||
}return/^\s*\}/.test(b)
|
||||
};
|
||||
this.autoOutdent = function(a, b) {
|
||||
var c = a.getLine(b).match(/^(\s*\})/);
|
||||
if(!c) {
|
||||
return 0
|
||||
}c = c[1].length;
|
||||
var d = a.findMatchingBracket({row:b, column:c});
|
||||
if(!d || d.row == b) {
|
||||
return 0
|
||||
}d = this.$getIndent(a.getLine(d.row));
|
||||
a.replace(new f(b, 0, b, c - 1), d);
|
||||
return d.length - (c - 1)
|
||||
};
|
||||
this.$getIndent = function(a) {
|
||||
if(a = a.match(/^(\s+)/)) {
|
||||
return a[1]
|
||||
}return""
|
||||
}
|
||||
}).call(e.prototype);
|
||||
return e
|
||||
});
|
||||
30
build/ace/mode/Text.js
Normal file
30
build/ace/mode/Text.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/Text", ["ace/Tokenizer", "ace/mode/TextHighlightRules"], function(c, d) {
|
||||
var b = function() {
|
||||
this.$tokenizer = new c((new d).getRules())
|
||||
};
|
||||
(function() {
|
||||
this.getTokenizer = function() {
|
||||
return this.$tokenizer
|
||||
};
|
||||
this.toggleCommentLines = function() {
|
||||
return 0
|
||||
};
|
||||
this.getNextLineIndent = function() {
|
||||
return""
|
||||
};
|
||||
this.checkOutdent = function() {
|
||||
return false
|
||||
};
|
||||
this.autoOutdent = function() {
|
||||
};
|
||||
this.$getIndent = function(a) {
|
||||
if(a = a.match(/^(\s+)/)) {
|
||||
return a[1]
|
||||
}return""
|
||||
}
|
||||
}).call(b.prototype);
|
||||
return b
|
||||
});
|
||||
22
build/ace/mode/TextHighlightRules.js
Normal file
22
build/ace/mode/TextHighlightRules.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/TextHighlightRules", [], function() {
|
||||
var f = function() {
|
||||
this.$rules = {start:[{token:"text", regex:".+"}]}
|
||||
};
|
||||
(function() {
|
||||
this.addRules = function(g, a) {
|
||||
for(var b in g) {
|
||||
for(var c = g[b], d = 0;d < c.length;d++) {
|
||||
var e = c[d];
|
||||
e.next = e.next ? a + e.next : a + b
|
||||
}this.$rules[a + b] = c
|
||||
}
|
||||
};
|
||||
this.getRules = function() {
|
||||
return this.$rules
|
||||
}
|
||||
}).call(f.prototype);
|
||||
return f
|
||||
});
|
||||
24
build/ace/mode/Xml.js
Normal file
24
build/ace/mode/Xml.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/XmlHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(b, c) {
|
||||
var a = function() {
|
||||
this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>",
|
||||
next:"start"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"(?:[^\\]]|\\](?!\\]>))+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]}
|
||||
};
|
||||
b.inherits(a, c);
|
||||
return a
|
||||
});
|
||||
require.def("ace/mode/Xml", ["ace/lib/oop", "ace/mode/Text", "ace/Tokenizer", "ace/mode/XmlHighlightRules"], function(b, c, a, e) {
|
||||
var d = function() {
|
||||
this.$tokenizer = new a((new e).getRules())
|
||||
};
|
||||
b.inherits(d, c);
|
||||
(function() {
|
||||
this.getNextLineIndent = function(g, f) {
|
||||
return this.$getIndent(f)
|
||||
}
|
||||
}).call(d.prototype);
|
||||
return d
|
||||
});
|
||||
11
build/ace/mode/XmlHighlightRules.js
Normal file
11
build/ace/mode/XmlHighlightRules.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def("ace/mode/XmlHighlightRules", ["ace/lib/oop", "ace/mode/TextHighlightRules"], function(b, c) {
|
||||
var a = function() {
|
||||
this.$rules = {start:[{token:"text", regex:"<\\!\\[CDATA\\[", next:"cdata"}, {token:"xml_pe", regex:"<\\?.*?\\?>"}, {token:"comment", regex:"<\\!--", next:"comment"}, {token:"text", regex:"<\\/?", next:"tag"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"[^<]+"}], tag:[{token:"text", regex:">", next:"start"}, {token:"keyword", regex:"[-_a-zA-Z0-9:]+"}, {token:"text", regex:"\\s+"}, {token:"string", regex:'".*?"'}, {token:"string", regex:"'.*?'"}], cdata:[{token:"text", regex:"\\]\\]>",
|
||||
next:"start"}, {token:"text", regex:"\\s+"}, {token:"text", regex:"(?:[^\\]]|\\](?!\\]>))+"}], comment:[{token:"comment", regex:".*?--\>", next:"start"}, {token:"comment", regex:".+"}]}
|
||||
};
|
||||
b.inherits(a, c);
|
||||
return a
|
||||
});
|
||||
79
build/ace/test/ChangeDocumentTest.js
Normal file
79
build/ace/test/ChangeDocumentTest.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Editor", "ace/mode/Text", "ace/mode/JavaScript", "ace/test/MockRenderer"], function(b, c, f, d, e) {
|
||||
new TestCase("ChangeDocumentTest", {setUp:function() {
|
||||
this.doc1 = new b("abc\ndef");
|
||||
this.doc2 = new b("ghi\njkl");
|
||||
this.editor = new c(new e)
|
||||
}, "test: change document":function() {
|
||||
this.editor.setDocument(this.doc1);
|
||||
assertEquals(this.doc1, this.editor.getDocument());
|
||||
this.editor.setDocument(this.doc2);
|
||||
assertEquals(this.doc2, this.editor.getDocument())
|
||||
}, "test: only changes to the new document should have effect":function() {
|
||||
var a = false;
|
||||
this.editor.onDocumentChange = function() {
|
||||
a = true
|
||||
};
|
||||
this.editor.setDocument(this.doc1);
|
||||
this.editor.setDocument(this.doc2);
|
||||
this.doc1.duplicateLines(0, 0);
|
||||
assertFalse(a);
|
||||
this.doc2.duplicateLines(0, 0);
|
||||
assertTrue(a)
|
||||
}, "test: should use cursor of new document":function() {
|
||||
this.doc1.getSelection().moveCursorTo(0, 1);
|
||||
this.doc2.getSelection().moveCursorTo(1, 0);
|
||||
this.editor.setDocument(this.doc1);
|
||||
assertPosition(0, 1, this.editor.getCursorPosition());
|
||||
this.editor.setDocument(this.doc2);
|
||||
assertPosition(1, 0, this.editor.getCursorPosition())
|
||||
}, "test: only changing the cursor of the new doc should not have an effect":function() {
|
||||
this.editor.onCursorChange = function() {
|
||||
a = true
|
||||
};
|
||||
this.editor.setDocument(this.doc1);
|
||||
this.editor.setDocument(this.doc2);
|
||||
assertPosition(0, 0, this.editor.getCursorPosition());
|
||||
var a = false;
|
||||
this.doc1.getSelection().moveCursorTo(0, 1);
|
||||
assertPosition(0, 0, this.editor.getCursorPosition());
|
||||
assertFalse(a);
|
||||
this.doc2.getSelection().moveCursorTo(1, 1);
|
||||
assertPosition(1, 1, this.editor.getCursorPosition());
|
||||
assertTrue(a)
|
||||
}, "test: should use selection of new document":function() {
|
||||
this.doc1.getSelection().selectTo(0, 1);
|
||||
this.doc2.getSelection().selectTo(1, 0);
|
||||
this.editor.setDocument(this.doc1);
|
||||
assertPosition(0, 1, this.editor.getSelection().getSelectionLead());
|
||||
this.editor.setDocument(this.doc2);
|
||||
assertPosition(1, 0, this.editor.getSelection().getSelectionLead())
|
||||
}, "test: only changing the selection of the new doc should not have an effect":function() {
|
||||
this.editor.onSelectionChange = function() {
|
||||
a = true
|
||||
};
|
||||
this.editor.setDocument(this.doc1);
|
||||
this.editor.setDocument(this.doc2);
|
||||
assertPosition(0, 0, this.editor.getSelection().getSelectionLead());
|
||||
var a = false;
|
||||
this.doc1.getSelection().selectTo(0, 1);
|
||||
assertPosition(0, 0, this.editor.getSelection().getSelectionLead());
|
||||
assertFalse(a);
|
||||
this.doc2.getSelection().selectTo(1, 1);
|
||||
assertPosition(1, 1, this.editor.getSelection().getSelectionLead());
|
||||
assertTrue(a)
|
||||
}, "test: should use mode of new document":function() {
|
||||
this.editor.onDocumentModeChange = function() {
|
||||
a = true
|
||||
};
|
||||
this.editor.setDocument(this.doc1);
|
||||
this.editor.setDocument(this.doc2);
|
||||
var a = false;
|
||||
this.doc1.setMode(new Text);
|
||||
assertFalse(a);
|
||||
this.doc2.setMode(new d);
|
||||
assertTrue(a)
|
||||
}})
|
||||
});
|
||||
148
build/ace/test/DocumentTest.js
Normal file
148
build/ace/test/DocumentTest.js
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/UndoManager", "ace/Editor", "ace/test/MockRenderer"], function(b, h, i, j) {
|
||||
new TestCase("TextDocumentTest", {"test: find matching opening bracket":function() {
|
||||
var a = new b(["(()(", "())))"]);
|
||||
assertPosition(0, 1, a.findMatchingBracket({row:0, column:3}));
|
||||
assertPosition(1, 0, a.findMatchingBracket({row:1, column:2}));
|
||||
assertPosition(0, 3, a.findMatchingBracket({row:1, column:3}));
|
||||
assertPosition(0, 0, a.findMatchingBracket({row:1, column:4}));
|
||||
assertEquals(null, a.findMatchingBracket({row:1, column:5}))
|
||||
}, "test: find matching closing bracket":function() {
|
||||
var a = new b(["(()(", "())))"]);
|
||||
assertPosition(1, 1, a.findMatchingBracket({row:1, column:1}));
|
||||
assertPosition(1, 1, a.findMatchingBracket({row:1, column:1}));
|
||||
assertPosition(1, 2, a.findMatchingBracket({row:0, column:4}));
|
||||
assertPosition(0, 2, a.findMatchingBracket({row:0, column:2}));
|
||||
assertPosition(1, 3, a.findMatchingBracket({row:0, column:1}));
|
||||
assertEquals(null, a.findMatchingBracket({row:0, column:0}))
|
||||
}, "test: match different bracket types":function() {
|
||||
var a = new b(["({[", ")]}"]);
|
||||
assertPosition(1, 0, a.findMatchingBracket({row:0, column:1}));
|
||||
assertPosition(1, 2, a.findMatchingBracket({row:0, column:2}));
|
||||
assertPosition(1, 1, a.findMatchingBracket({row:0, column:3}));
|
||||
assertPosition(0, 0, a.findMatchingBracket({row:1, column:1}));
|
||||
assertPosition(0, 2, a.findMatchingBracket({row:1, column:2}));
|
||||
assertPosition(0, 1, a.findMatchingBracket({row:1, column:3}))
|
||||
}, "test: move lines down":function() {
|
||||
var a = new b(["1", "2", "3", "4"]);
|
||||
a.moveLinesDown(0, 1);
|
||||
assertEquals("3\n1\n2\n4", a.toString());
|
||||
a.moveLinesDown(1, 2);
|
||||
assertEquals("3\n4\n1\n2", a.toString());
|
||||
a.moveLinesDown(2, 3);
|
||||
assertEquals("3\n4\n1\n2", a.toString());
|
||||
a.moveLinesDown(2, 2);
|
||||
assertEquals("3\n4\n2\n1", a.toString())
|
||||
}, "test: move lines up":function() {
|
||||
var a = new b(["1", "2", "3", "4"]);
|
||||
a.moveLinesUp(2, 3);
|
||||
assertEquals("1\n3\n4\n2", a.toString());
|
||||
a.moveLinesUp(1, 2);
|
||||
assertEquals("3\n4\n1\n2", a.toString());
|
||||
a.moveLinesUp(0, 1);
|
||||
assertEquals("3\n4\n1\n2", a.toString());
|
||||
a.moveLinesUp(2, 2);
|
||||
assertEquals("3\n1\n4\n2", a.toString())
|
||||
}, "test: duplicate lines":function() {
|
||||
var a = new b(["1", "2", "3", "4"]);
|
||||
a.duplicateLines(1, 2);
|
||||
assertEquals("1\n2\n3\n2\n3\n4", a.toString())
|
||||
}, "test: duplicate last line":function() {
|
||||
var a = new b(["1", "2", "3"]);
|
||||
a.duplicateLines(2, 2);
|
||||
assertEquals("1\n2\n3\n3", a.toString())
|
||||
}, "test: duplicate first line":function() {
|
||||
var a = new b(["1", "2", "3"]);
|
||||
a.duplicateLines(0, 0);
|
||||
assertEquals("1\n1\n2\n3", a.toString())
|
||||
}, "test: should handle unix style new lines":function() {
|
||||
var a = new b(["1", "2", "3"]);
|
||||
assertEquals("1\n2\n3", a.toString())
|
||||
}, "test: should handle windows style new lines":function() {
|
||||
var a = new b("1\r\n2\r\n3");
|
||||
a.setNewLineMode("unix");
|
||||
assertEquals("1\n2\n3", a.toString())
|
||||
}, "test: set new line mode to 'windows' should use '\r\n' as new lines":function() {
|
||||
var a = new b("1\n2\n3");
|
||||
a.setNewLineMode("windows");
|
||||
assertEquals("1\r\n2\r\n3", a.toString())
|
||||
}, "test: set new line mode to 'unix' should use '\n' as new lines":function() {
|
||||
var a = new b("1\r\n2\r\n3");
|
||||
a.setNewLineMode("unix");
|
||||
assertEquals("1\n2\n3", a.toString())
|
||||
}, "test: set new line mode to 'auto' should use detect the incoming nl type":function() {
|
||||
var a = new b("1\n2\n3");
|
||||
a.setNewLineMode("auto");
|
||||
assertEquals("1\n2\n3", a.toString());
|
||||
a = new b("1\r\n2\r\n3");
|
||||
a.setNewLineMode("auto");
|
||||
assertEquals("1\r\n2\r\n3", a.toString());
|
||||
a.replace(new Range(0, 0, 2, 1), "4\n5\n6");
|
||||
assertEquals("4\n5\n6", a.toString())
|
||||
}, "test: undo/redo for delete line":function() {
|
||||
var a = new b(["111", "222", "333"]), c = new h;
|
||||
a.setUndoManager(c);
|
||||
var e = a.toString(), d = new i(new j, a);
|
||||
d.removeLines();
|
||||
var f = a.toString();
|
||||
assertEquals("222\n333", f);
|
||||
a.$informUndoManager.call();
|
||||
d.removeLines();
|
||||
var g = a.toString();
|
||||
assertEquals("333", g);
|
||||
a.$informUndoManager.call();
|
||||
d.removeLines();
|
||||
d = a.toString();
|
||||
assertEquals("", d);
|
||||
a.$informUndoManager.call();
|
||||
c.undo();
|
||||
a.$informUndoManager.call();
|
||||
assertEquals(g, a.toString());
|
||||
c.undo();
|
||||
a.$informUndoManager.call();
|
||||
assertEquals(f, a.toString());
|
||||
c.undo();
|
||||
a.$informUndoManager.call();
|
||||
assertEquals(e, a.toString());
|
||||
c.undo();
|
||||
a.$informUndoManager.call();
|
||||
assertEquals(e, a.toString())
|
||||
}, "test: convert document to screen coordinates":function() {
|
||||
var a = new b("01234\t567890\t1234");
|
||||
a.setTabSize(4);
|
||||
assertEquals(0, a.documentToScreenColumn(0, 0));
|
||||
assertEquals(4, a.documentToScreenColumn(0, 4));
|
||||
assertEquals(5, a.documentToScreenColumn(0, 5));
|
||||
assertEquals(9, a.documentToScreenColumn(0, 6));
|
||||
assertEquals(15, a.documentToScreenColumn(0, 12));
|
||||
assertEquals(19, a.documentToScreenColumn(0, 13));
|
||||
a.setTabSize(2);
|
||||
assertEquals(0, a.documentToScreenColumn(0, 0));
|
||||
assertEquals(4, a.documentToScreenColumn(0, 4));
|
||||
assertEquals(5, a.documentToScreenColumn(0, 5));
|
||||
assertEquals(7, a.documentToScreenColumn(0, 6));
|
||||
assertEquals(13, a.documentToScreenColumn(0, 12));
|
||||
assertEquals(15, a.documentToScreenColumn(0, 13))
|
||||
}, "test: convert document to scrren coordinates with leading tabs":function() {
|
||||
var a = new b("\t\t123");
|
||||
a.setTabSize(4);
|
||||
assertEquals(0, a.documentToScreenColumn(0, 0));
|
||||
assertEquals(4, a.documentToScreenColumn(0, 1));
|
||||
assertEquals(8, a.documentToScreenColumn(0, 2));
|
||||
assertEquals(9, a.documentToScreenColumn(0, 3))
|
||||
}, "test: convert screen to document coordinates":function() {
|
||||
var a = new b("01234\t567890\t1234");
|
||||
a.setTabSize(4);
|
||||
assertEquals(0, a.screenToDocumentColumn(0, 0));
|
||||
assertEquals(4, a.screenToDocumentColumn(0, 4));
|
||||
assertEquals(5, a.screenToDocumentColumn(0, 5));
|
||||
assertEquals(5, a.screenToDocumentColumn(0, 6));
|
||||
assertEquals(5, a.screenToDocumentColumn(0, 7));
|
||||
assertEquals(5, a.screenToDocumentColumn(0, 8));
|
||||
assertEquals(6, a.screenToDocumentColumn(0, 9));
|
||||
assertEquals(12, a.screenToDocumentColumn(0, 15));
|
||||
assertEquals(13, a.screenToDocumentColumn(0, 19))
|
||||
}})
|
||||
});
|
||||
17
build/ace/test/EventEmitterTest.js
Normal file
17
build/ace/test/EventEmitterTest.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/lib/oop", "ace/MEventEmitter"], function(d, e) {
|
||||
var a = function() {
|
||||
};
|
||||
d.implement(a.prototype, e);
|
||||
new TestCase("EventEmitterTest", {"test: dispatch event with no data":function() {
|
||||
var b = new a, c = false;
|
||||
b.addEventListener("juhu", function(f) {
|
||||
c = true;
|
||||
assertEquals("juhu", f.type)
|
||||
});
|
||||
b.$dispatchEvent("juhu");
|
||||
assertTrue(c)
|
||||
}})
|
||||
});
|
||||
56
build/ace/test/MockRenderer.js
Normal file
56
build/ace/test/MockRenderer.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def([], function() {
|
||||
MockRenderer = function(a) {
|
||||
this.container = document.createElement("div");
|
||||
this.cursor = {row:0, column:0};
|
||||
this.visibleRowCount = a || 20;
|
||||
this.layerConfig = {firstVisibleRow:0, lastVisibleRow:this.visibleRowCount}
|
||||
};
|
||||
MockRenderer.prototype.getFirstVisibleRow = function() {
|
||||
return this.layerConfig.firstVisibleRow
|
||||
};
|
||||
MockRenderer.prototype.getLastVisibleRow = function() {
|
||||
return this.layerConfig.lastVisibleRow
|
||||
};
|
||||
MockRenderer.prototype.getContainerElement = function() {
|
||||
return this.container
|
||||
};
|
||||
MockRenderer.prototype.getMouseEventTarget = function() {
|
||||
return this.container
|
||||
};
|
||||
MockRenderer.prototype.setDocument = function(a) {
|
||||
this.lines = a.lines
|
||||
};
|
||||
MockRenderer.prototype.setTokenizer = function() {
|
||||
};
|
||||
MockRenderer.prototype.updateCursor = function(a) {
|
||||
this.cursor.row = a.row;
|
||||
this.cursor.column = a.column
|
||||
};
|
||||
MockRenderer.prototype.scrollCursorIntoView = function() {
|
||||
if(this.cursor.row < this.layerConfig.firstVisibleRow) {
|
||||
this.scrollToRow(this.cursor.row)
|
||||
}else {
|
||||
this.cursor.row > this.layerConfig.lastVisibleRow && this.scrollToRow(this.cursor.row)
|
||||
}
|
||||
};
|
||||
MockRenderer.prototype.scrollToRow = function(a) {
|
||||
a = Math.min(this.lines.length - this.visibleRowCount, Math.max(0, a));
|
||||
this.layerConfig.firstVisibleRow = a;
|
||||
this.layerConfig.lastVisibleRow = a + this.visibleRowCount
|
||||
};
|
||||
MockRenderer.prototype.getScrollTopRow = function() {
|
||||
return this.layerConfig.firstVisibleRow
|
||||
};
|
||||
MockRenderer.prototype.draw = function() {
|
||||
};
|
||||
MockRenderer.prototype.updateLines = function() {
|
||||
};
|
||||
MockRenderer.prototype.addMarker = function() {
|
||||
};
|
||||
MockRenderer.prototype.setBreakpoints = function() {
|
||||
};
|
||||
return MockRenderer
|
||||
});
|
||||
77
build/ace/test/NavigationTest.js
Normal file
77
build/ace/test/NavigationTest.js
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Editor", "ace/test/MockRenderer"], function(e, c, d) {
|
||||
TestCase("NavigationTest", {createTextDocument:function(a, b) {
|
||||
b = (new Array(b + 1)).join("a");
|
||||
a = (new Array(a)).join(b + "\n") + b;
|
||||
return new e(a)
|
||||
}, "test: navigate to end of file should scroll the last line into view":function() {
|
||||
var a = this.createTextDocument(200, 10);
|
||||
a = new c(new d, a);
|
||||
a.navigateFileEnd();
|
||||
var b = a.getCursorPosition();
|
||||
assertTrue(a.getFirstVisibleRow() <= b.row);
|
||||
assertTrue(a.getLastVisibleRow() >= b.row)
|
||||
}, "test: navigate to start of file should scroll the first row into view":function() {
|
||||
var a = this.createTextDocument(200, 10);
|
||||
a = new c(new d, a);
|
||||
a.moveCursorTo(a.getLastVisibleRow() + 20);
|
||||
a.navigateFileStart();
|
||||
assertEquals(0, a.getFirstVisibleRow())
|
||||
}, "test: goto hidden line should scroll the line into the middle of the viewport":function() {
|
||||
var a = new c(new d, this.createTextDocument(200, 5));
|
||||
a.navigateTo(0, 0);
|
||||
a.gotoLine(101);
|
||||
assertPosition(100, 0, a.getCursorPosition());
|
||||
assertEquals(90, a.getFirstVisibleRow());
|
||||
a.navigateTo(100, 0);
|
||||
a.gotoLine(11);
|
||||
assertPosition(10, 0, a.getCursorPosition());
|
||||
assertEquals(0, a.getFirstVisibleRow());
|
||||
a.navigateTo(100, 0);
|
||||
a.gotoLine(6);
|
||||
assertPosition(5, 0, a.getCursorPosition());
|
||||
assertEquals(0, a.getFirstVisibleRow());
|
||||
a.navigateTo(100, 0);
|
||||
a.gotoLine(1);
|
||||
assertPosition(0, 0, a.getCursorPosition());
|
||||
assertEquals(0, a.getFirstVisibleRow());
|
||||
a.navigateTo(0, 0);
|
||||
a.gotoLine(191);
|
||||
assertPosition(190, 0, a.getCursorPosition());
|
||||
assertEquals(180, a.getFirstVisibleRow());
|
||||
a.navigateTo(0, 0);
|
||||
a.gotoLine(196);
|
||||
assertPosition(195, 0, a.getCursorPosition());
|
||||
assertEquals(180, a.getFirstVisibleRow())
|
||||
}, "test: goto visible line should only move the cursor and not scroll":function() {
|
||||
var a = new c(new d, this.createTextDocument(200, 5));
|
||||
a.navigateTo(0, 0);
|
||||
a.gotoLine(12);
|
||||
assertPosition(11, 0, a.getCursorPosition());
|
||||
assertEquals(0, a.getFirstVisibleRow());
|
||||
a.navigateTo(30, 0);
|
||||
a.gotoLine(33);
|
||||
assertPosition(32, 0, a.getCursorPosition());
|
||||
assertEquals(30, a.getFirstVisibleRow())
|
||||
}, "test: navigate from the end of a long line down to a short line and back should maintain the curser column":function() {
|
||||
var a = new c(new d, new e(["123456", "1"]));
|
||||
a.navigateTo(0, 6);
|
||||
assertPosition(0, 6, a.getCursorPosition());
|
||||
a.navigateDown();
|
||||
assertPosition(1, 1, a.getCursorPosition());
|
||||
a.navigateUp();
|
||||
assertPosition(0, 6, a.getCursorPosition())
|
||||
}, "test: reset desired column on navigate left or right":function() {
|
||||
var a = new c(new d, new e(["123456", "12"]));
|
||||
a.navigateTo(0, 6);
|
||||
assertPosition(0, 6, a.getCursorPosition());
|
||||
a.navigateDown();
|
||||
assertPosition(1, 2, a.getCursorPosition());
|
||||
a.navigateLeft();
|
||||
assertPosition(1, 1, a.getCursorPosition());
|
||||
a.navigateUp();
|
||||
assertPosition(0, 1, a.getCursorPosition())
|
||||
}})
|
||||
});
|
||||
74
build/ace/test/RangeTest.js
Normal file
74
build/ace/test/RangeTest.js
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Range"], function(b) {
|
||||
RangeTest = new TestCase("RangeTest", {"test: create range":function() {
|
||||
var a = new b(1, 2, 3, 4);
|
||||
assertEquals(1, a.start.row);
|
||||
assertEquals(2, a.start.column);
|
||||
assertEquals(3, a.end.row);
|
||||
assertEquals(4, a.end.column)
|
||||
}, "test: create from points":function() {
|
||||
var a = b.fromPoints({row:1, column:2}, {row:3, column:4});
|
||||
assertEquals(1, a.start.row);
|
||||
assertEquals(2, a.start.column);
|
||||
assertEquals(3, a.end.row);
|
||||
assertEquals(4, a.end.column)
|
||||
}, "test: clip to rows":function() {
|
||||
assertRange(10, 0, 31, 0, (new b(0, 20, 100, 30)).clipRows(10, 30));
|
||||
assertRange(10, 0, 30, 10, (new b(0, 20, 30, 10)).clipRows(10, 30));
|
||||
var a = new b(0, 20, 3, 10);
|
||||
a = a.clipRows(10, 30);
|
||||
assertTrue(a.isEmpty());
|
||||
assertRange(10, 0, 10, 0, a)
|
||||
}, "test: isEmpty":function() {
|
||||
var a = new b(1, 2, 1, 2);
|
||||
assertTrue(a.isEmpty());
|
||||
a = new b(1, 2, 1, 6);
|
||||
assertFalse(a.isEmpty())
|
||||
}, "test: is multi line":function() {
|
||||
var a = new b(1, 2, 1, 6);
|
||||
assertFalse(a.isMultiLine());
|
||||
a = new b(1, 2, 2, 6);
|
||||
assertTrue(a.isMultiLine())
|
||||
}, "test: clone":function() {
|
||||
var a = new b(1, 2, 3, 4), c = a.clone();
|
||||
assertPosition(1, 2, c.start);
|
||||
assertPosition(3, 4, c.end);
|
||||
c.start.column = 20;
|
||||
assertPosition(1, 2, a.start);
|
||||
c.end.column = 20;
|
||||
assertPosition(3, 4, a.end)
|
||||
}, "test: contains for multi line ranges":function() {
|
||||
var a = new b(1, 10, 5, 20);
|
||||
assertTrue(a.contains(1, 10));
|
||||
assertTrue(a.contains(2, 0));
|
||||
assertTrue(a.contains(3, 100));
|
||||
assertTrue(a.contains(5, 19));
|
||||
assertTrue(a.contains(5, 20));
|
||||
assertFalse(a.contains(1, 9));
|
||||
assertFalse(a.contains(0, 0));
|
||||
assertFalse(a.contains(5, 21))
|
||||
}, "test: contains for single line ranges":function() {
|
||||
var a = new b(1, 10, 1, 20);
|
||||
assertTrue(a.contains(1, 10));
|
||||
assertTrue(a.contains(1, 15));
|
||||
assertTrue(a.contains(1, 20));
|
||||
assertFalse(a.contains(0, 9));
|
||||
assertFalse(a.contains(2, 9));
|
||||
assertFalse(a.contains(1, 9));
|
||||
assertFalse(a.contains(1, 21))
|
||||
}, "test: extend range":function() {
|
||||
var a = new b(2, 10, 2, 30);
|
||||
a = a.extend(2, 5);
|
||||
assertRange(2, 5, 2, 30, a);
|
||||
a = a.extend(2, 35);
|
||||
assertRange(2, 5, 2, 35, a);
|
||||
a = a.extend(2, 15);
|
||||
assertRange(2, 5, 2, 35, a);
|
||||
a = a.extend(1, 4);
|
||||
assertRange(1, 4, 2, 35, a);
|
||||
a = a.extend(6, 10);
|
||||
assertRange(1, 4, 6, 10, a)
|
||||
}})
|
||||
});
|
||||
135
build/ace/test/SearchTest.js
Normal file
135
build/ace/test/SearchTest.js
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Search"], function(c, b) {
|
||||
new TestCase("SearchTest", {"test: configure the search object":function() {
|
||||
(new b).set({needle:"juhu", scope:b.ALL})
|
||||
}, "test: find simple text in document":function() {
|
||||
var a = new c(["juhu kinners 123", "456"]);
|
||||
a = (new b).set({needle:"kinners"}).find(a);
|
||||
assertPosition(0, 5, a.start);
|
||||
assertPosition(0, 12, a.end)
|
||||
}, "test: find simple text in next line":function() {
|
||||
var a = new c(["abc", "juhu kinners 123", "456"]);
|
||||
a = (new b).set({needle:"kinners"}).find(a);
|
||||
assertPosition(1, 5, a.start);
|
||||
assertPosition(1, 12, a.end)
|
||||
}, "test: find text starting at cursor position":function() {
|
||||
var a = new c(["juhu kinners", "juhu kinners 123"]);
|
||||
a.getSelection().moveCursorTo(0, 6);
|
||||
a = (new b).set({needle:"kinners"}).find(a);
|
||||
assertPosition(1, 5, a.start);
|
||||
assertPosition(1, 12, a.end)
|
||||
}, "test: wrap search is off by default":function() {
|
||||
var a = new c(["abc", "juhu kinners 123", "456"]);
|
||||
a.getSelection().moveCursorTo(2, 1);
|
||||
var d = (new b).set({needle:"kinners"});
|
||||
assertEquals(null, d.find(a))
|
||||
}, "test: wrap search should wrap at file end":function() {
|
||||
var a = new c(["abc", "juhu kinners 123", "456"]);
|
||||
a.getSelection().moveCursorTo(2, 1);
|
||||
a = (new b).set({needle:"kinners", wrap:true}).find(a);
|
||||
assertPosition(1, 5, a.start);
|
||||
assertPosition(1, 12, a.end)
|
||||
}, "test: wrap search with no match should return 'null'":function() {
|
||||
var a = new c(["abc", "juhu kinners 123", "456"]);
|
||||
a.getSelection().moveCursorTo(2, 1);
|
||||
var d = (new b).set({needle:"xyz", wrap:true});
|
||||
assertEquals(null, d.find(a))
|
||||
}, "test: case sensitive is by default off":function() {
|
||||
var a = new c(["abc", "juhu kinners 123", "456"]), d = (new b).set({needle:"JUHU"});
|
||||
assertEquals(null, d.find(a))
|
||||
}, "test: case sensitive search":function() {
|
||||
var a = new c(["abc", "juhu kinners 123", "456"]);
|
||||
a = (new b).set({needle:"KINNERS", caseSensitive:true}).find(a);
|
||||
assertPosition(1, 5, a.start);
|
||||
assertPosition(1, 12, a.end)
|
||||
}, "test: whole word search should not match inside of words":function() {
|
||||
var a = new c(["juhukinners", "juhu kinners 123", "456"]);
|
||||
a = (new b).set({needle:"kinners", wholeWord:true}).find(a);
|
||||
assertPosition(1, 5, a.start);
|
||||
assertPosition(1, 12, a.end)
|
||||
}, "test: find backwards":function() {
|
||||
var a = new c(["juhu juhu juhu juhu"]);
|
||||
a.getSelection().moveCursorTo(0, 10);
|
||||
a = (new b).set({needle:"juhu", backwards:true}).find(a);
|
||||
assertPosition(0, 5, a.start);
|
||||
assertPosition(0, 9, a.end)
|
||||
}, "test: find in selection":function() {
|
||||
var a = new c(["juhu", "juhu", "juhu", "juhu"]);
|
||||
a.getSelection().setSelectionAnchor(1, 0);
|
||||
a.getSelection().selectTo(3, 5);
|
||||
var d = (new b).set({needle:"juhu", wrap:true, scope:b.SELECTION}), e = d.find(a);
|
||||
assertPosition(1, 0, e.start);
|
||||
assertPosition(1, 4, e.end);
|
||||
a.getSelection().setSelectionAnchor(0, 2);
|
||||
a.getSelection().selectTo(3, 2);
|
||||
e = d.find(a);
|
||||
assertPosition(1, 0, e.start);
|
||||
assertPosition(1, 4, e.end)
|
||||
}, "test: find backwards in selection":function() {
|
||||
var a = new c(["juhu", "juhu", "juhu", "juhu"]), d = (new b).set({needle:"juhu", wrap:true, backwards:true, scope:b.SELECTION});
|
||||
a.getSelection().setSelectionAnchor(0, 2);
|
||||
a.getSelection().selectTo(3, 2);
|
||||
var e = d.find(a);
|
||||
assertPosition(2, 0, e.start);
|
||||
assertPosition(2, 4, e.end);
|
||||
a.getSelection().setSelectionAnchor(0, 2);
|
||||
a.getSelection().selectTo(1, 2);
|
||||
assertEquals(null, d.find(a))
|
||||
}, "test: edge case - match directly before the cursor":function() {
|
||||
var a = new c(["123", "123", "juhu"]), d = (new b).set({needle:"juhu", wrap:true});
|
||||
a.getSelection().moveCursorTo(2, 5);
|
||||
a = d.find(a);
|
||||
assertPosition(2, 0, a.start);
|
||||
assertPosition(2, 4, a.end)
|
||||
}, "test: edge case - match backwards directly after the cursor":function() {
|
||||
var a = new c(["123", "123", "juhu"]), d = (new b).set({needle:"juhu", wrap:true, backwards:true});
|
||||
a.getSelection().moveCursorTo(2, 0);
|
||||
a = d.find(a);
|
||||
assertPosition(2, 0, a.start);
|
||||
assertPosition(2, 4, a.end)
|
||||
}, "test: find using a regular expression":function() {
|
||||
var a = new c(["abc123 123 cd", "abc"]);
|
||||
a = (new b).set({needle:"\\d+", regExp:true}).find(a);
|
||||
assertPosition(0, 3, a.start);
|
||||
assertPosition(0, 6, a.end)
|
||||
}, "test: find using a regular expression and whole word":function() {
|
||||
var a = new c(["abc123 123 cd", "abc"]);
|
||||
a = (new b).set({needle:"\\d+\\b", regExp:true, wholeWord:true}).find(a);
|
||||
assertPosition(0, 7, a.start);
|
||||
assertPosition(0, 10, a.end)
|
||||
}, "test: use regular expressions with capture groups":function() {
|
||||
var a = new c([" ab: 12px", " <h1 abc"]);
|
||||
a = (new b).set({needle:"(\\d+)", regExp:true}).find(a);
|
||||
assertPosition(0, 6, a.start);
|
||||
assertPosition(0, 8, a.end)
|
||||
}, "test: find all matches in selection":function() {
|
||||
var a = new c(["juhu", "juhu", "juhu", "juhu"]), d = (new b).set({needle:"uh", wrap:true, scope:b.SELECTION});
|
||||
a.getSelection().setSelectionAnchor(0, 2);
|
||||
a.getSelection().selectTo(3, 2);
|
||||
a = d.findAll(a);
|
||||
assertEquals(2, a.length);
|
||||
assertPosition(1, 1, a[0].start);
|
||||
assertPosition(1, 3, a[0].end);
|
||||
assertPosition(2, 1, a[1].start);
|
||||
assertPosition(2, 3, a[1].end)
|
||||
}, "test: replace() should return the replacement if the input matches the needle":function() {
|
||||
var a = (new b).set({needle:"juhu"});
|
||||
assertEquals("kinners", a.replace("juhu", "kinners"));
|
||||
assertEquals(null, a.replace("", "kinners"));
|
||||
assertEquals(null, a.replace(" juhu", "kinners"))
|
||||
}, "test: replace with a RegExp search":function() {
|
||||
var a = (new b).set({needle:"\\d+", regExp:true});
|
||||
assertEquals("kinners", a.replace("123", "kinners"));
|
||||
assertEquals("kinners", a.replace("01234", "kinners"));
|
||||
assertEquals(null, a.replace("", "kinners"));
|
||||
assertEquals(null, a.replace("a12", "kinners"));
|
||||
assertEquals(null, a.replace("12a", "kinners"))
|
||||
}, "test: replace with RegExp match and capture groups":function() {
|
||||
var a = (new b).set({needle:"ab(\\d\\d)", regExp:true});
|
||||
assertEquals("cd12", a.replace("ab12", "cd$1"));
|
||||
assertEquals("-ab12-", a.replace("ab12", "-$&-"));
|
||||
assertEquals("$", a.replace("ab12", "$$"))
|
||||
}})
|
||||
});
|
||||
149
build/ace/test/SelectionTest.js
Normal file
149
build/ace/test/SelectionTest.js
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document"], function(c) {
|
||||
TestCase("SelectionTest", {createTextDocument:function(a, b) {
|
||||
b = (new Array(b + 1)).join("a");
|
||||
a = (new Array(a)).join(b + "\n") + b;
|
||||
return new c(a)
|
||||
}, "test: move cursor to end of file should place the cursor on last row and column":function() {
|
||||
var a = this.createTextDocument(200, 10).getSelection();
|
||||
a.moveCursorFileEnd();
|
||||
assertPosition(199, 10, a.getCursor())
|
||||
}, "test: moveCursor to start of file should place the cursor on the first row and column":function() {
|
||||
var a = this.createTextDocument(200, 10).getSelection();
|
||||
a.moveCursorFileStart();
|
||||
assertPosition(0, 0, a.getCursor())
|
||||
}, "test: move selection lead to end of file":function() {
|
||||
var a = this.createTextDocument(200, 10).getSelection();
|
||||
a.moveCursorTo(100, 5);
|
||||
a.selectFileEnd();
|
||||
a = a.getRange();
|
||||
assertPosition(100, 5, a.start);
|
||||
assertPosition(199, 10, a.end)
|
||||
}, "test: move selection lead to start of file":function() {
|
||||
var a = this.createTextDocument(200, 10).getSelection();
|
||||
a.moveCursorTo(100, 5);
|
||||
a.selectFileStart();
|
||||
a = a.getRange();
|
||||
assertPosition(0, 0, a.start);
|
||||
assertPosition(100, 5, a.end)
|
||||
}, "test: move cursor word right":function() {
|
||||
var a = (new c("ab\n Juhu Kinners (abc, 12)\n cde")).getSelection();
|
||||
a.moveCursorDown();
|
||||
assertPosition(1, 0, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 1, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 5, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 6, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 13, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 15, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 18, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 20, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 22, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(1, 23, a.getCursor());
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(2, 0, a.getCursor())
|
||||
}, "test: select word right if cursor in word":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 2);
|
||||
a.moveCursorWordRight();
|
||||
assertPosition(0, 4, a.getCursor())
|
||||
}, "test: moveCursor word left":function() {
|
||||
var a = (new c("ab\n Juhu Kinners (abc, 12)\n cde")).getSelection();
|
||||
a.moveCursorDown();
|
||||
a.moveCursorLineEnd();
|
||||
assertPosition(1, 23, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 22, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 20, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 18, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 15, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 13, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 6, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 5, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 1, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(1, 0, a.getCursor());
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(0, 2, a.getCursor())
|
||||
}, "test: select word left if cursor in word":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 8);
|
||||
a.moveCursorWordLeft();
|
||||
assertPosition(0, 5, a.getCursor())
|
||||
}, "test: select word right and select":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 0);
|
||||
a.selectWordRight();
|
||||
a = a.getRange();
|
||||
assertPosition(0, 0, a.start);
|
||||
assertPosition(0, 4, a.end)
|
||||
}, "test: select word left and select":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 3);
|
||||
a.selectWordLeft();
|
||||
a = a.getRange();
|
||||
assertPosition(0, 0, a.start);
|
||||
assertPosition(0, 3, a.end)
|
||||
}, "test: select word with cursor in word should select the word":function() {
|
||||
var a = (new c("Juhu Kinners 123")).getSelection();
|
||||
a.moveCursorTo(0, 8);
|
||||
a.selectWord();
|
||||
a = a.getRange();
|
||||
assertPosition(0, 5, a.start);
|
||||
assertPosition(0, 12, a.end)
|
||||
}, "test: select word with cursor betwen white space and word should select the word":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 4);
|
||||
a.selectWord();
|
||||
var b = a.getRange();
|
||||
assertPosition(0, 0, b.start);
|
||||
assertPosition(0, 4, b.end);
|
||||
a.moveCursorTo(0, 5);
|
||||
a.selectWord();
|
||||
b = a.getRange();
|
||||
assertPosition(0, 5, b.start);
|
||||
assertPosition(0, 12, b.end)
|
||||
}, "test: select word with cursor in white space should select white space":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 5);
|
||||
a.selectWord();
|
||||
a = a.getRange();
|
||||
assertPosition(0, 4, a.start);
|
||||
assertPosition(0, 6, a.end)
|
||||
}, "test: moving cursor should fire a 'changeCursor' event":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 5);
|
||||
var b = false;
|
||||
a.addEventListener("changeCursor", function() {
|
||||
b = true
|
||||
});
|
||||
a.moveCursorTo(0, 6);
|
||||
assertTrue(b)
|
||||
}, "test: calling setCursor with the same position should not fire an event":function() {
|
||||
var a = (new c("Juhu Kinners")).getSelection();
|
||||
a.moveCursorTo(0, 5);
|
||||
var b = false;
|
||||
a.addEventListener("changeCursor", function() {
|
||||
b = true
|
||||
});
|
||||
a.moveCursorTo(0, 5);
|
||||
assertFalse(b)
|
||||
}})
|
||||
});
|
||||
178
build/ace/test/TextEditTest.js
Normal file
178
build/ace/test/TextEditTest.js
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Editor", "ace/mode/JavaScript", "ace/test/MockRenderer"], function(c, d, g, e) {
|
||||
TestCase("TextEditTest", {"test: delete line from the middle":function() {
|
||||
var b = new c("a\nb\nc\nd"), a = new d(new e, b);
|
||||
a.moveCursorTo(1, 1);
|
||||
a.removeLines();
|
||||
assertEquals("a\nc\nd", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition());
|
||||
a.removeLines();
|
||||
assertEquals("a\nd", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition());
|
||||
a.removeLines();
|
||||
assertEquals("a\n", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition());
|
||||
a.removeLines();
|
||||
assertEquals("a\n", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition())
|
||||
}, "test: delete multiple selected lines":function() {
|
||||
var b = new c("a\nb\nc\nd"), a = new d(new e, b);
|
||||
a.moveCursorTo(1, 1);
|
||||
a.getSelection().selectDown();
|
||||
a.removeLines();
|
||||
assertEquals("a\nd", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition())
|
||||
}, "test: delete first line":function() {
|
||||
var b = new c("a\nb\nc"), a = new d(new e, b);
|
||||
a.removeLines();
|
||||
assertEquals("b\nc", b.toString());
|
||||
assertPosition(0, 0, a.getCursorPosition())
|
||||
}, "test: delete last":function() {
|
||||
var b = new c("a\nb\nc"), a = new d(new e, b);
|
||||
a.moveCursorTo(2, 1);
|
||||
a.removeLines();
|
||||
assertEquals("a\nb\n", b.toString());
|
||||
assertPosition(2, 0, a.getCursorPosition())
|
||||
}, "test: indent block":function() {
|
||||
var b = new c("a12345\nb12345\nc12345"), a = new d(new e, b);
|
||||
a.moveCursorTo(1, 3);
|
||||
a.getSelection().selectDown();
|
||||
a.blockIndent(" ");
|
||||
assertEquals("a12345\n b12345\n c12345", b.toString());
|
||||
assertPosition(2, 7, a.getCursorPosition());
|
||||
b = a.getSelectionRange();
|
||||
assertPosition(1, 7, b.start);
|
||||
assertPosition(2, 7, b.end)
|
||||
}, "test: outdent block":function() {
|
||||
var b = new c(" a12345\n b12345\n c12345"), a = new d(new e, b);
|
||||
a.moveCursorTo(0, 3);
|
||||
a.getSelection().selectDown();
|
||||
a.getSelection().selectDown();
|
||||
a.blockOutdent(" ");
|
||||
assertEquals(" a12345\nb12345\n c12345", b.toString());
|
||||
assertPosition(2, 1, a.getCursorPosition());
|
||||
var f = a.getSelectionRange();
|
||||
assertPosition(0, 1, f.start);
|
||||
assertPosition(2, 1, f.end);
|
||||
a.blockOutdent(" ");
|
||||
assertEquals(" a12345\nb12345\n c12345", b.toString());
|
||||
f = a.getSelectionRange();
|
||||
assertPosition(0, 1, f.start);
|
||||
assertPosition(2, 1, f.end)
|
||||
}, "test: outent without a selection should update cursor":function() {
|
||||
var b = new c(" 12"), a = new d(new e, b);
|
||||
a.moveCursorTo(0, 3);
|
||||
a.blockOutdent(" ");
|
||||
assertEquals(" 12", b.toString());
|
||||
assertPosition(0, 1, a.getCursorPosition())
|
||||
}, "test: comment lines should perserve selection":function() {
|
||||
var b = new c(" abc\ncde", new g), a = new d(new e, b);
|
||||
a.moveCursorTo(0, 2);
|
||||
a.getSelection().selectDown();
|
||||
a.toggleCommentLines();
|
||||
assertEquals("// abc\n//cde", b.toString());
|
||||
b = a.getSelectionRange();
|
||||
assertPosition(0, 4, b.start);
|
||||
assertPosition(1, 4, b.end)
|
||||
}, "test: uncomment lines should perserve selection":function() {
|
||||
var b = new c("// abc\n//cde", new g), a = new d(new e, b);
|
||||
a.moveCursorTo(0, 1);
|
||||
a.getSelection().selectDown();
|
||||
a.getSelection().selectRight();
|
||||
a.getSelection().selectRight();
|
||||
a.toggleCommentLines();
|
||||
assertEquals(" abc\ncde", b.toString());
|
||||
assertRange(0, 0, 1, 1, a.getSelectionRange())
|
||||
}, "test: comment lines - if the selection end is at the line start it should stay there":function() {
|
||||
var b = new c("abc\ncde", new g);
|
||||
b = new d(new e, b);
|
||||
b.moveCursorTo(0, 0);
|
||||
b.getSelection().selectDown();
|
||||
b.toggleCommentLines();
|
||||
assertRange(0, 2, 1, 0, b.getSelectionRange());
|
||||
b = new c("abc\ncde", new g);
|
||||
b = new d(new e, b);
|
||||
b.moveCursorTo(1, 0);
|
||||
b.getSelection().selectUp();
|
||||
b.toggleCommentLines();
|
||||
assertRange(0, 2, 1, 0, b.getSelectionRange())
|
||||
}, "test: move lines down should select moved lines":function() {
|
||||
var b = new c("11\n22\n33\n44"), a = new d(new e, b);
|
||||
a.moveCursorTo(0, 1);
|
||||
a.getSelection().selectDown();
|
||||
a.moveLinesDown();
|
||||
assertEquals("33\n11\n22\n44", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition());
|
||||
assertPosition(3, 0, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(1, 0, a.getSelection().getSelectionLead());
|
||||
a.moveLinesDown();
|
||||
assertEquals("33\n44\n11\n22", b.toString());
|
||||
assertPosition(2, 0, a.getCursorPosition());
|
||||
assertPosition(3, 2, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(2, 0, a.getSelection().getSelectionLead());
|
||||
a.moveLinesDown();
|
||||
assertEquals("33\n44\n11\n22", b.toString());
|
||||
assertPosition(2, 0, a.getCursorPosition());
|
||||
assertPosition(3, 2, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(2, 0, a.getSelection().getSelectionLead())
|
||||
}, "test: move lines up should select moved lines":function() {
|
||||
var b = new c("11\n22\n33\n44"), a = new d(new e, b);
|
||||
a.moveCursorTo(2, 1);
|
||||
a.getSelection().selectDown();
|
||||
a.moveLinesUp();
|
||||
assertEquals("11\n33\n44\n22", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition());
|
||||
assertPosition(3, 0, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(1, 0, a.getSelection().getSelectionLead());
|
||||
a.moveLinesUp();
|
||||
assertEquals("33\n44\n11\n22", b.toString());
|
||||
assertPosition(0, 0, a.getCursorPosition());
|
||||
assertPosition(2, 0, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(0, 0, a.getSelection().getSelectionLead())
|
||||
}, "test: move line without active selection should move cursor to start of the moved line":function() {
|
||||
var b = new c("11\n22\n33\n44"), a = new d(new e, b);
|
||||
a.moveCursorTo(1, 1);
|
||||
a.clearSelection();
|
||||
a.moveLinesDown();
|
||||
assertEquals("11\n33\n22\n44", b.toString());
|
||||
assertPosition(2, 0, a.getCursorPosition());
|
||||
a.clearSelection();
|
||||
a.moveLinesUp();
|
||||
assertEquals("11\n22\n33\n44", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition())
|
||||
}, "test: copy lines down should select lines and place cursor at the selection start":function() {
|
||||
var b = new c("11\n22\n33\n44"), a = new d(new e, b);
|
||||
a.moveCursorTo(1, 1);
|
||||
a.getSelection().selectDown();
|
||||
a.copyLinesDown();
|
||||
assertEquals("11\n22\n33\n22\n33\n44", b.toString());
|
||||
assertPosition(3, 0, a.getCursorPosition());
|
||||
assertPosition(5, 0, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(3, 0, a.getSelection().getSelectionLead())
|
||||
}, "test: copy lines up should select lines and place cursor at the selection start":function() {
|
||||
var b = new c("11\n22\n33\n44"), a = new d(new e, b);
|
||||
a.moveCursorTo(1, 1);
|
||||
a.getSelection().selectDown();
|
||||
a.copyLinesUp();
|
||||
assertEquals("11\n22\n33\n22\n33\n44", b.toString());
|
||||
assertPosition(1, 0, a.getCursorPosition());
|
||||
assertPosition(3, 0, a.getSelection().getSelectionAnchor());
|
||||
assertPosition(1, 0, a.getSelection().getSelectionLead())
|
||||
}, "test: input a tab with soft tab should convert it to spaces":function() {
|
||||
var b = new c(""), a = new d(new e, b);
|
||||
b.setTabSize(2);
|
||||
b.setUseSoftTabs(true);
|
||||
a.onTextInput("\t");
|
||||
assertEquals(" ", b.toString());
|
||||
b.setTabSize(5);
|
||||
a.onTextInput("\t");
|
||||
assertEquals(" ", b.toString())
|
||||
}, "test: input tab without soft tabs should keep the tab character":function() {
|
||||
var b = new c(""), a = new d(new e, b);
|
||||
b.setUseSoftTabs(false);
|
||||
a.onTextInput("\t");
|
||||
assertEquals("\t", b.toString())
|
||||
}})
|
||||
});
|
||||
27
build/ace/test/VirtualRendererTest.js
Normal file
27
build/ace/test/VirtualRendererTest.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/VirtualRenderer"], function(c, d) {
|
||||
new TestCase("VirtualRendererTest", {"test: screen2text the column should be rounded to the next character edge":function() {
|
||||
var b = document.createElement("div");
|
||||
b.style.left = "0px";
|
||||
b.style.top = "0px";
|
||||
b.style.width = "100px";
|
||||
b.style.height = "100px";
|
||||
document.body.style.margin = "0px";
|
||||
document.body.style.padding = "0px";
|
||||
document.body.appendChild(b);
|
||||
var a = new d(b);
|
||||
a.setDocument(new c("1234"));
|
||||
a.characterWidth = 10;
|
||||
a.lineHeight = 15;
|
||||
assertPosition(0, 0, a.screenToTextCoordinates(0, 0));
|
||||
assertPosition(0, 0, a.screenToTextCoordinates(4, 0));
|
||||
assertPosition(0, 1, a.screenToTextCoordinates(5, 0));
|
||||
assertPosition(0, 1, a.screenToTextCoordinates(9, 0));
|
||||
assertPosition(0, 1, a.screenToTextCoordinates(10, 0));
|
||||
assertPosition(0, 1, a.screenToTextCoordinates(14, 0));
|
||||
assertPosition(0, 2, a.screenToTextCoordinates(15, 0));
|
||||
document.body.removeChild(b)
|
||||
}})
|
||||
});
|
||||
4
build/ace/test/all.js
Normal file
4
build/ace/test/all.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require({paths:{ace:"../src/ace"}}, ["ace/test/assertions", "ace/test/ChangeDocumentTest"], function(a) {
|
||||
console.log(a);
|
||||
alert("a " + a)
|
||||
});
|
||||
16
build/ace/test/assertions.js
Normal file
16
build/ace/test/assertions.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def([], function() {
|
||||
window.assertPosition = function(a, b, c) {
|
||||
assertEquals(a, c.row);
|
||||
assertEquals(b, c.column)
|
||||
};
|
||||
window.assertRange = function(a, b, c, e, d) {
|
||||
assertPosition(a, b, d.start);
|
||||
assertPosition(c, e, d.end)
|
||||
};
|
||||
window.assertJsonEquals = function(a, b) {
|
||||
assertEquals(JSON.stringify(a), JSON.stringify(b))
|
||||
}
|
||||
});
|
||||
21
build/ace/test/mode/CssTest.js
Normal file
21
build/ace/test/mode/CssTest.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Range", "ace/mode/Css"], function(b, c, d) {
|
||||
new TestCase("mode.CssTest", {setUp:function() {
|
||||
this.mode = new d
|
||||
}, "test: toggle comment lines should not do anything":function() {
|
||||
var a = new b(" abc\ncde\nfg"), e = new c(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, e);
|
||||
assertEquals(" abc\ncde\nfg", a.toString())
|
||||
}, "test: lines should keep indentation":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " abc", " "));
|
||||
assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc", " "))
|
||||
}, "test: new line after { should increase indent":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " abc{", " "));
|
||||
assertEquals("\t ", this.mode.getNextLineIndent("start", "\tabc { ", " "))
|
||||
}, "test: no indent increase after { in a comment":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " /*{", " "));
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " /*{ ", " "))
|
||||
}})
|
||||
});
|
||||
26
build/ace/test/mode/CssTokenizerTest.js
Normal file
26
build/ace/test/mode/CssTokenizerTest.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/mode/Css"], function(b) {
|
||||
new TestCase("mode.CssTest", {setUp:function() {
|
||||
this.tokenizer = (new b).getTokenizer()
|
||||
}, "test: tokenize pixel number":function() {
|
||||
var a = this.tokenizer.getLineTokens("-12px", "start").tokens;
|
||||
assertEquals(1, a.length);
|
||||
assertEquals("number", a[0].type)
|
||||
}, "test: tokenize hex3 color":function() {
|
||||
var a = this.tokenizer.getLineTokens("#abc", "start").tokens;
|
||||
assertEquals(1, a.length);
|
||||
assertEquals("number", a[0].type)
|
||||
}, "test: tokenize hex6 color":function() {
|
||||
var a = this.tokenizer.getLineTokens("#abc012", "start").tokens;
|
||||
assertEquals(1, a.length);
|
||||
assertEquals("number", a[0].type)
|
||||
}, "test: tokenize parens":function() {
|
||||
var a = this.tokenizer.getLineTokens("{()}", "start").tokens;
|
||||
assertEquals(3, a.length);
|
||||
assertEquals("lparen", a[0].type);
|
||||
assertEquals("text", a[1].type);
|
||||
assertEquals("rparen", a[2].type)
|
||||
}})
|
||||
});
|
||||
16
build/ace/test/mode/HtmlTest.js
Normal file
16
build/ace/test/mode/HtmlTest.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Range", "ace/mode/Html"], function(b, c, d) {
|
||||
new TestCase("mode.HtmlTest", {setUp:function() {
|
||||
this.mode = new d
|
||||
}, "test: toggle comment lines should not do anything":function() {
|
||||
var a = new b([" abc", "cde", "fg"]), e = new c(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, e);
|
||||
assertEquals(" abc\ncde\nfg", a.toString())
|
||||
}, "test: next line indent should be the same as the current line indent":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " abc"));
|
||||
assertEquals("", this.mode.getNextLineIndent("start", "abc"));
|
||||
assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc"))
|
||||
}})
|
||||
});
|
||||
21
build/ace/test/mode/HtmlTokenizerTest.js
Normal file
21
build/ace/test/mode/HtmlTokenizerTest.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/mode/Html"], function(b) {
|
||||
new TestCase("mode.HtmlTest", {setUp:function() {
|
||||
this.tokenizer = (new b).getTokenizer()
|
||||
}, "test: tokenize embedded script":function() {
|
||||
var a = this.tokenizer.getLineTokens("<script a='a'>var<\/script>'123'", "start").tokens;
|
||||
assertEquals("text", a[0].type);
|
||||
assertEquals("keyword", a[1].type);
|
||||
assertEquals("text", a[2].type);
|
||||
assertEquals("keyword", a[3].type);
|
||||
assertEquals("text", a[4].type);
|
||||
assertEquals("string", a[5].type);
|
||||
assertEquals("text", a[6].type);
|
||||
assertEquals("keyword", a[7].type);
|
||||
assertEquals("text", a[8].type);
|
||||
assertEquals("keyword", a[9].type);
|
||||
assertEquals("text", a[10].type)
|
||||
}})
|
||||
});
|
||||
62
build/ace/test/mode/JavaScriptTest.js
Normal file
62
build/ace/test/mode/JavaScriptTest.js
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Range", "ace/Tokenizer", "ace/mode/JavaScript"], function(c, d, e, f) {
|
||||
new TestCase("mode.JavaScriptTest", {setUp:function() {
|
||||
this.mode = new f
|
||||
}, "test: getTokenizer() (smoke test)":function() {
|
||||
var a = this.mode.getTokenizer();
|
||||
assertTrue(a instanceof e);
|
||||
a = a.getLineTokens("'juhu'", "start").tokens;
|
||||
assertEquals("string", a[0].type)
|
||||
}, "test: toggle comment lines should prepend '//' to each line":function() {
|
||||
var a = new c([" abc", "cde", "fg"]), b = new d(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, b);
|
||||
assertEquals("// abc\n//cde\nfg", a.toString())
|
||||
}, "test: toggle comment on commented lines should remove leading '//' chars":function() {
|
||||
var a = new c(["// abc", "//cde", "fg"]), b = new d(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, b);
|
||||
assertEquals(" abc\ncde\nfg", a.toString())
|
||||
}, "test: toggle comment on multiple lines with one commented line prepend '//' to each line":function() {
|
||||
var a = new c(["// abc", "//cde", "fg"]), b = new d(0, 3, 2, 1);
|
||||
this.mode.toggleCommentLines("start", a, b);
|
||||
assertEquals("//// abc\n////cde\n//fg", a.toString())
|
||||
}, "test: toggle comment on a comment line with leading white space":function() {
|
||||
var a = new c(["//cde", " //fg"]), b = new d(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, b);
|
||||
assertEquals("cde\n fg", a.toString())
|
||||
}, "test: auto indent after opening brace":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", "if () {", " "))
|
||||
}, "test: no auto indent after opening brace in multi line comment":function() {
|
||||
assertEquals("", this.mode.getNextLineIndent("start", "/*if () {", " "));
|
||||
assertEquals(" ", this.mode.getNextLineIndent("comment", " abcd", " "))
|
||||
}, "test: no auto indent after opening brace in single line comment":function() {
|
||||
assertEquals("", this.mode.getNextLineIndent("start", "//if () {", " "));
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " //if () {", " "))
|
||||
}, "test: no auto indent should add to existing indent":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " if () {", " "));
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " cde", " "))
|
||||
}, "test: special indent in doc comments":function() {
|
||||
assertEquals(" * ", this.mode.getNextLineIndent("doc-start", "/**", " "));
|
||||
assertEquals(" * ", this.mode.getNextLineIndent("doc-start", " /**", " "));
|
||||
assertEquals(" * ", this.mode.getNextLineIndent("doc-start", " *", " "));
|
||||
assertEquals(" * ", this.mode.getNextLineIndent("doc-start", " *", " "));
|
||||
assertEquals(" ", this.mode.getNextLineIndent("doc-start", " abc", " "))
|
||||
}, "test: no indent after doc comments":function() {
|
||||
assertEquals("", this.mode.getNextLineIndent("doc-start", " */", " "))
|
||||
}, "test: trigger outdent if line is space and new text starts with closing brace":function() {
|
||||
assertTrue(this.mode.checkOutdent("start", " ", " }"));
|
||||
assertFalse(this.mode.checkOutdent("start", " a ", " }"));
|
||||
assertFalse(this.mode.checkOutdent("start", "", "}"));
|
||||
assertFalse(this.mode.checkOutdent("start", " ", "a }"));
|
||||
assertFalse(this.mode.checkOutdent("start", " }", "}"))
|
||||
}, "test: auto outdent should indent the line with the same indent as the line with the matching opening brace":function() {
|
||||
var a = new c([" function foo() {", " bla", " }"]);
|
||||
this.mode.autoOutdent("start", a, 2);
|
||||
assertEquals(" }", a.getLine(2))
|
||||
}, "test: no auto outdent if no matching brace is found":function() {
|
||||
var a = new c([" function foo()", " bla", " }"]);
|
||||
this.mode.autoOutdent("start", a, 2);
|
||||
assertEquals(" }", a.getLine(2))
|
||||
}})
|
||||
});
|
||||
34
build/ace/test/mode/JavaScriptTokenizerTest.js
Normal file
34
build/ace/test/mode/JavaScriptTokenizerTest.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/mode/JavaScript"], function(b) {
|
||||
new TestCase("mode.JavaScriptTokenizerTest", {setUp:function() {
|
||||
this.tokenizer = (new b).getTokenizer()
|
||||
}, "test: tokenize1":function() {
|
||||
var a = this.tokenizer.getLineTokens("foo = function", "start").tokens;
|
||||
assertEquals(3, a.length);
|
||||
assertEquals("identifier", a[0].type);
|
||||
assertEquals("text", a[1].type);
|
||||
assertEquals("keyword", a[2].type)
|
||||
}, "test: tokenize doc comment":function() {
|
||||
var a = this.tokenizer.getLineTokens("abc /** de */ fg", "start").tokens;
|
||||
assertEquals(5, a.length);
|
||||
assertEquals("identifier", a[0].type);
|
||||
assertEquals("text", a[1].type);
|
||||
assertEquals("doc-comment", a[2].type);
|
||||
assertEquals("text", a[3].type);
|
||||
assertEquals("identifier", a[4].type)
|
||||
}, "test: tokenize doc comment with tag":function() {
|
||||
var a = this.tokenizer.getLineTokens("/** @param {} */", "start").tokens;
|
||||
assertEquals(3, a.length);
|
||||
assertEquals("doc-comment", a[0].type);
|
||||
assertEquals("doc-comment-tag", a[1].type);
|
||||
assertEquals("doc-comment", a[2].type)
|
||||
}, "test: tokenize parens":function() {
|
||||
var a = this.tokenizer.getLineTokens("[{( )}]", "start").tokens;
|
||||
assertEquals(3, a.length);
|
||||
assertEquals("lparen", a[0].type);
|
||||
assertEquals("text", a[1].type);
|
||||
assertEquals("rparen", a[2].type)
|
||||
}})
|
||||
});
|
||||
14
build/ace/test/mode/TextTest.js
Normal file
14
build/ace/test/mode/TextTest.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Range", "ace/mode/Text"], function(b, c, d) {
|
||||
new TestCase("mode.TextTest", {setUp:function() {
|
||||
this.mode = new d
|
||||
}, "test: toggle comment lines should not do anything":function() {
|
||||
var a = new b([" abc", "cde", "fg"]), e = new c(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, e);
|
||||
assertEquals(" abc\ncde\nfg", a.toString())
|
||||
}, "text: lines should not be indented":function() {
|
||||
assertEquals("", this.mode.getNextLineIndent("start", " abc", " "))
|
||||
}})
|
||||
});
|
||||
21
build/ace/test/mode/XmlTest.js
Normal file
21
build/ace/test/mode/XmlTest.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/Document", "ace/Range", "ace/Tokenizer", "ace/mode/Xml"], function(b, c, d, e) {
|
||||
new TestCase("mode.XmlTest", {setUp:function() {
|
||||
this.mode = new e
|
||||
}, "test: getTokenizer() (smoke test)":function() {
|
||||
var a = this.mode.getTokenizer();
|
||||
assertTrue(a instanceof d);
|
||||
a = a.getLineTokens("<juhu>", "start").tokens;
|
||||
assertEquals("keyword", a[1].type)
|
||||
}, "test: toggle comment lines should not do anything":function() {
|
||||
var a = new b([" abc", "cde", "fg"]), f = new c(0, 3, 1, 1);
|
||||
this.mode.toggleCommentLines("start", a, f);
|
||||
assertEquals(" abc\ncde\nfg", a.toString())
|
||||
}, "test: next line indent should be the same as the current line indent":function() {
|
||||
assertEquals(" ", this.mode.getNextLineIndent("start", " abc"));
|
||||
assertEquals("", this.mode.getNextLineIndent("start", "abc"));
|
||||
assertEquals("\t", this.mode.getNextLineIndent("start", "\tabc"))
|
||||
}})
|
||||
});
|
||||
16
build/ace/test/mode/XmlTokenizerTest.js
Normal file
16
build/ace/test/mode/XmlTokenizerTest.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
||||
*/
|
||||
require.def(["ace/mode/Xml"], function(b) {
|
||||
new TestCase("mode.XmlTest", {setUp:function() {
|
||||
this.tokenizer = (new b).getTokenizer()
|
||||
}, "test: tokenize1":function() {
|
||||
var a = this.tokenizer.getLineTokens("<Juhu>//Juhu Kinners</Kinners>", "start").tokens;
|
||||
assertEquals(5, a.length);
|
||||
assertEquals("text", a[0].type);
|
||||
assertEquals("keyword", a[1].type);
|
||||
assertEquals("text", a[2].type);
|
||||
assertEquals("keyword", a[3].type);
|
||||
assertEquals("text", a[4].type)
|
||||
}})
|
||||
});
|
||||
4
build/ace/theme/Clouds.js
Normal file
4
build/ace/theme/Clouds.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/Clouds", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-clouds .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-clouds .ace_gutter-layer { width: 100%; text-align: right;}.ace-clouds .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-clouds .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-clouds .ace_scroller { background-color: #FFFFFF;}.ace-clouds .ace_text-layer { cursor: text; color: #000000;}.ace-clouds .ace_cursor { border-left: 2px solid #000000;}.ace-clouds .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-clouds .ace_marker-layer .ace_selection { background: #BDD5FC;}.ace-clouds .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds .ace_marker-layer .ace_active_line { background: #FFFBD1;} .ace-clouds .ace_invisible { color: #BFBFBF;}.ace-clouds .ace_keyword { color:#AF956F;}.ace-clouds .ace_keyword.ace_operator { color:#484848;}.ace-clouds .ace_constant { }.ace-clouds .ace_constant.ace_language { color:#39946A;}.ace-clouds .ace_constant.ace_library { }.ace-clouds .ace_constant.ace_numeric { color:#46A609;}.ace-clouds .ace_invalid { background-color:#FF002A;}.ace-clouds .ace_invalid.ace_illegal { }.ace-clouds .ace_invalid.ace_deprecated { }.ace-clouds .ace_support { }.ace-clouds .ace_support.ace_function { color:#C52727;}.ace-clouds .ace_function.ace_buildin { }.ace-clouds .ace_string { color:#5D90CD;}.ace-clouds .ace_string.ace_regexp { }.ace-clouds .ace_comment { color:#BCC8BA;}.ace-clouds .ace_comment.ace_doc { }.ace-clouds .ace_comment.ace_doc.ace_tag { }.ace-clouds .ace_variable { }.ace-clouds .ace_variable.ace_language { }.ace-clouds .ace_xml_pe { }");
|
||||
return{cssClass:"ace-clouds"}
|
||||
});
|
||||
4
build/ace/theme/CloudsMidnight.js
Normal file
4
build/ace/theme/CloudsMidnight.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/CloudsMidnight", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-clouds-midnight .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-clouds-midnight .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-clouds-midnight .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-clouds-midnight .ace_gutter-layer { width: 100%; text-align: right;}.ace-clouds-midnight .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-clouds-midnight .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-clouds-midnight .ace_scroller { background-color: #191919;}.ace-clouds-midnight .ace_text-layer { cursor: text; color: #929292;}.ace-clouds-midnight .ace_cursor { border-left: 2px solid #7DA5DC;}.ace-clouds-midnight .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #7DA5DC;} .ace-clouds-midnight .ace_marker-layer .ace_selection { background: #000000;}.ace-clouds-midnight .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-clouds-midnight .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #BFBFBF;}.ace-clouds-midnight .ace_marker-layer .ace_active_line { background: rgba(215, 215, 215, 0.031);} .ace-clouds-midnight .ace_invisible { color: #BFBFBF;}.ace-clouds-midnight .ace_keyword { color:#927C5D;}.ace-clouds-midnight .ace_keyword.ace_operator { color:#4B4B4B;}.ace-clouds-midnight .ace_constant { }.ace-clouds-midnight .ace_constant.ace_language { color:#39946A;}.ace-clouds-midnight .ace_constant.ace_library { }.ace-clouds-midnight .ace_constant.ace_numeric { color:#46A609;}.ace-clouds-midnight .ace_invalid { color:#FFFFFF;background-color:#E92E2E;}.ace-clouds-midnight .ace_invalid.ace_illegal { }.ace-clouds-midnight .ace_invalid.ace_deprecated { }.ace-clouds-midnight .ace_support { }.ace-clouds-midnight .ace_support.ace_function { color:#E92E2E;}.ace-clouds-midnight .ace_function.ace_buildin { }.ace-clouds-midnight .ace_string { color:#5D90CD;}.ace-clouds-midnight .ace_string.ace_regexp { }.ace-clouds-midnight .ace_comment { color:#3C403B;}.ace-clouds-midnight .ace_comment.ace_doc { }.ace-clouds-midnight .ace_comment.ace_doc.ace_tag { }.ace-clouds-midnight .ace_variable { }.ace-clouds-midnight .ace_variable.ace_language { }.ace-clouds-midnight .ace_xml_pe { }");
|
||||
return{cssClass:"ace-clouds-midnight"}
|
||||
});
|
||||
4
build/ace/theme/Cobalt.js
Normal file
4
build/ace/theme/Cobalt.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/Cobalt", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-cobalt .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-cobalt .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-cobalt .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-cobalt .ace_gutter-layer { width: 100%; text-align: right;}.ace-cobalt .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-cobalt .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-cobalt .ace_scroller { background-color: #002240;}.ace-cobalt .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-cobalt .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-cobalt .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-cobalt .ace_marker-layer .ace_selection { background: rgba(179, 101, 57, 0.75);}.ace-cobalt .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-cobalt .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.15);}.ace-cobalt .ace_marker-layer .ace_active_line { background: rgba(0, 0, 0, 0.35);} .ace-cobalt .ace_invisible { color: rgba(255, 255, 255, 0.15);}.ace-cobalt .ace_keyword { color:#FF9D00;}.ace-cobalt .ace_keyword.ace_operator { }.ace-cobalt .ace_constant { color:#FF628C;}.ace-cobalt .ace_constant.ace_language { }.ace-cobalt .ace_constant.ace_library { }.ace-cobalt .ace_constant.ace_numeric { }.ace-cobalt .ace_invalid { color:#F8F8F8;background-color:#800F00;}.ace-cobalt .ace_invalid.ace_illegal { }.ace-cobalt .ace_invalid.ace_deprecated { }.ace-cobalt .ace_support { color:#80FFBB;}.ace-cobalt .ace_support.ace_function { color:#FFB054;}.ace-cobalt .ace_function.ace_buildin { }.ace-cobalt .ace_string { }.ace-cobalt .ace_string.ace_regexp { color:#80FFC2;}.ace-cobalt .ace_comment { font-style:italic;color:#0088FF;}.ace-cobalt .ace_comment.ace_doc { }.ace-cobalt .ace_comment.ace_doc.ace_tag { }.ace-cobalt .ace_variable { color:#CCCCCC;}.ace-cobalt .ace_variable.ace_language { color:#FF80E1;}.ace-cobalt .ace_xml_pe { }");
|
||||
return{cssClass:"ace-cobalt"}
|
||||
});
|
||||
4
build/ace/theme/Dawn.js
Normal file
4
build/ace/theme/Dawn.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/Dawn", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-dawn .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-dawn .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-dawn .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-dawn .ace_gutter-layer { width: 100%; text-align: right;}.ace-dawn .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-dawn .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-dawn .ace_scroller { background-color: #F9F9F9;}.ace-dawn .ace_text-layer { cursor: text; color: #080808;}.ace-dawn .ace_cursor { border-left: 2px solid #000000;}.ace-dawn .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #000000;} .ace-dawn .ace_marker-layer .ace_selection { background: rgba(39, 95, 255, 0.30);}.ace-dawn .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-dawn .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(75, 75, 126, 0.50);}.ace-dawn .ace_marker-layer .ace_active_line { background: rgba(36, 99, 180, 0.12);} .ace-dawn .ace_invisible { color: rgba(75, 75, 126, 0.50);}.ace-dawn .ace_keyword { color:#794938;}.ace-dawn .ace_keyword.ace_operator { }.ace-dawn .ace_constant { color:#811F24;}.ace-dawn .ace_constant.ace_language { }.ace-dawn .ace_constant.ace_library { }.ace-dawn .ace_constant.ace_numeric { }.ace-dawn .ace_invalid { }.ace-dawn .ace_invalid.ace_illegal { text-decoration:underline;font-style:italic;color:#F8F8F8;background-color:#B52A1D;}.ace-dawn .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#B52A1D;}.ace-dawn .ace_support { color:#691C97;}.ace-dawn .ace_support.ace_function { color:#693A17;}.ace-dawn .ace_function.ace_buildin { }.ace-dawn .ace_string { color:#0B6125;}.ace-dawn .ace_string.ace_regexp { color:#CF5628;}.ace-dawn .ace_comment { font-style:italic;color:#5A525F;}.ace-dawn .ace_comment.ace_doc { }.ace-dawn .ace_comment.ace_doc.ace_tag { }.ace-dawn .ace_variable { color:#234A97;}.ace-dawn .ace_variable.ace_language { }.ace-dawn .ace_xml_pe { }");
|
||||
return{cssClass:"ace-dawn"}
|
||||
});
|
||||
5
build/ace/theme/Eclipse.js
Normal file
5
build/ace/theme/Eclipse.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require.def("ace/theme/Eclipse", ["ace/lib/dom", "text!ace/theme/eclipse.css!.ace-eclipse .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-eclipse .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-eclipse .ace_gutter {\n width: 40px;\n background: rgb(227, 227, 227);\n border-right: 1px solid rgb(159, 159, 159);\t \n color: rgb(136, 136, 136);\n}\n\n.ace-eclipse .ace_gutter-layer {\n right: 10px;\n text-align: right;\n}\n\n.ace-eclipse .ace_text-layer {\n cursor: text;\n}\n\n.ace-eclipse .ace_cursor {\n border-left: 1px solid black;\n}\n\n.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {\n color: rgb(127, 0, 85);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-eclipse .ace_line .ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-eclipse .ace_line .ace_string {\n color: rgb(42, 0, 255);\n}\n\n.ace-eclipse .ace_line .ace_comment {\n color: rgb(63, 127, 95);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc {\n color: rgb(63, 95, 191);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(127, 159, 191);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_numeric {\n}\n\n.ace-eclipse .ace_line .ace_tag {\n\tcolor: rgb(63, 127, 127);\n}\n\n.ace-eclipse .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-eclipse .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-eclipse .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-eclipse .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}"],
|
||||
function(a, b) {
|
||||
a.importCssString(b);
|
||||
return{cssClass:"ace-eclipse"}
|
||||
});
|
||||
4
build/ace/theme/IdleFingers.js
Normal file
4
build/ace/theme/IdleFingers.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/IdleFingers", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-idle-fingers .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-idle-fingers .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-idle-fingers .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-idle-fingers .ace_gutter-layer { width: 100%; text-align: right;}.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-idle-fingers .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-idle-fingers .ace_scroller { background-color: #323232;}.ace-idle-fingers .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-idle-fingers .ace_cursor { border-left: 2px solid #91FF00;}.ace-idle-fingers .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #91FF00;} .ace-idle-fingers .ace_marker-layer .ace_selection { background: rgba(90, 100, 126, 0.88);}.ace-idle-fingers .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-idle-fingers .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #404040;}.ace-idle-fingers .ace_marker-layer .ace_active_line { background: #353637;} .ace-idle-fingers .ace_invisible { color: #404040;}.ace-idle-fingers .ace_keyword { color:#CC7833;}.ace-idle-fingers .ace_keyword.ace_operator { }.ace-idle-fingers .ace_constant { color:#6C99BB;}.ace-idle-fingers .ace_constant.ace_language { }.ace-idle-fingers .ace_constant.ace_library { }.ace-idle-fingers .ace_constant.ace_numeric { }.ace-idle-fingers .ace_invalid { color:#FFFFFF;background-color:#FF0000;}.ace-idle-fingers .ace_invalid.ace_illegal { }.ace-idle-fingers .ace_invalid.ace_deprecated { }.ace-idle-fingers .ace_support { }.ace-idle-fingers .ace_support.ace_function { color:#B83426;}.ace-idle-fingers .ace_function.ace_buildin { }.ace-idle-fingers .ace_string { color:#A5C261;}.ace-idle-fingers .ace_string.ace_regexp { color:#CCCC33;}.ace-idle-fingers .ace_comment { font-style:italic;color:#BC9458;}.ace-idle-fingers .ace_comment.ace_doc { }.ace-idle-fingers .ace_comment.ace_doc.ace_tag { }.ace-idle-fingers .ace_variable { }.ace-idle-fingers .ace_variable.ace_language { }.ace-idle-fingers .ace_xml_pe { }");
|
||||
return{cssClass:"ace-idle-fingers"}
|
||||
});
|
||||
4
build/ace/theme/KrTheme.js
Normal file
4
build/ace/theme/KrTheme.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/KrTheme", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-kr-theme .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-kr-theme .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-kr-theme .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-kr-theme .ace_gutter-layer { width: 100%; text-align: right;}.ace-kr-theme .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-kr-theme .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-kr-theme .ace_scroller { background-color: #0B0A09;}.ace-kr-theme .ace_text-layer { cursor: text; color: #FCFFE0;}.ace-kr-theme .ace_cursor { border-left: 2px solid #FF9900;}.ace-kr-theme .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FF9900;} .ace-kr-theme .ace_marker-layer .ace_selection { background: rgba(170, 0, 255, 0.45);}.ace-kr-theme .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-kr-theme .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 177, 111, 0.32);}.ace-kr-theme .ace_marker-layer .ace_active_line { background: #38403D;} .ace-kr-theme .ace_invisible { color: rgba(255, 177, 111, 0.32);}.ace-kr-theme .ace_keyword { color:#949C8B;}.ace-kr-theme .ace_keyword.ace_operator { }.ace-kr-theme .ace_constant { color:rgba(210, 117, 24, 0.76);}.ace-kr-theme .ace_constant.ace_language { }.ace-kr-theme .ace_constant.ace_library { }.ace-kr-theme .ace_constant.ace_numeric { }.ace-kr-theme .ace_invalid { color:#F8F8F8;background-color:#A41300;}.ace-kr-theme .ace_invalid.ace_illegal { }.ace-kr-theme .ace_invalid.ace_deprecated { }.ace-kr-theme .ace_support { color:#9FC28A;}.ace-kr-theme .ace_support.ace_function { color:#85873A;}.ace-kr-theme .ace_function.ace_buildin { }.ace-kr-theme .ace_string { }.ace-kr-theme .ace_string.ace_regexp { color:rgba(125, 255, 192, 0.65);}.ace-kr-theme .ace_comment { font-style:italic;color:#706D5B;}.ace-kr-theme .ace_comment.ace_doc { }.ace-kr-theme .ace_comment.ace_doc.ace_tag { }.ace-kr-theme .ace_variable { color:#D1A796;}.ace-kr-theme .ace_variable.ace_language { color:#FF80E1;}.ace-kr-theme .ace_xml_pe { }");
|
||||
return{cssClass:"ace-kr-theme"}
|
||||
});
|
||||
4
build/ace/theme/MonoIndustrial.js
Normal file
4
build/ace/theme/MonoIndustrial.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/MonoIndustrial", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-mono-industrial .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-mono-industrial .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-mono-industrial .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-mono-industrial .ace_gutter-layer { width: 100%; text-align: right;}.ace-mono-industrial .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-mono-industrial .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-mono-industrial .ace_scroller { background-color: #222C28;}.ace-mono-industrial .ace_text-layer { cursor: text; color: #FFFFFF;}.ace-mono-industrial .ace_cursor { border-left: 2px solid #FFFFFF;}.ace-mono-industrial .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #FFFFFF;} .ace-mono-industrial .ace_marker-layer .ace_selection { background: rgba(145, 153, 148, 0.40);}.ace-mono-industrial .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-mono-industrial .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(102, 108, 104, 0.50);}.ace-mono-industrial .ace_marker-layer .ace_active_line { background: rgba(12, 13, 12, 0.25);} .ace-mono-industrial .ace_invisible { color: rgba(102, 108, 104, 0.50);}.ace-mono-industrial .ace_keyword { color:#A39E64;}.ace-mono-industrial .ace_keyword.ace_operator { color:#A8B3AB;}.ace-mono-industrial .ace_constant { color:#E98800;}.ace-mono-industrial .ace_constant.ace_language { }.ace-mono-industrial .ace_constant.ace_library { }.ace-mono-industrial .ace_constant.ace_numeric { color:#E98800;}.ace-mono-industrial .ace_invalid { color:#FFFFFF;background-color:rgba(153, 0, 0, 0.68);}.ace-mono-industrial .ace_invalid.ace_illegal { }.ace-mono-industrial .ace_invalid.ace_deprecated { }.ace-mono-industrial .ace_support { }.ace-mono-industrial .ace_support.ace_function { color:#588E60;}.ace-mono-industrial .ace_function.ace_buildin { }.ace-mono-industrial .ace_string { }.ace-mono-industrial .ace_string.ace_regexp { }.ace-mono-industrial .ace_comment { color:#666C68;background-color:#151C19;}.ace-mono-industrial .ace_comment.ace_doc { }.ace-mono-industrial .ace_comment.ace_doc.ace_tag { }.ace-mono-industrial .ace_variable { }.ace-mono-industrial .ace_variable.ace_language { color:#648BD2;}.ace-mono-industrial .ace_xml_pe { }");
|
||||
return{cssClass:"ace-mono-industrial"}
|
||||
});
|
||||
4
build/ace/theme/Monokai.js
Normal file
4
build/ace/theme/Monokai.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/Monokai", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-monokai .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-monokai .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-monokai .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-monokai .ace_gutter-layer { width: 100%; text-align: right;}.ace-monokai .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-monokai .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-monokai .ace_scroller { background-color: #272822;}.ace-monokai .ace_text-layer { cursor: text; color: #F8F8F2;}.ace-monokai .ace_cursor { border-left: 2px solid #F8F8F0;}.ace-monokai .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #F8F8F0;} .ace-monokai .ace_marker-layer .ace_selection { background: #49483E;}.ace-monokai .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-monokai .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid #49483E;}.ace-monokai .ace_marker-layer .ace_active_line { background: #49483E;} .ace-monokai .ace_invisible { color: #49483E;}.ace-monokai .ace_keyword { color:#F92672;}.ace-monokai .ace_keyword.ace_operator { }.ace-monokai .ace_constant { }.ace-monokai .ace_constant.ace_language { color:#AE81FF;}.ace-monokai .ace_constant.ace_library { }.ace-monokai .ace_constant.ace_numeric { color:#AE81FF;}.ace-monokai .ace_invalid { color:#F8F8F0;background-color:#F92672;}.ace-monokai .ace_invalid.ace_illegal { }.ace-monokai .ace_invalid.ace_deprecated { color:#F8F8F0;background-color:#AE81FF;}.ace-monokai .ace_support { }.ace-monokai .ace_support.ace_function { color:#66D9EF;}.ace-monokai .ace_function.ace_buildin { }.ace-monokai .ace_string { color:#E6DB74;}.ace-monokai .ace_string.ace_regexp { }.ace-monokai .ace_comment { color:#75715E;}.ace-monokai .ace_comment.ace_doc { }.ace-monokai .ace_comment.ace_doc.ace_tag { }.ace-monokai .ace_variable { }.ace-monokai .ace_variable.ace_language { }.ace-monokai .ace_xml_pe { }");
|
||||
return{cssClass:"ace-monokai"}
|
||||
});
|
||||
5
build/ace/theme/TextMate.js
Normal file
5
build/ace/theme/TextMate.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require.def("ace/theme/TextMate", ["ace/lib/dom", "text!ace/theme/tm.css!.ace-tm .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-tm .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-tm .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-tm .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-tm .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-tm .ace_editor .ace_printMargin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_text-layer {\n cursor: text;\n}\n\n.ace-tm .ace_cursor {\n border-left: 2px solid black;\n}\n\n.ace-tm .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid black;\n}\n \n.ace-tm .ace_line .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_line .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_line .ace_invalid {\n background-color: rgb(153, 0, 0);\n color: white;\n}\n\n.ace-tm .ace_line .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_line .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_line .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_line .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_line .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_line .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0) \n}"],
|
||||
function(a, b) {
|
||||
a.importCssString(b);
|
||||
return{cssClass:"ace-tm"}
|
||||
});
|
||||
4
build/ace/theme/Twilight.js
Normal file
4
build/ace/theme/Twilight.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require.def("ace/theme/Twilight", ["ace/lib/dom"], function(a) {
|
||||
a.importCssString(".ace-twilight .ace_editor { border: 2px solid rgb(159, 159, 159);}.ace-twilight .ace_editor.ace_focus { border: 2px solid #327fbd;}.ace-twilight .ace_gutter { width: 50px; background: #e8e8e8; color: #333; overflow : hidden;}.ace-twilight .ace_gutter-layer { width: 100%; text-align: right;}.ace-twilight .ace_gutter-layer .ace_gutter-cell { padding-right: 6px;}.ace-twilight .ace_editor .ace_printMargin { width: 1px; background: #e8e8e8;}.ace-twilight .ace_scroller { background-color: #141414;}.ace-twilight .ace_text-layer { cursor: text; color: #F8F8F8;}.ace-twilight .ace_cursor { border-left: 2px solid #A7A7A7;}.ace-twilight .ace_cursor.ace_overwrite { border-left: 0px; border-bottom: 1px solid #A7A7A7;} .ace-twilight .ace_marker-layer .ace_selection { background: rgba(221, 240, 255, 0.20);}.ace-twilight .ace_marker-layer .ace_step { background: rgb(198, 219, 174);}.ace-twilight .ace_marker-layer .ace_bracket { margin: -1px 0 0 -1px; border: 1px solid rgba(255, 255, 255, 0.25);}.ace-twilight .ace_marker-layer .ace_active_line { background: rgba(255, 255, 255, 0.031);} .ace-twilight .ace_invisible { color: rgba(255, 255, 255, 0.25);}.ace-twilight .ace_keyword { color:#CDA869;}.ace-twilight .ace_keyword.ace_operator { }.ace-twilight .ace_constant { color:#CF6A4C;}.ace-twilight .ace_constant.ace_language { }.ace-twilight .ace_constant.ace_library { }.ace-twilight .ace_constant.ace_numeric { }.ace-twilight .ace_invalid { }.ace-twilight .ace_invalid.ace_illegal { color:#F8F8F8;background-color:rgba(86, 45, 86, 0.75);}.ace-twilight .ace_invalid.ace_deprecated { text-decoration:underline;font-style:italic;color:#D2A8A1;}.ace-twilight .ace_support { color:#9B859D;}.ace-twilight .ace_support.ace_function { color:#DAD085;}.ace-twilight .ace_function.ace_buildin { }.ace-twilight .ace_string { color:#8F9D6A;}.ace-twilight .ace_string.ace_regexp { color:#E9C062;}.ace-twilight .ace_comment { font-style:italic;color:#5F5A60;}.ace-twilight .ace_comment.ace_doc { }.ace-twilight .ace_comment.ace_doc.ace_tag { }.ace-twilight .ace_variable { color:#7587A6;}.ace-twilight .ace_variable.ace_language { }.ace-twilight .ace_xml_pe { color:#494949;}");
|
||||
return{cssClass:"ace-twilight"}
|
||||
});
|
||||
64
build/ace/theme/eclipse.css
Normal file
64
build/ace/theme/eclipse.css
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
.ace-eclipse .ace_editor {
|
||||
border: 2px solid rgb(159, 159, 159);
|
||||
}
|
||||
.ace-eclipse .ace_editor.ace_focus {
|
||||
border: 2px solid #327fbd;
|
||||
}
|
||||
.ace-eclipse .ace_gutter {
|
||||
width: 40px;
|
||||
background: rgb(227, 227, 227);
|
||||
border-right: 1px solid rgb(159, 159, 159);
|
||||
color: rgb(136, 136, 136);
|
||||
}
|
||||
.ace-eclipse .ace_gutter-layer {
|
||||
right: 10px;
|
||||
text-align: right;
|
||||
}
|
||||
.ace-eclipse .ace_text-layer {
|
||||
cursor: text;
|
||||
}
|
||||
.ace-eclipse .ace_cursor {
|
||||
border-left: 1px solid black;
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {
|
||||
color: rgb(127, 0, 85);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_constant.ace_buildin {
|
||||
color: rgb(88, 72, 246);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_constant.ace_library {
|
||||
color: rgb(6, 150, 14);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_function {
|
||||
color: rgb(60, 76, 114);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_string {
|
||||
color: rgb(42, 0, 255);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_comment {
|
||||
color: rgb(63, 127, 95);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_comment.ace_doc {
|
||||
color: rgb(63, 95, 191);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {
|
||||
color: rgb(127, 159, 191);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_constant.ace_numeric {
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_tag {
|
||||
color: rgb(63, 127, 127);
|
||||
}
|
||||
.ace-eclipse .ace_line .ace_xml_pe {
|
||||
color: rgb(104, 104, 91);
|
||||
}
|
||||
.ace-eclipse .ace_marker-layer .ace_selection {
|
||||
background: rgb(181, 213, 255);
|
||||
}
|
||||
.ace-eclipse .ace_marker-layer .ace_bracket {
|
||||
margin: -1px 0 0 -1px;
|
||||
border: 1px solid rgb(192, 192, 192);
|
||||
}
|
||||
.ace-eclipse .ace_marker-layer .ace_active_line {
|
||||
background: rgb(232, 242, 254);
|
||||
}
|
||||
96
build/ace/theme/tm.css
Normal file
96
build/ace/theme/tm.css
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
.ace-tm .ace_editor {
|
||||
border: 2px solid rgb(159, 159, 159);
|
||||
}
|
||||
.ace-tm .ace_editor.ace_focus {
|
||||
border: 2px solid #327fbd;
|
||||
}
|
||||
.ace-tm .ace_gutter {
|
||||
width: 50px;
|
||||
background: #e8e8e8;
|
||||
color: #333;
|
||||
overflow : hidden;
|
||||
}
|
||||
.ace-tm .ace_gutter-layer {
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
.ace-tm .ace_gutter-layer .ace_gutter-cell {
|
||||
padding-right: 6px;
|
||||
}
|
||||
.ace-tm .ace_editor .ace_printMargin {
|
||||
width: 1px;
|
||||
background: #e8e8e8;
|
||||
}
|
||||
.ace-tm .ace_text-layer {
|
||||
cursor: text;
|
||||
}
|
||||
.ace-tm .ace_cursor {
|
||||
border-left: 2px solid black;
|
||||
}
|
||||
.ace-tm .ace_cursor.ace_overwrite {
|
||||
border-left: 0px;
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
.ace-tm .ace_line .ace_invisible {
|
||||
color: rgb(191, 191, 191);
|
||||
}
|
||||
.ace-tm .ace_line .ace_keyword {
|
||||
color: blue;
|
||||
}
|
||||
.ace-tm .ace_line .ace_constant.ace_buildin {
|
||||
color: rgb(88, 72, 246);
|
||||
}
|
||||
.ace-tm .ace_line .ace_constant.ace_library {
|
||||
color: rgb(6, 150, 14);
|
||||
}
|
||||
.ace-tm .ace_line .ace_invalid {
|
||||
background-color: rgb(153, 0, 0);
|
||||
color: white;
|
||||
}
|
||||
.ace-tm .ace_line .ace_support.ace_function {
|
||||
color: rgb(60, 76, 114);
|
||||
}
|
||||
.ace-tm .ace_line .ace_keyword.ace_operator {
|
||||
color: rgb(104, 118, 135);
|
||||
}
|
||||
.ace-tm .ace_line .ace_string {
|
||||
color: rgb(3, 106, 7);
|
||||
}
|
||||
.ace-tm .ace_line .ace_comment {
|
||||
color: rgb(76, 136, 107);
|
||||
}
|
||||
.ace-tm .ace_line .ace_comment.ace_doc {
|
||||
color: rgb(0, 102, 255);
|
||||
}
|
||||
.ace-tm .ace_line .ace_comment.ace_doc.ace_tag {
|
||||
color: rgb(128, 159, 191);
|
||||
}
|
||||
.ace-tm .ace_line .ace_constant.ace_numeric {
|
||||
color: rgb(0, 0, 205);
|
||||
}
|
||||
.ace-tm .ace_line .ace_variable {
|
||||
color: rgb(49, 132, 149);
|
||||
}
|
||||
.ace-tm .ace_line .ace_xml_pe {
|
||||
color: rgb(104, 104, 91);
|
||||
}
|
||||
.ace-tm .ace_marker-layer .ace_selection {
|
||||
background: rgb(181, 213, 255);
|
||||
}
|
||||
.ace-tm .ace_marker-layer .ace_step {
|
||||
background: rgb(252, 255, 0);
|
||||
}
|
||||
.ace-tm .ace_marker-layer .ace_stack {
|
||||
background: rgb(164, 229, 101);
|
||||
}
|
||||
.ace-tm .ace_marker-layer .ace_bracket {
|
||||
margin: -1px 0 0 -1px;
|
||||
border: 1px solid rgb(192, 192, 192);
|
||||
}
|
||||
.ace-tm .ace_marker-layer .ace_active_line {
|
||||
background: rgb(232, 242, 254);
|
||||
}
|
||||
.ace-tm .ace_string.ace_regex {
|
||||
color: rgb(255, 0, 0)
|
||||
}
|
||||
57
build/build.txt
Normal file
57
build/build.txt
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
ace/Editor.js
|
||||
----------------
|
||||
ace/lib/oop.js
|
||||
ace/lib/core.js
|
||||
ace/lib/event.js
|
||||
ace/lib/lang.js
|
||||
ace/TextInput.js
|
||||
ace/conf/keybindings/default_mac.js
|
||||
ace/conf/keybindings/default_win.js
|
||||
ace/PluginManager.js
|
||||
ace/commands/DefaultCommands.js
|
||||
ace/KeyBinding.js
|
||||
ace/MEventEmitter.js
|
||||
ace/Range.js
|
||||
ace/Selection.js
|
||||
ace/Tokenizer.js
|
||||
ace/mode/TextHighlightRules.js
|
||||
ace/mode/Text.js
|
||||
ace/Document.js
|
||||
ace/Search.js
|
||||
ace/BackgroundTokenizer.js
|
||||
ace/Editor.js
|
||||
ace/UndoManager.js
|
||||
ace/lib/dom.js
|
||||
ace/layer/Gutter.js
|
||||
ace/layer/Marker.js
|
||||
ace/layer/Text.js
|
||||
ace/layer/Cursor.js
|
||||
ace/ScrollBar.js
|
||||
ace/RenderLoop.js
|
||||
ace/VirtualRenderer.js
|
||||
ace/mode/DocCommentHighlightRules.js
|
||||
ace/mode/JavaScriptHighlightRules.js
|
||||
ace/mode/MatchingBraceOutdent.js
|
||||
ace/mode/JavaScript.js
|
||||
ace/theme/TextMate.js
|
||||
|
||||
ace/theme/Eclipse.js
|
||||
----------------
|
||||
ace/theme/Eclipse.js
|
||||
|
||||
ace/mode/Xml.js
|
||||
----------------
|
||||
ace/mode/XmlHighlightRules.js
|
||||
ace/mode/Xml.js
|
||||
|
||||
ace/mode/Css.js
|
||||
----------------
|
||||
ace/mode/CssHighlightRules.js
|
||||
ace/mode/MatchingBraceOutdent.js
|
||||
ace/mode/Css.js
|
||||
|
||||
ace/mode/Html.js
|
||||
----------------
|
||||
ace/mode/HtmlHighlightRules.js
|
||||
ace/mode/Html.js
|
||||
134
build/require/i18n.js
Normal file
134
build/require/i18n.js
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
RequireJS i18n Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
(function() {
|
||||
function p(a, c) {
|
||||
c = c.nlsWaiting;
|
||||
return c[a] || (c[a] = c[c.push({_name:a}) - 1])
|
||||
}
|
||||
function n(a, c, e, b) {
|
||||
var d, i, h, k, j, g, f = "root";
|
||||
i = e.split("-");
|
||||
h = [];
|
||||
k = p(a, b);
|
||||
for(d = i.length;d > -1;d--) {
|
||||
j = d ? i.slice(0, d).join("-") : "root";
|
||||
if(g = c[j]) {
|
||||
if(e === b.config.locale && !k._match) {
|
||||
k._match = j
|
||||
}if(f === "root") {
|
||||
f = j
|
||||
}k[j] = j;
|
||||
if(g === true) {
|
||||
g = a.split("/");
|
||||
g.splice(-1, 0, j);
|
||||
g = g.join("/");
|
||||
if(!b.specified[g] && !(g in b.loaded) && !b.defined[g]) {
|
||||
b.defPlugin[g] = "i18n";
|
||||
h.push(g)
|
||||
}
|
||||
}
|
||||
}
|
||||
}if(f !== e) {
|
||||
if(b.defined[f]) {
|
||||
b.defined[e] = b.defined[f]
|
||||
}else {
|
||||
k[e] = f
|
||||
}
|
||||
}h.length && require(h, b.contextName)
|
||||
}
|
||||
var q = /(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/, r = {};
|
||||
require.plugin({prefix:"i18n", require:function(a, c, e, b) {
|
||||
var d, i = b.defined[a];
|
||||
d = q.exec(a);
|
||||
if(d[5]) {
|
||||
a = d[1] + d[5];
|
||||
c = p(a, b);
|
||||
c[d[4]] = d[4];
|
||||
c = b.nls[a];
|
||||
if(!c) {
|
||||
b.defPlugin[a] = "i18n";
|
||||
require([a], b.contextName);
|
||||
c = b.nls[a] = {}
|
||||
}c[d[4]] = e
|
||||
}else {
|
||||
if(c = b.nls[a]) {
|
||||
require.mixin(c, i)
|
||||
}else {
|
||||
c = b.nls[a] = i
|
||||
}b.nlsRootLoaded[a] = true;
|
||||
if(d = b.nlsToLoad[a]) {
|
||||
delete b.nlsToLoad[a];
|
||||
for(e = 0;e < d.length;e++) {
|
||||
n(a, c, d[e], b)
|
||||
}
|
||||
}n(a, c, b.config.locale, b)
|
||||
}
|
||||
}, newContext:function(a) {
|
||||
require.mixin(a, {nlsWaiting:[], nls:{}, nlsRootLoaded:{}, nlsToLoad:{}});
|
||||
if(!a.config.locale) {
|
||||
a.config.locale = typeof navigator === "undefined" ? "root" : (navigator.language || navigator.userLanguage || "root").toLowerCase()
|
||||
}
|
||||
}, load:function(a, c) {
|
||||
var e = require.s.contexts[c], b;
|
||||
b = q.exec(a);
|
||||
var d = b[4];
|
||||
if(b[5]) {
|
||||
a = b[1] + b[5];
|
||||
b = e.nls[a];
|
||||
if(e.nlsRootLoaded[a] && b) {
|
||||
n(a, b, d, e)
|
||||
}else {
|
||||
(e.nlsToLoad[a] || (e.nlsToLoad[a] = [])).push(d);
|
||||
e.defPlugin[a] = "i18n";
|
||||
require([a], c)
|
||||
}
|
||||
}else {
|
||||
if(!e.nlsRootLoaded[a]) {
|
||||
e.defPlugin[a] = "i18n";
|
||||
require.load(a, c)
|
||||
}
|
||||
}
|
||||
}, checkDeps:function() {
|
||||
}, isWaiting:function(a) {
|
||||
return!!a.nlsWaiting.length
|
||||
}, orderDeps:function(a) {
|
||||
var c, e, b, d, i, h, k, j, g, f, o, m, s = a.nlsWaiting, l;
|
||||
a.nlsWaiting = [];
|
||||
a.nlsToLoad = {};
|
||||
for(c = 0;d = s[c];c++) {
|
||||
b = d._name;
|
||||
i = a.nls[b];
|
||||
o = null;
|
||||
h = b.split("/");
|
||||
g = h.slice(0, h.length - 1).join("/");
|
||||
k = h[h.length - 1];
|
||||
for(f in d) {
|
||||
if(f !== "_name" && !(f in r)) {
|
||||
if(f === "_match") {
|
||||
o = d[f]
|
||||
}else {
|
||||
if(d[f] !== f) {
|
||||
(l || (l = {}))[f] = d[f]
|
||||
}else {
|
||||
j = {};
|
||||
h = f.split("-");
|
||||
for(e = h.length;e > 0;e--) {
|
||||
m = h.slice(0, e).join("-");
|
||||
m !== "root" && i[m] && require.mixin(j, i[m])
|
||||
}i.root && require.mixin(j, i.root);
|
||||
a.defined[g + "/" + f + "/" + k] = j
|
||||
}
|
||||
}
|
||||
}
|
||||
}a.defined[b] = a.defined[g + "/" + o + "/" + k];
|
||||
if(l) {
|
||||
for(f in l) {
|
||||
f in r || (a.defined[g + "/" + f + "/" + k] = a.defined[g + "/" + l[f] + "/" + k])
|
||||
}
|
||||
}
|
||||
}
|
||||
}})
|
||||
})();
|
||||
43
build/require/jsonp.js
Normal file
43
build/require/jsonp.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
RequireJS jsonp Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
(function() {
|
||||
var j = 0;
|
||||
require._jsonp = {};
|
||||
require.plugin({prefix:"jsonp", require:function() {
|
||||
}, newContext:function(a) {
|
||||
require.mixin(a, {jsonpWaiting:[]})
|
||||
}, load:function(a, d) {
|
||||
var b = a.indexOf("?"), c = a.substring(0, b);
|
||||
b = a.substring(b + 1, a.length);
|
||||
var f = require.s.contexts[d], i = {name:a}, g = "f" + j++, h = require.s.head, e = h.ownerDocument.createElement("script");
|
||||
require._jsonp[g] = function(k) {
|
||||
i.value = k;
|
||||
f.loaded[a] = true;
|
||||
setTimeout(function() {
|
||||
h.removeChild(e);
|
||||
delete require._jsonp[g]
|
||||
}, 15)
|
||||
};
|
||||
f.jsonpWaiting.push(i);
|
||||
c = require.nameToUrl(c, "?", d);
|
||||
c += (c.indexOf("?") === -1 ? "?" : "") + b.replace("?", "require._jsonp." + g);
|
||||
f.loaded[a] = false;
|
||||
e.type = "text/javascript";
|
||||
e.charset = "utf-8";
|
||||
e.src = c;
|
||||
e.async = true;
|
||||
h.appendChild(e)
|
||||
}, checkDeps:function() {
|
||||
}, isWaiting:function(a) {
|
||||
return!!a.jsonpWaiting.length
|
||||
}, orderDeps:function(a) {
|
||||
var d, b, c = a.jsonpWaiting;
|
||||
a.jsonpWaiting = [];
|
||||
for(d = 0;b = c[d];d++) {
|
||||
a.defined[b.name] = b.value
|
||||
}
|
||||
}})
|
||||
})();
|
||||
43
build/require/order.js
Normal file
43
build/require/order.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
RequireJS order Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
(function() {
|
||||
function g(a) {
|
||||
var b = a.currentTarget || a.srcElement, c, d, e, f;
|
||||
if(a.type === "load" || h.test(b.readyState)) {
|
||||
d = b.getAttribute("data-requirecontext");
|
||||
c = b.getAttribute("data-requiremodule");
|
||||
a = require.s.contexts[d];
|
||||
e = a.orderWaiting;
|
||||
f = a.orderCached;
|
||||
f[c] = true;
|
||||
for(c = 0;f[e[c]];c++);c > 0 && require(e.splice(0, c), d);
|
||||
if(!e.length) {
|
||||
a.orderCached = {}
|
||||
}setTimeout(function() {
|
||||
b.parentNode.removeChild(b)
|
||||
}, 15)
|
||||
}
|
||||
}
|
||||
var i = window.opera && Object.prototype.toString.call(window.opera) === "[object Opera]" || "MozAppearance" in document.documentElement.style, h = /^(complete|loaded)$/;
|
||||
require.plugin({prefix:"order", require:function() {
|
||||
}, newContext:function(a) {
|
||||
require.mixin(a, {orderWaiting:[], orderCached:{}})
|
||||
}, load:function(a, b) {
|
||||
var c = require.s.contexts[b], d = require.nameToUrl(a, null, b);
|
||||
require.s.skipAsync[d] = true;
|
||||
if(i) {
|
||||
require([a], b)
|
||||
}else {
|
||||
c.orderWaiting.push(a);
|
||||
c.loaded[a] = false;
|
||||
require.attach(d, b, a, g, "script/cache")
|
||||
}
|
||||
}, checkDeps:function() {
|
||||
}, isWaiting:function(a) {
|
||||
return!!a.orderWaiting.length
|
||||
}, orderDeps:function() {
|
||||
}})
|
||||
})();
|
||||
13
build/require/rhino.js
Normal file
13
build/require/rhino.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
RequireJS rhino Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
require.load = function(b, a) {
|
||||
var c = require.nameToUrl(b, null, a);
|
||||
a = require.s.contexts[a];
|
||||
require.s.isDone = false;
|
||||
a.loaded[b] = false;
|
||||
load(c);
|
||||
require.completeLoad(b, a)
|
||||
};
|
||||
94
build/require/text.js
Normal file
94
build/require/text.js
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
RequireJS text Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
(function() {
|
||||
var j = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"], l = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, m = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im;
|
||||
if(!require.textStrip) {
|
||||
require.textStrip = function(a) {
|
||||
if(a) {
|
||||
a = a.replace(l, "");
|
||||
var c = a.match(m);
|
||||
if(c) {
|
||||
a = c[1]
|
||||
}
|
||||
}else {
|
||||
a = ""
|
||||
}return a
|
||||
}
|
||||
}if(!require.getXhr) {
|
||||
require.getXhr = function() {
|
||||
var a, c, b;
|
||||
if(typeof XMLHttpRequest !== "undefined") {
|
||||
return new XMLHttpRequest
|
||||
}else {
|
||||
for(c = 0;c < 3;c++) {
|
||||
b = j[c];
|
||||
try {
|
||||
a = new ActiveXObject(b)
|
||||
}catch(g) {
|
||||
}if(a) {
|
||||
j = [b];
|
||||
break
|
||||
}
|
||||
}
|
||||
}if(!a) {
|
||||
throw new Error("require.getXhr(): XMLHttpRequest not available");
|
||||
}return a
|
||||
}
|
||||
}if(!require.fetchText) {
|
||||
require.fetchText = function(a, c) {
|
||||
var b = require.getXhr();
|
||||
b.open("GET", a, true);
|
||||
b.onreadystatechange = function() {
|
||||
b.readyState === 4 && c(b.responseText)
|
||||
};
|
||||
b.send(null)
|
||||
}
|
||||
}require.plugin({prefix:"text", require:function() {
|
||||
}, newContext:function(a) {
|
||||
require.mixin(a, {text:{}, textWaiting:[]})
|
||||
}, load:function(a, c) {
|
||||
var b = false, g = null, e, d = a.indexOf("."), k = a.substring(0, d), h = a.substring(d + 1, a.length), f = require.s.contexts[c], i = f.textWaiting;
|
||||
d = h.indexOf("!");
|
||||
if(d !== -1) {
|
||||
b = h.substring(d + 1, h.length);
|
||||
h = h.substring(0, d);
|
||||
d = b.indexOf("!");
|
||||
if(d !== -1 && b.substring(0, d) === "strip") {
|
||||
g = b.substring(d + 1, b.length);
|
||||
b = "strip"
|
||||
}else {
|
||||
if(b !== "strip") {
|
||||
g = b;
|
||||
b = null
|
||||
}
|
||||
}
|
||||
}e = k + "!" + h;
|
||||
d = b ? e + "!" + b : e;
|
||||
if(g !== null && !f.text[e]) {
|
||||
f.defined[a] = f.text[e] = g
|
||||
}else {
|
||||
if(!f.text[e] && !f.textWaiting[e] && !f.textWaiting[d]) {
|
||||
i[d] || (i[d] = i[i.push({name:a, key:e, fullKey:d, strip:!!b}) - 1]);
|
||||
c = require.nameToUrl(k, "." + h, c);
|
||||
f.loaded[a] = false;
|
||||
require.fetchText(c, function(n) {
|
||||
f.text[e] = n;
|
||||
f.loaded[a] = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}, checkDeps:function() {
|
||||
}, isWaiting:function(a) {
|
||||
return!!a.textWaiting.length
|
||||
}, orderDeps:function(a) {
|
||||
var c, b, g, e = a.textWaiting;
|
||||
a.textWaiting = [];
|
||||
for(c = 0;b = e[c];c++) {
|
||||
g = a.text[b.key];
|
||||
a.defined[b.name] = b.strip ? require.textStrip(g) : g
|
||||
}
|
||||
}})
|
||||
})();
|
||||
14
build/require/transportD.js
Normal file
14
build/require/transportD.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
RequireJS transportD Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
|
||||
Available via the MIT or new BSD license.
|
||||
see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
require.define = function(c, d) {
|
||||
var b, a;
|
||||
for(b in c) {
|
||||
if(c.hasOwnProperty(b)) {
|
||||
a = c[b];
|
||||
require.def(b, (a.injects || ["require", "exports", "module"]).concat(d || []), typeof a === "function" ? a : a.factory)
|
||||
}
|
||||
}
|
||||
};
|
||||
299
demo/editor-build.html
Normal file
299
demo/editor-build.html
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font: sans-serif;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana;
|
||||
font-size: 12px;
|
||||
background: rgb(14, 98, 165);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#editor {
|
||||
top: 55px;
|
||||
left: 0px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#controls {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
#jump {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid red;
|
||||
z-index: 10000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="require.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../build/ace/Editor.js" type="text/javascript" charset="utf-8"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="jump"></div>
|
||||
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/TextMate">TextMate</option>
|
||||
<option value="ace/theme/Eclipse">Eclipse</option>
|
||||
<option value="ace/theme/Dawn">Dawn</option>
|
||||
<option value="ace/theme/IdleFingers">idleFingers</option>
|
||||
<option value="ace/theme/Twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="select_style">Full line selections</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td>
|
||||
<label for="highlight_active">Highlight active line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<img src="logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
require(
|
||||
{baseUrl: "../build"},
|
||||
[
|
||||
"ace/lib/event",
|
||||
"ace/Editor",
|
||||
"ace/VirtualRenderer",
|
||||
"ace/theme/TextMate",
|
||||
"ace/Document",
|
||||
"ace/mode/JavaScript",
|
||||
"ace/mode/Css",
|
||||
"ace/mode/Html",
|
||||
"ace/mode/Xml",
|
||||
"ace/mode/Text",
|
||||
"ace/UndoManager"
|
||||
], function(event, Editor, Renderer, theme, Document, JavaScriptMode, CssMode, HtmlMode, XmlMode, TextMode, UndoManager) {
|
||||
|
||||
var docs = {}
|
||||
|
||||
docs.js = new Document(document.getElementById("jstext").innerHTML);
|
||||
docs.js.setMode(new JavaScriptMode());
|
||||
docs.js.setUndoManager(new UndoManager());
|
||||
|
||||
docs.css = new Document(document.getElementById("csstext").innerHTML);
|
||||
docs.css.setMode(new CssMode());
|
||||
docs.css.setUndoManager(new UndoManager());
|
||||
|
||||
docs.html = new Document(document.getElementById("htmltext").innerHTML);
|
||||
docs.html.setMode(new HtmlMode());
|
||||
docs.html.setUndoManager(new UndoManager());
|
||||
|
||||
var docEl = document.getElementById("doc");
|
||||
|
||||
function onDocChange() {
|
||||
var doc = getDoc();
|
||||
editor.setDocument(doc);
|
||||
|
||||
var mode = doc.getMode();
|
||||
if (mode instanceof JavaScriptMode) {
|
||||
modeEl.value = "javascript"
|
||||
}
|
||||
else if (mode instanceof CssMode) {
|
||||
modeEl.value = "css"
|
||||
}
|
||||
else if (mode instanceof HtmlMode) {
|
||||
modeEl.value = "html"
|
||||
}
|
||||
else if (mode instanceof XmlMode) {
|
||||
modeEl.value = "xml"
|
||||
}
|
||||
else {
|
||||
modeEl.value = "text"
|
||||
}
|
||||
|
||||
editor.focus();
|
||||
}
|
||||
docEl.onchange = onDocChange;
|
||||
|
||||
function getDoc() {
|
||||
return docs[docEl.value];
|
||||
}
|
||||
|
||||
var modeEl = document.getElementById("mode");
|
||||
modeEl.onchange = function() {
|
||||
editor.getDocument().setMode(modes[modeEl.value] || modes.text);
|
||||
};
|
||||
|
||||
var modes = {
|
||||
text: new TextMode(),
|
||||
xml: new XmlMode(),
|
||||
html: new HtmlMode(),
|
||||
css: new CssMode(),
|
||||
javascript: new JavaScriptMode()
|
||||
};
|
||||
|
||||
function getMode() {
|
||||
return modes[modeEl.value];
|
||||
}
|
||||
|
||||
var themeEl = document.getElementById("theme");
|
||||
themeEl.onchange = function() {
|
||||
editor.setTheme(themeEl.value);
|
||||
};
|
||||
|
||||
var selectEl = document.getElementById("select_style");
|
||||
selectEl.onchange = function() {
|
||||
if (selectEl.checked) {
|
||||
editor.setSelectionStyle("line");
|
||||
} else {
|
||||
editor.setSelectionStyle("text");
|
||||
}
|
||||
};
|
||||
|
||||
var activeEl = document.getElementById("highlight_active");
|
||||
activeEl.onchange = function() {
|
||||
editor.setHighlightActiveLine(!!activeEl.checked);
|
||||
};
|
||||
|
||||
var container = document.getElementById("editor");
|
||||
var editor = new Editor(new Renderer(container, theme));
|
||||
onDocChange();
|
||||
|
||||
window.jump = function() {
|
||||
var jump = document.getElementById("jump")
|
||||
var cursor = editor.getCursorPosition()
|
||||
var pos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column);
|
||||
jump.style.left = pos.pageX + "px";
|
||||
jump.style.top = pos.pageY + "px";
|
||||
jump.style.display = "block";
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
container.style.width = (document.documentElement.clientWidth - 4) + "px";
|
||||
container.style.height = (document.documentElement.clientHeight - 55 - 4) + "px";
|
||||
editor.resize();
|
||||
};
|
||||
|
||||
window.onresize = onResize;
|
||||
onResize();
|
||||
|
||||
event.addListener(container, "dragover", function(e) {
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
event.addListener(container, "drop", function(e) {
|
||||
try {
|
||||
var file = e.dataTransfer.files[0];
|
||||
} catch(e) {
|
||||
return event.stopEvent();
|
||||
}
|
||||
|
||||
if (window.FileReader) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
editor.getSelection().selectAll();
|
||||
|
||||
var mode = "text";
|
||||
if (/^.*\.js$/i.test(file.name)) {
|
||||
mode = "javascript";
|
||||
} else if (/^.*\.xml$/i.test(file.name)) {
|
||||
mode = "xml";
|
||||
} else if (/^.*\.html$/i.test(file.name)) {
|
||||
mode = "html";
|
||||
} else if (/^.*\.css$/i.test(file.name)) {
|
||||
mode = "css";
|
||||
}
|
||||
|
||||
editor.onTextInput(reader.result);
|
||||
|
||||
modeEl.value = mode;
|
||||
editor.getDocument().setMode(modes[mode]);
|
||||
}
|
||||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
298
demo/editor.html
Normal file
298
demo/editor.html
Normal file
|
|
@ -0,0 +1,298 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font: sans-serif;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana;
|
||||
font-size: 12px;
|
||||
background: rgb(14, 98, 165);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#editor {
|
||||
top: 55px;
|
||||
left: 0px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#controls {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
#jump {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid red;
|
||||
z-index: 10000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="require.js" type="text/javascript" charset="utf-8"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="jump"></div>
|
||||
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/TextMate">TextMate</option>
|
||||
<option value="ace/theme/Eclipse">Eclipse</option>
|
||||
<option value="ace/theme/Dawn">Dawn</option>
|
||||
<option value="ace/theme/IdleFingers">idleFingers</option>
|
||||
<option value="ace/theme/Twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="select_style">Full line selections</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td>
|
||||
<label for="highlight_active">Highlight active line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<img src="logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
require(
|
||||
{baseUrl: "../lib"},
|
||||
[
|
||||
"ace/lib/event",
|
||||
"ace/Editor",
|
||||
"ace/VirtualRenderer",
|
||||
"ace/theme/TextMate",
|
||||
"ace/Document",
|
||||
"ace/mode/JavaScript",
|
||||
"ace/mode/Css",
|
||||
"ace/mode/Html",
|
||||
"ace/mode/Xml",
|
||||
"ace/mode/Text",
|
||||
"ace/UndoManager"
|
||||
], function(event, Editor, Renderer, theme, Document, JavaScriptMode, CssMode, HtmlMode, XmlMode, TextMode, UndoManager) {
|
||||
|
||||
var docs = {}
|
||||
|
||||
docs.js = new Document(document.getElementById("jstext").innerHTML);
|
||||
docs.js.setMode(new JavaScriptMode());
|
||||
docs.js.setUndoManager(new UndoManager());
|
||||
|
||||
docs.css = new Document(document.getElementById("csstext").innerHTML);
|
||||
docs.css.setMode(new CssMode());
|
||||
docs.css.setUndoManager(new UndoManager());
|
||||
|
||||
docs.html = new Document(document.getElementById("htmltext").innerHTML);
|
||||
docs.html.setMode(new HtmlMode());
|
||||
docs.html.setUndoManager(new UndoManager());
|
||||
|
||||
var docEl = document.getElementById("doc");
|
||||
|
||||
function onDocChange() {
|
||||
var doc = getDoc();
|
||||
editor.setDocument(doc);
|
||||
|
||||
var mode = doc.getMode();
|
||||
if (mode instanceof JavaScriptMode) {
|
||||
modeEl.value = "javascript"
|
||||
}
|
||||
else if (mode instanceof CssMode) {
|
||||
modeEl.value = "css"
|
||||
}
|
||||
else if (mode instanceof HtmlMode) {
|
||||
modeEl.value = "html"
|
||||
}
|
||||
else if (mode instanceof XmlMode) {
|
||||
modeEl.value = "xml"
|
||||
}
|
||||
else {
|
||||
modeEl.value = "text"
|
||||
}
|
||||
|
||||
editor.focus();
|
||||
}
|
||||
docEl.onchange = onDocChange;
|
||||
|
||||
function getDoc() {
|
||||
return docs[docEl.value];
|
||||
}
|
||||
|
||||
var modeEl = document.getElementById("mode");
|
||||
modeEl.onchange = function() {
|
||||
editor.getDocument().setMode(modes[modeEl.value] || modes.text);
|
||||
};
|
||||
|
||||
var modes = {
|
||||
text: new TextMode(),
|
||||
xml: new XmlMode(),
|
||||
html: new HtmlMode(),
|
||||
css: new CssMode(),
|
||||
javascript: new JavaScriptMode()
|
||||
};
|
||||
|
||||
function getMode() {
|
||||
return modes[modeEl.value];
|
||||
}
|
||||
|
||||
var themeEl = document.getElementById("theme");
|
||||
themeEl.onchange = function() {
|
||||
editor.setTheme(themeEl.value);
|
||||
};
|
||||
|
||||
var selectEl = document.getElementById("select_style");
|
||||
selectEl.onchange = function() {
|
||||
if (selectEl.checked) {
|
||||
editor.setSelectionStyle("line");
|
||||
} else {
|
||||
editor.setSelectionStyle("text");
|
||||
}
|
||||
};
|
||||
|
||||
var activeEl = document.getElementById("highlight_active");
|
||||
activeEl.onchange = function() {
|
||||
editor.setHighlightActiveLine(!!activeEl.checked);
|
||||
};
|
||||
|
||||
var container = document.getElementById("editor");
|
||||
var editor = new Editor(new Renderer(container, theme));
|
||||
onDocChange();
|
||||
|
||||
window.jump = function() {
|
||||
var jump = document.getElementById("jump")
|
||||
var cursor = editor.getCursorPosition()
|
||||
var pos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column);
|
||||
jump.style.left = pos.pageX + "px";
|
||||
jump.style.top = pos.pageY + "px";
|
||||
jump.style.display = "block";
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
container.style.width = (document.documentElement.clientWidth - 4) + "px";
|
||||
container.style.height = (document.documentElement.clientHeight - 55 - 4) + "px";
|
||||
editor.resize();
|
||||
};
|
||||
|
||||
window.onresize = onResize;
|
||||
onResize();
|
||||
|
||||
event.addListener(container, "dragover", function(e) {
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
event.addListener(container, "drop", function(e) {
|
||||
try {
|
||||
var file = e.dataTransfer.files[0];
|
||||
} catch(e) {
|
||||
return event.stopEvent();
|
||||
}
|
||||
|
||||
if (window.FileReader) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
editor.getSelection().selectAll();
|
||||
|
||||
var mode = "text";
|
||||
if (/^.*\.js$/i.test(file.name)) {
|
||||
mode = "javascript";
|
||||
} else if (/^.*\.xml$/i.test(file.name)) {
|
||||
mode = "xml";
|
||||
} else if (/^.*\.html$/i.test(file.name)) {
|
||||
mode = "html";
|
||||
} else if (/^.*\.css$/i.test(file.name)) {
|
||||
mode = "css";
|
||||
}
|
||||
|
||||
editor.onTextInput(reader.result);
|
||||
|
||||
modeEl.value = mode;
|
||||
editor.getDocument().setMode(modes[mode]);
|
||||
}
|
||||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
demo/logo.png
Normal file
BIN
demo/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
2397
demo/require.js
Normal file
2397
demo/require.js
Normal file
File diff suppressed because it is too large
Load diff
61
doc/Editor.mm
Normal file
61
doc/Editor.mm
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<map version="0.8.0">
|
||||
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
|
||||
<node CREATED="1270106801605" ID="Freemind_Link_1615101381" MODIFIED="1270106809036" TEXT="Editor">
|
||||
<node CREATED="1270106809716" ID="_" MODIFIED="1270106896494" POSITION="right" TEXT="core features">
|
||||
<node CREATED="1270106812606" ID="Freemind_Link_941515617" MODIFIED="1270106824625" TEXT="text input"/>
|
||||
<node CREATED="1270106825885" ID="Freemind_Link_871701424" MODIFIED="1270106831385" TEXT="key navigation"/>
|
||||
<node CREATED="1270106831861" ID="Freemind_Link_497186050" MODIFIED="1270106836217" TEXT="shortcuts"/>
|
||||
<node CREATED="1270106836717" ID="Freemind_Link_53741891" MODIFIED="1270106841480" TEXT="copy&paste"/>
|
||||
<node CREATED="1270106842020" ID="Freemind_Link_985111837" MODIFIED="1270106846968" TEXT="drag&drop"/>
|
||||
<node CREATED="1270106849069" ID="Freemind_Link_81832450" MODIFIED="1270106852800" TEXT="selection"/>
|
||||
<node CREATED="1270106853508" ID="Freemind_Link_1490464696" MODIFIED="1270106861072" TEXT="syntax highlighting"/>
|
||||
<node CREATED="1270106861565" ID="Freemind_Link_1400628964" MODIFIED="1270106864776" TEXT="line numbers"/>
|
||||
<node CREATED="1270106865228" ID="Freemind_Link_1547807601" MODIFIED="1270106879192" TEXT="breakpoints (gutter)"/>
|
||||
</node>
|
||||
<node CREATED="1270106901715" ID="Freemind_Link_621059230" MODIFIED="1270106915606" POSITION="right" TEXT="additional features">
|
||||
<node CREATED="1270106916179" ID="Freemind_Link_138436821" MODIFIED="1270106921566" TEXT="column highlight"/>
|
||||
<node CREATED="1271052933294" ID="Freemind_Link_725020862" MODIFIED="1271052942879" TEXT="comment selection"/>
|
||||
<node CREATED="1270106922066" ID="Freemind_Link_1177585742" MODIFIED="1270106928030" TEXT="rectangular selection"/>
|
||||
<node CREATED="1270106928514" ID="Freemind_Link_1778337415" MODIFIED="1270106933390" TEXT="undo/redo"/>
|
||||
<node CREATED="1270106936530" ID="Freemind_Link_1313653586" MODIFIED="1270106939485" TEXT="auto indent"/>
|
||||
<node CREATED="1270106940626" ID="Freemind_Link_785606540" MODIFIED="1270106943653" TEXT="match braces"/>
|
||||
<node CREATED="1270106944617" ID="Freemind_Link_265205410" MODIFIED="1270106951045" TEXT="auto insert of code blocks"/>
|
||||
<node CREATED="1270106951682" ID="Freemind_Link_1064064918" MODIFIED="1270106955581" TEXT="autocomplete"/>
|
||||
<node CREATED="1270106957130" ID="Freemind_Link_1118872285" MODIFIED="1270106964437" TEXT="mark-highlight-variables"/>
|
||||
<node CREATED="1270106965257" ID="Freemind_Link_977412851" MODIFIED="1270106967828" TEXT="code folding"/>
|
||||
<node CREATED="1270106969353" ID="Freemind_Link_1003992965" MODIFIED="1270106972165" TEXT="refactoring"/>
|
||||
</node>
|
||||
<node CREATED="1270106975057" FOLDED="true" ID="Freemind_Link_1471854995" MODIFIED="1270106981986" POSITION="right" TEXT="supported browsers">
|
||||
<node CREATED="1270106983313" ID="Freemind_Link_594954564" MODIFIED="1270106988068" TEXT="IE 6-9"/>
|
||||
<node CREATED="1270106988584" ID="Freemind_Link_1809785833" MODIFIED="1270107014323" TEXT="FF 3 >= 3"/>
|
||||
<node CREATED="1270107000488" ID="Freemind_Link_497511816" MODIFIED="1270107008460" TEXT="Webkit >= 4"/>
|
||||
<node CREATED="1270107015287" ID="Freemind_Link_417983587" MODIFIED="1270107017819" TEXT="Chrome"/>
|
||||
<node CREATED="1270107018191" ID="Freemind_Link_393314987" MODIFIED="1270107038858" TEXT="Opera 9 or >= 10?"/>
|
||||
</node>
|
||||
<node CREATED="1271052795069" ID="Freemind_Link_674657297" MODIFIED="1271061756598" POSITION="left" TEXT="Ideas">
|
||||
<node CREATED="1271052800596" ID="Freemind_Link_1094064295" MODIFIED="1271052804602" TEXT="jsTestDriver"/>
|
||||
<node CREATED="1271052805542" FOLDED="true" ID="Freemind_Link_1473541975" MODIFIED="1271052813414" TEXT="Bindings">
|
||||
<node CREATED="1271052813802" ID="Freemind_Link_779313331" MODIFIED="1271052821938" TEXT="jquery"/>
|
||||
<node CREATED="1271052822527" ID="Freemind_Link_467300132" MODIFIED="1271052825604" TEXT="yql"/>
|
||||
<node CREATED="1271052825952" ID="Freemind_Link_622561431" MODIFIED="1271052828013" TEXT="qooxdoo"/>
|
||||
<node CREATED="1271052830859" ID="Freemind_Link_18779066" MODIFIED="1271052833496" TEXT="APF!"/>
|
||||
</node>
|
||||
<node CREATED="1271052839079" ID="Freemind_Link_439583810" MODIFIED="1271052852530" TEXT="Options">
|
||||
<node CREATED="1271052853166" ID="Freemind_Link_629899491" MODIFIED="1271052860101" TEXT="Tabs to spaces"/>
|
||||
<node CREATED="1271052862867" ID="Freemind_Link_746641062" MODIFIED="1271052866129" TEXT="Spaces to tabs"/>
|
||||
<node CREATED="1271052866517" ID="Freemind_Link_192666733" MODIFIED="1271052869210" TEXT="tab width"/>
|
||||
<node CREATED="1271052879027" ID="Freemind_Link_778966191" MODIFIED="1271052882825" TEXT="Language switch">
|
||||
<node CREATED="1271052883285" ID="Freemind_Link_436205918" MODIFIED="1271052895231" TEXT="highlighting"/>
|
||||
<node CREATED="1271052896052" ID="Freemind_Link_799407328" MODIFIED="1271052900474" TEXT="indent/outdent"/>
|
||||
<node CREATED="1271052900934" ID="Freemind_Link_62594174" MODIFIED="1271052907981" TEXT="comment block"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1271061753644" ID="Freemind_Link_1898747747" MODIFIED="1271061761714" POSITION="left" TEXT="Competition">
|
||||
<node CREATED="1271061762151" ID="Freemind_Link_248244633" MODIFIED="1271061764275" TEXT="bespin"/>
|
||||
<node CREATED="1271061764616" ID="Freemind_Link_1186004994" MODIFIED="1271061768509" TEXT="codeMirror"/>
|
||||
<node CREATED="1271061780744" ID="Freemind_Link_457888774" LINK="http://www.cdolivet.com/index.php?page=editArea" MODIFIED="1271061808808" TEXT="editarea"/>
|
||||
<node CREATED="1271061827047" ID="Freemind_Link_1466305116" LINK="http://www.amyeditor.com/" MODIFIED="1271061845504" TEXT="Amy editor"/>
|
||||
</node>
|
||||
</node>
|
||||
</map>
|
||||
135
lib/ace/BackgroundTokenizer.js
Normal file
135
lib/ace/BackgroundTokenizer.js
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/**
|
||||
* 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>
|
||||
*/
|
||||
require.def("ace/BackgroundTokenizer", ["ace/lib/oop", "ace/MEventEmitter"], function(oop, MEventEmitter) {
|
||||
|
||||
var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
this.running = false;
|
||||
this.textLines = [];
|
||||
this.lines = [];
|
||||
this.currentLine = 0;
|
||||
this.tokenizer = tokenizer;
|
||||
|
||||
var self = this;
|
||||
|
||||
this.$worker = function() {
|
||||
if (!self.running) { return; }
|
||||
|
||||
var workerStart = new Date();
|
||||
var startLine = self.currentLine;
|
||||
var textLines = self.textLines;
|
||||
|
||||
var processedLines = 0;
|
||||
var lastVisibleRow = editor.getLastVisibleRow();
|
||||
|
||||
while (self.currentLine < textLines.length) {
|
||||
self.lines[self.currentLine] = self.$tokenizeRows(self.currentLine, self.currentLine)[0];
|
||||
self.currentLine++;
|
||||
|
||||
// only check every 5 lines
|
||||
processedLines += 1;
|
||||
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
|
||||
self.fireUpdateEvent(startLine, self.currentLine-1);
|
||||
|
||||
var timeout = self.currentLine < lastVisibleRow ? 20 : 100;
|
||||
self.running = setTimeout(self.$worker, timeout);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
self.running = false;
|
||||
|
||||
self.fireUpdateEvent(startLine, textLines.length - 1);
|
||||
};
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
||||
oop.implement(this, MEventEmitter);
|
||||
|
||||
this.setTokenizer = function(tokenizer) {
|
||||
this.tokenizer = tokenizer;
|
||||
this.lines = [];
|
||||
|
||||
this.start(0);
|
||||
};
|
||||
|
||||
this.setLines = function(textLines) {
|
||||
this.textLines = textLines;
|
||||
this.lines = [];
|
||||
|
||||
this.stop();
|
||||
};
|
||||
|
||||
this.fireUpdateEvent = function(firstRow, lastRow) {
|
||||
var data = {
|
||||
first: firstRow,
|
||||
last: lastRow
|
||||
};
|
||||
this.$dispatchEvent("update", {data: data});
|
||||
};
|
||||
|
||||
this.start = function(startRow) {
|
||||
this.currentLine = Math.min(startRow || 0, this.currentLine,
|
||||
this.textLines.length);
|
||||
|
||||
// remove all cached items below this line
|
||||
this.lines.splice(this.currentLine, this.lines.length);
|
||||
|
||||
this.stop();
|
||||
// pretty long delay to prevent the tokenizer from interfering with the user
|
||||
this.running = setTimeout(this.$worker, 700);
|
||||
};
|
||||
|
||||
this.stop = function() {
|
||||
if (this.running)
|
||||
clearTimeout(this.running);
|
||||
this.running = false;
|
||||
};
|
||||
|
||||
this.getTokens = function(firstRow, lastRow, callback) {
|
||||
callback(this.$tokenizeRows(firstRow, lastRow));
|
||||
};
|
||||
|
||||
this.getState = function(row, callback) {
|
||||
callback(this.$tokenizeRows(row, row)[0].state);
|
||||
};
|
||||
|
||||
this.$tokenizeRows = function(firstRow, lastRow) {
|
||||
var rows = [];
|
||||
|
||||
// determine start state
|
||||
var state = "start";
|
||||
var doCache = false;
|
||||
if (firstRow > 0 && this.lines[firstRow - 1]) {
|
||||
state = this.lines[firstRow - 1].state;
|
||||
doCache = true;
|
||||
}
|
||||
|
||||
for (var row=firstRow; row<=lastRow; row++) {
|
||||
if (!this.lines[row]) {
|
||||
var tokens = this.tokenizer.getLineTokens(this.textLines[row] || "", state);
|
||||
var state = tokens.state;
|
||||
rows.push(tokens);
|
||||
|
||||
if (doCache) {
|
||||
this.lines[row] = tokens;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var tokens = this.lines[row];
|
||||
state = tokens.state;
|
||||
rows.push(tokens);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
};
|
||||
|
||||
}).call(BackgroundTokenizer.prototype);
|
||||
|
||||
return BackgroundTokenizer;
|
||||
});
|
||||
721
lib/ace/Document.js
Normal file
721
lib/ace/Document.js
Normal file
|
|
@ -0,0 +1,721 @@
|
|||
/**
|
||||
* 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>
|
||||
*/
|
||||
require.def("ace/Document",
|
||||
[
|
||||
"ace/lib/oop",
|
||||
"ace/lib/lang",
|
||||
"ace/MEventEmitter",
|
||||
"ace/Selection",
|
||||
"ace/mode/Text",
|
||||
"ace/Range"
|
||||
], function(oop, lang, MEventEmitter, Selection, TextMode, Range) {
|
||||
|
||||
var Document = function(text, mode) {
|
||||
this.modified = true;
|
||||
this.lines = [];
|
||||
this.selection = new Selection(this);
|
||||
this.$breakpoints = [];
|
||||
|
||||
this.listeners = [];
|
||||
if (mode) {
|
||||
this.setMode(mode);
|
||||
}
|
||||
|
||||
if (lang.isArray(text)) {
|
||||
this.$insertLines(0, text);
|
||||
} else {
|
||||
this.$insert({row: 0, column: 0}, text);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
oop.implement(this, MEventEmitter);
|
||||
|
||||
this.$undoManager = null;
|
||||
|
||||
this.$split = function(text) {
|
||||
return text.split(/\r\n|\r|\n/);
|
||||
};
|
||||
|
||||
this.setValue = function(text) {
|
||||
var args = [0, this.lines.length];
|
||||
args.push.apply(args, this.$split(text));
|
||||
this.lines.splice.apply(this.lines, args);
|
||||
this.modified = true;
|
||||
this.fireChangeEvent(0);
|
||||
};
|
||||
|
||||
this.toString = function() {
|
||||
return this.lines.join(this.$getNewLineCharacter());
|
||||
};
|
||||
|
||||
this.getSelection = function() {
|
||||
return this.selection;
|
||||
};
|
||||
|
||||
this.fireChangeEvent = function(firstRow, lastRow) {
|
||||
var data = {
|
||||
firstRow: firstRow,
|
||||
lastRow: lastRow
|
||||
};
|
||||
this.$dispatchEvent("change", { data: data});
|
||||
};
|
||||
|
||||
this.setUndoManager = function(undoManager) {
|
||||
this.$undoManager = undoManager;
|
||||
this.$deltas = [];
|
||||
|
||||
if (this.$informUndoManager) {
|
||||
this.$informUndoManager.cancel();
|
||||
}
|
||||
|
||||
if (undoManager) {
|
||||
//undoManager.setDocument(this);
|
||||
var self = this;
|
||||
this.$informUndoManager = lang.deferredCall(function() {
|
||||
if (self.$deltas.length > 0)
|
||||
undoManager.execute({
|
||||
action : "aceupdate",
|
||||
args : [self.$deltas, self]
|
||||
});
|
||||
self.$deltas = [];
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.$defaultUndoManager = {
|
||||
undo: function() {},
|
||||
redo: function() {}
|
||||
};
|
||||
|
||||
this.getUndoManager = function() {
|
||||
return this.$undoManager || this.$defaultUndoManager;
|
||||
},
|
||||
|
||||
this.getTabString = function() {
|
||||
if (this.getUseSoftTabs()) {
|
||||
return lang.stringRepeat(" ", this.getTabSize());
|
||||
} else {
|
||||
return "\t";
|
||||
}
|
||||
};
|
||||
|
||||
this.$useSoftTabs = true;
|
||||
this.setUseSoftTabs = function(useSoftTabs) {
|
||||
if (this.$useSoftTabs === useSoftTabs) return;
|
||||
|
||||
this.$useSoftTabs = useSoftTabs;
|
||||
};
|
||||
|
||||
this.getUseSoftTabs = function() {
|
||||
return this.$useSoftTabs;
|
||||
};
|
||||
|
||||
this.$tabSize = 4;
|
||||
this.setTabSize = function(tabSize) {
|
||||
if (isNaN(tabSize) || this.$tabSize === tabSize) return;
|
||||
|
||||
this.modified = true;
|
||||
this.$tabSize = tabSize;
|
||||
this.$dispatchEvent("changeTabSize");
|
||||
};
|
||||
|
||||
this.getTabSize = function() {
|
||||
return this.$tabSize;
|
||||
};
|
||||
|
||||
this.getBreakpoints = function() {
|
||||
return this.$breakpoints;
|
||||
};
|
||||
|
||||
this.setBreakpoints = function(rows) {
|
||||
this.$breakpoints = [];
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
this.$breakpoints[rows[i]] = true;
|
||||
}
|
||||
this.$dispatchEvent("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
this.clearBreakpoints = function() {
|
||||
this.$breakpoints = [];
|
||||
this.$dispatchEvent("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
this.setBreakpoint = function(row) {
|
||||
this.$breakpoints[row] = true;
|
||||
this.$dispatchEvent("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
this.clearBreakpoint = function(row) {
|
||||
delete this.$breakpoints[row];
|
||||
this.$dispatchEvent("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
this.$detectNewLine = function(text) {
|
||||
var match = text.match(/^.*?(\r?\n)/m);
|
||||
if (match) {
|
||||
this.$autoNewLine = match[1];
|
||||
} else {
|
||||
this.$autoNewLine = "\n";
|
||||
}
|
||||
};
|
||||
|
||||
this.tokenRe = /^[\w\d]+/g;
|
||||
this.nonTokenRe = /^[^\w\d]+/g;
|
||||
|
||||
this.getWordRange = function(row, column) {
|
||||
var line = this.getLine(row);
|
||||
|
||||
var inToken = false;
|
||||
if (column > 0) {
|
||||
inToken = !!line.charAt(column - 1).match(this.tokenRe);
|
||||
}
|
||||
|
||||
if (!inToken) {
|
||||
inToken = !!line.charAt(column).match(this.tokenRe);
|
||||
}
|
||||
|
||||
var re = inToken ? this.tokenRe : this.nonTokenRe;
|
||||
|
||||
var start = column;
|
||||
if (start > 0) {
|
||||
do {
|
||||
start--;
|
||||
}
|
||||
while (start >= 0 && line.charAt(start).match(re));
|
||||
start++;
|
||||
}
|
||||
|
||||
var end = column;
|
||||
while (end < line.length && line.charAt(end).match(re)) {
|
||||
end++;
|
||||
}
|
||||
|
||||
return new Range(row, start, row, end);
|
||||
};
|
||||
|
||||
this.$getNewLineCharacter = function() {
|
||||
switch (this.$newLineMode) {
|
||||
case "windows":
|
||||
return "\r\n";
|
||||
|
||||
case "unix":
|
||||
return "\n";
|
||||
|
||||
case "auto":
|
||||
return this.$autoNewLine;
|
||||
}
|
||||
},
|
||||
|
||||
this.$autoNewLine = "\n";
|
||||
this.$newLineMode = "auto";
|
||||
this.setNewLineMode = function(newLineMode) {
|
||||
if (this.$newLineMode === newLineMode) return;
|
||||
|
||||
this.$newLineMode = newLineMode;
|
||||
};
|
||||
|
||||
this.getNewLineMode = function() {
|
||||
return this.$newLineMode;
|
||||
};
|
||||
|
||||
this.$mode = null;
|
||||
this.setMode = function(mode) {
|
||||
if (this.$mode === mode) return;
|
||||
|
||||
this.$mode = mode;
|
||||
this.$dispatchEvent("changeMode");
|
||||
};
|
||||
|
||||
this.getMode = function() {
|
||||
if (!this.$mode) {
|
||||
this.$mode = new TextMode();
|
||||
}
|
||||
return this.$mode;
|
||||
};
|
||||
|
||||
this.$scrollTop = 0;
|
||||
this.setScrollTopRow = function(scrollTopRow) {
|
||||
if (this.$scrollTop === scrollTopRow) return;
|
||||
|
||||
this.$scrollTop = scrollTopRow;
|
||||
this.$dispatchEvent("changeScrollTop");
|
||||
};
|
||||
|
||||
this.getScrollTopRow = function() {
|
||||
return this.$scrollTop;
|
||||
};
|
||||
|
||||
this.getWidth = function() {
|
||||
this.$computeWidth();
|
||||
return this.width;
|
||||
};
|
||||
|
||||
this.getScreenWidth = function() {
|
||||
this.$computeWidth();
|
||||
return this.screenWith;
|
||||
};
|
||||
|
||||
this.$computeWidth = function() {
|
||||
if (this.modified) {
|
||||
this.modified = false;
|
||||
|
||||
var lines = this.lines;
|
||||
var longestLine = 0;
|
||||
var longestScreenLine = 0;
|
||||
var tabSize = this.getTabSize();
|
||||
|
||||
for ( var i = 0; i < lines.length; i++) {
|
||||
var len = lines[i].length;
|
||||
longestLine = Math.max(longestLine, len);
|
||||
|
||||
lines[i].replace("\t", function(m) {
|
||||
len += tabSize-1;
|
||||
return m;
|
||||
});
|
||||
longestScreenLine = Math.max(longestScreenLine, len);
|
||||
}
|
||||
this.width = longestLine;
|
||||
this.screenWith = longestScreenLine;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a verbatim copy of the given line as it is in the document
|
||||
*/
|
||||
this.getLine = function(row) {
|
||||
return this.lines[row] || "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a line as it is displayed on screen. Tabs are replaced by spaces.
|
||||
*/
|
||||
this.getDisplayLine = function(row) {
|
||||
var tab = new Array(this.getTabSize()+1).join(" ");
|
||||
return this.lines[row].replace(/\t/g, tab);
|
||||
};
|
||||
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.lines.slice(firstRow, lastRow+1);
|
||||
};
|
||||
|
||||
this.getLength = function() {
|
||||
return this.lines.length;
|
||||
};
|
||||
|
||||
this.getTextRange = function(range) {
|
||||
if (range.start.row == range.end.row) {
|
||||
return this.lines[range.start.row].substring(range.start.column,
|
||||
range.end.column);
|
||||
}
|
||||
else {
|
||||
var lines = [];
|
||||
lines.push(this.lines[range.start.row].substring(range.start.column));
|
||||
lines.push.apply(lines, this.getLines(range.start.row+1, range.end.row-1));
|
||||
lines.push(this.lines[range.end.row].substring(0, range.end.column));
|
||||
return lines.join(this.$getNewLineCharacter());
|
||||
}
|
||||
};
|
||||
|
||||
this.findMatchingBracket = function(position) {
|
||||
if (position.column == 0) return null;
|
||||
|
||||
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
|
||||
if (charBeforeCursor == "") return null;
|
||||
|
||||
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (match[1]) {
|
||||
return this.$findClosingBracket(match[1], position);
|
||||
} else {
|
||||
return this.$findOpeningBracket(match[2], position);
|
||||
}
|
||||
};
|
||||
|
||||
this.$brackets = {
|
||||
")": "(",
|
||||
"(": ")",
|
||||
"]": "[",
|
||||
"[": "]",
|
||||
"{": "}",
|
||||
"}": "{"
|
||||
};
|
||||
|
||||
this.$findOpeningBracket = function(bracket, position) {
|
||||
var openBracket = this.$brackets[bracket];
|
||||
|
||||
var column = position.column - 2;
|
||||
var row = position.row;
|
||||
var depth = 1;
|
||||
|
||||
var line = this.getLine(row);
|
||||
|
||||
while (true) {
|
||||
while(column >= 0) {
|
||||
var chr = line.charAt(column);
|
||||
if (chr == openBracket) {
|
||||
depth -= 1;
|
||||
if (depth == 0) {
|
||||
return {row: row, column: column};
|
||||
}
|
||||
}
|
||||
else if (chr == bracket) {
|
||||
depth +=1;
|
||||
}
|
||||
column -= 1;
|
||||
}
|
||||
row -=1;
|
||||
if (row < 0) break;
|
||||
|
||||
var line = this.getLine(row);
|
||||
var column = line.length-1;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.$findClosingBracket = function(bracket, position) {
|
||||
var closingBracket = this.$brackets[bracket];
|
||||
|
||||
var column = position.column;
|
||||
var row = position.row;
|
||||
var depth = 1;
|
||||
|
||||
var line = this.getLine(row);
|
||||
var lineCount = this.getLength();
|
||||
|
||||
while (true) {
|
||||
while(column < line.length) {
|
||||
var chr = line.charAt(column);
|
||||
if (chr == closingBracket) {
|
||||
depth -= 1;
|
||||
if (depth == 0) {
|
||||
return {row: row, column: column};
|
||||
}
|
||||
}
|
||||
else if (chr == bracket) {
|
||||
depth +=1;
|
||||
}
|
||||
column += 1;
|
||||
}
|
||||
row +=1;
|
||||
if (row >= lineCount) break;
|
||||
|
||||
var line = this.getLine(row);
|
||||
var column = 0;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.insert = function(position, text, fromUndo) {
|
||||
var end = this.$insert(position, text, fromUndo);
|
||||
this.fireChangeEvent(position.row, position.row == end.row ? position.row
|
||||
: undefined);
|
||||
return end;
|
||||
};
|
||||
|
||||
this.$insertLines = function(row, lines, fromUndo) {
|
||||
if (lines.length == 0)
|
||||
return;
|
||||
|
||||
var args = [row, 0];
|
||||
args.push.apply(args, lines);
|
||||
this.lines.splice.apply(this.lines, args);
|
||||
|
||||
if (!fromUndo && this.$undoManager) {
|
||||
var nl = this.$getNewLineCharacter();
|
||||
this.$deltas.push({
|
||||
action: "insertText",
|
||||
range: new Range(row, 0, row + lines.length, 0),
|
||||
text: lines.join(nl) + nl
|
||||
});
|
||||
this.$informUndoManager.schedule();
|
||||
}
|
||||
},
|
||||
|
||||
this.$insert = function(position, text, fromUndo) {
|
||||
if (text.length == 0)
|
||||
return position;
|
||||
|
||||
this.modified = true;
|
||||
if (this.lines.length <= 1) {
|
||||
this.$detectNewLine(text);
|
||||
}
|
||||
|
||||
var newLines = this.$split(text);
|
||||
|
||||
if (this.$isNewLine(text)) {
|
||||
var line = this.lines[position.row] || "";
|
||||
this.lines[position.row] = line.substring(0, position.column);
|
||||
this.lines.splice(position.row + 1, 0, line.substring(position.column));
|
||||
|
||||
var end = {
|
||||
row : position.row + 1,
|
||||
column : 0
|
||||
};
|
||||
}
|
||||
else if (newLines.length == 1) {
|
||||
var line = this.lines[position.row] || "";
|
||||
this.lines[position.row] = line.substring(0, position.column) + text
|
||||
+ line.substring(position.column);
|
||||
|
||||
var end = {
|
||||
row : position.row,
|
||||
column : position.column + text.length
|
||||
};
|
||||
}
|
||||
else {
|
||||
var line = this.lines[position.row] || "";
|
||||
var firstLine = line.substring(0, position.column) + newLines[0];
|
||||
var lastLine = newLines[newLines.length - 1] + line.substring(position.column);
|
||||
|
||||
this.lines[position.row] = firstLine;
|
||||
this.$insertLines(position.row + 1, [lastLine], true);
|
||||
|
||||
if (newLines.length > 2) {
|
||||
this.$insertLines(position.row + 1, newLines.slice(1, -1), true);
|
||||
}
|
||||
|
||||
var end = {
|
||||
row : position.row + newLines.length - 1,
|
||||
column : newLines[newLines.length - 1].length
|
||||
};
|
||||
}
|
||||
|
||||
if (!fromUndo && this.$undoManager) {
|
||||
this.$deltas.push({
|
||||
action: "insertText",
|
||||
range: Range.fromPoints(position, end),
|
||||
text: text
|
||||
});
|
||||
this.$informUndoManager.schedule();
|
||||
}
|
||||
|
||||
return end;
|
||||
};
|
||||
|
||||
this.$isNewLine = function(text) {
|
||||
return (text == "\r\n" || text == "\r" || text == "\n");
|
||||
};
|
||||
|
||||
this.remove = function(range, fromUndo) {
|
||||
if (range.isEmpty())
|
||||
return range.start;
|
||||
|
||||
this.$remove(range, fromUndo);
|
||||
|
||||
this.fireChangeEvent(range.start.row, range.isMultiLine() ? undefined : range.start.row);
|
||||
|
||||
return range.start;
|
||||
};
|
||||
|
||||
this.$remove = function(range, fromUndo) {
|
||||
if (range.isEmpty())
|
||||
return;
|
||||
|
||||
if (!fromUndo && this.$undoManager) {
|
||||
var nl = this.$getNewLineCharacter();
|
||||
this.$deltas.push({
|
||||
action: "removeText",
|
||||
range: range.clone(),
|
||||
text: this.getTextRange(range)
|
||||
});
|
||||
this.$informUndoManager.schedule();
|
||||
}
|
||||
|
||||
this.modified = true;
|
||||
|
||||
var firstRow = range.start.row;
|
||||
var lastRow = range.end.row;
|
||||
|
||||
var row = this.getLine(firstRow).substring(0, range.start.column)
|
||||
+ this.getLine(lastRow).substring(range.end.column);
|
||||
|
||||
this.lines.splice(firstRow, lastRow - firstRow + 1, row);
|
||||
|
||||
|
||||
return range.start;
|
||||
};
|
||||
|
||||
this.undoChanges = function(deltas) {
|
||||
this.selection.clearSelection();
|
||||
for (var i=deltas.length-1; i>=0; i--) {
|
||||
var delta = deltas[i];
|
||||
if (delta.action == "insertText") {
|
||||
this.remove(delta.range, true);
|
||||
this.selection.moveCursorToPosition(delta.range.start);
|
||||
} else {
|
||||
this.insert(delta.range.start, delta.text, true);
|
||||
this.selection.clearSelection();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
this.redoChanges = function(deltas) {
|
||||
this.selection.clearSelection();
|
||||
for (var i=0; i<deltas.length; i++) {
|
||||
var delta = deltas[i];
|
||||
if (delta.action == "insertText") {
|
||||
this.insert(delta.range.start, delta.text, true);
|
||||
this.selection.setSelectionRange(delta.range);
|
||||
} else {
|
||||
this.remove(delta.range, true);
|
||||
this.selection.moveCursorToPosition(delta.range.start);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
this.replace = function(range, text) {
|
||||
this.$remove(range);
|
||||
if (text) {
|
||||
var end = this.$insert(range.start, text);
|
||||
}
|
||||
else {
|
||||
end = range.start;
|
||||
}
|
||||
|
||||
var lastRemoved = range.end.column == 0 ? range.end.column - 1
|
||||
: range.end.column;
|
||||
this.fireChangeEvent(range.start.row, lastRemoved == end.row ? lastRemoved
|
||||
: undefined);
|
||||
|
||||
return end;
|
||||
};
|
||||
|
||||
this.indentRows = function(range, indentString) {
|
||||
indentString.replace("\t", this.getTabString());
|
||||
for (var row=range.start.row; row<=range.end.row; row++) {
|
||||
this.$insert({row: row, column:0}, indentString);
|
||||
}
|
||||
this.fireChangeEvent(range.start.row, range.end.row);
|
||||
return indentString.length;
|
||||
};
|
||||
|
||||
this.outdentRows = function (range) {
|
||||
var deleteRange = new Range(0, 0, 0, 0),
|
||||
size = this.getTabSize();
|
||||
|
||||
for (var i = range.start.row; i <= range.end.row; ++i) {
|
||||
var line = this.getLine(i);
|
||||
|
||||
deleteRange.start.row = i;
|
||||
deleteRange.end.row = i;
|
||||
for (var j = 0; j < size; ++j)
|
||||
if (line.charAt(j) != ' ')
|
||||
break;
|
||||
if (j < size && line.charAt(j) == '\t') {
|
||||
deleteRange.start.column = j;
|
||||
deleteRange.end.column = j + 1;
|
||||
} else {
|
||||
deleteRange.start.column = 0;
|
||||
deleteRange.end.column = j;
|
||||
}
|
||||
if (i == range.start.row)
|
||||
range.start.column -= deleteRange.end.column - deleteRange.start.column;
|
||||
if (i == range.end.row)
|
||||
range.end.column -= deleteRange.end.column - deleteRange.start.column;
|
||||
this.$remove(deleteRange);
|
||||
}
|
||||
this.fireChangeEvent(range.start.row, range.end.row);
|
||||
return range;
|
||||
}
|
||||
|
||||
this.moveLinesUp = function(firstRow, lastRow) {
|
||||
if (firstRow <= 0) return 0;
|
||||
|
||||
var removed = this.lines.slice(firstRow, lastRow + 1);
|
||||
this.$remove(new Range(firstRow, 0, lastRow + 1, 0));
|
||||
this.$insertLines(firstRow - 1, removed);
|
||||
|
||||
this.fireChangeEvent(firstRow - 1, lastRow);
|
||||
return -1;
|
||||
};
|
||||
|
||||
this.moveLinesDown = function(firstRow, lastRow) {
|
||||
if (lastRow >= this.lines.length-1) return 0;
|
||||
|
||||
var removed = this.lines.slice(firstRow, lastRow + 1);
|
||||
this.$remove(new Range(firstRow, 0, lastRow + 1, 0));
|
||||
this.$insertLines(firstRow+1, removed);
|
||||
|
||||
this.fireChangeEvent(firstRow, lastRow + 1);
|
||||
return 1;
|
||||
};
|
||||
|
||||
this.duplicateLines = function(firstRow, lastRow) {
|
||||
var firstRow = this.$clipRowToDocument(firstRow);
|
||||
var lastRow = this.$clipRowToDocument(lastRow);
|
||||
|
||||
var lines = this.getLines(firstRow, lastRow);
|
||||
this.$insertLines(firstRow, lines);
|
||||
|
||||
var addedRows = lastRow - firstRow + 1;
|
||||
this.fireChangeEvent(firstRow);
|
||||
|
||||
return addedRows;
|
||||
};
|
||||
|
||||
this.$clipRowToDocument = function(row) {
|
||||
return Math.max(0, Math.min(row, this.lines.length-1));
|
||||
};
|
||||
|
||||
this.documentToScreenColumn = function(row, docColumn) {
|
||||
var tabSize = this.getTabSize();
|
||||
|
||||
var screenColumn = 0;
|
||||
var remaining = docColumn;
|
||||
|
||||
var line = this.getLine(row).split("\t");
|
||||
for (var i=0; i<line.length; i++) {
|
||||
var len = line[i].length;
|
||||
if (remaining > len) {
|
||||
remaining -= (len + 1);
|
||||
screenColumn += len + tabSize;
|
||||
}
|
||||
else {
|
||||
screenColumn += remaining;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return screenColumn;
|
||||
};
|
||||
|
||||
this.screenToDocumentColumn = function(row, screenColumn) {
|
||||
var tabSize = this.getTabSize();
|
||||
|
||||
var docColumn = 0;
|
||||
var remaining = screenColumn;
|
||||
|
||||
var line = this.getLine(row).split("\t");
|
||||
for (var i=0; i<line.length; i++) {
|
||||
var len = line[i].length;
|
||||
if (remaining >= len + tabSize) {
|
||||
remaining -= (len + tabSize);
|
||||
docColumn += (len + 1);
|
||||
}
|
||||
else if (remaining > len){
|
||||
docColumn += len;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
docColumn += remaining;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return docColumn;
|
||||
};
|
||||
|
||||
}).call(Document.prototype);
|
||||
|
||||
return Document;
|
||||
});
|
||||
1011
lib/ace/Editor.js
Normal file
1011
lib/ace/Editor.js
Normal file
File diff suppressed because it is too large
Load diff
123
lib/ace/KeyBinding.js
Normal file
123
lib/ace/KeyBinding.js
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
/**
|
||||
* 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>
|
||||
*/
|
||||
require.def("ace/KeyBinding",
|
||||
["ace/lib/core",
|
||||
"ace/lib/event",
|
||||
"ace/conf/keybindings/default_mac",
|
||||
"ace/conf/keybindings/default_win",
|
||||
"ace/PluginManager",
|
||||
"ace/commands/DefaultCommands"],
|
||||
function(core, event, default_mac, default_win, PluginManager) {
|
||||
|
||||
var KeyBinding = function(element, editor, config) {
|
||||
this.setConfig(config);
|
||||
|
||||
var _self = this;
|
||||
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];
|
||||
|
||||
var commandName = (_self.config.reverse[hashId] || {})[(key
|
||||
|| String.fromCharCode(e.keyCode)).toLowerCase()];
|
||||
var command = PluginManager.commands[commandName];
|
||||
|
||||
if (command) {
|
||||
command(editor, editor.getSelection());
|
||||
return event.stopEvent(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
(function() {
|
||||
this.keyMods = {"ctrl": 1, "alt": 2, "option" : 2, "shift": 4, "meta": 8, "command": 8};
|
||||
|
||||
this.keyNames = {
|
||||
"8" : "Backspace",
|
||||
"9" : "Tab",
|
||||
"13" : "Enter",
|
||||
"27" : "Esc",
|
||||
"32" : "Space",
|
||||
"33" : "PageUp",
|
||||
"34" : "PageDown",
|
||||
"35" : "End",
|
||||
"36" : "Home",
|
||||
"37" : "Left",
|
||||
"38" : "Up",
|
||||
"39" : "Right",
|
||||
"40" : "Down",
|
||||
"45" : "Insert",
|
||||
"46" : "Delete",
|
||||
"107": "+",
|
||||
"112": "F1",
|
||||
"113": "F2",
|
||||
"114": "F3",
|
||||
"115": "F4",
|
||||
"116": "F5",
|
||||
"117": "F6",
|
||||
"118": "F7",
|
||||
"119": "F8",
|
||||
"120": "F9",
|
||||
"121": "F10",
|
||||
"122": "F11",
|
||||
"123": "F12"
|
||||
};
|
||||
|
||||
function splitSafe(s, separator, limit, bLowerCase) {
|
||||
return (bLowerCase && s.toLowerCase() || s)
|
||||
.replace(/(?:^\s+|\n|\s+$)/g, "")
|
||||
.split(new RegExp("[\\s ]*" + separator + "[\\s ]*", "g"), limit || 999);
|
||||
}
|
||||
|
||||
function parseKeys(keys, val, ret) {
|
||||
var key,
|
||||
hashId = 0,
|
||||
parts = splitSafe(keys, "\\-", null, true),
|
||||
i = 0,
|
||||
l = parts.length;
|
||||
|
||||
for (; i < l; ++i) {
|
||||
if (this.keyMods[parts[i]])
|
||||
hashId = hashId | this.keyMods[parts[i]];
|
||||
else
|
||||
key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
|
||||
}
|
||||
|
||||
(ret[hashId] || (ret[hashId] = {}))[key] = val;
|
||||
return ret;
|
||||
}
|
||||
|
||||
function objectReverse(obj, keySplit) {
|
||||
var i, j, l, key,
|
||||
ret = {};
|
||||
for (i in obj) {
|
||||
key = obj[i];
|
||||
if (keySplit && typeof key == "string") {
|
||||
key = key.split(keySplit);
|
||||
for (j = 0, l = key.length; j < l; ++j)
|
||||
parseKeys.call(this, key[j], i, ret);
|
||||
}
|
||||
else {
|
||||
parseKeys.call(this, key, i, ret);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
this.setConfig = function(config) {
|
||||
this.config = config || (core.isMac
|
||||
? default_mac
|
||||
: default_win);
|
||||
if (typeof this.config.reverse == "undefined")
|
||||
this.config.reverse = objectReverse.call(this, this.config, "|");
|
||||
};
|
||||
|
||||
}).call(KeyBinding.prototype);
|
||||
|
||||
return KeyBinding;
|
||||
});
|
||||
56
lib/ace/MEventEmitter.js
Normal file
56
lib/ace/MEventEmitter.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* 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);
|
||||
|
||||
require.def("ace/MEventEmitter", ["ace/lib/lang"], function(lang) {
|
||||
|
||||
var MEventEmitter = {}
|
||||
|
||||
MEventEmitter.$dispatchEvent = function(eventName, e) {
|
||||
this.$eventRegistry = this.$eventRegistry || {};
|
||||
|
||||
var listeners = this.$eventRegistry[eventName];
|
||||
if (!listeners || !listeners.length) return;
|
||||
|
||||
var e = e || {};
|
||||
e.type = eventName;
|
||||
|
||||
for (var i=0; i<listeners.length; i++) {
|
||||
listeners[i](e);
|
||||
}
|
||||
};
|
||||
|
||||
MEventEmitter.on =
|
||||
MEventEmitter.addEventListener = function(eventName, callback) {
|
||||
this.$eventRegistry = this.$eventRegistry || {};
|
||||
|
||||
var listeners = this.$eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
var listeners = this.$eventRegistry[eventName] = [];
|
||||
}
|
||||
if (lang.arrayIndexOf(listeners, callback) == -1) {
|
||||
listeners.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
MEventEmitter.removeEventListener = function(eventName, callback) {
|
||||
this.$eventRegistry = this.$eventRegistry || {};
|
||||
|
||||
var listeners = this.$eventRegistry[eventName];
|
||||
if (!listeners) {
|
||||
return;
|
||||
}
|
||||
var index = lang.arrayIndexOf(listeners, callback);
|
||||
if (index !== -1) {
|
||||
listeners.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
return MEventEmitter;
|
||||
});
|
||||
19
lib/ace/PluginManager.js
Normal file
19
lib/ace/PluginManager.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* 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>
|
||||
*/
|
||||
require.def("ace/PluginManager", [], function() {
|
||||
|
||||
var PluginManager = {
|
||||
commands : {},
|
||||
|
||||
registerCommand : function(name, command) {
|
||||
this.commands[name] = command;
|
||||
}
|
||||
};
|
||||
|
||||
return PluginManager;
|
||||
});
|
||||
126
lib/ace/Range.js
Normal file
126
lib/ace/Range.js
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
/**
|
||||
* 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>
|
||||
*/
|
||||
require.def("ace/Range", function() {
|
||||
|
||||
var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||
this.start = {
|
||||
row: startRow,
|
||||
column: startColumn
|
||||
};
|
||||
|
||||
this.end = {
|
||||
row: endRow,
|
||||
column: endColumn
|
||||
};
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.toString = function() {
|
||||
return ("Range: [" + this.start.row + "/" + this.start.column +
|
||||
"] -> [" + this.end.row + "/" + this.end.column + "]");
|
||||
};
|
||||
|
||||
this.contains = function(row, column) {
|
||||
return this.compare(row, column) == 0;
|
||||
};
|
||||
|
||||
this.compare = function(row, column) {
|
||||
if (!this.isMultiLine()) {
|
||||
if (row === this.start.row) {
|
||||
return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
|
||||
};
|
||||
}
|
||||
|
||||
if (row < this.start.row)
|
||||
return -1;
|
||||
|
||||
if (row > this.end.row)
|
||||
return 1;
|
||||
|
||||
if (this.start.row === row)
|
||||
return column >= this.start.column ? 0 : -1;
|
||||
|
||||
if (this.end.row === row)
|
||||
return column <= this.end.column ? 0 : 1;
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
this.clipRows = function(firstRow, lastRow) {
|
||||
if (this.end.row > lastRow) {
|
||||
var end = {
|
||||
row: lastRow+1,
|
||||
column: 0
|
||||
};
|
||||
}
|
||||
|
||||
if (this.start.row > lastRow) {
|
||||
var start = {
|
||||
row: lastRow+1,
|
||||
column: 0
|
||||
};
|
||||
}
|
||||
|
||||
if (this.start.row < firstRow) {
|
||||
var start = {
|
||||
row: firstRow,
|
||||
column: 0
|
||||
};
|
||||
}
|
||||
|
||||
if (this.end.row < firstRow) {
|
||||
var end = {
|
||||
row: firstRow,
|
||||
column: 0
|
||||
};
|
||||
}
|
||||
return Range.fromPoints(start || this.start, end || this.end);
|
||||
};
|
||||
|
||||
this.extend = function(row, column) {
|
||||
var cmp = this.compare(row, column);
|
||||
|
||||
if (cmp == 0)
|
||||
return this;
|
||||
else if (cmp == -1)
|
||||
var start = {row: row, column: column};
|
||||
else
|
||||
var end = {row: row, column: column};
|
||||
|
||||
return Range.fromPoints(start || this.start, end || this.end);
|
||||
};
|
||||
|
||||
this.isEmpty = function() {
|
||||
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
||||
};
|
||||
|
||||
this.isMultiLine = function() {
|
||||
return (this.start.row !== this.end.row);
|
||||
};
|
||||
|
||||
this.clone = function() {
|
||||
return Range.fromPoints(this.start, this.end);
|
||||
};
|
||||
|
||||
this.toScreenRange = function(doc) {
|
||||
return new Range(
|
||||
this.start.row, doc.documentToScreenColumn(this.start.row, this.start.column),
|
||||
this.end.row, doc.documentToScreenColumn(this.end.row, this.end.column)
|
||||
);
|
||||
};
|
||||
|
||||
}).call(Range.prototype);
|
||||
|
||||
|
||||
Range.fromPoints = function(start, end) {
|
||||
return new Range(start.row, start.column, end.row, end.column);
|
||||
};
|
||||
|
||||
return Range;
|
||||
})
|
||||
62
lib/ace/RenderLoop.js
Normal file
62
lib/ace/RenderLoop.js
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* 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>
|
||||
*/
|
||||
require.def("ace/RenderLoop", function() {
|
||||
|
||||
var RenderLoop = function(onRender) {
|
||||
this.onRender = onRender;
|
||||
this.pending = false;
|
||||
this.changes = 0;
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.schedule = function(change) {
|
||||
// this.onRender(change);
|
||||
// return;
|
||||
this.changes = this.changes | change;
|
||||
if (!this.pending) {
|
||||
this.pending = true;
|
||||
var _self = this;
|
||||
this.setTimeoutZero(function() {
|
||||
_self.pending = false;
|
||||
_self.onRender(_self.changes);
|
||||
_self.changes = 0;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
if (window.postMessage) {
|
||||
|
||||
this.messageName = "zero-timeout-message";
|
||||
|
||||
this.setTimeoutZero = function(callback) {
|
||||
if (!this.attached) {
|
||||
var _self = this;
|
||||
window.addEventListener("message", function(e) {
|
||||
if (e.source == window && _self.callback && e.data == _self.messageName) {
|
||||
e.stopPropagation();
|
||||
_self.callback();
|
||||
}
|
||||
}, false);
|
||||
this.attached = true;
|
||||
}
|
||||
this.callback = callback;
|
||||
window.postMessage(this.messageName, "*");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.setTimeoutZero = function(callback) {
|
||||
setTimeout(callback, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}).call(RenderLoop.prototype);
|
||||
|
||||
return RenderLoop;
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue