@@ -9,10 +9,12 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
99 if ( / ^ s c r i p t $ / i. test ( state . htmlState . context . tagName ) ) {
1010 state . token = javascript ;
1111 state . localState = jsMode . startState ( htmlMode . indent ( state . htmlState , "" ) ) ;
12+ state . mode = "javascript" ;
1213 }
1314 else if ( / ^ s t y l e $ / i. test ( state . htmlState . context . tagName ) ) {
1415 state . token = css ;
1516 state . localState = cssMode . startState ( htmlMode . indent ( state . htmlState , "" ) ) ;
17+ state . mode = "css" ;
1618 }
1719 }
1820 return style ;
@@ -27,6 +29,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
2729 if ( stream . match ( / ^ < \/ \s * s c r i p t \s * > / i, false ) ) {
2830 state . token = html ;
2931 state . curState = null ;
32+ state . mode = "html" ;
3033 return html ( stream , state ) ;
3134 }
3235 return maybeBackup ( stream , / < \/ \s * s c r i p t \s * > / ,
@@ -36,6 +39,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
3639 if ( stream . match ( / ^ < \/ \s * s t y l e \s * > / i, false ) ) {
3740 state . token = html ;
3841 state . localState = null ;
42+ state . mode = "html" ;
3943 return html ( stream , state ) ;
4044 }
4145 return maybeBackup ( stream , / < \/ \s * s t y l e \s * > / ,
@@ -45,13 +49,14 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
4549 return {
4650 startState : function ( ) {
4751 var state = htmlMode . startState ( ) ;
48- return { token : html , localState : null , htmlState : state } ;
52+ return { token : html , localState : null , mode : "html" , htmlState : state } ;
4953 } ,
5054
5155 copyState : function ( state ) {
5256 if ( state . localState )
5357 var local = CodeMirror . copyState ( state . token == css ? cssMode : jsMode , state . localState ) ;
54- return { token : state . token , localState : local , htmlState : CodeMirror . copyState ( htmlMode , state . htmlState ) } ;
58+ return { token : state . token , localState : local , mode : state . mode ,
59+ htmlState : CodeMirror . copyState ( htmlMode , state . htmlState ) } ;
5560 } ,
5661
5762 token : function ( stream , state ) {
0 commit comments