mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't set config unless needed in directive
Updates mathjax directive to only set config if it is needed. The main config is now set in base.coffee so isn't needed
This commit is contained in:
parent
99e24db075
commit
db518e16aa
1 changed files with 8 additions and 15 deletions
|
@ -4,23 +4,16 @@ define [
|
||||||
App.directive "mathjax", () ->
|
App.directive "mathjax", () ->
|
||||||
return {
|
return {
|
||||||
link: (scope, element, attrs) ->
|
link: (scope, element, attrs) ->
|
||||||
mathjaxConfig =
|
|
||||||
extensions: ["Safe.js"]
|
|
||||||
messageStyle: "none"
|
|
||||||
imageFont:null
|
|
||||||
"HTML-CSS": { availableFonts: ["TeX"] },
|
|
||||||
TeX:
|
|
||||||
equationNumbers: { autoNumber: "AMS" },
|
|
||||||
useLabelIDs: false
|
|
||||||
skipStartupTypeset: true
|
|
||||||
tex2jax:
|
|
||||||
processEscapes: true,
|
|
||||||
inlineMath: [ ["\\(","\\)"] ],
|
|
||||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
|
|
||||||
if attrs.delimiter != 'no-single-dollar'
|
if attrs.delimiter != 'no-single-dollar'
|
||||||
mathjaxConfig.tex2jax.inlineMath.push(['$','$']);
|
inlineMathConfig = MathJax?.Hub?.config?.tex2jax.inlineMath
|
||||||
|
alreadyConfigured = _.find inlineMathConfig, (c) ->
|
||||||
|
c[0] == '$' and c[1] == '$'
|
||||||
|
|
||||||
MathJax?.Hub?.Config(mathjaxConfig);
|
if !alreadyConfigured?
|
||||||
|
MathJax?.Hub?.Config(
|
||||||
|
tex2jax:
|
||||||
|
inlineMath: inlineMathConfig.concat([['$', '$']])
|
||||||
|
)
|
||||||
|
|
||||||
setTimeout () ->
|
setTimeout () ->
|
||||||
MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)])
|
MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)])
|
||||||
|
|
Loading…
Reference in a new issue