Skip to content

Conversation

@joshuasiler
Copy link

I needed to be able to call:

// programmatically initiate preview
$("#myTextArea").markItUpExec('preview');

// initiate a preview update
$("#myTextArea").markItUpExec('refreshPreview');

@joshuasiler
Copy link
Author

For more context on this, I found the built in previewAutoRefresh to be unreliable, so I wrote an updated one. You might want to consider incorporating this pattern.

refreshLocked = false

var updateTextilePreview = function() { 
    if(!refreshLocked)
    {
        refreshLocked = true;
        $("#job-desc-spinner").show();
        setTimeout(function() {
            refreshLocked = false;
            $("#job-description").markItUpExec('refreshPreview');
            $("#job-desc-spinner").hide();
        }, 5000);
    }
}

$(document).ready(function() {
                $("#job-description").markItUp(mySettings);
                // put up preview window
                $("#job-description").markItUpExec('preview');
                // markItUp autopreview refresh not reliable, so we implement our own
                $("#job-description").bind('change keyup paste', updateTextilePreview);
           });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant