@prosekit/core 0.7.13 → 0.7.15
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 +141 -23
- package/dist/{chunk-LAFNHJDR.js → chunk-B3WEP4DD.js} +97 -82
- package/dist/prosekit-core-test.js +3 -3
- package/dist/prosekit-core.d.ts +12 -3
- package/dist/prosekit-core.js +281 -137
- package/package.json +7 -7
@@ -1,9 +1,10 @@
|
|
1
1
|
import { AllSelection } from '@prosekit/pm/state';
|
2
2
|
import type { Attrs } from '@prosekit/pm/model';
|
3
|
+
import { BaseCommandsExtension as BaseCommandsExtension_2 } from '..';
|
3
4
|
import { Command } from '@prosekit/pm/state';
|
4
5
|
import type { ContentMatch } from '@prosekit/pm/model';
|
5
|
-
import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
|
6
6
|
import type { DirectEditorProps } from '@prosekit/pm/view';
|
7
|
+
import { DocExtension as DocExtension_2 } from '..';
|
7
8
|
import type { DOMEventMap } from '@prosekit/pm/view';
|
8
9
|
import type { DOMOutputSpec } from '@prosekit/pm/model';
|
9
10
|
import { DOMParser as DOMParser_2 } from '@prosekit/pm/model';
|
@@ -11,20 +12,24 @@ import { DOMSerializer } from '@prosekit/pm/model';
|
|
11
12
|
import { EditorState } from '@prosekit/pm/state';
|
12
13
|
import type { EditorStateConfig } from '@prosekit/pm/state';
|
13
14
|
import { EditorView } from '@prosekit/pm/view';
|
15
|
+
import { Facet as Facet_2 } from '../..';
|
14
16
|
import { Fragment } from '@prosekit/pm/model';
|
17
|
+
import { HistoryExtension as HistoryExtension_2 } from '..';
|
15
18
|
import type { IsEqual } from 'type-fest';
|
16
19
|
import { Mark } from '@prosekit/pm/model';
|
17
20
|
import type { MarkSpec } from '@prosekit/pm/model';
|
18
21
|
import type { MarkType } from '@prosekit/pm/model';
|
22
|
+
import type { MarkViewConstructor } from '@prosekit/pm/view';
|
19
23
|
import type { Node as Node_2 } from '@prosekit/pm/model';
|
24
|
+
import { NodeAction as NodeAction_2 } from '..';
|
20
25
|
import { NodeSelection } from '@prosekit/pm/state';
|
21
26
|
import type { NodeSpec } from '@prosekit/pm/model';
|
22
27
|
import type { NodeType } from '@prosekit/pm/model';
|
23
28
|
import { NodeType as NodeType_2 } from 'prosemirror-model';
|
24
29
|
import type { NodeView } from '@prosekit/pm/view';
|
25
30
|
import type { NodeViewConstructor } from '@prosekit/pm/view';
|
26
|
-
import { Options } from 'tsup';
|
27
31
|
import { ParseOptions } from '@prosekit/pm/model';
|
32
|
+
import { PlainExtension as PlainExtension_2 } from '..';
|
28
33
|
import { Plugin as Plugin_2 } from '@prosekit/pm/state';
|
29
34
|
import { ProseMirrorFragment } from '@prosekit/pm/model';
|
30
35
|
import { ProseMirrorNode } from '@prosekit/pm/model';
|
@@ -33,10 +38,14 @@ import { Schema } from '@prosekit/pm/model';
|
|
33
38
|
import { SchemaSpec } from '@prosekit/pm/model';
|
34
39
|
import { Selection as Selection_2 } from '@prosekit/pm/state';
|
35
40
|
import type { Simplify } from 'type-fest';
|
41
|
+
import { SimplifyDeeper as SimplifyDeeper_2 } from '..';
|
36
42
|
import { Slice } from '@prosekit/pm/model';
|
37
43
|
import type { TagParseRule } from '@prosekit/pm/model';
|
44
|
+
import { TextExtension as TextExtension_2 } from '..';
|
38
45
|
import { TextSelection } from '@prosekit/pm/state';
|
46
|
+
import { ToMarkAction as ToMarkAction_2 } from '..';
|
39
47
|
import { Transaction } from '@prosekit/pm/state';
|
48
|
+
import { Union as Union_2 } from '..';
|
40
49
|
import type { UnionToIntersection } from 'type-fest';
|
41
50
|
|
42
51
|
declare type Action = (options: {
|
@@ -189,7 +198,7 @@ export { BaseCommandsExtension as BaseCommandsExtension_alias_1 }
|
|
189
198
|
* @internal
|
190
199
|
*/
|
191
200
|
export declare abstract class BaseExtension<T extends ExtensionTyping = ExtensionTyping> implements Extension<T> {
|
192
|
-
extension: Extension | Extension[];
|
201
|
+
abstract extension: Extension | Extension[];
|
193
202
|
priority?: Priority;
|
194
203
|
_type?: T;
|
195
204
|
private trees;
|
@@ -218,7 +227,7 @@ export { BaseKeymapExtension as BaseKeymapExtension_alias_1 }
|
|
218
227
|
/**
|
219
228
|
* Some basic props for custom node views.
|
220
229
|
*
|
221
|
-
* @
|
230
|
+
* @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
|
222
231
|
*/
|
223
232
|
declare interface BaseNodeViewOptions {
|
224
233
|
/**
|
@@ -263,6 +272,18 @@ declare type ClickOnHandler = (view: EditorView, pos: number, node: Node_2, node
|
|
263
272
|
export { ClickOnHandler }
|
264
273
|
export { ClickOnHandler as ClickOnHandler_alias_1 }
|
265
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
|
+
|
266
287
|
/**
|
267
288
|
* A utility for constructing `className` strings conditionally.
|
268
289
|
*
|
@@ -394,10 +415,6 @@ export { createTestEditor as createTestEditor_alias_1 }
|
|
394
415
|
|
395
416
|
export declare function deepEquals<T>(a: T, b: T): boolean;
|
396
417
|
|
397
|
-
export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
|
398
|
-
|
399
|
-
export { default_alias_1 }
|
400
|
-
|
401
418
|
/**
|
402
419
|
* @internal
|
403
420
|
*/
|
@@ -480,6 +497,13 @@ declare function defineClickOnHandler(handler: ClickOnHandler): PlainExtension;
|
|
480
497
|
export { defineClickOnHandler }
|
481
498
|
export { defineClickOnHandler as defineClickOnHandler_alias_1 }
|
482
499
|
|
500
|
+
/**
|
501
|
+
* @internal
|
502
|
+
*/
|
503
|
+
declare function defineClipboardSerializer(options: ClipboardSerializerOptions): Extension;
|
504
|
+
export { defineClipboardSerializer }
|
505
|
+
export { defineClipboardSerializer as defineClipboardSerializer_alias_1 }
|
506
|
+
|
483
507
|
declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
|
484
508
|
Commands: {
|
485
509
|
[K in keyof T]: Parameters<T[K]>;
|
@@ -657,6 +681,24 @@ declare function defineMarkSpec<Mark extends string, Attrs extends AnyAttrs = An
|
|
657
681
|
export { defineMarkSpec }
|
658
682
|
export { defineMarkSpec as defineMarkSpec_alias_1 }
|
659
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
|
+
|
660
702
|
/**
|
661
703
|
* Registers a event handler that is called when the editor view is mounted.
|
662
704
|
*
|
@@ -763,11 +805,11 @@ export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_
|
|
763
805
|
/**
|
764
806
|
* @internal
|
765
807
|
*/
|
766
|
-
export declare function defineTestExtension():
|
808
|
+
export declare function defineTestExtension(): Union_2<readonly [BaseCommandsExtension_2, PlainExtension_2, DocExtension_2, HistoryExtension_2, Extension<{
|
767
809
|
Nodes: {
|
768
810
|
paragraph: Attrs;
|
769
811
|
};
|
770
|
-
}>,
|
812
|
+
}>, TextExtension_2, BoldExtension, ItalicExtension, LinkExtension, HeadingExtension, CodeBlockExtension]>;
|
771
813
|
|
772
814
|
/**
|
773
815
|
* @public
|
@@ -853,6 +895,11 @@ export declare class DOMDocumentNotFoundError extends ProseKitError {
|
|
853
895
|
|
854
896
|
/** @public */
|
855
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
|
+
*/
|
856
903
|
document?: Document;
|
857
904
|
}
|
858
905
|
export { DOMDocumentOptions }
|
@@ -891,7 +938,9 @@ export { DOMParserOptions as DOMParserOptions_alias_1 }
|
|
891
938
|
|
892
939
|
/** @public */
|
893
940
|
declare interface DOMSerializerOptions {
|
894
|
-
DOMSerializer?:
|
941
|
+
DOMSerializer?: {
|
942
|
+
fromSchema: typeof DOMSerializer.fromSchema;
|
943
|
+
};
|
895
944
|
}
|
896
945
|
export { DOMSerializerOptions }
|
897
946
|
export { DOMSerializerOptions as DOMSerializerOptions_alias_1 }
|
@@ -983,6 +1032,14 @@ declare class Editor<E extends Extension = any> {
|
|
983
1032
|
* - The string "end" (to set selection at the end)
|
984
1033
|
*/
|
985
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;
|
986
1043
|
/**
|
987
1044
|
* Execute the given command. Return `true` if the command was successfully
|
988
1045
|
* executed, otherwise `false`.
|
@@ -1012,7 +1069,7 @@ export { Editor as Editor_alias_1 }
|
|
1012
1069
|
/**
|
1013
1070
|
* @internal
|
1014
1071
|
*/
|
1015
|
-
declare const editorEventFacet:
|
1072
|
+
declare const editorEventFacet: Facet_2<EditorEventPayload, PluginPayload>;
|
1016
1073
|
export { editorEventFacet }
|
1017
1074
|
export { editorEventFacet as editorEventFacet_alias_1 }
|
1018
1075
|
|
@@ -1054,9 +1111,19 @@ export declare class EditorInstance {
|
|
1054
1111
|
private afterMounted;
|
1055
1112
|
constructor(extension: Extension);
|
1056
1113
|
getState: () => EditorState;
|
1114
|
+
private getDoc;
|
1115
|
+
private getProp;
|
1057
1116
|
updateState(state: EditorState): void;
|
1058
1117
|
private dispatch;
|
1059
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;
|
1060
1127
|
private updateExtension;
|
1061
1128
|
use(extension: Extension): VoidFunction;
|
1062
1129
|
mount(place: HTMLElement): void;
|
@@ -1413,6 +1480,8 @@ declare type FocusChangeHandler = (hasFocus: boolean) => void;
|
|
1413
1480
|
export { FocusChangeHandler }
|
1414
1481
|
export { FocusChangeHandler as FocusChangeHandler_alias_1 }
|
1415
1482
|
|
1483
|
+
declare type FunctionWrapper<T extends AnyFunction> = (fn: T) => T;
|
1484
|
+
|
1416
1485
|
export declare function getBrowserDocument(options?: {
|
1417
1486
|
document?: Document;
|
1418
1487
|
}): Document;
|
@@ -1423,6 +1492,12 @@ export declare function getBrowserWindow(options?: {
|
|
1423
1492
|
|
1424
1493
|
export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_2;
|
1425
1494
|
|
1495
|
+
/**
|
1496
|
+
* @public
|
1497
|
+
*/
|
1498
|
+
export declare interface getDocHTMLOptions extends DOMDocumentOptions {
|
1499
|
+
}
|
1500
|
+
|
1426
1501
|
export declare function getEditorContentDoc(schema: Schema, content: NodeJSON | string | HTMLElement | ProseMirrorNode): ProseMirrorNode;
|
1427
1502
|
|
1428
1503
|
export declare function getEditorContentJSON(schema: Schema, content: NodeJSON | string | HTMLElement): NodeJSON;
|
@@ -1642,7 +1717,12 @@ declare function isAtBlockStart(state: EditorState, view?: EditorView): Resolved
|
|
1642
1717
|
export { isAtBlockStart }
|
1643
1718
|
export { isAtBlockStart as isAtBlockStart_alias_1 }
|
1644
1719
|
|
1645
|
-
|
1720
|
+
/**
|
1721
|
+
* @internal
|
1722
|
+
*/
|
1723
|
+
declare function isElement(el: unknown): el is Element;
|
1724
|
+
export { isElement }
|
1725
|
+
export { isElement as isElement_alias_1 }
|
1646
1726
|
|
1647
1727
|
/**
|
1648
1728
|
* Checks if the given object is a `Fragment` instance.
|
@@ -1790,6 +1870,9 @@ export { jsonFromState as jsonFromState_alias_1 }
|
|
1790
1870
|
|
1791
1871
|
/** @public */
|
1792
1872
|
declare interface JSONParserOptions {
|
1873
|
+
/**
|
1874
|
+
* The editor schema to use.
|
1875
|
+
*/
|
1793
1876
|
schema: Schema;
|
1794
1877
|
}
|
1795
1878
|
export { JSONParserOptions }
|
@@ -1894,6 +1977,8 @@ declare type MarkBuilder = MarkAction;
|
|
1894
1977
|
export { MarkBuilder }
|
1895
1978
|
export { MarkBuilder as MarkBuilder_alias_1 }
|
1896
1979
|
|
1980
|
+
declare type MarksFromSchemaFunction = typeof DOMSerializer.marksFromSchema;
|
1981
|
+
|
1897
1982
|
/**
|
1898
1983
|
* @public
|
1899
1984
|
*/
|
@@ -1921,6 +2006,34 @@ declare interface MarkTyping {
|
|
1921
2006
|
export { MarkTyping }
|
1922
2007
|
export { MarkTyping as MarkTyping_alias_1 }
|
1923
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
|
+
|
1924
2037
|
/**
|
1925
2038
|
* @internal
|
1926
2039
|
*/
|
@@ -2074,6 +2187,8 @@ declare interface NodeJSON {
|
|
2074
2187
|
export { NodeJSON }
|
2075
2188
|
export { NodeJSON as NodeJSON_alias_1 }
|
2076
2189
|
|
2190
|
+
declare type NodesFromSchemaFunction = typeof DOMSerializer.nodesFromSchema;
|
2191
|
+
|
2077
2192
|
/**
|
2078
2193
|
* @public
|
2079
2194
|
*/
|
@@ -2150,7 +2265,6 @@ export { OBJECT_REPLACEMENT_CHARACTER as OBJECT_REPLACEMENT_CHARACTER_alias_1 }
|
|
2150
2265
|
* type MyObject = { a: 1; b: 'B' }
|
2151
2266
|
* type MyEntries = ObjectEntries<MyObject>
|
2152
2267
|
* // ^ ["a", 1] | ["b", "B"]
|
2153
|
-
*
|
2154
2268
|
*/
|
2155
2269
|
export declare type ObjectEntries<T extends Record<string, any>> = {
|
2156
2270
|
[K in keyof T]: [K, T[K]];
|
@@ -2356,6 +2470,10 @@ declare interface SelectionJSON {
|
|
2356
2470
|
export { SelectionJSON }
|
2357
2471
|
export { SelectionJSON as SelectionJSON_alias_1 }
|
2358
2472
|
|
2473
|
+
declare type SerializeFragmentFunction = typeof DOMSerializer.prototype.serializeFragment;
|
2474
|
+
|
2475
|
+
declare type SerializeNodeFunction = typeof DOMSerializer.prototype.serializeNode;
|
2476
|
+
|
2359
2477
|
/**
|
2360
2478
|
* Returns a command that tries to set the selected textblocks to the given node
|
2361
2479
|
* type with the given attributes.
|
@@ -2428,12 +2546,12 @@ export declare function setupEditorExtension<E extends Extension>(options: Edito
|
|
2428
2546
|
* @internal
|
2429
2547
|
*/
|
2430
2548
|
export declare function setupTest(): {
|
2431
|
-
editor: TestEditor<
|
2549
|
+
editor: TestEditor<Union_2<readonly [BaseCommandsExtension_2, PlainExtension_2, DocExtension_2, HistoryExtension_2, Extension<{
|
2432
2550
|
Nodes: {
|
2433
2551
|
paragraph: Attrs;
|
2434
2552
|
};
|
2435
|
-
}>,
|
2436
|
-
m:
|
2553
|
+
}>, TextExtension_2, BoldExtension, ItalicExtension, LinkExtension, HeadingExtension, CodeBlockExtension]>>;
|
2554
|
+
m: ToMarkAction_2<SimplifyDeeper_2< {
|
2437
2555
|
bold: {
|
2438
2556
|
readonly [x: string]: any;
|
2439
2557
|
};
|
@@ -2445,22 +2563,22 @@ export declare function setupTest(): {
|
|
2445
2563
|
};
|
2446
2564
|
}>>;
|
2447
2565
|
n: {
|
2448
|
-
p:
|
2566
|
+
p: NodeAction_2< {
|
2449
2567
|
readonly [x: string]: any;
|
2450
2568
|
}>;
|
2451
|
-
doc:
|
2569
|
+
doc: NodeAction_2< {
|
2452
2570
|
readonly [x: string]: any;
|
2453
2571
|
}>;
|
2454
|
-
paragraph:
|
2572
|
+
paragraph: NodeAction_2< {
|
2455
2573
|
readonly [x: string]: any;
|
2456
2574
|
}>;
|
2457
|
-
text:
|
2575
|
+
text: NodeAction_2< {
|
2458
2576
|
readonly [x: string]: any;
|
2459
2577
|
}>;
|
2460
|
-
heading:
|
2578
|
+
heading: NodeAction_2< {
|
2461
2579
|
readonly [x: string]: any;
|
2462
2580
|
}>;
|
2463
|
-
codeBlock:
|
2581
|
+
codeBlock: NodeAction_2< {
|
2464
2582
|
language: string;
|
2465
2583
|
}>;
|
2466
2584
|
};
|