Revert "Fix equation image resize for quizzes"
This reverts commit 14544ba024
.
Reason for revert: This change removes mathjax typesetting, reverting to image equations.
Change-Id: I7d5e7d8357ff94720181dd4e0b08750abb27e7ce
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284105
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Dustin Cowles <dustin.cowles@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jon Scheiding <jon.scheiding@instructure.com>
Product-Review: Jon Scheiding <jon.scheiding@instructure.com>
This commit is contained in:
parent
4857022ef0
commit
156dcb0811
|
@ -253,6 +253,19 @@ const mathImageHelper = {
|
|||
if (eqimgs.length > 0) {
|
||||
eqimgs.forEach(img => {
|
||||
const equation_text = this.getImageEquationText(img)
|
||||
if (equation_text) {
|
||||
img.setAttribute('mathjaxified', '')
|
||||
const mathtex = document.createElement('span')
|
||||
mathtex.setAttribute('class', 'math_equation_latex')
|
||||
mathtex.setAttribute('style', img.getAttribute('style'))
|
||||
mathtex.textContent = `\\(${equation_text}\\)`
|
||||
mathtex.style.maxWidth = ''
|
||||
if (img.nextSibling) {
|
||||
img.parentElement.insertBefore(mathtex, img.nextSibling)
|
||||
} else {
|
||||
img.parentElement.appendChild(mathtex)
|
||||
}
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -245,7 +245,8 @@ test('catchEquationImages processes equation images', () => {
|
|||
>
|
||||
`
|
||||
mathImageHelper.catchEquationImages(root)
|
||||
equal(document.querySelectorAll('img[mathjaxified]').length, 0)
|
||||
equal(document.querySelectorAll('img[mathjaxified]').length, 1)
|
||||
equal(document.querySelector('.math_equation_latex').textContent, '\\(17\\)')
|
||||
})
|
||||
|
||||
test('removeStrayEquationImages only removes tagged images', () => {
|
||||
|
|
Loading…
Reference in New Issue