This commit is contained in:
Fabian Jakobs 2010-04-26 11:34:34 +02:00
Родитель 3ef74385a7
Коммит fe837c321a
40 изменённых файлов: 1817 добавлений и 286 удалений

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;
}
</style>
<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">
<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>
<script src="require.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
@ -149,18 +116,34 @@
<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 = {}
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.css.setMode(new ace.mode.Css());
docs.css.setUndoManager(new ace.UndoManager());
docs.js = new Document(document.getElementById("jstext").innerHTML);
docs.js.setMode(new JavaScriptMode());
docs.js.setUndoManager(new UndoManager());
docs.html = new ace.Document(document.getElementById("htmltext").innerHTML);
docs.html.setMode(new ace.mode.Html());
docs.html.setUndoManager(new ace.UndoManager());
docs.css = new Document(document.getElementById("csstext").innerHTML);
docs.css.setMode(new CssMode());
docs.css.setUndoManager(new UndoManager());
docs.html = new Document(document.getElementById("htmltext").innerHTML);
docs.html.setMode(new HtmlMode());
docs.html.setUndoManager(new UndoManager());
var docEl = document.getElementById("doc");
@ -169,16 +152,16 @@ function onDocChange() {
editor.setDocument(doc);
var mode = doc.getMode();
if (mode instanceof ace.mode.JavaScript) {
if (mode instanceof JavaScriptMode) {
modeEl.value = "javascript"
}
else if (mode instanceof ace.mode.Css) {
else if (mode instanceof CssMode) {
modeEl.value = "css"
}
else if (mode instanceof ace.mode.Html) {
else if (mode instanceof HtmlMode) {
modeEl.value = "html"
}
else if (mode instanceof ace.mode.Xml) {
else if (mode instanceof XmlMode) {
modeEl.value = "xml"
}
else {
@ -199,11 +182,11 @@ modeEl.onchange = function() {
};
var modes = {
text: new ace.mode.Text(),
xml: new ace.mode.Xml(),
html: new ace.mode.Html(),
css: new ace.mode.Css(),
javascript: new ace.mode.JavaScript()
text: new TextMode(),
xml: new XmlMode(),
html: new HtmlMode(),
css: new CssMode(),
javascript: new JavaScriptMode()
};
function getMode() {
@ -225,7 +208,7 @@ activeEl.onchange = function() {
};
var container = document.getElementById("editor");
var editor = new ace.Editor(new ace.VirtualRenderer(container));
var editor = new Editor(new Renderer(container));
onDocChange();
function onResize() {
@ -274,7 +257,9 @@ ace.addListener(container, "drop", function(e) {
return ace.preventDefault(e);
});
});
</script>
</body>

1246
demo/require.js Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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.textLines = [];
this.lines = [];
@ -37,7 +37,7 @@ ace.BackgroundTokenizer = function(tokenizer) {
(function(){
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
@ -102,4 +102,7 @@ ace.BackgroundTokenizer = function(tokenizer) {
return this.lines[row];
};
}).call(ace.BackgroundTokenizer.prototype);
}).call(BackgroundTokenizer.prototype);
return BackgroundTokenizer;
});

Просмотреть файл

@ -1,10 +1,17 @@
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.lines = [];
this.selection = new ace.Selection(this);
this.$breakpoints = [];
this.selection = new Selection(this);
this.$breakpoints = [];
this.listeners = [];
if (mode) {
@ -20,7 +27,7 @@ ace.Document = function(text, mode) {
(function() {
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.$undoManager = null;
@ -182,7 +189,7 @@ ace.Document = function(text, mode) {
this.getMode = function() {
if (!this.$mode) {
this.$mode = new ace.mode.Text();
this.$mode = new TextMode();
}
return this.$mode;
};
@ -370,7 +377,7 @@ ace.Document = function(text, mode) {
var nl = this.$getNewLineCharacter();
this.$deltas.push({
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
});
this.$informUndoManager.schedule();
@ -430,7 +437,7 @@ ace.Document = function(text, mode) {
var nl = this.$getNewLineCharacter();
this.$deltas.push({
action: "insertText",
range: ace.Range.fromPoints(position, end),
range: Range.fromPoints(position, end),
text: text
});
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++)
{
@ -643,4 +650,7 @@ ace.Document = function(text, mode) {
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();
this.container = container;
this.renderer = renderer;
this.textInput = new ace.TextInput(container, this);
new ace.KeyBinding(container, this);
this.textInput = new TextInput(container, this);
new KeyBinding(container, this);
var self = this;
ace.addListener(container, "mousedown", function(e) {
setTimeout(function() {self.focus();});
@ -26,11 +35,11 @@ ace.Editor = function(renderer, doc) {
this.$highlightLineMarker = null;
this.$blockScrolling = false;
this.$search = new ace.Search().set({
this.$search = new Search().set({
wrap: true
});
this.setDocument(doc || new ace.Document(""));
this.setDocument(doc || new Document(""));
};
(function(){
@ -142,7 +151,7 @@ ace.Editor = function(renderer, doc) {
var pos = self.doc.findMatchingBracket(self.getCursorPosition());
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");
}
}, 10);
@ -198,7 +207,7 @@ ace.Editor = function(renderer, doc) {
if (this.getHighlightActiveLine() && !this.selection.isMultiLine()) {
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");
}
};
@ -230,7 +239,7 @@ ace.Editor = function(renderer, doc) {
if (!this.bgTokenizer) {
var onUpdate = ace.bind(this.onTokenizerUpdate, this);
this.bgTokenizer = new ace.BackgroundTokenizer(tokenizer);
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
this.bgTokenizer.addEventListener("update", onUpdate);
} else {
this.bgTokenizer.setTokenizer(tokenizer);
@ -349,7 +358,7 @@ ace.Editor = function(renderer, doc) {
var cursor = this.doc.remove(this.getSelectionRange());
this.clearSelection();
} else if (this.$overwrite){
var range = new ace.Range.fromPoints(cursor, cursor);
var range = new Range.fromPoints(cursor, cursor);
range.end.column += text.length;
this.doc.remove(range);
}
@ -369,7 +378,7 @@ ace.Editor = function(renderer, doc) {
if (row !== end.row) {
var indent = this.mode.getNextLineIndent(lineState, line, this.doc.getTabString());
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);
}
} else {
@ -519,7 +528,7 @@ ace.Editor = function(renderer, doc) {
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 addedColumns = this.mode.toggleCommentLines(state, this.doc, range);
@ -871,4 +880,8 @@ ace.Editor = function(renderer, doc) {
this.doc.getUndoManager().redo();
};
}).call(ace.Editor.prototype);
}).call(Editor.prototype);
return Editor;
});

Просмотреть файл

@ -1,7 +1,6 @@
ace.provide("ace.KeyBinding");
ace.KeyBinding = function(element, editor, config) {
require.def("ace/KeyBinding", ["ace/ace"], function(ace) {
var KeyBinding = function(element, editor, config) {
this.editor = editor;
this.setConfig(config);
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 || {};
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 || {};
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 || {};
var listeners = this.$eventRegistry[eventName];
@ -40,4 +40,6 @@ ace.MEventEmitter = function() {
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 = {
row: startRow,
column: startColumn
@ -73,7 +73,7 @@ ace.Range = function(startRow, startColumn, endRow, endColumn) {
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) {
@ -86,7 +86,7 @@ ace.Range = function(startRow, startColumn, endRow, endColumn) {
else
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() {
@ -98,19 +98,22 @@ ace.Range = function(startRow, startColumn, endRow, endColumn) {
};
this.clone = function() {
return ace.Range.fromPoints(this.start, this.end);
return Range.fromPoints(this.start, this.end);
};
this.toScreenRange = function(doc) {
return new ace.Range(
return new Range(
this.start.row, doc.documentToScreenColumn(this.start.row, this.start.column),
this.end.row, doc.documentToScreenColumn(this.end.row, this.end.column)
);
};
}).call(ace.Range.prototype);
}).call(Range.prototype);
ace.Range.fromPoints = function(start, end) {
return new ace.Range(start.row, start.column, end.row, end.column);
};
Range.fromPoints = function(start, end) {
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.className = "ace_sb";
@ -16,8 +16,7 @@ ace.ScrollBar = function(parent) {
};
(function() {
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.onScroll = function() {
this.$dispatchEvent("scroll", {data: this.element.scrollTop});
@ -39,4 +38,7 @@ ace.ScrollBar = function(parent) {
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 = {
needle: "",
backwards: false,
wrap: false,
caseSensitive: false,
wholeWord: false,
scope: ace.Search.ALL,
scope: Search.ALL,
regExp: false
};
};
ace.Search.ALL = 1;
ace.Search.SELECTION = 2;
Search.ALL = 1;
Search.SELECTION = 2;
(function() {
@ -166,7 +166,7 @@ ace.Search.SELECTION = 2;
};
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 start = doc.getSelection().getCursor();
@ -222,7 +222,7 @@ ace.Search.SELECTION = 2;
};
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 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.clearSelection();
@ -12,7 +16,7 @@ ace.Selection = function(doc) {
(function() {
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.isEmpty = function() {
return (!this.selectionAnchor ||
@ -90,10 +94,10 @@ ace.Selection = function(doc) {
var lead = this.selectionLead;
if (this.$isBackwards()) {
return ace.Range.fromPoints(lead, anchor);
return Range.fromPoints(lead, anchor);
}
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 style = text.style;
@ -80,4 +80,7 @@ ace.TextInput = function(parentNode, host) {
this.blur = function() {
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.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.$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;
ace.addCssClass(this.container, "ace_editor");
@ -16,20 +24,20 @@ ace.VirtualRenderer = function(container) {
this.content.style.position = "absolute";
this.scroller.appendChild(this.content);
this.$gutterLayer = new ace.layer.Gutter(this.$gutter);
this.$markerLayer = new ace.layer.Marker(this.content);
this.$gutterLayer = new GutterLayer(this.$gutter);
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.characterWidth = textLayer.getCharacterWidth();
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.scrollBar = new ace.ScrollBar(container);
this.scrollBar = new ScrollBar(container);
this.scrollBar.addEventListener("scroll", ace.bind(this.onScroll, this));
this.scrollTop = 0;
@ -335,4 +343,7 @@ ace.VirtualRenderer = function(container) {
this.hideComposition = function() {
};
}).call(ace.VirtualRenderer.prototype);
}).call(VirtualRenderer.prototype);
return VirtualRenderer;
});

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",
"removeline": "Meta-D",
"gotoline": "Meta-L",
@ -47,3 +47,5 @@ ace.KeyBinding.default_mac = {
"outdent": "Shift-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",
"removeline": "Control-D",
"gotoline": "Control-L",
@ -47,3 +47,5 @@ ace.KeyBinding.default_win = {
"outdent": "Shift-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.className = "ace_layer ace_cursor-layer";
parentEl.appendChild(this.element);
@ -92,4 +92,7 @@ ace.layer.Cursor = function(parentEl) {
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.className = "ace_layer ace_gutter-layer";
parentEl.appendChild(this.element);
@ -32,4 +32,7 @@ ace.layer.Gutter = function(parentEl) {
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.className = "ace_layer ace_marker-layer";
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.className = "ace_layer ace_text-layer";
parentEl.appendChild(this.element);
@ -11,7 +11,7 @@ ace.layer.Text = function(parentEl) {
(function() {
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.EOF_CHAR = "&para;";
this.EOL_CHAR = "&not;";
@ -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)
ace = {};
(function() {
require.def("ace/lib/core", function() {
var core = {};
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
this.isWin = (os == "win");
this.isMac = (os == "mac");
this.isLinux = (os == "linux");
core.isWin = (os == "win");
core.isMac = (os == "mac");
core.isLinux = (os == "linux");
core.isIE = ! + "\v1";
this.provide = function(namespace) {
core.provide = function(namespace) {
var parts = namespace.split(".");
var obj = window;
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) {
elem.innerText = text;
}
@ -11,22 +11,21 @@
}
};
this.hasCssClass = function(el, name) {
dom.hasCssClass = function(el, name) {
var classes = el.className.split(/\s+/g);
return ace.arrayIndexOf(classes, name) !== -1;
return lang.arrayIndexOf(classes, name) !== -1;
};
this.addCssClass = function(el, name) {
if (!this.hasCssClass(el, name)) {
dom.addCssClass = function(el, name) {
if (!dom.hasCssClass(el, name)) {
el.className += " " + name;
}
};
this.removeCssClass = function(el, name) {
dom.removeCssClass = function(el, name) {
var classes = el.className.split(/\s+/g);
while (true) {
var index = ace.arrayIndexOf(classes, name);
var index = lang.arrayIndexOf(classes, name);
if (index == -1) {
break;
}
@ -35,17 +34,17 @@
el.className = classes.join(" ");
};
this.getInnerWidth = function(element) {
return (parseInt(self.computedStyle(element, "paddingLeft"))
+ parseInt(self.computedStyle(element, "paddingRight")) + element.clientWidth);
dom.getInnerWidth = function(element) {
return (parseInt(dom.computedStyle(element, "paddingLeft"))
+ parseInt(dom.computedStyle(element, "paddingRight")) + element.clientWidth);
};
this.getInnerHeight = function(element) {
return (parseInt(this.computedStyle(element, "paddingTop"))
+ parseInt(this.computedStyle(element, "paddingBottom")) + element.clientHeight);
dom.getInnerHeight = function(element) {
return (parseInt(dom.computedStyle(element, "paddingTop"))
+ parseInt(dom.computedStyle(element, "paddingBottom")) + element.clientHeight);
};
this.computedStyle = function(element, style) {
dom.computedStyle = function(element, style) {
if (window.getComputedStyle) {
return (window.getComputedStyle(element, "") || {})[style] || "";
}
@ -54,7 +53,7 @@
}
};
this.scrollbarWidth = function() {
dom.scrollbarWidth = function() {
var inner = document.createElement('p');
inner.style.width = "100%";
@ -85,4 +84,5 @@
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";
this.addListener = function(elem, type, callback) {
event.addListener = function(elem, type, callback) {
if (elem.addEventListener) {
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) {
return elem.removeEventListener(type, callback, false);
}
@ -26,27 +24,27 @@
}
};
this.stopEvent = function(e) {
self.stopPropagation(e);
self.preventDefault(e);
event.stopEvent = function(e) {
event.stopPropagation(e);
event.preventDefault(e);
return false;
};
this.stopPropagation = function(e) {
event.stopPropagation = function(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
};
this.preventDefault = function(e) {
event.preventDefault = function(e) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
};
this.getDocumentX = function(event) {
event.getDocumentX = function(event) {
if (event.clientX) {
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
return event.clientX + scrollLeft;
@ -55,7 +53,7 @@
}
};
this.getDocumentY = function(event) {
event.getDocumentY = function(event) {
if (event.clientY) {
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
return event.clientY + scrollTop;
@ -65,31 +63,31 @@
};
if (document.documentElement.setCapture) {
this.capture = function(el, eventHandler, releaseCaptureHandler) {
event.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseMove(e) {
eventHandler(e);
return self.stopPropagation(e);
return event.stopPropagation(e);
}
function onReleaseCapture(e) {
eventHandler && eventHandler(e);
releaseCaptureHandler && releaseCaptureHandler();
self.removeListener(el, "mousemove", eventHandler);
self.removeListener(el, "mouseup", onReleaseCapture);
self.removeListener(el, "losecapture", onReleaseCapture);
event.removeListener(el, "mousemove", eventHandler);
event.removeListener(el, "mouseup", onReleaseCapture);
event.removeListener(el, "losecapture", onReleaseCapture);
el.releaseCapture();
}
self.addListener(el, "mousemove", eventHandler);
self.addListener(el, "mouseup", onReleaseCapture);
self.addListener(el, "losecapture", onReleaseCapture);
event.addListener(el, "mousemove", eventHandler);
event.addListener(el, "mouseup", onReleaseCapture);
event.addListener(el, "losecapture", onReleaseCapture);
el.setCapture();
};
}
else {
this.capture = function(el, eventHandler, releaseCaptureHandler) {
event.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseMove(e) {
eventHandler(e);
e.stopPropagation();
@ -110,17 +108,17 @@
};
}
this.addMouseWheelListener = function(el, callback) {
event.addMouseWheelListener = function(el, callback) {
var listener = function(e) {
e.wheel = (e.wheelDelta) ? e.wheelDelta / 120
: -(e.detail || 0) / 3;
callback(e);
};
self.addListener(el, "DOMMouseScroll", listener);
self.addListener(el, "mousewheel", listener);
event.addListener(el, "DOMMouseScroll", listener);
event.addListener(el, "mousewheel", listener);
};
this.addMultiMouseDownListener = function(el, count, callback) {
event.addMultiMouseDownListener = function(el, count, callback) {
var clicks = 0;
var listener = function(e) {
clicks += 1;
@ -134,23 +132,23 @@
clicks = 0;
callback(e);
}
return self.preventDefault(e);
return event.preventDefault(e);
};
self.addListener(el, "mousedown", listener);
this.isIE && self.addListener(el, "dblclick", listener);
event.addListener(el, "mousedown", listener);
core.isIE && event.addListener(el, "dblclick", listener);
};
this.addKeyListener = function(el, callback) {
event.addKeyListener = function(el, callback) {
var lastDown = null;
self.addListener(el, "keydown", function(e) {
event.addListener(el, "keydown", function(e) {
lastDown = e.keyIdentifier || e.keyCode;
return callback(e);
});
if (ace.isMac) {
self.addListener(el, "keypress", function(e) {
if (core.isMac) {
event.addListener(el, "keypress", function(e) {
var keyId = e.keyIdentifier || e.keyCode;
if (lastDown !== keyId) {
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("");
};
if (Array.prototype.indexOf) {
this.arrayIndexOf = function(array, searchElement) {
lang.arrayIndexOf = function(array, searchElement) {
return array.indexOf(searchElement);
};
}
else {
this.arrayIndexOf = function(array, searchElement) {
lang.arrayIndexOf = function(array, searchElement) {
for (var i=0; i<array.length; i++) {
if (array[i] == searchElement) {
return i;
@ -20,11 +22,11 @@
};
}
this.isArray = function(value) {
lang.isArray = function(value) {
return Object.prototype.toString.call(value) == "[object Array]";
};
this.copyObject = function(obj) {
lang.copyObject = function(obj) {
var copy = {};
for (var key in obj) {
copy[key] = obj[key];
@ -62,13 +64,13 @@
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};
this.bind = function(fcn, context) {
lang.bind = function(fcn, context) {
return function() {
return fcn.apply(context, arguments);
};
};
this.deferredCall = function(fcn) {
lang.deferredCall = function(fcn) {
var timer = null;
var callback = function() {
@ -84,7 +86,7 @@
},
call: function() {
this.cancel();
lang.cancel();
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() {};
tempCtor.prototype = superCtor.prototype;
ctor.super_ = superCtor.prototype;
@ -8,14 +10,15 @@
ctor.prototype.constructor = ctor;
};
this.mixin = function(obj, mixin) {
oop.mixin = function(obj, mixin) {
for (var key in mixin) {
obj[key] = mixin[key];
}
};
this.implement = function(proto, mixin) {
mixin.call(proto);
oop.implement = function(proto, mixin) {
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() {
this.$tokenizer = new ace.Tokenizer(new ace.mode.CssHighlightRules().getRules());
this.$outdent = new ace.mode.MatchingBraceOutdent();
var Css = function() {
this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
};
ace.inherits(ace.mode.Css, ace.mode.Text);
ace.inherits(Css, TextMode);
(function() {
@ -33,4 +40,7 @@ ace.inherits(ace.mode.Css, ace.mode.Text);
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(
("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 = {
"start" : [ {
@ -23,7 +27,7 @@ ace.mode.DocCommentHighlightRules = function() {
};
};
ace.inherits(ace.mode.DocCommentHighlightRules, ace.mode.TextHighlightRules);
ace.inherits(DocCommentHighlightRules, TextHighlightRules);
(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() {
this.$tokenizer = new ace.Tokenizer(new ace.mode.HtmlHighlightRules().getRules());
var Html = function() {
this.$tokenizer = new Tokenizer(new HtmlHighlightRules().getRules());
this.$js = new ace.mode.JavaScript();
this.$css = new ace.mode.Css();
this.$js = new JavaScriptMode();
this.$css = new CssMode();
};
ace.inherits(ace.mode.Html, ace.mode.Text);
ace.inherits(Html, TextMode);
(function() {
@ -51,4 +59,7 @@ ace.inherits(ace.mode.Html, ace.mode.Text);
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
// 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.$rules["js-start"].unshift({
token: "text",
@ -121,7 +127,7 @@ ace.mode.HtmlHighlightRules = function() {
next: "tag"
});
var cssRules = new ace.mode.CssHighlightRules().getRules();
var cssRules = new CssHighlightRules().getRules();
this.addRules(cssRules, "css-");
this.$rules["css-start"].unshift({
token: "text",
@ -129,4 +135,8 @@ ace.mode.HtmlHighlightRules = function() {
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() {
this.$tokenizer = new ace.Tokenizer(new ace.mode.JavaScriptHighlightRules().getRules());
this.$outdent = new ace.mode.MatchingBraceOutdent();
var JavaScript = function() {
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
};
ace.inherits(ace.mode.JavaScript, ace.mode.Text);
ace.inherits(JavaScript, TextMode);
(function() {
@ -77,4 +84,7 @@ ace.inherits(ace.mode.JavaScript, ace.mode.Text);
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 = {
"break" : 1,
@ -32,6 +38,7 @@ ace.mode.JavaScriptHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [ {
token : "comment",
@ -111,4 +118,8 @@ ace.mode.JavaScriptHighlightRules = function() {
this.addRules(docComment.getRules(), "doc-");
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() {
@ -37,4 +37,7 @@ ace.mode.MatchingBraceOutdent = function() {};
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() {
this.$tokenizer = new ace.Tokenizer(new ace.mode.TextHighlightRules().getRules());
var Text = function() {
this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
};
(function() {
@ -34,4 +38,7 @@ ace.mode.Text = function() {
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
// regexps are ordered -> the first match is used
@ -34,4 +34,7 @@ ace.mode.TextHighlightRules = function() {
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() {
this.$tokenizer = new ace.Tokenizer(new ace.mode.XmlHighlightRules().getRules());
var Xml = function() {
this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
};
ace.inherits(ace.mode.Xml, ace.mode.Text);
ace.inherits(Xml, TextMode);
(function() {
@ -11,4 +18,7 @@ ace.inherits(ace.mode.Xml, ace.mode.Text);
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
// 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;
});