Skip to content

Commit

Permalink
docs: add plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Jun 25, 2023
1 parent 107c4b8 commit d0e1c9b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export default defineConfig({
items: [
{ text: '全局API', link: '/guide/api' }
]
},
{
text: '插件',
items: [
{ text: '自定义插件', link: '/guide/plugin' }
]
}
],
socialLinks: [{
Expand Down
23 changes: 23 additions & 0 deletions docs/guide/plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 自定义插件

::: warning
目前仅支持对编辑器实例进行方法的增加及修改,后续扩展更多功能
:::

## 开发插件

```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)
```

0 comments on commit d0e1c9b

Please sign in to comment.