1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-02 19:52:32 +02:00

Add some clarifying documentation around Editor schema-specific methods

This commit is contained in:
Sunny Hirai
2021-03-29 00:29:48 -07:00
parent fbb311359b
commit 9caf2e8700

View File

@@ -316,6 +316,20 @@ Call a function, deferring normalization until after it completes.
### Schema-specific methods to override ### 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)` ###### `isInline(element: Element)`
Check if a value is an inline `Element` object. Check if a value is an inline `Element` object.