@crystallize/design-system 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.css +85 -142
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1512 -4409
- package/dist/index.mjs +1376 -4291
- package/package.json +19 -19
- package/src/iconography/document.tsx +19 -0
- package/src/iconography/folder.tsx +30 -0
- package/src/iconography/index.ts +8 -2
- package/src/iconography/product.tsx +42 -0
- package/src/rich-text-editor/model/crystallize-to-lexical.ts +1 -1
- package/src/rich-text-editor/model/lexical-to-crystallize.ts +2 -2
- package/src/rich-text-editor/model/to-text.test.ts +97 -0
- package/src/rich-text-editor/model/to-text.ts +47 -0
- package/src/rich-text-editor/nodes/BaseNodes.ts +0 -3
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/ComponentPickerPlugin/index.tsx +5 -5
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.tsx +29 -50
- package/src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx +34 -23
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +8 -8
- package/src/rich-text-editor/rich-text-editor.css +3 -3
- package/src/rich-text-editor/rich-text-editor.stories.tsx +9 -1
- package/src/rich-text-editor/rich-text-editor.tsx +30 -24
- package/src/rich-text-editor/tests/rich-text-editor-basic-rendering.test.tsx +1 -1
- package/src/rich-text-editor/tests/rich-text-editor-model-basics.test.tsx +1 -1
- package/src/rich-text-editor/tests/rich-text-editor-model-conversions.test.tsx +1 -1
- package/src/rich-text-editor/tests/rich-text-editor-text-formats.test.tsx +1 -1
- package/src/rich-text-editor/themes/{PlaygroundEditorTheme.css → CrystallizeRTEditorTheme.css} +81 -85
- package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.ts +113 -0
- package/dist/draggable-block-menu-KKHDNKJA.svg +0 -1
- package/src/rich-text-editor/appSettings.ts +0 -28
- package/src/rich-text-editor/context/SettingsContext.tsx +0 -71
- package/src/rich-text-editor/context/SharedAutocompleteContext.tsx +0 -60
- package/src/rich-text-editor/nodes/AutocompleteNode.tsx +0 -96
- package/src/rich-text-editor/plugins/AutocompletePlugin/index.tsx +0 -2536
- package/src/rich-text-editor/themes/PlaygroundEditorTheme.ts +0 -113
- /package/src/rich-text-editor/{model → types}/crystallize-rich-text-types/code.ts +0 -0
- /package/src/rich-text-editor/{model → types}/crystallize-rich-text-types/headings.ts +0 -0
- /package/src/rich-text-editor/{model → types}/crystallize-rich-text-types/index.ts +0 -0
- /package/src/rich-text-editor/{model → types}/crystallize-rich-text-types/link.ts +0 -0
- /package/src/rich-text-editor/{model → types}/crystallize-rich-text-types/table.ts +0 -0
- /package/src/rich-text-editor/{types.ts → types/types.ts} +0 -0
package/src/rich-text-editor/themes/{PlaygroundEditorTheme.css → CrystallizeRTEditorTheme.css}
RENAMED
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
.
|
|
9
|
+
.CrystallizeRTEditorTheme__ltr {
|
|
10
10
|
@apply text-left;
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
.CrystallizeRTEditorTheme__rtl {
|
|
13
13
|
@apply text-right;
|
|
14
14
|
}
|
|
15
|
-
.
|
|
15
|
+
.CrystallizeRTEditorTheme__paragraph {
|
|
16
16
|
font-size: 15px;
|
|
17
17
|
@apply relative m-0 mt-2 leading-6 text-gray-600-300;
|
|
18
18
|
}
|
|
19
|
-
.
|
|
19
|
+
.CrystallizeRTEditorTheme__paragraph + .CrystallizeRTEditorTheme__paragraph {
|
|
20
20
|
@apply relative m-0 mt-4;
|
|
21
21
|
}
|
|
22
|
-
.
|
|
22
|
+
.CrystallizeRTEditorTheme__quote {
|
|
23
23
|
font-size: 15px;
|
|
24
24
|
border-left-width: 4px;
|
|
25
25
|
border-left-style: solid;
|
|
@@ -28,59 +28,59 @@
|
|
|
28
28
|
@apply my-6 border-l-purple-700-200 font-normal text-gray-800-100;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.CrystallizeRTEditorTheme__h1 {
|
|
32
32
|
font-size: 20px;
|
|
33
33
|
|
|
34
34
|
@apply m-0 mb-1 mt-2 font-medium leading-6
|
|
35
35
|
text-gray-800-100;
|
|
36
36
|
}
|
|
37
|
-
.
|
|
37
|
+
.CrystallizeRTEditorTheme__h2 {
|
|
38
38
|
font-size: 19px;
|
|
39
39
|
@apply m-0 mb-1 mt-2 text-lg font-medium leading-6 text-gray-800-100;
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.CrystallizeRTEditorTheme__h3 {
|
|
42
42
|
font-size: 18px;
|
|
43
43
|
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
44
44
|
}
|
|
45
|
-
.
|
|
45
|
+
.CrystallizeRTEditorTheme__h4 {
|
|
46
46
|
font-size: 17px;
|
|
47
47
|
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
48
48
|
}
|
|
49
|
-
.
|
|
49
|
+
.CrystallizeRTEditorTheme__h5 {
|
|
50
50
|
font-size: 16px;
|
|
51
51
|
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
52
52
|
}
|
|
53
|
-
.
|
|
53
|
+
.CrystallizeRTEditorTheme__h6 {
|
|
54
54
|
font-size: 16px;
|
|
55
55
|
@apply m-0 mb-1 mt-2 font-medium leading-6 text-gray-800-100;
|
|
56
56
|
}
|
|
57
|
-
.
|
|
57
|
+
.CrystallizeRTEditorTheme__indent {
|
|
58
58
|
--lexical-indent-base-value: 20px;
|
|
59
59
|
}
|
|
60
|
-
.
|
|
60
|
+
.CrystallizeRTEditorTheme__textBold {
|
|
61
61
|
@apply font-bold;
|
|
62
62
|
}
|
|
63
|
-
.
|
|
63
|
+
.CrystallizeRTEditorTheme__textItalic {
|
|
64
64
|
@apply italic;
|
|
65
65
|
}
|
|
66
|
-
.
|
|
66
|
+
.CrystallizeRTEditorTheme__textUnderline {
|
|
67
67
|
@apply underline;
|
|
68
68
|
}
|
|
69
|
-
.
|
|
69
|
+
.CrystallizeRTEditorTheme__textStrikethrough {
|
|
70
70
|
@apply line-through;
|
|
71
71
|
}
|
|
72
|
-
.
|
|
72
|
+
.CrystallizeRTEditorTheme__textUnderlineStrikethrough {
|
|
73
73
|
text-decoration: underline line-through;
|
|
74
74
|
}
|
|
75
|
-
.
|
|
75
|
+
.CrystallizeRTEditorTheme__textSubscript {
|
|
76
76
|
font-size: 0.8em;
|
|
77
77
|
vertical-align: sub !important;
|
|
78
78
|
}
|
|
79
|
-
.
|
|
79
|
+
.CrystallizeRTEditorTheme__textSuperscript {
|
|
80
80
|
font-size: 0.8em;
|
|
81
81
|
vertical-align: super;
|
|
82
82
|
}
|
|
83
|
-
.
|
|
83
|
+
.CrystallizeRTEditorTheme__textCode {
|
|
84
84
|
padding: 2px 0.5rem;
|
|
85
85
|
font-family: Menlo, Consolas, Monaco, monospace;
|
|
86
86
|
font-size: 13px;
|
|
@@ -88,31 +88,27 @@
|
|
|
88
88
|
border-style: solid;
|
|
89
89
|
@apply rounded-md border-gray-100-800 bg-purple-50-900;
|
|
90
90
|
}
|
|
91
|
-
.
|
|
92
|
-
background-color: rgba(88, 144, 255, 0.15);
|
|
93
|
-
border-bottom: 1px solid rgba(88, 144, 255, 0.3);
|
|
94
|
-
}
|
|
95
|
-
.PlaygroundEditorTheme__link {
|
|
91
|
+
.CrystallizeRTEditorTheme__link {
|
|
96
92
|
text-decoration: none;
|
|
97
93
|
box-shadow: #5d96fd 0 -2px inset;
|
|
98
94
|
@apply !text-gray-600-300;
|
|
99
95
|
}
|
|
100
|
-
.
|
|
96
|
+
.CrystallizeRTEditorTheme__link:hover {
|
|
101
97
|
cursor: pointer;
|
|
102
98
|
}
|
|
103
|
-
.
|
|
99
|
+
.CrystallizeRTEditorTheme__code {
|
|
104
100
|
@apply relative my-2 mx-0 block overflow-x-auto rounded-md border border-solid border-gray-100-800 bg-purple-50-900 p-2 pl-14 text-sm leading-5;
|
|
105
101
|
font-family: Menlo, Consolas, Monaco, monospace;
|
|
106
102
|
font-size: 12px;
|
|
107
103
|
tab-size: 2;
|
|
108
104
|
}
|
|
109
|
-
.
|
|
105
|
+
.CrystallizeRTEditorTheme__code:before {
|
|
110
106
|
@apply absolute top-0 left-0 border-0 border-r-[1px] border-solid border-gray-100-800 bg-purple-100-800 p-2 text-right text-gray-400-500;
|
|
111
107
|
content: attr(data-gutter);
|
|
112
108
|
white-space: pre-wrap;
|
|
113
109
|
min-width: 25px;
|
|
114
110
|
}
|
|
115
|
-
.
|
|
111
|
+
.CrystallizeRTEditorTheme__table {
|
|
116
112
|
/* border-collapse: collapse; */
|
|
117
113
|
border-spacing: 0;
|
|
118
114
|
max-width: 100%;
|
|
@@ -126,19 +122,19 @@
|
|
|
126
122
|
@apply rounded-md border-gray-100-800;
|
|
127
123
|
}
|
|
128
124
|
|
|
129
|
-
.
|
|
125
|
+
.CrystallizeRTEditorTheme__tableSelected {
|
|
130
126
|
@apply outline-2 outline-purple-200-700;
|
|
131
127
|
}
|
|
132
|
-
.
|
|
128
|
+
.CrystallizeRTEditorTheme__tableCell {
|
|
133
129
|
@apply relative cursor-default border border-solid border-gray-100-800 px-2 py-0 text-start align-top outline-none;
|
|
134
130
|
min-width: 75px;
|
|
135
131
|
border-width: 0 0 1px 1px;
|
|
136
132
|
}
|
|
137
133
|
|
|
138
|
-
.
|
|
134
|
+
.CrystallizeRTEditorTheme__tableCell .CrystallizeRTEditorTheme__paragraph {
|
|
139
135
|
@apply my-2 text-sm;
|
|
140
136
|
}
|
|
141
|
-
.
|
|
137
|
+
.CrystallizeRTEditorTheme__tableCellSortedIndicator {
|
|
142
138
|
display: block;
|
|
143
139
|
opacity: 0.5;
|
|
144
140
|
position: absolute;
|
|
@@ -148,7 +144,7 @@
|
|
|
148
144
|
height: 4px;
|
|
149
145
|
background-color: #999;
|
|
150
146
|
}
|
|
151
|
-
.
|
|
147
|
+
.CrystallizeRTEditorTheme__tableCellResizer {
|
|
152
148
|
position: absolute;
|
|
153
149
|
right: -4px;
|
|
154
150
|
height: 100%;
|
|
@@ -157,14 +153,14 @@
|
|
|
157
153
|
z-index: 10;
|
|
158
154
|
top: 0;
|
|
159
155
|
}
|
|
160
|
-
.
|
|
156
|
+
.CrystallizeRTEditorTheme__tableCellHeader {
|
|
161
157
|
@apply bg-purple-50-900;
|
|
162
158
|
text-align: start;
|
|
163
159
|
}
|
|
164
|
-
.
|
|
160
|
+
.CrystallizeRTEditorTheme__tableCellSelected {
|
|
165
161
|
background-color: #c9dbf0;
|
|
166
162
|
}
|
|
167
|
-
.
|
|
163
|
+
.CrystallizeRTEditorTheme__tableCellPrimarySelected {
|
|
168
164
|
@apply border-2 border-solid border-purple-200-700;
|
|
169
165
|
|
|
170
166
|
display: block;
|
|
@@ -175,11 +171,11 @@
|
|
|
175
171
|
top: -1px;
|
|
176
172
|
z-index: 2;
|
|
177
173
|
}
|
|
178
|
-
.
|
|
174
|
+
.CrystallizeRTEditorTheme__tableCellEditing {
|
|
179
175
|
@apply shadow-md;
|
|
180
176
|
border-radius: 3px;
|
|
181
177
|
}
|
|
182
|
-
.
|
|
178
|
+
.CrystallizeRTEditorTheme__tableAddColumns {
|
|
183
179
|
position: absolute;
|
|
184
180
|
top: 0;
|
|
185
181
|
width: 20px;
|
|
@@ -191,7 +187,7 @@
|
|
|
191
187
|
border: 1px solid transparent;
|
|
192
188
|
@apply bg-purple-50-900;
|
|
193
189
|
}
|
|
194
|
-
.
|
|
190
|
+
.CrystallizeRTEditorTheme__tableAddColumns:after {
|
|
195
191
|
background-image: url(../images/icons/plus.svg);
|
|
196
192
|
background-size: contain;
|
|
197
193
|
background-position: center;
|
|
@@ -205,10 +201,10 @@
|
|
|
205
201
|
height: 100%;
|
|
206
202
|
opacity: 1;
|
|
207
203
|
}
|
|
208
|
-
.
|
|
204
|
+
.CrystallizeRTEditorTheme__tableAddColumns:hover {
|
|
209
205
|
@apply rounded-sm border-purple-200-700;
|
|
210
206
|
}
|
|
211
|
-
.
|
|
207
|
+
.CrystallizeRTEditorTheme__tableAddRows {
|
|
212
208
|
position: absolute;
|
|
213
209
|
bottom: -25px;
|
|
214
210
|
width: calc(100% - 25px);
|
|
@@ -221,7 +217,7 @@
|
|
|
221
217
|
|
|
222
218
|
@apply bg-purple-50-900;
|
|
223
219
|
}
|
|
224
|
-
.
|
|
220
|
+
.CrystallizeRTEditorTheme__tableAddRows:after {
|
|
225
221
|
background-image: url(../images/icons/plus.svg);
|
|
226
222
|
background-size: contain;
|
|
227
223
|
background-position: center;
|
|
@@ -235,7 +231,7 @@
|
|
|
235
231
|
height: 100%;
|
|
236
232
|
opacity: 1;
|
|
237
233
|
}
|
|
238
|
-
.
|
|
234
|
+
.CrystallizeRTEditorTheme__tableAddRows:hover {
|
|
239
235
|
@apply rounded-sm border-purple-200-700;
|
|
240
236
|
}
|
|
241
237
|
@keyframes table-controls {
|
|
@@ -246,7 +242,7 @@
|
|
|
246
242
|
opacity: 1;
|
|
247
243
|
}
|
|
248
244
|
}
|
|
249
|
-
.
|
|
245
|
+
.CrystallizeRTEditorTheme__tableCellResizeRuler {
|
|
250
246
|
display: block;
|
|
251
247
|
position: absolute;
|
|
252
248
|
width: 1px;
|
|
@@ -254,7 +250,7 @@
|
|
|
254
250
|
height: 100%;
|
|
255
251
|
top: 0;
|
|
256
252
|
}
|
|
257
|
-
.
|
|
253
|
+
.CrystallizeRTEditorTheme__tableCellActionButtonContainer {
|
|
258
254
|
display: block;
|
|
259
255
|
right: 5px;
|
|
260
256
|
top: 6px;
|
|
@@ -263,7 +259,7 @@
|
|
|
263
259
|
width: 20px;
|
|
264
260
|
height: 20px;
|
|
265
261
|
}
|
|
266
|
-
.
|
|
262
|
+
.CrystallizeRTEditorTheme__tableCellActionButton {
|
|
267
263
|
background-color: #eee;
|
|
268
264
|
display: block;
|
|
269
265
|
border: 0;
|
|
@@ -273,52 +269,52 @@
|
|
|
273
269
|
color: #222;
|
|
274
270
|
cursor: pointer;
|
|
275
271
|
}
|
|
276
|
-
.
|
|
272
|
+
.CrystallizeRTEditorTheme__tableCellActionButton:hover {
|
|
277
273
|
background-color: #ddd;
|
|
278
274
|
}
|
|
279
|
-
.
|
|
275
|
+
.CrystallizeRTEditorTheme__characterLimit {
|
|
280
276
|
display: inline;
|
|
281
277
|
background-color: #ffbbbb !important;
|
|
282
278
|
}
|
|
283
|
-
.
|
|
279
|
+
.CrystallizeRTEditorTheme__ol1 {
|
|
284
280
|
padding: 0;
|
|
285
281
|
margin: 0;
|
|
286
282
|
list-style-position: inside;
|
|
287
283
|
}
|
|
288
|
-
.
|
|
284
|
+
.CrystallizeRTEditorTheme__ol2 {
|
|
289
285
|
padding: 0;
|
|
290
286
|
margin: 0;
|
|
291
287
|
list-style-type: upper-alpha;
|
|
292
288
|
list-style-position: inside;
|
|
293
289
|
}
|
|
294
|
-
.
|
|
290
|
+
.CrystallizeRTEditorTheme__ol3 {
|
|
295
291
|
padding: 0;
|
|
296
292
|
margin: 0;
|
|
297
293
|
list-style-type: lower-alpha;
|
|
298
294
|
list-style-position: inside;
|
|
299
295
|
}
|
|
300
|
-
.
|
|
296
|
+
.CrystallizeRTEditorTheme__ol4 {
|
|
301
297
|
padding: 0;
|
|
302
298
|
margin: 0;
|
|
303
299
|
list-style-type: upper-roman;
|
|
304
300
|
list-style-position: inside;
|
|
305
301
|
}
|
|
306
|
-
.
|
|
302
|
+
.CrystallizeRTEditorTheme__ol5 {
|
|
307
303
|
padding: 0;
|
|
308
304
|
margin: 0;
|
|
309
305
|
list-style-type: lower-roman;
|
|
310
306
|
list-style-position: inside;
|
|
311
307
|
}
|
|
312
|
-
.
|
|
308
|
+
.CrystallizeRTEditorTheme__ul {
|
|
313
309
|
padding: 0;
|
|
314
310
|
margin: 0;
|
|
315
311
|
list-style-position: inside;
|
|
316
312
|
}
|
|
317
|
-
.
|
|
313
|
+
.CrystallizeRTEditorTheme__listItem {
|
|
318
314
|
@apply my-0 mx-5 leading-6 text-gray-600-300;
|
|
319
315
|
}
|
|
320
|
-
.
|
|
321
|
-
.
|
|
316
|
+
.CrystallizeRTEditorTheme__listItemChecked,
|
|
317
|
+
.CrystallizeRTEditorTheme__listItemUnchecked {
|
|
322
318
|
position: relative;
|
|
323
319
|
margin-left: 8px;
|
|
324
320
|
margin-right: 8px;
|
|
@@ -327,11 +323,11 @@
|
|
|
327
323
|
list-style-type: none;
|
|
328
324
|
outline: none;
|
|
329
325
|
}
|
|
330
|
-
.
|
|
326
|
+
.CrystallizeRTEditorTheme__listItemChecked {
|
|
331
327
|
text-decoration: line-through;
|
|
332
328
|
}
|
|
333
|
-
.
|
|
334
|
-
.
|
|
329
|
+
.CrystallizeRTEditorTheme__listItemUnchecked:before,
|
|
330
|
+
.CrystallizeRTEditorTheme__listItemChecked:before {
|
|
335
331
|
content: '';
|
|
336
332
|
width: 16px;
|
|
337
333
|
height: 16px;
|
|
@@ -342,27 +338,27 @@
|
|
|
342
338
|
background-size: cover;
|
|
343
339
|
position: absolute;
|
|
344
340
|
}
|
|
345
|
-
.
|
|
346
|
-
.
|
|
341
|
+
.CrystallizeRTEditorTheme__listItemUnchecked[dir='rtl']:before,
|
|
342
|
+
.CrystallizeRTEditorTheme__listItemChecked[dir='rtl']:before {
|
|
347
343
|
left: auto;
|
|
348
344
|
right: 0;
|
|
349
345
|
}
|
|
350
|
-
.
|
|
351
|
-
.
|
|
346
|
+
.CrystallizeRTEditorTheme__listItemUnchecked:focus:before,
|
|
347
|
+
.CrystallizeRTEditorTheme__listItemChecked:focus:before {
|
|
352
348
|
box-shadow: 0 0 0 2px #a6cdfe;
|
|
353
349
|
border-radius: 2px;
|
|
354
350
|
}
|
|
355
|
-
.
|
|
351
|
+
.CrystallizeRTEditorTheme__listItemUnchecked:before {
|
|
356
352
|
border: 1px solid #999;
|
|
357
353
|
border-radius: 2px;
|
|
358
354
|
}
|
|
359
|
-
.
|
|
355
|
+
.CrystallizeRTEditorTheme__listItemChecked:before {
|
|
360
356
|
border: 1px solid rgb(61, 135, 245);
|
|
361
357
|
border-radius: 2px;
|
|
362
358
|
background-color: #3d87f5;
|
|
363
359
|
background-repeat: no-repeat;
|
|
364
360
|
}
|
|
365
|
-
.
|
|
361
|
+
.CrystallizeRTEditorTheme__listItemChecked:after {
|
|
366
362
|
content: '';
|
|
367
363
|
cursor: pointer;
|
|
368
364
|
border-color: #fff;
|
|
@@ -377,57 +373,57 @@
|
|
|
377
373
|
transform: rotate(45deg);
|
|
378
374
|
border-width: 0 2px 2px 0;
|
|
379
375
|
}
|
|
380
|
-
.
|
|
376
|
+
.CrystallizeRTEditorTheme__nestedListItem {
|
|
381
377
|
list-style-type: none;
|
|
382
378
|
}
|
|
383
|
-
.
|
|
384
|
-
.
|
|
379
|
+
.CrystallizeRTEditorTheme__nestedListItem:before,
|
|
380
|
+
.CrystallizeRTEditorTheme__nestedListItem:after {
|
|
385
381
|
display: none;
|
|
386
382
|
}
|
|
387
|
-
.
|
|
383
|
+
.CrystallizeRTEditorTheme__tokenComment {
|
|
388
384
|
color: slategray;
|
|
389
385
|
}
|
|
390
|
-
.
|
|
386
|
+
.CrystallizeRTEditorTheme__tokenPunctuation {
|
|
391
387
|
color: #999;
|
|
392
388
|
}
|
|
393
|
-
.
|
|
389
|
+
.CrystallizeRTEditorTheme__tokenProperty {
|
|
394
390
|
color: #905;
|
|
395
391
|
}
|
|
396
|
-
.
|
|
392
|
+
.CrystallizeRTEditorTheme__tokenSelector {
|
|
397
393
|
color: #690;
|
|
398
394
|
}
|
|
399
|
-
.
|
|
395
|
+
.CrystallizeRTEditorTheme__tokenOperator {
|
|
400
396
|
color: #9a6e3a;
|
|
401
397
|
}
|
|
402
|
-
.
|
|
398
|
+
.CrystallizeRTEditorTheme__tokenAttr {
|
|
403
399
|
color: #07a;
|
|
404
400
|
}
|
|
405
|
-
.
|
|
401
|
+
.CrystallizeRTEditorTheme__tokenVariable {
|
|
406
402
|
color: #e90;
|
|
407
403
|
}
|
|
408
|
-
.
|
|
404
|
+
.CrystallizeRTEditorTheme__tokenFunction {
|
|
409
405
|
color: #dd4a68;
|
|
410
406
|
}
|
|
411
|
-
.
|
|
407
|
+
.CrystallizeRTEditorTheme__mark {
|
|
412
408
|
background: rgba(255, 212, 0, 0.14);
|
|
413
409
|
border-bottom: 2px solid rgba(255, 212, 0, 0.3);
|
|
414
410
|
padding-bottom: 2px;
|
|
415
411
|
}
|
|
416
|
-
.
|
|
412
|
+
.CrystallizeRTEditorTheme__markOverlap {
|
|
417
413
|
background: rgba(255, 212, 0, 0.3);
|
|
418
414
|
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
|
|
419
415
|
}
|
|
420
|
-
.
|
|
416
|
+
.CrystallizeRTEditorTheme__mark.selected {
|
|
421
417
|
background: rgba(255, 212, 0, 0.5);
|
|
422
418
|
border-bottom: 2px solid rgba(255, 212, 0, 1);
|
|
423
419
|
}
|
|
424
|
-
.
|
|
420
|
+
.CrystallizeRTEditorTheme__markOverlap.selected {
|
|
425
421
|
background: rgba(255, 212, 0, 0.7);
|
|
426
422
|
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
|
|
427
423
|
}
|
|
428
|
-
.
|
|
424
|
+
.CrystallizeRTEditorTheme__embedBlock {
|
|
429
425
|
user-select: none;
|
|
430
426
|
}
|
|
431
|
-
.
|
|
427
|
+
.CrystallizeRTEditorTheme__embedBlockFocus {
|
|
432
428
|
outline: 2px solid rgb(60, 132, 244);
|
|
433
429
|
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { EditorThemeClasses } from 'lexical';
|
|
10
|
+
|
|
11
|
+
import './CrystallizeRTEditorTheme.css';
|
|
12
|
+
|
|
13
|
+
const theme: EditorThemeClasses = {
|
|
14
|
+
blockCursor: 'CrystallizeRTEditorTheme__blockCursor',
|
|
15
|
+
characterLimit: 'CrystallizeRTEditorTheme__characterLimit',
|
|
16
|
+
code: 'CrystallizeRTEditorTheme__code',
|
|
17
|
+
codeHighlight: {
|
|
18
|
+
atrule: 'CrystallizeRTEditorTheme__tokenAttr',
|
|
19
|
+
attr: 'CrystallizeRTEditorTheme__tokenAttr',
|
|
20
|
+
boolean: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
21
|
+
builtin: 'CrystallizeRTEditorTheme__tokenSelector',
|
|
22
|
+
cdata: 'CrystallizeRTEditorTheme__tokenComment',
|
|
23
|
+
char: 'CrystallizeRTEditorTheme__tokenSelector',
|
|
24
|
+
class: 'CrystallizeRTEditorTheme__tokenFunction',
|
|
25
|
+
'class-name': 'CrystallizeRTEditorTheme__tokenFunction',
|
|
26
|
+
comment: 'CrystallizeRTEditorTheme__tokenComment',
|
|
27
|
+
constant: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
28
|
+
deleted: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
29
|
+
doctype: 'CrystallizeRTEditorTheme__tokenComment',
|
|
30
|
+
entity: 'CrystallizeRTEditorTheme__tokenOperator',
|
|
31
|
+
function: 'CrystallizeRTEditorTheme__tokenFunction',
|
|
32
|
+
important: 'CrystallizeRTEditorTheme__tokenVariable',
|
|
33
|
+
inserted: 'CrystallizeRTEditorTheme__tokenSelector',
|
|
34
|
+
keyword: 'CrystallizeRTEditorTheme__tokenAttr',
|
|
35
|
+
namespace: 'CrystallizeRTEditorTheme__tokenVariable',
|
|
36
|
+
number: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
37
|
+
operator: 'CrystallizeRTEditorTheme__tokenOperator',
|
|
38
|
+
prolog: 'CrystallizeRTEditorTheme__tokenComment',
|
|
39
|
+
property: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
40
|
+
punctuation: 'CrystallizeRTEditorTheme__tokenPunctuation',
|
|
41
|
+
regex: 'CrystallizeRTEditorTheme__tokenVariable',
|
|
42
|
+
selector: 'CrystallizeRTEditorTheme__tokenSelector',
|
|
43
|
+
string: 'CrystallizeRTEditorTheme__tokenSelector',
|
|
44
|
+
symbol: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
45
|
+
tag: 'CrystallizeRTEditorTheme__tokenProperty',
|
|
46
|
+
url: 'CrystallizeRTEditorTheme__tokenOperator',
|
|
47
|
+
variable: 'CrystallizeRTEditorTheme__tokenVariable',
|
|
48
|
+
},
|
|
49
|
+
embedBlock: {
|
|
50
|
+
base: 'CrystallizeRTEditorTheme__embedBlock',
|
|
51
|
+
focus: 'CrystallizeRTEditorTheme__embedBlockFocus',
|
|
52
|
+
},
|
|
53
|
+
hashtag: 'CrystallizeRTEditorTheme__hashtag',
|
|
54
|
+
heading: {
|
|
55
|
+
h1: 'CrystallizeRTEditorTheme__h1',
|
|
56
|
+
h2: 'CrystallizeRTEditorTheme__h2',
|
|
57
|
+
h3: 'CrystallizeRTEditorTheme__h3',
|
|
58
|
+
h4: 'CrystallizeRTEditorTheme__h4',
|
|
59
|
+
h5: 'CrystallizeRTEditorTheme__h5',
|
|
60
|
+
h6: 'CrystallizeRTEditorTheme__h6',
|
|
61
|
+
},
|
|
62
|
+
image: 'editor-image',
|
|
63
|
+
indent: 'CrystallizeRTEditorTheme__indent',
|
|
64
|
+
link: 'CrystallizeRTEditorTheme__link',
|
|
65
|
+
list: {
|
|
66
|
+
listitem: 'CrystallizeRTEditorTheme__listItem',
|
|
67
|
+
listitemChecked: 'CrystallizeRTEditorTheme__listItemChecked',
|
|
68
|
+
listitemUnchecked: 'CrystallizeRTEditorTheme__listItemUnchecked',
|
|
69
|
+
nested: {
|
|
70
|
+
listitem: 'CrystallizeRTEditorTheme__nestedListItem',
|
|
71
|
+
},
|
|
72
|
+
olDepth: [
|
|
73
|
+
'CrystallizeRTEditorTheme__ol1',
|
|
74
|
+
'CrystallizeRTEditorTheme__ol2',
|
|
75
|
+
'CrystallizeRTEditorTheme__ol3',
|
|
76
|
+
'CrystallizeRTEditorTheme__ol4',
|
|
77
|
+
'CrystallizeRTEditorTheme__ol5',
|
|
78
|
+
],
|
|
79
|
+
ul: 'CrystallizeRTEditorTheme__ul',
|
|
80
|
+
},
|
|
81
|
+
ltr: 'CrystallizeRTEditorTheme__ltr',
|
|
82
|
+
mark: 'CrystallizeRTEditorTheme__mark',
|
|
83
|
+
markOverlap: 'CrystallizeRTEditorTheme__markOverlap',
|
|
84
|
+
paragraph: 'CrystallizeRTEditorTheme__paragraph',
|
|
85
|
+
quote: 'CrystallizeRTEditorTheme__quote',
|
|
86
|
+
rtl: 'CrystallizeRTEditorTheme__rtl',
|
|
87
|
+
table: 'CrystallizeRTEditorTheme__table',
|
|
88
|
+
tableAddColumns: 'CrystallizeRTEditorTheme__tableAddColumns',
|
|
89
|
+
tableAddRows: 'CrystallizeRTEditorTheme__tableAddRows',
|
|
90
|
+
tableCell: 'CrystallizeRTEditorTheme__tableCell',
|
|
91
|
+
tableCellActionButton: 'CrystallizeRTEditorTheme__tableCellActionButton',
|
|
92
|
+
tableCellActionButtonContainer: 'CrystallizeRTEditorTheme__tableCellActionButtonContainer',
|
|
93
|
+
tableCellEditing: 'CrystallizeRTEditorTheme__tableCellEditing',
|
|
94
|
+
tableCellHeader: 'CrystallizeRTEditorTheme__tableCellHeader',
|
|
95
|
+
tableCellPrimarySelected: 'CrystallizeRTEditorTheme__tableCellPrimarySelected',
|
|
96
|
+
tableCellResizer: 'CrystallizeRTEditorTheme__tableCellResizer',
|
|
97
|
+
tableCellSelected: 'CrystallizeRTEditorTheme__tableCellSelected',
|
|
98
|
+
tableCellSortedIndicator: 'CrystallizeRTEditorTheme__tableCellSortedIndicator',
|
|
99
|
+
tableResizeRuler: 'CrystallizeRTEditorTheme__tableCellResizeRuler',
|
|
100
|
+
tableSelected: 'CrystallizeRTEditorTheme__tableSelected',
|
|
101
|
+
text: {
|
|
102
|
+
bold: 'CrystallizeRTEditorTheme__textBold',
|
|
103
|
+
code: 'CrystallizeRTEditorTheme__textCode',
|
|
104
|
+
italic: 'CrystallizeRTEditorTheme__textItalic',
|
|
105
|
+
strikethrough: 'CrystallizeRTEditorTheme__textStrikethrough',
|
|
106
|
+
subscript: 'CrystallizeRTEditorTheme__textSubscript',
|
|
107
|
+
superscript: 'CrystallizeRTEditorTheme__textSuperscript',
|
|
108
|
+
underline: 'CrystallizeRTEditorTheme__textUnderline',
|
|
109
|
+
underlineStrikethrough: 'CrystallizeRTEditorTheme__textUnderlineStrikethrough',
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default theme;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 24 24" fill="currentColor"><path stroke="currentColor" d="M8.5 10a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm0 7a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm7-10a2 2 0 1 0-2-2 2 2 0 0 0 2 2Zm-7-4a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm7 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2Zm0-7a2 2 0 1 0 2 2 2 2 0 0 0-2-2Z"/></svg>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export type SettingName =
|
|
10
|
-
| 'disableBeforeInput'
|
|
11
|
-
| 'measureTypingPerf'
|
|
12
|
-
| 'isCharLimit'
|
|
13
|
-
| 'isMaxLength'
|
|
14
|
-
| 'isCharLimitUtf8'
|
|
15
|
-
| 'isAutocomplete'
|
|
16
|
-
| 'showNestedEditorTreeView';
|
|
17
|
-
|
|
18
|
-
export type Settings = Record<SettingName, boolean>;
|
|
19
|
-
|
|
20
|
-
export const DEFAULT_SETTINGS: Settings = {
|
|
21
|
-
disableBeforeInput: false,
|
|
22
|
-
isAutocomplete: false,
|
|
23
|
-
isCharLimit: false,
|
|
24
|
-
isCharLimitUtf8: false,
|
|
25
|
-
isMaxLength: false,
|
|
26
|
-
measureTypingPerf: false,
|
|
27
|
-
showNestedEditorTreeView: false,
|
|
28
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { SettingName } from '../appSettings';
|
|
10
|
-
|
|
11
|
-
import { createContext, ReactNode, useCallback, useContext, useMemo, useState } from 'react';
|
|
12
|
-
|
|
13
|
-
import { DEFAULT_SETTINGS } from '../appSettings';
|
|
14
|
-
|
|
15
|
-
type SettingsContextShape = {
|
|
16
|
-
setOption: (name: SettingName, value: boolean) => void;
|
|
17
|
-
settings: Record<SettingName, boolean>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const Context: React.Context<SettingsContextShape> = createContext({
|
|
21
|
-
setOption: (name: SettingName, value: boolean) => {
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
|
-
console.log({ name, value });
|
|
24
|
-
return;
|
|
25
|
-
},
|
|
26
|
-
settings: DEFAULT_SETTINGS,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const SettingsContext = ({ children }: { children: ReactNode }): JSX.Element => {
|
|
30
|
-
const [settings, setSettings] = useState(DEFAULT_SETTINGS);
|
|
31
|
-
|
|
32
|
-
const setOption = useCallback((setting: SettingName, value: boolean) => {
|
|
33
|
-
setSettings(options => ({
|
|
34
|
-
...options,
|
|
35
|
-
[setting as string]: value,
|
|
36
|
-
}));
|
|
37
|
-
if (DEFAULT_SETTINGS[setting] === value) {
|
|
38
|
-
setURLParam(setting, null);
|
|
39
|
-
} else {
|
|
40
|
-
setURLParam(setting, value);
|
|
41
|
-
}
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
|
-
const contextValue = useMemo(() => {
|
|
45
|
-
return { setOption, settings };
|
|
46
|
-
}, [setOption, settings]);
|
|
47
|
-
|
|
48
|
-
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const useSettings = (): SettingsContextShape => {
|
|
52
|
-
return useContext(Context);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
function setURLParam(param: SettingName, value: null | boolean) {
|
|
56
|
-
const url = new URL(window.location.href);
|
|
57
|
-
const params = new URLSearchParams(url.search);
|
|
58
|
-
if (value !== null) {
|
|
59
|
-
if (params.has(param)) {
|
|
60
|
-
params.set(param, String(value));
|
|
61
|
-
} else {
|
|
62
|
-
params.append(param, String(value));
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
if (params.has(param)) {
|
|
66
|
-
params.delete(param);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
url.search = params.toString();
|
|
70
|
-
window.history.pushState(null, '', url.toString());
|
|
71
|
-
}
|