@prosekit/extensions 0.7.3 → 0.7.4
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/_tsup-dts-rollup.d.ts +389 -79
- package/dist/list/style.css +1 -1
- package/dist/prosekit-extensions-link.js +3 -3
- package/dist/prosekit-extensions-list.d.ts +4 -4
- package/dist/prosekit-extensions-list.js +30 -20
- package/dist/prosekit-extensions-table.js +0 -1
- package/dist/prosekit-extensions-text-align.d.ts +1 -0
- package/package.json +7 -6
@@ -1,5 +1,6 @@
|
|
1
1
|
import { AddMarkOptions } from '@prosekit/core';
|
2
|
-
import { Attrs } from '
|
2
|
+
import { Attrs } from 'prosemirror-model';
|
3
|
+
import { Attrs as Attrs_2 } from '@prosekit/pm/model';
|
3
4
|
import { BundledLanguage } from 'shiki';
|
4
5
|
import { BundledLanguageInfo } from 'shiki';
|
5
6
|
import { bundledLanguagesInfo } from 'shiki';
|
@@ -12,18 +13,20 @@ import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
|
|
12
13
|
import { EditorState } from '@prosekit/pm/state';
|
13
14
|
import { Extension } from '@prosekit/core';
|
14
15
|
import { ExtensionTyping } from '@prosekit/core';
|
15
|
-
import {
|
16
|
-
import {
|
16
|
+
import { ExtractMarkActions } from '@prosekit/core';
|
17
|
+
import { ExtractNodeActions } from '@prosekit/core';
|
17
18
|
import { getSingletonHighlighter } from 'shiki/bundle/full';
|
18
19
|
import type { Highlighter } from 'shiki';
|
19
20
|
import { IndentListOptions } from 'prosemirror-flat-list';
|
20
21
|
import { InputRule } from '@prosekit/pm/inputrules';
|
21
22
|
import { InsertNodeOptions } from '@prosekit/core';
|
23
|
+
import type { IsEqual } from 'type-fest';
|
22
24
|
import { ListAttributes } from 'prosemirror-flat-list';
|
23
25
|
import { ListDOMSerializer } from 'prosemirror-flat-list';
|
24
|
-
import { MarkBuilder } from '@prosekit/core';
|
25
26
|
import { MarkType } from '@prosekit/pm/model';
|
26
|
-
import {
|
27
|
+
import { Node as Node_2 } from 'prosemirror-model';
|
28
|
+
import { NodeAction } from '@prosekit/core';
|
29
|
+
import { NodeChild } from '@prosekit/core';
|
27
30
|
import { NodeJSON } from '@prosekit/core';
|
28
31
|
import { NodeType } from '@prosekit/pm/model';
|
29
32
|
import { Options } from 'tsup';
|
@@ -35,10 +38,12 @@ import { RemoveMarkOptions } from '@prosekit/core';
|
|
35
38
|
import { RemoveNodeOptions } from '@prosekit/core';
|
36
39
|
import { SetBlockTypeOptions } from '@prosekit/core';
|
37
40
|
import { SetNodeAttrsOptions } from '@prosekit/core';
|
41
|
+
import { SimplifyDeeper } from '@prosekit/core';
|
38
42
|
import type { SpecialLanguage } from 'shiki';
|
39
43
|
import { StepJSON } from '@prosekit/core';
|
40
44
|
import { TestEditor } from '@prosekit/core/test';
|
41
45
|
import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
|
46
|
+
import { ToMarkAction } from '@prosekit/core';
|
42
47
|
import { Transaction } from '@prosekit/pm/state';
|
43
48
|
import { UnsetBlockTypeOptions } from '@prosekit/core';
|
44
49
|
import { UnsetMarkOptions } from '@prosekit/core';
|
@@ -48,6 +53,11 @@ import { WrapOptions } from '@prosekit/core';
|
|
48
53
|
|
49
54
|
export declare function applyMarkRules(rules: MarkRuleOptions[], transactions: readonly Transaction[], oldState: EditorState, newState: EditorState): Transaction | null;
|
50
55
|
|
56
|
+
/**
|
57
|
+
* Utility function assert that two types are equal in tests.
|
58
|
+
*/
|
59
|
+
export declare function assertTypeEqual<T, U>(_val: IsEqual<T, U>): void;
|
60
|
+
|
51
61
|
declare class AutocompleteRule {
|
52
62
|
readonly regex: RegExp;
|
53
63
|
readonly onMatch: MatchHandler;
|
@@ -195,7 +205,9 @@ export declare function defineAutocomplete(rule: AutocompleteRule): Extension;
|
|
195
205
|
* @public
|
196
206
|
*/
|
197
207
|
export declare function defineBlockquote(): Extension< {
|
198
|
-
Nodes:
|
208
|
+
Nodes: SimplifyDeeper< {
|
209
|
+
blockquote: Attrs;
|
210
|
+
}>;
|
199
211
|
Marks: never;
|
200
212
|
Commands: never;
|
201
213
|
}>;
|
@@ -207,7 +219,9 @@ Commands: never;
|
|
207
219
|
export declare function defineBlockquoteInputRule(): Extension<ExtensionTyping<any, any, any>>;
|
208
220
|
|
209
221
|
export declare function defineBlockquoteSpec(): Extension< {
|
210
|
-
Nodes:
|
222
|
+
Nodes: {
|
223
|
+
blockquote: Attrs;
|
224
|
+
};
|
211
225
|
Marks: never;
|
212
226
|
Commands: never;
|
213
227
|
}>;
|
@@ -217,7 +231,9 @@ Commands: never;
|
|
217
231
|
*/
|
218
232
|
export declare function defineBold(): Extension< {
|
219
233
|
Nodes: never;
|
220
|
-
Marks:
|
234
|
+
Marks: SimplifyDeeper< {
|
235
|
+
bold: Attrs;
|
236
|
+
}>;
|
221
237
|
Commands: {
|
222
238
|
toggleBold: [];
|
223
239
|
};
|
@@ -236,7 +252,9 @@ export declare function defineBoldInputRule(): Extension<ExtensionTyping<any, an
|
|
236
252
|
export declare function defineBoldKeymap(): Extension<ExtensionTyping<any, any, any>>;
|
237
253
|
|
238
254
|
export declare function defineBoldSpec(): Extension< {
|
239
|
-
Marks:
|
255
|
+
Marks: {
|
256
|
+
bold: Attrs;
|
257
|
+
};
|
240
258
|
Nodes: never;
|
241
259
|
Commands: never;
|
242
260
|
}>;
|
@@ -246,7 +264,9 @@ Commands: never;
|
|
246
264
|
*/
|
247
265
|
export declare function defineCode(): Extension< {
|
248
266
|
Nodes: never;
|
249
|
-
Marks:
|
267
|
+
Marks: SimplifyDeeper< {
|
268
|
+
code: Attrs;
|
269
|
+
}>;
|
250
270
|
Commands: {
|
251
271
|
toggleCode: [];
|
252
272
|
};
|
@@ -264,7 +284,11 @@ toggleCode: [];
|
|
264
284
|
* @public
|
265
285
|
*/
|
266
286
|
declare function defineCodeBlock(): Extension< {
|
267
|
-
Nodes:
|
287
|
+
Nodes: SimplifyDeeper< {
|
288
|
+
codeBlock: {
|
289
|
+
language: string;
|
290
|
+
};
|
291
|
+
}>;
|
268
292
|
Marks: never;
|
269
293
|
Commands: {
|
270
294
|
setCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
@@ -346,7 +370,11 @@ export { defineCodeBlockShiki as defineCodeBlockShiki_alias_1 }
|
|
346
370
|
* @public
|
347
371
|
*/
|
348
372
|
declare function defineCodeBlockSpec(): Extension< {
|
349
|
-
Nodes:
|
373
|
+
Nodes: {
|
374
|
+
codeBlock: {
|
375
|
+
language: string;
|
376
|
+
};
|
377
|
+
};
|
350
378
|
Marks: never;
|
351
379
|
Commands: never;
|
352
380
|
}>;
|
@@ -369,7 +397,9 @@ export declare function defineCodeKeymap(): Extension<ExtensionTyping<any, any,
|
|
369
397
|
* @public
|
370
398
|
*/
|
371
399
|
export declare function defineCodeSpec(): Extension< {
|
372
|
-
Marks:
|
400
|
+
Marks: {
|
401
|
+
code: Attrs;
|
402
|
+
};
|
373
403
|
Nodes: never;
|
374
404
|
Commands: never;
|
375
405
|
}>;
|
@@ -410,7 +440,11 @@ export declare function defineEnterRule({ regex, handler, stop, }: EnterRuleOpti
|
|
410
440
|
* @public
|
411
441
|
*/
|
412
442
|
export declare function defineHeading(): Extension< {
|
413
|
-
Nodes:
|
443
|
+
Nodes: SimplifyDeeper< {
|
444
|
+
heading: {
|
445
|
+
level: number;
|
446
|
+
};
|
447
|
+
}>;
|
414
448
|
Marks: never;
|
415
449
|
Commands: {
|
416
450
|
setHeading: [attrs?: HeadingAttrs | undefined];
|
@@ -444,7 +478,11 @@ export { defineHeadingKeymap }
|
|
444
478
|
export { defineHeadingKeymap as defineHeadingKeymap_alias_1 }
|
445
479
|
|
446
480
|
declare function defineHeadingSpec(): Extension< {
|
447
|
-
Nodes:
|
481
|
+
Nodes: {
|
482
|
+
heading: {
|
483
|
+
level: number;
|
484
|
+
};
|
485
|
+
};
|
448
486
|
Marks: never;
|
449
487
|
Commands: never;
|
450
488
|
}>;
|
@@ -455,7 +493,11 @@ export { defineHeadingSpec as defineHeadingSpec_alias_1 }
|
|
455
493
|
* @public
|
456
494
|
*/
|
457
495
|
export declare function defineImage(): Extension< {
|
458
|
-
Nodes:
|
496
|
+
Nodes: SimplifyDeeper< {
|
497
|
+
image: {
|
498
|
+
src: null;
|
499
|
+
};
|
500
|
+
}>;
|
459
501
|
Marks: never;
|
460
502
|
Commands: {
|
461
503
|
insertImage: [attrs?: ImageAttrs | undefined];
|
@@ -471,7 +513,11 @@ Marks: never;
|
|
471
513
|
}>;
|
472
514
|
|
473
515
|
export declare function defineImageSpec(): Extension< {
|
474
|
-
Nodes:
|
516
|
+
Nodes: {
|
517
|
+
image: {
|
518
|
+
src: null;
|
519
|
+
};
|
520
|
+
};
|
475
521
|
Marks: never;
|
476
522
|
Commands: never;
|
477
523
|
}>;
|
@@ -490,7 +536,9 @@ export declare function defineInputRule(rule: InputRule): Extension;
|
|
490
536
|
*/
|
491
537
|
export declare function defineItalic(): Extension< {
|
492
538
|
Nodes: never;
|
493
|
-
Marks:
|
539
|
+
Marks: SimplifyDeeper< {
|
540
|
+
italic: Attrs;
|
541
|
+
}>;
|
494
542
|
Commands: {
|
495
543
|
toggleItalic: [];
|
496
544
|
};
|
@@ -509,7 +557,9 @@ export declare function defineItalicInputRule(): Extension<ExtensionTyping<any,
|
|
509
557
|
export declare function defineItalicKeymap(): Extension<ExtensionTyping<any, any, any>>;
|
510
558
|
|
511
559
|
export declare function defineItalicSpec(): Extension< {
|
512
|
-
Marks:
|
560
|
+
Marks: {
|
561
|
+
italic: Attrs;
|
562
|
+
};
|
513
563
|
Nodes: never;
|
514
564
|
Commands: never;
|
515
565
|
}>;
|
@@ -519,7 +569,9 @@ Commands: never;
|
|
519
569
|
*/
|
520
570
|
export declare function defineLink(): Extension< {
|
521
571
|
Nodes: never;
|
522
|
-
Marks:
|
572
|
+
Marks: SimplifyDeeper< {
|
573
|
+
link: LinkAttrs;
|
574
|
+
}>;
|
523
575
|
Commands: {
|
524
576
|
addLink: [attrs: LinkAttrs];
|
525
577
|
removeLink: [];
|
@@ -555,7 +607,9 @@ export declare function defineLinkInputRule(): Extension<ExtensionTyping<any, an
|
|
555
607
|
export declare function defineLinkMarkRule(): Extension<ExtensionTyping<any, any, any>>;
|
556
608
|
|
557
609
|
export declare function defineLinkSpec(): Extension< {
|
558
|
-
Marks:
|
610
|
+
Marks: {
|
611
|
+
link: LinkAttrs;
|
612
|
+
};
|
559
613
|
Nodes: never;
|
560
614
|
Commands: never;
|
561
615
|
}>;
|
@@ -563,24 +617,28 @@ Commands: never;
|
|
563
617
|
/**
|
564
618
|
* @public
|
565
619
|
*/
|
566
|
-
export declare function defineList(): Extension<{
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
620
|
+
export declare function defineList(): Extension< {
|
621
|
+
Nodes: SimplifyDeeper< {
|
622
|
+
list: ListAttrs;
|
623
|
+
}>;
|
624
|
+
Marks: never;
|
625
|
+
Commands: {
|
626
|
+
dedentList: [options?: DedentListOptions | undefined];
|
627
|
+
indentList: [options?: IndentListOptions | undefined];
|
628
|
+
moveList: [direction: "up" | "down"];
|
629
|
+
splitList: [];
|
630
|
+
toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
|
631
|
+
toggleList: [attrs: ListAttributes];
|
632
|
+
unwrapList: [options?: UnwrapListOptions | undefined];
|
633
|
+
wrapInList: [getAttrs: WrapInListGetAttrs<ListAttributes>];
|
634
|
+
insertList: [attrs?: ListAttributes | undefined];
|
635
|
+
};
|
580
636
|
}>;
|
581
637
|
|
582
638
|
/**
|
583
|
-
* Defines list commands
|
639
|
+
* Defines list commands.
|
640
|
+
*
|
641
|
+
* @internal
|
584
642
|
*/
|
585
643
|
declare function defineListCommands(): Extension< {
|
586
644
|
Commands: {
|
@@ -600,24 +658,41 @@ Marks: never;
|
|
600
658
|
export { defineListCommands }
|
601
659
|
export { defineListCommands as defineListCommands_alias_1 }
|
602
660
|
|
603
|
-
|
661
|
+
/**
|
662
|
+
* @internal
|
663
|
+
*/
|
664
|
+
declare function defineListInputRules(): Extension;
|
665
|
+
export { defineListInputRules }
|
666
|
+
export { defineListInputRules as defineListInputRules_alias_1 }
|
604
667
|
|
605
668
|
/**
|
606
669
|
* Returns a extension that adds key bindings for list.
|
607
670
|
*
|
608
|
-
* @
|
671
|
+
* @internal
|
609
672
|
*/
|
610
673
|
declare function defineListKeymap(): Extension<ExtensionTyping<any, any, any>>;
|
611
674
|
export { defineListKeymap }
|
612
675
|
export { defineListKeymap as defineListKeymap_alias_1 }
|
613
676
|
|
614
|
-
|
677
|
+
/**
|
678
|
+
* @internal
|
679
|
+
*/
|
680
|
+
declare function defineListPlugins(): Extension<ExtensionTyping<any, any, any>>;
|
681
|
+
export { defineListPlugins }
|
682
|
+
export { defineListPlugins as defineListPlugins_alias_1 }
|
615
683
|
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
684
|
+
/**
|
685
|
+
* @internal
|
686
|
+
*/
|
687
|
+
declare function defineListSpec(): Extension< {
|
688
|
+
Nodes: {
|
689
|
+
list: ListAttrs;
|
690
|
+
};
|
691
|
+
Marks: never;
|
692
|
+
Commands: never;
|
620
693
|
}>;
|
694
|
+
export { defineListSpec }
|
695
|
+
export { defineListSpec as defineListSpec_alias_1 }
|
621
696
|
|
622
697
|
/**
|
623
698
|
* Defines an input rule for automatically adding inline marks when a given
|
@@ -639,7 +714,9 @@ export { defineMarkRule as defineMarkRule_alias_1 }
|
|
639
714
|
* @public
|
640
715
|
*/
|
641
716
|
export declare function defineMention(): Extension< {
|
642
|
-
Nodes:
|
717
|
+
Nodes: SimplifyDeeper< {
|
718
|
+
mention: MentionAttrs;
|
719
|
+
}>;
|
643
720
|
Marks: never;
|
644
721
|
Commands: {
|
645
722
|
insertMention: [attrs: MentionAttrs];
|
@@ -658,7 +735,9 @@ Marks: never;
|
|
658
735
|
* @public
|
659
736
|
*/
|
660
737
|
export declare function defineMentionSpec(): Extension< {
|
661
|
-
Nodes:
|
738
|
+
Nodes: {
|
739
|
+
mention: MentionAttrs;
|
740
|
+
};
|
662
741
|
Marks: never;
|
663
742
|
Commands: never;
|
664
743
|
}>;
|
@@ -714,7 +793,9 @@ export declare function defineSearchQuery(options: SearchQueryOptions): Extensio
|
|
714
793
|
*/
|
715
794
|
export declare function defineStrike(): Extension< {
|
716
795
|
Nodes: never;
|
717
|
-
Marks:
|
796
|
+
Marks: SimplifyDeeper< {
|
797
|
+
strike: Attrs;
|
798
|
+
}>;
|
718
799
|
Commands: {
|
719
800
|
toggleStrike: [];
|
720
801
|
};
|
@@ -733,7 +814,9 @@ export declare function defineStrikeInputRule(): Extension<ExtensionTyping<any,
|
|
733
814
|
export declare function defineStrikeKeymap(): Extension<ExtensionTyping<any, any, any>>;
|
734
815
|
|
735
816
|
export declare function defineStrikeSpec(): Extension< {
|
736
|
-
Marks:
|
817
|
+
Marks: {
|
818
|
+
strike: Attrs;
|
819
|
+
};
|
737
820
|
Nodes: never;
|
738
821
|
Commands: never;
|
739
822
|
}>;
|
@@ -742,7 +825,16 @@ Commands: never;
|
|
742
825
|
* @public
|
743
826
|
*/
|
744
827
|
export declare function defineTable(): Extension< {
|
745
|
-
Nodes:
|
828
|
+
Nodes: SimplifyDeeper< {
|
829
|
+
table: Attrs;
|
830
|
+
tableRow: Attrs;
|
831
|
+
tableCell: {
|
832
|
+
[x: string]: any;
|
833
|
+
};
|
834
|
+
tableHeaderCell: {
|
835
|
+
[x: string]: any;
|
836
|
+
};
|
837
|
+
}>;
|
746
838
|
Marks: never;
|
747
839
|
Commands: {
|
748
840
|
insertTable: [{
|
@@ -755,7 +847,11 @@ exitTable: [];
|
|
755
847
|
}>;
|
756
848
|
|
757
849
|
declare function defineTableCellSpec(): Extension< {
|
758
|
-
Nodes:
|
850
|
+
Nodes: {
|
851
|
+
tableCell: {
|
852
|
+
[x: string]: any;
|
853
|
+
};
|
854
|
+
};
|
759
855
|
Marks: never;
|
760
856
|
Commands: never;
|
761
857
|
}>;
|
@@ -783,7 +879,11 @@ export { defineTableCommands }
|
|
783
879
|
export { defineTableCommands as defineTableCommands_alias_1 }
|
784
880
|
|
785
881
|
declare function defineTableHeaderCellSpec(): Extension< {
|
786
|
-
Nodes:
|
882
|
+
Nodes: {
|
883
|
+
tableHeaderCell: {
|
884
|
+
[x: string]: any;
|
885
|
+
};
|
886
|
+
};
|
787
887
|
Marks: never;
|
788
888
|
Commands: never;
|
789
889
|
}>;
|
@@ -798,7 +898,9 @@ export { defineTablePlugins }
|
|
798
898
|
export { defineTablePlugins as defineTablePlugins_alias_1 }
|
799
899
|
|
800
900
|
declare function defineTableRowSpec(): Extension< {
|
801
|
-
Nodes:
|
901
|
+
Nodes: {
|
902
|
+
tableRow: Attrs_2;
|
903
|
+
};
|
802
904
|
Marks: never;
|
803
905
|
Commands: never;
|
804
906
|
}>;
|
@@ -806,7 +908,9 @@ export { defineTableRowSpec }
|
|
806
908
|
export { defineTableRowSpec as defineTableRowSpec_alias_1 }
|
807
909
|
|
808
910
|
declare function defineTableSpec(): Extension< {
|
809
|
-
Nodes:
|
911
|
+
Nodes: {
|
912
|
+
table: Attrs_2;
|
913
|
+
};
|
810
914
|
Marks: never;
|
811
915
|
Commands: never;
|
812
916
|
}>;
|
@@ -817,8 +921,58 @@ export { defineTableSpec as defineTableSpec_alias_1 }
|
|
817
921
|
* @internal
|
818
922
|
*/
|
819
923
|
export declare function defineTestExtension(): Extension<{
|
820
|
-
Nodes:
|
821
|
-
|
924
|
+
Nodes: SimplifyDeeper< {
|
925
|
+
paragraph: Attrs;
|
926
|
+
doc: Attrs;
|
927
|
+
text: Attrs;
|
928
|
+
blockquote: {
|
929
|
+
readonly [x: string]: any;
|
930
|
+
};
|
931
|
+
heading: {
|
932
|
+
level: number;
|
933
|
+
};
|
934
|
+
image: {
|
935
|
+
src: null;
|
936
|
+
};
|
937
|
+
list: {
|
938
|
+
kind?: "bullet" | "ordered" | "task" | "toggle";
|
939
|
+
order?: number | null;
|
940
|
+
checked?: boolean;
|
941
|
+
collapsed?: boolean;
|
942
|
+
};
|
943
|
+
table: {
|
944
|
+
readonly [x: string]: any;
|
945
|
+
};
|
946
|
+
tableRow: {
|
947
|
+
readonly [x: string]: any;
|
948
|
+
};
|
949
|
+
tableCell: {
|
950
|
+
[x: string]: any;
|
951
|
+
};
|
952
|
+
tableHeaderCell: {
|
953
|
+
[x: string]: any;
|
954
|
+
};
|
955
|
+
}>;
|
956
|
+
Marks: SimplifyDeeper< {
|
957
|
+
bold: {
|
958
|
+
readonly [x: string]: any;
|
959
|
+
};
|
960
|
+
code: {
|
961
|
+
readonly [x: string]: any;
|
962
|
+
};
|
963
|
+
italic: {
|
964
|
+
readonly [x: string]: any;
|
965
|
+
};
|
966
|
+
link: {
|
967
|
+
href: string;
|
968
|
+
};
|
969
|
+
strike: {
|
970
|
+
readonly [x: string]: any;
|
971
|
+
};
|
972
|
+
underline: {
|
973
|
+
readonly [x: string]: any;
|
974
|
+
};
|
975
|
+
}>;
|
822
976
|
Commands: {
|
823
977
|
insertText: [{
|
824
978
|
text: string;
|
@@ -874,23 +1028,23 @@ export declare function defineTestExtension(): Extension<{
|
|
874
1028
|
*
|
875
1029
|
* @public
|
876
1030
|
*/
|
877
|
-
export declare function defineTextAlign(options: TextAlignOptions): Extension<{
|
878
|
-
Nodes:
|
879
|
-
|
880
|
-
|
881
|
-
|
1031
|
+
export declare function defineTextAlign<NodeName extends string = string>(options: TextAlignOptions<NodeName>): Extension<{
|
1032
|
+
Nodes: {
|
1033
|
+
[K in NodeName]: {
|
1034
|
+
textAlign: string | null;
|
1035
|
+
};
|
882
1036
|
};
|
1037
|
+
Marks: never;
|
1038
|
+
Commands: TextAlignCommandTyping;
|
883
1039
|
}>;
|
884
1040
|
|
885
1041
|
/**
|
886
1042
|
* @internal
|
887
1043
|
*/
|
888
1044
|
export declare function defineTextAlignCommands(types: string[]): Extension<{
|
889
|
-
Commands: {
|
890
|
-
setTextAlign: [value: string | null];
|
891
|
-
};
|
892
1045
|
Nodes: never;
|
893
1046
|
Marks: never;
|
1047
|
+
Commands: TextAlignCommandTyping;
|
894
1048
|
}>;
|
895
1049
|
|
896
1050
|
/**
|
@@ -929,7 +1083,7 @@ export declare function defineTextBlockInputRule({ regex, type, attrs, }: {
|
|
929
1083
|
/**
|
930
1084
|
* Attributes to set on the node.
|
931
1085
|
*/
|
932
|
-
attrs?:
|
1086
|
+
attrs?: Attrs_2 | null | ((match: RegExpMatchArray) => Attrs_2 | null);
|
933
1087
|
}): Extension;
|
934
1088
|
|
935
1089
|
/**
|
@@ -937,7 +1091,9 @@ export declare function defineTextBlockInputRule({ regex, type, attrs, }: {
|
|
937
1091
|
*/
|
938
1092
|
export declare function defineUnderline(): Extension< {
|
939
1093
|
Nodes: never;
|
940
|
-
Marks:
|
1094
|
+
Marks: SimplifyDeeper< {
|
1095
|
+
underline: Attrs;
|
1096
|
+
}>;
|
941
1097
|
Commands: {
|
942
1098
|
toggleUnderline: [];
|
943
1099
|
};
|
@@ -954,7 +1110,9 @@ Marks: never;
|
|
954
1110
|
export declare function defineUnderlineKeymap(): Extension<ExtensionTyping<any, any, any>>;
|
955
1111
|
|
956
1112
|
export declare function defineUnderlineSpec(): Extension< {
|
957
|
-
Marks:
|
1113
|
+
Marks: {
|
1114
|
+
underline: Attrs;
|
1115
|
+
};
|
958
1116
|
Nodes: never;
|
959
1117
|
Commands: never;
|
960
1118
|
}>;
|
@@ -993,7 +1151,7 @@ export declare function defineWrappingInputRule({ regex, type, attrs, join, }: {
|
|
993
1151
|
/**
|
994
1152
|
* Attributes to set on the node.
|
995
1153
|
*/
|
996
|
-
attrs?:
|
1154
|
+
attrs?: Attrs_2 | null | ((match: RegExpMatchArray) => Attrs_2 | null);
|
997
1155
|
/**
|
998
1156
|
* By default, if there's a node with the same type above the newly wrapped
|
999
1157
|
* node, the rule will try to
|
@@ -1144,7 +1302,31 @@ export declare interface LinkAttrs {
|
|
1144
1302
|
href: string;
|
1145
1303
|
}
|
1146
1304
|
|
1147
|
-
|
1305
|
+
/**
|
1306
|
+
* The attributes of a list node.
|
1307
|
+
*
|
1308
|
+
* @public
|
1309
|
+
*/
|
1310
|
+
declare interface ListAttrs {
|
1311
|
+
/**
|
1312
|
+
* The kind of list node.
|
1313
|
+
*/
|
1314
|
+
kind?: 'bullet' | 'ordered' | 'task' | 'toggle';
|
1315
|
+
/**
|
1316
|
+
* The optional order of the list node.
|
1317
|
+
*/
|
1318
|
+
order?: number | null;
|
1319
|
+
/**
|
1320
|
+
* Whether the list node is checked if its `kind` is `"task"`.
|
1321
|
+
*/
|
1322
|
+
checked?: boolean;
|
1323
|
+
/**
|
1324
|
+
* Whether the list node is collapsed if its `kind` is `"toggle"`.
|
1325
|
+
*/
|
1326
|
+
collapsed?: boolean;
|
1327
|
+
}
|
1328
|
+
export { ListAttrs }
|
1329
|
+
export { ListAttrs as ListAttrs_alias_1 }
|
1148
1330
|
|
1149
1331
|
export { ListDOMSerializer }
|
1150
1332
|
|
@@ -1167,7 +1349,7 @@ export declare interface MarkInputRuleOptions {
|
|
1167
1349
|
/**
|
1168
1350
|
* Attributes to set on the mark.
|
1169
1351
|
*/
|
1170
|
-
attrs?:
|
1352
|
+
attrs?: Attrs_2 | null | ((match: RegExpMatchArray) => Attrs_2 | null);
|
1171
1353
|
}
|
1172
1354
|
|
1173
1355
|
/**
|
@@ -1191,7 +1373,7 @@ declare interface MarkRuleOptions {
|
|
1191
1373
|
*
|
1192
1374
|
* @default null
|
1193
1375
|
*/
|
1194
|
-
attrs?:
|
1376
|
+
attrs?: Attrs_2 | null | ((match: RegExpMatchArray) => Attrs_2 | null);
|
1195
1377
|
}
|
1196
1378
|
export { MarkRuleOptions }
|
1197
1379
|
export { MarkRuleOptions as MarkRuleOptions_alias_1 }
|
@@ -1209,8 +1391,8 @@ export { MatchHandler as MatchHandler_alias_1 }
|
|
1209
1391
|
|
1210
1392
|
export declare interface MentionAttrs {
|
1211
1393
|
id: string;
|
1212
|
-
kind: string;
|
1213
1394
|
value: string;
|
1395
|
+
kind: string;
|
1214
1396
|
}
|
1215
1397
|
|
1216
1398
|
export declare interface PlaceholderOptions {
|
@@ -1312,8 +1494,58 @@ export declare function setTrMeta(tr: Transaction, meta: PredictionPluginState):
|
|
1312
1494
|
*/
|
1313
1495
|
export declare function setupTest(): {
|
1314
1496
|
editor: TestEditor<Extension<{
|
1315
|
-
Nodes:
|
1316
|
-
|
1497
|
+
Nodes: SimplifyDeeper< {
|
1498
|
+
paragraph: Attrs;
|
1499
|
+
doc: Attrs;
|
1500
|
+
text: Attrs;
|
1501
|
+
blockquote: {
|
1502
|
+
readonly [x: string]: any;
|
1503
|
+
};
|
1504
|
+
heading: {
|
1505
|
+
level: number;
|
1506
|
+
};
|
1507
|
+
image: {
|
1508
|
+
src: null;
|
1509
|
+
};
|
1510
|
+
list: {
|
1511
|
+
kind?: "bullet" | "ordered" | "task" | "toggle";
|
1512
|
+
order?: number | null;
|
1513
|
+
checked?: boolean;
|
1514
|
+
collapsed?: boolean;
|
1515
|
+
};
|
1516
|
+
table: {
|
1517
|
+
readonly [x: string]: any;
|
1518
|
+
};
|
1519
|
+
tableRow: {
|
1520
|
+
readonly [x: string]: any;
|
1521
|
+
};
|
1522
|
+
tableCell: {
|
1523
|
+
[x: string]: any;
|
1524
|
+
};
|
1525
|
+
tableHeaderCell: {
|
1526
|
+
[x: string]: any;
|
1527
|
+
};
|
1528
|
+
}>;
|
1529
|
+
Marks: SimplifyDeeper< {
|
1530
|
+
bold: {
|
1531
|
+
readonly [x: string]: any;
|
1532
|
+
};
|
1533
|
+
code: {
|
1534
|
+
readonly [x: string]: any;
|
1535
|
+
};
|
1536
|
+
italic: {
|
1537
|
+
readonly [x: string]: any;
|
1538
|
+
};
|
1539
|
+
link: {
|
1540
|
+
href: string;
|
1541
|
+
};
|
1542
|
+
strike: {
|
1543
|
+
readonly [x: string]: any;
|
1544
|
+
};
|
1545
|
+
underline: {
|
1546
|
+
readonly [x: string]: any;
|
1547
|
+
};
|
1548
|
+
}>;
|
1317
1549
|
Commands: {
|
1318
1550
|
insertText: [{
|
1319
1551
|
text: string;
|
@@ -1362,8 +1594,79 @@ export declare function setupTest(): {
|
|
1362
1594
|
toggleUnderline: [];
|
1363
1595
|
};
|
1364
1596
|
}>>;
|
1365
|
-
|
1366
|
-
|
1597
|
+
m: ToMarkAction<SimplifyDeeper< {
|
1598
|
+
bold: {
|
1599
|
+
readonly [x: string]: any;
|
1600
|
+
};
|
1601
|
+
code: {
|
1602
|
+
readonly [x: string]: any;
|
1603
|
+
};
|
1604
|
+
italic: {
|
1605
|
+
readonly [x: string]: any;
|
1606
|
+
};
|
1607
|
+
link: {
|
1608
|
+
href: string;
|
1609
|
+
};
|
1610
|
+
strike: {
|
1611
|
+
readonly [x: string]: any;
|
1612
|
+
};
|
1613
|
+
underline: {
|
1614
|
+
readonly [x: string]: any;
|
1615
|
+
};
|
1616
|
+
}>>;
|
1617
|
+
n: {
|
1618
|
+
p: NodeAction< {
|
1619
|
+
readonly [x: string]: any;
|
1620
|
+
}>;
|
1621
|
+
h1: (...children: NodeChild[]) => Node_2;
|
1622
|
+
h2: (...children: NodeChild[]) => Node_2;
|
1623
|
+
h3: (...children: NodeChild[]) => Node_2;
|
1624
|
+
h4: (...children: NodeChild[]) => Node_2;
|
1625
|
+
h5: (...children: NodeChild[]) => Node_2;
|
1626
|
+
h6: (...children: NodeChild[]) => Node_2;
|
1627
|
+
bullet: (...children: NodeChild[]) => Node_2;
|
1628
|
+
ordered: (...children: NodeChild[]) => Node_2;
|
1629
|
+
checked: (...children: NodeChild[]) => Node_2;
|
1630
|
+
unchecked: (...children: NodeChild[]) => Node_2;
|
1631
|
+
collapsed: (...children: NodeChild[]) => Node_2;
|
1632
|
+
expanded: (...children: NodeChild[]) => Node_2;
|
1633
|
+
paragraph: NodeAction< {
|
1634
|
+
readonly [x: string]: any;
|
1635
|
+
}>;
|
1636
|
+
doc: NodeAction< {
|
1637
|
+
readonly [x: string]: any;
|
1638
|
+
}>;
|
1639
|
+
text: NodeAction< {
|
1640
|
+
readonly [x: string]: any;
|
1641
|
+
}>;
|
1642
|
+
blockquote: NodeAction< {
|
1643
|
+
readonly [x: string]: any;
|
1644
|
+
}>;
|
1645
|
+
heading: NodeAction< {
|
1646
|
+
level: number;
|
1647
|
+
}>;
|
1648
|
+
image: NodeAction< {
|
1649
|
+
src: null;
|
1650
|
+
}>;
|
1651
|
+
list: NodeAction< {
|
1652
|
+
kind?: "bullet" | "ordered" | "task" | "toggle";
|
1653
|
+
order?: number | null;
|
1654
|
+
checked?: boolean;
|
1655
|
+
collapsed?: boolean;
|
1656
|
+
}>;
|
1657
|
+
table: NodeAction< {
|
1658
|
+
readonly [x: string]: any;
|
1659
|
+
}>;
|
1660
|
+
tableRow: NodeAction< {
|
1661
|
+
readonly [x: string]: any;
|
1662
|
+
}>;
|
1663
|
+
tableCell: NodeAction< {
|
1664
|
+
[x: string]: any;
|
1665
|
+
}>;
|
1666
|
+
tableHeaderCell: NodeAction< {
|
1667
|
+
[x: string]: any;
|
1668
|
+
}>;
|
1669
|
+
};
|
1367
1670
|
};
|
1368
1671
|
|
1369
1672
|
/**
|
@@ -1371,11 +1674,18 @@ export declare function setupTest(): {
|
|
1371
1674
|
*/
|
1372
1675
|
export declare function setupTestFromExtension<E extends Extension>(extension: E): {
|
1373
1676
|
editor: TestEditor<E>;
|
1374
|
-
n:
|
1375
|
-
m:
|
1677
|
+
n: ExtractNodeActions<E>;
|
1678
|
+
m: ExtractMarkActions<E>;
|
1376
1679
|
};
|
1377
1680
|
|
1378
|
-
|
1681
|
+
/**
|
1682
|
+
* @internal
|
1683
|
+
*/
|
1684
|
+
export declare type TextAlignCommandTyping = {
|
1685
|
+
setTextAlign: [value: string | null];
|
1686
|
+
};
|
1687
|
+
|
1688
|
+
export declare interface TextAlignOptions<NodeName extends string = string> {
|
1379
1689
|
/**
|
1380
1690
|
* The names of node to add the attribute to.
|
1381
1691
|
*
|
@@ -1383,7 +1693,7 @@ export declare interface TextAlignOptions {
|
|
1383
1693
|
*
|
1384
1694
|
* ["paragraph", "heading"]
|
1385
1695
|
*/
|
1386
|
-
types:
|
1696
|
+
types: NodeName[];
|
1387
1697
|
/**
|
1388
1698
|
* The default value for the attribute.
|
1389
1699
|
*
|
@@ -1410,7 +1720,7 @@ export declare type TextBlockEnterRuleOptions = {
|
|
1410
1720
|
* Attributes to set on the node. If a function is provided, it will be called
|
1411
1721
|
* with the matched result from the regular expression.
|
1412
1722
|
*/
|
1413
|
-
attrs?:
|
1723
|
+
attrs?: Attrs_2 | null | ((match: RegExpMatchArray) => Attrs_2 | null);
|
1414
1724
|
/**
|
1415
1725
|
* Whether to stop further handlers from being called if this rule is triggered.
|
1416
1726
|
*
|
package/dist/list/style.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* ../../node_modules/.pnpm/prosemirror-flat-list@0.5.
|
1
|
+
/* ../../node_modules/.pnpm/prosemirror-flat-list@0.5.3/node_modules/prosemirror-flat-list/dist/style.css */
|
2
2
|
.prosemirror-flat-list {
|
3
3
|
padding: 0;
|
4
4
|
margin-top: 0;
|
@@ -41,6 +41,9 @@ function defineLinkSpec() {
|
|
41
41
|
return defineMarkSpec({
|
42
42
|
name: "link",
|
43
43
|
inclusive: false,
|
44
|
+
attrs: {
|
45
|
+
href: {}
|
46
|
+
},
|
44
47
|
parseDOM: [
|
45
48
|
{
|
46
49
|
tag: "a[href]",
|
@@ -51,9 +54,6 @@ function defineLinkSpec() {
|
|
51
54
|
}
|
52
55
|
}
|
53
56
|
],
|
54
|
-
attrs: {
|
55
|
-
href: {}
|
56
|
-
},
|
57
57
|
toDOM(node) {
|
58
58
|
const { href } = node.attrs;
|
59
59
|
return ["a", { href }, 0];
|
@@ -1,13 +1,13 @@
|
|
1
|
-
export { defineListSpec } from './_tsup-dts-rollup';
|
2
|
-
export { defineListPlugins } from './_tsup-dts-rollup';
|
3
|
-
export { defineListInputRules } from './_tsup-dts-rollup';
|
4
1
|
export { defineList } from './_tsup-dts-rollup';
|
5
2
|
export { ListDOMSerializer } from './_tsup-dts-rollup';
|
6
3
|
export { DedentListOptions } from './_tsup-dts-rollup';
|
7
4
|
export { IndentListOptions } from './_tsup-dts-rollup';
|
8
|
-
export { ListAttributes } from './_tsup-dts-rollup';
|
9
5
|
export { ToggleCollapsedOptions } from './_tsup-dts-rollup';
|
10
6
|
export { UnwrapListOptions } from './_tsup-dts-rollup';
|
11
7
|
export { WrapInListGetAttrs } from './_tsup-dts-rollup';
|
12
8
|
export { defineListCommands_alias_1 as defineListCommands } from './_tsup-dts-rollup';
|
9
|
+
export { defineListInputRules } from './_tsup-dts-rollup';
|
13
10
|
export { defineListKeymap } from './_tsup-dts-rollup';
|
11
|
+
export { defineListPlugins } from './_tsup-dts-rollup';
|
12
|
+
export { defineListSpec } from './_tsup-dts-rollup';
|
13
|
+
export { ListAttrs } from './_tsup-dts-rollup';
|
@@ -3,16 +3,7 @@ import {
|
|
3
3
|
} from "./chunk-LVMTQOWG.js";
|
4
4
|
|
5
5
|
// src/list/index.ts
|
6
|
-
import {
|
7
|
-
defineNodeSpec,
|
8
|
-
definePlugin,
|
9
|
-
union
|
10
|
-
} from "@prosekit/core";
|
11
|
-
import {
|
12
|
-
createListPlugins,
|
13
|
-
createListSpec,
|
14
|
-
listInputRules
|
15
|
-
} from "prosemirror-flat-list";
|
6
|
+
import { union as union2 } from "@prosekit/core";
|
16
7
|
|
17
8
|
// src/list/commands.ts
|
18
9
|
import { defineCommands, insertNode } from "@prosekit/core";
|
@@ -43,6 +34,13 @@ function defineListCommands() {
|
|
43
34
|
});
|
44
35
|
}
|
45
36
|
|
37
|
+
// src/list/input-rules.ts
|
38
|
+
import { union } from "@prosekit/core";
|
39
|
+
import { listInputRules } from "prosemirror-flat-list";
|
40
|
+
function defineListInputRules() {
|
41
|
+
return union(listInputRules.map(defineInputRule));
|
42
|
+
}
|
43
|
+
|
46
44
|
// src/list/keymap.ts
|
47
45
|
import { defineKeymap } from "@prosekit/core";
|
48
46
|
import { chainCommands, deleteSelection } from "@prosekit/pm/commands";
|
@@ -61,30 +59,42 @@ var backspaceCommand = chainCommands(
|
|
61
59
|
joinListUp,
|
62
60
|
joinCollapsedListBackward
|
63
61
|
);
|
62
|
+
var dedentListCommand = createDedentListCommand();
|
63
|
+
var indentListCommand = createIndentListCommand();
|
64
64
|
var listKeymap = {
|
65
65
|
Enter: enterCommand,
|
66
66
|
Backspace: backspaceCommand,
|
67
67
|
Delete: deleteCommand,
|
68
|
-
"Mod-
|
69
|
-
"Mod-
|
68
|
+
"Mod-]": indentListCommand,
|
69
|
+
"Mod-[": dedentListCommand,
|
70
|
+
Tab: indentListCommand,
|
71
|
+
"Shift-Tab": dedentListCommand
|
70
72
|
};
|
71
73
|
function defineListKeymap() {
|
72
74
|
return defineKeymap(listKeymap);
|
73
75
|
}
|
74
76
|
|
75
|
-
// src/list/
|
76
|
-
import {
|
77
|
-
|
78
|
-
return defineNodeSpec({ ...createListSpec(), name: "list" });
|
79
|
-
}
|
77
|
+
// src/list/plugins.ts
|
78
|
+
import { definePlugin } from "@prosekit/core";
|
79
|
+
import { createListPlugins } from "prosemirror-flat-list";
|
80
80
|
function defineListPlugins() {
|
81
81
|
return definePlugin(({ schema }) => createListPlugins({ schema }));
|
82
82
|
}
|
83
|
-
|
84
|
-
|
83
|
+
|
84
|
+
// src/list/spec.ts
|
85
|
+
import { defineNodeSpec } from "@prosekit/core";
|
86
|
+
import { createListSpec } from "prosemirror-flat-list";
|
87
|
+
function defineListSpec() {
|
88
|
+
return defineNodeSpec({
|
89
|
+
...createListSpec(),
|
90
|
+
name: "list"
|
91
|
+
});
|
85
92
|
}
|
93
|
+
|
94
|
+
// src/list/index.ts
|
95
|
+
import { ListDOMSerializer } from "prosemirror-flat-list";
|
86
96
|
function defineList() {
|
87
|
-
return
|
97
|
+
return union2([
|
88
98
|
defineListSpec(),
|
89
99
|
defineListPlugins(),
|
90
100
|
defineListKeymap(),
|
@@ -3,3 +3,4 @@ export { defineTextAlignCommands } from './_tsup-dts-rollup';
|
|
3
3
|
export { defineTextAlignKeymap } from './_tsup-dts-rollup';
|
4
4
|
export { defineTextAlign } from './_tsup-dts-rollup';
|
5
5
|
export { TextAlignOptions } from './_tsup-dts-rollup';
|
6
|
+
export { TextAlignCommandTyping } from './_tsup-dts-rollup';
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/extensions",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.7.
|
4
|
+
"version": "0.7.4",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -180,19 +180,20 @@
|
|
180
180
|
"dependencies": {
|
181
181
|
"prosemirror-changeset": "^2.2.1",
|
182
182
|
"prosemirror-dropcursor": "^1.8.1",
|
183
|
-
"prosemirror-flat-list": "^0.5.
|
183
|
+
"prosemirror-flat-list": "^0.5.3",
|
184
184
|
"prosemirror-highlight": "^0.8.0",
|
185
185
|
"prosemirror-search": "^1.0.0",
|
186
186
|
"prosemirror-tables": "^1.3.7",
|
187
187
|
"shiki": "^1.10.3",
|
188
|
-
"@prosekit/core": "^0.7.
|
188
|
+
"@prosekit/core": "^0.7.4",
|
189
189
|
"@prosekit/pm": "^0.1.6"
|
190
190
|
},
|
191
191
|
"devDependencies": {
|
192
|
-
"@vitest/browser": "^2.0.
|
193
|
-
"tsup": "^8.1.
|
192
|
+
"@vitest/browser": "^2.0.3",
|
193
|
+
"tsup": "^8.1.2",
|
194
|
+
"type-fest": "^4.22.1",
|
194
195
|
"typescript": "^5.5.3",
|
195
|
-
"vitest": "^2.0.
|
196
|
+
"vitest": "^2.0.3",
|
196
197
|
"@prosekit/dev": "0.0.0"
|
197
198
|
},
|
198
199
|
"scripts": {
|