bring back packages ace
This commit is contained in:
parent
fe57908671
commit
b06c2f9a76
81 changed files with 8133 additions and 0 deletions
79
build/ace/background_tokenizer.js
Normal file
79
build/ace/background_tokenizer.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
define(function(f) {
|
||||
var i = f("./lib/oop"), j = f("./event_emitter");
|
||||
f = 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, g = b.currentLine, d = b.textLines, h = 0, k = c.getLastVisibleRow();b.currentLine < d.length;) {
|
||||
b.lines[b.currentLine] = b.$tokenizeRows(b.currentLine, b.currentLine)[0];
|
||||
b.currentLine++;
|
||||
h += 1;
|
||||
if(h % 5 == 0 && new Date - e > 20) {
|
||||
b.fireUpdateEvent(g, b.currentLine - 1);
|
||||
b.running = setTimeout(b.$worker, b.currentLine < k ? 20 : 100);
|
||||
return
|
||||
}
|
||||
}b.running = false;
|
||||
b.fireUpdateEvent(g, 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", g = false;
|
||||
if(a > 0 && this.lines[a - 1]) {
|
||||
e = this.lines[a - 1].state;
|
||||
g = 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(g) {
|
||||
this.lines[a] = d
|
||||
}
|
||||
}
|
||||
}return b
|
||||
}
|
||||
}).call(f.prototype);
|
||||
return f
|
||||
});
|
||||
152
build/ace/commands/default_commands.js
Normal file
152
build/ace/commands/default_commands.js
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
define(function(b) {
|
||||
b = b("../plugin_manager");
|
||||
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()
|
||||
})
|
||||
});
|
||||
5
build/ace/conf/keybindings/default_mac.js
Normal file
5
build/ace/conf/keybindings/default_mac.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define(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"}
|
||||
});
|
||||
5
build/ace/conf/keybindings/default_win.js
Normal file
5
build/ace/conf/keybindings/default_win.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define(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:"Alt-Shift-Up", gotostart:"Ctrl-Home|Ctrl-Up", selectup:"Shift-Up", golineup:"Up", copylinesdown:"Ctrl-Alt-Down", movelinesdown:"Alt-Down", selecttoend:"Alt-Shift-Down", gotoend:"Ctrl-End|Ctrl-Down", selectdown:"Shift-Down",
|
||||
godown:"Down", selectwordleft:"Ctrl-Shift-Left", gotowordleft:"Ctrl-Left", selecttolinestart:"Ctrl-Shift-Left", gotolinestart:"Alt-Left|Home", selectleft:"Shift-Left", gotoleft:"Left", selectwordright:"Ctrl-Shift-Right", gotowordright:"Ctrl-Right", selecttolineend:"Ctrl-Shift-Right", gotolineend:"Alt-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;
|
||||
}
|
||||
459
build/ace/document.js
Normal file
459
build/ace/document.js
Normal file
|
|
@ -0,0 +1,459 @@
|
|||
define(function(g) {
|
||||
var l = g("./lib/oop"), j = g("./lib/lang"), m = g("./event_emitter"), n = g("./selection"), o = g("./mode/text"), h = g("./range");
|
||||
g = function(a, b) {
|
||||
this.modified = true;
|
||||
this.lines = [];
|
||||
this.selection = new n(this);
|
||||
this.$breakpoints = [];
|
||||
this.listeners = [];
|
||||
b && this.setMode(b);
|
||||
j.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 = j.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() ? j.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 h(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(i) {
|
||||
f += d - 1;
|
||||
return i
|
||||
});
|
||||
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 i = f.charAt(d);
|
||||
if(i == c) {
|
||||
e -= 1;
|
||||
if(e == 0) {
|
||||
return{row:b, column:d}
|
||||
}
|
||||
}else {
|
||||
if(i == 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), i = 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 >= i) {
|
||||
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 h(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:h.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 h(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 h(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 h(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(g.prototype);
|
||||
return g
|
||||
});
|
||||
3413
build/ace/editor.js
Normal file
3413
build/ace/editor.js
Normal file
File diff suppressed because it is too large
Load diff
29
build/ace/event_emitter.js
Normal file
29
build/ace/event_emitter.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
define(function(d) {
|
||||
var e = d("./lib/lang");
|
||||
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
|
||||
});
|
||||
56
build/ace/keybinding.js
Normal file
56
build/ace/keybinding.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
define(function(e) {
|
||||
var m = e("./lib/core"), l = e("./lib/event"), n = e("./conf/keybindings/default_mac"), o = e("./conf/keybindings/default_win"), p = e("./plugin_manager");
|
||||
e("./commands/default_commands");
|
||||
e = function(j, h, k) {
|
||||
this.setConfig(k);
|
||||
var a = this;
|
||||
l.addKeyListener(j, 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(h, h.getSelection());
|
||||
return l.stopEvent(b)
|
||||
}
|
||||
})
|
||||
};
|
||||
(function() {
|
||||
function j(a, b, c, f) {
|
||||
return(f && a.toLowerCase() || a).replace(/(?:^\s+|\n|\s+$)/g, "").split(new RegExp("[\\s ]*" + b + "[\\s ]*", "g"), c || 999)
|
||||
}
|
||||
function h(a, b, c) {
|
||||
var f, g = 0;
|
||||
a = j(a, "\\-", null, true);
|
||||
for(var d = 0, i = a.length;d < i;++d) {
|
||||
if(this.keyMods[a[d]]) {
|
||||
g |= this.keyMods[a[d]]
|
||||
}else {
|
||||
f = a[d] || "-"
|
||||
}
|
||||
}(c[g] || (c[g] = {}))[f] = b;
|
||||
return c
|
||||
}
|
||||
function k(a, b) {
|
||||
var c, f, g, d, i = {};
|
||||
for(c in a) {
|
||||
d = a[c];
|
||||
if(b && typeof d == "string") {
|
||||
d = d.split(b);
|
||||
f = 0;
|
||||
for(g = d.length;f < g;++f) {
|
||||
h.call(this, d[f], c, i)
|
||||
}
|
||||
}else {
|
||||
h.call(this, d, c, i)
|
||||
}
|
||||
}return i
|
||||
}
|
||||
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 = k.call(this, this.config, "|")
|
||||
}
|
||||
}
|
||||
}).call(e.prototype);
|
||||
return e
|
||||
});
|
||||
63
build/ace/layer/cursor.js
Normal file
63
build/ace/layer/cursor.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
define(function(b) {
|
||||
var d = b("../lib/dom");
|
||||
b = 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, c) {
|
||||
this.position = {row:a.row, column:this.doc.documentToScreenColumn(a.row, a.column)};
|
||||
c ? d.addCssClass(this.cursor, "ace_overwrite") : d.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 c = Math.round(this.position.column * a.characterWidth), e = this.position.row * a.lineHeight;
|
||||
this.pixelPos = {left:c, top:e};
|
||||
this.cursor.style.left = c + "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(b.prototype);
|
||||
return b
|
||||
});
|
||||
30
build/ace/layer/gutter.js
Normal file
30
build/ace/layer/gutter.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
define(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
|
||||
});
|
||||
72
build/ace/layer/marker.js
Normal file
72
build/ace/layer/marker.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
define(function(h) {
|
||||
var i = h("../range");
|
||||
h = 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 i(d, a.start.column, d, this.doc.getLine(d).length);
|
||||
this.drawSingleLineMarker(c, f, e, b);
|
||||
d = a.end.row;
|
||||
f = new i(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(h.prototype);
|
||||
return h
|
||||
});
|
||||
156
build/ace/layer/text.js
Normal file
156
build/ace/layer/text.js
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
define(function(k) {
|
||||
var m = k("../lib/oop"), n = k("../lib/dom"), o = k("../event_emitter");
|
||||
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
|
||||
});
|
||||
17
build/ace/lib/core.js
Normal file
17
build/ace/lib/core.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
define(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
|
||||
});
|
||||
65
build/ace/lib/dom.js
Normal file
65
build/ace/lib/dom.js
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
define(function(g) {
|
||||
var f = g("./lang"), 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
|
||||
});
|
||||
134
build/ace/lib/event.js
Normal file
134
build/ace/lib/event.js
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
define(function(m) {
|
||||
var i = m("./core"), 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
|
||||
});
|
||||
56
build/ace/lib/lang.js
Normal file
56
build/ace/lib/lang.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
define(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
|
||||
});
|
||||
20
build/ace/lib/oop.js
Normal file
20
build/ace/lib/oop.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
define(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
|
||||
});
|
||||
80
build/ace/mode/css.js
Normal file
80
build/ace/mode/css.js
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
define("ace/mode/css_highlight_rules", ["require", "exports", "module", "../lib/oop", "../lib/lang", "./text_highlight_rules"], function(b) {
|
||||
var j = b("../lib/oop"), c = b("../lib/lang");
|
||||
b = b("./text_highlight_rules");
|
||||
var e = function() {
|
||||
function a(d) {
|
||||
var l = [];
|
||||
d = d.split("");
|
||||
for(var k = 0;k < d.length;k++) {
|
||||
l.push("[", d[k].toLowerCase(), d[k].toUpperCase(), "]")
|
||||
}return l.join("")
|
||||
}
|
||||
var f = 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("|")),
|
||||
g = c.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), h = 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("|")),
|
||||
i = 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(d) {
|
||||
return f[d.toLowerCase()] ? "support.type" : g[d.toLowerCase()] ? "support.function" : h[d.toLowerCase()] ? "support.constant" : i[d.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
|
||||
});
|
||||
define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "../range"], function(b) {
|
||||
var j = b("../range");
|
||||
b = function() {
|
||||
};
|
||||
(function() {
|
||||
this.checkOutdent = function(c, e) {
|
||||
if(!/^\s+$/.test(c)) {
|
||||
return false
|
||||
}return/^\s*\}/.test(e)
|
||||
};
|
||||
this.autoOutdent = function(c, e) {
|
||||
var a = c.getLine(e).match(/^(\s*\})/);
|
||||
if(!a) {
|
||||
return 0
|
||||
}a = a[1].length;
|
||||
var f = c.findMatchingBracket({row:e, column:a});
|
||||
if(!f || f.row == e) {
|
||||
return 0
|
||||
}f = this.$getIndent(c.getLine(f.row));
|
||||
c.replace(new j(e, 0, e, a - 1), f);
|
||||
return f.length - (a - 1)
|
||||
};
|
||||
this.$getIndent = function(c) {
|
||||
if(c = c.match(/^(\s+)/)) {
|
||||
return c[1]
|
||||
}return""
|
||||
}
|
||||
}).call(b.prototype);
|
||||
return b
|
||||
});
|
||||
define("ace/mode/css", ["require", "exports", "module", "../lib/oop", "./text", "../tokenizer", "./css_highlight_rules", "./matching_brace_outdent"], function(b) {
|
||||
var j = b("../lib/oop"), c = b("./text"), e = b("../tokenizer"), a = b("./css_highlight_rules"), f = b("./matching_brace_outdent");
|
||||
b = function() {
|
||||
this.$tokenizer = new e((new a).getRules());
|
||||
this.$outdent = new f
|
||||
};
|
||||
j.inherits(b, c);
|
||||
(function() {
|
||||
this.getNextLineIndent = function(g, h, i) {
|
||||
var d = this.$getIndent(h);
|
||||
g = this.$tokenizer.getLineTokens(h, g).tokens;
|
||||
if(g.length && g[g.length - 1].type == "comment") {
|
||||
return d
|
||||
}if(h.match(/^.*\{\s*$/)) {
|
||||
d += i
|
||||
}return d
|
||||
};
|
||||
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(b.prototype);
|
||||
return b
|
||||
});
|
||||
24
build/ace/mode/css_highlight_rules.js
Normal file
24
build/ace/mode/css_highlight_rules.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
define(function(c) {
|
||||
var h = c("../lib/oop"), d = c("../lib/lang");
|
||||
c = c("./text_highlight_rules");
|
||||
var g = function() {
|
||||
function a(b) {
|
||||
var f = [];
|
||||
b = b.split("");
|
||||
for(var e = 0;e < b.length;e++) {
|
||||
f.push("[", b[e].toLowerCase(), b[e].toUpperCase(), "]")
|
||||
}return f.join("")
|
||||
}
|
||||
var i = d.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 = d.arrayToMap("rgb|rgba|url|attr|counter|counters".split("|")), k = d.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 = d.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:".+"}]}
|
||||
};
|
||||
h.inherits(g, c);
|
||||
return g
|
||||
});
|
||||
14
build/ace/mode/doc_comment_highlight_rules.js
Normal file
14
build/ace/mode/doc_comment_highlight_rules.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
define(function(a) {
|
||||
var c = a("../lib/oop");
|
||||
a = a("./text_highlight_rules");
|
||||
var b = 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:"."}]}
|
||||
};
|
||||
c.inherits(b, a);
|
||||
(function() {
|
||||
this.getStartRule = function(d) {
|
||||
return{token:"comment.doc", regex:"\\/\\*(?=\\*)", next:d}
|
||||
}
|
||||
}).call(b.prototype);
|
||||
return b
|
||||
});
|
||||
57
build/ace/mode/html.js
Normal file
57
build/ace/mode/html.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
define("ace/mode/html_highlight_rules", ["require", "exports", "module", "../lib/oop", "./css_highlight_rules", "./javascript_highlight_rules", "./text_highlight_rules"], function(a) {
|
||||
var f = a("../lib/oop"), g = a("./css_highlight_rules"), h = a("./javascript_highlight_rules");
|
||||
a = a("./text_highlight_rules");
|
||||
var d = 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 h).getRules(), "js-");
|
||||
this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"});
|
||||
this.addRules((new g).getRules(), "css-");
|
||||
this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"})
|
||||
};
|
||||
f.inherits(d, a);
|
||||
return d
|
||||
});
|
||||
define("ace/mode/html", ["require", "exports", "module", "../lib/oop", "./text", "./javascript", "./css", "../tokenizer", "./html_highlight_rules"], function(a) {
|
||||
var f = a("../lib/oop"), g = a("./text"), h = a("./javascript"), d = a("./css"), k = a("../tokenizer"), l = a("./html_highlight_rules");
|
||||
a = function() {
|
||||
this.$tokenizer = new k((new l).getRules());
|
||||
this.$js = new h;
|
||||
this.$css = new d
|
||||
};
|
||||
f.inherits(a, g);
|
||||
(function() {
|
||||
this.toggleCommentLines = function() {
|
||||
return this.$delegate("toggleCommentLines", arguments, function() {
|
||||
return 0
|
||||
})
|
||||
};
|
||||
this.getNextLineIndent = function(i, b) {
|
||||
var e = this;
|
||||
return this.$delegate("getNextLineIndent", arguments, function() {
|
||||
return e.$getIndent(b)
|
||||
})
|
||||
};
|
||||
this.checkOutdent = function() {
|
||||
return this.$delegate("checkOutdent", arguments, function() {
|
||||
return false
|
||||
})
|
||||
};
|
||||
this.autoOutdent = function() {
|
||||
return this.$delegate("autoOutdent", arguments)
|
||||
};
|
||||
this.$delegate = function(i, b, e) {
|
||||
var j = b[0], c = j.split("js-");
|
||||
if(!c[0] && c[1]) {
|
||||
b[0] = c[1];
|
||||
return this.$js[i].apply(this.$js, b)
|
||||
}c = j.split("css-");
|
||||
if(!c[0] && c[1]) {
|
||||
b[0] = c[1];
|
||||
return this.$css[i].apply(this.$css, b)
|
||||
}return e ? e() : undefined
|
||||
}
|
||||
}).call(a.prototype);
|
||||
return a
|
||||
});
|
||||
15
build/ace/mode/html_highlight_rules.js
Normal file
15
build/ace/mode/html_highlight_rules.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
define(function(a) {
|
||||
var c = a("../lib/oop"), d = a("./css_highlight_rules"), e = a("./javascript_highlight_rules");
|
||||
a = a("./text_highlight_rules");
|
||||
var b = 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 e).getRules(), "js-");
|
||||
this.$rules["js-start"].unshift({token:"comment", regex:"\\/\\/.*(?=<\\/script>)", next:"tag"}, {token:"text", regex:"<\\/(?=script)", next:"tag"});
|
||||
this.addRules((new d).getRules(), "css-");
|
||||
this.$rules["css-start"].unshift({token:"text", regex:"<\\/(?=style)", next:"tag"})
|
||||
};
|
||||
c.inherits(b, a);
|
||||
return b
|
||||
});
|
||||
59
build/ace/mode/javascript.js
Normal file
59
build/ace/mode/javascript.js
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
define(function(f) {
|
||||
var h = f("../lib/oop"), i = f("./text"), j = f("../tokenizer"), k = f("./javascript_highlight_rules"), l = f("./matching_brace_outdent"), m = f("../range");
|
||||
f = function() {
|
||||
this.$tokenizer = new j((new k).getRules());
|
||||
this.$outdent = new l
|
||||
};
|
||||
h.inherits(f, 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 g = b.getLine(a).replace(d, "$1");
|
||||
c.start.row = a;
|
||||
c.end.row = a;
|
||||
c.end.column = g.length + 2;
|
||||
b.replace(c, g)
|
||||
}return-2
|
||||
}else {
|
||||
return b.indentRows(e, "//")
|
||||
}
|
||||
};
|
||||
this.getNextLineIndent = function(d, b, e) {
|
||||
var c = this.$getIndent(b), a = this.$tokenizer.getLineTokens(b, d), g = a.tokens;
|
||||
a = a.state;
|
||||
if(g.length && g[g.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(f.prototype);
|
||||
return f
|
||||
});
|
||||
16
build/ace/mode/javascript_highlight_rules.js
Normal file
16
build/ace/mode/javascript_highlight_rules.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
define(function(a) {
|
||||
var e = a("../lib/oop"), c = a("../lib/lang"), f = a("./doc_comment_highlight_rules");
|
||||
a = a("./text_highlight_rules");
|
||||
JavaScriptHighlightRules = function() {
|
||||
var d = new f, g = c.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 = c.arrayToMap("true|false|null|undefined|Infinity|NaN|undefined".split("|")), i = c.arrayToMap("class|enum|extends|super|const|export|import|implements|let|private|public|yield|interface|package|protected|static".split("|"));
|
||||
this.$rules = {start:[{token:"comment", regex:"\\/\\/.*$"}, d.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(b) {
|
||||
return b == "this" ? "variable.language" : g[b] ? "keyword" : h[b] ? "constant.language" : i[b] ? "invalid.illegal" : b == "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(d.getRules(), "doc-");
|
||||
this.$rules["doc-start"][0].next = "start"
|
||||
};
|
||||
e.inherits(JavaScriptHighlightRules, a);
|
||||
return JavaScriptHighlightRules
|
||||
});
|
||||
30
build/ace/mode/matching_brace_outdent.js
Normal file
30
build/ace/mode/matching_brace_outdent.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
define(function(e) {
|
||||
var f = e("../range");
|
||||
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
|
||||
});
|
||||
28
build/ace/mode/text.js
Normal file
28
build/ace/mode/text.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
define(function(a) {
|
||||
var c = a("../tokenizer"), d = a("./text_highlight_rules");
|
||||
a = 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(b) {
|
||||
if(b = b.match(/^(\s+)/)) {
|
||||
return b[1]
|
||||
}return""
|
||||
}
|
||||
}).call(a.prototype);
|
||||
return a
|
||||
});
|
||||
19
build/ace/mode/text_highlight_rules.js
Normal file
19
build/ace/mode/text_highlight_rules.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
define(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
|
||||
});
|
||||
23
build/ace/mode/xml.js
Normal file
23
build/ace/mode/xml.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
define("ace/mode/xml_highlight_rules", ["require", "exports", "module", "../lib/oop", "./text_highlight_rules"], function(a) {
|
||||
var c = a("../lib/oop");
|
||||
a = a("./text_highlight_rules");
|
||||
var b = 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:".+"}]}
|
||||
};
|
||||
c.inherits(b, a);
|
||||
return b
|
||||
});
|
||||
define("ace/mode/xml", ["require", "exports", "module", "../lib/oop", "./text", "../tokenizer", "./xml_highlight_rules"], function(a) {
|
||||
var c = a("../lib/oop"), b = a("./text"), d = a("../tokenizer"), e = a("./xml_highlight_rules");
|
||||
a = function() {
|
||||
this.$tokenizer = new d((new e).getRules())
|
||||
};
|
||||
c.inherits(a, b);
|
||||
(function() {
|
||||
this.getNextLineIndent = function(g, f) {
|
||||
return this.$getIndent(f)
|
||||
}
|
||||
}).call(a.prototype);
|
||||
return a
|
||||
});
|
||||
10
build/ace/mode/xml_highlight_rules.js
Normal file
10
build/ace/mode/xml_highlight_rules.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
define(function(a) {
|
||||
var c = a("../lib/oop");
|
||||
a = a("./text_highlight_rules");
|
||||
var b = 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:".+"}]}
|
||||
};
|
||||
c.inherits(b, a);
|
||||
return b
|
||||
});
|
||||
5
build/ace/plugin_manager.js
Normal file
5
build/ace/plugin_manager.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define(function() {
|
||||
return{commands:{}, registerCommand:function(a, b) {
|
||||
this.commands[a] = b
|
||||
}}
|
||||
});
|
||||
68
build/ace/range.js
Normal file
68
build/ace/range.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
define(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
|
||||
});
|
||||
43
build/ace/renderloop.js
Normal file
43
build/ace/renderloop.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
define(function(c) {
|
||||
var e = c("./lib/event");
|
||||
c = 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;
|
||||
e.addListener(window, "message", function(d) {
|
||||
if(d.source == window && a.callback && d.data == a.messageName) {
|
||||
e.stopPropagation(d);
|
||||
a.callback()
|
||||
}
|
||||
});
|
||||
this.attached = true
|
||||
}this.callback = b;
|
||||
window.postMessage(this.messageName, "*")
|
||||
}
|
||||
}else {
|
||||
this.setTimeoutZero = function(b) {
|
||||
setTimeout(b, 0)
|
||||
}
|
||||
}
|
||||
}).call(c.prototype);
|
||||
return c
|
||||
});
|
||||
32
build/ace/scrollbar.js
Normal file
32
build/ace/scrollbar.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
define(function(a) {
|
||||
var c = a("./lib/oop"), d = a("./lib/lang"), e = a("./lib/dom"), f = a("./lib/event"), g = a("./event_emitter");
|
||||
a = function(b) {
|
||||
this.element = document.createElement("div");
|
||||
this.element.className = "ace_sb";
|
||||
this.inner = document.createElement("div");
|
||||
this.element.appendChild(this.inner);
|
||||
b.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(b) {
|
||||
this.element.style.height = Math.max(0, b - this.width) + "px"
|
||||
};
|
||||
this.setInnerHeight = function(b) {
|
||||
this.inner.style.height = b + "px"
|
||||
};
|
||||
this.setScrollTop = function(b) {
|
||||
this.element.scrollTop = b
|
||||
}
|
||||
}).call(a.prototype);
|
||||
return a
|
||||
});
|
||||
149
build/ace/search.js
Normal file
149
build/ace/search.js
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
define(function(o) {
|
||||
var p = o("./lib/lang"), r = o("./lib/oop"), s = o("./range"), 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) {
|
||||
r.mixin(this.$options, a);
|
||||
return this
|
||||
};
|
||||
this.getOptions = function() {
|
||||
return p.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 s(a, b, a, b + c)
|
||||
};
|
||||
this.$assembleRegExp = function() {
|
||||
var a = this.$options.regExp ? this.$options.needle : p.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, q = false;!e(m, n, f);) {
|
||||
if(q) {
|
||||
return
|
||||
}f++;
|
||||
n = 0;
|
||||
if(f > j) {
|
||||
if(h) {
|
||||
f = i;
|
||||
n = k
|
||||
}else {
|
||||
return
|
||||
}
|
||||
}if(f == d.row) {
|
||||
q = 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
|
||||
});
|
||||
255
build/ace/selection.js
Normal file
255
build/ace/selection.js
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
define(function(d) {
|
||||
var g = d("./lib/oop"), h = d("./lib/lang"), i = d("./event_emitter"), f = d("./range");
|
||||
d = 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(), e = this.isBackwards();
|
||||
if(!e || b.column !== 0) {
|
||||
this.setSelectionAnchor(b.row, b.column + a)
|
||||
}if(e || 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() ? f.fromPoints(b, a) : f.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), e = 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(e)) {
|
||||
b += this.doc.nonTokenRe.lastIndex;
|
||||
this.doc.nonTokenRe.lastIndex = 0
|
||||
}else {
|
||||
if(this.doc.tokenRe.exec(e)) {
|
||||
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(d.prototype);
|
||||
return d
|
||||
});
|
||||
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))
|
||||
}
|
||||
});
|
||||
79
build/ace/test/change_document_test.js
Normal file
79
build/ace/test/change_document_test.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/document_test.js
Normal file
148
build/ace/test/document_test.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/event_emitter_test.js
Normal file
17
build/ace/test/event_emitter_test.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
|
||||
});
|
||||
21
build/ace/test/mode/css_test.js
Normal file
21
build/ace/test/mode/css_test.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/css_tokenizer_test.js
Normal file
26
build/ace/test/mode/css_tokenizer_test.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/html_test.js
Normal file
16
build/ace/test/mode/html_test.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/html_tokenizer_test.js
Normal file
21
build/ace/test/mode/html_tokenizer_test.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/javascript_test.js
Normal file
62
build/ace/test/mode/javascript_test.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/javascript_tokenizer_test.js
Normal file
34
build/ace/test/mode/javascript_tokenizer_test.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/text_test.js
Normal file
14
build/ace/test/mode/text_test.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/xml_test.js
Normal file
21
build/ace/test/mode/xml_test.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/xml_tokenizer_test.js
Normal file
16
build/ace/test/mode/xml_tokenizer_test.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)
|
||||
}})
|
||||
});
|
||||
77
build/ace/test/navigation_test.js
Normal file
77
build/ace/test/navigation_test.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/range_test.js
Normal file
74
build/ace/test/range_test.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/search_test.js
Normal file
135
build/ace/test/search_test.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/selection_test.js
Normal file
149
build/ace/test/selection_test.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/text_edit_test.js
Normal file
178
build/ace/test/text_edit_test.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/virtual_renderer_test.js
Normal file
27
build/ace/test/virtual_renderer_test.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)
|
||||
}})
|
||||
});
|
||||
79
build/ace/textinput.js
Normal file
79
build/ace/textinput.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
define(function(l) {
|
||||
var b = l("./lib/event");
|
||||
return function(m, 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";
|
||||
m.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()
|
||||
}
|
||||
}
|
||||
});
|
||||
4
build/ace/theme/clouds.js
Normal file
4
build/ace/theme/clouds.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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/clouds_mignight.js
Normal file
4
build/ace/theme/clouds_mignight.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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"}
|
||||
});
|
||||
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);
|
||||
}
|
||||
5
build/ace/theme/eclipse.js
Normal file
5
build/ace/theme/eclipse.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
define("ace/theme/eclipse", ["require", "exports", "module", "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}",
|
||||
"../lib/dom"], function(a, c, d, b) {
|
||||
a("../lib/dom").importCssString(b);
|
||||
return{cssClass:"ace-eclipse"}
|
||||
});
|
||||
4
build/ace/theme/idle_fingers.js
Normal file
4
build/ace/theme/idle_fingers.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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/kr_theme.js
Normal file
4
build/ace/theme/kr_theme.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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/mono_industrial.js
Normal file
4
build/ace/theme/mono_industrial.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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 @@
|
|||
define(["require", "exports", "module", "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}",
|
||||
"../lib/dom"], function(a, c, d, b) {
|
||||
a("../lib/dom").importCssString(b);
|
||||
return{cssClass:"ace-tm"}
|
||||
});
|
||||
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)
|
||||
}
|
||||
4
build/ace/theme/twilight.js
Normal file
4
build/ace/theme/twilight.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
define(function(a) {
|
||||
a("../lib/dom").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"}
|
||||
});
|
||||
46
build/ace/tokenizer.js
Normal file
46
build/ace/tokenizer.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
define(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
|
||||
});
|
||||
28
build/ace/undomanager.js
Normal file
28
build/ace/undomanager.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
define(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
|
||||
});
|
||||
376
build/ace/virtual_renderer.js
Normal file
376
build/ace/virtual_renderer.js
Normal file
|
|
@ -0,0 +1,376 @@
|
|||
define(["require", "exports", "module", '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}',
|
||||
"./lib/oop", "./lib/oop", "./lib/event", "./layer/gutter", "./layer/marker", "./layer/text", "./layer/cursor", "./scrollbar", "./renderloop", "./event_emitter"], function(d, k, u, l) {
|
||||
var m = d("./lib/oop"), i = d("./lib/lang"), f = d("./lib/dom"), j = d("./lib/event"), n = d("./layer/gutter"), o = d("./layer/marker"), p = d("./layer/text"), q = d("./layer/cursor"), r = d("./scrollbar"), s = d("./renderloop"), t = d("./event_emitter");
|
||||
f.importCssString(l);
|
||||
k = function(a, b) {
|
||||
this.container = a;
|
||||
f.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 n(this.$gutter);
|
||||
this.$markerLayer = new o(this.content);
|
||||
var c = this.$textLayer = new p(this.content);
|
||||
this.canvas = c.element;
|
||||
this.characterWidth = c.getCharacterWidth();
|
||||
this.lineHeight = c.getLineHeight();
|
||||
this.$cursorLayer = new q(this.content);
|
||||
this.layers = [this.$markerLayer, c, this.$cursorLayer];
|
||||
this.scrollBar = new r(a);
|
||||
this.scrollBar.addEventListener("scroll", i.bind(this.onScroll, this));
|
||||
this.scrollTop = 0;
|
||||
this.cursorPos = {row:0, column:0};
|
||||
var e = this;
|
||||
this.$textLayer.addEventListener("changeCharaterSize", function() {
|
||||
e.characterWidth = c.getCharacterWidth();
|
||||
e.lineHeight = c.getLineHeight();
|
||||
e.$loop.schedule(e.CHANGE_FULL)
|
||||
});
|
||||
j.addListener(this.$gutter, "click", i.bind(this.$onGutterClick, this));
|
||||
j.addListener(this.$gutter, "dblclick", i.bind(this.$onGutterClick, this));
|
||||
this.$size = {width:0, height:0, scrollerHeight:0, scrollerWidth:0};
|
||||
this.$loop = new s(i.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;
|
||||
m.implement(this, t);
|
||||
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 = f.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 = f.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 = j.getDocumentX(a), c = j.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(), e = !this.layerConfig ? true : this.layerConfig.width != c, h = Math.ceil(b / this.lineHeight), g = Math.max(0, Math.round((this.scrollTop - a) / this.lineHeight));
|
||||
h = Math.min(this.lines.length, g + h) - 1;
|
||||
this.layerConfig = {width:c, padding:this.$padding, firstRow:g, lastRow:h, lineHeight:this.lineHeight, characterWidth:this.characterWidth, minHeight:b, offset:a, height:this.$size.scrollerHeight};
|
||||
for(g = 0;g < this.layers.length;g++) {
|
||||
h = this.layers[g];
|
||||
if(e) {
|
||||
h.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() {
|
||||
f.addCssClass(this.container, "ace_focus")
|
||||
};
|
||||
this.visualizeBlur = function() {
|
||||
f.removeCssClass(this.container, "ace_focus")
|
||||
};
|
||||
this.showComposition = function() {
|
||||
};
|
||||
this.setCompositionText = function() {
|
||||
};
|
||||
this.hideComposition = function() {
|
||||
};
|
||||
this.setTheme = function(a) {
|
||||
function b(e) {
|
||||
c.$theme && f.removeCssClass(c.container, c.$theme);
|
||||
c.$theme = e ? e.cssClass : null;
|
||||
c.$theme && f.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";
|
||||
d([a], function(e) {
|
||||
b(e)
|
||||
})
|
||||
}else {
|
||||
b(a)
|
||||
}c = this
|
||||
}
|
||||
}).call(k.prototype);
|
||||
return k
|
||||
});
|
||||
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/plugin_manager.js
|
||||
ace/commands/default_commands.js
|
||||
ace/keybinding.js
|
||||
ace/event_emitter.js
|
||||
ace/range.js
|
||||
ace/selection.js
|
||||
ace/tokenizer.js
|
||||
ace/mode/text_highlight_rules.js
|
||||
ace/mode/text.js
|
||||
ace/document.js
|
||||
ace/search.js
|
||||
ace/background_tokenizer.js
|
||||
ace/editor.js
|
||||
ace/undomanager.js
|
||||
ace/layer/gutter.js
|
||||
ace/layer/marker.js
|
||||
ace/lib/dom.js
|
||||
ace/layer/text.js
|
||||
ace/layer/cursor.js
|
||||
ace/scrollbar.js
|
||||
ace/renderloop.js
|
||||
ace/virtual_renderer.js
|
||||
ace/mode/doc_comment_highlight_rules.js
|
||||
ace/mode/javascript_highlight_rules.js
|
||||
ace/mode/matching_brace_outdent.js
|
||||
ace/mode/javascript.js
|
||||
ace/theme/textmate.js
|
||||
|
||||
ace/theme/eclipse.js
|
||||
----------------
|
||||
ace/theme/eclipse.js
|
||||
|
||||
ace/mode/xml.js
|
||||
----------------
|
||||
ace/mode/xml_highlight_rules.js
|
||||
ace/mode/xml.js
|
||||
|
||||
ace/mode/css.js
|
||||
----------------
|
||||
ace/mode/css_highlight_rules.js
|
||||
ace/mode/matching_brace_outdent.js
|
||||
ace/mode/css.js
|
||||
|
||||
ace/mode/html.js
|
||||
----------------
|
||||
ace/mode/html_highlight_rules.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)
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue