mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-02 11:42:53 +02:00
Add some clarifying documentation around Editor schema-specific methods
This commit is contained in:
@@ -316,6 +316,20 @@ Call a function, deferring normalization until after it completes.
|
||||
|
||||
### Schema-specific methods to override
|
||||
|
||||
These methods can and should be replaced to modify the original behavior of the editor which is a part of building [Plugins](/concepts/07-plugins). When you modify behavior, call the original method where appropriate. For example, a plugin that marks image nodes as "void":
|
||||
|
||||
```js
|
||||
const withImages = editor => {
|
||||
const { isVoid } = editor
|
||||
|
||||
editor.isVoid = element => {
|
||||
return element.type === 'image' ? true : isVoid(element)
|
||||
}
|
||||
|
||||
return editor
|
||||
}
|
||||
```
|
||||
|
||||
###### `isInline(element: Element)`
|
||||
|
||||
Check if a value is an inline `Element` object.
|
||||
|
Reference in New Issue
Block a user