-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy patheditorConfig.ts
More file actions
150 lines (141 loc) · 3.04 KB
/
Copy patheditorConfig.ts
File metadata and controls
150 lines (141 loc) · 3.04 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import type {
EnrichedTextHtmlStyle,
HtmlStyle,
OnChangeStateEvent,
} from 'react-native-enriched-html';
export type StylesState = OnChangeStateEvent;
export const DEFAULT_STYLE_STATE = {
isActive: false,
isConflicting: false,
isBlocking: false,
};
export const DEFAULT_STYLES: StylesState = {
bold: DEFAULT_STYLE_STATE,
italic: DEFAULT_STYLE_STATE,
underline: DEFAULT_STYLE_STATE,
strikeThrough: DEFAULT_STYLE_STATE,
inlineCode: DEFAULT_STYLE_STATE,
h1: DEFAULT_STYLE_STATE,
h2: DEFAULT_STYLE_STATE,
h3: DEFAULT_STYLE_STATE,
h4: DEFAULT_STYLE_STATE,
h5: DEFAULT_STYLE_STATE,
h6: DEFAULT_STYLE_STATE,
blockQuote: DEFAULT_STYLE_STATE,
codeBlock: DEFAULT_STYLE_STATE,
orderedList: DEFAULT_STYLE_STATE,
unorderedList: DEFAULT_STYLE_STATE,
link: DEFAULT_STYLE_STATE,
image: DEFAULT_STYLE_STATE,
mention: DEFAULT_STYLE_STATE,
checkboxList: DEFAULT_STYLE_STATE,
alignment: 'auto',
};
export const DEFAULT_LINK_STATE = {
text: '',
url: '',
start: 0,
end: 0,
};
export const LINK_REGEX =
/^(?:enriched:\/\/\S+|(?:https?:\/\/)?(?:www\.)?swmansion\.com(?:\/\S*)?)$/i;
export const DEBUG_SCROLLABLE = false;
// Enabling this prop fixes input flickering while auto growing.
// However, it's still experimental and not tested well.
// Disabled for now, as it's causing some strange issues.
// See: https://github.com/software-mansion/react-native-enriched-html/issues/229
export const ANDROID_EXPERIMENTAL_SYNCHRONOUS_EVENTS = false;
export const htmlStyle = {
h1: {
fontSize: 72,
bold: true,
},
h2: {
fontSize: 60,
bold: true,
},
h3: {
fontSize: 50,
bold: true,
},
h4: {
fontSize: 40,
bold: true,
},
h5: {
fontSize: 30,
bold: true,
},
h6: {
fontSize: 24,
bold: true,
},
blockquote: {
borderColor: 'navy',
borderWidth: 4,
gapWidth: 16,
color: 'navy',
},
codeblock: {
color: 'green',
borderRadius: 8,
backgroundColor: 'grey',
},
code: {
color: 'purple',
backgroundColor: 'yellow',
},
a: {
color: 'green',
textDecorationLine: 'underline',
},
mention: {
'#': {
color: 'blue',
backgroundColor: 'lightblue',
textDecorationLine: 'underline',
},
'@': {
color: 'green',
backgroundColor: 'lightgreen',
textDecorationLine: 'none',
},
},
ol: {
gapWidth: 16,
marginLeft: 16,
markerColor: 'navy',
markerFontWeight: 'bold',
},
ul: {
bulletColor: 'aquamarine',
bulletSize: 8,
marginLeft: 24,
gapWidth: 16,
},
ulCheckbox: {
boxSize: 24,
gapWidth: 16,
marginLeft: 24,
boxColor: 'rgb(0, 26, 114)',
},
} satisfies HtmlStyle;
export const enrichedTextHtmlStyle: EnrichedTextHtmlStyle = {
...htmlStyle,
a: {
...htmlStyle.a,
pressColor: 'darkgreen',
},
mention: {
'#': {
...htmlStyle.mention['#'],
pressColor: 'darkgreen',
pressBackgroundColor: 'lightgreen',
},
'@': {
...htmlStyle.mention['@'],
pressColor: 'darkblue',
pressBackgroundColor: 'blue',
},
},
};