@supernova-studio/client 0.48.26 → 0.48.28
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/index.d.mts +19 -7
- package/dist/index.d.ts +19 -7
- package/dist/index.js +86 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/yjs/docs-editor/blocks-to-prosemirror.ts +8 -0
- package/src/yjs/docs-editor/prosemirror/schema.ts +56 -28
- package/src/yjs/docs-editor/prosemirror-to-blocks.ts +15 -0
package/package.json
CHANGED
|
@@ -628,6 +628,14 @@ function serializeTextSpanAttribute(spanAttribute: PageBlockTextSpanAttribute):
|
|
|
628
628
|
return { type: "strike", attrs: {} };
|
|
629
629
|
case "Code":
|
|
630
630
|
return { type: "code", attrs: {} };
|
|
631
|
+
case "Comment":
|
|
632
|
+
return {
|
|
633
|
+
type: "commentHighlight",
|
|
634
|
+
attrs: {
|
|
635
|
+
highlightId: spanAttribute.commentHighlightId,
|
|
636
|
+
resolved: spanAttribute.commentIsResolved,
|
|
637
|
+
},
|
|
638
|
+
};
|
|
631
639
|
case "Link":
|
|
632
640
|
if (spanAttribute.link) {
|
|
633
641
|
return serializeLinkMark(
|
|
@@ -510,7 +510,7 @@ const newSchema = {
|
|
|
510
510
|
name: "link",
|
|
511
511
|
rank: 0,
|
|
512
512
|
spec: {
|
|
513
|
-
inclusive:
|
|
513
|
+
inclusive: false,
|
|
514
514
|
attrs: {
|
|
515
515
|
href: {
|
|
516
516
|
default: null,
|
|
@@ -522,10 +522,7 @@ const newSchema = {
|
|
|
522
522
|
default: "noopener noreferrer nofollow",
|
|
523
523
|
},
|
|
524
524
|
class: {
|
|
525
|
-
default:
|
|
526
|
-
},
|
|
527
|
-
itemId: {
|
|
528
|
-
default: null,
|
|
525
|
+
default: "tiptap-link",
|
|
529
526
|
},
|
|
530
527
|
},
|
|
531
528
|
parseDOM: [
|
|
@@ -549,11 +546,7 @@ const newSchema = {
|
|
|
549
546
|
},
|
|
550
547
|
class: {
|
|
551
548
|
hasDefault: true,
|
|
552
|
-
default:
|
|
553
|
-
},
|
|
554
|
-
itemId: {
|
|
555
|
-
hasDefault: true,
|
|
556
|
-
default: null,
|
|
549
|
+
default: "tiptap-link",
|
|
557
550
|
},
|
|
558
551
|
},
|
|
559
552
|
instance: {
|
|
@@ -562,47 +555,65 @@ const newSchema = {
|
|
|
562
555
|
href: null,
|
|
563
556
|
target: "_blank",
|
|
564
557
|
rel: "noopener noreferrer nofollow",
|
|
565
|
-
class:
|
|
566
|
-
itemId: null,
|
|
558
|
+
class: "tiptap-link",
|
|
567
559
|
},
|
|
568
560
|
},
|
|
569
561
|
},
|
|
570
|
-
|
|
571
|
-
name: "
|
|
562
|
+
commentHighlight: {
|
|
563
|
+
name: "commentHighlight",
|
|
572
564
|
rank: 1,
|
|
573
565
|
spec: {
|
|
574
|
-
|
|
575
|
-
{
|
|
576
|
-
|
|
566
|
+
attrs: {
|
|
567
|
+
highlightId: {
|
|
568
|
+
default: null,
|
|
577
569
|
},
|
|
578
|
-
{
|
|
579
|
-
|
|
570
|
+
resolved: {
|
|
571
|
+
default: false,
|
|
580
572
|
},
|
|
573
|
+
},
|
|
574
|
+
parseDOM: [
|
|
581
575
|
{
|
|
582
|
-
|
|
576
|
+
tag: "commenthighlight",
|
|
583
577
|
},
|
|
584
578
|
],
|
|
585
579
|
},
|
|
586
|
-
attrs: {
|
|
580
|
+
attrs: {
|
|
581
|
+
highlightId: {
|
|
582
|
+
hasDefault: true,
|
|
583
|
+
default: null,
|
|
584
|
+
},
|
|
585
|
+
resolved: {
|
|
586
|
+
hasDefault: true,
|
|
587
|
+
default: false,
|
|
588
|
+
},
|
|
589
|
+
},
|
|
587
590
|
instance: {
|
|
588
|
-
type: "
|
|
591
|
+
type: "commentHighlight",
|
|
592
|
+
attrs: {
|
|
593
|
+
highlightId: null,
|
|
594
|
+
resolved: false,
|
|
595
|
+
},
|
|
589
596
|
},
|
|
590
597
|
},
|
|
591
|
-
|
|
592
|
-
name: "
|
|
598
|
+
bold: {
|
|
599
|
+
name: "bold",
|
|
593
600
|
rank: 2,
|
|
594
601
|
spec: {
|
|
595
|
-
excludes: "_",
|
|
596
|
-
code: true,
|
|
597
602
|
parseDOM: [
|
|
598
603
|
{
|
|
599
|
-
tag: "
|
|
604
|
+
tag: "strong",
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
tag: "b",
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
style: "font-weight",
|
|
600
611
|
},
|
|
601
612
|
],
|
|
602
613
|
},
|
|
603
614
|
attrs: {},
|
|
604
615
|
instance: {
|
|
605
|
-
type: "
|
|
616
|
+
type: "bold",
|
|
606
617
|
},
|
|
607
618
|
},
|
|
608
619
|
italic: {
|
|
@@ -651,6 +662,23 @@ const newSchema = {
|
|
|
651
662
|
type: "strike",
|
|
652
663
|
},
|
|
653
664
|
},
|
|
665
|
+
code: {
|
|
666
|
+
name: "code",
|
|
667
|
+
rank: 5,
|
|
668
|
+
spec: {
|
|
669
|
+
excludes: "bold code italic strike link",
|
|
670
|
+
code: true,
|
|
671
|
+
parseDOM: [
|
|
672
|
+
{
|
|
673
|
+
tag: "code",
|
|
674
|
+
},
|
|
675
|
+
],
|
|
676
|
+
},
|
|
677
|
+
attrs: {},
|
|
678
|
+
instance: {
|
|
679
|
+
type: "code",
|
|
680
|
+
},
|
|
681
|
+
},
|
|
654
682
|
},
|
|
655
683
|
} as const;
|
|
656
684
|
|
|
@@ -421,6 +421,8 @@ function parseRichTextAttribute(mark: ProsemirrorMark): PageBlockTextSpanAttribu
|
|
|
421
421
|
return { type: "Code" };
|
|
422
422
|
case "link":
|
|
423
423
|
return parseProsemirrorLink(mark);
|
|
424
|
+
case "commentHighlight":
|
|
425
|
+
return parseProsemirrorCommentHighlight(mark);
|
|
424
426
|
}
|
|
425
427
|
|
|
426
428
|
return null;
|
|
@@ -450,6 +452,19 @@ function parseProsemirrorLink(mark: ProsemirrorMark): PageBlockTextSpanAttribute
|
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
454
|
|
|
455
|
+
function parseProsemirrorCommentHighlight(mark: ProsemirrorMark): PageBlockTextSpanAttribute | null {
|
|
456
|
+
const highlightId = getProsemirrorAttribute(mark, "highlightId", z.string().optional());
|
|
457
|
+
if (!highlightId) return null;
|
|
458
|
+
|
|
459
|
+
const isResolved = getProsemirrorAttribute(mark, "resolved", z.boolean().optional()) ?? false;
|
|
460
|
+
|
|
461
|
+
return {
|
|
462
|
+
type: "Comment",
|
|
463
|
+
commentHighlightId: highlightId,
|
|
464
|
+
commentIsResolved: isResolved,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
453
468
|
//
|
|
454
469
|
// Embed
|
|
455
470
|
//
|