-
Notifications
You must be signed in to change notification settings - Fork 3
/
maps.js
83 lines (74 loc) · 1.53 KB
/
maps.js
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const markTypeValuesMap = {
em: ['e'],
strong: ['s'],
link: ['l'],
code: ['c'],
}
const markAttrsKeysMap = {
href: ['h'], // link
title: ['t'], // link
}
const markKeysMap = {
type: ['t', markTypeValuesMap],
attrs: ['a', markAttrsKeysMap],
}
const contentTypeValuesMap = {
doc: ['d'],
paragraph: ['p'],
blockquote: ['b'],
horizontal_rule: ['h_r'],
heading: ['h'],
code_block: ['c_b'],
text: ['t'],
image: ['i'],
hard_break: ['h_b'],
ordered_list: ['o_l'],
bullet_list: ['b_l'],
list_item: ['l_i'],
table: ['ta'],
table_row: ['t_r'],
table_cell: ['t_c'],
}
const contentAttrsKeysMap = {
level: ['l'], // heading
src: ['s'], // image
alt: ['a'], // image
title: ['t'], // image
order: ['o'], // ordered_list
columns: ['c'], // table, table_row
}
const contentKeysMap = {
type: ['t', contentTypeValuesMap],
text: ['te'],
attrs: ['a', contentAttrsKeysMap],
level: ['l'],
marks: ['m', markKeysMap],
}
contentKeysMap.content = ['c', contentKeysMap]
const sliceKeysMap = {
content: ['c', contentKeysMap],
openLeft: ['oL'],
openRight: ['oR'],
}
export const stepKeysMap = {
stepType: ['sT'],
from: ['f'],
to: ['t'],
structure: ['st'],
insert: ['i'],
gapFrom: ['gF'],
gapTo: ['gT'],
slice: ['s', sliceKeysMap],
mark: ['m', markKeysMap],
}
export const selectionKeysMap = {
head: ['h'],
anchor: ['a'],
node: ['n'],
after: ['af'],
}
export const stateKeysMap = {
doc: ['d', contentKeysMap],
selection: ['s', selectionKeysMap],
storedMarks: ['sM', markKeysMap],
}