markupmirror/static/markupmirror/markupmirror.js
/* when changing the textarea we replace the iframe content with the
   new coming from the server */
when changing the textarea we replace the iframe content with the
new coming from the server
when changing the textarea we replace the iframe content with the new coming from the server
function update_preview(editor) {
    var $textarea = $(editor.getTextArea()),
        $codemirror = $textarea.next('.CodeMirror'),
        $iframe = $codemirror.children('iframe'),
        mm_settings = $textarea.data('mmSettings'),
        url = mm_settings.preview_url,
        markup_type = mm_settings.markup_type;
    $.post(url, {
            markup_type: markup_type,
            text: editor.getValue()
        },
        function(data, textStatus, jqXHR) {
            $iframe.trigger('_resize');
            if( $iframe.data('load') === true ) {
                $iframe.trigger('_update', {html: data});
            } else {
                $iframe.data('replace', data);
            }
        }
    );
}
function update_preview ( editor ) { var $textarea = $ ( editor . getTextArea ( ) ) , $codemirror = $textarea . next ( '.CodeMirror' ) , $iframe = $codemirror . children ( 'iframe' ) , mm_settings = $textarea . data ( 'mmSettings' ) , url = mm_settings . preview_url , markup_type = mm_settings . markup_type ; $ . post ( url , { markup_type : markup_type , text : editor . getValue ( ) } , function ( data , textStatus , jqXHR ) { $iframe . trigger ( '_resize' ) ; if ( $iframe . data ( 'load' ) === true ) { $iframe . trigger ( '_update' , { html : data } ) ; } else { $iframe . data ( 'replace' , data ) ; } } ) ; }
when changing the textarea we replace the iframe content with the
new coming from the server
when changing the textarea we replace the iframe content with the new coming from the server
/* csrfmiddlewaretoken: '{{ csrf_token }}', */