@prosekit/core 0.0.0-next-20231120040948 → 0.0.0-next-20240421132240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.ts +747 -49
- package/dist/prosekit-core.d.ts +62 -5
- package/dist/prosekit-core.js +787 -184
- package/package.json +7 -9
- package/dist/style.css +0 -55
- package/src/index.ts +0 -71
@@ -3,22 +3,27 @@ import { Attrs } from '@prosekit/pm/model';
|
|
3
3
|
import { Attrs as Attrs_2 } from 'prosemirror-model';
|
4
4
|
import { Command } from '@prosekit/pm/state';
|
5
5
|
import type { ConditionalExcept } from 'type-fest';
|
6
|
+
import type { ContentMatch } from '@prosekit/pm/model';
|
6
7
|
import type { DirectEditorProps } from '@prosekit/pm/view';
|
8
|
+
import type { DOMEventMap } from '@prosekit/pm/view';
|
9
|
+
import { DOMParser as DOMParser_2 } from '@prosekit/pm/model';
|
10
|
+
import { DOMSerializer } from '@prosekit/pm/model';
|
7
11
|
import { EditorState } from '@prosekit/pm/state';
|
8
12
|
import type { EditorStateConfig } from '@prosekit/pm/state';
|
9
13
|
import { EditorView } from '@prosekit/pm/view';
|
10
14
|
import type { EmptyObject } from 'type-fest';
|
11
|
-
import { InputRule } from '@prosekit/pm/inputrules';
|
12
15
|
import type { IsEqual } from 'type-fest';
|
13
16
|
import { Mark } from '@prosekit/pm/model';
|
14
17
|
import type { MarkSpec } from '@prosekit/pm/model';
|
15
18
|
import { MarkType } from '@prosekit/pm/model';
|
16
19
|
import { MarkType as MarkType_2 } from 'prosemirror-model';
|
17
20
|
import { Node as Node_2 } from 'prosemirror-model';
|
21
|
+
import type { Node as Node_3 } from '@prosekit/pm/model';
|
18
22
|
import { NodeSelection } from '@prosekit/pm/state';
|
19
23
|
import type { NodeSpec } from '@prosekit/pm/model';
|
20
24
|
import { NodeType } from '@prosekit/pm/model';
|
21
25
|
import { NodeType as NodeType_2 } from 'prosemirror-model';
|
26
|
+
import { NodeView } from '@prosekit/pm/view';
|
22
27
|
import { NodeViewConstructor } from '@prosekit/pm/view';
|
23
28
|
import { Options } from 'tsup';
|
24
29
|
import { Plugin as Plugin_2 } from '@prosekit/pm/state';
|
@@ -29,10 +34,10 @@ import type { SchemaSpec } from '@prosekit/pm/model';
|
|
29
34
|
import { Selection as Selection_2 } from '@prosekit/pm/state';
|
30
35
|
import { Selection as Selection_3 } from 'prosemirror-state';
|
31
36
|
import type { Simplify } from 'type-fest';
|
37
|
+
import type { Slice } from '@prosekit/pm/model';
|
32
38
|
import { TextSelection } from '@prosekit/pm/state';
|
33
39
|
import { Transaction } from '@prosekit/pm/state';
|
34
40
|
import type { UnionToIntersection } from 'type-fest';
|
35
|
-
import { UserProjectConfigExport } from 'vitest/dist/config.js';
|
36
41
|
|
37
42
|
declare type Action = (options: {
|
38
43
|
tr: Transaction;
|
@@ -40,7 +45,9 @@ declare type Action = (options: {
|
|
40
45
|
}) => boolean;
|
41
46
|
|
42
47
|
/**
|
43
|
-
*
|
48
|
+
* Returns a command that adds the given mark with the given attributes.
|
49
|
+
*
|
50
|
+
* @public
|
44
51
|
*/
|
45
52
|
declare function addMark(options: {
|
46
53
|
/**
|
@@ -94,8 +101,55 @@ export declare abstract class BaseExtension<T extends ExtensionTyping = Extensio
|
|
94
101
|
abstract schema: Schema | null;
|
95
102
|
}
|
96
103
|
|
104
|
+
/**
|
105
|
+
* Some basic props for custom node views.
|
106
|
+
*
|
107
|
+
* @public
|
108
|
+
*/
|
109
|
+
declare interface BaseNodeViewOptions {
|
110
|
+
/**
|
111
|
+
* The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
|
112
|
+
*/
|
113
|
+
as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
|
114
|
+
/**
|
115
|
+
* The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
|
116
|
+
*/
|
117
|
+
contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
|
118
|
+
update?: NodeView['update'];
|
119
|
+
ignoreMutation?: NodeView['ignoreMutation'];
|
120
|
+
selectNode?: NodeView['selectNode'];
|
121
|
+
deselectNode?: NodeView['deselectNode'];
|
122
|
+
setSelection?: NodeView['setSelection'];
|
123
|
+
stopEvent?: NodeView['stopEvent'];
|
124
|
+
destroy?: NodeView['destroy'];
|
125
|
+
onUpdate?: () => void;
|
126
|
+
}
|
127
|
+
export { BaseNodeViewOptions }
|
128
|
+
export { BaseNodeViewOptions as BaseNodeViewOptions_alias_1 }
|
129
|
+
|
130
|
+
declare type ClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
|
131
|
+
export { ClickHandler }
|
132
|
+
export { ClickHandler as ClickHandler_alias_1 }
|
133
|
+
|
134
|
+
declare type ClickOnHandler = (view: EditorView, pos: number, node: Node_3, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
|
135
|
+
export { ClickOnHandler }
|
136
|
+
export { ClickOnHandler as ClickOnHandler_alias_1 }
|
137
|
+
|
138
|
+
/**
|
139
|
+
* A utility for constructing `className` strings conditionally.
|
140
|
+
*
|
141
|
+
* It is a re-export of [clsx/lite](https://www.npmjs.com/package/clsx) with stricter types.
|
142
|
+
*
|
143
|
+
* @public
|
144
|
+
*/
|
145
|
+
declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
|
146
|
+
export { clsx }
|
147
|
+
export { clsx as clsx_alias_1 }
|
148
|
+
|
97
149
|
export declare function collectNodes(content: NodeContent): ProseMirrorNode[];
|
98
150
|
|
151
|
+
export declare function combineEventHandlers<Handler extends (...args: any[]) => boolean | void, Args extends Parameters<Handler> = Parameters<Handler>>(): readonly [(handlers: Handler[]) => void, (...args: Args) => boolean];
|
152
|
+
|
99
153
|
export declare interface CommandApplier<Args extends any[] = any[]> {
|
100
154
|
(...args: Args): boolean;
|
101
155
|
canApply(...args: Args): boolean;
|
@@ -127,7 +181,7 @@ declare type ConverterTuple = Tuple5<FacetConverter | undefined>;
|
|
127
181
|
/**
|
128
182
|
* @public
|
129
183
|
*/
|
130
|
-
declare function createEditor<E extends Extension>(
|
184
|
+
declare function createEditor<E extends Extension>(options: EditorOptions<E>): Editor<E>;
|
131
185
|
export { createEditor }
|
132
186
|
export { createEditor as createEditor_alias_1 }
|
133
187
|
|
@@ -137,7 +191,18 @@ export declare function createNodeBuilder(getState: () => EditorState | null | u
|
|
137
191
|
|
138
192
|
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
139
193
|
|
140
|
-
export declare const default_alias_1:
|
194
|
+
export declare const default_alias_1: {
|
195
|
+
test: {
|
196
|
+
environment: "jsdom";
|
197
|
+
};
|
198
|
+
};
|
199
|
+
|
200
|
+
/**
|
201
|
+
* @internal
|
202
|
+
*/
|
203
|
+
declare function defaultBlockAt(match: ContentMatch): NodeType_2 | null;
|
204
|
+
export { defaultBlockAt }
|
205
|
+
export { defaultBlockAt as defaultBlockAt_alias_1 }
|
141
206
|
|
142
207
|
declare interface DefaultStateOptions {
|
143
208
|
/**
|
@@ -192,6 +257,11 @@ declare function defineBaseCommands(): Extension<{
|
|
192
257
|
from?: number | undefined;
|
193
258
|
to?: number | undefined;
|
194
259
|
}];
|
260
|
+
setNodeAttrs: [options: {
|
261
|
+
type: string | NodeType_2;
|
262
|
+
attrs: Attrs_2;
|
263
|
+
pos?: number | undefined;
|
264
|
+
}];
|
195
265
|
selectAll: [];
|
196
266
|
addMark: [options: {
|
197
267
|
type: string | MarkType_2;
|
@@ -211,12 +281,39 @@ export { defineBaseCommands }
|
|
211
281
|
export { defineBaseCommands as defineBaseCommands_alias_1 }
|
212
282
|
|
213
283
|
/**
|
284
|
+
* Defines some basic key bindings.
|
285
|
+
*
|
214
286
|
* @public
|
215
287
|
*/
|
216
|
-
declare function defineBaseKeymap(
|
288
|
+
declare function defineBaseKeymap(options?: {
|
289
|
+
/**
|
290
|
+
* The priority of the keymap.
|
291
|
+
*
|
292
|
+
* @default Priority.low
|
293
|
+
*/
|
294
|
+
priority?: Priority;
|
295
|
+
}): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
217
296
|
export { defineBaseKeymap }
|
218
297
|
export { defineBaseKeymap as defineBaseKeymap_alias_1 }
|
219
298
|
|
299
|
+
/**
|
300
|
+
* @public
|
301
|
+
*
|
302
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
|
303
|
+
*/
|
304
|
+
declare function defineClickHandler(handler: ClickHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
305
|
+
export { defineClickHandler }
|
306
|
+
export { defineClickHandler as defineClickHandler_alias_1 }
|
307
|
+
|
308
|
+
/**
|
309
|
+
* @public
|
310
|
+
*
|
311
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
|
312
|
+
*/
|
313
|
+
declare function defineClickOnHandler(handler: ClickOnHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
314
|
+
export { defineClickOnHandler }
|
315
|
+
export { defineClickOnHandler as defineClickOnHandler_alias_1 }
|
316
|
+
|
220
317
|
declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
|
221
318
|
COMMAND_ARGS: {
|
222
319
|
[K in keyof T]: Parameters<T[K]>;
|
@@ -238,6 +335,60 @@ NODES: "doc";
|
|
238
335
|
export { defineDoc }
|
239
336
|
export { defineDoc as defineDoc_alias_1 }
|
240
337
|
|
338
|
+
/**
|
339
|
+
* Registers a event handler that is called when the editor document is changed.
|
340
|
+
*
|
341
|
+
* @public
|
342
|
+
*/
|
343
|
+
declare function defineDocChangeHandler(handler: DocChangeHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
344
|
+
export { defineDocChangeHandler }
|
345
|
+
export { defineDocChangeHandler as defineDocChangeHandler_alias_1 }
|
346
|
+
|
347
|
+
/**
|
348
|
+
* Register a new event handler for the given event type.
|
349
|
+
*
|
350
|
+
* @public
|
351
|
+
*/
|
352
|
+
declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
353
|
+
export { defineDOMEventHandler }
|
354
|
+
export { defineDOMEventHandler as defineDOMEventHandler_alias_1 }
|
355
|
+
|
356
|
+
/**
|
357
|
+
* @public
|
358
|
+
*
|
359
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
|
360
|
+
*/
|
361
|
+
declare function defineDoubleClickHandler(handler: DoubleClickHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
362
|
+
export { defineDoubleClickHandler }
|
363
|
+
export { defineDoubleClickHandler as defineDoubleClickHandler_alias_1 }
|
364
|
+
|
365
|
+
/**
|
366
|
+
* @public
|
367
|
+
*
|
368
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
|
369
|
+
*/
|
370
|
+
declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
371
|
+
export { defineDoubleClickOnHandler }
|
372
|
+
export { defineDoubleClickOnHandler as defineDoubleClickOnHandler_alias_1 }
|
373
|
+
|
374
|
+
/**
|
375
|
+
* @public
|
376
|
+
*
|
377
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
|
378
|
+
*/
|
379
|
+
declare function defineDropHandler(handler: DropHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
380
|
+
export { defineDropHandler }
|
381
|
+
export { defineDropHandler as defineDropHandler_alias_1 }
|
382
|
+
|
383
|
+
/**
|
384
|
+
* Registers a event handler that is called when the editor gains or loses focus.
|
385
|
+
*
|
386
|
+
* @public
|
387
|
+
*/
|
388
|
+
declare function defineFocusChangeHandler(handler: FocusChangeHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
389
|
+
export { defineFocusChangeHandler }
|
390
|
+
export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
|
391
|
+
|
241
392
|
/**
|
242
393
|
* Add undo/redo history to the editor.
|
243
394
|
*/
|
@@ -251,18 +402,13 @@ export { defineHistory }
|
|
251
402
|
export { defineHistory as defineHistory_alias_1 }
|
252
403
|
|
253
404
|
/**
|
254
|
-
* Defines an input rule extension.
|
255
|
-
*
|
256
|
-
* @param rule - The ProseMirror input rule to add, or an array of input rules,
|
257
|
-
* or a function that returns one or multiple input rules.
|
258
|
-
*
|
259
405
|
* @public
|
406
|
+
*
|
407
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
|
260
408
|
*/
|
261
|
-
declare function
|
262
|
-
|
263
|
-
|
264
|
-
export { defineInputRule }
|
265
|
-
export { defineInputRule as defineInputRule_alias_1 }
|
409
|
+
declare function defineKeyDownHandler(handler: KeyDownHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
410
|
+
export { defineKeyDownHandler }
|
411
|
+
export { defineKeyDownHandler as defineKeyDownHandler_alias_1 }
|
266
412
|
|
267
413
|
/**
|
268
414
|
* @public
|
@@ -271,6 +417,22 @@ declare function defineKeymap(keymap: Keymap): Extension;
|
|
271
417
|
export { defineKeymap }
|
272
418
|
export { defineKeymap as defineKeymap_alias_1 }
|
273
419
|
|
420
|
+
/**
|
421
|
+
* @public
|
422
|
+
*
|
423
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
|
424
|
+
*/
|
425
|
+
declare function defineKeyPressHandler(handler: KeyPressHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
426
|
+
export { defineKeyPressHandler }
|
427
|
+
export { defineKeyPressHandler as defineKeyPressHandler_alias_1 }
|
428
|
+
|
429
|
+
/**
|
430
|
+
* @public
|
431
|
+
*/
|
432
|
+
declare function defineMarkAttr(options: MarkAttrOptions): Extension;
|
433
|
+
export { defineMarkAttr }
|
434
|
+
export { defineMarkAttr as defineMarkAttr_alias_1 }
|
435
|
+
|
274
436
|
/**
|
275
437
|
* @public
|
276
438
|
*/
|
@@ -281,6 +443,26 @@ export { defineMarkSpec }
|
|
281
443
|
export { defineMarkSpec as defineMarkSpec_alias_1 }
|
282
444
|
|
283
445
|
/**
|
446
|
+
* Registers a event handler that is called when the editor view is mounted.
|
447
|
+
*
|
448
|
+
* @public
|
449
|
+
*/
|
450
|
+
declare function defineMountHandler(handler: MountHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
451
|
+
export { defineMountHandler }
|
452
|
+
export { defineMountHandler as defineMountHandler_alias_1 }
|
453
|
+
|
454
|
+
/**
|
455
|
+
* Defines an attribute for a node type.
|
456
|
+
*
|
457
|
+
* @public
|
458
|
+
*/
|
459
|
+
declare function defineNodeAttr(options: NodeAttrOptions): Extension;
|
460
|
+
export { defineNodeAttr }
|
461
|
+
export { defineNodeAttr as defineNodeAttr_alias_1 }
|
462
|
+
|
463
|
+
/**
|
464
|
+
* Defines a node type.
|
465
|
+
*
|
284
466
|
* @public
|
285
467
|
*/
|
286
468
|
declare function defineNodeSpec<NodeName extends string>(options: NodeSpecOptions<NodeName>): Extension<{
|
@@ -293,9 +475,12 @@ declare function defineNodeView(options: NodeViewOptions): Extension;
|
|
293
475
|
export { defineNodeView }
|
294
476
|
export { defineNodeView as defineNodeView_alias_1 }
|
295
477
|
|
296
|
-
|
297
|
-
|
298
|
-
|
478
|
+
/**
|
479
|
+
* @internal
|
480
|
+
*/
|
481
|
+
declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
|
482
|
+
export { defineNodeViewFactory }
|
483
|
+
export { defineNodeViewFactory as defineNodeViewFactory_alias_1 }
|
299
484
|
|
300
485
|
/**
|
301
486
|
* @public
|
@@ -317,6 +502,15 @@ export declare function defineParagraphSpec(): Extension< {
|
|
317
502
|
NODES: "paragraph";
|
318
503
|
}>;
|
319
504
|
|
505
|
+
/**
|
506
|
+
* @public
|
507
|
+
*
|
508
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
|
509
|
+
*/
|
510
|
+
declare function definePasteHandler(handler: PasteHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
511
|
+
export { definePasteHandler }
|
512
|
+
export { definePasteHandler as definePasteHandler_alias_1 }
|
513
|
+
|
320
514
|
/**
|
321
515
|
* Adds a ProseMirror plugin to the editor.
|
322
516
|
*
|
@@ -331,6 +525,15 @@ declare function definePlugin(plugin: Plugin_2 | Plugin_2[] | ((context: {
|
|
331
525
|
export { definePlugin }
|
332
526
|
export { definePlugin as definePlugin_alias_1 }
|
333
527
|
|
528
|
+
/**
|
529
|
+
* @public
|
530
|
+
*
|
531
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
|
532
|
+
*/
|
533
|
+
declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
534
|
+
export { defineScrollToSelectionHandler }
|
535
|
+
export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_1 }
|
536
|
+
|
334
537
|
/**
|
335
538
|
* @public
|
336
539
|
*/
|
@@ -341,12 +544,126 @@ export { defineText }
|
|
341
544
|
export { defineText as defineText_alias_1 }
|
342
545
|
|
343
546
|
/**
|
344
|
-
* @
|
547
|
+
* @public
|
548
|
+
*
|
549
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
|
550
|
+
*/
|
551
|
+
declare function defineTextInputHandler(handler: TextInputHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
552
|
+
export { defineTextInputHandler }
|
553
|
+
export { defineTextInputHandler as defineTextInputHandler_alias_1 }
|
554
|
+
|
555
|
+
/**
|
556
|
+
* @public
|
557
|
+
*
|
558
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
|
559
|
+
*/
|
560
|
+
declare function defineTripleClickHandler(handler: TripleClickHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
561
|
+
export { defineTripleClickHandler }
|
562
|
+
export { defineTripleClickHandler as defineTripleClickHandler_alias_1 }
|
563
|
+
|
564
|
+
/**
|
565
|
+
* @public
|
566
|
+
*
|
567
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
|
568
|
+
*/
|
569
|
+
declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
570
|
+
export { defineTripleClickOnHandler }
|
571
|
+
export { defineTripleClickOnHandler as defineTripleClickOnHandler_alias_1 }
|
572
|
+
|
573
|
+
/**
|
574
|
+
* Registers a event handler that is called when the editor view is unmounted.
|
575
|
+
*
|
576
|
+
* @public
|
577
|
+
*/
|
578
|
+
declare function defineUnmountHandler(handler: UnmountHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
579
|
+
export { defineUnmountHandler }
|
580
|
+
export { defineUnmountHandler as defineUnmountHandler_alias_1 }
|
581
|
+
|
582
|
+
/**
|
583
|
+
* Registers a event handler that is called when the editor state is updated.
|
584
|
+
*
|
585
|
+
* @public
|
345
586
|
*/
|
346
587
|
declare function defineUpdateHandler(handler: UpdateHandler): Extension<ExtensionTyping<string, string, CommandArgs>>;
|
347
588
|
export { defineUpdateHandler }
|
348
589
|
export { defineUpdateHandler as defineUpdateHandler_alias_1 }
|
349
590
|
|
591
|
+
/**
|
592
|
+
* A function that is called when the editor document is changed.
|
593
|
+
*
|
594
|
+
* @param view - The editor view.
|
595
|
+
* @param prevState - The previous editor state.
|
596
|
+
*
|
597
|
+
* @public
|
598
|
+
*/
|
599
|
+
declare type DocChangeHandler = (view: EditorView, prevState: EditorState) => void;
|
600
|
+
export { DocChangeHandler }
|
601
|
+
export { DocChangeHandler as DocChangeHandler_alias_1 }
|
602
|
+
|
603
|
+
/**
|
604
|
+
* @internal
|
605
|
+
*/
|
606
|
+
export declare class DOMDocumentNotFoundError extends ProseKitError {
|
607
|
+
constructor();
|
608
|
+
}
|
609
|
+
|
610
|
+
/** @public */
|
611
|
+
declare type DOMDocumentOptions = {
|
612
|
+
document?: Document;
|
613
|
+
};
|
614
|
+
export { DOMDocumentOptions }
|
615
|
+
export { DOMDocumentOptions as DOMDocumentOptions_alias_1 }
|
616
|
+
|
617
|
+
/**
|
618
|
+
* @internal
|
619
|
+
*/
|
620
|
+
export declare const domEventFacet: Facet<DOMEventPayload, PluginPayload>;
|
621
|
+
|
622
|
+
/**
|
623
|
+
* A function to handle the events fired on the editable DOM element. Returns
|
624
|
+
* `true` to indicate that it handled the given event. you are responsible for
|
625
|
+
* calling `preventDefault` yourself (or not, if you want to allow the default
|
626
|
+
* behavior).
|
627
|
+
*
|
628
|
+
* @public
|
629
|
+
*/
|
630
|
+
declare type DOMEventHandler<Event extends keyof DOMEventMap = string> = (view: EditorView, event: DOMEventMap[Event]) => boolean | void;
|
631
|
+
export { DOMEventHandler }
|
632
|
+
export { DOMEventHandler as DOMEventHandler_alias_1 }
|
633
|
+
|
634
|
+
/**
|
635
|
+
* @internal
|
636
|
+
*/
|
637
|
+
export declare type DOMEventPayload = [event: string, handler: DOMEventHandler];
|
638
|
+
|
639
|
+
export declare type DOMNode = InstanceType<typeof window.Node>;
|
640
|
+
|
641
|
+
/** @public */
|
642
|
+
declare type DOMParserOptions = {
|
643
|
+
DOMParser?: typeof DOMParser_2;
|
644
|
+
};
|
645
|
+
export { DOMParserOptions }
|
646
|
+
export { DOMParserOptions as DOMParserOptions_alias_1 }
|
647
|
+
|
648
|
+
/** @public */
|
649
|
+
declare type DOMSerializerOptions = {
|
650
|
+
DOMSerializer?: typeof DOMSerializer;
|
651
|
+
};
|
652
|
+
export { DOMSerializerOptions }
|
653
|
+
export { DOMSerializerOptions as DOMSerializerOptions_alias_1 }
|
654
|
+
|
655
|
+
declare type DoubleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
|
656
|
+
export { DoubleClickHandler }
|
657
|
+
export { DoubleClickHandler as DoubleClickHandler_alias_1 }
|
658
|
+
|
659
|
+
declare type DoubleClickOnHandler = (view: EditorView, pos: number, node: Node_3, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
|
660
|
+
export { DoubleClickOnHandler }
|
661
|
+
export { DoubleClickOnHandler as DoubleClickOnHandler_alias_1 }
|
662
|
+
|
663
|
+
declare type DropHandler = (view: EditorView, event: DragEvent, slice: Slice, moved: boolean) => boolean | void;
|
664
|
+
export { DropHandler }
|
665
|
+
export { DropHandler as DropHandler_alias_1 }
|
666
|
+
|
350
667
|
/**
|
351
668
|
* @public
|
352
669
|
*/
|
@@ -358,27 +675,57 @@ declare class Editor<E extends Extension = any> {
|
|
358
675
|
* @internal
|
359
676
|
*/
|
360
677
|
static create(instance: any): Editor<any>;
|
678
|
+
/**
|
679
|
+
* Whether the editor is mounted.
|
680
|
+
*/
|
361
681
|
get mounted(): boolean;
|
682
|
+
/**
|
683
|
+
* The editor view.
|
684
|
+
*/
|
362
685
|
get view(): EditorView;
|
686
|
+
/**
|
687
|
+
* The editor schema.
|
688
|
+
*/
|
363
689
|
get schema(): Schema<ExtractNodes<E>, ExtractMarks<E>>;
|
364
690
|
get commands(): ExtractCommandAppliers<E>;
|
365
|
-
|
691
|
+
/**
|
692
|
+
* Whether the editor is focused.
|
693
|
+
*/
|
694
|
+
get focused(): boolean;
|
695
|
+
/**
|
696
|
+
* Mount the editor to the given HTML element.
|
697
|
+
* Pass `null` or `undefined` to unmount the editor.
|
698
|
+
*/
|
699
|
+
mount(place: HTMLElement | null | undefined): void;
|
700
|
+
/**
|
701
|
+
* Unmount the editor. This is equivalent to `mount(null)`.
|
702
|
+
*/
|
366
703
|
unmount(): void;
|
367
|
-
use(extension: Extension): VoidFunction;
|
368
704
|
/**
|
369
|
-
*
|
705
|
+
* Focus the editor.
|
370
706
|
*/
|
371
|
-
|
707
|
+
focus(): void;
|
372
708
|
/**
|
373
|
-
*
|
709
|
+
* Blur the editor.
|
374
710
|
*/
|
375
|
-
|
711
|
+
blur(): void;
|
712
|
+
use(extension: Extension): VoidFunction;
|
713
|
+
get state(): EditorState;
|
376
714
|
get nodes(): Record<ExtractNodes<E>, NodeBuilder>;
|
377
715
|
get marks(): Record<ExtractMarks<E>, MarkBuilder>;
|
378
716
|
}
|
379
717
|
export { Editor }
|
380
718
|
export { Editor as Editor_alias_1 }
|
381
719
|
|
720
|
+
/**
|
721
|
+
* @internal
|
722
|
+
*/
|
723
|
+
declare class EditorNotFoundError extends ProseKitError {
|
724
|
+
constructor();
|
725
|
+
}
|
726
|
+
export { EditorNotFoundError }
|
727
|
+
export { EditorNotFoundError as EditorNotFoundError_alias_1 }
|
728
|
+
|
382
729
|
/**
|
383
730
|
* @public
|
384
731
|
*/
|
@@ -411,12 +758,44 @@ export { EditorOptions as EditorOptions_alias_1 }
|
|
411
758
|
*
|
412
759
|
* @internal
|
413
760
|
*/
|
414
|
-
export declare function elementFromHTML(html: string): HTMLElement;
|
761
|
+
export declare function elementFromHTML(html: string, options?: DOMDocumentOptions): HTMLElement;
|
762
|
+
|
763
|
+
/**
|
764
|
+
* Parse a ProseMirror document JSON object to a HTML element.
|
765
|
+
*
|
766
|
+
* @public
|
767
|
+
*/
|
768
|
+
declare function elementFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
|
769
|
+
export { elementFromJSON }
|
770
|
+
export { elementFromJSON as elementFromJSON_alias_1 }
|
771
|
+
|
772
|
+
/**
|
773
|
+
* Serialize a ProseMirror node to a HTML element.
|
774
|
+
*
|
775
|
+
* @public
|
776
|
+
*/
|
777
|
+
declare function elementFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
|
778
|
+
export { elementFromNode }
|
779
|
+
export { elementFromNode as elementFromNode_alias_1 }
|
415
780
|
|
416
781
|
declare type EmptyValue = undefined | null | EmptyObject;
|
417
782
|
|
418
783
|
export declare type ExceptEmptyValue<T> = ConditionalExcept<T, EmptyValue>;
|
419
784
|
|
785
|
+
/**
|
786
|
+
* Expands the selection to include the entire mark at the current position.
|
787
|
+
*
|
788
|
+
* @public
|
789
|
+
*/
|
790
|
+
declare function expandMark(options: {
|
791
|
+
/**
|
792
|
+
* The type of the mark to expand.
|
793
|
+
*/
|
794
|
+
type: string | MarkType;
|
795
|
+
}): Command;
|
796
|
+
export { expandMark }
|
797
|
+
export { expandMark as expandMark_alias_1 }
|
798
|
+
|
420
799
|
/**
|
421
800
|
* @public
|
422
801
|
*/
|
@@ -561,14 +940,46 @@ declare interface FacetOptions<Input, Output> {
|
|
561
940
|
export { FacetOptions }
|
562
941
|
export { FacetOptions as FacetOptions_alias_1 }
|
563
942
|
|
564
|
-
export declare function
|
943
|
+
export declare function findBrowserDocument(options?: {
|
944
|
+
document?: Document;
|
945
|
+
}): Document | undefined;
|
946
|
+
|
947
|
+
export declare function findBrowserWindow(options?: {
|
948
|
+
document?: Document;
|
949
|
+
}): (Window & typeof globalThis) | null | undefined;
|
950
|
+
|
951
|
+
/**
|
952
|
+
* A function that is called when the editor gains or loses focus.
|
953
|
+
*
|
954
|
+
* @param hasFocus - Whether the editor has focus.
|
955
|
+
*
|
956
|
+
* @public
|
957
|
+
*/
|
958
|
+
declare type FocusChangeHandler = (hasFocus: boolean) => void;
|
959
|
+
export { FocusChangeHandler }
|
960
|
+
export { FocusChangeHandler as FocusChangeHandler_alias_1 }
|
961
|
+
|
962
|
+
export declare function getBrowserDocument(options?: {
|
963
|
+
document?: Document;
|
964
|
+
}): Document;
|
565
965
|
|
566
|
-
export declare function getBrowserWindow(
|
966
|
+
export declare function getBrowserWindow(options?: {
|
967
|
+
document?: Document;
|
968
|
+
}): Window & typeof globalThis;
|
567
969
|
|
568
970
|
export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_3;
|
569
971
|
|
570
972
|
export declare function getFacetCount(): number;
|
571
973
|
|
974
|
+
/**
|
975
|
+
* Returns a unique id in the current process that can be used in various places.
|
976
|
+
*
|
977
|
+
* @internal
|
978
|
+
*/
|
979
|
+
declare function getId(): string;
|
980
|
+
export { getId as _getId }
|
981
|
+
export { getId }
|
982
|
+
|
572
983
|
/**
|
573
984
|
* @internal
|
574
985
|
*/
|
@@ -583,6 +994,41 @@ declare function getNodeType(schema: Schema, type: string | NodeType): NodeType;
|
|
583
994
|
export { getNodeType }
|
584
995
|
export { getNodeType as getNodeType_alias_1 }
|
585
996
|
|
997
|
+
export declare type GroupedEntries<T extends Record<string, any>> = {
|
998
|
+
[K in keyof T]?: T[K][];
|
999
|
+
};
|
1000
|
+
|
1001
|
+
export declare function groupEntries<T extends Record<string, any>>(entries: ObjectEntries<T>[]): GroupedEntries<T>;
|
1002
|
+
|
1003
|
+
/**
|
1004
|
+
* @internal
|
1005
|
+
*/
|
1006
|
+
export declare function htmlFromElement(element: HTMLElement): string;
|
1007
|
+
|
1008
|
+
/**
|
1009
|
+
* Parse a ProseMirror document JSON object to a HTML string.
|
1010
|
+
*
|
1011
|
+
* @public
|
1012
|
+
*/
|
1013
|
+
declare function htmlFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): string;
|
1014
|
+
export { htmlFromJSON }
|
1015
|
+
export { htmlFromJSON as htmlFromJSON_alias_1 }
|
1016
|
+
|
1017
|
+
/**
|
1018
|
+
* Serialize a ProseMirror node to a HTML string
|
1019
|
+
*
|
1020
|
+
* @public
|
1021
|
+
*/
|
1022
|
+
declare function htmlFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): string;
|
1023
|
+
export { htmlFromNode }
|
1024
|
+
export { htmlFromNode as htmlFromNode_alias_1 }
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* Returns a command that inserts the given node at the current selection or at
|
1028
|
+
* the given position.
|
1029
|
+
*
|
1030
|
+
* @public
|
1031
|
+
*/
|
586
1032
|
declare function insertNode(options: {
|
587
1033
|
node: ProseMirrorNode;
|
588
1034
|
pos?: number;
|
@@ -602,6 +1048,11 @@ export declare function insertNodeAction({ node, pos, }: {
|
|
602
1048
|
pos?: number;
|
603
1049
|
}): Action;
|
604
1050
|
|
1051
|
+
/**
|
1052
|
+
* Returns a command that inserts the given text.
|
1053
|
+
*
|
1054
|
+
* @public
|
1055
|
+
*/
|
605
1056
|
export declare function insertText({ text, from, to, }: {
|
606
1057
|
text: string;
|
607
1058
|
from?: number;
|
@@ -615,6 +1066,17 @@ declare function isAllSelection(sel: Selection_2): sel is AllSelection;
|
|
615
1066
|
export { isAllSelection }
|
616
1067
|
export { isAllSelection as isAllSelection_alias_1 }
|
617
1068
|
|
1069
|
+
export declare function isElement(value: unknown): value is Element;
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* Check if the selection is in a code block.
|
1073
|
+
*
|
1074
|
+
* @internal
|
1075
|
+
*/
|
1076
|
+
declare function isInCodeBlock(selection: Selection_2): boolean | undefined;
|
1077
|
+
export { isInCodeBlock }
|
1078
|
+
export { isInCodeBlock as isInCodeBlock_alias_1 }
|
1079
|
+
|
618
1080
|
export declare const isMac: boolean;
|
619
1081
|
|
620
1082
|
/**
|
@@ -624,6 +1086,9 @@ declare function isMark(mark: unknown): mark is Mark;
|
|
624
1086
|
export { isMark }
|
625
1087
|
export { isMark as isMark_alias_1 }
|
626
1088
|
|
1089
|
+
/**
|
1090
|
+
* @internal
|
1091
|
+
*/
|
627
1092
|
export declare function isMarkActive(state: EditorState, type: string | MarkType, attrs?: Attrs | null): boolean;
|
628
1093
|
|
629
1094
|
export declare function isNodeActive(state: EditorState, type: string | NodeType, attrs?: Attrs | null): boolean;
|
@@ -652,20 +1117,18 @@ export { isTextSelection }
|
|
652
1117
|
export { isTextSelection as isTextSelection_alias_1 }
|
653
1118
|
|
654
1119
|
/**
|
655
|
-
*
|
1120
|
+
* Serialize a HTML element to a ProseMirror document JSON object.
|
656
1121
|
*
|
657
1122
|
* @public
|
658
1123
|
*/
|
659
|
-
declare function jsonFromElement(element:
|
660
|
-
export { jsonFromElement }
|
661
|
-
export { jsonFromElement as jsonFromElement_alias_1 }
|
1124
|
+
export declare function jsonFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): NodeJSON;
|
662
1125
|
|
663
1126
|
/**
|
664
|
-
* Parse a HTML string to a ProseMirror document JSON.
|
1127
|
+
* Parse a HTML string to a ProseMirror document JSON object.
|
665
1128
|
*
|
666
1129
|
* @public
|
667
1130
|
*/
|
668
|
-
declare function jsonFromHTML(html: string,
|
1131
|
+
declare function jsonFromHTML(html: string, options: DOMDocumentOptions & DOMParserOptions & JSONParserOptions): NodeJSON;
|
669
1132
|
export { jsonFromHTML }
|
670
1133
|
export { jsonFromHTML as jsonFromHTML_alias_1 }
|
671
1134
|
|
@@ -687,6 +1150,17 @@ declare function jsonFromState(state: EditorState): StateJSON;
|
|
687
1150
|
export { jsonFromState }
|
688
1151
|
export { jsonFromState as jsonFromState_alias_1 }
|
689
1152
|
|
1153
|
+
/** @public */
|
1154
|
+
declare type JSONParserOptions = {
|
1155
|
+
schema: Schema;
|
1156
|
+
};
|
1157
|
+
export { JSONParserOptions }
|
1158
|
+
export { JSONParserOptions as JSONParserOptions_alias_1 }
|
1159
|
+
|
1160
|
+
declare type KeyDownHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
|
1161
|
+
export { KeyDownHandler }
|
1162
|
+
export { KeyDownHandler as KeyDownHandler_alias_1 }
|
1163
|
+
|
690
1164
|
/**
|
691
1165
|
* @public
|
692
1166
|
*/
|
@@ -696,6 +1170,54 @@ declare interface Keymap {
|
|
696
1170
|
export { Keymap }
|
697
1171
|
export { Keymap as Keymap_alias_1 }
|
698
1172
|
|
1173
|
+
/**
|
1174
|
+
* @internal
|
1175
|
+
*/
|
1176
|
+
declare const keymapFacet: Facet<Keymap, PluginPayload>;
|
1177
|
+
export { keymapFacet }
|
1178
|
+
export { keymapFacet as keymapFacet_alias_1 }
|
1179
|
+
|
1180
|
+
/**
|
1181
|
+
* @internal
|
1182
|
+
*/
|
1183
|
+
declare type KeymapPayload = Keymap;
|
1184
|
+
export { KeymapPayload }
|
1185
|
+
export { KeymapPayload as KeymapPayload_alias_1 }
|
1186
|
+
|
1187
|
+
declare type KeyPressHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
|
1188
|
+
export { KeyPressHandler }
|
1189
|
+
export { KeyPressHandler as KeyPressHandler_alias_1 }
|
1190
|
+
|
1191
|
+
/**
|
1192
|
+
* @public
|
1193
|
+
*/
|
1194
|
+
declare interface MarkAttrOptions {
|
1195
|
+
/**
|
1196
|
+
* The name of the mark type.
|
1197
|
+
*/
|
1198
|
+
type: string;
|
1199
|
+
/**
|
1200
|
+
* The name of the attribute.
|
1201
|
+
*/
|
1202
|
+
attr: string;
|
1203
|
+
/**
|
1204
|
+
* The default value for this attribute, to use when no explicit value is
|
1205
|
+
* provided. Attributes that have no default must be provided whenever a mark
|
1206
|
+
* of a type that has them is created.
|
1207
|
+
*/
|
1208
|
+
default?: any;
|
1209
|
+
/**
|
1210
|
+
* Returns the attribute key and value to be set on the DOM node.
|
1211
|
+
*/
|
1212
|
+
toDOM?: (value: any) => [key: string, value: string] | null | void;
|
1213
|
+
/**
|
1214
|
+
* Parses the attribute value from the DOM.
|
1215
|
+
*/
|
1216
|
+
parseDOM?: (node: HTMLElement) => any;
|
1217
|
+
}
|
1218
|
+
export { MarkAttrOptions }
|
1219
|
+
export { MarkAttrOptions as MarkAttrOptions_alias_1 }
|
1220
|
+
|
699
1221
|
export declare interface MarkBuilder {
|
700
1222
|
(attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[];
|
701
1223
|
(...children: NodeChild[]): ProseMirrorNode[];
|
@@ -711,6 +1233,47 @@ declare interface MarkSpecOptions<MarkName extends string = string> extends Mark
|
|
711
1233
|
export { MarkSpecOptions }
|
712
1234
|
export { MarkSpecOptions as MarkSpecOptions_alias_1 }
|
713
1235
|
|
1236
|
+
/**
|
1237
|
+
* A function that is called when the editor view is mounted.
|
1238
|
+
*
|
1239
|
+
* @param view - The editor view.
|
1240
|
+
*
|
1241
|
+
* @public
|
1242
|
+
*/
|
1243
|
+
declare type MountHandler = (view: EditorView) => void;
|
1244
|
+
export { MountHandler }
|
1245
|
+
export { MountHandler as MountHandler_alias_1 }
|
1246
|
+
|
1247
|
+
/**
|
1248
|
+
* @public
|
1249
|
+
*/
|
1250
|
+
declare interface NodeAttrOptions {
|
1251
|
+
/**
|
1252
|
+
* The name of the node type.
|
1253
|
+
*/
|
1254
|
+
type: string;
|
1255
|
+
/**
|
1256
|
+
* The name of the attribute.
|
1257
|
+
*/
|
1258
|
+
attr: string;
|
1259
|
+
/**
|
1260
|
+
* The default value for this attribute, to use when no explicit value is
|
1261
|
+
* provided. Attributes that have no default must be provided whenever a node
|
1262
|
+
* of a type that has them is created.
|
1263
|
+
*/
|
1264
|
+
default?: any;
|
1265
|
+
/**
|
1266
|
+
* Returns the attribute key and value to be set on the DOM node.
|
1267
|
+
*/
|
1268
|
+
toDOM?: (value: any) => [key: string, value: string] | null | void;
|
1269
|
+
/**
|
1270
|
+
* Parses the attribute value from the DOM.
|
1271
|
+
*/
|
1272
|
+
parseDOM?: (node: HTMLElement) => any;
|
1273
|
+
}
|
1274
|
+
export { NodeAttrOptions }
|
1275
|
+
export { NodeAttrOptions as NodeAttrOptions_alias_1 }
|
1276
|
+
|
714
1277
|
export declare interface NodeBuilder {
|
715
1278
|
(attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode;
|
716
1279
|
(...children: NodeChild[]): ProseMirrorNode;
|
@@ -726,7 +1289,7 @@ export declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeCo
|
|
726
1289
|
*
|
727
1290
|
* @public
|
728
1291
|
*/
|
729
|
-
declare function nodeFromElement(element:
|
1292
|
+
declare function nodeFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): ProseMirrorNode;
|
730
1293
|
export { nodeFromElement }
|
731
1294
|
export { nodeFromElement as nodeFromElement_alias_1 }
|
732
1295
|
|
@@ -735,7 +1298,7 @@ export { nodeFromElement as nodeFromElement_alias_1 }
|
|
735
1298
|
*
|
736
1299
|
* @public
|
737
1300
|
*/
|
738
|
-
declare function nodeFromHTML(html: string,
|
1301
|
+
declare function nodeFromHTML(html: string, options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions): ProseMirrorNode;
|
739
1302
|
export { nodeFromHTML }
|
740
1303
|
export { nodeFromHTML as nodeFromHTML_alias_1 }
|
741
1304
|
|
@@ -744,7 +1307,7 @@ export { nodeFromHTML as nodeFromHTML_alias_1 }
|
|
744
1307
|
*
|
745
1308
|
* @public
|
746
1309
|
*/
|
747
|
-
declare function nodeFromJSON(json: NodeJSON,
|
1310
|
+
declare function nodeFromJSON(json: NodeJSON, options: JSONParserOptions): ProseMirrorNode;
|
748
1311
|
export { nodeFromJSON }
|
749
1312
|
export { nodeFromJSON as nodeFromJSON_alias_1 }
|
750
1313
|
|
@@ -773,17 +1336,20 @@ declare interface NodeSpecOptions<NodeName extends string = string> extends Node
|
|
773
1336
|
export { NodeSpecOptions }
|
774
1337
|
export { NodeSpecOptions as NodeSpecOptions_alias_1 }
|
775
1338
|
|
776
|
-
|
1339
|
+
/**
|
1340
|
+
* @internal
|
1341
|
+
*/
|
1342
|
+
declare type NodeViewFactoryOptions<T> = {
|
777
1343
|
group: string;
|
778
1344
|
name: string;
|
779
|
-
args:
|
1345
|
+
args: T;
|
780
1346
|
} | {
|
781
1347
|
group: string;
|
782
1348
|
name?: undefined;
|
783
|
-
factory: (args:
|
1349
|
+
factory: (args: T) => NodeViewConstructor;
|
784
1350
|
};
|
785
|
-
export {
|
786
|
-
export {
|
1351
|
+
export { NodeViewFactoryOptions }
|
1352
|
+
export { NodeViewFactoryOptions as NodeViewFactoryOptions_alias_1 }
|
787
1353
|
|
788
1354
|
declare interface NodeViewOptions {
|
789
1355
|
name: string;
|
@@ -792,8 +1358,34 @@ declare interface NodeViewOptions {
|
|
792
1358
|
export { NodeViewOptions }
|
793
1359
|
export { NodeViewOptions as NodeViewOptions_alias_1 }
|
794
1360
|
|
1361
|
+
/**
|
1362
|
+
* @internal
|
1363
|
+
*/
|
1364
|
+
declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
|
1365
|
+
export { OBJECT_REPLACEMENT_CHARACTER }
|
1366
|
+
export { OBJECT_REPLACEMENT_CHARACTER as OBJECT_REPLACEMENT_CHARACTER_alias_1 }
|
1367
|
+
|
1368
|
+
/**
|
1369
|
+
* @internal
|
1370
|
+
*
|
1371
|
+
* @example
|
1372
|
+
*
|
1373
|
+
* ```
|
1374
|
+
* type MyObject = { a: 1; b: 'B' }
|
1375
|
+
* type MyEntries = ObjectEntries<MyObject>
|
1376
|
+
* // ^ ["a", 1] | ["b", "B"]
|
1377
|
+
*
|
1378
|
+
*/
|
1379
|
+
export declare type ObjectEntries<T extends Record<string, any>> = {
|
1380
|
+
[K in keyof T]: [K, T[K]];
|
1381
|
+
}[keyof T];
|
1382
|
+
|
795
1383
|
export declare function objectEqual<T>(a: T, b: T): boolean;
|
796
1384
|
|
1385
|
+
declare type PasteHandler = (view: EditorView, event: ClipboardEvent, slice: Slice) => boolean | void;
|
1386
|
+
export { PasteHandler }
|
1387
|
+
export { PasteHandler as PasteHandler_alias_1 }
|
1388
|
+
|
797
1389
|
declare type Payload = unknown;
|
798
1390
|
|
799
1391
|
export declare type Payloads = PayloadTuple[];
|
@@ -817,6 +1409,8 @@ export { PluginPayload }
|
|
817
1409
|
export { PluginPayload as PluginPayload_alias_1 }
|
818
1410
|
|
819
1411
|
/**
|
1412
|
+
* ProseKit extension priority.
|
1413
|
+
*
|
820
1414
|
* @public
|
821
1415
|
*/
|
822
1416
|
declare const enum Priority {
|
@@ -831,6 +1425,8 @@ export { Priority as Priority_alias_1 }
|
|
831
1425
|
|
832
1426
|
/**
|
833
1427
|
* Base class for all ProseKit errors.
|
1428
|
+
*
|
1429
|
+
* @internal
|
834
1430
|
*/
|
835
1431
|
declare class ProseKitError extends Error {
|
836
1432
|
}
|
@@ -838,7 +1434,9 @@ export { ProseKitError }
|
|
838
1434
|
export { ProseKitError as ProseKitError_alias_1 }
|
839
1435
|
|
840
1436
|
/**
|
841
|
-
*
|
1437
|
+
* Returns a command that removes the given mark.
|
1438
|
+
*
|
1439
|
+
* @public
|
842
1440
|
*/
|
843
1441
|
declare function removeMark(options: {
|
844
1442
|
/**
|
@@ -865,6 +1463,15 @@ export declare const schemaFacet: Facet<SchemaPayload, SchemaPayload>;
|
|
865
1463
|
|
866
1464
|
export declare type SchemaPayload = SchemaSpec;
|
867
1465
|
|
1466
|
+
declare type ScrollToSelectionHandler = (view: EditorView) => boolean;
|
1467
|
+
export { ScrollToSelectionHandler }
|
1468
|
+
export { ScrollToSelectionHandler as ScrollToSelectionHandler_alias_1 }
|
1469
|
+
|
1470
|
+
/**
|
1471
|
+
* Returns a command that selects the whole document.
|
1472
|
+
*
|
1473
|
+
* @public
|
1474
|
+
*/
|
868
1475
|
export declare function selectAll(): Command;
|
869
1476
|
|
870
1477
|
/**
|
@@ -883,6 +1490,8 @@ export { SelectionJSON as SelectionJSON_alias_1 }
|
|
883
1490
|
/**
|
884
1491
|
* Returns a command that tries to set the selected textblocks to the given node
|
885
1492
|
* type with the given attributes.
|
1493
|
+
*
|
1494
|
+
* @public
|
886
1495
|
*/
|
887
1496
|
declare function setBlockType(options: {
|
888
1497
|
type: NodeType | string;
|
@@ -893,6 +1502,38 @@ declare function setBlockType(options: {
|
|
893
1502
|
export { setBlockType }
|
894
1503
|
export { setBlockType as setBlockType_alias_1 }
|
895
1504
|
|
1505
|
+
/**
|
1506
|
+
* Returns a command that set the attributes of the current node.
|
1507
|
+
*
|
1508
|
+
* @public
|
1509
|
+
*/
|
1510
|
+
declare function setNodeAttrs(options: {
|
1511
|
+
/**
|
1512
|
+
* The type of node to set the attributes of.
|
1513
|
+
*
|
1514
|
+
* If current node is not of this type, the command will do nothing.
|
1515
|
+
*/
|
1516
|
+
type: string | NodeType;
|
1517
|
+
/**
|
1518
|
+
* The attributes to set.
|
1519
|
+
*/
|
1520
|
+
attrs: Attrs;
|
1521
|
+
/**
|
1522
|
+
* The position of the node. Defaults to the position of the wrapping node
|
1523
|
+
* containing the current selection.
|
1524
|
+
*/
|
1525
|
+
pos?: number;
|
1526
|
+
}): Command;
|
1527
|
+
export { setNodeAttrs }
|
1528
|
+
export { setNodeAttrs as setNodeAttrs_alias_1 }
|
1529
|
+
|
1530
|
+
export declare function setSelectionAround(tr: Transaction, pos: number): void;
|
1531
|
+
|
1532
|
+
/**
|
1533
|
+
* @internal
|
1534
|
+
*/
|
1535
|
+
export declare type Setter<T> = (value: T) => void;
|
1536
|
+
|
896
1537
|
/**
|
897
1538
|
* @internal
|
898
1539
|
*/
|
@@ -918,7 +1559,7 @@ export declare const stateFacet: Facet<StatePayload, StatePayload>;
|
|
918
1559
|
*
|
919
1560
|
* @public
|
920
1561
|
*/
|
921
|
-
declare function stateFromJSON(json: StateJSON,
|
1562
|
+
declare function stateFromJSON(json: StateJSON, options: JSONParserOptions): EditorState;
|
922
1563
|
export { stateFromJSON }
|
923
1564
|
export { stateFromJSON as stateFromJSON_alias_1 }
|
924
1565
|
|
@@ -944,6 +1585,10 @@ export declare type StatePayload = (ctx: {
|
|
944
1585
|
schema: Schema;
|
945
1586
|
}) => EditorStateConfig;
|
946
1587
|
|
1588
|
+
declare type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean | void;
|
1589
|
+
export { TextInputHandler }
|
1590
|
+
export { TextInputHandler as TextInputHandler_alias_1 }
|
1591
|
+
|
947
1592
|
export declare type ToCommandApplier<T extends CommandArgs> = {
|
948
1593
|
[K in keyof T]: CommandApplier<T[K]>;
|
949
1594
|
};
|
@@ -956,6 +1601,11 @@ export declare type ToCommandCreators<T extends CommandArgs> = {
|
|
956
1601
|
[K in keyof T]: CommandCreator<T[K]>;
|
957
1602
|
};
|
958
1603
|
|
1604
|
+
/**
|
1605
|
+
* Returns a command that toggles the given mark with the given attributes.
|
1606
|
+
*
|
1607
|
+
* @public
|
1608
|
+
*/
|
959
1609
|
declare function toggleMark({ type, attrs, }: {
|
960
1610
|
type: string | MarkType;
|
961
1611
|
attrs?: Attrs | null;
|
@@ -963,6 +1613,12 @@ declare function toggleMark({ type, attrs, }: {
|
|
963
1613
|
export { toggleMark }
|
964
1614
|
export { toggleMark as toggleMark_alias_1 }
|
965
1615
|
|
1616
|
+
/**
|
1617
|
+
* Returns a command that set the selected textblocks to the given node type
|
1618
|
+
* with the given attributes.
|
1619
|
+
*
|
1620
|
+
* @public
|
1621
|
+
*/
|
966
1622
|
declare function toggleNode({ type, attrs, }: {
|
967
1623
|
type: string | NodeType;
|
968
1624
|
attrs?: Attrs | null;
|
@@ -970,8 +1626,21 @@ declare function toggleNode({ type, attrs, }: {
|
|
970
1626
|
export { toggleNode }
|
971
1627
|
export { toggleNode as toggleNode_alias_1 }
|
972
1628
|
|
1629
|
+
declare type TripleClickHandler = (view: EditorView, pos: number, event: MouseEvent) => boolean | void;
|
1630
|
+
export { TripleClickHandler }
|
1631
|
+
export { TripleClickHandler as TripleClickHandler_alias_1 }
|
1632
|
+
|
1633
|
+
declare type TripleClickOnHandler = (view: EditorView, pos: number, node: Node_3, nodePos: number, event: MouseEvent, direct: boolean) => boolean | void;
|
1634
|
+
export { TripleClickOnHandler }
|
1635
|
+
export { TripleClickOnHandler as TripleClickOnHandler_alias_1 }
|
1636
|
+
|
973
1637
|
declare type Tuple5<T> = [T, T, T, T, T];
|
974
1638
|
|
1639
|
+
/**
|
1640
|
+
* Merge multiple extensions into one.
|
1641
|
+
*
|
1642
|
+
* @public
|
1643
|
+
*/
|
975
1644
|
declare function union<E extends Extension | Extension[]>(extension: E): SimplifyExtension<E>;
|
976
1645
|
export { union }
|
977
1646
|
export { union as union_alias_1 }
|
@@ -989,6 +1658,15 @@ export declare function uniqPush<T>(prev: readonly T[], next: readonly T[]): T[]
|
|
989
1658
|
|
990
1659
|
export declare function uniqRemove<T>(prev: T[], next: T[]): T[];
|
991
1660
|
|
1661
|
+
/**
|
1662
|
+
* A function that is called when the editor view is unmounted.
|
1663
|
+
*
|
1664
|
+
* @public
|
1665
|
+
*/
|
1666
|
+
declare type UnmountHandler = () => void;
|
1667
|
+
export { UnmountHandler }
|
1668
|
+
export { UnmountHandler as UnmountHandler_alias_1 }
|
1669
|
+
|
992
1670
|
export declare function updateExtension(prevInputs: Payloads, prevConverters: Converters, extension: Extension, mode: 'add' | 'remove'): {
|
993
1671
|
schemaInput: SchemaPayload | null;
|
994
1672
|
stateInput: StatePayload | null;
|
@@ -996,10 +1674,17 @@ export declare function updateExtension(prevInputs: Payloads, prevConverters: Co
|
|
996
1674
|
commandInput: CommandCreators | null;
|
997
1675
|
};
|
998
1676
|
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1677
|
+
/**
|
1678
|
+
* A function that is called when the editor state is updated.
|
1679
|
+
*
|
1680
|
+
* @param view - The editor view.
|
1681
|
+
* @param prevState - The previous editor state.
|
1682
|
+
*
|
1683
|
+
* @public
|
1684
|
+
*/
|
1685
|
+
declare type UpdateHandler = (view: EditorView, prevState: EditorState) => void;
|
1686
|
+
export { UpdateHandler }
|
1687
|
+
export { UpdateHandler as UpdateHandler_alias_1 }
|
1003
1688
|
|
1004
1689
|
export declare const viewFacet: Facet<ViewPayload, ViewPayload>;
|
1005
1690
|
|
@@ -1014,6 +1699,19 @@ declare function withPriority<T extends Extension>(extension: T, priority: Prior
|
|
1014
1699
|
export { withPriority }
|
1015
1700
|
export { withPriority as withPriority_alias_1 }
|
1016
1701
|
|
1702
|
+
/**
|
1703
|
+
* @internal
|
1704
|
+
*/
|
1705
|
+
declare function withSkipCodeBlock(command: Command): Command;
|
1706
|
+
export { withSkipCodeBlock }
|
1707
|
+
export { withSkipCodeBlock as withSkipCodeBlock_alias_1 }
|
1708
|
+
|
1709
|
+
/**
|
1710
|
+
* Returns a command that wraps the selected textblock with the given node type
|
1711
|
+
* with the given attributes.
|
1712
|
+
*
|
1713
|
+
* @public
|
1714
|
+
*/
|
1017
1715
|
export declare function wrap({ nodeType, attrs, }: {
|
1018
1716
|
nodeType: NodeType;
|
1019
1717
|
attrs?: Attrs | null;
|