Commit b0afacd5 authored by RobertPlummer's avatar RobertPlummer

[FIX] Ensure that codemirror updates textarea before getting its value

parent 62b36810
......@@ -573,7 +573,10 @@ var syntaxHighlighter = {
$input
.data('codeMirrorRelationship', i - 1)
.addClass('codeMirror');
.addClass('codeMirror')
.on('sync', function() {
syntaxHighlighter.sync($input);
});
},
remove: function($input) {
var relationship = parseInt($input.data('codeMirrorRelationship'));
......
......@@ -16,12 +16,13 @@
{/jq}
{else}
{jq}
{*the call to trigger sync is for ensuring we get the most up to date value form the editor, which could be using codemirror*}
$('input[name=preview]').click(function(){
$(document).trigger('previewWikiLingo', [false, $('#editwiki').val(), $('#editpageform'), $('#autosave_preview').slideDown('slow')]);
$(document).trigger('previewWikiLingo', [false, $('#editwiki').trigger('sync').val(), $('#editpageform'), $('#autosave_preview').slideDown('slow')]);
return false;
});
$('input.btn-primary').click(function() {
$(document).trigger('saveWikiLingo', [false, $('#editwiki').val(), $('#editpageform')]);
$(document).trigger('saveWikiLingo', [false, $('#editwiki').trigger('sync').val(), $('#editpageform')]);
return false;
});
{/jq}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment