uk2459644 / editorjs-mathlive

Math Block Tool for Editor.js, enables writing mathematical expressions in EditorJs Markdown editor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Field Type Description
virtualKeyboardMode string initial mode of virtual keyboard. manual by default
defaultMode string initial editing mode. math by default
smartMode boolean MathEditor mode. false by default
virtualKeyboardTheme string MathEditor keyboard theme. material by default

Config Params Optional values

Field Type Option values
virtualKeyboardMode string manual, auto, onfocus,off
defaultMode string math , inline-math, text
smartMode boolean false, true
virtualKeyboardTheme string material, apple

Output data

This Tool returns data in the following format

Field Type Description
type string Style of math text
latex string Mathematical equation text in latexs
{
  "type" : "math",
  "data" : {
    "type": "cdx-math-info",
    "latex" : "e=mc^2"
  }
}

About

Math Block Tool for Editor.js, enables writing mathematical expressions in EditorJs Markdown editor.

License:MIT License


Languages

Language:JavaScript 85.4%Language:HTML 11.1%Language:CSS 3.6%