Don't have preprocessors make a preview if there already is one. Resolves issue #1445.
This commit is contained in:
parent
97b9fbcfab
commit
1e999e389e
|
@ -207,11 +207,13 @@ MathJax.Extension.asciimath2jax = {
|
|||
},
|
||||
|
||||
createPreview: function (mode,asciimath) {
|
||||
var previewClass = MathJax.Hub.config.preRemoveClass;
|
||||
var preview = this.config.preview;
|
||||
if (preview === "none") return;
|
||||
if ((this.search.close.previousSibling||{}).className === previewClass) return;
|
||||
if (preview === "AsciiMath") {preview = [this.filterPreview(asciimath)]}
|
||||
if (preview) {
|
||||
preview = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},preview);
|
||||
preview = MathJax.HTML.Element("span",{className:previewClass},preview);
|
||||
this.insertNode(preview);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -73,10 +73,13 @@ MathJax.Extension.jsMath2jax = {
|
|||
},
|
||||
|
||||
createPreview: function (node) {
|
||||
var previewClass = MathJax.Hub.config.preRemoveClass;
|
||||
var preview = this.config.preview;
|
||||
if (preview === "none") return;
|
||||
if ((node.previousSibling||{}).className === previewClass) return;
|
||||
if (preview === "TeX") {preview = [this.filterPreview(node.innerHTML)]}
|
||||
if (preview) {
|
||||
preview = MathJax.HTML.Element("span",{className: MathJax.Hub.config.preRemoveClass},preview);
|
||||
preview = MathJax.HTML.Element("span",{className:previewClass},preview);
|
||||
node.parentNode.insertBefore(preview,node);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -203,6 +203,8 @@ MathJax.Extension.mml2jax = {
|
|||
var preview = this.config.preview;
|
||||
if (preview === "none") return;
|
||||
var isNodePreview = false;
|
||||
var previewClass = MathJax.Hub.config.preRemoveClass;
|
||||
if ((script.previousSibling||{}).className === previewClass) return;
|
||||
if (preview === "mathml") {
|
||||
isNodePreview = true;
|
||||
// mathml preview does not work with IE < 9, so fallback to alttext.
|
||||
|
@ -225,10 +227,10 @@ MathJax.Extension.mml2jax = {
|
|||
if (preview) {
|
||||
var span;
|
||||
if (isNodePreview) {
|
||||
span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});
|
||||
span = MathJax.HTML.Element("span",{className:previewClass});
|
||||
span.appendChild(preview);
|
||||
} else {
|
||||
span = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},preview);
|
||||
span = MathJax.HTML.Element("span",{className:previewClass},preview);
|
||||
}
|
||||
script.parentNode.insertBefore(span,script);
|
||||
}
|
||||
|
|
|
@ -277,11 +277,13 @@ MathJax.Extension.tex2jax = {
|
|||
},
|
||||
|
||||
createPreview: function (mode,tex) {
|
||||
var previewClass = MathJax.Hub.config.preRemoveClass;
|
||||
var preview = this.config.preview;
|
||||
if (preview === "none") return;
|
||||
if ((this.search.close.previousSibling||{}).className === previewClass) return;
|
||||
if (preview === "TeX") {preview = [this.filterPreview(tex)]}
|
||||
if (preview) {
|
||||
preview = MathJax.HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass},preview);
|
||||
preview = MathJax.HTML.Element("span",{className:previewClass},preview);
|
||||
this.insertNode(preview);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user