Markdown mode added, fix to tag display

Markdown added as a mode
CodeMirror changed their object structure to include another child -
htmlState
If it's a markdown file we're editing, after loading our file into the
stickyTab, onload of this parse our content through mmd to this window
This commit is contained in:
Matt Pass
2013-04-30 17:54:19 +01:00
parent d886372f11
commit d43a758a37

View File

@@ -215,6 +215,7 @@ var ICEcoder = {
: fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby")
: fileName.indexOf('.css')>0 ? cM.setOption("mode","css")
: fileName.indexOf('.less')>0 ? cM.setOption("mode","less")
: fileName.indexOf('.md')>0 ? cM.setOption("mode","markdown")
: cM.setOption("mode","application/x-httpd-php");
}
},
@@ -1008,7 +1009,7 @@ var ICEcoder = {
state = cM.getTokenAt(cM.getCursor()).state;
if ("undefined" != typeof state.curState) {
ICEcoder.htmlTagArray = [];
for (cx = state.curState.context; cx; cx = cx.prev) {
for (cx = state.curState.htmlState.context; cx; cx = cx.prev) {
if ("undefined" != typeof cx.tagName) {
ICEcoder.htmlTagArray.unshift(cx.tagName);
}
@@ -1107,7 +1108,8 @@ var ICEcoder = {
else if (fileName.indexOf(".coffee")>0) {caretLocType="CoffeeScript"}
else if (fileName.indexOf(".rb")>0) {caretLocType="Ruby"}
else if (fileName.indexOf(".css")>0) {caretLocType="CSS"}
else if (fileName.indexOf(".less")>0) {caretLocType="LESS"};
else if (fileName.indexOf(".less")>0) {caretLocType="LESS"}
else if (fileName.indexOf(".md")>0) {caretLocType="Markdown"};
ICEcoder.caretLocType = caretLocType;
},
@@ -2047,7 +2049,14 @@ var ICEcoder = {
// CTRL+Enter (Open Webpage)
} else if(key==13 && evt.ctrlKey && top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] != "/[NEW]") {
if (top.ICEcoder.stickyTabMaybe) {
top.ICEcoder.stickyTab = window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1],"stickyTab");
var filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
var filename = filepath.substr(filepath.lastIndexOf("/")+1);
var fileExt = filename.substr(filename.lastIndexOf(".")+1);
var cM = ICEcoder.getcMInstance();
top.ICEcoder.stickyTab = window.open(filepath,"stickyTab");
if (["md"].indexOf(fileExt) > -1) {
top.ICEcoder.stickyTab.onload = function() {top.ICEcoder.stickyTab.document.documentElement.innerHTML = mmd(cM.getValue())};
}
} else {
window.open(top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]);
}