forked from ling-drag0n/CloudPaste
-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
8706 lines (7700 loc) · 261 KB
/
worker.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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 在文件开头添加常量声明
const MAX_FILE_SIZE = 98 * 1024 * 1024; // 文件大小限制 (98MB)
const MAX_TOTAL_STORAGE = 6 * 1024 * 1024 * 1024; // 总存储限制 (6GB)
// 工具函数
const utils = {
// 生成随机ID
generateId(length = 8) {
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
let result = "";
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
},
// 密码加密
async hashPassword(password) {
const encoder = new TextEncoder();
const data = encoder.encode(password);
const hash = await crypto.subtle.digest("SHA-256", data);
return btoa(String.fromCharCode(...new Uint8Array(hash)));
},
// 验证密码
async verifyPassword(password, hash) {
const inputHash = await utils.hashPassword(password);
return inputHash === hash;
},
// 计算过期时间
calculateExpiryTime(duration) {
if (duration === "never") return null; // 永久不过期返回 null
const now = new Date();
switch (duration) {
case "1h":
return new Date(now.getTime() + 60 * 60 * 1000);
case "1d":
return new Date(now.getTime() + 24 * 60 * 60 * 1000);
case "7d":
return new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);
case "30d":
return new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000);
default:
return new Date(now.getTime() + 24 * 60 * 60 * 1000);
}
},
// 检查是否过期
isExpired(expiryTime) {
if (!expiryTime) return false; // 如果没有过期时间,则永不过期
return new Date() > new Date(expiryTime);
},
};
// CSS 样式
const styles = `
/* GitHub 图标样式 */
.github-link {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
color: var(--text-color); /* 使用主题颜色 */
transition: color 0.3s ease;
}
.github-link:hover {
color: var(--primary-color);
}
.github-icon {
transition: transform 0.3s ease;
}
.github-link:hover .github-icon {
transform: scale(1.1);
}
:root {
--primary-color: #3498db;
--bg-color: #f5f6fa;
--border-color: #dcdde1;
--text-color: #2d3436;
--card-bg: white;
--error-bg: #ffebee;
--error-border: #ef5350;
--error-text: #c62828;
--code-bg: #f6f8fa;
--hover-bg: rgba(0,0,0,0.05);
--secondary-bg: #f8f9fa;
--secondary-text: #666;
--admin-panel-bg: white;
--markdown-preview-bg: white;
--markdown-code-bg: #f6f8fa;
--markdown-blockquote-bg: #f8f9fa;
--markdown-blockquote-border: #3498db;
--btn-secondary-bg: #95a5a6;
--btn-secondary-text: white;
--input-bg: white;
--input-text: #2d3436;
--input-placeholder: #999;
--scrollbar-thumb: rgba(0,0,0,0.2);
--scrollbar-track: transparent;
--markdown-bg: white;
--markdown-text: #24292e;
--markdown-heading-text: #1a1a1a;
--markdown-link: #0366d6;
--markdown-link-hover: #0550ae;
--markdown-code-bg: #f6f8fa;
--markdown-code-text: #24292e;
--markdown-code-block-bg: #f6f8fa;
--markdown-blockquote-bg: #f8f9fa;
--markdown-blockquote-text: #6a737d;
--markdown-blockquote-border: #3498db;
--markdown-table-border: #dfe2e5;
--markdown-table-bg: white;
--markdown-table-alt-bg: #f8f9fa;
--markdown-hr: #eaecef;
--markdown-list-marker: #24292e;
}
[data-theme="dark"] {
--primary-color: #5dade2;
--bg-color: #1a1a1a;
--border-color: #333;
--text-color: #e0e0e0;
--card-bg: #242424;
--error-bg: #421c1c;
--error-border: #b71c1c;
--error-text: #ff5252;
--code-bg: #2d2d2d;
--hover-bg: rgba(255,255,255,0.05);
/* 暗色主题特有变量 */
--secondary-bg: #2d2d2d;
--secondary-text: #aaa;
--admin-panel-bg: #242424;
--markdown-preview-bg: #2d2d2d;
--markdown-code-bg: #2d333b;
--markdown-blockquote-bg: #363636;
--markdown-blockquote-border: #5dade2;
--btn-secondary-bg: #4a4a4a;
--btn-secondary-text: #e0e0e0;
--input-bg: #363636;
--input-text: #e0e0e0;
--input-placeholder: #666;
--scrollbar-thumb: rgba(255,255,255,0.2);
--scrollbar-track: rgba(255,255,255,0.05);
--markdown-bg: #22272e;
--markdown-text: #adbac7;
--markdown-heading-text: #e6edf3;
--markdown-link: #539bf5;
--markdown-link-hover: #6cb6ff;
--markdown-code-bg: #2d333b;
--markdown-code-text: #adbac7;
--markdown-code-block-bg: #2d333b;
--markdown-blockquote-bg: #2d333b;
--markdown-blockquote-text: #768390;
--markdown-blockquote-border: #444c56;
--markdown-table-border: #444c56;
--markdown-table-bg: #22272e;
--markdown-table-alt-bg: #2d333b;
--markdown-hr: #444c56;
--markdown-list-marker: #768390;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
}
.card {
background: var(--card-bg);
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 2rem;
margin-bottom: 1rem;
width: fit-content;
min-width: 1200px; /* 设置默认最小宽度 */
overflow: visible;
transition: width 0.3s ease; /* 添加过渡效果 */
}
.tabs {
display: flex;
gap: 1rem;
margin-bottom: 1rem;
}
.tab {
padding: 0.5rem 1rem;
border: none;
background: none;
cursor: pointer;
border-bottom: 2px solid transparent;
position: relative;
}
.tab::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 2px;
background: var(--primary-color);
transition: all 0.3s ease;
transform: translateX(-50%);
}
.tab.active {
border-bottom-color: var(--primary-color);
color: var(--primary-color);
}
.tab.active::after {
width: 100%;
}
.settings {
margin-top: 1rem;
display: grid;
gap: 1rem;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.input-group {
margin-bottom: 1rem;
}
.input-group label {
display: block;
margin-bottom: 0.5rem;
}
.input-group input, .input-group select {
width: 100%;
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 4px;
}
.file-list {
margin-top: 1rem;
}
.file-item {
display: flex;
align-items: center;
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 4px;
margin-bottom: 0.5rem;
animation: file-item-in 0.3s ease-out;
}
@keyframes file-item-in {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.file-item .name {
flex: 1;
}
.file-item .size {
color: #7f8c8d;
margin: 0 1rem;
}
.result {
margin-top: 1rem;
padding: 1rem;
background: #f1f2f6;
border-radius: 4px;
}
.link {
display: flex;
align-items: center;
gap: 1rem;
margin: 0.5rem 0;
}
.link a {
color: var(--primary-color);
text-decoration: none;
word-break: break-all;
}
.expiry-info {
color: #7f8c8d;
font-size: 0.9rem;
}
/* 二维码弹窗样式 */
.qr-dialog {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1100;
}
.qr-content {
background: var(--card-bg);
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
max-width: 300px;
width: 90%;
text-align: center;
}
.qr-content h3 {
margin: 0 0 1rem 0;
color: var(--text-color);
}
.qr-actions {
display: flex;
gap: 1rem;
margin-top: 1.5rem;
justify-content: center;
}
/* 链接操作按钮组样式 */
.link-actions {
display: flex;
gap: 0.5rem;
align-items: center;
}
/* 修改 qr-btn 样式,使其同时支持 button 和 a 标签 */
.qr-btn {
padding: 0.5rem;
background: none;
border: none;
cursor: pointer;
color: var(--text-color);
opacity: 0.7;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
justify-content: center;
text-decoration: none;
}
.qr-btn:hover {
opacity: 1;
transform: scale(1.1);
}
.qr-btn svg {
width: 20px;
height: 20px;
}
/* 确保链接形式的 qr-btn 继承颜色 */
a.qr-btn {
color: inherit;
}
.qr-content #qr-container {
margin: 1rem auto;
width: 200px;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
.qr-content #qr-container img {
max-width: 100%;
height: auto;
display: block;
}
/* 添加直链按钮样式 */
.direct-link-btn {
width: 32px;
height: 32px;
padding: 6px;
border: none;
background: none;
cursor: pointer;
color: var(--text-color);
opacity: 0.7;
transition: all 0.3s ease;
margin-left: 0.5rem;
}
.direct-link-btn:hover {
opacity: 1;
transform: scale(1.1);
color: var(--primary-color);
}
.direct-link-btn svg {
width: 100%;
height: 100%;
}
/* 管理面板组件 */
.admin-panel {
position: fixed;
top: 20px;
right: 70px;
z-index: 1000;
}
.admin-login {
background: white;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 15px rgba(0,0,0,0.1);
min-width: 300px;
}
.admin-content {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 350px;
background: var(--admin-panel-bg);
box-shadow: -2px 0 15px rgba(0,0,0,0.1);
padding: 1.5rem;
overflow-y: auto;
}
/* 管理面板头部 */
.admin-header {
display: flex;
flex-direction: column;
gap: 0.8rem;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border-color);
}
.admin-header-top {
display: flex;
justify-content: space-between;
align-items: center;
}
.admin-header-top h3 {
font-size: 1.2rem;
font-weight: 600;
color: #2c3e50;
margin: 0;
}
/* 管理面板控制按钮 */
.admin-controls {
display: flex;
gap: 0.8rem;
align-items: center;
flex-wrap: wrap;
}
.refresh-btn {
height: 32px;
padding: 0 0.8rem;
border: 1px solid var(--border-color);
border-radius: 4px;
background: white;
cursor: pointer;
font-size: 0.9rem;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
color: #666;
white-space: nowrap;
}
.refresh-btn:hover {
border-color: var(--primary-color);
color: var(--primary-color);
}
.refresh-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.close-btn {
width: 32px;
height: 32px;
padding: 0;
border: 1px solid var(--border-color);
border-radius: 4px;
background: white;
cursor: pointer;
font-size: 1.2rem;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
color: #666;
}
.close-btn:hover {
border-color: #e74c3c;
color: #e74c3c;
}
/* 分享列表 */
.share-list {
margin-top: 1rem;
}
/* 修改分享项布局 */
.share-item {
position: relative; /* 添加相对定位 */
padding: 1rem;
background: var(--secondary-bg);
border-radius: 8px;
margin-bottom: 1rem;
border: 1px solid var(--border-color);
}
/* 修改标题样式 */
.share-item .title {
display: flex;
align-items: center;
justify-content: space-between; /* 添加这行,让内容两端对齐 */
margin-bottom: 0.5rem;
font-weight: 600;
color: var(--text-color);
}
/* 修改左侧标题区域样式 */
.title-left {
display: flex;
align-items: center;
gap: 1rem; /* 增加文字和锁图标的间距 */
}
/* 标题链接样式 */
.title-link {
text-decoration: none;
color: var(--text-color);
transition: all 0.2s ease;
padding: 0.15rem 0.3rem;
border-radius: 4px;
position: relative;
margin-left: -0.4rem;
display: inline-block; /* 让链接紧贴文字内容 */
line-height: 1.2; /* 减小行高 */
}
.title-link:hover {
background: var(--hover-bg);
color: var(--primary-color);
}
/* 锁图标样式 */
.lock-icon {
font-size: 0.9em;
opacity: 0.7;
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.2em;
height: 1.2em;
transition: opacity 0.2s ease;
margin-left: 0.3rem; /* 微调锁图标的间距 */
}
/* 添加点击波纹效果 */
.title-link::after {
content: '';
position: absolute;
inset: 0;
border-radius: 4px;
background: var(--primary-color);
opacity: 0;
transform: scale(0.6);
transition: all 0.2s ease;
}
.title-link:active::after {
opacity: 0.1;
transform: scale(1);
}
/* 统一图标按钮样式 */
.icon-btn {
width: 20px;
height: 20px;
padding: 2px;
border: none;
background: none;
cursor: pointer;
color: var(--text-color);
opacity: 0.7;
transition: all 0.3s ease;
}
.icon-btn:hover {
opacity: 1;
transform: scale(1.1);
color: var(--primary-color);
}
.icon-btn svg {
width: 100%;
height: 100%;
}
/* 调整密码保护标签样式 */
.badge {
font-size: 0.8em;
padding: 2px 6px;
border-radius: 4px;
background: var(--primary-color);
color: white;
}
.share-item .info {
font-size: 0.9em;
color: var(--secondary-text);
margin-bottom: 0.5rem;
padding-right: 2.5rem; /* 避免与二维码重叠 */
}
.share-item .info div {
margin: 0.25rem 0;
}
/* 操作按钮组样式 */
.share-item .actions {
display: flex;
gap: 0.5rem;
margin-top: 1rem;
align-items: center;
flex-wrap: wrap;
}
/* 二维码按钮样式 */
.share-item .qr-btn {
position: absolute;
top: 1rem;
right: 1rem;
padding: 0.4rem;
background: none;
border: none;
cursor: pointer;
color: var(--text-color);
opacity: 0.6;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
}
.share-item .qr-btn:hover {
opacity: 1;
}
.share-item .qr-btn svg {
width: 18px;
height: 18px;
}
/* 确保标题文字不会与图标重叠 */
.share-item .title-text {
margin-right: 80px; /* 为图标预留空间 */
}
/* 统计卡片 */
.admin-stats {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
margin-bottom: 1.5rem;
}
.stat-card {
background: var(--secondary-bg);
padding: 1rem;
border-radius: 8px;
text-align: center;
}
.stat-value {
font-size: 1.5rem;
font-weight: bold;
color: var(--primary-color);
}
.stat-label {
font-size: 0.9rem;
color: var(--secondary-text);
}
/* 筛选和状态 */
.filter-bar {
margin-bottom: 1rem;
display: flex;
gap: 0.5rem;
}
.filter-bar select {
padding: 0.5rem;
border: 1px solid var(--border-color);
border-radius: 4px;
background: white;
}
.upload-status {
margin: 1rem 0;
padding: 0.5rem;
border-radius: 4px;
background: var(--secondary-bg);
color: var(--text-color);
text-align: center;
}
.upload-status.error {
background: #ffebee;
color: #c62828;
}
/* 密码输入组件 */
.password-input-group {
position: relative;
display: flex;
align-items: center;
}
.password-toggle {
position: absolute;
right: 10px;
background: none;
border: none;
cursor: pointer;
color: #666;
padding: 5px;
opacity: 0.6;
transition: opacity 0.2s;
}
.password-toggle:hover {
opacity: 1;
}
/* 管理员登录按钮 */
.admin-login .actions {
display: flex;
gap: 1rem; /* 添加按钮之间的间距 */
margin-top: 1rem;
}
.admin-login .actions .btn {
flex: 1; /* 让按钮平均分配空间 */
}
.admin-login .actions .btn:last-child {
background: #95a5a6; /* 取消按钮使用不同的颜色 */
}
/* 确认对话框样式 */
.confirm-dialog {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1100;
}
.confirm-content {
background: var(--card-bg);
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 90%;
}
.confirm-content h3 {
margin: 0 0 1rem 0;
color: var(--text-color);
}
.confirm-content .warning {
color: #e74c3c;
font-weight: 500;
margin: 1rem 0;
}
.confirm-actions {
display: flex;
gap: 1rem;
margin-top: 1.5rem;
}
.confirm-actions .btn {
flex: 1;
}
.confirm-actions .btn.cancel {
background: #95a5a6;
}
/* 删除按钮默认样式 */
.delete-btn {
background-color: #e74c3c !important; /* 使用 !important 确保覆盖其他样式 */
}
/* 删除按钮悬停样式 */
.delete-btn:hover {
background-color: #c0392b !important;
}
/* Markdown 复选框 */
.markdown-toggle {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
}
.markdown-toggle input[type="checkbox"] {
margin: 0;
}
.markdown-toggle label {
margin: 0;
cursor: pointer;
}
/* 编辑页滚动优化 */
.editor-container {
display: flex;
gap: 1rem;
height: 600px;
min-height: 400px;
width: 100%; /* 限制最大宽度 */
max-width: 100%; /* 限制最大宽度 */
position: relative;
resize: both;
overflow: auto;
margin: 1rem 0;
}
.editor, .preview {
flex: 1;
padding: 1rem;
border: 1px solid var(--border-color);
border-radius: 4px;
overflow-y: auto;
position: relative;
word-wrap: break-word;
overflow-wrap: break-word;
white-space: pre-wrap;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 16px;
line-height: 1.6;
width: 0; /* 强制flex子项不超出容器 */
min-width: 0; /* 允许flex子项收缩 */
min-width: calc(50% - 0.5rem); /* 确保最小宽度不会小于容器的一半减去间距 */
}
.editor textarea {
width: 100%;
height: 100%;
border: none;
resize: none;
outline: none;
font-family: inherit;
font-size: inherit;
line-height: inherit;
padding: 0;
margin: 0;
background: transparent;
white-space: pre-wrap; /* 保留换行符并自动换行 */
word-wrap: break-word; /* 允许单词内换行 */
overflow-wrap: break-word; /* 确保长单词会换行 */
}
/* 拉伸手柄样式优化 */
.editor-container::after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 25px;
height: 25px;
cursor: nw-resize;
background: linear-gradient(135deg, transparent 50%, var(--border-color) 50%);
border-radius: 0 0 4px 0;
}
/* 编辑器预览区域的列表样式 */
.editor-container .preview ol {
list-style: none;
counter-reset: preview-item;
padding-left: 2em;
margin: 0.2em 0;
}
.editor-container .preview ol > li {
counter-increment: preview-item;
position: relative;
margin: 0.2em 0;
padding-left: 0.3em;
}
.editor-container .preview ol > li::before {
content: counter(preview-item) ".";
position: absolute;
left: -2em;
width: 1.5em;
text-align: right;
color: #3498db;
font-weight: 600;
}
/* 编辑器预览区域的嵌套列表样式 */
.editor-container .preview ol ol {
counter-reset: preview-subitem;
margin: 0.2em 0;
padding-left: 1.5em;
}
.editor-container .preview ol ol > li {
counter-increment: preview-subitem;
}
.editor-container .preview ol ol > li::before {
content: counter(preview-subitem) ".";
}
/* 编辑器预览区域的无序列表样式 */
.editor-container .preview ul {
list-style: none;
padding-left: 2em;
margin: 0.2em 0;
}
.editor-container .preview ul > li {
position: relative;
margin: 0.2em 0;
padding-left: 0.3em;
}
.editor-container .preview ul > li::before {
content: "•";
position: absolute;
left: -1.5em;
width: 1em;
text-align: center;
color: var(--text-color);
}
/* 编辑器预览区域的有序列表中的无序列表 */
.editor-container .preview ol > li > ul {
padding-left: 1.5em;
margin: 0.2em 0;
}
.editor-container .preview ol > li > ul > li {
counter-increment: none;
}
.editor-container .preview ol > li > ul > li::before {
content: "•";
left: -1.5em;