@tiptap/core 2.0.0-beta.213 → 2.0.0-beta.215
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/index.cjs +3931 -3960
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +3857 -3962
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +4280 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/packages/core/src/CommandManager.d.ts +20 -0
- package/dist/packages/core/src/Editor.d.ts +147 -0
- package/dist/packages/core/src/EventEmitter.d.ts +11 -0
- package/dist/packages/core/src/Extension.d.ts +227 -0
- package/dist/packages/core/src/ExtensionManager.d.ts +18 -0
- package/dist/packages/core/src/InputRule.d.ts +42 -0
- package/dist/packages/core/src/Mark.d.ts +327 -0
- package/dist/packages/core/src/Node.d.ts +397 -0
- package/dist/packages/core/src/NodeView.d.ts +27 -0
- package/dist/packages/core/src/PasteRule.d.ts +42 -0
- package/dist/packages/core/src/Tracker.d.ts +11 -0
- package/dist/packages/core/src/commands/blur.d.ts +12 -0
- package/dist/packages/core/src/commands/clearContent.d.ts +12 -0
- package/dist/packages/core/src/commands/clearNodes.d.ts +12 -0
- package/dist/packages/core/src/commands/command.d.ts +12 -0
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +12 -0
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +12 -0
- package/dist/packages/core/src/commands/deleteNode.d.ts +13 -0
- package/dist/packages/core/src/commands/deleteRange.d.ts +12 -0
- package/dist/packages/core/src/commands/deleteSelection.d.ts +12 -0
- package/dist/packages/core/src/commands/enter.d.ts +12 -0
- package/dist/packages/core/src/commands/exitCode.d.ts +12 -0
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +13 -0
- package/dist/packages/core/src/commands/first.d.ts +12 -0
- package/dist/packages/core/src/commands/focus.d.ts +14 -0
- package/dist/packages/core/src/commands/forEach.d.ts +14 -0
- package/dist/packages/core/src/commands/index.d.ts +50 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +16 -0
- package/dist/packages/core/src/commands/insertContentAt.d.ts +16 -0
- package/dist/packages/core/src/commands/join.d.ts +33 -0
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +12 -0
- package/dist/packages/core/src/commands/lift.d.ts +13 -0
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +12 -0
- package/dist/packages/core/src/commands/liftListItem.d.ts +13 -0
- package/dist/packages/core/src/commands/newlineInCode.d.ts +12 -0
- package/dist/packages/core/src/commands/resetAttributes.d.ts +13 -0
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +12 -0
- package/dist/packages/core/src/commands/selectAll.d.ts +12 -0
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +12 -0
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +12 -0
- package/dist/packages/core/src/commands/selectParentNode.d.ts +12 -0
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +12 -0
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +12 -0
- package/dist/packages/core/src/commands/setContent.d.ts +13 -0
- package/dist/packages/core/src/commands/setMark.d.ts +13 -0
- package/dist/packages/core/src/commands/setMeta.d.ts +12 -0
- package/dist/packages/core/src/commands/setNode.d.ts +13 -0
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +12 -0
- package/dist/packages/core/src/commands/setTextSelection.d.ts +12 -0
- package/dist/packages/core/src/commands/sinkListItem.d.ts +13 -0
- package/dist/packages/core/src/commands/splitBlock.d.ts +14 -0
- package/dist/packages/core/src/commands/splitListItem.d.ts +13 -0
- package/dist/packages/core/src/commands/toggleList.d.ts +13 -0
- package/dist/packages/core/src/commands/toggleMark.d.ts +18 -0
- package/dist/packages/core/src/commands/toggleNode.d.ts +13 -0
- package/dist/packages/core/src/commands/toggleWrap.d.ts +13 -0
- package/dist/packages/core/src/commands/undoInputRule.d.ts +12 -0
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +12 -0
- package/dist/packages/core/src/commands/unsetMark.d.ts +18 -0
- package/dist/packages/core/src/commands/updateAttributes.d.ts +13 -0
- package/dist/packages/core/src/commands/wrapIn.d.ts +13 -0
- package/dist/packages/core/src/commands/wrapInList.d.ts +13 -0
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +2 -0
- package/dist/packages/core/src/extensions/commands.d.ts +3 -0
- package/dist/packages/core/src/extensions/editable.d.ts +2 -0
- package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
- package/dist/packages/core/src/extensions/index.d.ts +6 -0
- package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
- package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +7 -0
- package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
- package/dist/packages/core/src/helpers/createDocument.d.ts +3 -0
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +7 -0
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +2 -0
- package/dist/packages/core/src/helpers/findChildren.d.ts +3 -0
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +6 -0
- package/dist/packages/core/src/helpers/findParentNode.d.ts +8 -0
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +8 -0
- package/dist/packages/core/src/helpers/generateHTML.d.ts +2 -0
- package/dist/packages/core/src/helpers/generateJSON.d.ts +2 -0
- package/dist/packages/core/src/helpers/generateText.d.ts +5 -0
- package/dist/packages/core/src/helpers/getAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +2 -0
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
- package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchema.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +2 -0
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +2 -0
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +2 -0
- package/dist/packages/core/src/helpers/getText.d.ts +6 -0
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +6 -0
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +2 -0
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +3 -0
- package/dist/packages/core/src/helpers/index.d.ts +33 -0
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
- package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
- package/dist/packages/core/src/helpers/isList.d.ts +2 -0
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
- package/dist/packages/core/src/index.d.ts +23 -0
- package/dist/packages/core/src/inputRules/index.d.ts +5 -0
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +12 -0
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +12 -0
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +9 -0
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +14 -0
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +23 -0
- package/dist/packages/core/src/pasteRules/index.d.ts +3 -0
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +12 -0
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +12 -0
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
- package/dist/packages/core/src/style.d.ts +1 -0
- package/dist/packages/core/src/types.d.ts +214 -0
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
- package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
- package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -0
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/index.d.ts +20 -0
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
- package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
- package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
- package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
- package/dist/packages/core/src/utilities/isString.d.ts +1 -0
- package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
- package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
- package/package.json +7 -16
- package/dist/index.d.ts +0 -2330
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { DOMOutputSpec, Node as ProseMirrorNode, NodeSpec, NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { Plugin, Transaction } from '@tiptap/pm/state';
|
|
3
|
+
import { NodeConfig } from '.';
|
|
4
|
+
import { Editor } from './Editor';
|
|
5
|
+
import { InputRule } from './InputRule';
|
|
6
|
+
import { PasteRule } from './PasteRule';
|
|
7
|
+
import { Attributes, Extensions, GlobalAttributes, KeyboardShortcutCommand, NodeViewRenderer, ParentConfig, RawCommands } from './types';
|
|
8
|
+
declare module '@tiptap/core' {
|
|
9
|
+
interface NodeConfig<Options = any, Storage = any> {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
/**
|
|
12
|
+
* Name
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Priority
|
|
17
|
+
*/
|
|
18
|
+
priority?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Default options
|
|
21
|
+
*/
|
|
22
|
+
defaultOptions?: Options;
|
|
23
|
+
/**
|
|
24
|
+
* Default Options
|
|
25
|
+
*/
|
|
26
|
+
addOptions?: (this: {
|
|
27
|
+
name: string;
|
|
28
|
+
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addOptions'], undefined>;
|
|
29
|
+
}) => Options;
|
|
30
|
+
/**
|
|
31
|
+
* Default Storage
|
|
32
|
+
*/
|
|
33
|
+
addStorage?: (this: {
|
|
34
|
+
name: string;
|
|
35
|
+
options: Options;
|
|
36
|
+
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addStorage'], undefined>;
|
|
37
|
+
}) => Storage;
|
|
38
|
+
/**
|
|
39
|
+
* Global attributes
|
|
40
|
+
*/
|
|
41
|
+
addGlobalAttributes?: (this: {
|
|
42
|
+
name: string;
|
|
43
|
+
options: Options;
|
|
44
|
+
storage: Storage;
|
|
45
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addGlobalAttributes'];
|
|
46
|
+
}) => GlobalAttributes | {};
|
|
47
|
+
/**
|
|
48
|
+
* Raw
|
|
49
|
+
*/
|
|
50
|
+
addCommands?: (this: {
|
|
51
|
+
name: string;
|
|
52
|
+
options: Options;
|
|
53
|
+
storage: Storage;
|
|
54
|
+
editor: Editor;
|
|
55
|
+
type: NodeType;
|
|
56
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addCommands'];
|
|
57
|
+
}) => Partial<RawCommands>;
|
|
58
|
+
/**
|
|
59
|
+
* Keyboard shortcuts
|
|
60
|
+
*/
|
|
61
|
+
addKeyboardShortcuts?: (this: {
|
|
62
|
+
name: string;
|
|
63
|
+
options: Options;
|
|
64
|
+
storage: Storage;
|
|
65
|
+
editor: Editor;
|
|
66
|
+
type: NodeType;
|
|
67
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
68
|
+
}) => {
|
|
69
|
+
[key: string]: KeyboardShortcutCommand;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Input rules
|
|
73
|
+
*/
|
|
74
|
+
addInputRules?: (this: {
|
|
75
|
+
name: string;
|
|
76
|
+
options: Options;
|
|
77
|
+
storage: Storage;
|
|
78
|
+
editor: Editor;
|
|
79
|
+
type: NodeType;
|
|
80
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addInputRules'];
|
|
81
|
+
}) => InputRule[];
|
|
82
|
+
/**
|
|
83
|
+
* Paste rules
|
|
84
|
+
*/
|
|
85
|
+
addPasteRules?: (this: {
|
|
86
|
+
name: string;
|
|
87
|
+
options: Options;
|
|
88
|
+
storage: Storage;
|
|
89
|
+
editor: Editor;
|
|
90
|
+
type: NodeType;
|
|
91
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addPasteRules'];
|
|
92
|
+
}) => PasteRule[];
|
|
93
|
+
/**
|
|
94
|
+
* ProseMirror plugins
|
|
95
|
+
*/
|
|
96
|
+
addProseMirrorPlugins?: (this: {
|
|
97
|
+
name: string;
|
|
98
|
+
options: Options;
|
|
99
|
+
storage: Storage;
|
|
100
|
+
editor: Editor;
|
|
101
|
+
type: NodeType;
|
|
102
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
103
|
+
}) => Plugin[];
|
|
104
|
+
/**
|
|
105
|
+
* Extensions
|
|
106
|
+
*/
|
|
107
|
+
addExtensions?: (this: {
|
|
108
|
+
name: string;
|
|
109
|
+
options: Options;
|
|
110
|
+
storage: Storage;
|
|
111
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addExtensions'];
|
|
112
|
+
}) => Extensions;
|
|
113
|
+
/**
|
|
114
|
+
* Extend Node Schema
|
|
115
|
+
*/
|
|
116
|
+
extendNodeSchema?: ((this: {
|
|
117
|
+
name: string;
|
|
118
|
+
options: Options;
|
|
119
|
+
storage: Storage;
|
|
120
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['extendNodeSchema'];
|
|
121
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
122
|
+
/**
|
|
123
|
+
* Extend Mark Schema
|
|
124
|
+
*/
|
|
125
|
+
extendMarkSchema?: ((this: {
|
|
126
|
+
name: string;
|
|
127
|
+
options: Options;
|
|
128
|
+
storage: Storage;
|
|
129
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['extendMarkSchema'];
|
|
130
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
131
|
+
/**
|
|
132
|
+
* The editor is not ready yet.
|
|
133
|
+
*/
|
|
134
|
+
onBeforeCreate?: ((this: {
|
|
135
|
+
name: string;
|
|
136
|
+
options: Options;
|
|
137
|
+
storage: Storage;
|
|
138
|
+
editor: Editor;
|
|
139
|
+
type: NodeType;
|
|
140
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onBeforeCreate'];
|
|
141
|
+
}) => void) | null;
|
|
142
|
+
/**
|
|
143
|
+
* The editor is ready.
|
|
144
|
+
*/
|
|
145
|
+
onCreate?: ((this: {
|
|
146
|
+
name: string;
|
|
147
|
+
options: Options;
|
|
148
|
+
storage: Storage;
|
|
149
|
+
editor: Editor;
|
|
150
|
+
type: NodeType;
|
|
151
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onCreate'];
|
|
152
|
+
}) => void) | null;
|
|
153
|
+
/**
|
|
154
|
+
* The content has changed.
|
|
155
|
+
*/
|
|
156
|
+
onUpdate?: ((this: {
|
|
157
|
+
name: string;
|
|
158
|
+
options: Options;
|
|
159
|
+
storage: Storage;
|
|
160
|
+
editor: Editor;
|
|
161
|
+
type: NodeType;
|
|
162
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onUpdate'];
|
|
163
|
+
}) => void) | null;
|
|
164
|
+
/**
|
|
165
|
+
* The selection has changed.
|
|
166
|
+
*/
|
|
167
|
+
onSelectionUpdate?: ((this: {
|
|
168
|
+
name: string;
|
|
169
|
+
options: Options;
|
|
170
|
+
storage: Storage;
|
|
171
|
+
editor: Editor;
|
|
172
|
+
type: NodeType;
|
|
173
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onSelectionUpdate'];
|
|
174
|
+
}) => void) | null;
|
|
175
|
+
/**
|
|
176
|
+
* The editor state has changed.
|
|
177
|
+
*/
|
|
178
|
+
onTransaction?: ((this: {
|
|
179
|
+
name: string;
|
|
180
|
+
options: Options;
|
|
181
|
+
storage: Storage;
|
|
182
|
+
editor: Editor;
|
|
183
|
+
type: NodeType;
|
|
184
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onTransaction'];
|
|
185
|
+
}, props: {
|
|
186
|
+
transaction: Transaction;
|
|
187
|
+
}) => void) | null;
|
|
188
|
+
/**
|
|
189
|
+
* The editor is focused.
|
|
190
|
+
*/
|
|
191
|
+
onFocus?: ((this: {
|
|
192
|
+
name: string;
|
|
193
|
+
options: Options;
|
|
194
|
+
storage: Storage;
|
|
195
|
+
editor: Editor;
|
|
196
|
+
type: NodeType;
|
|
197
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onFocus'];
|
|
198
|
+
}, props: {
|
|
199
|
+
event: FocusEvent;
|
|
200
|
+
}) => void) | null;
|
|
201
|
+
/**
|
|
202
|
+
* The editor isn’t focused anymore.
|
|
203
|
+
*/
|
|
204
|
+
onBlur?: ((this: {
|
|
205
|
+
name: string;
|
|
206
|
+
options: Options;
|
|
207
|
+
storage: Storage;
|
|
208
|
+
editor: Editor;
|
|
209
|
+
type: NodeType;
|
|
210
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onBlur'];
|
|
211
|
+
}, props: {
|
|
212
|
+
event: FocusEvent;
|
|
213
|
+
}) => void) | null;
|
|
214
|
+
/**
|
|
215
|
+
* The editor is destroyed.
|
|
216
|
+
*/
|
|
217
|
+
onDestroy?: ((this: {
|
|
218
|
+
name: string;
|
|
219
|
+
options: Options;
|
|
220
|
+
storage: Storage;
|
|
221
|
+
editor: Editor;
|
|
222
|
+
type: NodeType;
|
|
223
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onDestroy'];
|
|
224
|
+
}) => void) | null;
|
|
225
|
+
/**
|
|
226
|
+
* Node View
|
|
227
|
+
*/
|
|
228
|
+
addNodeView?: ((this: {
|
|
229
|
+
name: string;
|
|
230
|
+
options: Options;
|
|
231
|
+
storage: Storage;
|
|
232
|
+
editor: Editor;
|
|
233
|
+
type: NodeType;
|
|
234
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addNodeView'];
|
|
235
|
+
}) => NodeViewRenderer) | null;
|
|
236
|
+
/**
|
|
237
|
+
* TopNode
|
|
238
|
+
*/
|
|
239
|
+
topNode?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Content
|
|
242
|
+
*/
|
|
243
|
+
content?: NodeSpec['content'] | ((this: {
|
|
244
|
+
name: string;
|
|
245
|
+
options: Options;
|
|
246
|
+
storage: Storage;
|
|
247
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['content'];
|
|
248
|
+
}) => NodeSpec['content']);
|
|
249
|
+
/**
|
|
250
|
+
* Marks
|
|
251
|
+
*/
|
|
252
|
+
marks?: NodeSpec['marks'] | ((this: {
|
|
253
|
+
name: string;
|
|
254
|
+
options: Options;
|
|
255
|
+
storage: Storage;
|
|
256
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['marks'];
|
|
257
|
+
}) => NodeSpec['marks']);
|
|
258
|
+
/**
|
|
259
|
+
* Group
|
|
260
|
+
*/
|
|
261
|
+
group?: NodeSpec['group'] | ((this: {
|
|
262
|
+
name: string;
|
|
263
|
+
options: Options;
|
|
264
|
+
storage: Storage;
|
|
265
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['group'];
|
|
266
|
+
}) => NodeSpec['group']);
|
|
267
|
+
/**
|
|
268
|
+
* Inline
|
|
269
|
+
*/
|
|
270
|
+
inline?: NodeSpec['inline'] | ((this: {
|
|
271
|
+
name: string;
|
|
272
|
+
options: Options;
|
|
273
|
+
storage: Storage;
|
|
274
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['inline'];
|
|
275
|
+
}) => NodeSpec['inline']);
|
|
276
|
+
/**
|
|
277
|
+
* Atom
|
|
278
|
+
*/
|
|
279
|
+
atom?: NodeSpec['atom'] | ((this: {
|
|
280
|
+
name: string;
|
|
281
|
+
options: Options;
|
|
282
|
+
storage: Storage;
|
|
283
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['atom'];
|
|
284
|
+
}) => NodeSpec['atom']);
|
|
285
|
+
/**
|
|
286
|
+
* Selectable
|
|
287
|
+
*/
|
|
288
|
+
selectable?: NodeSpec['selectable'] | ((this: {
|
|
289
|
+
name: string;
|
|
290
|
+
options: Options;
|
|
291
|
+
storage: Storage;
|
|
292
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['selectable'];
|
|
293
|
+
}) => NodeSpec['selectable']);
|
|
294
|
+
/**
|
|
295
|
+
* Draggable
|
|
296
|
+
*/
|
|
297
|
+
draggable?: NodeSpec['draggable'] | ((this: {
|
|
298
|
+
name: string;
|
|
299
|
+
options: Options;
|
|
300
|
+
storage: Storage;
|
|
301
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['draggable'];
|
|
302
|
+
}) => NodeSpec['draggable']);
|
|
303
|
+
/**
|
|
304
|
+
* Code
|
|
305
|
+
*/
|
|
306
|
+
code?: NodeSpec['code'] | ((this: {
|
|
307
|
+
name: string;
|
|
308
|
+
options: Options;
|
|
309
|
+
storage: Storage;
|
|
310
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['code'];
|
|
311
|
+
}) => NodeSpec['code']);
|
|
312
|
+
/**
|
|
313
|
+
* Whitespace
|
|
314
|
+
*/
|
|
315
|
+
whitespace?: NodeSpec['whitespace'] | ((this: {
|
|
316
|
+
name: string;
|
|
317
|
+
options: Options;
|
|
318
|
+
storage: Storage;
|
|
319
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['whitespace'];
|
|
320
|
+
}) => NodeSpec['whitespace']);
|
|
321
|
+
/**
|
|
322
|
+
* Defining
|
|
323
|
+
*/
|
|
324
|
+
defining?: NodeSpec['defining'] | ((this: {
|
|
325
|
+
name: string;
|
|
326
|
+
options: Options;
|
|
327
|
+
storage: Storage;
|
|
328
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['defining'];
|
|
329
|
+
}) => NodeSpec['defining']);
|
|
330
|
+
/**
|
|
331
|
+
* Isolating
|
|
332
|
+
*/
|
|
333
|
+
isolating?: NodeSpec['isolating'] | ((this: {
|
|
334
|
+
name: string;
|
|
335
|
+
options: Options;
|
|
336
|
+
storage: Storage;
|
|
337
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['isolating'];
|
|
338
|
+
}) => NodeSpec['isolating']);
|
|
339
|
+
/**
|
|
340
|
+
* Parse HTML
|
|
341
|
+
*/
|
|
342
|
+
parseHTML?: (this: {
|
|
343
|
+
name: string;
|
|
344
|
+
options: Options;
|
|
345
|
+
storage: Storage;
|
|
346
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['parseHTML'];
|
|
347
|
+
}) => NodeSpec['parseDOM'];
|
|
348
|
+
/**
|
|
349
|
+
* Render HTML
|
|
350
|
+
*/
|
|
351
|
+
renderHTML?: ((this: {
|
|
352
|
+
name: string;
|
|
353
|
+
options: Options;
|
|
354
|
+
storage: Storage;
|
|
355
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['renderHTML'];
|
|
356
|
+
}, props: {
|
|
357
|
+
node: ProseMirrorNode;
|
|
358
|
+
HTMLAttributes: Record<string, any>;
|
|
359
|
+
}) => DOMOutputSpec) | null;
|
|
360
|
+
/**
|
|
361
|
+
* Render Text
|
|
362
|
+
*/
|
|
363
|
+
renderText?: ((this: {
|
|
364
|
+
name: string;
|
|
365
|
+
options: Options;
|
|
366
|
+
storage: Storage;
|
|
367
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['renderText'];
|
|
368
|
+
}, props: {
|
|
369
|
+
node: ProseMirrorNode;
|
|
370
|
+
pos: number;
|
|
371
|
+
parent: ProseMirrorNode;
|
|
372
|
+
index: number;
|
|
373
|
+
}) => string) | null;
|
|
374
|
+
/**
|
|
375
|
+
* Add Attributes
|
|
376
|
+
*/
|
|
377
|
+
addAttributes?: (this: {
|
|
378
|
+
name: string;
|
|
379
|
+
options: Options;
|
|
380
|
+
storage: Storage;
|
|
381
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
|
|
382
|
+
}) => Attributes | {};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
export declare class Node<Options = any, Storage = any> {
|
|
386
|
+
type: string;
|
|
387
|
+
name: string;
|
|
388
|
+
parent: Node | null;
|
|
389
|
+
child: Node | null;
|
|
390
|
+
options: Options;
|
|
391
|
+
storage: Storage;
|
|
392
|
+
config: NodeConfig;
|
|
393
|
+
constructor(config?: Partial<NodeConfig<Options, Storage>>);
|
|
394
|
+
static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>>): Node<O, S>;
|
|
395
|
+
configure(options?: Partial<Options>): Node<Options, Storage>;
|
|
396
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>): Node<ExtendedOptions, ExtendedStorage>;
|
|
397
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view';
|
|
3
|
+
import { Editor as CoreEditor } from './Editor';
|
|
4
|
+
import { Node } from './Node';
|
|
5
|
+
import { NodeViewRendererOptions, NodeViewRendererProps } from './types';
|
|
6
|
+
export declare class NodeView<Component, NodeEditor extends CoreEditor = CoreEditor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> implements ProseMirrorNodeView {
|
|
7
|
+
component: Component;
|
|
8
|
+
editor: NodeEditor;
|
|
9
|
+
options: Options;
|
|
10
|
+
extension: Node;
|
|
11
|
+
node: ProseMirrorNode;
|
|
12
|
+
decorations: Decoration[];
|
|
13
|
+
getPos: any;
|
|
14
|
+
isDragging: boolean;
|
|
15
|
+
constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
|
|
16
|
+
mount(): void;
|
|
17
|
+
get dom(): HTMLElement;
|
|
18
|
+
get contentDOM(): HTMLElement | null;
|
|
19
|
+
onDragStart(event: DragEvent): void;
|
|
20
|
+
stopEvent(event: Event): boolean;
|
|
21
|
+
ignoreMutation(mutation: MutationRecord | {
|
|
22
|
+
type: 'selection';
|
|
23
|
+
target: Element;
|
|
24
|
+
}): boolean;
|
|
25
|
+
updateAttributes(attributes: {}): void;
|
|
26
|
+
deleteNode(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EditorState, Plugin } from '@tiptap/pm/state';
|
|
2
|
+
import { Editor } from './Editor';
|
|
3
|
+
import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types';
|
|
4
|
+
export declare type PasteRuleMatch = {
|
|
5
|
+
index: number;
|
|
6
|
+
text: string;
|
|
7
|
+
replaceWith?: string;
|
|
8
|
+
match?: RegExpMatchArray;
|
|
9
|
+
data?: Record<string, any>;
|
|
10
|
+
};
|
|
11
|
+
export declare type PasteRuleFinder = RegExp | ((text: string) => PasteRuleMatch[] | null | undefined);
|
|
12
|
+
export declare class PasteRule {
|
|
13
|
+
find: PasteRuleFinder;
|
|
14
|
+
handler: (props: {
|
|
15
|
+
state: EditorState;
|
|
16
|
+
range: Range;
|
|
17
|
+
match: ExtendedRegExpMatchArray;
|
|
18
|
+
commands: SingleCommands;
|
|
19
|
+
chain: () => ChainedCommands;
|
|
20
|
+
can: () => CanCommands;
|
|
21
|
+
}) => void | null;
|
|
22
|
+
constructor(config: {
|
|
23
|
+
find: PasteRuleFinder;
|
|
24
|
+
handler: (props: {
|
|
25
|
+
state: EditorState;
|
|
26
|
+
range: Range;
|
|
27
|
+
match: ExtendedRegExpMatchArray;
|
|
28
|
+
commands: SingleCommands;
|
|
29
|
+
chain: () => ChainedCommands;
|
|
30
|
+
can: () => CanCommands;
|
|
31
|
+
}) => void | null;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create an paste rules plugin. When enabled, it will cause pasted
|
|
36
|
+
* text that matches any of the given rules to trigger the rule’s
|
|
37
|
+
* action.
|
|
38
|
+
*/
|
|
39
|
+
export declare function pasteRulesPlugin(props: {
|
|
40
|
+
editor: Editor;
|
|
41
|
+
rules: PasteRule[];
|
|
42
|
+
}): Plugin[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Transaction } from '@tiptap/pm/state';
|
|
2
|
+
export interface TrackerResult {
|
|
3
|
+
position: number;
|
|
4
|
+
deleted: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class Tracker {
|
|
7
|
+
transaction: Transaction;
|
|
8
|
+
currentStep: number;
|
|
9
|
+
constructor(transaction: Transaction);
|
|
10
|
+
map(position: number): TrackerResult;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
clearContent: {
|
|
5
|
+
/**
|
|
6
|
+
* Clear the whole document.
|
|
7
|
+
*/
|
|
8
|
+
clearContent: (emitUpdate?: boolean) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const clearContent: RawCommands['clearContent'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
clearNodes: {
|
|
5
|
+
/**
|
|
6
|
+
* Normalize nodes to a simple paragraph.
|
|
7
|
+
*/
|
|
8
|
+
clearNodes: () => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const clearNodes: RawCommands['clearNodes'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command, RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
command: {
|
|
5
|
+
/**
|
|
6
|
+
* Define a command inline.
|
|
7
|
+
*/
|
|
8
|
+
command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const command: RawCommands['command'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
createParagraphNear: {
|
|
5
|
+
/**
|
|
6
|
+
* Create a paragraph nearby.
|
|
7
|
+
*/
|
|
8
|
+
createParagraphNear: () => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const createParagraphNear: RawCommands['createParagraphNear'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
deleteCurrentNode: {
|
|
5
|
+
/**
|
|
6
|
+
* Delete the node that currently has the selection anchor.
|
|
7
|
+
*/
|
|
8
|
+
deleteCurrentNode: () => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const deleteCurrentNode: RawCommands['deleteCurrentNode'];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { RawCommands } from '../types';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
deleteNode: {
|
|
6
|
+
/**
|
|
7
|
+
* Delete a node.
|
|
8
|
+
*/
|
|
9
|
+
deleteNode: (typeOrName: string | NodeType) => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const deleteNode: RawCommands['deleteNode'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Range, RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
deleteRange: {
|
|
5
|
+
/**
|
|
6
|
+
* Delete a given range.
|
|
7
|
+
*/
|
|
8
|
+
deleteRange: (range: Range) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const deleteRange: RawCommands['deleteRange'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
deleteSelection: {
|
|
5
|
+
/**
|
|
6
|
+
* Delete the selection, if there is one.
|
|
7
|
+
*/
|
|
8
|
+
deleteSelection: () => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const deleteSelection: RawCommands['deleteSelection'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
exitCode: {
|
|
5
|
+
/**
|
|
6
|
+
* Exit from a code block.
|
|
7
|
+
*/
|
|
8
|
+
exitCode: () => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const exitCode: RawCommands['exitCode'];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MarkType } from '@tiptap/pm/model';
|
|
2
|
+
import { RawCommands } from '../types';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
extendMarkRange: {
|
|
6
|
+
/**
|
|
7
|
+
* Extends the text selection to the current mark.
|
|
8
|
+
*/
|
|
9
|
+
extendMarkRange: (typeOrName: string | MarkType, attributes?: Record<string, any>) => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const extendMarkRange: RawCommands['extendMarkRange'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command, CommandProps, RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
first: {
|
|
5
|
+
/**
|
|
6
|
+
* Runs one command after the other and stops at the first which returns true.
|
|
7
|
+
*/
|
|
8
|
+
first: (commands: Command[] | ((props: CommandProps) => Command[])) => ReturnType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const first: RawCommands['first'];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FocusPosition, RawCommands } from '../types';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
focus: {
|
|
5
|
+
/**
|
|
6
|
+
* Focus the editor at the given position.
|
|
7
|
+
*/
|
|
8
|
+
focus: (position?: FocusPosition, options?: {
|
|
9
|
+
scrollIntoView?: boolean;
|
|
10
|
+
}) => ReturnType;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const focus: RawCommands['focus'];
|