@prosekit/core 0.7.14 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,6 @@ import { AllSelection } from '@prosekit/pm/state';
2
2
  import type { Attrs } from '@prosekit/pm/model';
3
3
  import { Command } from '@prosekit/pm/state';
4
4
  import type { ContentMatch } from '@prosekit/pm/model';
5
- import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
6
5
  import type { DirectEditorProps } from '@prosekit/pm/view';
7
6
  import type { DOMEventMap } from '@prosekit/pm/view';
8
7
  import type { DOMOutputSpec } from '@prosekit/pm/model';
@@ -21,10 +20,8 @@ import type { Node as Node_2 } from '@prosekit/pm/model';
21
20
  import { NodeSelection } from '@prosekit/pm/state';
22
21
  import type { NodeSpec } from '@prosekit/pm/model';
23
22
  import type { NodeType } from '@prosekit/pm/model';
24
- import { NodeType as NodeType_2 } from 'prosemirror-model';
25
23
  import type { NodeView } from '@prosekit/pm/view';
26
24
  import type { NodeViewConstructor } from '@prosekit/pm/view';
27
- import { Options } from 'tsup';
28
25
  import { ParseOptions } from '@prosekit/pm/model';
29
26
  import { Plugin as Plugin_2 } from '@prosekit/pm/state';
30
27
  import { ProseMirrorFragment } from '@prosekit/pm/model';
@@ -125,11 +122,6 @@ export { assert as assert_alias_1 }
125
122
  */
126
123
  export declare function assertTypeEqual<T, U>(_val: IsEqual<T, U>): void;
127
124
 
128
- /**
129
- * Utility function assert that two types are equal in tests.
130
- */
131
- export declare function assertTypeEqual_alias_1<T, U>(_val: IsEqual<T, U>): void;
132
-
133
125
  declare interface AttrOptions {
134
126
  attr: string;
135
127
  toDOM?: (value: unknown) => [key: string, value: string] | null | undefined;
@@ -190,7 +182,7 @@ export { BaseCommandsExtension as BaseCommandsExtension_alias_1 }
190
182
  * @internal
191
183
  */
192
184
  export declare abstract class BaseExtension<T extends ExtensionTyping = ExtensionTyping> implements Extension<T> {
193
- extension: Extension | Extension[];
185
+ abstract extension: Extension | Extension[];
194
186
  priority?: Priority;
195
187
  _type?: T;
196
188
  private trees;
@@ -220,6 +212,8 @@ export { BaseKeymapExtension as BaseKeymapExtension_alias_1 }
220
212
  * Some basic props for custom node views.
221
213
  *
222
214
  * @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
215
+ *
216
+ * @hidden
223
217
  */
224
218
  declare interface BaseNodeViewOptions {
225
219
  /**
@@ -242,12 +236,6 @@ declare interface BaseNodeViewOptions {
242
236
  export { BaseNodeViewOptions }
243
237
  export { BaseNodeViewOptions as BaseNodeViewOptions_alias_1 }
244
238
 
245
- declare type BoldExtension = Extension<{
246
- Marks: {
247
- bold: Attrs;
248
- };
249
- }>;
250
-
251
239
  export declare function buildNode(type: NodeType, args: [Attrs | NodeChild | null | undefined, ...NodeChild[]], createNode: CreateNodeFunction): ProseMirrorNode;
252
240
 
253
241
  export declare function cache<T>(fn: () => T): () => T;
@@ -264,6 +252,18 @@ declare type ClickOnHandler = (view: EditorView, pos: number, node: Node_2, node
264
252
  export { ClickOnHandler }
265
253
  export { ClickOnHandler as ClickOnHandler_alias_1 }
266
254
 
255
+ /**
256
+ * @internal
257
+ */
258
+ declare interface ClipboardSerializerOptions {
259
+ serializeFragmentWrapper?: FunctionWrapper<SerializeFragmentFunction>;
260
+ serializeNodeWrapper?: FunctionWrapper<SerializeNodeFunction>;
261
+ nodesFromSchemaWrapper?: FunctionWrapper<NodesFromSchemaFunction>;
262
+ marksFromSchemaWrapper?: FunctionWrapper<MarksFromSchemaFunction>;
263
+ }
264
+ export { ClipboardSerializerOptions }
265
+ export { ClipboardSerializerOptions as ClipboardSerializerOptions_alias_1 }
266
+
267
267
  /**
268
268
  * A utility for constructing `className` strings conditionally.
269
269
  *
@@ -275,14 +275,6 @@ declare const clsx: (...args: Array<string | boolean | null | undefined>) => str
275
275
  export { clsx }
276
276
  export { clsx as clsx_alias_1 }
277
277
 
278
- declare type CodeBlockExtension = Extension<{
279
- Nodes: {
280
- codeBlock: {
281
- language: string;
282
- };
283
- };
284
- }>;
285
-
286
278
  /**
287
279
  * Collects all children of a node or a fragment, and returns them as an array.
288
280
  *
@@ -395,14 +387,10 @@ export { createTestEditor as createTestEditor_alias_1 }
395
387
 
396
388
  export declare function deepEquals<T>(a: T, b: T): boolean;
397
389
 
398
- export declare const default_alias: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>);
399
-
400
- export { default_alias_1 }
401
-
402
390
  /**
403
391
  * @internal
404
392
  */
405
- declare function defaultBlockAt(match: ContentMatch): NodeType_2 | null;
393
+ declare function defaultBlockAt(match: ContentMatch): NodeType | null;
406
394
  export { defaultBlockAt }
407
395
  export { defaultBlockAt as defaultBlockAt_alias_1 }
408
396
 
@@ -481,6 +469,13 @@ declare function defineClickOnHandler(handler: ClickOnHandler): PlainExtension;
481
469
  export { defineClickOnHandler }
482
470
  export { defineClickOnHandler as defineClickOnHandler_alias_1 }
483
471
 
472
+ /**
473
+ * @internal
474
+ */
475
+ declare function defineClipboardSerializer(options: ClipboardSerializerOptions): Extension;
476
+ export { defineClipboardSerializer }
477
+ export { defineClipboardSerializer as defineClipboardSerializer_alias_1 }
478
+
484
479
  declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
485
480
  Commands: {
486
481
  [K in keyof T]: Parameters<T[K]>;
@@ -502,6 +497,12 @@ export { defineDefaultState as defineDefaultState_alias_1 }
502
497
 
503
498
  /**
504
499
  * @public
500
+ *
501
+ * @deprecated Use the following import instead:
502
+ *
503
+ * ```ts
504
+ * import { defineDoc } from 'prosekit/extensions/doc'
505
+ * ```
505
506
  */
506
507
  declare function defineDoc(): DocExtension;
507
508
  export { defineDoc }
@@ -735,18 +736,17 @@ export { defineNodeViewFactory as defineNodeViewFactory_alias_1 }
735
736
  * @public
736
737
  *
737
738
  * Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
739
+ *
740
+ * @deprecated Use the following import instead:
741
+ *
742
+ * ```ts
743
+ * import { defineParagraph } from 'prosekit/extensions/paragraph'
744
+ * ```
738
745
  */
739
746
  declare function defineParagraph(): ParagraphExtension;
740
747
  export { defineParagraph }
741
748
  export { defineParagraph as defineParagraph_alias_1 }
742
749
 
743
- /**
744
- * @public
745
- *
746
- * Defines a paragraph node spec.
747
- */
748
- export declare function defineParagraphSpec(): ParagraphSpecExtension;
749
-
750
750
  /**
751
751
  * @public
752
752
  *
@@ -779,17 +779,14 @@ declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandle
779
779
  export { defineScrollToSelectionHandler }
780
780
  export { defineScrollToSelectionHandler as defineScrollToSelectionHandler_alias_1 }
781
781
 
782
- /**
783
- * @internal
784
- */
785
- export declare function defineTestExtension(): Union<readonly [BaseCommandsExtension, PlainExtension, DocExtension, HistoryExtension, Extension<{
786
- Nodes: {
787
- paragraph: Attrs;
788
- };
789
- }>, TextExtension, BoldExtension, ItalicExtension, LinkExtension, HeadingExtension, CodeBlockExtension]>;
790
-
791
782
  /**
792
783
  * @public
784
+ *
785
+ * @deprecated Use the following import instead:
786
+ *
787
+ * ```ts
788
+ * import { defineText } from 'prosekit/extensions/text'
789
+ * ```
793
790
  */
794
791
  declare function defineText(): TextExtension;
795
792
  export { defineText }
@@ -872,6 +869,11 @@ export declare class DOMDocumentNotFoundError extends ProseKitError {
872
869
 
873
870
  /** @public */
874
871
  declare interface DOMDocumentOptions {
872
+ /**
873
+ * The Document object to use for DOM operations. If not provided, defaults to
874
+ * the current browser's document object. Useful for server-side rendering or
875
+ * testing environments.
876
+ */
875
877
  document?: Document;
876
878
  }
877
879
  export { DOMDocumentOptions }
@@ -910,7 +912,9 @@ export { DOMParserOptions as DOMParserOptions_alias_1 }
910
912
 
911
913
  /** @public */
912
914
  declare interface DOMSerializerOptions {
913
- DOMSerializer?: typeof DOMSerializer;
915
+ DOMSerializer?: {
916
+ fromSchema: typeof DOMSerializer.fromSchema;
917
+ };
914
918
  }
915
919
  export { DOMSerializerOptions }
916
920
  export { DOMSerializerOptions as DOMSerializerOptions_alias_1 }
@@ -1002,6 +1006,14 @@ declare class Editor<E extends Extension = any> {
1002
1006
  * - The string "end" (to set selection at the end)
1003
1007
  */
1004
1008
  setContent: (content: ProseMirrorNode | NodeJSON | string | HTMLElement, selection?: SelectionJSON | Selection_2 | "start" | "end") => void;
1009
+ /**
1010
+ * Return a JSON object representing the editor's current document.
1011
+ */
1012
+ getDocJSON: () => NodeJSON;
1013
+ /**
1014
+ * Return a HTML string representing the editor's current document.
1015
+ */
1016
+ getDocHTML: (options?: getDocHTMLOptions) => string;
1005
1017
  /**
1006
1018
  * Execute the given command. Return `true` if the command was successfully
1007
1019
  * executed, otherwise `false`.
@@ -1073,9 +1085,19 @@ export declare class EditorInstance {
1073
1085
  private afterMounted;
1074
1086
  constructor(extension: Extension);
1075
1087
  getState: () => EditorState;
1088
+ private getDoc;
1089
+ private getProp;
1076
1090
  updateState(state: EditorState): void;
1077
1091
  private dispatch;
1078
1092
  setContent(content: NodeJSON | string | HTMLElement | ProseMirrorNode, selection?: SelectionJSON | Selection_2 | 'start' | 'end'): void;
1093
+ /**
1094
+ * Return a JSON object representing the editor's current document.
1095
+ */
1096
+ getDocJSON: () => NodeJSON;
1097
+ /**
1098
+ * Return a HTML string representing the editor's current document.
1099
+ */
1100
+ getDocHTML: (options?: getDocHTMLOptions) => string;
1079
1101
  private updateExtension;
1080
1102
  use(extension: Extension): VoidFunction;
1081
1103
  mount(place: HTMLElement): void;
@@ -1146,6 +1168,13 @@ export declare function elementFromHTML(html: string, options?: DOMDocumentOptio
1146
1168
  * Parse a ProseMirror document JSON object to a HTML element.
1147
1169
  *
1148
1170
  * @public
1171
+ *
1172
+ * @example
1173
+ *
1174
+ * ```ts
1175
+ * const json = { type: 'doc', content: [{ type: 'paragraph' }] }
1176
+ * const element = elementFromJSON(json, { schema: editor.schema })
1177
+ * ```
1149
1178
  */
1150
1179
  declare function elementFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
1151
1180
  export { elementFromJSON }
@@ -1155,6 +1184,13 @@ export { elementFromJSON as elementFromJSON_alias_1 }
1155
1184
  * Serialize a ProseMirror node to a HTML element.
1156
1185
  *
1157
1186
  * @public
1187
+ *
1188
+ * @example
1189
+ *
1190
+ * ```ts
1191
+ * const node = editor.state.doc
1192
+ * const element = elementFromNode(node)
1193
+ * ```
1158
1194
  */
1159
1195
  declare function elementFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
1160
1196
  export { elementFromNode }
@@ -1432,6 +1468,8 @@ declare type FocusChangeHandler = (hasFocus: boolean) => void;
1432
1468
  export { FocusChangeHandler }
1433
1469
  export { FocusChangeHandler as FocusChangeHandler_alias_1 }
1434
1470
 
1471
+ declare type FunctionWrapper<T extends AnyFunction> = (fn: T) => T;
1472
+
1435
1473
  export declare function getBrowserDocument(options?: {
1436
1474
  document?: Document;
1437
1475
  }): Document;
@@ -1442,6 +1480,12 @@ export declare function getBrowserWindow(options?: {
1442
1480
 
1443
1481
  export declare function getCustomSelection(state: EditorState, from?: number | null, to?: number | null): Selection_2;
1444
1482
 
1483
+ /**
1484
+ * @public
1485
+ */
1486
+ export declare interface getDocHTMLOptions extends DOMDocumentOptions {
1487
+ }
1488
+
1445
1489
  export declare function getEditorContentDoc(schema: Schema, content: NodeJSON | string | HTMLElement | ProseMirrorNode): ProseMirrorNode;
1446
1490
 
1447
1491
  export declare function getEditorContentJSON(schema: Schema, content: NodeJSON | string | HTMLElement): NodeJSON;
@@ -1486,12 +1530,6 @@ export declare function groupEntries<T extends Record<string, any>>(entries: Obj
1486
1530
  [K in keyof T]?: T[K][];
1487
1531
  };
1488
1532
 
1489
- declare type HeadingExtension = Extension<{
1490
- Nodes: {
1491
- heading: Attrs;
1492
- };
1493
- }>;
1494
-
1495
1533
  /**
1496
1534
  * @internal
1497
1535
  */
@@ -1537,6 +1575,13 @@ export declare function htmlFromElement(element: HTMLElement): string;
1537
1575
  * Parse a ProseMirror document JSON object to a HTML string.
1538
1576
  *
1539
1577
  * @public
1578
+ *
1579
+ * @example
1580
+ *
1581
+ * ```ts
1582
+ * const json = { type: 'doc', content: [{ type: 'paragraph' }] }
1583
+ * const html = htmlFromJSON(json, { schema: editor.schema })
1584
+ * ```
1540
1585
  */
1541
1586
  declare function htmlFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): string;
1542
1587
  export { htmlFromJSON }
@@ -1546,6 +1591,13 @@ export { htmlFromJSON as htmlFromJSON_alias_1 }
1546
1591
  * Serialize a ProseMirror node to a HTML string
1547
1592
  *
1548
1593
  * @public
1594
+ *
1595
+ * @example
1596
+ *
1597
+ * ```ts
1598
+ * const node = document.getElementById('content')
1599
+ * const html = htmlFromNode(node)
1600
+ * ```
1549
1601
  */
1550
1602
  declare function htmlFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): string;
1551
1603
  export { htmlFromNode }
@@ -1553,8 +1605,6 @@ export { htmlFromNode as htmlFromNode_alias_1 }
1553
1605
 
1554
1606
  export declare function includesMark(marks: readonly Mark[], markType: MarkType, attrs?: Attrs | null): boolean;
1555
1607
 
1556
- export declare function inputText(input: string): Promise<void>;
1557
-
1558
1608
  /**
1559
1609
  * Returns a command that inserts a default block after current selection or at
1560
1610
  * the given position.
@@ -1661,7 +1711,12 @@ declare function isAtBlockStart(state: EditorState, view?: EditorView): Resolved
1661
1711
  export { isAtBlockStart }
1662
1712
  export { isAtBlockStart as isAtBlockStart_alias_1 }
1663
1713
 
1664
- export declare function isElement(el: unknown): el is Element;
1714
+ /**
1715
+ * @internal
1716
+ */
1717
+ declare function isElement(el: unknown): el is Element;
1718
+ export { isElement }
1719
+ export { isElement as isElement_alias_1 }
1665
1720
 
1666
1721
  /**
1667
1722
  * Checks if the given object is a `Fragment` instance.
@@ -1767,16 +1822,17 @@ declare function isTextSelection(sel: Selection_2): sel is TextSelection;
1767
1822
  export { isTextSelection }
1768
1823
  export { isTextSelection as isTextSelection_alias_1 }
1769
1824
 
1770
- declare type ItalicExtension = Extension<{
1771
- Marks: {
1772
- italic: Attrs;
1773
- };
1774
- }>;
1775
-
1776
1825
  /**
1777
1826
  * Serialize a HTML element to a ProseMirror document JSON object.
1778
1827
  *
1779
1828
  * @public
1829
+ *
1830
+ * @example
1831
+ *
1832
+ * ```ts
1833
+ * const element = document.getElementById('content')
1834
+ * const json = jsonFromElement(element, { schema: editor.schema })
1835
+ * ```
1780
1836
  */
1781
1837
  export declare function jsonFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): NodeJSON;
1782
1838
 
@@ -1784,6 +1840,13 @@ export declare function jsonFromElement(element: DOMNode, options: DOMParserOpti
1784
1840
  * Parse a HTML string to a ProseMirror document JSON object.
1785
1841
  *
1786
1842
  * @public
1843
+ *
1844
+ * @example
1845
+ *
1846
+ * ```ts
1847
+ * const html = '<p>Hello, world!</p>'
1848
+ * const json = jsonFromHTML(html, { schema: editor.schema })
1849
+ * ```
1787
1850
  */
1788
1851
  declare function jsonFromHTML(html: string, options: DOMDocumentOptions & DOMParserOptions & JSONParserOptions): NodeJSON;
1789
1852
  export { jsonFromHTML }
@@ -1793,6 +1856,13 @@ export { jsonFromHTML as jsonFromHTML_alias_1 }
1793
1856
  * Return a JSON object representing this node.
1794
1857
  *
1795
1858
  * @public
1859
+ *
1860
+ * @example
1861
+ *
1862
+ * ```ts
1863
+ * const node = editor.state.doc
1864
+ * const json = jsonFromNode(node)
1865
+ * ```
1796
1866
  */
1797
1867
  declare function jsonFromNode(node: ProseMirrorNode): NodeJSON;
1798
1868
  export { jsonFromNode }
@@ -1802,6 +1872,13 @@ export { jsonFromNode as jsonFromNode_alias_1 }
1802
1872
  * Return a JSON object representing this state.
1803
1873
  *
1804
1874
  * @public
1875
+ *
1876
+ * @example
1877
+ *
1878
+ * ```ts
1879
+ * const state = editor.state
1880
+ * const json = jsonFromState(state)
1881
+ * ```
1805
1882
  */
1806
1883
  declare function jsonFromState(state: EditorState): StateJSON;
1807
1884
  export { jsonFromState }
@@ -1809,6 +1886,9 @@ export { jsonFromState as jsonFromState_alias_1 }
1809
1886
 
1810
1887
  /** @public */
1811
1888
  declare interface JSONParserOptions {
1889
+ /**
1890
+ * The editor schema to use.
1891
+ */
1812
1892
  schema: Schema;
1813
1893
  }
1814
1894
  export { JSONParserOptions }
@@ -1845,16 +1925,6 @@ declare type KeyPressHandler = (view: EditorView, event: KeyboardEvent) => boole
1845
1925
  export { KeyPressHandler }
1846
1926
  export { KeyPressHandler as KeyPressHandler_alias_1 }
1847
1927
 
1848
- declare interface LinkAttrs {
1849
- href: string;
1850
- }
1851
-
1852
- declare type LinkExtension = Extension<{
1853
- Marks: {
1854
- link: LinkAttrs;
1855
- };
1856
- }>;
1857
-
1858
1928
  /**
1859
1929
  * A function for creating a mark with optional attributes and any number of
1860
1930
  * children.
@@ -1913,6 +1983,8 @@ declare type MarkBuilder = MarkAction;
1913
1983
  export { MarkBuilder }
1914
1984
  export { MarkBuilder as MarkBuilder_alias_1 }
1915
1985
 
1986
+ declare type MarksFromSchemaFunction = typeof DOMSerializer.marksFromSchema;
1987
+
1916
1988
  /**
1917
1989
  * @public
1918
1990
  */
@@ -2080,6 +2152,12 @@ export { NodeContent as NodeContent_alias_1 }
2080
2152
  * Parse a HTML element to a ProseMirror node.
2081
2153
  *
2082
2154
  * @public
2155
+ *
2156
+ * @example
2157
+ *
2158
+ * ```ts
2159
+ * const element = document.getElementById('content')
2160
+ * const node = nodeFromElement(element, { schema: editor.schema })
2083
2161
  */
2084
2162
  declare function nodeFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): ProseMirrorNode;
2085
2163
  export { nodeFromElement }
@@ -2089,6 +2167,12 @@ export { nodeFromElement as nodeFromElement_alias_1 }
2089
2167
  * Parse a HTML string to a ProseMirror node.
2090
2168
  *
2091
2169
  * @public
2170
+ *
2171
+ * @example
2172
+ *
2173
+ * ```ts
2174
+ * const html = '<p>Hello, world!</p>'
2175
+ * const node = nodeFromHTML(html, { schema: editor.schema })
2092
2176
  */
2093
2177
  declare function nodeFromHTML(html: string, options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions): ProseMirrorNode;
2094
2178
  export { nodeFromHTML }
@@ -2098,6 +2182,13 @@ export { nodeFromHTML as nodeFromHTML_alias_1 }
2098
2182
  * Parse a JSON object to a ProseMirror node.
2099
2183
  *
2100
2184
  * @public
2185
+ *
2186
+ * @example
2187
+ *
2188
+ * ```ts
2189
+ * const json = { type: 'doc', content: [{ type: 'paragraph' }] }
2190
+ * const node = nodeFromJSON(json, { schema: editor.schema })
2191
+ * ```
2101
2192
  */
2102
2193
  declare function nodeFromJSON(json: NodeJSON, options: JSONParserOptions): ProseMirrorNode;
2103
2194
  export { nodeFromJSON }
@@ -2121,6 +2212,8 @@ declare interface NodeJSON {
2121
2212
  export { NodeJSON }
2122
2213
  export { NodeJSON as NodeJSON_alias_1 }
2123
2214
 
2215
+ declare type NodesFromSchemaFunction = typeof DOMSerializer.nodesFromSchema;
2216
+
2124
2217
  /**
2125
2218
  * @public
2126
2219
  */
@@ -2206,6 +2299,12 @@ export declare function objectEqual<T>(a: T, b: T): boolean;
2206
2299
 
2207
2300
  /**
2208
2301
  * @internal
2302
+ *
2303
+ * @deprecated Use the following import instead:
2304
+ *
2305
+ * ```ts
2306
+ * import type { ParagraphExtension } from 'prosekit/extensions/paragraph'
2307
+ * ```
2209
2308
  */
2210
2309
  declare type ParagraphExtension = ParagraphSpecExtension;
2211
2310
  export { ParagraphExtension }
@@ -2402,6 +2501,10 @@ declare interface SelectionJSON {
2402
2501
  export { SelectionJSON }
2403
2502
  export { SelectionJSON as SelectionJSON_alias_1 }
2404
2503
 
2504
+ declare type SerializeFragmentFunction = typeof DOMSerializer.prototype.serializeFragment;
2505
+
2506
+ declare type SerializeNodeFunction = typeof DOMSerializer.prototype.serializeNode;
2507
+
2405
2508
  /**
2406
2509
  * Returns a command that tries to set the selected textblocks to the given node
2407
2510
  * type with the given attributes.
@@ -2470,57 +2573,6 @@ export declare type Setter<T> = (value: T) => void;
2470
2573
  */
2471
2574
  export declare function setupEditorExtension<E extends Extension>(options: EditorOptions<E>): E;
2472
2575
 
2473
- /**
2474
- * @internal
2475
- */
2476
- export declare function setupTest(): {
2477
- editor: TestEditor<Union<readonly [BaseCommandsExtension, PlainExtension, DocExtension, HistoryExtension, Extension<{
2478
- Nodes: {
2479
- paragraph: Attrs;
2480
- };
2481
- }>, TextExtension, BoldExtension, ItalicExtension, LinkExtension, HeadingExtension, CodeBlockExtension]>>;
2482
- m: ToMarkAction<SimplifyDeeper< {
2483
- bold: {
2484
- readonly [x: string]: any;
2485
- };
2486
- italic: {
2487
- readonly [x: string]: any;
2488
- };
2489
- link: {
2490
- href: string;
2491
- };
2492
- }>>;
2493
- n: {
2494
- p: NodeAction< {
2495
- readonly [x: string]: any;
2496
- }>;
2497
- doc: NodeAction< {
2498
- readonly [x: string]: any;
2499
- }>;
2500
- paragraph: NodeAction< {
2501
- readonly [x: string]: any;
2502
- }>;
2503
- text: NodeAction< {
2504
- readonly [x: string]: any;
2505
- }>;
2506
- heading: NodeAction< {
2507
- readonly [x: string]: any;
2508
- }>;
2509
- codeBlock: NodeAction< {
2510
- language: string;
2511
- }>;
2512
- };
2513
- };
2514
-
2515
- /**
2516
- * @internal
2517
- */
2518
- export declare function setupTestFromExtension<E extends Extension>(extension: E): {
2519
- editor: TestEditor<E>;
2520
- n: ExtractNodeActions<E>;
2521
- m: ExtractMarkActions<E>;
2522
- };
2523
-
2524
2576
  /**
2525
2577
  * @internal
2526
2578
  */
@@ -2543,6 +2595,13 @@ export declare const stateFacet: Facet<StatePayload, RootPayload>;
2543
2595
  * Parse a JSON object to a ProseMirror state.
2544
2596
  *
2545
2597
  * @public
2598
+ *
2599
+ * @example
2600
+ *
2601
+ * ```ts
2602
+ * const json = { state: { type: 'doc', content: [{ type: 'paragraph' }], selection: { type: 'text', from: 1, to: 1 } } }
2603
+ * const state = stateFromJSON(json, { schema: editor.schema })
2604
+ * ```
2546
2605
  */
2547
2606
  declare function stateFromJSON(json: StateJSON, options: JSONParserOptions): EditorState;
2548
2607
  export { stateFromJSON }