@prosekit/core 0.7.7 → 0.7.9
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 +245 -41
- package/dist/{chunk-MDJ2B4IL.js → chunk-RNBMCB5M.js} +165 -130
- package/dist/prosekit-core-test.js +5 -2
- package/dist/prosekit-core.d.ts +6 -0
- package/dist/prosekit-core.js +264 -275
- package/package.json +7 -6
@@ -1,28 +1,30 @@
|
|
1
1
|
import { AllSelection } from '@prosekit/pm/state';
|
2
|
-
import { Attrs } from '@prosekit/pm/model';
|
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
5
|
import { config as default_alias_1 } from '@prosekit/dev/config-vitest';
|
6
6
|
import type { DirectEditorProps } from '@prosekit/pm/view';
|
7
7
|
import type { DOMEventMap } from '@prosekit/pm/view';
|
8
|
+
import type { DOMOutputSpec } from '@prosekit/pm/model';
|
8
9
|
import { DOMParser as DOMParser_2 } from '@prosekit/pm/model';
|
9
10
|
import { DOMSerializer } from '@prosekit/pm/model';
|
10
11
|
import { EditorState } from '@prosekit/pm/state';
|
11
12
|
import type { EditorStateConfig } from '@prosekit/pm/state';
|
12
13
|
import { EditorView } from '@prosekit/pm/view';
|
14
|
+
import { Fragment } from '@prosekit/pm/model';
|
13
15
|
import type { IsEqual } from 'type-fest';
|
14
16
|
import { Mark } from '@prosekit/pm/model';
|
15
17
|
import type { MarkSpec } from '@prosekit/pm/model';
|
16
|
-
import { MarkType } from '@prosekit/pm/model';
|
18
|
+
import type { MarkType } from '@prosekit/pm/model';
|
17
19
|
import type { Node as Node_2 } from '@prosekit/pm/model';
|
18
20
|
import { NodeSelection } from '@prosekit/pm/state';
|
19
21
|
import type { NodeSpec } from '@prosekit/pm/model';
|
20
|
-
import { NodeType } from '@prosekit/pm/model';
|
22
|
+
import type { NodeType } from '@prosekit/pm/model';
|
21
23
|
import { NodeType as NodeType_2 } from 'prosemirror-model';
|
22
24
|
import type { NodeView } from '@prosekit/pm/view';
|
23
25
|
import type { NodeViewConstructor } from '@prosekit/pm/view';
|
24
26
|
import { Options } from 'tsup';
|
25
|
-
import
|
27
|
+
import { ParseOptions } from '@prosekit/pm/model';
|
26
28
|
import { Plugin as Plugin_2 } from '@prosekit/pm/state';
|
27
29
|
import { ProseMirrorFragment } from '@prosekit/pm/model';
|
28
30
|
import { ProseMirrorNode } from '@prosekit/pm/model';
|
@@ -32,7 +34,8 @@ import { SchemaSpec } from '@prosekit/pm/model';
|
|
32
34
|
import { Selection as Selection_2 } from '@prosekit/pm/state';
|
33
35
|
import { Selection as Selection_3 } from 'prosemirror-state';
|
34
36
|
import type { Simplify } from 'type-fest';
|
35
|
-
import
|
37
|
+
import { Slice } from '@prosekit/pm/model';
|
38
|
+
import type { TagParseRule } from '@prosekit/pm/model';
|
36
39
|
import { TextSelection } from '@prosekit/pm/state';
|
37
40
|
import { Transaction } from '@prosekit/pm/state';
|
38
41
|
import type { UnionToIntersection } from 'type-fest';
|
@@ -120,6 +123,12 @@ export declare function assertTypeEqual<T, U>(_val: IsEqual<T, U>): void;
|
|
120
123
|
*/
|
121
124
|
export declare function assertTypeEqual_alias_1<T, U>(_val: IsEqual<T, U>): void;
|
122
125
|
|
126
|
+
declare interface AttrOptions {
|
127
|
+
attr: string;
|
128
|
+
toDOM?: (value: unknown) => [key: string, value: string] | null | undefined;
|
129
|
+
parseDOM?: (node: HTMLElement) => unknown;
|
130
|
+
}
|
131
|
+
|
123
132
|
export declare function attrsMatch(nodeOrMark: ProseMirrorNode | Mark, attrs: Attrs): boolean;
|
124
133
|
|
125
134
|
/**
|
@@ -224,10 +233,6 @@ declare interface BaseNodeViewOptions {
|
|
224
233
|
export { BaseNodeViewOptions }
|
225
234
|
export { BaseNodeViewOptions as BaseNodeViewOptions_alias_1 }
|
226
235
|
|
227
|
-
export declare function baseToggleMark(markType: MarkType, attrs?: Attrs | null, options?: {
|
228
|
-
removeWhenPresent: boolean;
|
229
|
-
}): Command;
|
230
|
-
|
231
236
|
declare type BoldExtension = Extension<{
|
232
237
|
Marks: {
|
233
238
|
bold: Attrs;
|
@@ -269,16 +274,27 @@ declare type CodeBlockExtension = Extension<{
|
|
269
274
|
};
|
270
275
|
}>;
|
271
276
|
|
277
|
+
/**
|
278
|
+
* Collects all children of a node or a fragment, and returns them as an array.
|
279
|
+
*
|
280
|
+
* @public
|
281
|
+
*/
|
282
|
+
declare function collectChildren(parent: ProseMirrorNode | Fragment): ProseMirrorNode[];
|
283
|
+
export { collectChildren }
|
284
|
+
export { collectChildren as collectChildren_alias_1 }
|
285
|
+
|
272
286
|
/**
|
273
287
|
* Collects all nodes from a given content.
|
274
288
|
*
|
289
|
+
* @deprecated Use `collectChildren` instead.
|
290
|
+
*
|
275
291
|
* @public
|
276
292
|
*/
|
277
293
|
declare function collectNodes(content: NodeContent): ProseMirrorNode[];
|
278
294
|
export { collectNodes }
|
279
295
|
export { collectNodes as collectNodes_alias_1 }
|
280
296
|
|
281
|
-
export declare function combineEventHandlers<Handler extends (...args: any[]) => boolean | void, Args extends Parameters<Handler> = Parameters<Handler>>(): readonly [(
|
297
|
+
export declare function combineEventHandlers<Handler extends (...args: any[]) => boolean | void, Args extends Parameters<Handler> = Parameters<Handler>>(): readonly [(eventHandlers: Handler[]) => void, (...args: Args) => boolean];
|
282
298
|
|
283
299
|
/**
|
284
300
|
* A function to apply a command to the editor. It will return `true` if the command was applied, and `false` otherwise.
|
@@ -288,7 +304,21 @@ export declare function combineEventHandlers<Handler extends (...args: any[]) =>
|
|
288
304
|
* @public
|
289
305
|
*/
|
290
306
|
declare interface CommandAction<Args extends any[] = any[]> {
|
307
|
+
/**
|
308
|
+
* Execute the current command. Return `true` if the command was successfully
|
309
|
+
* executed, otherwise `false`.
|
310
|
+
*/
|
291
311
|
(...args: Args): boolean;
|
312
|
+
/**
|
313
|
+
* Check if the current command can be executed. Return `true` if the command
|
314
|
+
* can be executed, otherwise `false`.
|
315
|
+
*/
|
316
|
+
canExec(...args: Args): boolean;
|
317
|
+
/**
|
318
|
+
* An alias for `canExec`.
|
319
|
+
*
|
320
|
+
* @deprecated Use `canExec` instead.
|
321
|
+
*/
|
292
322
|
canApply(...args: Args): boolean;
|
293
323
|
}
|
294
324
|
export { CommandAction }
|
@@ -389,7 +419,7 @@ declare interface DefaultStateOptions {
|
|
389
419
|
defaultHTML?: string | HTMLElement;
|
390
420
|
/**
|
391
421
|
* A JSON object representing the starting selection to use when creating the
|
392
|
-
* editor. It's only used when `
|
422
|
+
* editor. It's only used when `defaultContent` is also provided.
|
393
423
|
*/
|
394
424
|
defaultSelection?: SelectionJSON;
|
395
425
|
}
|
@@ -450,9 +480,11 @@ export { defineCommands as defineCommands_alias_1 }
|
|
450
480
|
/**
|
451
481
|
* Define a default state for the editor.
|
452
482
|
*
|
483
|
+
* @param options
|
484
|
+
*
|
453
485
|
* @public
|
454
486
|
*/
|
455
|
-
declare function defineDefaultState(
|
487
|
+
declare function defineDefaultState({ defaultSelection, defaultContent, defaultDoc, defaultHTML, }: DefaultStateOptions): PlainExtension;
|
456
488
|
export { defineDefaultState }
|
457
489
|
export { defineDefaultState as defineDefaultState_alias_1 }
|
458
490
|
|
@@ -554,6 +586,8 @@ export { defineFocusChangeHandler as defineFocusChangeHandler_alias_1 }
|
|
554
586
|
/**
|
555
587
|
* Add undo/redo history to the editor.
|
556
588
|
*
|
589
|
+
* @param options
|
590
|
+
*
|
557
591
|
* @public
|
558
592
|
*/
|
559
593
|
declare function defineHistory({ depth, newGroupDelay, }?: HistoryOptions): HistoryExtension;
|
@@ -933,6 +967,16 @@ declare class Editor<E extends Extension = any> {
|
|
933
967
|
* - The string "end" (to set selection at the end)
|
934
968
|
*/
|
935
969
|
setContent: (content: ProseMirrorNode | NodeJSON | string | HTMLElement, selection?: SelectionJSON | Selection_2 | "start" | "end") => void;
|
970
|
+
/**
|
971
|
+
* Execute the given command. Return `true` if the command was successfully
|
972
|
+
* executed, otherwise `false`.
|
973
|
+
*/
|
974
|
+
exec: (command: Command) => boolean;
|
975
|
+
/**
|
976
|
+
* Check if the given command can be executed. Return `true` if the command
|
977
|
+
* can be executed, otherwise `false`.
|
978
|
+
*/
|
979
|
+
canExec: (command: Command) => boolean;
|
936
980
|
/**
|
937
981
|
* All {@link CommandAction}s defined by the editor.
|
938
982
|
*/
|
@@ -966,6 +1010,7 @@ export declare class EditorInstance {
|
|
966
1010
|
constructor(extension: Extension);
|
967
1011
|
getState: () => EditorState;
|
968
1012
|
updateState(state: EditorState): void;
|
1013
|
+
private dispatch;
|
969
1014
|
setContent(content: NodeJSON | string | HTMLElement | ProseMirrorNode, selection?: SelectionJSON | Selection_2 | 'start' | 'end'): void;
|
970
1015
|
private updateExtension;
|
971
1016
|
use(extension: Extension): VoidFunction;
|
@@ -975,6 +1020,8 @@ export declare class EditorInstance {
|
|
975
1020
|
get assertView(): EditorView;
|
976
1021
|
definePlugins(plugins: readonly Plugin_2[]): void;
|
977
1022
|
removePlugins(plugins: readonly Plugin_2[]): void;
|
1023
|
+
exec(command: Command): boolean;
|
1024
|
+
canExec(command: Command): boolean;
|
978
1025
|
defineCommand<Args extends any[] = any[]>(name: string, commandCreator: CommandCreator<Args>): void;
|
979
1026
|
removeCommand(name: string): void;
|
980
1027
|
}
|
@@ -1017,7 +1064,7 @@ declare interface EditorOptions<E extends Extension> {
|
|
1017
1064
|
defaultHTML?: string | HTMLElement;
|
1018
1065
|
/**
|
1019
1066
|
* A JSON object representing the starting selection to use when creating the
|
1020
|
-
* editor. It's only used when `
|
1067
|
+
* editor. It's only used when `defaultContent` is also provided.
|
1021
1068
|
*/
|
1022
1069
|
defaultSelection?: SelectionJSON;
|
1023
1070
|
}
|
@@ -1252,10 +1299,63 @@ export declare function findBrowserWindow(options?: {
|
|
1252
1299
|
document?: Document;
|
1253
1300
|
}): (Window & typeof globalThis) | null | undefined;
|
1254
1301
|
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1302
|
+
/**
|
1303
|
+
* Find the closest parent node that satisfies the predicate.
|
1304
|
+
*
|
1305
|
+
* @public
|
1306
|
+
*/
|
1307
|
+
declare function findParentNode(
|
1308
|
+
/**
|
1309
|
+
* The predicate to test the parent node.
|
1310
|
+
*/
|
1311
|
+
predicate: (node: ProseMirrorNode) => boolean,
|
1312
|
+
/**
|
1313
|
+
* The position to start searching from.
|
1314
|
+
*/
|
1315
|
+
$pos: ResolvedPos): FindParentNodeResult | undefined;
|
1316
|
+
export { findParentNode }
|
1317
|
+
export { findParentNode as findParentNode_alias_1 }
|
1318
|
+
|
1319
|
+
/**
|
1320
|
+
* Finds the closest parent node that matches the given node type.
|
1321
|
+
*
|
1322
|
+
* @public
|
1323
|
+
*/
|
1324
|
+
declare function findParentNodeOfType(
|
1325
|
+
/**
|
1326
|
+
* The type of the node to find.
|
1327
|
+
*/
|
1328
|
+
type: NodeType | string,
|
1329
|
+
/**
|
1330
|
+
* The position to start searching from.
|
1331
|
+
*/
|
1332
|
+
$pos: ResolvedPos): FindParentNodeResult | undefined;
|
1333
|
+
export { findParentNodeOfType }
|
1334
|
+
export { findParentNodeOfType as findParentNodeOfType_alias_1 }
|
1335
|
+
|
1336
|
+
/**
|
1337
|
+
* @public
|
1338
|
+
*/
|
1339
|
+
declare interface FindParentNodeResult {
|
1340
|
+
/**
|
1341
|
+
* The closest parent node that satisfies the predicate.
|
1342
|
+
*/
|
1343
|
+
node: ProseMirrorNode;
|
1344
|
+
/**
|
1345
|
+
* The position directly before the node.
|
1346
|
+
*/
|
1347
|
+
pos: number;
|
1348
|
+
/**
|
1349
|
+
* The position at the start of the node.
|
1350
|
+
*/
|
1351
|
+
start: number;
|
1352
|
+
/**
|
1353
|
+
* The depth of the node.
|
1354
|
+
*/
|
1355
|
+
depth: number;
|
1356
|
+
}
|
1357
|
+
export { FindParentNodeResult }
|
1358
|
+
export { FindParentNodeResult as FindParentNodeResult_alias_1 }
|
1259
1359
|
|
1260
1360
|
/**
|
1261
1361
|
* A function that is called when the editor gains or loses focus.
|
@@ -1316,12 +1416,12 @@ export declare function getNodeTypes(schema: Schema, types: string | NodeType |
|
|
1316
1416
|
|
1317
1417
|
declare type GetStateFunction = () => EditorState | null | undefined;
|
1318
1418
|
|
1319
|
-
export declare
|
1419
|
+
export declare function groupBy<K extends PropertyKey, T>(items: Iterable<T>, keySelector: (item: T) => K): Partial<Record<K, T[]>>;
|
1420
|
+
|
1421
|
+
export declare function groupEntries<T extends Record<string, any>>(entries: ObjectEntries<T>[]): {
|
1320
1422
|
[K in keyof T]?: T[K][];
|
1321
1423
|
};
|
1322
1424
|
|
1323
|
-
export declare function groupEntries<T extends Record<string, any>>(entries: ObjectEntries<T>[]): GroupedEntries<T>;
|
1324
|
-
|
1325
1425
|
declare type HeadingExtension = Extension<{
|
1326
1426
|
Nodes: {
|
1327
1427
|
heading: Attrs;
|
@@ -1429,6 +1529,8 @@ declare interface InsertNodeOptions {
|
|
1429
1529
|
export { InsertNodeOptions }
|
1430
1530
|
export { InsertNodeOptions as InsertNodeOptions_alias_1 }
|
1431
1531
|
|
1532
|
+
export declare function insertOutputSpecAttrs(dom: DOMOutputSpec, attrs: Array<[key: string, value: string]>): DOMOutputSpec;
|
1533
|
+
|
1432
1534
|
/**
|
1433
1535
|
* Returns a command that inserts the given text.
|
1434
1536
|
*
|
@@ -1446,7 +1548,9 @@ export declare type InsertTextOptions = {
|
|
1446
1548
|
};
|
1447
1549
|
|
1448
1550
|
/**
|
1449
|
-
*
|
1551
|
+
* Checks if the given object is a `AllSelection` instance.
|
1552
|
+
*
|
1553
|
+
* @public
|
1450
1554
|
*/
|
1451
1555
|
declare function isAllSelection(sel: Selection_2): sel is AllSelection;
|
1452
1556
|
export { isAllSelection }
|
@@ -1470,6 +1574,15 @@ export { isAtBlockStart as isAtBlockStart_alias_1 }
|
|
1470
1574
|
|
1471
1575
|
export declare function isElement(el: unknown): el is Element;
|
1472
1576
|
|
1577
|
+
/**
|
1578
|
+
* Checks if the given object is a `Fragment` instance.
|
1579
|
+
*
|
1580
|
+
* @public
|
1581
|
+
*/
|
1582
|
+
declare function isFragment(fragment: unknown): fragment is Fragment;
|
1583
|
+
export { isFragment }
|
1584
|
+
export { isFragment as isFragment_alias_1 }
|
1585
|
+
|
1473
1586
|
/**
|
1474
1587
|
* Check if the selection is in a code block.
|
1475
1588
|
*
|
@@ -1480,7 +1593,9 @@ export { isInCodeBlock }
|
|
1480
1593
|
export { isInCodeBlock as isInCodeBlock_alias_1 }
|
1481
1594
|
|
1482
1595
|
/**
|
1483
|
-
*
|
1596
|
+
* Checks if the given object is a `Mark` instance.
|
1597
|
+
*
|
1598
|
+
* @public
|
1484
1599
|
*/
|
1485
1600
|
declare function isMark(mark: unknown): mark is Mark;
|
1486
1601
|
export { isMark }
|
@@ -1507,30 +1622,46 @@ export { isMarkActive as isMarkActive_alias_1 }
|
|
1507
1622
|
export declare function isNodeActive(state: EditorState, type: string | NodeType, attrs?: Attrs | null): boolean;
|
1508
1623
|
|
1509
1624
|
/**
|
1510
|
-
*
|
1625
|
+
* Checks if the given object is a `NodeSelection` instance.
|
1626
|
+
*
|
1627
|
+
* @public
|
1511
1628
|
*/
|
1512
1629
|
declare function isNodeSelection(sel: Selection_2): sel is NodeSelection;
|
1513
1630
|
export { isNodeSelection }
|
1514
1631
|
export { isNodeSelection as isNodeSelection_alias_1 }
|
1515
1632
|
|
1516
|
-
|
1633
|
+
/**
|
1634
|
+
* @internal
|
1635
|
+
*/
|
1636
|
+
export declare function isNotNullish<T>(value: T | null | undefined | void): value is T;
|
1517
1637
|
|
1518
1638
|
export declare function isObject(v: unknown): v is Record<string, unknown>;
|
1519
1639
|
|
1520
1640
|
/**
|
1521
|
-
*
|
1641
|
+
* Checks if the given object is a `ProseMirrorNode` instance.
|
1522
1642
|
*/
|
1523
1643
|
declare function isProseMirrorNode(node: unknown): node is ProseMirrorNode;
|
1524
1644
|
export { isProseMirrorNode }
|
1525
1645
|
export { isProseMirrorNode as isProseMirrorNode_alias_1 }
|
1526
1646
|
|
1527
1647
|
/**
|
1528
|
-
*
|
1648
|
+
* Checks if the given object is a `Selection` instance.
|
1649
|
+
*
|
1650
|
+
* @public
|
1529
1651
|
*/
|
1530
1652
|
declare function isSelection(sel: unknown): sel is Selection_2;
|
1531
1653
|
export { isSelection }
|
1532
1654
|
export { isSelection as isSelection_alias_1 }
|
1533
1655
|
|
1656
|
+
/**
|
1657
|
+
* Checks if the given object is a `Slice` instance.
|
1658
|
+
*
|
1659
|
+
* @public
|
1660
|
+
*/
|
1661
|
+
declare function isSlice(slice: unknown): slice is Slice;
|
1662
|
+
export { isSlice }
|
1663
|
+
export { isSlice as isSlice_alias_1 }
|
1664
|
+
|
1534
1665
|
/**
|
1535
1666
|
* Check if `subset` is a subset of `superset`.
|
1536
1667
|
*
|
@@ -1539,7 +1670,9 @@ export { isSelection as isSelection_alias_1 }
|
|
1539
1670
|
export declare function isSubset(subset: Record<string, unknown>, superset: Record<string, unknown>): boolean;
|
1540
1671
|
|
1541
1672
|
/**
|
1542
|
-
*
|
1673
|
+
* Checks if the given object is a `TextSelection` instance.
|
1674
|
+
*
|
1675
|
+
* @public
|
1543
1676
|
*/
|
1544
1677
|
declare function isTextSelection(sel: Selection_2): sel is TextSelection;
|
1545
1678
|
export { isTextSelection }
|
@@ -1668,13 +1801,18 @@ declare interface MarkAttrOptions<MarkName extends string = string, AttrName ext
|
|
1668
1801
|
*/
|
1669
1802
|
attr: AttrName;
|
1670
1803
|
/**
|
1671
|
-
* Returns the attribute key and value to be set on the
|
1804
|
+
* Returns the attribute key and value to be set on the HTML element.
|
1805
|
+
*
|
1806
|
+
* If the returned `key` is `"style"`, the value is a string of CSS properties and will
|
1807
|
+
* be prepended to the existing `style` attribute on the DOM node.
|
1808
|
+
*
|
1809
|
+
* @param value - The value of the attribute of current ProseMirror node.
|
1672
1810
|
*/
|
1673
|
-
toDOM?: (value:
|
1811
|
+
toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
|
1674
1812
|
/**
|
1675
1813
|
* Parses the attribute value from the DOM.
|
1676
1814
|
*/
|
1677
|
-
parseDOM?: (node: HTMLElement) =>
|
1815
|
+
parseDOM?: (node: HTMLElement) => AttrType;
|
1678
1816
|
}
|
1679
1817
|
export { MarkAttrOptions }
|
1680
1818
|
export { MarkAttrOptions as MarkAttrOptions_alias_1 }
|
@@ -1720,6 +1858,12 @@ declare function maybeRun<T, R = T extends (...args: any[]) => void ? ReturnType
|
|
1720
1858
|
export { maybeRun }
|
1721
1859
|
export { maybeRun as maybeRun_alias_1 }
|
1722
1860
|
|
1861
|
+
export declare function mergeObjects<T extends object>(...objects: Array<Partial<T> | null | undefined>): Partial<T>;
|
1862
|
+
|
1863
|
+
export declare function mergeSpecs(a: NodeSpec, b: NodeSpec): NodeSpec;
|
1864
|
+
|
1865
|
+
export declare function mergeSpecs(a: MarkSpec, b: MarkSpec): MarkSpec;
|
1866
|
+
|
1723
1867
|
/**
|
1724
1868
|
* A function that is called when the editor view is mounted.
|
1725
1869
|
*
|
@@ -1774,16 +1918,18 @@ declare interface NodeAttrOptions<NodeName extends string = string, AttrName ext
|
|
1774
1918
|
*/
|
1775
1919
|
splittable?: boolean;
|
1776
1920
|
/**
|
1777
|
-
* Returns the attribute key and value to be set on the
|
1921
|
+
* Returns the attribute key and value to be set on the HTML element.
|
1778
1922
|
*
|
1779
|
-
* If the `key` is `"style"`, the value is a string of CSS properties and will
|
1923
|
+
* If the returned `key` is `"style"`, the value is a string of CSS properties and will
|
1780
1924
|
* be prepended to the existing `style` attribute on the DOM node.
|
1925
|
+
*
|
1926
|
+
* @param value - The value of the attribute of current ProseMirror node.
|
1781
1927
|
*/
|
1782
|
-
toDOM?: (value:
|
1928
|
+
toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
|
1783
1929
|
/**
|
1784
1930
|
* Parses the attribute value from the DOM.
|
1785
1931
|
*/
|
1786
|
-
parseDOM?: (node: HTMLElement) =>
|
1932
|
+
parseDOM?: (node: HTMLElement) => AttrType;
|
1787
1933
|
}
|
1788
1934
|
export { NodeAttrOptions }
|
1789
1935
|
export { NodeAttrOptions as NodeAttrOptions_alias_1 }
|
@@ -1806,6 +1952,8 @@ export { NodeChild as NodeChild_alias_1 }
|
|
1806
1952
|
|
1807
1953
|
/**
|
1808
1954
|
* @public
|
1955
|
+
*
|
1956
|
+
* @deprecated
|
1809
1957
|
*/
|
1810
1958
|
declare type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
|
1811
1959
|
export { NodeContent }
|
@@ -2082,13 +2230,16 @@ declare interface RemoveNodeOptions {
|
|
2082
2230
|
*/
|
2083
2231
|
type: string | NodeType;
|
2084
2232
|
/**
|
2085
|
-
* The document position to start searching node. By default it will be the
|
2233
|
+
* The document position to start searching node. By default it will be the
|
2234
|
+
* anchor position of current selection.
|
2086
2235
|
*/
|
2087
2236
|
pos?: number;
|
2088
2237
|
}
|
2089
2238
|
export { RemoveNodeOptions }
|
2090
2239
|
export { RemoveNodeOptions as RemoveNodeOptions_alias_1 }
|
2091
2240
|
|
2241
|
+
export declare function removeUndefinedValues<T extends object>(obj: T): T;
|
2242
|
+
|
2092
2243
|
export declare const rootFacet: Facet<RootPayload, RootOutput>;
|
2093
2244
|
|
2094
2245
|
export declare type RootOutput = {
|
@@ -2383,9 +2534,11 @@ export declare type ToCommandCreators<T extends CommandTyping> = {
|
|
2383
2534
|
/**
|
2384
2535
|
* Returns a command that toggles the given mark with the given attributes.
|
2385
2536
|
*
|
2537
|
+
* @param options
|
2538
|
+
*
|
2386
2539
|
* @public
|
2387
2540
|
*/
|
2388
|
-
declare function toggleMark({ type, attrs }: ToggleMarkOptions): Command;
|
2541
|
+
declare function toggleMark({ type, attrs, removeWhenPresent, enterInlineAtoms, }: ToggleMarkOptions): Command;
|
2389
2542
|
export { toggleMark }
|
2390
2543
|
export { toggleMark as toggleMark_alias_1 }
|
2391
2544
|
|
@@ -2393,8 +2546,30 @@ export { toggleMark as toggleMark_alias_1 }
|
|
2393
2546
|
* @public
|
2394
2547
|
*/
|
2395
2548
|
declare interface ToggleMarkOptions {
|
2549
|
+
/**
|
2550
|
+
* The mark type to toggle.
|
2551
|
+
*/
|
2396
2552
|
type: string | MarkType;
|
2553
|
+
/**
|
2554
|
+
* The optional attributes to set on the mark.
|
2555
|
+
*/
|
2397
2556
|
attrs?: Attrs | null;
|
2557
|
+
/**
|
2558
|
+
* Controls whether, when part of the selected range has the mark
|
2559
|
+
* already and part doesn't, the mark is removed (`true`) or added
|
2560
|
+
* (`false`).
|
2561
|
+
*
|
2562
|
+
* @default false
|
2563
|
+
*/
|
2564
|
+
removeWhenPresent?: boolean;
|
2565
|
+
/**
|
2566
|
+
* Whether the command should act on the content of inline nodes marked as
|
2567
|
+
* [atoms](https://prosemirror.net/docs/ref/#model.NodeSpec.atom) that are
|
2568
|
+
* completely covered by a selection range.
|
2569
|
+
*
|
2570
|
+
* @default true
|
2571
|
+
*/
|
2572
|
+
enterInlineAtoms?: boolean;
|
2398
2573
|
}
|
2399
2574
|
export { ToggleMarkOptions }
|
2400
2575
|
export { ToggleMarkOptions as ToggleMarkOptions_alias_1 }
|
@@ -2403,6 +2578,8 @@ export { ToggleMarkOptions as ToggleMarkOptions_alias_1 }
|
|
2403
2578
|
* Returns a command that set the selected textblocks to the given node type
|
2404
2579
|
* with the given attributes.
|
2405
2580
|
*
|
2581
|
+
* @param options
|
2582
|
+
*
|
2406
2583
|
* @public
|
2407
2584
|
*/
|
2408
2585
|
declare function toggleNode({ type, attrs }: ToggleNodeOptions): Command;
|
@@ -2470,7 +2647,8 @@ export { Union }
|
|
2470
2647
|
export { Union as Union_alias_1 }
|
2471
2648
|
|
2472
2649
|
/**
|
2473
|
-
*
|
2650
|
+
* Merges multiple extensions into one. You can pass multiple extensions as
|
2651
|
+
* arguments or a single array containing multiple extensions.
|
2474
2652
|
*
|
2475
2653
|
* @throws If no extensions are provided.
|
2476
2654
|
*
|
@@ -2478,6 +2656,17 @@ export { Union as Union_alias_1 }
|
|
2478
2656
|
*
|
2479
2657
|
* ```ts
|
2480
2658
|
* function defineFancyNodes() {
|
2659
|
+
* return union(
|
2660
|
+
* defineFancyParagraph(),
|
2661
|
+
* defineFancyHeading(),
|
2662
|
+
* )
|
2663
|
+
* }
|
2664
|
+
* ```
|
2665
|
+
*
|
2666
|
+
* @example
|
2667
|
+
*
|
2668
|
+
* ```ts
|
2669
|
+
* function defineFancyNodes() {
|
2481
2670
|
* return union([
|
2482
2671
|
* defineFancyParagraph(),
|
2483
2672
|
* defineFancyHeading(),
|
@@ -2633,12 +2822,13 @@ export { withSkipCodeBlock }
|
|
2633
2822
|
export { withSkipCodeBlock as withSkipCodeBlock_alias_1 }
|
2634
2823
|
|
2635
2824
|
/**
|
2636
|
-
* Returns a command that wraps the selected textblock with the given node type
|
2637
|
-
*
|
2825
|
+
* Returns a command that wraps the selected textblock with the given node type.
|
2826
|
+
*
|
2827
|
+
* @param options
|
2638
2828
|
*
|
2639
2829
|
* @public
|
2640
2830
|
*/
|
2641
|
-
declare function wrap(
|
2831
|
+
declare function wrap(options: WrapOptions): Command;
|
2642
2832
|
export { wrap }
|
2643
2833
|
export { wrap as wrap_alias_1 }
|
2644
2834
|
|
@@ -2646,12 +2836,26 @@ export { wrap as wrap_alias_1 }
|
|
2646
2836
|
* @public
|
2647
2837
|
*/
|
2648
2838
|
declare interface WrapOptions {
|
2649
|
-
|
2839
|
+
/**
|
2840
|
+
* The node type to wrap the selected textblock with.
|
2841
|
+
*/
|
2842
|
+
type: NodeType | string;
|
2843
|
+
/**
|
2844
|
+
* @deprecated Use `nodeSpec` instead.
|
2845
|
+
*/
|
2846
|
+
nodeType?: NodeType;
|
2847
|
+
/**
|
2848
|
+
* Optional attributes to apply to the node.
|
2849
|
+
*/
|
2650
2850
|
attrs?: Attrs | null;
|
2651
2851
|
}
|
2652
2852
|
export { WrapOptions }
|
2653
2853
|
export { WrapOptions as WrapOptions_alias_1 }
|
2654
2854
|
|
2855
|
+
export declare function wrapOutputSpecAttrs<T extends ProseMirrorNode | Mark, Args extends readonly unknown[]>(toDOM: (node: T, ...args: Args) => DOMOutputSpec, options: AttrOptions[]): (node: T, ...args: Args) => DOMOutputSpec;
|
2856
|
+
|
2857
|
+
export declare function wrapTagParseRuleAttrs(rule: TagParseRule, options: AttrOptions[]): TagParseRule;
|
2858
|
+
|
2655
2859
|
export declare function zip<T, P>(a: T[], b: P[]): [T, P][];
|
2656
2860
|
|
2657
2861
|
export { }
|