Merge branch 'master' of github.com:ajaxorg/editor

This commit is contained in:
mikedeboer 2010-09-17 12:37:53 +02:00
commit d9f0e0e2c4
42 changed files with 1944 additions and 892 deletions

View 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;
});

View file

@ -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;
@ -102,6 +109,7 @@ ace.Document = function(text, mode) {
this.setTabSize = function(tabSize) {
if (this.$tabSize === tabSize) return;
this.modified = true;
this.$tabSize = tabSize;
this.$dispatchEvent("changeTabSize");
};
@ -181,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;
};
@ -199,17 +207,37 @@ ace.Document = function(text, mode) {
};
this.getWidth = function() {
this.$computeWidth();
return this.width;
};
this.getScreenWidth = function() {
this.$computeWidth();
return this.screenWith;
};
this.$computeWidth = function() {
if (this.modified) {
this.modified = false;
var lines = this.lines;
var longestLine = 0;
var longestScreenLine = 0;
var tabSize = this.getTabSize();
for ( var i = 0; i < lines.length; i++) {
longestLine = Math.max(longestLine, lines[i].length);
var len = lines[i].length;
longestLine = Math.max(longestLine, len);
lines[i].replace("\t", function(m) {
len += tabSize-1;
return m;
});
longestScreenLine = Math.max(longestScreenLine, len);
}
this.width = longestLine;
this.screenWith = longestScreenLine;
}
return this.width;
};
this.getLine = function(row) {
@ -349,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();
@ -409,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();
@ -509,11 +537,11 @@ ace.Document = function(text, mode) {
};
this.indentRows = function(range, indentString) {
for (var row=range.start.row; row<= range.end.row; row++) {
this.$insert({row: row, column:0}, indentString);
}
this.fireChangeEvent(range.start.row, range.end.row);
return indentString.length;
for (var row=range.start.row; row<= range.end.row; row++) {
this.$insert({row: row, column:0}, indentString);
}
this.fireChangeEvent(range.start.row, range.end.row);
return indentString.length;
};
this.outdentRows = function(range, indentString) {
@ -525,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++)
{
@ -622,4 +650,7 @@ ace.Document = function(text, mode) {
return docColumn;
};
}).call(ace.Document.prototype);
}).call(Document.prototype);
return Document;
});

View file

@ -1,12 +1,22 @@
ace.provide("ace.Editor");
require.def("ace/Editor",
[
"ace/ace",
"ace/TextInput",
"ace/KeyBinding",
"ace/Document",
"ace/Search",
"ace/BackgroundTokenizer",
"ace/Range",
"ace/MEventEmitter"
], function(ace, TextInput, KeyBinding, Document, Search, BackgroundTokenizer, Range, MEventEmitter) {
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,16 +36,16 @@ 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(){
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.$forwardEvents = {
gutterclick: 1,
@ -142,7 +152,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 +208,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 +240,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 +359,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 +379,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 {
@ -505,6 +515,10 @@ ace.Editor = function(renderer, doc) {
var indentString = indentString || this.doc.getTabString();
var addedColumns = this.doc.outdentRows(this.getSelectionRange(), indentString);
// besides the indent string also outdent tabs
if (addedColumns == 0 && indentString != "\t")
var addedColumns = this.doc.outdentRows(this.getSelectionRange(), "\t");
this.selection.shiftSelection(addedColumns);
this.$updateDesiredColumn();
};
@ -515,7 +529,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);
@ -867,4 +881,8 @@ ace.Editor = function(renderer, doc) {
this.doc.getUndoManager().redo();
};
}).call(ace.Editor.prototype);
}).call(Editor.prototype);
return Editor;
});

View file

@ -1,7 +1,8 @@
ace.provide("ace.KeyBinding");
ace.KeyBinding = function(element, editor, config) {
require.def("ace/KeyBinding",
["ace/ace", "ace/conf/keybindings/default_mac", "ace/conf/keybindings/default_win"],
function(ace, default_mac, default_win) {
var KeyBinding = function(element, editor, config) {
this.editor = editor;
this.setConfig(config);
var keys = this.keys;
@ -54,8 +55,8 @@ ace.KeyBinding = function(element, editor, config) {
this.setConfig = function(config) {
this.config = config || ace.isMac
? ace.KeyBinding.default_mac
: ace.KeyBinding.default_win;
? default_mac
: default_win;
if (typeof this.config.reverse == "undefined")
this.config.reverse = ace.objectReverse(this.config, "|");
};
@ -211,4 +212,7 @@ ace.KeyBinding = function(element, editor, config) {
}
};
}).call(ace.KeyBinding.prototype);
}).call(KeyBinding.prototype);
return KeyBinding;
});

View file

@ -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;
});

View file

@ -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,12 +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);
};
}).call(ace.Range.prototype);
this.toScreenRange = function(doc) {
return new Range(
this.start.row, doc.documentToScreenColumn(this.start.row, this.start.column),
this.end.row, doc.documentToScreenColumn(this.end.row, this.end.column)
);
};
}).call(Range.prototype);
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;
})

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -1,6 +1,15 @@
ace.provide("ace.VirtualRenderer");
require.def("ace/VirtualRenderer",
[
"ace/ace",
"ace/layer/Gutter",
"ace/layer/Marker",
"ace/layer/Text",
"ace/layer/Cursor",
"ace/ScrollBar",
"ace/MEventEmitter"
], function(ace, GutterLayer, MarkerLayer, TextLayer, CursorLayer, ScrollBar, MEventEmitter) {
ace.VirtualRenderer = function(container) {
var VirtualRenderer = function(container) {
this.container = container;
ace.addCssClass(this.container, "ace_editor");
@ -16,20 +25,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;
@ -54,11 +63,12 @@ ace.VirtualRenderer = function(container) {
(function() {
ace.implement(this, ace.MEventEmitter);
ace.implement(this, MEventEmitter);
this.setDocument = function(doc) {
this.lines = doc.lines;
this.doc = doc;
this.$cursorLayer.setDocument(doc);
this.$markerLayer.setDocument(doc);
this.$textLayer.setDocument(doc);
};
@ -190,7 +200,7 @@ ace.VirtualRenderer = function(container) {
var offset = this.scrollTop % this.lineHeight;
var minHeight = this.scroller.clientHeight + offset;
var charCount = this.doc.getWidth();
var charCount = this.doc.getScreenWidth();
if (this.$showInvisibles)
charCount += 1;
@ -229,8 +239,6 @@ ace.VirtualRenderer = function(container) {
this.addMarker = function(range, clazz, type) {
range.start = this.$documentToScreenPosition(range.start);
range.end = this.$documentToScreenPosition(range.end);
return this.$markerLayer.addMarker(range, clazz, type);
};
@ -243,17 +251,10 @@ ace.VirtualRenderer = function(container) {
};
this.updateCursor = function(position, overwrite) {
this.$cursorLayer.setCursor(this.$documentToScreenPosition(position), overwrite);
this.$cursorLayer.setCursor(position, overwrite);
this.$cursorLayer.update(this.layerConfig);
};
this.$documentToScreenPosition = function(pos) {
return {
row: pos.row,
column: this.doc.documentToScreenColumn(pos.row, pos.column)
};
};
this.hideCursor = function() {
this.$cursorLayer.hideCursor();
};
@ -343,4 +344,7 @@ ace.VirtualRenderer = function(container) {
this.hideComposition = function() {
};
}).call(ace.VirtualRenderer.prototype);
}).call(VirtualRenderer.prototype);
return VirtualRenderer;
});

18
src/ace/ace.js Normal file
View 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;
});

View file

@ -1,6 +1,6 @@
ace.provide("ace.KeyBinding.default_mac");
require.def("ace/conf/keybindings/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"
};
});

View file

@ -1,6 +1,6 @@
ace.provide("ace.KeyBinding.default_win");
require.def("ace/conf/keybindings/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"
};
});

View file

@ -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);
@ -13,10 +13,14 @@ ace.layer.Cursor = function(parentEl) {
(function() {
this.setDocument = function(doc) {
this.doc = doc;
};
this.setCursor = function(position, overwrite) {
this.position = {
row : position.row,
column : position.column
column : this.doc.documentToScreenColumn(position.row, position.column)
};
if (overwrite) {
ace.addCssClass(this.cursor, "ace_overwrite");
@ -88,4 +92,7 @@ ace.layer.Cursor = function(parentEl) {
this.restartTimer();
};
}).call(ace.layer.Cursor.prototype);
}).call(Cursor.prototype);
return Cursor;
});

View file

@ -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;
});

View file

@ -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);
@ -84,6 +84,7 @@ ace.layer.Marker = function(parentEl) {
};
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig) {
var range = range.toScreenRange(this.doc);
// from selection start to the end of the line
var height = layerConfig.lineHeight;
@ -125,6 +126,7 @@ ace.layer.Marker = function(parentEl) {
};
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig) {
var range = range.toScreenRange(this.doc);
var height = layerConfig.lineHeight;
var width = Math.round((range.end.column - range.start.column) * layerConfig.characterWidth);
@ -140,4 +142,7 @@ ace.layer.Marker = function(parentEl) {
);
};
}).call(ace.layer.Marker.prototype);
}).call(Marker.prototype);
return Marker;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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];
@ -32,7 +34,16 @@
return copy;
};
this.objectReverse = function(obj, keySplit) {
lang.arrayToMap = function(arr) {
var map = {};
for (var i=0; i<arr.length; i++) {
map[arr[i]] = 1;
}
return map;
};
lang.objectReverse = function(obj, keySplit) {
var i, j, l, key,
ret = {};
for (i in obj) {
@ -53,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() {
@ -75,7 +86,7 @@
},
call: function() {
this.cancel();
lang.cancel();
fcn();
},
@ -86,4 +97,5 @@
};
};
}).call(ace);
return lang;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -1,58 +1,65 @@
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 = {
"width": 1,
"height": 1,
"top": 1,
"left": 1,
"right": 1,
"bottom": 1,
"overflow": 1,
"overflow-x": 1,
"overflow-y": 1,
"background": 1,
"font": 1,
"font-style": 1,
"font-family": 1,
"font-size": 1,
"text-align": 1,
"white-space": 1,
"color": 1,
"z-index": 1,
"position": 1,
"cursor": 1,
"box-sizing": 1,
"-webkit-box-sizing": 1,
"-moz-box-sizing": 1,
"margin": 1,
"padding": 1,
"padding-top": 1,
"padding-right": 1,
"padding-bottom": 1,
"padding-left": 1,
"border": 1,
"border-top": 1,
"border-right": 1,
"border-left": 1,
"border-bottom": 1
};
var properties = ace.arrayToMap(
("azimuth|background-attachment|background-color|background-image|" +
"background-position|background-repeat|background|border-bottom-color|" +
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
"border-color|border-left-color|border-left-style|border-left-width|" +
"border-left|border-right-color|border-right-style|border-right-width|" +
"border-right|border-spacing|border-style|border-top-color|" +
"border-top-style|border-top-width|border-top|border-width|border|" +
"bottom|caption-side|clear|clip|color|content|counter-increment|" +
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
"letter-spacing|line-height|list-style-image|list-style-position|" +
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
"min-width|-moz-border-radius|opacity|orphans|outline-color|" +
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
"padding-left|padding-right|padding-top|padding|page-break-after|" +
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
"pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
"stress|table-layout|text-align|text-decoration|text-indent|" +
"text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
"z-index").split("|")
);
var functions = {
"rgb": 1,
"rgba": 1
};
var functions = ace.arrayToMap(
("rgb|rgba|url|attr|counter|counters").split("|")
);
var constants = {
"absolute": 1,
"relative": 1,
"fixed": 1,
"solid": 1,
"hidden": 1,
"scroll": 1,
"no-wrap": 1
};
var constants = ace.arrayToMap(
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
"block|bold|bolder|both|bottom|break-all|break-word|capitalize|center|" +
"char|circle|cjk-ideographic|col-resize|collapse|crosshair|dashed|" +
"decimal-leading-zero|decimal|default|disabled|disc|" +
"distribute-all-lines|distribute-letter|distribute-space|" +
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
"zero").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -175,4 +182,7 @@ ace.mode.CssHighlightRules = function() {
};
};
ace.inherits(ace.mode.CssHighlightRules, ace.mode.TextHighlightRules);
ace.inherits(CssHighlightRules, TextHighlightRules);
return CssHighlightRules;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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: "comment",
@ -125,7 +131,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",
@ -133,4 +139,8 @@ ace.mode.HtmlHighlightRules = function() {
next: "tag"
});
};
ace.inherits(ace.mode.HtmlHighlightRules, ace.mode.TextHighlightRules);
ace.inherits(HtmlHighlightRules, TextHighlightRules);
return HtmlHighlightRules;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});

View file

@ -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;
});