forked from ejilay/draftjs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
47 lines (41 loc) · 1.43 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package draftjs
// ContentState
// https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftContentState.js
type ContentState struct {
Blocks []*ContentBlock `json:"blocks"`
EntityMap map[string]*Entity `json:"entityMap"`
}
// ContentBlock
// https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftContentBlock.js
type ContentBlock struct {
Key string `json:"key"`
Type string `json:"type"`
Text string `json:"text"`
Depth int `json:"depth"`
InlineStyleRanges []*InlineStyleRange `json:"inlineStyleRanges"`
EntityRanges []*EntityRange `json:"entityRanges"`
Data interface{} `json:"data"`
}
// Entity
// https://github.com/facebook/draft-js/blob/master/src/model/encoding/RawDraftEntity.js
type Entity struct {
Type string `json:"type"`
Mutability string `json:"mutability"`
Data map[string]string `json:"data"`
}
type Range struct {
Offset int `json:"offset"`
Length int `json:"length"`
}
// InlineStyleRange
// https://github.com/facebook/draft-js/blob/master/src/model/encoding/InlineStyleRange.js
type InlineStyleRange struct {
Style string `json:"style"`
Range
}
// EntityRange
// https://github.com/facebook/draft-js/blob/master/src/model/encoding/EntityRange.js
type EntityRange struct {
Key int `json:"key"`
Range
}