@tiptap/core 3.0.0-next.0 → 3.0.0-next.2

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.
Files changed (214) hide show
  1. package/dist/index.cjs +4934 -4574
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +3576 -0
  4. package/dist/index.d.ts +3576 -0
  5. package/dist/index.js +4839 -4481
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -8
  8. package/src/Editor.ts +66 -10
  9. package/src/EventEmitter.ts +9 -0
  10. package/src/Extension.ts +4 -3
  11. package/src/ExtensionManager.ts +18 -12
  12. package/src/InputRule.ts +45 -30
  13. package/src/Mark.ts +4 -3
  14. package/src/Node.ts +23 -3
  15. package/src/NodePos.ts +9 -4
  16. package/src/NodeView.ts +43 -12
  17. package/src/PasteRule.ts +96 -42
  18. package/src/commands/focus.ts +1 -6
  19. package/src/commands/insertContent.ts +9 -9
  20. package/src/commands/insertContentAt.ts +23 -3
  21. package/src/commands/selectAll.ts +10 -5
  22. package/src/commands/setContent.ts +10 -14
  23. package/src/commands/setMeta.ts +3 -1
  24. package/src/commands/setNode.ts +9 -2
  25. package/src/commands/splitListItem.ts +27 -17
  26. package/src/commands/toggleNode.ts +11 -2
  27. package/src/commands/updateAttributes.ts +72 -12
  28. package/src/extensions/drop.ts +26 -0
  29. package/src/extensions/index.ts +2 -0
  30. package/src/extensions/keymap.ts +5 -2
  31. package/src/extensions/paste.ts +26 -0
  32. package/src/helpers/createDocument.ts +4 -2
  33. package/src/helpers/createNodeFromContent.ts +11 -2
  34. package/src/helpers/getAttributesFromExtensions.ts +1 -1
  35. package/src/helpers/getMarkRange.ts +35 -8
  36. package/src/helpers/getMarksBetween.ts +1 -1
  37. package/src/helpers/getRenderedAttributes.ts +3 -0
  38. package/src/helpers/getSchemaByResolvedExtensions.ts +3 -2
  39. package/src/helpers/isList.ts +1 -1
  40. package/src/helpers/isNodeEmpty.ts +33 -12
  41. package/src/inputRules/markInputRule.ts +1 -1
  42. package/src/inputRules/nodeInputRule.ts +1 -1
  43. package/src/inputRules/textInputRule.ts +1 -1
  44. package/src/inputRules/textblockTypeInputRule.ts +1 -1
  45. package/src/inputRules/wrappingInputRule.ts +1 -1
  46. package/src/pasteRules/markPasteRule.ts +1 -1
  47. package/src/pasteRules/nodePasteRule.ts +15 -6
  48. package/src/pasteRules/textPasteRule.ts +1 -1
  49. package/src/style.ts +2 -2
  50. package/src/types.ts +107 -19
  51. package/src/utilities/mergeAttributes.ts +18 -1
  52. package/dist/index.umd.js +0 -5130
  53. package/dist/index.umd.js.map +0 -1
  54. package/dist/packages/core/src/CommandManager.d.ts +0 -20
  55. package/dist/packages/core/src/Editor.d.ts +0 -159
  56. package/dist/packages/core/src/EventEmitter.d.ts +0 -11
  57. package/dist/packages/core/src/Extension.d.ts +0 -343
  58. package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
  59. package/dist/packages/core/src/InputRule.d.ts +0 -42
  60. package/dist/packages/core/src/Mark.d.ts +0 -451
  61. package/dist/packages/core/src/Node.d.ts +0 -611
  62. package/dist/packages/core/src/NodePos.d.ts +0 -44
  63. package/dist/packages/core/src/NodeView.d.ts +0 -31
  64. package/dist/packages/core/src/PasteRule.d.ts +0 -50
  65. package/dist/packages/core/src/Tracker.d.ts +0 -11
  66. package/dist/packages/core/src/commands/blur.d.ts +0 -13
  67. package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
  68. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
  69. package/dist/packages/core/src/commands/command.d.ts +0 -18
  70. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
  71. package/dist/packages/core/src/commands/cut.d.ts +0 -20
  72. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
  73. package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
  74. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
  75. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
  76. package/dist/packages/core/src/commands/enter.d.ts +0 -13
  77. package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
  78. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
  79. package/dist/packages/core/src/commands/first.d.ts +0 -14
  80. package/dist/packages/core/src/commands/focus.d.ts +0 -27
  81. package/dist/packages/core/src/commands/forEach.d.ts +0 -14
  82. package/dist/packages/core/src/commands/index.d.ts +0 -55
  83. package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
  84. package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
  85. package/dist/packages/core/src/commands/join.d.ts +0 -41
  86. package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
  87. package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
  88. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
  89. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
  90. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
  91. package/dist/packages/core/src/commands/lift.d.ts +0 -17
  92. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
  93. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
  94. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
  95. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
  96. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
  97. package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
  98. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
  99. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
  100. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
  101. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
  102. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
  103. package/dist/packages/core/src/commands/setContent.d.ts +0 -40
  104. package/dist/packages/core/src/commands/setMark.d.ts +0 -15
  105. package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
  106. package/dist/packages/core/src/commands/setNode.d.ts +0 -16
  107. package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
  108. package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
  109. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
  110. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
  111. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
  112. package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
  113. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
  114. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
  115. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
  116. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
  117. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
  118. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
  119. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
  120. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
  121. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
  122. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
  123. package/dist/packages/core/src/extensions/commands.d.ts +0 -3
  124. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  125. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  126. package/dist/packages/core/src/extensions/index.d.ts +0 -6
  127. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  128. package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
  129. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
  130. package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
  131. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
  132. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
  133. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
  134. package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
  135. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
  136. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
  137. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
  138. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
  139. package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
  140. package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
  141. package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
  142. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  143. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
  144. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
  145. package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
  146. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  147. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
  148. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  149. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  150. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  151. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
  152. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
  153. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  154. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  155. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
  156. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
  157. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
  158. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
  159. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
  160. package/dist/packages/core/src/helpers/getText.d.ts +0 -15
  161. package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
  162. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
  163. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
  164. package/dist/packages/core/src/helpers/index.d.ts +0 -50
  165. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  166. package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
  167. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
  168. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
  169. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
  170. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  171. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
  172. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
  173. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -8
  174. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  175. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  176. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
  177. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
  178. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  179. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  180. package/dist/packages/core/src/index.d.ts +0 -24
  181. package/dist/packages/core/src/inputRules/index.d.ts +0 -5
  182. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
  183. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
  184. package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
  185. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
  186. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
  187. package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
  188. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
  189. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
  190. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
  191. package/dist/packages/core/src/style.d.ts +0 -1
  192. package/dist/packages/core/src/types.d.ts +0 -253
  193. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
  194. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  195. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
  196. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  197. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
  198. package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
  199. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  200. package/dist/packages/core/src/utilities/index.d.ts +0 -20
  201. package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
  202. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  203. package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
  204. package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
  205. package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
  206. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  207. package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
  208. package/dist/packages/core/src/utilities/isString.d.ts +0 -1
  209. package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
  210. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
  211. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
  212. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  213. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
  214. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
@@ -0,0 +1,3576 @@
1
+ import { EditorState, Plugin, Transaction, PluginKey, Selection, NodeSelection, TextSelection } from '@tiptap/pm/state';
2
+ import { NodeType, NodeSpec, Node as Node$1, DOMOutputSpec, MarkType, MarkSpec, Mark as Mark$1, Slice, ParseOptions, Schema, ResolvedPos, Fragment, ContentMatch, ParseRule } from '@tiptap/pm/model';
3
+ import { NodeView as NodeView$1, EditorProps, EditorView, Decoration, DecorationAttrs, ViewMutationRecord, NodeViewConstructor } from '@tiptap/pm/view';
4
+ import { Mappable, Transform } from '@tiptap/pm/transform';
5
+ import * as prosemirror_model from 'prosemirror-model';
6
+
7
+ type StringKeyOf<T> = Extract<keyof T, string>;
8
+ type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
9
+ type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
10
+ declare class EventEmitter<T extends Record<string, any>> {
11
+ private callbacks;
12
+ on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
13
+ emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
14
+ off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
15
+ once<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
16
+ removeAllListeners(): void;
17
+ }
18
+
19
+ type InputRuleMatch = {
20
+ index: number;
21
+ text: string;
22
+ replaceWith?: string;
23
+ match?: RegExpMatchArray;
24
+ data?: Record<string, any>;
25
+ };
26
+ type InputRuleFinder = RegExp | ((text: string) => InputRuleMatch | null);
27
+ declare class InputRule {
28
+ find: InputRuleFinder;
29
+ handler: (props: {
30
+ state: EditorState;
31
+ range: Range;
32
+ match: ExtendedRegExpMatchArray;
33
+ commands: SingleCommands;
34
+ chain: () => ChainedCommands;
35
+ can: () => CanCommands;
36
+ }) => void | null;
37
+ constructor(config: {
38
+ find: InputRuleFinder;
39
+ handler: (props: {
40
+ state: EditorState;
41
+ range: Range;
42
+ match: ExtendedRegExpMatchArray;
43
+ commands: SingleCommands;
44
+ chain: () => ChainedCommands;
45
+ can: () => CanCommands;
46
+ }) => void | null;
47
+ });
48
+ }
49
+ /**
50
+ * Create an input rules plugin. When enabled, it will cause text
51
+ * input that matches any of the given rules to trigger the rule’s
52
+ * action.
53
+ */
54
+ declare function inputRulesPlugin(props: {
55
+ editor: Editor;
56
+ rules: InputRule[];
57
+ }): Plugin;
58
+
59
+ type PasteRuleMatch = {
60
+ index: number;
61
+ text: string;
62
+ replaceWith?: string;
63
+ match?: RegExpMatchArray;
64
+ data?: Record<string, any>;
65
+ };
66
+ type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
67
+ /**
68
+ * Paste rules are used to react to pasted content.
69
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
70
+ */
71
+ declare class PasteRule {
72
+ find: PasteRuleFinder;
73
+ handler: (props: {
74
+ state: EditorState;
75
+ range: Range;
76
+ match: ExtendedRegExpMatchArray;
77
+ commands: SingleCommands;
78
+ chain: () => ChainedCommands;
79
+ can: () => CanCommands;
80
+ pasteEvent: ClipboardEvent | null;
81
+ dropEvent: DragEvent | null;
82
+ }) => void | null;
83
+ constructor(config: {
84
+ find: PasteRuleFinder;
85
+ handler: (props: {
86
+ can: () => CanCommands;
87
+ chain: () => ChainedCommands;
88
+ commands: SingleCommands;
89
+ dropEvent: DragEvent | null;
90
+ match: ExtendedRegExpMatchArray;
91
+ pasteEvent: ClipboardEvent | null;
92
+ range: Range;
93
+ state: EditorState;
94
+ }) => void | null;
95
+ });
96
+ }
97
+ /**
98
+ * Create an paste rules plugin. When enabled, it will cause pasted
99
+ * text that matches any of the given rules to trigger the rule’s
100
+ * action.
101
+ */
102
+ declare function pasteRulesPlugin(props: {
103
+ editor: Editor;
104
+ rules: PasteRule[];
105
+ }): Plugin[];
106
+
107
+ declare module '@tiptap/core' {
108
+ interface NodeConfig<Options = any, Storage = any> {
109
+ [key: string]: any;
110
+ /**
111
+ * The extension name - this must be unique.
112
+ * It will be used to identify the extension.
113
+ *
114
+ * @example 'myExtension'
115
+ */
116
+ name: string;
117
+ /**
118
+ * The priority of your extension. The higher, the earlier it will be called
119
+ * and will take precedence over other extensions with a lower priority.
120
+ * @default 100
121
+ * @example 101
122
+ */
123
+ priority?: number;
124
+ /**
125
+ * The default options for this extension.
126
+ * @example
127
+ * defaultOptions: {
128
+ * myOption: 'foo',
129
+ * myOtherOption: 10,
130
+ * }
131
+ */
132
+ defaultOptions?: Options;
133
+ /**
134
+ * This method will add options to this extension
135
+ * @see https://tiptap.dev/guide/custom-extensions#settings
136
+ * @example
137
+ * addOptions() {
138
+ * return {
139
+ * myOption: 'foo',
140
+ * myOtherOption: 10,
141
+ * }
142
+ */
143
+ addOptions?: (this: {
144
+ name: string;
145
+ parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addOptions'], undefined>;
146
+ }) => Options;
147
+ /**
148
+ * The default storage this extension can save data to.
149
+ * @see https://tiptap.dev/guide/custom-extensions#storage
150
+ * @example
151
+ * defaultStorage: {
152
+ * prefetchedUsers: [],
153
+ * loading: false,
154
+ * }
155
+ */
156
+ addStorage?: (this: {
157
+ name: string;
158
+ options: Options;
159
+ parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addStorage'], undefined>;
160
+ }) => Storage;
161
+ /**
162
+ * This function adds globalAttributes to specific nodes.
163
+ * @see https://tiptap.dev/guide/custom-extensions#global-attributes
164
+ * @example
165
+ * addGlobalAttributes() {
166
+ * return [
167
+ * {
168
+ // Extend the following extensions
169
+ * types: [
170
+ * 'heading',
171
+ * 'paragraph',
172
+ * ],
173
+ * // … with those attributes
174
+ * attributes: {
175
+ * textAlign: {
176
+ * default: 'left',
177
+ * renderHTML: attributes => ({
178
+ * style: `text-align: ${attributes.textAlign}`,
179
+ * }),
180
+ * parseHTML: element => element.style.textAlign || 'left',
181
+ * },
182
+ * },
183
+ * },
184
+ * ]
185
+ * }
186
+ */
187
+ addGlobalAttributes?: (this: {
188
+ name: string;
189
+ options: Options;
190
+ storage: Storage;
191
+ extensions: (Node | Mark)[];
192
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addGlobalAttributes'];
193
+ }) => GlobalAttributes;
194
+ /**
195
+ * This function adds commands to the editor
196
+ * @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
197
+ * @example
198
+ * addCommands() {
199
+ * return {
200
+ * myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
201
+ * }
202
+ * }
203
+ */
204
+ addCommands?: (this: {
205
+ name: string;
206
+ options: Options;
207
+ storage: Storage;
208
+ editor: Editor;
209
+ type: NodeType;
210
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addCommands'];
211
+ }) => Partial<RawCommands>;
212
+ /**
213
+ * This function registers keyboard shortcuts.
214
+ * @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
215
+ * @example
216
+ * addKeyboardShortcuts() {
217
+ * return {
218
+ * 'Mod-l': () => this.editor.commands.toggleBulletList(),
219
+ * }
220
+ * },
221
+ */
222
+ addKeyboardShortcuts?: (this: {
223
+ name: string;
224
+ options: Options;
225
+ storage: Storage;
226
+ editor: Editor;
227
+ type: NodeType;
228
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addKeyboardShortcuts'];
229
+ }) => {
230
+ [key: string]: KeyboardShortcutCommand;
231
+ };
232
+ /**
233
+ * This function adds input rules to the editor.
234
+ * @see https://tiptap.dev/guide/custom-extensions#input-rules
235
+ * @example
236
+ * addInputRules() {
237
+ * return [
238
+ * markInputRule({
239
+ * find: inputRegex,
240
+ * type: this.type,
241
+ * }),
242
+ * ]
243
+ * },
244
+ */
245
+ addInputRules?: (this: {
246
+ name: string;
247
+ options: Options;
248
+ storage: Storage;
249
+ editor: Editor;
250
+ type: NodeType;
251
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addInputRules'];
252
+ }) => InputRule[];
253
+ /**
254
+ * This function adds paste rules to the editor.
255
+ * @see https://tiptap.dev/guide/custom-extensions#paste-rules
256
+ * @example
257
+ * addPasteRules() {
258
+ * return [
259
+ * markPasteRule({
260
+ * find: pasteRegex,
261
+ * type: this.type,
262
+ * }),
263
+ * ]
264
+ * },
265
+ */
266
+ addPasteRules?: (this: {
267
+ name: string;
268
+ options: Options;
269
+ storage: Storage;
270
+ editor: Editor;
271
+ type: NodeType;
272
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addPasteRules'];
273
+ }) => PasteRule[];
274
+ /**
275
+ * This function adds Prosemirror plugins to the editor
276
+ * @see https://tiptap.dev/guide/custom-extensions#prosemirror-plugins
277
+ * @example
278
+ * addProseMirrorPlugins() {
279
+ * return [
280
+ * customPlugin(),
281
+ * ]
282
+ * }
283
+ */
284
+ addProseMirrorPlugins?: (this: {
285
+ name: string;
286
+ options: Options;
287
+ storage: Storage;
288
+ editor: Editor;
289
+ type: NodeType;
290
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addProseMirrorPlugins'];
291
+ }) => Plugin[];
292
+ /**
293
+ * This function adds additional extensions to the editor. This is useful for
294
+ * building extension kits.
295
+ * @example
296
+ * addExtensions() {
297
+ * return [
298
+ * BulletList,
299
+ * OrderedList,
300
+ * ListItem
301
+ * ]
302
+ * }
303
+ */
304
+ addExtensions?: (this: {
305
+ name: string;
306
+ options: Options;
307
+ storage: Storage;
308
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addExtensions'];
309
+ }) => Extensions;
310
+ /**
311
+ * This function extends the schema of the node.
312
+ * @example
313
+ * extendNodeSchema() {
314
+ * return {
315
+ * group: 'inline',
316
+ * selectable: false,
317
+ * }
318
+ * }
319
+ */
320
+ extendNodeSchema?: ((this: {
321
+ name: string;
322
+ options: Options;
323
+ storage: Storage;
324
+ parent: ParentConfig<NodeConfig<Options, Storage>>['extendNodeSchema'];
325
+ }, extension: Node) => Record<string, any>) | null;
326
+ /**
327
+ * This function extends the schema of the mark.
328
+ * @example
329
+ * extendMarkSchema() {
330
+ * return {
331
+ * group: 'inline',
332
+ * selectable: false,
333
+ * }
334
+ * }
335
+ */
336
+ extendMarkSchema?: ((this: {
337
+ name: string;
338
+ options: Options;
339
+ storage: Storage;
340
+ parent: ParentConfig<NodeConfig<Options, Storage>>['extendMarkSchema'];
341
+ editor?: Editor;
342
+ }, extension: Node) => Record<string, any>) | null;
343
+ /**
344
+ * The editor is not ready yet.
345
+ */
346
+ onBeforeCreate?: ((this: {
347
+ name: string;
348
+ options: Options;
349
+ storage: Storage;
350
+ editor: Editor;
351
+ type: NodeType;
352
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onBeforeCreate'];
353
+ }) => void) | null;
354
+ /**
355
+ * The editor is ready.
356
+ */
357
+ onCreate?: ((this: {
358
+ name: string;
359
+ options: Options;
360
+ storage: Storage;
361
+ editor: Editor;
362
+ type: NodeType;
363
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onCreate'];
364
+ }) => void) | null;
365
+ /**
366
+ * The content has changed.
367
+ */
368
+ onUpdate?: ((this: {
369
+ name: string;
370
+ options: Options;
371
+ storage: Storage;
372
+ editor: Editor;
373
+ type: NodeType;
374
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onUpdate'];
375
+ }) => void) | null;
376
+ /**
377
+ * The selection has changed.
378
+ */
379
+ onSelectionUpdate?: ((this: {
380
+ name: string;
381
+ options: Options;
382
+ storage: Storage;
383
+ editor: Editor;
384
+ type: NodeType;
385
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onSelectionUpdate'];
386
+ }) => void) | null;
387
+ /**
388
+ * The editor state has changed.
389
+ */
390
+ onTransaction?: ((this: {
391
+ name: string;
392
+ options: Options;
393
+ storage: Storage;
394
+ editor: Editor;
395
+ type: NodeType;
396
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onTransaction'];
397
+ }, props: {
398
+ editor: Editor;
399
+ transaction: Transaction;
400
+ }) => void) | null;
401
+ /**
402
+ * The editor is focused.
403
+ */
404
+ onFocus?: ((this: {
405
+ name: string;
406
+ options: Options;
407
+ storage: Storage;
408
+ editor: Editor;
409
+ type: NodeType;
410
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onFocus'];
411
+ }, props: {
412
+ event: FocusEvent;
413
+ }) => void) | null;
414
+ /**
415
+ * The editor isn’t focused anymore.
416
+ */
417
+ onBlur?: ((this: {
418
+ name: string;
419
+ options: Options;
420
+ storage: Storage;
421
+ editor: Editor;
422
+ type: NodeType;
423
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onBlur'];
424
+ }, props: {
425
+ event: FocusEvent;
426
+ }) => void) | null;
427
+ /**
428
+ * The editor is destroyed.
429
+ */
430
+ onDestroy?: ((this: {
431
+ name: string;
432
+ options: Options;
433
+ storage: Storage;
434
+ editor: Editor;
435
+ type: NodeType;
436
+ parent: ParentConfig<NodeConfig<Options, Storage>>['onDestroy'];
437
+ }) => void) | null;
438
+ /**
439
+ * Node View
440
+ */
441
+ addNodeView?: ((this: {
442
+ name: string;
443
+ options: Options;
444
+ storage: Storage;
445
+ editor: Editor;
446
+ type: NodeType;
447
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addNodeView'];
448
+ }) => NodeViewRenderer) | null;
449
+ /**
450
+ * Defines if this node should be a top level node (doc)
451
+ * @default false
452
+ * @example true
453
+ */
454
+ topNode?: boolean;
455
+ /**
456
+ * The content expression for this node, as described in the [schema
457
+ * guide](/docs/guide/#schema.content_expressions). When not given,
458
+ * the node does not allow any content.
459
+ *
460
+ * You can read more about it on the Prosemirror documentation here
461
+ * @see https://prosemirror.net/docs/guide/#schema.content_expressions
462
+ * @default undefined
463
+ * @example content: 'block+'
464
+ * @example content: 'headline paragraph block*'
465
+ */
466
+ content?: NodeSpec['content'] | ((this: {
467
+ name: string;
468
+ options: Options;
469
+ storage: Storage;
470
+ parent: ParentConfig<NodeConfig<Options, Storage>>['content'];
471
+ editor?: Editor;
472
+ }) => NodeSpec['content']);
473
+ /**
474
+ * The marks that are allowed inside of this node. May be a
475
+ * space-separated string referring to mark names or groups, `"_"`
476
+ * to explicitly allow all marks, or `""` to disallow marks. When
477
+ * not given, nodes with inline content default to allowing all
478
+ * marks, other nodes default to not allowing marks.
479
+ *
480
+ * @example marks: 'strong em'
481
+ */
482
+ marks?: NodeSpec['marks'] | ((this: {
483
+ name: string;
484
+ options: Options;
485
+ storage: Storage;
486
+ parent: ParentConfig<NodeConfig<Options, Storage>>['marks'];
487
+ editor?: Editor;
488
+ }) => NodeSpec['marks']);
489
+ /**
490
+ * The group or space-separated groups to which this node belongs,
491
+ * which can be referred to in the content expressions for the
492
+ * schema.
493
+ *
494
+ * By default Tiptap uses the groups 'block' and 'inline' for nodes. You
495
+ * can also use custom groups if you want to group specific nodes together
496
+ * and handle them in your schema.
497
+ * @example group: 'block'
498
+ * @example group: 'inline'
499
+ * @example group: 'customBlock' // this uses a custom group
500
+ */
501
+ group?: NodeSpec['group'] | ((this: {
502
+ name: string;
503
+ options: Options;
504
+ storage: Storage;
505
+ parent: ParentConfig<NodeConfig<Options, Storage>>['group'];
506
+ editor?: Editor;
507
+ }) => NodeSpec['group']);
508
+ /**
509
+ * Should be set to true for inline nodes. (Implied for text nodes.)
510
+ */
511
+ inline?: NodeSpec['inline'] | ((this: {
512
+ name: string;
513
+ options: Options;
514
+ storage: Storage;
515
+ parent: ParentConfig<NodeConfig<Options, Storage>>['inline'];
516
+ editor?: Editor;
517
+ }) => NodeSpec['inline']);
518
+ /**
519
+ * Can be set to true to indicate that, though this isn't a [leaf
520
+ * node](https://prosemirror.net/docs/ref/#model.NodeType.isLeaf), it doesn't have directly editable
521
+ * content and should be treated as a single unit in the view.
522
+ *
523
+ * @example atom: true
524
+ */
525
+ atom?: NodeSpec['atom'] | ((this: {
526
+ name: string;
527
+ options: Options;
528
+ storage: Storage;
529
+ parent: ParentConfig<NodeConfig<Options, Storage>>['atom'];
530
+ editor?: Editor;
531
+ }) => NodeSpec['atom']);
532
+ /**
533
+ * Controls whether nodes of this type can be selected as a [node
534
+ * selection](https://prosemirror.net/docs/ref/#state.NodeSelection). Defaults to true for non-text
535
+ * nodes.
536
+ *
537
+ * @default true
538
+ * @example selectable: false
539
+ */
540
+ selectable?: NodeSpec['selectable'] | ((this: {
541
+ name: string;
542
+ options: Options;
543
+ storage: Storage;
544
+ parent: ParentConfig<NodeConfig<Options, Storage>>['selectable'];
545
+ editor?: Editor;
546
+ }) => NodeSpec['selectable']);
547
+ /**
548
+ * Determines whether nodes of this type can be dragged without
549
+ * being selected. Defaults to false.
550
+ *
551
+ * @default: false
552
+ * @example: draggable: true
553
+ */
554
+ draggable?: NodeSpec['draggable'] | ((this: {
555
+ name: string;
556
+ options: Options;
557
+ storage: Storage;
558
+ parent: ParentConfig<NodeConfig<Options, Storage>>['draggable'];
559
+ editor?: Editor;
560
+ }) => NodeSpec['draggable']);
561
+ /**
562
+ * Can be used to indicate that this node contains code, which
563
+ * causes some commands to behave differently.
564
+ */
565
+ code?: NodeSpec['code'] | ((this: {
566
+ name: string;
567
+ options: Options;
568
+ storage: Storage;
569
+ parent: ParentConfig<NodeConfig<Options, Storage>>['code'];
570
+ editor?: Editor;
571
+ }) => NodeSpec['code']);
572
+ /**
573
+ * Controls way whitespace in this a node is parsed. The default is
574
+ * `"normal"`, which causes the [DOM parser](https://prosemirror.net/docs/ref/#model.DOMParser) to
575
+ * collapse whitespace in normal mode, and normalize it (replacing
576
+ * newlines and such with spaces) otherwise. `"pre"` causes the
577
+ * parser to preserve spaces inside the node. When this option isn't
578
+ * given, but [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) is true, `whitespace`
579
+ * will default to `"pre"`. Note that this option doesn't influence
580
+ * the way the node is rendered—that should be handled by `toDOM`
581
+ * and/or styling.
582
+ */
583
+ whitespace?: NodeSpec['whitespace'] | ((this: {
584
+ name: string;
585
+ options: Options;
586
+ storage: Storage;
587
+ parent: ParentConfig<NodeConfig<Options, Storage>>['whitespace'];
588
+ editor?: Editor;
589
+ }) => NodeSpec['whitespace']);
590
+ /**
591
+ * Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
592
+ * When converting between block types that have whitespace set to "pre"
593
+ * and don't support the linebreak node (e.g. codeBlock) and other block types
594
+ * that do support the linebreak node (e.g. paragraphs) - this node will be used
595
+ * as the linebreak instead of stripping the newline.
596
+ *
597
+ * See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
598
+ */
599
+ linebreakReplacement?: NodeSpec['linebreakReplacement'] | ((this: {
600
+ name: string;
601
+ options: Options;
602
+ storage: Storage;
603
+ parent: ParentConfig<NodeConfig<Options, Storage>>['linebreakReplacement'];
604
+ editor?: Editor;
605
+ }) => NodeSpec['linebreakReplacement']);
606
+ /**
607
+ * When enabled, enables both
608
+ * [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
609
+ * [`definingForContent`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
610
+ *
611
+ * @default false
612
+ * @example isolating: true
613
+ */
614
+ defining?: NodeSpec['defining'] | ((this: {
615
+ name: string;
616
+ options: Options;
617
+ storage: Storage;
618
+ parent: ParentConfig<NodeConfig<Options, Storage>>['defining'];
619
+ editor?: Editor;
620
+ }) => NodeSpec['defining']);
621
+ /**
622
+ * When enabled (default is false), the sides of nodes of this type
623
+ * count as boundaries that regular editing operations, like
624
+ * backspacing or lifting, won't cross. An example of a node that
625
+ * should probably have this enabled is a table cell.
626
+ */
627
+ isolating?: NodeSpec['isolating'] | ((this: {
628
+ name: string;
629
+ options: Options;
630
+ storage: Storage;
631
+ parent: ParentConfig<NodeConfig<Options, Storage>>['isolating'];
632
+ editor?: Editor;
633
+ }) => NodeSpec['isolating']);
634
+ /**
635
+ * Associates DOM parser information with this node, which can be
636
+ * used by [`DOMParser.fromSchema`](https://prosemirror.net/docs/ref/#model.DOMParser^fromSchema) to
637
+ * automatically derive a parser. The `node` field in the rules is
638
+ * implied (the name of this node will be filled in automatically).
639
+ * If you supply your own parser, you do not need to also specify
640
+ * parsing rules in your schema.
641
+ *
642
+ * @example parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
643
+ */
644
+ parseHTML?: (this: {
645
+ name: string;
646
+ options: Options;
647
+ storage: Storage;
648
+ parent: ParentConfig<NodeConfig<Options, Storage>>['parseHTML'];
649
+ editor?: Editor;
650
+ }) => NodeSpec['parseDOM'];
651
+ /**
652
+ * A description of a DOM structure. Can be either a string, which is
653
+ * interpreted as a text node, a DOM node, which is interpreted as
654
+ * itself, a `{dom, contentDOM}` object, or an array.
655
+ *
656
+ * An array describes a DOM element. The first value in the array
657
+ * should be a string—the name of the DOM element, optionally prefixed
658
+ * by a namespace URL and a space. If the second element is plain
659
+ * object, it is interpreted as a set of attributes for the element.
660
+ * Any elements after that (including the 2nd if it's not an attribute
661
+ * object) are interpreted as children of the DOM elements, and must
662
+ * either be valid `DOMOutputSpec` values, or the number zero.
663
+ *
664
+ * The number zero (pronounced “hole”) is used to indicate the place
665
+ * where a node's child nodes should be inserted. If it occurs in an
666
+ * output spec, it should be the only child element in its parent
667
+ * node.
668
+ *
669
+ * @example toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
670
+ */
671
+ renderHTML?: ((this: {
672
+ name: string;
673
+ options: Options;
674
+ storage: Storage;
675
+ parent: ParentConfig<NodeConfig<Options, Storage>>['renderHTML'];
676
+ editor?: Editor;
677
+ }, props: {
678
+ node: Node$1;
679
+ HTMLAttributes: Record<string, any>;
680
+ }) => DOMOutputSpec) | null;
681
+ /**
682
+ * renders the node as text
683
+ * @example renderText: () => 'foo
684
+ */
685
+ renderText?: ((this: {
686
+ name: string;
687
+ options: Options;
688
+ storage: Storage;
689
+ parent: ParentConfig<NodeConfig<Options, Storage>>['renderText'];
690
+ editor?: Editor;
691
+ }, props: {
692
+ node: Node$1;
693
+ pos: number;
694
+ parent: Node$1;
695
+ index: number;
696
+ }) => string) | null;
697
+ /**
698
+ * Add attributes to the node
699
+ * @example addAttributes: () => ({ class: 'foo' })
700
+ */
701
+ addAttributes?: (this: {
702
+ name: string;
703
+ options: Options;
704
+ storage: Storage;
705
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
706
+ editor?: Editor;
707
+ }) => Attributes | {};
708
+ }
709
+ }
710
+ /**
711
+ * The Node class is used to create custom node extensions.
712
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
713
+ */
714
+ declare class Node<Options = any, Storage = any> {
715
+ type: string;
716
+ name: string;
717
+ parent: Node | null;
718
+ child: Node | null;
719
+ options: Options;
720
+ storage: Storage;
721
+ config: NodeConfig;
722
+ constructor(config?: Partial<NodeConfig<Options, Storage>>);
723
+ static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>>): Node<O, S>;
724
+ configure(options?: Partial<Options>): Node<Options, Storage>;
725
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>): Node<ExtendedOptions, ExtendedStorage>;
726
+ }
727
+
728
+ declare module '@tiptap/core' {
729
+ interface MarkConfig<Options = any, Storage = any> {
730
+ [key: string]: any;
731
+ /**
732
+ * The extension name - this must be unique.
733
+ * It will be used to identify the extension.
734
+ *
735
+ * @example 'myExtension'
736
+ */
737
+ name: string;
738
+ /**
739
+ * The priority of your extension. The higher, the earlier it will be called
740
+ * and will take precedence over other extensions with a lower priority.
741
+ * @default 100
742
+ * @example 101
743
+ */
744
+ priority?: number;
745
+ /**
746
+ * The default options for this extension.
747
+ * @example
748
+ * defaultOptions: {
749
+ * myOption: 'foo',
750
+ * myOtherOption: 10,
751
+ * }
752
+ */
753
+ defaultOptions?: Options;
754
+ /**
755
+ * This method will add options to this extension
756
+ * @see https://tiptap.dev/guide/custom-extensions#settings
757
+ * @example
758
+ * addOptions() {
759
+ * return {
760
+ * myOption: 'foo',
761
+ * myOtherOption: 10,
762
+ * }
763
+ */
764
+ addOptions?: (this: {
765
+ name: string;
766
+ parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>;
767
+ }) => Options;
768
+ /**
769
+ * The default storage this extension can save data to.
770
+ * @see https://tiptap.dev/guide/custom-extensions#storage
771
+ * @example
772
+ * defaultStorage: {
773
+ * prefetchedUsers: [],
774
+ * loading: false,
775
+ * }
776
+ */
777
+ addStorage?: (this: {
778
+ name: string;
779
+ options: Options;
780
+ parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>;
781
+ }) => Storage;
782
+ /**
783
+ * This function adds globalAttributes to specific nodes.
784
+ * @see https://tiptap.dev/guide/custom-extensions#global-attributes
785
+ * @example
786
+ * addGlobalAttributes() {
787
+ * return [
788
+ * {
789
+ // Extend the following extensions
790
+ * types: [
791
+ * 'heading',
792
+ * 'paragraph',
793
+ * ],
794
+ * // … with those attributes
795
+ * attributes: {
796
+ * textAlign: {
797
+ * default: 'left',
798
+ * renderHTML: attributes => ({
799
+ * style: `text-align: ${attributes.textAlign}`,
800
+ * }),
801
+ * parseHTML: element => element.style.textAlign || 'left',
802
+ * },
803
+ * },
804
+ * },
805
+ * ]
806
+ * }
807
+ */
808
+ addGlobalAttributes?: (this: {
809
+ name: string;
810
+ options: Options;
811
+ storage: Storage;
812
+ extensions: (Node | Mark)[];
813
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'];
814
+ }) => GlobalAttributes;
815
+ /**
816
+ * This function adds commands to the editor
817
+ * @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
818
+ * @example
819
+ * addCommands() {
820
+ * return {
821
+ * myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
822
+ * }
823
+ * }
824
+ */
825
+ addCommands?: (this: {
826
+ name: string;
827
+ options: Options;
828
+ storage: Storage;
829
+ editor: Editor;
830
+ type: MarkType;
831
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addCommands'];
832
+ }) => Partial<RawCommands>;
833
+ /**
834
+ * This function registers keyboard shortcuts.
835
+ * @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
836
+ * @example
837
+ * addKeyboardShortcuts() {
838
+ * return {
839
+ * 'Mod-l': () => this.editor.commands.toggleBulletList(),
840
+ * }
841
+ * },
842
+ */
843
+ addKeyboardShortcuts?: (this: {
844
+ name: string;
845
+ options: Options;
846
+ storage: Storage;
847
+ editor: Editor;
848
+ type: MarkType;
849
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addKeyboardShortcuts'];
850
+ }) => {
851
+ [key: string]: KeyboardShortcutCommand;
852
+ };
853
+ /**
854
+ * This function adds input rules to the editor.
855
+ * @see https://tiptap.dev/guide/custom-extensions#input-rules
856
+ * @example
857
+ * addInputRules() {
858
+ * return [
859
+ * markInputRule({
860
+ * find: inputRegex,
861
+ * type: this.type,
862
+ * }),
863
+ * ]
864
+ * },
865
+ */
866
+ addInputRules?: (this: {
867
+ name: string;
868
+ options: Options;
869
+ storage: Storage;
870
+ editor: Editor;
871
+ type: MarkType;
872
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addInputRules'];
873
+ }) => InputRule[];
874
+ /**
875
+ * This function adds paste rules to the editor.
876
+ * @see https://tiptap.dev/guide/custom-extensions#paste-rules
877
+ * @example
878
+ * addPasteRules() {
879
+ * return [
880
+ * markPasteRule({
881
+ * find: pasteRegex,
882
+ * type: this.type,
883
+ * }),
884
+ * ]
885
+ * },
886
+ */
887
+ addPasteRules?: (this: {
888
+ name: string;
889
+ options: Options;
890
+ storage: Storage;
891
+ editor: Editor;
892
+ type: MarkType;
893
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addPasteRules'];
894
+ }) => PasteRule[];
895
+ /**
896
+ * This function adds Prosemirror plugins to the editor
897
+ * @see https://tiptap.dev/guide/custom-extensions#prosemirror-plugins
898
+ * @example
899
+ * addProseMirrorPlugins() {
900
+ * return [
901
+ * customPlugin(),
902
+ * ]
903
+ * }
904
+ */
905
+ addProseMirrorPlugins?: (this: {
906
+ name: string;
907
+ options: Options;
908
+ storage: Storage;
909
+ editor: Editor;
910
+ type: MarkType;
911
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addProseMirrorPlugins'];
912
+ }) => Plugin[];
913
+ /**
914
+ * This function adds additional extensions to the editor. This is useful for
915
+ * building extension kits.
916
+ * @example
917
+ * addExtensions() {
918
+ * return [
919
+ * BulletList,
920
+ * OrderedList,
921
+ * ListItem
922
+ * ]
923
+ * }
924
+ */
925
+ addExtensions?: (this: {
926
+ name: string;
927
+ options: Options;
928
+ storage: Storage;
929
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addExtensions'];
930
+ }) => Extensions;
931
+ /**
932
+ * This function extends the schema of the node.
933
+ * @example
934
+ * extendNodeSchema() {
935
+ * return {
936
+ * group: 'inline',
937
+ * selectable: false,
938
+ * }
939
+ * }
940
+ */
941
+ extendNodeSchema?: ((this: {
942
+ name: string;
943
+ options: Options;
944
+ storage: Storage;
945
+ parent: ParentConfig<MarkConfig<Options, Storage>>['extendNodeSchema'];
946
+ }, extension: Node) => Record<string, any>) | null;
947
+ /**
948
+ * This function extends the schema of the mark.
949
+ * @example
950
+ * extendMarkSchema() {
951
+ * return {
952
+ * group: 'inline',
953
+ * selectable: false,
954
+ * }
955
+ * }
956
+ */
957
+ extendMarkSchema?: ((this: {
958
+ name: string;
959
+ options: Options;
960
+ storage: Storage;
961
+ parent: ParentConfig<MarkConfig<Options, Storage>>['extendMarkSchema'];
962
+ }, extension: Mark) => Record<string, any>) | null;
963
+ /**
964
+ * The editor is not ready yet.
965
+ */
966
+ onBeforeCreate?: ((this: {
967
+ name: string;
968
+ options: Options;
969
+ storage: Storage;
970
+ editor: Editor;
971
+ type: MarkType;
972
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onBeforeCreate'];
973
+ }) => void) | null;
974
+ /**
975
+ * The editor is ready.
976
+ */
977
+ onCreate?: ((this: {
978
+ name: string;
979
+ options: Options;
980
+ storage: Storage;
981
+ editor: Editor;
982
+ type: MarkType;
983
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onCreate'];
984
+ }) => void) | null;
985
+ /**
986
+ * The content has changed.
987
+ */
988
+ onUpdate?: ((this: {
989
+ name: string;
990
+ options: Options;
991
+ storage: Storage;
992
+ editor: Editor;
993
+ type: MarkType;
994
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onUpdate'];
995
+ }) => void) | null;
996
+ /**
997
+ * The selection has changed.
998
+ */
999
+ onSelectionUpdate?: ((this: {
1000
+ name: string;
1001
+ options: Options;
1002
+ storage: Storage;
1003
+ editor: Editor;
1004
+ type: MarkType;
1005
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onSelectionUpdate'];
1006
+ }) => void) | null;
1007
+ /**
1008
+ * The editor state has changed.
1009
+ */
1010
+ onTransaction?: ((this: {
1011
+ name: string;
1012
+ options: Options;
1013
+ storage: Storage;
1014
+ editor: Editor;
1015
+ type: MarkType;
1016
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onTransaction'];
1017
+ }, props: {
1018
+ editor: Editor;
1019
+ transaction: Transaction;
1020
+ }) => void) | null;
1021
+ /**
1022
+ * The editor is focused.
1023
+ */
1024
+ onFocus?: ((this: {
1025
+ name: string;
1026
+ options: Options;
1027
+ storage: Storage;
1028
+ editor: Editor;
1029
+ type: MarkType;
1030
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
1031
+ }, props: {
1032
+ event: FocusEvent;
1033
+ }) => void) | null;
1034
+ /**
1035
+ * The editor isn’t focused anymore.
1036
+ */
1037
+ onBlur?: ((this: {
1038
+ name: string;
1039
+ options: Options;
1040
+ storage: Storage;
1041
+ editor: Editor;
1042
+ type: MarkType;
1043
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
1044
+ }, props: {
1045
+ event: FocusEvent;
1046
+ }) => void) | null;
1047
+ /**
1048
+ * The editor is destroyed.
1049
+ */
1050
+ onDestroy?: ((this: {
1051
+ name: string;
1052
+ options: Options;
1053
+ storage: Storage;
1054
+ editor: Editor;
1055
+ type: MarkType;
1056
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
1057
+ }) => void) | null;
1058
+ /**
1059
+ * Keep mark after split node
1060
+ */
1061
+ keepOnSplit?: boolean | (() => boolean);
1062
+ /**
1063
+ * Inclusive
1064
+ */
1065
+ inclusive?: MarkSpec['inclusive'] | ((this: {
1066
+ name: string;
1067
+ options: Options;
1068
+ storage: Storage;
1069
+ parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
1070
+ editor?: Editor;
1071
+ }) => MarkSpec['inclusive']);
1072
+ /**
1073
+ * Excludes
1074
+ */
1075
+ excludes?: MarkSpec['excludes'] | ((this: {
1076
+ name: string;
1077
+ options: Options;
1078
+ storage: Storage;
1079
+ parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
1080
+ editor?: Editor;
1081
+ }) => MarkSpec['excludes']);
1082
+ /**
1083
+ * Marks this Mark as exitable
1084
+ */
1085
+ exitable?: boolean | (() => boolean);
1086
+ /**
1087
+ * Group
1088
+ */
1089
+ group?: MarkSpec['group'] | ((this: {
1090
+ name: string;
1091
+ options: Options;
1092
+ storage: Storage;
1093
+ parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
1094
+ editor?: Editor;
1095
+ }) => MarkSpec['group']);
1096
+ /**
1097
+ * Spanning
1098
+ */
1099
+ spanning?: MarkSpec['spanning'] | ((this: {
1100
+ name: string;
1101
+ options: Options;
1102
+ storage: Storage;
1103
+ parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
1104
+ editor?: Editor;
1105
+ }) => MarkSpec['spanning']);
1106
+ /**
1107
+ * Code
1108
+ */
1109
+ code?: boolean | ((this: {
1110
+ name: string;
1111
+ options: Options;
1112
+ storage: Storage;
1113
+ parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
1114
+ editor?: Editor;
1115
+ }) => boolean);
1116
+ /**
1117
+ * Parse HTML
1118
+ */
1119
+ parseHTML?: (this: {
1120
+ name: string;
1121
+ options: Options;
1122
+ storage: Storage;
1123
+ parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
1124
+ editor?: Editor;
1125
+ }) => MarkSpec['parseDOM'];
1126
+ /**
1127
+ * Render HTML
1128
+ */
1129
+ renderHTML?: ((this: {
1130
+ name: string;
1131
+ options: Options;
1132
+ storage: Storage;
1133
+ parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
1134
+ editor?: Editor;
1135
+ }, props: {
1136
+ mark: Mark$1;
1137
+ HTMLAttributes: Record<string, any>;
1138
+ }) => DOMOutputSpec) | null;
1139
+ /**
1140
+ * Attributes
1141
+ */
1142
+ addAttributes?: (this: {
1143
+ name: string;
1144
+ options: Options;
1145
+ storage: Storage;
1146
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
1147
+ editor?: Editor;
1148
+ }) => Attributes | {};
1149
+ }
1150
+ }
1151
+ /**
1152
+ * The Mark class is used to create custom mark extensions.
1153
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
1154
+ */
1155
+ declare class Mark<Options = any, Storage = any> {
1156
+ type: string;
1157
+ name: string;
1158
+ parent: Mark | null;
1159
+ child: Mark | null;
1160
+ options: Options;
1161
+ storage: Storage;
1162
+ config: MarkConfig;
1163
+ constructor(config?: Partial<MarkConfig<Options, Storage>>);
1164
+ static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
1165
+ configure(options?: Partial<Options>): Mark<Options, Storage>;
1166
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
1167
+ static handleExit({ editor, mark }: {
1168
+ editor: Editor;
1169
+ mark: Mark;
1170
+ }): boolean;
1171
+ }
1172
+
1173
+ declare module '@tiptap/core' {
1174
+ interface ExtensionConfig<Options = any, Storage = any> {
1175
+ [key: string]: any;
1176
+ /**
1177
+ * The extension name - this must be unique.
1178
+ * It will be used to identify the extension.
1179
+ *
1180
+ * @example 'myExtension'
1181
+ */
1182
+ name: string;
1183
+ /**
1184
+ * The priority of your extension. The higher, the earlier it will be called
1185
+ * and will take precedence over other extensions with a lower priority.
1186
+ * @default 100
1187
+ * @example 101
1188
+ */
1189
+ priority?: number;
1190
+ /**
1191
+ * The default options for this extension.
1192
+ * @example
1193
+ * defaultOptions: {
1194
+ * myOption: 'foo',
1195
+ * myOtherOption: 10,
1196
+ * }
1197
+ */
1198
+ defaultOptions?: Options;
1199
+ /**
1200
+ * This method will add options to this extension
1201
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#settings
1202
+ * @example
1203
+ * addOptions() {
1204
+ * return {
1205
+ * myOption: 'foo',
1206
+ * myOtherOption: 10,
1207
+ * }
1208
+ */
1209
+ addOptions?: (this: {
1210
+ name: string;
1211
+ parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addOptions'], undefined>;
1212
+ }) => Options;
1213
+ /**
1214
+ * The default storage this extension can save data to.
1215
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#storage
1216
+ * @example
1217
+ * defaultStorage: {
1218
+ * prefetchedUsers: [],
1219
+ * loading: false,
1220
+ * }
1221
+ */
1222
+ addStorage?: (this: {
1223
+ name: string;
1224
+ options: Options;
1225
+ parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addStorage'], undefined>;
1226
+ }) => Storage;
1227
+ /**
1228
+ * This function adds globalAttributes to specific nodes.
1229
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#global-attributes
1230
+ * @example
1231
+ * addGlobalAttributes() {
1232
+ * return [
1233
+ * {
1234
+ // Extend the following extensions
1235
+ * types: [
1236
+ * 'heading',
1237
+ * 'paragraph',
1238
+ * ],
1239
+ * // … with those attributes
1240
+ * attributes: {
1241
+ * textAlign: {
1242
+ * default: 'left',
1243
+ * renderHTML: attributes => ({
1244
+ * style: `text-align: ${attributes.textAlign}`,
1245
+ * }),
1246
+ * parseHTML: element => element.style.textAlign || 'left',
1247
+ * },
1248
+ * },
1249
+ * },
1250
+ * ]
1251
+ * }
1252
+ */
1253
+ addGlobalAttributes?: (this: {
1254
+ name: string;
1255
+ options: Options;
1256
+ storage: Storage;
1257
+ extensions: (Node | Mark)[];
1258
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addGlobalAttributes'];
1259
+ }) => GlobalAttributes;
1260
+ /**
1261
+ * This function adds commands to the editor
1262
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#commands
1263
+ * @example
1264
+ * addCommands() {
1265
+ * return {
1266
+ * myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
1267
+ * }
1268
+ * }
1269
+ */
1270
+ addCommands?: (this: {
1271
+ name: string;
1272
+ options: Options;
1273
+ storage: Storage;
1274
+ editor: Editor;
1275
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addCommands'];
1276
+ }) => Partial<RawCommands>;
1277
+ /**
1278
+ * This function registers keyboard shortcuts.
1279
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#keyboard-shortcuts
1280
+ * @example
1281
+ * addKeyboardShortcuts() {
1282
+ * return {
1283
+ * 'Mod-l': () => this.editor.commands.toggleBulletList(),
1284
+ * }
1285
+ * },
1286
+ */
1287
+ addKeyboardShortcuts?: (this: {
1288
+ name: string;
1289
+ options: Options;
1290
+ storage: Storage;
1291
+ editor: Editor;
1292
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addKeyboardShortcuts'];
1293
+ }) => {
1294
+ [key: string]: KeyboardShortcutCommand;
1295
+ };
1296
+ /**
1297
+ * This function adds input rules to the editor.
1298
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#input-rules
1299
+ * @example
1300
+ * addInputRules() {
1301
+ * return [
1302
+ * markInputRule({
1303
+ * find: inputRegex,
1304
+ * type: this.type,
1305
+ * }),
1306
+ * ]
1307
+ * },
1308
+ */
1309
+ addInputRules?: (this: {
1310
+ name: string;
1311
+ options: Options;
1312
+ storage: Storage;
1313
+ editor: Editor;
1314
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addInputRules'];
1315
+ }) => InputRule[];
1316
+ /**
1317
+ * This function adds paste rules to the editor.
1318
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#paste-rules
1319
+ * @example
1320
+ * addPasteRules() {
1321
+ * return [
1322
+ * markPasteRule({
1323
+ * find: pasteRegex,
1324
+ * type: this.type,
1325
+ * }),
1326
+ * ]
1327
+ * },
1328
+ */
1329
+ addPasteRules?: (this: {
1330
+ name: string;
1331
+ options: Options;
1332
+ storage: Storage;
1333
+ editor: Editor;
1334
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addPasteRules'];
1335
+ }) => PasteRule[];
1336
+ /**
1337
+ * This function adds Prosemirror plugins to the editor
1338
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#prosemirror-plugins
1339
+ * @example
1340
+ * addProseMirrorPlugins() {
1341
+ * return [
1342
+ * customPlugin(),
1343
+ * ]
1344
+ * }
1345
+ */
1346
+ addProseMirrorPlugins?: (this: {
1347
+ name: string;
1348
+ options: Options;
1349
+ storage: Storage;
1350
+ editor: Editor;
1351
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addProseMirrorPlugins'];
1352
+ }) => Plugin[];
1353
+ /**
1354
+ * This function adds additional extensions to the editor. This is useful for
1355
+ * building extension kits.
1356
+ * @example
1357
+ * addExtensions() {
1358
+ * return [
1359
+ * BulletList,
1360
+ * OrderedList,
1361
+ * ListItem
1362
+ * ]
1363
+ * }
1364
+ */
1365
+ addExtensions?: (this: {
1366
+ name: string;
1367
+ options: Options;
1368
+ storage: Storage;
1369
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['addExtensions'];
1370
+ }) => Extensions;
1371
+ /**
1372
+ * This function extends the schema of the node.
1373
+ * @example
1374
+ * extendNodeSchema() {
1375
+ * return {
1376
+ * group: 'inline',
1377
+ * selectable: false,
1378
+ * }
1379
+ * }
1380
+ */
1381
+ extendNodeSchema?: ((this: {
1382
+ name: string;
1383
+ options: Options;
1384
+ storage: Storage;
1385
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['extendNodeSchema'];
1386
+ }, extension: Node) => Record<string, any>) | null;
1387
+ /**
1388
+ * This function extends the schema of the mark.
1389
+ * @example
1390
+ * extendMarkSchema() {
1391
+ * return {
1392
+ * group: 'inline',
1393
+ * selectable: false,
1394
+ * }
1395
+ * }
1396
+ */
1397
+ extendMarkSchema?: ((this: {
1398
+ name: string;
1399
+ options: Options;
1400
+ storage: Storage;
1401
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['extendMarkSchema'];
1402
+ }, extension: Mark) => Record<string, any>) | null;
1403
+ /**
1404
+ * The editor is not ready yet.
1405
+ */
1406
+ onBeforeCreate?: ((this: {
1407
+ name: string;
1408
+ options: Options;
1409
+ storage: Storage;
1410
+ editor: Editor;
1411
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBeforeCreate'];
1412
+ }) => void) | null;
1413
+ /**
1414
+ * The editor is ready.
1415
+ */
1416
+ onCreate?: ((this: {
1417
+ name: string;
1418
+ options: Options;
1419
+ storage: Storage;
1420
+ editor: Editor;
1421
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onCreate'];
1422
+ }) => void) | null;
1423
+ /**
1424
+ * The content has changed.
1425
+ */
1426
+ onUpdate?: ((this: {
1427
+ name: string;
1428
+ options: Options;
1429
+ storage: Storage;
1430
+ editor: Editor;
1431
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onUpdate'];
1432
+ }) => void) | null;
1433
+ /**
1434
+ * The selection has changed.
1435
+ */
1436
+ onSelectionUpdate?: ((this: {
1437
+ name: string;
1438
+ options: Options;
1439
+ storage: Storage;
1440
+ editor: Editor;
1441
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onSelectionUpdate'];
1442
+ }) => void) | null;
1443
+ /**
1444
+ * The editor state has changed.
1445
+ */
1446
+ onTransaction?: ((this: {
1447
+ name: string;
1448
+ options: Options;
1449
+ storage: Storage;
1450
+ editor: Editor;
1451
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onTransaction'];
1452
+ }, props: {
1453
+ editor: Editor;
1454
+ transaction: Transaction;
1455
+ }) => void) | null;
1456
+ /**
1457
+ * The editor is focused.
1458
+ */
1459
+ onFocus?: ((this: {
1460
+ name: string;
1461
+ options: Options;
1462
+ storage: Storage;
1463
+ editor: Editor;
1464
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onFocus'];
1465
+ }, props: {
1466
+ event: FocusEvent;
1467
+ }) => void) | null;
1468
+ /**
1469
+ * The editor isn’t focused anymore.
1470
+ */
1471
+ onBlur?: ((this: {
1472
+ name: string;
1473
+ options: Options;
1474
+ storage: Storage;
1475
+ editor: Editor;
1476
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBlur'];
1477
+ }, props: {
1478
+ event: FocusEvent;
1479
+ }) => void) | null;
1480
+ /**
1481
+ * The editor is destroyed.
1482
+ */
1483
+ onDestroy?: ((this: {
1484
+ name: string;
1485
+ options: Options;
1486
+ storage: Storage;
1487
+ editor: Editor;
1488
+ parent: ParentConfig<ExtensionConfig<Options, Storage>>['onDestroy'];
1489
+ }) => void) | null;
1490
+ }
1491
+ }
1492
+ /**
1493
+ * The Extension class is the base class for all extensions.
1494
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
1495
+ */
1496
+ declare class Extension<Options = any, Storage = any> {
1497
+ type: string;
1498
+ name: string;
1499
+ parent: Extension | null;
1500
+ child: Extension | null;
1501
+ options: Options;
1502
+ storage: Storage;
1503
+ config: ExtensionConfig;
1504
+ constructor(config?: Partial<ExtensionConfig<Options, Storage>>);
1505
+ static create<O = any, S = any>(config?: Partial<ExtensionConfig<O, S>>): Extension<O, S>;
1506
+ configure(options?: Partial<Options>): Extension<Options, Storage>;
1507
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>): Extension<ExtendedOptions, ExtendedStorage>;
1508
+ }
1509
+
1510
+ type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig;
1511
+ type AnyExtension = Extension | Node | Mark;
1512
+ type Extensions = AnyExtension[];
1513
+ type ParentConfig<T> = Partial<{
1514
+ [P in keyof T]: Required<T>[P] extends (...args: any) => any ? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]> : T[P];
1515
+ }>;
1516
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
1517
+ type RemoveThis<T> = T extends (...args: any) => any ? (...args: Parameters<T>) => ReturnType<T> : T;
1518
+ type MaybeReturnType<T> = T extends (...args: any) => any ? ReturnType<T> : T;
1519
+ type MaybeThisParameterType<T> = Exclude<T, Primitive> extends (...args: any) => any ? ThisParameterType<Exclude<T, Primitive>> : any;
1520
+ interface EditorEvents {
1521
+ beforeCreate: {
1522
+ editor: Editor;
1523
+ };
1524
+ create: {
1525
+ editor: Editor;
1526
+ };
1527
+ contentError: {
1528
+ editor: Editor;
1529
+ error: Error;
1530
+ /**
1531
+ * If called, will re-initialize the editor with the collaboration extension removed.
1532
+ * This will prevent syncing back deletions of content not present in the current schema.
1533
+ */
1534
+ disableCollaboration: () => void;
1535
+ };
1536
+ update: {
1537
+ editor: Editor;
1538
+ transaction: Transaction;
1539
+ };
1540
+ selectionUpdate: {
1541
+ editor: Editor;
1542
+ transaction: Transaction;
1543
+ };
1544
+ beforeTransaction: {
1545
+ editor: Editor;
1546
+ transaction: Transaction;
1547
+ nextState: EditorState;
1548
+ };
1549
+ transaction: {
1550
+ editor: Editor;
1551
+ transaction: Transaction;
1552
+ };
1553
+ focus: {
1554
+ editor: Editor;
1555
+ event: FocusEvent;
1556
+ transaction: Transaction;
1557
+ };
1558
+ blur: {
1559
+ editor: Editor;
1560
+ event: FocusEvent;
1561
+ transaction: Transaction;
1562
+ };
1563
+ destroy: void;
1564
+ paste: {
1565
+ editor: Editor;
1566
+ event: ClipboardEvent;
1567
+ slice: Slice;
1568
+ };
1569
+ drop: {
1570
+ editor: Editor;
1571
+ event: DragEvent;
1572
+ slice: Slice;
1573
+ moved: boolean;
1574
+ };
1575
+ }
1576
+ type EnableRules = (AnyExtension | string)[] | boolean;
1577
+ interface EditorOptions {
1578
+ element: Element;
1579
+ content: Content;
1580
+ extensions: Extensions;
1581
+ injectCSS: boolean;
1582
+ injectNonce: string | undefined;
1583
+ autofocus: FocusPosition;
1584
+ editable: boolean;
1585
+ editorProps: EditorProps;
1586
+ parseOptions: ParseOptions;
1587
+ coreExtensionOptions?: {
1588
+ clipboardTextSerializer?: {
1589
+ blockSeparator?: string;
1590
+ };
1591
+ };
1592
+ enableInputRules: EnableRules;
1593
+ enablePasteRules: EnableRules;
1594
+ /**
1595
+ * Determines whether core extensions are enabled.
1596
+ *
1597
+ * If set to `false`, all core extensions will be disabled.
1598
+ * To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`.
1599
+ * Extensions not listed in the object will remain enabled.
1600
+ *
1601
+ * @example
1602
+ * // Disable all core extensions
1603
+ * enabledCoreExtensions: false
1604
+ *
1605
+ * @example
1606
+ * // Disable only the keymap core extension
1607
+ * enabledCoreExtensions: { keymap: false }
1608
+ *
1609
+ * @default true
1610
+ */
1611
+ enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste', false>>;
1612
+ /**
1613
+ * If `true`, the editor will check the content for errors on initialization.
1614
+ * Emitting the `contentError` event if the content is invalid.
1615
+ * Which can be used to show a warning or error message to the user.
1616
+ * @default false
1617
+ */
1618
+ enableContentCheck: boolean;
1619
+ onBeforeCreate: (props: EditorEvents['beforeCreate']) => void;
1620
+ onCreate: (props: EditorEvents['create']) => void;
1621
+ /**
1622
+ * Called when the editor encounters an error while parsing the content.
1623
+ * Only enabled if `enableContentCheck` is `true`.
1624
+ */
1625
+ onContentError: (props: EditorEvents['contentError']) => void;
1626
+ onUpdate: (props: EditorEvents['update']) => void;
1627
+ onSelectionUpdate: (props: EditorEvents['selectionUpdate']) => void;
1628
+ onTransaction: (props: EditorEvents['transaction']) => void;
1629
+ onFocus: (props: EditorEvents['focus']) => void;
1630
+ onBlur: (props: EditorEvents['blur']) => void;
1631
+ onDestroy: (props: EditorEvents['destroy']) => void;
1632
+ onPaste: (e: ClipboardEvent, slice: Slice) => void;
1633
+ onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void;
1634
+ }
1635
+ type HTMLContent = string;
1636
+ type JSONContent = {
1637
+ type?: string;
1638
+ attrs?: Record<string, any>;
1639
+ content?: JSONContent[];
1640
+ marks?: {
1641
+ type: string;
1642
+ attrs?: Record<string, any>;
1643
+ [key: string]: any;
1644
+ }[];
1645
+ text?: string;
1646
+ [key: string]: any;
1647
+ };
1648
+ type Content = HTMLContent | JSONContent | JSONContent[] | null;
1649
+ type CommandProps = {
1650
+ editor: Editor;
1651
+ tr: Transaction;
1652
+ commands: SingleCommands;
1653
+ can: () => CanCommands;
1654
+ chain: () => ChainedCommands;
1655
+ state: EditorState;
1656
+ view: EditorView;
1657
+ dispatch: ((args?: any) => any) | undefined;
1658
+ };
1659
+ type Command = (props: CommandProps) => boolean;
1660
+ type CommandSpec = (...args: any[]) => Command;
1661
+ type KeyboardShortcutCommand = (props: {
1662
+ editor: Editor;
1663
+ }) => boolean;
1664
+ type Attribute = {
1665
+ default?: any;
1666
+ rendered?: boolean;
1667
+ renderHTML?: ((attributes: Record<string, any>) => Record<string, any> | null) | null;
1668
+ parseHTML?: ((element: HTMLElement) => any | null) | null;
1669
+ keepOnSplit?: boolean;
1670
+ isRequired?: boolean;
1671
+ };
1672
+ type Attributes = {
1673
+ [key: string]: Attribute;
1674
+ };
1675
+ type ExtensionAttribute = {
1676
+ type: string;
1677
+ name: string;
1678
+ attribute: Required<Attribute>;
1679
+ };
1680
+ type GlobalAttributes = {
1681
+ /**
1682
+ * The node & mark types this attribute should be applied to.
1683
+ */
1684
+ types: string[];
1685
+ /**
1686
+ * The attributes to add to the node or mark types.
1687
+ */
1688
+ attributes: Record<string, Attribute | undefined>;
1689
+ }[];
1690
+ type PickValue<T, K extends keyof T> = T[K];
1691
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
1692
+ type Diff<T extends keyof any, U extends keyof any> = ({
1693
+ [P in T]: P;
1694
+ } & {
1695
+ [P in U]: never;
1696
+ } & {
1697
+ [x: string]: never;
1698
+ })[T];
1699
+ type Overwrite<T, U> = Pick<T, Diff<keyof T, keyof U>> & U;
1700
+ type ValuesOf<T> = T[keyof T];
1701
+ type KeysWithTypeOf<T, Type> = {
1702
+ [P in keyof T]: T[P] extends Type ? P : never;
1703
+ }[keyof T];
1704
+ type DOMNode = InstanceType<typeof window.Node>;
1705
+ /**
1706
+ * prosemirror-view does not export the `type` property of `Decoration`.
1707
+ * So, this defines the `DecorationType` interface to include the `type` property.
1708
+ */
1709
+ interface DecorationType {
1710
+ spec: any;
1711
+ map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
1712
+ valid(node: Node, span: Decoration): boolean;
1713
+ eq(other: DecorationType): boolean;
1714
+ destroy(dom: DOMNode): void;
1715
+ readonly attrs: DecorationAttrs;
1716
+ }
1717
+ /**
1718
+ * prosemirror-view does not export the `type` property of `Decoration`.
1719
+ * This adds the `type` property to the `Decoration` type.
1720
+ */
1721
+ type DecorationWithType = Decoration & {
1722
+ type: DecorationType;
1723
+ };
1724
+ interface NodeViewProps extends NodeViewRendererProps {
1725
+ decorations: readonly DecorationWithType[];
1726
+ selected: boolean;
1727
+ updateAttributes: (attributes: Record<string, any>) => void;
1728
+ deleteNode: () => void;
1729
+ }
1730
+ interface NodeViewRendererOptions {
1731
+ stopEvent: ((props: {
1732
+ event: Event;
1733
+ }) => boolean) | null;
1734
+ ignoreMutation: ((props: {
1735
+ mutation: ViewMutationRecord;
1736
+ }) => boolean) | null;
1737
+ contentDOMElementTag: string;
1738
+ }
1739
+ interface NodeViewRendererProps {
1740
+ /**
1741
+ * The node that is being rendered.
1742
+ */
1743
+ node: Parameters<NodeViewConstructor>[0];
1744
+ /**
1745
+ * The editor's view.
1746
+ */
1747
+ view: Parameters<NodeViewConstructor>[1];
1748
+ /**
1749
+ * A function that can be called to get the node's current position in the document.
1750
+ */
1751
+ getPos: Parameters<NodeViewConstructor>[2];
1752
+ /**
1753
+ * is an array of node or inline decorations that are active around the node.
1754
+ * They are automatically drawn in the normal way, and you will usually just want to ignore this, but they can also be used as a way to provide context information to the node view without adding it to the document itself.
1755
+ */
1756
+ decorations: Parameters<NodeViewConstructor>[3];
1757
+ /**
1758
+ * holds the decorations for the node's content. You can safely ignore this if your view has no content or a contentDOM property, since the editor will draw the decorations on the content.
1759
+ * But if you, for example, want to create a nested editor with the content, it may make sense to provide it with the inner decorations.
1760
+ */
1761
+ innerDecorations: Parameters<NodeViewConstructor>[4];
1762
+ /**
1763
+ * The editor instance.
1764
+ */
1765
+ editor: Editor;
1766
+ /**
1767
+ * The extension that is responsible for the node.
1768
+ */
1769
+ extension: Node;
1770
+ /**
1771
+ * The HTML attributes that should be added to the node's DOM element.
1772
+ */
1773
+ HTMLAttributes: Record<string, any>;
1774
+ }
1775
+ type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView$1;
1776
+ type AnyCommands = Record<string, (...args: any[]) => Command>;
1777
+ type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, {}>>>>;
1778
+ type RawCommands = {
1779
+ [Item in keyof UnionCommands]: UnionCommands<Command>[Item];
1780
+ };
1781
+ type SingleCommands = {
1782
+ [Item in keyof UnionCommands]: UnionCommands<boolean>[Item];
1783
+ };
1784
+ type ChainedCommands = {
1785
+ [Item in keyof UnionCommands]: UnionCommands<ChainedCommands>[Item];
1786
+ } & {
1787
+ run: () => boolean;
1788
+ };
1789
+ type CanCommands = SingleCommands & {
1790
+ chain: () => ChainedCommands;
1791
+ };
1792
+ type FocusPosition = 'start' | 'end' | 'all' | number | boolean | null;
1793
+ type Range = {
1794
+ from: number;
1795
+ to: number;
1796
+ };
1797
+ type NodeRange = {
1798
+ node: Node$1;
1799
+ from: number;
1800
+ to: number;
1801
+ };
1802
+ type MarkRange = {
1803
+ mark: Mark$1;
1804
+ from: number;
1805
+ to: number;
1806
+ };
1807
+ type Predicate = (node: Node$1) => boolean;
1808
+ type NodeWithPos = {
1809
+ node: Node$1;
1810
+ pos: number;
1811
+ };
1812
+ type TextSerializer = (props: {
1813
+ node: Node$1;
1814
+ pos: number;
1815
+ parent: Node$1;
1816
+ index: number;
1817
+ range: Range;
1818
+ }) => string;
1819
+ type ExtendedRegExpMatchArray = RegExpMatchArray & {
1820
+ data?: Record<string, any>;
1821
+ };
1822
+ type Dispatch = ((args?: any) => any) | undefined;
1823
+
1824
+ declare class ExtensionManager {
1825
+ editor: Editor;
1826
+ schema: Schema;
1827
+ extensions: Extensions;
1828
+ splittableMarks: string[];
1829
+ constructor(extensions: Extensions, editor: Editor);
1830
+ /**
1831
+ * Returns a flattened and sorted extension list while
1832
+ * also checking for duplicated extensions and warns the user.
1833
+ * @param extensions An array of Tiptap extensions
1834
+ * @returns An flattened and sorted array of Tiptap extensions
1835
+ */
1836
+ static resolve(extensions: Extensions): Extensions;
1837
+ /**
1838
+ * Create a flattened array of extensions by traversing the `addExtensions` field.
1839
+ * @param extensions An array of Tiptap extensions
1840
+ * @returns A flattened array of Tiptap extensions
1841
+ */
1842
+ static flatten(extensions: Extensions): Extensions;
1843
+ /**
1844
+ * Sort extensions by priority.
1845
+ * @param extensions An array of Tiptap extensions
1846
+ * @returns A sorted array of Tiptap extensions by priority
1847
+ */
1848
+ static sort(extensions: Extensions): Extensions;
1849
+ /**
1850
+ * Get all commands from the extensions.
1851
+ * @returns An object with all commands where the key is the command name and the value is the command function
1852
+ */
1853
+ get commands(): RawCommands;
1854
+ /**
1855
+ * Get all registered Prosemirror plugins from the extensions.
1856
+ * @returns An array of Prosemirror plugins
1857
+ */
1858
+ get plugins(): Plugin[];
1859
+ /**
1860
+ * Get all attributes from the extensions.
1861
+ * @returns An array of attributes
1862
+ */
1863
+ get attributes(): ExtensionAttribute[];
1864
+ /**
1865
+ * Get all node views from the extensions.
1866
+ * @returns An object with all node views where the key is the node name and the value is the node view function
1867
+ */
1868
+ get nodeViews(): Record<string, NodeViewConstructor>;
1869
+ /**
1870
+ * Go through all extensions, create extension storages & setup marks
1871
+ * & bind editor event listener.
1872
+ */
1873
+ private setupExtensions;
1874
+ }
1875
+
1876
+ declare class NodePos {
1877
+ private resolvedPos;
1878
+ private isBlock;
1879
+ private editor;
1880
+ private get name();
1881
+ constructor(pos: ResolvedPos, editor: Editor, isBlock?: boolean, node?: Node$1 | null);
1882
+ private currentNode;
1883
+ get node(): Node$1;
1884
+ get element(): HTMLElement;
1885
+ actualDepth: number | null;
1886
+ get depth(): number;
1887
+ get pos(): number;
1888
+ get content(): Fragment;
1889
+ set content(content: Content);
1890
+ get attributes(): {
1891
+ [key: string]: any;
1892
+ };
1893
+ get textContent(): string;
1894
+ get size(): number;
1895
+ get from(): number;
1896
+ get range(): Range;
1897
+ get to(): number;
1898
+ get parent(): NodePos | null;
1899
+ get before(): NodePos | null;
1900
+ get after(): NodePos | null;
1901
+ get children(): NodePos[];
1902
+ get firstChild(): NodePos | null;
1903
+ get lastChild(): NodePos | null;
1904
+ closest(selector: string, attributes?: {
1905
+ [key: string]: any;
1906
+ }): NodePos | null;
1907
+ querySelector(selector: string, attributes?: {
1908
+ [key: string]: any;
1909
+ }): NodePos | null;
1910
+ querySelectorAll(selector: string, attributes?: {
1911
+ [key: string]: any;
1912
+ }, firstItemOnly?: boolean): NodePos[];
1913
+ setAttribute(attributes: {
1914
+ [key: string]: any;
1915
+ }): void;
1916
+ }
1917
+
1918
+ type ClipboardTextSerializerOptions = {
1919
+ blockSeparator?: string;
1920
+ };
1921
+ declare const ClipboardTextSerializer: Extension<ClipboardTextSerializerOptions, any>;
1922
+
1923
+ declare module '@tiptap/core' {
1924
+ interface Commands<ReturnType> {
1925
+ blur: {
1926
+ /**
1927
+ * Removes focus from the editor.
1928
+ * @example editor.commands.blur()
1929
+ */
1930
+ blur: () => ReturnType;
1931
+ };
1932
+ }
1933
+ }
1934
+
1935
+ declare module '@tiptap/core' {
1936
+ interface Commands<ReturnType> {
1937
+ clearContent: {
1938
+ /**
1939
+ * Clear the whole document.
1940
+ * @param emitUpdate Whether to emit an update event.
1941
+ * @example editor.commands.clearContent()
1942
+ */
1943
+ clearContent: (emitUpdate?: boolean) => ReturnType;
1944
+ };
1945
+ }
1946
+ }
1947
+
1948
+ declare module '@tiptap/core' {
1949
+ interface Commands<ReturnType> {
1950
+ clearNodes: {
1951
+ /**
1952
+ * Normalize nodes to a simple paragraph.
1953
+ * @example editor.commands.clearNodes()
1954
+ */
1955
+ clearNodes: () => ReturnType;
1956
+ };
1957
+ }
1958
+ }
1959
+
1960
+ declare module '@tiptap/core' {
1961
+ interface Commands<ReturnType> {
1962
+ command: {
1963
+ /**
1964
+ * Define a command inline.
1965
+ * @param fn The command function.
1966
+ * @example
1967
+ * editor.commands.command(({ tr, state }) => {
1968
+ * ...
1969
+ * return true
1970
+ * })
1971
+ */
1972
+ command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
1973
+ };
1974
+ }
1975
+ }
1976
+
1977
+ declare module '@tiptap/core' {
1978
+ interface Commands<ReturnType> {
1979
+ createParagraphNear: {
1980
+ /**
1981
+ * Create a paragraph nearby.
1982
+ * @example editor.commands.createParagraphNear()
1983
+ */
1984
+ createParagraphNear: () => ReturnType;
1985
+ };
1986
+ }
1987
+ }
1988
+
1989
+ declare module '@tiptap/core' {
1990
+ interface Commands<ReturnType> {
1991
+ cut: {
1992
+ /**
1993
+ * Cuts content from a range and inserts it at a given position.
1994
+ * @param range The range to cut.
1995
+ * @param range.from The start position of the range.
1996
+ * @param range.to The end position of the range.
1997
+ * @param targetPos The position to insert the content at.
1998
+ * @example editor.commands.cut({ from: 1, to: 3 }, 5)
1999
+ */
2000
+ cut: ({ from, to }: {
2001
+ from: number;
2002
+ to: number;
2003
+ }, targetPos: number) => ReturnType;
2004
+ };
2005
+ }
2006
+ }
2007
+
2008
+ declare module '@tiptap/core' {
2009
+ interface Commands<ReturnType> {
2010
+ deleteCurrentNode: {
2011
+ /**
2012
+ * Delete the node that currently has the selection anchor.
2013
+ * @example editor.commands.deleteCurrentNode()
2014
+ */
2015
+ deleteCurrentNode: () => ReturnType;
2016
+ };
2017
+ }
2018
+ }
2019
+
2020
+ declare module '@tiptap/core' {
2021
+ interface Commands<ReturnType> {
2022
+ deleteNode: {
2023
+ /**
2024
+ * Delete a node with a given type or name.
2025
+ * @param typeOrName The type or name of the node.
2026
+ * @example editor.commands.deleteNode('paragraph')
2027
+ */
2028
+ deleteNode: (typeOrName: string | NodeType) => ReturnType;
2029
+ };
2030
+ }
2031
+ }
2032
+
2033
+ declare module '@tiptap/core' {
2034
+ interface Commands<ReturnType> {
2035
+ deleteRange: {
2036
+ /**
2037
+ * Delete a given range.
2038
+ * @param range The range to delete.
2039
+ * @example editor.commands.deleteRange({ from: 1, to: 3 })
2040
+ */
2041
+ deleteRange: (range: Range) => ReturnType;
2042
+ };
2043
+ }
2044
+ }
2045
+
2046
+ declare module '@tiptap/core' {
2047
+ interface Commands<ReturnType> {
2048
+ deleteSelection: {
2049
+ /**
2050
+ * Delete the selection, if there is one.
2051
+ * @example editor.commands.deleteSelection()
2052
+ */
2053
+ deleteSelection: () => ReturnType;
2054
+ };
2055
+ }
2056
+ }
2057
+
2058
+ declare module '@tiptap/core' {
2059
+ interface Commands<ReturnType> {
2060
+ enter: {
2061
+ /**
2062
+ * Trigger enter.
2063
+ * @example editor.commands.enter()
2064
+ */
2065
+ enter: () => ReturnType;
2066
+ };
2067
+ }
2068
+ }
2069
+
2070
+ declare module '@tiptap/core' {
2071
+ interface Commands<ReturnType> {
2072
+ exitCode: {
2073
+ /**
2074
+ * Exit from a code block.
2075
+ * @example editor.commands.exitCode()
2076
+ */
2077
+ exitCode: () => ReturnType;
2078
+ };
2079
+ }
2080
+ }
2081
+
2082
+ declare module '@tiptap/core' {
2083
+ interface Commands<ReturnType> {
2084
+ extendMarkRange: {
2085
+ /**
2086
+ * Extends the text selection to the current mark by type or name.
2087
+ * @param typeOrName The type or name of the mark.
2088
+ * @param attributes The attributes of the mark.
2089
+ * @example editor.commands.extendMarkRange('bold')
2090
+ * @example editor.commands.extendMarkRange('mention', { userId: "1" })
2091
+ */
2092
+ extendMarkRange: (
2093
+ /**
2094
+ * The type or name of the mark.
2095
+ */
2096
+ typeOrName: string | MarkType,
2097
+ /**
2098
+ * The attributes of the mark.
2099
+ */
2100
+ attributes?: Record<string, any>) => ReturnType;
2101
+ };
2102
+ }
2103
+ }
2104
+
2105
+ declare module '@tiptap/core' {
2106
+ interface Commands<ReturnType> {
2107
+ first: {
2108
+ /**
2109
+ * Runs one command after the other and stops at the first which returns true.
2110
+ * @param commands The commands to run.
2111
+ * @example editor.commands.first([command1, command2])
2112
+ */
2113
+ first: (commands: Command[] | ((props: CommandProps) => Command[])) => ReturnType;
2114
+ };
2115
+ }
2116
+ }
2117
+
2118
+ declare module '@tiptap/core' {
2119
+ interface Commands<ReturnType> {
2120
+ focus: {
2121
+ /**
2122
+ * Focus the editor at the given position.
2123
+ * @param position The position to focus at.
2124
+ * @param options.scrollIntoView Scroll the focused position into view after focusing
2125
+ * @example editor.commands.focus()
2126
+ * @example editor.commands.focus(32, { scrollIntoView: false })
2127
+ */
2128
+ focus: (
2129
+ /**
2130
+ * The position to focus at.
2131
+ */
2132
+ position?: FocusPosition,
2133
+ /**
2134
+ * Optional options
2135
+ * @default { scrollIntoView: true }
2136
+ */
2137
+ options?: {
2138
+ scrollIntoView?: boolean;
2139
+ }) => ReturnType;
2140
+ };
2141
+ }
2142
+ }
2143
+
2144
+ declare module '@tiptap/core' {
2145
+ interface Commands<ReturnType> {
2146
+ forEach: {
2147
+ /**
2148
+ * Loop through an array of items.
2149
+ */
2150
+ forEach: <T>(items: T[], fn: (item: T, props: CommandProps & {
2151
+ index: number;
2152
+ }) => boolean) => ReturnType;
2153
+ };
2154
+ }
2155
+ }
2156
+
2157
+ declare module '@tiptap/core' {
2158
+ interface Commands<ReturnType> {
2159
+ insertContent: {
2160
+ /**
2161
+ * Insert a node or string of HTML at the current position.
2162
+ * @example editor.commands.insertContent('<h1>Example</h1>')
2163
+ * @example editor.commands.insertContent('<h1>Example</h1>', { updateSelection: false })
2164
+ */
2165
+ insertContent: (
2166
+ /**
2167
+ * The ProseMirror content to insert.
2168
+ */
2169
+ value: Content | Node$1 | Fragment,
2170
+ /**
2171
+ * Optional options
2172
+ */
2173
+ options?: {
2174
+ /**
2175
+ * Options for parsing the content.
2176
+ */
2177
+ parseOptions?: ParseOptions;
2178
+ /**
2179
+ * Whether to update the selection after inserting the content.
2180
+ */
2181
+ updateSelection?: boolean;
2182
+ applyInputRules?: boolean;
2183
+ applyPasteRules?: boolean;
2184
+ }) => ReturnType;
2185
+ };
2186
+ }
2187
+ }
2188
+
2189
+ declare module '@tiptap/core' {
2190
+ interface Commands<ReturnType> {
2191
+ insertContentAt: {
2192
+ /**
2193
+ * Insert a node or string of HTML at a specific position.
2194
+ * @example editor.commands.insertContentAt(0, '<h1>Example</h1>')
2195
+ */
2196
+ insertContentAt: (
2197
+ /**
2198
+ * The position to insert the content at.
2199
+ */
2200
+ position: number | Range,
2201
+ /**
2202
+ * The ProseMirror content to insert.
2203
+ */
2204
+ value: Content | Node$1 | Fragment,
2205
+ /**
2206
+ * Optional options
2207
+ */
2208
+ options?: {
2209
+ /**
2210
+ * Options for parsing the content.
2211
+ */
2212
+ parseOptions?: ParseOptions;
2213
+ /**
2214
+ * Whether to update the selection after inserting the content.
2215
+ */
2216
+ updateSelection?: boolean;
2217
+ /**
2218
+ * Whether to apply input rules after inserting the content.
2219
+ */
2220
+ applyInputRules?: boolean;
2221
+ /**
2222
+ * Whether to apply paste rules after inserting the content.
2223
+ */
2224
+ applyPasteRules?: boolean;
2225
+ /**
2226
+ * Whether to throw an error if the content is invalid.
2227
+ */
2228
+ errorOnInvalidContent?: boolean;
2229
+ }) => ReturnType;
2230
+ };
2231
+ }
2232
+ }
2233
+
2234
+ declare module '@tiptap/core' {
2235
+ interface Commands<ReturnType> {
2236
+ joinUp: {
2237
+ /**
2238
+ * Join the selected block or, if there is a text selection, the closest ancestor block of the selection that can be joined, with the sibling above it.
2239
+ * @example editor.commands.joinUp()
2240
+ */
2241
+ joinUp: () => ReturnType;
2242
+ };
2243
+ joinDown: {
2244
+ /**
2245
+ * Join the selected block, or the closest ancestor of the selection that can be joined, with the sibling after it.
2246
+ * @example editor.commands.joinDown()
2247
+ */
2248
+ joinDown: () => ReturnType;
2249
+ };
2250
+ joinBackward: {
2251
+ /**
2252
+ * If the selection is empty and at the start of a textblock, try to reduce the distance between that block and the one before it—if there's a block directly before it that can be joined, join them.
2253
+ * If not, try to move the selected block closer to the next one in the document structure by lifting it out of its
2254
+ * parent or moving it into a parent of the previous block. Will use the view for accurate (bidi-aware) start-of-textblock detection if given.
2255
+ * @example editor.commands.joinBackward()
2256
+ */
2257
+ joinBackward: () => ReturnType;
2258
+ };
2259
+ joinForward: {
2260
+ /**
2261
+ * If the selection is empty and the cursor is at the end of a textblock, try to reduce or remove the boundary between that block and the one after it,
2262
+ * either by joining them or by moving the other block closer to this one in the tree structure.
2263
+ * Will use the view for accurate start-of-textblock detection if given.
2264
+ * @example editor.commands.joinForward()
2265
+ */
2266
+ joinForward: () => ReturnType;
2267
+ };
2268
+ }
2269
+ }
2270
+
2271
+ declare module '@tiptap/core' {
2272
+ interface Commands<ReturnType> {
2273
+ joinItemBackward: {
2274
+ /**
2275
+ * Join two items backward.
2276
+ * @example editor.commands.joinItemBackward()
2277
+ */
2278
+ joinItemBackward: () => ReturnType;
2279
+ };
2280
+ }
2281
+ }
2282
+
2283
+ declare module '@tiptap/core' {
2284
+ interface Commands<ReturnType> {
2285
+ joinItemForward: {
2286
+ /**
2287
+ * Join two items Forwards.
2288
+ * @example editor.commands.joinItemForward()
2289
+ */
2290
+ joinItemForward: () => ReturnType;
2291
+ };
2292
+ }
2293
+ }
2294
+
2295
+ declare module '@tiptap/core' {
2296
+ interface Commands<ReturnType> {
2297
+ joinTextblockBackward: {
2298
+ /**
2299
+ * A more limited form of joinBackward that only tries to join the current textblock to the one before it, if the cursor is at the start of a textblock.
2300
+ */
2301
+ joinTextblockBackward: () => ReturnType;
2302
+ };
2303
+ }
2304
+ }
2305
+
2306
+ declare module '@tiptap/core' {
2307
+ interface Commands<ReturnType> {
2308
+ joinTextblockForward: {
2309
+ /**
2310
+ * A more limited form of joinForward that only tries to join the current textblock to the one after it, if the cursor is at the end of a textblock.
2311
+ */
2312
+ joinTextblockForward: () => ReturnType;
2313
+ };
2314
+ }
2315
+ }
2316
+
2317
+ declare module '@tiptap/core' {
2318
+ interface Commands<ReturnType> {
2319
+ keyboardShortcut: {
2320
+ /**
2321
+ * Trigger a keyboard shortcut.
2322
+ * @param name The name of the keyboard shortcut.
2323
+ * @example editor.commands.keyboardShortcut('Mod-b')
2324
+ */
2325
+ keyboardShortcut: (name: string) => ReturnType;
2326
+ };
2327
+ }
2328
+ }
2329
+
2330
+ declare module '@tiptap/core' {
2331
+ interface Commands<ReturnType> {
2332
+ lift: {
2333
+ /**
2334
+ * Removes an existing wrap if possible lifting the node out of it
2335
+ * @param typeOrName The type or name of the node.
2336
+ * @param attributes The attributes of the node.
2337
+ * @example editor.commands.lift('paragraph')
2338
+ * @example editor.commands.lift('heading', { level: 1 })
2339
+ */
2340
+ lift: (typeOrName: string | NodeType, attributes?: Record<string, any>) => ReturnType;
2341
+ };
2342
+ }
2343
+ }
2344
+
2345
+ declare module '@tiptap/core' {
2346
+ interface Commands<ReturnType> {
2347
+ liftEmptyBlock: {
2348
+ /**
2349
+ * If the cursor is in an empty textblock that can be lifted, lift the block.
2350
+ * @example editor.commands.liftEmptyBlock()
2351
+ */
2352
+ liftEmptyBlock: () => ReturnType;
2353
+ };
2354
+ }
2355
+ }
2356
+
2357
+ declare module '@tiptap/core' {
2358
+ interface Commands<ReturnType> {
2359
+ liftListItem: {
2360
+ /**
2361
+ * Create a command to lift the list item around the selection up into a wrapping list.
2362
+ * @param typeOrName The type or name of the node.
2363
+ * @example editor.commands.liftListItem('listItem')
2364
+ */
2365
+ liftListItem: (typeOrName: string | NodeType) => ReturnType;
2366
+ };
2367
+ }
2368
+ }
2369
+
2370
+ declare module '@tiptap/core' {
2371
+ interface Commands<ReturnType> {
2372
+ newlineInCode: {
2373
+ /**
2374
+ * Add a newline character in code.
2375
+ * @example editor.commands.newlineInCode()
2376
+ */
2377
+ newlineInCode: () => ReturnType;
2378
+ };
2379
+ }
2380
+ }
2381
+
2382
+ declare module '@tiptap/core' {
2383
+ interface Commands<ReturnType> {
2384
+ resetAttributes: {
2385
+ /**
2386
+ * Resets some node attributes to the default value.
2387
+ * @param typeOrName The type or name of the node.
2388
+ * @param attributes The attributes of the node to reset.
2389
+ * @example editor.commands.resetAttributes('heading', 'level')
2390
+ */
2391
+ resetAttributes: (typeOrName: string | NodeType | MarkType, attributes: string | string[]) => ReturnType;
2392
+ };
2393
+ }
2394
+ }
2395
+
2396
+ declare module '@tiptap/core' {
2397
+ interface Commands<ReturnType> {
2398
+ scrollIntoView: {
2399
+ /**
2400
+ * Scroll the selection into view.
2401
+ * @example editor.commands.scrollIntoView()
2402
+ */
2403
+ scrollIntoView: () => ReturnType;
2404
+ };
2405
+ }
2406
+ }
2407
+
2408
+ declare module '@tiptap/core' {
2409
+ interface Commands<ReturnType> {
2410
+ selectAll: {
2411
+ /**
2412
+ * Select the whole document.
2413
+ * @example editor.commands.selectAll()
2414
+ */
2415
+ selectAll: () => ReturnType;
2416
+ };
2417
+ }
2418
+ }
2419
+
2420
+ declare module '@tiptap/core' {
2421
+ interface Commands<ReturnType> {
2422
+ selectNodeBackward: {
2423
+ /**
2424
+ * Select a node backward.
2425
+ * @example editor.commands.selectNodeBackward()
2426
+ */
2427
+ selectNodeBackward: () => ReturnType;
2428
+ };
2429
+ }
2430
+ }
2431
+
2432
+ declare module '@tiptap/core' {
2433
+ interface Commands<ReturnType> {
2434
+ selectNodeForward: {
2435
+ /**
2436
+ * Select a node forward.
2437
+ * @example editor.commands.selectNodeForward()
2438
+ */
2439
+ selectNodeForward: () => ReturnType;
2440
+ };
2441
+ }
2442
+ }
2443
+
2444
+ declare module '@tiptap/core' {
2445
+ interface Commands<ReturnType> {
2446
+ selectParentNode: {
2447
+ /**
2448
+ * Select the parent node.
2449
+ * @example editor.commands.selectParentNode()
2450
+ */
2451
+ selectParentNode: () => ReturnType;
2452
+ };
2453
+ }
2454
+ }
2455
+
2456
+ declare module '@tiptap/core' {
2457
+ interface Commands<ReturnType> {
2458
+ selectTextblockEnd: {
2459
+ /**
2460
+ * Moves the cursor to the end of current text block.
2461
+ * @example editor.commands.selectTextblockEnd()
2462
+ */
2463
+ selectTextblockEnd: () => ReturnType;
2464
+ };
2465
+ }
2466
+ }
2467
+
2468
+ declare module '@tiptap/core' {
2469
+ interface Commands<ReturnType> {
2470
+ selectTextblockStart: {
2471
+ /**
2472
+ * Moves the cursor to the start of current text block.
2473
+ * @example editor.commands.selectTextblockStart()
2474
+ */
2475
+ selectTextblockStart: () => ReturnType;
2476
+ };
2477
+ }
2478
+ }
2479
+
2480
+ declare module '@tiptap/core' {
2481
+ interface Commands<ReturnType> {
2482
+ setContent: {
2483
+ /**
2484
+ * Replace the whole document with new content.
2485
+ * @param content The new content.
2486
+ * @param emitUpdate Whether to emit an update event.
2487
+ * @param parseOptions Options for parsing the content.
2488
+ * @example editor.commands.setContent('<p>Example text</p>')
2489
+ */
2490
+ setContent: (
2491
+ /**
2492
+ * The new content.
2493
+ */
2494
+ content: Content | Fragment | Node$1,
2495
+ /**
2496
+ * Whether to emit an update event.
2497
+ * @default false
2498
+ */
2499
+ emitUpdate?: boolean,
2500
+ /**
2501
+ * Options for parsing the content.
2502
+ * @default {}
2503
+ */
2504
+ parseOptions?: ParseOptions,
2505
+ /**
2506
+ * Options for `setContent`.
2507
+ */
2508
+ options?: {
2509
+ /**
2510
+ * Whether to throw an error if the content is invalid.
2511
+ */
2512
+ errorOnInvalidContent?: boolean;
2513
+ }) => ReturnType;
2514
+ };
2515
+ }
2516
+ }
2517
+
2518
+ declare module '@tiptap/core' {
2519
+ interface Commands<ReturnType> {
2520
+ setMark: {
2521
+ /**
2522
+ * Add a mark with new attributes.
2523
+ * @param typeOrName The mark type or name.
2524
+ * @example editor.commands.setMark('bold', { level: 1 })
2525
+ */
2526
+ setMark: (typeOrName: string | MarkType, attributes?: Record<string, any>) => ReturnType;
2527
+ };
2528
+ }
2529
+ }
2530
+
2531
+ declare module '@tiptap/core' {
2532
+ interface Commands<ReturnType> {
2533
+ setMeta: {
2534
+ /**
2535
+ * Store a metadata property in the current transaction.
2536
+ * @param key The key of the metadata property.
2537
+ * @param value The value to store.
2538
+ * @example editor.commands.setMeta('foo', 'bar')
2539
+ */
2540
+ setMeta: (key: string | Plugin | PluginKey, value: any) => ReturnType;
2541
+ };
2542
+ }
2543
+ }
2544
+
2545
+ declare module '@tiptap/core' {
2546
+ interface Commands<ReturnType> {
2547
+ setNode: {
2548
+ /**
2549
+ * Replace a given range with a node.
2550
+ * @param typeOrName The type or name of the node
2551
+ * @param attributes The attributes of the node
2552
+ * @example editor.commands.setNode('paragraph')
2553
+ */
2554
+ setNode: (typeOrName: string | NodeType, attributes?: Record<string, any>) => ReturnType;
2555
+ };
2556
+ }
2557
+ }
2558
+
2559
+ declare module '@tiptap/core' {
2560
+ interface Commands<ReturnType> {
2561
+ setNodeSelection: {
2562
+ /**
2563
+ * Creates a NodeSelection.
2564
+ * @param position - Position of the node.
2565
+ * @example editor.commands.setNodeSelection(10)
2566
+ */
2567
+ setNodeSelection: (position: number) => ReturnType;
2568
+ };
2569
+ }
2570
+ }
2571
+
2572
+ declare module '@tiptap/core' {
2573
+ interface Commands<ReturnType> {
2574
+ setTextSelection: {
2575
+ /**
2576
+ * Creates a TextSelection.
2577
+ * @param position The position of the selection.
2578
+ * @example editor.commands.setTextSelection(10)
2579
+ */
2580
+ setTextSelection: (position: number | Range) => ReturnType;
2581
+ };
2582
+ }
2583
+ }
2584
+
2585
+ declare module '@tiptap/core' {
2586
+ interface Commands<ReturnType> {
2587
+ sinkListItem: {
2588
+ /**
2589
+ * Sink the list item down into an inner list.
2590
+ * @param typeOrName The type or name of the node.
2591
+ * @example editor.commands.sinkListItem('listItem')
2592
+ */
2593
+ sinkListItem: (typeOrName: string | NodeType) => ReturnType;
2594
+ };
2595
+ }
2596
+ }
2597
+
2598
+ declare module '@tiptap/core' {
2599
+ interface Commands<ReturnType> {
2600
+ splitBlock: {
2601
+ /**
2602
+ * Forks a new node from an existing node.
2603
+ * @param options.keepMarks Keep marks from the previous node.
2604
+ * @example editor.commands.splitBlock()
2605
+ * @example editor.commands.splitBlock({ keepMarks: true })
2606
+ */
2607
+ splitBlock: (options?: {
2608
+ keepMarks?: boolean;
2609
+ }) => ReturnType;
2610
+ };
2611
+ }
2612
+ }
2613
+
2614
+ declare module '@tiptap/core' {
2615
+ interface Commands<ReturnType> {
2616
+ splitListItem: {
2617
+ /**
2618
+ * Splits one list item into two list items.
2619
+ * @param typeOrName The type or name of the node.
2620
+ * @param overrideAttrs The attributes to ensure on the new node.
2621
+ * @example editor.commands.splitListItem('listItem')
2622
+ */
2623
+ splitListItem: (typeOrName: string | NodeType, overrideAttrs?: Record<string, any>) => ReturnType;
2624
+ };
2625
+ }
2626
+ }
2627
+
2628
+ declare module '@tiptap/core' {
2629
+ interface Commands<ReturnType> {
2630
+ toggleList: {
2631
+ /**
2632
+ * Toggle between different list types.
2633
+ * @param listTypeOrName The type or name of the list.
2634
+ * @param itemTypeOrName The type or name of the list item.
2635
+ * @param keepMarks Keep marks when toggling.
2636
+ * @param attributes Attributes for the new list.
2637
+ * @example editor.commands.toggleList('bulletList', 'listItem')
2638
+ */
2639
+ toggleList: (listTypeOrName: string | NodeType, itemTypeOrName: string | NodeType, keepMarks?: boolean, attributes?: Record<string, any>) => ReturnType;
2640
+ };
2641
+ }
2642
+ }
2643
+
2644
+ declare module '@tiptap/core' {
2645
+ interface Commands<ReturnType> {
2646
+ toggleMark: {
2647
+ /**
2648
+ * Toggle a mark on and off.
2649
+ * @param typeOrName The mark type or name.
2650
+ * @param attributes The attributes of the mark.
2651
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
2652
+ * @example editor.commands.toggleMark('bold')
2653
+ */
2654
+ toggleMark: (
2655
+ /**
2656
+ * The mark type or name.
2657
+ */
2658
+ typeOrName: string | MarkType,
2659
+ /**
2660
+ * The attributes of the mark.
2661
+ */
2662
+ attributes?: Record<string, any>, options?: {
2663
+ /**
2664
+ * Removes the mark even across the current selection. Defaults to `false`.
2665
+ */
2666
+ extendEmptyMarkRange?: boolean;
2667
+ }) => ReturnType;
2668
+ };
2669
+ }
2670
+ }
2671
+
2672
+ declare module '@tiptap/core' {
2673
+ interface Commands<ReturnType> {
2674
+ toggleNode: {
2675
+ /**
2676
+ * Toggle a node with another node.
2677
+ * @param typeOrName The type or name of the node.
2678
+ * @param toggleTypeOrName The type or name of the node to toggle.
2679
+ * @param attributes The attributes of the node.
2680
+ * @example editor.commands.toggleNode('heading', 'paragraph')
2681
+ */
2682
+ toggleNode: (typeOrName: string | NodeType, toggleTypeOrName: string | NodeType, attributes?: Record<string, any>) => ReturnType;
2683
+ };
2684
+ }
2685
+ }
2686
+
2687
+ declare module '@tiptap/core' {
2688
+ interface Commands<ReturnType> {
2689
+ toggleWrap: {
2690
+ /**
2691
+ * Wraps nodes in another node, or removes an existing wrap.
2692
+ * @param typeOrName The type or name of the node.
2693
+ * @param attributes The attributes of the node.
2694
+ * @example editor.commands.toggleWrap('blockquote')
2695
+ */
2696
+ toggleWrap: (typeOrName: string | NodeType, attributes?: Record<string, any>) => ReturnType;
2697
+ };
2698
+ }
2699
+ }
2700
+
2701
+ declare module '@tiptap/core' {
2702
+ interface Commands<ReturnType> {
2703
+ undoInputRule: {
2704
+ /**
2705
+ * Undo an input rule.
2706
+ * @example editor.commands.undoInputRule()
2707
+ */
2708
+ undoInputRule: () => ReturnType;
2709
+ };
2710
+ }
2711
+ }
2712
+
2713
+ declare module '@tiptap/core' {
2714
+ interface Commands<ReturnType> {
2715
+ unsetAllMarks: {
2716
+ /**
2717
+ * Remove all marks in the current selection.
2718
+ * @example editor.commands.unsetAllMarks()
2719
+ */
2720
+ unsetAllMarks: () => ReturnType;
2721
+ };
2722
+ }
2723
+ }
2724
+
2725
+ declare module '@tiptap/core' {
2726
+ interface Commands<ReturnType> {
2727
+ unsetMark: {
2728
+ /**
2729
+ * Remove all marks in the current selection.
2730
+ * @param typeOrName The mark type or name.
2731
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
2732
+ * @example editor.commands.unsetMark('bold')
2733
+ */
2734
+ unsetMark: (
2735
+ /**
2736
+ * The mark type or name.
2737
+ */
2738
+ typeOrName: string | MarkType, options?: {
2739
+ /**
2740
+ * Removes the mark even across the current selection. Defaults to `false`.
2741
+ */
2742
+ extendEmptyMarkRange?: boolean;
2743
+ }) => ReturnType;
2744
+ };
2745
+ }
2746
+ }
2747
+
2748
+ declare module '@tiptap/core' {
2749
+ interface Commands<ReturnType> {
2750
+ updateAttributes: {
2751
+ /**
2752
+ * Update attributes of a node or mark.
2753
+ * @param typeOrName The type or name of the node or mark.
2754
+ * @param attributes The attributes of the node or mark.
2755
+ * @example editor.commands.updateAttributes('mention', { userId: "2" })
2756
+ */
2757
+ updateAttributes: (
2758
+ /**
2759
+ * The type or name of the node or mark.
2760
+ */
2761
+ typeOrName: string | NodeType | MarkType,
2762
+ /**
2763
+ * The attributes of the node or mark.
2764
+ */
2765
+ attributes: Record<string, any>) => ReturnType;
2766
+ };
2767
+ }
2768
+ }
2769
+
2770
+ declare module '@tiptap/core' {
2771
+ interface Commands<ReturnType> {
2772
+ wrapIn: {
2773
+ /**
2774
+ * Wraps nodes in another node.
2775
+ * @param typeOrName The type or name of the node.
2776
+ * @param attributes The attributes of the node.
2777
+ * @example editor.commands.wrapIn('blockquote')
2778
+ */
2779
+ wrapIn: (typeOrName: string | NodeType, attributes?: Record<string, any>) => ReturnType;
2780
+ };
2781
+ }
2782
+ }
2783
+
2784
+ declare module '@tiptap/core' {
2785
+ interface Commands<ReturnType> {
2786
+ wrapInList: {
2787
+ /**
2788
+ * Wrap a node in a list.
2789
+ * @param typeOrName The type or name of the node.
2790
+ * @param attributes The attributes of the node.
2791
+ * @example editor.commands.wrapInList('bulletList')
2792
+ */
2793
+ wrapInList: (typeOrName: string | NodeType, attributes?: Record<string, any>) => ReturnType;
2794
+ };
2795
+ }
2796
+ }
2797
+
2798
+ declare const Commands$1: Extension<any, any>;
2799
+
2800
+ declare const Drop: Extension<any, any>;
2801
+
2802
+ declare const Editable: Extension<any, any>;
2803
+
2804
+ declare const FocusEvents: Extension<any, any>;
2805
+
2806
+ declare const Keymap: Extension<any, any>;
2807
+
2808
+ declare const Paste: Extension<any, any>;
2809
+
2810
+ declare const Tabindex: Extension<any, any>;
2811
+
2812
+ declare const index_ClipboardTextSerializer: typeof ClipboardTextSerializer;
2813
+ declare const index_Drop: typeof Drop;
2814
+ declare const index_Editable: typeof Editable;
2815
+ declare const index_FocusEvents: typeof FocusEvents;
2816
+ declare const index_Keymap: typeof Keymap;
2817
+ declare const index_Paste: typeof Paste;
2818
+ declare const index_Tabindex: typeof Tabindex;
2819
+ declare namespace index {
2820
+ 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 };
2821
+ }
2822
+
2823
+ interface TiptapEditorHTMLElement extends HTMLElement {
2824
+ editor?: Editor;
2825
+ }
2826
+ declare class Editor extends EventEmitter<EditorEvents> {
2827
+ private commandManager;
2828
+ extensionManager: ExtensionManager;
2829
+ private css;
2830
+ schema: Schema;
2831
+ view: EditorView;
2832
+ isFocused: boolean;
2833
+ /**
2834
+ * The editor is considered initialized after the `create` event has been emitted.
2835
+ */
2836
+ isInitialized: boolean;
2837
+ extensionStorage: Record<string, any>;
2838
+ /**
2839
+ * A unique ID for this editor instance.
2840
+ */
2841
+ instanceId: string;
2842
+ options: EditorOptions;
2843
+ constructor(options?: Partial<EditorOptions>);
2844
+ /**
2845
+ * Returns the editor storage.
2846
+ */
2847
+ get storage(): Record<string, any>;
2848
+ /**
2849
+ * An object of all registered commands.
2850
+ */
2851
+ get commands(): SingleCommands;
2852
+ /**
2853
+ * Create a command chain to call multiple commands at once.
2854
+ */
2855
+ chain(): ChainedCommands;
2856
+ /**
2857
+ * Check if a command or a command chain can be executed. Without executing it.
2858
+ */
2859
+ can(): CanCommands;
2860
+ /**
2861
+ * Inject CSS styles.
2862
+ */
2863
+ private injectCSS;
2864
+ /**
2865
+ * Update editor options.
2866
+ *
2867
+ * @param options A list of options
2868
+ */
2869
+ setOptions(options?: Partial<EditorOptions>): void;
2870
+ /**
2871
+ * Update editable state of the editor.
2872
+ */
2873
+ setEditable(editable: boolean, emitUpdate?: boolean): void;
2874
+ /**
2875
+ * Returns whether the editor is editable.
2876
+ */
2877
+ get isEditable(): boolean;
2878
+ /**
2879
+ * Returns the editor state.
2880
+ */
2881
+ get state(): EditorState;
2882
+ /**
2883
+ * Register a ProseMirror plugin.
2884
+ *
2885
+ * @param plugin A ProseMirror plugin
2886
+ * @param handlePlugins Control how to merge the plugin into the existing plugins.
2887
+ * @returns The new editor state
2888
+ */
2889
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
2890
+ /**
2891
+ * Unregister a ProseMirror plugin.
2892
+ *
2893
+ * @param nameOrPluginKeyToRemove The plugins name
2894
+ * @returns The new editor state or undefined if the editor is destroyed
2895
+ */
2896
+ unregisterPlugin(nameOrPluginKeyToRemove: string | PluginKey | (string | PluginKey)[]): EditorState | undefined;
2897
+ /**
2898
+ * Creates an extension manager.
2899
+ */
2900
+ private createExtensionManager;
2901
+ /**
2902
+ * Creates an command manager.
2903
+ */
2904
+ private createCommandManager;
2905
+ /**
2906
+ * Creates a ProseMirror schema.
2907
+ */
2908
+ private createSchema;
2909
+ /**
2910
+ * Creates a ProseMirror view.
2911
+ */
2912
+ private createView;
2913
+ /**
2914
+ * Creates all node views.
2915
+ */
2916
+ createNodeViews(): void;
2917
+ /**
2918
+ * Prepend class name to element.
2919
+ */
2920
+ prependClass(): void;
2921
+ isCapturingTransaction: boolean;
2922
+ private capturedTransaction;
2923
+ captureTransaction(fn: Function): Transaction | null;
2924
+ /**
2925
+ * The callback over which to send transactions (state updates) produced by the view.
2926
+ *
2927
+ * @param transaction An editor state transaction
2928
+ */
2929
+ private dispatchTransaction;
2930
+ /**
2931
+ * Get attributes of the currently selected node or mark.
2932
+ */
2933
+ getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
2934
+ /**
2935
+ * Returns if the currently selected node or mark is active.
2936
+ *
2937
+ * @param name Name of the node or mark
2938
+ * @param attributes Attributes of the node or mark
2939
+ */
2940
+ isActive(name: string, attributes?: {}): boolean;
2941
+ isActive(attributes: {}): boolean;
2942
+ /**
2943
+ * Get the document as JSON.
2944
+ */
2945
+ getJSON(): JSONContent;
2946
+ /**
2947
+ * Get the document as HTML.
2948
+ */
2949
+ getHTML(): string;
2950
+ /**
2951
+ * Get the document as text.
2952
+ */
2953
+ getText(options?: {
2954
+ blockSeparator?: string;
2955
+ textSerializers?: Record<string, TextSerializer>;
2956
+ }): string;
2957
+ /**
2958
+ * Check if there is no content.
2959
+ */
2960
+ get isEmpty(): boolean;
2961
+ /**
2962
+ * Get the number of characters for the current document.
2963
+ *
2964
+ * @deprecated
2965
+ */
2966
+ getCharacterCount(): number;
2967
+ /**
2968
+ * Destroy the editor.
2969
+ */
2970
+ destroy(): void;
2971
+ /**
2972
+ * Check if the editor is already destroyed.
2973
+ */
2974
+ get isDestroyed(): boolean;
2975
+ $node(selector: string, attributes?: {
2976
+ [key: string]: any;
2977
+ }): NodePos | null;
2978
+ $nodes(selector: string, attributes?: {
2979
+ [key: string]: any;
2980
+ }): NodePos[] | null;
2981
+ $pos(pos: number): NodePos;
2982
+ get $doc(): NodePos;
2983
+ }
2984
+
2985
+ declare class CommandManager {
2986
+ editor: Editor;
2987
+ rawCommands: AnyCommands;
2988
+ customState?: EditorState;
2989
+ constructor(props: {
2990
+ editor: Editor;
2991
+ state?: EditorState;
2992
+ });
2993
+ get hasCustomState(): boolean;
2994
+ get state(): EditorState;
2995
+ get commands(): SingleCommands;
2996
+ get chain(): () => ChainedCommands;
2997
+ get can(): () => CanCommands;
2998
+ createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
2999
+ createCan(startTr?: Transaction): CanCommands;
3000
+ buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
3001
+ }
3002
+
3003
+ /**
3004
+ * Returns a new `Transform` based on all steps of the passed transactions.
3005
+ * @param oldDoc The Prosemirror node to start from
3006
+ * @param transactions The transactions to combine
3007
+ * @returns A new `Transform` with all steps of the passed transactions
3008
+ */
3009
+ declare function combineTransactionSteps(oldDoc: Node$1, transactions: Transaction[]): Transform;
3010
+
3011
+ /**
3012
+ * Takes a Transaction & Editor State and turns it into a chainable state object
3013
+ * @param config The transaction and state to create the chainable state from
3014
+ * @returns A chainable Editor state object
3015
+ */
3016
+ declare function createChainableState(config: {
3017
+ transaction: Transaction;
3018
+ state: EditorState;
3019
+ }): EditorState;
3020
+
3021
+ /**
3022
+ * Create a new Prosemirror document node from content.
3023
+ * @param content The JSON or HTML content to create the document from
3024
+ * @param schema The Prosemirror schema to use for the document
3025
+ * @param parseOptions Options for the parser
3026
+ * @returns The created Prosemirror document node
3027
+ */
3028
+ declare function createDocument(content: Content | Node$1 | Fragment, schema: Schema, parseOptions?: ParseOptions, options?: {
3029
+ errorOnInvalidContent?: boolean;
3030
+ }): Node$1;
3031
+
3032
+ type CreateNodeFromContentOptions = {
3033
+ slice?: boolean;
3034
+ parseOptions?: ParseOptions;
3035
+ errorOnInvalidContent?: boolean;
3036
+ };
3037
+ /**
3038
+ * Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.
3039
+ * @param content The JSON or HTML content to create the node from
3040
+ * @param schema The Prosemirror schema to use for the node
3041
+ * @param options Options for the parser
3042
+ * @returns The created Prosemirror node or fragment
3043
+ */
3044
+ declare function createNodeFromContent(content: Content | Node$1 | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): Node$1 | Fragment;
3045
+
3046
+ /**
3047
+ * Gets the default block type at a given match
3048
+ * @param match The content match to get the default block type from
3049
+ * @returns The default block type or null
3050
+ */
3051
+ declare function defaultBlockAt(match: ContentMatch): NodeType | null;
3052
+
3053
+ /**
3054
+ * Find children inside a Prosemirror node that match a predicate.
3055
+ * @param node The Prosemirror node to search in
3056
+ * @param predicate The predicate to match
3057
+ * @returns An array of nodes with their positions
3058
+ */
3059
+ declare function findChildren(node: Node$1, predicate: Predicate): NodeWithPos[];
3060
+
3061
+ /**
3062
+ * Same as `findChildren` but searches only within a `range`.
3063
+ * @param node The Prosemirror node to search in
3064
+ * @param range The range to search in
3065
+ * @param predicate The predicate to match
3066
+ * @returns An array of nodes with their positions
3067
+ */
3068
+ declare function findChildrenInRange(node: Node$1, range: Range, predicate: Predicate): NodeWithPos[];
3069
+
3070
+ /**
3071
+ * Finds the closest parent node to the current selection that matches a predicate.
3072
+ * @param predicate The predicate to match
3073
+ * @returns A command that finds the closest parent node to the current selection that matches the predicate
3074
+ * @example ```js
3075
+ * findParentNode(node => node.type.name === 'paragraph')
3076
+ * ```
3077
+ */
3078
+ declare function findParentNode(predicate: Predicate): (selection: Selection) => {
3079
+ pos: number;
3080
+ start: number;
3081
+ depth: number;
3082
+ node: prosemirror_model.Node;
3083
+ } | undefined;
3084
+
3085
+ /**
3086
+ * Finds the closest parent node to a resolved position that matches a predicate.
3087
+ * @param $pos The resolved position to search from
3088
+ * @param predicate The predicate to match
3089
+ * @returns The closest parent node to the resolved position that matches the predicate
3090
+ * @example ```js
3091
+ * findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')
3092
+ * ```
3093
+ */
3094
+ declare function findParentNodeClosestToPos($pos: ResolvedPos, predicate: Predicate): {
3095
+ pos: number;
3096
+ start: number;
3097
+ depth: number;
3098
+ node: Node$1;
3099
+ } | undefined;
3100
+
3101
+ /**
3102
+ * Generate HTML from a JSONContent
3103
+ * @param doc The JSONContent to generate HTML from
3104
+ * @param extensions The extensions to use for the schema
3105
+ * @returns The generated HTML
3106
+ */
3107
+ declare function generateHTML(doc: JSONContent, extensions: Extensions): string;
3108
+
3109
+ /**
3110
+ * Generate JSONContent from HTML
3111
+ * @param html The HTML to generate JSONContent from
3112
+ * @param extensions The extensions to use for the schema
3113
+ * @returns The generated JSONContent
3114
+ */
3115
+ declare function generateJSON(html: string, extensions: Extensions): Record<string, any>;
3116
+
3117
+ /**
3118
+ * Generate raw text from a JSONContent
3119
+ * @param doc The JSONContent to generate text from
3120
+ * @param extensions The extensions to use for the schema
3121
+ * @param options Options for the text generation f.e. blockSeparator or textSerializers
3122
+ * @returns The generated text
3123
+ */
3124
+ declare function generateText(doc: JSONContent, extensions: Extensions, options?: {
3125
+ blockSeparator?: string;
3126
+ textSerializers?: Record<string, TextSerializer>;
3127
+ }): string;
3128
+
3129
+ /**
3130
+ * Get node or mark attributes by type or name on the current editor state
3131
+ * @param state The current editor state
3132
+ * @param typeOrName The node or mark type or name
3133
+ * @returns The attributes of the node or mark or an empty object
3134
+ */
3135
+ declare function getAttributes(state: EditorState, typeOrName: string | NodeType | MarkType): Record<string, any>;
3136
+
3137
+ /**
3138
+ * Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.
3139
+ * @param extensions List of extensions
3140
+ */
3141
+ declare function getAttributesFromExtensions(extensions: Extensions): ExtensionAttribute[];
3142
+
3143
+ type ChangedRange = {
3144
+ oldRange: Range;
3145
+ newRange: Range;
3146
+ };
3147
+ /**
3148
+ * Returns a list of changed ranges
3149
+ * based on the first and last state of all steps.
3150
+ */
3151
+ declare function getChangedRanges(transform: Transform): ChangedRange[];
3152
+
3153
+ interface DebugJSONContent extends JSONContent {
3154
+ from: number;
3155
+ to: number;
3156
+ }
3157
+ declare function getDebugJSON(node: Node$1, startOffset?: number): DebugJSONContent;
3158
+
3159
+ /**
3160
+ * Returns a field from an extension
3161
+ * @param extension The Tiptap extension
3162
+ * @param field The field, for example `renderHTML` or `priority`
3163
+ * @param context The context object that should be passed as `this` into the function
3164
+ * @returns The field value
3165
+ */
3166
+ declare function getExtensionField<T = any>(extension: AnyExtension, field: string, context?: Omit<MaybeThisParameterType<T>, 'parent'>): RemoveThis<T>;
3167
+
3168
+ declare function getHTMLFromFragment(fragment: Fragment, schema: Schema): string;
3169
+
3170
+ declare function getMarkAttributes(state: EditorState, typeOrName: string | MarkType): Record<string, any>;
3171
+
3172
+ /**
3173
+ * Get the range of a mark at a resolved position.
3174
+ */
3175
+ declare function getMarkRange(
3176
+ /**
3177
+ * The position to get the mark range for.
3178
+ */
3179
+ $pos: ResolvedPos,
3180
+ /**
3181
+ * The mark type to get the range for.
3182
+ */
3183
+ type: MarkType,
3184
+ /**
3185
+ * The attributes to match against.
3186
+ * If not provided, only the first mark at the position will be matched.
3187
+ */
3188
+ attributes?: Record<string, any>): Range | void;
3189
+
3190
+ declare function getMarksBetween(from: number, to: number, doc: Node$1): MarkRange[];
3191
+
3192
+ declare function getMarkType(nameOrType: string | MarkType, schema: Schema): MarkType;
3193
+
3194
+ /**
3195
+ * Finds the first node of a given type or name in the current selection.
3196
+ * @param state The editor state.
3197
+ * @param typeOrName The node type or name.
3198
+ * @param pos The position to start searching from.
3199
+ * @param maxDepth The maximum depth to search.
3200
+ * @returns The node and the depth as an array.
3201
+ */
3202
+ declare const getNodeAtPosition: (state: EditorState, typeOrName: string | NodeType, pos: number, maxDepth?: number) => [Node$1 | null, number];
3203
+
3204
+ declare function getNodeAttributes(state: EditorState, typeOrName: string | NodeType): Record<string, any>;
3205
+
3206
+ declare function getNodeType(nameOrType: string | NodeType, schema: Schema): NodeType;
3207
+
3208
+ declare function getRenderedAttributes(nodeOrMark: Node$1 | Mark$1, extensionAttributes: ExtensionAttribute[]): Record<string, any>;
3209
+
3210
+ declare function getSchema(extensions: Extensions, editor?: Editor): Schema;
3211
+
3212
+ /**
3213
+ * Creates a new Prosemirror schema based on the given extensions.
3214
+ * @param extensions An array of Tiptap extensions
3215
+ * @param editor The editor instance
3216
+ * @returns A Prosemirror schema
3217
+ */
3218
+ declare function getSchemaByResolvedExtensions(extensions: Extensions, editor?: Editor): Schema;
3219
+
3220
+ /**
3221
+ * Tries to get a node or mark type by its name.
3222
+ * @param name The name of the node or mark type
3223
+ * @param schema The Prosemiror schema to search in
3224
+ * @returns The node or mark type, or null if it doesn't exist
3225
+ */
3226
+ declare function getSchemaTypeByName(name: string, schema: Schema): NodeType | MarkType | null;
3227
+
3228
+ /**
3229
+ * Get the type of a schema item by its name.
3230
+ * @param name The name of the schema item
3231
+ * @param schema The Prosemiror schema to search in
3232
+ * @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist
3233
+ */
3234
+ declare function getSchemaTypeNameByName(name: string, schema: Schema): 'node' | 'mark' | null;
3235
+
3236
+ /**
3237
+ * Return attributes of an extension that should be splitted by keepOnSplit flag
3238
+ * @param extensionAttributes Array of extension attributes
3239
+ * @param typeName The type of the extension
3240
+ * @param attributes The attributes of the extension
3241
+ * @returns The splitted attributes
3242
+ */
3243
+ declare function getSplittedAttributes(extensionAttributes: ExtensionAttribute[], typeName: string, attributes: Record<string, any>): Record<string, any>;
3244
+
3245
+ /**
3246
+ * Gets the text of a Prosemirror node
3247
+ * @param node The Prosemirror node
3248
+ * @param options Options for the text serializer & block separator
3249
+ * @returns The text of the node
3250
+ * @example ```js
3251
+ * const text = getText(node, { blockSeparator: '\n' })
3252
+ * ```
3253
+ */
3254
+ declare function getText(node: Node$1, options?: {
3255
+ blockSeparator?: string;
3256
+ textSerializers?: Record<string, TextSerializer>;
3257
+ }): string;
3258
+
3259
+ /**
3260
+ * Gets the text between two positions in a Prosemirror node
3261
+ * and serializes it using the given text serializers and block separator (see getText)
3262
+ * @param startNode The Prosemirror node to start from
3263
+ * @param range The range of the text to get
3264
+ * @param options Options for the text serializer & block separator
3265
+ * @returns The text between the two positions
3266
+ */
3267
+ declare function getTextBetween(startNode: Node$1, range: Range, options?: {
3268
+ blockSeparator?: string;
3269
+ textSerializers?: Record<string, TextSerializer>;
3270
+ }): string;
3271
+
3272
+ /**
3273
+ * Returns the text content of a resolved prosemirror position
3274
+ * @param $from The resolved position to get the text content from
3275
+ * @param maxMatch The maximum number of characters to match
3276
+ * @returns The text content
3277
+ */
3278
+ declare const getTextContentFromNodes: ($from: ResolvedPos, maxMatch?: number) => string;
3279
+
3280
+ /**
3281
+ * Find text serializers `toText` in a Prosemirror schema
3282
+ * @param schema The Prosemirror schema to search in
3283
+ * @returns A record of text serializers by node name
3284
+ */
3285
+ declare function getTextSerializersFromSchema(schema: Schema): Record<string, TextSerializer>;
3286
+
3287
+ /**
3288
+ * This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).
3289
+ * Cancels when `getAttrs` returned `false`.
3290
+ * @param parseRule ProseMirror ParseRule
3291
+ * @param extensionAttributes List of attributes to inject
3292
+ */
3293
+ declare function injectExtensionAttributesToParseRule(parseRule: ParseRule, extensionAttributes: ExtensionAttribute[]): ParseRule;
3294
+
3295
+ declare function isActive(state: EditorState, name: string | null, attributes?: Record<string, any>): boolean;
3296
+
3297
+ declare const isAtEndOfNode: (state: EditorState, nodeType?: string) => boolean;
3298
+
3299
+ declare const isAtStartOfNode: (state: EditorState) => boolean;
3300
+
3301
+ declare function isExtensionRulesEnabled(extension: AnyExtension, enabled: EnableRules): boolean;
3302
+
3303
+ declare function isList(name: string, extensions: Extensions): boolean;
3304
+
3305
+ declare function isMarkActive(state: EditorState, typeOrName: MarkType | string | null, attributes?: Record<string, any>): boolean;
3306
+
3307
+ declare function isNodeActive(state: EditorState, typeOrName: NodeType | string | null, attributes?: Record<string, any>): boolean;
3308
+
3309
+ /**
3310
+ * Returns true if the given prosemirror node is empty.
3311
+ */
3312
+ declare function isNodeEmpty(node: Node$1, { checkChildren, ignoreWhitespace, }?: {
3313
+ /**
3314
+ * When true (default), it will also check if all children are empty.
3315
+ */
3316
+ checkChildren?: boolean;
3317
+ /**
3318
+ * When true, it will ignore whitespace when checking for emptiness.
3319
+ */
3320
+ ignoreWhitespace?: boolean;
3321
+ }): boolean;
3322
+
3323
+ declare function isNodeSelection(value: unknown): value is NodeSelection;
3324
+
3325
+ declare function isTextSelection(value: unknown): value is TextSelection;
3326
+
3327
+ declare function posToDOMRect(view: EditorView, from: number, to: number): DOMRect;
3328
+
3329
+ declare function resolveFocusPosition(doc: Node$1, position?: FocusPosition): Selection | null;
3330
+
3331
+ declare function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number): void;
3332
+
3333
+ declare function splitExtensions(extensions: Extensions): {
3334
+ baseExtensions: Extension<any, any>[];
3335
+ nodeExtensions: Node<any, any>[];
3336
+ markExtensions: Mark<any, any>[];
3337
+ };
3338
+
3339
+ /**
3340
+ * Build an input rule that adds a mark when the
3341
+ * matched text is typed into it.
3342
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3343
+ */
3344
+ declare function markInputRule(config: {
3345
+ find: InputRuleFinder;
3346
+ type: MarkType;
3347
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3348
+ }): InputRule;
3349
+
3350
+ /**
3351
+ * Build an input rule that adds a node when the
3352
+ * matched text is typed into it.
3353
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3354
+ */
3355
+ declare function nodeInputRule(config: {
3356
+ /**
3357
+ * The regex to match.
3358
+ */
3359
+ find: InputRuleFinder;
3360
+ /**
3361
+ * The node type to add.
3362
+ */
3363
+ type: NodeType;
3364
+ /**
3365
+ * A function that returns the attributes for the node
3366
+ * can also be an object of attributes
3367
+ */
3368
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3369
+ }): InputRule;
3370
+
3371
+ /**
3372
+ * Build an input rule that changes the type of a textblock when the
3373
+ * matched text is typed into it. When using a regular expresion you’ll
3374
+ * probably want the regexp to start with `^`, so that the pattern can
3375
+ * only occur at the start of a textblock.
3376
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3377
+ */
3378
+ declare function textblockTypeInputRule(config: {
3379
+ find: InputRuleFinder;
3380
+ type: NodeType;
3381
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3382
+ }): InputRule;
3383
+
3384
+ /**
3385
+ * Build an input rule that replaces text when the
3386
+ * matched text is typed into it.
3387
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3388
+ */
3389
+ declare function textInputRule(config: {
3390
+ find: InputRuleFinder;
3391
+ replace: string;
3392
+ }): InputRule;
3393
+
3394
+ /**
3395
+ * Build an input rule for automatically wrapping a textblock when a
3396
+ * given string is typed. When using a regular expresion you’ll
3397
+ * probably want the regexp to start with `^`, so that the pattern can
3398
+ * only occur at the start of a textblock.
3399
+ *
3400
+ * `type` is the type of node to wrap in.
3401
+ *
3402
+ * By default, if there’s a node with the same type above the newly
3403
+ * wrapped node, the rule will try to join those
3404
+ * two nodes. You can pass a join predicate, which takes a regular
3405
+ * expression match and the node before the wrapped node, and can
3406
+ * return a boolean to indicate whether a join should happen.
3407
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3408
+ */
3409
+ declare function wrappingInputRule(config: {
3410
+ find: InputRuleFinder;
3411
+ type: NodeType;
3412
+ keepMarks?: boolean;
3413
+ keepAttributes?: boolean;
3414
+ editor?: Editor;
3415
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3416
+ joinPredicate?: (match: ExtendedRegExpMatchArray, node: Node$1) => boolean;
3417
+ }): InputRule;
3418
+
3419
+ /**
3420
+ * Node views are used to customize the rendered DOM structure of a node.
3421
+ * @see https://tiptap.dev/guide/node-views
3422
+ */
3423
+ declare class NodeView<Component, NodeEditor extends Editor = Editor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> implements NodeView$1 {
3424
+ component: Component;
3425
+ editor: NodeEditor;
3426
+ options: Options;
3427
+ extension: NodeViewRendererProps['extension'];
3428
+ node: NodeViewRendererProps['node'];
3429
+ decorations: NodeViewRendererProps['decorations'];
3430
+ innerDecorations: NodeViewRendererProps['innerDecorations'];
3431
+ view: NodeViewRendererProps['view'];
3432
+ getPos: NodeViewRendererProps['getPos'];
3433
+ HTMLAttributes: NodeViewRendererProps['HTMLAttributes'];
3434
+ isDragging: boolean;
3435
+ constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
3436
+ mount(): void;
3437
+ get dom(): HTMLElement;
3438
+ get contentDOM(): HTMLElement | null;
3439
+ onDragStart(event: DragEvent): void;
3440
+ stopEvent(event: Event): boolean;
3441
+ /**
3442
+ * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.
3443
+ * @return `false` if the editor should re-read the selection or re-parse the range around the mutation
3444
+ * @return `true` if it can safely be ignored.
3445
+ */
3446
+ ignoreMutation(mutation: ViewMutationRecord): boolean;
3447
+ /**
3448
+ * Update the attributes of the prosemirror node.
3449
+ */
3450
+ updateAttributes(attributes: Record<string, any>): void;
3451
+ /**
3452
+ * Delete the node.
3453
+ */
3454
+ deleteNode(): void;
3455
+ }
3456
+
3457
+ /**
3458
+ * Build an paste rule that adds a mark when the
3459
+ * matched text is pasted into it.
3460
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
3461
+ */
3462
+ declare function markPasteRule(config: {
3463
+ find: PasteRuleFinder;
3464
+ type: MarkType;
3465
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray, event: ClipboardEvent) => Record<string, any>) | false | null;
3466
+ }): PasteRule;
3467
+
3468
+ /**
3469
+ * Build an paste rule that adds a node when the
3470
+ * matched text is pasted into it.
3471
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
3472
+ */
3473
+ declare function nodePasteRule(config: {
3474
+ find: PasteRuleFinder;
3475
+ type: NodeType;
3476
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray, event: ClipboardEvent) => Record<string, any>) | false | null;
3477
+ getContent?: JSONContent[] | ((attrs: Record<string, any>) => JSONContent[]) | false | null;
3478
+ }): PasteRule;
3479
+
3480
+ /**
3481
+ * Build an paste rule that replaces text when the
3482
+ * matched text is pasted into it.
3483
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
3484
+ */
3485
+ declare function textPasteRule(config: {
3486
+ find: PasteRuleFinder;
3487
+ replace: string;
3488
+ }): PasteRule;
3489
+
3490
+ interface TrackerResult {
3491
+ position: number;
3492
+ deleted: boolean;
3493
+ }
3494
+ declare class Tracker {
3495
+ transaction: Transaction;
3496
+ currentStep: number;
3497
+ constructor(transaction: Transaction);
3498
+ map(position: number): TrackerResult;
3499
+ }
3500
+
3501
+ /**
3502
+ * Optionally calls `value` as a function.
3503
+ * Otherwise it is returned directly.
3504
+ * @param value Function or any value.
3505
+ * @param context Optional context to bind to function.
3506
+ * @param props Optional props to pass to function.
3507
+ */
3508
+ declare function callOrReturn<T>(value: T, context?: any, ...props: any[]): MaybeReturnType<T>;
3509
+
3510
+ declare function createStyleTag(style: string, nonce?: string, suffix?: string): HTMLStyleElement;
3511
+
3512
+ /**
3513
+ * Remove a property or an array of properties from an object
3514
+ * @param obj Object
3515
+ * @param key Key to remove
3516
+ */
3517
+ declare function deleteProps(obj: Record<string, any>, propOrProps: string | string[]): Record<string, any>;
3518
+
3519
+ declare function elementFromString(value: string): HTMLElement;
3520
+
3521
+ declare function escapeForRegEx(string: string): string;
3522
+
3523
+ declare function findDuplicates(items: any[]): any[];
3524
+
3525
+ declare function fromString(value: any): any;
3526
+
3527
+ declare function isEmptyObject(value?: {}): boolean;
3528
+
3529
+ declare function isFunction(value: any): value is Function;
3530
+
3531
+ declare function isiOS(): boolean;
3532
+
3533
+ declare function isMacOS(): boolean;
3534
+
3535
+ declare function isNumber(value: any): value is number;
3536
+
3537
+ declare function isPlainObject(value: any): value is Record<string, any>;
3538
+
3539
+ declare function isRegExp(value: any): value is RegExp;
3540
+
3541
+ declare function isString(value: any): value is string;
3542
+
3543
+ declare function mergeAttributes(...objects: Record<string, any>[]): Record<string, any>;
3544
+
3545
+ declare function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
3546
+
3547
+ declare function minMax(value?: number, min?: number, max?: number): number;
3548
+
3549
+ /**
3550
+ * Check if object1 includes object2
3551
+ * @param object1 Object
3552
+ * @param object2 Object
3553
+ */
3554
+ declare function objectIncludes(object1: Record<string, any>, object2: Record<string, any>, options?: {
3555
+ strict: boolean;
3556
+ }): boolean;
3557
+
3558
+ /**
3559
+ * Removes duplicated values within an array.
3560
+ * Supports numbers, strings and objects.
3561
+ */
3562
+ declare function removeDuplicates<T>(array: T[], by?: {
3563
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
3564
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
3565
+ }): T[];
3566
+
3567
+ interface Commands<ReturnType = any> {
3568
+ }
3569
+ interface ExtensionConfig<Options = any, Storage = any> {
3570
+ }
3571
+ interface NodeConfig<Options = any, Storage = any> {
3572
+ }
3573
+ interface MarkConfig<Options = any, Storage = any> {
3574
+ }
3575
+
3576
+ 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 DecorationType, type DecorationWithType, type Diff, type Dispatch, 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 MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, 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 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, 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, resolveFocusPosition, selectionToInsertionEnd, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };