OLD | NEW |
| 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 // Distributed under an MIT license: http://codemirror.net/LICENSE |
| 3 |
| 4 (function(mod) { |
| 5 if (typeof exports == "object" && typeof module == "object") // CommonJS |
| 6 mod(require("../../lib/codemirror"), require("../xml/xml"), require("../java
script/javascript"), require("../css/css")); |
| 7 else if (typeof define == "function" && define.amd) // AMD |
| 8 define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", ".
./css/css"], mod); |
| 9 else // Plain browser env |
| 10 mod(CodeMirror); |
| 11 })(function(CodeMirror) { |
| 12 "use strict"; |
| 13 |
1 CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { | 14 CodeMirror.defineMode("htmlmixed", function(config, parserConfig) { |
2 var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); | 15 var htmlMode = CodeMirror.getMode(config, {name: "xml", |
| 16 htmlMode: true, |
| 17 multilineTagIndentFactor: parserCon
fig.multilineTagIndentFactor, |
| 18 multilineTagIndentPastTag: parserCo
nfig.multilineTagIndentPastTag}); |
3 var cssMode = CodeMirror.getMode(config, "css"); | 19 var cssMode = CodeMirror.getMode(config, "css"); |
4 | 20 |
5 var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTyp
es; | 21 var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTyp
es; |
6 scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$
|^$/i, | 22 scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$
|^$/i, |
7 mode: CodeMirror.getMode(config, "javascript")}); | 23 mode: CodeMirror.getMode(config, "javascript")}); |
8 if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) { | 24 if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) { |
9 var conf = scriptTypesConf[i]; | 25 var conf = scriptTypesConf[i]; |
10 scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMo
de(config, conf.mode)}); | 26 scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMo
de(config, conf.mode)}); |
11 } | 27 } |
12 scriptTypes.push({matches: /./, | 28 scriptTypes.push({matches: /./, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 102 |
87 indent: function(state, textAfter) { | 103 indent: function(state, textAfter) { |
88 if (!state.localMode || /^\s*<\//.test(textAfter)) | 104 if (!state.localMode || /^\s*<\//.test(textAfter)) |
89 return htmlMode.indent(state.htmlState, textAfter); | 105 return htmlMode.indent(state.htmlState, textAfter); |
90 else if (state.localMode.indent) | 106 else if (state.localMode.indent) |
91 return state.localMode.indent(state.localState, textAfter); | 107 return state.localMode.indent(state.localState, textAfter); |
92 else | 108 else |
93 return CodeMirror.Pass; | 109 return CodeMirror.Pass; |
94 }, | 110 }, |
95 | 111 |
96 electricChars: "/{}:", | |
97 | |
98 innerMode: function(state) { | 112 innerMode: function(state) { |
99 return {state: state.localState || state.htmlState, mode: state.localMode
|| htmlMode}; | 113 return {state: state.localState || state.htmlState, mode: state.localMode
|| htmlMode}; |
100 } | 114 } |
101 }; | 115 }; |
102 }, "xml", "javascript", "css"); | 116 }, "xml", "javascript", "css"); |
103 | 117 |
104 CodeMirror.defineMIME("text/html", "htmlmixed"); | 118 CodeMirror.defineMIME("text/html", "htmlmixed"); |
| 119 |
| 120 }); |
OLD | NEW |