mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
3912de589f
Use production `web` dependencies for development GitOrigin-RevId: e89942d1a24c32bf60b319932c6d74905db74a19
32 lines
946 B
TypeScript
32 lines
946 B
TypeScript
const MATHJAX_STUB = `
|
|
window.MathJax = {
|
|
startup: {
|
|
promise: Promise.resolve()
|
|
},
|
|
svgStylesheet: () => document.createElement("STYLE"),
|
|
typesetPromise: (elements) => {
|
|
for (const element of elements) {
|
|
// This will keep math delimeters around the text
|
|
element.classList.add('MathJax')
|
|
}
|
|
return Promise.resolve()
|
|
},
|
|
tex2svgPromise: (content) => {
|
|
const text = document.createElement('SPAN')
|
|
text.classList.add('MathJax')
|
|
text.innerText = content
|
|
return Promise.resolve(text)
|
|
},
|
|
getMetricsFor: () => ({}),
|
|
texReset: () => {},
|
|
}
|
|
`
|
|
|
|
export const interceptMathJax = () => {
|
|
// NOTE: this is just a URL to be intercepted with the stub, not the real (versioned) MathJax URL
|
|
const url = '/js/libs/mathjax-3/es5/tex-svg-full.js'
|
|
cy.window().then(win => {
|
|
win.metaAttributesCache.set('ol-mathJax3Path', url)
|
|
})
|
|
cy.intercept('GET', url, MATHJAX_STUB).as('mathjax-load-request')
|
|
}
|