1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-28 09:29:49 +02:00

add extra code sample to plugins guide

This commit is contained in:
Ian Storm Taylor
2017-10-27 13:11:30 -07:00
parent 8f307b8260
commit 759979f995

View File

@@ -196,7 +196,24 @@ function Bold(options) {
}
```
With things like `changes` and `helpers`, you can define your bold logic in a single place, and allow other parts of your codebase to use the exposed API to keep consistent.
With things like `changes` and `helpers`, you can define your bold logic in a single place, and allow other parts of your codebase to use the exposed API to keep consistent. Then you can use them like so:
```js
const bold = Bold()
const italic = Italic()
...
const plugins = [
...bold.plugins,
...italic.plugins,
...
]
<Editor
plugins={plugins}
...
/>
```
Feature plugins like that are almost always made up of many smaller helper plugins. And they are usually app-specific, so they don't make great open-source candidates.