canvas-editor_fex765/docs/guide/plugin.md

25 lines
559 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 自定义插件
::: tip
1. 目前仅支持对编辑器实例进行方法的增加及修改,后续扩展更多功能
2. 官方维护插件https://github.com/Hufe921/canvas-editor-plugin
:::
## 开发插件
```javascript
export function myPlugin(editor: Editor, options?: Option) {
// 1. 修改方法详见src/plugins/copy
editor.command.updateFunction = () => {}
// 2. 增加方法详见src/plugins/markdown
editor.command.addFunction = () => {}
}
```
## 使用插件
```javascript
instance.add(myPlugin, options?: Option)
```