@editorcn/editor 0.3.1 → 0.3.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/dist/style.css CHANGED
@@ -216,10 +216,6 @@ button.rte-control-button:active {
216
216
  text-decoration-color: color-mix(in srgb, var(--primary) 80%, transparent);
217
217
  }
218
218
 
219
- .rte-content .ProseMirror ::selection {
220
- background-color: color-mix(in srgb, var(--primary) 15%, transparent);
221
- }
222
-
223
219
  /* Syntax Highlighting */
224
220
  .rte-content .ProseMirror pre .hljs-comment,
225
221
  .rte-content .ProseMirror pre .hljs-quote {
@@ -737,19 +733,25 @@ button.rte-control-button:active {
737
733
 
738
734
  /* ── Embed nodes ── */
739
735
  .rte-embed-wrapper {
736
+ display: flex;
737
+ width: 100%;
740
738
  margin: 1rem 0;
739
+ position: relative;
741
740
  transition:
742
741
  opacity 150ms ease-out,
743
742
  transform 150ms ease-out;
744
743
  }
745
744
 
746
745
  .rte-embed-wrapper[data-align="left"] {
746
+ justify-content: flex-start;
747
747
  text-align: left;
748
748
  }
749
749
  .rte-embed-wrapper[data-align="center"] {
750
+ justify-content: center;
750
751
  text-align: center;
751
752
  }
752
753
  .rte-embed-wrapper[data-align="right"] {
754
+ justify-content: flex-end;
753
755
  text-align: right;
754
756
  }
755
757
 
@@ -762,7 +764,7 @@ button.rte-control-button:active {
762
764
 
763
765
  .rte-embed {
764
766
  position: relative;
765
- overflow: hidden;
767
+ overflow: visible;
766
768
  border-radius: var(--radius);
767
769
  background: var(--muted);
768
770
  display: inline-block;
@@ -777,6 +779,7 @@ button.rte-control-button:active {
777
779
  aspect-ratio: 16 / 9;
778
780
  border: 0;
779
781
  display: block;
782
+ border-radius: var(--radius);
780
783
  }
781
784
 
782
785
  .rte-embed-loading {
@@ -796,6 +799,134 @@ button.rte-control-button:active {
796
799
  }
797
800
  }
798
801
 
802
+ /* ── Floating Embed Selector Toolbar ── */
803
+ .rte-embed-selector {
804
+ position: absolute;
805
+ top: -46px;
806
+ left: 50%;
807
+ transform: translateX(-50%);
808
+ z-index: 50;
809
+ display: flex;
810
+ align-items: center;
811
+ height: 2.25rem;
812
+ background: var(--popover);
813
+ border: 1px solid var(--border);
814
+ border-radius: var(--radius);
815
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
816
+ padding: 0 0.375rem;
817
+ gap: 0.25rem;
818
+ white-space: nowrap;
819
+ animation: rte-bubble-pop-in 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
820
+ pointer-events: auto;
821
+ }
822
+
823
+ .rte-embed-selector-group {
824
+ display: flex;
825
+ align-items: center;
826
+ gap: 2px;
827
+ }
828
+
829
+ .rte-embed-selector-divider {
830
+ width: 1px;
831
+ height: 1.25rem;
832
+ background: var(--border);
833
+ margin: 0 0.125rem;
834
+ flex-shrink: 0;
835
+ }
836
+
837
+ .rte-embed-selector-btn {
838
+ display: inline-flex;
839
+ align-items: center;
840
+ justify-content: center;
841
+ height: 1.75rem;
842
+ min-width: 1.75rem;
843
+ padding: 0 0.375rem;
844
+ border: none;
845
+ border-radius: calc(var(--radius) - 4px);
846
+ background: transparent;
847
+ color: var(--popover-foreground);
848
+ cursor: pointer;
849
+ font-size: 0.75rem;
850
+ font-weight: 500;
851
+ transition:
852
+ background-color 150ms ease-out,
853
+ color 150ms ease-out,
854
+ transform 100ms ease-out;
855
+ }
856
+
857
+ .rte-embed-selector-btn:hover {
858
+ background: var(--accent);
859
+ color: var(--accent-foreground);
860
+ }
861
+
862
+ .rte-embed-selector-btn:active {
863
+ transform: scale(0.96);
864
+ }
865
+
866
+ .rte-embed-selector-btn--active {
867
+ color: var(--primary);
868
+ background: color-mix(in srgb, var(--primary) 12%, transparent);
869
+ }
870
+
871
+ .rte-embed-selector-btn--preset {
872
+ font-weight: 600;
873
+ font-size: 0.7rem;
874
+ letter-spacing: 0.02em;
875
+ }
876
+
877
+ .rte-embed-selector-btn--danger:hover {
878
+ background: color-mix(in srgb, var(--destructive) 15%, transparent);
879
+ color: var(--destructive);
880
+ }
881
+
882
+ .rte-embed-selector-btn--save {
883
+ background: var(--primary);
884
+ color: var(--primary-foreground);
885
+ padding: 0 0.5rem;
886
+ }
887
+ .rte-embed-selector-btn--save:hover {
888
+ background: color-mix(in srgb, var(--primary) 90%, black);
889
+ color: var(--primary-foreground);
890
+ }
891
+
892
+ .rte-embed-selector-edit-form {
893
+ display: flex;
894
+ align-items: center;
895
+ gap: 0.375rem;
896
+ }
897
+
898
+ .rte-embed-selector-input {
899
+ height: 1.75rem;
900
+ width: 220px;
901
+ padding: 0 0.5rem;
902
+ font-size: 0.75rem;
903
+ border-radius: calc(var(--radius) - 4px);
904
+ border: 1px solid var(--border);
905
+ background: var(--background);
906
+ color: var(--foreground);
907
+ outline: none;
908
+ }
909
+
910
+ .rte-embed-selector-input:focus {
911
+ border-color: var(--primary);
912
+ }
913
+
914
+ .rte-embed-resize-badge {
915
+ position: absolute;
916
+ bottom: 8px;
917
+ right: 8px;
918
+ z-index: 40;
919
+ background: rgba(0, 0, 0, 0.75);
920
+ color: #fff;
921
+ font-size: 0.7rem;
922
+ font-weight: 600;
923
+ padding: 2px 6px;
924
+ border-radius: 4px;
925
+ pointer-events: none;
926
+ backdrop-filter: blur(4px);
927
+ font-family: var(--font-mono, monospace);
928
+ }
929
+
799
930
  /* ── Resize handles for embeds ── */
800
931
  .rte-resize-handle {
801
932
  position: absolute;
@@ -810,6 +941,32 @@ button.rte-control-button:active {
810
941
  opacity: 1;
811
942
  }
812
943
 
944
+ .rte-resize-handle--left {
945
+ top: 0;
946
+ bottom: 0;
947
+ left: -3px;
948
+ width: 6px;
949
+ cursor: ew-resize;
950
+ background: transparent;
951
+ }
952
+
953
+ .rte-resize-handle--left::after {
954
+ content: "";
955
+ position: absolute;
956
+ inset: 4px 1px;
957
+ width: 2px;
958
+ background: var(--primary);
959
+ border-radius: 1px;
960
+ transition:
961
+ width 150ms ease-out,
962
+ inset 150ms ease-out;
963
+ }
964
+
965
+ .rte-resize-handle--left:hover::after {
966
+ width: 4px;
967
+ inset: 4px 0;
968
+ }
969
+
813
970
  .rte-resize-handle--right {
814
971
  top: 0;
815
972
  bottom: 0;
@@ -865,17 +1022,26 @@ button.rte-control-button:active {
865
1022
  }
866
1023
 
867
1024
  .rte-resize-handle--corner {
868
- bottom: -5px;
869
- right: -5px;
870
1025
  width: 12px;
871
1026
  height: 12px;
872
- cursor: nwse-resize;
873
1027
  background: var(--primary);
874
1028
  border: 2px solid var(--background);
875
1029
  border-radius: 2px;
876
1030
  transition: transform 150ms ease-out;
877
1031
  }
878
1032
 
1033
+ .rte-resize-handle--corner-br {
1034
+ bottom: -5px;
1035
+ right: -5px;
1036
+ cursor: nwse-resize;
1037
+ }
1038
+
1039
+ .rte-resize-handle--corner-bl {
1040
+ bottom: -5px;
1041
+ left: -5px;
1042
+ cursor: nesw-resize;
1043
+ }
1044
+
879
1045
  .rte-resize-handle--corner:hover {
880
1046
  transform: scale(1.15);
881
1047
  }
@@ -1071,6 +1237,123 @@ button.rte-control-button:active {
1071
1237
  color: var(--primary);
1072
1238
  }
1073
1239
 
1240
+ .rte-bubble-dropdown-divider {
1241
+ height: 1px;
1242
+ background: var(--border);
1243
+ margin: 0.25rem 0;
1244
+ }
1245
+
1246
+ .rte-bubble-dropdown--color {
1247
+ min-width: auto;
1248
+ padding: 0.5rem;
1249
+ }
1250
+
1251
+ .rte-bubble-dropdown--color .rte-bubble-dropdown-divider {
1252
+ margin: 0.5rem 0 0.375rem;
1253
+ }
1254
+
1255
+ .rte-bubble-color-section {
1256
+ display: flex;
1257
+ flex-direction: column;
1258
+ gap: 0.5rem;
1259
+ }
1260
+
1261
+ .rte-bubble-color-label {
1262
+ padding: 0 0.125rem;
1263
+ color: var(--muted-foreground);
1264
+ font-size: 0.75rem;
1265
+ font-weight: 700;
1266
+ line-height: 1;
1267
+ }
1268
+
1269
+ .rte-bubble-color-grid {
1270
+ display: grid;
1271
+ grid-template-columns: repeat(5, 1.5rem);
1272
+ justify-content: center;
1273
+ gap: 0.375rem;
1274
+ }
1275
+
1276
+ .rte-bubble-color-recent {
1277
+ display: flex;
1278
+ flex-wrap: wrap;
1279
+ justify-content: center;
1280
+ gap: 0.375rem;
1281
+ }
1282
+
1283
+ .rte-bubble-color-swatch {
1284
+ display: inline-flex;
1285
+ align-items: center;
1286
+ justify-content: center;
1287
+ width: 1.5rem;
1288
+ height: 1.5rem;
1289
+ padding: 0;
1290
+ border-radius: 999px;
1291
+ border: 1px solid transparent;
1292
+ cursor: pointer;
1293
+ transition:
1294
+ transform 120ms cubic-bezier(0.34, 1.56, 0.64, 1),
1295
+ background-color 100ms ease-out,
1296
+ border-color 100ms ease-out,
1297
+ color 100ms ease-out,
1298
+ box-shadow 120ms ease-out;
1299
+ }
1300
+
1301
+ .rte-bubble-color-swatch:hover {
1302
+ transform: scale(1.1);
1303
+ }
1304
+
1305
+ .rte-bubble-color-swatch:active {
1306
+ transform: scale(0.96);
1307
+ }
1308
+
1309
+ .rte-bubble-color-swatch:focus-visible {
1310
+ outline: 2px solid var(--ring);
1311
+ outline-offset: 1px;
1312
+ }
1313
+
1314
+ .rte-bubble-color-swatch--text {
1315
+ background: transparent;
1316
+ border-color: var(--swatch-color);
1317
+ color: var(--swatch-color);
1318
+ }
1319
+
1320
+ .rte-bubble-color-swatch--text.rte-bubble-color-swatch--active {
1321
+ background: var(--swatch-color);
1322
+ border-color: var(--swatch-color);
1323
+ color: var(--swatch-check);
1324
+ }
1325
+
1326
+ .rte-bubble-color-swatch--highlight {
1327
+ background: var(--swatch-color);
1328
+ border-color: transparent;
1329
+ color: var(--swatch-check);
1330
+ }
1331
+
1332
+ .rte-bubble-color-swatch--highlight.rte-bubble-color-swatch--active {
1333
+ box-shadow: 0 0 0 2px
1334
+ color-mix(in srgb, var(--swatch-color) 55%, var(--popover-foreground));
1335
+ }
1336
+
1337
+ .rte-bubble-color-glyph {
1338
+ font-size: 0.625rem;
1339
+ font-weight: 700;
1340
+ line-height: 1;
1341
+ }
1342
+
1343
+ .rte-bubble-color-check {
1344
+ display: flex;
1345
+ align-items: center;
1346
+ justify-content: center;
1347
+ width: 0.75rem;
1348
+ height: 0.75rem;
1349
+ color: var(--swatch-check);
1350
+ }
1351
+
1352
+ .rte-bubble-color-check svg {
1353
+ width: 100%;
1354
+ height: 100%;
1355
+ }
1356
+
1074
1357
  /* ── Suppress transitions on theme switch ── */
1075
1358
  .rte-theme-transitioning *,
1076
1359
  .rte-theme-transitioning *::before,
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "@editorcn/editor",
3
- "version": "0.3.1",
4
- "files": [
5
- "dist"
6
- ],
7
- "type": "module",
8
- "main": "./dist/index.cjs",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js",
15
- "require": "./dist/index.cjs"
16
- },
17
- "./style.css": "./dist/style.css"
18
- },
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
- "scripts": {
23
- "build": "tsup && node -e \"require('fs').copyFileSync('src/style.css','dist/style.css')\"",
24
- "dev": "tsup --watch",
25
- "typecheck": "tsc --noEmit",
26
- "prepublishOnly": "pnpm build"
27
- },
28
- "dependencies": {
29
- "clsx": "^2.1.1",
30
- "lucide-react": ">=0.400.0 <1.0.0",
31
- "tailwind-merge": "^3.0.0"
32
- },
33
- "devDependencies": {
34
- "@types/react": "^19",
35
- "tsup": "^8.4.0",
36
- "typescript": "^5"
37
- },
38
- "peerDependencies": {
39
- "@base-ui/react": "^1.0.0",
40
- "@floating-ui/dom": "^1.6.0",
41
- "@tiptap/core": ">=3.0.0 <4",
42
- "@tiptap/extension-code-block-lowlight": ">=3.0.0 <4",
43
- "@tiptap/extension-link": ">=3.0.0 <4",
44
- "@tiptap/extension-placeholder": ">=3.0.0 <4",
45
- "@tiptap/extension-underline": ">=3.0.0 <4",
46
- "@tiptap/pm": ">=3.0.0 <4",
47
- "@tiptap/react": ">=3.0.0 <4",
48
- "@tiptap/starter-kit": ">=3.0.0 <4",
49
- "class-variance-authority": "^0.7.1",
50
- "lowlight": ">=3.0.0 <4",
51
- "react": "^18 || ^19",
52
- "react-dom": "^18 || ^19"
53
- },
54
- "peerDependenciesMeta": {
55
- "@tiptap/extension-code-block-lowlight": {
56
- "optional": true
57
- },
58
- "lowlight": {
59
- "optional": true
60
- },
61
- "@tiptap/extension-placeholder": {
62
- "optional": true
63
- }
64
- }
65
- }
1
+ {
2
+ "name": "@editorcn/editor",
3
+ "version": "0.3.3",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "type": "module",
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ },
17
+ "./style.css": "./dist/style.css"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "scripts": {
23
+ "build": "tsup && node -e \"require('fs').copyFileSync('src/style.css','dist/style.css')\"",
24
+ "dev": "tsup --watch",
25
+ "typecheck": "tsc --noEmit",
26
+ "prepublishOnly": "pnpm build"
27
+ },
28
+ "dependencies": {
29
+ "clsx": "^2.1.1",
30
+ "lucide-react": ">=0.400.0 <1.0.0",
31
+ "tailwind-merge": "^3.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/react": "^19",
35
+ "tsup": "^8.4.0",
36
+ "typescript": "^5"
37
+ },
38
+ "peerDependencies": {
39
+ "@base-ui/react": "^1.0.0",
40
+ "@floating-ui/dom": "^1.6.0",
41
+ "@tiptap/core": ">=3.0.0 <4",
42
+ "@tiptap/extension-code-block-lowlight": ">=3.0.0 <4",
43
+ "@tiptap/extension-link": ">=3.0.0 <4",
44
+ "@tiptap/extension-placeholder": ">=3.0.0 <4",
45
+ "@tiptap/extension-underline": ">=3.0.0 <4",
46
+ "@tiptap/pm": ">=3.0.0 <4",
47
+ "@tiptap/react": ">=3.0.0 <4",
48
+ "@tiptap/starter-kit": ">=3.0.0 <4",
49
+ "class-variance-authority": "^0.7.1",
50
+ "lowlight": ">=3.0.0 <4",
51
+ "react": "^18 || ^19",
52
+ "react-dom": "^18 || ^19"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@tiptap/extension-code-block-lowlight": {
56
+ "optional": true
57
+ },
58
+ "lowlight": {
59
+ "optional": true
60
+ },
61
+ "@tiptap/extension-placeholder": {
62
+ "optional": true
63
+ }
64
+ }
65
+ }