@eventuras/scribo 0.8.2 → 0.8.3
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 +6 -0
- package/package.json +9 -8
- package/src/MarkdownEditor.css +91 -2
- package/src/MarkdownEditor.tsx +10 -6
- package/src/themes/EditorTheme.css +77 -61
- package/src/themes/EditorTheme.ts +85 -85
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventuras/scribo",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/losol/eventuras.git",
|
|
@@ -39,26 +39,27 @@
|
|
|
39
39
|
"@lexical/table": "0.35.0",
|
|
40
40
|
"@lexical/utils": "0.35.0",
|
|
41
41
|
"lexical": "0.35.0",
|
|
42
|
-
"prismjs": "^1.30.0"
|
|
42
|
+
"prismjs": "^1.30.0",
|
|
43
|
+
"yjs": "^13.6.29"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@eventuras/eslint-config": "workspace:*",
|
|
46
47
|
"@eventuras/typescript-config": "workspace:*",
|
|
47
48
|
"@eventuras/vite-config": "workspace:*",
|
|
48
|
-
"@testing-library/react": "^16.3.
|
|
49
|
-
"@types/react": "^19.2.
|
|
49
|
+
"@testing-library/react": "^16.3.2",
|
|
50
|
+
"@types/react": "^19.2.9",
|
|
50
51
|
"@types/react-dom": "^19.2.3",
|
|
51
52
|
"@vitejs/plugin-react": "^5.1.2",
|
|
52
|
-
"lightningcss": "^1.
|
|
53
|
+
"lightningcss": "^1.31.1",
|
|
53
54
|
"typescript": "^5.9.3",
|
|
54
|
-
"vite": "^7.3.
|
|
55
|
-
"vitest": "^4.0.
|
|
55
|
+
"vite": "^7.3.1",
|
|
56
|
+
"vitest": "^4.0.18"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"react": "^19.2.3",
|
|
59
60
|
"react-dom": "^19.2.3"
|
|
60
61
|
},
|
|
61
|
-
"packageManager": "pnpm@10.
|
|
62
|
+
"packageManager": "pnpm@10.28.1",
|
|
62
63
|
"engines": {
|
|
63
64
|
"node": ">=22.0.0 <25.0.0"
|
|
64
65
|
}
|
package/src/MarkdownEditor.css
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
*
|
|
3
|
+
* Modified from the work of Meta Platforms, Inc. and affiliates
|
|
4
|
+
*
|
|
2
5
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
6
|
*
|
|
4
7
|
* This source code is licensed under the MIT license found in the
|
|
@@ -17,6 +20,10 @@
|
|
|
17
20
|
font-weight: 400;
|
|
18
21
|
}
|
|
19
22
|
|
|
23
|
+
[data-theme="dark"] .editor-shell {
|
|
24
|
+
color: #e5e5e5;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
.editor-shell .editor-container {
|
|
21
28
|
background: #fff;
|
|
22
29
|
position: relative;
|
|
@@ -25,6 +32,10 @@
|
|
|
25
32
|
border-bottom-right-radius: 10px;
|
|
26
33
|
}
|
|
27
34
|
|
|
35
|
+
[data-theme="dark"] .editor-shell .editor-container {
|
|
36
|
+
background: rgba(255, 255, 255, 0.05);
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
.editor-shell .editor-container.tree-view {
|
|
29
40
|
border-radius: 0;
|
|
30
41
|
}
|
|
@@ -101,6 +112,10 @@
|
|
|
101
112
|
border-left: 3px solid #ddd;
|
|
102
113
|
}
|
|
103
114
|
|
|
115
|
+
[data-theme="dark"] .editor blockquote {
|
|
116
|
+
border-left-color: #555;
|
|
117
|
+
}
|
|
118
|
+
|
|
104
119
|
ul {
|
|
105
120
|
list-style-type: disc;
|
|
106
121
|
padding: 10px 0 !important;
|
|
@@ -188,6 +203,11 @@ i.redo {
|
|
|
188
203
|
background-color: rgb(223, 232, 250);
|
|
189
204
|
}
|
|
190
205
|
|
|
206
|
+
[data-theme="dark"] .link-editor .button.active,
|
|
207
|
+
[data-theme="dark"] .toolbar .button.active {
|
|
208
|
+
background-color: rgba(100, 150, 255, 0.3);
|
|
209
|
+
}
|
|
210
|
+
|
|
191
211
|
.link-editor .link-input {
|
|
192
212
|
display: block;
|
|
193
213
|
width: calc(100% - 75px);
|
|
@@ -204,6 +224,11 @@ i.redo {
|
|
|
204
224
|
font-family: inherit;
|
|
205
225
|
}
|
|
206
226
|
|
|
227
|
+
[data-theme="dark"] .link-editor .link-input {
|
|
228
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
229
|
+
color: #e5e5e5;
|
|
230
|
+
}
|
|
231
|
+
|
|
207
232
|
.link-editor .link-view {
|
|
208
233
|
display: block;
|
|
209
234
|
width: calc(100% - 24px);
|
|
@@ -340,6 +365,14 @@ i.redo {
|
|
|
340
365
|
background-color: #fff;
|
|
341
366
|
}
|
|
342
367
|
|
|
368
|
+
[data-theme="dark"] .dropdown {
|
|
369
|
+
background-color: rgba(30, 30, 30, 0.95);
|
|
370
|
+
box-shadow:
|
|
371
|
+
0 12px 28px 0 rgba(0, 0, 0, 0.6),
|
|
372
|
+
0 2px 4px 0 rgba(0, 0, 0, 0.3),
|
|
373
|
+
inset 0 0 0 1px rgba(255, 255, 255, 0.1);
|
|
374
|
+
}
|
|
375
|
+
|
|
343
376
|
.dropdown .item {
|
|
344
377
|
margin: 0 8px 0 8px;
|
|
345
378
|
padding: 8px;
|
|
@@ -359,6 +392,11 @@ i.redo {
|
|
|
359
392
|
min-width: 100px;
|
|
360
393
|
}
|
|
361
394
|
|
|
395
|
+
[data-theme="dark"] .dropdown .item {
|
|
396
|
+
color: #e5e5e5;
|
|
397
|
+
background-color: transparent;
|
|
398
|
+
}
|
|
399
|
+
|
|
362
400
|
.dropdown .item.fontsize-item,
|
|
363
401
|
.dropdown .item.fontsize-item .text {
|
|
364
402
|
min-width: unset;
|
|
@@ -383,6 +421,10 @@ i.redo {
|
|
|
383
421
|
background-color: #eee;
|
|
384
422
|
}
|
|
385
423
|
|
|
424
|
+
[data-theme="dark"] .dropdown .item:hover {
|
|
425
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
426
|
+
}
|
|
427
|
+
|
|
386
428
|
.dropdown .item .text {
|
|
387
429
|
display: flex;
|
|
388
430
|
line-height: 20px;
|
|
@@ -402,6 +444,10 @@ i.redo {
|
|
|
402
444
|
background-repeat: no-repeat;
|
|
403
445
|
}
|
|
404
446
|
|
|
447
|
+
[data-theme="dark"] .dropdown .item .icon {
|
|
448
|
+
filter: invert(1);
|
|
449
|
+
}
|
|
450
|
+
|
|
405
451
|
.dropdown .divider {
|
|
406
452
|
width: auto;
|
|
407
453
|
background-color: #eee;
|
|
@@ -409,6 +455,10 @@ i.redo {
|
|
|
409
455
|
height: 1px;
|
|
410
456
|
}
|
|
411
457
|
|
|
458
|
+
[data-theme="dark"] .dropdown .divider {
|
|
459
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
460
|
+
}
|
|
461
|
+
|
|
412
462
|
@media screen and (max-width: 1100px) {
|
|
413
463
|
.dropdown-button-text {
|
|
414
464
|
display: none !important;
|
|
@@ -835,17 +885,31 @@ i.chevron-down {
|
|
|
835
885
|
cursor: pointer;
|
|
836
886
|
}
|
|
837
887
|
|
|
888
|
+
[data-theme="dark"] .action-button {
|
|
889
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
890
|
+
color: #e5e5e5;
|
|
891
|
+
}
|
|
892
|
+
|
|
838
893
|
.action-button:hover {
|
|
839
894
|
background-color: #ddd;
|
|
840
895
|
color: #000;
|
|
841
896
|
}
|
|
842
897
|
|
|
898
|
+
[data-theme="dark"] .action-button:hover {
|
|
899
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
900
|
+
color: #fff;
|
|
901
|
+
}
|
|
902
|
+
|
|
843
903
|
button.action-button:disabled {
|
|
844
904
|
opacity: 0.6;
|
|
845
905
|
background: #eee;
|
|
846
906
|
cursor: not-allowed;
|
|
847
907
|
}
|
|
848
908
|
|
|
909
|
+
[data-theme="dark"] button.action-button:disabled {
|
|
910
|
+
background: rgba(255, 255, 255, 0.05);
|
|
911
|
+
}
|
|
912
|
+
|
|
849
913
|
.ltr {
|
|
850
914
|
text-align: left;
|
|
851
915
|
}
|
|
@@ -869,6 +933,10 @@ button.action-button:disabled {
|
|
|
869
933
|
z-index: 2;
|
|
870
934
|
}
|
|
871
935
|
|
|
936
|
+
[data-theme="dark"] .toolbar {
|
|
937
|
+
background: rgba(255, 255, 255, 0.1);
|
|
938
|
+
}
|
|
939
|
+
|
|
872
940
|
button.toolbar-item {
|
|
873
941
|
border: 0;
|
|
874
942
|
display: flex;
|
|
@@ -900,6 +968,10 @@ button.toolbar-item i.format {
|
|
|
900
968
|
opacity: 0.6;
|
|
901
969
|
}
|
|
902
970
|
|
|
971
|
+
[data-theme="dark"] button.toolbar-item i.format {
|
|
972
|
+
filter: invert(1);
|
|
973
|
+
}
|
|
974
|
+
|
|
903
975
|
button.toolbar-item:disabled .icon,
|
|
904
976
|
button.toolbar-item:disabled .text,
|
|
905
977
|
button.toolbar-item:disabled i.format,
|
|
@@ -919,6 +991,10 @@ button.toolbar-item.active i {
|
|
|
919
991
|
background-color: #eee;
|
|
920
992
|
}
|
|
921
993
|
|
|
994
|
+
[data-theme="dark"] .toolbar-item:hover:not([disabled]) {
|
|
995
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
996
|
+
}
|
|
997
|
+
|
|
922
998
|
.toolbar-item.font-family .text {
|
|
923
999
|
display: block;
|
|
924
1000
|
max-width: 40px;
|
|
@@ -941,6 +1017,10 @@ button.toolbar-item.active i {
|
|
|
941
1017
|
padding-right: 10px;
|
|
942
1018
|
}
|
|
943
1019
|
|
|
1020
|
+
[data-theme="dark"] .toolbar .toolbar-item .text {
|
|
1021
|
+
color: #bbb;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
944
1024
|
.toolbar .toolbar-item .icon {
|
|
945
1025
|
display: flex;
|
|
946
1026
|
width: 20px;
|
|
@@ -951,6 +1031,10 @@ button.toolbar-item.active i {
|
|
|
951
1031
|
background-size: contain;
|
|
952
1032
|
}
|
|
953
1033
|
|
|
1034
|
+
[data-theme="dark"] .toolbar .toolbar-item .icon {
|
|
1035
|
+
filter: invert(1);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
954
1038
|
.toolbar i.chevron-down,
|
|
955
1039
|
.toolbar-item i.chevron-down {
|
|
956
1040
|
margin-top: 3px;
|
|
@@ -960,6 +1044,11 @@ button.toolbar-item.active i {
|
|
|
960
1044
|
user-select: none;
|
|
961
1045
|
}
|
|
962
1046
|
|
|
1047
|
+
[data-theme="dark"] .toolbar i.chevron-down,
|
|
1048
|
+
[data-theme="dark"] .toolbar-item i.chevron-down {
|
|
1049
|
+
filter: invert(1);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
963
1052
|
.toolbar i.chevron-down.inside {
|
|
964
1053
|
width: 16px;
|
|
965
1054
|
height: 16px;
|
|
@@ -1146,13 +1235,13 @@ hr.selected {
|
|
|
1146
1235
|
z-index: 3;
|
|
1147
1236
|
}
|
|
1148
1237
|
|
|
1149
|
-
.
|
|
1238
|
+
.EditorTheme__blockCursor {
|
|
1150
1239
|
display: block;
|
|
1151
1240
|
pointer-events: none;
|
|
1152
1241
|
position: absolute;
|
|
1153
1242
|
}
|
|
1154
1243
|
|
|
1155
|
-
.
|
|
1244
|
+
.EditorTheme__blockCursor:after {
|
|
1156
1245
|
content: "";
|
|
1157
1246
|
display: block;
|
|
1158
1247
|
position: absolute;
|
package/src/MarkdownEditor.tsx
CHANGED
|
@@ -3,9 +3,7 @@ import {
|
|
|
3
3
|
$convertToMarkdownString,
|
|
4
4
|
TRANSFORMERS,
|
|
5
5
|
} from "@lexical/markdown";
|
|
6
|
-
import {
|
|
7
|
-
$getRoot,
|
|
8
|
-
} from 'lexical';
|
|
6
|
+
import { $getRoot } from 'lexical';
|
|
9
7
|
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
10
8
|
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
11
9
|
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
@@ -19,6 +17,7 @@ import EditorTheme from "./themes/EditorTheme";
|
|
|
19
17
|
import ContentEditable from "./ui/ContentEditable";
|
|
20
18
|
import Placeholder from "./ui/Placeholder";
|
|
21
19
|
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
20
|
+
import { MarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPlugin';
|
|
22
21
|
import LinkPlugin from "./plugins/LinkPlugin";
|
|
23
22
|
import FloatingLinkEditorPlugin from "./plugins/FloatingLinkEditorPlugin";
|
|
24
23
|
import AutoLinkPlugin from "./plugins/AutoLinkPlugin";
|
|
@@ -65,9 +64,13 @@ const MarkdownEditor: React.FC<MarkdownEditorProps> = (props) => {
|
|
|
65
64
|
throw error;
|
|
66
65
|
},
|
|
67
66
|
theme: EditorTheme,
|
|
68
|
-
editorState:
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
editorState: props.initialMarkdown
|
|
68
|
+
? () => {
|
|
69
|
+
// Unescape backslash-escaped markdown characters
|
|
70
|
+
const unescapedMarkdown = props.initialMarkdown!.replace(/\\([*_`\[\]()#+-])/g, '$1');
|
|
71
|
+
$convertFromMarkdownString(unescapedMarkdown, TRANSFORMERS);
|
|
72
|
+
}
|
|
73
|
+
: undefined,
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
return (
|
|
@@ -77,6 +80,7 @@ const MarkdownEditor: React.FC<MarkdownEditorProps> = (props) => {
|
|
|
77
80
|
<ToolbarPlugin setIsLinkEditMode={setIsLinkEditMode} />
|
|
78
81
|
<div className="editor-container rich-text">
|
|
79
82
|
<HistoryPlugin externalHistoryState={historyState} />
|
|
83
|
+
<MarkdownShortcutPlugin transformers={TRANSFORMERS} />
|
|
80
84
|
<AutoLinkPlugin />
|
|
81
85
|
<LinkPlugin />
|
|
82
86
|
<FloatingLinkEditorPlugin
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
.
|
|
9
|
+
.EditorTheme__ltr {
|
|
10
10
|
text-align: left;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.
|
|
13
|
+
.EditorTheme__rtl {
|
|
14
14
|
text-align: right;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.
|
|
17
|
+
.EditorTheme__paragraph {
|
|
18
18
|
margin: 0;
|
|
19
19
|
position: relative;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
.EditorTheme__quote {
|
|
23
23
|
margin: 0;
|
|
24
24
|
margin-left: 20px;
|
|
25
25
|
margin-bottom: 10px;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
padding-left: 16px;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.EditorTheme__h1 {
|
|
35
35
|
font-size: 32px;
|
|
36
36
|
line-height: 1.3;
|
|
37
37
|
padding-top: 2rem;
|
|
@@ -41,7 +41,11 @@
|
|
|
41
41
|
margin: 0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
44
|
+
[data-theme="dark"] .EditorTheme__h1 {
|
|
45
|
+
color: #ffffff;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.EditorTheme__h2 {
|
|
45
49
|
font-size: 24px;
|
|
46
50
|
color: #406280;
|
|
47
51
|
padding-top: 2rem;
|
|
@@ -50,7 +54,11 @@
|
|
|
50
54
|
margin: 0;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
.
|
|
57
|
+
[data-theme="dark"] .EditorTheme__h2 {
|
|
58
|
+
color: #ffffff;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.EditorTheme__h3 {
|
|
54
62
|
font-size: 24px;
|
|
55
63
|
color: #406280;
|
|
56
64
|
padding-top: 2rem;
|
|
@@ -59,7 +67,11 @@
|
|
|
59
67
|
margin: 0;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
.
|
|
70
|
+
[data-theme="dark"] .EditorTheme__h3 {
|
|
71
|
+
color: #ffffff;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.EditorTheme__h4 {
|
|
63
75
|
font-size: 16px;
|
|
64
76
|
color: #406280;
|
|
65
77
|
padding-top: 1.5rem;
|
|
@@ -68,63 +80,67 @@
|
|
|
68
80
|
margin: 0;
|
|
69
81
|
}
|
|
70
82
|
|
|
71
|
-
.
|
|
83
|
+
[data-theme="dark"] .EditorTheme__h4 {
|
|
84
|
+
color: #ffffff;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.EditorTheme__indent {
|
|
72
88
|
--lexical-indent-base-value: 40px;
|
|
73
89
|
}
|
|
74
90
|
|
|
75
|
-
.
|
|
91
|
+
.EditorTheme__textBold {
|
|
76
92
|
font-weight: bold;
|
|
77
93
|
}
|
|
78
94
|
|
|
79
|
-
.
|
|
95
|
+
.EditorTheme__textItalic {
|
|
80
96
|
font-style: italic;
|
|
81
97
|
}
|
|
82
98
|
|
|
83
|
-
.
|
|
99
|
+
.EditorTheme__textUnderline {
|
|
84
100
|
text-decoration: underline;
|
|
85
101
|
}
|
|
86
102
|
|
|
87
|
-
.
|
|
103
|
+
.EditorTheme__textStrikethrough {
|
|
88
104
|
text-decoration: line-through;
|
|
89
105
|
}
|
|
90
106
|
|
|
91
|
-
.
|
|
107
|
+
.EditorTheme__textUnderlineStrikethrough {
|
|
92
108
|
text-decoration: underline line-through;
|
|
93
109
|
}
|
|
94
110
|
|
|
95
|
-
.
|
|
111
|
+
.EditorTheme__textSubscript {
|
|
96
112
|
font-size: 0.8em;
|
|
97
113
|
vertical-align: sub !important;
|
|
98
114
|
}
|
|
99
115
|
|
|
100
|
-
.
|
|
116
|
+
.EditorTheme__textSuperscript {
|
|
101
117
|
font-size: 0.8em;
|
|
102
118
|
vertical-align: super;
|
|
103
119
|
}
|
|
104
120
|
|
|
105
|
-
.
|
|
121
|
+
.EditorTheme__textCode {
|
|
106
122
|
background-color: rgb(240, 242, 245);
|
|
107
123
|
padding: 1px 0.25rem;
|
|
108
124
|
font-family: Menlo, Consolas, Monaco, monospace;
|
|
109
125
|
font-size: 94%;
|
|
110
126
|
}
|
|
111
127
|
|
|
112
|
-
.
|
|
128
|
+
.EditorTheme__hashtag {
|
|
113
129
|
background-color: rgba(88, 144, 255, 0.15);
|
|
114
130
|
border-bottom: 1px solid rgba(88, 144, 255, 0.3);
|
|
115
131
|
}
|
|
116
132
|
|
|
117
|
-
.
|
|
133
|
+
.EditorTheme__link {
|
|
118
134
|
color: rgb(33, 111, 219);
|
|
119
135
|
text-decoration: none;
|
|
120
136
|
}
|
|
121
137
|
|
|
122
|
-
.
|
|
138
|
+
.EditorTheme__link:hover {
|
|
123
139
|
text-decoration: underline;
|
|
124
140
|
cursor: pointer;
|
|
125
141
|
}
|
|
126
142
|
|
|
127
|
-
.
|
|
143
|
+
.EditorTheme__code {
|
|
128
144
|
background-color: rgb(240, 242, 245);
|
|
129
145
|
font-family: Menlo, Consolas, Monaco, monospace;
|
|
130
146
|
display: block;
|
|
@@ -139,7 +155,7 @@
|
|
|
139
155
|
tab-size: 2;
|
|
140
156
|
}
|
|
141
157
|
|
|
142
|
-
.
|
|
158
|
+
.EditorTheme__code:before {
|
|
143
159
|
content: attr(data-gutter);
|
|
144
160
|
position: absolute;
|
|
145
161
|
background-color: #eee;
|
|
@@ -153,57 +169,57 @@
|
|
|
153
169
|
min-width: 25px;
|
|
154
170
|
}
|
|
155
171
|
|
|
156
|
-
.
|
|
172
|
+
.EditorTheme__characterLimit {
|
|
157
173
|
display: inline;
|
|
158
174
|
background-color: #ffbbbb !important;
|
|
159
175
|
}
|
|
160
176
|
|
|
161
|
-
.
|
|
177
|
+
.EditorTheme__ol1 {
|
|
162
178
|
padding: 0;
|
|
163
179
|
margin: 0;
|
|
164
180
|
list-style-position: inside;
|
|
165
181
|
}
|
|
166
182
|
|
|
167
|
-
.
|
|
183
|
+
.EditorTheme__ol2 {
|
|
168
184
|
padding: 0;
|
|
169
185
|
margin: 0;
|
|
170
186
|
list-style-type: upper-alpha;
|
|
171
187
|
list-style-position: inside;
|
|
172
188
|
}
|
|
173
189
|
|
|
174
|
-
.
|
|
190
|
+
.EditorTheme__ol3 {
|
|
175
191
|
padding: 0;
|
|
176
192
|
margin: 0;
|
|
177
193
|
list-style-type: lower-alpha;
|
|
178
194
|
list-style-position: inside;
|
|
179
195
|
}
|
|
180
196
|
|
|
181
|
-
.
|
|
197
|
+
.EditorTheme__ol4 {
|
|
182
198
|
padding: 0;
|
|
183
199
|
margin: 0;
|
|
184
200
|
list-style-type: upper-roman;
|
|
185
201
|
list-style-position: inside;
|
|
186
202
|
}
|
|
187
203
|
|
|
188
|
-
.
|
|
204
|
+
.EditorTheme__ol5 {
|
|
189
205
|
padding: 0;
|
|
190
206
|
margin: 0;
|
|
191
207
|
list-style-type: lower-roman;
|
|
192
208
|
list-style-position: inside;
|
|
193
209
|
}
|
|
194
210
|
|
|
195
|
-
.
|
|
211
|
+
.EditorTheme__ul {
|
|
196
212
|
padding: 0;
|
|
197
213
|
margin: 0;
|
|
198
214
|
list-style-position: inside;
|
|
199
215
|
}
|
|
200
216
|
|
|
201
|
-
.
|
|
217
|
+
.EditorTheme__listItem {
|
|
202
218
|
margin: 0 32px;
|
|
203
219
|
}
|
|
204
220
|
|
|
205
|
-
.
|
|
206
|
-
.
|
|
221
|
+
.EditorTheme__listItemChecked,
|
|
222
|
+
.EditorTheme__listItemUnchecked {
|
|
207
223
|
position: relative;
|
|
208
224
|
margin-left: 8px;
|
|
209
225
|
margin-right: 8px;
|
|
@@ -213,12 +229,12 @@
|
|
|
213
229
|
outline: none;
|
|
214
230
|
}
|
|
215
231
|
|
|
216
|
-
.
|
|
232
|
+
.EditorTheme__listItemChecked {
|
|
217
233
|
text-decoration: line-through;
|
|
218
234
|
}
|
|
219
235
|
|
|
220
|
-
.
|
|
221
|
-
.
|
|
236
|
+
.EditorTheme__listItemUnchecked:before,
|
|
237
|
+
.EditorTheme__listItemChecked:before {
|
|
222
238
|
content: "";
|
|
223
239
|
width: 16px;
|
|
224
240
|
height: 16px;
|
|
@@ -230,31 +246,31 @@
|
|
|
230
246
|
position: absolute;
|
|
231
247
|
}
|
|
232
248
|
|
|
233
|
-
.
|
|
234
|
-
.
|
|
249
|
+
.EditorTheme__listItemUnchecked[dir="rtl"]:before,
|
|
250
|
+
.EditorTheme__listItemChecked[dir="rtl"]:before {
|
|
235
251
|
left: auto;
|
|
236
252
|
right: 0;
|
|
237
253
|
}
|
|
238
254
|
|
|
239
|
-
.
|
|
240
|
-
.
|
|
255
|
+
.EditorTheme__listItemUnchecked:focus:before,
|
|
256
|
+
.EditorTheme__listItemChecked:focus:before {
|
|
241
257
|
box-shadow: 0 0 0 2px #a6cdfe;
|
|
242
258
|
border-radius: 2px;
|
|
243
259
|
}
|
|
244
260
|
|
|
245
|
-
.
|
|
261
|
+
.EditorTheme__listItemUnchecked:before {
|
|
246
262
|
border: 1px solid #999;
|
|
247
263
|
border-radius: 2px;
|
|
248
264
|
}
|
|
249
265
|
|
|
250
|
-
.
|
|
266
|
+
.EditorTheme__listItemChecked:before {
|
|
251
267
|
border: 1px solid rgb(61, 135, 245);
|
|
252
268
|
border-radius: 2px;
|
|
253
269
|
background-color: #3d87f5;
|
|
254
270
|
background-repeat: no-repeat;
|
|
255
271
|
}
|
|
256
272
|
|
|
257
|
-
.
|
|
273
|
+
.EditorTheme__listItemChecked:after {
|
|
258
274
|
content: "";
|
|
259
275
|
cursor: pointer;
|
|
260
276
|
border-color: #fff;
|
|
@@ -270,83 +286,83 @@
|
|
|
270
286
|
border-width: 0 2px 2px 0;
|
|
271
287
|
}
|
|
272
288
|
|
|
273
|
-
.
|
|
289
|
+
.EditorTheme__nestedListItem {
|
|
274
290
|
list-style-type: none;
|
|
275
291
|
}
|
|
276
292
|
|
|
277
|
-
.
|
|
278
|
-
.
|
|
293
|
+
.EditorTheme__nestedListItem:before,
|
|
294
|
+
.EditorTheme__nestedListItem:after {
|
|
279
295
|
display: none;
|
|
280
296
|
}
|
|
281
297
|
|
|
282
|
-
.
|
|
298
|
+
.EditorTheme__tokenComment {
|
|
283
299
|
color: slategray;
|
|
284
300
|
}
|
|
285
301
|
|
|
286
|
-
.
|
|
302
|
+
.EditorTheme__tokenPunctuation {
|
|
287
303
|
color: #999;
|
|
288
304
|
}
|
|
289
305
|
|
|
290
|
-
.
|
|
306
|
+
.EditorTheme__tokenProperty {
|
|
291
307
|
color: #905;
|
|
292
308
|
}
|
|
293
309
|
|
|
294
|
-
.
|
|
310
|
+
.EditorTheme__tokenSelector {
|
|
295
311
|
color: #690;
|
|
296
312
|
}
|
|
297
313
|
|
|
298
|
-
.
|
|
314
|
+
.EditorTheme__tokenOperator {
|
|
299
315
|
color: #9a6e3a;
|
|
300
316
|
}
|
|
301
317
|
|
|
302
|
-
.
|
|
318
|
+
.EditorTheme__tokenAttr {
|
|
303
319
|
color: #07a;
|
|
304
320
|
}
|
|
305
321
|
|
|
306
|
-
.
|
|
322
|
+
.EditorTheme__tokenVariable {
|
|
307
323
|
color: #e90;
|
|
308
324
|
}
|
|
309
325
|
|
|
310
|
-
.
|
|
326
|
+
.EditorTheme__tokenFunction {
|
|
311
327
|
color: #dd4a68;
|
|
312
328
|
}
|
|
313
329
|
|
|
314
|
-
.
|
|
330
|
+
.EditorTheme__mark {
|
|
315
331
|
background: rgba(255, 212, 0, 0.14);
|
|
316
332
|
border-bottom: 2px solid rgba(255, 212, 0, 0.3);
|
|
317
333
|
padding-bottom: 2px;
|
|
318
334
|
}
|
|
319
335
|
|
|
320
|
-
.
|
|
336
|
+
.EditorTheme__markOverlap {
|
|
321
337
|
background: rgba(255, 212, 0, 0.3);
|
|
322
338
|
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
|
|
323
339
|
}
|
|
324
340
|
|
|
325
|
-
.
|
|
341
|
+
.EditorTheme__mark.selected {
|
|
326
342
|
background: rgba(255, 212, 0, 0.5);
|
|
327
343
|
border-bottom: 2px solid rgba(255, 212, 0, 1);
|
|
328
344
|
}
|
|
329
345
|
|
|
330
|
-
.
|
|
346
|
+
.EditorTheme__markOverlap.selected {
|
|
331
347
|
background: rgba(255, 212, 0, 0.7);
|
|
332
348
|
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
|
|
333
349
|
}
|
|
334
350
|
|
|
335
|
-
.
|
|
351
|
+
.EditorTheme__embedBlock {
|
|
336
352
|
user-select: none;
|
|
337
353
|
}
|
|
338
354
|
|
|
339
|
-
.
|
|
355
|
+
.EditorTheme__embedBlockFocus {
|
|
340
356
|
outline: 2px solid rgb(60, 132, 244);
|
|
341
357
|
}
|
|
342
358
|
|
|
343
|
-
.
|
|
359
|
+
.EditorTheme__layoutContaner {
|
|
344
360
|
display: grid;
|
|
345
361
|
gap: 10px;
|
|
346
362
|
margin: 10px 0;
|
|
347
363
|
}
|
|
348
364
|
|
|
349
|
-
.
|
|
365
|
+
.EditorTheme__layoutItem {
|
|
350
366
|
border: 1px dashed #ddd;
|
|
351
367
|
padding: 8px 16px;
|
|
352
368
|
}
|
|
@@ -11,107 +11,107 @@ import "./EditorTheme.css";
|
|
|
11
11
|
import type { EditorThemeClasses } from "lexical";
|
|
12
12
|
|
|
13
13
|
const theme: EditorThemeClasses = {
|
|
14
|
-
blockCursor: "
|
|
15
|
-
characterLimit: "
|
|
16
|
-
code: "
|
|
14
|
+
blockCursor: "EditorTheme__blockCursor",
|
|
15
|
+
characterLimit: "EditorTheme__characterLimit",
|
|
16
|
+
code: "EditorTheme__code",
|
|
17
17
|
codeHighlight: {
|
|
18
|
-
atrule: "
|
|
19
|
-
attr: "
|
|
20
|
-
boolean: "
|
|
21
|
-
builtin: "
|
|
22
|
-
cdata: "
|
|
23
|
-
char: "
|
|
24
|
-
class: "
|
|
25
|
-
"class-name": "
|
|
26
|
-
comment: "
|
|
27
|
-
constant: "
|
|
28
|
-
deleted: "
|
|
29
|
-
doctype: "
|
|
30
|
-
entity: "
|
|
31
|
-
function: "
|
|
32
|
-
important: "
|
|
33
|
-
inserted: "
|
|
34
|
-
keyword: "
|
|
35
|
-
namespace: "
|
|
36
|
-
number: "
|
|
37
|
-
operator: "
|
|
38
|
-
prolog: "
|
|
39
|
-
property: "
|
|
40
|
-
punctuation: "
|
|
41
|
-
regex: "
|
|
42
|
-
selector: "
|
|
43
|
-
string: "
|
|
44
|
-
symbol: "
|
|
45
|
-
tag: "
|
|
46
|
-
url: "
|
|
47
|
-
variable: "
|
|
18
|
+
atrule: "EditorTheme__tokenAttr",
|
|
19
|
+
attr: "EditorTheme__tokenAttr",
|
|
20
|
+
boolean: "EditorTheme__tokenProperty",
|
|
21
|
+
builtin: "EditorTheme__tokenSelector",
|
|
22
|
+
cdata: "EditorTheme__tokenComment",
|
|
23
|
+
char: "EditorTheme__tokenSelector",
|
|
24
|
+
class: "EditorTheme__tokenFunction",
|
|
25
|
+
"class-name": "EditorTheme__tokenFunction",
|
|
26
|
+
comment: "EditorTheme__tokenComment",
|
|
27
|
+
constant: "EditorTheme__tokenProperty",
|
|
28
|
+
deleted: "EditorTheme__tokenProperty",
|
|
29
|
+
doctype: "EditorTheme__tokenComment",
|
|
30
|
+
entity: "EditorTheme__tokenOperator",
|
|
31
|
+
function: "EditorTheme__tokenFunction",
|
|
32
|
+
important: "EditorTheme__tokenVariable",
|
|
33
|
+
inserted: "EditorTheme__tokenSelector",
|
|
34
|
+
keyword: "EditorTheme__tokenAttr",
|
|
35
|
+
namespace: "EditorTheme__tokenVariable",
|
|
36
|
+
number: "EditorTheme__tokenProperty",
|
|
37
|
+
operator: "EditorTheme__tokenOperator",
|
|
38
|
+
prolog: "EditorTheme__tokenComment",
|
|
39
|
+
property: "EditorTheme__tokenProperty",
|
|
40
|
+
punctuation: "EditorTheme__tokenPunctuation",
|
|
41
|
+
regex: "EditorTheme__tokenVariable",
|
|
42
|
+
selector: "EditorTheme__tokenSelector",
|
|
43
|
+
string: "EditorTheme__tokenSelector",
|
|
44
|
+
symbol: "EditorTheme__tokenProperty",
|
|
45
|
+
tag: "EditorTheme__tokenProperty",
|
|
46
|
+
url: "EditorTheme__tokenOperator",
|
|
47
|
+
variable: "EditorTheme__tokenVariable",
|
|
48
48
|
},
|
|
49
49
|
embedBlock: {
|
|
50
|
-
base: "
|
|
51
|
-
focus: "
|
|
50
|
+
base: "EditorTheme__embedBlock",
|
|
51
|
+
focus: "EditorTheme__embedBlockFocus",
|
|
52
52
|
},
|
|
53
|
-
hashtag: "
|
|
53
|
+
hashtag: "EditorTheme__hashtag",
|
|
54
54
|
heading: {
|
|
55
|
-
h1: "
|
|
56
|
-
h2: "
|
|
57
|
-
h3: "
|
|
58
|
-
h4: "
|
|
59
|
-
h5: "
|
|
60
|
-
h6: "
|
|
55
|
+
h1: "EditorTheme__h1",
|
|
56
|
+
h2: "EditorTheme__h2",
|
|
57
|
+
h3: "EditorTheme__h3",
|
|
58
|
+
h4: "EditorTheme__h4",
|
|
59
|
+
h5: "EditorTheme__h5",
|
|
60
|
+
h6: "EditorTheme__h6",
|
|
61
61
|
},
|
|
62
62
|
image: "editor-image",
|
|
63
|
-
indent: "
|
|
63
|
+
indent: "EditorTheme__indent",
|
|
64
64
|
inlineImage: "inline-editor-image",
|
|
65
|
-
layoutContainer: "
|
|
66
|
-
layoutItem: "
|
|
67
|
-
link: "
|
|
65
|
+
layoutContainer: "EditorTheme__layoutContaner",
|
|
66
|
+
layoutItem: "EditorTheme__layoutItem",
|
|
67
|
+
link: "EditorTheme__link",
|
|
68
68
|
list: {
|
|
69
|
-
listitem: "
|
|
70
|
-
listitemChecked: "
|
|
71
|
-
listitemUnchecked: "
|
|
69
|
+
listitem: "EditorTheme__listItem",
|
|
70
|
+
listitemChecked: "EditorTheme__listItemChecked",
|
|
71
|
+
listitemUnchecked: "EditorTheme__listItemUnchecked",
|
|
72
72
|
nested: {
|
|
73
|
-
listitem: "
|
|
73
|
+
listitem: "EditorTheme__nestedListItem",
|
|
74
74
|
},
|
|
75
75
|
olDepth: [
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
76
|
+
"EditorTheme__ol1",
|
|
77
|
+
"EditorTheme__ol2",
|
|
78
|
+
"EditorTheme__ol3",
|
|
79
|
+
"EditorTheme__ol4",
|
|
80
|
+
"EditorTheme__ol5",
|
|
81
81
|
],
|
|
82
|
-
ul: "
|
|
82
|
+
ul: "EditorTheme__ul",
|
|
83
83
|
},
|
|
84
|
-
ltr: "
|
|
85
|
-
mark: "
|
|
86
|
-
markOverlap: "
|
|
87
|
-
paragraph: "
|
|
88
|
-
quote: "
|
|
89
|
-
rtl: "
|
|
90
|
-
table: "
|
|
91
|
-
tableAddColumns: "
|
|
92
|
-
tableAddRows: "
|
|
93
|
-
tableCell: "
|
|
94
|
-
tableCellActionButton: "
|
|
84
|
+
ltr: "EditorTheme__ltr",
|
|
85
|
+
mark: "EditorTheme__mark",
|
|
86
|
+
markOverlap: "EditorTheme__markOverlap",
|
|
87
|
+
paragraph: "EditorTheme__paragraph",
|
|
88
|
+
quote: "EditorTheme__quote",
|
|
89
|
+
rtl: "EditorTheme__rtl",
|
|
90
|
+
table: "EditorTheme__table",
|
|
91
|
+
tableAddColumns: "EditorTheme__tableAddColumns",
|
|
92
|
+
tableAddRows: "EditorTheme__tableAddRows",
|
|
93
|
+
tableCell: "EditorTheme__tableCell",
|
|
94
|
+
tableCellActionButton: "EditorTheme__tableCellActionButton",
|
|
95
95
|
tableCellActionButtonContainer:
|
|
96
|
-
"
|
|
97
|
-
tableCellEditing: "
|
|
98
|
-
tableCellHeader: "
|
|
99
|
-
tableCellPrimarySelected: "
|
|
100
|
-
tableCellResizer: "
|
|
101
|
-
tableCellSelected: "
|
|
102
|
-
tableCellSortedIndicator: "
|
|
103
|
-
tableResizeRuler: "
|
|
104
|
-
tableSelected: "
|
|
105
|
-
tableSelection: "
|
|
96
|
+
"EditorTheme__tableCellActionButtonContainer",
|
|
97
|
+
tableCellEditing: "EditorTheme__tableCellEditing",
|
|
98
|
+
tableCellHeader: "EditorTheme__tableCellHeader",
|
|
99
|
+
tableCellPrimarySelected: "EditorTheme__tableCellPrimarySelected",
|
|
100
|
+
tableCellResizer: "EditorTheme__tableCellResizer",
|
|
101
|
+
tableCellSelected: "EditorTheme__tableCellSelected",
|
|
102
|
+
tableCellSortedIndicator: "EditorTheme__tableCellSortedIndicator",
|
|
103
|
+
tableResizeRuler: "EditorTheme__tableCellResizeRuler",
|
|
104
|
+
tableSelected: "EditorTheme__tableSelected",
|
|
105
|
+
tableSelection: "EditorTheme__tableSelection",
|
|
106
106
|
text: {
|
|
107
|
-
bold: "
|
|
108
|
-
code: "
|
|
109
|
-
italic: "
|
|
110
|
-
strikethrough: "
|
|
111
|
-
subscript: "
|
|
112
|
-
superscript: "
|
|
113
|
-
underline: "
|
|
114
|
-
underlineStrikethrough: "
|
|
107
|
+
bold: "EditorTheme__textBold",
|
|
108
|
+
code: "EditorTheme__textCode",
|
|
109
|
+
italic: "EditorTheme__textItalic",
|
|
110
|
+
strikethrough: "EditorTheme__textStrikethrough",
|
|
111
|
+
subscript: "EditorTheme__textSubscript",
|
|
112
|
+
superscript: "EditorTheme__textSuperscript",
|
|
113
|
+
underline: "EditorTheme__textUnderline",
|
|
114
|
+
underlineStrikethrough: "EditorTheme__textUnderlineStrikethrough",
|
|
115
115
|
},
|
|
116
116
|
};
|
|
117
117
|
|