Make a flag for output jax to control fast preview (so we don't have to maintain a blakc-list here).

This commit is contained in:
Davide P. Cervone 2015-12-09 16:26:41 -05:00
parent 7342aebe66
commit 5973694116
2 changed files with 9 additions and 2 deletions

View File

@ -29,6 +29,7 @@
(function (HUB,HTML,BROWSER) {
var SETTINGS = HUB.config.menuSettings;
var JAX = MathJax.OutputJax;
var msieColorBug = BROWSER.isMSIE && (document.documentMode||0) < 8;
var FastPreview = MathJax.Extension["fast-preview"] = {
@ -63,7 +64,7 @@
HUB.Config({"HTML-CSS": config.Chunks, CommonHTML: config.Chunks, SVG: config.Chunks});
}
HUB.Register.MessageHook("Begin Math Output",function () {
if (!done && SETTINGS.FastPreview && this.enabled && SETTINGS.renderer !== "PreviewHTML") {
if (!done && FastPreview.Active()) {
update = HUB.processUpdateTime; delay = HUB.processUpdateDelay;
style = HUB.config.messageStyle;
HUB.processUpdateTime = config.updateTime;
@ -88,13 +89,18 @@
//
Disable: function () {this.enabled = false},
Enable: function () {this.enabled = true},
Active: function () {
return SETTINGS.FastPreview && this.enabled &&
!(JAX[SETTINGS.renderer]||{}).noFastPreview;
},
//
// Insert a preview span, if there isn't one already,
// and call the PreviewHTML output jax to create the preview
//
Preview: function (data) {
if (!SETTINGS.FastPreview || !this.enabled || SETTINGS.renderer === "PreviewHTML") return;
if (!this.Active()) return;
var preview = data.script.MathJax.preview || data.script.previousSibling;
if (!preview || preview.className !== MathJax.Hub.config.preRemoveClass) {
preview = HTML.Element("span",{className:MathJax.Hub.config.preRemoveClass});

View File

@ -30,6 +30,7 @@ MathJax.OutputJax.PreviewHTML = MathJax.OutputJax({
version: "2.6.0-beta",
directory: MathJax.OutputJax.directory + "/PreviewHTML",
extensionDir: MathJax.OutputJax.extensionDir + "/PreviewHTML",
noFastPreview: true, // don't do fast preview for this output jax
config: {
scale: 100, minScaleAdjust: 50, // global math scaling factor, and minimum adjusted scale factor