From 59736941161cc73d03c546fe54b8b96a9e2c28dd Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 9 Dec 2015 16:26:41 -0500 Subject: [PATCH] Make a flag for output jax to control fast preview (so we don't have to maintain a blakc-list here). --- unpacked/extensions/fast-preview.js | 10 ++++++++-- unpacked/jax/output/PreviewHTML/config.js | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/unpacked/extensions/fast-preview.js b/unpacked/extensions/fast-preview.js index c71108205..2d64959ea 100644 --- a/unpacked/extensions/fast-preview.js +++ b/unpacked/extensions/fast-preview.js @@ -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}); diff --git a/unpacked/jax/output/PreviewHTML/config.js b/unpacked/jax/output/PreviewHTML/config.js index 822f077fa..ddfe33bc7 100644 --- a/unpacked/jax/output/PreviewHTML/config.js +++ b/unpacked/jax/output/PreviewHTML/config.js @@ -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