Merge branch 'master' of github.com:ajaxorg/editor
This commit is contained in:
commit
d9f0e0e2c4
42 changed files with 1944 additions and 892 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;
|
||||
}
|
||||
|
||||
|
||||
</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
1246
demo/require.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -8,16 +8,23 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<embed type="application/o3demo-8a66ecac-63fd-4afa-9d42-3034d18c88f4" width="0" height="0" />
|
||||
|
||||
<script src="o3.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
|
||||
var o3obj = document.getElementsByTagName("embed")[0];
|
||||
|
||||
//o3obj = o3.create("8a66ecac-63fd-4afa-9d42-3034d18c88f4", {
|
||||
o3obj = o3.create("8A66ECAC-63FD-4AFA-9D42-3034D18C88F4", {
|
||||
/*
|
||||
o3obj = o3.create("8A66ECAC-63FD-4AFA-9D42-3034D18C88F4", {
|
||||
oninstallprompt : function(){ alert("can't find o3 plugin");},
|
||||
product : 'O3Demo'
|
||||
});
|
||||
});*/
|
||||
|
||||
alert("O3: " + o3obj);
|
||||
alert("socket: " + o3obj.socketTCP());
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,532 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="d8.js"></script>
|
||||
<script type="text/javascript" src="o3.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<embed type="application/o3stem-aaaaaaaa-1111-bbbb-1111-cccccccccccc" width="0" height="0" />
|
||||
|
||||
<button onClick="testChrome()">start test</button>
|
||||
<br></br>
|
||||
<textarea name="log" id="log" cols="100" rows="25">
|
||||
</textarea>
|
||||
</body>
|
||||
<script>
|
||||
var o3obj = document.getElementsByTagName("embed")[0];;
|
||||
// creating an o3 instance, we need the UID and the name of the product
|
||||
// the o3.js file will take care of all the details
|
||||
//o3obj = o3.create("AAAAAAAA-1111-BBBB-1111-CCCCCCCCCCCC", {
|
||||
//o3obj = o3.create("aaaaaaaa-1111-bbbb-1111-cccccccccccc", {
|
||||
// oninstallprompt : function(){ alert("can't find o3 plugin");},
|
||||
// product : 'o3stem'
|
||||
//} );
|
||||
|
||||
function getValueFromHeader(name,data,from) {
|
||||
var ret;
|
||||
if (!from)
|
||||
from = 0;
|
||||
|
||||
var s = data.indexOf(name,from);
|
||||
if (s == -1)
|
||||
return ret;
|
||||
var e = data.indexOf("\r\n",s);
|
||||
if (e == -1)
|
||||
return ret;
|
||||
|
||||
ret = data.substring(s+name.length+1,e);
|
||||
return ret;
|
||||
};
|
||||
|
||||
var MSG = {
|
||||
handshake: "ChromeDevToolsHandshake\r\n"
|
||||
};
|
||||
|
||||
var STATE = {
|
||||
seq_id: 0,
|
||||
client: o3obj.socketTCP(),
|
||||
connectionEstabilished: false,
|
||||
received : '',
|
||||
tabID: ''
|
||||
};
|
||||
|
||||
var EVENTS = {
|
||||
DevToolsService : {
|
||||
event : {
|
||||
|
||||
},
|
||||
response : {
|
||||
"list_tabs": {}
|
||||
}
|
||||
},
|
||||
V8Debugger : {
|
||||
event : {
|
||||
"break": {
|
||||
"fromCode": nativeBreak
|
||||
},
|
||||
"exception": function(r){log("\n> exception event occured\n");},
|
||||
"afterCompile": function(r){log("\n> after compile event occured\n");},
|
||||
"navigated": function(r){log("\n> navigated event occured\n");},
|
||||
"closed": function(r){log("\n> tab closed event occured\n");}
|
||||
},
|
||||
response : {
|
||||
"attach": {}
|
||||
}
|
||||
},
|
||||
defaults : {
|
||||
v8event : unknownV8Event,
|
||||
v8response : unknownV8Response,
|
||||
devToolResponse : unknownDevToolResponse,
|
||||
connected : connected
|
||||
},
|
||||
pending : {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
function reportError(e) {
|
||||
alert(e);
|
||||
};
|
||||
|
||||
function v8eventDispatcher(responseObj) {
|
||||
var eventType = responseObj.data.event,
|
||||
eventID,
|
||||
brNo,
|
||||
cbGroup = EVENTS.V8Debugger.event[eventType];
|
||||
|
||||
if (cbGroup) {
|
||||
if (eventType == "break") {
|
||||
if (responseObj.data.body.breakpoints)
|
||||
brNo = responseObj.data.body.breakpoints[0];
|
||||
if (brNo)
|
||||
cbGroup[brNo](responseObj);
|
||||
else
|
||||
cbGroup["fromCode"](responseObj);
|
||||
}else
|
||||
cbGroup(responseObj);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
EVENTS.defaults.v8event(responseObj);
|
||||
}
|
||||
|
||||
function v8responseDispatcher(responseObj) {
|
||||
var command = (responseObj.data && responseObj.data.command) ?
|
||||
responseObj.data.command : responseObj.command,
|
||||
|
||||
reqSeq = responseObj.data ? responseObj.data.request_seq : -1,
|
||||
cbGroup = EVENTS.V8Debugger.response[command],
|
||||
eventToListen;
|
||||
|
||||
// TODO: check the result report error if something is wrong
|
||||
|
||||
// set up listener for an already specified event
|
||||
if (eventToListen = EVENTS.pending[reqSeq]) {
|
||||
var brNo = responseObj.data.body.breakpoint;
|
||||
EVENTS.V8Debugger.event[eventToListen.event][brNo] =
|
||||
eventToListen.ontrigger;
|
||||
EVENTS.pending.reqSeq = null;
|
||||
delete EVENTS.pending.reqSeq;
|
||||
}
|
||||
|
||||
// lookup reponse callback based on 'request_seq' property
|
||||
if (cbGroup) {
|
||||
// some v8 responses, added for chrome only...
|
||||
if (reqSeq==-1) {
|
||||
cbGroup(responseObj);
|
||||
return
|
||||
}
|
||||
|
||||
if (cbGroup[reqSeq]) {
|
||||
cbGroup[reqSeq](responseObj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EVENTS.defaults.v8response(responseObj);
|
||||
return;
|
||||
}
|
||||
function devtoolResponseDispatcher(responseObj) {
|
||||
var cbGroup = EVENTS.DevToolsService.response[responseObj.command];
|
||||
if (cbGroup) {
|
||||
cbGroup(responseObj);
|
||||
return;
|
||||
}
|
||||
|
||||
EVENTS.defaults.devToolResponse(responseObj);
|
||||
}
|
||||
function nativeBreak(responseObj) {
|
||||
log("\n>event: native javascript breakpoint\n");
|
||||
}
|
||||
|
||||
function unknownV8Event(e) {
|
||||
log("\n>event: unknownV8Event\n");
|
||||
};
|
||||
function unknownV8Response(e){
|
||||
log("\n>event: unknownV8Response\n");
|
||||
};
|
||||
function unknownDevToolResponse(e){
|
||||
log("\n>event: unknownDevToolResponse\n");
|
||||
};
|
||||
function connected(e){
|
||||
log("\n>event: connected\n");
|
||||
setTimeout("start()",0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
function objectifyResponse(responseText){
|
||||
var responseObj = null;
|
||||
try {
|
||||
//headers = responseText.match(/\[w_-]+\:[^\n\r]+[\n\r]/g);
|
||||
var content,d = responseText.indexOf('\r\n\r\n'),
|
||||
content = responseText.substring(d+4);
|
||||
responseObj = eval('(' + content + ')');
|
||||
}
|
||||
catch(e){
|
||||
debugger;
|
||||
}
|
||||
return responseObj;
|
||||
}
|
||||
|
||||
function checkForWholeMessage() {
|
||||
var i,c,l,responseLength,fullResponse = false;
|
||||
if ((i = STATE.received.indexOf('\r\n\r\n')) != -1) {
|
||||
if ((c = STATE.received.indexOf('Content-Length:')) != -1) {
|
||||
l = STATE.received.substring(c+15);
|
||||
l = l.substring(0, l.indexOf('\r\n'));
|
||||
responseLength = i+4+parseInt(l,10)
|
||||
if (responseLength<=STATE.received.length) {
|
||||
fullResponse = STATE.received.substring(0,responseLength);
|
||||
STATE.received = STATE.received.substring(responseLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fullResponse;
|
||||
}
|
||||
|
||||
function dispatchResponse(fullResponse) {
|
||||
var responseObj = objectifyResponse(fullResponse),
|
||||
tool = getValueFromHeader("Tool", fullResponse),
|
||||
dest = getValueFromHeader("Destination", fullResponse);
|
||||
|
||||
if (!responseObj) {
|
||||
alert("broken message!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tool == "V8Debugger"){
|
||||
if (responseObj.data && responseObj.data.type) {
|
||||
if (responseObj.data.type == "event") {
|
||||
v8eventDispatcher(responseObj);
|
||||
return;
|
||||
}
|
||||
else if (responseObj.data.type == "response") {
|
||||
v8responseDispatcher(responseObj);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
reportError("unknown V8 message type: "
|
||||
+ responseObj.data.type);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// v8debugger tool messages were extended with some
|
||||
// special messages only for chrome
|
||||
v8responseDispatcher(responseObj);
|
||||
}
|
||||
}
|
||||
else if (tool == "DevToolsService") {
|
||||
devtoolResponseDispatcher(responseObj);
|
||||
}
|
||||
else {
|
||||
reportError("tool not supported: " + tool);
|
||||
}
|
||||
}
|
||||
|
||||
// receives the next chunk on the socket, and handles the message if there were any
|
||||
function globalReceiveFunction() {
|
||||
var lastChunk = STATE.client.receivedText;
|
||||
STATE.client.clearBuf();
|
||||
STATE.received += lastChunk;
|
||||
log("\n>receiving: \n" + lastChunk + "\n");
|
||||
|
||||
if (!STATE.connectionEstabilished &&
|
||||
STATE.received == MSG.handshake)
|
||||
{
|
||||
EVENTS.defaults.connected();
|
||||
STATE.received = '';
|
||||
STATE.connectionEstabilished = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// if there are whole messages on the pipe let's dispatch them
|
||||
while (fullResponse = checkForWholeMessage())
|
||||
dispatchResponse(fullResponse);
|
||||
}
|
||||
|
||||
var RequestHandler = {
|
||||
sendMessage: function(requestObj) {
|
||||
log("\n>send message:\n" + requestObj.msg + '\n');
|
||||
var command = requestObj.v8command ? requestObj.v8command :
|
||||
requestObj.command;
|
||||
|
||||
EVENTS[requestObj.tool]["response"][command] ?
|
||||
EVENTS[requestObj.tool]["response"][command]
|
||||
: (EVENTS[requestObj.tool]["response"][command] = {});
|
||||
|
||||
// set callback for the receive response event
|
||||
if (requestObj.seq){
|
||||
if (!EVENTS[requestObj.tool]["response"][command]);
|
||||
EVENTS[requestObj.tool]["response"][command] = {};
|
||||
EVENTS[requestObj.tool]["response"][command][requestObj.seq] = requestObj.ondone;
|
||||
}
|
||||
else
|
||||
EVENTS[requestObj.tool]["response"][command] = requestObj.ondone;
|
||||
|
||||
// after the response we might want to listen for an event
|
||||
// (like for example setbreakpoint request)
|
||||
if (requestObj.event)
|
||||
EVENTS.pending[requestObj.seq] = {
|
||||
ontrigger: requestObj.ontrigger,
|
||||
event: requestObj.event
|
||||
};
|
||||
|
||||
STATE.client.send(requestObj.msg);
|
||||
}
|
||||
}
|
||||
|
||||
function protocolStringifier() {
|
||||
var s='';
|
||||
for(var i=0; i<this.headers.length; i++) {
|
||||
s += this.headers[i] + "\r\n";
|
||||
}
|
||||
s += "\r\n";
|
||||
s += this.content;
|
||||
return s;
|
||||
}
|
||||
|
||||
function connectAndHandshake()
|
||||
{
|
||||
STATE.client.onconnect = function()
|
||||
{
|
||||
log("\n>connect cb\n");
|
||||
STATE.client.receive();
|
||||
STATE.client.send(MSG.handshake);
|
||||
STATE.client.onconnect = 0;
|
||||
}
|
||||
STATE.client.onreceive = globalReceiveFunction;
|
||||
STATE.client.connect('127.0.0.1', 9222);
|
||||
}
|
||||
|
||||
|
||||
function listTabs(ondone)
|
||||
{
|
||||
var LIST_TABS = '{"command":"list_tabs"}',
|
||||
contentLength = LIST_TABS.length,
|
||||
protocolObj = {
|
||||
headers: [],
|
||||
content: LIST_TABS,
|
||||
toString: protocolStringifier
|
||||
};
|
||||
|
||||
protocolObj.headers.push(
|
||||
'Content-Length:' + contentLength,
|
||||
'Tool:DevToolsService'
|
||||
);
|
||||
|
||||
var requestObj = {
|
||||
msg: protocolObj.toString(),
|
||||
command: "list_tabs",
|
||||
tool: "DevToolsService",
|
||||
ondone: ondone
|
||||
};
|
||||
|
||||
RequestHandler.sendMessage(requestObj);
|
||||
}
|
||||
|
||||
function attach(tabID, ondone)
|
||||
{
|
||||
var ATTACH_TABS = '{"command":"attach"}',
|
||||
contentLength = ATTACH_TABS.length,
|
||||
protocolObj = {
|
||||
headers: [],
|
||||
content: ATTACH_TABS,
|
||||
toString: protocolStringifier
|
||||
};
|
||||
|
||||
protocolObj.headers.push(
|
||||
'Content-Length:' + contentLength,
|
||||
'Tool:V8Debugger',
|
||||
'Destination:' + tabID
|
||||
);
|
||||
|
||||
var requestObj = {
|
||||
msg: protocolObj.toString(),
|
||||
command: "attach",
|
||||
tool: "V8Debugger",
|
||||
ondone: ondone
|
||||
};
|
||||
|
||||
RequestHandler.sendMessage(requestObj);
|
||||
}
|
||||
|
||||
function debuggerCmd(cmd, ondone, v8command, seq, event)
|
||||
{
|
||||
var debCmd = '{"command":"debugger_command","data":'
|
||||
+ cmd +'}',
|
||||
contentLength = debCmd.length,
|
||||
protocolObj = {
|
||||
headers: [],
|
||||
content: debCmd,
|
||||
toString: protocolStringifier
|
||||
};
|
||||
|
||||
protocolObj.headers.push(
|
||||
'Content-Length:' + contentLength,
|
||||
'Tool:V8Debugger',
|
||||
'Destination:' + STATE.tabID
|
||||
);
|
||||
|
||||
var requestObj = {
|
||||
msg: protocolObj.toString(),
|
||||
command: "debugger_command",
|
||||
v8command: v8command,
|
||||
tool: "V8Debugger",
|
||||
ondone: ondone
|
||||
};
|
||||
|
||||
if (seq)
|
||||
requestObj.seq = seq;
|
||||
|
||||
if (event) {
|
||||
requestObj.event = event.type;
|
||||
requestObj.ontrigger = event.ontrigger;
|
||||
}
|
||||
|
||||
RequestHandler.sendMessage(requestObj);
|
||||
}
|
||||
|
||||
function breakpoint(target, line, ondone, ontrigger)
|
||||
{
|
||||
var v8req = {
|
||||
seq:++STATE.seq_id,
|
||||
type:"request",
|
||||
command: "setbreakpoint",
|
||||
arguments: {
|
||||
enabled: true,
|
||||
target: target,
|
||||
line: line,
|
||||
type: "script"
|
||||
}
|
||||
};
|
||||
var req = SimpleObjectToJSON_(v8req);
|
||||
var event = {type: "break", ontrigger: ontrigger};
|
||||
debuggerCmd(req, ondone, v8req.command, v8req.seq, event);
|
||||
evalDummy();
|
||||
}
|
||||
|
||||
function source(ondone)
|
||||
{
|
||||
var v8req = {
|
||||
seq:++STATE.seq_id,
|
||||
type:"request",
|
||||
command: "source",
|
||||
arguments: {}
|
||||
};
|
||||
var req = SimpleObjectToJSON_(v8req);
|
||||
debuggerCmd(req, ondone);
|
||||
}
|
||||
|
||||
function scripts(ondone)
|
||||
{
|
||||
var v8req = {
|
||||
seq:++STATE.seq_id,
|
||||
type:"request",
|
||||
command: "scripts"
|
||||
};
|
||||
var req = SimpleObjectToJSON_(v8req);
|
||||
debuggerCmd(req, ondone, v8req.command, v8req.seq);
|
||||
evalDummy();
|
||||
}
|
||||
|
||||
function evalDummy()
|
||||
{
|
||||
var debCmd = '{"command":"evaluate_javascript","data":"javascript:void(0);"}',
|
||||
contentLength = debCmd.length,
|
||||
protocolObj = {
|
||||
headers: [],
|
||||
content: debCmd,
|
||||
toString: protocolStringifier
|
||||
};
|
||||
|
||||
protocolObj.headers.push(
|
||||
'Content-Length:' + contentLength,
|
||||
'Tool:V8Debugger',
|
||||
'Destination:' + STATE.tabID
|
||||
);
|
||||
|
||||
var requestObj = {
|
||||
msg: protocolObj.toString(),
|
||||
command: "debugger_command",
|
||||
tool: "V8Debugger",
|
||||
ondone: function(){}
|
||||
};
|
||||
|
||||
RequestHandler.sendMessage(requestObj);
|
||||
}
|
||||
|
||||
function log(text) {
|
||||
var prev;
|
||||
if (document.all) {
|
||||
document.getElementById('log').innerText += text;
|
||||
} else {
|
||||
document.getElementById('log').textContent += text;
|
||||
}
|
||||
}
|
||||
|
||||
function testChrome() {
|
||||
connectAndHandshake();
|
||||
}
|
||||
|
||||
function start() {
|
||||
listTabs(onReceiveTabs);
|
||||
}
|
||||
|
||||
var tabid_;
|
||||
function onReceiveTabs(responseObj) {
|
||||
log("\nreceived tabs...\n");
|
||||
tabid_ = responseObj.data[0][0];
|
||||
attach(responseObj.data[0][0], onAttached);
|
||||
}
|
||||
|
||||
function onAttached(responseObj) {
|
||||
log("\onAttach: " + responseObj.result + "\n");
|
||||
STATE.tabID = tabid_;
|
||||
scripts(onReceiveActiveScripts);
|
||||
}
|
||||
|
||||
function onReceiveActiveScripts(responseObj) {
|
||||
var scripts = responseObj.data.body;
|
||||
log("\n> received scripts:\n")
|
||||
var debugjs;
|
||||
for (var i=0; i<scripts.length; i++) {
|
||||
if (!scripts[i].name)
|
||||
continue;
|
||||
log(scripts[i].name + "\n");
|
||||
if (!debugjs && scripts[i].name.indexOf("debug.js")!=-1)
|
||||
debugjs = scripts[i].name;
|
||||
}
|
||||
breakpoint(debugjs, 2, onsetBreakPoint, onBreak);
|
||||
}
|
||||
|
||||
function onsetBreakPoint(responseObj) {
|
||||
log("\n> breakpoint set id: " + responseObj.data.body.breakpoint + "\n")
|
||||
}
|
||||
|
||||
function onBreak(responseObj) {
|
||||
log("\n> breakpoint hit.");
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,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;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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,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
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/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"
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -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"
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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 = "¶";
|
||||
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)
|
||||
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];
|
||||
|
|
@ -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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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: "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;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue