Disable Fast Preview for version 2.5.
Except for the Discussion Tab. TNL-3693, TNL-3365
This commit is contained in:
@@ -235,8 +235,7 @@ describe("Formula Equation Preview", function () {
|
||||
|
||||
// Refresh the MathJax.
|
||||
expect(MathJax.Hub.Queue).toHaveBeenCalledWith(
|
||||
['Text', this.jax, 'THE_FORMULA'],
|
||||
['Reprocess', this.jax]
|
||||
['Text', this.jax, 'THE_FORMULA']
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -302,8 +301,7 @@ describe("Formula Equation Preview", function () {
|
||||
runs(function () {
|
||||
// Refresh the MathJax.
|
||||
expect(MathJax.Hub.Queue).toHaveBeenCalledWith(
|
||||
['Text', this.jax, '\\text{OOPSIE}'],
|
||||
['Reprocess', this.jax]
|
||||
['Text', this.jax, '\\text{OOPSIE}']
|
||||
);
|
||||
expect($img.css('visibility')).toEqual('hidden');
|
||||
});
|
||||
@@ -349,17 +347,15 @@ describe("Formula Equation Preview", function () {
|
||||
|
||||
this.callbacks[0](this.responses[0]);
|
||||
expect(MathJax.Hub.Queue).toHaveBeenCalledWith(
|
||||
['Text', this.jax, 'THE_FORMULA_0'],
|
||||
['Reprocess', this.jax]
|
||||
['Text', this.jax, 'THE_FORMULA_0']
|
||||
);
|
||||
expect($img.css('visibility')).toEqual('visible');
|
||||
|
||||
this.callbacks[1](this.responses[1]);
|
||||
expect(MathJax.Hub.Queue).toHaveBeenCalledWith(
|
||||
['Text', this.jax, 'THE_FORMULA_1'],
|
||||
['Reprocess', this.jax]
|
||||
['Text', this.jax, 'THE_FORMULA_1']
|
||||
);
|
||||
expect($img.css('visibility')).toEqual('hidden')
|
||||
expect($img.css('visibility')).toEqual('hidden');
|
||||
});
|
||||
|
||||
it("doesn't display outdated information", function () {
|
||||
@@ -370,15 +366,14 @@ describe("Formula Equation Preview", function () {
|
||||
// Switch the order (1 returns before 0)
|
||||
this.callbacks[1](this.responses[1]);
|
||||
expect(MathJax.Hub.Queue).toHaveBeenCalledWith(
|
||||
['Text', this.jax, 'THE_FORMULA_1'],
|
||||
['Reprocess', this.jax]
|
||||
['Text', this.jax, 'THE_FORMULA_1']
|
||||
);
|
||||
expect($img.css('visibility')).toEqual('hidden')
|
||||
expect($img.css('visibility')).toEqual('hidden');
|
||||
|
||||
MathJax.Hub.Queue.reset();
|
||||
this.callbacks[0](this.responses[0]);
|
||||
expect(MathJax.Hub.Queue).not.toHaveBeenCalled();
|
||||
expect($img.css('visibility')).toEqual('hidden')
|
||||
expect($img.css('visibility')).toEqual('hidden');
|
||||
});
|
||||
|
||||
it("doesn't show an error if the responses are close together",
|
||||
@@ -392,8 +387,7 @@ describe("Formula Equation Preview", function () {
|
||||
|
||||
this.callbacks[1](this.responses[1]);
|
||||
expect(MathJax.Hub.Queue).toHaveBeenCalledWith(
|
||||
['Text', this.jax, 'THE_FORMULA_1'],
|
||||
['Reprocess', this.jax]
|
||||
['Text', this.jax, 'THE_FORMULA_1']
|
||||
);
|
||||
|
||||
// Make sure that it doesn't indeed show up later
|
||||
|
||||
@@ -139,8 +139,7 @@ formulaEquationPreview.enable = function () {
|
||||
if (inputData.jax) {
|
||||
// Set the text as the latex code, and then update the MathJax.
|
||||
MathJax.Hub.Queue(
|
||||
['Text', inputData.jax, latex],
|
||||
['Reprocess', inputData.jax]
|
||||
['Text', inputData.jax, latex]
|
||||
);
|
||||
} else if (latex) {
|
||||
console.log("[FormulaEquationInput] Oops no mathjax for ", latex);
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
## mako
|
||||
## File: templates/mathjax_include.html
|
||||
##
|
||||
## Advanced mathjax using 2.0-latest CDN for Dynamic Math
|
||||
##
|
||||
## This enables ASCIIMathJAX, and is used by js_textbox
|
||||
## Note that this file is only used by LMS.
|
||||
## MathJax configuration for Studio lives in
|
||||
## cms/js/require-config.js.
|
||||
|
||||
|
||||
<%page args="disable_fast_preview=True"/>
|
||||
|
||||
%if disable_fast_preview:
|
||||
// Fast Preview was introduced in 2.5. However, it
|
||||
// causes undesirable flashing/font size changes when
|
||||
// MathJax is used for interactive preview (equation editor).
|
||||
// Setting processSectionDelay to 0 (see below) fully eliminates
|
||||
// fast preview, but to reduce confusion, we are also setting
|
||||
// the option as displayed in the context menu to false.
|
||||
// When upgrading to 2.6, check if this variable name changed.
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
menuSettings: {CHTMLpreview: false}
|
||||
};
|
||||
</script>
|
||||
%endif
|
||||
|
||||
%if mathjax_mode is not Undefined and mathjax_mode == 'wiki':
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
@@ -30,7 +47,16 @@
|
||||
</script>
|
||||
%endif
|
||||
<script type="text/x-mathjax-config">
|
||||
window.HUB = MathJax.Hub;
|
||||
|
||||
%if disable_fast_preview:
|
||||
// In order to eliminate all flashing during interactive
|
||||
// preview, it is necessary to set processSectionDelay to 0
|
||||
// (remove delay between input and output phases). This
|
||||
// effectively disables fast preview, regardless of
|
||||
// the fast preview setting as shown in the context menu.
|
||||
MathJax.Hub.processSectionDelay = 0;
|
||||
%endif
|
||||
|
||||
MathJax.Hub.signal.Interest(function(message) {
|
||||
if(message[0] === "End Math") {
|
||||
set_mathjax_display_div_settings();
|
||||
@@ -50,4 +76,4 @@
|
||||
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates.
|
||||
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
|
||||
MathJax extension libraries -->
|
||||
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/2.4-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"></script>
|
||||
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"></script>
|
||||
|
||||
Reference in New Issue
Block a user