mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
db518e16aa
Updates mathjax directive to only set config if it is needed. The main config is now set in base.coffee so isn't needed
21 lines
No EOL
550 B
CoffeeScript
21 lines
No EOL
550 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.directive "mathjax", () ->
|
|
return {
|
|
link: (scope, element, attrs) ->
|
|
if attrs.delimiter != 'no-single-dollar'
|
|
inlineMathConfig = MathJax?.Hub?.config?.tex2jax.inlineMath
|
|
alreadyConfigured = _.find inlineMathConfig, (c) ->
|
|
c[0] == '$' and c[1] == '$'
|
|
|
|
if !alreadyConfigured?
|
|
MathJax?.Hub?.Config(
|
|
tex2jax:
|
|
inlineMath: inlineMathConfig.concat([['$', '$']])
|
|
)
|
|
|
|
setTimeout () ->
|
|
MathJax?.Hub?.Queue(["Typeset", MathJax?.Hub, element.get(0)])
|
|
, 0
|
|
} |