@tiptap/core 3.0.0-next.4 → 3.0.0-next.6
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/LICENSE.md +1 -1
- package/dist/index.cjs +352 -238
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1084 -1431
- package/dist/index.d.ts +1084 -1431
- package/dist/index.js +344 -235
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime/jsx-runtime.cjs +56 -0
- package/dist/jsx-runtime/jsx-runtime.cjs.map +1 -0
- package/dist/jsx-runtime/jsx-runtime.d.cts +22 -0
- package/dist/jsx-runtime/jsx-runtime.d.ts +22 -0
- package/dist/jsx-runtime/jsx-runtime.js +26 -0
- package/dist/jsx-runtime/jsx-runtime.js.map +1 -0
- package/jsx-runtime/index.cjs +1 -0
- package/jsx-runtime/index.d.cts +1 -0
- package/jsx-runtime/index.d.ts +1 -0
- package/jsx-runtime/index.js +1 -0
- package/package.json +20 -3
- package/src/Editor.ts +104 -22
- package/src/Extendable.ts +483 -0
- package/src/Extension.ts +5 -490
- package/src/ExtensionManager.ts +55 -10
- package/src/Mark.ts +135 -623
- package/src/MarkView.ts +66 -0
- package/src/Node.ts +325 -829
- package/src/commands/clearContent.ts +9 -4
- package/src/commands/focus.ts +7 -1
- package/src/commands/insertContentAt.ts +6 -2
- package/src/commands/setContent.ts +15 -14
- package/src/extensions/delete.ts +89 -0
- package/src/extensions/index.ts +1 -0
- package/src/extensions/keymap.ts +4 -0
- package/src/helpers/getExtensionField.ts +10 -7
- package/src/index.ts +3 -7
- package/src/jsx-runtime.ts +64 -0
- package/src/types.ts +334 -19
- package/src/utilities/elementFromString.ts +3 -0
- package/src/utilities/index.ts +1 -0
- package/src/utilities/mergeAttributes.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transaction, EditorState, Plugin, Selection, NodeSelection, TextSelection, PluginKey } from '@tiptap/pm/state';
|
|
2
|
-
import { Node as Node$1,
|
|
3
|
-
import {
|
|
2
|
+
import { Node as Node$1, MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Slice, ParseOptions, Fragment as Fragment$1, Schema, ContentMatch, ResolvedPos, ParseRule } from '@tiptap/pm/model';
|
|
3
|
+
import { EditorProps, EditorView, Decoration, DecorationAttrs, ViewMutationRecord, NodeViewConstructor, NodeView as NodeView$1, MarkViewConstructor, MarkView as MarkView$1 } from '@tiptap/pm/view';
|
|
4
4
|
import { Transform, Mappable } from '@tiptap/pm/transform';
|
|
5
5
|
|
|
6
6
|
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
@@ -73,6 +73,404 @@ declare function inputRulesPlugin(props: {
|
|
|
73
73
|
rules: InputRule[];
|
|
74
74
|
}): Plugin;
|
|
75
75
|
|
|
76
|
+
interface MarkConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, MarkConfig<Options, Storage>, MarkType$1> {
|
|
77
|
+
/**
|
|
78
|
+
* Mark View
|
|
79
|
+
*/
|
|
80
|
+
addMarkView?: ((this: {
|
|
81
|
+
name: string;
|
|
82
|
+
options: Options;
|
|
83
|
+
storage: Storage;
|
|
84
|
+
editor: Editor;
|
|
85
|
+
type: MarkType$1;
|
|
86
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addMarkView'];
|
|
87
|
+
}) => MarkViewRenderer) | null;
|
|
88
|
+
/**
|
|
89
|
+
* Keep mark after split node
|
|
90
|
+
*/
|
|
91
|
+
keepOnSplit?: boolean | (() => boolean);
|
|
92
|
+
/**
|
|
93
|
+
* Inclusive
|
|
94
|
+
*/
|
|
95
|
+
inclusive?: MarkSpec['inclusive'] | ((this: {
|
|
96
|
+
name: string;
|
|
97
|
+
options: Options;
|
|
98
|
+
storage: Storage;
|
|
99
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
|
|
100
|
+
editor?: Editor;
|
|
101
|
+
}) => MarkSpec['inclusive']);
|
|
102
|
+
/**
|
|
103
|
+
* Excludes
|
|
104
|
+
*/
|
|
105
|
+
excludes?: MarkSpec['excludes'] | ((this: {
|
|
106
|
+
name: string;
|
|
107
|
+
options: Options;
|
|
108
|
+
storage: Storage;
|
|
109
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
|
|
110
|
+
editor?: Editor;
|
|
111
|
+
}) => MarkSpec['excludes']);
|
|
112
|
+
/**
|
|
113
|
+
* Marks this Mark as exitable
|
|
114
|
+
*/
|
|
115
|
+
exitable?: boolean | (() => boolean);
|
|
116
|
+
/**
|
|
117
|
+
* Group
|
|
118
|
+
*/
|
|
119
|
+
group?: MarkSpec['group'] | ((this: {
|
|
120
|
+
name: string;
|
|
121
|
+
options: Options;
|
|
122
|
+
storage: Storage;
|
|
123
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
|
|
124
|
+
editor?: Editor;
|
|
125
|
+
}) => MarkSpec['group']);
|
|
126
|
+
/**
|
|
127
|
+
* Spanning
|
|
128
|
+
*/
|
|
129
|
+
spanning?: MarkSpec['spanning'] | ((this: {
|
|
130
|
+
name: string;
|
|
131
|
+
options: Options;
|
|
132
|
+
storage: Storage;
|
|
133
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
|
|
134
|
+
editor?: Editor;
|
|
135
|
+
}) => MarkSpec['spanning']);
|
|
136
|
+
/**
|
|
137
|
+
* Code
|
|
138
|
+
*/
|
|
139
|
+
code?: boolean | ((this: {
|
|
140
|
+
name: string;
|
|
141
|
+
options: Options;
|
|
142
|
+
storage: Storage;
|
|
143
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
|
|
144
|
+
editor?: Editor;
|
|
145
|
+
}) => boolean);
|
|
146
|
+
/**
|
|
147
|
+
* Parse HTML
|
|
148
|
+
*/
|
|
149
|
+
parseHTML?: (this: {
|
|
150
|
+
name: string;
|
|
151
|
+
options: Options;
|
|
152
|
+
storage: Storage;
|
|
153
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
|
|
154
|
+
editor?: Editor;
|
|
155
|
+
}) => MarkSpec['parseDOM'];
|
|
156
|
+
/**
|
|
157
|
+
* Render HTML
|
|
158
|
+
*/
|
|
159
|
+
renderHTML?: ((this: {
|
|
160
|
+
name: string;
|
|
161
|
+
options: Options;
|
|
162
|
+
storage: Storage;
|
|
163
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
|
|
164
|
+
editor?: Editor;
|
|
165
|
+
}, props: {
|
|
166
|
+
mark: Mark$1;
|
|
167
|
+
HTMLAttributes: Record<string, any>;
|
|
168
|
+
}) => DOMOutputSpec) | null;
|
|
169
|
+
/**
|
|
170
|
+
* Attributes
|
|
171
|
+
*/
|
|
172
|
+
addAttributes?: (this: {
|
|
173
|
+
name: string;
|
|
174
|
+
options: Options;
|
|
175
|
+
storage: Storage;
|
|
176
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
|
|
177
|
+
editor?: Editor;
|
|
178
|
+
}) => Attributes$1 | {};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The Mark class is used to create custom mark extensions.
|
|
182
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
183
|
+
*/
|
|
184
|
+
declare class Mark<Options = any, Storage = any> extends Extendable<Options, Storage> {
|
|
185
|
+
type: string;
|
|
186
|
+
static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
|
|
187
|
+
static handleExit({ editor, mark }: {
|
|
188
|
+
editor: Editor;
|
|
189
|
+
mark: Mark;
|
|
190
|
+
}): boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface NodeConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, NodeConfig<Options, Storage>, NodeType$1> {
|
|
194
|
+
/**
|
|
195
|
+
* Node View
|
|
196
|
+
*/
|
|
197
|
+
addNodeView?: ((this: {
|
|
198
|
+
name: string;
|
|
199
|
+
options: Options;
|
|
200
|
+
storage: Storage;
|
|
201
|
+
editor: Editor;
|
|
202
|
+
type: NodeType$1;
|
|
203
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addNodeView'];
|
|
204
|
+
}) => NodeViewRenderer) | null;
|
|
205
|
+
/**
|
|
206
|
+
* Defines if this node should be a top level node (doc)
|
|
207
|
+
* @default false
|
|
208
|
+
* @example true
|
|
209
|
+
*/
|
|
210
|
+
topNode?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* The content expression for this node, as described in the [schema
|
|
213
|
+
* guide](/docs/guide/#schema.content_expressions). When not given,
|
|
214
|
+
* the node does not allow any content.
|
|
215
|
+
*
|
|
216
|
+
* You can read more about it on the Prosemirror documentation here
|
|
217
|
+
* @see https://prosemirror.net/docs/guide/#schema.content_expressions
|
|
218
|
+
* @default undefined
|
|
219
|
+
* @example content: 'block+'
|
|
220
|
+
* @example content: 'headline paragraph block*'
|
|
221
|
+
*/
|
|
222
|
+
content?: NodeSpec['content'] | ((this: {
|
|
223
|
+
name: string;
|
|
224
|
+
options: Options;
|
|
225
|
+
storage: Storage;
|
|
226
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['content'];
|
|
227
|
+
editor?: Editor;
|
|
228
|
+
}) => NodeSpec['content']);
|
|
229
|
+
/**
|
|
230
|
+
* The marks that are allowed inside of this node. May be a
|
|
231
|
+
* space-separated string referring to mark names or groups, `"_"`
|
|
232
|
+
* to explicitly allow all marks, or `""` to disallow marks. When
|
|
233
|
+
* not given, nodes with inline content default to allowing all
|
|
234
|
+
* marks, other nodes default to not allowing marks.
|
|
235
|
+
*
|
|
236
|
+
* @example marks: 'strong em'
|
|
237
|
+
*/
|
|
238
|
+
marks?: NodeSpec['marks'] | ((this: {
|
|
239
|
+
name: string;
|
|
240
|
+
options: Options;
|
|
241
|
+
storage: Storage;
|
|
242
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['marks'];
|
|
243
|
+
editor?: Editor;
|
|
244
|
+
}) => NodeSpec['marks']);
|
|
245
|
+
/**
|
|
246
|
+
* The group or space-separated groups to which this node belongs,
|
|
247
|
+
* which can be referred to in the content expressions for the
|
|
248
|
+
* schema.
|
|
249
|
+
*
|
|
250
|
+
* By default Tiptap uses the groups 'block' and 'inline' for nodes. You
|
|
251
|
+
* can also use custom groups if you want to group specific nodes together
|
|
252
|
+
* and handle them in your schema.
|
|
253
|
+
* @example group: 'block'
|
|
254
|
+
* @example group: 'inline'
|
|
255
|
+
* @example group: 'customBlock' // this uses a custom group
|
|
256
|
+
*/
|
|
257
|
+
group?: NodeSpec['group'] | ((this: {
|
|
258
|
+
name: string;
|
|
259
|
+
options: Options;
|
|
260
|
+
storage: Storage;
|
|
261
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['group'];
|
|
262
|
+
editor?: Editor;
|
|
263
|
+
}) => NodeSpec['group']);
|
|
264
|
+
/**
|
|
265
|
+
* Should be set to true for inline nodes. (Implied for text nodes.)
|
|
266
|
+
*/
|
|
267
|
+
inline?: NodeSpec['inline'] | ((this: {
|
|
268
|
+
name: string;
|
|
269
|
+
options: Options;
|
|
270
|
+
storage: Storage;
|
|
271
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['inline'];
|
|
272
|
+
editor?: Editor;
|
|
273
|
+
}) => NodeSpec['inline']);
|
|
274
|
+
/**
|
|
275
|
+
* Can be set to true to indicate that, though this isn't a [leaf
|
|
276
|
+
* node](https://prosemirror.net/docs/ref/#model.NodeType.isLeaf), it doesn't have directly editable
|
|
277
|
+
* content and should be treated as a single unit in the view.
|
|
278
|
+
*
|
|
279
|
+
* @example atom: true
|
|
280
|
+
*/
|
|
281
|
+
atom?: NodeSpec['atom'] | ((this: {
|
|
282
|
+
name: string;
|
|
283
|
+
options: Options;
|
|
284
|
+
storage: Storage;
|
|
285
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['atom'];
|
|
286
|
+
editor?: Editor;
|
|
287
|
+
}) => NodeSpec['atom']);
|
|
288
|
+
/**
|
|
289
|
+
* Controls whether nodes of this type can be selected as a [node
|
|
290
|
+
* selection](https://prosemirror.net/docs/ref/#state.NodeSelection). Defaults to true for non-text
|
|
291
|
+
* nodes.
|
|
292
|
+
*
|
|
293
|
+
* @default true
|
|
294
|
+
* @example selectable: false
|
|
295
|
+
*/
|
|
296
|
+
selectable?: NodeSpec['selectable'] | ((this: {
|
|
297
|
+
name: string;
|
|
298
|
+
options: Options;
|
|
299
|
+
storage: Storage;
|
|
300
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['selectable'];
|
|
301
|
+
editor?: Editor;
|
|
302
|
+
}) => NodeSpec['selectable']);
|
|
303
|
+
/**
|
|
304
|
+
* Determines whether nodes of this type can be dragged without
|
|
305
|
+
* being selected. Defaults to false.
|
|
306
|
+
*
|
|
307
|
+
* @default: false
|
|
308
|
+
* @example: draggable: true
|
|
309
|
+
*/
|
|
310
|
+
draggable?: NodeSpec['draggable'] | ((this: {
|
|
311
|
+
name: string;
|
|
312
|
+
options: Options;
|
|
313
|
+
storage: Storage;
|
|
314
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['draggable'];
|
|
315
|
+
editor?: Editor;
|
|
316
|
+
}) => NodeSpec['draggable']);
|
|
317
|
+
/**
|
|
318
|
+
* Can be used to indicate that this node contains code, which
|
|
319
|
+
* causes some commands to behave differently.
|
|
320
|
+
*/
|
|
321
|
+
code?: NodeSpec['code'] | ((this: {
|
|
322
|
+
name: string;
|
|
323
|
+
options: Options;
|
|
324
|
+
storage: Storage;
|
|
325
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['code'];
|
|
326
|
+
editor?: Editor;
|
|
327
|
+
}) => NodeSpec['code']);
|
|
328
|
+
/**
|
|
329
|
+
* Controls way whitespace in this a node is parsed. The default is
|
|
330
|
+
* `"normal"`, which causes the [DOM parser](https://prosemirror.net/docs/ref/#model.DOMParser) to
|
|
331
|
+
* collapse whitespace in normal mode, and normalize it (replacing
|
|
332
|
+
* newlines and such with spaces) otherwise. `"pre"` causes the
|
|
333
|
+
* parser to preserve spaces inside the node. When this option isn't
|
|
334
|
+
* given, but [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) is true, `whitespace`
|
|
335
|
+
* will default to `"pre"`. Note that this option doesn't influence
|
|
336
|
+
* the way the node is rendered—that should be handled by `toDOM`
|
|
337
|
+
* and/or styling.
|
|
338
|
+
*/
|
|
339
|
+
whitespace?: NodeSpec['whitespace'] | ((this: {
|
|
340
|
+
name: string;
|
|
341
|
+
options: Options;
|
|
342
|
+
storage: Storage;
|
|
343
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['whitespace'];
|
|
344
|
+
editor?: Editor;
|
|
345
|
+
}) => NodeSpec['whitespace']);
|
|
346
|
+
/**
|
|
347
|
+
* Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
|
|
348
|
+
* When converting between block types that have whitespace set to "pre"
|
|
349
|
+
* and don't support the linebreak node (e.g. codeBlock) and other block types
|
|
350
|
+
* that do support the linebreak node (e.g. paragraphs) - this node will be used
|
|
351
|
+
* as the linebreak instead of stripping the newline.
|
|
352
|
+
*
|
|
353
|
+
* See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
|
|
354
|
+
*/
|
|
355
|
+
linebreakReplacement?: NodeSpec['linebreakReplacement'] | ((this: {
|
|
356
|
+
name: string;
|
|
357
|
+
options: Options;
|
|
358
|
+
storage: Storage;
|
|
359
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['linebreakReplacement'];
|
|
360
|
+
editor?: Editor;
|
|
361
|
+
}) => NodeSpec['linebreakReplacement']);
|
|
362
|
+
/**
|
|
363
|
+
* When enabled, enables both
|
|
364
|
+
* [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
|
|
365
|
+
* [`definingForContent`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
|
|
366
|
+
*
|
|
367
|
+
* @default false
|
|
368
|
+
* @example isolating: true
|
|
369
|
+
*/
|
|
370
|
+
defining?: NodeSpec['defining'] | ((this: {
|
|
371
|
+
name: string;
|
|
372
|
+
options: Options;
|
|
373
|
+
storage: Storage;
|
|
374
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['defining'];
|
|
375
|
+
editor?: Editor;
|
|
376
|
+
}) => NodeSpec['defining']);
|
|
377
|
+
/**
|
|
378
|
+
* When enabled (default is false), the sides of nodes of this type
|
|
379
|
+
* count as boundaries that regular editing operations, like
|
|
380
|
+
* backspacing or lifting, won't cross. An example of a node that
|
|
381
|
+
* should probably have this enabled is a table cell.
|
|
382
|
+
*/
|
|
383
|
+
isolating?: NodeSpec['isolating'] | ((this: {
|
|
384
|
+
name: string;
|
|
385
|
+
options: Options;
|
|
386
|
+
storage: Storage;
|
|
387
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['isolating'];
|
|
388
|
+
editor?: Editor;
|
|
389
|
+
}) => NodeSpec['isolating']);
|
|
390
|
+
/**
|
|
391
|
+
* Associates DOM parser information with this node, which can be
|
|
392
|
+
* used by [`DOMParser.fromSchema`](https://prosemirror.net/docs/ref/#model.DOMParser^fromSchema) to
|
|
393
|
+
* automatically derive a parser. The `node` field in the rules is
|
|
394
|
+
* implied (the name of this node will be filled in automatically).
|
|
395
|
+
* If you supply your own parser, you do not need to also specify
|
|
396
|
+
* parsing rules in your schema.
|
|
397
|
+
*
|
|
398
|
+
* @example parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
|
|
399
|
+
*/
|
|
400
|
+
parseHTML?: (this: {
|
|
401
|
+
name: string;
|
|
402
|
+
options: Options;
|
|
403
|
+
storage: Storage;
|
|
404
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['parseHTML'];
|
|
405
|
+
editor?: Editor;
|
|
406
|
+
}) => NodeSpec['parseDOM'];
|
|
407
|
+
/**
|
|
408
|
+
* A description of a DOM structure. Can be either a string, which is
|
|
409
|
+
* interpreted as a text node, a DOM node, which is interpreted as
|
|
410
|
+
* itself, a `{dom, contentDOM}` object, or an array.
|
|
411
|
+
*
|
|
412
|
+
* An array describes a DOM element. The first value in the array
|
|
413
|
+
* should be a string—the name of the DOM element, optionally prefixed
|
|
414
|
+
* by a namespace URL and a space. If the second element is plain
|
|
415
|
+
* object, it is interpreted as a set of attributes for the element.
|
|
416
|
+
* Any elements after that (including the 2nd if it's not an attribute
|
|
417
|
+
* object) are interpreted as children of the DOM elements, and must
|
|
418
|
+
* either be valid `DOMOutputSpec` values, or the number zero.
|
|
419
|
+
*
|
|
420
|
+
* The number zero (pronounced “hole”) is used to indicate the place
|
|
421
|
+
* where a node's child nodes should be inserted. If it occurs in an
|
|
422
|
+
* output spec, it should be the only child element in its parent
|
|
423
|
+
* node.
|
|
424
|
+
*
|
|
425
|
+
* @example toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
|
|
426
|
+
*/
|
|
427
|
+
renderHTML?: ((this: {
|
|
428
|
+
name: string;
|
|
429
|
+
options: Options;
|
|
430
|
+
storage: Storage;
|
|
431
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['renderHTML'];
|
|
432
|
+
editor?: Editor;
|
|
433
|
+
}, props: {
|
|
434
|
+
node: Node$1;
|
|
435
|
+
HTMLAttributes: Record<string, any>;
|
|
436
|
+
}) => DOMOutputSpec) | null;
|
|
437
|
+
/**
|
|
438
|
+
* renders the node as text
|
|
439
|
+
* @example renderText: () => 'foo
|
|
440
|
+
*/
|
|
441
|
+
renderText?: ((this: {
|
|
442
|
+
name: string;
|
|
443
|
+
options: Options;
|
|
444
|
+
storage: Storage;
|
|
445
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['renderText'];
|
|
446
|
+
editor?: Editor;
|
|
447
|
+
}, props: {
|
|
448
|
+
node: Node$1;
|
|
449
|
+
pos: number;
|
|
450
|
+
parent: Node$1;
|
|
451
|
+
index: number;
|
|
452
|
+
}) => string) | null;
|
|
453
|
+
/**
|
|
454
|
+
* Add attributes to the node
|
|
455
|
+
* @example addAttributes: () => ({ class: 'foo' })
|
|
456
|
+
*/
|
|
457
|
+
addAttributes?: (this: {
|
|
458
|
+
name: string;
|
|
459
|
+
options: Options;
|
|
460
|
+
storage: Storage;
|
|
461
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
|
|
462
|
+
editor?: Editor;
|
|
463
|
+
}) => Attributes$1 | {};
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The Node class is used to create custom node extensions.
|
|
467
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
468
|
+
*/
|
|
469
|
+
declare class Node<Options = any, Storage = any> extends Extendable<Options, Storage> {
|
|
470
|
+
type: string;
|
|
471
|
+
static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>>): Node<O, S>;
|
|
472
|
+
}
|
|
473
|
+
|
|
76
474
|
type PasteRuleMatch = {
|
|
77
475
|
index: number;
|
|
78
476
|
text: string;
|
|
@@ -121,1407 +519,341 @@ declare function pasteRulesPlugin(props: {
|
|
|
121
519
|
rules: PasteRule[];
|
|
122
520
|
}): Plugin[];
|
|
123
521
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
* @example 'myExtension'
|
|
132
|
-
*/
|
|
133
|
-
name: string;
|
|
134
|
-
/**
|
|
135
|
-
* The priority of your extension. The higher, the earlier it will be called
|
|
136
|
-
* and will take precedence over other extensions with a lower priority.
|
|
137
|
-
* @default 100
|
|
138
|
-
* @example 101
|
|
139
|
-
*/
|
|
140
|
-
priority?: number;
|
|
141
|
-
/**
|
|
142
|
-
* The default options for this extension.
|
|
143
|
-
* @example
|
|
144
|
-
* defaultOptions: {
|
|
145
|
-
* myOption: 'foo',
|
|
146
|
-
* myOtherOption: 10,
|
|
147
|
-
* }
|
|
148
|
-
*/
|
|
149
|
-
defaultOptions?: Options;
|
|
150
|
-
/**
|
|
151
|
-
* This method will add options to this extension
|
|
152
|
-
* @see https://tiptap.dev/guide/custom-extensions#settings
|
|
153
|
-
* @example
|
|
154
|
-
* addOptions() {
|
|
155
|
-
* return {
|
|
156
|
-
* myOption: 'foo',
|
|
157
|
-
* myOtherOption: 10,
|
|
158
|
-
* }
|
|
159
|
-
*/
|
|
160
|
-
addOptions?: (this: {
|
|
161
|
-
name: string;
|
|
162
|
-
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addOptions'], undefined>;
|
|
163
|
-
}) => Options;
|
|
164
|
-
/**
|
|
165
|
-
* The default storage this extension can save data to.
|
|
166
|
-
* @see https://tiptap.dev/guide/custom-extensions#storage
|
|
167
|
-
* @example
|
|
168
|
-
* defaultStorage: {
|
|
169
|
-
* prefetchedUsers: [],
|
|
170
|
-
* loading: false,
|
|
171
|
-
* }
|
|
172
|
-
*/
|
|
173
|
-
addStorage?: (this: {
|
|
174
|
-
name: string;
|
|
175
|
-
options: Options;
|
|
176
|
-
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addStorage'], undefined>;
|
|
177
|
-
}) => Storage;
|
|
178
|
-
/**
|
|
179
|
-
* This function adds globalAttributes to specific nodes.
|
|
180
|
-
* @see https://tiptap.dev/guide/custom-extensions#global-attributes
|
|
181
|
-
* @example
|
|
182
|
-
* addGlobalAttributes() {
|
|
183
|
-
* return [
|
|
184
|
-
* {
|
|
185
|
-
// Extend the following extensions
|
|
186
|
-
* types: [
|
|
187
|
-
* 'heading',
|
|
188
|
-
* 'paragraph',
|
|
189
|
-
* ],
|
|
190
|
-
* // … with those attributes
|
|
191
|
-
* attributes: {
|
|
192
|
-
* textAlign: {
|
|
193
|
-
* default: 'left',
|
|
194
|
-
* renderHTML: attributes => ({
|
|
195
|
-
* style: `text-align: ${attributes.textAlign}`,
|
|
196
|
-
* }),
|
|
197
|
-
* parseHTML: element => element.style.textAlign || 'left',
|
|
198
|
-
* },
|
|
199
|
-
* },
|
|
200
|
-
* },
|
|
201
|
-
* ]
|
|
202
|
-
* }
|
|
203
|
-
*/
|
|
204
|
-
addGlobalAttributes?: (this: {
|
|
205
|
-
name: string;
|
|
206
|
-
options: Options;
|
|
207
|
-
storage: Storage;
|
|
208
|
-
extensions: (Node | Mark)[];
|
|
209
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addGlobalAttributes'];
|
|
210
|
-
}) => GlobalAttributes;
|
|
211
|
-
/**
|
|
212
|
-
* This function adds commands to the editor
|
|
213
|
-
* @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
|
|
214
|
-
* @example
|
|
215
|
-
* addCommands() {
|
|
216
|
-
* return {
|
|
217
|
-
* myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
|
|
218
|
-
* }
|
|
219
|
-
* }
|
|
220
|
-
*/
|
|
221
|
-
addCommands?: (this: {
|
|
222
|
-
name: string;
|
|
223
|
-
options: Options;
|
|
224
|
-
storage: Storage;
|
|
225
|
-
editor: Editor;
|
|
226
|
-
type: NodeType$1;
|
|
227
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addCommands'];
|
|
228
|
-
}) => Partial<RawCommands>;
|
|
229
|
-
/**
|
|
230
|
-
* This function registers keyboard shortcuts.
|
|
231
|
-
* @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
|
|
232
|
-
* @example
|
|
233
|
-
* addKeyboardShortcuts() {
|
|
234
|
-
* return {
|
|
235
|
-
* 'Mod-l': () => this.editor.commands.toggleBulletList(),
|
|
236
|
-
* }
|
|
237
|
-
* },
|
|
238
|
-
*/
|
|
239
|
-
addKeyboardShortcuts?: (this: {
|
|
240
|
-
name: string;
|
|
241
|
-
options: Options;
|
|
242
|
-
storage: Storage;
|
|
243
|
-
editor: Editor;
|
|
244
|
-
type: NodeType$1;
|
|
245
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
246
|
-
}) => {
|
|
247
|
-
[key: string]: KeyboardShortcutCommand;
|
|
248
|
-
};
|
|
249
|
-
/**
|
|
250
|
-
* This function adds input rules to the editor.
|
|
251
|
-
* @see https://tiptap.dev/guide/custom-extensions#input-rules
|
|
252
|
-
* @example
|
|
253
|
-
* addInputRules() {
|
|
254
|
-
* return [
|
|
255
|
-
* markInputRule({
|
|
256
|
-
* find: inputRegex,
|
|
257
|
-
* type: this.type,
|
|
258
|
-
* }),
|
|
259
|
-
* ]
|
|
260
|
-
* },
|
|
261
|
-
*/
|
|
262
|
-
addInputRules?: (this: {
|
|
263
|
-
name: string;
|
|
264
|
-
options: Options;
|
|
265
|
-
storage: Storage;
|
|
266
|
-
editor: Editor;
|
|
267
|
-
type: NodeType$1;
|
|
268
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addInputRules'];
|
|
269
|
-
}) => InputRule[];
|
|
270
|
-
/**
|
|
271
|
-
* This function adds paste rules to the editor.
|
|
272
|
-
* @see https://tiptap.dev/guide/custom-extensions#paste-rules
|
|
273
|
-
* @example
|
|
274
|
-
* addPasteRules() {
|
|
275
|
-
* return [
|
|
276
|
-
* markPasteRule({
|
|
277
|
-
* find: pasteRegex,
|
|
278
|
-
* type: this.type,
|
|
279
|
-
* }),
|
|
280
|
-
* ]
|
|
281
|
-
* },
|
|
282
|
-
*/
|
|
283
|
-
addPasteRules?: (this: {
|
|
284
|
-
name: string;
|
|
285
|
-
options: Options;
|
|
286
|
-
storage: Storage;
|
|
287
|
-
editor: Editor;
|
|
288
|
-
type: NodeType$1;
|
|
289
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addPasteRules'];
|
|
290
|
-
}) => PasteRule[];
|
|
291
|
-
/**
|
|
292
|
-
* This function adds Prosemirror plugins to the editor
|
|
293
|
-
* @see https://tiptap.dev/guide/custom-extensions#prosemirror-plugins
|
|
294
|
-
* @example
|
|
295
|
-
* addProseMirrorPlugins() {
|
|
296
|
-
* return [
|
|
297
|
-
* customPlugin(),
|
|
298
|
-
* ]
|
|
299
|
-
* }
|
|
300
|
-
*/
|
|
301
|
-
addProseMirrorPlugins?: (this: {
|
|
302
|
-
name: string;
|
|
303
|
-
options: Options;
|
|
304
|
-
storage: Storage;
|
|
305
|
-
editor: Editor;
|
|
306
|
-
type: NodeType$1;
|
|
307
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
308
|
-
}) => Plugin[];
|
|
309
|
-
/**
|
|
310
|
-
* This function adds additional extensions to the editor. This is useful for
|
|
311
|
-
* building extension kits.
|
|
312
|
-
* @example
|
|
313
|
-
* addExtensions() {
|
|
314
|
-
* return [
|
|
315
|
-
* BulletList,
|
|
316
|
-
* OrderedList,
|
|
317
|
-
* ListItem
|
|
318
|
-
* ]
|
|
319
|
-
* }
|
|
320
|
-
*/
|
|
321
|
-
addExtensions?: (this: {
|
|
322
|
-
name: string;
|
|
323
|
-
options: Options;
|
|
324
|
-
storage: Storage;
|
|
325
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addExtensions'];
|
|
326
|
-
}) => Extensions;
|
|
327
|
-
/**
|
|
328
|
-
* This function extends the schema of the node.
|
|
329
|
-
* @example
|
|
330
|
-
* extendNodeSchema() {
|
|
331
|
-
* return {
|
|
332
|
-
* group: 'inline',
|
|
333
|
-
* selectable: false,
|
|
334
|
-
* }
|
|
335
|
-
* }
|
|
336
|
-
*/
|
|
337
|
-
extendNodeSchema?: ((this: {
|
|
338
|
-
name: string;
|
|
339
|
-
options: Options;
|
|
340
|
-
storage: Storage;
|
|
341
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['extendNodeSchema'];
|
|
342
|
-
}, extension: Node) => Record<string, any>) | null;
|
|
343
|
-
/**
|
|
344
|
-
* This function extends the schema of the mark.
|
|
345
|
-
* @example
|
|
346
|
-
* extendMarkSchema() {
|
|
347
|
-
* return {
|
|
348
|
-
* group: 'inline',
|
|
349
|
-
* selectable: false,
|
|
350
|
-
* }
|
|
351
|
-
* }
|
|
352
|
-
*/
|
|
353
|
-
extendMarkSchema?: ((this: {
|
|
354
|
-
name: string;
|
|
355
|
-
options: Options;
|
|
356
|
-
storage: Storage;
|
|
357
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['extendMarkSchema'];
|
|
358
|
-
editor?: Editor;
|
|
359
|
-
}, extension: Node) => Record<string, any>) | null;
|
|
360
|
-
/**
|
|
361
|
-
* The editor is not ready yet.
|
|
362
|
-
*/
|
|
363
|
-
onBeforeCreate?: ((this: {
|
|
364
|
-
name: string;
|
|
365
|
-
options: Options;
|
|
366
|
-
storage: Storage;
|
|
367
|
-
editor: Editor;
|
|
368
|
-
type: NodeType$1;
|
|
369
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onBeforeCreate'];
|
|
370
|
-
}) => void) | null;
|
|
371
|
-
/**
|
|
372
|
-
* The editor is ready.
|
|
373
|
-
*/
|
|
374
|
-
onCreate?: ((this: {
|
|
375
|
-
name: string;
|
|
376
|
-
options: Options;
|
|
377
|
-
storage: Storage;
|
|
378
|
-
editor: Editor;
|
|
379
|
-
type: NodeType$1;
|
|
380
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onCreate'];
|
|
381
|
-
}) => void) | null;
|
|
382
|
-
/**
|
|
383
|
-
* The content has changed.
|
|
384
|
-
*/
|
|
385
|
-
onUpdate?: ((this: {
|
|
386
|
-
name: string;
|
|
387
|
-
options: Options;
|
|
388
|
-
storage: Storage;
|
|
389
|
-
editor: Editor;
|
|
390
|
-
type: NodeType$1;
|
|
391
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onUpdate'];
|
|
392
|
-
}) => void) | null;
|
|
393
|
-
/**
|
|
394
|
-
* The selection has changed.
|
|
395
|
-
*/
|
|
396
|
-
onSelectionUpdate?: ((this: {
|
|
397
|
-
name: string;
|
|
398
|
-
options: Options;
|
|
399
|
-
storage: Storage;
|
|
400
|
-
editor: Editor;
|
|
401
|
-
type: NodeType$1;
|
|
402
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onSelectionUpdate'];
|
|
403
|
-
}) => void) | null;
|
|
404
|
-
/**
|
|
405
|
-
* The editor state has changed.
|
|
406
|
-
*/
|
|
407
|
-
onTransaction?: ((this: {
|
|
408
|
-
name: string;
|
|
409
|
-
options: Options;
|
|
410
|
-
storage: Storage;
|
|
411
|
-
editor: Editor;
|
|
412
|
-
type: NodeType$1;
|
|
413
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onTransaction'];
|
|
414
|
-
}, props: {
|
|
415
|
-
editor: Editor;
|
|
416
|
-
transaction: Transaction;
|
|
417
|
-
}) => void) | null;
|
|
418
|
-
/**
|
|
419
|
-
* The editor is focused.
|
|
420
|
-
*/
|
|
421
|
-
onFocus?: ((this: {
|
|
422
|
-
name: string;
|
|
423
|
-
options: Options;
|
|
424
|
-
storage: Storage;
|
|
425
|
-
editor: Editor;
|
|
426
|
-
type: NodeType$1;
|
|
427
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onFocus'];
|
|
428
|
-
}, props: {
|
|
429
|
-
event: FocusEvent;
|
|
430
|
-
}) => void) | null;
|
|
431
|
-
/**
|
|
432
|
-
* The editor isn’t focused anymore.
|
|
433
|
-
*/
|
|
434
|
-
onBlur?: ((this: {
|
|
435
|
-
name: string;
|
|
436
|
-
options: Options;
|
|
437
|
-
storage: Storage;
|
|
438
|
-
editor: Editor;
|
|
439
|
-
type: NodeType$1;
|
|
440
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onBlur'];
|
|
441
|
-
}, props: {
|
|
442
|
-
event: FocusEvent;
|
|
443
|
-
}) => void) | null;
|
|
444
|
-
/**
|
|
445
|
-
* The editor is destroyed.
|
|
446
|
-
*/
|
|
447
|
-
onDestroy?: ((this: {
|
|
448
|
-
name: string;
|
|
449
|
-
options: Options;
|
|
450
|
-
storage: Storage;
|
|
451
|
-
editor: Editor;
|
|
452
|
-
type: NodeType$1;
|
|
453
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['onDestroy'];
|
|
454
|
-
}) => void) | null;
|
|
455
|
-
/**
|
|
456
|
-
* Node View
|
|
457
|
-
*/
|
|
458
|
-
addNodeView?: ((this: {
|
|
459
|
-
name: string;
|
|
460
|
-
options: Options;
|
|
461
|
-
storage: Storage;
|
|
462
|
-
editor: Editor;
|
|
463
|
-
type: NodeType$1;
|
|
464
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addNodeView'];
|
|
465
|
-
}) => NodeViewRenderer) | null;
|
|
466
|
-
/**
|
|
467
|
-
* Defines if this node should be a top level node (doc)
|
|
468
|
-
* @default false
|
|
469
|
-
* @example true
|
|
470
|
-
*/
|
|
471
|
-
topNode?: boolean;
|
|
472
|
-
/**
|
|
473
|
-
* The content expression for this node, as described in the [schema
|
|
474
|
-
* guide](/docs/guide/#schema.content_expressions). When not given,
|
|
475
|
-
* the node does not allow any content.
|
|
476
|
-
*
|
|
477
|
-
* You can read more about it on the Prosemirror documentation here
|
|
478
|
-
* @see https://prosemirror.net/docs/guide/#schema.content_expressions
|
|
479
|
-
* @default undefined
|
|
480
|
-
* @example content: 'block+'
|
|
481
|
-
* @example content: 'headline paragraph block*'
|
|
482
|
-
*/
|
|
483
|
-
content?: NodeSpec['content'] | ((this: {
|
|
484
|
-
name: string;
|
|
485
|
-
options: Options;
|
|
486
|
-
storage: Storage;
|
|
487
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['content'];
|
|
488
|
-
editor?: Editor;
|
|
489
|
-
}) => NodeSpec['content']);
|
|
490
|
-
/**
|
|
491
|
-
* The marks that are allowed inside of this node. May be a
|
|
492
|
-
* space-separated string referring to mark names or groups, `"_"`
|
|
493
|
-
* to explicitly allow all marks, or `""` to disallow marks. When
|
|
494
|
-
* not given, nodes with inline content default to allowing all
|
|
495
|
-
* marks, other nodes default to not allowing marks.
|
|
496
|
-
*
|
|
497
|
-
* @example marks: 'strong em'
|
|
498
|
-
*/
|
|
499
|
-
marks?: NodeSpec['marks'] | ((this: {
|
|
500
|
-
name: string;
|
|
501
|
-
options: Options;
|
|
502
|
-
storage: Storage;
|
|
503
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['marks'];
|
|
504
|
-
editor?: Editor;
|
|
505
|
-
}) => NodeSpec['marks']);
|
|
506
|
-
/**
|
|
507
|
-
* The group or space-separated groups to which this node belongs,
|
|
508
|
-
* which can be referred to in the content expressions for the
|
|
509
|
-
* schema.
|
|
510
|
-
*
|
|
511
|
-
* By default Tiptap uses the groups 'block' and 'inline' for nodes. You
|
|
512
|
-
* can also use custom groups if you want to group specific nodes together
|
|
513
|
-
* and handle them in your schema.
|
|
514
|
-
* @example group: 'block'
|
|
515
|
-
* @example group: 'inline'
|
|
516
|
-
* @example group: 'customBlock' // this uses a custom group
|
|
517
|
-
*/
|
|
518
|
-
group?: NodeSpec['group'] | ((this: {
|
|
519
|
-
name: string;
|
|
520
|
-
options: Options;
|
|
521
|
-
storage: Storage;
|
|
522
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['group'];
|
|
523
|
-
editor?: Editor;
|
|
524
|
-
}) => NodeSpec['group']);
|
|
525
|
-
/**
|
|
526
|
-
* Should be set to true for inline nodes. (Implied for text nodes.)
|
|
527
|
-
*/
|
|
528
|
-
inline?: NodeSpec['inline'] | ((this: {
|
|
529
|
-
name: string;
|
|
530
|
-
options: Options;
|
|
531
|
-
storage: Storage;
|
|
532
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['inline'];
|
|
533
|
-
editor?: Editor;
|
|
534
|
-
}) => NodeSpec['inline']);
|
|
535
|
-
/**
|
|
536
|
-
* Can be set to true to indicate that, though this isn't a [leaf
|
|
537
|
-
* node](https://prosemirror.net/docs/ref/#model.NodeType.isLeaf), it doesn't have directly editable
|
|
538
|
-
* content and should be treated as a single unit in the view.
|
|
539
|
-
*
|
|
540
|
-
* @example atom: true
|
|
541
|
-
*/
|
|
542
|
-
atom?: NodeSpec['atom'] | ((this: {
|
|
543
|
-
name: string;
|
|
544
|
-
options: Options;
|
|
545
|
-
storage: Storage;
|
|
546
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['atom'];
|
|
547
|
-
editor?: Editor;
|
|
548
|
-
}) => NodeSpec['atom']);
|
|
549
|
-
/**
|
|
550
|
-
* Controls whether nodes of this type can be selected as a [node
|
|
551
|
-
* selection](https://prosemirror.net/docs/ref/#state.NodeSelection). Defaults to true for non-text
|
|
552
|
-
* nodes.
|
|
553
|
-
*
|
|
554
|
-
* @default true
|
|
555
|
-
* @example selectable: false
|
|
556
|
-
*/
|
|
557
|
-
selectable?: NodeSpec['selectable'] | ((this: {
|
|
558
|
-
name: string;
|
|
559
|
-
options: Options;
|
|
560
|
-
storage: Storage;
|
|
561
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['selectable'];
|
|
562
|
-
editor?: Editor;
|
|
563
|
-
}) => NodeSpec['selectable']);
|
|
564
|
-
/**
|
|
565
|
-
* Determines whether nodes of this type can be dragged without
|
|
566
|
-
* being selected. Defaults to false.
|
|
567
|
-
*
|
|
568
|
-
* @default: false
|
|
569
|
-
* @example: draggable: true
|
|
570
|
-
*/
|
|
571
|
-
draggable?: NodeSpec['draggable'] | ((this: {
|
|
572
|
-
name: string;
|
|
573
|
-
options: Options;
|
|
574
|
-
storage: Storage;
|
|
575
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['draggable'];
|
|
576
|
-
editor?: Editor;
|
|
577
|
-
}) => NodeSpec['draggable']);
|
|
578
|
-
/**
|
|
579
|
-
* Can be used to indicate that this node contains code, which
|
|
580
|
-
* causes some commands to behave differently.
|
|
581
|
-
*/
|
|
582
|
-
code?: NodeSpec['code'] | ((this: {
|
|
583
|
-
name: string;
|
|
584
|
-
options: Options;
|
|
585
|
-
storage: Storage;
|
|
586
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['code'];
|
|
587
|
-
editor?: Editor;
|
|
588
|
-
}) => NodeSpec['code']);
|
|
589
|
-
/**
|
|
590
|
-
* Controls way whitespace in this a node is parsed. The default is
|
|
591
|
-
* `"normal"`, which causes the [DOM parser](https://prosemirror.net/docs/ref/#model.DOMParser) to
|
|
592
|
-
* collapse whitespace in normal mode, and normalize it (replacing
|
|
593
|
-
* newlines and such with spaces) otherwise. `"pre"` causes the
|
|
594
|
-
* parser to preserve spaces inside the node. When this option isn't
|
|
595
|
-
* given, but [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) is true, `whitespace`
|
|
596
|
-
* will default to `"pre"`. Note that this option doesn't influence
|
|
597
|
-
* the way the node is rendered—that should be handled by `toDOM`
|
|
598
|
-
* and/or styling.
|
|
599
|
-
*/
|
|
600
|
-
whitespace?: NodeSpec['whitespace'] | ((this: {
|
|
601
|
-
name: string;
|
|
602
|
-
options: Options;
|
|
603
|
-
storage: Storage;
|
|
604
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['whitespace'];
|
|
605
|
-
editor?: Editor;
|
|
606
|
-
}) => NodeSpec['whitespace']);
|
|
607
|
-
/**
|
|
608
|
-
* Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
|
|
609
|
-
* When converting between block types that have whitespace set to "pre"
|
|
610
|
-
* and don't support the linebreak node (e.g. codeBlock) and other block types
|
|
611
|
-
* that do support the linebreak node (e.g. paragraphs) - this node will be used
|
|
612
|
-
* as the linebreak instead of stripping the newline.
|
|
613
|
-
*
|
|
614
|
-
* See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
|
|
615
|
-
*/
|
|
616
|
-
linebreakReplacement?: NodeSpec['linebreakReplacement'] | ((this: {
|
|
617
|
-
name: string;
|
|
618
|
-
options: Options;
|
|
619
|
-
storage: Storage;
|
|
620
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['linebreakReplacement'];
|
|
621
|
-
editor?: Editor;
|
|
622
|
-
}) => NodeSpec['linebreakReplacement']);
|
|
623
|
-
/**
|
|
624
|
-
* When enabled, enables both
|
|
625
|
-
* [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
|
|
626
|
-
* [`definingForContent`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
|
|
627
|
-
*
|
|
628
|
-
* @default false
|
|
629
|
-
* @example isolating: true
|
|
630
|
-
*/
|
|
631
|
-
defining?: NodeSpec['defining'] | ((this: {
|
|
632
|
-
name: string;
|
|
633
|
-
options: Options;
|
|
634
|
-
storage: Storage;
|
|
635
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['defining'];
|
|
636
|
-
editor?: Editor;
|
|
637
|
-
}) => NodeSpec['defining']);
|
|
638
|
-
/**
|
|
639
|
-
* When enabled (default is false), the sides of nodes of this type
|
|
640
|
-
* count as boundaries that regular editing operations, like
|
|
641
|
-
* backspacing or lifting, won't cross. An example of a node that
|
|
642
|
-
* should probably have this enabled is a table cell.
|
|
643
|
-
*/
|
|
644
|
-
isolating?: NodeSpec['isolating'] | ((this: {
|
|
645
|
-
name: string;
|
|
646
|
-
options: Options;
|
|
647
|
-
storage: Storage;
|
|
648
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['isolating'];
|
|
649
|
-
editor?: Editor;
|
|
650
|
-
}) => NodeSpec['isolating']);
|
|
651
|
-
/**
|
|
652
|
-
* Associates DOM parser information with this node, which can be
|
|
653
|
-
* used by [`DOMParser.fromSchema`](https://prosemirror.net/docs/ref/#model.DOMParser^fromSchema) to
|
|
654
|
-
* automatically derive a parser. The `node` field in the rules is
|
|
655
|
-
* implied (the name of this node will be filled in automatically).
|
|
656
|
-
* If you supply your own parser, you do not need to also specify
|
|
657
|
-
* parsing rules in your schema.
|
|
658
|
-
*
|
|
659
|
-
* @example parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
|
|
660
|
-
*/
|
|
661
|
-
parseHTML?: (this: {
|
|
662
|
-
name: string;
|
|
663
|
-
options: Options;
|
|
664
|
-
storage: Storage;
|
|
665
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['parseHTML'];
|
|
666
|
-
editor?: Editor;
|
|
667
|
-
}) => NodeSpec['parseDOM'];
|
|
668
|
-
/**
|
|
669
|
-
* A description of a DOM structure. Can be either a string, which is
|
|
670
|
-
* interpreted as a text node, a DOM node, which is interpreted as
|
|
671
|
-
* itself, a `{dom, contentDOM}` object, or an array.
|
|
672
|
-
*
|
|
673
|
-
* An array describes a DOM element. The first value in the array
|
|
674
|
-
* should be a string—the name of the DOM element, optionally prefixed
|
|
675
|
-
* by a namespace URL and a space. If the second element is plain
|
|
676
|
-
* object, it is interpreted as a set of attributes for the element.
|
|
677
|
-
* Any elements after that (including the 2nd if it's not an attribute
|
|
678
|
-
* object) are interpreted as children of the DOM elements, and must
|
|
679
|
-
* either be valid `DOMOutputSpec` values, or the number zero.
|
|
680
|
-
*
|
|
681
|
-
* The number zero (pronounced “hole”) is used to indicate the place
|
|
682
|
-
* where a node's child nodes should be inserted. If it occurs in an
|
|
683
|
-
* output spec, it should be the only child element in its parent
|
|
684
|
-
* node.
|
|
685
|
-
*
|
|
686
|
-
* @example toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
|
|
687
|
-
*/
|
|
688
|
-
renderHTML?: ((this: {
|
|
689
|
-
name: string;
|
|
690
|
-
options: Options;
|
|
691
|
-
storage: Storage;
|
|
692
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['renderHTML'];
|
|
693
|
-
editor?: Editor;
|
|
694
|
-
}, props: {
|
|
695
|
-
node: Node$1;
|
|
696
|
-
HTMLAttributes: Record<string, any>;
|
|
697
|
-
}) => DOMOutputSpec) | null;
|
|
698
|
-
/**
|
|
699
|
-
* renders the node as text
|
|
700
|
-
* @example renderText: () => 'foo
|
|
701
|
-
*/
|
|
702
|
-
renderText?: ((this: {
|
|
703
|
-
name: string;
|
|
704
|
-
options: Options;
|
|
705
|
-
storage: Storage;
|
|
706
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['renderText'];
|
|
707
|
-
editor?: Editor;
|
|
708
|
-
}, props: {
|
|
709
|
-
node: Node$1;
|
|
710
|
-
pos: number;
|
|
711
|
-
parent: Node$1;
|
|
712
|
-
index: number;
|
|
713
|
-
}) => string) | null;
|
|
714
|
-
/**
|
|
715
|
-
* Add attributes to the node
|
|
716
|
-
* @example addAttributes: () => ({ class: 'foo' })
|
|
717
|
-
*/
|
|
718
|
-
addAttributes?: (this: {
|
|
719
|
-
name: string;
|
|
720
|
-
options: Options;
|
|
721
|
-
storage: Storage;
|
|
722
|
-
parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
|
|
723
|
-
editor?: Editor;
|
|
724
|
-
}) => Attributes | {};
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* The Node class is used to create custom node extensions.
|
|
729
|
-
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
730
|
-
*/
|
|
731
|
-
declare class Node<Options = any, Storage = any> {
|
|
732
|
-
type: string;
|
|
522
|
+
interface ExtendableConfig<Options = any, Storage = any, Config extends ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage> | ExtendableConfig<Options, Storage> = ExtendableConfig<Options, Storage, any, any>, PMType = any> {
|
|
523
|
+
/**
|
|
524
|
+
* The extension name - this must be unique.
|
|
525
|
+
* It will be used to identify the extension.
|
|
526
|
+
*
|
|
527
|
+
* @example 'myExtension'
|
|
528
|
+
*/
|
|
733
529
|
name: string;
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
* @example 'myExtension'
|
|
753
|
-
*/
|
|
530
|
+
/**
|
|
531
|
+
* The priority of your extension. The higher, the earlier it will be called
|
|
532
|
+
* and will take precedence over other extensions with a lower priority.
|
|
533
|
+
* @default 100
|
|
534
|
+
* @example 101
|
|
535
|
+
*/
|
|
536
|
+
priority?: number;
|
|
537
|
+
/**
|
|
538
|
+
* This method will add options to this extension
|
|
539
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#settings
|
|
540
|
+
* @example
|
|
541
|
+
* addOptions() {
|
|
542
|
+
* return {
|
|
543
|
+
* myOption: 'foo',
|
|
544
|
+
* myOtherOption: 10,
|
|
545
|
+
* }
|
|
546
|
+
*/
|
|
547
|
+
addOptions?: (this: {
|
|
754
548
|
name: string;
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
* parseHTML: element => element.style.textAlign || 'left',
|
|
819
|
-
* },
|
|
820
|
-
* },
|
|
821
|
-
* },
|
|
822
|
-
* ]
|
|
823
|
-
* }
|
|
824
|
-
*/
|
|
825
|
-
addGlobalAttributes?: (this: {
|
|
826
|
-
name: string;
|
|
827
|
-
options: Options;
|
|
828
|
-
storage: Storage;
|
|
829
|
-
extensions: (Node | Mark)[];
|
|
830
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'];
|
|
831
|
-
}) => GlobalAttributes;
|
|
832
|
-
/**
|
|
833
|
-
* This function adds commands to the editor
|
|
834
|
-
* @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
|
|
835
|
-
* @example
|
|
836
|
-
* addCommands() {
|
|
837
|
-
* return {
|
|
838
|
-
* myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
|
|
839
|
-
* }
|
|
840
|
-
* }
|
|
841
|
-
*/
|
|
842
|
-
addCommands?: (this: {
|
|
843
|
-
name: string;
|
|
844
|
-
options: Options;
|
|
845
|
-
storage: Storage;
|
|
846
|
-
editor: Editor;
|
|
847
|
-
type: MarkType$1;
|
|
848
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addCommands'];
|
|
849
|
-
}) => Partial<RawCommands>;
|
|
850
|
-
/**
|
|
851
|
-
* This function registers keyboard shortcuts.
|
|
852
|
-
* @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
|
|
853
|
-
* @example
|
|
854
|
-
* addKeyboardShortcuts() {
|
|
855
|
-
* return {
|
|
856
|
-
* 'Mod-l': () => this.editor.commands.toggleBulletList(),
|
|
857
|
-
* }
|
|
858
|
-
* },
|
|
859
|
-
*/
|
|
860
|
-
addKeyboardShortcuts?: (this: {
|
|
861
|
-
name: string;
|
|
862
|
-
options: Options;
|
|
863
|
-
storage: Storage;
|
|
864
|
-
editor: Editor;
|
|
865
|
-
type: MarkType$1;
|
|
866
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
867
|
-
}) => {
|
|
868
|
-
[key: string]: KeyboardShortcutCommand;
|
|
869
|
-
};
|
|
870
|
-
/**
|
|
871
|
-
* This function adds input rules to the editor.
|
|
872
|
-
* @see https://tiptap.dev/guide/custom-extensions#input-rules
|
|
873
|
-
* @example
|
|
874
|
-
* addInputRules() {
|
|
875
|
-
* return [
|
|
876
|
-
* markInputRule({
|
|
877
|
-
* find: inputRegex,
|
|
878
|
-
* type: this.type,
|
|
879
|
-
* }),
|
|
880
|
-
* ]
|
|
881
|
-
* },
|
|
882
|
-
*/
|
|
883
|
-
addInputRules?: (this: {
|
|
884
|
-
name: string;
|
|
885
|
-
options: Options;
|
|
886
|
-
storage: Storage;
|
|
887
|
-
editor: Editor;
|
|
888
|
-
type: MarkType$1;
|
|
889
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addInputRules'];
|
|
890
|
-
}) => InputRule[];
|
|
891
|
-
/**
|
|
892
|
-
* This function adds paste rules to the editor.
|
|
893
|
-
* @see https://tiptap.dev/guide/custom-extensions#paste-rules
|
|
894
|
-
* @example
|
|
895
|
-
* addPasteRules() {
|
|
896
|
-
* return [
|
|
897
|
-
* markPasteRule({
|
|
898
|
-
* find: pasteRegex,
|
|
899
|
-
* type: this.type,
|
|
900
|
-
* }),
|
|
901
|
-
* ]
|
|
902
|
-
* },
|
|
903
|
-
*/
|
|
904
|
-
addPasteRules?: (this: {
|
|
905
|
-
name: string;
|
|
906
|
-
options: Options;
|
|
907
|
-
storage: Storage;
|
|
908
|
-
editor: Editor;
|
|
909
|
-
type: MarkType$1;
|
|
910
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addPasteRules'];
|
|
911
|
-
}) => PasteRule[];
|
|
912
|
-
/**
|
|
913
|
-
* This function adds Prosemirror plugins to the editor
|
|
914
|
-
* @see https://tiptap.dev/guide/custom-extensions#prosemirror-plugins
|
|
915
|
-
* @example
|
|
916
|
-
* addProseMirrorPlugins() {
|
|
917
|
-
* return [
|
|
918
|
-
* customPlugin(),
|
|
919
|
-
* ]
|
|
920
|
-
* }
|
|
921
|
-
*/
|
|
922
|
-
addProseMirrorPlugins?: (this: {
|
|
923
|
-
name: string;
|
|
924
|
-
options: Options;
|
|
925
|
-
storage: Storage;
|
|
926
|
-
editor: Editor;
|
|
927
|
-
type: MarkType$1;
|
|
928
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
929
|
-
}) => Plugin[];
|
|
930
|
-
/**
|
|
931
|
-
* This function adds additional extensions to the editor. This is useful for
|
|
932
|
-
* building extension kits.
|
|
933
|
-
* @example
|
|
934
|
-
* addExtensions() {
|
|
935
|
-
* return [
|
|
936
|
-
* BulletList,
|
|
937
|
-
* OrderedList,
|
|
938
|
-
* ListItem
|
|
939
|
-
* ]
|
|
940
|
-
* }
|
|
941
|
-
*/
|
|
942
|
-
addExtensions?: (this: {
|
|
943
|
-
name: string;
|
|
944
|
-
options: Options;
|
|
945
|
-
storage: Storage;
|
|
946
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addExtensions'];
|
|
947
|
-
}) => Extensions;
|
|
948
|
-
/**
|
|
949
|
-
* This function extends the schema of the node.
|
|
950
|
-
* @example
|
|
951
|
-
* extendNodeSchema() {
|
|
952
|
-
* return {
|
|
953
|
-
* group: 'inline',
|
|
954
|
-
* selectable: false,
|
|
955
|
-
* }
|
|
956
|
-
* }
|
|
957
|
-
*/
|
|
958
|
-
extendNodeSchema?: ((this: {
|
|
959
|
-
name: string;
|
|
960
|
-
options: Options;
|
|
961
|
-
storage: Storage;
|
|
962
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['extendNodeSchema'];
|
|
963
|
-
}, extension: Node) => Record<string, any>) | null;
|
|
964
|
-
/**
|
|
965
|
-
* This function extends the schema of the mark.
|
|
966
|
-
* @example
|
|
967
|
-
* extendMarkSchema() {
|
|
968
|
-
* return {
|
|
969
|
-
* group: 'inline',
|
|
970
|
-
* selectable: false,
|
|
971
|
-
* }
|
|
972
|
-
* }
|
|
973
|
-
*/
|
|
974
|
-
extendMarkSchema?: ((this: {
|
|
975
|
-
name: string;
|
|
976
|
-
options: Options;
|
|
977
|
-
storage: Storage;
|
|
978
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['extendMarkSchema'];
|
|
979
|
-
}, extension: Mark) => Record<string, any>) | null;
|
|
980
|
-
/**
|
|
981
|
-
* The editor is not ready yet.
|
|
982
|
-
*/
|
|
983
|
-
onBeforeCreate?: ((this: {
|
|
984
|
-
name: string;
|
|
985
|
-
options: Options;
|
|
986
|
-
storage: Storage;
|
|
987
|
-
editor: Editor;
|
|
988
|
-
type: MarkType$1;
|
|
989
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onBeforeCreate'];
|
|
990
|
-
}) => void) | null;
|
|
991
|
-
/**
|
|
992
|
-
* The editor is ready.
|
|
993
|
-
*/
|
|
994
|
-
onCreate?: ((this: {
|
|
995
|
-
name: string;
|
|
996
|
-
options: Options;
|
|
997
|
-
storage: Storage;
|
|
998
|
-
editor: Editor;
|
|
999
|
-
type: MarkType$1;
|
|
1000
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onCreate'];
|
|
1001
|
-
}) => void) | null;
|
|
1002
|
-
/**
|
|
1003
|
-
* The content has changed.
|
|
1004
|
-
*/
|
|
1005
|
-
onUpdate?: ((this: {
|
|
1006
|
-
name: string;
|
|
1007
|
-
options: Options;
|
|
1008
|
-
storage: Storage;
|
|
1009
|
-
editor: Editor;
|
|
1010
|
-
type: MarkType$1;
|
|
1011
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onUpdate'];
|
|
1012
|
-
}) => void) | null;
|
|
1013
|
-
/**
|
|
1014
|
-
* The selection has changed.
|
|
1015
|
-
*/
|
|
1016
|
-
onSelectionUpdate?: ((this: {
|
|
1017
|
-
name: string;
|
|
1018
|
-
options: Options;
|
|
1019
|
-
storage: Storage;
|
|
1020
|
-
editor: Editor;
|
|
1021
|
-
type: MarkType$1;
|
|
1022
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onSelectionUpdate'];
|
|
1023
|
-
}) => void) | null;
|
|
1024
|
-
/**
|
|
1025
|
-
* The editor state has changed.
|
|
1026
|
-
*/
|
|
1027
|
-
onTransaction?: ((this: {
|
|
1028
|
-
name: string;
|
|
1029
|
-
options: Options;
|
|
1030
|
-
storage: Storage;
|
|
1031
|
-
editor: Editor;
|
|
1032
|
-
type: MarkType$1;
|
|
1033
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onTransaction'];
|
|
1034
|
-
}, props: {
|
|
1035
|
-
editor: Editor;
|
|
1036
|
-
transaction: Transaction;
|
|
1037
|
-
}) => void) | null;
|
|
1038
|
-
/**
|
|
1039
|
-
* The editor is focused.
|
|
1040
|
-
*/
|
|
1041
|
-
onFocus?: ((this: {
|
|
1042
|
-
name: string;
|
|
1043
|
-
options: Options;
|
|
1044
|
-
storage: Storage;
|
|
1045
|
-
editor: Editor;
|
|
1046
|
-
type: MarkType$1;
|
|
1047
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
|
|
1048
|
-
}, props: {
|
|
1049
|
-
event: FocusEvent;
|
|
1050
|
-
}) => void) | null;
|
|
1051
|
-
/**
|
|
1052
|
-
* The editor isn’t focused anymore.
|
|
1053
|
-
*/
|
|
1054
|
-
onBlur?: ((this: {
|
|
1055
|
-
name: string;
|
|
1056
|
-
options: Options;
|
|
1057
|
-
storage: Storage;
|
|
1058
|
-
editor: Editor;
|
|
1059
|
-
type: MarkType$1;
|
|
1060
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
|
|
1061
|
-
}, props: {
|
|
1062
|
-
event: FocusEvent;
|
|
1063
|
-
}) => void) | null;
|
|
1064
|
-
/**
|
|
1065
|
-
* The editor is destroyed.
|
|
1066
|
-
*/
|
|
1067
|
-
onDestroy?: ((this: {
|
|
1068
|
-
name: string;
|
|
1069
|
-
options: Options;
|
|
1070
|
-
storage: Storage;
|
|
1071
|
-
editor: Editor;
|
|
1072
|
-
type: MarkType$1;
|
|
1073
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
|
|
1074
|
-
}) => void) | null;
|
|
1075
|
-
/**
|
|
1076
|
-
* Keep mark after split node
|
|
1077
|
-
*/
|
|
1078
|
-
keepOnSplit?: boolean | (() => boolean);
|
|
1079
|
-
/**
|
|
1080
|
-
* Inclusive
|
|
1081
|
-
*/
|
|
1082
|
-
inclusive?: MarkSpec['inclusive'] | ((this: {
|
|
1083
|
-
name: string;
|
|
1084
|
-
options: Options;
|
|
1085
|
-
storage: Storage;
|
|
1086
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
|
|
1087
|
-
editor?: Editor;
|
|
1088
|
-
}) => MarkSpec['inclusive']);
|
|
1089
|
-
/**
|
|
1090
|
-
* Excludes
|
|
1091
|
-
*/
|
|
1092
|
-
excludes?: MarkSpec['excludes'] | ((this: {
|
|
1093
|
-
name: string;
|
|
1094
|
-
options: Options;
|
|
1095
|
-
storage: Storage;
|
|
1096
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
|
|
1097
|
-
editor?: Editor;
|
|
1098
|
-
}) => MarkSpec['excludes']);
|
|
1099
|
-
/**
|
|
1100
|
-
* Marks this Mark as exitable
|
|
1101
|
-
*/
|
|
1102
|
-
exitable?: boolean | (() => boolean);
|
|
1103
|
-
/**
|
|
1104
|
-
* Group
|
|
1105
|
-
*/
|
|
1106
|
-
group?: MarkSpec['group'] | ((this: {
|
|
1107
|
-
name: string;
|
|
1108
|
-
options: Options;
|
|
1109
|
-
storage: Storage;
|
|
1110
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
|
|
1111
|
-
editor?: Editor;
|
|
1112
|
-
}) => MarkSpec['group']);
|
|
1113
|
-
/**
|
|
1114
|
-
* Spanning
|
|
1115
|
-
*/
|
|
1116
|
-
spanning?: MarkSpec['spanning'] | ((this: {
|
|
1117
|
-
name: string;
|
|
1118
|
-
options: Options;
|
|
1119
|
-
storage: Storage;
|
|
1120
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
|
|
1121
|
-
editor?: Editor;
|
|
1122
|
-
}) => MarkSpec['spanning']);
|
|
1123
|
-
/**
|
|
1124
|
-
* Code
|
|
1125
|
-
*/
|
|
1126
|
-
code?: boolean | ((this: {
|
|
1127
|
-
name: string;
|
|
1128
|
-
options: Options;
|
|
1129
|
-
storage: Storage;
|
|
1130
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
|
|
1131
|
-
editor?: Editor;
|
|
1132
|
-
}) => boolean);
|
|
1133
|
-
/**
|
|
1134
|
-
* Parse HTML
|
|
1135
|
-
*/
|
|
1136
|
-
parseHTML?: (this: {
|
|
1137
|
-
name: string;
|
|
1138
|
-
options: Options;
|
|
1139
|
-
storage: Storage;
|
|
1140
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
|
|
1141
|
-
editor?: Editor;
|
|
1142
|
-
}) => MarkSpec['parseDOM'];
|
|
1143
|
-
/**
|
|
1144
|
-
* Render HTML
|
|
1145
|
-
*/
|
|
1146
|
-
renderHTML?: ((this: {
|
|
1147
|
-
name: string;
|
|
1148
|
-
options: Options;
|
|
1149
|
-
storage: Storage;
|
|
1150
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
|
|
1151
|
-
editor?: Editor;
|
|
1152
|
-
}, props: {
|
|
1153
|
-
mark: Mark$1;
|
|
1154
|
-
HTMLAttributes: Record<string, any>;
|
|
1155
|
-
}) => DOMOutputSpec) | null;
|
|
1156
|
-
/**
|
|
1157
|
-
* Attributes
|
|
1158
|
-
*/
|
|
1159
|
-
addAttributes?: (this: {
|
|
1160
|
-
name: string;
|
|
1161
|
-
options: Options;
|
|
1162
|
-
storage: Storage;
|
|
1163
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
|
|
1164
|
-
editor?: Editor;
|
|
1165
|
-
}) => Attributes | {};
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* The Mark class is used to create custom mark extensions.
|
|
1170
|
-
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
1171
|
-
*/
|
|
1172
|
-
declare class Mark<Options = any, Storage = any> {
|
|
1173
|
-
type: string;
|
|
1174
|
-
name: string;
|
|
1175
|
-
parent: Mark | null;
|
|
1176
|
-
child: Mark | null;
|
|
1177
|
-
options: Options;
|
|
1178
|
-
storage: Storage;
|
|
1179
|
-
config: MarkConfig;
|
|
1180
|
-
constructor(config?: Partial<MarkConfig<Options, Storage>>);
|
|
1181
|
-
static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
|
|
1182
|
-
configure(options?: Partial<Options>): Mark<Options, Storage>;
|
|
1183
|
-
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
|
|
1184
|
-
static handleExit({ editor, mark }: {
|
|
549
|
+
parent: ParentConfig<Config>['addOptions'];
|
|
550
|
+
}) => Options;
|
|
551
|
+
/**
|
|
552
|
+
* The default storage this extension can save data to.
|
|
553
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#storage
|
|
554
|
+
* @example
|
|
555
|
+
* defaultStorage: {
|
|
556
|
+
* prefetchedUsers: [],
|
|
557
|
+
* loading: false,
|
|
558
|
+
* }
|
|
559
|
+
*/
|
|
560
|
+
addStorage?: (this: {
|
|
561
|
+
name: string;
|
|
562
|
+
options: Options;
|
|
563
|
+
parent: ParentConfig<Config>['addStorage'];
|
|
564
|
+
}) => Storage;
|
|
565
|
+
/**
|
|
566
|
+
* This function adds globalAttributes to specific nodes.
|
|
567
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#global-attributes
|
|
568
|
+
* @example
|
|
569
|
+
* addGlobalAttributes() {
|
|
570
|
+
* return [
|
|
571
|
+
* {
|
|
572
|
+
// Extend the following extensions
|
|
573
|
+
* types: [
|
|
574
|
+
* 'heading',
|
|
575
|
+
* 'paragraph',
|
|
576
|
+
* ],
|
|
577
|
+
* // … with those attributes
|
|
578
|
+
* attributes: {
|
|
579
|
+
* textAlign: {
|
|
580
|
+
* default: 'left',
|
|
581
|
+
* renderHTML: attributes => ({
|
|
582
|
+
* style: `text-align: ${attributes.textAlign}`,
|
|
583
|
+
* }),
|
|
584
|
+
* parseHTML: element => element.style.textAlign || 'left',
|
|
585
|
+
* },
|
|
586
|
+
* },
|
|
587
|
+
* },
|
|
588
|
+
* ]
|
|
589
|
+
* }
|
|
590
|
+
*/
|
|
591
|
+
addGlobalAttributes?: (this: {
|
|
592
|
+
name: string;
|
|
593
|
+
options: Options;
|
|
594
|
+
storage: Storage;
|
|
595
|
+
extensions: (Node | Mark)[];
|
|
596
|
+
parent: ParentConfig<Config>['addGlobalAttributes'];
|
|
597
|
+
}) => GlobalAttributes;
|
|
598
|
+
/**
|
|
599
|
+
* This function adds commands to the editor
|
|
600
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#commands
|
|
601
|
+
* @example
|
|
602
|
+
* addCommands() {
|
|
603
|
+
* return {
|
|
604
|
+
* myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
|
|
605
|
+
* }
|
|
606
|
+
* }
|
|
607
|
+
*/
|
|
608
|
+
addCommands?: (this: {
|
|
609
|
+
name: string;
|
|
610
|
+
options: Options;
|
|
611
|
+
storage: Storage;
|
|
1185
612
|
editor: Editor;
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
613
|
+
type: PMType;
|
|
614
|
+
parent: ParentConfig<Config>['addCommands'];
|
|
615
|
+
}) => Partial<RawCommands>;
|
|
616
|
+
/**
|
|
617
|
+
* This function registers keyboard shortcuts.
|
|
618
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#keyboard-shortcuts
|
|
619
|
+
* @example
|
|
620
|
+
* addKeyboardShortcuts() {
|
|
621
|
+
* return {
|
|
622
|
+
* 'Mod-l': () => this.editor.commands.toggleBulletList(),
|
|
623
|
+
* }
|
|
624
|
+
* },
|
|
625
|
+
*/
|
|
626
|
+
addKeyboardShortcuts?: (this: {
|
|
1199
627
|
name: string;
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
* The editor is not ready yet.
|
|
1422
|
-
*/
|
|
1423
|
-
onBeforeCreate?: ((this: {
|
|
1424
|
-
name: string;
|
|
1425
|
-
options: Options;
|
|
1426
|
-
storage: Storage;
|
|
1427
|
-
editor: Editor;
|
|
1428
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBeforeCreate'];
|
|
1429
|
-
}) => void) | null;
|
|
1430
|
-
/**
|
|
1431
|
-
* The editor is ready.
|
|
1432
|
-
*/
|
|
1433
|
-
onCreate?: ((this: {
|
|
1434
|
-
name: string;
|
|
1435
|
-
options: Options;
|
|
1436
|
-
storage: Storage;
|
|
1437
|
-
editor: Editor;
|
|
1438
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onCreate'];
|
|
1439
|
-
}) => void) | null;
|
|
1440
|
-
/**
|
|
1441
|
-
* The content has changed.
|
|
1442
|
-
*/
|
|
1443
|
-
onUpdate?: ((this: {
|
|
1444
|
-
name: string;
|
|
1445
|
-
options: Options;
|
|
1446
|
-
storage: Storage;
|
|
1447
|
-
editor: Editor;
|
|
1448
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onUpdate'];
|
|
1449
|
-
}) => void) | null;
|
|
1450
|
-
/**
|
|
1451
|
-
* The selection has changed.
|
|
1452
|
-
*/
|
|
1453
|
-
onSelectionUpdate?: ((this: {
|
|
1454
|
-
name: string;
|
|
1455
|
-
options: Options;
|
|
1456
|
-
storage: Storage;
|
|
1457
|
-
editor: Editor;
|
|
1458
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onSelectionUpdate'];
|
|
1459
|
-
}) => void) | null;
|
|
1460
|
-
/**
|
|
1461
|
-
* The editor state has changed.
|
|
1462
|
-
*/
|
|
1463
|
-
onTransaction?: ((this: {
|
|
1464
|
-
name: string;
|
|
1465
|
-
options: Options;
|
|
1466
|
-
storage: Storage;
|
|
1467
|
-
editor: Editor;
|
|
1468
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onTransaction'];
|
|
1469
|
-
}, props: {
|
|
1470
|
-
editor: Editor;
|
|
1471
|
-
transaction: Transaction;
|
|
1472
|
-
}) => void) | null;
|
|
1473
|
-
/**
|
|
1474
|
-
* The editor is focused.
|
|
1475
|
-
*/
|
|
1476
|
-
onFocus?: ((this: {
|
|
1477
|
-
name: string;
|
|
1478
|
-
options: Options;
|
|
1479
|
-
storage: Storage;
|
|
1480
|
-
editor: Editor;
|
|
1481
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onFocus'];
|
|
1482
|
-
}, props: {
|
|
1483
|
-
event: FocusEvent;
|
|
1484
|
-
}) => void) | null;
|
|
1485
|
-
/**
|
|
1486
|
-
* The editor isn’t focused anymore.
|
|
1487
|
-
*/
|
|
1488
|
-
onBlur?: ((this: {
|
|
1489
|
-
name: string;
|
|
1490
|
-
options: Options;
|
|
1491
|
-
storage: Storage;
|
|
1492
|
-
editor: Editor;
|
|
1493
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBlur'];
|
|
1494
|
-
}, props: {
|
|
1495
|
-
event: FocusEvent;
|
|
1496
|
-
}) => void) | null;
|
|
1497
|
-
/**
|
|
1498
|
-
* The editor is destroyed.
|
|
1499
|
-
*/
|
|
1500
|
-
onDestroy?: ((this: {
|
|
1501
|
-
name: string;
|
|
1502
|
-
options: Options;
|
|
1503
|
-
storage: Storage;
|
|
1504
|
-
editor: Editor;
|
|
1505
|
-
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onDestroy'];
|
|
1506
|
-
}) => void) | null;
|
|
1507
|
-
}
|
|
628
|
+
options: Options;
|
|
629
|
+
storage: Storage;
|
|
630
|
+
editor: Editor;
|
|
631
|
+
type: PMType;
|
|
632
|
+
parent: ParentConfig<Config>['addKeyboardShortcuts'];
|
|
633
|
+
}) => {
|
|
634
|
+
[key: string]: KeyboardShortcutCommand;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* This function adds input rules to the editor.
|
|
638
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#input-rules
|
|
639
|
+
* @example
|
|
640
|
+
* addInputRules() {
|
|
641
|
+
* return [
|
|
642
|
+
* markInputRule({
|
|
643
|
+
* find: inputRegex,
|
|
644
|
+
* type: this.type,
|
|
645
|
+
* }),
|
|
646
|
+
* ]
|
|
647
|
+
* },
|
|
648
|
+
*/
|
|
649
|
+
addInputRules?: (this: {
|
|
650
|
+
name: string;
|
|
651
|
+
options: Options;
|
|
652
|
+
storage: Storage;
|
|
653
|
+
editor: Editor;
|
|
654
|
+
type: PMType;
|
|
655
|
+
parent: ParentConfig<Config>['addInputRules'];
|
|
656
|
+
}) => InputRule[];
|
|
657
|
+
/**
|
|
658
|
+
* This function adds paste rules to the editor.
|
|
659
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#paste-rules
|
|
660
|
+
* @example
|
|
661
|
+
* addPasteRules() {
|
|
662
|
+
* return [
|
|
663
|
+
* markPasteRule({
|
|
664
|
+
* find: pasteRegex,
|
|
665
|
+
* type: this.type,
|
|
666
|
+
* }),
|
|
667
|
+
* ]
|
|
668
|
+
* },
|
|
669
|
+
*/
|
|
670
|
+
addPasteRules?: (this: {
|
|
671
|
+
name: string;
|
|
672
|
+
options: Options;
|
|
673
|
+
storage: Storage;
|
|
674
|
+
editor: Editor;
|
|
675
|
+
type: PMType;
|
|
676
|
+
parent: ParentConfig<Config>['addPasteRules'];
|
|
677
|
+
}) => PasteRule[];
|
|
678
|
+
/**
|
|
679
|
+
* This function adds Prosemirror plugins to the editor
|
|
680
|
+
* @see https://tiptap.dev/docs/editor/guide/custom-extensions#prosemirror-plugins
|
|
681
|
+
* @example
|
|
682
|
+
* addProseMirrorPlugins() {
|
|
683
|
+
* return [
|
|
684
|
+
* customPlugin(),
|
|
685
|
+
* ]
|
|
686
|
+
* }
|
|
687
|
+
*/
|
|
688
|
+
addProseMirrorPlugins?: (this: {
|
|
689
|
+
name: string;
|
|
690
|
+
options: Options;
|
|
691
|
+
storage: Storage;
|
|
692
|
+
editor: Editor;
|
|
693
|
+
type: PMType;
|
|
694
|
+
parent: ParentConfig<Config>['addProseMirrorPlugins'];
|
|
695
|
+
}) => Plugin[];
|
|
696
|
+
/**
|
|
697
|
+
* This function adds additional extensions to the editor. This is useful for
|
|
698
|
+
* building extension kits.
|
|
699
|
+
* @example
|
|
700
|
+
* addExtensions() {
|
|
701
|
+
* return [
|
|
702
|
+
* BulletList,
|
|
703
|
+
* OrderedList,
|
|
704
|
+
* ListItem
|
|
705
|
+
* ]
|
|
706
|
+
* }
|
|
707
|
+
*/
|
|
708
|
+
addExtensions?: (this: {
|
|
709
|
+
name: string;
|
|
710
|
+
options: Options;
|
|
711
|
+
storage: Storage;
|
|
712
|
+
parent: ParentConfig<Config>['addExtensions'];
|
|
713
|
+
}) => Extensions;
|
|
714
|
+
/**
|
|
715
|
+
* This function extends the schema of the node.
|
|
716
|
+
* @example
|
|
717
|
+
* extendNodeSchema() {
|
|
718
|
+
* return {
|
|
719
|
+
* group: 'inline',
|
|
720
|
+
* selectable: false,
|
|
721
|
+
* }
|
|
722
|
+
* }
|
|
723
|
+
*/
|
|
724
|
+
extendNodeSchema?: ((this: {
|
|
725
|
+
name: string;
|
|
726
|
+
options: Options;
|
|
727
|
+
storage: Storage;
|
|
728
|
+
parent: ParentConfig<Config>['extendNodeSchema'];
|
|
729
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
730
|
+
/**
|
|
731
|
+
* This function extends the schema of the mark.
|
|
732
|
+
* @example
|
|
733
|
+
* extendMarkSchema() {
|
|
734
|
+
* return {
|
|
735
|
+
* group: 'inline',
|
|
736
|
+
* selectable: false,
|
|
737
|
+
* }
|
|
738
|
+
* }
|
|
739
|
+
*/
|
|
740
|
+
extendMarkSchema?: ((this: {
|
|
741
|
+
name: string;
|
|
742
|
+
options: Options;
|
|
743
|
+
storage: Storage;
|
|
744
|
+
parent: ParentConfig<Config>['extendMarkSchema'];
|
|
745
|
+
}, extension: Mark) => Record<string, any>) | null;
|
|
746
|
+
/**
|
|
747
|
+
* The editor is not ready yet.
|
|
748
|
+
*/
|
|
749
|
+
onBeforeCreate?: ((this: {
|
|
750
|
+
name: string;
|
|
751
|
+
options: Options;
|
|
752
|
+
storage: Storage;
|
|
753
|
+
editor: Editor;
|
|
754
|
+
type: PMType;
|
|
755
|
+
parent: ParentConfig<Config>['onBeforeCreate'];
|
|
756
|
+
}, event: EditorEvents['beforeCreate']) => void) | null;
|
|
757
|
+
/**
|
|
758
|
+
* The editor is ready.
|
|
759
|
+
*/
|
|
760
|
+
onCreate?: ((this: {
|
|
761
|
+
name: string;
|
|
762
|
+
options: Options;
|
|
763
|
+
storage: Storage;
|
|
764
|
+
editor: Editor;
|
|
765
|
+
type: PMType;
|
|
766
|
+
parent: ParentConfig<Config>['onCreate'];
|
|
767
|
+
}, event: EditorEvents['create']) => void) | null;
|
|
768
|
+
/**
|
|
769
|
+
* The content has changed.
|
|
770
|
+
*/
|
|
771
|
+
onUpdate?: ((this: {
|
|
772
|
+
name: string;
|
|
773
|
+
options: Options;
|
|
774
|
+
storage: Storage;
|
|
775
|
+
editor: Editor;
|
|
776
|
+
type: PMType;
|
|
777
|
+
parent: ParentConfig<Config>['onUpdate'];
|
|
778
|
+
}, event: EditorEvents['update']) => void) | null;
|
|
779
|
+
/**
|
|
780
|
+
* The selection has changed.
|
|
781
|
+
*/
|
|
782
|
+
onSelectionUpdate?: ((this: {
|
|
783
|
+
name: string;
|
|
784
|
+
options: Options;
|
|
785
|
+
storage: Storage;
|
|
786
|
+
editor: Editor;
|
|
787
|
+
type: PMType;
|
|
788
|
+
parent: ParentConfig<Config>['onSelectionUpdate'];
|
|
789
|
+
}, event: EditorEvents['selectionUpdate']) => void) | null;
|
|
790
|
+
/**
|
|
791
|
+
* The editor state has changed.
|
|
792
|
+
*/
|
|
793
|
+
onTransaction?: ((this: {
|
|
794
|
+
name: string;
|
|
795
|
+
options: Options;
|
|
796
|
+
storage: Storage;
|
|
797
|
+
editor: Editor;
|
|
798
|
+
type: PMType;
|
|
799
|
+
parent: ParentConfig<Config>['onTransaction'];
|
|
800
|
+
}, event: EditorEvents['transaction']) => void) | null;
|
|
801
|
+
/**
|
|
802
|
+
* The editor is focused.
|
|
803
|
+
*/
|
|
804
|
+
onFocus?: ((this: {
|
|
805
|
+
name: string;
|
|
806
|
+
options: Options;
|
|
807
|
+
storage: Storage;
|
|
808
|
+
editor: Editor;
|
|
809
|
+
type: PMType;
|
|
810
|
+
parent: ParentConfig<Config>['onFocus'];
|
|
811
|
+
}, event: EditorEvents['focus']) => void) | null;
|
|
812
|
+
/**
|
|
813
|
+
* The editor isn’t focused anymore.
|
|
814
|
+
*/
|
|
815
|
+
onBlur?: ((this: {
|
|
816
|
+
name: string;
|
|
817
|
+
options: Options;
|
|
818
|
+
storage: Storage;
|
|
819
|
+
editor: Editor;
|
|
820
|
+
type: PMType;
|
|
821
|
+
parent: ParentConfig<Config>['onBlur'];
|
|
822
|
+
}, event: EditorEvents['blur']) => void) | null;
|
|
823
|
+
/**
|
|
824
|
+
* The editor is destroyed.
|
|
825
|
+
*/
|
|
826
|
+
onDestroy?: ((this: {
|
|
827
|
+
name: string;
|
|
828
|
+
options: Options;
|
|
829
|
+
storage: Storage;
|
|
830
|
+
editor: Editor;
|
|
831
|
+
type: PMType;
|
|
832
|
+
parent: ParentConfig<Config>['onDestroy'];
|
|
833
|
+
}, event: EditorEvents['destroy']) => void) | null;
|
|
834
|
+
}
|
|
835
|
+
declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>> {
|
|
836
|
+
type: string;
|
|
837
|
+
parent: Extendable | null;
|
|
838
|
+
child: Extendable | null;
|
|
839
|
+
name: string;
|
|
840
|
+
config: Config;
|
|
841
|
+
constructor(config?: Partial<Config>);
|
|
842
|
+
get options(): Options;
|
|
843
|
+
get storage(): Readonly<Storage>;
|
|
844
|
+
configure(options?: Partial<Options>): Extendable<Options, Storage, ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>>;
|
|
845
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage> | NodeConfig<ExtendedOptions, ExtendedStorage> | MarkConfig<ExtendedOptions, ExtendedStorage>>): Extendable<ExtendedOptions, ExtendedStorage>;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
interface ExtensionConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, ExtensionConfig<Options, Storage>, null> {
|
|
1508
849
|
}
|
|
1509
850
|
/**
|
|
1510
851
|
* The Extension class is the base class for all extensions.
|
|
1511
852
|
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
1512
853
|
*/
|
|
1513
|
-
declare class Extension<Options = any, Storage = any> {
|
|
854
|
+
declare class Extension<Options = any, Storage = any> extends Extendable<Options, Storage> {
|
|
1514
855
|
type: string;
|
|
1515
|
-
name: string;
|
|
1516
|
-
parent: Extension | null;
|
|
1517
|
-
child: Extension | null;
|
|
1518
|
-
options: Options;
|
|
1519
|
-
storage: Storage;
|
|
1520
|
-
config: ExtensionConfig;
|
|
1521
|
-
constructor(config?: Partial<ExtensionConfig<Options, Storage>>);
|
|
1522
856
|
static create<O = any, S = any>(config?: Partial<ExtensionConfig<O, S>>): Extension<O, S>;
|
|
1523
|
-
configure(options?: Partial<Options>): Extension<Options, Storage>;
|
|
1524
|
-
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>): Extension<ExtendedOptions, ExtendedStorage>;
|
|
1525
857
|
}
|
|
1526
858
|
|
|
1527
859
|
type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig;
|
|
@@ -1536,13 +868,25 @@ type MaybeReturnType<T> = T extends (...args: any) => any ? ReturnType<T> : T;
|
|
|
1536
868
|
type MaybeThisParameterType<T> = Exclude<T, Primitive> extends (...args: any) => any ? ThisParameterType<Exclude<T, Primitive>> : any;
|
|
1537
869
|
interface EditorEvents {
|
|
1538
870
|
beforeCreate: {
|
|
871
|
+
/**
|
|
872
|
+
* The editor instance
|
|
873
|
+
*/
|
|
1539
874
|
editor: Editor;
|
|
1540
875
|
};
|
|
1541
876
|
create: {
|
|
877
|
+
/**
|
|
878
|
+
* The editor instance
|
|
879
|
+
*/
|
|
1542
880
|
editor: Editor;
|
|
1543
881
|
};
|
|
1544
882
|
contentError: {
|
|
883
|
+
/**
|
|
884
|
+
* The editor instance
|
|
885
|
+
*/
|
|
1545
886
|
editor: Editor;
|
|
887
|
+
/**
|
|
888
|
+
* The error that occurred while parsing the content
|
|
889
|
+
*/
|
|
1546
890
|
error: Error;
|
|
1547
891
|
/**
|
|
1548
892
|
* If called, will re-initialize the editor with the collaboration extension removed.
|
|
@@ -1551,64 +895,247 @@ interface EditorEvents {
|
|
|
1551
895
|
disableCollaboration: () => void;
|
|
1552
896
|
};
|
|
1553
897
|
update: {
|
|
898
|
+
/**
|
|
899
|
+
* The editor instance
|
|
900
|
+
*/
|
|
1554
901
|
editor: Editor;
|
|
902
|
+
/**
|
|
903
|
+
* The transaction that caused the update
|
|
904
|
+
*/
|
|
1555
905
|
transaction: Transaction;
|
|
906
|
+
/**
|
|
907
|
+
* Appended transactions that were added to the initial transaction by plugins
|
|
908
|
+
*/
|
|
1556
909
|
appendedTransactions: Transaction[];
|
|
1557
910
|
};
|
|
1558
911
|
selectionUpdate: {
|
|
912
|
+
/**
|
|
913
|
+
* The editor instance
|
|
914
|
+
*/
|
|
1559
915
|
editor: Editor;
|
|
916
|
+
/**
|
|
917
|
+
* The transaction that caused the selection update
|
|
918
|
+
*/
|
|
1560
919
|
transaction: Transaction;
|
|
1561
920
|
};
|
|
1562
921
|
beforeTransaction: {
|
|
922
|
+
/**
|
|
923
|
+
* The editor instance
|
|
924
|
+
*/
|
|
1563
925
|
editor: Editor;
|
|
926
|
+
/**
|
|
927
|
+
* The transaction that will be applied
|
|
928
|
+
*/
|
|
1564
929
|
transaction: Transaction;
|
|
930
|
+
/**
|
|
931
|
+
* The next state of the editor after the transaction is applied
|
|
932
|
+
*/
|
|
1565
933
|
nextState: EditorState;
|
|
1566
934
|
};
|
|
1567
935
|
transaction: {
|
|
936
|
+
/**
|
|
937
|
+
* The editor instance
|
|
938
|
+
*/
|
|
1568
939
|
editor: Editor;
|
|
940
|
+
/**
|
|
941
|
+
* The initial transaction
|
|
942
|
+
*/
|
|
1569
943
|
transaction: Transaction;
|
|
944
|
+
/**
|
|
945
|
+
* Appended transactions that were added to the initial transaction by plugins
|
|
946
|
+
*/
|
|
1570
947
|
appendedTransactions: Transaction[];
|
|
1571
948
|
};
|
|
1572
949
|
focus: {
|
|
950
|
+
/**
|
|
951
|
+
* The editor instance
|
|
952
|
+
*/
|
|
1573
953
|
editor: Editor;
|
|
954
|
+
/**
|
|
955
|
+
* The focus event
|
|
956
|
+
*/
|
|
1574
957
|
event: FocusEvent;
|
|
958
|
+
/**
|
|
959
|
+
* The transaction that caused the focus
|
|
960
|
+
*/
|
|
1575
961
|
transaction: Transaction;
|
|
1576
962
|
};
|
|
1577
963
|
blur: {
|
|
964
|
+
/**
|
|
965
|
+
* The editor instance
|
|
966
|
+
*/
|
|
1578
967
|
editor: Editor;
|
|
968
|
+
/**
|
|
969
|
+
* The focus event
|
|
970
|
+
*/
|
|
1579
971
|
event: FocusEvent;
|
|
972
|
+
/**
|
|
973
|
+
* The transaction that caused the blur
|
|
974
|
+
*/
|
|
1580
975
|
transaction: Transaction;
|
|
1581
976
|
};
|
|
1582
977
|
destroy: void;
|
|
1583
978
|
paste: {
|
|
979
|
+
/**
|
|
980
|
+
* The editor instance
|
|
981
|
+
*/
|
|
1584
982
|
editor: Editor;
|
|
983
|
+
/**
|
|
984
|
+
* The clipboard event
|
|
985
|
+
*/
|
|
1585
986
|
event: ClipboardEvent;
|
|
987
|
+
/**
|
|
988
|
+
* The slice that was pasted
|
|
989
|
+
*/
|
|
1586
990
|
slice: Slice;
|
|
1587
991
|
};
|
|
1588
992
|
drop: {
|
|
993
|
+
/**
|
|
994
|
+
* The editor instance
|
|
995
|
+
*/
|
|
1589
996
|
editor: Editor;
|
|
997
|
+
/**
|
|
998
|
+
* The drag event
|
|
999
|
+
*/
|
|
1590
1000
|
event: DragEvent;
|
|
1001
|
+
/**
|
|
1002
|
+
* The slice that was dropped
|
|
1003
|
+
*/
|
|
1591
1004
|
slice: Slice;
|
|
1005
|
+
/**
|
|
1006
|
+
* Whether the content was moved (true) or copied (false)
|
|
1007
|
+
*/
|
|
1592
1008
|
moved: boolean;
|
|
1593
1009
|
};
|
|
1010
|
+
delete: {
|
|
1011
|
+
/**
|
|
1012
|
+
* The editor instance
|
|
1013
|
+
*/
|
|
1014
|
+
editor: Editor;
|
|
1015
|
+
/**
|
|
1016
|
+
* The range of the deleted content (before the deletion)
|
|
1017
|
+
*/
|
|
1018
|
+
deletedRange: Range;
|
|
1019
|
+
/**
|
|
1020
|
+
* The new range of positions of where the deleted content was in the new document (after the deletion)
|
|
1021
|
+
*/
|
|
1022
|
+
newRange: Range;
|
|
1023
|
+
/**
|
|
1024
|
+
* The transaction that caused the deletion
|
|
1025
|
+
*/
|
|
1026
|
+
transaction: Transaction;
|
|
1027
|
+
/**
|
|
1028
|
+
* The combined transform (including all appended transactions) that caused the deletion
|
|
1029
|
+
*/
|
|
1030
|
+
combinedTransform: Transform;
|
|
1031
|
+
/**
|
|
1032
|
+
* Whether the deletion was partial (only a part of this content was deleted)
|
|
1033
|
+
*/
|
|
1034
|
+
partial: boolean;
|
|
1035
|
+
/**
|
|
1036
|
+
* This is the start position of the mark in the document (before the deletion)
|
|
1037
|
+
*/
|
|
1038
|
+
from: number;
|
|
1039
|
+
/**
|
|
1040
|
+
* This is the end position of the mark in the document (before the deletion)
|
|
1041
|
+
*/
|
|
1042
|
+
to: number;
|
|
1043
|
+
} & ({
|
|
1044
|
+
/**
|
|
1045
|
+
* The content that was deleted
|
|
1046
|
+
*/
|
|
1047
|
+
type: 'node';
|
|
1048
|
+
/**
|
|
1049
|
+
* The node which the deletion occurred in
|
|
1050
|
+
* @note This can be a parent node of the deleted content
|
|
1051
|
+
*/
|
|
1052
|
+
node: Node$1;
|
|
1053
|
+
/**
|
|
1054
|
+
* The new start position of the node in the document (after the deletion)
|
|
1055
|
+
*/
|
|
1056
|
+
newFrom: number;
|
|
1057
|
+
/**
|
|
1058
|
+
* The new end position of the node in the document (after the deletion)
|
|
1059
|
+
*/
|
|
1060
|
+
newTo: number;
|
|
1061
|
+
} | {
|
|
1062
|
+
/**
|
|
1063
|
+
* The content that was deleted
|
|
1064
|
+
*/
|
|
1065
|
+
type: 'mark';
|
|
1066
|
+
/**
|
|
1067
|
+
* The mark that was deleted
|
|
1068
|
+
*/
|
|
1069
|
+
mark: Mark$1;
|
|
1070
|
+
});
|
|
1594
1071
|
}
|
|
1595
1072
|
type EnableRules = (AnyExtension | string)[] | boolean;
|
|
1596
1073
|
interface EditorOptions {
|
|
1597
|
-
|
|
1074
|
+
/**
|
|
1075
|
+
* The element or selector to bind the editor to
|
|
1076
|
+
* If `null` is passed, the editor will not be mounted automatically
|
|
1077
|
+
* If a function is passed, it will be called with the editor's root element
|
|
1078
|
+
*/
|
|
1079
|
+
element: Element | null;
|
|
1080
|
+
/**
|
|
1081
|
+
* The content of the editor (HTML, JSON, or a JSON array)
|
|
1082
|
+
*/
|
|
1598
1083
|
content: Content;
|
|
1084
|
+
/**
|
|
1085
|
+
* The extensions to use
|
|
1086
|
+
*/
|
|
1599
1087
|
extensions: Extensions;
|
|
1088
|
+
/**
|
|
1089
|
+
* Whether to inject base CSS styles
|
|
1090
|
+
*/
|
|
1600
1091
|
injectCSS: boolean;
|
|
1092
|
+
/**
|
|
1093
|
+
* A nonce to use for CSP while injecting styles
|
|
1094
|
+
*/
|
|
1601
1095
|
injectNonce: string | undefined;
|
|
1096
|
+
/**
|
|
1097
|
+
* The editor's initial focus position
|
|
1098
|
+
*/
|
|
1602
1099
|
autofocus: FocusPosition;
|
|
1100
|
+
/**
|
|
1101
|
+
* Whether the editor is editable
|
|
1102
|
+
*/
|
|
1603
1103
|
editable: boolean;
|
|
1104
|
+
/**
|
|
1105
|
+
* The editor's props
|
|
1106
|
+
*/
|
|
1604
1107
|
editorProps: EditorProps;
|
|
1108
|
+
/**
|
|
1109
|
+
* The editor's content parser options
|
|
1110
|
+
*/
|
|
1605
1111
|
parseOptions: ParseOptions;
|
|
1112
|
+
/**
|
|
1113
|
+
* The editor's core extension options
|
|
1114
|
+
*/
|
|
1606
1115
|
coreExtensionOptions?: {
|
|
1607
1116
|
clipboardTextSerializer?: {
|
|
1608
1117
|
blockSeparator?: string;
|
|
1609
1118
|
};
|
|
1119
|
+
delete?: {
|
|
1120
|
+
/**
|
|
1121
|
+
* Whether the `delete` extension should be called asynchronously to avoid blocking the editor while processing deletions
|
|
1122
|
+
* @default true deletion events are called asynchronously
|
|
1123
|
+
*/
|
|
1124
|
+
async?: boolean;
|
|
1125
|
+
/**
|
|
1126
|
+
* Allows filtering the transactions that are processed by the `delete` extension.
|
|
1127
|
+
* If the function returns `true`, the transaction will be ignored.
|
|
1128
|
+
*/
|
|
1129
|
+
filterTransaction?: (transaction: Transaction) => boolean;
|
|
1130
|
+
};
|
|
1610
1131
|
};
|
|
1132
|
+
/**
|
|
1133
|
+
* Whether to enable input rules behavior
|
|
1134
|
+
*/
|
|
1611
1135
|
enableInputRules: EnableRules;
|
|
1136
|
+
/**
|
|
1137
|
+
* Whether to enable paste rules behavior
|
|
1138
|
+
*/
|
|
1612
1139
|
enablePasteRules: EnableRules;
|
|
1613
1140
|
/**
|
|
1614
1141
|
* Determines whether core extensions are enabled.
|
|
@@ -1627,7 +1154,7 @@ interface EditorOptions {
|
|
|
1627
1154
|
*
|
|
1628
1155
|
* @default true
|
|
1629
1156
|
*/
|
|
1630
|
-
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste', false>>;
|
|
1157
|
+
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste' | 'delete', false>>;
|
|
1631
1158
|
/**
|
|
1632
1159
|
* If `true`, the editor will check the content for errors on initialization.
|
|
1633
1160
|
* Emitting the `contentError` event if the content is invalid.
|
|
@@ -1635,23 +1162,63 @@ interface EditorOptions {
|
|
|
1635
1162
|
* @default false
|
|
1636
1163
|
*/
|
|
1637
1164
|
enableContentCheck: boolean;
|
|
1165
|
+
/**
|
|
1166
|
+
* Called before the editor is constructed.
|
|
1167
|
+
*/
|
|
1638
1168
|
onBeforeCreate: (props: EditorEvents['beforeCreate']) => void;
|
|
1169
|
+
/**
|
|
1170
|
+
* Called after the editor is constructed.
|
|
1171
|
+
*/
|
|
1639
1172
|
onCreate: (props: EditorEvents['create']) => void;
|
|
1640
1173
|
/**
|
|
1641
1174
|
* Called when the editor encounters an error while parsing the content.
|
|
1642
1175
|
* Only enabled if `enableContentCheck` is `true`.
|
|
1643
1176
|
*/
|
|
1644
1177
|
onContentError: (props: EditorEvents['contentError']) => void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Called when the editor's content is updated.
|
|
1180
|
+
*/
|
|
1645
1181
|
onUpdate: (props: EditorEvents['update']) => void;
|
|
1182
|
+
/**
|
|
1183
|
+
* Called when the editor's selection is updated.
|
|
1184
|
+
*/
|
|
1646
1185
|
onSelectionUpdate: (props: EditorEvents['selectionUpdate']) => void;
|
|
1186
|
+
/**
|
|
1187
|
+
* Called after a transaction is applied to the editor.
|
|
1188
|
+
*/
|
|
1647
1189
|
onTransaction: (props: EditorEvents['transaction']) => void;
|
|
1190
|
+
/**
|
|
1191
|
+
* Called on focus events.
|
|
1192
|
+
*/
|
|
1648
1193
|
onFocus: (props: EditorEvents['focus']) => void;
|
|
1194
|
+
/**
|
|
1195
|
+
* Called on blur events.
|
|
1196
|
+
*/
|
|
1649
1197
|
onBlur: (props: EditorEvents['blur']) => void;
|
|
1198
|
+
/**
|
|
1199
|
+
* Called when the editor is destroyed.
|
|
1200
|
+
*/
|
|
1650
1201
|
onDestroy: (props: EditorEvents['destroy']) => void;
|
|
1202
|
+
/**
|
|
1203
|
+
* Called when content is pasted into the editor.
|
|
1204
|
+
*/
|
|
1651
1205
|
onPaste: (e: ClipboardEvent, slice: Slice) => void;
|
|
1206
|
+
/**
|
|
1207
|
+
* Called when content is dropped into the editor.
|
|
1208
|
+
*/
|
|
1652
1209
|
onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void;
|
|
1210
|
+
/**
|
|
1211
|
+
* Called when content is deleted from the editor.
|
|
1212
|
+
*/
|
|
1213
|
+
onDelete: (props: EditorEvents['delete']) => void;
|
|
1653
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* The editor's content as HTML
|
|
1217
|
+
*/
|
|
1654
1218
|
type HTMLContent = string;
|
|
1219
|
+
/**
|
|
1220
|
+
* Loosely describes a JSON representation of a Prosemirror document or node
|
|
1221
|
+
*/
|
|
1655
1222
|
type JSONContent = {
|
|
1656
1223
|
type?: string;
|
|
1657
1224
|
attrs?: Record<string, any>;
|
|
@@ -1669,19 +1236,19 @@ type JSONContent = {
|
|
|
1669
1236
|
*/
|
|
1670
1237
|
type MarkType<Type extends string | {
|
|
1671
1238
|
name: string;
|
|
1672
|
-
} = any,
|
|
1239
|
+
} = any, TAttributes extends undefined | Record<string, any> = any> = {
|
|
1673
1240
|
type: Type;
|
|
1674
|
-
attrs:
|
|
1241
|
+
attrs: TAttributes;
|
|
1675
1242
|
};
|
|
1676
1243
|
/**
|
|
1677
1244
|
* A node type is either a JSON representation of a node or a Prosemirror node instance
|
|
1678
1245
|
*/
|
|
1679
1246
|
type NodeType<Type extends string | {
|
|
1680
1247
|
name: string;
|
|
1681
|
-
} = any,
|
|
1248
|
+
} = any, TAttributes extends undefined | Record<string, any> = any, NodeMarkType extends MarkType = any, TContent extends (NodeType | TextType)[] = any> = {
|
|
1682
1249
|
type: Type;
|
|
1683
|
-
attrs:
|
|
1684
|
-
content?:
|
|
1250
|
+
attrs: TAttributes;
|
|
1251
|
+
content?: TContent;
|
|
1685
1252
|
marks?: NodeMarkType[];
|
|
1686
1253
|
};
|
|
1687
1254
|
/**
|
|
@@ -1702,7 +1269,7 @@ type TextType<TMarkType extends MarkType = MarkType> = {
|
|
|
1702
1269
|
* Describes the output of a `renderHTML` function in prosemirror
|
|
1703
1270
|
* @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec
|
|
1704
1271
|
*/
|
|
1705
|
-
type DOMOutputSpecArray = [string] | [string, Record<string, any>] | [string, 0] | [string, Record<string, any>, 0] | [string, Record<string, any>, DOMOutputSpecArray | 0] | [string, DOMOutputSpecArray];
|
|
1272
|
+
type DOMOutputSpecArray$1 = [string] | [string, Record<string, any>] | [string, 0] | [string, Record<string, any>, 0] | [string, Record<string, any>, DOMOutputSpecArray$1 | 0] | [string, DOMOutputSpecArray$1];
|
|
1706
1273
|
type Content = HTMLContent | JSONContent | JSONContent[] | null;
|
|
1707
1274
|
type CommandProps = {
|
|
1708
1275
|
editor: Editor;
|
|
@@ -1728,7 +1295,7 @@ type Attribute = {
|
|
|
1728
1295
|
keepOnSplit?: boolean;
|
|
1729
1296
|
isRequired?: boolean;
|
|
1730
1297
|
};
|
|
1731
|
-
type Attributes = {
|
|
1298
|
+
type Attributes$1 = {
|
|
1732
1299
|
[key: string]: Attribute;
|
|
1733
1300
|
};
|
|
1734
1301
|
type ExtensionAttribute = {
|
|
@@ -1832,6 +1399,40 @@ interface NodeViewRendererProps {
|
|
|
1832
1399
|
HTMLAttributes: Record<string, any>;
|
|
1833
1400
|
}
|
|
1834
1401
|
type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView$1;
|
|
1402
|
+
interface MarkViewProps extends MarkViewRendererProps {
|
|
1403
|
+
}
|
|
1404
|
+
interface MarkViewRendererProps {
|
|
1405
|
+
/**
|
|
1406
|
+
* The node that is being rendered.
|
|
1407
|
+
*/
|
|
1408
|
+
mark: Parameters<MarkViewConstructor>[0];
|
|
1409
|
+
/**
|
|
1410
|
+
* The editor's view.
|
|
1411
|
+
*/
|
|
1412
|
+
view: Parameters<MarkViewConstructor>[1];
|
|
1413
|
+
/**
|
|
1414
|
+
* indicates whether the mark's content is inline
|
|
1415
|
+
*/
|
|
1416
|
+
inline: Parameters<MarkViewConstructor>[2];
|
|
1417
|
+
/**
|
|
1418
|
+
* The editor instance.
|
|
1419
|
+
*/
|
|
1420
|
+
editor: Editor;
|
|
1421
|
+
/**
|
|
1422
|
+
* The extension that is responsible for the mark.
|
|
1423
|
+
*/
|
|
1424
|
+
extension: Mark;
|
|
1425
|
+
/**
|
|
1426
|
+
* The HTML attributes that should be added to the mark's DOM element.
|
|
1427
|
+
*/
|
|
1428
|
+
HTMLAttributes: Record<string, any>;
|
|
1429
|
+
}
|
|
1430
|
+
type MarkViewRenderer = (props: MarkViewRendererProps) => MarkView$1;
|
|
1431
|
+
interface MarkViewRendererOptions {
|
|
1432
|
+
ignoreMutation: ((props: {
|
|
1433
|
+
mutation: ViewMutationRecord;
|
|
1434
|
+
}) => boolean) | null;
|
|
1435
|
+
}
|
|
1835
1436
|
type AnyCommands = Record<string, (...args: any[]) => Command>;
|
|
1836
1437
|
type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, object>>>>;
|
|
1837
1438
|
type RawCommands = {
|
|
@@ -1887,7 +1488,7 @@ type Dispatch = ((args?: any) => any) | undefined;
|
|
|
1887
1488
|
* @param parseOptions Options for the parser
|
|
1888
1489
|
* @returns The created Prosemirror document node
|
|
1889
1490
|
*/
|
|
1890
|
-
declare function createDocument(content: Content | Node$1 | Fragment, schema: Schema, parseOptions?: ParseOptions, options?: {
|
|
1491
|
+
declare function createDocument(content: Content | Node$1 | Fragment$1, schema: Schema, parseOptions?: ParseOptions, options?: {
|
|
1891
1492
|
errorOnInvalidContent?: boolean;
|
|
1892
1493
|
}): Node$1;
|
|
1893
1494
|
|
|
@@ -1903,7 +1504,7 @@ type CreateNodeFromContentOptions = {
|
|
|
1903
1504
|
* @param options Options for the parser
|
|
1904
1505
|
* @returns The created Prosemirror node or fragment
|
|
1905
1506
|
*/
|
|
1906
|
-
declare function createNodeFromContent(content: Content | Node$1 | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): Node$1 | Fragment;
|
|
1507
|
+
declare function createNodeFromContent(content: Content | Node$1 | Fragment$1, schema: Schema, options?: CreateNodeFromContentOptions): Node$1 | Fragment$1;
|
|
1907
1508
|
|
|
1908
1509
|
/**
|
|
1909
1510
|
* Gets the default block type at a given match
|
|
@@ -2027,9 +1628,9 @@ declare function getDebugJSON(node: Node$1, startOffset?: number): DebugJSONCont
|
|
|
2027
1628
|
* @param context The context object that should be passed as `this` into the function
|
|
2028
1629
|
* @returns The field value
|
|
2029
1630
|
*/
|
|
2030
|
-
declare function getExtensionField<T = any>(extension:
|
|
1631
|
+
declare function getExtensionField<T = any, E extends AnyExtension = any>(extension: E, field: keyof ExtensionConfig | keyof MarkConfig | keyof NodeConfig, context?: Omit<MaybeThisParameterType<T>, 'parent'>): RemoveThis<T>;
|
|
2031
1632
|
|
|
2032
|
-
declare function getHTMLFromFragment(fragment: Fragment, schema: Schema): string;
|
|
1633
|
+
declare function getHTMLFromFragment(fragment: Fragment$1, schema: Schema): string;
|
|
2033
1634
|
|
|
2034
1635
|
declare function getMarkAttributes(state: EditorState, typeOrName: string | MarkType$1): Record<string, any>;
|
|
2035
1636
|
|
|
@@ -2287,6 +1888,7 @@ declare class ExtensionManager {
|
|
|
2287
1888
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
2288
1889
|
*/
|
|
2289
1890
|
get nodeViews(): Record<string, NodeViewConstructor>;
|
|
1891
|
+
get markViews(): Record<string, MarkViewConstructor>;
|
|
2290
1892
|
/**
|
|
2291
1893
|
* Go through all extensions, create extension storages & setup marks
|
|
2292
1894
|
* & bind editor event listener.
|
|
@@ -2306,7 +1908,7 @@ declare class NodePos {
|
|
|
2306
1908
|
actualDepth: number | null;
|
|
2307
1909
|
get depth(): number;
|
|
2308
1910
|
get pos(): number;
|
|
2309
|
-
get content(): Fragment;
|
|
1911
|
+
get content(): Fragment$1;
|
|
2310
1912
|
set content(content: Content);
|
|
2311
1913
|
get attributes(): {
|
|
2312
1914
|
[key: string]: any;
|
|
@@ -2358,10 +1960,14 @@ declare module '@tiptap/core' {
|
|
|
2358
1960
|
clearContent: {
|
|
2359
1961
|
/**
|
|
2360
1962
|
* Clear the whole document.
|
|
2361
|
-
* @param emitUpdate Whether to emit an update event.
|
|
2362
1963
|
* @example editor.commands.clearContent()
|
|
2363
1964
|
*/
|
|
2364
|
-
clearContent: (
|
|
1965
|
+
clearContent: (
|
|
1966
|
+
/**
|
|
1967
|
+
* Whether to emit an update event.
|
|
1968
|
+
* @default true
|
|
1969
|
+
*/
|
|
1970
|
+
emitUpdate?: boolean) => ReturnType;
|
|
2365
1971
|
};
|
|
2366
1972
|
}
|
|
2367
1973
|
}
|
|
@@ -2587,7 +2193,7 @@ declare module '@tiptap/core' {
|
|
|
2587
2193
|
/**
|
|
2588
2194
|
* The ProseMirror content to insert.
|
|
2589
2195
|
*/
|
|
2590
|
-
value: Content | Node$1 | Fragment,
|
|
2196
|
+
value: Content | Node$1 | Fragment$1,
|
|
2591
2197
|
/**
|
|
2592
2198
|
* Optional options
|
|
2593
2199
|
*/
|
|
@@ -2622,7 +2228,7 @@ declare module '@tiptap/core' {
|
|
|
2622
2228
|
/**
|
|
2623
2229
|
* The ProseMirror content to insert.
|
|
2624
2230
|
*/
|
|
2625
|
-
value: Content | Node$1 | Fragment,
|
|
2231
|
+
value: Content | Node$1 | Fragment$1,
|
|
2626
2232
|
/**
|
|
2627
2233
|
* Optional options
|
|
2628
2234
|
*/
|
|
@@ -2912,25 +2518,25 @@ declare module '@tiptap/core' {
|
|
|
2912
2518
|
/**
|
|
2913
2519
|
* The new content.
|
|
2914
2520
|
*/
|
|
2915
|
-
content: Content | Fragment | Node$1,
|
|
2916
|
-
/**
|
|
2917
|
-
* Whether to emit an update event.
|
|
2918
|
-
* @default false
|
|
2919
|
-
*/
|
|
2920
|
-
emitUpdate?: boolean,
|
|
2921
|
-
/**
|
|
2922
|
-
* Options for parsing the content.
|
|
2923
|
-
* @default {}
|
|
2924
|
-
*/
|
|
2925
|
-
parseOptions?: ParseOptions,
|
|
2521
|
+
content: Content | Fragment$1 | Node$1,
|
|
2926
2522
|
/**
|
|
2927
2523
|
* Options for `setContent`.
|
|
2928
2524
|
*/
|
|
2929
2525
|
options?: {
|
|
2526
|
+
/**
|
|
2527
|
+
* Options for parsing the content.
|
|
2528
|
+
* @default {}
|
|
2529
|
+
*/
|
|
2530
|
+
parseOptions?: ParseOptions;
|
|
2930
2531
|
/**
|
|
2931
2532
|
* Whether to throw an error if the content is invalid.
|
|
2932
2533
|
*/
|
|
2933
2534
|
errorOnInvalidContent?: boolean;
|
|
2535
|
+
/**
|
|
2536
|
+
* Whether to emit an update event.
|
|
2537
|
+
* @default true
|
|
2538
|
+
*/
|
|
2539
|
+
emitUpdate?: boolean;
|
|
2934
2540
|
}) => ReturnType;
|
|
2935
2541
|
};
|
|
2936
2542
|
}
|
|
@@ -3218,6 +2824,11 @@ declare module '@tiptap/core' {
|
|
|
3218
2824
|
|
|
3219
2825
|
declare const Commands$1: Extension<any, any>;
|
|
3220
2826
|
|
|
2827
|
+
/**
|
|
2828
|
+
* This extension allows you to be notified when the user deletes content you are interested in.
|
|
2829
|
+
*/
|
|
2830
|
+
declare const Delete: Extension<any, any>;
|
|
2831
|
+
|
|
3221
2832
|
declare const Drop: Extension<any, any>;
|
|
3222
2833
|
|
|
3223
2834
|
declare const Editable: Extension<any, any>;
|
|
@@ -3231,6 +2842,7 @@ declare const Paste: Extension<any, any>;
|
|
|
3231
2842
|
declare const Tabindex: Extension<any, any>;
|
|
3232
2843
|
|
|
3233
2844
|
declare const index_ClipboardTextSerializer: typeof ClipboardTextSerializer;
|
|
2845
|
+
declare const index_Delete: typeof Delete;
|
|
3234
2846
|
declare const index_Drop: typeof Drop;
|
|
3235
2847
|
declare const index_Editable: typeof Editable;
|
|
3236
2848
|
declare const index_FocusEvents: typeof FocusEvents;
|
|
@@ -3238,7 +2850,7 @@ declare const index_Keymap: typeof Keymap;
|
|
|
3238
2850
|
declare const index_Paste: typeof Paste;
|
|
3239
2851
|
declare const index_Tabindex: typeof Tabindex;
|
|
3240
2852
|
declare namespace index {
|
|
3241
|
-
export { index_ClipboardTextSerializer as ClipboardTextSerializer, Commands$1 as Commands, index_Drop as Drop, index_Editable as Editable, index_FocusEvents as FocusEvents, index_Keymap as Keymap, index_Paste as Paste, index_Tabindex as Tabindex };
|
|
2853
|
+
export { index_ClipboardTextSerializer as ClipboardTextSerializer, Commands$1 as Commands, index_Delete as Delete, index_Drop as Drop, index_Editable as Editable, index_FocusEvents as FocusEvents, index_Keymap as Keymap, index_Paste as Paste, index_Tabindex as Tabindex };
|
|
3242
2854
|
}
|
|
3243
2855
|
|
|
3244
2856
|
interface TiptapEditorHTMLElement extends HTMLElement {
|
|
@@ -3249,23 +2861,25 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
3249
2861
|
extensionManager: ExtensionManager;
|
|
3250
2862
|
private css;
|
|
3251
2863
|
schema: Schema;
|
|
3252
|
-
|
|
2864
|
+
private editorView;
|
|
3253
2865
|
isFocused: boolean;
|
|
2866
|
+
private editorState;
|
|
3254
2867
|
/**
|
|
3255
2868
|
* The editor is considered initialized after the `create` event has been emitted.
|
|
3256
2869
|
*/
|
|
3257
2870
|
isInitialized: boolean;
|
|
3258
|
-
extensionStorage:
|
|
2871
|
+
extensionStorage: Storage;
|
|
3259
2872
|
/**
|
|
3260
2873
|
* A unique ID for this editor instance.
|
|
3261
2874
|
*/
|
|
3262
2875
|
instanceId: string;
|
|
3263
2876
|
options: EditorOptions;
|
|
3264
2877
|
constructor(options?: Partial<EditorOptions>);
|
|
2878
|
+
mount(el: NonNullable<EditorOptions['element']> & {}): void;
|
|
3265
2879
|
/**
|
|
3266
2880
|
* Returns the editor storage.
|
|
3267
2881
|
*/
|
|
3268
|
-
get storage():
|
|
2882
|
+
get storage(): Storage;
|
|
3269
2883
|
/**
|
|
3270
2884
|
* An object of all registered commands.
|
|
3271
2885
|
*/
|
|
@@ -3296,6 +2910,10 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
3296
2910
|
* Returns whether the editor is editable.
|
|
3297
2911
|
*/
|
|
3298
2912
|
get isEditable(): boolean;
|
|
2913
|
+
/**
|
|
2914
|
+
* Returns the editor state.
|
|
2915
|
+
*/
|
|
2916
|
+
get view(): EditorView;
|
|
3299
2917
|
/**
|
|
3300
2918
|
* Returns the editor state.
|
|
3301
2919
|
*/
|
|
@@ -3327,6 +2945,10 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
3327
2945
|
* Creates a ProseMirror schema.
|
|
3328
2946
|
*/
|
|
3329
2947
|
private createSchema;
|
|
2948
|
+
/**
|
|
2949
|
+
* Creates the initial document.
|
|
2950
|
+
*/
|
|
2951
|
+
private createDoc;
|
|
3330
2952
|
/**
|
|
3331
2953
|
* Creates a ProseMirror view.
|
|
3332
2954
|
*/
|
|
@@ -3495,6 +3117,39 @@ declare function wrappingInputRule(config: {
|
|
|
3495
3117
|
joinPredicate?: (match: ExtendedRegExpMatchArray, node: Node$1) => boolean;
|
|
3496
3118
|
}): InputRule;
|
|
3497
3119
|
|
|
3120
|
+
type Attributes = Record<string, any>;
|
|
3121
|
+
type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray;
|
|
3122
|
+
/**
|
|
3123
|
+
* Better describes the output of a `renderHTML` function in prosemirror
|
|
3124
|
+
* @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec
|
|
3125
|
+
*/
|
|
3126
|
+
type DOMOutputSpecArray = [string] | [string, Attributes] | [string, 0] | [string, Attributes, 0] | [string, Attributes, DOMOutputSpecArray | 0] | [string, DOMOutputSpecArray];
|
|
3127
|
+
declare global {
|
|
3128
|
+
namespace JSX {
|
|
3129
|
+
type Element = [string, ...any[]];
|
|
3130
|
+
interface IntrinsicElements {
|
|
3131
|
+
[key: string]: any;
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
type JSXRenderer = (tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement), props?: Attributes, ...children: JSXRenderer[]) => DOMOutputSpecArray | DOMOutputSpecElement;
|
|
3136
|
+
declare function Fragment(props: {
|
|
3137
|
+
children: JSXRenderer[];
|
|
3138
|
+
}): JSXRenderer[];
|
|
3139
|
+
declare const h: JSXRenderer;
|
|
3140
|
+
|
|
3141
|
+
declare class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
|
|
3142
|
+
component: Component;
|
|
3143
|
+
editor: Editor;
|
|
3144
|
+
options: Options;
|
|
3145
|
+
mark: MarkViewProps['mark'];
|
|
3146
|
+
HTMLAttributes: MarkViewProps['HTMLAttributes'];
|
|
3147
|
+
constructor(component: Component, props: MarkViewProps, options?: Partial<Options>);
|
|
3148
|
+
get dom(): HTMLElement;
|
|
3149
|
+
get contentDOM(): HTMLElement | null;
|
|
3150
|
+
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3498
3153
|
/**
|
|
3499
3154
|
* Node views are used to customize the rendered DOM structure of a node.
|
|
3500
3155
|
* @see https://tiptap.dev/guide/node-views
|
|
@@ -3606,6 +3261,8 @@ declare function findDuplicates<T>(items: T[]): T[];
|
|
|
3606
3261
|
|
|
3607
3262
|
declare function fromString(value: any): any;
|
|
3608
3263
|
|
|
3264
|
+
declare function isAndroid(): boolean;
|
|
3265
|
+
|
|
3609
3266
|
declare function isEmptyObject(value?: {}): boolean;
|
|
3610
3267
|
|
|
3611
3268
|
declare function isFunction(value: any): value is Function;
|
|
@@ -3648,11 +3305,7 @@ declare function removeDuplicates<T>(array: T[], by?: {
|
|
|
3648
3305
|
|
|
3649
3306
|
interface Commands<ReturnType = any> {
|
|
3650
3307
|
}
|
|
3651
|
-
interface
|
|
3652
|
-
}
|
|
3653
|
-
interface NodeConfig<Options = any, Storage = any> {
|
|
3654
|
-
}
|
|
3655
|
-
interface MarkConfig<Options = any, Storage = any> {
|
|
3308
|
+
interface Storage {
|
|
3656
3309
|
}
|
|
3657
3310
|
|
|
3658
|
-
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, combineTransactionSteps, createChainableState, createDocument, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|
|
3311
|
+
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes$1 as Attributes, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, combineTransactionSteps, createChainableState, createDocument, h as createElement, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, h, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|