commit 3737c8d84bcd4647449a267f490cc883cba4372f
parent 0b00aceae229ae50f2132cc13ffeecb96711f824
Author: Davide P. Cervone <dpvc@union.edu>
Date: Fri, 11 Dec 2015 16:14:37 -0500
Merge branch 'preview-disable' into develop
Diffstat:
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/unpacked/extensions/fast-preview.js b/unpacked/extensions/fast-preview.js
@@ -29,10 +29,12 @@
(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"] = {
version: "2.6.0-beta",
+ enabled: true,
//
// Configuration for the chunking of the main output
@@ -62,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 && SETTINGS.renderer !== "PreviewHTML") {
+ if (!done && FastPreview.Active()) {
update = HUB.processUpdateTime; delay = HUB.processUpdateDelay;
style = HUB.config.messageStyle;
HUB.processUpdateTime = config.updateTime;
@@ -81,13 +83,24 @@
}
});
},
+
+ //
+ // Allow page to override user settings (for things like editor previews)
+ //
+ 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 || 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
@@ -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