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
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue