Handle interleaved Typeset() calls better.
This commit is contained in:
parent
d3eec1386a
commit
624572a654
|
@ -415,7 +415,10 @@
|
||||||
// Add the node for the math and mark it as being processed
|
// Add the node for the math and mark it as being processed
|
||||||
//
|
//
|
||||||
jax = script.MathJax.elementJax; if (!jax) continue;
|
jax = script.MathJax.elementJax; if (!jax) continue;
|
||||||
jax.CHTML = {display: (jax.root.Get("display") === "block")}
|
jax.CHTML = {
|
||||||
|
display: (jax.root.Get("display") === "block"),
|
||||||
|
preview: (jax.CHTML||{}).preview // in case typeset calls are interleaved
|
||||||
|
};
|
||||||
node = CHTML.Element("mjx-chtml",{
|
node = CHTML.Element("mjx-chtml",{
|
||||||
id:jax.inputID+"-Frame", className:"MathJax_CHTML", isMathJax:true, jaxID:this.id,
|
id:jax.inputID+"-Frame", className:"MathJax_CHTML", isMathJax:true, jaxID:this.id,
|
||||||
oncontextmenu:EVENT.Menu, onmousedown: EVENT.Mousedown,
|
oncontextmenu:EVENT.Menu, onmousedown: EVENT.Mousedown,
|
||||||
|
|
|
@ -683,7 +683,7 @@
|
||||||
// Get the data about the math
|
// Get the data about the math
|
||||||
//
|
//
|
||||||
var jax = script.MathJax.elementJax, math = jax.root,
|
var jax = script.MathJax.elementJax, math = jax.root,
|
||||||
span = document.getElementById(jax.inputID+"-Frame"),
|
span = script.previousSibling;
|
||||||
div = (jax.HTMLCSS.display ? (span||{}).parentNode : span);
|
div = (jax.HTMLCSS.display ? (span||{}).parentNode : span);
|
||||||
if (!div) return;
|
if (!div) return;
|
||||||
//
|
//
|
||||||
|
@ -775,6 +775,7 @@
|
||||||
script = scripts[i];
|
script = scripts[i];
|
||||||
if (script && script.parentNode && script.MathJax.elementJax) {
|
if (script && script.parentNode && script.MathJax.elementJax) {
|
||||||
jax = script.MathJax.elementJax; this.getMetrics(jax);
|
jax = script.MathJax.elementJax; this.getMetrics(jax);
|
||||||
|
if (jax.HTMLCSS.span && jax.HTMLCSS.div)
|
||||||
jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.II);
|
jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.II);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -788,6 +789,7 @@
|
||||||
// Finish the math with its measured size (toHTML phase III)
|
// Finish the math with its measured size (toHTML phase III)
|
||||||
//
|
//
|
||||||
jax = script.MathJax.elementJax; this.getMetrics(jax);
|
jax = script.MathJax.elementJax; this.getMetrics(jax);
|
||||||
|
if (jax.HTMLCSS.span && jax.HTMLCSS.div) {
|
||||||
jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.III);
|
jax.root.toHTML(jax.HTMLCSS.span,jax.HTMLCSS.div,this.PHASE.III);
|
||||||
if (jax.HTMLCSS.isHidden) script.parentNode.insertBefore(jax.HTMLCSS.div,script);
|
if (jax.HTMLCSS.isHidden) script.parentNode.insertBefore(jax.HTMLCSS.div,script);
|
||||||
delete jax.HTMLCSS.span; delete jax.HTMLCSS.div;
|
delete jax.HTMLCSS.span; delete jax.HTMLCSS.div;
|
||||||
|
@ -798,6 +800,7 @@
|
||||||
HUB.signal.Post(["New Math",script.MathJax.elementJax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback)
|
HUB.signal.Post(["New Math",script.MathJax.elementJax.inputID]); // FIXME: wait for this? (i.e., restart if returns uncalled callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.forceReflow) {
|
if (this.forceReflow) {
|
||||||
// WebKit can misplace some elements that should wrap to the next line
|
// WebKit can misplace some elements that should wrap to the next line
|
||||||
// but gets them right on a reflow, so force reflow by toggling a stylesheet
|
// but gets them right on a reflow, so force reflow by toggling a stylesheet
|
||||||
|
|
|
@ -228,7 +228,10 @@
|
||||||
// then set the role and mark it as being processed
|
// then set the role and mark it as being processed
|
||||||
//
|
//
|
||||||
jax = script.MathJax.elementJax; if (!jax) continue;
|
jax = script.MathJax.elementJax; if (!jax) continue;
|
||||||
jax.SVG = {display: (jax.root.Get("display") === "block")}
|
jax.SVG = {
|
||||||
|
display: (jax.root.Get("display") === "block"),
|
||||||
|
preview: (jax.SVG||{}).preview // in case typeset calls are interleaved
|
||||||
|
};
|
||||||
span = div = HTML.Element("span",{
|
span = div = HTML.Element("span",{
|
||||||
style: {"font-size": this.config.scale+"%", display:"inline-block"},
|
style: {"font-size": this.config.scale+"%", display:"inline-block"},
|
||||||
className:"MathJax_SVG", id:jax.inputID+"-Frame", isMathJax:true, jaxID:this.id,
|
className:"MathJax_SVG", id:jax.inputID+"-Frame", isMathJax:true, jaxID:this.id,
|
||||||
|
@ -312,7 +315,7 @@
|
||||||
// Get the data about the math
|
// Get the data about the math
|
||||||
//
|
//
|
||||||
var jax = script.MathJax.elementJax, math = jax.root,
|
var jax = script.MathJax.elementJax, math = jax.root,
|
||||||
span = document.getElementById(jax.inputID+"-Frame"),
|
span = script.previousSibling;
|
||||||
div = (jax.SVG.display ? (span||{}).parentNode : span),
|
div = (jax.SVG.display ? (span||{}).parentNode : span),
|
||||||
localCache = (SVG.config.useFontCache && !SVG.config.useGlobalCache);
|
localCache = (SVG.config.useFontCache && !SVG.config.useGlobalCache);
|
||||||
if (!div) return;
|
if (!div) return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user