An open API service indexing awesome lists of open source software.

https://github.com/kelen/wangeditor-plugin-imagesource

wangEditor图片来源
https://github.com/kelen/wangeditor-plugin-imagesource

Last synced: about 1 month ago
JSON representation

wangEditor图片来源

Awesome Lists containing this project

README

        

# wangEditor formula module

[中文文档](./README.md)

## Introduction

[wangEditor](https://www.wangeditor.com/en/) Formula plugin, use `LateX` syntax.

![](./_img/demo.png)

## Installation

```shell
yarn add katex
yarn add @wangeditor/plugin-image-source
```

## Usage

### Register to editor

```js
import { Boot, IEditorConfig, IToolbarConfig } from '@wangeditor/editor'
import formulaModule from '@wangeditor/plugin-image-source'

// Register
// You should register this before create editor, and register only once (not repeatedly).
Boot.registerModule(formulaModule)
```

### Menu config

```js
const editorConfig: Partial = {
// Hoverbar keys when selected a formula node.
hoverbarKeys: {
formula: {
menuKeys: ['editFormula'], // “编辑公式”菜单
},
},

// others...
}

const toolbarConfig: Partial = {
insertKeys: {
index: 0,
keys: [
'insertFormula', // Insert formula menu
// 'editFormula' // Edit formula menu
],
},

// others...
}
```

Then create editor and toolbar, you will use `editorConfig` and `toolbarConfig`

### Render HTML

You will get a formula's HTML format like this

```html

```

Dateset `data-value` is the `LateX` syntax value, you can use a third-party lib to render formula card, like [KateX](https://katex.org/).

## Others

Support i18n.