Update Mathjax version to include a11y

This commit is contained in:
DawoudSheraz
2018-12-04 16:29:15 +05:00
parent 8b47763543
commit bd262e000b
17 changed files with 333 additions and 28 deletions

View File

@@ -42,6 +42,14 @@ if (typeof MathJax === 'undefined') {
});
};
};
vendorScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG';
// Automatic loading of Mathjax accessibility files
window.MathJax = {
menuSettings: {
collapsible: true,
autocollapse: true,
explorer: true
}
};
vendorScript.src = 'https://cdn.jsdelivr.net/npm/mathjax@2.7.5/MathJax.js?config=TeX-MML-AM_SVG';
document.body.appendChild(vendorScript);
}

View File

@@ -482,7 +482,6 @@
this.postMathJaxProcessor(this.markdownWithHighlight(element.text()))
);
this.typesetMathJax(element);
};
DiscussionUtil.typesetMathJax = function(element) {

View File

@@ -59,13 +59,12 @@
this.renderAttrs();
this.$('span.timeago').timeago();
this.convertMath();
this.$('.post-body');
this.$('h1,h3');
return this;
};
DiscussionThreadShowView.prototype.convertMath = function() {
DiscussionUtil.convertMath(this.$('.post-body'));
DiscussionUtil.typesetMathJax(this.$('.post-body'));
};
DiscussionThreadShowView.prototype.edit = function(event) {

View File

@@ -317,7 +317,9 @@
if (options.focusAddedResponse) {
this.focusToTheAddedResponse(view.el);
}
DiscussionUtil.typesetMathJax(view.$el.find('.js-response-list'));
// Typeset the response when initially loaded for any forum
DiscussionUtil.typesetMathJax(view.$el);
return view;
};
DiscussionThreadView.prototype.renderAddResponseButton = function() {
@@ -345,7 +347,7 @@
};
DiscussionThreadView.prototype.submitComment = function(event) {
var body, comment, url;
var body, comment, url, view;
event.preventDefault();
url = this.model.urlFor('reply');
body = this.getWmdContent('reply-body');
@@ -365,7 +367,7 @@
user_id: window.user.get('id')
});
comment.set('thread', this.model.get('thread'));
this.renderResponseToList(comment, '.js-response-list', {
view = this.renderResponseToList(comment, '.js-response-list', {
focusAddedResponse: true
});
this.model.addComment();
@@ -380,7 +382,8 @@
},
success: function(data) {
comment.updateInfo(data.annotated_content_info);
return comment.set(data.content);
comment.set(data.content);
DiscussionUtil.typesetMathJax(view.$el.find('.response-body'));
}
});
};

View File

@@ -72,6 +72,7 @@
ResponseCommentShowView.prototype.convertMath = function() {
DiscussionUtil.convertMath(this.$el.find('.response-body'));
DiscussionUtil.typesetMathJax(this.$el.find('.response-body'));
};
ResponseCommentShowView.prototype._delete = function(event) {

View File

@@ -82,7 +82,7 @@
ThreadResponseView.prototype.render = function() {
this.$el.addClass('response_' + this.model.get('id'));
this.$el.html(this.renderTemplate());
edx.HtmlUtils.setHtml(this.$el, edx.HtmlUtils.HTML(this.renderTemplate()));
this.delegateEvents();
this.renderShowView();
this.renderAttrs();
@@ -309,6 +309,7 @@
event.preventDefault();
this.createShowView();
this.renderShowView();
DiscussionUtil.typesetMathJax(this.$el.find('.response-body'));
return this.showCommentForm();
};
@@ -342,6 +343,7 @@
});
self.createShowView();
self.renderShowView();
DiscussionUtil.typesetMathJax(self.$el.find('.response-body'));
return self.showCommentForm();
}
});