@prosekit/core 0.8.2 → 0.8.4
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/editor-CfkZ4TNU.d.ts +748 -0
- package/dist/editor-CfkZ4TNU.d.ts.map +1 -0
- package/dist/{editor-DbMrpnmL.js → editor-CizSwUN8.js} +102 -192
- package/dist/editor-CizSwUN8.js.map +1 -0
- package/dist/prosekit-core-test.d.ts +20 -19
- package/dist/prosekit-core-test.d.ts.map +1 -0
- package/dist/prosekit-core-test.js +4 -5
- package/dist/prosekit-core-test.js.map +1 -0
- package/dist/prosekit-core.d.ts +782 -757
- package/dist/prosekit-core.d.ts.map +1 -0
- package/dist/prosekit-core.js +30 -45
- package/dist/prosekit-core.js.map +1 -0
- package/package.json +14 -11
- package/src/commands/add-mark.ts +53 -0
- package/src/commands/expand-mark.ts +96 -0
- package/src/commands/insert-default-block.spec.ts +102 -0
- package/src/commands/insert-default-block.ts +49 -0
- package/src/commands/insert-node.ts +71 -0
- package/src/commands/insert-text.ts +24 -0
- package/src/commands/remove-mark.ts +54 -0
- package/src/commands/remove-node.ts +43 -0
- package/src/commands/select-all.ts +16 -0
- package/src/commands/set-block-type.ts +64 -0
- package/src/commands/set-node-attrs.ts +68 -0
- package/src/commands/toggle-mark.ts +65 -0
- package/src/commands/toggle-node.ts +47 -0
- package/src/commands/toggle-wrap.spec.ts +35 -0
- package/src/commands/toggle-wrap.ts +42 -0
- package/src/commands/unset-block-type.spec.ts +49 -0
- package/src/commands/unset-block-type.ts +84 -0
- package/src/commands/unset-mark.spec.ts +35 -0
- package/src/commands/unset-mark.ts +38 -0
- package/src/commands/wrap.ts +50 -0
- package/src/editor/action.spec.ts +143 -0
- package/src/editor/action.ts +248 -0
- package/src/editor/editor.spec.ts +186 -0
- package/src/editor/editor.ts +563 -0
- package/src/editor/union.spec.ts +108 -0
- package/src/editor/union.ts +47 -0
- package/src/editor/with-priority.ts +25 -0
- package/src/error.ts +28 -0
- package/src/extensions/clipboard-serializer.ts +107 -0
- package/src/extensions/command.ts +121 -0
- package/src/extensions/default-state.spec.ts +60 -0
- package/src/extensions/default-state.ts +76 -0
- package/src/extensions/doc.ts +31 -0
- package/src/extensions/events/doc-change.ts +34 -0
- package/src/extensions/events/dom-event.spec.ts +70 -0
- package/src/extensions/events/dom-event.ts +117 -0
- package/src/extensions/events/editor-event.ts +293 -0
- package/src/extensions/events/focus.spec.ts +50 -0
- package/src/extensions/events/focus.ts +28 -0
- package/src/extensions/events/plugin-view.ts +132 -0
- package/src/extensions/history.ts +81 -0
- package/src/extensions/keymap-base.ts +60 -0
- package/src/extensions/keymap.spec.ts +89 -0
- package/src/extensions/keymap.ts +96 -0
- package/src/extensions/mark-spec.spec.ts +177 -0
- package/src/extensions/mark-spec.ts +181 -0
- package/src/extensions/mark-view-effect.ts +85 -0
- package/src/extensions/mark-view.ts +43 -0
- package/src/extensions/node-spec.spec.ts +224 -0
- package/src/extensions/node-spec.ts +199 -0
- package/src/extensions/node-view-effect.ts +85 -0
- package/src/extensions/node-view.ts +43 -0
- package/src/extensions/paragraph.ts +61 -0
- package/src/extensions/plugin.ts +91 -0
- package/src/extensions/text.ts +34 -0
- package/src/facets/base-extension.ts +54 -0
- package/src/facets/command.ts +21 -0
- package/src/facets/facet-extension.spec.ts +173 -0
- package/src/facets/facet-extension.ts +53 -0
- package/src/facets/facet-node.spec.ts +265 -0
- package/src/facets/facet-node.ts +185 -0
- package/src/facets/facet-types.ts +9 -0
- package/src/facets/facet.spec.ts +76 -0
- package/src/facets/facet.ts +84 -0
- package/src/facets/root.ts +44 -0
- package/src/facets/schema-spec.ts +30 -0
- package/src/facets/schema.ts +26 -0
- package/src/facets/state.ts +57 -0
- package/src/facets/union-extension.ts +41 -0
- package/src/index.ts +302 -0
- package/src/test/index.ts +4 -0
- package/src/test/test-builder.ts +68 -0
- package/src/test/test-editor.spec.ts +104 -0
- package/src/test/test-editor.ts +113 -0
- package/src/testing/index.ts +283 -0
- package/src/testing/keyboard.ts +5 -0
- package/src/types/any-function.ts +4 -0
- package/src/types/assert-type-equal.ts +8 -0
- package/src/types/attrs.ts +32 -0
- package/src/types/base-node-view-options.ts +33 -0
- package/src/types/dom-node.ts +1 -0
- package/src/types/extension-command.ts +52 -0
- package/src/types/extension-mark.ts +15 -0
- package/src/types/extension-node.ts +15 -0
- package/src/types/extension.spec.ts +56 -0
- package/src/types/extension.ts +168 -0
- package/src/types/model.ts +54 -0
- package/src/types/object-entries.ts +13 -0
- package/src/types/pick-string-literal.spec.ts +10 -0
- package/src/types/pick-string-literal.ts +6 -0
- package/src/types/pick-sub-type.spec.ts +20 -0
- package/src/types/pick-sub-type.ts +6 -0
- package/src/types/priority.ts +12 -0
- package/src/types/setter.ts +4 -0
- package/src/types/simplify-deeper.spec.ts +40 -0
- package/src/types/simplify-deeper.ts +6 -0
- package/src/types/simplify-union.spec.ts +21 -0
- package/src/types/simplify-union.ts +11 -0
- package/src/utils/array-grouping.spec.ts +29 -0
- package/src/utils/array-grouping.ts +25 -0
- package/src/utils/array.ts +21 -0
- package/src/utils/assert.ts +13 -0
- package/src/utils/attrs-match.ts +20 -0
- package/src/utils/can-use-regex-lookbehind.ts +12 -0
- package/src/utils/clsx.spec.ts +14 -0
- package/src/utils/clsx.ts +12 -0
- package/src/utils/collect-children.ts +21 -0
- package/src/utils/collect-nodes.ts +37 -0
- package/src/utils/combine-event-handlers.spec.ts +27 -0
- package/src/utils/combine-event-handlers.ts +27 -0
- package/src/utils/contains-inline-node.ts +17 -0
- package/src/utils/deep-equals.spec.ts +26 -0
- package/src/utils/deep-equals.ts +29 -0
- package/src/utils/default-block-at.ts +15 -0
- package/src/utils/editor-content.spec.ts +47 -0
- package/src/utils/editor-content.ts +77 -0
- package/src/utils/env.ts +6 -0
- package/src/utils/find-parent-node-of-type.ts +29 -0
- package/src/utils/find-parent-node.spec.ts +68 -0
- package/src/utils/find-parent-node.ts +55 -0
- package/src/utils/get-custom-selection.ts +19 -0
- package/src/utils/get-dom-api.ts +56 -0
- package/src/utils/get-id.spec.ts +14 -0
- package/src/utils/get-id.ts +13 -0
- package/src/utils/get-mark-type.ts +20 -0
- package/src/utils/get-node-type.ts +20 -0
- package/src/utils/get-node-types.ts +19 -0
- package/src/utils/includes-mark.ts +18 -0
- package/src/utils/is-at-block-start.ts +26 -0
- package/src/utils/is-in-code-block.ts +18 -0
- package/src/utils/is-mark-absent.spec.ts +53 -0
- package/src/utils/is-mark-absent.ts +42 -0
- package/src/utils/is-mark-active.ts +27 -0
- package/src/utils/is-node-active.ts +25 -0
- package/src/utils/is-subset.spec.ts +12 -0
- package/src/utils/is-subset.ts +11 -0
- package/src/utils/maybe-run.spec.ts +39 -0
- package/src/utils/maybe-run.ts +11 -0
- package/src/utils/merge-objects.spec.ts +30 -0
- package/src/utils/merge-objects.ts +11 -0
- package/src/utils/merge-specs.ts +35 -0
- package/src/utils/object-equal.spec.ts +26 -0
- package/src/utils/object-equal.ts +28 -0
- package/src/utils/output-spec.test.ts +95 -0
- package/src/utils/output-spec.ts +130 -0
- package/src/utils/parse.spec.ts +46 -0
- package/src/utils/parse.ts +321 -0
- package/src/utils/remove-undefined-values.spec.ts +15 -0
- package/src/utils/remove-undefined-values.ts +9 -0
- package/src/utils/set-selection-around.ts +11 -0
- package/src/utils/type-assertion.ts +91 -0
- package/src/utils/unicode.spec.ts +10 -0
- package/src/utils/unicode.ts +4 -0
- package/src/utils/with-skip-code-block.ts +15 -0
- package/dist/editor-CjVyjJqw.d.ts +0 -739
package/dist/prosekit-core.d.ts
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
import { AnyAttrs, AttrSpec, CommandAction, CommandCreator, CommandTyping, DOMDocumentOptions, DOMParserOptions, DOMSerializerOptions, Editor, 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 } from "./editor-
|
|
1
|
+
import { AnyAttrs, AttrSpec, CommandAction, CommandCreator, CommandTyping, DOMDocumentOptions, DOMParserOptions, DOMSerializerOptions, Editor, EditorOptions, Extension, ExtensionTyping, ExtractCommandActions, ExtractCommandAppliers, ExtractCommandCreators, ExtractCommands, ExtractMarkActions, ExtractMarks, ExtractNodeActions, ExtractNodes, ExtractTyping, 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 } from "./editor-CfkZ4TNU.js";
|
|
2
2
|
import { AllSelection, Command, EditorState, EditorStateConfig, NodeSelection, Plugin, Selection, TextSelection, Transaction } from "@prosekit/pm/state";
|
|
3
3
|
import { Attrs as Attrs$1, ContentMatch, DOMSerializer, Fragment, Mark as Mark$1, MarkSpec, MarkType as MarkType$1, Node as Node$1, NodeSpec, NodeType as NodeType$1, ProseMirrorFragment, ProseMirrorNode, ResolvedPos, Schema, Slice } from "@prosekit/pm/model";
|
|
4
4
|
import { DOMEventMap, EditorView, MarkViewConstructor, NodeView, NodeViewConstructor } from "@prosekit/pm/view";
|
|
5
5
|
|
|
6
6
|
//#region src/commands/add-mark.d.ts
|
|
7
7
|
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
10
|
interface AddMarkOptions {
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* The type of the mark to add.
|
|
13
|
+
*/
|
|
14
14
|
type: string | MarkType$1;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* The attributes of the mark to add.
|
|
17
|
+
*/
|
|
18
18
|
attrs?: Attrs$1 | null;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
* The start position of the document. By default it will be the start position of current selection.
|
|
21
|
+
*/
|
|
22
22
|
from?: number;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* The end position of the document. By default it will be the end position of current selection.
|
|
25
|
+
*/
|
|
26
26
|
to?: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Returns a command that adds the given mark with the given attributes.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
29
|
+
* Returns a command that adds the given mark with the given attributes.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
33
|
declare function addMark(options: AddMarkOptions): Command;
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/commands/expand-mark.d.ts
|
|
36
36
|
/**
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
39
|
interface ExpandMarkOptions {
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* The type of the mark to expand.
|
|
42
|
+
*/
|
|
43
43
|
type: string | MarkType$1;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Expands the selection to include the entire mark at the current position.
|
|
47
|
-
*
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
46
|
+
* Expands the selection to include the entire mark at the current position.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
50
|
declare function expandMark(options: ExpandMarkOptions): Command;
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/commands/insert-default-block.d.ts
|
|
53
53
|
/**
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
56
|
interface InsertDefaultBlockOptions {
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* The position to insert the node at. By default it will insert after the
|
|
59
|
+
* current selection.
|
|
60
|
+
*/
|
|
61
61
|
pos?: number;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
* Returns a command that inserts a default block after current selection or at
|
|
65
|
-
* the given position.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
64
|
+
* Returns a command that inserts a default block after current selection or at
|
|
65
|
+
* the given position.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
69
|
declare function insertDefaultBlock(options?: InsertDefaultBlockOptions): Command;
|
|
70
70
|
//#endregion
|
|
71
71
|
//#region src/commands/insert-node.d.ts
|
|
72
72
|
/**
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
75
|
interface InsertNodeOptions {
|
|
76
76
|
/**
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
* The node to insert. Either this or `type` must be provided.
|
|
78
|
+
*/
|
|
79
79
|
node?: ProseMirrorNode;
|
|
80
80
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
* The type of the node to insert. Either this or `node` must be provided.
|
|
82
|
+
*/
|
|
83
83
|
type?: string | NodeType$1;
|
|
84
84
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
* When `type` is provided, the attributes of the node to insert.
|
|
86
|
+
*/
|
|
87
87
|
attrs?: Attrs$1;
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
* The position to insert the node at. By default it will be the anchor
|
|
90
|
+
* position of current selection.
|
|
91
|
+
*/
|
|
92
92
|
pos?: number;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Returns a command that inserts the given node at the current selection or at
|
|
96
|
-
* the given position.
|
|
97
|
-
*
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
95
|
+
* Returns a command that inserts the given node at the current selection or at
|
|
96
|
+
* the given position.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
100
|
declare function insertNode(options: InsertNodeOptions): Command;
|
|
101
101
|
//#endregion
|
|
102
102
|
//#region src/commands/remove-mark.d.ts
|
|
103
103
|
/**
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
106
|
interface RemoveMarkOptions {
|
|
107
107
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
* The type of the mark to remove.
|
|
109
|
+
*/
|
|
110
110
|
type: string | MarkType$1;
|
|
111
111
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
* If attrs is given, remove precisely the mark with the given attrs. Otherwise, remove all marks of the given type.
|
|
113
|
+
*/
|
|
114
114
|
attrs?: Attrs$1 | null;
|
|
115
115
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
* The start position of the document. By default it will be the start position of current selection.
|
|
117
|
+
*/
|
|
118
118
|
from?: number;
|
|
119
119
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
* The end position of the document. By default it will be the end position of current selection.
|
|
121
|
+
*/
|
|
122
122
|
to?: number;
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
|
-
* Returns a command that removes the given mark.
|
|
126
|
-
*
|
|
127
|
-
* @public
|
|
128
|
-
*/
|
|
125
|
+
* Returns a command that removes the given mark.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
129
|
declare function removeMark(options: RemoveMarkOptions): Command;
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/commands/remove-node.d.ts
|
|
132
132
|
/**
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
135
|
interface RemoveNodeOptions {
|
|
136
136
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
* The type of the node to remove.
|
|
138
|
+
*/
|
|
139
139
|
type: string | NodeType$1;
|
|
140
140
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
* The document position to start searching node. By default it will be the
|
|
142
|
+
* anchor position of current selection.
|
|
143
|
+
*/
|
|
144
144
|
pos?: number;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
|
-
* Returns a command to remove the nearest ancestor node of a specific type from the current position.
|
|
148
|
-
*
|
|
149
|
-
* @public
|
|
150
|
-
*/
|
|
147
|
+
* Returns a command to remove the nearest ancestor node of a specific type from the current position.
|
|
148
|
+
*
|
|
149
|
+
* @public
|
|
150
|
+
*/
|
|
151
151
|
declare function removeNode(options: RemoveNodeOptions): Command;
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/commands/set-block-type.d.ts
|
|
154
154
|
/**
|
|
155
|
-
* @public
|
|
156
|
-
*/
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
157
|
interface SetBlockTypeOptions {
|
|
158
158
|
type: NodeType$1 | string;
|
|
159
159
|
attrs?: Attrs$1 | null;
|
|
@@ -161,78 +161,78 @@ interface SetBlockTypeOptions {
|
|
|
161
161
|
to?: number;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
|
-
* Returns a command that tries to set the selected textblocks to the given node
|
|
165
|
-
* type with the given attributes.
|
|
166
|
-
*
|
|
167
|
-
* @public
|
|
168
|
-
*/
|
|
164
|
+
* Returns a command that tries to set the selected textblocks to the given node
|
|
165
|
+
* type with the given attributes.
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
169
|
declare function setBlockType(options: SetBlockTypeOptions): Command;
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region src/commands/set-node-attrs.d.ts
|
|
172
172
|
/**
|
|
173
|
-
* @public
|
|
174
|
-
*/
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
175
175
|
interface SetNodeAttrsOptions {
|
|
176
176
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
* The type of node to set the attributes of.
|
|
178
|
+
*
|
|
179
|
+
* If current node is not of this type, the command will do nothing.
|
|
180
|
+
*/
|
|
181
181
|
type: string | NodeType$1 | string[] | NodeType$1[];
|
|
182
182
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
* The attributes to set.
|
|
184
|
+
*/
|
|
185
185
|
attrs: Attrs$1;
|
|
186
186
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
* The position of the node. Defaults to the position of the wrapping node
|
|
188
|
+
* containing the current selection.
|
|
189
|
+
*/
|
|
190
190
|
pos?: number;
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
|
-
* Returns a command that set the attributes of the current node.
|
|
194
|
-
*
|
|
195
|
-
* @public
|
|
196
|
-
*/
|
|
193
|
+
* Returns a command that set the attributes of the current node.
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
197
|
declare function setNodeAttrs(options: SetNodeAttrsOptions): Command;
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/commands/toggle-mark.d.ts
|
|
200
200
|
/**
|
|
201
|
-
* @public
|
|
202
|
-
*/
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
203
|
interface ToggleMarkOptions {
|
|
204
204
|
/**
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
* The mark type to toggle.
|
|
206
|
+
*/
|
|
207
207
|
type: string | MarkType$1;
|
|
208
208
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
* The optional attributes to set on the mark.
|
|
210
|
+
*/
|
|
211
211
|
attrs?: Attrs$1 | null;
|
|
212
212
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
* Controls whether, when part of the selected range has the mark
|
|
214
|
+
* already and part doesn't, the mark is removed (`true`) or added
|
|
215
|
+
* (`false`).
|
|
216
|
+
*
|
|
217
|
+
* @default false
|
|
218
|
+
*/
|
|
219
219
|
removeWhenPresent?: boolean;
|
|
220
220
|
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
221
|
+
* Whether the command should act on the content of inline nodes marked as
|
|
222
|
+
* [atoms](https://prosemirror.net/docs/ref/#model.NodeSpec.atom) that are
|
|
223
|
+
* completely covered by a selection range.
|
|
224
|
+
*
|
|
225
|
+
* @default true
|
|
226
|
+
*/
|
|
227
227
|
enterInlineAtoms?: boolean;
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
|
-
* Returns a command that toggles the given mark with the given attributes.
|
|
231
|
-
*
|
|
232
|
-
* @param options
|
|
233
|
-
*
|
|
234
|
-
* @public
|
|
235
|
-
*/
|
|
230
|
+
* Returns a command that toggles the given mark with the given attributes.
|
|
231
|
+
*
|
|
232
|
+
* @param options
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
*/
|
|
236
236
|
declare function toggleMark({
|
|
237
237
|
type,
|
|
238
238
|
attrs,
|
|
@@ -242,26 +242,26 @@ declare function toggleMark({
|
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/commands/toggle-node.d.ts
|
|
244
244
|
/**
|
|
245
|
-
* @public
|
|
246
|
-
*/
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
247
|
interface ToggleNodeOptions {
|
|
248
248
|
/**
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
* The type of the node to toggle.
|
|
250
|
+
*/
|
|
251
251
|
type: string | NodeType$1;
|
|
252
252
|
/**
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
* The attributes of the node to toggle.
|
|
254
|
+
*/
|
|
255
255
|
attrs?: Attrs$1 | null;
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
|
-
* Returns a command that set the selected textblocks to the given node type
|
|
259
|
-
* with the given attributes.
|
|
260
|
-
*
|
|
261
|
-
* @param options
|
|
262
|
-
*
|
|
263
|
-
* @public
|
|
264
|
-
*/
|
|
258
|
+
* Returns a command that set the selected textblocks to the given node type
|
|
259
|
+
* with the given attributes.
|
|
260
|
+
*
|
|
261
|
+
* @param options
|
|
262
|
+
*
|
|
263
|
+
* @public
|
|
264
|
+
*/
|
|
265
265
|
declare function toggleNode({
|
|
266
266
|
type,
|
|
267
267
|
attrs
|
|
@@ -270,164 +270,166 @@ declare function toggleNode({
|
|
|
270
270
|
//#region src/commands/toggle-wrap.d.ts
|
|
271
271
|
interface ToggleWrapOptions {
|
|
272
272
|
/**
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
* The type of the node to toggle.
|
|
274
|
+
*/
|
|
275
275
|
type: string | NodeType$1;
|
|
276
276
|
/**
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
* The attributes of the node to toggle.
|
|
278
|
+
*/
|
|
279
279
|
attrs?: Attrs$1 | null;
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
|
-
* Toggle between wrapping an inactive node with the provided node type, and
|
|
283
|
-
* lifting it up into its parent.
|
|
284
|
-
*
|
|
285
|
-
* @param options
|
|
286
|
-
*
|
|
287
|
-
* @public
|
|
288
|
-
*/
|
|
282
|
+
* Toggle between wrapping an inactive node with the provided node type, and
|
|
283
|
+
* lifting it up into its parent.
|
|
284
|
+
*
|
|
285
|
+
* @param options
|
|
286
|
+
*
|
|
287
|
+
* @public
|
|
288
|
+
*/
|
|
289
289
|
declare function toggleWrap(options: ToggleWrapOptions): Command;
|
|
290
290
|
//#endregion
|
|
291
291
|
//#region src/commands/unset-block-type.d.ts
|
|
292
292
|
/**
|
|
293
|
-
* @public
|
|
294
|
-
*/
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
295
295
|
interface UnsetBlockTypeOptions {
|
|
296
296
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
* The start position of the document. By default it will be the start position of current selection.
|
|
298
|
+
*/
|
|
299
299
|
from?: number;
|
|
300
300
|
/**
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
* The end position of the document. By default it will be the end position of current selection.
|
|
302
|
+
*/
|
|
303
303
|
to?: number;
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
|
-
* Returns a command that set the type of all textblocks between the given range
|
|
307
|
-
* to the default type (usually `paragraph`).
|
|
308
|
-
*
|
|
309
|
-
* @public
|
|
310
|
-
*/
|
|
306
|
+
* Returns a command that set the type of all textblocks between the given range
|
|
307
|
+
* to the default type (usually `paragraph`).
|
|
308
|
+
*
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
311
|
declare function unsetBlockType(options?: UnsetBlockTypeOptions): Command;
|
|
312
312
|
//#endregion
|
|
313
313
|
//#region src/commands/unset-mark.d.ts
|
|
314
314
|
/**
|
|
315
|
-
* @public
|
|
316
|
-
|
|
315
|
+
* @public
|
|
316
|
+
*
|
|
317
|
+
* Options for {@link unsetMark}.
|
|
318
|
+
*/
|
|
317
319
|
interface UnsetMarkOptions {
|
|
318
320
|
/**
|
|
319
|
-
|
|
320
|
-
|
|
321
|
+
* The start position of the document. By default it will be the start position of current selection.
|
|
322
|
+
*/
|
|
321
323
|
from?: number;
|
|
322
324
|
/**
|
|
323
|
-
|
|
324
|
-
|
|
325
|
+
* The end position of the document. By default it will be the end position of current selection.
|
|
326
|
+
*/
|
|
325
327
|
to?: number;
|
|
326
328
|
}
|
|
327
329
|
/**
|
|
328
|
-
* Returns a command that removes all marks.
|
|
329
|
-
*
|
|
330
|
-
* @public
|
|
331
|
-
*/
|
|
330
|
+
* Returns a command that removes all marks.
|
|
331
|
+
*
|
|
332
|
+
* @public
|
|
333
|
+
*/
|
|
332
334
|
declare function unsetMark(options?: UnsetMarkOptions): Command;
|
|
333
335
|
//#endregion
|
|
334
336
|
//#region src/commands/wrap.d.ts
|
|
335
337
|
/**
|
|
336
|
-
* @public
|
|
337
|
-
*/
|
|
338
|
+
* @public
|
|
339
|
+
*/
|
|
338
340
|
interface WrapOptions {
|
|
339
341
|
/**
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
* The node type to wrap the selected textblock with.
|
|
343
|
+
*/
|
|
342
344
|
type: NodeType$1 | string;
|
|
343
345
|
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
+
* @deprecated Use `nodeSpec` instead.
|
|
347
|
+
*/
|
|
346
348
|
nodeType?: NodeType$1;
|
|
347
349
|
/**
|
|
348
|
-
|
|
349
|
-
|
|
350
|
+
* Optional attributes to apply to the node.
|
|
351
|
+
*/
|
|
350
352
|
attrs?: Attrs$1 | null;
|
|
351
353
|
}
|
|
352
354
|
/**
|
|
353
|
-
* Returns a command that wraps the selected textblock with the given node type.
|
|
354
|
-
*
|
|
355
|
-
* @param options
|
|
356
|
-
*
|
|
357
|
-
* @public
|
|
358
|
-
*/
|
|
355
|
+
* Returns a command that wraps the selected textblock with the given node type.
|
|
356
|
+
*
|
|
357
|
+
* @param options
|
|
358
|
+
*
|
|
359
|
+
* @public
|
|
360
|
+
*/
|
|
359
361
|
declare function wrap(options: WrapOptions): Command;
|
|
360
362
|
//#endregion
|
|
361
363
|
//#region src/editor/union.d.ts
|
|
362
364
|
/**
|
|
363
|
-
* Merges multiple extensions into one. You can pass multiple extensions as
|
|
364
|
-
* arguments or a single array containing multiple extensions.
|
|
365
|
-
*
|
|
366
|
-
* @throws If no extensions are provided.
|
|
367
|
-
*
|
|
368
|
-
* @example
|
|
369
|
-
*
|
|
370
|
-
* ```ts
|
|
371
|
-
* function defineFancyNodes() {
|
|
372
|
-
* return union(
|
|
373
|
-
* defineFancyParagraph(),
|
|
374
|
-
* defineFancyHeading(),
|
|
375
|
-
* )
|
|
376
|
-
* }
|
|
377
|
-
* ```
|
|
378
|
-
*
|
|
379
|
-
* @example
|
|
380
|
-
*
|
|
381
|
-
* ```ts
|
|
382
|
-
* function defineFancyNodes() {
|
|
383
|
-
* return union([
|
|
384
|
-
* defineFancyParagraph(),
|
|
385
|
-
* defineFancyHeading(),
|
|
386
|
-
* ])
|
|
387
|
-
* }
|
|
388
|
-
* ```
|
|
389
|
-
*
|
|
390
|
-
* @public
|
|
391
|
-
*/
|
|
365
|
+
* Merges multiple extensions into one. You can pass multiple extensions as
|
|
366
|
+
* arguments or a single array containing multiple extensions.
|
|
367
|
+
*
|
|
368
|
+
* @throws If no extensions are provided.
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
*
|
|
372
|
+
* ```ts
|
|
373
|
+
* function defineFancyNodes() {
|
|
374
|
+
* return union(
|
|
375
|
+
* defineFancyParagraph(),
|
|
376
|
+
* defineFancyHeading(),
|
|
377
|
+
* )
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
*
|
|
383
|
+
* ```ts
|
|
384
|
+
* function defineFancyNodes() {
|
|
385
|
+
* return union([
|
|
386
|
+
* defineFancyParagraph(),
|
|
387
|
+
* defineFancyHeading(),
|
|
388
|
+
* ])
|
|
389
|
+
* }
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @public
|
|
393
|
+
*/
|
|
392
394
|
declare function union<const E extends readonly Extension[]>(...exts: E): Union<E>;
|
|
393
395
|
declare function union<const E extends readonly Extension[]>(exts: E): Union<E>;
|
|
394
396
|
//#endregion
|
|
395
397
|
//#region src/editor/with-priority.d.ts
|
|
396
398
|
/**
|
|
397
|
-
* Return an new extension with the given priority.
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
* ```ts
|
|
401
|
-
* import { Priority, withPriority } from 'prosekit/core'
|
|
402
|
-
*
|
|
403
|
-
* const extension = withPriority(defineMyExtension(), Priority.high)
|
|
404
|
-
* ```
|
|
405
|
-
*
|
|
406
|
-
* @public
|
|
407
|
-
*/
|
|
399
|
+
* Return an new extension with the given priority.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```ts
|
|
403
|
+
* import { Priority, withPriority } from 'prosekit/core'
|
|
404
|
+
*
|
|
405
|
+
* const extension = withPriority(defineMyExtension(), Priority.high)
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* @public
|
|
409
|
+
*/
|
|
408
410
|
declare function withPriority<T extends Extension>(extension: T, priority: Priority): T;
|
|
409
411
|
//#endregion
|
|
410
412
|
//#region src/error.d.ts
|
|
411
413
|
/**
|
|
412
|
-
* Base class for all ProseKit errors.
|
|
413
|
-
*
|
|
414
|
-
* @internal
|
|
415
|
-
*/
|
|
414
|
+
* Base class for all ProseKit errors.
|
|
415
|
+
*
|
|
416
|
+
* @internal
|
|
417
|
+
*/
|
|
416
418
|
declare class ProseKitError extends Error {}
|
|
417
419
|
/**
|
|
418
|
-
* @internal
|
|
419
|
-
*/
|
|
420
|
+
* @internal
|
|
421
|
+
*/
|
|
420
422
|
declare class EditorNotFoundError extends ProseKitError {
|
|
421
423
|
constructor();
|
|
422
424
|
}
|
|
423
425
|
/**
|
|
424
|
-
* @internal
|
|
425
|
-
*/
|
|
426
|
+
* @internal
|
|
427
|
+
*/
|
|
426
428
|
//#endregion
|
|
427
429
|
//#region src/types/any-function.d.ts
|
|
428
430
|
/**
|
|
429
|
-
* @internal
|
|
430
|
-
*/
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
431
433
|
type AnyFunction = (...args: any[]) => any;
|
|
432
434
|
//#endregion
|
|
433
435
|
//#region src/extensions/clipboard-serializer.d.ts
|
|
@@ -437,8 +439,8 @@ type NodesFromSchemaFunction = typeof DOMSerializer.nodesFromSchema;
|
|
|
437
439
|
type MarksFromSchemaFunction = typeof DOMSerializer.marksFromSchema;
|
|
438
440
|
type FunctionWrapper<T extends AnyFunction> = (fn: T) => T;
|
|
439
441
|
/**
|
|
440
|
-
* @internal
|
|
441
|
-
*/
|
|
442
|
+
* @internal
|
|
443
|
+
*/
|
|
442
444
|
interface ClipboardSerializerOptions {
|
|
443
445
|
serializeFragmentWrapper?: FunctionWrapper<SerializeFragmentFunction>;
|
|
444
446
|
serializeNodeWrapper?: FunctionWrapper<SerializeNodeFunction>;
|
|
@@ -446,32 +448,32 @@ interface ClipboardSerializerOptions {
|
|
|
446
448
|
marksFromSchemaWrapper?: FunctionWrapper<MarksFromSchemaFunction>;
|
|
447
449
|
}
|
|
448
450
|
/**
|
|
449
|
-
* @internal
|
|
450
|
-
*/
|
|
451
|
+
* @internal
|
|
452
|
+
*/
|
|
451
453
|
declare function defineClipboardSerializer(options: ClipboardSerializerOptions): PlainExtension;
|
|
452
454
|
//#endregion
|
|
453
455
|
//#region src/commands/insert-text.d.ts
|
|
454
456
|
/**
|
|
455
|
-
* @public
|
|
456
|
-
*/
|
|
457
|
+
* @public
|
|
458
|
+
*/
|
|
457
459
|
type InsertTextOptions = {
|
|
458
460
|
text: string;
|
|
459
461
|
from?: number;
|
|
460
462
|
to?: number;
|
|
461
463
|
};
|
|
462
464
|
/**
|
|
463
|
-
* Returns a command that inserts the given text.
|
|
464
|
-
*
|
|
465
|
-
* @public
|
|
466
|
-
*/
|
|
465
|
+
* Returns a command that inserts the given text.
|
|
466
|
+
*
|
|
467
|
+
* @public
|
|
468
|
+
*/
|
|
467
469
|
//#endregion
|
|
468
470
|
//#region src/extensions/command.d.ts
|
|
469
471
|
declare function defineCommands<T extends Record<string, CommandCreator> = Record<string, CommandCreator>>(commands: T): Extension<{
|
|
470
472
|
Commands: { [K in keyof T]: Parameters<T[K]> };
|
|
471
473
|
}>;
|
|
472
474
|
/**
|
|
473
|
-
* @internal
|
|
474
|
-
*/
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
475
477
|
type BaseCommandsExtension = Extension<{
|
|
476
478
|
Commands: {
|
|
477
479
|
insertText: [options: InsertTextOptions];
|
|
@@ -490,49 +492,49 @@ type BaseCommandsExtension = Extension<{
|
|
|
490
492
|
};
|
|
491
493
|
}>;
|
|
492
494
|
/**
|
|
493
|
-
* Add some base commands
|
|
494
|
-
*
|
|
495
|
-
* @public
|
|
496
|
-
*/
|
|
495
|
+
* Add some base commands
|
|
496
|
+
*
|
|
497
|
+
* @public
|
|
498
|
+
*/
|
|
497
499
|
declare function defineBaseCommands(): BaseCommandsExtension;
|
|
498
500
|
//#endregion
|
|
499
501
|
//#region src/extensions/default-state.d.ts
|
|
500
502
|
/**
|
|
501
|
-
* @public
|
|
502
|
-
*/
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
503
505
|
interface DefaultStateOptions {
|
|
504
506
|
/**
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
* The starting document to use when creating the editor. It can be a
|
|
508
|
+
* ProseMirror node JSON object, a HTML string, or a HTML element instance.
|
|
509
|
+
*/
|
|
508
510
|
defaultContent?: NodeJSON | string | HTMLElement;
|
|
509
511
|
/**
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
512
|
+
* A JSON object representing the starting document to use when creating the
|
|
513
|
+
* editor.
|
|
514
|
+
*
|
|
515
|
+
* @deprecated Use `defaultContent` instead.
|
|
516
|
+
*/
|
|
515
517
|
defaultDoc?: NodeJSON;
|
|
516
518
|
/**
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
519
|
+
* A HTML element or a HTML string representing the starting document to use
|
|
520
|
+
* when creating the editor.
|
|
521
|
+
*
|
|
522
|
+
* @deprecated Use `defaultContent` instead.
|
|
523
|
+
*/
|
|
522
524
|
defaultHTML?: string | HTMLElement;
|
|
523
525
|
/**
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
526
|
+
* A JSON object representing the starting selection to use when creating the
|
|
527
|
+
* editor. It's only used when `defaultContent` is also provided.
|
|
528
|
+
*/
|
|
527
529
|
defaultSelection?: SelectionJSON;
|
|
528
530
|
}
|
|
529
531
|
/**
|
|
530
|
-
* Define a default state for the editor.
|
|
531
|
-
*
|
|
532
|
-
* @param options
|
|
533
|
-
*
|
|
534
|
-
* @public
|
|
535
|
-
*/
|
|
532
|
+
* Define a default state for the editor.
|
|
533
|
+
*
|
|
534
|
+
* @param options
|
|
535
|
+
*
|
|
536
|
+
* @public
|
|
537
|
+
*/
|
|
536
538
|
declare function defineDefaultState({
|
|
537
539
|
defaultSelection,
|
|
538
540
|
defaultContent,
|
|
@@ -542,103 +544,140 @@ declare function defineDefaultState({
|
|
|
542
544
|
//#endregion
|
|
543
545
|
//#region src/extensions/doc.d.ts
|
|
544
546
|
/**
|
|
545
|
-
* @internal
|
|
546
|
-
*/
|
|
547
|
+
* @internal
|
|
548
|
+
*/
|
|
547
549
|
type DocExtension = Extension<{
|
|
548
550
|
Nodes: {
|
|
549
551
|
doc: Attrs$1;
|
|
550
552
|
};
|
|
551
553
|
}>;
|
|
552
554
|
/**
|
|
553
|
-
* @public
|
|
554
|
-
*
|
|
555
|
-
* @deprecated Use the following import instead:
|
|
556
|
-
*
|
|
557
|
-
* ```ts
|
|
558
|
-
* import { defineDoc } from 'prosekit/extensions/doc'
|
|
559
|
-
* ```
|
|
560
|
-
*/
|
|
555
|
+
* @public
|
|
556
|
+
*
|
|
557
|
+
* @deprecated Use the following import instead:
|
|
558
|
+
*
|
|
559
|
+
* ```ts
|
|
560
|
+
* import { defineDoc } from 'prosekit/extensions/doc'
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
561
563
|
declare function defineDoc(): DocExtension;
|
|
562
564
|
//#endregion
|
|
563
565
|
//#region src/extensions/events/doc-change.d.ts
|
|
564
566
|
/**
|
|
565
|
-
* A function that is called when the editor document is changed.
|
|
566
|
-
*
|
|
567
|
-
* @param view - The editor view.
|
|
568
|
-
* @param prevState - The previous editor state.
|
|
569
|
-
*
|
|
570
|
-
* @public
|
|
571
|
-
*/
|
|
567
|
+
* A function that is called when the editor document is changed.
|
|
568
|
+
*
|
|
569
|
+
* @param view - The editor view.
|
|
570
|
+
* @param prevState - The previous editor state.
|
|
571
|
+
*
|
|
572
|
+
* @public
|
|
573
|
+
*/
|
|
572
574
|
type DocChangeHandler = (view: EditorView, prevState: EditorState) => void;
|
|
573
575
|
/**
|
|
574
|
-
* Registers a event handler that is called when the editor document is changed.
|
|
575
|
-
*
|
|
576
|
-
* @public
|
|
577
|
-
*/
|
|
576
|
+
* Registers a event handler that is called when the editor document is changed.
|
|
577
|
+
*
|
|
578
|
+
* @public
|
|
579
|
+
*/
|
|
578
580
|
declare function defineDocChangeHandler(handler: DocChangeHandler): PlainExtension;
|
|
579
581
|
//#endregion
|
|
582
|
+
//#region src/extensions/events/dom-event.d.ts
|
|
583
|
+
/**
|
|
584
|
+
* A function to handle the events fired on the editable DOM element. Returns
|
|
585
|
+
* `true` to indicate that it handled the given event. When returning `true`,
|
|
586
|
+
* you are responsible for calling `event.preventDefault()` yourself (or not, if
|
|
587
|
+
* you want to allow the default behavior).
|
|
588
|
+
*
|
|
589
|
+
* @public
|
|
590
|
+
*/
|
|
591
|
+
type DOMEventHandler<Event extends keyof DOMEventMap = string> = (view: EditorView, event: DOMEventMap[Event]) => boolean | void;
|
|
592
|
+
/**
|
|
593
|
+
* @internal
|
|
594
|
+
*/
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Register a new event handler for the given event type.
|
|
598
|
+
*
|
|
599
|
+
* @public
|
|
600
|
+
*/
|
|
601
|
+
declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): PlainExtension;
|
|
602
|
+
/**
|
|
603
|
+
* @internal
|
|
604
|
+
*/
|
|
605
|
+
//#endregion
|
|
580
606
|
//#region src/facets/facet-types.d.ts
|
|
581
607
|
/**
|
|
582
|
-
* @internal
|
|
583
|
-
*/
|
|
608
|
+
* @internal
|
|
609
|
+
*/
|
|
584
610
|
type FacetReducer<Input, Output> = (input: Input[]) => Output;
|
|
585
611
|
//#endregion
|
|
586
612
|
//#region src/facets/facet.d.ts
|
|
587
613
|
/**
|
|
588
|
-
* @internal
|
|
589
|
-
*/
|
|
614
|
+
* @internal
|
|
615
|
+
*/
|
|
590
616
|
declare class Facet<Input, Output> {
|
|
591
617
|
private _reducer?;
|
|
592
618
|
private _reduce?;
|
|
593
619
|
/**
|
|
594
|
-
|
|
595
|
-
|
|
620
|
+
* @internal
|
|
621
|
+
*/
|
|
596
622
|
readonly index: number;
|
|
597
623
|
/**
|
|
598
|
-
|
|
599
|
-
|
|
624
|
+
* @internal
|
|
625
|
+
*/
|
|
600
626
|
readonly parent: Facet<Output, any> | null;
|
|
601
627
|
/**
|
|
602
|
-
|
|
603
|
-
|
|
628
|
+
* @internal
|
|
629
|
+
*/
|
|
604
630
|
readonly singleton: boolean;
|
|
605
631
|
/**
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
632
|
+
* A index path to retrieve the current facet in a tree from the root.
|
|
633
|
+
*
|
|
634
|
+
* @internal
|
|
635
|
+
*/
|
|
610
636
|
readonly path: number[];
|
|
611
637
|
/**
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
constructor(parent: Facet<Output, any> | null, singleton: boolean, _reducer?: FacetReducer<Input, Output> | undefined, _reduce?: () => FacetReducer<Input, Output>);
|
|
638
|
+
* @internal
|
|
639
|
+
*/
|
|
640
|
+
constructor(parent: Facet<Output, any> | null, singleton: boolean, _reducer?: FacetReducer<Input, Output> | undefined, _reduce?: (() => FacetReducer<Input, Output>) | undefined);
|
|
615
641
|
get reducer(): FacetReducer<Input, Output>;
|
|
616
642
|
}
|
|
617
643
|
/**
|
|
618
|
-
* @internal
|
|
619
|
-
*/
|
|
644
|
+
* @internal
|
|
645
|
+
*/
|
|
620
646
|
declare function defineFacet<Input, Output>(options: {
|
|
621
647
|
/**
|
|
622
|
-
|
|
623
|
-
|
|
648
|
+
* The parent facet in the tree.
|
|
649
|
+
*/
|
|
624
650
|
parent: Facet<Output, any>;
|
|
625
651
|
/**
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
652
|
+
* Set this to true if you only want to keep one facet payload. For example,
|
|
653
|
+
* this facet corresponds to a ProseMirror plugin with a key.
|
|
654
|
+
*/
|
|
629
655
|
singleton?: boolean;
|
|
630
656
|
/**
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
657
|
+
* A reducer is a function that accepts an array of input and produce a single
|
|
658
|
+
* output.
|
|
659
|
+
*/
|
|
634
660
|
reducer?: FacetReducer<Input, Output>;
|
|
635
661
|
/**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
662
|
+
* A callback function that returns a reducer. This is useful if you want to
|
|
663
|
+
* store something in the closure.
|
|
664
|
+
*/
|
|
639
665
|
reduce?: () => FacetReducer<Input, Output>;
|
|
640
666
|
}): Facet<Input, Output>;
|
|
641
667
|
//#endregion
|
|
668
|
+
//#region src/types/object-entries.d.ts
|
|
669
|
+
/**
|
|
670
|
+
* @internal
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
*
|
|
674
|
+
* ```
|
|
675
|
+
* type MyObject = { a: 1; b: 'B' }
|
|
676
|
+
* type MyEntries = ObjectEntries<MyObject>
|
|
677
|
+
* // ^ ["a", 1] | ["b", "B"]
|
|
678
|
+
*/
|
|
679
|
+
type ObjectEntries<T extends Record<string, any>> = { [K in keyof T]: [K, T[K]] }[keyof T];
|
|
680
|
+
//#endregion
|
|
642
681
|
//#region src/facets/state.d.ts
|
|
643
682
|
type StatePayload = (ctx: {
|
|
644
683
|
schema: Schema;
|
|
@@ -646,64 +685,27 @@ type StatePayload = (ctx: {
|
|
|
646
685
|
//#endregion
|
|
647
686
|
//#region src/extensions/plugin.d.ts
|
|
648
687
|
/**
|
|
649
|
-
* Adds a ProseMirror plugin to the editor.
|
|
650
|
-
*
|
|
651
|
-
* @param plugin - The ProseMirror plugin to add, or an array of plugins, or a
|
|
652
|
-
* function that returns one or multiple plugins.
|
|
653
|
-
*
|
|
654
|
-
* @public
|
|
655
|
-
*/
|
|
688
|
+
* Adds a ProseMirror plugin to the editor.
|
|
689
|
+
*
|
|
690
|
+
* @param plugin - The ProseMirror plugin to add, or an array of plugins, or a
|
|
691
|
+
* function that returns one or multiple plugins.
|
|
692
|
+
*
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
656
695
|
declare function definePlugin(plugin: Plugin | Plugin[] | ((context: {
|
|
657
696
|
schema: Schema;
|
|
658
697
|
}) => Plugin | Plugin[])): PlainExtension;
|
|
659
698
|
/**
|
|
660
|
-
* @internal
|
|
661
|
-
*/
|
|
699
|
+
* @internal
|
|
700
|
+
*/
|
|
662
701
|
type PluginPayload = Plugin | Plugin[] | ((context: {
|
|
663
702
|
schema: Schema;
|
|
664
703
|
}) => Plugin | Plugin[]);
|
|
665
704
|
/**
|
|
666
|
-
* @internal
|
|
667
|
-
*/
|
|
705
|
+
* @internal
|
|
706
|
+
*/
|
|
668
707
|
declare const pluginFacet: Facet<PluginPayload, StatePayload>;
|
|
669
708
|
//#endregion
|
|
670
|
-
//#region src/extensions/events/dom-event.d.ts
|
|
671
|
-
/**
|
|
672
|
-
* A function to handle the events fired on the editable DOM element. Returns
|
|
673
|
-
* `true` to indicate that it handled the given event. you are responsible for
|
|
674
|
-
* calling `preventDefault` yourself (or not, if you want to allow the default
|
|
675
|
-
* behavior).
|
|
676
|
-
*
|
|
677
|
-
* @public
|
|
678
|
-
*/
|
|
679
|
-
type DOMEventHandler<Event extends keyof DOMEventMap = string> = (view: EditorView, event: DOMEventMap[Event]) => boolean | void;
|
|
680
|
-
/**
|
|
681
|
-
* @internal
|
|
682
|
-
*/
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* Register a new event handler for the given event type.
|
|
686
|
-
*
|
|
687
|
-
* @public
|
|
688
|
-
*/
|
|
689
|
-
declare function defineDOMEventHandler<Event extends keyof DOMEventMap = string>(event: Event, handler: DOMEventHandler<Event>): PlainExtension;
|
|
690
|
-
/**
|
|
691
|
-
* @internal
|
|
692
|
-
*/
|
|
693
|
-
//#endregion
|
|
694
|
-
//#region src/types/object-entries.d.ts
|
|
695
|
-
/**
|
|
696
|
-
* @internal
|
|
697
|
-
*
|
|
698
|
-
* @example
|
|
699
|
-
*
|
|
700
|
-
* ```
|
|
701
|
-
* type MyObject = { a: 1; b: 'B' }
|
|
702
|
-
* type MyEntries = ObjectEntries<MyObject>
|
|
703
|
-
* // ^ ["a", 1] | ["b", "B"]
|
|
704
|
-
*/
|
|
705
|
-
type ObjectEntries<T extends Record<string, any>> = { [K in keyof T]: [K, T[K]] }[keyof T];
|
|
706
|
-
//#endregion
|
|
707
709
|
//#region src/extensions/events/editor-event.d.ts
|
|
708
710
|
type KeyDownHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
|
|
709
711
|
type KeyPressHandler = (view: EditorView, event: KeyboardEvent) => boolean | void;
|
|
@@ -718,76 +720,76 @@ type PasteHandler = (view: EditorView, event: ClipboardEvent, slice: Slice) => b
|
|
|
718
720
|
type DropHandler = (view: EditorView, event: DragEvent, slice: Slice, moved: boolean) => boolean | void;
|
|
719
721
|
type ScrollToSelectionHandler = (view: EditorView) => boolean;
|
|
720
722
|
/**
|
|
721
|
-
* @public
|
|
722
|
-
*
|
|
723
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
|
|
724
|
-
*/
|
|
723
|
+
* @public
|
|
724
|
+
*
|
|
725
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown}
|
|
726
|
+
*/
|
|
725
727
|
declare function defineKeyDownHandler(handler: KeyDownHandler): PlainExtension;
|
|
726
728
|
/**
|
|
727
|
-
* @public
|
|
728
|
-
*
|
|
729
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
|
|
730
|
-
*/
|
|
729
|
+
* @public
|
|
730
|
+
*
|
|
731
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyPress}
|
|
732
|
+
*/
|
|
731
733
|
declare function defineKeyPressHandler(handler: KeyPressHandler): PlainExtension;
|
|
732
734
|
/**
|
|
733
|
-
* @public
|
|
734
|
-
*
|
|
735
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
|
|
736
|
-
*/
|
|
735
|
+
* @public
|
|
736
|
+
*
|
|
737
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTextInput}
|
|
738
|
+
*/
|
|
737
739
|
declare function defineTextInputHandler(handler: TextInputHandler): PlainExtension;
|
|
738
740
|
/**
|
|
739
|
-
* @public
|
|
740
|
-
*
|
|
741
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
|
|
742
|
-
*/
|
|
741
|
+
* @public
|
|
742
|
+
*
|
|
743
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClickOn}
|
|
744
|
+
*/
|
|
743
745
|
declare function defineClickOnHandler(handler: ClickOnHandler): PlainExtension;
|
|
744
746
|
/**
|
|
745
|
-
* @public
|
|
746
|
-
*
|
|
747
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
|
|
748
|
-
*/
|
|
747
|
+
* @public
|
|
748
|
+
*
|
|
749
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleClick}
|
|
750
|
+
*/
|
|
749
751
|
declare function defineClickHandler(handler: ClickHandler): PlainExtension;
|
|
750
752
|
/**
|
|
751
|
-
* @public
|
|
752
|
-
*
|
|
753
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
|
|
754
|
-
*/
|
|
753
|
+
* @public
|
|
754
|
+
*
|
|
755
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClickOn}
|
|
756
|
+
*/
|
|
755
757
|
declare function defineDoubleClickOnHandler(handler: DoubleClickOnHandler): PlainExtension;
|
|
756
758
|
/**
|
|
757
|
-
* @public
|
|
758
|
-
*
|
|
759
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
|
|
760
|
-
*/
|
|
759
|
+
* @public
|
|
760
|
+
*
|
|
761
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDoubleClick}
|
|
762
|
+
*/
|
|
761
763
|
declare function defineDoubleClickHandler(handler: DoubleClickHandler): PlainExtension;
|
|
762
764
|
/**
|
|
763
|
-
* @public
|
|
764
|
-
*
|
|
765
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
|
|
766
|
-
*/
|
|
765
|
+
* @public
|
|
766
|
+
*
|
|
767
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClickOn}
|
|
768
|
+
*/
|
|
767
769
|
declare function defineTripleClickOnHandler(handler: TripleClickOnHandler): PlainExtension;
|
|
768
770
|
/**
|
|
769
|
-
* @public
|
|
770
|
-
*
|
|
771
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
|
|
772
|
-
*/
|
|
771
|
+
* @public
|
|
772
|
+
*
|
|
773
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleTripleClick}
|
|
774
|
+
*/
|
|
773
775
|
declare function defineTripleClickHandler(handler: TripleClickHandler): PlainExtension;
|
|
774
776
|
/**
|
|
775
|
-
* @public
|
|
776
|
-
*
|
|
777
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
|
|
778
|
-
*/
|
|
777
|
+
* @public
|
|
778
|
+
*
|
|
779
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste}
|
|
780
|
+
*/
|
|
779
781
|
declare function definePasteHandler(handler: PasteHandler): PlainExtension;
|
|
780
782
|
/**
|
|
781
|
-
* @public
|
|
782
|
-
*
|
|
783
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
|
|
784
|
-
*/
|
|
783
|
+
* @public
|
|
784
|
+
*
|
|
785
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleDrop}
|
|
786
|
+
*/
|
|
785
787
|
declare function defineDropHandler(handler: DropHandler): PlainExtension;
|
|
786
788
|
/**
|
|
787
|
-
* @public
|
|
788
|
-
*
|
|
789
|
-
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
|
|
790
|
-
*/
|
|
789
|
+
* @public
|
|
790
|
+
*
|
|
791
|
+
* See {@link https://prosemirror.net/docs/ref/#view.EditorProps.handleScrollToSelection}
|
|
792
|
+
*/
|
|
791
793
|
declare function defineScrollToSelectionHandler(handler: ScrollToSelectionHandler): PlainExtension;
|
|
792
794
|
interface EditorEventMap {
|
|
793
795
|
keyDown: KeyDownHandler;
|
|
@@ -804,98 +806,98 @@ interface EditorEventMap {
|
|
|
804
806
|
scrollToSelection: ScrollToSelectionHandler;
|
|
805
807
|
}
|
|
806
808
|
/**
|
|
807
|
-
* @internal
|
|
808
|
-
*/
|
|
809
|
+
* @internal
|
|
810
|
+
*/
|
|
809
811
|
type EditorEventPayload = ObjectEntries<EditorEventMap>;
|
|
810
812
|
/**
|
|
811
|
-
* @internal
|
|
812
|
-
*/
|
|
813
|
+
* @internal
|
|
814
|
+
*/
|
|
813
815
|
declare const editorEventFacet: Facet<EditorEventPayload, PluginPayload>;
|
|
814
816
|
//#endregion
|
|
815
817
|
//#region src/extensions/events/focus.d.ts
|
|
816
818
|
/**
|
|
817
|
-
* A function that is called when the editor gains or loses focus.
|
|
818
|
-
*
|
|
819
|
-
* @param hasFocus - Whether the editor has focus.
|
|
820
|
-
*
|
|
821
|
-
* @public
|
|
822
|
-
*/
|
|
819
|
+
* A function that is called when the editor gains or loses focus.
|
|
820
|
+
*
|
|
821
|
+
* @param hasFocus - Whether the editor has focus.
|
|
822
|
+
*
|
|
823
|
+
* @public
|
|
824
|
+
*/
|
|
823
825
|
type FocusChangeHandler = (hasFocus: boolean) => void;
|
|
824
826
|
/**
|
|
825
|
-
* Registers a event handler that is called when the editor gains or loses focus.
|
|
826
|
-
*
|
|
827
|
-
* @public
|
|
828
|
-
*/
|
|
827
|
+
* Registers a event handler that is called when the editor gains or loses focus.
|
|
828
|
+
*
|
|
829
|
+
* @public
|
|
830
|
+
*/
|
|
829
831
|
declare function defineFocusChangeHandler(handler: FocusChangeHandler): PlainExtension;
|
|
830
832
|
//#endregion
|
|
831
833
|
//#region src/extensions/events/plugin-view.d.ts
|
|
832
834
|
/**
|
|
833
|
-
* A function that is called when the editor view is mounted.
|
|
834
|
-
*
|
|
835
|
-
* @param view - The editor view.
|
|
836
|
-
*
|
|
837
|
-
* @public
|
|
838
|
-
*/
|
|
835
|
+
* A function that is called when the editor view is mounted.
|
|
836
|
+
*
|
|
837
|
+
* @param view - The editor view.
|
|
838
|
+
*
|
|
839
|
+
* @public
|
|
840
|
+
*/
|
|
839
841
|
type MountHandler = (view: EditorView) => void;
|
|
840
842
|
/**
|
|
841
|
-
* A function that is called when the editor state is updated.
|
|
842
|
-
*
|
|
843
|
-
* @param view - The editor view.
|
|
844
|
-
* @param prevState - The previous editor state.
|
|
845
|
-
*
|
|
846
|
-
* @public
|
|
847
|
-
*/
|
|
843
|
+
* A function that is called when the editor state is updated.
|
|
844
|
+
*
|
|
845
|
+
* @param view - The editor view.
|
|
846
|
+
* @param prevState - The previous editor state.
|
|
847
|
+
*
|
|
848
|
+
* @public
|
|
849
|
+
*/
|
|
848
850
|
type UpdateHandler = (view: EditorView, prevState: EditorState) => void;
|
|
849
851
|
/**
|
|
850
|
-
* A function that is called when the editor view is unmounted.
|
|
851
|
-
*
|
|
852
|
-
* @public
|
|
853
|
-
*/
|
|
852
|
+
* A function that is called when the editor view is unmounted.
|
|
853
|
+
*
|
|
854
|
+
* @public
|
|
855
|
+
*/
|
|
854
856
|
type UnmountHandler = () => void;
|
|
855
857
|
/**
|
|
856
|
-
* Registers a event handler that is called when the editor view is mounted.
|
|
857
|
-
*
|
|
858
|
-
* @public
|
|
859
|
-
*/
|
|
858
|
+
* Registers a event handler that is called when the editor view is mounted.
|
|
859
|
+
*
|
|
860
|
+
* @public
|
|
861
|
+
*/
|
|
860
862
|
declare function defineMountHandler(handler: MountHandler): PlainExtension;
|
|
861
863
|
/**
|
|
862
|
-
* Registers a event handler that is called when the editor state is updated.
|
|
863
|
-
*
|
|
864
|
-
* @public
|
|
865
|
-
*/
|
|
864
|
+
* Registers a event handler that is called when the editor state is updated.
|
|
865
|
+
*
|
|
866
|
+
* @public
|
|
867
|
+
*/
|
|
866
868
|
declare function defineUpdateHandler(handler: UpdateHandler): PlainExtension;
|
|
867
869
|
/**
|
|
868
|
-
* Registers a event handler that is called when the editor view is unmounted.
|
|
869
|
-
*
|
|
870
|
-
* @public
|
|
871
|
-
*/
|
|
870
|
+
* Registers a event handler that is called when the editor view is unmounted.
|
|
871
|
+
*
|
|
872
|
+
* @public
|
|
873
|
+
*/
|
|
872
874
|
declare function defineUnmountHandler(handler: UnmountHandler): PlainExtension;
|
|
873
875
|
//#endregion
|
|
874
876
|
//#region src/extensions/history.d.ts
|
|
875
877
|
/**
|
|
876
|
-
* Options for {@link defineHistory}.
|
|
877
|
-
*
|
|
878
|
-
* @public
|
|
879
|
-
*/
|
|
878
|
+
* Options for {@link defineHistory}.
|
|
879
|
+
*
|
|
880
|
+
* @public
|
|
881
|
+
*/
|
|
880
882
|
interface HistoryOptions {
|
|
881
883
|
/**
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
884
|
+
* The amount of history events that are collected before the oldest events
|
|
885
|
+
* are discarded.
|
|
886
|
+
*
|
|
887
|
+
* @default 200
|
|
888
|
+
*/
|
|
887
889
|
depth?: number;
|
|
888
890
|
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
* The delay in milliseconds between changes after which a new group should be
|
|
892
|
+
* started.
|
|
893
|
+
*
|
|
894
|
+
* @default 250
|
|
895
|
+
*/
|
|
894
896
|
newGroupDelay?: number;
|
|
895
897
|
}
|
|
896
898
|
/**
|
|
897
|
-
* @internal
|
|
898
|
-
*/
|
|
899
|
+
* @internal
|
|
900
|
+
*/
|
|
899
901
|
type HistoryExtension = Extension<{
|
|
900
902
|
Commands: {
|
|
901
903
|
undo: [];
|
|
@@ -903,12 +905,12 @@ type HistoryExtension = Extension<{
|
|
|
903
905
|
};
|
|
904
906
|
}>;
|
|
905
907
|
/**
|
|
906
|
-
* Add undo/redo history to the editor.
|
|
907
|
-
*
|
|
908
|
-
* @param options
|
|
909
|
-
*
|
|
910
|
-
* @public
|
|
911
|
-
*/
|
|
908
|
+
* Add undo/redo history to the editor.
|
|
909
|
+
*
|
|
910
|
+
* @param options
|
|
911
|
+
*
|
|
912
|
+
* @public
|
|
913
|
+
*/
|
|
912
914
|
declare function defineHistory({
|
|
913
915
|
depth,
|
|
914
916
|
newGroupDelay
|
|
@@ -916,92 +918,92 @@ declare function defineHistory({
|
|
|
916
918
|
//#endregion
|
|
917
919
|
//#region src/extensions/keymap.d.ts
|
|
918
920
|
/**
|
|
919
|
-
* @public
|
|
920
|
-
*/
|
|
921
|
+
* @public
|
|
922
|
+
*/
|
|
921
923
|
interface Keymap {
|
|
922
924
|
[key: string]: Command;
|
|
923
925
|
}
|
|
924
926
|
/**
|
|
925
|
-
* @public
|
|
926
|
-
*/
|
|
927
|
+
* @public
|
|
928
|
+
*/
|
|
927
929
|
declare function defineKeymap(keymap: Keymap): PlainExtension;
|
|
928
930
|
/**
|
|
929
|
-
* @internal
|
|
930
|
-
*/
|
|
931
|
+
* @internal
|
|
932
|
+
*/
|
|
931
933
|
type KeymapPayload = Keymap;
|
|
932
934
|
/**
|
|
933
|
-
* @internal
|
|
934
|
-
*/
|
|
935
|
+
* @internal
|
|
936
|
+
*/
|
|
935
937
|
declare const keymapFacet: Facet<KeymapPayload, PluginPayload>;
|
|
936
938
|
//#endregion
|
|
937
939
|
//#region src/extensions/keymap-base.d.ts
|
|
938
940
|
/**
|
|
939
|
-
* @internal
|
|
940
|
-
*/
|
|
941
|
+
* @internal
|
|
942
|
+
*/
|
|
941
943
|
type BaseKeymapExtension = PlainExtension;
|
|
942
944
|
/**
|
|
943
|
-
* Defines some basic key bindings.
|
|
944
|
-
*
|
|
945
|
-
* @public
|
|
946
|
-
*/
|
|
945
|
+
* Defines some basic key bindings.
|
|
946
|
+
*
|
|
947
|
+
* @public
|
|
948
|
+
*/
|
|
947
949
|
declare function defineBaseKeymap(options?: {
|
|
948
950
|
/**
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
951
|
+
* The priority of the keymap.
|
|
952
|
+
*
|
|
953
|
+
* @default Priority.low
|
|
954
|
+
*/
|
|
953
955
|
priority?: Priority;
|
|
954
956
|
}): BaseKeymapExtension;
|
|
955
957
|
//#endregion
|
|
956
958
|
//#region src/extensions/mark-spec.d.ts
|
|
957
959
|
/**
|
|
958
|
-
* @public
|
|
959
|
-
*/
|
|
960
|
+
* @public
|
|
961
|
+
*/
|
|
960
962
|
interface MarkSpecOptions<MarkName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends MarkSpec {
|
|
961
963
|
/**
|
|
962
|
-
|
|
963
|
-
|
|
964
|
+
* The name of the mark type.
|
|
965
|
+
*/
|
|
964
966
|
name: MarkName;
|
|
965
967
|
/**
|
|
966
|
-
|
|
967
|
-
|
|
968
|
+
* The attributes that marks of this type get.
|
|
969
|
+
*/
|
|
968
970
|
attrs?: { [K in keyof Attrs]: AttrSpec<Attrs[K]> };
|
|
969
971
|
}
|
|
970
972
|
/**
|
|
971
|
-
* @public
|
|
972
|
-
*/
|
|
973
|
+
* @public
|
|
974
|
+
*/
|
|
973
975
|
interface MarkAttrOptions<MarkName extends string = string, AttrName extends string = string, AttrType = any> extends AttrSpec<AttrType> {
|
|
974
976
|
/**
|
|
975
|
-
|
|
976
|
-
|
|
977
|
+
* The name of the mark type.
|
|
978
|
+
*/
|
|
977
979
|
type: MarkName;
|
|
978
980
|
/**
|
|
979
|
-
|
|
980
|
-
|
|
981
|
+
* The name of the attribute.
|
|
982
|
+
*/
|
|
981
983
|
attr: AttrName;
|
|
982
984
|
/**
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
985
|
+
* Returns the attribute key and value to be set on the HTML element.
|
|
986
|
+
*
|
|
987
|
+
* If the returned `key` is `"style"`, the value is a string of CSS properties and will
|
|
988
|
+
* be prepended to the existing `style` attribute on the DOM node.
|
|
989
|
+
*
|
|
990
|
+
* @param value - The value of the attribute of current ProseMirror node.
|
|
991
|
+
*/
|
|
990
992
|
toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
|
|
991
993
|
/**
|
|
992
|
-
|
|
993
|
-
|
|
994
|
+
* Parses the attribute value from the DOM.
|
|
995
|
+
*/
|
|
994
996
|
parseDOM?: (node: HTMLElement) => AttrType;
|
|
995
997
|
}
|
|
996
998
|
/**
|
|
997
|
-
* @public
|
|
998
|
-
*/
|
|
999
|
+
* @public
|
|
1000
|
+
*/
|
|
999
1001
|
declare function defineMarkSpec<Mark extends string, Attrs extends AnyAttrs = AnyAttrs>(options: MarkSpecOptions<Mark, Attrs>): Extension<{
|
|
1000
1002
|
Marks: { [K in Mark]: Attrs };
|
|
1001
1003
|
}>;
|
|
1002
1004
|
/**
|
|
1003
|
-
* @public
|
|
1004
|
-
*/
|
|
1005
|
+
* @public
|
|
1006
|
+
*/
|
|
1005
1007
|
declare function defineMarkAttr<MarkType extends string = string, AttrName extends string = string, AttrType = any>(options: MarkAttrOptions<MarkType, AttrName, AttrType>): Extension<{
|
|
1006
1008
|
Marks: { [K in MarkType]: AttrType };
|
|
1007
1009
|
}>;
|
|
@@ -1015,95 +1017,95 @@ declare function defineMarkView(options: MarkViewOptions): Extension;
|
|
|
1015
1017
|
//#endregion
|
|
1016
1018
|
//#region src/extensions/mark-view-effect.d.ts
|
|
1017
1019
|
/**
|
|
1018
|
-
* @internal
|
|
1019
|
-
*/
|
|
1020
|
+
* @internal
|
|
1021
|
+
*/
|
|
1020
1022
|
type MarkViewFactoryOptions<T> = {
|
|
1021
1023
|
group: string;
|
|
1022
1024
|
factory: (args: T) => MarkViewConstructor;
|
|
1023
1025
|
};
|
|
1024
1026
|
/**
|
|
1025
|
-
* @internal
|
|
1026
|
-
*/
|
|
1027
|
+
* @internal
|
|
1028
|
+
*/
|
|
1027
1029
|
type MarkViewComponentOptions<T> = {
|
|
1028
1030
|
group: string;
|
|
1029
1031
|
name: string;
|
|
1030
1032
|
args: T;
|
|
1031
1033
|
};
|
|
1032
1034
|
/**
|
|
1033
|
-
* @internal
|
|
1034
|
-
*/
|
|
1035
|
+
* @internal
|
|
1036
|
+
*/
|
|
1035
1037
|
declare function defineMarkViewFactory<T>(options: MarkViewFactoryOptions<T>): Extension;
|
|
1036
1038
|
/**
|
|
1037
|
-
* @internal
|
|
1038
|
-
*/
|
|
1039
|
+
* @internal
|
|
1040
|
+
*/
|
|
1039
1041
|
declare function defineMarkViewComponent<T>(options: MarkViewComponentOptions<T>): Extension;
|
|
1040
1042
|
//#endregion
|
|
1041
1043
|
//#region src/extensions/node-spec.d.ts
|
|
1042
1044
|
/**
|
|
1043
|
-
* @public
|
|
1044
|
-
*/
|
|
1045
|
+
* @public
|
|
1046
|
+
*/
|
|
1045
1047
|
interface NodeSpecOptions<NodeName extends string = string, Attrs extends AnyAttrs = AnyAttrs> extends NodeSpec {
|
|
1046
1048
|
/**
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
+
* The name of the node type.
|
|
1050
|
+
*/
|
|
1049
1051
|
name: NodeName;
|
|
1050
1052
|
/**
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1053
|
+
* Whether this is the top-level node type. Only one node type can be the
|
|
1054
|
+
* top-level node type in a schema.
|
|
1055
|
+
*/
|
|
1054
1056
|
topNode?: boolean;
|
|
1055
1057
|
/**
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
+
* The attributes that nodes of this type get.
|
|
1059
|
+
*/
|
|
1058
1060
|
attrs?: { [key in keyof Attrs]: AttrSpec<Attrs[key]> };
|
|
1059
1061
|
}
|
|
1060
1062
|
/**
|
|
1061
|
-
* @public
|
|
1062
|
-
*/
|
|
1063
|
+
* @public
|
|
1064
|
+
*/
|
|
1063
1065
|
interface NodeAttrOptions<NodeName extends string = string, AttrName extends string = string, AttrType = any> extends AttrSpec<AttrType> {
|
|
1064
1066
|
/**
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
+
* The name of the node type.
|
|
1068
|
+
*/
|
|
1067
1069
|
type: NodeName;
|
|
1068
1070
|
/**
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
+
* The name of the attribute.
|
|
1072
|
+
*/
|
|
1071
1073
|
attr: AttrName;
|
|
1072
1074
|
/**
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1075
|
+
* Whether the attribute should be kept when the node is split. Set it to
|
|
1076
|
+
* `true` if you want to inherit the attribute from the previous node when
|
|
1077
|
+
* splitting the node by pressing `Enter`.
|
|
1078
|
+
*
|
|
1079
|
+
* @default undefined
|
|
1080
|
+
*/
|
|
1079
1081
|
splittable?: boolean;
|
|
1080
1082
|
/**
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1083
|
+
* Returns the attribute key and value to be set on the HTML element.
|
|
1084
|
+
*
|
|
1085
|
+
* If the returned `key` is `"style"`, the value is a string of CSS properties and will
|
|
1086
|
+
* be prepended to the existing `style` attribute on the DOM node.
|
|
1087
|
+
*
|
|
1088
|
+
* @param value - The value of the attribute of current ProseMirror node.
|
|
1089
|
+
*/
|
|
1088
1090
|
toDOM?: (value: AttrType) => [key: string, value: string] | null | undefined;
|
|
1089
1091
|
/**
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
+
* Parses the attribute value from the DOM.
|
|
1093
|
+
*/
|
|
1092
1094
|
parseDOM?: (node: HTMLElement) => AttrType;
|
|
1093
1095
|
}
|
|
1094
1096
|
/**
|
|
1095
|
-
* Defines a node type.
|
|
1096
|
-
*
|
|
1097
|
-
* @public
|
|
1098
|
-
*/
|
|
1097
|
+
* Defines a node type.
|
|
1098
|
+
*
|
|
1099
|
+
* @public
|
|
1100
|
+
*/
|
|
1099
1101
|
declare function defineNodeSpec<Node extends string, Attrs extends AnyAttrs = AnyAttrs>(options: NodeSpecOptions<Node, Attrs>): Extension<{
|
|
1100
1102
|
Nodes: { [K in Node]: Attrs };
|
|
1101
1103
|
}>;
|
|
1102
1104
|
/**
|
|
1103
|
-
* Defines an attribute for a node type.
|
|
1104
|
-
*
|
|
1105
|
-
* @public
|
|
1106
|
-
*/
|
|
1105
|
+
* Defines an attribute for a node type.
|
|
1106
|
+
*
|
|
1107
|
+
* @public
|
|
1108
|
+
*/
|
|
1107
1109
|
declare function defineNodeAttr<NodeType extends string = string, AttrName extends string = string, AttrType = any>(options: NodeAttrOptions<NodeType, AttrName, AttrType>): Extension<{
|
|
1108
1110
|
Nodes: { [K in NodeType]: { [K in AttrName]: AttrType } };
|
|
1109
1111
|
}>;
|
|
@@ -1117,269 +1119,291 @@ declare function defineNodeView(options: NodeViewOptions): Extension;
|
|
|
1117
1119
|
//#endregion
|
|
1118
1120
|
//#region src/extensions/node-view-effect.d.ts
|
|
1119
1121
|
/**
|
|
1120
|
-
* @internal
|
|
1121
|
-
*/
|
|
1122
|
+
* @internal
|
|
1123
|
+
*/
|
|
1122
1124
|
type NodeViewFactoryOptions<T> = {
|
|
1123
1125
|
group: string;
|
|
1124
1126
|
factory: (args: T) => NodeViewConstructor;
|
|
1125
1127
|
};
|
|
1126
1128
|
/**
|
|
1127
|
-
* @internal
|
|
1128
|
-
*/
|
|
1129
|
+
* @internal
|
|
1130
|
+
*/
|
|
1129
1131
|
type NodeViewComponentOptions<T> = {
|
|
1130
1132
|
group: string;
|
|
1131
1133
|
name: string;
|
|
1132
1134
|
args: T;
|
|
1133
1135
|
};
|
|
1134
1136
|
/**
|
|
1135
|
-
* @internal
|
|
1136
|
-
*/
|
|
1137
|
+
* @internal
|
|
1138
|
+
*/
|
|
1137
1139
|
declare function defineNodeViewFactory<T>(options: NodeViewFactoryOptions<T>): Extension;
|
|
1138
1140
|
/**
|
|
1139
|
-
* @internal
|
|
1140
|
-
*/
|
|
1141
|
+
* @internal
|
|
1142
|
+
*/
|
|
1141
1143
|
declare function defineNodeViewComponent<T>(options: NodeViewComponentOptions<T>): Extension;
|
|
1142
1144
|
//#endregion
|
|
1143
1145
|
//#region src/extensions/paragraph.d.ts
|
|
1144
1146
|
/**
|
|
1145
|
-
* @internal
|
|
1146
|
-
*/
|
|
1147
|
+
* @internal
|
|
1148
|
+
*/
|
|
1147
1149
|
type ParagraphSpecExtension = Extension<{
|
|
1148
1150
|
Nodes: {
|
|
1149
1151
|
paragraph: Attrs$1;
|
|
1150
1152
|
};
|
|
1151
1153
|
}>;
|
|
1152
1154
|
/**
|
|
1153
|
-
* @internal
|
|
1154
|
-
*
|
|
1155
|
-
* @deprecated Use the following import instead:
|
|
1156
|
-
*
|
|
1157
|
-
* ```ts
|
|
1158
|
-
* import type { ParagraphExtension } from 'prosekit/extensions/paragraph'
|
|
1159
|
-
* ```
|
|
1160
|
-
*/
|
|
1155
|
+
* @internal
|
|
1156
|
+
*
|
|
1157
|
+
* @deprecated Use the following import instead:
|
|
1158
|
+
*
|
|
1159
|
+
* ```ts
|
|
1160
|
+
* import type { ParagraphExtension } from 'prosekit/extensions/paragraph'
|
|
1161
|
+
* ```
|
|
1162
|
+
*/
|
|
1161
1163
|
type ParagraphExtension = ParagraphSpecExtension;
|
|
1162
1164
|
/**
|
|
1163
|
-
* @public
|
|
1164
|
-
*
|
|
1165
|
-
* Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
|
|
1166
|
-
*
|
|
1167
|
-
* @deprecated Use the following import instead:
|
|
1168
|
-
*
|
|
1169
|
-
* ```ts
|
|
1170
|
-
* import { defineParagraph } from 'prosekit/extensions/paragraph'
|
|
1171
|
-
* ```
|
|
1172
|
-
*/
|
|
1165
|
+
* @public
|
|
1166
|
+
*
|
|
1167
|
+
* Defines a paragraph node spec as the highest priority, because it should be the default block node for most cases.
|
|
1168
|
+
*
|
|
1169
|
+
* @deprecated Use the following import instead:
|
|
1170
|
+
*
|
|
1171
|
+
* ```ts
|
|
1172
|
+
* import { defineParagraph } from 'prosekit/extensions/paragraph'
|
|
1173
|
+
* ```
|
|
1174
|
+
*/
|
|
1173
1175
|
declare function defineParagraph(): ParagraphExtension;
|
|
1174
1176
|
//#endregion
|
|
1175
1177
|
//#region src/extensions/text.d.ts
|
|
1176
1178
|
/**
|
|
1177
|
-
* @internal
|
|
1178
|
-
*/
|
|
1179
|
+
* @internal
|
|
1180
|
+
*/
|
|
1179
1181
|
type TextExtension = Extension<{
|
|
1180
1182
|
Nodes: {
|
|
1181
1183
|
text: Attrs$1;
|
|
1182
1184
|
};
|
|
1183
1185
|
}>;
|
|
1184
1186
|
/**
|
|
1185
|
-
* @public
|
|
1186
|
-
*
|
|
1187
|
-
* @deprecated Use the following import instead:
|
|
1188
|
-
*
|
|
1189
|
-
* ```ts
|
|
1190
|
-
* import { defineText } from 'prosekit/extensions/text'
|
|
1191
|
-
* ```
|
|
1192
|
-
*/
|
|
1187
|
+
* @public
|
|
1188
|
+
*
|
|
1189
|
+
* @deprecated Use the following import instead:
|
|
1190
|
+
*
|
|
1191
|
+
* ```ts
|
|
1192
|
+
* import { defineText } from 'prosekit/extensions/text'
|
|
1193
|
+
* ```
|
|
1194
|
+
*/
|
|
1193
1195
|
declare function defineText(): TextExtension;
|
|
1194
1196
|
//#endregion
|
|
1195
1197
|
//#region src/facets/facet-extension.d.ts
|
|
1196
1198
|
/**
|
|
1197
|
-
* @internal
|
|
1198
|
-
*/
|
|
1199
|
+
* @internal
|
|
1200
|
+
*/
|
|
1199
1201
|
declare function defineFacetPayload<Input>(facet: Facet<Input, any>, payloads: Input[]): Extension;
|
|
1200
1202
|
//#endregion
|
|
1201
1203
|
//#region src/types/base-node-view-options.d.ts
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
|
|
1209
|
-
*/
|
|
1204
|
+
/**
|
|
1205
|
+
* Some basic props for custom node views.
|
|
1206
|
+
*
|
|
1207
|
+
* @deprecated - This is no longer needed. Use `CoreNodeViewUserOptions` from `@prosemirror-adapter/core` instead.
|
|
1208
|
+
*
|
|
1209
|
+
* @hidden
|
|
1210
|
+
*/
|
|
1210
1211
|
interface BaseNodeViewOptions {
|
|
1211
1212
|
/**
|
|
1212
|
-
|
|
1213
|
-
|
|
1213
|
+
* The wrapping DOM element for the node view. Defaults to `div` for block nodes and `span` for inline nodes.
|
|
1214
|
+
*/
|
|
1214
1215
|
as?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
|
|
1215
1216
|
/**
|
|
1216
|
-
|
|
1217
|
-
|
|
1217
|
+
* The wrapping DOM element for the node view's content. Defaults to `div` for block nodes and `span` for inline nodes.
|
|
1218
|
+
*/
|
|
1218
1219
|
contentAs?: string | HTMLElement | ((node: ProseMirrorNode) => HTMLElement);
|
|
1219
|
-
update?: NodeView[
|
|
1220
|
-
ignoreMutation?: NodeView[
|
|
1221
|
-
selectNode?: NodeView[
|
|
1222
|
-
deselectNode?: NodeView[
|
|
1223
|
-
setSelection?: NodeView[
|
|
1224
|
-
stopEvent?: NodeView[
|
|
1225
|
-
destroy?: NodeView[
|
|
1220
|
+
update?: NodeView['update'];
|
|
1221
|
+
ignoreMutation?: NodeView['ignoreMutation'];
|
|
1222
|
+
selectNode?: NodeView['selectNode'];
|
|
1223
|
+
deselectNode?: NodeView['deselectNode'];
|
|
1224
|
+
setSelection?: NodeView['setSelection'];
|
|
1225
|
+
stopEvent?: NodeView['stopEvent'];
|
|
1226
|
+
destroy?: NodeView['destroy'];
|
|
1226
1227
|
onUpdate?: () => void;
|
|
1227
1228
|
}
|
|
1228
1229
|
//#endregion
|
|
1229
1230
|
//#region src/utils/assert.d.ts
|
|
1230
1231
|
/**
|
|
1231
|
-
* @internal
|
|
1232
|
-
*/
|
|
1232
|
+
* @internal
|
|
1233
|
+
*/
|
|
1233
1234
|
declare function assert(condition: unknown, message?: string): asserts condition;
|
|
1234
1235
|
//#endregion
|
|
1235
1236
|
//#region src/utils/can-use-regex-lookbehind.d.ts
|
|
1237
|
+
/**
|
|
1238
|
+
* Checks if the browser supports [regex lookbehind assertion](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Lookbehind_assertion).
|
|
1239
|
+
*/
|
|
1236
1240
|
declare const canUseRegexLookbehind: () => boolean;
|
|
1237
1241
|
//#endregion
|
|
1238
1242
|
//#region src/utils/clsx.d.ts
|
|
1239
1243
|
/**
|
|
1240
|
-
* A utility for constructing `className` strings conditionally.
|
|
1241
|
-
*
|
|
1242
|
-
* It is a re-export of [clsx/lite](https://www.npmjs.com/package/clsx) with stricter types.
|
|
1243
|
-
*
|
|
1244
|
-
* @public
|
|
1245
|
-
*/
|
|
1244
|
+
* A utility for constructing `className` strings conditionally.
|
|
1245
|
+
*
|
|
1246
|
+
* It is a re-export of [clsx/lite](https://www.npmjs.com/package/clsx) with stricter types.
|
|
1247
|
+
*
|
|
1248
|
+
* @public
|
|
1249
|
+
*/
|
|
1246
1250
|
declare const clsx: (...args: Array<string | boolean | null | undefined>) => string;
|
|
1247
1251
|
//#endregion
|
|
1248
1252
|
//#region src/utils/collect-children.d.ts
|
|
1249
1253
|
/**
|
|
1250
|
-
* Collects all children of a node or a fragment, and returns them as an array.
|
|
1251
|
-
*
|
|
1252
|
-
* @
|
|
1253
|
-
|
|
1254
|
+
* Collects all children of a node or a fragment, and returns them as an array.
|
|
1255
|
+
*
|
|
1256
|
+
* @deprecated Use `node.children` or `fragment.content` instead.
|
|
1257
|
+
*
|
|
1258
|
+
* @hidden
|
|
1259
|
+
*/
|
|
1254
1260
|
declare function collectChildren(parent: ProseMirrorNode | Fragment): ProseMirrorNode[];
|
|
1255
1261
|
//#endregion
|
|
1256
1262
|
//#region src/utils/collect-nodes.d.ts
|
|
1257
1263
|
/**
|
|
1258
|
-
* @
|
|
1259
|
-
*
|
|
1260
|
-
* @deprecated
|
|
1261
|
-
*/
|
|
1264
|
+
* @hidden
|
|
1265
|
+
*
|
|
1266
|
+
* @deprecated
|
|
1267
|
+
*/
|
|
1262
1268
|
type NodeContent = ProseMirrorNode | ProseMirrorFragment | NodeContent[];
|
|
1263
1269
|
/**
|
|
1264
|
-
* Collects all nodes from a given content.
|
|
1265
|
-
*
|
|
1266
|
-
* @deprecated Use `collectChildren` instead.
|
|
1267
|
-
*
|
|
1268
|
-
* @
|
|
1269
|
-
*/
|
|
1270
|
+
* Collects all nodes from a given content.
|
|
1271
|
+
*
|
|
1272
|
+
* @deprecated Use `collectChildren` instead.
|
|
1273
|
+
*
|
|
1274
|
+
* @hidden
|
|
1275
|
+
*/
|
|
1270
1276
|
declare function collectNodes(content: NodeContent): ProseMirrorNode[];
|
|
1271
1277
|
//#endregion
|
|
1272
1278
|
//#region src/utils/contains-inline-node.d.ts
|
|
1273
1279
|
/**
|
|
1274
|
-
* @internal
|
|
1275
|
-
*/
|
|
1280
|
+
* @internal
|
|
1281
|
+
*/
|
|
1276
1282
|
declare function containsInlineNode(doc: ProseMirrorNode, from: number, to: number): boolean;
|
|
1277
1283
|
//#endregion
|
|
1278
1284
|
//#region src/utils/default-block-at.d.ts
|
|
1279
1285
|
/**
|
|
1280
|
-
* @internal
|
|
1281
|
-
*/
|
|
1286
|
+
* @internal
|
|
1287
|
+
*/
|
|
1282
1288
|
declare function defaultBlockAt(match: ContentMatch): NodeType$1 | null;
|
|
1283
1289
|
//#endregion
|
|
1284
1290
|
//#region src/utils/env.d.ts
|
|
1285
1291
|
/**
|
|
1286
|
-
* @
|
|
1287
|
-
*/
|
|
1292
|
+
* @internal
|
|
1293
|
+
*/
|
|
1288
1294
|
declare const isApple: boolean;
|
|
1289
1295
|
//#endregion
|
|
1290
1296
|
//#region src/utils/find-parent-node.d.ts
|
|
1291
1297
|
/**
|
|
1292
|
-
* @public
|
|
1293
|
-
*/
|
|
1298
|
+
* @public
|
|
1299
|
+
*/
|
|
1294
1300
|
interface FindParentNodeResult {
|
|
1295
1301
|
/**
|
|
1296
|
-
|
|
1297
|
-
|
|
1302
|
+
* The closest parent node that satisfies the predicate.
|
|
1303
|
+
*/
|
|
1298
1304
|
node: ProseMirrorNode;
|
|
1299
1305
|
/**
|
|
1300
|
-
|
|
1301
|
-
|
|
1306
|
+
* The position directly before the node.
|
|
1307
|
+
*/
|
|
1302
1308
|
pos: number;
|
|
1303
1309
|
/**
|
|
1304
|
-
|
|
1305
|
-
|
|
1310
|
+
* The position at the start of the node.
|
|
1311
|
+
*/
|
|
1306
1312
|
start: number;
|
|
1307
1313
|
/**
|
|
1308
|
-
|
|
1309
|
-
|
|
1314
|
+
* The depth of the node.
|
|
1315
|
+
*/
|
|
1310
1316
|
depth: number;
|
|
1311
1317
|
}
|
|
1312
1318
|
/**
|
|
1313
|
-
* Find the closest parent node that satisfies the predicate.
|
|
1314
|
-
*
|
|
1315
|
-
* @public
|
|
1316
|
-
*/
|
|
1317
|
-
declare function findParentNode(
|
|
1319
|
+
* Find the closest parent node that satisfies the predicate.
|
|
1320
|
+
*
|
|
1321
|
+
* @public
|
|
1322
|
+
*/
|
|
1323
|
+
declare function findParentNode(
|
|
1324
|
+
/**
|
|
1325
|
+
* The predicate to test the parent node.
|
|
1326
|
+
*/
|
|
1327
|
+
predicate: (node: ProseMirrorNode) => boolean,
|
|
1328
|
+
/**
|
|
1329
|
+
* The position to start searching from.
|
|
1330
|
+
*/
|
|
1331
|
+
$pos: ResolvedPos): FindParentNodeResult | undefined;
|
|
1318
1332
|
//#endregion
|
|
1319
1333
|
//#region src/utils/find-parent-node-of-type.d.ts
|
|
1320
1334
|
/**
|
|
1321
|
-
* Finds the closest parent node that matches the given node type.
|
|
1322
|
-
*
|
|
1323
|
-
* @public
|
|
1324
|
-
*/
|
|
1325
|
-
declare function findParentNodeOfType(
|
|
1335
|
+
* Finds the closest parent node that matches the given node type.
|
|
1336
|
+
*
|
|
1337
|
+
* @public
|
|
1338
|
+
*/
|
|
1339
|
+
declare function findParentNodeOfType(
|
|
1340
|
+
/**
|
|
1341
|
+
* The type of the node to find.
|
|
1342
|
+
*/
|
|
1343
|
+
type: NodeType$1 | string,
|
|
1344
|
+
/**
|
|
1345
|
+
* The position to start searching from.
|
|
1346
|
+
*/
|
|
1347
|
+
$pos: ResolvedPos): FindParentNodeResult | undefined;
|
|
1326
1348
|
//#endregion
|
|
1327
1349
|
//#region src/utils/get-id.d.ts
|
|
1328
1350
|
/**
|
|
1329
|
-
* Returns a unique id in the current process that can be used in various places.
|
|
1330
|
-
*
|
|
1331
|
-
* @internal
|
|
1332
|
-
|
|
1351
|
+
* Returns a unique id in the current process that can be used in various places.
|
|
1352
|
+
*
|
|
1353
|
+
* @internal
|
|
1354
|
+
*
|
|
1355
|
+
* @deprecated Import `getId` from `@ocavue/utils` package instead. Remove it in a future version.
|
|
1356
|
+
*/
|
|
1333
1357
|
declare function getId(): string;
|
|
1334
1358
|
//#endregion
|
|
1335
1359
|
//#region src/utils/get-mark-type.d.ts
|
|
1336
1360
|
/**
|
|
1337
|
-
* @internal
|
|
1338
|
-
*/
|
|
1361
|
+
* @internal
|
|
1362
|
+
*/
|
|
1339
1363
|
declare function getMarkType(schema: Schema, type: string | MarkType$1): MarkType$1;
|
|
1340
1364
|
//#endregion
|
|
1341
1365
|
//#region src/utils/get-node-type.d.ts
|
|
1342
1366
|
/**
|
|
1343
|
-
* @internal
|
|
1344
|
-
*/
|
|
1367
|
+
* @internal
|
|
1368
|
+
*/
|
|
1345
1369
|
declare function getNodeType(schema: Schema, type: string | NodeType$1): NodeType$1;
|
|
1346
1370
|
//#endregion
|
|
1347
1371
|
//#region src/utils/is-at-block-start.d.ts
|
|
1348
1372
|
/**
|
|
1349
|
-
* Whether the selection is an empty text selection at the start of a block.
|
|
1350
|
-
*
|
|
1351
|
-
* @internal
|
|
1352
|
-
*/
|
|
1373
|
+
* Whether the selection is an empty text selection at the start of a block.
|
|
1374
|
+
*
|
|
1375
|
+
* @internal
|
|
1376
|
+
*/
|
|
1353
1377
|
declare function isAtBlockStart(state: EditorState, view?: EditorView): ResolvedPos | null;
|
|
1354
1378
|
//#endregion
|
|
1355
1379
|
//#region src/utils/is-in-code-block.d.ts
|
|
1356
1380
|
/**
|
|
1357
|
-
* Check if the selection is in a code block.
|
|
1358
|
-
*
|
|
1359
|
-
* @internal
|
|
1360
|
-
*/
|
|
1381
|
+
* Check if the selection is in a code block.
|
|
1382
|
+
*
|
|
1383
|
+
* @internal
|
|
1384
|
+
*/
|
|
1361
1385
|
declare function isInCodeBlock(selection: Selection): boolean;
|
|
1362
1386
|
//#endregion
|
|
1363
1387
|
//#region src/utils/is-mark-absent.d.ts
|
|
1364
1388
|
/**
|
|
1365
|
-
* Returns true if the given mark is missing in some part of the range.
|
|
1366
|
-
* Returns false if the entire range has the given mark.
|
|
1367
|
-
* Returns true if the mark is not allowed in the range.
|
|
1368
|
-
*
|
|
1369
|
-
* @internal
|
|
1370
|
-
*/
|
|
1389
|
+
* Returns true if the given mark is missing in some part of the range.
|
|
1390
|
+
* Returns false if the entire range has the given mark.
|
|
1391
|
+
* Returns true if the mark is not allowed in the range.
|
|
1392
|
+
*
|
|
1393
|
+
* @internal
|
|
1394
|
+
*/
|
|
1371
1395
|
declare function isMarkAbsent(node: ProseMirrorNode, from: number, to: number, markType: MarkType$1, attrs?: Attrs$1 | null): boolean;
|
|
1372
1396
|
//#endregion
|
|
1373
1397
|
//#region src/utils/is-mark-active.d.ts
|
|
1374
1398
|
/**
|
|
1375
|
-
* @internal
|
|
1376
|
-
*/
|
|
1399
|
+
* @internal
|
|
1400
|
+
*/
|
|
1377
1401
|
declare function isMarkActive(state: EditorState, type: string | MarkType$1, attrs?: Attrs$1 | null): boolean;
|
|
1378
1402
|
//#endregion
|
|
1379
1403
|
//#region src/utils/maybe-run.d.ts
|
|
1380
1404
|
/**
|
|
1381
|
-
* @internal
|
|
1382
|
-
*/
|
|
1405
|
+
* @internal
|
|
1406
|
+
*/
|
|
1383
1407
|
declare function maybeRun<Value, Args extends unknown[]>(value: Value | ((...args: Args) => Value), ...args: Args): Value;
|
|
1384
1408
|
//#endregion
|
|
1385
1409
|
//#region src/utils/set-selection-around.d.ts
|
|
@@ -1387,65 +1411,66 @@ declare function setSelectionAround(tr: Transaction, pos: number): void;
|
|
|
1387
1411
|
//#endregion
|
|
1388
1412
|
//#region src/utils/type-assertion.d.ts
|
|
1389
1413
|
/**
|
|
1390
|
-
* Checks if the given object is a
|
|
1391
|
-
*/
|
|
1392
|
-
declare function isProseMirrorNode(
|
|
1393
|
-
/**
|
|
1394
|
-
* Checks if the given object is a
|
|
1395
|
-
*
|
|
1396
|
-
* @public
|
|
1397
|
-
*/
|
|
1398
|
-
declare function isMark(
|
|
1399
|
-
/**
|
|
1400
|
-
* Checks if the given object is a
|
|
1401
|
-
*
|
|
1402
|
-
* @public
|
|
1403
|
-
*/
|
|
1404
|
-
declare function isFragment(
|
|
1405
|
-
/**
|
|
1406
|
-
* Checks if the given object is a
|
|
1407
|
-
*
|
|
1408
|
-
* @public
|
|
1409
|
-
*/
|
|
1410
|
-
declare function isSlice(
|
|
1411
|
-
/**
|
|
1412
|
-
* Checks if the given object is a
|
|
1413
|
-
*
|
|
1414
|
-
* @public
|
|
1415
|
-
*/
|
|
1416
|
-
declare function isSelection(
|
|
1417
|
-
/**
|
|
1418
|
-
* Checks if the given object is a
|
|
1419
|
-
*
|
|
1420
|
-
* @public
|
|
1421
|
-
*/
|
|
1422
|
-
declare function isTextSelection(
|
|
1423
|
-
/**
|
|
1424
|
-
* Checks if the given object is a
|
|
1425
|
-
*
|
|
1426
|
-
* @public
|
|
1427
|
-
*/
|
|
1428
|
-
declare function isNodeSelection(
|
|
1429
|
-
/**
|
|
1430
|
-
* Checks if the given object is a
|
|
1431
|
-
*
|
|
1432
|
-
* @public
|
|
1433
|
-
*/
|
|
1434
|
-
declare function isAllSelection(
|
|
1435
|
-
/**
|
|
1436
|
-
* @internal
|
|
1437
|
-
*/
|
|
1414
|
+
* Checks if the given object is a {@link ProseMirrorNode} instance.
|
|
1415
|
+
*/
|
|
1416
|
+
declare function isProseMirrorNode(value: unknown): value is ProseMirrorNode;
|
|
1417
|
+
/**
|
|
1418
|
+
* Checks if the given object is a {@link Mark} instance.
|
|
1419
|
+
*
|
|
1420
|
+
* @public
|
|
1421
|
+
*/
|
|
1422
|
+
declare function isMark(value: unknown): value is Mark$1;
|
|
1423
|
+
/**
|
|
1424
|
+
* Checks if the given object is a {@link Fragment} instance.
|
|
1425
|
+
*
|
|
1426
|
+
* @public
|
|
1427
|
+
*/
|
|
1428
|
+
declare function isFragment(value: unknown): value is Fragment;
|
|
1429
|
+
/**
|
|
1430
|
+
* Checks if the given object is a {@link Slice} instance.
|
|
1431
|
+
*
|
|
1432
|
+
* @public
|
|
1433
|
+
*/
|
|
1434
|
+
declare function isSlice(value: unknown): value is Slice;
|
|
1435
|
+
/**
|
|
1436
|
+
* Checks if the given object is a {@link Selection} instance.
|
|
1437
|
+
*
|
|
1438
|
+
* @public
|
|
1439
|
+
*/
|
|
1440
|
+
declare function isSelection(value: unknown): value is Selection;
|
|
1441
|
+
/**
|
|
1442
|
+
* Checks if the given object is a {@link TextSelection} instance.
|
|
1443
|
+
*
|
|
1444
|
+
* @public
|
|
1445
|
+
*/
|
|
1446
|
+
declare function isTextSelection(value: Selection): value is TextSelection;
|
|
1447
|
+
/**
|
|
1448
|
+
* Checks if the given object is a {@link NodeSelection} instance.
|
|
1449
|
+
*
|
|
1450
|
+
* @public
|
|
1451
|
+
*/
|
|
1452
|
+
declare function isNodeSelection(value: Selection): value is NodeSelection;
|
|
1453
|
+
/**
|
|
1454
|
+
* Checks if the given object is a {@link AllSelection} instance.
|
|
1455
|
+
*
|
|
1456
|
+
* @public
|
|
1457
|
+
*/
|
|
1458
|
+
declare function isAllSelection(value: Selection): value is AllSelection;
|
|
1459
|
+
/**
|
|
1460
|
+
* @internal
|
|
1461
|
+
*/
|
|
1438
1462
|
//#endregion
|
|
1439
1463
|
//#region src/utils/unicode.d.ts
|
|
1440
1464
|
/**
|
|
1441
|
-
* @internal
|
|
1442
|
-
*/
|
|
1443
|
-
declare const OBJECT_REPLACEMENT_CHARACTER = "
|
|
1465
|
+
* @internal
|
|
1466
|
+
*/
|
|
1467
|
+
declare const OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
|
|
1444
1468
|
//#endregion
|
|
1445
1469
|
//#region src/utils/with-skip-code-block.d.ts
|
|
1446
1470
|
/**
|
|
1447
|
-
* @internal
|
|
1448
|
-
*/
|
|
1471
|
+
* @internal
|
|
1472
|
+
*/
|
|
1449
1473
|
declare function withSkipCodeBlock(command: Command): Command;
|
|
1450
1474
|
//#endregion
|
|
1451
|
-
export { AddMarkOptions, AnyAttrs, AnyFunction, AttrSpec, BaseCommandsExtension, BaseKeymapExtension, BaseNodeViewOptions, ClickHandler, ClickOnHandler, ClipboardSerializerOptions, CommandAction, CommandTyping, DOMDocumentOptions, DOMEventHandler, DOMParserOptions, DOMSerializerOptions, DefaultStateOptions, DocChangeHandler, DocExtension, DoubleClickHandler, DoubleClickOnHandler, DropHandler, Editor, EditorEventPayload, EditorNotFoundError, EditorOptions, ExpandMarkOptions, Extension, ExtensionTyping, ExtractCommandActions, ExtractCommandAppliers, ExtractCommandCreators, ExtractMarkActions, ExtractMarks, ExtractNodeActions, ExtractNodes, Facet, FindParentNodeResult, FocusChangeHandler, HistoryExtension, HistoryOptions, InsertDefaultBlockOptions, InsertNodeOptions, JSONParserOptions, KeyDownHandler, KeyPressHandler, Keymap, KeymapPayload, MarkAction, MarkAttrOptions, MarkBuilder, MarkSpecOptions, MarkTyping, MarkViewComponentOptions, MarkViewFactoryOptions, MarkViewOptions, MountHandler, NodeAction, NodeAttrOptions, NodeBuilder, NodeChild, NodeContent, NodeJSON, NodeSpecOptions, NodeTyping, NodeViewComponentOptions, NodeViewFactoryOptions, NodeViewOptions, OBJECT_REPLACEMENT_CHARACTER, ParagraphExtension, PasteHandler, PickSubType, PlainExtension, PluginPayload, Priority, ProseKitError, RemoveMarkOptions, RemoveNodeOptions, ScrollToSelectionHandler, SelectionJSON, SetBlockTypeOptions, SetNodeAttrsOptions, SimplifyDeeper, SimplifyUnion, StateJSON, StepJSON, TextExtension, TextInputHandler, ToMarkAction, ToNodeAction, ToggleMarkOptions, ToggleNodeOptions, ToggleWrapOptions, TripleClickHandler, TripleClickOnHandler, Union, UnionExtension, UnmountHandler, UnsetBlockTypeOptions, UnsetMarkOptions, UpdateHandler, WrapOptions, getId as _getId, addMark, assert, canUseRegexLookbehind, clsx, collectChildren, collectNodes, containsInlineNode, createEditor, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClickHandler, defineClickOnHandler, defineClipboardSerializer, defineCommands, defineDOMEventHandler, defineDefaultState, defineDoc, defineDocChangeHandler, defineDoubleClickHandler, defineDoubleClickOnHandler, defineDropHandler, defineFacet, defineFacetPayload, defineFocusChangeHandler, defineHistory, defineKeyDownHandler, defineKeyPressHandler, defineKeymap, defineMarkAttr, defineMarkSpec, defineMarkView, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeAttr, defineNodeSpec, defineNodeView, defineNodeViewComponent, defineNodeViewFactory, defineParagraph, definePasteHandler, definePlugin, defineScrollToSelectionHandler, defineText, defineTextInputHandler, defineTripleClickHandler, defineTripleClickOnHandler, defineUnmountHandler, defineUpdateHandler, editorEventFacet, elementFromJSON, elementFromNode, expandMark, findParentNode, findParentNodeOfType, getMarkType, getNodeType, htmlFromJSON, htmlFromNode, insertDefaultBlock, insertNode, isAllSelection, isApple, isAtBlockStart, isFragment, isInCodeBlock, isMark, isMarkAbsent, isMarkActive, isNodeSelection, isProseMirrorNode, isSelection, isSlice, isTextSelection, jsonFromHTML, jsonFromNode, jsonFromState, keymapFacet, maybeRun, nodeFromElement, nodeFromHTML, nodeFromJSON, pluginFacet, removeMark, removeNode, setBlockType, setNodeAttrs, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };
|
|
1475
|
+
export { type AddMarkOptions, type AnyAttrs, type AnyFunction, type AttrSpec, type BaseCommandsExtension, type BaseKeymapExtension, type BaseNodeViewOptions, type ClickHandler, type ClickOnHandler, type ClipboardSerializerOptions, type CommandAction, type CommandTyping, type DOMDocumentOptions, type DOMEventHandler, type DOMParserOptions, type DOMSerializerOptions, type DefaultStateOptions, type DocChangeHandler, type DocExtension, type DoubleClickHandler, type DoubleClickOnHandler, type DropHandler, Editor, type EditorEventPayload, EditorNotFoundError, type EditorOptions, type ExpandMarkOptions, type Extension, type ExtensionTyping, type ExtractCommandActions, type ExtractCommandAppliers, type ExtractCommandCreators, type ExtractCommands, type ExtractMarkActions, type ExtractMarks, type ExtractNodeActions, type ExtractNodes, type ExtractTyping, type Facet, type FindParentNodeResult, type FocusChangeHandler, type HistoryExtension, type HistoryOptions, type InsertDefaultBlockOptions, type InsertNodeOptions, type JSONParserOptions, type KeyDownHandler, type KeyPressHandler, type Keymap, type KeymapPayload, type MarkAction, type MarkAttrOptions, type MarkBuilder, type MarkSpecOptions, type MarkTyping, type MarkViewComponentOptions, type MarkViewFactoryOptions, type MarkViewOptions, type MountHandler, type NodeAction, type NodeAttrOptions, type NodeBuilder, type NodeChild, type NodeContent, type NodeJSON, type NodeSpecOptions, type NodeTyping, type NodeViewComponentOptions, type NodeViewFactoryOptions, type NodeViewOptions, OBJECT_REPLACEMENT_CHARACTER, type ParagraphExtension, type PasteHandler, type PickSubType, type PlainExtension, type PluginPayload, Priority, ProseKitError, type RemoveMarkOptions, type RemoveNodeOptions, type ScrollToSelectionHandler, type SelectionJSON, type SetBlockTypeOptions, type SetNodeAttrsOptions, type SimplifyDeeper, type SimplifyUnion, type StateJSON, type StepJSON, type TextExtension, type TextInputHandler, type ToMarkAction, type ToNodeAction, type ToggleMarkOptions, type ToggleNodeOptions, type ToggleWrapOptions, type TripleClickHandler, type TripleClickOnHandler, type Union, type UnionExtension, type UnmountHandler, type UnsetBlockTypeOptions, type UnsetMarkOptions, type UpdateHandler, type WrapOptions, getId as _getId, addMark, assert, canUseRegexLookbehind, clsx, collectChildren, collectNodes, containsInlineNode, createEditor, defaultBlockAt, defineBaseCommands, defineBaseKeymap, defineClickHandler, defineClickOnHandler, defineClipboardSerializer, defineCommands, defineDOMEventHandler, defineDefaultState, defineDoc, defineDocChangeHandler, defineDoubleClickHandler, defineDoubleClickOnHandler, defineDropHandler, defineFacet, defineFacetPayload, defineFocusChangeHandler, defineHistory, defineKeyDownHandler, defineKeyPressHandler, defineKeymap, defineMarkAttr, defineMarkSpec, defineMarkView, defineMarkViewComponent, defineMarkViewFactory, defineMountHandler, defineNodeAttr, defineNodeSpec, defineNodeView, defineNodeViewComponent, defineNodeViewFactory, defineParagraph, definePasteHandler, definePlugin, defineScrollToSelectionHandler, defineText, defineTextInputHandler, defineTripleClickHandler, defineTripleClickOnHandler, defineUnmountHandler, defineUpdateHandler, editorEventFacet, elementFromJSON, elementFromNode, expandMark, findParentNode, findParentNodeOfType, getMarkType, getNodeType, htmlFromJSON, htmlFromNode, insertDefaultBlock, insertNode, isAllSelection, isApple, isAtBlockStart, isFragment, isInCodeBlock, isMark, isMarkAbsent, isMarkActive, isNodeSelection, isProseMirrorNode, isSelection, isSlice, isTextSelection, jsonFromHTML, jsonFromNode, jsonFromState, keymapFacet, maybeRun, nodeFromElement, nodeFromHTML, nodeFromJSON, pluginFacet, removeMark, removeNode, setBlockType, setNodeAttrs, setSelectionAround, stateFromJSON, toggleMark, toggleNode, toggleWrap, union, unsetBlockType, unsetMark, withPriority, withSkipCodeBlock, wrap };
|
|
1476
|
+
//# sourceMappingURL=prosekit-core.d.ts.map
|