Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3382a955
Commit
3382a955
authored
Oct 29, 2015
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10378 from edx/christina/fix-mathjax-preview
Disable Fast Preview for version 2.5.
parents
55d1fb98
deb4e35f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
28 deletions
+69
-28
cms/static/cms/js/require-config.js
+20
-1
cms/static/coffee/spec/main.coffee
+1
-1
cms/static/coffee/spec/main_squire.coffee
+1
-1
common/static/js/capa/spec/formula_equation_preview_spec.js
+9
-15
common/static/js/capa/src/formula_equation_preview.js
+1
-2
common/templates/mathjax_include.html
+31
-5
lms/static/js/spec/main.js
+1
-1
lms/templates/discussion/_js_body_dependencies.html
+3
-1
lms/templates/discussion/index.html
+2
-1
No files found.
cms/static/cms/js/require-config.js
View file @
3382a955
if
(
window
)
{
// MathJax 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.
window
.
MathJax
=
{
menuSettings
:
{
CHTMLpreview
:
false
}
};
}
require
.
config
({
// NOTE: baseUrl has been previously set in cms/static/templates/base.html
waitSeconds
:
60
,
...
...
@@ -70,7 +83,7 @@ require.config({
// end of Annotation tool files
// externally hosted files
"mathjax"
:
"//cdn.mathjax.org/mathjax/2.
4
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured"
,
"mathjax"
:
"//cdn.mathjax.org/mathjax/2.
5
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured"
,
"youtube"
:
[
// youtube URL does not end in ".js". We add "?noext" to the path so
// that require.js adds the ".js" to the query component of the URL,
...
...
@@ -191,6 +204,12 @@ require.config({
]
}
});
// 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
;
MathJax
.
Hub
.
Configured
();
}
},
...
...
cms/static/coffee/spec/main.coffee
View file @
3382a955
...
...
@@ -51,7 +51,7 @@ requirejs.config({
"URI"
:
"xmodule_js/common_static/js/vendor/URI.min"
,
"mock-ajax"
:
"xmodule_js/common_static/js/vendor/mock-ajax"
,
"mathjax"
:
"//cdn.mathjax.org/mathjax/2.
4
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured"
,
"mathjax"
:
"//cdn.mathjax.org/mathjax/2.
5
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured"
,
"youtube"
:
"//www.youtube.com/player_api?noext"
,
"coffee/src/ajax_prefix"
:
"xmodule_js/common_static/coffee/src/ajax_prefix"
,
...
...
cms/static/coffee/spec/main_squire.coffee
View file @
3382a955
...
...
@@ -42,7 +42,7 @@ requirejs.config({
"domReady"
:
"xmodule_js/common_static/js/vendor/domReady"
,
"URI"
:
"xmodule_js/common_static/js/vendor/URI.min"
,
"mathjax"
:
"//cdn.mathjax.org/mathjax/2.
4
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured"
,
"mathjax"
:
"//cdn.mathjax.org/mathjax/2.
5
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured"
,
"youtube"
:
"//www.youtube.com/player_api?noext"
,
"coffee/src/ajax_prefix"
:
"xmodule_js/common_static/coffee/src/ajax_prefix"
...
...
common/static/js/capa/spec/formula_equation_preview_spec.js
View file @
3382a955
...
...
@@ -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
...
...
common/static/js/capa/src/formula_equation_preview.js
View file @
3382a955
...
...
@@ -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
);
...
...
common/templates/mathjax_include.html
View file @
3382a955
## 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"
>
...
...
@@ -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>
lms/static/js/spec/main.js
View file @
3382a955
...
...
@@ -49,7 +49,7 @@
'jasmine.async'
:
'xmodule_js/common_static/js/vendor/jasmine.async'
,
'draggabilly'
:
'xmodule_js/common_static/js/vendor/draggabilly.pkgd'
,
'domReady'
:
'xmodule_js/common_static/js/vendor/domReady'
,
'mathjax'
:
'//cdn.mathjax.org/mathjax/2.
4
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured'
,
// jshint ignore:line
'mathjax'
:
'//cdn.mathjax.org/mathjax/2.
5
-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full&delayStartupUntil=configured'
,
// jshint ignore:line
'youtube'
:
'//www.youtube.com/player_api?noext'
,
'coffee/src/ajax_prefix'
:
'xmodule_js/common_static/coffee/src/ajax_prefix'
,
'coffee/src/instructor_dashboard/student_admin'
:
'coffee/src/instructor_dashboard/student_admin'
,
...
...
lms/templates/discussion/_js_body_dependencies.html
View file @
3382a955
<
%
include
file=
"/mathjax_include.html"
/>
<
%
page
args=
"disable_fast_preview=True"
/>
<
%
include
file=
"/mathjax_include.html"
args=
"disable_fast_preview=disable_fast_preview"
/>
lms/templates/discussion/index.html
View file @
3382a955
...
...
@@ -18,7 +18,8 @@ from django.core.urlresolvers import reverse
</
%
block>
<
%
block
name=
"js_extra"
>
<
%
include
file=
"_js_body_dependencies.html"
/>
## Enable fast preview to fix discussion MathJax rendering bug when page first loads.
<
%
include
file=
"_js_body_dependencies.html"
args=
"disable_fast_preview=False"
/>
<
%
static:js
group=
'discussion'
/>
</
%
block>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment