diff --git a/common/static/js/vendor/tiny_mce/plugins/codemirror/source.html b/common/static/js/vendor/tiny_mce/plugins/codemirror/source.html index 06f1e70fc1..7850536b66 100644 --- a/common/static/js/vendor/tiny_mce/plugins/codemirror/source.html +++ b/common/static/js/vendor/tiny_mce/plugins/codemirror/source.html @@ -202,10 +202,6 @@ function submit() editor.fire('SaveCodeMirror', codemirror); editor.setContent(codemirror.getValue().replace(cc, '')); - editor.isNotDirty = !isDirty; - if (isDirty) { - editor.nodeChanged(); - } // Set cursor: var el = editor.dom.select('span#CmCaReT')[0]; @@ -214,6 +210,22 @@ function submit() editor.selection.setCursorLocation(el,0); editor.dom.remove(el); } + // EDX: added because CmCaReT span was getting left in when caret was within a style tag. + // Make sure to strip it out (and accept that caret will not be in the correct place). + else { + var content = editor.getContent(); + var strippedContent = content.replace('', ''); + if (content !== strippedContent) { + editor.setContent(strippedContent); + } + } + + // EDX: moved block of code from original location since we may change content in bug fix code above. + editor.isNotDirty = !isDirty; + if (isDirty) { + editor.nodeChanged(); + } + }