@editorcn/editor 0.1.0 → 0.1.2

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/dist/style.css CHANGED
@@ -1,8 +1,12 @@
1
+ /* ── Main Editor Wrapper ── */
1
2
  .rte-root {
2
3
  position: relative;
3
4
  border-radius: var(--radius);
4
5
  border: 1px solid var(--border);
5
6
  background-color: var(--background);
7
+ transition:
8
+ border-color 0.2s ease,
9
+ box-shadow 0.2s ease;
6
10
  }
7
11
 
8
12
  .rte-editor-icon {
@@ -18,8 +22,17 @@ button.rte-control-button {
18
22
  height: 2rem;
19
23
  width: 2rem;
20
24
  padding: 0;
25
+ transition:
26
+ background-color 0.15s ease,
27
+ color 0.15s ease,
28
+ transform 0.1s ease;
21
29
  }
22
30
 
31
+ button.rte-control-button:active {
32
+ transform: scale(0.95);
33
+ }
34
+
35
+ /* ── Editor Content ── */
23
36
  .rte-content .ProseMirror {
24
37
  outline: 0;
25
38
  padding: var(--spacing, 0.75rem);
@@ -37,6 +50,7 @@ button.rte-control-button {
37
50
  float: left;
38
51
  height: 0;
39
52
  color: var(--muted-foreground);
53
+ transition: opacity 0.2s ease;
40
54
  }
41
55
 
42
56
  .rte-content .ProseMirror p {
@@ -62,7 +76,6 @@ button.rte-control-button {
62
76
  margin-bottom: 1rem;
63
77
  margin-top: 1.5rem;
64
78
  }
65
-
66
79
  .rte-content .ProseMirror h1:first-child {
67
80
  margin-top: 0;
68
81
  }
@@ -74,7 +87,6 @@ button.rte-control-button {
74
87
  margin-bottom: 0.75rem;
75
88
  margin-top: 1.25rem;
76
89
  }
77
-
78
90
  .rte-content .ProseMirror h2:first-child {
79
91
  margin-top: 0;
80
92
  }
@@ -85,7 +97,6 @@ button.rte-control-button {
85
97
  margin-bottom: 0.5rem;
86
98
  margin-top: 1rem;
87
99
  }
88
-
89
100
  .rte-content .ProseMirror h3:first-child {
90
101
  margin-top: 0;
91
102
  }
@@ -96,7 +107,6 @@ button.rte-control-button {
96
107
  margin-bottom: 0.5rem;
97
108
  margin-top: 0.75rem;
98
109
  }
99
-
100
110
  .rte-content .ProseMirror h4:first-child {
101
111
  margin-top: 0;
102
112
  }
@@ -107,7 +117,6 @@ button.rte-control-button {
107
117
  margin-bottom: 0.5rem;
108
118
  margin-top: 0.75rem;
109
119
  }
110
-
111
120
  .rte-content .ProseMirror h5:first-child {
112
121
  margin-top: 0;
113
122
  }
@@ -118,7 +127,6 @@ button.rte-control-button {
118
127
  margin-bottom: 0.5rem;
119
128
  margin-top: 0.75rem;
120
129
  }
121
-
122
130
  .rte-content .ProseMirror h6:first-child {
123
131
  margin-top: 0;
124
132
  }
@@ -200,16 +208,22 @@ button.rte-control-button {
200
208
  text-decoration: underline;
201
209
  text-underline-offset: 4px;
202
210
  cursor: pointer;
211
+ transition:
212
+ color 0.2s ease,
213
+ text-decoration-color 0.2s ease;
214
+ text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent);
203
215
  }
204
216
 
205
217
  .rte-content .ProseMirror a:hover {
206
218
  color: color-mix(in srgb, var(--primary) 80%, transparent);
219
+ text-decoration-color: color-mix(in srgb, var(--primary) 80%, transparent);
207
220
  }
208
221
 
209
222
  .rte-content .ProseMirror ::selection {
210
223
  background-color: color-mix(in srgb, var(--primary) 15%, transparent);
211
224
  }
212
225
 
226
+ /* Syntax Highlighting */
213
227
  .rte-content .ProseMirror pre .hljs-comment,
214
228
  .rte-content .ProseMirror pre .hljs-quote {
215
229
  color: var(--muted-foreground);
@@ -256,11 +270,11 @@ button.rte-control-button {
256
270
  .rte-content .ProseMirror pre .hljs-emphasis {
257
271
  font-style: italic;
258
272
  }
259
-
260
273
  .rte-content .ProseMirror pre .hljs-strong {
261
274
  font-weight: 700;
262
275
  }
263
276
 
277
+ /* ── Toolbars and Footer ── */
264
278
  .rte-toolbar {
265
279
  display: flex;
266
280
  align-items: center;
@@ -274,10 +288,51 @@ button.rte-control-button {
274
288
  border-start-start-radius: var(--radius);
275
289
  border-bottom: 1px solid var(--border);
276
290
  padding: 0.5rem 0.75rem;
291
+ transition:
292
+ box-shadow 0.2s ease,
293
+ background-color 0.2s ease;
277
294
  }
278
295
 
279
296
  .rte-toolbar[data-sticky] {
280
297
  position: sticky;
298
+ background-color: color-mix(in srgb, var(--background) 85%, transparent);
299
+ backdrop-filter: blur(8px);
300
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
301
+ }
302
+
303
+ .rte-footer {
304
+ display: flex;
305
+ align-items: center;
306
+ justify-content: space-between;
307
+ flex-wrap: wrap;
308
+ gap: 0.5rem;
309
+ background-color: var(--background);
310
+ z-index: 1;
311
+ border-end-end-radius: var(--radius);
312
+ border-end-start-radius: var(--radius);
313
+ border-top: 1px solid var(--border);
314
+ padding: 0.5rem 0.75rem;
315
+ font-size: 0.75rem;
316
+ color: var(--muted-foreground);
317
+ }
318
+
319
+ .rte-footer[data-sticky] {
320
+ position: sticky;
321
+ bottom: 0;
322
+ background-color: color-mix(in srgb, var(--background) 85%, transparent);
323
+ backdrop-filter: blur(8px);
324
+ box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
325
+ }
326
+
327
+ .rte-footer-word-count {
328
+ white-space: nowrap;
329
+ }
330
+
331
+ .rte-toolbar--subtle + .rte-content + .rte-footer {
332
+ background-color: var(--muted);
333
+ }
334
+ .rte-toolbar--compact + .rte-content + .rte-footer {
335
+ background-color: var(--muted);
281
336
  }
282
337
 
283
338
  @media (max-width: 640px) {
@@ -288,6 +343,7 @@ button.rte-control-button {
288
343
  scrollbar-width: none;
289
344
  -ms-overflow-style: none;
290
345
  -webkit-overflow-scrolling: touch;
346
+ mask-image: linear-gradient(to right, black 95%, transparent 100%);
291
347
  }
292
348
  .rte-toolbar::-webkit-scrollbar {
293
349
  display: none;
@@ -305,8 +361,11 @@ button.rte-control-button {
305
361
  min-width: 1.625rem;
306
362
  height: 1.625rem;
307
363
  background-color: var(--background);
364
+ transition: all 0.15s ease;
308
365
  }
309
- .rte-root[data-variant="default"] .rte-controls-group > button:not(:last-of-type) {
366
+ .rte-root[data-variant="default"]
367
+ .rte-controls-group
368
+ > button:not(:last-of-type) {
310
369
  border-inline-end-width: 0;
311
370
  }
312
371
  .rte-root[data-variant="default"] .rte-controls-group > button:first-of-type {
@@ -322,15 +381,25 @@ button.rte-control-button {
322
381
  color: var(--accent-foreground);
323
382
  }
324
383
  .rte-root[data-variant="default"] .rte-controls-group > button[data-state="on"],
325
- .rte-root[data-variant="default"] .rte-controls-group > button[aria-pressed="true"] {
384
+ .rte-root[data-variant="default"]
385
+ .rte-controls-group
386
+ > button[aria-pressed="true"] {
326
387
  background-color: var(--accent);
327
388
  color: var(--accent-foreground);
389
+ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
328
390
  }
329
391
 
330
392
  /* ── Subtle variant: elevated card with soft toolbar ── */
331
393
  .rte-root[data-variant="subtle"] {
332
394
  border-color: transparent;
333
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
395
+ box-shadow:
396
+ 0 1px 3px rgba(0, 0, 0, 0.06),
397
+ 0 1px 2px rgba(0, 0, 0, 0.04);
398
+ }
399
+ .rte-root[data-variant="subtle"]:focus-within {
400
+ box-shadow:
401
+ 0 4px 12px rgba(0, 0, 0, 0.08),
402
+ 0 0 0 1px var(--primary);
334
403
  }
335
404
  .rte-toolbar--subtle {
336
405
  border-bottom: 1px solid var(--border);
@@ -351,14 +420,17 @@ button.rte-control-button {
351
420
  min-width: 2rem;
352
421
  height: 2rem;
353
422
  background-color: transparent;
423
+ transition: all 0.15s ease;
354
424
  }
355
425
  .rte-root[data-variant="subtle"] .rte-controls-group > button:hover {
356
426
  background-color: var(--accent);
357
427
  color: var(--accent-foreground);
358
428
  }
359
429
  .rte-root[data-variant="subtle"] .rte-controls-group > button[data-state="on"],
360
- .rte-root[data-variant="subtle"] .rte-controls-group > button[aria-pressed="true"] {
361
- background-color: var(--accent);
430
+ .rte-root[data-variant="subtle"]
431
+ .rte-controls-group
432
+ > button[aria-pressed="true"] {
433
+ background-color: color-mix(in srgb, var(--accent) 90%, black 5%);
362
434
  color: var(--accent-foreground);
363
435
  }
364
436
 
@@ -386,13 +458,16 @@ button.rte-control-button {
386
458
  min-width: 1.5rem;
387
459
  height: 1.5rem;
388
460
  background-color: transparent;
461
+ transition: all 0.15s ease;
389
462
  }
390
463
  .rte-root[data-variant="compact"] .rte-controls-group > button:hover {
391
464
  background-color: var(--accent);
392
465
  color: var(--accent-foreground);
393
466
  }
394
467
  .rte-root[data-variant="compact"] .rte-controls-group > button[data-state="on"],
395
- .rte-root[data-variant="compact"] .rte-controls-group > button[aria-pressed="true"] {
468
+ .rte-root[data-variant="compact"]
469
+ .rte-controls-group
470
+ > button[aria-pressed="true"] {
396
471
  background-color: var(--accent);
397
472
  color: var(--accent-foreground);
398
473
  }
@@ -423,6 +498,7 @@ button.rte-control-button {
423
498
  border-end-start-radius: 0;
424
499
  }
425
500
 
501
+ /* ── Task Lists ── */
426
502
  .rte-task-list {
427
503
  list-style-type: none;
428
504
  padding: 0;
@@ -435,6 +511,11 @@ button.rte-control-button {
435
511
  display: flex;
436
512
  align-items: flex-start;
437
513
  gap: 0.5rem;
514
+ transition: opacity 0.2s ease;
515
+ }
516
+
517
+ .rte-task-list li[data-checked] {
518
+ opacity: 0.6;
438
519
  }
439
520
 
440
521
  .rte-task-list li[data-checked] > div {
@@ -468,6 +549,14 @@ button.rte-control-button {
468
549
  vertical-align: middle;
469
550
  position: relative;
470
551
  flex-shrink: 0;
552
+ transition:
553
+ background-color 0.2s ease,
554
+ border-color 0.2s ease,
555
+ transform 0.1s ease;
556
+ }
557
+
558
+ .rte-task-list input[type="checkbox"]:active {
559
+ transform: scale(0.9);
471
560
  }
472
561
 
473
562
  .rte-task-list input[type="checkbox"]:checked {
@@ -475,20 +564,43 @@ button.rte-control-button {
475
564
  border-color: var(--primary);
476
565
  }
477
566
 
567
+ /* Pop animation for the checkmark */
568
+ @keyframes checkmark-in {
569
+ 0% {
570
+ transform: scale(0.5) rotate(-15deg);
571
+ opacity: 0;
572
+ }
573
+ 100% {
574
+ transform: scale(1) rotate(0);
575
+ opacity: 1;
576
+ }
577
+ }
578
+
579
+ .rte-task-list input[type="checkbox"]:checked::before {
580
+ position: absolute;
581
+ content: "";
582
+ inset: 0;
583
+ background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxMCA3Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNCA0LjU4NkwxLjcwNyAyLjI5M0ExIDEgMCAxMC4yOTMgMy43MDdsMyAzYS45OTcuOTk3IDAgMDAxLjQxNCAwbDUtNUExIDEgMCAxMDguMjkzLjI5M0w0IDQuNTg2eiIvPjwvc3ZnPg==");
584
+ background-repeat: no-repeat;
585
+ background-size: 10px;
586
+ background-position: center;
587
+ animation: checkmark-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
588
+ }
589
+
478
590
  /* ── Embed nodes ── */
479
591
  .rte-embed-wrapper {
480
592
  margin: 1rem 0;
481
- transition: opacity 0.2s;
593
+ transition:
594
+ opacity 0.25s ease,
595
+ transform 0.25s ease;
482
596
  }
483
597
 
484
598
  .rte-embed-wrapper[data-align="left"] {
485
599
  text-align: left;
486
600
  }
487
-
488
601
  .rte-embed-wrapper[data-align="center"] {
489
602
  text-align: center;
490
603
  }
491
-
492
604
  .rte-embed-wrapper[data-align="right"] {
493
605
  text-align: right;
494
606
  }
@@ -497,6 +609,7 @@ button.rte-control-button {
497
609
  outline: 2px solid var(--primary);
498
610
  outline-offset: 2px;
499
611
  border-radius: var(--radius);
612
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
500
613
  }
501
614
 
502
615
  .rte-embed {
@@ -505,6 +618,9 @@ button.rte-control-button {
505
618
  border-radius: var(--radius);
506
619
  background: var(--muted);
507
620
  display: inline-block;
621
+ transition:
622
+ outline-color 0.2s ease,
623
+ box-shadow 0.2s ease;
508
624
  }
509
625
 
510
626
  .rte-embed-iframe {
@@ -519,6 +635,17 @@ button.rte-control-button {
519
635
  padding: 2rem;
520
636
  text-align: center;
521
637
  color: var(--muted-foreground);
638
+ animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
639
+ }
640
+
641
+ @keyframes pulse {
642
+ 0%,
643
+ 100% {
644
+ opacity: 1;
645
+ }
646
+ 50% {
647
+ opacity: 0.5;
648
+ }
522
649
  }
523
650
 
524
651
  /* ── Resize handles for embeds ── */
@@ -526,7 +653,9 @@ button.rte-control-button {
526
653
  position: absolute;
527
654
  z-index: 10;
528
655
  opacity: 0;
529
- transition: opacity 0.15s;
656
+ transition:
657
+ opacity 0.2s ease,
658
+ background-color 0.2s ease;
530
659
  }
531
660
 
532
661
  .rte-embed-wrapper[data-selected] .rte-resize-handle {
@@ -549,6 +678,14 @@ button.rte-control-button {
549
678
  width: 2px;
550
679
  background: var(--primary);
551
680
  border-radius: 1px;
681
+ transition:
682
+ width 0.2s ease,
683
+ inset 0.2s ease;
684
+ }
685
+
686
+ .rte-resize-handle--right:hover::after {
687
+ width: 4px;
688
+ inset: 4px 0;
552
689
  }
553
690
 
554
691
  .rte-resize-handle--bottom {
@@ -569,6 +706,14 @@ button.rte-control-button {
569
706
  background: var(--primary);
570
707
  border-radius: 1px;
571
708
  bottom: 1px;
709
+ transition:
710
+ height 0.2s ease,
711
+ bottom 0.2s ease;
712
+ }
713
+
714
+ .rte-resize-handle--bottom:hover::after {
715
+ height: 4px;
716
+ bottom: 0;
572
717
  }
573
718
 
574
719
  .rte-resize-handle--corner {
@@ -580,14 +725,9 @@ button.rte-control-button {
580
725
  background: var(--primary);
581
726
  border: 2px solid var(--background);
582
727
  border-radius: 2px;
728
+ transition: transform 0.15s ease;
583
729
  }
584
730
 
585
- .rte-task-list input[type="checkbox"]:checked::before {
586
- position: absolute;
587
- content: "";
588
- inset: 0;
589
- background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxMCA3Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNCA0LjU4NkwxLjcwNyAyLjI5M0ExIDEgMCAxMC4yOTMgMy43MDdsMyAzYS45OTcuOTk3IDAgMDAxLjQxNCAwbDUtNUExIDEgMCAxMDguMjkzLjI5M0w0IDQuNTg2eiIvPjwvc3ZnPg==');
590
- background-repeat: no-repeat;
591
- background-size: 10px;
592
- background-position: center;
731
+ .rte-resize-handle--corner:hover {
732
+ transform: scale(1.15);
593
733
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editorcn/editor",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",