tiptap-markdown-react 0.8.6 → 0.8.7
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/README.md +5 -2
- package/dist/components/EditorToolbar.d.ts +32 -2
- package/dist/icons/index.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +171 -54
- package/dist/index.js.map +1 -1
- package/dist/insertMarkdown.d.ts +3 -0
- package/dist/insertMarkdown.test.d.ts +1 -0
- package/dist/labels.d.ts +9 -0
- package/dist/style.css +70 -51
- package/package.json +1 -1
package/dist/insertMarkdown.d.ts
CHANGED
|
@@ -3,5 +3,8 @@ import { SourceRef } from './citationUtils';
|
|
|
3
3
|
/**
|
|
4
4
|
* 在光标处插入 markdown 片段(封装 contentType: 'markdown')。
|
|
5
5
|
* 传入 `sources` 时会先 enrich `[^n]` → 带 url 的 citation-ref,再插入。
|
|
6
|
+
*
|
|
7
|
+
* 整段过不了 schema(嵌套 bold、块级图进 listItem 等)时按块重试,
|
|
8
|
+
* 单块仍挂则剥标记当段落。某一处脏输出不至于整次插入失败。
|
|
6
9
|
*/
|
|
7
10
|
export declare function insertMarkdown(editor: Editor, markdown: string, sources?: SourceRef[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/labels.d.ts
CHANGED
|
@@ -30,6 +30,14 @@ export interface ToolbarLabels {
|
|
|
30
30
|
imageUploadFailed: string;
|
|
31
31
|
/** Markdown 文件导入失败(与图片上传共用 onError 回调时,便于宿主区分文案)。 */
|
|
32
32
|
importMarkdownFailed: string;
|
|
33
|
+
/** 主栏导入按钮。默认只吃 .md,宿主传 onImportDocument 后可扩展格式。 */
|
|
34
|
+
importDocument: string;
|
|
35
|
+
/** 导入进行中的按钮 title。 */
|
|
36
|
+
importDocumentBusy: string;
|
|
37
|
+
/** 导入进行中的取消按钮。 */
|
|
38
|
+
importDocumentCancel: string;
|
|
39
|
+
/** 非 Markdown 文件导入失败(onError 的 source === 'import')。 */
|
|
40
|
+
importDocumentFailed: string;
|
|
33
41
|
blockquote: string;
|
|
34
42
|
bulletList: string;
|
|
35
43
|
orderedList: string;
|
|
@@ -37,6 +45,7 @@ export interface ToolbarLabels {
|
|
|
37
45
|
more: string;
|
|
38
46
|
codeBlock: string;
|
|
39
47
|
hr: string;
|
|
48
|
+
/** @deprecated 导入入口已移到主栏,改用 `importDocument`。 */
|
|
40
49
|
importMarkdown: string;
|
|
41
50
|
tableInsert: string;
|
|
42
51
|
tableAddColumnBefore: string;
|
package/dist/style.css
CHANGED
|
@@ -533,7 +533,7 @@
|
|
|
533
533
|
color: #22863a;
|
|
534
534
|
}
|
|
535
535
|
/* 顶部操作栏:横跨宽度、内容居中、细线灰图标。配色映射到可覆盖的 --tmr-* 变量。 */
|
|
536
|
-
.
|
|
536
|
+
._toolbar_1ybhg_2 {
|
|
537
537
|
--sb-accent: var(--tmr-accent, #ff6719);
|
|
538
538
|
--sb-text: var(--tmr-text, #363737);
|
|
539
539
|
--sb-muted: var(--tmr-toolbar-muted, #6b6b6b);
|
|
@@ -546,7 +546,7 @@
|
|
|
546
546
|
z-index: 8;
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
.
|
|
549
|
+
._inner_1ybhg_15 {
|
|
550
550
|
display: flex;
|
|
551
551
|
align-items: center;
|
|
552
552
|
justify-content: safe center;
|
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
overflow-x: auto;
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
-
.
|
|
561
|
+
._btn_1ybhg_27 {
|
|
562
562
|
display: inline-flex;
|
|
563
563
|
align-items: center;
|
|
564
564
|
justify-content: center;
|
|
@@ -576,28 +576,47 @@
|
|
|
576
576
|
transition: background 0.15s, color 0.15s;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
.
|
|
579
|
+
._btn_1ybhg_27:hover:not(:disabled) {
|
|
580
580
|
background: #f3f3f3;
|
|
581
581
|
color: var(--sb-text);
|
|
582
582
|
}
|
|
583
583
|
|
|
584
|
-
.
|
|
584
|
+
._btnActive_1ybhg_50 {
|
|
585
585
|
color: var(--sb-accent);
|
|
586
586
|
background: #fff3ec;
|
|
587
587
|
}
|
|
588
588
|
|
|
589
|
-
.
|
|
589
|
+
._btnActive_1ybhg_50:hover {
|
|
590
590
|
color: var(--sb-accent);
|
|
591
591
|
background: #ffe8da;
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
.
|
|
594
|
+
._btn_1ybhg_27:disabled {
|
|
595
595
|
opacity: 0.3;
|
|
596
596
|
cursor: not-allowed;
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
+
/* 导入中的取消:紧跟导入按钮的小号文字按钮 */
|
|
600
|
+
._importCancel_1ybhg_66 {
|
|
601
|
+
height: 34px;
|
|
602
|
+
padding: 0 6px;
|
|
603
|
+
border: none;
|
|
604
|
+
border-radius: 6px;
|
|
605
|
+
background: transparent;
|
|
606
|
+
color: var(--sb-accent);
|
|
607
|
+
font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
608
|
+
font-size: 13px;
|
|
609
|
+
line-height: 1;
|
|
610
|
+
cursor: pointer;
|
|
611
|
+
flex-shrink: 0;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
._importCancel_1ybhg_66:hover {
|
|
615
|
+
background: #f3f3f3;
|
|
616
|
+
}
|
|
617
|
+
|
|
599
618
|
/* 表内浮动工具条(BubbleMenu portal 到 body,拿不到 .toolbar 变量,故写死配色) */
|
|
600
|
-
.
|
|
619
|
+
._tableBubble_1ybhg_85 {
|
|
601
620
|
display: flex;
|
|
602
621
|
align-items: center;
|
|
603
622
|
gap: 2px;
|
|
@@ -609,7 +628,7 @@
|
|
|
609
628
|
}
|
|
610
629
|
|
|
611
630
|
/* 文字型图标(引用等) */
|
|
612
|
-
.
|
|
631
|
+
._txtIcon_1ybhg_97 {
|
|
613
632
|
font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
614
633
|
font-size: 16px;
|
|
615
634
|
font-weight: 600;
|
|
@@ -617,7 +636,7 @@
|
|
|
617
636
|
}
|
|
618
637
|
|
|
619
638
|
/* 文字颜色 / 高亮图标:字母 + 底部当前色条 */
|
|
620
|
-
.
|
|
639
|
+
._colorIcon_1ybhg_105 {
|
|
621
640
|
display: inline-flex;
|
|
622
641
|
flex-direction: column;
|
|
623
642
|
align-items: center;
|
|
@@ -625,20 +644,20 @@
|
|
|
625
644
|
line-height: 1;
|
|
626
645
|
}
|
|
627
646
|
|
|
628
|
-
.
|
|
647
|
+
._colorIconGlyph_1ybhg_113 {
|
|
629
648
|
font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
630
649
|
font-size: 15px;
|
|
631
650
|
font-weight: 600;
|
|
632
651
|
}
|
|
633
652
|
|
|
634
|
-
.
|
|
653
|
+
._colorIconBar_1ybhg_119 {
|
|
635
654
|
width: 16px;
|
|
636
655
|
height: 3px;
|
|
637
656
|
border-radius: 1.5px;
|
|
638
657
|
}
|
|
639
658
|
|
|
640
659
|
/* A▾ 上标/下标下拉触发器 */
|
|
641
|
-
.
|
|
660
|
+
._scriptTrigger_1ybhg_126 {
|
|
642
661
|
display: inline-flex;
|
|
643
662
|
align-items: center;
|
|
644
663
|
gap: 3px;
|
|
@@ -653,12 +672,12 @@
|
|
|
653
672
|
transition: background 0.15s, color 0.15s;
|
|
654
673
|
}
|
|
655
674
|
|
|
656
|
-
.
|
|
675
|
+
._scriptTrigger_1ybhg_126:hover {
|
|
657
676
|
background: #f3f3f3;
|
|
658
677
|
color: var(--sb-text);
|
|
659
678
|
}
|
|
660
679
|
|
|
661
|
-
.
|
|
680
|
+
._scriptTriggerGlyph_1ybhg_146 {
|
|
662
681
|
font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
663
682
|
font-size: 16px;
|
|
664
683
|
font-weight: 600;
|
|
@@ -666,7 +685,7 @@
|
|
|
666
685
|
text-underline-offset: 2px;
|
|
667
686
|
}
|
|
668
687
|
|
|
669
|
-
.
|
|
688
|
+
._divider_1ybhg_154 {
|
|
670
689
|
width: 1px;
|
|
671
690
|
height: 20px;
|
|
672
691
|
margin: 0 8px;
|
|
@@ -675,7 +694,7 @@
|
|
|
675
694
|
}
|
|
676
695
|
|
|
677
696
|
/* ── Style / Size / More 下拉触发器 ── */
|
|
678
|
-
.
|
|
697
|
+
._styleTrigger_1ybhg_163 {
|
|
679
698
|
display: inline-flex;
|
|
680
699
|
align-items: center;
|
|
681
700
|
justify-content: space-between;
|
|
@@ -695,16 +714,16 @@
|
|
|
695
714
|
transition: background 0.15s;
|
|
696
715
|
}
|
|
697
716
|
|
|
698
|
-
.
|
|
717
|
+
._styleTrigger_1ybhg_163:hover:not(:disabled) {
|
|
699
718
|
background: #f3f3f3;
|
|
700
719
|
}
|
|
701
720
|
|
|
702
|
-
.
|
|
721
|
+
._styleTrigger_1ybhg_163:disabled {
|
|
703
722
|
opacity: 0.3;
|
|
704
723
|
cursor: not-allowed;
|
|
705
724
|
}
|
|
706
725
|
|
|
707
|
-
.
|
|
726
|
+
._styleTriggerLabel_1ybhg_192 {
|
|
708
727
|
flex: 1;
|
|
709
728
|
text-align: left;
|
|
710
729
|
overflow: hidden;
|
|
@@ -712,19 +731,19 @@
|
|
|
712
731
|
text-overflow: ellipsis;
|
|
713
732
|
}
|
|
714
733
|
|
|
715
|
-
.
|
|
734
|
+
._styleTriggerCaret_1ybhg_200 {
|
|
716
735
|
color: var(--sb-muted);
|
|
717
736
|
flex: none;
|
|
718
737
|
}
|
|
719
738
|
|
|
720
739
|
/* 下拉项:图标 + 文字 */
|
|
721
|
-
.
|
|
740
|
+
._styleItem_1ybhg_206 {
|
|
722
741
|
display: inline-flex;
|
|
723
742
|
align-items: center;
|
|
724
743
|
gap: 12px;
|
|
725
744
|
}
|
|
726
745
|
|
|
727
|
-
.
|
|
746
|
+
._styleIcon_1ybhg_212 {
|
|
728
747
|
display: inline-flex;
|
|
729
748
|
justify-content: center;
|
|
730
749
|
align-items: center;
|
|
@@ -734,19 +753,19 @@
|
|
|
734
753
|
}
|
|
735
754
|
|
|
736
755
|
/* 上标 / 下标图标 */
|
|
737
|
-
.
|
|
756
|
+
._scriptGlyph_1ybhg_222 {
|
|
738
757
|
display: inline-block;
|
|
739
758
|
text-align: center;
|
|
740
759
|
font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
|
|
741
760
|
}
|
|
742
761
|
|
|
743
|
-
.
|
|
744
|
-
.
|
|
762
|
+
._scriptGlyph_1ybhg_222 sup,
|
|
763
|
+
._scriptGlyph_1ybhg_222 sub {
|
|
745
764
|
font-size: 0.7em;
|
|
746
765
|
}
|
|
747
766
|
|
|
748
767
|
/* ── Radix 下拉菜单面板(替代 antd .ant-dropdown-menu) ── */
|
|
749
|
-
.
|
|
768
|
+
._menu_1ybhg_234 {
|
|
750
769
|
min-width: 200px;
|
|
751
770
|
padding: 6px;
|
|
752
771
|
background: #fff;
|
|
@@ -757,7 +776,7 @@
|
|
|
757
776
|
z-index: 1000;
|
|
758
777
|
}
|
|
759
778
|
|
|
760
|
-
.
|
|
779
|
+
._menuItem_1ybhg_245 {
|
|
761
780
|
display: flex;
|
|
762
781
|
align-items: center;
|
|
763
782
|
width: 100%;
|
|
@@ -773,52 +792,52 @@
|
|
|
773
792
|
outline: none;
|
|
774
793
|
}
|
|
775
794
|
|
|
776
|
-
.
|
|
795
|
+
._menuItem_1ybhg_245:hover:not(:disabled) {
|
|
777
796
|
background: #f3f3f3;
|
|
778
797
|
}
|
|
779
798
|
|
|
780
|
-
.
|
|
799
|
+
._menuItem_1ybhg_245:disabled {
|
|
781
800
|
opacity: 0.35;
|
|
782
801
|
cursor: not-allowed;
|
|
783
802
|
}
|
|
784
803
|
|
|
785
804
|
/* 选中态:品牌色高亮 */
|
|
786
|
-
.
|
|
805
|
+
._menuItemSelected_1ybhg_271 {
|
|
787
806
|
background: #fff3ec;
|
|
788
807
|
color: var(--sb-accent);
|
|
789
808
|
}
|
|
790
809
|
|
|
791
|
-
.
|
|
810
|
+
._menuItemSelected_1ybhg_271 ._styleIcon_1ybhg_212 {
|
|
792
811
|
color: var(--sb-accent);
|
|
793
812
|
}
|
|
794
813
|
|
|
795
|
-
.
|
|
814
|
+
._menuItemSelected_1ybhg_271:hover:not(:disabled) {
|
|
796
815
|
background: #ffe8da;
|
|
797
816
|
}
|
|
798
817
|
|
|
799
818
|
/* Radix Popover 内容(承载 ColorPalette),面板自带阴影,这里只兜底 z-index */
|
|
800
|
-
.
|
|
819
|
+
._popoverContent_1ybhg_285 {
|
|
801
820
|
z-index: 1000;
|
|
802
821
|
}
|
|
803
822
|
|
|
804
|
-
.
|
|
823
|
+
._mathLayer_1ybhg_289 {
|
|
805
824
|
position: absolute;
|
|
806
825
|
z-index: 6;
|
|
807
826
|
}
|
|
808
827
|
|
|
809
|
-
.
|
|
828
|
+
._mathStack_1ybhg_294 {
|
|
810
829
|
display: flex;
|
|
811
830
|
flex-direction: column;
|
|
812
831
|
align-items: flex-start;
|
|
813
832
|
gap: 8px;
|
|
814
833
|
}
|
|
815
834
|
|
|
816
|
-
.
|
|
835
|
+
._mathStackBlock_1ybhg_301 {
|
|
817
836
|
align-items: stretch;
|
|
818
837
|
width: 100%;
|
|
819
838
|
}
|
|
820
839
|
|
|
821
|
-
.
|
|
840
|
+
._mathHint_1ybhg_306 {
|
|
822
841
|
display: inline-flex;
|
|
823
842
|
align-items: center;
|
|
824
843
|
gap: 6px;
|
|
@@ -830,19 +849,19 @@
|
|
|
830
849
|
line-height: 1.4;
|
|
831
850
|
}
|
|
832
851
|
|
|
833
|
-
.
|
|
852
|
+
._mathHintBlock_1ybhg_318 {
|
|
834
853
|
width: 100%;
|
|
835
854
|
padding: 10px 14px;
|
|
836
855
|
border-radius: 8px;
|
|
837
856
|
}
|
|
838
857
|
|
|
839
|
-
.
|
|
858
|
+
._mathHintIcon_1ybhg_324 {
|
|
840
859
|
font-family: ui-serif, Georgia, 'Times New Roman', serif;
|
|
841
860
|
font-size: 12px;
|
|
842
861
|
opacity: 0.85;
|
|
843
862
|
}
|
|
844
863
|
|
|
845
|
-
.
|
|
864
|
+
._mathPreviewInline_1ybhg_330 {
|
|
846
865
|
display: inline-flex;
|
|
847
866
|
max-width: min(440px, calc(100vw - 24px));
|
|
848
867
|
padding: 4px 10px;
|
|
@@ -852,7 +871,7 @@
|
|
|
852
871
|
color: var(--tmr-text, #363737);
|
|
853
872
|
}
|
|
854
873
|
|
|
855
|
-
.
|
|
874
|
+
._mathPreviewBlock_1ybhg_340 {
|
|
856
875
|
width: 100%;
|
|
857
876
|
min-height: 48px;
|
|
858
877
|
padding: 14px 16px;
|
|
@@ -863,11 +882,11 @@
|
|
|
863
882
|
color: var(--tmr-text, #363737);
|
|
864
883
|
}
|
|
865
884
|
|
|
866
|
-
.
|
|
885
|
+
._mathPreviewBlock_1ybhg_340 .katex-display {
|
|
867
886
|
margin: 0;
|
|
868
887
|
}
|
|
869
888
|
|
|
870
|
-
.
|
|
889
|
+
._mathField_1ybhg_355 {
|
|
871
890
|
display: flex;
|
|
872
891
|
align-items: center;
|
|
873
892
|
gap: 8px;
|
|
@@ -879,14 +898,14 @@
|
|
|
879
898
|
box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
|
|
880
899
|
}
|
|
881
900
|
|
|
882
|
-
.
|
|
901
|
+
._mathFieldBlock_1ybhg_367 {
|
|
883
902
|
align-items: flex-start;
|
|
884
903
|
width: 100%;
|
|
885
904
|
border-radius: 12px;
|
|
886
905
|
padding: 10px 10px 10px 14px;
|
|
887
906
|
}
|
|
888
907
|
|
|
889
|
-
.
|
|
908
|
+
._mathInput_1ybhg_374 {
|
|
890
909
|
flex: 1;
|
|
891
910
|
min-width: 0;
|
|
892
911
|
margin: 0;
|
|
@@ -900,11 +919,11 @@
|
|
|
900
919
|
resize: none;
|
|
901
920
|
}
|
|
902
921
|
|
|
903
|
-
.
|
|
922
|
+
._mathInput_1ybhg_374:focus {
|
|
904
923
|
outline: none;
|
|
905
924
|
}
|
|
906
925
|
|
|
907
|
-
.
|
|
926
|
+
._mathDone_1ybhg_392 {
|
|
908
927
|
display: inline-flex;
|
|
909
928
|
align-items: center;
|
|
910
929
|
gap: 4px;
|
|
@@ -920,16 +939,16 @@
|
|
|
920
939
|
cursor: pointer;
|
|
921
940
|
}
|
|
922
941
|
|
|
923
|
-
.
|
|
942
|
+
._mathDone_1ybhg_392:hover:not(:disabled) {
|
|
924
943
|
filter: brightness(0.95);
|
|
925
944
|
}
|
|
926
945
|
|
|
927
|
-
.
|
|
946
|
+
._mathDone_1ybhg_392:disabled {
|
|
928
947
|
opacity: 0.35;
|
|
929
948
|
cursor: not-allowed;
|
|
930
949
|
}
|
|
931
950
|
|
|
932
|
-
.
|
|
951
|
+
._mathDoneKbd_1ybhg_417 {
|
|
933
952
|
font-size: 11px;
|
|
934
953
|
font-weight: 500;
|
|
935
954
|
opacity: 0.85;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiptap-markdown-react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
4
4
|
"description": "A batteries-included, self-styled Markdown WYSIWYG editor and reader suite built on Tiptap v3. Markdown in/out, SSR/static rendering, table of contents, themeable via CSS variables, zero Ant Design.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|