Load MathEvents if needed to add contextual menu to an error message

This commit is contained in:
Davide P. Cervone 2012-01-08 20:33:21 -05:00
parent a83c7c54b3
commit 7570eec623
2 changed files with 7 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -1662,10 +1662,15 @@ MathJax.Hub = {
formatError: function (script,err) {
var error = MathJax.HTML.Element("span",{className:"MathJax_Error"},this.config.errorSettings.message);
error.jaxID = "Error";
if (MathJax.Extension.MathEvents) {
error.jaxID = "Error";
error.oncontextmenu = MathJax.Extension.MathEvents.Event.Menu;
error.onmousedown = MathJax.Extension.MathEvents.Event.Mousedown;
} else {
MathJax.Ajax.Require("[MathJax]/extensions/MathEvents.js",function () {
error.oncontextmenu = MathJax.Extension.MathEvents.Event.Menu;
error.onmousedown = MathJax.Extension.MathEvents.Event.Mousedown;
});
}
script.parentNode.insertBefore(error,script);
if (script.MathJax.preview) {script.MathJax.preview.style.display = "none"}