You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

quill-editor-math

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quill-editor-math

React Quill with math formula

0.2.0
latest
Source
npmnpm
Version published
Weekly downloads
74
-3.9%
Maintainers
1
Weekly downloads
 
Created
Source

quill-editor-math

Rich text editor with react quill, mathquill4quill, katex, and image resizer. you can use formula with this. 👌🏻

NPM JavaScript Style Guide

Demo

Stackblitz

Install

npm install --save quill-editor-math

or

yarn add quill-editor-math

Usage

React

import React, { Component } from 'react'

import Editor from 'quill-editor-math'
import 'quill-editor-math/dist/index.css'

class Example extends Component {
  render() {
    return <Editor initialValue='Hello World!' />
  }
}

NextJS

import dynamic from 'next/dynamic';
import 'quill-editor-math/dist/index.css';

const Editor = dynamic(() => import('quill-editor-math')
.then((mod) => mod.default), {
    ssr: false,
    loading: () => <p>Editor loading ...</p>,
  }
);

export default function Example() {
  return (
   <Editor initialValue='Hello World!' />
  );
}

If you want to reset field of this text editor, you can try this 👇

import { useState } from 'react';
import dynamic from 'next/dynamic';
import 'quill-editor-math/dist/index.css';

const Editor = dynamic(() => import('quill-editor-math')
.then((mod) => mod.default), {
    ssr: false,
    loading: () => <p>Editor loading ...</p>,
  }
);

export default function Example() {
  const [resetField, setResetField] = useState(false);

  return (
   <>
        <button onClick={() => setResetField(true)}>Reset Field</button>
        <Editor initialValue='Hello World!' resetField={resetField} setResetField={setResetField} />
   </>
  );
}

API

PropertyDescriptionTypeDefault
initialValuethe initial value to be inserted into the text editorString""
onChangeCallback when user inputfunction(value, delta, source, editor)false
onBlurCalled when leaving the componentfunction(previousSelection, source, editor)false
placeholderThe placeholder of inputString-
styleHTML CSS styleReact.CSSProperties-
themeQuill Editor themesString - "bubble | snow""snow"
customOperatorOperator that will appear in the equation, you can write latex formula.array[['\pm', '\pm'], ['\sqrt{x}', '\sqrt']]
toolbarQuill Toolbar Options, you can read more here: https://quilljs.com/docs/modules/toolbar/#toolbar-modulearray-
resetFieldvariable state for reset field of the text editorbooleanfalse
setResetFieldif you pass 'resetField' into props, you have to pass 'setResetField' too, it will set back resetField into falseReact.Dispatch<React.SetStateAction>-

License

MIT © vieyama

FAQs

Package last updated on 07 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts