How to use the react-mathquill.addStyles function in react-mathquill

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

github JithinKS97 / dynamic-learning / imports / ui / components / workbook / MathQuill.jsx View on Github external
constructor() {
    super();
    addMathquillStyles();
    this.state = {
      latex: '\\frac{1}{\\sqrt{2}}\\cdot 2',
    };
  }
github edtr-io / edtr-io / packages / plugins / text / src / plugins / katex / index.tsx View on Github external
import * as React from 'react'
import { Editor } from 'slate'

import {
  NodeRendererProps,
  NodeEditorProps,
  TextPlugin,
  NodeControlsProps,
  trimSelection
} from '../..'
import { SlatePluginClosure } from '../../factory/types'
import { katexBlockNode, katexInlineNode } from '../../model'
import { DefaultEditorComponent } from './editor'

if (canUseDOM) {
  require('react-mathquill').addStyles()
}

export const isKatex = (editor: Editor) => {
  return (
    editor.value.blocks.some(block =>
      block ? block.type === katexBlockNode : false
    ) ||
    editor.value.inlines.some(inline =>
      inline ? inline.type === katexInlineNode : false
    )
  )
}
export const insertKatex = (editor: Editor) => {
  if (editor.value.selection.isExpanded) {
    trimSelection(editor)
    const selection = document.getSelection()

react-mathquill

React component wrapper for Mathquill

MIT
Latest version published 11 months ago

Package Health Score

55 / 100
Full package analysis

Popular react-mathquill functions

Similar packages