Skip to content

Commit f6fcd13

Browse files
committed
Merge branch 'devel' of github.com:ajaxorg/cloud9 into devel
2 parents de88a26 + 624a746 commit f6fcd13

39 files changed

Lines changed: 680 additions & 74683 deletions

File tree

client/core/document.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var Document = function(node, docValue){
1515
};
1616

1717
this.setNode = function(newNode) {
18+
this.dispatchEvent("setnode", {node: newNode});
1819
return (node = newNode);
1920
};
2021

client/core/util.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ var contentTypes = {
9898
};
9999

100100
exports.getFileIcon = function(xmlNode) {
101-
var ctype = xmlNode.getAttribute('contenttype');
101+
var name = xmlNode.getAttribute('name');
102102
var icon = "page_white_text";
103-
var mime;
103+
var ext;
104104

105-
if (ctype) {
106-
mime = ctype.split(";")[0];
107-
icon = SupportedIcons[mime] || SupportedIcons[mime.split("/")[0]] || "page_white_text";
105+
if (name) {
106+
ext = name.split(".").pop();
107+
icon = SupportedIcons[contentTypes[ext]] || "page_white_text";
108108
}
109109
return icon + ".png";
110110
};

client/ext/code/code.js

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,40 @@ var SupportedModes = {
5656
"text/x-web-textile": "textile"
5757
};
5858

59+
var contentTypes = {
60+
"js": "application/javascript",
61+
"json": "application/json",
62+
"css": "text/css",
63+
64+
"xml": "application/xml",
65+
"rdf": "application/rdf+xml",
66+
"rss": "application/rss+xml",
67+
"svg": "image/svg+xml",
68+
"wsdl": "application/wsdl+xml",
69+
"xslt": "application/xslt+xml",
70+
"atom": "application/atom+xml",
71+
"mathml": "application/mathml+xml",
72+
"mml": "application/mathml+xml",
73+
74+
"php": "application/x-httpd-php",
75+
"html": "text/html",
76+
"xhtml": "application/xhtml+xml",
77+
"coffee": "text/x-script.coffeescript",
78+
"py": "text/x-script.python",
79+
80+
"ru": "text/x-script.ruby",
81+
"gemspec": "text/x-script.ruby",
82+
"rake": "text/x-script.ruby",
83+
"rb": "text/x-script.ruby",
84+
85+
"c": "text/x-c",
86+
"cc": "text/x-c",
87+
"cpp": "text/x-c",
88+
"cxx": "text/x-c",
89+
"h": "text/x-c",
90+
"hh": "text/x-c"
91+
};
92+
5993
return ext.register("ext/code/code", {
6094
name : "Code Editor",
6195
dev : "Ajax.org",
@@ -65,9 +99,20 @@ return ext.register("ext/code/code", {
6599

66100
nodes : [],
67101

68-
getSyntax : function(type) {
69-
var mime = type.split(";")[0];
70-
return (SupportedModes[mime] || "text");
102+
getSyntax : function(node) {
103+
if(!node) return "";
104+
var customType = node.getAttribute("customtype");
105+
if (!customType)
106+
customType = contentTypes[node.getAttribute("name").split(".").pop()];
107+
108+
if (customType) {
109+
var mime = customType.split(";")[0];
110+
111+
return (SupportedModes[mime] || "text");
112+
}
113+
else {
114+
return "text";
115+
}
71116
},
72117

73118
getSelection : function(){
@@ -229,8 +274,13 @@ return ext.register("ext/code/code", {
229274

230275
mnuSyntax.onitemclick = function(e) {
231276
var file = ide.getActivePageModel();
232-
if (file)
233-
apf.xmldb.setAttribute(file, "contenttype", e.relatedNode.value);
277+
if (file) {
278+
var value = e.relatedNode.value;
279+
if (value == "auto")
280+
apf.xmldb.removeAttribute(file, "customtype", "");
281+
else
282+
apf.xmldb.setAttribute(file, "customtype", value);
283+
}
234284
};
235285

236286
/*ide.addEventListener("clearfilecache", function(e){
@@ -277,4 +327,4 @@ return ext.register("ext/code/code", {
277327
}
278328
});
279329

280-
});
330+
});

client/ext/code/code.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
flex = "1"
44
anchors = "6 0 4 0"
55
visible = "false"
6-
syntax = "{require('ext/code/code').getSyntax([@contenttype])}"
6+
syntax = "{require('ext/code/code').getSyntax(%[.])}"
77
theme = "[{require('ext/settings/settings').model}::editors/code/@theme]"
88
overwrite = "[{require('ext/settings/settings').model}::editors/code/@overwrite]"
99
selectstyle = "[{require('ext/settings/settings').model}::editors/code/@selectstyle]"
@@ -46,6 +46,8 @@
4646
</a:menu>
4747

4848
<a:menu id="mnuSyntax">
49+
<a:item type="radio" value="auto">Auto Select</a:item>
50+
<a:divider />
4951
<a:item type="radio" value="text/plain">Plain Text</a:item>
5052
<a:item type="radio" value="application/javascript">JavaScript</a:item>
5153
<a:item type="radio" value="text/x-script.coffeescript">CoffeeScript</a:item>

client/ext/console/console.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
display: block;
3939
}
4040

41-
.barConsoleHints a:hover {
41+
.barConsoleHints a.selected {
4242
padding: 2px 4px;
4343
-webkit-border-radius: 4px;
4444
-moz-border-radius: 4px;

0 commit comments

Comments
 (0)