-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtypes.go
More file actions
66 lines (55 loc) · 1.6 KB
/
types.go
File metadata and controls
66 lines (55 loc) · 1.6 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package goeditorjs
import (
"encoding/json"
"errors"
)
// editorJS rpresents the Editor JS data
type editorJS struct {
Blocks []EditorJSBlock `json:"blocks"`
}
// EditorJSBlock type
type EditorJSBlock struct {
Type string `json:"type"`
// Data is the Data for an editorJS block in the form of RawMessage ([]byte). It is left up to the Handler to parse the Data field
Data json.RawMessage `json:"data"`
}
var (
//ErrBlockHandlerNotFound is returned from GenerateHTML when the HTML engine doesn't have a registered handler
//for that type and the HTMLEngine is set to return on errors.
ErrBlockHandlerNotFound = errors.New("Handler not found for block type")
)
// header represents header data from EditorJS
type header struct {
Text string `json:"text"`
Level int `json:"level"`
}
// paragraph represents paragraph data from EditorJS
type paragraph struct {
Text string `json:"text"`
Alignment string `json:"alignment"`
}
// list represents list data from EditorJS
type list struct {
Style string `json:"style"`
Items []string `json:"items"`
}
// codeBox represents code box data from EditorJS
type codeBox struct {
Code string `json:"code"`
Language string `json:"language"`
}
// raw represents raw html data from EditorJS
type raw struct {
HTML string `json:"html"`
}
// image represents image data from EditorJS
type image struct {
File file `json:"file"`
Caption string `json:"caption"`
WithBorder bool `json:"withBorder"`
WithBackground bool `json:"withBackground"`
Stretched bool `json:"stretched"`
}
type file struct {
URL string `json:"url"`
}