diff --git a/src/language/HTMLUtils.js b/src/language/HTMLUtils.js index fc2c03e883b..9c7a0279dc9 100644 --- a/src/language/HTMLUtils.js +++ b/src/language/HTMLUtils.js @@ -485,7 +485,8 @@ define(function (require, exports, module) { currentBlock = null, inBlock = false, outerMode = editor._codeMirror.getMode(), - tokenModeName; + tokenModeName, + previousMode; while (TokenUtils.moveNextToken(ctx, false)) { tokenModeName = CodeMirror.innerMode(outerMode, ctx.token.state).mode.name; @@ -495,7 +496,7 @@ define(function (require, exports, module) { currentBlock.end = currentBlock.start; } // Check for end of this block - if (tokenModeName !== modeName) { + if (tokenModeName === previousMode) { // currentBlock.end is already set to pos of the last token by now currentBlock.text = editor.document.getRange(currentBlock.start, currentBlock.end); inBlock = false; @@ -510,6 +511,8 @@ define(function (require, exports, module) { }; blocks.push(currentBlock); inBlock = true; + } else { + previousMode = tokenModeName; } // else, random token: ignore } diff --git a/test/spec/InlineEditorProviders-test-files/test1.php b/test/spec/InlineEditorProviders-test-files/test1.php new file mode 100644 index 00000000000..f0d07e12d2b --- /dev/null +++ b/test/spec/InlineEditorProviders-test-files/test1.php @@ -0,0 +1,14 @@ + + +
+ + + +