notra-editor 0.4.0 → 0.6.0

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.
Files changed (102) hide show
  1. package/dist/components/code-block-view/code-block-shell.cjs +41 -0
  2. package/dist/components/code-block-view/code-block-shell.cjs.map +1 -0
  3. package/dist/components/code-block-view/code-block-shell.d.cts +11 -0
  4. package/dist/components/code-block-view/code-block-shell.d.ts +11 -0
  5. package/dist/components/code-block-view/code-block-shell.mjs +17 -0
  6. package/dist/components/code-block-view/code-block-shell.mjs.map +1 -0
  7. package/dist/components/{code-block-view.cjs → code-block-view/code-block-view.cjs} +16 -8
  8. package/dist/components/code-block-view/code-block-view.cjs.map +1 -0
  9. package/dist/components/code-block-view/code-block-view.d.cts +6 -0
  10. package/dist/components/code-block-view/code-block-view.d.ts +6 -0
  11. package/dist/components/code-block-view/code-block-view.mjs +26 -0
  12. package/dist/components/code-block-view/code-block-view.mjs.map +1 -0
  13. package/dist/components/code-block-view/language-select.cjs +91 -0
  14. package/dist/components/code-block-view/language-select.cjs.map +1 -0
  15. package/dist/components/code-block-view/language-select.d.cts +11 -0
  16. package/dist/components/code-block-view/language-select.d.ts +11 -0
  17. package/dist/components/code-block-view/language-select.mjs +74 -0
  18. package/dist/components/code-block-view/language-select.mjs.map +1 -0
  19. package/dist/components/image-popover/image-popover.cjs +161 -0
  20. package/dist/components/image-popover/image-popover.cjs.map +1 -0
  21. package/dist/components/image-popover/image-popover.d.cts +9 -0
  22. package/dist/components/image-popover/image-popover.d.ts +9 -0
  23. package/dist/components/image-popover/image-popover.mjs +137 -0
  24. package/dist/components/image-popover/image-popover.mjs.map +1 -0
  25. package/dist/components/image-popover/use-image-popover.cjs +88 -0
  26. package/dist/components/image-popover/use-image-popover.cjs.map +1 -0
  27. package/dist/components/image-popover/use-image-popover.d.cts +19 -0
  28. package/dist/components/image-popover/use-image-popover.d.ts +19 -0
  29. package/dist/components/image-popover/use-image-popover.mjs +64 -0
  30. package/dist/components/image-popover/use-image-popover.mjs.map +1 -0
  31. package/dist/components/link-popover/link-popover.cjs +12 -3
  32. package/dist/components/link-popover/link-popover.cjs.map +1 -1
  33. package/dist/components/link-popover/link-popover.mjs +12 -3
  34. package/dist/components/link-popover/link-popover.mjs.map +1 -1
  35. package/dist/components/link-popover/use-link-popover.cjs +17 -2
  36. package/dist/components/link-popover/use-link-popover.cjs.map +1 -1
  37. package/dist/components/link-popover/use-link-popover.d.cts +1 -0
  38. package/dist/components/link-popover/use-link-popover.d.ts +1 -0
  39. package/dist/components/link-popover/use-link-popover.mjs +17 -2
  40. package/dist/components/link-popover/use-link-popover.mjs.map +1 -1
  41. package/dist/components/ui/command.cjs +144 -0
  42. package/dist/components/ui/command.cjs.map +1 -0
  43. package/dist/components/ui/command.d.cts +12 -0
  44. package/dist/components/ui/command.d.ts +12 -0
  45. package/dist/components/ui/command.mjs +115 -0
  46. package/dist/components/ui/command.mjs.map +1 -0
  47. package/dist/extensions/code-block.cjs +76 -19
  48. package/dist/extensions/code-block.cjs.map +1 -1
  49. package/dist/extensions/code-block.d.cts +7 -3
  50. package/dist/extensions/code-block.d.ts +7 -3
  51. package/dist/extensions/code-block.mjs +73 -8
  52. package/dist/extensions/code-block.mjs.map +1 -1
  53. package/dist/extensions/editor.cjs +2 -0
  54. package/dist/extensions/editor.cjs.map +1 -1
  55. package/dist/extensions/editor.d.cts +4 -3
  56. package/dist/extensions/editor.d.ts +4 -3
  57. package/dist/extensions/editor.mjs +2 -0
  58. package/dist/extensions/editor.mjs.map +1 -1
  59. package/dist/extensions/index.d.cts +2 -1
  60. package/dist/extensions/index.d.ts +2 -1
  61. package/dist/extensions/shared.cjs +8 -2
  62. package/dist/extensions/shared.cjs.map +1 -1
  63. package/dist/extensions/shared.d.cts +3 -1
  64. package/dist/extensions/shared.d.ts +3 -1
  65. package/dist/extensions/shared.mjs +8 -2
  66. package/dist/extensions/shared.mjs.map +1 -1
  67. package/dist/index.cjs +23 -2
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.d.cts +7 -0
  70. package/dist/index.d.ts +7 -0
  71. package/dist/index.mjs +18 -1
  72. package/dist/index.mjs.map +1 -1
  73. package/dist/lib/highlight-code-to-html.cjs +38 -0
  74. package/dist/lib/highlight-code-to-html.cjs.map +1 -0
  75. package/dist/lib/highlight-code-to-html.d.cts +6 -0
  76. package/dist/lib/highlight-code-to-html.d.ts +6 -0
  77. package/dist/lib/highlight-code-to-html.mjs +14 -0
  78. package/dist/lib/highlight-code-to-html.mjs.map +1 -0
  79. package/dist/lib/languages.cjs +181 -0
  80. package/dist/lib/languages.cjs.map +1 -0
  81. package/dist/lib/languages.d.cts +24 -0
  82. package/dist/lib/languages.d.ts +24 -0
  83. package/dist/lib/languages.mjs +155 -0
  84. package/dist/lib/languages.mjs.map +1 -0
  85. package/dist/notra-editor.cjs +3 -1
  86. package/dist/notra-editor.cjs.map +1 -1
  87. package/dist/notra-editor.mjs +3 -1
  88. package/dist/notra-editor.mjs.map +1 -1
  89. package/dist/notra-reader.cjs +32 -3
  90. package/dist/notra-reader.cjs.map +1 -1
  91. package/dist/notra-reader.d.cts +11 -1
  92. package/dist/notra-reader.d.ts +11 -1
  93. package/dist/notra-reader.mjs +32 -3
  94. package/dist/notra-reader.mjs.map +1 -1
  95. package/dist/styles/globals.css +112 -0
  96. package/dist/themes/default/shared.css +150 -5
  97. package/package.json +6 -1
  98. package/dist/components/code-block-view.cjs.map +0 -1
  99. package/dist/components/code-block-view.d.cts +0 -12
  100. package/dist/components/code-block-view.d.ts +0 -12
  101. package/dist/components/code-block-view.mjs +0 -17
  102. package/dist/components/code-block-view.mjs.map +0 -1
@@ -223,6 +223,10 @@
223
223
  width: calc(var(--nt-spacing) * 3);
224
224
  height: calc(var(--nt-spacing) * 3);
225
225
  }
226
+ .nt\:size-4 {
227
+ width: calc(var(--nt-spacing) * 4);
228
+ height: calc(var(--nt-spacing) * 4);
229
+ }
226
230
  .nt\:size-6 {
227
231
  width: calc(var(--nt-spacing) * 6);
228
232
  height: calc(var(--nt-spacing) * 6);
@@ -254,18 +258,27 @@
254
258
  .nt\:h-9 {
255
259
  height: calc(var(--nt-spacing) * 9);
256
260
  }
261
+ .nt\:h-full {
262
+ height: 100%;
263
+ }
257
264
  .nt\:h-px {
258
265
  height: 1px;
259
266
  }
260
267
  .nt\:max-h-\(--radix-dropdown-menu-content-available-height\) {
261
268
  max-height: var(--radix-dropdown-menu-content-available-height);
262
269
  }
270
+ .nt\:max-h-\[300px\] {
271
+ max-height: 300px;
272
+ }
263
273
  .nt\:w-\(--radix-dropdown-menu-trigger-width\) {
264
274
  width: var(--radix-dropdown-menu-trigger-width);
265
275
  }
266
276
  .nt\:w-72 {
267
277
  width: calc(var(--nt-spacing) * 72);
268
278
  }
279
+ .nt\:w-\[200px\] {
280
+ width: 200px;
281
+ }
269
282
  .nt\:w-auto {
270
283
  width: auto;
271
284
  }
@@ -284,6 +297,9 @@
284
297
  .nt\:min-w-\[96px\] {
285
298
  min-width: 96px;
286
299
  }
300
+ .nt\:flex-1 {
301
+ flex: 1;
302
+ }
287
303
  .nt\:shrink-0 {
288
304
  flex-shrink: 0;
289
305
  }
@@ -296,9 +312,18 @@
296
312
  .nt\:cursor-default {
297
313
  cursor: default;
298
314
  }
315
+ .nt\:scroll-py-1 {
316
+ scroll-padding-block: calc(var(--nt-spacing) * 1);
317
+ }
318
+ .nt\:flex-col {
319
+ flex-direction: column;
320
+ }
299
321
  .nt\:items-center {
300
322
  align-items: center;
301
323
  }
324
+ .nt\:justify-between {
325
+ justify-content: space-between;
326
+ }
302
327
  .nt\:justify-center {
303
328
  justify-content: center;
304
329
  }
@@ -311,6 +336,9 @@
311
336
  .nt\:gap-1\.5 {
312
337
  gap: calc(var(--nt-spacing) * 1.5);
313
338
  }
339
+ .nt\:gap-2 {
340
+ gap: calc(var(--nt-spacing) * 2);
341
+ }
314
342
  .nt\:overflow-hidden {
315
343
  overflow: hidden;
316
344
  }
@@ -336,6 +364,10 @@
336
364
  border-style: var(--tw-border-style);
337
365
  border-width: 1px;
338
366
  }
367
+ .nt\:border-b {
368
+ border-bottom-style: var(--tw-border-style);
369
+ border-bottom-width: 1px;
370
+ }
339
371
  .nt\:border-none {
340
372
  --tw-border-style: none;
341
373
  border-style: none;
@@ -343,6 +375,12 @@
343
375
  .nt\:border-border {
344
376
  border-color: var(--border);
345
377
  }
378
+ .nt\:border-foreground\/10 {
379
+ border-color: var(--foreground);
380
+ @supports (color: color-mix(in lab, red, red)) {
381
+ border-color: color-mix(in oklab, var(--foreground) 10%, transparent);
382
+ }
383
+ }
346
384
  .nt\:border-input {
347
385
  border-color: var(--input);
348
386
  }
@@ -376,6 +414,9 @@
376
414
  .nt\:bg-clip-padding {
377
415
  background-clip: padding-box;
378
416
  }
417
+ .nt\:p-0 {
418
+ padding: calc(var(--nt-spacing) * 0);
419
+ }
379
420
  .nt\:p-1 {
380
421
  padding: calc(var(--nt-spacing) * 1);
381
422
  }
@@ -397,6 +438,15 @@
397
438
  .nt\:py-1 {
398
439
  padding-block: calc(var(--nt-spacing) * 1);
399
440
  }
441
+ .nt\:py-1\.5 {
442
+ padding-block: calc(var(--nt-spacing) * 1.5);
443
+ }
444
+ .nt\:py-3 {
445
+ padding-block: calc(var(--nt-spacing) * 3);
446
+ }
447
+ .nt\:py-6 {
448
+ padding-block: calc(var(--nt-spacing) * 6);
449
+ }
400
450
  .nt\:\!pt-9 {
401
451
  padding-top: calc(var(--nt-spacing) * 9) !important;
402
452
  }
@@ -406,6 +456,9 @@
406
456
  .nt\:pl-1\.5 {
407
457
  padding-left: calc(var(--nt-spacing) * 1.5);
408
458
  }
459
+ .nt\:text-center {
460
+ text-align: center;
461
+ }
409
462
  .nt\:text-base {
410
463
  font-size: var(--nt-text-base);
411
464
  line-height: var(--tw-leading, var(--nt-text-base--line-height));
@@ -438,6 +491,9 @@
438
491
  .nt\:text-destructive {
439
492
  color: var(--destructive);
440
493
  }
494
+ .nt\:text-foreground {
495
+ color: var(--foreground);
496
+ }
441
497
  .nt\:text-muted-foreground {
442
498
  color: var(--muted-foreground);
443
499
  }
@@ -456,6 +512,15 @@
456
512
  .nt\:underline-offset-4 {
457
513
  text-underline-offset: 4px;
458
514
  }
515
+ .nt\:opacity-0 {
516
+ opacity: 0%;
517
+ }
518
+ .nt\:opacity-50 {
519
+ opacity: 50%;
520
+ }
521
+ .nt\:opacity-100 {
522
+ opacity: 100%;
523
+ }
459
524
  .nt\:shadow-lg {
460
525
  --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 4px 6px -4px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
461
526
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
@@ -813,6 +878,16 @@
813
878
  color: var(--tt-brand-color-500);
814
879
  }
815
880
  }
881
+ .nt\:data-\[disabled\=true\]\:pointer-events-none {
882
+ &[data-disabled="true"] {
883
+ pointer-events: none;
884
+ }
885
+ }
886
+ .nt\:data-\[disabled\=true\]\:opacity-50 {
887
+ &[data-disabled="true"] {
888
+ opacity: 50%;
889
+ }
890
+ }
816
891
  .nt\:data-\[orientation\=horizontal\]\:h-px {
817
892
  &[data-orientation="horizontal"] {
818
893
  height: 1px;
@@ -833,6 +908,16 @@
833
908
  width: 1px;
834
909
  }
835
910
  }
911
+ .nt\:data-\[selected\=true\]\:bg-accent {
912
+ &[data-selected="true"] {
913
+ background-color: var(--accent);
914
+ }
915
+ }
916
+ .nt\:data-\[selected\=true\]\:text-accent-foreground {
917
+ &[data-selected="true"] {
918
+ color: var(--accent-foreground);
919
+ }
920
+ }
836
921
  .nt\:data-\[state\=closed\]\:overflow-hidden {
837
922
  &[data-state="closed"] {
838
923
  overflow: hidden;
@@ -965,6 +1050,33 @@
965
1050
  }
966
1051
  }
967
1052
  }
1053
+ .nt\:\[\&_\[cmdk-group-heading\]\]\:px-2 {
1054
+ & [cmdk-group-heading] {
1055
+ padding-inline: calc(var(--nt-spacing) * 2);
1056
+ }
1057
+ }
1058
+ .nt\:\[\&_\[cmdk-group-heading\]\]\:py-1\.5 {
1059
+ & [cmdk-group-heading] {
1060
+ padding-block: calc(var(--nt-spacing) * 1.5);
1061
+ }
1062
+ }
1063
+ .nt\:\[\&_\[cmdk-group-heading\]\]\:text-xs {
1064
+ & [cmdk-group-heading] {
1065
+ font-size: var(--nt-text-xs);
1066
+ line-height: var(--tw-leading, var(--nt-text-xs--line-height));
1067
+ }
1068
+ }
1069
+ .nt\:\[\&_\[cmdk-group-heading\]\]\:font-medium {
1070
+ & [cmdk-group-heading] {
1071
+ --tw-font-weight: var(--nt-font-weight-medium);
1072
+ font-weight: var(--nt-font-weight-medium);
1073
+ }
1074
+ }
1075
+ .nt\:\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground {
1076
+ & [cmdk-group-heading] {
1077
+ color: var(--muted-foreground);
1078
+ }
1079
+ }
968
1080
  .nt\:\[\&_svg\]\:pointer-events-none {
969
1081
  & svg {
970
1082
  pointer-events: none;
@@ -341,14 +341,13 @@
341
341
  ===================== */
342
342
  .notra .tiptap pre,
343
343
  .notra-reader pre {
344
- background-color: var(--notra-codeblock-bg);
345
- color: var(--notra-codeblock-text);
346
344
  border: 1px solid var(--notra-codeblock-border);
347
345
  margin-top: 1.5em;
348
346
  margin-bottom: 1.5em;
349
- padding: 1em;
350
347
  font-size: 1rem;
351
348
  border-radius: var(--notra-radius);
349
+ overflow: hidden;
350
+ font-family: var(--notra-font-mono);
352
351
  }
353
352
 
354
353
  .notra .tiptap pre code,
@@ -356,8 +355,136 @@
356
355
  background-color: transparent;
357
356
  border: none;
358
357
  border-radius: 0;
359
- color: inherit;
360
- padding: 0;
358
+ padding: 1em;
359
+ display: block;
360
+ overflow-x: auto;
361
+ font-size: 0.875em;
362
+ line-height: 1.5;
363
+ }
364
+
365
+ /* =====================
366
+ Code — Highlight (Atom One Light, default)
367
+ ===================== */
368
+ .notra .hljs {
369
+ color: #383a42;
370
+ background: #fafafa;
371
+ }
372
+ .notra .hljs-comment,
373
+ .notra .hljs-quote {
374
+ color: #a0a1a7;
375
+ font-style: italic;
376
+ }
377
+ .notra .hljs-doctag,
378
+ .notra .hljs-formula,
379
+ .notra .hljs-keyword {
380
+ color: #a626a4;
381
+ }
382
+ .notra .hljs-deletion,
383
+ .notra .hljs-name,
384
+ .notra .hljs-section,
385
+ .notra .hljs-selector-tag,
386
+ .notra .hljs-subst {
387
+ color: #e45649;
388
+ }
389
+ .notra .hljs-literal {
390
+ color: #0184bb;
391
+ }
392
+ .notra .hljs-addition,
393
+ .notra .hljs-attribute,
394
+ .notra .hljs-meta .hljs-string,
395
+ .notra .hljs-regexp,
396
+ .notra .hljs-string {
397
+ color: #50a14f;
398
+ }
399
+ .notra .hljs-built_in,
400
+ .notra .hljs-class .hljs-title,
401
+ .notra .hljs-title.class_ {
402
+ color: #c18401;
403
+ }
404
+ .notra .hljs-attr,
405
+ .notra .hljs-number,
406
+ .notra .hljs-selector-attr,
407
+ .notra .hljs-selector-class,
408
+ .notra .hljs-selector-pseudo,
409
+ .notra .hljs-template-variable,
410
+ .notra .hljs-type,
411
+ .notra .hljs-variable {
412
+ color: #986801;
413
+ }
414
+ .notra .hljs-bullet,
415
+ .notra .hljs-link,
416
+ .notra .hljs-meta,
417
+ .notra .hljs-selector-id,
418
+ .notra .hljs-symbol,
419
+ .notra .hljs-title {
420
+ color: #4078f2;
421
+ }
422
+ .notra .hljs-emphasis {
423
+ font-style: italic;
424
+ }
425
+ .notra .hljs-strong {
426
+ font-weight: bold;
427
+ }
428
+ .notra .hljs-link {
429
+ text-decoration: underline;
430
+ }
431
+
432
+ /* =====================
433
+ Code — Highlight (Atom One Dark, .dark override)
434
+ ===================== */
435
+ .dark .notra .hljs {
436
+ color: #abb2bf;
437
+ background: #282c34;
438
+ }
439
+ .dark .notra .hljs-comment,
440
+ .dark .notra .hljs-quote {
441
+ color: #5c6370;
442
+ font-style: italic;
443
+ }
444
+ .dark .notra .hljs-doctag,
445
+ .dark .notra .hljs-formula,
446
+ .dark .notra .hljs-keyword {
447
+ color: #c678dd;
448
+ }
449
+ .dark .notra .hljs-deletion,
450
+ .dark .notra .hljs-name,
451
+ .dark .notra .hljs-section,
452
+ .dark .notra .hljs-selector-tag,
453
+ .dark .notra .hljs-subst {
454
+ color: #e06c75;
455
+ }
456
+ .dark .notra .hljs-literal {
457
+ color: #56b6c2;
458
+ }
459
+ .dark .notra .hljs-addition,
460
+ .dark .notra .hljs-attribute,
461
+ .dark .notra .hljs-meta .hljs-string,
462
+ .dark .notra .hljs-regexp,
463
+ .dark .notra .hljs-string {
464
+ color: #98c379;
465
+ }
466
+ .dark .notra .hljs-built_in,
467
+ .dark .notra .hljs-class .hljs-title,
468
+ .dark .notra .hljs-title.class_ {
469
+ color: #e6c07b;
470
+ }
471
+ .dark .notra .hljs-attr,
472
+ .dark .notra .hljs-number,
473
+ .dark .notra .hljs-selector-attr,
474
+ .dark .notra .hljs-selector-class,
475
+ .dark .notra .hljs-selector-pseudo,
476
+ .dark .notra .hljs-template-variable,
477
+ .dark .notra .hljs-type,
478
+ .dark .notra .hljs-variable {
479
+ color: #d19a66;
480
+ }
481
+ .dark .notra .hljs-bullet,
482
+ .dark .notra .hljs-link,
483
+ .dark .notra .hljs-meta,
484
+ .dark .notra .hljs-selector-id,
485
+ .dark .notra .hljs-symbol,
486
+ .dark .notra .hljs-title {
487
+ color: #61aeee;
361
488
  }
362
489
 
363
490
  /* =====================
@@ -417,6 +544,24 @@
417
544
  text-decoration: underline;
418
545
  }
419
546
 
547
+ /* =====================
548
+ Images
549
+ ===================== */
550
+ .notra .tiptap img,
551
+ .notra-reader img {
552
+ max-width: 100%;
553
+ height: auto;
554
+ display: block;
555
+ margin: 1.5em 0;
556
+ border-radius: var(--notra-radius);
557
+ }
558
+
559
+ /* Selected image (NodeSelection) — only relevant in the editor */
560
+ .notra .tiptap img.ProseMirror-selectednode {
561
+ outline: 2px solid var(--tt-brand-color-500);
562
+ outline-offset: 2px;
563
+ }
564
+
420
565
  /* =====================
421
566
  Inline Text Decoration
422
567
  ===================== */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "notra-editor",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.6.0",
5
5
  "description": "A Markdown-first rich text editor for React",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -42,6 +42,8 @@
42
42
  "@radix-ui/react-slot": "^1.2.4",
43
43
  "@tiptap/core": "^3.22.4",
44
44
  "@tiptap/extension-code-block": "^3.22.4",
45
+ "@tiptap/extension-code-block-lowlight": "^3.22.4",
46
+ "@tiptap/extension-image": "^3.22.4",
45
47
  "@tiptap/extension-link": "^3.22.4",
46
48
  "@tiptap/extension-list": "^3.22.4",
47
49
  "@tiptap/pm": "^3.22.4",
@@ -50,6 +52,9 @@
50
52
  "@tiptap/static-renderer": "^3.22.4",
51
53
  "class-variance-authority": "^0.7.1",
52
54
  "clsx": "^2.1.1",
55
+ "cmdk": "^1.1.1",
56
+ "hast-util-to-html": "^9.0.5",
57
+ "lowlight": "^3.3.0",
53
58
  "lucide-react": "^1.9.0",
54
59
  "radix-ui": "^1.4.3",
55
60
  "tailwind-merge": "^3.5.0",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/code-block-view.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tNodeViewContent,\n\tNodeViewWrapper,\n\ttype NodeViewProps\n} from '@tiptap/react';\n\nimport { CopyButton } from './copy-button';\n\nimport type { ReactNode } from 'react';\n\ninterface CodeBlockShellProps {\n\tvalue: string;\n\tchildren: ReactNode;\n}\n\n// Visual structure shared by editor (NodeView) and reader (nodeMapping).\n// Children is the <code> element (or <NodeViewContent as=\"code\"/>); the\n// shell does not wrap it because each consumer mounts <code> differently.\nexport const CodeBlockShell = ({ value, children }: CodeBlockShellProps) => (\n\t<div className=\"nt:relative\">\n\t\t<div className=\"nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-end nt:px-2\">\n\t\t\t<CopyButton value={value} />\n\t\t</div>\n\t\t<pre className=\"nt:!pt-9\">{children}</pre>\n\t</div>\n);\n\n// Editor-side React NodeView. Tiptap mounts content-editable DOM directly\n// onto the <code> rendered by NodeViewContent.\nexport const CodeBlockView = ({ node }: NodeViewProps) => (\n\t<NodeViewWrapper>\n\t\t<CodeBlockShell value={node.textContent}>\n\t\t\t<NodeViewContent<'code'> as=\"code\" />\n\t\t</CodeBlockShell>\n\t</NodeViewWrapper>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBC;AAnBD,mBAIO;AAEP,yBAA2B;AAYpB,MAAM,iBAAiB,CAAC,EAAE,OAAO,SAAS,MAChD,6CAAC,SAAI,WAAU,eACd;AAAA,8CAAC,SAAI,WAAU,2FACd,sDAAC,iCAAW,OAAc,GAC3B;AAAA,EACA,4CAAC,SAAI,WAAU,YAAY,UAAS;AAAA,GACrC;AAKM,MAAM,gBAAgB,CAAC,EAAE,KAAK,MACpC,4CAAC,gCACA,sDAAC,kBAAe,OAAO,KAAK,aAC3B,sDAAC,gCAAwB,IAAG,QAAO,GACpC,GACD;","names":[]}
@@ -1,12 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { NodeViewProps } from '@tiptap/react';
3
- import { ReactNode } from 'react';
4
-
5
- interface CodeBlockShellProps {
6
- value: string;
7
- children: ReactNode;
8
- }
9
- declare const CodeBlockShell: ({ value, children }: CodeBlockShellProps) => react_jsx_runtime.JSX.Element;
10
- declare const CodeBlockView: ({ node }: NodeViewProps) => react_jsx_runtime.JSX.Element;
11
-
12
- export { CodeBlockShell, CodeBlockView };
@@ -1,12 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { NodeViewProps } from '@tiptap/react';
3
- import { ReactNode } from 'react';
4
-
5
- interface CodeBlockShellProps {
6
- value: string;
7
- children: ReactNode;
8
- }
9
- declare const CodeBlockShell: ({ value, children }: CodeBlockShellProps) => react_jsx_runtime.JSX.Element;
10
- declare const CodeBlockView: ({ node }: NodeViewProps) => react_jsx_runtime.JSX.Element;
11
-
12
- export { CodeBlockShell, CodeBlockView };
@@ -1,17 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import {
4
- NodeViewContent,
5
- NodeViewWrapper
6
- } from "@tiptap/react";
7
- import { CopyButton } from "./copy-button";
8
- const CodeBlockShell = ({ value, children }) => /* @__PURE__ */ jsxs("div", { className: "nt:relative", children: [
9
- /* @__PURE__ */ jsx("div", { className: "nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-end nt:px-2", children: /* @__PURE__ */ jsx(CopyButton, { value }) }),
10
- /* @__PURE__ */ jsx("pre", { className: "nt:!pt-9", children })
11
- ] });
12
- const CodeBlockView = ({ node }) => /* @__PURE__ */ jsx(NodeViewWrapper, { children: /* @__PURE__ */ jsx(CodeBlockShell, { value: node.textContent, children: /* @__PURE__ */ jsx(NodeViewContent, { as: "code" }) }) });
13
- export {
14
- CodeBlockShell,
15
- CodeBlockView
16
- };
17
- //# sourceMappingURL=code-block-view.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/code-block-view.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tNodeViewContent,\n\tNodeViewWrapper,\n\ttype NodeViewProps\n} from '@tiptap/react';\n\nimport { CopyButton } from './copy-button';\n\nimport type { ReactNode } from 'react';\n\ninterface CodeBlockShellProps {\n\tvalue: string;\n\tchildren: ReactNode;\n}\n\n// Visual structure shared by editor (NodeView) and reader (nodeMapping).\n// Children is the <code> element (or <NodeViewContent as=\"code\"/>); the\n// shell does not wrap it because each consumer mounts <code> differently.\nexport const CodeBlockShell = ({ value, children }: CodeBlockShellProps) => (\n\t<div className=\"nt:relative\">\n\t\t<div className=\"nt:absolute nt:inset-x-0 nt:top-0 nt:flex nt:h-9 nt:items-center nt:justify-end nt:px-2\">\n\t\t\t<CopyButton value={value} />\n\t\t</div>\n\t\t<pre className=\"nt:!pt-9\">{children}</pre>\n\t</div>\n);\n\n// Editor-side React NodeView. Tiptap mounts content-editable DOM directly\n// onto the <code> rendered by NodeViewContent.\nexport const CodeBlockView = ({ node }: NodeViewProps) => (\n\t<NodeViewWrapper>\n\t\t<CodeBlockShell value={node.textContent}>\n\t\t\t<NodeViewContent<'code'> as=\"code\" />\n\t\t</CodeBlockShell>\n\t</NodeViewWrapper>\n);\n"],"mappings":";AAqBC,SAEE,KAFF;AAnBD;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AAEP,SAAS,kBAAkB;AAYpB,MAAM,iBAAiB,CAAC,EAAE,OAAO,SAAS,MAChD,qBAAC,SAAI,WAAU,eACd;AAAA,sBAAC,SAAI,WAAU,2FACd,8BAAC,cAAW,OAAc,GAC3B;AAAA,EACA,oBAAC,SAAI,WAAU,YAAY,UAAS;AAAA,GACrC;AAKM,MAAM,gBAAgB,CAAC,EAAE,KAAK,MACpC,oBAAC,mBACA,8BAAC,kBAAe,OAAO,KAAK,aAC3B,8BAAC,mBAAwB,IAAG,QAAO,GACpC,GACD;","names":[]}