# yt-simplemde-editor

> React SimpleMDE Markdown Editor

Latest version **3.2.2** (published 2020-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install yt-simplemde-editor
pnpm add yt-simplemde-editor
yarn add yt-simplemde-editor
bun add yt-simplemde-editor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.2 |
| Published | 2020-10-24 |
| First published | 2018-09-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 43.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 17 |
| Author | yanthink |
| Maintainers | yanthink |
| Keywords | react, markdown, markdown-editor, simplemde-editor, emoji |

## Links

- npm: https://www.npmjs.com/package/yt-simplemde-editor
- Repository: https://github.com/yanthink/react-simplemde-editor
- Homepage: https://github.com/yanthink/react-simplemde-editor#readme
- Issues: https://github.com/yanthink/react-simplemde-editor/issues
- npm.io page: https://npm.io/package/yt-simplemde-editor

## Dependencies (8)

- [react](https://npm.io/package/react.md) ^16.8.6
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [react-dom](https://npm.io/package/react-dom.md) ^16.8.6
- [simplemde](https://npm.io/package/simplemde.md) ^1.11.2
- [textcomplete](https://npm.io/package/textcomplete.md) ^0.17.1
- [emoji-toolkit](https://npm.io/package/emoji-toolkit.md) ^5.0.3
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^2.0.0
- [textcomplete.codemirror](https://npm.io/package/textcomplete.codemirror.md) ^0.2.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.2.2 (latest) — 2020-10-24
- 3.2.1 — 2019-10-12
- 3.2.0 — 2019-09-18
- 3.1.2 — 2019-08-13
- 3.1.1 — 2019-07-31
- 3.1.0 — 2019-07-31
- 3.0.2 — 2019-07-16
- 3.0.1 — 2019-07-16
- 3.0.0 — 2019-07-15
- 2.0.0 — 2019-07-13
- 1.0.1 — 2018-09-18
- 1.0.0 — 2018-09-06

## README

## React SimpleMDE Markdown Editor

### 演示地址
https://www.einsition.com/demos/yt-simplemde-editor

### 更新日志

[CHANGELOG.md](CHANGELOG.md)

### 特性

* 支持粘贴和拖拽上传图片。
* 支持自定义预览渲染
* 支持emoji表情

### 安装

```
npm install -S yt-simplemde-editor
```


### 使用

您可以在 [demo](demo/src/pages/index.js) 中查看基本用法。

### Demo

```
git clone https://github.com/yanthink/react-simplemde-editor
cd react-simplemde-editor
npm install
npm run build
npm link

cd demo
npm install
npm link yt-simplemde-editor
npm start
```

### API

| 参数 | 说明 | 类型 | 默认值	 |
| --- | --- | --- | --- |
| id | 编辑器id | string |  - |
| className | 根元素的类名称 | string | - |
| label | label | string | - |
| uploadOptions | 上传附件参数 | [UploadOptions](#UploadOptions) | - |
| theme | 主题设置 | string | - |
| getMdeInstance | 获取编辑器实例方法 | simplemde => void | - |
| extraKeys | 快捷键设置，详见 [extraKeys](https://codemirror.net/doc/manual.html#option_extraKeys) | object | - |
| value | 初始化内容 | string | - |
| onChange | 内容发生改变时触发 | value => void | - |
| options | [SimpleMDE选项](https://github.com/sparksuite/simplemde-markdown-editor#configuration) | object | - |
| emoji | emoji参数 | [Emoji](#Emoji) | - |

### UploadOptions
| 参数 | 说明 | 类型 | 默认值	 |
| --- | --- | --- | --- |
| action | 上传的地址 | string | 无 |
| name | 发到后台的文件参数名 | string | file |
| jsonName | 后台响应的文件地址名称 | string | fileUrl |
| allowedTypes | 接受上传的文件类型 | string &#x7C; array | image/* |
| progressText | 上传中显示内容 | string | &#x21;&#x5B;Uploading file...&#x5D;() |
| data | 上传所需参数 | object &#x7C; file => object | - |
| headers | 设置上传的请求头部 | object | - |
| withCredentials | 上传请求时是否携带 cookie | boolean | false |
| beforeUpload | 上传文件之前的钩子，参数为上传的文件，若返回 false 则停止上传 | (file) => boolean &#x7C; Promise | - |
| onSuccess | 上传成功事件 | (response, file) => any | - |
| onError | 上传失败事件 | (err, response, file) => any | - |


### Emoji
| 参数 | 说明 | 类型 | 默认值	 |
| --- | --- | --- | --- |
| enabled | 是否开启 | boolean | false |
| autoComplete | 是否开启 [shortname](https://www.einsition.com/tools/emoji-cheat-sheet) 自动补全 | boolean | false |
| insertConvertTo | 插值转换，可选值 `shortname`，`unicode` | string | shortname |
| emojiToolkit | [emoji-toolkit配置](https://github.com/joypixels/emoji-toolkit/blob/master/USAGE.md) | object |  - |
| categories | [类别设置](https://github.com/yanthink/react-emoji-picker#api) | { [key: string]: { title: string; emoji: string; } } | [defaultCategories](#defaultCategories) |


### defaultCategories
```json
const defaultCategories: CategoriesType = {
  recent: {
    title: '常用',
    emoji: 'clock3',
  },
  people: {
    title: '表情符号与人物',
    emoji: 'smile',
  },
  nature: {
    title: '动物与自然',
    emoji: 'hamster',
  },
  food: {
    title: '食物与饮料',
    emoji: 'pizza',
  },
  activity: {
    title: '活动',
    emoji: 'soccer',
  },
  travel: {
    title: '旅行与地点',
    emoji: 'earth_americas',
  },
  objects: {
    title: '物体',
    emoji: 'bulb',
  },
  symbols: {
    title: '符号',
    emoji: 'symbols',
  },
  flags: {
    title: '旗帜',
    emoji: 'flag_cn',
  },
};
```

---
_Source: https://npm.io/package/yt-simplemde-editor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
