Make format submenu use 'Original' for original MathML source, and set the value each time the menu is opened, so mixed pages work properly

This commit is contained in:
dpvc 2010-07-30 13:49:04 +00:00
parent 5ef4eb10d0
commit a90fbc083a
6 changed files with 20 additions and 14 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

View File

@ -29,7 +29,7 @@
var CONFIG = HUB.Insert({ var CONFIG = HUB.Insert({
delay: 150, // the delay for submenus delay: 150, // the delay for submenus
helpURL: "http://www.mathjax.org/help/user/", // the URL for the "MathJax Help" menu helpURL: "http://www.mathjax.org/Help-User/", // the URL for the "MathJax Help" menu
showRenderer: true, // show the "Math Renderer" menu? showRenderer: true, // show the "Math Renderer" menu?
showFontMenu: false, // show the "Font Preference" menu? showFontMenu: false, // show the "Font Preference" menu?
@ -672,7 +672,7 @@
*/ */
CONFIG.settings = HUB.config.menuSettings; CONFIG.settings = HUB.config.menuSettings;
if (!CONFIG.settings.format) if (!CONFIG.settings.format)
{CONFIG.settings.format = (MathJax.InputJax.TeX ? "TeX" : "MathML")} {CONFIG.settings.format = (MathJax.InputJax.TeX ? "Original" : "MathML")}
if (typeof(CONFIG.settings.showRenderer) !== "undefined") {CONFIG.showRenderer = CONFIG.settings.showRenderer} if (typeof(CONFIG.settings.showRenderer) !== "undefined") {CONFIG.showRenderer = CONFIG.settings.showRenderer}
if (typeof(CONFIG.settings.showFontMenu) !== "undefined") {CONFIG.showFontMenu = CONFIG.settings.showFontMenu} if (typeof(CONFIG.settings.showFontMenu) !== "undefined") {CONFIG.showFontMenu = CONFIG.settings.showFontMenu}
if (typeof(CONFIG.settings.showContext) !== "undefined") {CONFIG.showContext = CONFIG.settings.showContext} if (typeof(CONFIG.settings.showContext) !== "undefined") {CONFIG.showContext = CONFIG.settings.showContext}
@ -684,8 +684,8 @@
MENU.menu = MENU( MENU.menu = MENU(
ITEM.COMMAND("Show Source",MENU.ShowSource), ITEM.COMMAND("Show Source",MENU.ShowSource),
ITEM.SUBMENU("Format", ITEM.SUBMENU("Format",
ITEM.RADIO("MathML", "format"), ITEM.RADIO("MathML", "format"),
ITEM.RADIO("TeX", "format", {disabled: !MathJax.InputJax.TeX}) ITEM.RADIO("Original", "format", {value: "Original"})
), ),
ITEM.RULE(), ITEM.RULE(),
ITEM.SUBMENU("Settings", ITEM.SUBMENU("Settings",

View File

@ -386,10 +386,13 @@
ContextMenu: function (event,force) { ContextMenu: function (event,force) {
if (HTMLCSS.config.showMathMenu && (HTMLCSS.settings.context === "MathJax" || force)) { if (HTMLCSS.config.showMathMenu && (HTMLCSS.settings.context === "MathJax" || force)) {
if (HTMLCSS.safariContextMenuBug) {setTimeout('window.getSelection().empty()',0)} if (HTMLCSS.safariContextMenuBug) {setTimeout('window.getSelection().empty()',0)}
if (MathJax.Menu) { var MENU = MathJax.Menu;
if (MENU) {
var math = (this.parentNode.className === "MathJax_Display" ? this.parentNode : this) var math = (this.parentNode.className === "MathJax_Display" ? this.parentNode : this)
MathJax.Menu.jax = HUB.getJaxFor(math.nextSibling); MENU.jax = HUB.getJaxFor(math.nextSibling);
return MathJax.Menu.menu.Post(event); MENU.menu.items[1].menu.items[1].name =
(MENU.jax.inputJax.name === "MathML" ? "Original" : MENU.jax.inputJax.name);
return MENU.menu.Post(event);
} else { } else {
if (!AJAX.loadingMathMenu) { if (!AJAX.loadingMathMenu) {
AJAX.loadingMathMenu = true; AJAX.loadingMathMenu = true;

View File

@ -149,12 +149,15 @@
ContextMenu: function (event,force) { ContextMenu: function (event,force) {
if (nMML.config.showMathMenu && (nMML.settings.context === "MathJax" || force)) { if (nMML.config.showMathMenu && (nMML.settings.context === "MathJax" || force)) {
if (nMML.safariContextMenuBug) {setTimeout('window.getSelection().empty()',0)} if (nMML.safariContextMenuBug) {setTimeout('window.getSelection().empty()',0)}
if (MathJax.Menu) { var MENU = MathJax.Menu;
if (MENU) {
if (document.selection) {setTimeout("document.selection.empty()",0)} if (document.selection) {setTimeout("document.selection.empty()",0)}
var script = (isMSIE ? this.parentNode.parentNode.nextSibling : this.parentNode.nextSibling); var script = (isMSIE ? this.parentNode.parentNode.nextSibling : this.parentNode.nextSibling);
MathJax.Menu.jax = HUB.getJaxFor(script); MENU.jax = HUB.getJaxFor(script);
MENU.menu.items[1].menu.items[1].name =
(MENU.jax.inputJax.name === "MathML" ? "Original" : MENU.jax.inputJax.name);
delete nMML.trapClick; delete nMML.trapUp; delete nMML.trapClick; delete nMML.trapUp;
return MathJax.Menu.menu.Post(event); return MENU.menu.Post(event);
} else { } else {
if (!AJAX.loadingMathMenu) { if (!AJAX.loadingMathMenu) {
AJAX.loadingMathMenu = true; AJAX.loadingMathMenu = true;