Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows external access to functions #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allows external access to functions #7

wants to merge 1 commit into from

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