Skip to content
Snippets Groups Projects
Commit dbf4d80c authored by Mike Greiling's avatar Mike Greiling
Browse files

move check for preview loading class to top of method

parent 8c1f287c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -20,12 +20,17 @@
MarkdownPreview.prototype.ajaxCache = {};
 
MarkdownPreview.prototype.showPreview = function ($form) {
var mdText;
var preview = $form.find('.js-md-preview');
var mdText = $form.find('textarea.markdown-area').val();
if (preview.hasClass('md-preview-loading')) {
return;
}
mdText = $form.find('textarea.markdown-area').val();
if (mdText.trim().length === 0) {
preview.text('Nothing to preview.');
this.hideReferencedUsers($form);
} else if (!preview.hasClass('md-preview-loading')) {
} else {
preview.addClass('md-preview-loading').text('Loading...');
this.fetchMarkdownPreview(mdText, (function (response) {
preview.removeClass('md-preview-loading').html(response.body);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment