@prosekit/extensions 0.7.24 → 0.8.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.
- package/dist/_tsup-dts-rollup.d.ts +118 -159
- package/dist/{chunk-BV3SHIMW.js → chunk-I2UMHK3L.js} +3 -2
- package/dist/{chunk-HFAZX2J3.js → chunk-QVFEYPQ6.js} +1 -1
- package/dist/prosekit-extensions-blockquote.js +1 -1
- package/dist/prosekit-extensions-bold.js +1 -1
- package/dist/prosekit-extensions-code-block.js +1 -1
- package/dist/prosekit-extensions-code.js +2 -1
- package/dist/prosekit-extensions-doc.d.ts +2 -0
- package/dist/prosekit-extensions-doc.js +14 -0
- package/dist/prosekit-extensions-heading.js +7 -7
- package/dist/prosekit-extensions-horizontal-rule.js +1 -1
- package/dist/prosekit-extensions-input-rule.js +1 -1
- package/dist/prosekit-extensions-italic.js +1 -1
- package/dist/prosekit-extensions-link.js +1 -1
- package/dist/prosekit-extensions-list.js +1 -1
- package/dist/prosekit-extensions-paragraph.d.ts +7 -0
- package/dist/prosekit-extensions-paragraph.js +59 -0
- package/dist/prosekit-extensions-placeholder.js +1 -1
- package/dist/prosekit-extensions-strike.js +1 -1
- package/dist/prosekit-extensions-table.js +1 -1
- package/dist/prosekit-extensions-text.d.ts +2 -0
- package/dist/prosekit-extensions-text.js +13 -0
- package/dist/shiki-highlighter-chunk.js +3 -5
- package/package.json +38 -14
@@ -1,9 +1,5 @@
|
|
1
1
|
import { Attrs } from '@prosekit/pm/model';
|
2
|
-
import { Attrs as Attrs_2 } from 'prosemirror-model';
|
3
2
|
import type { Awareness } from 'y-protocols/awareness';
|
4
|
-
import { BaseCommandsExtension } from '@prosekit/core';
|
5
|
-
import { BlockquoteExtension as BlockquoteExtension_2 } from '../blockquote';
|
6
|
-
import { BoldExtension as BoldExtension_2 } from '../bold';
|
7
3
|
import type { BundledHighlighterOptions } from 'shiki';
|
8
4
|
import { BundledLanguage } from 'shiki';
|
9
5
|
import { BundledLanguageInfo } from 'shiki';
|
@@ -12,40 +8,26 @@ import { BundledTheme } from 'shiki';
|
|
12
8
|
import { BundledThemeInfo } from 'shiki';
|
13
9
|
import { bundledThemesInfo } from 'shiki';
|
14
10
|
import { CellSelection } from 'prosemirror-tables';
|
15
|
-
import { CodeExtension as CodeExtension_2 } from '../code';
|
16
11
|
import { Command } from '@prosekit/pm/state';
|
17
12
|
import { CursorAwareness } from 'loro-prosemirror';
|
18
13
|
import type { DecorationAttrs } from '@prosekit/pm/view';
|
19
14
|
import { DedentListOptions } from 'prosemirror-flat-list';
|
20
|
-
import { DocExtension } from '@prosekit/core';
|
21
15
|
import { EditorState } from '@prosekit/pm/state';
|
22
16
|
import type { EditorView } from '@prosekit/pm/view';
|
23
17
|
import { Extension } from '@prosekit/core';
|
24
18
|
import { ExtensionTyping } from '@prosekit/core';
|
25
|
-
import { ExtractMarkActions } from '@prosekit/core';
|
26
|
-
import { ExtractNodeActions } from '@prosekit/core';
|
27
19
|
import { FindParentNodeResult } from '@prosekit/core';
|
28
20
|
import { GapCursor } from 'prosemirror-gapcursor';
|
29
|
-
import { HeadingExtension as HeadingExtension_2 } from '../heading';
|
30
21
|
import type { Highlighter } from 'shiki';
|
31
|
-
import { HistoryExtension } from '@prosekit/core';
|
32
|
-
import { HorizontalRuleExtension as HorizontalRuleExtension_2 } from '../horizontal-rule';
|
33
|
-
import { ImageExtension as ImageExtension_2 } from '../image';
|
34
22
|
import { IndentListOptions } from 'prosemirror-flat-list';
|
35
23
|
import { InputRule } from '@prosekit/pm/inputrules';
|
36
24
|
import type { IsEqual } from 'type-fest';
|
37
|
-
import { ItalicExtension as ItalicExtension_2 } from '../italic';
|
38
|
-
import { LinkExtension as LinkExtension_2 } from '../link';
|
39
25
|
import { ListAttributes } from 'prosemirror-flat-list';
|
40
26
|
import { ListDOMSerializer } from 'prosemirror-flat-list';
|
41
|
-
import { ListExtension as ListExtension_2 } from '../list';
|
42
27
|
import type { LoroDocType } from 'loro-prosemirror';
|
43
28
|
import { LoroSyncPluginProps } from 'loro-prosemirror';
|
44
29
|
import { LoroUndoPluginProps } from 'loro-prosemirror';
|
45
30
|
import { MarkType } from '@prosekit/pm/model';
|
46
|
-
import { Node as Node_2 } from 'prosemirror-model';
|
47
|
-
import { NodeAction } from '@prosekit/core';
|
48
|
-
import { NodeChild } from '@prosekit/core';
|
49
31
|
import { NodeJSON } from '@prosekit/core';
|
50
32
|
import type { NodeType } from '@prosekit/pm/model';
|
51
33
|
import { Parser } from 'prosemirror-highlight';
|
@@ -56,17 +38,10 @@ import { PluginKey } from '@prosekit/pm/state';
|
|
56
38
|
import { ProseMirrorNode } from '@prosekit/pm/model';
|
57
39
|
import type { ResolvedPos } from '@prosekit/pm/model';
|
58
40
|
import type { Selection as Selection_2 } from '@prosekit/pm/state';
|
59
|
-
import { SimplifyDeeper } from '@prosekit/core';
|
60
41
|
import type { SpecialLanguage } from 'shiki';
|
61
42
|
import { StepJSON } from '@prosekit/core';
|
62
|
-
import { StrikeExtension as StrikeExtension_2 } from '../strike';
|
63
|
-
import { TableExtension as TableExtension_2 } from '../table';
|
64
|
-
import { TestEditor } from '@prosekit/core/test';
|
65
|
-
import { TextExtension } from '@prosekit/core';
|
66
43
|
import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
|
67
|
-
import { ToMarkAction } from '@prosekit/core';
|
68
44
|
import { Transaction } from '@prosekit/pm/state';
|
69
|
-
import { UnderlineExtension as UnderlineExtension_2 } from '../underline';
|
70
45
|
import { Union } from '@prosekit/core';
|
71
46
|
import { UnwrapListOptions } from 'prosemirror-flat-list';
|
72
47
|
import { WrapInListGetAttrs } from 'prosemirror-flat-list';
|
@@ -344,7 +319,7 @@ export declare function createLazyParser(highlighterOptions: HighlighterOptions)
|
|
344
319
|
/**
|
345
320
|
* @internal
|
346
321
|
*/
|
347
|
-
export declare function createMarkInputRule({ regex, type, attrs, }: MarkInputRuleOptions): InputRule;
|
322
|
+
export declare function createMarkInputRule({ regex, type, attrs, inCodeMark, }: MarkInputRuleOptions): InputRule;
|
348
323
|
|
349
324
|
export declare function createOrGetHighlighter(options: HighlighterOptions): HighlighterResult;
|
350
325
|
|
@@ -502,6 +477,11 @@ export { defineCodeBlockKeymap as defineCodeBlockKeymap_alias_1 }
|
|
502
477
|
/**
|
503
478
|
* Adds syntax highlighting to code blocks using the [Shiki](https://github.com/shikijs/shiki) package.
|
504
479
|
*
|
480
|
+
* It will set two CSS variables on the code block elements:
|
481
|
+
*
|
482
|
+
* - `--prosemirror-highlight`: sets text color
|
483
|
+
* - `--prosemirror-highlight-bg`: sets background color
|
484
|
+
*
|
505
485
|
* @param options - The options to configure the Shiki highlighter.
|
506
486
|
*
|
507
487
|
* @public
|
@@ -557,6 +537,11 @@ export declare function defineCommitRecorder(commitRecorder: CommitRecorder): Pl
|
|
557
537
|
*/
|
558
538
|
export declare function defineCommitViewer(commit: Commit): PlainExtension;
|
559
539
|
|
540
|
+
/**
|
541
|
+
* @public
|
542
|
+
*/
|
543
|
+
export declare function defineDoc(): DocExtension;
|
544
|
+
|
560
545
|
/**
|
561
546
|
* Show up a decoration at the drop position when something is dragged over the editor.
|
562
547
|
*
|
@@ -905,6 +890,41 @@ mention: MentionAttrs;
|
|
905
890
|
*/
|
906
891
|
export declare function defineModClickPrevention(): ModClickPreventionExtension;
|
907
892
|
|
893
|
+
/**
|
894
|
+
* @public
|
895
|
+
*
|
896
|
+
* Defines a paragraph node.
|
897
|
+
*
|
898
|
+
* The paragraph node spec has the highest priority, because it should be the
|
899
|
+
* default block node for most cases.
|
900
|
+
*/
|
901
|
+
declare function defineParagraph(): ParagraphExtension;
|
902
|
+
export { defineParagraph }
|
903
|
+
export { defineParagraph as defineParagraph_alias_1 }
|
904
|
+
|
905
|
+
/**
|
906
|
+
* @internal
|
907
|
+
*/
|
908
|
+
declare function defineParagraphCommands(): ParagraphCommandsExtension;
|
909
|
+
export { defineParagraphCommands }
|
910
|
+
export { defineParagraphCommands as defineParagraphCommands_alias_1 }
|
911
|
+
|
912
|
+
/**
|
913
|
+
* @internal
|
914
|
+
*/
|
915
|
+
declare function defineParagraphKeymap(): PlainExtension;
|
916
|
+
export { defineParagraphKeymap }
|
917
|
+
export { defineParagraphKeymap as defineParagraphKeymap_alias_1 }
|
918
|
+
|
919
|
+
/**
|
920
|
+
* @internal
|
921
|
+
*
|
922
|
+
* Defines a paragraph node spec.
|
923
|
+
*/
|
924
|
+
declare function defineParagraphSpec(): ParagraphSpecExtension;
|
925
|
+
export { defineParagraphSpec }
|
926
|
+
export { defineParagraphSpec as defineParagraphSpec_alias_1 }
|
927
|
+
|
908
928
|
/**
|
909
929
|
* Add a placeholder text to the editor when the current block or document is
|
910
930
|
* empty.
|
@@ -1015,13 +1035,9 @@ export { defineTableSpec }
|
|
1015
1035
|
export { defineTableSpec as defineTableSpec_alias_1 }
|
1016
1036
|
|
1017
1037
|
/**
|
1018
|
-
* @
|
1038
|
+
* @public
|
1019
1039
|
*/
|
1020
|
-
export declare function
|
1021
|
-
Nodes: {
|
1022
|
-
paragraph: Attrs_2;
|
1023
|
-
};
|
1024
|
-
}>, TableExtension_2, HorizontalRuleExtension_2]>;
|
1040
|
+
export declare function defineText(): TextExtension;
|
1025
1041
|
|
1026
1042
|
/**
|
1027
1043
|
* Adds a `textAlign` attribute to the specified nodes. This will be rendered as
|
@@ -1174,6 +1190,15 @@ declare function defineYjsUndoPlugin(options: YjsUndoOptions): PlainExtension;
|
|
1174
1190
|
export { defineYjsUndoPlugin }
|
1175
1191
|
export { defineYjsUndoPlugin as defineYjsUndoPlugin_alias_1 }
|
1176
1192
|
|
1193
|
+
/**
|
1194
|
+
* @internal
|
1195
|
+
*/
|
1196
|
+
export declare type DocExtension = Extension<{
|
1197
|
+
Nodes: {
|
1198
|
+
doc: Attrs;
|
1199
|
+
};
|
1200
|
+
}>;
|
1201
|
+
|
1177
1202
|
/**
|
1178
1203
|
* @internal
|
1179
1204
|
*/
|
@@ -1341,8 +1366,6 @@ declare function findTable($pos: ResolvedPos): FindParentNodeResult | undefined;
|
|
1341
1366
|
export { findTable }
|
1342
1367
|
export { findTable as findTable_alias_1 }
|
1343
1368
|
|
1344
|
-
export declare function formatHTML(html: string): Promise<string>;
|
1345
|
-
|
1346
1369
|
export { GapCursor }
|
1347
1370
|
|
1348
1371
|
/**
|
@@ -1490,8 +1513,6 @@ export { ImageSpecExtension as ImageSpecExtension_alias_1 }
|
|
1490
1513
|
export { IndentListOptions }
|
1491
1514
|
export { IndentListOptions as IndentListOptions_alias_1 }
|
1492
1515
|
|
1493
|
-
export declare function inputText(input: string): Promise<void>;
|
1494
|
-
|
1495
1516
|
/**
|
1496
1517
|
* Returns a command that inserts a horizontal rule at the current selection.
|
1497
1518
|
*/
|
@@ -1515,9 +1536,20 @@ export { insertTable as insertTable_alias_1 }
|
|
1515
1536
|
* @public
|
1516
1537
|
*/
|
1517
1538
|
declare interface InsertTableOptions {
|
1539
|
+
/**
|
1540
|
+
* The number of rows in the table.
|
1541
|
+
*/
|
1518
1542
|
row: number;
|
1543
|
+
/**
|
1544
|
+
* The number of columns in the table.
|
1545
|
+
*/
|
1519
1546
|
col: number;
|
1520
|
-
|
1547
|
+
/**
|
1548
|
+
* Whether the table has a header row.
|
1549
|
+
*
|
1550
|
+
* @default false
|
1551
|
+
*/
|
1552
|
+
header?: boolean;
|
1521
1553
|
}
|
1522
1554
|
export { InsertTableOptions }
|
1523
1555
|
export { InsertTableOptions as InsertTableOptions_alias_1 }
|
@@ -1749,6 +1781,12 @@ export declare interface MarkInputRuleOptions {
|
|
1749
1781
|
* Attributes to set on the mark.
|
1750
1782
|
*/
|
1751
1783
|
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
1784
|
+
/**
|
1785
|
+
* Whether this rule should fire inside marks marked as [code](https://prosemirror.net/docs/ref/#model.MarkSpec.code).
|
1786
|
+
*
|
1787
|
+
* @default `false`
|
1788
|
+
*/
|
1789
|
+
inCodeMark?: boolean;
|
1752
1790
|
}
|
1753
1791
|
|
1754
1792
|
/**
|
@@ -1799,6 +1837,35 @@ export declare interface MentionAttrs {
|
|
1799
1837
|
*/
|
1800
1838
|
export declare type ModClickPreventionExtension = PlainExtension;
|
1801
1839
|
|
1840
|
+
/**
|
1841
|
+
* @internal
|
1842
|
+
*/
|
1843
|
+
declare type ParagraphCommandsExtension = Extension<{
|
1844
|
+
Commands: {
|
1845
|
+
setParagraph: [];
|
1846
|
+
};
|
1847
|
+
}>;
|
1848
|
+
export { ParagraphCommandsExtension }
|
1849
|
+
export { ParagraphCommandsExtension as ParagraphCommandsExtension_alias_1 }
|
1850
|
+
|
1851
|
+
/**
|
1852
|
+
* @internal
|
1853
|
+
*/
|
1854
|
+
declare type ParagraphExtension = Union<[ParagraphSpecExtension, ParagraphCommandsExtension]>;
|
1855
|
+
export { ParagraphExtension }
|
1856
|
+
export { ParagraphExtension as ParagraphExtension_alias_1 }
|
1857
|
+
|
1858
|
+
/**
|
1859
|
+
* @internal
|
1860
|
+
*/
|
1861
|
+
declare type ParagraphSpecExtension = Extension<{
|
1862
|
+
Nodes: {
|
1863
|
+
paragraph: Attrs;
|
1864
|
+
};
|
1865
|
+
}>;
|
1866
|
+
export { ParagraphSpecExtension }
|
1867
|
+
export { ParagraphSpecExtension as ParagraphSpecExtension_alias_1 }
|
1868
|
+
|
1802
1869
|
export declare interface PlaceholderOptions {
|
1803
1870
|
/**
|
1804
1871
|
* The placeholder to use. It can be a static string or a function that
|
@@ -1835,22 +1902,6 @@ export declare interface PredictionPluginState {
|
|
1835
1902
|
} | null;
|
1836
1903
|
}
|
1837
1904
|
|
1838
|
-
/**
|
1839
|
-
* @example
|
1840
|
-
*
|
1841
|
-
* ```ts
|
1842
|
-
* await pressKey('mod-1')
|
1843
|
-
* await pressKey('Backspace')
|
1844
|
-
* ```
|
1845
|
-
*
|
1846
|
-
* @internal
|
1847
|
-
*/
|
1848
|
-
export declare function pressKey(input: string): Promise<void>;
|
1849
|
-
|
1850
|
-
export declare function readHtmlTextFromClipboard(format?: boolean): Promise<string>;
|
1851
|
-
|
1852
|
-
export declare function readPlainTextFromClipboard(): Promise<string>;
|
1853
|
-
|
1854
1905
|
/**
|
1855
1906
|
* @internal
|
1856
1907
|
*/
|
@@ -1988,6 +2039,11 @@ declare interface SelectTableRowOptions {
|
|
1988
2039
|
export { SelectTableRowOptions }
|
1989
2040
|
export { SelectTableRowOptions as SelectTableRowOptions_alias_1 }
|
1990
2041
|
|
2042
|
+
/**
|
2043
|
+
* @internal
|
2044
|
+
*/
|
2045
|
+
export declare function setParagraph(): Command;
|
2046
|
+
|
1991
2047
|
/**
|
1992
2048
|
* @internal
|
1993
2049
|
*/
|
@@ -1998,112 +2054,6 @@ export declare function setTextAlign({ types, value, }: {
|
|
1998
2054
|
|
1999
2055
|
export declare function setTrMeta(tr: Transaction, meta: PredictionPluginState): Transaction;
|
2000
2056
|
|
2001
|
-
/**
|
2002
|
-
* @internal
|
2003
|
-
*/
|
2004
|
-
export declare function setupTest(): {
|
2005
|
-
editor: TestEditor<Union<readonly [DocExtension, TextExtension, HeadingExtension_2, HistoryExtension, ListExtension_2, BlockquoteExtension_2, PlainExtension, BaseCommandsExtension, ItalicExtension_2, BoldExtension_2, UnderlineExtension_2, StrikeExtension_2, CodeExtension_2, LinkExtension_2, ImageExtension_2, Extension<{
|
2006
|
-
Nodes: {
|
2007
|
-
paragraph: Attrs_2;
|
2008
|
-
};
|
2009
|
-
}>, TableExtension_2, HorizontalRuleExtension_2]>>;
|
2010
|
-
m: ToMarkAction<SimplifyDeeper< {
|
2011
|
-
bold: {
|
2012
|
-
readonly [x: string]: any;
|
2013
|
-
};
|
2014
|
-
code: {
|
2015
|
-
readonly [x: string]: any;
|
2016
|
-
};
|
2017
|
-
italic: {
|
2018
|
-
readonly [x: string]: any;
|
2019
|
-
};
|
2020
|
-
link: {
|
2021
|
-
href: string;
|
2022
|
-
};
|
2023
|
-
strike: {
|
2024
|
-
readonly [x: string]: any;
|
2025
|
-
};
|
2026
|
-
underline: {
|
2027
|
-
readonly [x: string]: any;
|
2028
|
-
};
|
2029
|
-
}>>;
|
2030
|
-
n: {
|
2031
|
-
p: NodeAction< {
|
2032
|
-
readonly [x: string]: any;
|
2033
|
-
}>;
|
2034
|
-
h1: (...children: NodeChild[]) => Node_2;
|
2035
|
-
h2: (...children: NodeChild[]) => Node_2;
|
2036
|
-
h3: (...children: NodeChild[]) => Node_2;
|
2037
|
-
h4: (...children: NodeChild[]) => Node_2;
|
2038
|
-
h5: (...children: NodeChild[]) => Node_2;
|
2039
|
-
h6: (...children: NodeChild[]) => Node_2;
|
2040
|
-
bullet: (...children: NodeChild[]) => Node_2;
|
2041
|
-
ordered: (...children: NodeChild[]) => Node_2;
|
2042
|
-
checked: (...children: NodeChild[]) => Node_2;
|
2043
|
-
unchecked: (...children: NodeChild[]) => Node_2;
|
2044
|
-
collapsed: (...children: NodeChild[]) => Node_2;
|
2045
|
-
expanded: (...children: NodeChild[]) => Node_2;
|
2046
|
-
doc: NodeAction< {
|
2047
|
-
readonly [x: string]: any;
|
2048
|
-
}>;
|
2049
|
-
paragraph: NodeAction< {
|
2050
|
-
readonly [x: string]: any;
|
2051
|
-
}>;
|
2052
|
-
text: NodeAction< {
|
2053
|
-
readonly [x: string]: any;
|
2054
|
-
}>;
|
2055
|
-
blockquote: NodeAction< {
|
2056
|
-
readonly [x: string]: any;
|
2057
|
-
}>;
|
2058
|
-
heading: NodeAction< {
|
2059
|
-
level: number;
|
2060
|
-
}>;
|
2061
|
-
horizontalRule: NodeAction< {
|
2062
|
-
readonly [x: string]: any;
|
2063
|
-
}>;
|
2064
|
-
image: NodeAction< {
|
2065
|
-
src?: string | null | undefined;
|
2066
|
-
width?: number | null | undefined;
|
2067
|
-
height?: number | null | undefined;
|
2068
|
-
}>;
|
2069
|
-
list: NodeAction< {
|
2070
|
-
kind?: "bullet" | "ordered" | "task" | "toggle" | undefined;
|
2071
|
-
order?: number | null | undefined;
|
2072
|
-
checked?: boolean | undefined;
|
2073
|
-
collapsed?: boolean | undefined;
|
2074
|
-
}>;
|
2075
|
-
table: NodeAction< {
|
2076
|
-
readonly [x: string]: any;
|
2077
|
-
}>;
|
2078
|
-
tableRow: NodeAction< {
|
2079
|
-
readonly [x: string]: any;
|
2080
|
-
}>;
|
2081
|
-
tableCell: NodeAction< {
|
2082
|
-
colspan: number;
|
2083
|
-
rowspan: number;
|
2084
|
-
colwidth: number[] | null;
|
2085
|
-
}>;
|
2086
|
-
tableHeaderCell: NodeAction< {
|
2087
|
-
colspan: number;
|
2088
|
-
rowspan: number;
|
2089
|
-
colwidth: number[] | null;
|
2090
|
-
}>;
|
2091
|
-
};
|
2092
|
-
copy: () => Promise<{
|
2093
|
-
html: string;
|
2094
|
-
plain: string;
|
2095
|
-
}>;
|
2096
|
-
};
|
2097
|
-
|
2098
|
-
/**
|
2099
|
-
* @internal
|
2100
|
-
*/
|
2101
|
-
export declare function setupTestFromExtension<E extends Extension>(extension: E): {
|
2102
|
-
editor: TestEditor<E>;
|
2103
|
-
n: ExtractNodeActions<E>;
|
2104
|
-
m: ExtractMarkActions<E>;
|
2105
|
-
};
|
2106
|
-
|
2107
2057
|
export declare interface ShikiHighlighterOptions extends BundledHighlighterOptions<BundledLanguage, BundledTheme> {
|
2108
2058
|
}
|
2109
2059
|
|
@@ -2291,6 +2241,15 @@ export declare type TextBlockEnterRuleOptions = {
|
|
2291
2241
|
stop?: boolean;
|
2292
2242
|
};
|
2293
2243
|
|
2244
|
+
/**
|
2245
|
+
* @internal
|
2246
|
+
*/
|
2247
|
+
export declare type TextExtension = Extension<{
|
2248
|
+
Nodes: {
|
2249
|
+
text: Attrs;
|
2250
|
+
};
|
2251
|
+
}>;
|
2252
|
+
|
2294
2253
|
export { ToggleCollapsedOptions }
|
2295
2254
|
export { ToggleCollapsedOptions as ToggleCollapsedOptions_alias_1 }
|
2296
2255
|
|
@@ -21,7 +21,8 @@ function defineInputRule(rule) {
|
|
21
21
|
function createMarkInputRule({
|
22
22
|
regex,
|
23
23
|
type,
|
24
|
-
attrs = null
|
24
|
+
attrs = null,
|
25
|
+
inCodeMark = false
|
25
26
|
}) {
|
26
27
|
const rule = new InputRule(regex, (state, match, start, end) => {
|
27
28
|
const { tr, schema } = state;
|
@@ -49,7 +50,7 @@ function createMarkInputRule({
|
|
49
50
|
}
|
50
51
|
tr.setStoredMarks(initialStoredMarks);
|
51
52
|
return tr;
|
52
|
-
});
|
53
|
+
}, { inCodeMark });
|
53
54
|
return rule;
|
54
55
|
}
|
55
56
|
function defineMarkInputRule(options) {
|
@@ -90,7 +90,7 @@ function repeat(node, length) {
|
|
90
90
|
}
|
91
91
|
function insertTable(options) {
|
92
92
|
return (state, dispatch, view) => {
|
93
|
-
const { row, col, header } = options;
|
93
|
+
const { row, col, header = false } = options;
|
94
94
|
const table = createEmptyTable(state.schema, row, col, header);
|
95
95
|
return insertNode({ node: table })(state, dispatch, view);
|
96
96
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineMarkInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-I2UMHK3L.js";
|
4
4
|
|
5
5
|
// src/code/code.ts
|
6
6
|
import {
|
@@ -46,6 +46,7 @@ function defineCodeSpec() {
|
|
46
46
|
return defineMarkSpec({
|
47
47
|
name: "code",
|
48
48
|
parseDOM: [{ tag: "code" }],
|
49
|
+
code: true,
|
49
50
|
toDOM() {
|
50
51
|
return ["code", 0];
|
51
52
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
defineTextBlockInputRule
|
3
|
-
} from "./chunk-
|
3
|
+
} from "./chunk-I2UMHK3L.js";
|
4
4
|
|
5
5
|
// src/heading/heading.ts
|
6
6
|
import {
|
@@ -60,12 +60,12 @@ var backspaceUnsetHeading = (state, dispatch, view) => {
|
|
60
60
|
};
|
61
61
|
function defineHeadingKeymap() {
|
62
62
|
return defineKeymap({
|
63
|
-
"mod-1": toggleHeadingKeybinding(1),
|
64
|
-
"mod-2": toggleHeadingKeybinding(2),
|
65
|
-
"mod-3": toggleHeadingKeybinding(3),
|
66
|
-
"mod-4": toggleHeadingKeybinding(4),
|
67
|
-
"mod-5": toggleHeadingKeybinding(5),
|
68
|
-
"mod-6": toggleHeadingKeybinding(6),
|
63
|
+
"mod-alt-1": toggleHeadingKeybinding(1),
|
64
|
+
"mod-alt-2": toggleHeadingKeybinding(2),
|
65
|
+
"mod-alt-3": toggleHeadingKeybinding(3),
|
66
|
+
"mod-alt-4": toggleHeadingKeybinding(4),
|
67
|
+
"mod-alt-5": toggleHeadingKeybinding(5),
|
68
|
+
"mod-alt-6": toggleHeadingKeybinding(6),
|
69
69
|
"Backspace": backspaceUnsetHeading
|
70
70
|
});
|
71
71
|
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export { defineParagraph } from './_tsup-dts-rollup.js';
|
2
|
+
export { ParagraphExtension } from './_tsup-dts-rollup.js';
|
3
|
+
export { defineParagraphCommands } from './_tsup-dts-rollup.js';
|
4
|
+
export { ParagraphCommandsExtension } from './_tsup-dts-rollup.js';
|
5
|
+
export { defineParagraphKeymap } from './_tsup-dts-rollup.js';
|
6
|
+
export { defineParagraphSpec } from './_tsup-dts-rollup.js';
|
7
|
+
export { ParagraphSpecExtension } from './_tsup-dts-rollup.js';
|
@@ -0,0 +1,59 @@
|
|
1
|
+
// src/paragraph/paragraph.ts
|
2
|
+
import {
|
3
|
+
Priority,
|
4
|
+
union,
|
5
|
+
withPriority
|
6
|
+
} from "@prosekit/core";
|
7
|
+
|
8
|
+
// src/paragraph/paragraph-commands.ts
|
9
|
+
import {
|
10
|
+
defineCommands,
|
11
|
+
setBlockType
|
12
|
+
} from "@prosekit/core";
|
13
|
+
function setParagraph() {
|
14
|
+
return setBlockType({ type: "paragraph" });
|
15
|
+
}
|
16
|
+
function defineParagraphCommands() {
|
17
|
+
return defineCommands({ setParagraph });
|
18
|
+
}
|
19
|
+
|
20
|
+
// src/paragraph/paragraph-keymap.ts
|
21
|
+
import {
|
22
|
+
defineKeymap
|
23
|
+
} from "@prosekit/core";
|
24
|
+
function defineParagraphKeymap() {
|
25
|
+
return defineKeymap({
|
26
|
+
"mod-alt-0": setParagraph()
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
// src/paragraph/paragraph-spec.ts
|
31
|
+
import {
|
32
|
+
defineNodeSpec
|
33
|
+
} from "@prosekit/core";
|
34
|
+
function defineParagraphSpec() {
|
35
|
+
return defineNodeSpec({
|
36
|
+
name: "paragraph",
|
37
|
+
content: "inline*",
|
38
|
+
group: "block",
|
39
|
+
parseDOM: [{ tag: "p" }],
|
40
|
+
toDOM() {
|
41
|
+
return ["p", 0];
|
42
|
+
}
|
43
|
+
});
|
44
|
+
}
|
45
|
+
|
46
|
+
// src/paragraph/paragraph.ts
|
47
|
+
function defineParagraph() {
|
48
|
+
return union(
|
49
|
+
withPriority(defineParagraphSpec(), Priority.highest),
|
50
|
+
defineParagraphCommands(),
|
51
|
+
defineParagraphKeymap()
|
52
|
+
);
|
53
|
+
}
|
54
|
+
export {
|
55
|
+
defineParagraph,
|
56
|
+
defineParagraphCommands,
|
57
|
+
defineParagraphKeymap,
|
58
|
+
defineParagraphSpec
|
59
|
+
};
|
@@ -1,8 +1,6 @@
|
|
1
1
|
// src/code-block/shiki-highlighter-chunk.ts
|
2
|
-
import {
|
3
|
-
|
4
|
-
createJavaScriptRegexEngine
|
5
|
-
} from "shiki/bundle/full";
|
2
|
+
import { createHighlighter } from "shiki/bundle/full";
|
3
|
+
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
6
4
|
var highlighter;
|
7
5
|
var loadedLangs = /* @__PURE__ */ new Set();
|
8
6
|
var loadedThemes = /* @__PURE__ */ new Set();
|
@@ -11,7 +9,7 @@ async function createAndCacheHighlighter({
|
|
11
9
|
}) {
|
12
10
|
if (!highlighter) {
|
13
11
|
if (!options.engine) {
|
14
|
-
const engine = createJavaScriptRegexEngine();
|
12
|
+
const engine = createJavaScriptRegexEngine({ forgiving: true });
|
15
13
|
options.engine = engine;
|
16
14
|
}
|
17
15
|
highlighter = await createHighlighter(options);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/extensions",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.8.0",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -63,6 +63,11 @@
|
|
63
63
|
"./commit/style.css": {
|
64
64
|
"default": "./dist/commit/style.css"
|
65
65
|
},
|
66
|
+
"./doc": {
|
67
|
+
"types": "./dist/prosekit-extensions-doc.d.ts",
|
68
|
+
"import": "./dist/prosekit-extensions-doc.js",
|
69
|
+
"default": "./dist/prosekit-extensions-doc.js"
|
70
|
+
},
|
66
71
|
"./drop-cursor": {
|
67
72
|
"types": "./dist/prosekit-extensions-drop-cursor.d.ts",
|
68
73
|
"import": "./dist/prosekit-extensions-drop-cursor.js",
|
@@ -147,6 +152,11 @@
|
|
147
152
|
"import": "./dist/prosekit-extensions-mod-click-prevention.js",
|
148
153
|
"default": "./dist/prosekit-extensions-mod-click-prevention.js"
|
149
154
|
},
|
155
|
+
"./paragraph": {
|
156
|
+
"types": "./dist/prosekit-extensions-paragraph.d.ts",
|
157
|
+
"import": "./dist/prosekit-extensions-paragraph.js",
|
158
|
+
"default": "./dist/prosekit-extensions-paragraph.js"
|
159
|
+
},
|
150
160
|
"./placeholder": {
|
151
161
|
"types": "./dist/prosekit-extensions-placeholder.d.ts",
|
152
162
|
"import": "./dist/prosekit-extensions-placeholder.js",
|
@@ -181,6 +191,11 @@
|
|
181
191
|
"./table/style.css": {
|
182
192
|
"default": "./dist/table/style.css"
|
183
193
|
},
|
194
|
+
"./text": {
|
195
|
+
"types": "./dist/prosekit-extensions-text.d.ts",
|
196
|
+
"import": "./dist/prosekit-extensions-text.js",
|
197
|
+
"default": "./dist/prosekit-extensions-text.js"
|
198
|
+
},
|
184
199
|
"./text-align": {
|
185
200
|
"types": "./dist/prosekit-extensions-text-align.d.ts",
|
186
201
|
"import": "./dist/prosekit-extensions-text-align.js",
|
@@ -216,11 +231,11 @@
|
|
216
231
|
"prosemirror-dropcursor": "^1.8.1",
|
217
232
|
"prosemirror-flat-list": "^0.5.4",
|
218
233
|
"prosemirror-gapcursor": "^1.3.2",
|
219
|
-
"prosemirror-highlight": "^0.
|
234
|
+
"prosemirror-highlight": "^0.13.0",
|
220
235
|
"prosemirror-search": "^1.0.0",
|
221
|
-
"prosemirror-tables": "^1.6.
|
222
|
-
"shiki": "^
|
223
|
-
"@prosekit/core": "^0.
|
236
|
+
"prosemirror-tables": "^1.6.4",
|
237
|
+
"shiki": "^3.2.1",
|
238
|
+
"@prosekit/core": "^0.8.0",
|
224
239
|
"@prosekit/pm": "^0.1.9"
|
225
240
|
},
|
226
241
|
"peerDependencies": {
|
@@ -244,18 +259,18 @@
|
|
244
259
|
}
|
245
260
|
},
|
246
261
|
"devDependencies": {
|
247
|
-
"@vitest/browser": "^3.0.
|
262
|
+
"@vitest/browser": "^3.0.9",
|
248
263
|
"just-pick": "^4.2.0",
|
249
|
-
"loro-crdt": "^1.
|
264
|
+
"loro-crdt": "^1.4.6",
|
250
265
|
"loro-prosemirror": "^0.2.1",
|
251
|
-
"prettier": "^3.
|
252
|
-
"tsup": "^8.
|
253
|
-
"type-fest": "^4.
|
254
|
-
"typescript": "~5.7.
|
255
|
-
"vitest": "^3.0.
|
256
|
-
"y-prosemirror": "^1.2.
|
266
|
+
"prettier": "^3.5.3",
|
267
|
+
"tsup": "^8.4.0",
|
268
|
+
"type-fest": "^4.37.0",
|
269
|
+
"typescript": "~5.7.3",
|
270
|
+
"vitest": "^3.0.9",
|
271
|
+
"y-prosemirror": "^1.2.17",
|
257
272
|
"y-protocols": "^1.0.6",
|
258
|
-
"yjs": "^13.6.
|
273
|
+
"yjs": "^13.6.24",
|
259
274
|
"@prosekit/dev": "0.0.0"
|
260
275
|
},
|
261
276
|
"scripts": {
|
@@ -286,6 +301,9 @@
|
|
286
301
|
"commit": [
|
287
302
|
"./dist/prosekit-extensions-commit.d.ts"
|
288
303
|
],
|
304
|
+
"doc": [
|
305
|
+
"./dist/prosekit-extensions-doc.d.ts"
|
306
|
+
],
|
289
307
|
"drop-cursor": [
|
290
308
|
"./dist/prosekit-extensions-drop-cursor.d.ts"
|
291
309
|
],
|
@@ -331,6 +349,9 @@
|
|
331
349
|
"mod-click-prevention": [
|
332
350
|
"./dist/prosekit-extensions-mod-click-prevention.d.ts"
|
333
351
|
],
|
352
|
+
"paragraph": [
|
353
|
+
"./dist/prosekit-extensions-paragraph.d.ts"
|
354
|
+
],
|
334
355
|
"placeholder": [
|
335
356
|
"./dist/prosekit-extensions-placeholder.d.ts"
|
336
357
|
],
|
@@ -346,6 +367,9 @@
|
|
346
367
|
"table": [
|
347
368
|
"./dist/prosekit-extensions-table.d.ts"
|
348
369
|
],
|
370
|
+
"text": [
|
371
|
+
"./dist/prosekit-extensions-text.d.ts"
|
372
|
+
],
|
349
373
|
"text-align": [
|
350
374
|
"./dist/prosekit-extensions-text-align.d.ts"
|
351
375
|
],
|