@prosekit/core 0.7.15 → 0.8.1

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.
@@ -1,3076 +0,0 @@
1
- import { AllSelection } from '@prosekit/pm/state';
2
- import type { Attrs } from '@prosekit/pm/model';
3
- import { BaseCommandsExtension as BaseCommandsExtension_2 } from '..';
4
- import { Command } from '@prosekit/pm/state';
5
- import type { ContentMatch } from '@prosekit/pm/model';
6
- import type { DirectEditorProps } from '@prosekit/pm/view';
7
- import { DocExtension as DocExtension_2 } from '..';
8
- import type { DOMEventMap } from '@prosekit/pm/view';
9
- import type { DOMOutputSpec } from '@prosekit/pm/model';
10
- import { DOMParser as DOMParser_2 } from '@prosekit/pm/model';
11
- import { DOMSerializer } from '@prosekit/pm/model';
12
- import { EditorState } from '@prosekit/pm/state';
13
- import type { EditorStateConfig } from '@prosekit/pm/state';
14
- import { EditorView } from '@prosekit/pm/view';
15
- import { Facet as Facet_2 } from '../..';
16
- import { Fragment } from '@prosekit/pm/model';
17
- import { HistoryExtension as HistoryExtension_2 } from '..';
18
- import type { IsEqual } from 'type-fest';
19
- import { Mark } from '@prosekit/pm/model';
20
- import type { MarkSpec } from '@prosekit/pm/model';
21
- import type { MarkType } from '@prosekit/pm/model';
22
- import type { MarkViewConstructor } from '@prosekit/pm/view';
23
- import type { Node as Node_2 } from '@prosekit/pm/model';
24
- import { NodeAction as NodeAction_2 } from '..';
25
- import { NodeSelection } from '@prosekit/pm/state';
26
- import type { NodeSpec } from '@prosekit/pm/model';
27
- import type { NodeType } from '@prosekit/pm/model';
28
- import { NodeType as NodeType_2 } from 'prosemirror-model';
29
- import type { NodeView } from '@prosekit/pm/view';
30
- import type { NodeViewConstructor } from '@prosekit/pm/view';
31
- import { ParseOptions } from '@prosekit/pm/model';
32
- import { PlainExtension as PlainExtension_2 } from '..';
33
- import { Plugin as Plugin_2 } from '@prosekit/pm/state';
34
- import { ProseMirrorFragment } from '@prosekit/pm/model';
35
- import { ProseMirrorNode } from '@prosekit/pm/model';
36
- import type { ResolvedPos } from '@prosekit/pm/model';
37
- import { Schema } from '@prosekit/pm/model';
38
- import { SchemaSpec } from '@prosekit/pm/model';
39
- import { Selection as Selection_2 } from '@prosekit/pm/state';
40
- import type { Simplify } from 'type-fest';
41
- import { SimplifyDeeper as SimplifyDeeper_2 } from '..';
42
- import { Slice } from '@prosekit/pm/model';
43
- import type { TagParseRule } from '@prosekit/pm/model';
44
- import { TextExtension as TextExtension_2 } from '..';
45
- import { TextSelection } from '@prosekit/pm/state';
46
- import { ToMarkAction as ToMarkAction_2 } from '..';
47
- import { Transaction } from '@prosekit/pm/state';
48
- import { Union as Union_2 } from '..';
49
- import type { UnionToIntersection } from 'type-fest';
50
-
51
- declare type Action = (options: {
52
- tr: Transaction;
53
- view?: EditorView;
54
- }) => boolean;
55
-
56
- /**
57
- * Returns a command that adds the given mark with the given attributes.
58
- *
59
- * @public
60
- */
61
- declare function addMark(options: AddMarkOptions): Command;
62
- export { addMark }
63
- export { addMark as addMark_alias_1 }
64
-
65
- /**
66
- * @public
67
- */
68
- declare interface AddMarkOptions {
69
- /**
70
- * The type of the mark to add.
71
- */
72
- type: string | MarkType;
73
- /**
74
- * The attributes of the mark to add.
75
- */
76
- attrs?: Attrs | null;
77
- /**
78
- * The start position of the document. By default it will be the start position of current selection.
79
- */
80
- from?: number;
81
- /**
82
- * The end position of the document. By default it will be the end position of current selection.
83
- */
84
- to?: number;
85
- }
86
- export { AddMarkOptions }
87
- export { AddMarkOptions as AddMarkOptions_alias_1 }
88
-
89
- /**
90
- * An object holding the attributes of a node.
91
-
92
- * @public
93
- */
94
- declare type AnyAttrs = Attrs;
95
- export { AnyAttrs }
96
- export { AnyAttrs as AnyAttrs_alias_1 }
97
-
98
- /**
99
- * @internal
100
- */
101
- declare type AnyFunction = (...args: any[]) => any;
102
- export { AnyFunction }
103
- export { AnyFunction as AnyFunction_alias_1 }
104
-
105
- export declare function applyAction(operator: Action): Command;
106
-
107
- export declare const applyMarkForTest: ApplyMarkFunction;
108
-
109
- /**
110
- * @internal
111
- */
112
- export declare type ApplyMarkFunction = (mark: Mark, children: ProseMirrorNode[]) => ProseMirrorNode[];
113
-
114
- /**
115
- * @internal
116
- */
117
- export declare function arrayRemove<T>(array: T[], item: T): void;
118
-
119
- /**
120
- * @internal
121
- */
122
- export declare function arraySubstract<T>(a: T[], b: T[]): T[];
123
-
124
- /**
125
- * @internal
126
- */
127
- declare function assert(condition: unknown, message?: string): asserts condition;
128
- export { assert }
129
- export { assert as assert_alias_1 }
130
-
131
- /**
132
- * Utility function assert that two types are equal in tests.
133
- */
134
- export declare function assertTypeEqual<T, U>(_val: IsEqual<T, U>): void;
135
-
136
- /**
137
- * Utility function assert that two types are equal in tests.
138
- */
139
- export declare function assertTypeEqual_alias_1<T, U>(_val: IsEqual<T, U>): void;
140
-
141
- declare interface AttrOptions {
142
- attr: string;
143
- toDOM?: (value: unknown) => [key: string, value: string] | null | undefined;
144
- parseDOM?: (node: HTMLElement) => unknown;
145
- }
146
-
147
- export declare function attrsMatch(nodeOrMark: ProseMirrorNode | Mark, attrs: Attrs): boolean;
148
-
149
- /**
150
- * @public
151
- */
152
- declare type AttrSpec<AttrType = any> = {
153
- /**
154
- * The default value for this attribute, to use when no explicit value is
155
- * provided. Attributes that have no default must be provided whenever a node
156
- * or mark of a type that has them is created.
157
- */
158
- default?: AttrType;
159
- /**
160
- * A function or type name used to validate values of this attribute. This
161
- * will be used when deserializing the attribute from JSON, and when running
162
- * [`Node.check`](https://prosemirror.net/docs/ref/#model.Node.check). When a
163
- * function, it should raise an exception if the value isn't of the expected
164
- * type or shape. When a string, it should be a `|`-separated string of
165
- * primitive types (`"number"`, `"string"`, `"boolean"`, `"null"`, and
166
- * `"undefined"`), and the library will raise an error when the value is not
167
- * one of those types.
168
- */
169
- validate?: string | ((value: unknown) => void);
170
- };
171
- export { AttrSpec }
172
- export { AttrSpec as AttrSpec_alias_1 }
173
-
174
- /**
175
- * @internal
176
- */
177
- declare type BaseCommandsExtension = Extension<{
178
- Commands: {
179
- insertText: [options: InsertTextOptions];
180
- insertNode: [options: InsertNodeOptions];
181
- removeNode: [options: RemoveNodeOptions];
182
- wrap: [options: WrapOptions];
183
- toggleWrap: [options: ToggleWrapOptions];
184
- setBlockType: [options: SetBlockTypeOptions];
185
- setNodeAttrs: [options: SetNodeAttrsOptions];
186
- insertDefaultBlock: [options?: InsertDefaultBlockOptions];
187
- selectAll: [];
188
- addMark: [options: AddMarkOptions];
189
- removeMark: [options: RemoveMarkOptions];
190
- unsetBlockType: [options?: UnsetBlockTypeOptions];
191
- unsetMark: [options?: UnsetMarkOptions];
192
- };
193
- }>;
194
- export { BaseCommandsExtension }
195
- export { BaseCommandsExtension as BaseCommandsExtension_alias_1 }
196
-
197
- /**
198
- * @internal
199
- */
200
- export declare abstract class BaseExtension<T extends ExtensionTyping = ExtensionTyping> implements Extension<T> {
201
- abstract extension: Extension | Extension[];
202
- priority?: Priority;
203
- _type?: T;
204
- private trees;
205
- /**
206
- * @internal
207
- */
208
- abstract createTree(priority: Priority): FacetNode;
209
- /**
210
- * @internal
211
- */
212
- getTree(priority?: Priority): FacetNode;
213
- /**
214
- * @internal
215
- */
216
- findFacetOutput<I, O>(facet: Facet<I, O>): Tuple5<O | null> | null;
217
- get schema(): Schema | null;
218
- }
219
-
220
- /**
221
- * @internal
222
- */
223
- declare type BaseKeymapExtension = PlainExtension;
224
- export { BaseKeymapExtension }
225
- export { BaseKeymapExtension as BaseKeymapExtension_alias_1 }
226
-
227
- /**
228
- * Some basic props for custom node views.
229
- *
230
- * @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
231
- */
232
- declare interface BaseNodeViewOptions {
233
- /**
234
- * The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
235
- */
236
- as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
237
- /**
238
- * The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
239
- */
240
- contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
241
- update?: NodeView['update'];
242
- ignoreMutation?: NodeView['ignoreMutation'];
243
- selectNode?: NodeView['selectNode'];
244
- deselectNode?: NodeView['deselectNode'];
245
- setSelection?: NodeView['setSelection'];
246
- stopEvent?: NodeView['stopEvent'];
247
- destroy?: NodeView['destroy'];
248
- onUpdate?: () => void;
249
- }
250
- export { BaseNodeViewOptions }
251
- export { BaseNodeViewOptions as BaseNodeViewOptions_alias_1 }
252
-
253
- declare type BoldExtension = Extension<{
254
- Marks: {
255
- bold: Attrs;
256
- };
257
- }>;
258
-
259
- export declare function buildNode(type: NodeType, args: [Attrs | NodeChild | null | undefined, ...NodeChild[]], createNode: CreateNodeFunction): ProseMirrorNode;
260
-
261
- export declare function cache<T>(fn: () => T): () => T;
262
-
263
- declare const canUseRegexLookbehind: () => boolean;
264
- export { canUseRegexLookbehind }
265
- export { canUseRegexLookbehind as canUseRegexLookbehind_alias_1 }
266
-
267
- declare type ClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
268
- export { ClickHandler }
269
- export { ClickHandler as ClickHandler_alias_1 }
270
-
271
- declare type ClickOnHandler = (view: EditorView, pos: number, node: Node_2, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
272
- export { ClickOnHandler }
273
- export { ClickOnHandler as ClickOnHandler_alias_1 }
274
-
275
- /**
276
- * @internal
277
- */
278
- declare interface ClipboardSerializerOptions {
279
- serializeFragmentWrapper?: FunctionWrapper<SerializeFragmentFunction>;
280
- serializeNodeWrapper?: FunctionWrapper<SerializeNodeFunction>;
281
- nodesFromSchemaWrapper?: FunctionWrapper<NodesFromSchemaFunction>;
282
- marksFromSchemaWrapper?: FunctionWrapper<MarksFromSchemaFunction>;
283
- }
284
- export { ClipboardSerializerOptions }
285
- export { ClipboardSerializerOptions as ClipboardSerializerOptions_alias_1 }
286
-
287
- /**
288
- * A utility for constructing `className` strings conditionally.
289
- *
290
- * It is a re-export of [clsx/lite](https://www.npmjs.com/package/clsx) with stricter types.
291
- *
292
- * @public
293
- */
294
- declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
295
- export { clsx }
296
- export { clsx as clsx_alias_1 }
297
-
298
- declare type CodeBlockExtension = Extension<{
299
- Nodes: {
300
- codeBlock: {
301
- language: string;
302
- };
303
- };
304
- }>;
305
-
306
- /**
307
- * Collects all children of a node or a fragment, and returns them as an array.
308
- *
309
- * @public
310
- */
311
- declare function collectChildren(parent: ProseMirrorNode | Fragment): ProseMirrorNode[];
312
- export { collectChildren }
313
- export { collectChildren as collectChildren_alias_1 }
314
-
315
- /**
316
- * Collects all nodes from a given content.
317
- *
318
- * @deprecated Use `collectChildren` instead.
319
- *
320
- * @public
321
- */
322
- declare function collectNodes(content: NodeContent): ProseMirrorNode[];
323
- export { collectNodes }
324
- export { collectNodes as collectNodes_alias_1 }
325
-
326
- export declare function combineEventHandlers<Handler extends (...args: any[]) => boolean | void, Args extends Parameters<Handler> = Parameters<Handler>>(): [
327
- setHandlers: (eventHandlers: Handler[]) => void,
328
- combinedEventHandler: (...args: Args) => boolean
329
- ];
330
-
331
- /**
332
- * A function to apply a command to the editor. It will return `true` if the command was applied, and `false` otherwise.
333
- *
334
- * It also has a `canExec` method to check if the command can be applied.
335
- *
336
- * @public
337
- */
338
- declare interface CommandAction<Args extends any[] = any[]> {
339
- /**
340
- * Execute the current command. Return `true` if the command was successfully
341
- * executed, otherwise `false`.
342
- */
343
- (...args: Args): boolean;
344
- /**
345
- * Check if the current command can be executed. Return `true` if the command
346
- * can be executed, otherwise `false`.
347
- */
348
- canExec(...args: Args): boolean;
349
- /**
350
- * An alias for `canExec`.
351
- *
352
- * @deprecated Use `canExec` instead.
353
- */
354
- canApply(...args: Args): boolean;
355
- }
356
- export { CommandAction }
357
- export { CommandAction as CommandAction_alias_1 }
358
-
359
- export declare type CommandCreator<Args extends any[] = any[]> = (...arg: Args) => Command;
360
-
361
- export declare interface CommandCreators {
362
- [name: string]: CommandCreator;
363
- }
364
-
365
- export declare const commandFacet: Facet<CommandPayload, RootPayload>;
366
-
367
- export declare type CommandPayload = CommandCreators;
368
-
369
- /**
370
- * @internal
371
- */
372
- declare interface CommandTyping {
373
- [name: string]: any[];
374
- }
375
- export { CommandTyping }
376
- export { CommandTyping as CommandTyping_alias_1 }
377
-
378
- /**
379
- * @internal
380
- */
381
- declare function containsInlineNode(doc: ProseMirrorNode, from: number, to: number): boolean;
382
- export { containsInlineNode }
383
- export { containsInlineNode as containsInlineNode_alias_1 }
384
-
385
- /**
386
- * @public
387
- */
388
- declare function createEditor<E extends Extension>(options: EditorOptions<E>): Editor<E>;
389
- export { createEditor }
390
- export { createEditor as createEditor_alias_1 }
391
-
392
- /**
393
- * @internal
394
- */
395
- export declare function createMarkActions(schema: Schema, getState: GetStateFunction, applyMark?: ApplyMarkFunction): Record<string, MarkAction>;
396
-
397
- /**
398
- * @internal
399
- */
400
- export declare function createNodeActions(schema: Schema, getState: GetStateFunction, createNode?: CreateNodeFunction): Record<string, NodeAction>;
401
-
402
- export declare const createNodeForTest: CreateNodeFunction;
403
-
404
- /**
405
- * @internal
406
- */
407
- export declare type CreateNodeFunction = (type: NodeType, attrs: Attrs | null, children: ProseMirrorNode[]) => ProseMirrorNode;
408
-
409
- /**
410
- * @public
411
- */
412
- declare function createTestEditor<E extends Extension>(options: EditorOptions<E>): TestEditor<E>;
413
- export { createTestEditor }
414
- export { createTestEditor as createTestEditor_alias_1 }
415
-
416
- export declare function deepEquals<T>(a: T, b: T): boolean;
417
-
418
- /**
419
- * @internal
420
- */
421
- declare function defaultBlockAt(match: ContentMatch): NodeType_2 | null;
422
- export { defaultBlockAt }
423
- export { defaultBlockAt as defaultBlockAt_alias_1 }
424
-
425
- /**
426
- * @public
427
- */
428
- declare interface DefaultStateOptions {
429
- /**
430
- * The starting document to use when creating the editor. It can be a
431
- * ProseMirror node JSON object, a HTML string, or a HTML element instance.
432
- */
433
- defaultContent?: NodeJSON | string | HTMLElement;
434
- /**
435
- * A JSON object representing the starting document to use when creating the
436
- * editor.
437
- *
438
- * @deprecated Use `defaultContent` instead.
439
- */
440
- defaultDoc?: NodeJSON;
441
- /**
442
- * A HTML element or a HTML string representing the starting document to use
443
- * when creating the editor.
444
- *
445
- * @deprecated Use `defaultContent` instead.
446
- */
447
- defaultHTML?: string | HTMLElement;
448
- /**
449
- * A JSON object representing the starting selection to use when creating the
450
- * editor. It's only used when `defaultContent` is also provided.
451
- */
452
- defaultSelection?: SelectionJSON;
453
- }
454
- export { DefaultStateOptions }
455
- export { DefaultStateOptions as DefaultStateOptions_alias_1 }
456
-
457
- /**
458
- * Add some base commands
459
- *
460
- * @public
461
- */
462
- declare function defineBaseCommands(): BaseCommandsExtension;
463
- export { defineBaseCommands }
464
- export { defineBaseCommands as defineBaseCommands_alias_1 }
465
-
466
- /**
467
- * Defines some basic key bindings.
468
- *
469
- * @public
470
- */
471
- declare function defineBaseKeymap(options?: {
472
- /**
473
- * The priority of the keymap.
474
- *
475
- * @default Priority.low
476
- */
477
- priority?: Priority;
478
- }): BaseKeymapExtension;
479
- export { defineBaseKeymap }
480
- export { defineBaseKeymap as defineBaseKeymap_alias_1 }
481
-
482
- /**
483
- * @public
484
- *
485
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
486
- */
487
- declare function defineClickHandler(handler: ClickHandler): PlainExtension;
488
- export { defineClickHandler }
489
- export { defineClickHandler as defineClickHandler_alias_1 }
490
-
491
- /**
492
- * @public
493
- *
494
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
495
- */
496
- declare function defineClickOnHandler(handler: ClickOnHandler): PlainExtension;
497
- export { defineClickOnHandler }
498
- export { defineClickOnHandler as defineClickOnHandler_alias_1 }
499
-
500
- /**
501
- * @internal
502
- */
503
- declare function defineClipboardSerializer(options: ClipboardSerializerOptions): Extension;
504
- export { defineClipboardSerializer }
505
- export { defineClipboardSerializer as defineClipboardSerializer_alias_1 }
506
-
507
- declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
508
- Commands: {
509
- [K in keyof T]: Parameters<T[K]>;
510
- };
511
- }>;
512
- export { defineCommands }
513
- export { defineCommands as defineCommands_alias_1 }
514
-
515
- /**
516
- * Define a default state for the editor.
517
- *
518
- * @param options
519
- *
520
- * @public
521
- */
522
- declare function defineDefaultState({ defaultSelection, defaultContent, defaultDoc, defaultHTML, }: DefaultStateOptions): PlainExtension;
523
- export { defineDefaultState }
524
- export { defineDefaultState as defineDefaultState_alias_1 }
525
-
526
- /**
527
- * @public
528
- */
529
- declare function defineDoc(): DocExtension;
530
- export { defineDoc }
531
- export { defineDoc as defineDoc_alias_1 }
532
-
533
- /**
534
- * Registers a event handler that is called when the editor document is changed.
535
- *
536
- * @public
537
- */
538
- declare function defineDocChangeHandler(handler: DocChangeHandler): PlainExtension;
539
- export { defineDocChangeHandler }
540
- export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
541
-
542
- /**
543
- * @internal
544
- */
545
- export declare function defineDomEventFacetPayload(...payloads: DOMEventPayload[]): PlainExtension;
546
-
547
- /**
548
- * Register a new event handler for the given event type.
549
- *
550
- * @public
551
- */
552
- declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): PlainExtension;
553
- export { defineDOMEventHandler }
554
- export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
555
-
556
- /**
557
- * @public
558
- *
559
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
560
- */
561
- declare function defineDoubleClickHandler(handler: DoubleClickHandler): PlainExtension;
562
- export { defineDoubleClickHandler }
563
- export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
564
-
565
- /**
566
- * @public
567
- *
568
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
569
- */
570
- declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): PlainExtension;
571
- export { defineDoubleClickOnHandler }
572
- export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
573
-
574
- /**
575
- * @public
576
- *
577
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
578
- */
579
- declare function defineDropHandler(handler: DropHandler): PlainExtension;
580
- export { defineDropHandler }
581
- export { defineDropHandler as defineDropHandler_alias_1 }
582
-
583
- /**
584
- * @internal
585
- */
586
- declare function defineFacet<Input, Output>(options: {
587
- /**
588
- * The parent facet in the tree.
589
- */
590
- parent: Facet<Output, any>;
591
- /**
592
- * Set this to true if you only want to keep one facet payload. For example,
593
- * this facet corresponds to a ProseMirror plugin with a key.
594
- */
595
- singleton?: boolean;
596
- /**
597
- * A reducer is a function that accepts an array of input and produce a single
598
- * output.
599
- */
600
- reducer?: FacetReducer<Input, Output>;
601
- /**
602
- * A callback function that returns a reducer. This is useful if you want to
603
- * store something in the closure.
604
- */
605
- reduce?: () => FacetReducer<Input, Output>;
606
- }): Facet<Input, Output>;
607
- export { defineFacet }
608
- export { defineFacet as defineFacet_alias_1 }
609
-
610
- /**
611
- * @internal
612
- */
613
- declare function defineFacetPayload<Input>(facet: Facet<Input, any>, payloads: Input[]): Extension;
614
- export { defineFacetPayload }
615
- export { defineFacetPayload as defineFacetPayload_alias_1 }
616
-
617
- /**
618
- * Registers a event handler that is called when the editor gains or loses focus.
619
- *
620
- * @public
621
- */
622
- declare function defineFocusChangeHandler(handler: FocusChangeHandler): PlainExtension;
623
- export { defineFocusChangeHandler }
624
- export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
625
-
626
- /**
627
- * Add undo/redo history to the editor.
628
- *
629
- * @param options
630
- *
631
- * @public
632
- */
633
- declare function defineHistory({ depth, newGroupDelay, }?: HistoryOptions): HistoryExtension;
634
- export { defineHistory }
635
- export { defineHistory as defineHistory_alias_1 }
636
-
637
- /**
638
- * @public
639
- *
640
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
641
- */
642
- declare function defineKeyDownHandler(handler: KeyDownHandler): PlainExtension;
643
- export { defineKeyDownHandler }
644
- export { defineKeyDownHandler as defineKeyDownHandler_alias_1 }
645
-
646
- /**
647
- * @public
648
- */
649
- declare function defineKeymap(keymap: Keymap): PlainExtension;
650
- export { defineKeymap }
651
- export { defineKeymap as defineKeymap_alias_1 }
652
-
653
- /**
654
- * @public
655
- *
656
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
657
- */
658
- declare function defineKeyPressHandler(handler: KeyPressHandler): PlainExtension;
659
- export { defineKeyPressHandler }
660
- export { defineKeyPressHandler as defineKeyPressHandler_alias_1 }
661
-
662
- /**
663
- * @public
664
- */
665
- declare function defineMarkAttr<MarkType extends string = string, AttrName extends string = string, AttrType = any>(options: MarkAttrOptions<MarkType, AttrName, AttrType>): Extension<{
666
- Marks: {
667
- [K in MarkType]: AttrType;
668
- };
669
- }>;
670
- export { defineMarkAttr }
671
- export { defineMarkAttr as defineMarkAttr_alias_1 }
672
-
673
- /**
674
- * @public
675
- */
676
- declare function defineMarkSpec<Mark extends string, Attrs extends AnyAttrs = AnyAttrs>(options: MarkSpecOptions<Mark, Attrs>): Extension<{
677
- Marks: {
678
- [K in Mark]: Attrs;
679
- };
680
- }>;
681
- export { defineMarkSpec }
682
- export { defineMarkSpec as defineMarkSpec_alias_1 }
683
-
684
- declare function defineMarkView(options: MarkViewOptions): Extension;
685
- export { defineMarkView }
686
- export { defineMarkView as defineMarkView_alias_1 }
687
-
688
- /**
689
- * @internal
690
- */
691
- declare function defineMarkViewComponent<T>(options: MarkViewComponentOptions<T>): Extension;
692
- export { defineMarkViewComponent }
693
- export { defineMarkViewComponent as defineMarkViewComponent_alias_1 }
694
-
695
- /**
696
- * @internal
697
- */
698
- declare function defineMarkViewFactory<T>(options: MarkViewFactoryOptions<T>): Extension;
699
- export { defineMarkViewFactory }
700
- export { defineMarkViewFactory as defineMarkViewFactory_alias_1 }
701
-
702
- /**
703
- * Registers a event handler that is called when the editor view is mounted.
704
- *
705
- * @public
706
- */
707
- declare function defineMountHandler(handler: MountHandler): PlainExtension;
708
- export { defineMountHandler }
709
- export { defineMountHandler as defineMountHandler_alias_1 }
710
-
711
- /**
712
- * Defines an attribute for a node type.
713
- *
714
- * @public
715
- */
716
- declare function defineNodeAttr<NodeType extends string = string, AttrName extends string = string, AttrType = any>(options: NodeAttrOptions<NodeType, AttrName, AttrType>): Extension<{
717
- Nodes: {
718
- [K in NodeType]: {
719
- [K in AttrName]: AttrType;
720
- };
721
- };
722
- }>;
723
- export { defineNodeAttr }
724
- export { defineNodeAttr as defineNodeAttr_alias_1 }
725
-
726
- /**
727
- * Defines a node type.
728
- *
729
- * @public
730
- */
731
- declare function defineNodeSpec<Node extends string, Attrs extends AnyAttrs = AnyAttrs>(options: NodeSpecOptions<Node, Attrs>): Extension<{
732
- Nodes: {
733
- [K in Node]: Attrs;
734
- };
735
- }>;
736
- export { defineNodeSpec }
737
- export { defineNodeSpec as defineNodeSpec_alias_1 }
738
-
739
- declare function defineNodeView(options: NodeViewOptions): Extension;
740
- export { defineNodeView }
741
- export { defineNodeView as defineNodeView_alias_1 }
742
-
743
- /**
744
- * @internal
745
- */
746
- declare function defineNodeViewComponent<T>(options: NodeViewComponentOptions<T>): Extension;
747
- export { defineNodeViewComponent }
748
- export { defineNodeViewComponent as defineNodeViewComponent_alias_1 }
749
-
750
- /**
751
- * @internal
752
- */
753
- declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
754
- export { defineNodeViewFactory }
755
- export { defineNodeViewFactory as defineNodeViewFactory_alias_1 }
756
-
757
- /**
758
- * @public
759
- *
760
- * Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
761
- */
762
- declare function defineParagraph(): ParagraphExtension;
763
- export { defineParagraph }
764
- export { defineParagraph as defineParagraph_alias_1 }
765
-
766
- /**
767
- * @public
768
- *
769
- * Defines a paragraph node spec.
770
- */
771
- export declare function defineParagraphSpec(): ParagraphSpecExtension;
772
-
773
- /**
774
- * @public
775
- *
776
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
777
- */
778
- declare function definePasteHandler(handler: PasteHandler): PlainExtension;
779
- export { definePasteHandler }
780
- export { definePasteHandler as definePasteHandler_alias_1 }
781
-
782
- /**
783
- * Adds a ProseMirror plugin to the editor.
784
- *
785
- * @param plugin - The ProseMirror plugin to add, or an array of plugins, or a
786
- * function that returns one or multiple plugins.
787
- *
788
- * @public
789
- */
790
- declare function definePlugin(plugin: Plugin_2 | Plugin_2[] | ((context: {
791
- schema: Schema;
792
- }) => Plugin_2 | Plugin_2[])): PlainExtension;
793
- export { definePlugin }
794
- export { definePlugin as definePlugin_alias_1 }
795
-
796
- /**
797
- * @public
798
- *
799
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
800
- */
801
- declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): PlainExtension;
802
- export { defineScrollToSelectionHandler }
803
- export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_1 }
804
-
805
- /**
806
- * @internal
807
- */
808
- export declare function defineTestExtension(): Union_2<readonly [BaseCommandsExtension_2, PlainExtension_2, DocExtension_2, HistoryExtension_2, Extension<{
809
- Nodes: {
810
- paragraph: Attrs;
811
- };
812
- }>, TextExtension_2, BoldExtension, ItalicExtension, LinkExtension, HeadingExtension, CodeBlockExtension]>;
813
-
814
- /**
815
- * @public
816
- */
817
- declare function defineText(): TextExtension;
818
- export { defineText }
819
- export { defineText as defineText_alias_1 }
820
-
821
- /**
822
- * @public
823
- *
824
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
825
- */
826
- declare function defineTextInputHandler(handler: TextInputHandler): PlainExtension;
827
- export { defineTextInputHandler }
828
- export { defineTextInputHandler as defineTextInputHandler_alias_1 }
829
-
830
- /**
831
- * @public
832
- *
833
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
834
- */
835
- declare function defineTripleClickHandler(handler: TripleClickHandler): PlainExtension;
836
- export { defineTripleClickHandler }
837
- export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
838
-
839
- /**
840
- * @public
841
- *
842
- * See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
843
- */
844
- declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): PlainExtension;
845
- export { defineTripleClickOnHandler }
846
- export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
847
-
848
- /**
849
- * Registers a event handler that is called when the editor view is unmounted.
850
- *
851
- * @public
852
- */
853
- declare function defineUnmountHandler(handler: UnmountHandler): PlainExtension;
854
- export { defineUnmountHandler }
855
- export { defineUnmountHandler as defineUnmountHandler_alias_1 }
856
-
857
- /**
858
- * Registers a event handler that is called when the editor state is updated.
859
- *
860
- * @public
861
- */
862
- declare function defineUpdateHandler(handler: UpdateHandler): PlainExtension;
863
- export { defineUpdateHandler }
864
- export { defineUpdateHandler as defineUpdateHandler_alias_1 }
865
-
866
- /**
867
- * A function that is called when the editor document is changed.
868
- *
869
- * @param view - The editor view.
870
- * @param prevState - The previous editor state.
871
- *
872
- * @public
873
- */
874
- declare type DocChangeHandler = (view: EditorView, prevState: EditorState) => void;
875
- export { DocChangeHandler }
876
- export { DocChangeHandler as DocChangeHandler_alias_1 }
877
-
878
- /**
879
- * @internal
880
- */
881
- declare type DocExtension = Extension<{
882
- Nodes: {
883
- doc: Attrs;
884
- };
885
- }>;
886
- export { DocExtension }
887
- export { DocExtension as DocExtension_alias_1 }
888
-
889
- /**
890
- * @internal
891
- */
892
- export declare class DOMDocumentNotFoundError extends ProseKitError {
893
- constructor();
894
- }
895
-
896
- /** @public */
897
- declare interface DOMDocumentOptions {
898
- /**
899
- * The Document object to use for DOM operations. If not provided, defaults to
900
- * the current browser's document object. Useful for server-side rendering or
901
- * testing environments.
902
- */
903
- document?: Document;
904
- }
905
- export { DOMDocumentOptions }
906
- export { DOMDocumentOptions as DOMDocumentOptions_alias_1 }
907
-
908
- /**
909
- * @internal
910
- */
911
- export declare const domEventFacet: Facet<DOMEventPayload, PluginPayload>;
912
-
913
- /**
914
- * A function to handle the events fired on the editable DOM element. Returns
915
- * `true` to indicate that it handled the given event. you are responsible for
916
- * calling `preventDefault` yourself (or not, if you want to allow the default
917
- * behavior).
918
- *
919
- * @public
920
- */
921
- declare type DOMEventHandler<Event extends keyof DOMEventMap = string> = (view: EditorView, event: DOMEventMap[Event]) => boolean | void;
922
- export { DOMEventHandler }
923
- export { DOMEventHandler as DOMEventHandler_alias_1 }
924
-
925
- /**
926
- * @internal
927
- */
928
- export declare type DOMEventPayload = [event: string, handler: DOMEventHandler];
929
-
930
- export declare type DOMNode = InstanceType<typeof window.Node>;
931
-
932
- /** @public */
933
- declare interface DOMParserOptions extends ParseOptions {
934
- DOMParser?: typeof DOMParser_2;
935
- }
936
- export { DOMParserOptions }
937
- export { DOMParserOptions as DOMParserOptions_alias_1 }
938
-
939
- /** @public */
940
- declare interface DOMSerializerOptions {
941
- DOMSerializer?: {
942
- fromSchema: typeof DOMSerializer.fromSchema;
943
- };
944
- }
945
- export { DOMSerializerOptions }
946
- export { DOMSerializerOptions as DOMSerializerOptions_alias_1 }
947
-
948
- declare type DoubleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
949
- export { DoubleClickHandler }
950
- export { DoubleClickHandler as DoubleClickHandler_alias_1 }
951
-
952
- declare type DoubleClickOnHandler = (view: EditorView, pos: number, node: Node_2, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
953
- export { DoubleClickOnHandler }
954
- export { DoubleClickOnHandler as DoubleClickOnHandler_alias_1 }
955
-
956
- declare type DropHandler = (view: EditorView, event: DragEvent, slice: Slice, moved: boolean) => boolean | void;
957
- export { DropHandler }
958
- export { DropHandler as DropHandler_alias_1 }
959
-
960
- /**
961
- * @public
962
- */
963
- declare class Editor<E extends Extension = any> {
964
- private instance;
965
- /**
966
- * @internal
967
- */
968
- constructor(instance: EditorInstance);
969
- /**
970
- * Whether the editor is mounted.
971
- */
972
- get mounted(): boolean;
973
- /**
974
- * The editor view.
975
- */
976
- get view(): EditorView;
977
- /**
978
- * The editor schema.
979
- */
980
- get schema(): Schema<ExtractNodeNames<E>, ExtractMarkNames<E>>;
981
- /**
982
- * The editor's current state.
983
- */
984
- get state(): EditorState;
985
- /**
986
- * Whether the editor is focused.
987
- */
988
- get focused(): boolean;
989
- /**
990
- * Mount the editor to the given HTML element.
991
- * Pass `null` or `undefined` to unmount the editor.
992
- */
993
- mount: (place: HTMLElement | null | undefined) => void;
994
- /**
995
- * Unmount the editor. This is equivalent to `mount(null)`.
996
- */
997
- unmount: () => void;
998
- /**
999
- * Focus the editor.
1000
- */
1001
- focus: () => void;
1002
- /**
1003
- * Blur the editor.
1004
- */
1005
- blur: () => void;
1006
- /**
1007
- * Register an extension to the editor. Return a function to unregister the
1008
- * extension.
1009
- */
1010
- use: (extension: Extension) => VoidFunction;
1011
- /**
1012
- * Update the editor's state.
1013
- *
1014
- * @remarks
1015
- *
1016
- * This is an advanced method. Use it only if you have a specific reason to
1017
- * directly manipulate the editor's state.
1018
- */
1019
- updateState: (state: EditorState) => void;
1020
- /**
1021
- * Update the editor's document and selection.
1022
- *
1023
- * @param content - The new document to set. It can be one of the following:
1024
- * - A ProseMirror node instance
1025
- * - A ProseMirror node JSON object
1026
- * - An HTML string
1027
- * - An HTML element instance
1028
- * @param selection - Optional. Specifies the new selection. It can be one of the following:
1029
- * - A ProseMirror selection instance
1030
- * - A ProseMirror selection JSON object
1031
- * - The string "start" (to set selection at the beginning, default value)
1032
- * - The string "end" (to set selection at the end)
1033
- */
1034
- setContent: (content: ProseMirrorNode | NodeJSON | string | HTMLElement, selection?: SelectionJSON | Selection_2 | "start" | "end") => void;
1035
- /**
1036
- * Return a JSON object representing the editor's current document.
1037
- */
1038
- getDocJSON: () => NodeJSON;
1039
- /**
1040
- * Return a HTML string representing the editor's current document.
1041
- */
1042
- getDocHTML: (options?: getDocHTMLOptions) => string;
1043
- /**
1044
- * Execute the given command. Return `true` if the command was successfully
1045
- * executed, otherwise `false`.
1046
- */
1047
- exec: (command: Command) => boolean;
1048
- /**
1049
- * Check if the given command can be executed. Return `true` if the command
1050
- * can be executed, otherwise `false`.
1051
- */
1052
- canExec: (command: Command) => boolean;
1053
- /**
1054
- * All {@link CommandAction}s defined by the editor.
1055
- */
1056
- get commands(): ExtractCommandActions<E>;
1057
- /**
1058
- * All {@link NodeAction}s defined by the editor.
1059
- */
1060
- get nodes(): ExtractNodeActions<E>;
1061
- /**
1062
- * All {@link MarkAction}s defined by the editor.
1063
- */
1064
- get marks(): ExtractMarkActions<E>;
1065
- }
1066
- export { Editor }
1067
- export { Editor as Editor_alias_1 }
1068
-
1069
- /**
1070
- * @internal
1071
- */
1072
- declare const editorEventFacet: Facet_2<EditorEventPayload, PluginPayload>;
1073
- export { editorEventFacet }
1074
- export { editorEventFacet as editorEventFacet_alias_1 }
1075
-
1076
- declare interface EditorEventMap {
1077
- keyDown: KeyDownHandler;
1078
- keyPress: KeyPressHandler;
1079
- textInput: TextInputHandler;
1080
- clickOn: ClickOnHandler;
1081
- click: ClickHandler;
1082
- doubleClickOn: DoubleClickOnHandler;
1083
- doubleClick: DoubleClickHandler;
1084
- tripleClickOn: TripleClickOnHandler;
1085
- tripleClick: TripleClickHandler;
1086
- paste: PasteHandler;
1087
- drop: DropHandler;
1088
- scrollToSelection: ScrollToSelectionHandler;
1089
- }
1090
-
1091
- /**
1092
- * @internal
1093
- */
1094
- declare type EditorEventPayload = ObjectEntries<EditorEventMap>;
1095
- export { EditorEventPayload }
1096
- export { EditorEventPayload as EditorEventPayload_alias_1 }
1097
-
1098
- /**
1099
- * An internal class to make TypeScript generic type easier to use.
1100
- *
1101
- * @internal
1102
- */
1103
- export declare class EditorInstance {
1104
- view: EditorView | null;
1105
- schema: Schema;
1106
- nodes: Record<string, NodeAction>;
1107
- marks: Record<string, MarkAction>;
1108
- commands: Record<string, CommandAction>;
1109
- private tree;
1110
- private directEditorProps;
1111
- private afterMounted;
1112
- constructor(extension: Extension);
1113
- getState: () => EditorState;
1114
- private getDoc;
1115
- private getProp;
1116
- updateState(state: EditorState): void;
1117
- private dispatch;
1118
- setContent(content: NodeJSON | string | HTMLElement | ProseMirrorNode, selection?: SelectionJSON | Selection_2 | 'start' | 'end'): void;
1119
- /**
1120
- * Return a JSON object representing the editor's current document.
1121
- */
1122
- getDocJSON: () => NodeJSON;
1123
- /**
1124
- * Return a HTML string representing the editor's current document.
1125
- */
1126
- getDocHTML: (options?: getDocHTMLOptions) => string;
1127
- private updateExtension;
1128
- use(extension: Extension): VoidFunction;
1129
- mount(place: HTMLElement): void;
1130
- unmount(): void;
1131
- get mounted(): boolean;
1132
- get assertView(): EditorView;
1133
- definePlugins(plugins: readonly Plugin_2[]): void;
1134
- removePlugins(plugins: readonly Plugin_2[]): void;
1135
- exec(command: Command): boolean;
1136
- canExec(command: Command): boolean;
1137
- defineCommand<Args extends any[] = any[]>(name: string, commandCreator: CommandCreator<Args>): void;
1138
- removeCommand(name: string): void;
1139
- }
1140
-
1141
- /**
1142
- * @internal
1143
- */
1144
- declare class EditorNotFoundError extends ProseKitError {
1145
- constructor();
1146
- }
1147
- export { EditorNotFoundError }
1148
- export { EditorNotFoundError as EditorNotFoundError_alias_1 }
1149
-
1150
- /**
1151
- * @public
1152
- */
1153
- declare interface EditorOptions<E extends Extension> {
1154
- /**
1155
- * The extension to use when creating the editor.
1156
- */
1157
- extension: E;
1158
- /**
1159
- * The starting document to use when creating the editor. It can be a
1160
- * ProseMirror node JSON object, a HTML string, or a HTML element instance.
1161
- */
1162
- defaultContent?: NodeJSON | string | HTMLElement;
1163
- /**
1164
- * A JSON object representing the starting document to use when creating the
1165
- * editor.
1166
- *
1167
- * @deprecated Use `defaultContent` instead.
1168
- */
1169
- defaultDoc?: NodeJSON;
1170
- /**
1171
- * A HTML element or a HTML string representing the starting document to use
1172
- * when creating the editor.
1173
- *
1174
- * @deprecated Use `defaultContent` instead.
1175
- */
1176
- defaultHTML?: string | HTMLElement;
1177
- /**
1178
- * A JSON object representing the starting selection to use when creating the
1179
- * editor. It's only used when `defaultContent` is also provided.
1180
- */
1181
- defaultSelection?: SelectionJSON;
1182
- }
1183
- export { EditorOptions }
1184
- export { EditorOptions as EditorOptions_alias_1 }
1185
-
1186
- /**
1187
- * Parse a HTML string to a HTML element.
1188
- *
1189
- * @internal
1190
- */
1191
- export declare function elementFromHTML(html: string, options?: DOMDocumentOptions): HTMLElement;
1192
-
1193
- /**
1194
- * Parse a ProseMirror document JSON object to a HTML element.
1195
- *
1196
- * @public
1197
- */
1198
- declare function elementFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
1199
- export { elementFromJSON }
1200
- export { elementFromJSON as elementFromJSON_alias_1 }
1201
-
1202
- /**
1203
- * Serialize a ProseMirror node to a HTML element.
1204
- *
1205
- * @public
1206
- */
1207
- declare function elementFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
1208
- export { elementFromNode }
1209
- export { elementFromNode as elementFromNode_alias_1 }
1210
-
1211
- /**
1212
- * Expands the selection to include the entire mark at the current position.
1213
- *
1214
- * @public
1215
- */
1216
- declare function expandMark(options: ExpandMarkOptions): Command;
1217
- export { expandMark }
1218
- export { expandMark as expandMark_alias_1 }
1219
-
1220
- /**
1221
- * @public
1222
- */
1223
- declare interface ExpandMarkOptions {
1224
- /**
1225
- * The type of the mark to expand.
1226
- */
1227
- type: string | MarkType;
1228
- }
1229
- export { ExpandMarkOptions }
1230
- export { ExpandMarkOptions as ExpandMarkOptions_alias_1 }
1231
-
1232
- /**
1233
- * @public
1234
- */
1235
- declare interface Extension<T extends ExtensionTyping<any, any, any> = ExtensionTyping<any, any, any>> {
1236
- extension: Extension | Extension[];
1237
- priority?: Priority;
1238
- _type?: T;
1239
- /**
1240
- * @public
1241
- *
1242
- * The schema that this extension represents.
1243
- */
1244
- schema: Schema | null;
1245
- }
1246
- export { Extension }
1247
- export { Extension as Extension_alias_1 }
1248
-
1249
- /**
1250
- * @internal
1251
- */
1252
- declare interface ExtensionTyping<N extends NodeTyping | never = never, M extends MarkTyping | never = never, C extends CommandTyping | never = never> {
1253
- Nodes?: N;
1254
- Marks?: M;
1255
- Commands?: C;
1256
- }
1257
- export { ExtensionTyping }
1258
- export { ExtensionTyping as ExtensionTyping_alias_1 }
1259
-
1260
- /**
1261
- * Extracts the {@link CommandAction}s from an extension type.
1262
- *
1263
- * @public
1264
- */
1265
- declare type ExtractCommandActions<E extends Extension> = ToCommandAction<ExtractCommands<E>>;
1266
- export { ExtractCommandActions }
1267
- export { ExtractCommandActions as ExtractCommandActions_alias_1 }
1268
-
1269
- /**
1270
- * @deprecated Use `ExtractCommandActions` instead.
1271
- */
1272
- declare type ExtractCommandAppliers<E extends Extension> = ExtractCommandActions<E>;
1273
- export { ExtractCommandAppliers }
1274
- export { ExtractCommandAppliers as ExtractCommandAppliers_alias_1 }
1275
-
1276
- /**
1277
- * @public
1278
- */
1279
- declare type ExtractCommandCreators<E extends Extension> = ToCommandCreators<ExtractCommands<E>>;
1280
- export { ExtractCommandCreators }
1281
- export { ExtractCommandCreators as ExtractCommandCreators_alias_1 }
1282
-
1283
- /**
1284
- * @internal
1285
- */
1286
- export declare type ExtractCommands<E extends Extension> = SimplifyUnion<ExtractTyping<E>['Commands']>;
1287
-
1288
- /**
1289
- * Extracts the {@link MarkAction}s from an extension type.
1290
- *
1291
- * @public
1292
- */
1293
- declare type ExtractMarkActions<E extends Extension> = ToMarkAction<ExtractMarks<E>>;
1294
- export { ExtractMarkActions }
1295
- export { ExtractMarkActions as ExtractMarkActions_alias_1 }
1296
-
1297
- /**
1298
- * @public
1299
- */
1300
- export declare type ExtractMarkNames<E extends Extension> = PickStringLiteral<keyof ExtractMarks<E>>;
1301
-
1302
- /**
1303
- * @public
1304
- */
1305
- declare type ExtractMarks<E extends Extension> = SimplifyDeeper<SimplifyUnion<ExtractTyping<E>['Marks']>>;
1306
- export { ExtractMarks }
1307
- export { ExtractMarks as ExtractMarks_alias_1 }
1308
-
1309
- /**
1310
- * Extracts the {@link NodeAction}s from an extension type.
1311
- *
1312
- * @public
1313
- */
1314
- declare type ExtractNodeActions<E extends Extension> = ToNodeAction<ExtractNodes<E>>;
1315
- export { ExtractNodeActions }
1316
- export { ExtractNodeActions as ExtractNodeActions_alias_1 }
1317
-
1318
- /**
1319
- * @public
1320
- */
1321
- export declare type ExtractNodeNames<E extends Extension> = PickStringLiteral<keyof ExtractNodes<E>>;
1322
-
1323
- /**
1324
- * @public
1325
- */
1326
- declare type ExtractNodes<E extends Extension> = SimplifyDeeper<SimplifyUnion<ExtractTyping<E>['Nodes']>>;
1327
- export { ExtractNodes }
1328
- export { ExtractNodes as ExtractNodes_alias_1 }
1329
-
1330
- export declare function extractTags(node: TaggedProseMirrorNode): Record<string, number>;
1331
-
1332
- /**
1333
- * @internal
1334
- */
1335
- export declare type ExtractTyping<E extends Extension> = E extends Extension<ExtensionTyping<infer N, infer M, infer C>> ? ExtensionTyping<PickSubType<N, NodeTyping>, PickSubType<M, MarkTyping>, PickSubType<C, CommandTyping>> : never;
1336
-
1337
- /**
1338
- * @internal
1339
- */
1340
- declare class Facet<Input, Output> {
1341
- private _reducer?;
1342
- private _reduce?;
1343
- /**
1344
- * @internal
1345
- */
1346
- readonly index: number;
1347
- /**
1348
- * @internal
1349
- */
1350
- readonly parent: Facet<Output, any> | null;
1351
- /**
1352
- * @internal
1353
- */
1354
- readonly singleton: boolean;
1355
- /**
1356
- * A index path to retrieve the current facet in a tree from the root.
1357
- *
1358
- * @internal
1359
- */
1360
- readonly path: number[];
1361
- /**
1362
- * @internal
1363
- */
1364
- constructor(parent: Facet<Output, any> | null, singleton: boolean, _reducer?: FacetReducer<Input, Output> | undefined, _reduce?: (() => FacetReducer<Input, Output>) | undefined);
1365
- get reducer(): FacetReducer<Input, Output>;
1366
- }
1367
- export { Facet }
1368
- export { Facet as Facet_alias_1 }
1369
-
1370
- /**
1371
- * @internal
1372
- */
1373
- export declare class FacetExtensionImpl<Input, Output> extends BaseExtension {
1374
- readonly facet: Facet<Input, Output>;
1375
- readonly payloads: Input[];
1376
- extension: Extension;
1377
- /**
1378
- * @internal
1379
- */
1380
- constructor(facet: Facet<Input, Output>, payloads: Input[]);
1381
- /**
1382
- * @internal
1383
- */
1384
- createTree(priority: Priority): FacetNode;
1385
- }
1386
-
1387
- export declare class FacetNode<I = any, O = any> {
1388
- readonly facet: Facet<I, O>;
1389
- readonly inputs: Tuple5<I[] | null>;
1390
- readonly children: Map<number, FacetNode>;
1391
- readonly reducers: Tuple5<FacetReducer<I, O> | null>;
1392
- output: Tuple5<O | null> | null;
1393
- constructor(facet: Facet<I, O>, inputs?: Tuple5<I[] | null>, children?: Map<number, FacetNode>, reducers?: Tuple5<FacetReducer<I, O> | null>);
1394
- private calcOutput;
1395
- getOutput(): Tuple5<O | null>;
1396
- getSingletonOutput(): O | null;
1397
- getRootOutput(): RootOutput;
1398
- isRoot(): boolean;
1399
- }
1400
-
1401
- /**
1402
- * @internal
1403
- */
1404
- export declare type FacetReducer<Input, Output> = (input: Input[]) => Output;
1405
-
1406
- export declare function findBrowserDocument(options?: {
1407
- document?: Document;
1408
- }): Document | undefined;
1409
-
1410
- export declare function findBrowserWindow(options?: {
1411
- document?: Document;
1412
- }): (Window & typeof globalThis) | undefined;
1413
-
1414
- /**
1415
- * Find the closest parent node that satisfies the predicate.
1416
- *
1417
- * @public
1418
- */
1419
- declare function findParentNode(
1420
- /**
1421
- * The predicate to test the parent node.
1422
- */
1423
- predicate: (node: ProseMirrorNode) => boolean,
1424
- /**
1425
- * The position to start searching from.
1426
- */
1427
- $pos: ResolvedPos): FindParentNodeResult | undefined;
1428
- export { findParentNode }
1429
- export { findParentNode as findParentNode_alias_1 }
1430
-
1431
- /**
1432
- * Finds the closest parent node that matches the given node type.
1433
- *
1434
- * @public
1435
- */
1436
- declare function findParentNodeOfType(
1437
- /**
1438
- * The type of the node to find.
1439
- */
1440
- type: NodeType | string,
1441
- /**
1442
- * The position to start searching from.
1443
- */
1444
- $pos: ResolvedPos): FindParentNodeResult | undefined;
1445
- export { findParentNodeOfType }
1446
- export { findParentNodeOfType as findParentNodeOfType_alias_1 }
1447
-
1448
- /**
1449
- * @public
1450
- */
1451
- declare interface FindParentNodeResult {
1452
- /**
1453
- * The closest parent node that satisfies the predicate.
1454
- */
1455
- node: ProseMirrorNode;
1456
- /**
1457
- * The position directly before the node.
1458
- */
1459
- pos: number;
1460
- /**
1461
- * The position at the start of the node.
1462
- */
1463
- start: number;
1464
- /**
1465
- * The depth of the node.
1466
- */
1467
- depth: number;
1468
- }
1469
- export { FindParentNodeResult }
1470
- export { FindParentNodeResult as FindParentNodeResult_alias_1 }
1471
-
1472
- /**
1473
- * A function that is called when the editor gains or loses focus.
1474
- *
1475
- * @param hasFocus - Whether the editor has focus.
1476
- *
1477
- * @public
1478
- */
1479
- declare type FocusChangeHandler = (hasFocus: boolean) => void;
1480
- export { FocusChangeHandler }
1481
- export { FocusChangeHandler as FocusChangeHandler_alias_1 }
1482
-
1483
- declare type FunctionWrapper<T extends AnyFunction> = (fn: T) => T;
1484
-
1485
- export declare function getBrowserDocument(options?: {
1486
- document?: Document;
1487
- }): Document;
1488
-
1489
- export declare function getBrowserWindow(options?: {
1490
- document?: Document;
1491
- }): Window & typeof globalThis;
1492
-
1493
- export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_2;
1494
-
1495
- /**
1496
- * @public
1497
- */
1498
- export declare interface getDocHTMLOptions extends DOMDocumentOptions {
1499
- }
1500
-
1501
- export declare function getEditorContentDoc(schema: Schema, content: NodeJSON | string | HTMLElement | ProseMirrorNode): ProseMirrorNode;
1502
-
1503
- export declare function getEditorContentJSON(schema: Schema, content: NodeJSON | string | HTMLElement): NodeJSON;
1504
-
1505
- export declare function getEditorContentNode(schema: Schema, content: NodeJSON | string | HTMLElement | ProseMirrorNode): ProseMirrorNode;
1506
-
1507
- export declare function getEditorSelection(doc: ProseMirrorNode, selection: SelectionJSON | Selection_2 | 'start' | 'end'): Selection_2;
1508
-
1509
- /**
1510
- * Returns a unique id in the current process that can be used in various places.
1511
- *
1512
- * @internal
1513
- */
1514
- declare function getId(): string;
1515
- export { getId as _getId }
1516
- export { getId }
1517
-
1518
- /**
1519
- * @internal
1520
- */
1521
- declare function getMarkType(schema: Schema, type: string | MarkType): MarkType;
1522
- export { getMarkType }
1523
- export { getMarkType as getMarkType_alias_1 }
1524
-
1525
- /**
1526
- * @internal
1527
- */
1528
- declare function getNodeType(schema: Schema, type: string | NodeType): NodeType;
1529
- export { getNodeType }
1530
- export { getNodeType as getNodeType_alias_1 }
1531
-
1532
- /**
1533
- * @internal
1534
- */
1535
- export declare function getNodeTypes(schema: Schema, types: string | NodeType | string[] | NodeType[]): NodeType[];
1536
-
1537
- declare type GetStateFunction = () => EditorState | null | undefined;
1538
-
1539
- export declare function groupBy<K extends PropertyKey, T>(items: Iterable<T>, keySelector: (item: T) => K): Partial<Record<K, T[]>>;
1540
-
1541
- export declare function groupEntries<T extends Record<string, any>>(entries: ObjectEntries<T>[]): {
1542
- [K in keyof T]?: T[K][];
1543
- };
1544
-
1545
- declare type HeadingExtension = Extension<{
1546
- Nodes: {
1547
- heading: Attrs;
1548
- };
1549
- }>;
1550
-
1551
- /**
1552
- * @internal
1553
- */
1554
- declare type HistoryExtension = Extension<{
1555
- Commands: {
1556
- undo: [];
1557
- redo: [];
1558
- };
1559
- }>;
1560
- export { HistoryExtension }
1561
- export { HistoryExtension as HistoryExtension_alias_1 }
1562
-
1563
- /**
1564
- * Options for {@link defineHistory}.
1565
- *
1566
- * @public
1567
- */
1568
- declare interface HistoryOptions {
1569
- /**
1570
- * The amount of history events that are collected before the oldest events
1571
- * are discarded.
1572
- *
1573
- * @default 200
1574
- */
1575
- depth?: number;
1576
- /**
1577
- * The delay in milliseconds between changes after which a new group should be
1578
- * started.
1579
- *
1580
- * @default 250
1581
- */
1582
- newGroupDelay?: number;
1583
- }
1584
- export { HistoryOptions }
1585
- export { HistoryOptions as HistoryOptions_alias_1 }
1586
-
1587
- /**
1588
- * @internal
1589
- */
1590
- export declare function htmlFromElement(element: HTMLElement): string;
1591
-
1592
- /**
1593
- * Parse a ProseMirror document JSON object to a HTML string.
1594
- *
1595
- * @public
1596
- */
1597
- declare function htmlFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): string;
1598
- export { htmlFromJSON }
1599
- export { htmlFromJSON as htmlFromJSON_alias_1 }
1600
-
1601
- /**
1602
- * Serialize a ProseMirror node to a HTML string
1603
- *
1604
- * @public
1605
- */
1606
- declare function htmlFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): string;
1607
- export { htmlFromNode }
1608
- export { htmlFromNode as htmlFromNode_alias_1 }
1609
-
1610
- export declare function includesMark(marks: readonly Mark[], markType: MarkType, attrs?: Attrs | null): boolean;
1611
-
1612
- export declare function inputText(input: string): Promise<void>;
1613
-
1614
- /**
1615
- * Returns a command that inserts a default block after current selection or at
1616
- * the given position.
1617
- *
1618
- * @public
1619
- */
1620
- declare function insertDefaultBlock(options?: InsertDefaultBlockOptions): Command;
1621
- export { insertDefaultBlock }
1622
- export { insertDefaultBlock as insertDefaultBlock_alias_1 }
1623
-
1624
- /**
1625
- * @public
1626
- */
1627
- declare interface InsertDefaultBlockOptions {
1628
- /**
1629
- * The position to insert the node at. By default it will insert after the
1630
- * current selection.
1631
- */
1632
- pos?: number;
1633
- }
1634
- export { InsertDefaultBlockOptions }
1635
- export { InsertDefaultBlockOptions as InsertDefaultBlockOptions_alias_1 }
1636
-
1637
- /**
1638
- * Returns a command that inserts the given node at the current selection or at
1639
- * the given position.
1640
- *
1641
- * @public
1642
- */
1643
- declare function insertNode(options: InsertNodeOptions): Command;
1644
- export { insertNode }
1645
- export { insertNode as insertNode_alias_1 }
1646
-
1647
- export declare function insertNodeAction({ node, pos, }: {
1648
- node: ProseMirrorNode;
1649
- pos?: number;
1650
- }): Action;
1651
-
1652
- /**
1653
- * @public
1654
- */
1655
- declare interface InsertNodeOptions {
1656
- /**
1657
- * The node to insert. Either this or `type` must be provided.
1658
- */
1659
- node?: ProseMirrorNode;
1660
- /**
1661
- * The type of the node to insert. Either this or `node` must be provided.
1662
- */
1663
- type?: string | NodeType;
1664
- /**
1665
- * When `type` is provided, the attributes of the node to insert.
1666
- */
1667
- attrs?: Attrs;
1668
- /**
1669
- * The position to insert the node at. By default it will be the anchor
1670
- * position of current selection.
1671
- */
1672
- pos?: number;
1673
- }
1674
- export { InsertNodeOptions }
1675
- export { InsertNodeOptions as InsertNodeOptions_alias_1 }
1676
-
1677
- export declare function insertOutputSpecAttrs(dom: DOMOutputSpec, attrs: Array<[key: string, value: string]>): DOMOutputSpec;
1678
-
1679
- /**
1680
- * Returns a command that inserts the given text.
1681
- *
1682
- * @public
1683
- */
1684
- export declare function insertText({ text, from, to }: InsertTextOptions): Command;
1685
-
1686
- /**
1687
- * @public
1688
- */
1689
- export declare type InsertTextOptions = {
1690
- text: string;
1691
- from?: number;
1692
- to?: number;
1693
- };
1694
-
1695
- /**
1696
- * Checks if the given object is a `AllSelection` instance.
1697
- *
1698
- * @public
1699
- */
1700
- declare function isAllSelection(sel: Selection_2): sel is AllSelection;
1701
- export { isAllSelection }
1702
- export { isAllSelection as isAllSelection_alias_1 }
1703
-
1704
- /**
1705
- * @private
1706
- */
1707
- declare const isApple: boolean;
1708
- export { isApple }
1709
- export { isApple as isApple_alias_1 }
1710
-
1711
- /**
1712
- * Whether the selection is an empty text selection at the start of a block.
1713
- *
1714
- * @internal
1715
- */
1716
- declare function isAtBlockStart(state: EditorState, view?: EditorView): ResolvedPos | null;
1717
- export { isAtBlockStart }
1718
- export { isAtBlockStart as isAtBlockStart_alias_1 }
1719
-
1720
- /**
1721
- * @internal
1722
- */
1723
- declare function isElement(el: unknown): el is Element;
1724
- export { isElement }
1725
- export { isElement as isElement_alias_1 }
1726
-
1727
- /**
1728
- * Checks if the given object is a `Fragment` instance.
1729
- *
1730
- * @public
1731
- */
1732
- declare function isFragment(fragment: unknown): fragment is Fragment;
1733
- export { isFragment }
1734
- export { isFragment as isFragment_alias_1 }
1735
-
1736
- /**
1737
- * Check if the selection is in a code block.
1738
- *
1739
- * @internal
1740
- */
1741
- declare function isInCodeBlock(selection: Selection_2): boolean;
1742
- export { isInCodeBlock }
1743
- export { isInCodeBlock as isInCodeBlock_alias_1 }
1744
-
1745
- /**
1746
- * Checks if the given object is a `Mark` instance.
1747
- *
1748
- * @public
1749
- */
1750
- declare function isMark(mark: unknown): mark is Mark;
1751
- export { isMark }
1752
- export { isMark as isMark_alias_1 }
1753
-
1754
- /**
1755
- * Returns true if the given mark is missing in some part of the range.
1756
- * Returns false if the entire range has the given mark.
1757
- * Returns true if the mark is not allowed in the range.
1758
- *
1759
- * @internal
1760
- */
1761
- declare function isMarkAbsent(node: ProseMirrorNode, from: number, to: number, markType: MarkType, attrs?: Attrs | null): boolean;
1762
- export { isMarkAbsent }
1763
- export { isMarkAbsent as isMarkAbsent_alias_1 }
1764
-
1765
- /**
1766
- * @internal
1767
- */
1768
- declare function isMarkActive(state: EditorState, type: string | MarkType, attrs?: Attrs | null): boolean;
1769
- export { isMarkActive }
1770
- export { isMarkActive as isMarkActive_alias_1 }
1771
-
1772
- export declare function isNodeActive(state: EditorState, type: string | NodeType, attrs?: Attrs | null): boolean;
1773
-
1774
- /**
1775
- * Checks if the given object is a `NodeSelection` instance.
1776
- *
1777
- * @public
1778
- */
1779
- declare function isNodeSelection(sel: Selection_2): sel is NodeSelection;
1780
- export { isNodeSelection }
1781
- export { isNodeSelection as isNodeSelection_alias_1 }
1782
-
1783
- /**
1784
- * @internal
1785
- */
1786
- export declare function isNotNullish<T>(value: T | null | undefined | void): value is T;
1787
-
1788
- export declare function isObject(v: unknown): v is Record<string, unknown>;
1789
-
1790
- /**
1791
- * Checks if the given object is a `ProseMirrorNode` instance.
1792
- */
1793
- declare function isProseMirrorNode(node: unknown): node is ProseMirrorNode;
1794
- export { isProseMirrorNode }
1795
- export { isProseMirrorNode as isProseMirrorNode_alias_1 }
1796
-
1797
- /**
1798
- * Checks if the given object is a `Selection` instance.
1799
- *
1800
- * @public
1801
- */
1802
- declare function isSelection(sel: unknown): sel is Selection_2;
1803
- export { isSelection }
1804
- export { isSelection as isSelection_alias_1 }
1805
-
1806
- /**
1807
- * Checks if the given object is a `Slice` instance.
1808
- *
1809
- * @public
1810
- */
1811
- declare function isSlice(slice: unknown): slice is Slice;
1812
- export { isSlice }
1813
- export { isSlice as isSlice_alias_1 }
1814
-
1815
- /**
1816
- * Check if `subset` is a subset of `superset`.
1817
- *
1818
- * @internal
1819
- */
1820
- export declare function isSubset(subset: Record<string, unknown>, superset: Record<string, unknown>): boolean;
1821
-
1822
- /**
1823
- * Checks if the given object is a `TextSelection` instance.
1824
- *
1825
- * @public
1826
- */
1827
- declare function isTextSelection(sel: Selection_2): sel is TextSelection;
1828
- export { isTextSelection }
1829
- export { isTextSelection as isTextSelection_alias_1 }
1830
-
1831
- declare type ItalicExtension = Extension<{
1832
- Marks: {
1833
- italic: Attrs;
1834
- };
1835
- }>;
1836
-
1837
- /**
1838
- * Serialize a HTML element to a ProseMirror document JSON object.
1839
- *
1840
- * @public
1841
- */
1842
- export declare function jsonFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): NodeJSON;
1843
-
1844
- /**
1845
- * Parse a HTML string to a ProseMirror document JSON object.
1846
- *
1847
- * @public
1848
- */
1849
- declare function jsonFromHTML(html: string, options: DOMDocumentOptions & DOMParserOptions & JSONParserOptions): NodeJSON;
1850
- export { jsonFromHTML }
1851
- export { jsonFromHTML as jsonFromHTML_alias_1 }
1852
-
1853
- /**
1854
- * Return a JSON object representing this node.
1855
- *
1856
- * @public
1857
- */
1858
- declare function jsonFromNode(node: ProseMirrorNode): NodeJSON;
1859
- export { jsonFromNode }
1860
- export { jsonFromNode as jsonFromNode_alias_1 }
1861
-
1862
- /**
1863
- * Return a JSON object representing this state.
1864
- *
1865
- * @public
1866
- */
1867
- declare function jsonFromState(state: EditorState): StateJSON;
1868
- export { jsonFromState }
1869
- export { jsonFromState as jsonFromState_alias_1 }
1870
-
1871
- /** @public */
1872
- declare interface JSONParserOptions {
1873
- /**
1874
- * The editor schema to use.
1875
- */
1876
- schema: Schema;
1877
- }
1878
- export { JSONParserOptions }
1879
- export { JSONParserOptions as JSONParserOptions_alias_1 }
1880
-
1881
- declare type KeyDownHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
1882
- export { KeyDownHandler }
1883
- export { KeyDownHandler as KeyDownHandler_alias_1 }
1884
-
1885
- /**
1886
- * @public
1887
- */
1888
- declare interface Keymap {
1889
- [key: string]: Command;
1890
- }
1891
- export { Keymap }
1892
- export { Keymap as Keymap_alias_1 }
1893
-
1894
- /**
1895
- * @internal
1896
- */
1897
- declare const keymapFacet: Facet<KeymapPayload, PluginPayload>;
1898
- export { keymapFacet }
1899
- export { keymapFacet as keymapFacet_alias_1 }
1900
-
1901
- /**
1902
- * @internal
1903
- */
1904
- declare type KeymapPayload = Keymap;
1905
- export { KeymapPayload }
1906
- export { KeymapPayload as KeymapPayload_alias_1 }
1907
-
1908
- declare type KeyPressHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
1909
- export { KeyPressHandler }
1910
- export { KeyPressHandler as KeyPressHandler_alias_1 }
1911
-
1912
- declare interface LinkAttrs {
1913
- href: string;
1914
- }
1915
-
1916
- declare type LinkExtension = Extension<{
1917
- Marks: {
1918
- link: LinkAttrs;
1919
- };
1920
- }>;
1921
-
1922
- /**
1923
- * A function for creating a mark with optional attributes and any number of
1924
- * children.
1925
- *
1926
- * It also has a `isActive` method for checking if the mark is active in the
1927
- * current editor selection.
1928
- *
1929
- * @public
1930
- */
1931
- declare interface MarkAction<Attrs extends AnyAttrs = AnyAttrs> {
1932
- (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[];
1933
- (...children: NodeChild[]): ProseMirrorNode[];
1934
- /**
1935
- * Checks if the mark is active in the current editor selection. If the
1936
- * optional `attrs` parameter is provided, it will check if the mark is active
1937
- * with the given attributes.
1938
- */
1939
- isActive: (attrs?: Attrs) => boolean;
1940
- }
1941
- export { MarkAction }
1942
- export { MarkAction as MarkAction_alias_1 }
1943
-
1944
- /**
1945
- * @public
1946
- */
1947
- declare interface MarkAttrOptions<MarkName extends string = string, AttrName extends string = string, AttrType = any> extends AttrSpec<AttrType> {
1948
- /**
1949
- * The name of the mark type.
1950
- */
1951
- type: MarkName;
1952
- /**
1953
- * The name of the attribute.
1954
- */
1955
- attr: AttrName;
1956
- /**
1957
- * Returns the attribute key and value to be set on the HTML element.
1958
- *
1959
- * If the returned `key` is `"style"`, the value is a string of CSS properties and will
1960
- * be prepended to the existing `style` attribute on the DOM node.
1961
- *
1962
- * @param value - The value of the attribute of current ProseMirror node.
1963
- */
1964
- toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
1965
- /**
1966
- * Parses the attribute value from the DOM.
1967
- */
1968
- parseDOM?: (node: HTMLElement) => AttrType;
1969
- }
1970
- export { MarkAttrOptions }
1971
- export { MarkAttrOptions as MarkAttrOptions_alias_1 }
1972
-
1973
- /**
1974
- * @deprecated Use type {@link MarkAction} instead.
1975
- */
1976
- declare type MarkBuilder = MarkAction;
1977
- export { MarkBuilder }
1978
- export { MarkBuilder as MarkBuilder_alias_1 }
1979
-
1980
- declare type MarksFromSchemaFunction = typeof DOMSerializer.marksFromSchema;
1981
-
1982
- /**
1983
- * @public
1984
- */
1985
- declare interface MarkSpecOptions<MarkName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends MarkSpec {
1986
- /**
1987
- * The name of the mark type.
1988
- */
1989
- name: MarkName;
1990
- /**
1991
- * The attributes that marks of this type get.
1992
- */
1993
- attrs?: {
1994
- [K in keyof Attrs]: AttrSpec<Attrs[K]>;
1995
- };
1996
- }
1997
- export { MarkSpecOptions }
1998
- export { MarkSpecOptions as MarkSpecOptions_alias_1 }
1999
-
2000
- /**
2001
- * @internal
2002
- */
2003
- declare interface MarkTyping {
2004
- [name: string]: Record<string, any>;
2005
- }
2006
- export { MarkTyping }
2007
- export { MarkTyping as MarkTyping_alias_1 }
2008
-
2009
- /**
2010
- * @internal
2011
- */
2012
- declare type MarkViewComponentOptions<T> = {
2013
- group: string;
2014
- name: string;
2015
- args: T;
2016
- };
2017
- export { MarkViewComponentOptions }
2018
- export { MarkViewComponentOptions as MarkViewComponentOptions_alias_1 }
2019
-
2020
- /**
2021
- * @internal
2022
- */
2023
- declare type MarkViewFactoryOptions<T> = {
2024
- group: string;
2025
- factory: (args: T) => MarkViewConstructor;
2026
- };
2027
- export { MarkViewFactoryOptions }
2028
- export { MarkViewFactoryOptions as MarkViewFactoryOptions_alias_1 }
2029
-
2030
- declare interface MarkViewOptions {
2031
- name: string;
2032
- constructor: MarkViewConstructor;
2033
- }
2034
- export { MarkViewOptions }
2035
- export { MarkViewOptions as MarkViewOptions_alias_1 }
2036
-
2037
- /**
2038
- * @internal
2039
- */
2040
- declare function maybeRun<MaybeFn, Result = MaybeFn extends (...args: any[]) => void ? ReturnType<MaybeFn> : MaybeFn>(value: MaybeFn, ...args: MaybeFn extends (...args: any[]) => void ? Parameters<MaybeFn> : never): Result;
2041
- export { maybeRun }
2042
- export { maybeRun as maybeRun_alias_1 }
2043
-
2044
- export declare function mergeObjects<T extends object>(...objects: Array<Partial<T> | null | undefined>): Partial<T>;
2045
-
2046
- export declare function mergeSpecs(a: NodeSpec, b: NodeSpec): NodeSpec;
2047
-
2048
- export declare function mergeSpecs(a: MarkSpec, b: MarkSpec): MarkSpec;
2049
-
2050
- /**
2051
- * A function that is called when the editor view is mounted.
2052
- *
2053
- * @param view - The editor view.
2054
- *
2055
- * @public
2056
- */
2057
- declare type MountHandler = (view: EditorView) => void;
2058
- export { MountHandler }
2059
- export { MountHandler as MountHandler_alias_1 }
2060
-
2061
- /**
2062
- * A function for creating a node with optional attributes and any number of
2063
- * children.
2064
- *
2065
- * It also has a `isActive` method for checking if the node is active in the
2066
- * current editor selection.
2067
- *
2068
- * @public
2069
- */
2070
- declare interface NodeAction<Attrs extends AnyAttrs = AnyAttrs> {
2071
- (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode;
2072
- (...children: NodeChild[]): ProseMirrorNode;
2073
- /**
2074
- * Checks if the node is active in the current editor selection. If the
2075
- * optional `attrs` parameter is provided, it will check if the node is active
2076
- * with the given attributes.
2077
- */
2078
- isActive: (attrs?: Attrs) => boolean;
2079
- }
2080
- export { NodeAction }
2081
- export { NodeAction as NodeAction_alias_1 }
2082
-
2083
- /**
2084
- * @public
2085
- */
2086
- declare interface NodeAttrOptions<NodeName extends string = string, AttrName extends string = string, AttrType = any> extends AttrSpec<AttrType> {
2087
- /**
2088
- * The name of the node type.
2089
- */
2090
- type: NodeName;
2091
- /**
2092
- * The name of the attribute.
2093
- */
2094
- attr: AttrName;
2095
- /**
2096
- * Whether the attribute should be kept when the node is split. Set it to
2097
- * `true` if you want to inherit the attribute from the previous node when
2098
- * splitting the node by pressing `Enter`.
2099
- *
2100
- * @default undefined
2101
- */
2102
- splittable?: boolean;
2103
- /**
2104
- * Returns the attribute key and value to be set on the HTML element.
2105
- *
2106
- * If the returned `key` is `"style"`, the value is a string of CSS properties and will
2107
- * be prepended to the existing `style` attribute on the DOM node.
2108
- *
2109
- * @param value - The value of the attribute of current ProseMirror node.
2110
- */
2111
- toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
2112
- /**
2113
- * Parses the attribute value from the DOM.
2114
- */
2115
- parseDOM?: (node: HTMLElement) => AttrType;
2116
- }
2117
- export { NodeAttrOptions }
2118
- export { NodeAttrOptions as NodeAttrOptions_alias_1 }
2119
-
2120
- /**
2121
- * @deprecated Use type {@link NodeAction} instead.
2122
- */
2123
- declare type NodeBuilder = NodeAction;
2124
- export { NodeBuilder }
2125
- export { NodeBuilder as NodeBuilder_alias_1 }
2126
-
2127
- /**
2128
- * Available children parameters for {@link NodeAction} and {@link MarkAction}.
2129
- *
2130
- * @public
2131
- */
2132
- declare type NodeChild = ProseMirrorNode | string | NodeChild[];
2133
- export { NodeChild }
2134
- export { NodeChild as NodeChild_alias_1 }
2135
-
2136
- /**
2137
- * @public
2138
- *
2139
- * @deprecated
2140
- */
2141
- declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
2142
- export { NodeContent }
2143
- export { NodeContent as NodeContent_alias_1 }
2144
-
2145
- /**
2146
- * Parse a HTML element to a ProseMirror node.
2147
- *
2148
- * @public
2149
- */
2150
- declare function nodeFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): ProseMirrorNode;
2151
- export { nodeFromElement }
2152
- export { nodeFromElement as nodeFromElement_alias_1 }
2153
-
2154
- /**
2155
- * Parse a HTML string to a ProseMirror node.
2156
- *
2157
- * @public
2158
- */
2159
- declare function nodeFromHTML(html: string, options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions): ProseMirrorNode;
2160
- export { nodeFromHTML }
2161
- export { nodeFromHTML as nodeFromHTML_alias_1 }
2162
-
2163
- /**
2164
- * Parse a JSON object to a ProseMirror node.
2165
- *
2166
- * @public
2167
- */
2168
- declare function nodeFromJSON(json: NodeJSON, options: JSONParserOptions): ProseMirrorNode;
2169
- export { nodeFromJSON }
2170
- export { nodeFromJSON as nodeFromJSON_alias_1 }
2171
-
2172
- /**
2173
- * A JSON representation of the prosemirror node.
2174
- *
2175
- * @public
2176
- */
2177
- declare interface NodeJSON {
2178
- type: string;
2179
- marks?: Array<{
2180
- type: string;
2181
- attrs?: Record<string, any>;
2182
- }>;
2183
- text?: string;
2184
- content?: NodeJSON[];
2185
- attrs?: Record<string, any>;
2186
- }
2187
- export { NodeJSON }
2188
- export { NodeJSON as NodeJSON_alias_1 }
2189
-
2190
- declare type NodesFromSchemaFunction = typeof DOMSerializer.nodesFromSchema;
2191
-
2192
- /**
2193
- * @public
2194
- */
2195
- declare interface NodeSpecOptions<NodeName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends NodeSpec {
2196
- /**
2197
- * The name of the node type.
2198
- */
2199
- name: NodeName;
2200
- /**
2201
- * Whether this is the top-level node type. Only one node type can be the
2202
- * top-level node type in a schema.
2203
- */
2204
- topNode?: boolean;
2205
- /**
2206
- * The attributes that nodes of this type get.
2207
- */
2208
- attrs?: {
2209
- [key in keyof Attrs]: AttrSpec<Attrs[key]>;
2210
- };
2211
- }
2212
- export { NodeSpecOptions }
2213
- export { NodeSpecOptions as NodeSpecOptions_alias_1 }
2214
-
2215
- /**
2216
- * @internal
2217
- */
2218
- declare interface NodeTyping {
2219
- [name: string]: Record<string, any>;
2220
- }
2221
- export { NodeTyping }
2222
- export { NodeTyping as NodeTyping_alias_1 }
2223
-
2224
- /**
2225
- * @internal
2226
- */
2227
- declare type NodeViewComponentOptions<T> = {
2228
- group: string;
2229
- name: string;
2230
- args: T;
2231
- };
2232
- export { NodeViewComponentOptions }
2233
- export { NodeViewComponentOptions as NodeViewComponentOptions_alias_1 }
2234
-
2235
- /**
2236
- * @internal
2237
- */
2238
- declare type NodeViewFactoryOptions<T> = {
2239
- group: string;
2240
- factory: (args: T) => NodeViewConstructor;
2241
- };
2242
- export { NodeViewFactoryOptions }
2243
- export { NodeViewFactoryOptions as NodeViewFactoryOptions_alias_1 }
2244
-
2245
- declare interface NodeViewOptions {
2246
- name: string;
2247
- constructor: NodeViewConstructor;
2248
- }
2249
- export { NodeViewOptions }
2250
- export { NodeViewOptions as NodeViewOptions_alias_1 }
2251
-
2252
- /**
2253
- * @internal
2254
- */
2255
- declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
2256
- export { OBJECT_REPLACEMENT_CHARACTER }
2257
- export { OBJECT_REPLACEMENT_CHARACTER as OBJECT_REPLACEMENT_CHARACTER_alias_1 }
2258
-
2259
- /**
2260
- * @internal
2261
- *
2262
- * @example
2263
- *
2264
- * ```
2265
- * type MyObject = { a: 1; b: 'B' }
2266
- * type MyEntries = ObjectEntries<MyObject>
2267
- * // ^ ["a", 1] | ["b", "B"]
2268
- */
2269
- export declare type ObjectEntries<T extends Record<string, any>> = {
2270
- [K in keyof T]: [K, T[K]];
2271
- }[keyof T];
2272
-
2273
- export declare function objectEqual<T>(a: T, b: T): boolean;
2274
-
2275
- /**
2276
- * @internal
2277
- */
2278
- declare type ParagraphExtension = ParagraphSpecExtension;
2279
- export { ParagraphExtension }
2280
- export { ParagraphExtension as ParagraphExtension_alias_1 }
2281
-
2282
- /**
2283
- * @internal
2284
- */
2285
- declare type ParagraphSpecExtension = Extension<{
2286
- Nodes: {
2287
- paragraph: Attrs;
2288
- };
2289
- }>;
2290
-
2291
- declare type PasteHandler = (view: EditorView, event: ClipboardEvent, slice: Slice) => boolean | void;
2292
- export { PasteHandler }
2293
- export { PasteHandler as PasteHandler_alias_1 }
2294
-
2295
- /**
2296
- * @internal
2297
- */
2298
- export declare type Payloads<T> = Tuple5<T[]>;
2299
-
2300
- /**
2301
- * @internal
2302
- */
2303
- export declare type PickStringLiteral<T> = PickSubType<T, string>;
2304
-
2305
- /**
2306
- * @internal
2307
- */
2308
- declare type PickSubType<Type, ParentType> = Type extends ParentType ? [ParentType] extends [Type] ? never : Type : never;
2309
- export { PickSubType }
2310
- export { PickSubType as PickSubType_alias_1 }
2311
-
2312
- /**
2313
- * An extension that does not define any nodes, marks, or commands.
2314
- *
2315
- * @internal
2316
- */
2317
- declare type PlainExtension = Extension<{
2318
- Nodes: never;
2319
- Marks: never;
2320
- Commands: never;
2321
- }>;
2322
- export { PlainExtension }
2323
- export { PlainExtension as PlainExtension_alias_1 }
2324
-
2325
- /**
2326
- * @internal
2327
- */
2328
- declare const pluginFacet: Facet<PluginPayload, StatePayload>;
2329
- export { pluginFacet }
2330
- export { pluginFacet as pluginFacet_alias_1 }
2331
-
2332
- /**
2333
- * @internal
2334
- */
2335
- declare type PluginPayload = Plugin_2 | Plugin_2[] | ((context: {
2336
- schema: Schema;
2337
- }) => Plugin_2 | Plugin_2[]);
2338
- export { PluginPayload }
2339
- export { PluginPayload as PluginPayload_alias_1 }
2340
-
2341
- /**
2342
- * ProseKit extension priority.
2343
- *
2344
- * @public
2345
- */
2346
- declare enum Priority {
2347
- lowest = 0,
2348
- low = 1,
2349
- default = 2,
2350
- high = 3,
2351
- highest = 4
2352
- }
2353
- export { Priority }
2354
- export { Priority as Priority_alias_1 }
2355
-
2356
- /**
2357
- * Base class for all ProseKit errors.
2358
- *
2359
- * @internal
2360
- */
2361
- declare class ProseKitError extends Error {
2362
- }
2363
- export { ProseKitError }
2364
- export { ProseKitError as ProseKitError_alias_1 }
2365
-
2366
- /**
2367
- * Returns a command that removes the given mark.
2368
- *
2369
- * @public
2370
- */
2371
- declare function removeMark(options: RemoveMarkOptions): Command;
2372
- export { removeMark }
2373
- export { removeMark as removeMark_alias_1 }
2374
-
2375
- /**
2376
- * @public
2377
- */
2378
- declare interface RemoveMarkOptions {
2379
- /**
2380
- * The type of the mark to remove.
2381
- */
2382
- type: string | MarkType;
2383
- /**
2384
- * If attrs is given, remove precisely the mark with the given attrs. Otherwise, remove all marks of the given type.
2385
- */
2386
- attrs?: Attrs | null;
2387
- /**
2388
- * The start position of the document. By default it will be the start position of current selection.
2389
- */
2390
- from?: number;
2391
- /**
2392
- * The end position of the document. By default it will be the end position of current selection.
2393
- */
2394
- to?: number;
2395
- }
2396
- export { RemoveMarkOptions }
2397
- export { RemoveMarkOptions as RemoveMarkOptions_alias_1 }
2398
-
2399
- /**
2400
- * Returns a command to remove the nearest ancestor node of a specific type from the current position.
2401
- *
2402
- * @public
2403
- */
2404
- declare function removeNode(options: RemoveNodeOptions): Command;
2405
- export { removeNode }
2406
- export { removeNode as removeNode_alias_1 }
2407
-
2408
- /**
2409
- * @public
2410
- */
2411
- declare interface RemoveNodeOptions {
2412
- /**
2413
- * The type of the node to remove.
2414
- */
2415
- type: string | NodeType;
2416
- /**
2417
- * The document position to start searching node. By default it will be the
2418
- * anchor position of current selection.
2419
- */
2420
- pos?: number;
2421
- }
2422
- export { RemoveNodeOptions }
2423
- export { RemoveNodeOptions as RemoveNodeOptions_alias_1 }
2424
-
2425
- export declare function removeUndefinedValues<T extends object>(obj: T): T;
2426
-
2427
- export declare const rootFacet: Facet<RootPayload, RootOutput>;
2428
-
2429
- export declare type RootOutput = {
2430
- schema?: Schema | null;
2431
- commands?: CommandCreators;
2432
- state?: EditorStateConfig;
2433
- view?: Omit<DirectEditorProps, 'state'>;
2434
- };
2435
-
2436
- export declare type RootPayload = {
2437
- schema?: Schema | null;
2438
- commands?: CommandCreators;
2439
- state?: (ctx: {
2440
- schema: Schema;
2441
- }) => EditorStateConfig;
2442
- view?: Omit<DirectEditorProps, 'state'>;
2443
- };
2444
-
2445
- export declare const schemaFacet: Facet<SchemaSpec, RootPayload>;
2446
-
2447
- export declare const schemaSpecFacet: Facet<SchemaSpec, SchemaSpec>;
2448
-
2449
- declare type ScrollToSelectionHandler = (view: EditorView) => boolean;
2450
- export { ScrollToSelectionHandler }
2451
- export { ScrollToSelectionHandler as ScrollToSelectionHandler_alias_1 }
2452
-
2453
- /**
2454
- * Returns a command that selects the whole document.
2455
- *
2456
- * @public
2457
- */
2458
- export declare function selectAll(): Command;
2459
-
2460
- /**
2461
- * A JSON representation of the prosemirror selection.
2462
- *
2463
- * @public
2464
- */
2465
- declare interface SelectionJSON {
2466
- anchor: number;
2467
- head: number;
2468
- type: string;
2469
- }
2470
- export { SelectionJSON }
2471
- export { SelectionJSON as SelectionJSON_alias_1 }
2472
-
2473
- declare type SerializeFragmentFunction = typeof DOMSerializer.prototype.serializeFragment;
2474
-
2475
- declare type SerializeNodeFunction = typeof DOMSerializer.prototype.serializeNode;
2476
-
2477
- /**
2478
- * Returns a command that tries to set the selected textblocks to the given node
2479
- * type with the given attributes.
2480
- *
2481
- * @public
2482
- */
2483
- declare function setBlockType(options: SetBlockTypeOptions): Command;
2484
- export { setBlockType }
2485
- export { setBlockType as setBlockType_alias_1 }
2486
-
2487
- /**
2488
- * @public
2489
- */
2490
- declare interface SetBlockTypeOptions {
2491
- type: NodeType | string;
2492
- attrs?: Attrs | null;
2493
- from?: number;
2494
- to?: number;
2495
- }
2496
- export { SetBlockTypeOptions }
2497
- export { SetBlockTypeOptions as SetBlockTypeOptions_alias_1 }
2498
-
2499
- /**
2500
- * Returns a command that set the attributes of the current node.
2501
- *
2502
- * @public
2503
- */
2504
- declare function setNodeAttrs(options: SetNodeAttrsOptions): Command;
2505
- export { setNodeAttrs }
2506
- export { setNodeAttrs as setNodeAttrs_alias_1 }
2507
-
2508
- /**
2509
- * @public
2510
- */
2511
- declare interface SetNodeAttrsOptions {
2512
- /**
2513
- * The type of node to set the attributes of.
2514
- *
2515
- * If current node is not of this type, the command will do nothing.
2516
- */
2517
- type: string | NodeType | string[] | NodeType[];
2518
- /**
2519
- * The attributes to set.
2520
- */
2521
- attrs: Attrs;
2522
- /**
2523
- * The position of the node. Defaults to the position of the wrapping node
2524
- * containing the current selection.
2525
- */
2526
- pos?: number;
2527
- }
2528
- export { SetNodeAttrsOptions }
2529
- export { SetNodeAttrsOptions as SetNodeAttrsOptions_alias_1 }
2530
-
2531
- declare function setSelectionAround(tr: Transaction, pos: number): void;
2532
- export { setSelectionAround }
2533
- export { setSelectionAround as setSelectionAround_alias_1 }
2534
-
2535
- /**
2536
- * @internal
2537
- */
2538
- export declare type Setter<T> = (value: T) => void;
2539
-
2540
- /**
2541
- * @internal
2542
- */
2543
- export declare function setupEditorExtension<E extends Extension>(options: EditorOptions<E>): E;
2544
-
2545
- /**
2546
- * @internal
2547
- */
2548
- export declare function setupTest(): {
2549
- editor: TestEditor<Union_2<readonly [BaseCommandsExtension_2, PlainExtension_2, DocExtension_2, HistoryExtension_2, Extension<{
2550
- Nodes: {
2551
- paragraph: Attrs;
2552
- };
2553
- }>, TextExtension_2, BoldExtension, ItalicExtension, LinkExtension, HeadingExtension, CodeBlockExtension]>>;
2554
- m: ToMarkAction_2<SimplifyDeeper_2< {
2555
- bold: {
2556
- readonly [x: string]: any;
2557
- };
2558
- italic: {
2559
- readonly [x: string]: any;
2560
- };
2561
- link: {
2562
- href: string;
2563
- };
2564
- }>>;
2565
- n: {
2566
- p: NodeAction_2< {
2567
- readonly [x: string]: any;
2568
- }>;
2569
- doc: NodeAction_2< {
2570
- readonly [x: string]: any;
2571
- }>;
2572
- paragraph: NodeAction_2< {
2573
- readonly [x: string]: any;
2574
- }>;
2575
- text: NodeAction_2< {
2576
- readonly [x: string]: any;
2577
- }>;
2578
- heading: NodeAction_2< {
2579
- readonly [x: string]: any;
2580
- }>;
2581
- codeBlock: NodeAction_2< {
2582
- language: string;
2583
- }>;
2584
- };
2585
- };
2586
-
2587
- /**
2588
- * @internal
2589
- */
2590
- export declare function setupTestFromExtension<E extends Extension>(extension: E): {
2591
- editor: TestEditor<E>;
2592
- n: ExtractNodeActions<E>;
2593
- m: ExtractMarkActions<E>;
2594
- };
2595
-
2596
- /**
2597
- * @internal
2598
- */
2599
- declare type SimplifyDeeper<T> = {
2600
- [KeyType in keyof T]: Simplify<T[KeyType]>;
2601
- };
2602
- export { SimplifyDeeper }
2603
- export { SimplifyDeeper as SimplifyDeeper_alias_1 }
2604
-
2605
- /**
2606
- * @internal
2607
- */
2608
- declare type SimplifyUnion<T> = Simplify<UnionToIntersection<T extends undefined ? never : T>>;
2609
- export { SimplifyUnion }
2610
- export { SimplifyUnion as SimplifyUnion_alias_1 }
2611
-
2612
- export declare const stateFacet: Facet<StatePayload, RootPayload>;
2613
-
2614
- /**
2615
- * Parse a JSON object to a ProseMirror state.
2616
- *
2617
- * @public
2618
- */
2619
- declare function stateFromJSON(json: StateJSON, options: JSONParserOptions): EditorState;
2620
- export { stateFromJSON }
2621
- export { stateFromJSON as stateFromJSON_alias_1 }
2622
-
2623
- /**
2624
- * A JSON representation of the prosemirror state.
2625
- *
2626
- * @public
2627
- */
2628
- declare interface StateJSON {
2629
- /**
2630
- * The main `ProseMirror` doc.
2631
- */
2632
- doc: NodeJSON;
2633
- /**
2634
- * The current selection.
2635
- */
2636
- selection: SelectionJSON;
2637
- }
2638
- export { StateJSON }
2639
- export { StateJSON as StateJSON_alias_1 }
2640
-
2641
- export declare type StatePayload = (ctx: {
2642
- schema: Schema;
2643
- }) => EditorStateConfig;
2644
-
2645
- /**
2646
- * A JSON representation of the prosemirror step.
2647
- *
2648
- * @public
2649
- */
2650
- declare interface StepJSON {
2651
- /**
2652
- * The type of the step.
2653
- */
2654
- stepType: string;
2655
- [x: string]: unknown;
2656
- }
2657
- export { StepJSON }
2658
- export { StepJSON as StepJSON_alias_1 }
2659
-
2660
- /**
2661
- * Takes two facet nodes and returns a new facet node containing inputs and
2662
- * children from the first node but not the second.
2663
- *
2664
- * The reducers of the first facet node will be reused.
2665
- *
2666
- * @internal
2667
- */
2668
- export declare function subtractFacetNode<I, O>(a: FacetNode<I, O>, b: FacetNode<I, O>): FacetNode<I, O>;
2669
-
2670
- export declare type TaggedProseMirrorNode = ProseMirrorNode & {
2671
- tags?: Tags;
2672
- };
2673
-
2674
- declare type Tags = Record<string, number>;
2675
-
2676
- /**
2677
- * An editor for testing purposes.
2678
- * @public
2679
- */
2680
- declare class TestEditor<E extends Extension = Extension> extends Editor<E> {
2681
- constructor(instance: EditorInstance);
2682
- /**
2683
- * Set the editor state to the given document. You can use special tokens
2684
- * `<a>` and `<b>` to set the anchor and head positions of the selection.
2685
- *
2686
- * @example
2687
- *
2688
- * ```ts
2689
- * const editor = createTestEditor({ extension })
2690
- * const n = editor.nodes
2691
- * const doc = n.doc(n.paragraph('<a>Hello<b> world!'))
2692
- * editor.set(doc) // "Hello" is selected.
2693
- * ```
2694
- */
2695
- set(doc: ProseMirrorNode): void;
2696
- dispatchEvent(event: Event): void;
2697
- }
2698
- export { TestEditor }
2699
- export { TestEditor as TestEditor_alias_1 }
2700
-
2701
- /**
2702
- * @internal
2703
- */
2704
- declare type TextExtension = Extension<{
2705
- Nodes: {
2706
- text: Attrs;
2707
- };
2708
- }>;
2709
- export { TextExtension }
2710
- export { TextExtension as TextExtension_alias_1 }
2711
-
2712
- declare type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean | void;
2713
- export { TextInputHandler }
2714
- export { TextInputHandler as TextInputHandler_alias_1 }
2715
-
2716
- export declare type ToCommandAction<T extends CommandTyping> = {
2717
- [K in keyof T]: CommandAction<T[K]>;
2718
- };
2719
-
2720
- export declare type ToCommandCreators<T extends CommandTyping> = {
2721
- [K in keyof T]: CommandCreator<T[K]>;
2722
- };
2723
-
2724
- /**
2725
- * Returns a command that toggles the given mark with the given attributes.
2726
- *
2727
- * @param options
2728
- *
2729
- * @public
2730
- */
2731
- declare function toggleMark({ type, attrs, removeWhenPresent, enterInlineAtoms, }: ToggleMarkOptions): Command;
2732
- export { toggleMark }
2733
- export { toggleMark as toggleMark_alias_1 }
2734
-
2735
- /**
2736
- * @public
2737
- */
2738
- declare interface ToggleMarkOptions {
2739
- /**
2740
- * The mark type to toggle.
2741
- */
2742
- type: string | MarkType;
2743
- /**
2744
- * The optional attributes to set on the mark.
2745
- */
2746
- attrs?: Attrs | null;
2747
- /**
2748
- * Controls whether, when part of the selected range has the mark
2749
- * already and part doesn't, the mark is removed (`true`) or added
2750
- * (`false`).
2751
- *
2752
- * @default false
2753
- */
2754
- removeWhenPresent?: boolean;
2755
- /**
2756
- * Whether the command should act on the content of inline nodes marked as
2757
- * [atoms](https://prosemirror.net/docs/ref/#model.NodeSpec.atom) that are
2758
- * completely covered by a selection range.
2759
- *
2760
- * @default true
2761
- */
2762
- enterInlineAtoms?: boolean;
2763
- }
2764
- export { ToggleMarkOptions }
2765
- export { ToggleMarkOptions as ToggleMarkOptions_alias_1 }
2766
-
2767
- /**
2768
- * Returns a command that set the selected textblocks to the given node type
2769
- * with the given attributes.
2770
- *
2771
- * @param options
2772
- *
2773
- * @public
2774
- */
2775
- declare function toggleNode({ type, attrs }: ToggleNodeOptions): Command;
2776
- export { toggleNode }
2777
- export { toggleNode as toggleNode_alias_1 }
2778
-
2779
- /**
2780
- * @public
2781
- */
2782
- declare interface ToggleNodeOptions {
2783
- /**
2784
- * The type of the node to toggle.
2785
- */
2786
- type: string | NodeType;
2787
- /**
2788
- * The attributes of the node to toggle.
2789
- */
2790
- attrs?: Attrs | null;
2791
- }
2792
- export { ToggleNodeOptions }
2793
- export { ToggleNodeOptions as ToggleNodeOptions_alias_1 }
2794
-
2795
- /**
2796
- * Toggle between wrapping an inactive node with the provided node type, and
2797
- * lifting it up into it's parent.
2798
- *
2799
- * @param options
2800
- *
2801
- * @public
2802
- */
2803
- declare function toggleWrap(options: ToggleWrapOptions): Command;
2804
- export { toggleWrap }
2805
- export { toggleWrap as toggleWrap_alias_1 }
2806
-
2807
- declare interface ToggleWrapOptions {
2808
- /**
2809
- * The type of the node to toggle.
2810
- */
2811
- type: string | NodeType;
2812
- /**
2813
- * The attributes of the node to toggle.
2814
- */
2815
- attrs?: Attrs | null;
2816
- }
2817
- export { ToggleWrapOptions }
2818
- export { ToggleWrapOptions as ToggleWrapOptions_alias_1 }
2819
-
2820
- /**
2821
- * @internal
2822
- */
2823
- declare type ToMarkAction<T extends MarkTyping> = {
2824
- [K in keyof T]: MarkAction<T[K]>;
2825
- };
2826
- export { ToMarkAction }
2827
- export { ToMarkAction as ToMarkAction_alias_1 }
2828
-
2829
- /**
2830
- * @internal
2831
- */
2832
- declare type ToNodeAction<T extends NodeTyping> = {
2833
- [K in keyof T]: NodeAction<T[K]>;
2834
- };
2835
- export { ToNodeAction }
2836
- export { ToNodeAction as ToNodeAction_alias_1 }
2837
-
2838
- export declare function toReversed<T>(arr: T[]): T[];
2839
-
2840
- declare type TripleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
2841
- export { TripleClickHandler }
2842
- export { TripleClickHandler as TripleClickHandler_alias_1 }
2843
-
2844
- declare type TripleClickOnHandler = (view: EditorView, pos: number, node: Node_2, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
2845
- export { TripleClickOnHandler }
2846
- export { TripleClickOnHandler as TripleClickOnHandler_alias_1 }
2847
-
2848
- /**
2849
- * @internal
2850
- */
2851
- export declare type Tuple5<T> = [T, T, T, T, T];
2852
-
2853
- /**
2854
- * @internal
2855
- */
2856
- declare type Union<E extends readonly Extension[]> = Extension<{
2857
- Nodes: ExtractNodes<E[number]>;
2858
- Marks: ExtractMarks<E[number]>;
2859
- Commands: ExtractCommands<E[number]>;
2860
- }>;
2861
- export { Union }
2862
- export { Union as Union_alias_1 }
2863
-
2864
- /**
2865
- * Merges multiple extensions into one. You can pass multiple extensions as
2866
- * arguments or a single array containing multiple extensions.
2867
- *
2868
- * @throws If no extensions are provided.
2869
- *
2870
- * @example
2871
- *
2872
- * ```ts
2873
- * function defineFancyNodes() {
2874
- * return union(
2875
- * defineFancyParagraph(),
2876
- * defineFancyHeading(),
2877
- * )
2878
- * }
2879
- * ```
2880
- *
2881
- * @example
2882
- *
2883
- * ```ts
2884
- * function defineFancyNodes() {
2885
- * return union([
2886
- * defineFancyParagraph(),
2887
- * defineFancyHeading(),
2888
- * ])
2889
- * }
2890
- * ```
2891
- *
2892
- * @public
2893
- */
2894
- declare function union<const E extends readonly Extension[]>(...exts: E): Union<E>;
2895
-
2896
- declare function union<const E extends readonly Extension[]>(exts: E): Union<E>;
2897
- export { union }
2898
- export { union as union_alias_1 }
2899
-
2900
- /**
2901
- * @deprecated Use `Union` instead.
2902
- * @internal
2903
- */
2904
- declare type UnionExtension<E extends Extension | readonly Extension[]> = E extends readonly Extension[] ? Extension<{
2905
- Nodes: ExtractNodes<E[number]>;
2906
- Marks: ExtractMarks<E[number]>;
2907
- Commands: ExtractCommands<E[number]>;
2908
- }> : E;
2909
- export { UnionExtension }
2910
- export { UnionExtension as UnionExtension_alias_1 }
2911
-
2912
- export declare class UnionExtensionImpl<T extends ExtensionTyping = ExtensionTyping> extends BaseExtension<T> implements Extension<T> {
2913
- extension: BaseExtension[];
2914
- /**
2915
- * @internal
2916
- */
2917
- constructor(extension?: BaseExtension[]);
2918
- /**
2919
- * @internal
2920
- */
2921
- createTree(priority: Priority): FacetNode;
2922
- }
2923
-
2924
- /**
2925
- * Takes two facet nodes and returns a new facet node containing inputs and
2926
- * children from both nodes.
2927
- *
2928
- * The reducers of the first facet node will be reused.
2929
- *
2930
- * @internal
2931
- */
2932
- export declare function unionFacetNode<I, O>(a: FacetNode<I, O>, b: FacetNode<I, O>): FacetNode<I, O>;
2933
-
2934
- export declare function uniqPush<T>(prev: readonly T[], next: readonly T[]): T[];
2935
-
2936
- export declare function uniqRemove<T>(prev: T[], next: T[]): T[];
2937
-
2938
- /**
2939
- * A function that is called when the editor view is unmounted.
2940
- *
2941
- * @public
2942
- */
2943
- declare type UnmountHandler = () => void;
2944
- export { UnmountHandler }
2945
- export { UnmountHandler as UnmountHandler_alias_1 }
2946
-
2947
- /**
2948
- * Returns a command that set the type of all textblocks between the given range
2949
- * to the default type (usually `paragraph`).
2950
- *
2951
- * @public
2952
- */
2953
- declare function unsetBlockType(options?: UnsetBlockTypeOptions): Command;
2954
- export { unsetBlockType }
2955
- export { unsetBlockType as unsetBlockType_alias_1 }
2956
-
2957
- /**
2958
- * @public
2959
- */
2960
- declare interface UnsetBlockTypeOptions {
2961
- /**
2962
- * The start position of the document. By default it will be the start position of current selection.
2963
- */
2964
- from?: number;
2965
- /**
2966
- * The end position of the document. By default it will be the end position of current selection.
2967
- */
2968
- to?: number;
2969
- }
2970
- export { UnsetBlockTypeOptions }
2971
- export { UnsetBlockTypeOptions as UnsetBlockTypeOptions_alias_1 }
2972
-
2973
- /**
2974
- * Returns a command that removes all marks.
2975
- *
2976
- * @public
2977
- */
2978
- declare function unsetMark(options?: UnsetMarkOptions): Command;
2979
- export { unsetMark }
2980
- export { unsetMark as unsetMark_alias_1 }
2981
-
2982
- /**
2983
- * @public
2984
- */
2985
- declare interface UnsetMarkOptions {
2986
- /**
2987
- * The start position of the document. By default it will be the start position of current selection.
2988
- */
2989
- from?: number;
2990
- /**
2991
- * The end position of the document. By default it will be the end position of current selection.
2992
- */
2993
- to?: number;
2994
- }
2995
- export { UnsetMarkOptions }
2996
- export { UnsetMarkOptions as UnsetMarkOptions_alias_1 }
2997
-
2998
- /**
2999
- * A function that is called when the editor state is updated.
3000
- *
3001
- * @param view - The editor view.
3002
- * @param prevState - The previous editor state.
3003
- *
3004
- * @public
3005
- */
3006
- declare type UpdateHandler = (view: EditorView, prevState: EditorState) => void;
3007
- export { UpdateHandler }
3008
- export { UpdateHandler as UpdateHandler_alias_1 }
3009
-
3010
- export declare const viewFacet: Facet<ViewPayload, RootPayload>;
3011
-
3012
- export declare type ViewPayload = Omit<DirectEditorProps, 'state'>;
3013
-
3014
- export declare function voidFunction(): void;
3015
-
3016
- /**
3017
- * Return an new extension with the given priority.
3018
- *
3019
- * @example
3020
- * ```ts
3021
- * import { Priority, withPriority } from 'prosekit/core'
3022
- *
3023
- * const extension = withPriority(defineMyExtension(), Priority.high)
3024
- * ```
3025
- *
3026
- * @public
3027
- */
3028
- declare function withPriority<T extends Extension>(extension: T, priority: Priority): T;
3029
- export { withPriority }
3030
- export { withPriority as withPriority_alias_1 }
3031
-
3032
- /**
3033
- * @internal
3034
- */
3035
- declare function withSkipCodeBlock(command: Command): Command;
3036
- export { withSkipCodeBlock }
3037
- export { withSkipCodeBlock as withSkipCodeBlock_alias_1 }
3038
-
3039
- /**
3040
- * Returns a command that wraps the selected textblock with the given node type.
3041
- *
3042
- * @param options
3043
- *
3044
- * @public
3045
- */
3046
- declare function wrap(options: WrapOptions): Command;
3047
- export { wrap }
3048
- export { wrap as wrap_alias_1 }
3049
-
3050
- /**
3051
- * @public
3052
- */
3053
- declare interface WrapOptions {
3054
- /**
3055
- * The node type to wrap the selected textblock with.
3056
- */
3057
- type: NodeType | string;
3058
- /**
3059
- * @deprecated Use `nodeSpec` instead.
3060
- */
3061
- nodeType?: NodeType;
3062
- /**
3063
- * Optional attributes to apply to the node.
3064
- */
3065
- attrs?: Attrs | null;
3066
- }
3067
- export { WrapOptions }
3068
- export { WrapOptions as WrapOptions_alias_1 }
3069
-
3070
- export declare function wrapOutputSpecAttrs<T extends ProseMirrorNode | Mark, Args extends readonly unknown[]>(toDOM: (node: T, ...args: Args) => DOMOutputSpec, options: AttrOptions[]): (node: T, ...args: Args) => DOMOutputSpec;
3071
-
3072
- export declare function wrapTagParseRuleAttrs(rule: TagParseRule, options: AttrOptions[]): TagParseRule;
3073
-
3074
- export declare function zip<T, P>(a: T[], b: P[]): [T, P][];
3075
-
3076
- export { }