1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-08 22:20:41 +02:00

remove marks, in favor of text properties (#3235)

* remove marks, in favor of text properties

* fix lint

* fix more examples

* update docs
This commit is contained in:
Ian Storm Taylor
2019-12-05 11:21:15 -05:00
committed by GitHub
parent 31df397930
commit 4c03b497d9
205 changed files with 792 additions and 4208 deletions

View File

@@ -5,14 +5,13 @@ Slate works with pure JSON objects. All it requires is that those JSON objects c
```ts
interface Text {
text: string
marks: Mark[]
[key: string]: any
}
```
Which means it must have a `text` property with a string of content, and a `marks` property with an array of formatting marks (or an empty array).
Which means it must have a `text` property with a string of content.
But other custom properties are also allowed, and completely up to you. This lets you tailor your data to your specific domain and use case, without Slate getting in the way.
But **any** other custom properties are also allowed, and completely up to you. This lets you tailor your data to your specific domain and use case, adding whatever formatting logic you'd like, without Slate getting in the way.
This interface-based approach separates Slate from most other rich-text editors which require you to work with their hand-rolled "model" classes, and makes it much easier to reason about. It also means that it avoids startup time penalties related to "initializing" the data model.