./vendor/assets/javascripts/codemirror/modes/php.js in codemirror-rails-0.2.1 vs ./vendor/assets/javascripts/codemirror/modes/php.js in codemirror-rails-0.2.2
- old
+ new
@@ -47,29 +47,33 @@
var style = htmlMode.token(stream, state.curState);
if (style == "meta" && /^<\?/.test(stream.current())) {
state.curMode = phpMode;
state.curState = state.php;
state.curClose = /^\?>/;
+ state.mode = 'php';
}
else if (style == "tag" && stream.current() == ">" && state.curState.context) {
if (/^script$/i.test(state.curState.context.tagName)) {
state.curMode = jsMode;
state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
state.curClose = /^<\/\s*script\s*>/i;
+ state.mode = 'javascript';
}
else if (/^style$/i.test(state.curState.context.tagName)) {
state.curMode = cssMode;
state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
state.curClose = /^<\/\s*style\s*>/i;
+ state.mode = 'css';
}
}
return style;
}
else if (stream.match(state.curClose, false)) {
state.curMode = htmlMode;
state.curState = state.html;
state.curClose = null;
+ state.mode = 'html';
return dispatch(stream, state);
}
else return state.curMode.token(stream, state.curState);
}
@@ -78,10 +82,11 @@
var html = htmlMode.startState();
return {html: html,
php: phpMode.startState(),
curMode: parserConfig.startOpen ? phpMode : htmlMode,
curState: parserConfig.startOpen ? phpMode.startState() : html,
- curClose: parserConfig.startOpen ? /^\?>/ : null}
+ curClose: parserConfig.startOpen ? /^\?>/ : null,
+ mode: parserConfig.startOpen ? 'php' : 'html'}
},
copyState: function(state) {
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;