@prosekit/core 0.8.1 → 0.8.3

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.
@@ -109,13 +109,30 @@ let facetCount = 0;
109
109
  * @internal
110
110
  */
111
111
  var Facet = class {
112
+ /**
113
+ * @internal
114
+ */
115
+ index = facetCount++;
116
+ /**
117
+ * @internal
118
+ */
119
+ parent;
120
+ /**
121
+ * @internal
122
+ */
123
+ singleton;
124
+ /**
125
+ * A index path to retrieve the current facet in a tree from the root.
126
+ *
127
+ * @internal
128
+ */
129
+ path;
112
130
  /**
113
131
  * @internal
114
132
  */
115
133
  constructor(parent, singleton, _reducer, _reduce) {
116
134
  this._reducer = _reducer;
117
135
  this._reduce = _reduce;
118
- this.index = facetCount++;
119
136
  assert((_reduce || _reducer) && !(_reduce && _reducer));
120
137
  this.parent = parent;
121
138
  this.singleton = singleton;
@@ -174,15 +191,15 @@ const schemaFacet = defineFacet({
174
191
  * @internal
175
192
  */
176
193
  var BaseExtension = class {
177
- constructor() {
178
- this.trees = [
179
- null,
180
- null,
181
- null,
182
- null,
183
- null
184
- ];
185
- }
194
+ priority;
195
+ _type;
196
+ trees = [
197
+ null,
198
+ null,
199
+ null,
200
+ null,
201
+ null
202
+ ];
186
203
  /**
187
204
  * @internal
188
205
  */
@@ -214,7 +231,7 @@ function uniqPush(prev, next) {
214
231
  /**
215
232
  * @internal
216
233
  */
217
- function arraySubstract(a, b) {
234
+ function arraySubtract(a, b) {
218
235
  return a.filter((x) => !b.includes(x));
219
236
  }
220
237
  function toReversed(arr) {
@@ -224,66 +241,66 @@ function toReversed(arr) {
224
241
  //#endregion
225
242
  //#region src/utils/type-assertion.ts
226
243
  /**
227
- * Checks if the given object is a `ProseMirrorNode` instance.
244
+ * Checks if the given object is a {@link ProseMirrorNode} instance.
228
245
  */
229
- function isProseMirrorNode(node) {
230
- return node instanceof ProseMirrorNode;
246
+ function isProseMirrorNode(value) {
247
+ return value instanceof ProseMirrorNode;
231
248
  }
232
249
  /**
233
- * Checks if the given object is a `Mark` instance.
250
+ * Checks if the given object is a {@link Mark} instance.
234
251
  *
235
252
  * @public
236
253
  */
237
- function isMark(mark) {
238
- return mark instanceof Mark;
254
+ function isMark(value) {
255
+ return value instanceof Mark;
239
256
  }
240
257
  /**
241
- * Checks if the given object is a `Fragment` instance.
258
+ * Checks if the given object is a {@link Fragment} instance.
242
259
  *
243
260
  * @public
244
261
  */
245
- function isFragment(fragment) {
246
- return fragment instanceof Fragment;
262
+ function isFragment(value) {
263
+ return value instanceof Fragment;
247
264
  }
248
265
  /**
249
- * Checks if the given object is a `Slice` instance.
266
+ * Checks if the given object is a {@link Slice} instance.
250
267
  *
251
268
  * @public
252
269
  */
253
- function isSlice(slice) {
254
- return slice instanceof Slice;
270
+ function isSlice(value) {
271
+ return value instanceof Slice;
255
272
  }
256
273
  /**
257
- * Checks if the given object is a `Selection` instance.
274
+ * Checks if the given object is a {@link Selection} instance.
258
275
  *
259
276
  * @public
260
277
  */
261
- function isSelection(sel) {
262
- return sel instanceof Selection;
278
+ function isSelection(value) {
279
+ return value instanceof Selection;
263
280
  }
264
281
  /**
265
- * Checks if the given object is a `TextSelection` instance.
282
+ * Checks if the given object is a {@link TextSelection} instance.
266
283
  *
267
284
  * @public
268
285
  */
269
- function isTextSelection(sel) {
270
- return sel instanceof TextSelection;
286
+ function isTextSelection(value) {
287
+ return value instanceof TextSelection;
271
288
  }
272
289
  /**
273
- * Checks if the given object is a `NodeSelection` instance.
290
+ * Checks if the given object is a {@link NodeSelection} instance.
274
291
  *
275
292
  * @public
276
293
  */
277
- function isNodeSelection(sel) {
278
- return sel instanceof NodeSelection;
294
+ function isNodeSelection(value) {
295
+ return value instanceof NodeSelection;
279
296
  }
280
297
  /**
281
- * Checks if the given object is a `AllSelection` instance.
298
+ * Checks if the given object is a {@link AllSelection} instance.
282
299
  *
283
300
  * @public
284
301
  */
285
- function isAllSelection(sel) {
286
- return sel instanceof AllSelection;
302
+ function isAllSelection(value) {
303
+ return value instanceof AllSelection;
287
304
  }
288
305
  /**
289
306
  * @internal
@@ -310,7 +327,7 @@ function unionInput(a, b) {
310
327
  function subtractInput(a, b) {
311
328
  if (!a) return null;
312
329
  if (!b) return [...a];
313
- return arraySubstract(a, b);
330
+ return arraySubtract(a, b);
314
331
  }
315
332
  function unionChildren(a, b) {
316
333
  const merged = new Map(a);
@@ -353,13 +370,14 @@ function subtractFacetNode(a, b) {
353
370
  return new FacetNode(a.facet, zip5(a.inputs, b.inputs, subtractInput), subtractChildren(a.children, b.children), a.reducers);
354
371
  }
355
372
  var FacetNode = class {
373
+ output = null;
356
374
  constructor(facet, inputs = [
357
375
  null,
358
376
  null,
359
377
  null,
360
378
  null,
361
379
  null
362
- ], children = new Map(), reducers = [
380
+ ], children = /* @__PURE__ */ new Map(), reducers = [
363
381
  null,
364
382
  null,
365
383
  null,
@@ -370,7 +388,6 @@ var FacetNode = class {
370
388
  this.inputs = inputs;
371
389
  this.children = children;
372
390
  this.reducers = reducers;
373
- this.output = null;
374
391
  }
375
392
  calcOutput() {
376
393
  const inputs = [
@@ -603,6 +620,7 @@ function nodeFromJSON(json, options) {
603
620
  * ```ts
604
621
  * const element = document.getElementById('content')
605
622
  * const node = nodeFromElement(element, { schema: editor.schema })
623
+ * ```
606
624
  */
607
625
  function nodeFromElement(element, options) {
608
626
  const { DOMParser: CustomDOMParser, schema,...parseOptions } = options;
@@ -654,6 +672,7 @@ function htmlFromElement(element) {
654
672
  * ```ts
655
673
  * const html = '<p>Hello, world!</p>'
656
674
  * const node = nodeFromHTML(html, { schema: editor.schema })
675
+ * ```
657
676
  */
658
677
  function nodeFromHTML(html, options) {
659
678
  return nodeFromElement(elementFromHTML(html, options), options);
@@ -980,30 +999,15 @@ function createEditor(options) {
980
999
  * @internal
981
1000
  */
982
1001
  var EditorInstance = class {
1002
+ view = null;
1003
+ schema;
1004
+ nodes;
1005
+ marks;
1006
+ commands = {};
1007
+ tree;
1008
+ directEditorProps;
1009
+ afterMounted = [];
983
1010
  constructor(extension) {
984
- this.view = null;
985
- this.commands = {};
986
- this.afterMounted = [];
987
- this.getState = () => {
988
- return this.view?.state || this.directEditorProps.state;
989
- };
990
- this.dispatch = (tr) => {
991
- if (this.view) this.view.dispatch(tr);
992
- else this.directEditorProps.state = this.directEditorProps.state.apply(tr);
993
- };
994
- this.getDocJSON = () => {
995
- const state$1 = this.getState();
996
- return jsonFromNode(state$1.doc);
997
- };
998
- this.getDocHTML = (options) => {
999
- const serializer = this.getProp("clipboardSerializer");
1000
- const DOMSerializer$1 = serializer ? { fromSchema: () => serializer } : void 0;
1001
- const doc = this.getDoc();
1002
- return htmlFromNode(doc, {
1003
- ...options,
1004
- DOMSerializer: DOMSerializer$1
1005
- });
1006
- };
1007
1011
  this.tree = extension.getTree();
1008
1012
  const payload = this.tree.getRootOutput();
1009
1013
  const schema = payload.schema;
@@ -1019,6 +1023,9 @@ var EditorInstance = class {
1019
1023
  ...payload.view
1020
1024
  };
1021
1025
  }
1026
+ getState = () => {
1027
+ return this.view?.state || this.directEditorProps.state;
1028
+ };
1022
1029
  getDoc() {
1023
1030
  return this.getState().doc;
1024
1031
  }
@@ -1029,6 +1036,10 @@ var EditorInstance = class {
1029
1036
  if (this.view) this.view.updateState(state);
1030
1037
  else this.directEditorProps.state = state;
1031
1038
  }
1039
+ dispatch = (tr) => {
1040
+ if (this.view) this.view.dispatch(tr);
1041
+ else this.directEditorProps.state = this.directEditorProps.state.apply(tr);
1042
+ };
1032
1043
  setContent(content, selection) {
1033
1044
  const doc = getEditorContentDoc(this.schema, content);
1034
1045
  doc.check();
@@ -1042,6 +1053,25 @@ var EditorInstance = class {
1042
1053
  });
1043
1054
  this.updateState(newState);
1044
1055
  }
1056
+ /**
1057
+ * Return a JSON object representing the editor's current document.
1058
+ */
1059
+ getDocJSON = () => {
1060
+ const state = this.getState();
1061
+ return jsonFromNode(state.doc);
1062
+ };
1063
+ /**
1064
+ * Return a HTML string representing the editor's current document.
1065
+ */
1066
+ getDocHTML = (options) => {
1067
+ const serializer = this.getProp("clipboardSerializer");
1068
+ const DOMSerializer$1 = serializer ? { fromSchema: () => serializer } : void 0;
1069
+ const doc = this.getDoc();
1070
+ return htmlFromNode(doc, {
1071
+ ...options,
1072
+ DOMSerializer: DOMSerializer$1
1073
+ });
1074
+ };
1045
1075
  updateExtension(extension, add) {
1046
1076
  const view = this.view;
1047
1077
  if (!view || view.isDestroyed) return;
@@ -1142,44 +1172,11 @@ var EditorInstance = class {
1142
1172
  * @public
1143
1173
  */
1144
1174
  var Editor = class {
1175
+ instance;
1145
1176
  /**
1146
1177
  * @internal
1147
1178
  */
1148
1179
  constructor(instance) {
1149
- this.mount = (place) => {
1150
- if (place) this.instance.mount(place);
1151
- else this.instance.unmount();
1152
- };
1153
- this.unmount = () => {
1154
- this.instance.unmount();
1155
- };
1156
- this.focus = () => {
1157
- this.instance.view?.focus();
1158
- };
1159
- this.blur = () => {
1160
- this.instance.view?.dom.blur();
1161
- };
1162
- this.use = (extension) => {
1163
- return this.instance.use(extension);
1164
- };
1165
- this.updateState = (state) => {
1166
- this.instance.updateState(state);
1167
- };
1168
- this.setContent = (content, selection) => {
1169
- return this.instance.setContent(content, selection);
1170
- };
1171
- this.getDocJSON = () => {
1172
- return this.instance.getDocJSON();
1173
- };
1174
- this.getDocHTML = (options) => {
1175
- return this.instance.getDocHTML(options);
1176
- };
1177
- this.exec = (command) => {
1178
- return this.instance.exec(command);
1179
- };
1180
- this.canExec = (command) => {
1181
- return this.instance.canExec(command);
1182
- };
1183
1180
  if (!(instance instanceof EditorInstance)) throw new TypeError("Invalid EditorInstance");
1184
1181
  this.instance = instance;
1185
1182
  }
@@ -1214,6 +1211,93 @@ var Editor = class {
1214
1211
  return this.instance.view?.hasFocus() ?? false;
1215
1212
  }
1216
1213
  /**
1214
+ * Mount the editor to the given HTML element.
1215
+ * Pass `null` or `undefined` to unmount the editor.
1216
+ */
1217
+ mount = (place) => {
1218
+ if (place) this.instance.mount(place);
1219
+ else this.instance.unmount();
1220
+ };
1221
+ /**
1222
+ * Unmount the editor. This is equivalent to `mount(null)`.
1223
+ */
1224
+ unmount = () => {
1225
+ this.instance.unmount();
1226
+ };
1227
+ /**
1228
+ * Focus the editor.
1229
+ */
1230
+ focus = () => {
1231
+ this.instance.view?.focus();
1232
+ };
1233
+ /**
1234
+ * Blur the editor.
1235
+ */
1236
+ blur = () => {
1237
+ this.instance.view?.dom.blur();
1238
+ };
1239
+ /**
1240
+ * Register an extension to the editor. Return a function to unregister the
1241
+ * extension.
1242
+ */
1243
+ use = (extension) => {
1244
+ return this.instance.use(extension);
1245
+ };
1246
+ /**
1247
+ * Update the editor's state.
1248
+ *
1249
+ * @remarks
1250
+ *
1251
+ * This is an advanced method. Use it only if you have a specific reason to
1252
+ * directly manipulate the editor's state.
1253
+ */
1254
+ updateState = (state) => {
1255
+ this.instance.updateState(state);
1256
+ };
1257
+ /**
1258
+ * Update the editor's document and selection.
1259
+ *
1260
+ * @param content - The new document to set. It can be one of the following:
1261
+ * - A ProseMirror node instance
1262
+ * - A ProseMirror node JSON object
1263
+ * - An HTML string
1264
+ * - An HTML element instance
1265
+ * @param selection - Optional. Specifies the new selection. It can be one of the following:
1266
+ * - A ProseMirror selection instance
1267
+ * - A ProseMirror selection JSON object
1268
+ * - The string "start" (to set selection at the beginning, default value)
1269
+ * - The string "end" (to set selection at the end)
1270
+ */
1271
+ setContent = (content, selection) => {
1272
+ return this.instance.setContent(content, selection);
1273
+ };
1274
+ /**
1275
+ * Return a JSON object representing the editor's current document.
1276
+ */
1277
+ getDocJSON = () => {
1278
+ return this.instance.getDocJSON();
1279
+ };
1280
+ /**
1281
+ * Return a HTML string representing the editor's current document.
1282
+ */
1283
+ getDocHTML = (options) => {
1284
+ return this.instance.getDocHTML(options);
1285
+ };
1286
+ /**
1287
+ * Execute the given command. Return `true` if the command was successfully
1288
+ * executed, otherwise `false`.
1289
+ */
1290
+ exec = (command) => {
1291
+ return this.instance.exec(command);
1292
+ };
1293
+ /**
1294
+ * Check if the given command can be executed. Return `true` if the command
1295
+ * can be executed, otherwise `false`.
1296
+ */
1297
+ canExec = (command) => {
1298
+ return this.instance.canExec(command);
1299
+ };
1300
+ /**
1217
1301
  * All {@link CommandAction}s defined by the editor.
1218
1302
  */
1219
1303
  get commands() {
@@ -7,11 +7,6 @@ import { Simplify, UnionToIntersection } from "type-fest";
7
7
  /**
8
8
  * An object holding the attributes of a node.
9
9
 
10
- * @public
11
- */
12
- /**
13
- * An object holding the attributes of a node.
14
-
15
10
  * @public
16
11
  */
17
12
  type AnyAttrs = Attrs;
@@ -36,7 +31,8 @@ type AttrSpec<AttrType = any> = {
36
31
  * one of those types.
37
32
  */
38
33
  validate?: string | ((value: unknown) => void);
39
- }; //#endregion
34
+ };
35
+ //#endregion
40
36
  //#region src/editor/action.d.ts
41
37
  /**
42
38
  * Available children parameters for {@link NodeAction} and {@link MarkAction}.
@@ -54,7 +50,13 @@ type NodeChild = ProseMirrorNode | string | NodeChild[];
54
50
  * @public
55
51
  */
56
52
  interface NodeAction<Attrs extends AnyAttrs = AnyAttrs> {
53
+ /**
54
+ * Creates a node with attributes and any number of children.
55
+ */
57
56
  (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode;
57
+ /**
58
+ * Creates a node with any number of children.
59
+ */
58
60
  (...children: NodeChild[]): ProseMirrorNode;
59
61
  /**
60
62
  * Checks if the node is active in the current editor selection. If the
@@ -64,7 +66,7 @@ interface NodeAction<Attrs extends AnyAttrs = AnyAttrs> {
64
66
  isActive: (attrs?: Attrs) => boolean;
65
67
  }
66
68
  /**
67
- * A function for creating a mark with optional attributes and any number of
69
+ * A function for applying a mark with optional attributes and any number of
68
70
  * children.
69
71
  *
70
72
  * It also has a `isActive` method for checking if the mark is active in the
@@ -73,7 +75,13 @@ interface NodeAction<Attrs extends AnyAttrs = AnyAttrs> {
73
75
  * @public
74
76
  */
75
77
  interface MarkAction<Attrs extends AnyAttrs = AnyAttrs> {
78
+ /**
79
+ * Applies a mark with attributes and any number of children.
80
+ */
76
81
  (attrs: Attrs | null, ...children: NodeChild[]): ProseMirrorNode[];
82
+ /**
83
+ * Applies a mark with any number of children.
84
+ */
77
85
  (...children: NodeChild[]): ProseMirrorNode[];
78
86
  /**
79
87
  * Checks if the mark is active in the current editor selection. If the
@@ -90,12 +98,11 @@ type NodeBuilder = NodeAction;
90
98
  * @deprecated Use type {@link MarkAction} instead.
91
99
  */
92
100
  type MarkBuilder = MarkAction;
93
-
94
- //#endregion
95
- //#region src/types/extension-command.d.ts
96
101
  /**
97
102
  * @internal
98
103
  */
104
+ //#endregion
105
+ //#region src/types/extension-command.d.ts
99
106
  /**
100
107
  * A function to apply a command to the editor. It will return `true` if the command was applied, and `false` otherwise.
101
108
  *
@@ -130,7 +137,6 @@ interface CommandTyping {
130
137
  }
131
138
  type ToCommandCreators<T extends CommandTyping> = { [K in keyof T]: CommandCreator<T[K]> };
132
139
  type ToCommandAction<T extends CommandTyping> = { [K in keyof T]: CommandAction<T[K]> };
133
-
134
140
  //#endregion
135
141
  //#region src/types/extension-mark.d.ts
136
142
  /**
@@ -143,7 +149,6 @@ interface MarkTyping {
143
149
  * @internal
144
150
  */
145
151
  type ToMarkAction<T extends MarkTyping> = { [K in keyof T]: MarkAction<T[K]> };
146
-
147
152
  //#endregion
148
153
  //#region src/types/extension-node.d.ts
149
154
  /**
@@ -156,21 +161,18 @@ interface NodeTyping {
156
161
  * @internal
157
162
  */
158
163
  type ToNodeAction<T extends NodeTyping> = { [K in keyof T]: NodeAction<T[K]> };
159
-
160
164
  //#endregion
161
165
  //#region src/types/pick-sub-type.d.ts
162
166
  /**
163
167
  * @internal
164
168
  */
165
169
  type PickSubType<Type, ParentType> = Type extends ParentType ? [ParentType] extends [Type] ? never : Type : never;
166
-
167
170
  //#endregion
168
171
  //#region src/types/pick-string-literal.d.ts
169
172
  /**
170
173
  * @internal
171
174
  */
172
175
  type PickStringLiteral<T> = PickSubType<T, string>;
173
-
174
176
  //#endregion
175
177
  //#region src/types/priority.d.ts
176
178
  /**
@@ -185,27 +187,24 @@ declare enum Priority {
185
187
  high = 3,
186
188
  highest = 4,
187
189
  }
188
-
189
190
  //#endregion
190
191
  //#region src/types/simplify-deeper.d.ts
191
192
  /**
192
193
  * @internal
193
194
  */
194
195
  type SimplifyDeeper<T> = { [KeyType in keyof T]: Simplify<T[KeyType]> };
195
-
196
196
  //#endregion
197
197
  //#region src/types/simplify-union.d.ts
198
198
  /**
199
199
  * @internal
200
200
  */
201
201
  type SimplifyUnion<T> = Simplify<UnionToIntersection<T extends undefined ? never : T>>;
202
-
203
202
  //#endregion
204
203
  //#region src/types/extension.d.ts
205
204
  /**
206
205
  * @internal
207
206
  */
208
- interface ExtensionTyping<N extends NodeTyping | never = never, M extends MarkTyping | never = never, C extends CommandTyping | never = never> {
207
+ interface ExtensionTyping<N extends NodeTyping = never, M extends MarkTyping = never, C extends CommandTyping = never> {
209
208
  Nodes?: N;
210
209
  Marks?: M;
211
210
  Commands?: C;
@@ -216,13 +215,14 @@ interface ExtensionTyping<N extends NodeTyping | never = never, M extends MarkTy
216
215
  interface Extension<T extends ExtensionTyping<any, any, any> = ExtensionTyping<any, any, any>> {
217
216
  extension: Extension | Extension[];
218
217
  priority?: Priority;
219
- _type?: T;
220
218
  /**
221
219
  * @public
222
220
  *
223
221
  * The schema that this extension represents.
224
222
  */
225
223
  schema: Schema | null;
224
+ /** @internal */
225
+ _type?: T;
226
226
  }
227
227
  /**
228
228
  * @internal
@@ -301,7 +301,6 @@ type UnionExtension<E extends Extension | readonly Extension[]> = E extends read
301
301
  Marks: ExtractMarks<E[number]>;
302
302
  Commands: ExtractCommands<E[number]>;
303
303
  }> : E;
304
-
305
304
  //#endregion
306
305
  //#region src/types/model.d.ts
307
306
  /**
@@ -356,11 +355,9 @@ interface StepJSON {
356
355
  stepType: string;
357
356
  [x: string]: unknown;
358
357
  }
359
-
360
358
  //#endregion
361
359
  //#region src/types/dom-node.d.ts
362
360
  type DOMNode = InstanceType<typeof window.Node>;
363
-
364
361
  //#endregion
365
362
  //#region src/utils/parse.d.ts
366
363
  /** @public */
@@ -389,6 +386,7 @@ interface JSONParserOptions {
389
386
  */
390
387
  schema: Schema;
391
388
  }
389
+ /////////////// JSON <=> State ///////////////
392
390
  /**
393
391
  * Return a JSON object representing this state.
394
392
  *
@@ -415,6 +413,7 @@ declare function jsonFromState(state: EditorState): StateJSON;
415
413
  * ```
416
414
  */
417
415
  declare function stateFromJSON(json: StateJSON, options: JSONParserOptions): EditorState;
416
+ /////////////// JSON <=> Node ///////////////
418
417
  /**
419
418
  * Return a JSON object representing this node.
420
419
  *
@@ -441,6 +440,7 @@ declare function jsonFromNode(node: ProseMirrorNode): NodeJSON;
441
440
  * ```
442
441
  */
443
442
  declare function nodeFromJSON(json: NodeJSON, options: JSONParserOptions): ProseMirrorNode;
443
+ /////////////// Node <=> Element ///////////////
444
444
  /**
445
445
  * Parse a HTML element to a ProseMirror node.
446
446
  *
@@ -451,6 +451,7 @@ declare function nodeFromJSON(json: NodeJSON, options: JSONParserOptions): Prose
451
451
  * ```ts
452
452
  * const element = document.getElementById('content')
453
453
  * const node = nodeFromElement(element, { schema: editor.schema })
454
+ * ```
454
455
  */
455
456
  declare function nodeFromElement(element: DOMNode, options: DOMParserOptions & JSONParserOptions): ProseMirrorNode;
456
457
  /**
@@ -466,12 +467,14 @@ declare function nodeFromElement(element: DOMNode, options: DOMParserOptions & J
466
467
  * ```
467
468
  */
468
469
  declare function elementFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
470
+ /////////////// Element <=> HTML ///////////////
469
471
  /**
470
472
  * Parse a HTML string to a HTML element.
471
473
  *
472
474
  * @internal
473
475
  */
474
476
 
477
+ /////////////// Node <=> HTML ///////////////
475
478
  /**
476
479
  * Parse a HTML string to a ProseMirror node.
477
480
  *
@@ -482,6 +485,7 @@ declare function elementFromNode(node: ProseMirrorNode, options?: DOMSerializerO
482
485
  * ```ts
483
486
  * const html = '<p>Hello, world!</p>'
484
487
  * const node = nodeFromHTML(html, { schema: editor.schema })
488
+ * ```
485
489
  */
486
490
  declare function nodeFromHTML(html: string, options: DOMParserOptions & JSONParserOptions & DOMDocumentOptions): ProseMirrorNode;
487
491
  /**
@@ -497,6 +501,7 @@ declare function nodeFromHTML(html: string, options: DOMParserOptions & JSONPars
497
501
  * ```
498
502
  */
499
503
  declare function htmlFromNode(node: ProseMirrorNode, options?: DOMSerializerOptions & DOMDocumentOptions): string;
504
+ /////////////// JSON <=> Element ///////////////
500
505
  /**
501
506
  * Serialize a HTML element to a ProseMirror document JSON object.
502
507
  *
@@ -523,6 +528,7 @@ declare function htmlFromNode(node: ProseMirrorNode, options?: DOMSerializerOpti
523
528
  * ```
524
529
  */
525
530
  declare function elementFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): HTMLElement;
531
+ /////////////// JSON <=> HTML ///////////////
526
532
  /**
527
533
  * Parse a HTML string to a ProseMirror document JSON object.
528
534
  *
@@ -549,7 +555,6 @@ declare function jsonFromHTML(html: string, options: DOMDocumentOptions & DOMPar
549
555
  * ```
550
556
  */
551
557
  declare function htmlFromJSON(json: NodeJSON, options: JSONParserOptions & DOMSerializerOptions & DOMDocumentOptions): string;
552
-
553
558
  //#endregion
554
559
  //#region src/editor/editor.d.ts
555
560
  /**
@@ -745,6 +750,5 @@ declare class Editor<E extends Extension = any> {
745
750
  */
746
751
  get marks(): ExtractMarkActions<E>;
747
752
  }
748
-
749
753
  //#endregion
750
- export { AnyAttrs, AttrSpec, CommandAction, CommandCreator, CommandTyping, DOMDocumentOptions, DOMParserOptions, DOMSerializerOptions, Editor as Editor$1, EditorInstance as EditorInstance$1, EditorOptions, Extension, ExtensionTyping, ExtractCommandActions, ExtractCommandAppliers, ExtractCommandCreators, ExtractMarkActions, ExtractMarks, ExtractNodeActions, ExtractNodes, JSONParserOptions, MarkAction, MarkBuilder, MarkTyping, NodeAction, NodeBuilder, NodeChild, NodeJSON, NodeTyping, PickSubType, PlainExtension, Priority as Priority$1, SelectionJSON, SimplifyDeeper, SimplifyUnion, StateJSON, StepJSON, ToMarkAction, ToNodeAction, Union, UnionExtension, createEditor as createEditor$1, elementFromJSON as elementFromJSON$1, elementFromNode as elementFromNode$1, htmlFromJSON as htmlFromJSON$1, htmlFromNode as htmlFromNode$1, jsonFromHTML as jsonFromHTML$1, jsonFromNode as jsonFromNode$1, jsonFromState as jsonFromState$1, nodeFromElement as nodeFromElement$1, nodeFromHTML as nodeFromHTML$1, nodeFromJSON as nodeFromJSON$1, stateFromJSON as stateFromJSON$1 };
754
+ export { AnyAttrs, AttrSpec, CommandAction, CommandCreator, CommandTyping, DOMDocumentOptions, DOMParserOptions, DOMSerializerOptions, Editor, EditorInstance, EditorOptions, Extension, ExtensionTyping, ExtractCommandActions, ExtractCommandAppliers, ExtractCommandCreators, ExtractMarkActions, ExtractMarks, ExtractNodeActions, ExtractNodes, JSONParserOptions, MarkAction, MarkBuilder, MarkTyping, NodeAction, NodeBuilder, NodeChild, NodeJSON, NodeTyping, PickSubType, PlainExtension, Priority, SelectionJSON, SimplifyDeeper, SimplifyUnion, StateJSON, StepJSON, ToMarkAction, ToNodeAction, Union, UnionExtension, createEditor, elementFromJSON, elementFromNode, htmlFromJSON, htmlFromNode, jsonFromHTML, jsonFromNode, jsonFromState, nodeFromElement, nodeFromHTML, nodeFromJSON, stateFromJSON };
@@ -1,11 +1,8 @@
1
- import { Editor$1 as Editor, EditorInstance$1 as EditorInstance, EditorOptions, Extension } from "./editor-BP9kgR6R.js";
1
+ import { Editor, EditorInstance, EditorOptions, Extension } from "./editor-OUH5V8BA.js";
2
2
  import { ProseMirrorNode } from "@prosekit/pm/model";
3
3
 
4
4
  //#region src/test/test-editor.d.ts
5
- /**
6
- * An editor for testing purposes.
7
- * @public
8
- */
5
+
9
6
  /**
10
7
  * An editor for testing purposes.
11
8
  * @public
@@ -32,6 +29,5 @@ declare class TestEditor<E extends Extension = Extension> extends Editor<E> {
32
29
  * @public
33
30
  */
34
31
  declare function createTestEditor<E extends Extension>(options: EditorOptions<E>): TestEditor<E>;
35
-
36
32
  //#endregion
37
33
  export { TestEditor, createTestEditor };