1.0.1 • Published 1 year ago

editorjs-mathlive v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

MathEditor tool

The MathEditor Block for the Editor.js.

editorjs-mathlive

Installation

Get the package

npm i --save editorjs-mathlive

or

yarn add editorjs-mathlive

Usage

Add a new Tool to the tools property of the Editor.js initial config.

import MathEditor from 'editorjs-mathlive';

var editor = EditorJS({
  tools: {
    math: MathEditor,
  }
});

Or init the MathEditor tool with additional settings

var editor = EditorJS({
  tools: {
    math: {
      class: MathEditor,
      inlineToolbar: true,
      config: {
        virtualKeyboardMode: 'manual',
        defaultMode: 'math',
        smartMode:false,
        virtualKeyboardTheme:'material',
      },
    },
  },
});

Config Params

FieldTypeDescription
virtualKeyboardModestringinitial mode of virtual keyboard. manual by default
defaultModestringinitial editing mode. math by default
smartModebooleanMathEditor mode. false by default
virtualKeyboardThemestringMathEditor keyboard theme. material by default

Config Params Optional values

FieldTypeOption values
virtualKeyboardModestringmanual, auto, onfocus,off
defaultModestringmath , inline-math, text
smartModebooleanfalse, true
virtualKeyboardThemestringmaterial, apple

Output data

This Tool returns data in the following format

FieldTypeDescription
typestringStyle of math text
latexstringMathematical equation text in latexs
{
  "type" : "math",
  "data" : {
    "type": "cdx-math-info",
    "latex" : "e=mc^2"
  }
}