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

add loading class to preview element and check it to prevent multiple ajax requests

parent 2b6f6e7b
No related branches found
No related tags found
No related merge requests found
Loading
@@ -23,10 +23,10 @@
Loading
@@ -23,10 +23,10 @@
if (mdText.trim().length === 0) { if (mdText.trim().length === 0) {
preview.text('Nothing to preview.'); preview.text('Nothing to preview.');
this.hideReferencedUsers($form); this.hideReferencedUsers($form);
} else { } else if (!preview.hasClass('md-preview-loading')) {
preview.text('Loading...'); preview.addClass('md-preview-loading').text('Loading...');
this.fetchMarkdownPreview(mdText, (function(response) { this.fetchMarkdownPreview(mdText, (function(response) {
preview.html(response.body); preview.removeClass('md-preview-loading').html(response.body);
preview.renderGFM(); preview.renderGFM();
this.renderReferencedUsers(response.references.users, $form); this.renderReferencedUsers(response.references.users, $form);
}).bind(this)); }).bind(this));
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