Add contextual menu to Math Processing Error messages, so it is possible to access the settings if something has gone wrong

This commit is contained in:
Davide P. Cervone 2011-09-22 09:17:10 -04:00
parent dcd4be5dd7
commit 0a2e1c3968
12 changed files with 72 additions and 13 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1641,6 +1641,11 @@ MathJax.Hub = {
formatError: function (script,err) {
var error = MathJax.HTML.Element("span",{className:"MathJax_Error"},this.config.errorSettings.message);
if (MathJax.Extension.MathEvents) {
error.jaxID = "Error";
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"}
this.lastError = err;
@ -2174,6 +2179,20 @@ MathJax.Hub.Startup = {
}
});
BASE.ElementJax.prototype.STATE = BASE.ElementJax.STATE;
//
// Some "Fake" jax used to allow menu access for "Math Processing Error" messages
//
BASE.OutputJax.Error = {
id: "Error", version: "1.1", config: {},
ContextMenu: function () {return BASE.Extension.MathEvents.Event.ContextMenu.apply(BASE.Extension.MathEvents.Event,arguments)},
Mousedown: function () {return BASE.Extension.MathEvents.Event.AltContextMenu.apply(BASE.Extension.MathEvents.Event,arguments)},
getJaxFromMath: function () {return {inputJax:"Error", outputJax:"Error", originalText:"Math Processing Error"}}
};
BASE.InputJax.Error = {
id: "Error", version: "1.1", config: {},
sourceMenuTitle: "Error Message"
};
})("MathJax");

View File

@ -147,8 +147,9 @@
var MENU = MathJax.Menu;
if (MENU) {
MENU.jax = jax;
MENU.menu.Find("Show Math As").menu.items[1].name =
(INPUT[jax.inputJax].sourceMenuTitle||"Original Form");
var source = MENU.menu.Find("Show Math As").menu;
source.items[1].name = (INPUT[jax.inputJax].sourceMenuTitle||"Original Form");
source.items[0].hidden = (jax.inputJax === "Error"); // hide MathML choice for error messages
return MENU.menu.Post(event);
} else {
if (!AJAX.loadingMathMenu) {