@prosekit/extensions 0.0.0-next-20230709094459 → 0.0.0-next-20240421132240
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 +889 -0
- package/dist/chunk-ASTUC4KT.js +111 -0
- package/dist/chunk-DYFRBXUX.js +56 -0
- package/dist/list/style.css +18 -13
- package/dist/prosekit-extensions-autocomplete.d.ts +3 -0
- package/dist/prosekit-extensions-autocomplete.js +194 -0
- package/dist/prosekit-extensions-blockquote.d.ts +3 -11
- package/dist/prosekit-extensions-blockquote.js +24 -15
- package/dist/prosekit-extensions-bold.d.ts +4 -20
- package/dist/prosekit-extensions-bold.js +35 -37
- package/dist/prosekit-extensions-code-block.d.ts +15 -0
- package/dist/prosekit-extensions-code-block.js +214 -0
- package/dist/prosekit-extensions-code.d.ts +4 -16
- package/dist/prosekit-extensions-code.js +28 -12
- package/dist/prosekit-extensions-drop-cursor.d.ts +2 -0
- package/dist/prosekit-extensions-drop-cursor.js +9 -0
- package/dist/prosekit-extensions-enter-rule.d.ts +5 -0
- package/dist/prosekit-extensions-enter-rule.js +8 -0
- package/dist/prosekit-extensions-heading.d.ts +6 -15
- package/dist/prosekit-extensions-heading.js +75 -41
- package/dist/prosekit-extensions-image.d.ts +4 -0
- package/dist/prosekit-extensions-image.js +49 -0
- package/dist/prosekit-extensions-input-rule.d.ts +3 -0
- package/dist/prosekit-extensions-input-rule.js +10 -0
- package/dist/prosekit-extensions-italic.d.ts +4 -20
- package/dist/prosekit-extensions-italic.js +29 -31
- package/dist/prosekit-extensions-link.d.ts +6 -0
- package/dist/prosekit-extensions-link.js +102 -0
- package/dist/prosekit-extensions-list.d.ts +7 -14
- package/dist/prosekit-extensions-list.js +59 -24
- package/dist/prosekit-extensions-mention.d.ts +4 -0
- package/dist/prosekit-extensions-mention.js +56 -0
- package/dist/prosekit-extensions-placeholder.d.ts +2 -23
- package/dist/prosekit-extensions-placeholder.js +11 -7
- package/dist/prosekit-extensions-readonly.d.ts +1 -0
- package/dist/prosekit-extensions-readonly.js +16 -0
- package/dist/prosekit-extensions-strike.d.ts +4 -0
- package/dist/prosekit-extensions-strike.js +47 -0
- package/dist/prosekit-extensions-table.d.ts +7 -0
- package/dist/prosekit-extensions-table.js +197 -0
- package/dist/prosekit-extensions-underline.d.ts +4 -0
- package/dist/prosekit-extensions-underline.js +45 -0
- package/dist/prosekit-extensions-virtual-selection.d.ts +1 -0
- package/dist/prosekit-extensions-virtual-selection.js +58 -0
- package/dist/prosekit-extensions.d.ts +1 -2
- package/dist/shiki-import-25BJYIO2.js +5 -0
- package/dist/table/style.css +34 -0
- package/dist/virtual-selection/style.css +6 -0
- package/package.json +119 -13
- package/dist/prosekit-extensions-suggestion.d.ts +0 -37
- package/dist/prosekit-extensions-suggestion.js +0 -159
- package/src/index.ts +0 -1
@@ -0,0 +1,889 @@
|
|
1
|
+
import { Attrs } from '@prosekit/pm/model';
|
2
|
+
import { BundledLanguage } from 'shiki';
|
3
|
+
import { BundledLanguageInfo } from 'shiki';
|
4
|
+
import { bundledLanguagesInfo } from 'shiki';
|
5
|
+
import { BundledTheme } from 'shiki';
|
6
|
+
import { BundledThemeInfo } from 'shiki';
|
7
|
+
import { bundledThemesInfo } from 'shiki';
|
8
|
+
import { Command } from '@prosekit/pm/state';
|
9
|
+
import { CommandArgs } from '@prosekit/core';
|
10
|
+
import { DedentListOptions } from 'prosemirror-flat-list';
|
11
|
+
import { EditorState } from '@prosekit/pm/state';
|
12
|
+
import { Extension } from '@prosekit/core';
|
13
|
+
import { ExtensionTyping } from '@prosekit/core';
|
14
|
+
import { getHighlighter } from 'shiki/bundle/full';
|
15
|
+
import { IndentListOptions } from 'prosemirror-flat-list';
|
16
|
+
import { InputRule } from '@prosekit/pm/inputrules';
|
17
|
+
import { ListAttributes } from 'prosemirror-flat-list';
|
18
|
+
import { ListDOMSerializer } from 'prosemirror-flat-list';
|
19
|
+
import { NodeRange } from 'prosemirror-model';
|
20
|
+
import { NodeType } from '@prosekit/pm/model';
|
21
|
+
import { Options } from 'tsup';
|
22
|
+
import { Parser } from 'prosemirror-highlight';
|
23
|
+
import { Plugin as Plugin_2 } from '@prosekit/pm/state';
|
24
|
+
import { PluginKey } from '@prosekit/pm/state';
|
25
|
+
import { ProseMirrorNode } from '@prosekit/pm/model';
|
26
|
+
import type { SpecialLanguage } from 'shiki';
|
27
|
+
import { ToggleCollapsedOptions } from 'prosemirror-flat-list';
|
28
|
+
import { Transaction } from '@prosekit/pm/state';
|
29
|
+
import { UnwrapListOptions } from 'prosemirror-flat-list';
|
30
|
+
|
31
|
+
declare class AutocompleteRule {
|
32
|
+
readonly regex: RegExp;
|
33
|
+
readonly onMatch: MatchHandler;
|
34
|
+
readonly onLeave?: VoidFunction;
|
35
|
+
readonly canMatch: (options: {
|
36
|
+
state: EditorState;
|
37
|
+
}) => boolean;
|
38
|
+
constructor(options: {
|
39
|
+
regex: RegExp;
|
40
|
+
onEnter: MatchHandler;
|
41
|
+
onLeave?: VoidFunction;
|
42
|
+
canMatch?: (options: {
|
43
|
+
state: EditorState;
|
44
|
+
}) => boolean;
|
45
|
+
});
|
46
|
+
}
|
47
|
+
export { AutocompleteRule }
|
48
|
+
export { AutocompleteRule as AutocompleteRule_alias_1 }
|
49
|
+
|
50
|
+
export { BundledLanguage as ShikiBundledLanguage }
|
51
|
+
export { BundledLanguage as ShikiBundledLanguage_alias_1 }
|
52
|
+
|
53
|
+
export { BundledLanguageInfo as ShikiBundledLanguageInfo }
|
54
|
+
export { BundledLanguageInfo as ShikiBundledLanguageInfo_alias_1 }
|
55
|
+
|
56
|
+
export { bundledLanguagesInfo as shikiBundledLanguagesInfo }
|
57
|
+
export { bundledLanguagesInfo as shikiBundledLanguagesInfo_alias_1 }
|
58
|
+
|
59
|
+
export { BundledTheme as ShikiBundledTheme }
|
60
|
+
export { BundledTheme as ShikiBundledTheme_alias_1 }
|
61
|
+
|
62
|
+
export { BundledThemeInfo as ShikiBundledThemeInfo }
|
63
|
+
export { BundledThemeInfo as ShikiBundledThemeInfo_alias_1 }
|
64
|
+
|
65
|
+
export { bundledThemesInfo as shikiBundledThemesInfo }
|
66
|
+
export { bundledThemesInfo as shikiBundledThemesInfo_alias_1 }
|
67
|
+
|
68
|
+
export declare interface CellAttrs {
|
69
|
+
colspan: number;
|
70
|
+
rowspan: number;
|
71
|
+
colwidth: number[] | null;
|
72
|
+
}
|
73
|
+
|
74
|
+
/**
|
75
|
+
* The attributes for the `codeBlock` node.
|
76
|
+
*
|
77
|
+
* @public
|
78
|
+
*/
|
79
|
+
declare interface CodeBlockAttrs {
|
80
|
+
language?: string;
|
81
|
+
}
|
82
|
+
export { CodeBlockAttrs }
|
83
|
+
export { CodeBlockAttrs as CodeBlockAttrs_alias_1 }
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @public
|
87
|
+
*/
|
88
|
+
export declare interface CodeBlockShikiOptions {
|
89
|
+
/**
|
90
|
+
* Theme registation
|
91
|
+
*
|
92
|
+
* @default ['one-dark-pro']
|
93
|
+
*/
|
94
|
+
themes?: BundledTheme[];
|
95
|
+
/**
|
96
|
+
* Language registation
|
97
|
+
*
|
98
|
+
* @default ['text']
|
99
|
+
*/
|
100
|
+
langs?: (BundledLanguage | SpecialLanguage)[];
|
101
|
+
/**
|
102
|
+
* Alias of languages
|
103
|
+
*
|
104
|
+
* @example { 'my-lang': 'javascript' }
|
105
|
+
*/
|
106
|
+
langAlias?: Record<string, BundledLanguage>;
|
107
|
+
}
|
108
|
+
|
109
|
+
export declare function createAutocompletePlugin({ getRules, }: {
|
110
|
+
getRules: () => AutocompleteRule[];
|
111
|
+
}): Plugin_2;
|
112
|
+
|
113
|
+
/**
|
114
|
+
* @internal
|
115
|
+
*/
|
116
|
+
export declare function createLazyParser(highlighterOptions: HighlighterOptions): Parser;
|
117
|
+
|
118
|
+
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
119
|
+
|
120
|
+
export declare const default_alias_1: {
|
121
|
+
test: {
|
122
|
+
environment: "jsdom";
|
123
|
+
};
|
124
|
+
};
|
125
|
+
|
126
|
+
export declare function defaultCanMatch({ state }: {
|
127
|
+
state: EditorState;
|
128
|
+
}): boolean;
|
129
|
+
|
130
|
+
export declare function defineAutocomplete(rule: AutocompleteRule): Extension;
|
131
|
+
|
132
|
+
/**
|
133
|
+
* @public
|
134
|
+
*/
|
135
|
+
export declare function defineBlockquote(): Extension< {
|
136
|
+
NODES: "blockquote";
|
137
|
+
}>;
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Wraps the text block in a blockquote when `>` is typed at the start of a new
|
141
|
+
* line followed by a space.
|
142
|
+
*/
|
143
|
+
export declare function defineBlockquoteInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
144
|
+
|
145
|
+
export declare function defineBlockquoteSpec(): Extension< {
|
146
|
+
NODES: "blockquote";
|
147
|
+
}>;
|
148
|
+
|
149
|
+
/**
|
150
|
+
* @public
|
151
|
+
*/
|
152
|
+
export declare function defineBold(): Extension< {
|
153
|
+
MARKS: "bold";
|
154
|
+
COMMAND_ARGS: {
|
155
|
+
toggleBold: [];
|
156
|
+
};
|
157
|
+
}>;
|
158
|
+
|
159
|
+
export declare function defineBoldCommands(): Extension< {
|
160
|
+
COMMAND_ARGS: {
|
161
|
+
toggleBold: [];
|
162
|
+
};
|
163
|
+
}>;
|
164
|
+
|
165
|
+
export declare function defineBoldKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
166
|
+
|
167
|
+
export declare function defineBoldSpec(): Extension< {
|
168
|
+
MARKS: "bold";
|
169
|
+
}>;
|
170
|
+
|
171
|
+
/**
|
172
|
+
* @public
|
173
|
+
*/
|
174
|
+
export declare function defineCode(): Extension< {
|
175
|
+
MARKS: "code";
|
176
|
+
COMMAND_ARGS: {
|
177
|
+
toggleCode: [];
|
178
|
+
};
|
179
|
+
}>;
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Adds `codeBlock` nodes to the editor. This includes the following extensions:
|
183
|
+
*
|
184
|
+
* - {@link defineCodeBlockSpec}
|
185
|
+
* - {@link defineCodeBlockInputRule}
|
186
|
+
* - {@link defineCodeBlockEnterRule}
|
187
|
+
* - {@link defineCodeBlockKeymap}
|
188
|
+
* - {@link defineCodeBlockCommands}.
|
189
|
+
*
|
190
|
+
* @public
|
191
|
+
*/
|
192
|
+
declare function defineCodeBlock(): Extension< {
|
193
|
+
NODES: "codeBlock";
|
194
|
+
COMMAND_ARGS: {
|
195
|
+
setCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
196
|
+
insertCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
197
|
+
toggleCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
198
|
+
setCodeBlockAttrs: [attrs: CodeBlockAttrs];
|
199
|
+
};
|
200
|
+
}>;
|
201
|
+
export { defineCodeBlock }
|
202
|
+
export { defineCodeBlock as defineCodeBlock_alias_1 }
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Adds commands for working with `codeBlock` nodes.
|
206
|
+
*
|
207
|
+
* @public
|
208
|
+
*/
|
209
|
+
declare function defineCodeBlockCommands(): Extension< {
|
210
|
+
COMMAND_ARGS: {
|
211
|
+
setCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
212
|
+
insertCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
213
|
+
toggleCodeBlock: [attrs?: CodeBlockAttrs | undefined];
|
214
|
+
setCodeBlockAttrs: [attrs: CodeBlockAttrs];
|
215
|
+
};
|
216
|
+
}>;
|
217
|
+
export { defineCodeBlockCommands }
|
218
|
+
export { defineCodeBlockCommands as defineCodeBlockCommands_alias_1 }
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Adds enter rules for `codeBlock` nodes.
|
222
|
+
*
|
223
|
+
* @public
|
224
|
+
*/
|
225
|
+
declare function defineCodeBlockEnterRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
226
|
+
export { defineCodeBlockEnterRule }
|
227
|
+
export { defineCodeBlockEnterRule as defineCodeBlockEnterRule_alias_1 }
|
228
|
+
|
229
|
+
/**
|
230
|
+
* Adds syntax highlighting to code blocks. This function requires a `Parser`
|
231
|
+
* instance from the `prosemirror-highlight` package. See the
|
232
|
+
* [documentation](https://github.com/ocavue/prosemirror-highlight) for more
|
233
|
+
* information.
|
234
|
+
*
|
235
|
+
* @public
|
236
|
+
*/
|
237
|
+
declare function defineCodeBlockHighlight({ parser, }: {
|
238
|
+
parser: HighlightParser;
|
239
|
+
}): Extension;
|
240
|
+
export { defineCodeBlockHighlight }
|
241
|
+
export { defineCodeBlockHighlight as defineCodeBlockHighlight_alias_1 }
|
242
|
+
|
243
|
+
/**
|
244
|
+
* Adds input rules for `codeBlock` nodes.
|
245
|
+
*
|
246
|
+
* @public
|
247
|
+
*/
|
248
|
+
declare function defineCodeBlockInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
249
|
+
export { defineCodeBlockInputRule }
|
250
|
+
export { defineCodeBlockInputRule as defineCodeBlockInputRule_alias_1 }
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Defines the keymap for code blocks.
|
254
|
+
*/
|
255
|
+
export declare function defineCodeBlockKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Adds syntax highlighting to code blocks using the [shiki](https://github.com/shikijs/shiki) package.
|
259
|
+
*
|
260
|
+
* @public
|
261
|
+
*/
|
262
|
+
declare function defineCodeBlockShiki({ themes, langs, langAlias, }?: CodeBlockShikiOptions): Extension;
|
263
|
+
export { defineCodeBlockShiki }
|
264
|
+
export { defineCodeBlockShiki as defineCodeBlockShiki_alias_1 }
|
265
|
+
|
266
|
+
/**
|
267
|
+
* Defines the `codeBlock` node spec.
|
268
|
+
*
|
269
|
+
* @public
|
270
|
+
*/
|
271
|
+
declare function defineCodeBlockSpec(): Extension< {
|
272
|
+
NODES: "codeBlock";
|
273
|
+
}>;
|
274
|
+
export { defineCodeBlockSpec }
|
275
|
+
export { defineCodeBlockSpec as defineCodeBlockSpec_alias_1 }
|
276
|
+
|
277
|
+
export declare function defineCodeCommands(): Extension< {
|
278
|
+
COMMAND_ARGS: {
|
279
|
+
toggleCode: [];
|
280
|
+
};
|
281
|
+
}>;
|
282
|
+
|
283
|
+
/**
|
284
|
+
* @public
|
285
|
+
*/
|
286
|
+
export declare function defineCodeSpec(): Extension< {
|
287
|
+
MARKS: "code";
|
288
|
+
}>;
|
289
|
+
|
290
|
+
/**
|
291
|
+
* Show up a decoration at the drop position when something is dragged over the editor.
|
292
|
+
*
|
293
|
+
* See [prosemirror-dropcursor](https://github.com/ProseMirror/prosemirror-dropcursor) for more information.
|
294
|
+
*
|
295
|
+
* @public
|
296
|
+
*/
|
297
|
+
export declare function defineDropCursor(options?: DropCursorOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Defines an enter rule. An enter rule applies when the text directly in front of
|
301
|
+
* the cursor matches `regex` and user presses Enter. The `regex` should end
|
302
|
+
* with `$`.
|
303
|
+
*
|
304
|
+
* @public
|
305
|
+
*/
|
306
|
+
export declare function defineEnterRule({ regex, handler, stop, }: EnterRuleOptions): Extension;
|
307
|
+
|
308
|
+
/**
|
309
|
+
* @public
|
310
|
+
*/
|
311
|
+
export declare function defineHeading(): Extension< {
|
312
|
+
NODES: "heading";
|
313
|
+
COMMAND_ARGS: {
|
314
|
+
setHeading: [attrs?: HeadingAttrs | undefined];
|
315
|
+
insertHeading: [attrs?: HeadingAttrs | undefined];
|
316
|
+
toggleHeading: [attrs?: HeadingAttrs | undefined];
|
317
|
+
};
|
318
|
+
}>;
|
319
|
+
|
320
|
+
export declare function defineHeadingCommands(): Extension< {
|
321
|
+
COMMAND_ARGS: {
|
322
|
+
setHeading: [attrs?: HeadingAttrs | undefined];
|
323
|
+
insertHeading: [attrs?: HeadingAttrs | undefined];
|
324
|
+
toggleHeading: [attrs?: HeadingAttrs | undefined];
|
325
|
+
};
|
326
|
+
}>;
|
327
|
+
|
328
|
+
/**
|
329
|
+
* Converts the text block to a heading when `#` is typed at the start of a new
|
330
|
+
* line followed by a space.
|
331
|
+
*/
|
332
|
+
export declare function defineHeadingInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
333
|
+
|
334
|
+
export declare function defineHeadingKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
335
|
+
|
336
|
+
export declare function defineHeadingSpec(): Extension< {
|
337
|
+
NODES: "heading";
|
338
|
+
}>;
|
339
|
+
|
340
|
+
/**
|
341
|
+
* @public
|
342
|
+
*/
|
343
|
+
export declare function defineImage(): Extension< {
|
344
|
+
NODES: "image";
|
345
|
+
COMMAND_ARGS: {
|
346
|
+
insertImage: [attrs?: ImageAttrs | undefined];
|
347
|
+
};
|
348
|
+
}>;
|
349
|
+
|
350
|
+
export declare function defineImageCommands(): Extension< {
|
351
|
+
COMMAND_ARGS: {
|
352
|
+
insertImage: [attrs?: ImageAttrs | undefined];
|
353
|
+
};
|
354
|
+
}>;
|
355
|
+
|
356
|
+
export declare function defineImageSpec(): Extension< {
|
357
|
+
NODES: "image";
|
358
|
+
}>;
|
359
|
+
|
360
|
+
/**
|
361
|
+
* Defines an input rule extension.
|
362
|
+
*
|
363
|
+
* @param rule - The ProseMirror input rule to add.
|
364
|
+
*
|
365
|
+
* @public
|
366
|
+
*/
|
367
|
+
export declare function defineInputRule(rule: InputRule): Extension;
|
368
|
+
|
369
|
+
/**
|
370
|
+
* @public
|
371
|
+
*/
|
372
|
+
export declare function defineItalic(): Extension< {
|
373
|
+
MARKS: "italic";
|
374
|
+
COMMAND_ARGS: {
|
375
|
+
toggleItalic: [];
|
376
|
+
};
|
377
|
+
}>;
|
378
|
+
|
379
|
+
export declare function defineItalicCommands(): Extension< {
|
380
|
+
COMMAND_ARGS: {
|
381
|
+
toggleItalic: [];
|
382
|
+
};
|
383
|
+
}>;
|
384
|
+
|
385
|
+
export declare function defineItalicKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
386
|
+
|
387
|
+
export declare function defineItalicKeymap_alias_1(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
388
|
+
|
389
|
+
export declare function defineItalicSpec(): Extension< {
|
390
|
+
MARKS: "italic";
|
391
|
+
}>;
|
392
|
+
|
393
|
+
/**
|
394
|
+
* @public
|
395
|
+
*/
|
396
|
+
export declare function defineLink(): Extension< {
|
397
|
+
MARKS: "link";
|
398
|
+
COMMAND_ARGS: {
|
399
|
+
addLink: [attrs: LinkAttrs];
|
400
|
+
removeLink: [];
|
401
|
+
toggleLink: [attrs: LinkAttrs];
|
402
|
+
expandLink: [];
|
403
|
+
};
|
404
|
+
}>;
|
405
|
+
|
406
|
+
export declare function defineLinkCommands(): Extension< {
|
407
|
+
COMMAND_ARGS: {
|
408
|
+
addLink: [attrs: LinkAttrs];
|
409
|
+
removeLink: [];
|
410
|
+
toggleLink: [attrs: LinkAttrs];
|
411
|
+
expandLink: [];
|
412
|
+
};
|
413
|
+
}>;
|
414
|
+
|
415
|
+
export declare function defineLinkEnterRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
416
|
+
|
417
|
+
export declare function defineLinkInputRule(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
418
|
+
|
419
|
+
export declare function defineLinkSpec(): Extension< {
|
420
|
+
MARKS: "link";
|
421
|
+
}>;
|
422
|
+
|
423
|
+
/**
|
424
|
+
* @public
|
425
|
+
*/
|
426
|
+
export declare function defineList(): Extension<{
|
427
|
+
NODES: "list";
|
428
|
+
COMMAND_ARGS: {
|
429
|
+
dedentList: [options?: DedentListOptions | undefined];
|
430
|
+
indentList: [options?: IndentListOptions | undefined];
|
431
|
+
moveList: [direction: "up" | "down"];
|
432
|
+
splitList: [];
|
433
|
+
toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
|
434
|
+
toggleList: [attrs: ListAttributes];
|
435
|
+
unwrapList: [options?: UnwrapListOptions | undefined];
|
436
|
+
wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
|
437
|
+
insertList: [attrs?: ListAttributes | undefined];
|
438
|
+
};
|
439
|
+
}>;
|
440
|
+
|
441
|
+
export declare function defineListCommands(): Extension<{
|
442
|
+
COMMAND_ARGS: {
|
443
|
+
dedentList: [options?: DedentListOptions | undefined];
|
444
|
+
indentList: [options?: IndentListOptions | undefined];
|
445
|
+
moveList: [direction: "up" | "down"];
|
446
|
+
splitList: [];
|
447
|
+
toggleCollapsed: [(ToggleCollapsedOptions | undefined)?];
|
448
|
+
toggleList: [attrs: ListAttributes];
|
449
|
+
unwrapList: [options?: UnwrapListOptions | undefined];
|
450
|
+
wrapInList: [getAttrs: ListAttributes | ((range: NodeRange) => ListAttributes | null)];
|
451
|
+
insertList: [attrs?: ListAttributes | undefined];
|
452
|
+
};
|
453
|
+
}>;
|
454
|
+
|
455
|
+
export declare function defineListInputRules(): Extension;
|
456
|
+
|
457
|
+
/**
|
458
|
+
* Returns a extension that adds key bindings for list.
|
459
|
+
*
|
460
|
+
* @public
|
461
|
+
*/
|
462
|
+
export declare function defineListKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
463
|
+
|
464
|
+
export declare function defineListPlugins(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
465
|
+
|
466
|
+
export declare function defineListSpec(): Extension<{
|
467
|
+
NODES: "list";
|
468
|
+
}>;
|
469
|
+
|
470
|
+
/**
|
471
|
+
* @public
|
472
|
+
*/
|
473
|
+
export declare function defineMention(): Extension< {
|
474
|
+
NODES: "mention";
|
475
|
+
COMMAND_ARGS: {
|
476
|
+
insertMention: [attrs: MentionAttrs];
|
477
|
+
};
|
478
|
+
}>;
|
479
|
+
|
480
|
+
export declare function defineMentionCommands(): Extension< {
|
481
|
+
COMMAND_ARGS: {
|
482
|
+
insertMention: [attrs: MentionAttrs];
|
483
|
+
};
|
484
|
+
}>;
|
485
|
+
|
486
|
+
/**
|
487
|
+
* @public
|
488
|
+
*/
|
489
|
+
export declare function defineMentionSpec(): Extension< {
|
490
|
+
NODES: "mention";
|
491
|
+
}>;
|
492
|
+
|
493
|
+
/**
|
494
|
+
* Add a placeholder text to the editor when the current block or document is
|
495
|
+
* empty.
|
496
|
+
*/
|
497
|
+
export declare function definePlaceholder(options: PlaceholderOptions): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
498
|
+
|
499
|
+
/**
|
500
|
+
* Make the editor read-only.
|
501
|
+
*/
|
502
|
+
export declare function defineReadonly(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
503
|
+
|
504
|
+
/**
|
505
|
+
* @public
|
506
|
+
*/
|
507
|
+
export declare function defineStrike(): Extension< {
|
508
|
+
MARKS: "strike";
|
509
|
+
COMMAND_ARGS: {
|
510
|
+
toggleStrike: [];
|
511
|
+
};
|
512
|
+
}>;
|
513
|
+
|
514
|
+
export declare function defineStrikeCommands(): Extension< {
|
515
|
+
COMMAND_ARGS: {
|
516
|
+
toggleStrike: [];
|
517
|
+
};
|
518
|
+
}>;
|
519
|
+
|
520
|
+
export declare function defineStrikeKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
521
|
+
|
522
|
+
export declare function defineStrikeSpec(): Extension< {
|
523
|
+
MARKS: "strike";
|
524
|
+
}>;
|
525
|
+
|
526
|
+
/**
|
527
|
+
* @public
|
528
|
+
*/
|
529
|
+
export declare function defineTable(): Extension< {
|
530
|
+
NODES: "table" | "tableRow" | "tableCell" | "tableHeaderCell";
|
531
|
+
COMMAND_ARGS: {
|
532
|
+
insertTable: [{
|
533
|
+
row: number;
|
534
|
+
col: number;
|
535
|
+
header: boolean;
|
536
|
+
}];
|
537
|
+
exitTable: [];
|
538
|
+
};
|
539
|
+
}>;
|
540
|
+
|
541
|
+
declare function defineTableCellSpec(): Extension< {
|
542
|
+
NODES: "tableCell";
|
543
|
+
}>;
|
544
|
+
export { defineTableCellSpec }
|
545
|
+
export { defineTableCellSpec as defineTableCellSpec_alias_1 }
|
546
|
+
|
547
|
+
/**
|
548
|
+
* Adds commands for working with `table` nodes.
|
549
|
+
*
|
550
|
+
* @public
|
551
|
+
*/
|
552
|
+
declare function defineTableCommands(): Extension< {
|
553
|
+
COMMAND_ARGS: {
|
554
|
+
insertTable: [{
|
555
|
+
row: number;
|
556
|
+
col: number;
|
557
|
+
header: boolean;
|
558
|
+
}];
|
559
|
+
exitTable: [];
|
560
|
+
};
|
561
|
+
}>;
|
562
|
+
export { defineTableCommands }
|
563
|
+
export { defineTableCommands as defineTableCommands_alias_1 }
|
564
|
+
|
565
|
+
declare function defineTableHeaderCellSpec(): Extension< {
|
566
|
+
NODES: "tableHeaderCell";
|
567
|
+
}>;
|
568
|
+
export { defineTableHeaderCellSpec }
|
569
|
+
export { defineTableHeaderCellSpec as defineTableHeaderCellSpec_alias_1 }
|
570
|
+
|
571
|
+
/**
|
572
|
+
* @public
|
573
|
+
*/
|
574
|
+
declare function defineTablePlugins(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
575
|
+
export { defineTablePlugins }
|
576
|
+
export { defineTablePlugins as defineTablePlugins_alias_1 }
|
577
|
+
|
578
|
+
declare function defineTableRowSpec(): Extension< {
|
579
|
+
NODES: "tableRow";
|
580
|
+
}>;
|
581
|
+
export { defineTableRowSpec }
|
582
|
+
export { defineTableRowSpec as defineTableRowSpec_alias_1 }
|
583
|
+
|
584
|
+
declare function defineTableSpec(): Extension< {
|
585
|
+
NODES: "table";
|
586
|
+
}>;
|
587
|
+
export { defineTableSpec }
|
588
|
+
export { defineTableSpec as defineTableSpec_alias_1 }
|
589
|
+
|
590
|
+
/**
|
591
|
+
* Defines an enter rule that replaces the matched text with a block node.
|
592
|
+
*
|
593
|
+
* See also {@link defineEnterRule}.
|
594
|
+
*
|
595
|
+
* @public
|
596
|
+
*/
|
597
|
+
export declare function defineTextBlockEnterRule({ regex, type, attrs, stop, }: TextBlockEnterRuleOptions): Extension;
|
598
|
+
|
599
|
+
/**
|
600
|
+
* Defines an input rule that changes the type of a textblock when the matched
|
601
|
+
* text is typed into it.
|
602
|
+
*
|
603
|
+
* See also [textblockTypeInputRule](https://prosemirror.net/docs/ref/#inputrules.textblockTypeInputRule)
|
604
|
+
*
|
605
|
+
* @public
|
606
|
+
*/
|
607
|
+
export declare function defineTextBlockInputRule({ regex, type, attrs, }: {
|
608
|
+
/**
|
609
|
+
* The regular expression to match against. You'll usually want to start it
|
610
|
+
* with `^` to that it is only matched at the start of a textblock.
|
611
|
+
*/
|
612
|
+
regex: RegExp;
|
613
|
+
/**
|
614
|
+
* The node type to replace the matched text with.
|
615
|
+
*/
|
616
|
+
type: string | NodeType;
|
617
|
+
/**
|
618
|
+
* Attributes to set on the node.
|
619
|
+
*/
|
620
|
+
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
621
|
+
}): Extension;
|
622
|
+
|
623
|
+
/**
|
624
|
+
* @public
|
625
|
+
*/
|
626
|
+
export declare function defineUnderline(): Extension< {
|
627
|
+
MARKS: "underline";
|
628
|
+
COMMAND_ARGS: {
|
629
|
+
toggleUnderline: [];
|
630
|
+
};
|
631
|
+
}>;
|
632
|
+
|
633
|
+
export declare function defineUnderlineCommands(): Extension< {
|
634
|
+
COMMAND_ARGS: {
|
635
|
+
toggleUnderline: [];
|
636
|
+
};
|
637
|
+
}>;
|
638
|
+
|
639
|
+
export declare function defineUnderlineKeymap(): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
640
|
+
|
641
|
+
export declare function defineUnderlineSpec(): Extension< {
|
642
|
+
MARKS: "underline";
|
643
|
+
}>;
|
644
|
+
|
645
|
+
/**
|
646
|
+
* Shows a virtual selection when the editor is not focused. When the editor is
|
647
|
+
* not focused, the selected inline content will be wrapped in a `<span>`
|
648
|
+
* element with the class `prosekit-virtual-selection`.
|
649
|
+
*
|
650
|
+
* This is useful when you want to move the focus to an element outside the
|
651
|
+
* editor, but still want to show the selection.
|
652
|
+
*
|
653
|
+
* @public
|
654
|
+
*/
|
655
|
+
export declare function defineVirtualSelection(): Extension;
|
656
|
+
|
657
|
+
/**
|
658
|
+
* Defines an input rule for automatically wrapping a textblock when a given
|
659
|
+
* string is typed.
|
660
|
+
*
|
661
|
+
* See also [wrappingInputRule](https://prosemirror.net/docs/ref/#inputrules.wrappingInputRule)
|
662
|
+
*
|
663
|
+
* @public
|
664
|
+
*/
|
665
|
+
export declare function defineWrappingInputRule({ regex, type, attrs, join, }: {
|
666
|
+
/**
|
667
|
+
* The regular expression to match against. You'll usually want to start it
|
668
|
+
* with `^` to that it is only matched at the start of a textblock.
|
669
|
+
*/
|
670
|
+
regex: RegExp;
|
671
|
+
/**
|
672
|
+
* The type of node to wrap in.
|
673
|
+
*/
|
674
|
+
type: string | NodeType;
|
675
|
+
/**
|
676
|
+
* Attributes to set on the node.
|
677
|
+
*/
|
678
|
+
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
679
|
+
/**
|
680
|
+
* By default, if there's a node with the same type above the newly wrapped
|
681
|
+
* node, the rule will try to
|
682
|
+
* [join](https://prosemirror.net/docs/ref/#transform.Transform.join) those
|
683
|
+
* two nodes. You can pass a join predicate, which takes a regular expression
|
684
|
+
* match and the node before the wrapped node, and can return a boolean to
|
685
|
+
* indicate whether a join should happen.
|
686
|
+
*/
|
687
|
+
join?: (match: RegExpMatchArray, node: ProseMirrorNode) => boolean;
|
688
|
+
}): Extension;
|
689
|
+
|
690
|
+
export declare interface DropCursorOptions {
|
691
|
+
/**
|
692
|
+
* The color of the cursor. Use `false` to apply no color and rely only on class.
|
693
|
+
*
|
694
|
+
* @default 'black'
|
695
|
+
*/
|
696
|
+
color?: string | false;
|
697
|
+
/**
|
698
|
+
* The precise width of the cursor in pixels.
|
699
|
+
*
|
700
|
+
* @default 1
|
701
|
+
*/
|
702
|
+
width?: number;
|
703
|
+
/**
|
704
|
+
* A CSS class name to add to the cursor element.
|
705
|
+
*/
|
706
|
+
class?: string;
|
707
|
+
}
|
708
|
+
|
709
|
+
/**
|
710
|
+
* @public
|
711
|
+
*/
|
712
|
+
export declare type EnterRuleHandler = (options: {
|
713
|
+
/**
|
714
|
+
* The current editor state.
|
715
|
+
*/
|
716
|
+
state: EditorState;
|
717
|
+
/**
|
718
|
+
* The start position of the matched text.
|
719
|
+
*/
|
720
|
+
from: number;
|
721
|
+
/**
|
722
|
+
* The end position of the matched text.
|
723
|
+
*/
|
724
|
+
to: number;
|
725
|
+
/**
|
726
|
+
* The matched result from the regular expression.
|
727
|
+
*/
|
728
|
+
match: RegExpExecArray;
|
729
|
+
}) => Transaction | null;
|
730
|
+
|
731
|
+
/**
|
732
|
+
* Options for {@link defineEnterRule}.
|
733
|
+
*
|
734
|
+
* @public
|
735
|
+
*/
|
736
|
+
export declare type EnterRuleOptions = {
|
737
|
+
/**
|
738
|
+
* The regular expression to match against. It should end with `$`.
|
739
|
+
*/
|
740
|
+
regex: RegExp;
|
741
|
+
/**
|
742
|
+
* A function to be called when an enter rule is triggered.
|
743
|
+
*/
|
744
|
+
handler: EnterRuleHandler;
|
745
|
+
/**
|
746
|
+
* Whether to stop further handlers from being called if this rule is triggered.
|
747
|
+
*
|
748
|
+
* @default false
|
749
|
+
*/
|
750
|
+
stop?: boolean;
|
751
|
+
};
|
752
|
+
|
753
|
+
/**
|
754
|
+
* When the selection is in a table node, create a default block after the table
|
755
|
+
* table, and move the cursor there.
|
756
|
+
*
|
757
|
+
* @public
|
758
|
+
*/
|
759
|
+
export declare const exitTable: Command;
|
760
|
+
|
761
|
+
export { getHighlighter }
|
762
|
+
|
763
|
+
export declare function getPluginState(state: EditorState): PredictionPluginState | undefined;
|
764
|
+
|
765
|
+
export declare function getTrMeta(tr: Transaction): PredictionPluginState;
|
766
|
+
|
767
|
+
export declare interface HeadingAttrs {
|
768
|
+
level: number;
|
769
|
+
}
|
770
|
+
|
771
|
+
declare type HighlighterOptions = {
|
772
|
+
themes: BundledTheme[];
|
773
|
+
langs: (BundledLanguage | SpecialLanguage)[];
|
774
|
+
langAlias?: Record<string, BundledLanguage>;
|
775
|
+
};
|
776
|
+
|
777
|
+
/**
|
778
|
+
* @public
|
779
|
+
*
|
780
|
+
* An alias for the `Parser` type from the `prosemirror-highlight` package.
|
781
|
+
*/
|
782
|
+
declare type HighlightParser = Parser;
|
783
|
+
export { HighlightParser }
|
784
|
+
export { HighlightParser as HighlightParser_alias_1 }
|
785
|
+
|
786
|
+
export declare interface ImageAttrs {
|
787
|
+
src?: string | null;
|
788
|
+
}
|
789
|
+
|
790
|
+
/**
|
791
|
+
* Insert a table node with the given number of rows and columns, and optionally
|
792
|
+
* a header row.
|
793
|
+
*
|
794
|
+
* @public
|
795
|
+
*/
|
796
|
+
export declare function insertTable({ row, col, header, }: {
|
797
|
+
row: number;
|
798
|
+
col: number;
|
799
|
+
header: boolean;
|
800
|
+
}): Command;
|
801
|
+
|
802
|
+
export declare const LINK_RE: RegExp;
|
803
|
+
|
804
|
+
export declare const LINK_SPACE_RE: RegExp;
|
805
|
+
|
806
|
+
/**
|
807
|
+
* @public
|
808
|
+
*/
|
809
|
+
export declare interface LinkAttrs {
|
810
|
+
href: string;
|
811
|
+
}
|
812
|
+
|
813
|
+
export { ListDOMSerializer }
|
814
|
+
|
815
|
+
declare type MatchHandler = (options: {
|
816
|
+
state: EditorState;
|
817
|
+
match: RegExpExecArray;
|
818
|
+
from: number;
|
819
|
+
to: number;
|
820
|
+
ignoreMatch: () => void;
|
821
|
+
deleteMatch: () => void;
|
822
|
+
}) => void;
|
823
|
+
export { MatchHandler }
|
824
|
+
export { MatchHandler as MatchHandler_alias_1 }
|
825
|
+
|
826
|
+
export declare interface MentionAttrs {
|
827
|
+
id: string;
|
828
|
+
kind: string;
|
829
|
+
value: string;
|
830
|
+
}
|
831
|
+
|
832
|
+
export declare interface PlaceholderOptions {
|
833
|
+
/**
|
834
|
+
* The placeholder text to use.
|
835
|
+
*/
|
836
|
+
placeholder: string;
|
837
|
+
/**
|
838
|
+
* By default, the placeholder text will be shown whenever the current text
|
839
|
+
* cursor is in an empty text node. If you only want to show the placeholder
|
840
|
+
* when the whole doc is empty, you can set this option to 'doc'.
|
841
|
+
*
|
842
|
+
* @default 'block'
|
843
|
+
*/
|
844
|
+
strategy?: 'doc' | 'block';
|
845
|
+
}
|
846
|
+
|
847
|
+
export declare const pluginKey: PluginKey<PredictionPluginState>;
|
848
|
+
|
849
|
+
export declare interface PredictionPluginState {
|
850
|
+
active: boolean;
|
851
|
+
ignore: number | null;
|
852
|
+
matching: {
|
853
|
+
rule: AutocompleteRule;
|
854
|
+
from: number;
|
855
|
+
to: number;
|
856
|
+
match: RegExpExecArray;
|
857
|
+
} | null;
|
858
|
+
}
|
859
|
+
|
860
|
+
export declare function setTrMeta(tr: Transaction, meta: PredictionPluginState): Transaction;
|
861
|
+
|
862
|
+
/**
|
863
|
+
* Options for {@link defineTextBlockEnterRule}.
|
864
|
+
*
|
865
|
+
* @public
|
866
|
+
*/
|
867
|
+
export declare type TextBlockEnterRuleOptions = {
|
868
|
+
/**
|
869
|
+
* The regular expression to match against. It should end with `$`.
|
870
|
+
*/
|
871
|
+
regex: RegExp;
|
872
|
+
/**
|
873
|
+
* The node type to replace the matched text with.
|
874
|
+
*/
|
875
|
+
type: string | NodeType;
|
876
|
+
/**
|
877
|
+
* Attributes to set on the node. If a function is provided, it will be called
|
878
|
+
* with the matched result from the regular expression.
|
879
|
+
*/
|
880
|
+
attrs?: Attrs | null | ((match: RegExpMatchArray) => Attrs | null);
|
881
|
+
/**
|
882
|
+
* Whether to stop further handlers from being called if this rule is triggered.
|
883
|
+
*
|
884
|
+
* @default true
|
885
|
+
*/
|
886
|
+
stop?: boolean;
|
887
|
+
};
|
888
|
+
|
889
|
+
export { }
|