use requireJS as loader
This commit is contained in:
parent
3ef74385a7
commit
fe837c321a
40 changed files with 1817 additions and 286 deletions
97
css/eclipse.css
Normal file
97
css/eclipse.css
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
.editor {
|
||||||
|
border: 2px solid rgb(159, 159, 159);
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor.focus {
|
||||||
|
border: 2px solid #327fbd;;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gutter {
|
||||||
|
width: 40px;
|
||||||
|
background: rgb(227, 227, 227);
|
||||||
|
border-right: 1px solid rgb(159, 159, 159);
|
||||||
|
color: rgb(136, 136, 136);
|
||||||
|
font-family: Monaco, "Courier New";
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gutter-layer {
|
||||||
|
right: 10px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-layer {
|
||||||
|
font-family: Monaco, "Courier New", monospace;
|
||||||
|
font-size: 11px;
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursor {
|
||||||
|
width: 1px;
|
||||||
|
background: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .keyword {
|
||||||
|
color: rgb(127, 0, 85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .buildin-constant {
|
||||||
|
color: rgb(88, 72, 246);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .library-constant {
|
||||||
|
color: rgb(6, 150, 14);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .buildin-function {
|
||||||
|
color: rgb(60, 76, 114);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .string {
|
||||||
|
color: rgb(42, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .comment {
|
||||||
|
color: rgb(63, 127, 95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .doc-comment {
|
||||||
|
color: rgb(63, 95, 191);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .doc-comment-tag {
|
||||||
|
color: rgb(127, 159, 191);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .number {
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .tag {
|
||||||
|
color: rgb(63, 127, 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .attribute {
|
||||||
|
color: rbg(127, 0, 127);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .attribute-value {
|
||||||
|
font-style: italic;
|
||||||
|
color: rbg(42, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line .xml_pe {
|
||||||
|
color: rgb(104, 104, 91);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-layer .selection {
|
||||||
|
background: rgb(181, 213, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-layer .bracket {
|
||||||
|
margin: -1px 0 0 -1px;
|
||||||
|
border: 1px solid rgb(192, 192, 192);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-layer .active_line {
|
||||||
|
background: rgb(232, 242, 254);
|
||||||
|
}
|
||||||
|
|
@ -38,44 +38,11 @@
|
||||||
height: 55px;
|
height: 55px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="../css/editor.css" type="text/css" charset="utf-8">
|
<link rel="stylesheet" href="../css/editor.css" type="text/css" charset="utf-8">
|
||||||
<link rel="stylesheet" href="../css/tm.css" type="text/css" charset="utf-8">
|
<link rel="stylesheet" href="../css/tm.css" type="text/css" charset="utf-8">
|
||||||
|
<script src="require.js" type="text/javascript" charset="utf-8"></script>
|
||||||
<script src="../src/ace/lib/core.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/lib/oop.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/lib/lang.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/lib/event.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/lib/dom.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/Text.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/TextHighlightRules.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/JavaScript.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/DocCommentHighlightRules.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/JavaScriptHighlightRules.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/Html.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/HtmlHighlightRules.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/Css.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/CssHighlightRules.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/Xml.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/XmlHighlightRules.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/mode/MatchingBraceOutdent.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/MEventEmitter.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/Search.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/Range.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/Selection.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/UndoManager.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/Document.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/Tokenizer.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/BackgroundTokenizer.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/layer/Cursor.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/layer/Gutter.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/layer/Text.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/layer/Marker.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/ScrollBar.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/TextInput.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/KeyBinding.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/Editor.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
<script src="../src/ace/VirtualRenderer.js" type="text/javascript" charset="utf-8"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
@ -149,18 +116,34 @@
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
|
||||||
|
require(
|
||||||
|
{baseUrl: "../src"},
|
||||||
|
[
|
||||||
|
"ace/Editor",
|
||||||
|
"ace/VirtualRenderer",
|
||||||
|
"ace/Document",
|
||||||
|
"ace/mode/JavaScript",
|
||||||
|
"ace/mode/Css",
|
||||||
|
"ace/mode/Html",
|
||||||
|
"ace/mode/Xml",
|
||||||
|
"ace/mode/Text",
|
||||||
|
"ace/UndoManager"
|
||||||
|
], function(Editor, Renderer, Document, JavaScriptMode, CssMode, HtmlMode, XmlMode, TextMode, UndoManager) {
|
||||||
|
|
||||||
|
var ace = require("ace/ace");
|
||||||
var docs = {}
|
var docs = {}
|
||||||
docs.js = new ace.Document(document.getElementById("jstext").innerHTML);
|
|
||||||
docs.js.setMode(new ace.mode.JavaScript());
|
|
||||||
docs.js.setUndoManager(new ace.UndoManager());
|
|
||||||
|
|
||||||
docs.css = new ace.Document(document.getElementById("csstext").innerHTML);
|
docs.js = new Document(document.getElementById("jstext").innerHTML);
|
||||||
docs.css.setMode(new ace.mode.Css());
|
docs.js.setMode(new JavaScriptMode());
|
||||||
docs.css.setUndoManager(new ace.UndoManager());
|
docs.js.setUndoManager(new UndoManager());
|
||||||
|
|
||||||
docs.html = new ace.Document(document.getElementById("htmltext").innerHTML);
|
docs.css = new Document(document.getElementById("csstext").innerHTML);
|
||||||
docs.html.setMode(new ace.mode.Html());
|
docs.css.setMode(new CssMode());
|
||||||
docs.html.setUndoManager(new ace.UndoManager());
|
docs.css.setUndoManager(new UndoManager());
|
||||||
|
|
||||||
|
docs.html = new Document(document.getElementById("htmltext").innerHTML);
|
||||||
|
docs.html.setMode(new HtmlMode());
|
||||||
|
docs.html.setUndoManager(new UndoManager());
|
||||||
|
|
||||||
var docEl = document.getElementById("doc");
|
var docEl = document.getElementById("doc");
|
||||||
|
|
||||||
|
|
@ -169,16 +152,16 @@ function onDocChange() {
|
||||||
editor.setDocument(doc);
|
editor.setDocument(doc);
|
||||||
|
|
||||||
var mode = doc.getMode();
|
var mode = doc.getMode();
|
||||||
if (mode instanceof ace.mode.JavaScript) {
|
if (mode instanceof JavaScriptMode) {
|
||||||
modeEl.value = "javascript"
|
modeEl.value = "javascript"
|
||||||
}
|
}
|
||||||
else if (mode instanceof ace.mode.Css) {
|
else if (mode instanceof CssMode) {
|
||||||
modeEl.value = "css"
|
modeEl.value = "css"
|
||||||
}
|
}
|
||||||
else if (mode instanceof ace.mode.Html) {
|
else if (mode instanceof HtmlMode) {
|
||||||
modeEl.value = "html"
|
modeEl.value = "html"
|
||||||
}
|
}
|
||||||
else if (mode instanceof ace.mode.Xml) {
|
else if (mode instanceof XmlMode) {
|
||||||
modeEl.value = "xml"
|
modeEl.value = "xml"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -199,11 +182,11 @@ modeEl.onchange = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var modes = {
|
var modes = {
|
||||||
text: new ace.mode.Text(),
|
text: new TextMode(),
|
||||||
xml: new ace.mode.Xml(),
|
xml: new XmlMode(),
|
||||||
html: new ace.mode.Html(),
|
html: new HtmlMode(),
|
||||||
css: new ace.mode.Css(),
|
css: new CssMode(),
|
||||||
javascript: new ace.mode.JavaScript()
|
javascript: new JavaScriptMode()
|
||||||
};
|
};
|
||||||
|
|
||||||
function getMode() {
|
function getMode() {
|
||||||
|
|
@ -225,7 +208,7 @@ activeEl.onchange = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var container = document.getElementById("editor");
|
var container = document.getElementById("editor");
|
||||||
var editor = new ace.Editor(new ace.VirtualRenderer(container));
|
var editor = new Editor(new Renderer(container));
|
||||||
onDocChange();
|
onDocChange();
|
||||||
|
|
||||||
function onResize() {
|
function onResize() {
|
||||||
|
|
@ -275,6 +258,8 @@ ace.addListener(container, "drop", function(e) {
|
||||||
return ace.preventDefault(e);
|
return ace.preventDefault(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
1246
demo/require.js
Normal file
1246
demo/require.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.BackgroundTokenizer");
|
require.def("ace/BackgroundTokenizer", ["ace/ace", "ace/MEventEmitter"], function(ace, MEventEmitter) {
|
||||||
|
|
||||||
ace.BackgroundTokenizer = function(tokenizer) {
|
var BackgroundTokenizer = function(tokenizer) {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
this.textLines = [];
|
this.textLines = [];
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
|
|
@ -37,7 +37,7 @@ ace.BackgroundTokenizer = function(tokenizer) {
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
ace.implement(this, ace.MEventEmitter);
|
ace.implement(this, MEventEmitter);
|
||||||
|
|
||||||
this.setTokenizer = function(tokenizer) {
|
this.setTokenizer = function(tokenizer) {
|
||||||
this.tokenizer = tokenizer;
|
this.tokenizer = tokenizer;
|
||||||
|
|
@ -102,4 +102,7 @@ ace.BackgroundTokenizer = function(tokenizer) {
|
||||||
return this.lines[row];
|
return this.lines[row];
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.BackgroundTokenizer.prototype);
|
}).call(BackgroundTokenizer.prototype);
|
||||||
|
|
||||||
|
return BackgroundTokenizer;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,16 @@
|
||||||
ace.provide("ace.Document");
|
require.def("ace/Document",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/MEventEmitter",
|
||||||
|
"ace/Selection",
|
||||||
|
"ace/mode/Text",
|
||||||
|
"ace/Range"
|
||||||
|
], function(ace, MEventEmitter, Selection, TextMode, Range) {
|
||||||
|
|
||||||
ace.Document = function(text, mode) {
|
var Document = function(text, mode) {
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
this.selection = new ace.Selection(this);
|
this.selection = new Selection(this);
|
||||||
this.$breakpoints = [];
|
this.$breakpoints = [];
|
||||||
|
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
|
|
@ -20,7 +27,7 @@ ace.Document = function(text, mode) {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
ace.implement(this, ace.MEventEmitter);
|
ace.implement(this, MEventEmitter);
|
||||||
|
|
||||||
this.$undoManager = null;
|
this.$undoManager = null;
|
||||||
|
|
||||||
|
|
@ -182,7 +189,7 @@ ace.Document = function(text, mode) {
|
||||||
|
|
||||||
this.getMode = function() {
|
this.getMode = function() {
|
||||||
if (!this.$mode) {
|
if (!this.$mode) {
|
||||||
this.$mode = new ace.mode.Text();
|
this.$mode = new TextMode();
|
||||||
}
|
}
|
||||||
return this.$mode;
|
return this.$mode;
|
||||||
};
|
};
|
||||||
|
|
@ -370,7 +377,7 @@ ace.Document = function(text, mode) {
|
||||||
var nl = this.$getNewLineCharacter();
|
var nl = this.$getNewLineCharacter();
|
||||||
this.$deltas.push({
|
this.$deltas.push({
|
||||||
action: "insertText",
|
action: "insertText",
|
||||||
range: new ace.Range(row, 0, row + lines.length, 0),
|
range: new Range(row, 0, row + lines.length, 0),
|
||||||
text: lines.join(nl) + nl
|
text: lines.join(nl) + nl
|
||||||
});
|
});
|
||||||
this.$informUndoManager.schedule();
|
this.$informUndoManager.schedule();
|
||||||
|
|
@ -430,7 +437,7 @@ ace.Document = function(text, mode) {
|
||||||
var nl = this.$getNewLineCharacter();
|
var nl = this.$getNewLineCharacter();
|
||||||
this.$deltas.push({
|
this.$deltas.push({
|
||||||
action: "insertText",
|
action: "insertText",
|
||||||
range: ace.Range.fromPoints(position, end),
|
range: Range.fromPoints(position, end),
|
||||||
text: text
|
text: text
|
||||||
});
|
});
|
||||||
this.$informUndoManager.schedule();
|
this.$informUndoManager.schedule();
|
||||||
|
|
@ -546,7 +553,7 @@ ace.Document = function(text, mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var deleteRange = new ace.Range(0, 0, 0, outdentLength);
|
var deleteRange = new Range(0, 0, 0, outdentLength);
|
||||||
|
|
||||||
for (var i=range.start.row; i<= range.end.row; i++)
|
for (var i=range.start.row; i<= range.end.row; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -643,4 +650,7 @@ ace.Document = function(text, mode) {
|
||||||
return docColumn;
|
return docColumn;
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.Document.prototype);
|
}).call(Document.prototype);
|
||||||
|
|
||||||
|
return Document;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,21 @@
|
||||||
ace.provide("ace.Editor");
|
require.def("ace/Editor",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/TextInput",
|
||||||
|
"ace/KeyBinding",
|
||||||
|
"ace/Document",
|
||||||
|
"ace/Search",
|
||||||
|
"ace/BackgroundTokenizer",
|
||||||
|
"ace/Range",
|
||||||
|
], function(ace, TextInput, KeyBinding, Document, Search, BackgroundTokenizer, Range) {
|
||||||
|
|
||||||
ace.Editor = function(renderer, doc) {
|
var Editor = function(renderer, doc) {
|
||||||
var container = renderer.getContainerElement();
|
var container = renderer.getContainerElement();
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
|
|
||||||
this.textInput = new ace.TextInput(container, this);
|
this.textInput = new TextInput(container, this);
|
||||||
new ace.KeyBinding(container, this);
|
new KeyBinding(container, this);
|
||||||
var self = this;
|
var self = this;
|
||||||
ace.addListener(container, "mousedown", function(e) {
|
ace.addListener(container, "mousedown", function(e) {
|
||||||
setTimeout(function() {self.focus();});
|
setTimeout(function() {self.focus();});
|
||||||
|
|
@ -26,11 +35,11 @@ ace.Editor = function(renderer, doc) {
|
||||||
this.$highlightLineMarker = null;
|
this.$highlightLineMarker = null;
|
||||||
this.$blockScrolling = false;
|
this.$blockScrolling = false;
|
||||||
|
|
||||||
this.$search = new ace.Search().set({
|
this.$search = new Search().set({
|
||||||
wrap: true
|
wrap: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setDocument(doc || new ace.Document(""));
|
this.setDocument(doc || new Document(""));
|
||||||
};
|
};
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
|
|
@ -142,7 +151,7 @@ ace.Editor = function(renderer, doc) {
|
||||||
|
|
||||||
var pos = self.doc.findMatchingBracket(self.getCursorPosition());
|
var pos = self.doc.findMatchingBracket(self.getCursorPosition());
|
||||||
if (pos) {
|
if (pos) {
|
||||||
var range = new ace.Range(pos.row, pos.column, pos.row, pos.column+1);
|
var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
|
||||||
self.$bracketHighlight = self.renderer.addMarker(range, "ace_bracket");
|
self.$bracketHighlight = self.renderer.addMarker(range, "ace_bracket");
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
@ -198,7 +207,7 @@ ace.Editor = function(renderer, doc) {
|
||||||
|
|
||||||
if (this.getHighlightActiveLine() && !this.selection.isMultiLine()) {
|
if (this.getHighlightActiveLine() && !this.selection.isMultiLine()) {
|
||||||
var cursor = this.getCursorPosition();
|
var cursor = this.getCursorPosition();
|
||||||
var range = new ace.Range(cursor.row, 0, cursor.row+1, 0);
|
var range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||||
this.$highlightLineMarker = this.renderer.addMarker(range, "ace_active_line", "line");
|
this.$highlightLineMarker = this.renderer.addMarker(range, "ace_active_line", "line");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -230,7 +239,7 @@ ace.Editor = function(renderer, doc) {
|
||||||
|
|
||||||
if (!this.bgTokenizer) {
|
if (!this.bgTokenizer) {
|
||||||
var onUpdate = ace.bind(this.onTokenizerUpdate, this);
|
var onUpdate = ace.bind(this.onTokenizerUpdate, this);
|
||||||
this.bgTokenizer = new ace.BackgroundTokenizer(tokenizer);
|
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
|
||||||
this.bgTokenizer.addEventListener("update", onUpdate);
|
this.bgTokenizer.addEventListener("update", onUpdate);
|
||||||
} else {
|
} else {
|
||||||
this.bgTokenizer.setTokenizer(tokenizer);
|
this.bgTokenizer.setTokenizer(tokenizer);
|
||||||
|
|
@ -349,7 +358,7 @@ ace.Editor = function(renderer, doc) {
|
||||||
var cursor = this.doc.remove(this.getSelectionRange());
|
var cursor = this.doc.remove(this.getSelectionRange());
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
} else if (this.$overwrite){
|
} else if (this.$overwrite){
|
||||||
var range = new ace.Range.fromPoints(cursor, cursor);
|
var range = new Range.fromPoints(cursor, cursor);
|
||||||
range.end.column += text.length;
|
range.end.column += text.length;
|
||||||
this.doc.remove(range);
|
this.doc.remove(range);
|
||||||
}
|
}
|
||||||
|
|
@ -369,7 +378,7 @@ ace.Editor = function(renderer, doc) {
|
||||||
if (row !== end.row) {
|
if (row !== end.row) {
|
||||||
var indent = this.mode.getNextLineIndent(lineState, line, this.doc.getTabString());
|
var indent = this.mode.getNextLineIndent(lineState, line, this.doc.getTabString());
|
||||||
if (indent) {
|
if (indent) {
|
||||||
var indentRange = new ace.Range(row+1, 0, end.row, end.column);
|
var indentRange = new Range(row+1, 0, end.row, end.column);
|
||||||
end.column += this.doc.indentRows(indentRange, indent);
|
end.column += this.doc.indentRows(indentRange, indent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -519,7 +528,7 @@ ace.Editor = function(renderer, doc) {
|
||||||
|
|
||||||
var rows = this.$getSelectedRows();
|
var rows = this.$getSelectedRows();
|
||||||
|
|
||||||
var range = new ace.Range(rows.first, 0, rows.last, 0);
|
var range = new Range(rows.first, 0, rows.last, 0);
|
||||||
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
|
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
|
||||||
var addedColumns = this.mode.toggleCommentLines(state, this.doc, range);
|
var addedColumns = this.mode.toggleCommentLines(state, this.doc, range);
|
||||||
|
|
||||||
|
|
@ -871,4 +880,8 @@ ace.Editor = function(renderer, doc) {
|
||||||
this.doc.getUndoManager().redo();
|
this.doc.getUndoManager().redo();
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.Editor.prototype);
|
}).call(Editor.prototype);
|
||||||
|
|
||||||
|
|
||||||
|
return Editor;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
ace.provide("ace.KeyBinding");
|
require.def("ace/KeyBinding", ["ace/ace"], function(ace) {
|
||||||
|
|
||||||
ace.KeyBinding = function(element, editor, config) {
|
|
||||||
|
|
||||||
|
var KeyBinding = function(element, editor, config) {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.setConfig(config);
|
this.setConfig(config);
|
||||||
var keys = this.keys;
|
var keys = this.keys;
|
||||||
|
|
@ -211,4 +210,7 @@ ace.KeyBinding = function(element, editor, config) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.KeyBinding.prototype);
|
}).call(KeyBinding.prototype);
|
||||||
|
|
||||||
|
return KeyBinding;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
ace.provide("ace.MEventEmitter");
|
require.def("ace/MEventEmitter", ["ace/ace"], function(ace) {
|
||||||
|
|
||||||
ace.MEventEmitter = function() {
|
var MEventEmitter = {}
|
||||||
|
|
||||||
this.$dispatchEvent = function(eventName, e) {
|
MEventEmitter.$dispatchEvent = function(eventName, e) {
|
||||||
this.$eventRegistry = this.$eventRegistry || {};
|
this.$eventRegistry = this.$eventRegistry || {};
|
||||||
|
|
||||||
var listeners = this.$eventRegistry[eventName];
|
var listeners = this.$eventRegistry[eventName];
|
||||||
|
|
@ -16,7 +16,7 @@ ace.MEventEmitter = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addEventListener = function(eventName, callback) {
|
MEventEmitter.addEventListener = function(eventName, callback) {
|
||||||
this.$eventRegistry = this.$eventRegistry || {};
|
this.$eventRegistry = this.$eventRegistry || {};
|
||||||
|
|
||||||
var listeners = this.$eventRegistry[eventName];
|
var listeners = this.$eventRegistry[eventName];
|
||||||
|
|
@ -28,7 +28,7 @@ ace.MEventEmitter = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeEventListener = function(eventName, callback) {
|
MEventEmitter.removeEventListener = function(eventName, callback) {
|
||||||
this.$eventRegistry = this.$eventRegistry || {};
|
this.$eventRegistry = this.$eventRegistry || {};
|
||||||
|
|
||||||
var listeners = this.$eventRegistry[eventName];
|
var listeners = this.$eventRegistry[eventName];
|
||||||
|
|
@ -40,4 +40,6 @@ ace.MEventEmitter = function() {
|
||||||
listeners.splice(index, 1);
|
listeners.splice(index, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
return MEventEmitter;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.Range");
|
require.def("ace/Range", function() {
|
||||||
|
|
||||||
ace.Range = function(startRow, startColumn, endRow, endColumn) {
|
var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
this.start = {
|
this.start = {
|
||||||
row: startRow,
|
row: startRow,
|
||||||
column: startColumn
|
column: startColumn
|
||||||
|
|
@ -73,7 +73,7 @@ ace.Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
column: 0
|
column: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return ace.Range.fromPoints(start || this.start, end || this.end);
|
return Range.fromPoints(start || this.start, end || this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.extend = function(row, column) {
|
this.extend = function(row, column) {
|
||||||
|
|
@ -86,7 +86,7 @@ ace.Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
else
|
else
|
||||||
var end = {row: row, column: column};
|
var end = {row: row, column: column};
|
||||||
|
|
||||||
return ace.Range.fromPoints(start || this.start, end || this.end);
|
return Range.fromPoints(start || this.start, end || this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
|
|
@ -98,19 +98,22 @@ ace.Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clone = function() {
|
this.clone = function() {
|
||||||
return ace.Range.fromPoints(this.start, this.end);
|
return Range.fromPoints(this.start, this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toScreenRange = function(doc) {
|
this.toScreenRange = function(doc) {
|
||||||
return new ace.Range(
|
return new Range(
|
||||||
this.start.row, doc.documentToScreenColumn(this.start.row, this.start.column),
|
this.start.row, doc.documentToScreenColumn(this.start.row, this.start.column),
|
||||||
this.end.row, doc.documentToScreenColumn(this.end.row, this.end.column)
|
this.end.row, doc.documentToScreenColumn(this.end.row, this.end.column)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.Range.prototype);
|
}).call(Range.prototype);
|
||||||
|
|
||||||
|
|
||||||
ace.Range.fromPoints = function(start, end) {
|
Range.fromPoints = function(start, end) {
|
||||||
return new ace.Range(start.row, start.column, end.row, end.column);
|
return new Range(start.row, start.column, end.row, end.column);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return Range;
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.ScrollBar");
|
require.def("ace/ScrollBar", ["ace/ace", "ace/MEventEmitter"], function(ace, MEventEmitter) {
|
||||||
|
|
||||||
ace.ScrollBar = function(parent) {
|
var ScrollBar = function(parent) {
|
||||||
this.element = document.createElement("div");
|
this.element = document.createElement("div");
|
||||||
this.element.className = "ace_sb";
|
this.element.className = "ace_sb";
|
||||||
|
|
||||||
|
|
@ -16,8 +16,7 @@ ace.ScrollBar = function(parent) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
ace.implement(this, MEventEmitter);
|
||||||
ace.implement(this, ace.MEventEmitter);
|
|
||||||
|
|
||||||
this.onScroll = function() {
|
this.onScroll = function() {
|
||||||
this.$dispatchEvent("scroll", {data: this.element.scrollTop});
|
this.$dispatchEvent("scroll", {data: this.element.scrollTop});
|
||||||
|
|
@ -39,4 +38,7 @@ ace.ScrollBar = function(parent) {
|
||||||
this.element.scrollTop = scrollTop;
|
this.element.scrollTop = scrollTop;
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.ScrollBar.prototype);
|
}).call(ScrollBar.prototype);
|
||||||
|
|
||||||
|
return ScrollBar;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
ace.provide("ace.Search");
|
require.def("ace/Search", ["ace/ace"], function(ace) {
|
||||||
|
|
||||||
ace.Search = function() {
|
var Search = function() {
|
||||||
this.$options = {
|
this.$options = {
|
||||||
needle: "",
|
needle: "",
|
||||||
backwards: false,
|
backwards: false,
|
||||||
wrap: false,
|
wrap: false,
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
wholeWord: false,
|
wholeWord: false,
|
||||||
scope: ace.Search.ALL,
|
scope: Search.ALL,
|
||||||
regExp: false
|
regExp: false
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Search.ALL = 1;
|
Search.ALL = 1;
|
||||||
ace.Search.SELECTION = 2;
|
Search.SELECTION = 2;
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ ace.Search.SELECTION = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$forwardLineIterator = function(doc) {
|
this.$forwardLineIterator = function(doc) {
|
||||||
var searchSelection = this.$options.scope == ace.Search.SELECTION;
|
var searchSelection = this.$options.scope == Search.SELECTION;
|
||||||
|
|
||||||
var range = doc.getSelection().getRange();
|
var range = doc.getSelection().getRange();
|
||||||
var start = doc.getSelection().getCursor();
|
var start = doc.getSelection().getCursor();
|
||||||
|
|
@ -222,7 +222,7 @@ ace.Search.SELECTION = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$backwardLineIterator = function(doc) {
|
this.$backwardLineIterator = function(doc) {
|
||||||
var searchSelection = this.$options.scope == ace.Search.SELECTION;
|
var searchSelection = this.$options.scope == Search.SELECTION;
|
||||||
|
|
||||||
var range = doc.getSelection().getRange();
|
var range = doc.getSelection().getRange();
|
||||||
var start = searchSelection ? range.end : range.start;
|
var start = searchSelection ? range.end : range.start;
|
||||||
|
|
@ -272,4 +272,7 @@ ace.Search.SELECTION = 2;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.Search.prototype);
|
}).call(Search.prototype);
|
||||||
|
|
||||||
|
return Search;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
ace.provide("ace.Selection");
|
require.def("ace/Selection", [
|
||||||
|
"ace/ace",
|
||||||
|
"ace/MEventEmitter",
|
||||||
|
"ace/Range"
|
||||||
|
], function(ace, MEventEmitter, Range) {
|
||||||
|
|
||||||
ace.Selection = function(doc) {
|
var Selection = function(doc) {
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
|
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
|
|
@ -12,7 +16,7 @@ ace.Selection = function(doc) {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
ace.implement(this, ace.MEventEmitter);
|
ace.implement(this, MEventEmitter);
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (!this.selectionAnchor ||
|
return (!this.selectionAnchor ||
|
||||||
|
|
@ -90,10 +94,10 @@ ace.Selection = function(doc) {
|
||||||
var lead = this.selectionLead;
|
var lead = this.selectionLead;
|
||||||
|
|
||||||
if (this.$isBackwards()) {
|
if (this.$isBackwards()) {
|
||||||
return ace.Range.fromPoints(lead, anchor);
|
return Range.fromPoints(lead, anchor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ace.Range.fromPoints(anchor, lead);
|
return Range.fromPoints(anchor, lead);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -387,4 +391,7 @@ ace.Selection = function(doc) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.Selection.prototype);
|
}).call(Selection.prototype);
|
||||||
|
|
||||||
|
return Selection;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.TextInput");
|
require.def("ace/TextInput", ["ace/ace"], function(ace) {
|
||||||
|
|
||||||
ace.TextInput = function(parentNode, host) {
|
var TextInput = function(parentNode, host) {
|
||||||
|
|
||||||
var text = document.createElement("textarea");
|
var text = document.createElement("textarea");
|
||||||
var style = text.style;
|
var style = text.style;
|
||||||
|
|
@ -81,3 +81,6 @@ ace.TextInput = function(parentNode, host) {
|
||||||
text.blur();
|
text.blur();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return TextInput;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.Tokenizer");
|
require.def("ace/Tokenizer", [], function() {
|
||||||
|
|
||||||
ace.Tokenizer = function(rules) {
|
var Tokenizer = function(rules) {
|
||||||
this.rules = rules;
|
this.rules = rules;
|
||||||
|
|
||||||
this.regExps = {};
|
this.regExps = {};
|
||||||
|
|
@ -89,4 +89,7 @@ ace.Tokenizer = function(rules) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.Tokenizer.prototype);
|
}).call(Tokenizer.prototype);
|
||||||
|
|
||||||
|
return Tokenizer;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.UndoManager");
|
require.def("ace/UndoManager", function() {
|
||||||
|
|
||||||
ace.UndoManager = function() {
|
var UndoManager = function() {
|
||||||
this.$undoStack = [];
|
this.$undoStack = [];
|
||||||
this.$redoStack = [];
|
this.$redoStack = [];
|
||||||
};
|
};
|
||||||
|
|
@ -32,4 +32,7 @@ ace.UndoManager = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.UndoManager.prototype);
|
}).call(UndoManager.prototype);
|
||||||
|
|
||||||
|
return UndoManager;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
ace.provide("ace.VirtualRenderer");
|
require.def("ace/VirtualRenderer",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/layer/Gutter",
|
||||||
|
"ace/layer/Marker",
|
||||||
|
"ace/layer/Text",
|
||||||
|
"ace/layer/Cursor",
|
||||||
|
"ace/ScrollBar"
|
||||||
|
], function(ace, GutterLayer, MarkerLayer, TextLayer, CursorLayer, ScrollBar) {
|
||||||
|
|
||||||
ace.VirtualRenderer = function(container) {
|
var VirtualRenderer = function(container) {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
ace.addCssClass(this.container, "ace_editor");
|
ace.addCssClass(this.container, "ace_editor");
|
||||||
|
|
||||||
|
|
@ -16,20 +24,20 @@ ace.VirtualRenderer = function(container) {
|
||||||
this.content.style.position = "absolute";
|
this.content.style.position = "absolute";
|
||||||
this.scroller.appendChild(this.content);
|
this.scroller.appendChild(this.content);
|
||||||
|
|
||||||
this.$gutterLayer = new ace.layer.Gutter(this.$gutter);
|
this.$gutterLayer = new GutterLayer(this.$gutter);
|
||||||
this.$markerLayer = new ace.layer.Marker(this.content);
|
this.$markerLayer = new MarkerLayer(this.content);
|
||||||
|
|
||||||
var textLayer = this.$textLayer = new ace.layer.Text(this.content);
|
var textLayer = this.$textLayer = new TextLayer(this.content);
|
||||||
this.canvas = textLayer.element;
|
this.canvas = textLayer.element;
|
||||||
|
|
||||||
this.characterWidth = textLayer.getCharacterWidth();
|
this.characterWidth = textLayer.getCharacterWidth();
|
||||||
this.lineHeight = textLayer.getLineHeight();
|
this.lineHeight = textLayer.getLineHeight();
|
||||||
|
|
||||||
this.$cursorLayer = new ace.layer.Cursor(this.content);
|
this.$cursorLayer = new CursorLayer(this.content);
|
||||||
|
|
||||||
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
|
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
|
||||||
|
|
||||||
this.scrollBar = new ace.ScrollBar(container);
|
this.scrollBar = new ScrollBar(container);
|
||||||
this.scrollBar.addEventListener("scroll", ace.bind(this.onScroll, this));
|
this.scrollBar.addEventListener("scroll", ace.bind(this.onScroll, this));
|
||||||
|
|
||||||
this.scrollTop = 0;
|
this.scrollTop = 0;
|
||||||
|
|
@ -335,4 +343,7 @@ ace.VirtualRenderer = function(container) {
|
||||||
this.hideComposition = function() {
|
this.hideComposition = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.VirtualRenderer.prototype);
|
}).call(VirtualRenderer.prototype);
|
||||||
|
|
||||||
|
return VirtualRenderer;
|
||||||
|
});
|
||||||
|
|
|
||||||
18
src/ace/ace.js
Normal file
18
src/ace/ace.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
require.def("ace/ace", [
|
||||||
|
"ace/lib/core",
|
||||||
|
"ace/lib/dom",
|
||||||
|
"ace/lib/event",
|
||||||
|
"ace/lib/lang",
|
||||||
|
"ace/lib/oop"
|
||||||
|
], function(core, dom, evt, lang, oop) {
|
||||||
|
|
||||||
|
var ace = {};
|
||||||
|
|
||||||
|
oop.mixin(ace, core);
|
||||||
|
oop.mixin(ace, dom);
|
||||||
|
oop.mixin(ace, evt);
|
||||||
|
oop.mixin(ace, lang);
|
||||||
|
oop.mixin(ace, oop);
|
||||||
|
|
||||||
|
return ace;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.KeyBinding.default_mac");
|
require.def("ace/conf/keybinding/default_mac", function() {
|
||||||
|
|
||||||
ace.KeyBinding.default_mac = {
|
return {
|
||||||
"selectall": "Meta-A",
|
"selectall": "Meta-A",
|
||||||
"removeline": "Meta-D",
|
"removeline": "Meta-D",
|
||||||
"gotoline": "Meta-L",
|
"gotoline": "Meta-L",
|
||||||
|
|
@ -47,3 +47,5 @@ ace.KeyBinding.default_mac = {
|
||||||
"outdent": "Shift-Tab",
|
"outdent": "Shift-Tab",
|
||||||
"indent": "Tab"
|
"indent": "Tab"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.KeyBinding.default_win");
|
require.def("ace/conf/keybinding/default_win", function() {
|
||||||
|
|
||||||
ace.KeyBinding.default_win = {
|
return {
|
||||||
"selectall": "Control-A",
|
"selectall": "Control-A",
|
||||||
"removeline": "Control-D",
|
"removeline": "Control-D",
|
||||||
"gotoline": "Control-L",
|
"gotoline": "Control-L",
|
||||||
|
|
@ -47,3 +47,5 @@ ace.KeyBinding.default_win = {
|
||||||
"outdent": "Shift-Tab",
|
"outdent": "Shift-Tab",
|
||||||
"indent": "Tab"
|
"indent": "Tab"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.layer.Cursor");
|
require.def("ace/layer/Cursor", ["ace/ace"], function(ace) {
|
||||||
|
|
||||||
ace.layer.Cursor = function(parentEl) {
|
var Cursor = function(parentEl) {
|
||||||
this.element = document.createElement("div");
|
this.element = document.createElement("div");
|
||||||
this.element.className = "ace_layer ace_cursor-layer";
|
this.element.className = "ace_layer ace_cursor-layer";
|
||||||
parentEl.appendChild(this.element);
|
parentEl.appendChild(this.element);
|
||||||
|
|
@ -92,4 +92,7 @@ ace.layer.Cursor = function(parentEl) {
|
||||||
this.restartTimer();
|
this.restartTimer();
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.layer.Cursor.prototype);
|
}).call(Cursor.prototype);
|
||||||
|
|
||||||
|
return Cursor;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.layer.Gutter");
|
require.def("ace/layer/Gutter", [], function() {
|
||||||
|
|
||||||
ace.layer.Gutter = function(parentEl) {
|
var Gutter = function(parentEl) {
|
||||||
this.element = document.createElement("div");
|
this.element = document.createElement("div");
|
||||||
this.element.className = "ace_layer ace_gutter-layer";
|
this.element.className = "ace_layer ace_gutter-layer";
|
||||||
parentEl.appendChild(this.element);
|
parentEl.appendChild(this.element);
|
||||||
|
|
@ -32,4 +32,7 @@ ace.layer.Gutter = function(parentEl) {
|
||||||
this.element.style.height = config.minHeight + "px";
|
this.element.style.height = config.minHeight + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.layer.Gutter.prototype);
|
}).call(Gutter.prototype);
|
||||||
|
|
||||||
|
return Gutter;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.layer.Marker");
|
require.def("ace/layer/Marker", [], function() {
|
||||||
|
|
||||||
ace.layer.Marker = function(parentEl) {
|
var Marker = function(parentEl) {
|
||||||
this.element = document.createElement("div");
|
this.element = document.createElement("div");
|
||||||
this.element.className = "ace_layer ace_marker-layer";
|
this.element.className = "ace_layer ace_marker-layer";
|
||||||
parentEl.appendChild(this.element);
|
parentEl.appendChild(this.element);
|
||||||
|
|
@ -142,4 +142,7 @@ ace.layer.Marker = function(parentEl) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.layer.Marker.prototype);
|
}).call(Marker.prototype);
|
||||||
|
|
||||||
|
return Marker;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.layer.Text");
|
require.def("ace/layer/Text", ["ace/ace", "ace/MEventEmitter"], function(ace, MEventEmitter) {
|
||||||
|
|
||||||
ace.layer.Text = function(parentEl) {
|
var Text = function(parentEl) {
|
||||||
this.element = document.createElement("div");
|
this.element = document.createElement("div");
|
||||||
this.element.className = "ace_layer ace_text-layer";
|
this.element.className = "ace_layer ace_text-layer";
|
||||||
parentEl.appendChild(this.element);
|
parentEl.appendChild(this.element);
|
||||||
|
|
@ -11,7 +11,7 @@ ace.layer.Text = function(parentEl) {
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
ace.implement(this, ace.MEventEmitter);
|
ace.implement(this, MEventEmitter);
|
||||||
|
|
||||||
this.EOF_CHAR = "¶";
|
this.EOF_CHAR = "¶";
|
||||||
this.EOL_CHAR = "¬";
|
this.EOL_CHAR = "¬";
|
||||||
|
|
@ -180,4 +180,7 @@ ace.layer.Text = function(parentEl) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.layer.Text.prototype);
|
}).call(Text.prototype);
|
||||||
|
|
||||||
|
return Text;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
if (!window.ace)
|
require.def("ace/lib/core", function() {
|
||||||
ace = {};
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
|
var core = {};
|
||||||
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
||||||
|
|
||||||
this.isWin = (os == "win");
|
core.isWin = (os == "win");
|
||||||
this.isMac = (os == "mac");
|
core.isMac = (os == "mac");
|
||||||
this.isLinux = (os == "linux");
|
core.isLinux = (os == "linux");
|
||||||
|
core.isIE = ! + "\v1";
|
||||||
|
|
||||||
this.provide = function(namespace) {
|
core.provide = function(namespace) {
|
||||||
var parts = namespace.split(".");
|
var parts = namespace.split(".");
|
||||||
var obj = window;
|
var obj = window;
|
||||||
for (var i=0; i<parts.length; i++) {
|
for (var i=0; i<parts.length; i++) {
|
||||||
|
|
@ -21,4 +20,6 @@ if (!window.ace)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace);
|
return core;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
(function() {
|
require.def("ace/lib/dom", ["ace/lib/lang"], function(lang) {
|
||||||
|
|
||||||
var self = this;
|
var dom = {};
|
||||||
|
|
||||||
this.setText = function(elem, text) {
|
dom.setText = function(elem, text) {
|
||||||
if (elem.innerText !== undefined) {
|
if (elem.innerText !== undefined) {
|
||||||
elem.innerText = text;
|
elem.innerText = text;
|
||||||
}
|
}
|
||||||
|
|
@ -11,22 +11,21 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hasCssClass = function(el, name) {
|
dom.hasCssClass = function(el, name) {
|
||||||
var classes = el.className.split(/\s+/g);
|
var classes = el.className.split(/\s+/g);
|
||||||
return ace.arrayIndexOf(classes, name) !== -1;
|
return lang.arrayIndexOf(classes, name) !== -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dom.addCssClass = function(el, name) {
|
||||||
this.addCssClass = function(el, name) {
|
if (!dom.hasCssClass(el, name)) {
|
||||||
if (!this.hasCssClass(el, name)) {
|
|
||||||
el.className += " " + name;
|
el.className += " " + name;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeCssClass = function(el, name) {
|
dom.removeCssClass = function(el, name) {
|
||||||
var classes = el.className.split(/\s+/g);
|
var classes = el.className.split(/\s+/g);
|
||||||
while (true) {
|
while (true) {
|
||||||
var index = ace.arrayIndexOf(classes, name);
|
var index = lang.arrayIndexOf(classes, name);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -35,17 +34,17 @@
|
||||||
el.className = classes.join(" ");
|
el.className = classes.join(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getInnerWidth = function(element) {
|
dom.getInnerWidth = function(element) {
|
||||||
return (parseInt(self.computedStyle(element, "paddingLeft"))
|
return (parseInt(dom.computedStyle(element, "paddingLeft"))
|
||||||
+ parseInt(self.computedStyle(element, "paddingRight")) + element.clientWidth);
|
+ parseInt(dom.computedStyle(element, "paddingRight")) + element.clientWidth);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getInnerHeight = function(element) {
|
dom.getInnerHeight = function(element) {
|
||||||
return (parseInt(this.computedStyle(element, "paddingTop"))
|
return (parseInt(dom.computedStyle(element, "paddingTop"))
|
||||||
+ parseInt(this.computedStyle(element, "paddingBottom")) + element.clientHeight);
|
+ parseInt(dom.computedStyle(element, "paddingBottom")) + element.clientHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.computedStyle = function(element, style) {
|
dom.computedStyle = function(element, style) {
|
||||||
if (window.getComputedStyle) {
|
if (window.getComputedStyle) {
|
||||||
return (window.getComputedStyle(element, "") || {})[style] || "";
|
return (window.getComputedStyle(element, "") || {})[style] || "";
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +53,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.scrollbarWidth = function() {
|
dom.scrollbarWidth = function() {
|
||||||
|
|
||||||
var inner = document.createElement('p');
|
var inner = document.createElement('p');
|
||||||
inner.style.width = "100%";
|
inner.style.width = "100%";
|
||||||
|
|
@ -85,4 +84,5 @@
|
||||||
return noScrollbar-withScrollbar;
|
return noScrollbar-withScrollbar;
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace);
|
return dom;
|
||||||
|
});
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
(function() {
|
require.def("ace/lib/event", ["ace/lib/core"], function(core) {
|
||||||
|
|
||||||
var self = this;
|
var event = {};
|
||||||
|
|
||||||
this.isIE = ! + "\v1";
|
event.addListener = function(elem, type, callback) {
|
||||||
|
|
||||||
this.addListener = function(elem, type, callback) {
|
|
||||||
if (elem.addEventListener) {
|
if (elem.addEventListener) {
|
||||||
return elem.addEventListener(type, callback, false);
|
return elem.addEventListener(type, callback, false);
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +15,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.removeListener = function(elem, type, callback) {
|
event.removeListener = function(elem, type, callback) {
|
||||||
if (elem.removeEventListener) {
|
if (elem.removeEventListener) {
|
||||||
return elem.removeEventListener(type, callback, false);
|
return elem.removeEventListener(type, callback, false);
|
||||||
}
|
}
|
||||||
|
|
@ -26,27 +24,27 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.stopEvent = function(e) {
|
event.stopEvent = function(e) {
|
||||||
self.stopPropagation(e);
|
event.stopPropagation(e);
|
||||||
self.preventDefault(e);
|
event.preventDefault(e);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.stopPropagation = function(e) {
|
event.stopPropagation = function(e) {
|
||||||
if (e.stopPropagation)
|
if (e.stopPropagation)
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
else
|
else
|
||||||
e.cancelBubble = true;
|
e.cancelBubble = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.preventDefault = function(e) {
|
event.preventDefault = function(e) {
|
||||||
if (e.preventDefault)
|
if (e.preventDefault)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
else
|
else
|
||||||
e.returnValue = false;
|
e.returnValue = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocumentX = function(event) {
|
event.getDocumentX = function(event) {
|
||||||
if (event.clientX) {
|
if (event.clientX) {
|
||||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||||
return event.clientX + scrollLeft;
|
return event.clientX + scrollLeft;
|
||||||
|
|
@ -55,7 +53,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocumentY = function(event) {
|
event.getDocumentY = function(event) {
|
||||||
if (event.clientY) {
|
if (event.clientY) {
|
||||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
return event.clientY + scrollTop;
|
return event.clientY + scrollTop;
|
||||||
|
|
@ -65,31 +63,31 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
if (document.documentElement.setCapture) {
|
if (document.documentElement.setCapture) {
|
||||||
this.capture = function(el, eventHandler, releaseCaptureHandler) {
|
event.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||||
function onMouseMove(e) {
|
function onMouseMove(e) {
|
||||||
eventHandler(e);
|
eventHandler(e);
|
||||||
return self.stopPropagation(e);
|
return event.stopPropagation(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onReleaseCapture(e) {
|
function onReleaseCapture(e) {
|
||||||
eventHandler && eventHandler(e);
|
eventHandler && eventHandler(e);
|
||||||
releaseCaptureHandler && releaseCaptureHandler();
|
releaseCaptureHandler && releaseCaptureHandler();
|
||||||
|
|
||||||
self.removeListener(el, "mousemove", eventHandler);
|
event.removeListener(el, "mousemove", eventHandler);
|
||||||
self.removeListener(el, "mouseup", onReleaseCapture);
|
event.removeListener(el, "mouseup", onReleaseCapture);
|
||||||
self.removeListener(el, "losecapture", onReleaseCapture);
|
event.removeListener(el, "losecapture", onReleaseCapture);
|
||||||
|
|
||||||
el.releaseCapture();
|
el.releaseCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.addListener(el, "mousemove", eventHandler);
|
event.addListener(el, "mousemove", eventHandler);
|
||||||
self.addListener(el, "mouseup", onReleaseCapture);
|
event.addListener(el, "mouseup", onReleaseCapture);
|
||||||
self.addListener(el, "losecapture", onReleaseCapture);
|
event.addListener(el, "losecapture", onReleaseCapture);
|
||||||
el.setCapture();
|
el.setCapture();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.capture = function(el, eventHandler, releaseCaptureHandler) {
|
event.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||||
function onMouseMove(e) {
|
function onMouseMove(e) {
|
||||||
eventHandler(e);
|
eventHandler(e);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
@ -110,17 +108,17 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addMouseWheelListener = function(el, callback) {
|
event.addMouseWheelListener = function(el, callback) {
|
||||||
var listener = function(e) {
|
var listener = function(e) {
|
||||||
e.wheel = (e.wheelDelta) ? e.wheelDelta / 120
|
e.wheel = (e.wheelDelta) ? e.wheelDelta / 120
|
||||||
: -(e.detail || 0) / 3;
|
: -(e.detail || 0) / 3;
|
||||||
callback(e);
|
callback(e);
|
||||||
};
|
};
|
||||||
self.addListener(el, "DOMMouseScroll", listener);
|
event.addListener(el, "DOMMouseScroll", listener);
|
||||||
self.addListener(el, "mousewheel", listener);
|
event.addListener(el, "mousewheel", listener);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addMultiMouseDownListener = function(el, count, callback) {
|
event.addMultiMouseDownListener = function(el, count, callback) {
|
||||||
var clicks = 0;
|
var clicks = 0;
|
||||||
var listener = function(e) {
|
var listener = function(e) {
|
||||||
clicks += 1;
|
clicks += 1;
|
||||||
|
|
@ -134,23 +132,23 @@
|
||||||
clicks = 0;
|
clicks = 0;
|
||||||
callback(e);
|
callback(e);
|
||||||
}
|
}
|
||||||
return self.preventDefault(e);
|
return event.preventDefault(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.addListener(el, "mousedown", listener);
|
event.addListener(el, "mousedown", listener);
|
||||||
this.isIE && self.addListener(el, "dblclick", listener);
|
core.isIE && event.addListener(el, "dblclick", listener);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addKeyListener = function(el, callback) {
|
event.addKeyListener = function(el, callback) {
|
||||||
var lastDown = null;
|
var lastDown = null;
|
||||||
|
|
||||||
self.addListener(el, "keydown", function(e) {
|
event.addListener(el, "keydown", function(e) {
|
||||||
lastDown = e.keyIdentifier || e.keyCode;
|
lastDown = e.keyIdentifier || e.keyCode;
|
||||||
return callback(e);
|
return callback(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ace.isMac) {
|
if (core.isMac) {
|
||||||
self.addListener(el, "keypress", function(e) {
|
event.addListener(el, "keypress", function(e) {
|
||||||
var keyId = e.keyIdentifier || e.keyCode;
|
var keyId = e.keyIdentifier || e.keyCode;
|
||||||
if (lastDown !== keyId) {
|
if (lastDown !== keyId) {
|
||||||
return callback(e);
|
return callback(e);
|
||||||
|
|
@ -160,4 +158,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}).call(ace);
|
|
||||||
|
return event;
|
||||||
|
});
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
(function() {
|
require.def("ace/lib/lang", function() {
|
||||||
|
|
||||||
this.stringReverse = function(string) {
|
var lang = {};
|
||||||
|
|
||||||
|
lang.stringReverse = function(string) {
|
||||||
return string.split("").reverse().join("");
|
return string.split("").reverse().join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Array.prototype.indexOf) {
|
if (Array.prototype.indexOf) {
|
||||||
this.arrayIndexOf = function(array, searchElement) {
|
lang.arrayIndexOf = function(array, searchElement) {
|
||||||
return array.indexOf(searchElement);
|
return array.indexOf(searchElement);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.arrayIndexOf = function(array, searchElement) {
|
lang.arrayIndexOf = function(array, searchElement) {
|
||||||
for (var i=0; i<array.length; i++) {
|
for (var i=0; i<array.length; i++) {
|
||||||
if (array[i] == searchElement) {
|
if (array[i] == searchElement) {
|
||||||
return i;
|
return i;
|
||||||
|
|
@ -20,11 +22,11 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isArray = function(value) {
|
lang.isArray = function(value) {
|
||||||
return Object.prototype.toString.call(value) == "[object Array]";
|
return Object.prototype.toString.call(value) == "[object Array]";
|
||||||
};
|
};
|
||||||
|
|
||||||
this.copyObject = function(obj) {
|
lang.copyObject = function(obj) {
|
||||||
var copy = {};
|
var copy = {};
|
||||||
for (var key in obj) {
|
for (var key in obj) {
|
||||||
copy[key] = obj[key];
|
copy[key] = obj[key];
|
||||||
|
|
@ -62,13 +64,13 @@
|
||||||
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.bind = function(fcn, context) {
|
lang.bind = function(fcn, context) {
|
||||||
return function() {
|
return function() {
|
||||||
return fcn.apply(context, arguments);
|
return fcn.apply(context, arguments);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deferredCall = function(fcn) {
|
lang.deferredCall = function(fcn) {
|
||||||
|
|
||||||
var timer = null;
|
var timer = null;
|
||||||
var callback = function() {
|
var callback = function() {
|
||||||
|
|
@ -84,7 +86,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
call: function() {
|
call: function() {
|
||||||
this.cancel();
|
lang.cancel();
|
||||||
fcn();
|
fcn();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -95,4 +97,5 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace);
|
return lang;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
(function() {
|
require.def("ace/lib/oop", function() {
|
||||||
|
|
||||||
this.inherits = function(ctor, superCtor) {
|
var oop = {};
|
||||||
|
|
||||||
|
oop.inherits = function(ctor, superCtor) {
|
||||||
var tempCtor = function() {};
|
var tempCtor = function() {};
|
||||||
tempCtor.prototype = superCtor.prototype;
|
tempCtor.prototype = superCtor.prototype;
|
||||||
ctor.super_ = superCtor.prototype;
|
ctor.super_ = superCtor.prototype;
|
||||||
|
|
@ -8,14 +10,15 @@
|
||||||
ctor.prototype.constructor = ctor;
|
ctor.prototype.constructor = ctor;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mixin = function(obj, mixin) {
|
oop.mixin = function(obj, mixin) {
|
||||||
for (var key in mixin) {
|
for (var key in mixin) {
|
||||||
obj[key] = mixin[key];
|
obj[key] = mixin[key];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.implement = function(proto, mixin) {
|
oop.implement = function(proto, mixin) {
|
||||||
mixin.call(proto);
|
oop.mixin(proto, mixin);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace);
|
return oop;
|
||||||
|
});
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
ace.provide("ace.mode.Css");
|
require.def("ace/mode/Css",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/Text",
|
||||||
|
"ace/Tokenizer",
|
||||||
|
"ace/mode/CssHighlightRules",
|
||||||
|
"ace/mode/MatchingBraceOutdent"
|
||||||
|
], function(ace, TextMode, Tokenizer, CssHighlightRules, MatchingBraceOutdent) {
|
||||||
|
|
||||||
ace.mode.Css = function() {
|
var Css = function() {
|
||||||
this.$tokenizer = new ace.Tokenizer(new ace.mode.CssHighlightRules().getRules());
|
this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
|
||||||
this.$outdent = new ace.mode.MatchingBraceOutdent();
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.Css, ace.mode.Text);
|
ace.inherits(Css, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -33,4 +40,7 @@ ace.inherits(ace.mode.Css, ace.mode.Text);
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
return this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.Css.prototype);
|
}).call(Css.prototype);
|
||||||
|
|
||||||
|
return Css;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
ace.provide("ace.mode.CssHighlightRules");
|
require.def("ace/mode/CssHighlightRules",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/TextHighlightRules"
|
||||||
|
], function(ace, TextHighlightRules) {
|
||||||
|
|
||||||
ace.mode.CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = ace.arrayToMap(
|
var properties = ace.arrayToMap(
|
||||||
("azimuth|background-attachment|background-color|background-image|" +
|
("azimuth|background-attachment|background-color|background-image|" +
|
||||||
|
|
@ -178,4 +182,7 @@ ace.mode.CssHighlightRules = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.inherits(ace.mode.CssHighlightRules, ace.mode.TextHighlightRules);
|
ace.inherits(CssHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
return CssHighlightRules;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
ace.provide("ace.mode.DocCommentHighlightRules");
|
require.def("ace/mode/DocCommentHighlightRules",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/TextHighlightRules"
|
||||||
|
], function(ace, TextHighlightRules) {
|
||||||
|
|
||||||
ace.mode.DocCommentHighlightRules = function() {
|
var DocCommentHighlightRules = function() {
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [ {
|
"start" : [ {
|
||||||
|
|
@ -23,7 +27,7 @@ ace.mode.DocCommentHighlightRules = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.inherits(ace.mode.DocCommentHighlightRules, ace.mode.TextHighlightRules);
|
ace.inherits(DocCommentHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -35,4 +39,7 @@ ace.inherits(ace.mode.DocCommentHighlightRules, ace.mode.TextHighlightRules);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.DocCommentHighlightRules.prototype);
|
}).call(DocCommentHighlightRules.prototype);
|
||||||
|
|
||||||
|
return DocCommentHighlightRules;
|
||||||
|
});
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
ace.provide("ace.mode.Html");
|
require.def("ace/mode/Html",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/Text",
|
||||||
|
"ace/mode/JavaScript",
|
||||||
|
"ace/mode/Css",
|
||||||
|
"ace/Tokenizer",
|
||||||
|
"ace/mode/HtmlHighlightRules"
|
||||||
|
], function(ace, TextMode, JavaScriptMode, CssMode, Tokenizer, HtmlHighlightRules) {
|
||||||
|
|
||||||
ace.mode.Html = function() {
|
var Html = function() {
|
||||||
this.$tokenizer = new ace.Tokenizer(new ace.mode.HtmlHighlightRules().getRules());
|
this.$tokenizer = new Tokenizer(new HtmlHighlightRules().getRules());
|
||||||
|
|
||||||
this.$js = new ace.mode.JavaScript();
|
this.$js = new JavaScriptMode();
|
||||||
this.$css = new ace.mode.Css();
|
this.$css = new CssMode();
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.Html, ace.mode.Text);
|
ace.inherits(Html, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -51,4 +59,7 @@ ace.inherits(ace.mode.Html, ace.mode.Text);
|
||||||
return defaultHandler ? defaultHandler() : undefined;
|
return defaultHandler ? defaultHandler() : undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.Html.prototype);
|
}).call(Html.prototype);
|
||||||
|
|
||||||
|
return Html;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
ace.provide("ace.mode.HtmlHighlightRules");
|
require.def("ace/mode/HtmlHighlightRules",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/CssHighlightRules",
|
||||||
|
"ace/mode/JavaScriptHighlightRules",
|
||||||
|
"ace/mode/TextHighlightRules"
|
||||||
|
], function(ace, CssHighlightRules, JavaScriptHighlightRules, TextHighlightRules) {
|
||||||
|
|
||||||
ace.mode.HtmlHighlightRules = function() {
|
var HtmlHighlightRules = function() {
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// regexp must not have capturing parentheses
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
@ -113,7 +119,7 @@ ace.mode.HtmlHighlightRules = function() {
|
||||||
} ]
|
} ]
|
||||||
};
|
};
|
||||||
|
|
||||||
var jsRules = new ace.mode.JavaScriptHighlightRules().getRules();
|
var jsRules = new JavaScriptHighlightRules().getRules();
|
||||||
this.addRules(jsRules, "js-");
|
this.addRules(jsRules, "js-");
|
||||||
this.$rules["js-start"].unshift({
|
this.$rules["js-start"].unshift({
|
||||||
token: "text",
|
token: "text",
|
||||||
|
|
@ -121,7 +127,7 @@ ace.mode.HtmlHighlightRules = function() {
|
||||||
next: "tag"
|
next: "tag"
|
||||||
});
|
});
|
||||||
|
|
||||||
var cssRules = new ace.mode.CssHighlightRules().getRules();
|
var cssRules = new CssHighlightRules().getRules();
|
||||||
this.addRules(cssRules, "css-");
|
this.addRules(cssRules, "css-");
|
||||||
this.$rules["css-start"].unshift({
|
this.$rules["css-start"].unshift({
|
||||||
token: "text",
|
token: "text",
|
||||||
|
|
@ -129,4 +135,8 @@ ace.mode.HtmlHighlightRules = function() {
|
||||||
next: "tag"
|
next: "tag"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.HtmlHighlightRules, ace.mode.TextHighlightRules);
|
|
||||||
|
ace.inherits(HtmlHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
return HtmlHighlightRules;
|
||||||
|
});
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
ace.provide("ace.mode.JavaScript");
|
require.def("ace/mode/JavaScript",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/Text",
|
||||||
|
"ace/Tokenizer",
|
||||||
|
"ace/mode/JavaScriptHighlightRules",
|
||||||
|
"ace/mode/MatchingBraceOutdent"
|
||||||
|
], function(ace, TextMode, Tokenizer, JavaScriptHighlightRules, MatchingBraceOutdent) {
|
||||||
|
|
||||||
ace.mode.JavaScript = function() {
|
var JavaScript = function() {
|
||||||
this.$tokenizer = new ace.Tokenizer(new ace.mode.JavaScriptHighlightRules().getRules());
|
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
|
||||||
this.$outdent = new ace.mode.MatchingBraceOutdent();
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.JavaScript, ace.mode.Text);
|
ace.inherits(JavaScript, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -77,4 +84,7 @@ ace.inherits(ace.mode.JavaScript, ace.mode.Text);
|
||||||
return this.$outdent.autoOutdent(doc, row);
|
return this.$outdent.autoOutdent(doc, row);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.JavaScript.prototype);
|
}).call(JavaScript.prototype);
|
||||||
|
|
||||||
|
return JavaScript;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,14 @@
|
||||||
ace.provide("ace.mode.JavaScriptHighlightRules");
|
require.def("ace/mode/JavaScriptHighlightRules",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/DocCommentHighlightRules",
|
||||||
|
"ace/mode/TextHighlightRules"
|
||||||
|
], function(ace, DocCommentHighlightRules, TextHighlightRules) {
|
||||||
|
|
||||||
ace.mode.JavaScriptHighlightRules = function() {
|
|
||||||
|
|
||||||
var docComment = new ace.mode.DocCommentHighlightRules();
|
JavaScriptHighlightRules = function() {
|
||||||
|
|
||||||
|
var docComment = new DocCommentHighlightRules();
|
||||||
|
|
||||||
var keywords = {
|
var keywords = {
|
||||||
"break" : 1,
|
"break" : 1,
|
||||||
|
|
@ -32,6 +38,7 @@ ace.mode.JavaScriptHighlightRules = function() {
|
||||||
|
|
||||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
this.$rules = {
|
this.$rules = {
|
||||||
"start" : [ {
|
"start" : [ {
|
||||||
token : "comment",
|
token : "comment",
|
||||||
|
|
@ -111,4 +118,8 @@ ace.mode.JavaScriptHighlightRules = function() {
|
||||||
this.addRules(docComment.getRules(), "doc-");
|
this.addRules(docComment.getRules(), "doc-");
|
||||||
this.$rules["doc-start"][0].next = "start";
|
this.$rules["doc-start"][0].next = "start";
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.JavaScriptHighlightRules, ace.mode.TextHighlightRules);
|
|
||||||
|
ace.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
return JavaScriptHighlightRules;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.mode.MatchingBraceOutdent");
|
require.def("ace/mode/MatchingBraceOutdent", [], function() {
|
||||||
|
|
||||||
ace.mode.MatchingBraceOutdent = function() {};
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -37,4 +37,7 @@ ace.mode.MatchingBraceOutdent = function() {};
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.MatchingBraceOutdent.prototype);
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
return MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
ace.provide("ace.mode.Text");
|
require.def("ace/mode/Text",
|
||||||
|
[
|
||||||
|
"ace/Tokenizer",
|
||||||
|
"ace/mode/TextHighlightRules",
|
||||||
|
], function(Tokenizer, TextHighlightRules) {
|
||||||
|
|
||||||
ace.mode.Text = function() {
|
var Text = function() {
|
||||||
this.$tokenizer = new ace.Tokenizer(new ace.mode.TextHighlightRules().getRules());
|
this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -34,4 +38,7 @@ ace.mode.Text = function() {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.Text.prototype);
|
}).call(Text.prototype);
|
||||||
|
|
||||||
|
return Text;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ace.provide("ace.mode.TextHighlightRules");
|
require.def("ace/mode/TextHighlightRules", [], function() {
|
||||||
|
|
||||||
ace.mode.TextHighlightRules = function() {
|
var TextHighlightRules = function() {
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// regexp must not have capturing parentheses
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
@ -34,4 +34,7 @@ ace.mode.TextHighlightRules = function() {
|
||||||
return this.$rules;
|
return this.$rules;
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.TextHighlightRules.prototype);
|
}).call(TextHighlightRules.prototype);
|
||||||
|
|
||||||
|
return TextHighlightRules;
|
||||||
|
});
|
||||||
|
|
@ -1,9 +1,16 @@
|
||||||
ace.provide("ace.mode.Xml");
|
require.def("ace/mode/Xml",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/Text",
|
||||||
|
"ace/Tokenizer",
|
||||||
|
"ace/mode/XmlHighlightRules"
|
||||||
|
], function(ace, TextMode, Tokenizer, XmlHighlightRules) {
|
||||||
|
|
||||||
ace.mode.Xml = function() {
|
var Xml = function() {
|
||||||
this.$tokenizer = new ace.Tokenizer(new ace.mode.XmlHighlightRules().getRules());
|
this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.Xml, ace.mode.Text);
|
|
||||||
|
ace.inherits(Xml, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
|
@ -11,4 +18,7 @@ ace.inherits(ace.mode.Xml, ace.mode.Text);
|
||||||
return this.$getIndent(line);
|
return this.$getIndent(line);
|
||||||
};
|
};
|
||||||
|
|
||||||
}).call(ace.mode.Xml.prototype);
|
}).call(Xml.prototype);
|
||||||
|
|
||||||
|
return Xml;
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
ace.provide("ace.mode.XmlHighlightRules");
|
require.def("ace/mode/XmlHighlightRules",
|
||||||
|
[
|
||||||
|
"ace/ace",
|
||||||
|
"ace/mode/TextHighlightRules"
|
||||||
|
], function(ace, TextHighlightRules) {
|
||||||
|
|
||||||
ace.mode.XmlHighlightRules = function() {
|
var XmlHighlightRules = function() {
|
||||||
|
|
||||||
// regexp must not have capturing parentheses
|
// regexp must not have capturing parentheses
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
@ -69,4 +73,8 @@ ace.mode.XmlHighlightRules = function() {
|
||||||
} ]
|
} ]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.XmlHighlightRules, ace.mode.TextHighlightRules);
|
|
||||||
|
ace.inherits(XmlHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
return XmlHighlightRules;
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue