1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-20 07:04:39 +01:00

docs: Add descriptions and links to describe void/inline and void/not void elements in API

This commit is contained in:
Sunny Hirai 2021-05-25 18:44:12 -07:00
parent 29051c8fc0
commit ffbb92f28a

View File

@ -1,6 +1,15 @@
# Element
`Element` objects are a type of node in a Slate document that contain other `Element` nodes or `Text` nodes. They can be either "blocks" or "inlines" depending on the Slate editor's configuration.
`Element` objects are a type of node in a Slate document that contain other `Element` nodes or `Text` nodes.
Element nodes behave differently depending on the [Slate editor's configuration](./editor.md#schema-specific-instance-methods-to-override). An element can be:
- "block" or "inline" as defined by `editor.isInline`
- either "void" or "not void" as defined by `editor.isVoid`
A "block" element can only be siblings with other "block" elements. AN "inline" node can be siblings with `Text` nodes or other "inline" elements.
In a not "void" element, Slate handles the rendering of its `children` (e.g. in a paragraph where the `Text` and `Inline` children are rendered by Slate). In a "void" element, the `children` are rendered by the `Element`s render code.
```typescript
interface Element {