tiptap-markdown-react 0.8.11 → 0.8.12

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/labels.d.ts CHANGED
@@ -54,12 +54,27 @@ export interface ToolbarLabels {
54
54
  /** 导入下拉里的 Markdown 项。 */
55
55
  importMarkdown: string;
56
56
  tableInsert: string;
57
+ /** 网格选择器底部尺寸文案,如 "3 × 4"。参数顺序:列、行。 */
58
+ tableSizeSelected: (cols: number, rows: number) => string;
57
59
  tableAddColumnBefore: string;
58
60
  tableAddColumnAfter: string;
59
61
  tableDeleteColumn: string;
60
62
  tableAddRowBefore: string;
61
63
  tableAddRowAfter: string;
62
64
  tableDeleteRow: string;
65
+ /** 多格选区:在左侧插入 N 列。 */
66
+ tableAddColumnBeforeN: (n: number) => string;
67
+ /** 多格选区:在右侧插入 N 列。 */
68
+ tableAddColumnAfterN: (n: number) => string;
69
+ /** 多格选区:删除 N 列。 */
70
+ tableDeleteColumnN: (n: number) => string;
71
+ /** 多格选区:在上方插入 N 行。 */
72
+ tableAddRowBeforeN: (n: number) => string;
73
+ /** 多格选区:在下方插入 N 行。 */
74
+ tableAddRowAfterN: (n: number) => string;
75
+ /** 多格选区:删除 N 行。 */
76
+ tableDeleteRowN: (n: number) => string;
77
+ tableDeleteTable: string;
63
78
  inlineMath: string;
64
79
  blockMath: string;
65
80
  mathPlaceholder: string;
package/dist/style.css CHANGED
@@ -559,7 +559,7 @@
559
559
  color: #22863a;
560
560
  }
561
561
  /* 顶部操作栏:横跨宽度、内容居中、细线灰图标。配色映射到可覆盖的 --tmr-* 变量。 */
562
- ._toolbar_16b09_2 {
562
+ ._toolbar_1f7fb_2 {
563
563
  --sb-accent: var(--tmr-accent, #ff6719);
564
564
  --sb-text: var(--tmr-text, #363737);
565
565
  --sb-muted: var(--tmr-toolbar-muted, #6b6b6b);
@@ -572,7 +572,7 @@
572
572
  z-index: 8;
573
573
  }
574
574
 
575
- ._inner_16b09_15 {
575
+ ._inner_1f7fb_15 {
576
576
  display: flex;
577
577
  align-items: center;
578
578
  justify-content: safe center;
@@ -584,7 +584,7 @@
584
584
  overflow-x: auto;
585
585
  }
586
586
 
587
- ._btn_16b09_27 {
587
+ ._btn_1f7fb_27 {
588
588
  display: inline-flex;
589
589
  align-items: center;
590
590
  justify-content: center;
@@ -602,40 +602,88 @@
602
602
  transition: background 0.15s, color 0.15s;
603
603
  }
604
604
 
605
- ._btn_16b09_27:hover:not(:disabled) {
605
+ ._btn_1f7fb_27:hover:not(:disabled) {
606
606
  background: #f3f3f3;
607
607
  color: var(--sb-text);
608
608
  }
609
609
 
610
- ._btnActive_16b09_50 {
610
+ ._btnActive_1f7fb_50 {
611
611
  color: var(--sb-accent);
612
612
  background: #fff3ec;
613
613
  }
614
614
 
615
- ._btnActive_16b09_50:hover {
615
+ ._btnActive_1f7fb_50:hover {
616
616
  color: var(--sb-accent);
617
617
  background: #ffe8da;
618
618
  }
619
619
 
620
- ._btn_16b09_27:disabled {
620
+ ._btn_1f7fb_27:disabled {
621
621
  opacity: 0.3;
622
622
  cursor: not-allowed;
623
623
  }
624
624
 
625
- /* 表内浮动工具条(BubbleMenu portal 到 body,拿不到 .toolbar 变量,故写死配色) */
626
- ._tableBubble_16b09_66 {
625
+ /* 表内右键菜单(portal 到 body,拿不到 .toolbar 变量,故写死配色) */
626
+ ._tableBubble_1f7fb_66 {
627
627
  display: flex;
628
- align-items: center;
629
- gap: 2px;
630
- padding: 4px;
628
+ flex-direction: column;
629
+ min-width: 220px;
630
+ padding: 6px;
631
631
  background: #fff;
632
632
  border: 1px solid #ececec;
633
- border-radius: 8px;
634
- box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
633
+ border-radius: 10px;
634
+ box-shadow: 0 6px 24px rgb(0 0 0 / 14%);
635
+ }
636
+
637
+ ._tableMenuItem_1f7fb_77 {
638
+ display: flex;
639
+ align-items: center;
640
+ gap: 10px;
641
+ width: 100%;
642
+ padding: 7px 10px;
643
+ border: none;
644
+ border-radius: 6px;
645
+ background: transparent;
646
+ color: #363737;
647
+ font-size: 14px;
648
+ line-height: 1.3;
649
+ text-align: left;
650
+ cursor: pointer;
651
+ user-select: none;
652
+ }
653
+
654
+ ._tableMenuItem_1f7fb_77:hover:not(:disabled) {
655
+ background: #f3f3f3;
656
+ }
657
+
658
+ ._tableMenuItem_1f7fb_77:disabled {
659
+ opacity: 0.35;
660
+ cursor: not-allowed;
661
+ }
662
+
663
+ ._tableMenuItemIcon_1f7fb_103 {
664
+ display: inline-flex;
665
+ align-items: center;
666
+ justify-content: center;
667
+ flex: none;
668
+ width: 20px;
669
+ height: 20px;
670
+ color: #6b6b6b;
671
+ }
672
+
673
+ ._tableMenuItemLabel_1f7fb_113 {
674
+ flex: 1;
675
+ min-width: 0;
676
+ }
677
+
678
+ ._tableMenuDivider_1f7fb_118 {
679
+ height: 1px;
680
+ margin: 4px 8px;
681
+ background: #ececec;
682
+ flex-shrink: 0;
635
683
  }
636
684
 
637
685
  /* 文字型图标(引用等) */
638
- ._txtIcon_16b09_78 {
686
+ ._txtIcon_1f7fb_126 {
639
687
  font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
640
688
  font-size: 16px;
641
689
  font-weight: 600;
@@ -643,7 +691,7 @@
643
691
  }
644
692
 
645
693
  /* 文字颜色 / 高亮图标:字母 + 底部当前色条 */
646
- ._colorIcon_16b09_86 {
694
+ ._colorIcon_1f7fb_134 {
647
695
  display: inline-flex;
648
696
  flex-direction: column;
649
697
  align-items: center;
@@ -651,20 +699,20 @@
651
699
  line-height: 1;
652
700
  }
653
701
 
654
- ._colorIconGlyph_16b09_94 {
702
+ ._colorIconGlyph_1f7fb_142 {
655
703
  font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
656
704
  font-size: 15px;
657
705
  font-weight: 600;
658
706
  }
659
707
 
660
- ._colorIconBar_16b09_100 {
708
+ ._colorIconBar_1f7fb_148 {
661
709
  width: 16px;
662
710
  height: 3px;
663
711
  border-radius: 1.5px;
664
712
  }
665
713
 
666
714
  /* A▾ 上标/下标下拉触发器 */
667
- ._scriptTrigger_16b09_107 {
715
+ ._scriptTrigger_1f7fb_155 {
668
716
  display: inline-flex;
669
717
  align-items: center;
670
718
  gap: 3px;
@@ -679,12 +727,12 @@
679
727
  transition: background 0.15s, color 0.15s;
680
728
  }
681
729
 
682
- ._scriptTrigger_16b09_107:hover {
730
+ ._scriptTrigger_1f7fb_155:hover {
683
731
  background: #f3f3f3;
684
732
  color: var(--sb-text);
685
733
  }
686
734
 
687
- ._scriptTriggerGlyph_16b09_127 {
735
+ ._scriptTriggerGlyph_1f7fb_175 {
688
736
  font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
689
737
  font-size: 16px;
690
738
  font-weight: 600;
@@ -692,7 +740,7 @@
692
740
  text-underline-offset: 2px;
693
741
  }
694
742
 
695
- ._divider_16b09_135 {
743
+ ._divider_1f7fb_183 {
696
744
  width: 1px;
697
745
  height: 20px;
698
746
  margin: 0 8px;
@@ -701,7 +749,7 @@
701
749
  }
702
750
 
703
751
  /* ── Style / Size / More 下拉触发器 ── */
704
- ._styleTrigger_16b09_144 {
752
+ ._styleTrigger_1f7fb_192 {
705
753
  display: inline-flex;
706
754
  align-items: center;
707
755
  justify-content: space-between;
@@ -721,16 +769,16 @@
721
769
  transition: background 0.15s;
722
770
  }
723
771
 
724
- ._styleTrigger_16b09_144:hover:not(:disabled) {
772
+ ._styleTrigger_1f7fb_192:hover:not(:disabled) {
725
773
  background: #f3f3f3;
726
774
  }
727
775
 
728
- ._styleTrigger_16b09_144:disabled {
776
+ ._styleTrigger_1f7fb_192:disabled {
729
777
  opacity: 0.3;
730
778
  cursor: not-allowed;
731
779
  }
732
780
 
733
- ._styleTriggerLabel_16b09_173 {
781
+ ._styleTriggerLabel_1f7fb_221 {
734
782
  flex: 1;
735
783
  text-align: left;
736
784
  overflow: hidden;
@@ -738,19 +786,19 @@
738
786
  text-overflow: ellipsis;
739
787
  }
740
788
 
741
- ._styleTriggerCaret_16b09_181 {
789
+ ._styleTriggerCaret_1f7fb_229 {
742
790
  color: var(--sb-muted);
743
791
  flex: none;
744
792
  }
745
793
 
746
794
  /* 下拉项:图标 + 文字 */
747
- ._styleItem_16b09_187 {
795
+ ._styleItem_1f7fb_235 {
748
796
  display: inline-flex;
749
797
  align-items: center;
750
798
  gap: 12px;
751
799
  }
752
800
 
753
- ._styleIcon_16b09_193 {
801
+ ._styleIcon_1f7fb_241 {
754
802
  display: inline-flex;
755
803
  justify-content: center;
756
804
  align-items: center;
@@ -760,19 +808,19 @@
760
808
  }
761
809
 
762
810
  /* 上标 / 下标图标 */
763
- ._scriptGlyph_16b09_203 {
811
+ ._scriptGlyph_1f7fb_251 {
764
812
  display: inline-block;
765
813
  text-align: center;
766
814
  font-family: 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
767
815
  }
768
816
 
769
- ._scriptGlyph_16b09_203 sup,
770
- ._scriptGlyph_16b09_203 sub {
817
+ ._scriptGlyph_1f7fb_251 sup,
818
+ ._scriptGlyph_1f7fb_251 sub {
771
819
  font-size: 0.7em;
772
820
  }
773
821
 
774
822
  /* ── Radix 下拉菜单面板(替代 antd .ant-dropdown-menu) ── */
775
- ._menu_16b09_215 {
823
+ ._menu_1f7fb_263 {
776
824
  min-width: 200px;
777
825
  padding: 6px;
778
826
  background: #fff;
@@ -783,7 +831,7 @@
783
831
  z-index: 1000;
784
832
  }
785
833
 
786
- ._menuItem_16b09_226 {
834
+ ._menuItem_1f7fb_274 {
787
835
  display: flex;
788
836
  align-items: center;
789
837
  width: 100%;
@@ -797,54 +845,101 @@
797
845
  cursor: pointer;
798
846
  user-select: none;
799
847
  outline: none;
848
+ gap: 8px;
800
849
  }
801
850
 
802
- ._menuItem_16b09_226:hover:not(:disabled) {
851
+ ._menuItem_1f7fb_274:hover:not(:disabled) {
803
852
  background: #f3f3f3;
804
853
  }
805
854
 
806
- ._menuItem_16b09_226:disabled {
855
+ ._menuItem_1f7fb_274:disabled {
807
856
  opacity: 0.35;
808
857
  cursor: not-allowed;
809
858
  }
810
859
 
811
860
  /* 选中态:品牌色高亮 */
812
- ._menuItemSelected_16b09_252 {
861
+ ._menuItemSelected_1f7fb_301 {
813
862
  background: #fff3ec;
814
863
  color: var(--sb-accent);
815
864
  }
816
865
 
817
- ._menuItemSelected_16b09_252 ._styleIcon_16b09_193 {
866
+ ._menuItemSelected_1f7fb_301 ._styleIcon_1f7fb_241 {
818
867
  color: var(--sb-accent);
819
868
  }
820
869
 
821
- ._menuItemSelected_16b09_252:hover:not(:disabled) {
870
+ ._menuItemSelected_1f7fb_301:hover:not(:disabled) {
822
871
  background: #ffe8da;
823
872
  }
824
873
 
874
+ ._tableInsertCaret_1f7fb_314 {
875
+ margin-left: auto;
876
+ color: var(--sb-muted);
877
+ transform: rotate(-90deg);
878
+ flex: none;
879
+ }
880
+
881
+ /* 插入表格:行列网格选择器 */
882
+ ._tableSizePicker_1f7fb_322 {
883
+ padding: 10px;
884
+ background: #fff;
885
+ border-radius: 10px;
886
+ box-shadow:
887
+ 0 6px 24px rgba(0, 0, 0, 0.12),
888
+ 0 0 0 1px rgba(0, 0, 0, 0.06);
889
+ z-index: 1001;
890
+ }
891
+
892
+ ._tableSizeGrid_1f7fb_332 {
893
+ display: grid;
894
+ gap: 3px;
895
+ }
896
+
897
+ ._tableSizeCell_1f7fb_337 {
898
+ width: 16px;
899
+ height: 16px;
900
+ padding: 0;
901
+ border: 1px solid #d9d9d9;
902
+ border-radius: 2px;
903
+ background: #fff;
904
+ cursor: pointer;
905
+ }
906
+
907
+ ._tableSizeCellActive_1f7fb_347 {
908
+ border-color: var(--tmr-accent, #ff6719);
909
+ background: #fff3ec;
910
+ }
911
+
912
+ ._tableSizeLabel_1f7fb_352 {
913
+ margin-top: 8px;
914
+ text-align: center;
915
+ font-size: 12px;
916
+ color: #6b6b6b;
917
+ font-variant-numeric: tabular-nums;
918
+ }
919
+
825
920
  /* Radix Popover 内容(承载 ColorPalette),面板自带阴影,这里只兜底 z-index */
826
- ._popoverContent_16b09_266 {
921
+ ._popoverContent_1f7fb_361 {
827
922
  z-index: 1000;
828
923
  }
829
924
 
830
- ._mathLayer_16b09_270 {
925
+ ._mathLayer_1f7fb_365 {
831
926
  position: absolute;
832
927
  z-index: 6;
833
928
  }
834
929
 
835
- ._mathStack_16b09_275 {
930
+ ._mathStack_1f7fb_370 {
836
931
  display: flex;
837
932
  flex-direction: column;
838
933
  align-items: flex-start;
839
934
  gap: 8px;
840
935
  }
841
936
 
842
- ._mathStackBlock_16b09_282 {
937
+ ._mathStackBlock_1f7fb_377 {
843
938
  align-items: stretch;
844
939
  width: 100%;
845
940
  }
846
941
 
847
- ._mathHint_16b09_287 {
942
+ ._mathHint_1f7fb_382 {
848
943
  display: inline-flex;
849
944
  align-items: center;
850
945
  gap: 6px;
@@ -856,19 +951,19 @@
856
951
  line-height: 1.4;
857
952
  }
858
953
 
859
- ._mathHintBlock_16b09_299 {
954
+ ._mathHintBlock_1f7fb_394 {
860
955
  width: 100%;
861
956
  padding: 10px 14px;
862
957
  border-radius: 8px;
863
958
  }
864
959
 
865
- ._mathHintIcon_16b09_305 {
960
+ ._mathHintIcon_1f7fb_400 {
866
961
  font-family: ui-serif, Georgia, 'Times New Roman', serif;
867
962
  font-size: 12px;
868
963
  opacity: 0.85;
869
964
  }
870
965
 
871
- ._mathPreviewInline_16b09_311 {
966
+ ._mathPreviewInline_1f7fb_406 {
872
967
  display: inline-flex;
873
968
  max-width: min(440px, calc(100vw - 24px));
874
969
  padding: 4px 10px;
@@ -878,7 +973,7 @@
878
973
  color: var(--tmr-text, #363737);
879
974
  }
880
975
 
881
- ._mathPreviewBlock_16b09_321 {
976
+ ._mathPreviewBlock_1f7fb_416 {
882
977
  width: 100%;
883
978
  min-height: 48px;
884
979
  padding: 14px 16px;
@@ -889,11 +984,11 @@
889
984
  color: var(--tmr-text, #363737);
890
985
  }
891
986
 
892
- ._mathPreviewBlock_16b09_321 .katex-display {
987
+ ._mathPreviewBlock_1f7fb_416 .katex-display {
893
988
  margin: 0;
894
989
  }
895
990
 
896
- ._mathField_16b09_336 {
991
+ ._mathField_1f7fb_431 {
897
992
  display: flex;
898
993
  align-items: center;
899
994
  gap: 8px;
@@ -905,14 +1000,14 @@
905
1000
  box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
906
1001
  }
907
1002
 
908
- ._mathFieldBlock_16b09_348 {
1003
+ ._mathFieldBlock_1f7fb_443 {
909
1004
  align-items: flex-start;
910
1005
  width: 100%;
911
1006
  border-radius: 12px;
912
1007
  padding: 10px 10px 10px 14px;
913
1008
  }
914
1009
 
915
- ._mathInput_16b09_355 {
1010
+ ._mathInput_1f7fb_450 {
916
1011
  flex: 1;
917
1012
  min-width: 0;
918
1013
  margin: 0;
@@ -926,11 +1021,11 @@
926
1021
  resize: none;
927
1022
  }
928
1023
 
929
- ._mathInput_16b09_355:focus {
1024
+ ._mathInput_1f7fb_450:focus {
930
1025
  outline: none;
931
1026
  }
932
1027
 
933
- ._mathDone_16b09_373 {
1028
+ ._mathDone_1f7fb_468 {
934
1029
  display: inline-flex;
935
1030
  align-items: center;
936
1031
  gap: 4px;
@@ -946,16 +1041,16 @@
946
1041
  cursor: pointer;
947
1042
  }
948
1043
 
949
- ._mathDone_16b09_373:hover:not(:disabled) {
1044
+ ._mathDone_1f7fb_468:hover:not(:disabled) {
950
1045
  filter: brightness(0.95);
951
1046
  }
952
1047
 
953
- ._mathDone_16b09_373:disabled {
1048
+ ._mathDone_1f7fb_468:disabled {
954
1049
  opacity: 0.35;
955
1050
  cursor: not-allowed;
956
1051
  }
957
1052
 
958
- ._mathDoneKbd_16b09_398 {
1053
+ ._mathDoneKbd_1f7fb_493 {
959
1054
  font-size: 11px;
960
1055
  font-weight: 500;
961
1056
  opacity: 0.85;
@@ -0,0 +1,29 @@
1
+ import { Editor } from '@tiptap/core';
2
+ import { EditorState } from '@tiptap/pm/state';
3
+ import { CellSelection } from '@tiptap/pm/tables';
4
+ export interface TableSelectionInfo {
5
+ rowCount: number;
6
+ colCount: number;
7
+ /** 选区跨越多行或多列时为 true(用于带 N 的文案)。 */
8
+ isMultiCell: boolean;
9
+ includesHeaderRow: boolean;
10
+ coversAllRows: boolean;
11
+ coversAllCols: boolean;
12
+ }
13
+ /** 当前若不在表格内返回 null。 */
14
+ export declare function getTableSelectionInfo(state: EditorState): TableSelectionInfo | null;
15
+ /** 文档坐标是否落在 CellSelection 覆盖的某个单元格内(含单元格节点本身)。 */
16
+ export declare function isPosInCellSelection(selection: CellSelection, pos: number): boolean;
17
+ /**
18
+ * 表内右键:若点击落在已有多格选区内则保留选区;
19
+ * 否则把光标落到点击位置(单格操作)。
20
+ */
21
+ export declare function preserveTableSelectionOnContextMenu(editor: Editor, pos: number): void;
22
+ export declare function addRowsBefore(editor: Editor, count: number): boolean;
23
+ export declare function addRowsAfter(editor: Editor, count: number): boolean;
24
+ export declare function addColumnsBefore(editor: Editor, count: number): boolean;
25
+ export declare function addColumnsAfter(editor: Editor, count: number): boolean;
26
+ /** 删行:全表行被选中时改为删整表;含表头时调用方应先禁用。 */
27
+ export declare function deleteSelectedRows(editor: Editor): boolean;
28
+ /** 删列:选区覆盖全部列且同时覆盖全部行时删整表;仅覆盖全部列时失败(由 UI 禁用)。 */
29
+ export declare function deleteSelectedColumns(editor: Editor): boolean;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiptap-markdown-react",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
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",