Index: branches/5.3.x/core/admin_templates/js/forms.js =================================================================== diff -u -N -r16390 -r16595 --- branches/5.3.x/core/admin_templates/js/forms.js (.../forms.js) (revision 16390) +++ branches/5.3.x/core/admin_templates/js/forms.js (.../forms.js) (revision 16595) @@ -134,15 +134,27 @@ } if ( !$.isEmptyObject($CodeMirrorEditors) ) { - var $editor; - - for (var $editor_id in $CodeMirrorEditors) { - var $textarea_element = $('#' + jq($editor_id)), + $.each($CodeMirrorEditors, function ($editor_id, $editor_options) { + var $editor, + $textarea_element = $('#' + jq($editor_id)), $height = parseInt($textarea_element.height(), 10); - $editor = CodeMirror.fromTextArea($textarea_element.get(0), $CodeMirrorEditors[$editor_id]); + if ( $textarea_element.is(':disabled') ) { + $editor_options.readOnly = 'nocursor'; + } + + $editor = CodeMirror.fromTextArea($textarea_element.get(0), $editor_options); $editor.setSize(null, $height); - } + + $textarea_element + .on('change', function ($e) { + $editor.getDoc().setValue($textarea_element.val()); + }) + .on('refresh', function ($e) { + $editor.setOption('readOnly', $textarea_element.is(':disabled') ? 'nocursor' : ''); + }) + ; + }); } }