How to use @digabi/mathquill - 1 common examples

To help you get started, we’ve selected a few @digabi/mathquill examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github digabi / rich-text-editor / src / math-editor.js View on Github external
$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: {

@digabi/mathquill

Easily type math in your webapp

MPL-2.0
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Popular @digabi/mathquill functions

Similar packages