Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$outerPlaceholder,
focus,
baseUrl,
updateMathImg = ($img, latex) => {
const trimmed = trimLatex(latex)
$img.prop({
src: baseUrl + '/math.svg?latex=' + encodeURIComponent(trimmed),
alt: trimmed
})
$img.closest('[data-js="answer"]').trigger('input')
}
) {
let updateMathImgTimeout
if (firstTime) {
MQ = MathQuill.getInterface(2)
}
const $mathEditorContainer = $(`
<div data-js="mathEditor" class="math-editor">
<div data-js="equationField" class="math-editor-equation-field"></div>
<textarea placeholder="LaTeΧ" data-js="latexField" class="math-editor-latex-field" rows="1"></textarea>
</div>`)
$outerPlaceholder.append($mathEditorContainer)
const $latexField = $mathEditorContainer.find('[data-js="latexField"]')
const $equationField = $mathEditorContainer.find('[data-js="equationField"]')
let mqEditTimeout
let visible = false
let focusChanged = null
//noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
const mqInstance = MQ.MathField($equationField.get(0), {
handlers: {