@tiptap/extension-highlight 2.5.0-beta.2 → 2.5.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/index.cjs +85 -85
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +84 -84
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.js +85 -85
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/packages/core/src/CommandManager.d.ts +20 -0
  8. package/dist/packages/core/src/Editor.d.ts +161 -0
  9. package/dist/packages/core/src/EventEmitter.d.ts +11 -0
  10. package/dist/packages/core/src/Extension.d.ts +343 -0
  11. package/dist/packages/core/src/ExtensionManager.d.ts +55 -0
  12. package/dist/packages/core/src/InputRule.d.ts +42 -0
  13. package/dist/packages/core/src/Mark.d.ts +451 -0
  14. package/dist/packages/core/src/Node.d.ts +611 -0
  15. package/dist/packages/core/src/NodePos.d.ts +44 -0
  16. package/dist/packages/core/src/NodeView.d.ts +31 -0
  17. package/dist/packages/core/src/PasteRule.d.ts +50 -0
  18. package/dist/packages/core/src/Tracker.d.ts +11 -0
  19. package/dist/packages/core/src/commands/blur.d.ts +13 -0
  20. package/dist/packages/core/src/commands/clearContent.d.ts +14 -0
  21. package/dist/packages/core/src/commands/clearNodes.d.ts +13 -0
  22. package/dist/packages/core/src/commands/command.d.ts +18 -0
  23. package/dist/packages/core/src/commands/createParagraphNear.d.ts +13 -0
  24. package/dist/packages/core/src/commands/cut.d.ts +20 -0
  25. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +13 -0
  26. package/dist/packages/core/src/commands/deleteNode.d.ts +15 -0
  27. package/dist/packages/core/src/commands/deleteRange.d.ts +14 -0
  28. package/dist/packages/core/src/commands/deleteSelection.d.ts +13 -0
  29. package/dist/packages/core/src/commands/enter.d.ts +13 -0
  30. package/dist/packages/core/src/commands/exitCode.d.ts +13 -0
  31. package/dist/packages/core/src/commands/extendMarkRange.d.ts +25 -0
  32. package/dist/packages/core/src/commands/first.d.ts +14 -0
  33. package/dist/packages/core/src/commands/focus.d.ts +27 -0
  34. package/dist/packages/core/src/commands/forEach.d.ts +14 -0
  35. package/dist/packages/core/src/commands/index.d.ts +55 -0
  36. package/dist/packages/core/src/commands/insertContent.d.ts +34 -0
  37. package/dist/packages/core/src/commands/insertContentAt.d.ts +47 -0
  38. package/dist/packages/core/src/commands/join.d.ts +41 -0
  39. package/dist/packages/core/src/commands/joinItemBackward.d.ts +13 -0
  40. package/dist/packages/core/src/commands/joinItemForward.d.ts +13 -0
  41. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +12 -0
  42. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +12 -0
  43. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +14 -0
  44. package/dist/packages/core/src/commands/lift.d.ts +17 -0
  45. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +13 -0
  46. package/dist/packages/core/src/commands/liftListItem.d.ts +15 -0
  47. package/dist/packages/core/src/commands/newlineInCode.d.ts +13 -0
  48. package/dist/packages/core/src/commands/resetAttributes.d.ts +16 -0
  49. package/dist/packages/core/src/commands/scrollIntoView.d.ts +13 -0
  50. package/dist/packages/core/src/commands/selectAll.d.ts +13 -0
  51. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +13 -0
  52. package/dist/packages/core/src/commands/selectNodeForward.d.ts +13 -0
  53. package/dist/packages/core/src/commands/selectParentNode.d.ts +13 -0
  54. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +13 -0
  55. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +13 -0
  56. package/dist/packages/core/src/commands/setContent.d.ts +40 -0
  57. package/dist/packages/core/src/commands/setMark.d.ts +15 -0
  58. package/dist/packages/core/src/commands/setMeta.d.ts +15 -0
  59. package/dist/packages/core/src/commands/setNode.d.ts +16 -0
  60. package/dist/packages/core/src/commands/setNodeSelection.d.ts +14 -0
  61. package/dist/packages/core/src/commands/setTextSelection.d.ts +14 -0
  62. package/dist/packages/core/src/commands/sinkListItem.d.ts +15 -0
  63. package/dist/packages/core/src/commands/splitBlock.d.ts +17 -0
  64. package/dist/packages/core/src/commands/splitListItem.d.ts +15 -0
  65. package/dist/packages/core/src/commands/toggleList.d.ts +18 -0
  66. package/dist/packages/core/src/commands/toggleMark.d.ts +30 -0
  67. package/dist/packages/core/src/commands/toggleNode.d.ts +17 -0
  68. package/dist/packages/core/src/commands/toggleWrap.d.ts +16 -0
  69. package/dist/packages/core/src/commands/undoInputRule.d.ts +13 -0
  70. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +13 -0
  71. package/dist/packages/core/src/commands/unsetMark.d.ts +25 -0
  72. package/dist/packages/core/src/commands/updateAttributes.d.ts +24 -0
  73. package/dist/packages/core/src/commands/wrapIn.d.ts +16 -0
  74. package/dist/packages/core/src/commands/wrapInList.d.ts +16 -0
  75. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +5 -0
  76. package/dist/packages/core/src/extensions/commands.d.ts +3 -0
  77. package/dist/packages/core/src/extensions/editable.d.ts +2 -0
  78. package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
  79. package/dist/packages/core/src/extensions/index.d.ts +6 -0
  80. package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
  81. package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
  82. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +10 -0
  83. package/dist/packages/core/src/helpers/createChainableState.d.ts +10 -0
  84. package/dist/packages/core/src/helpers/createDocument.d.ts +12 -0
  85. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +15 -0
  86. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +7 -0
  87. package/dist/packages/core/src/helpers/findChildren.d.ts +9 -0
  88. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +10 -0
  89. package/dist/packages/core/src/helpers/findParentNode.d.ts +16 -0
  90. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +17 -0
  91. package/dist/packages/core/src/helpers/generateHTML.d.ts +8 -0
  92. package/dist/packages/core/src/helpers/generateJSON.d.ts +8 -0
  93. package/dist/packages/core/src/helpers/generateText.d.ts +12 -0
  94. package/dist/packages/core/src/helpers/getAttributes.d.ts +9 -0
  95. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
  96. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
  97. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
  98. package/dist/packages/core/src/helpers/getExtensionField.d.ts +9 -0
  99. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
  100. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
  101. package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
  102. package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
  103. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
  104. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +11 -0
  105. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
  106. package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
  107. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
  108. package/dist/packages/core/src/helpers/getSchema.d.ts +4 -0
  109. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +10 -0
  110. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +8 -0
  111. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +8 -0
  112. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +9 -0
  113. package/dist/packages/core/src/helpers/getText.d.ts +15 -0
  114. package/dist/packages/core/src/helpers/getTextBetween.d.ts +14 -0
  115. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +8 -0
  116. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +8 -0
  117. package/dist/packages/core/src/helpers/index.d.ts +50 -0
  118. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
  119. package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
  120. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +2 -0
  121. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +2 -0
  122. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
  123. package/dist/packages/core/src/helpers/isList.d.ts +2 -0
  124. package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
  125. package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
  126. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
  127. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
  128. package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
  129. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
  130. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
  131. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
  132. package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
  133. package/dist/packages/core/src/index.d.ts +24 -0
  134. package/dist/packages/core/src/inputRules/index.d.ts +5 -0
  135. package/dist/packages/core/src/inputRules/markInputRule.d.ts +13 -0
  136. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +23 -0
  137. package/dist/packages/core/src/inputRules/textInputRule.d.ts +10 -0
  138. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +15 -0
  139. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +28 -0
  140. package/dist/packages/core/src/pasteRules/index.d.ts +3 -0
  141. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +13 -0
  142. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +13 -0
  143. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +10 -0
  144. package/dist/packages/core/src/style.d.ts +1 -0
  145. package/dist/packages/core/src/types.d.ts +250 -0
  146. package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
  147. package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
  148. package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
  149. package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
  150. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -0
  151. package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
  152. package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
  153. package/dist/packages/core/src/utilities/index.d.ts +20 -0
  154. package/dist/packages/core/src/utilities/isAndroid.d.ts +1 -0
  155. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
  156. package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
  157. package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
  158. package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
  159. package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
  160. package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
  161. package/dist/packages/core/src/utilities/isString.d.ts +1 -0
  162. package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
  163. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
  164. package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
  165. package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
  166. package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
  167. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
  168. package/dist/packages/extension-highlight/src/highlight.d.ts +55 -55
  169. package/dist/packages/extension-highlight/src/index.d.ts +3 -3
  170. package/package.json +2 -2
@@ -0,0 +1,451 @@
1
+ import { DOMOutputSpec, Mark as ProseMirrorMark, MarkSpec, MarkType } from '@tiptap/pm/model';
2
+ import { Plugin, Transaction } from '@tiptap/pm/state';
3
+ import { Editor } from './Editor.js';
4
+ import { MarkConfig } from './index.js';
5
+ import { InputRule } from './InputRule.js';
6
+ import { Node } from './Node.js';
7
+ import { PasteRule } from './PasteRule.js';
8
+ import { Attributes, Extensions, GlobalAttributes, KeyboardShortcutCommand, ParentConfig, RawCommands } from './types.js';
9
+ declare module '@tiptap/core' {
10
+ interface MarkConfig<Options = any, Storage = any> {
11
+ [key: string]: any;
12
+ /**
13
+ * The extension name - this must be unique.
14
+ * It will be used to identify the extension.
15
+ *
16
+ * @example 'myExtension'
17
+ */
18
+ name: string;
19
+ /**
20
+ * The priority of your extension. The higher, the later it will be called
21
+ * and will take precedence over other extensions with a lower priority.
22
+ * @default 1000
23
+ * @example 1001
24
+ */
25
+ priority?: number;
26
+ /**
27
+ * The default options for this extension.
28
+ * @example
29
+ * defaultOptions: {
30
+ * myOption: 'foo',
31
+ * myOtherOption: 10,
32
+ * }
33
+ */
34
+ defaultOptions?: Options;
35
+ /**
36
+ * This method will add options to this extension
37
+ * @see https://tiptap.dev/guide/custom-extensions#settings
38
+ * @example
39
+ * addOptions() {
40
+ * return {
41
+ * myOption: 'foo',
42
+ * myOtherOption: 10,
43
+ * }
44
+ */
45
+ addOptions?: (this: {
46
+ name: string;
47
+ parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>;
48
+ }) => Options;
49
+ /**
50
+ * The default storage this extension can save data to.
51
+ * @see https://tiptap.dev/guide/custom-extensions#storage
52
+ * @example
53
+ * defaultStorage: {
54
+ * prefetchedUsers: [],
55
+ * loading: false,
56
+ * }
57
+ */
58
+ addStorage?: (this: {
59
+ name: string;
60
+ options: Options;
61
+ parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>;
62
+ }) => Storage;
63
+ /**
64
+ * This function adds globalAttributes to specific nodes.
65
+ * @see https://tiptap.dev/guide/custom-extensions#global-attributes
66
+ * @example
67
+ * addGlobalAttributes() {
68
+ * return [
69
+ * {
70
+ // Extend the following extensions
71
+ * types: [
72
+ * 'heading',
73
+ * 'paragraph',
74
+ * ],
75
+ * // … with those attributes
76
+ * attributes: {
77
+ * textAlign: {
78
+ * default: 'left',
79
+ * renderHTML: attributes => ({
80
+ * style: `text-align: ${attributes.textAlign}`,
81
+ * }),
82
+ * parseHTML: element => element.style.textAlign || 'left',
83
+ * },
84
+ * },
85
+ * },
86
+ * ]
87
+ * }
88
+ */
89
+ addGlobalAttributes?: (this: {
90
+ name: string;
91
+ options: Options;
92
+ storage: Storage;
93
+ extensions: (Node | Mark)[];
94
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'];
95
+ }) => GlobalAttributes;
96
+ /**
97
+ * This function adds commands to the editor
98
+ * @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
99
+ * @example
100
+ * addCommands() {
101
+ * return {
102
+ * myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
103
+ * }
104
+ * }
105
+ */
106
+ addCommands?: (this: {
107
+ name: string;
108
+ options: Options;
109
+ storage: Storage;
110
+ editor: Editor;
111
+ type: MarkType;
112
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addCommands'];
113
+ }) => Partial<RawCommands>;
114
+ /**
115
+ * This function registers keyboard shortcuts.
116
+ * @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
117
+ * @example
118
+ * addKeyboardShortcuts() {
119
+ * return {
120
+ * 'Mod-l': () => this.editor.commands.toggleBulletList(),
121
+ * }
122
+ * },
123
+ */
124
+ addKeyboardShortcuts?: (this: {
125
+ name: string;
126
+ options: Options;
127
+ storage: Storage;
128
+ editor: Editor;
129
+ type: MarkType;
130
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addKeyboardShortcuts'];
131
+ }) => {
132
+ [key: string]: KeyboardShortcutCommand;
133
+ };
134
+ /**
135
+ * This function adds input rules to the editor.
136
+ * @see https://tiptap.dev/guide/custom-extensions#input-rules
137
+ * @example
138
+ * addInputRules() {
139
+ * return [
140
+ * markInputRule({
141
+ * find: inputRegex,
142
+ * type: this.type,
143
+ * }),
144
+ * ]
145
+ * },
146
+ */
147
+ addInputRules?: (this: {
148
+ name: string;
149
+ options: Options;
150
+ storage: Storage;
151
+ editor: Editor;
152
+ type: MarkType;
153
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addInputRules'];
154
+ }) => InputRule[];
155
+ /**
156
+ * This function adds paste rules to the editor.
157
+ * @see https://tiptap.dev/guide/custom-extensions#paste-rules
158
+ * @example
159
+ * addPasteRules() {
160
+ * return [
161
+ * markPasteRule({
162
+ * find: pasteRegex,
163
+ * type: this.type,
164
+ * }),
165
+ * ]
166
+ * },
167
+ */
168
+ addPasteRules?: (this: {
169
+ name: string;
170
+ options: Options;
171
+ storage: Storage;
172
+ editor: Editor;
173
+ type: MarkType;
174
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addPasteRules'];
175
+ }) => PasteRule[];
176
+ /**
177
+ * This function adds Prosemirror plugins to the editor
178
+ * @see https://tiptap.dev/guide/custom-extensions#prosemirror-plugins
179
+ * @example
180
+ * addProseMirrorPlugins() {
181
+ * return [
182
+ * customPlugin(),
183
+ * ]
184
+ * }
185
+ */
186
+ addProseMirrorPlugins?: (this: {
187
+ name: string;
188
+ options: Options;
189
+ storage: Storage;
190
+ editor: Editor;
191
+ type: MarkType;
192
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addProseMirrorPlugins'];
193
+ }) => Plugin[];
194
+ /**
195
+ * This function adds additional extensions to the editor. This is useful for
196
+ * building extension kits.
197
+ * @example
198
+ * addExtensions() {
199
+ * return [
200
+ * BulletList,
201
+ * OrderedList,
202
+ * ListItem
203
+ * ]
204
+ * }
205
+ */
206
+ addExtensions?: (this: {
207
+ name: string;
208
+ options: Options;
209
+ storage: Storage;
210
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addExtensions'];
211
+ }) => Extensions;
212
+ /**
213
+ * This function extends the schema of the node.
214
+ * @example
215
+ * extendNodeSchema() {
216
+ * return {
217
+ * group: 'inline',
218
+ * selectable: false,
219
+ * }
220
+ * }
221
+ */
222
+ extendNodeSchema?: ((this: {
223
+ name: string;
224
+ options: Options;
225
+ storage: Storage;
226
+ parent: ParentConfig<MarkConfig<Options, Storage>>['extendNodeSchema'];
227
+ }, extension: Node) => Record<string, any>) | null;
228
+ /**
229
+ * This function extends the schema of the mark.
230
+ * @example
231
+ * extendMarkSchema() {
232
+ * return {
233
+ * group: 'inline',
234
+ * selectable: false,
235
+ * }
236
+ * }
237
+ */
238
+ extendMarkSchema?: ((this: {
239
+ name: string;
240
+ options: Options;
241
+ storage: Storage;
242
+ parent: ParentConfig<MarkConfig<Options, Storage>>['extendMarkSchema'];
243
+ }, extension: Mark) => Record<string, any>) | null;
244
+ /**
245
+ * The editor is not ready yet.
246
+ */
247
+ onBeforeCreate?: ((this: {
248
+ name: string;
249
+ options: Options;
250
+ storage: Storage;
251
+ editor: Editor;
252
+ type: MarkType;
253
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onBeforeCreate'];
254
+ }) => void) | null;
255
+ /**
256
+ * The editor is ready.
257
+ */
258
+ onCreate?: ((this: {
259
+ name: string;
260
+ options: Options;
261
+ storage: Storage;
262
+ editor: Editor;
263
+ type: MarkType;
264
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onCreate'];
265
+ }) => void) | null;
266
+ /**
267
+ * The content has changed.
268
+ */
269
+ onUpdate?: ((this: {
270
+ name: string;
271
+ options: Options;
272
+ storage: Storage;
273
+ editor: Editor;
274
+ type: MarkType;
275
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onUpdate'];
276
+ }) => void) | null;
277
+ /**
278
+ * The selection has changed.
279
+ */
280
+ onSelectionUpdate?: ((this: {
281
+ name: string;
282
+ options: Options;
283
+ storage: Storage;
284
+ editor: Editor;
285
+ type: MarkType;
286
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onSelectionUpdate'];
287
+ }) => void) | null;
288
+ /**
289
+ * The editor state has changed.
290
+ */
291
+ onTransaction?: ((this: {
292
+ name: string;
293
+ options: Options;
294
+ storage: Storage;
295
+ editor: Editor;
296
+ type: MarkType;
297
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onTransaction'];
298
+ }, props: {
299
+ transaction: Transaction;
300
+ }) => void) | null;
301
+ /**
302
+ * The editor is focused.
303
+ */
304
+ onFocus?: ((this: {
305
+ name: string;
306
+ options: Options;
307
+ storage: Storage;
308
+ editor: Editor;
309
+ type: MarkType;
310
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
311
+ }, props: {
312
+ event: FocusEvent;
313
+ }) => void) | null;
314
+ /**
315
+ * The editor isn’t focused anymore.
316
+ */
317
+ onBlur?: ((this: {
318
+ name: string;
319
+ options: Options;
320
+ storage: Storage;
321
+ editor: Editor;
322
+ type: MarkType;
323
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
324
+ }, props: {
325
+ event: FocusEvent;
326
+ }) => void) | null;
327
+ /**
328
+ * The editor is destroyed.
329
+ */
330
+ onDestroy?: ((this: {
331
+ name: string;
332
+ options: Options;
333
+ storage: Storage;
334
+ editor: Editor;
335
+ type: MarkType;
336
+ parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
337
+ }) => void) | null;
338
+ /**
339
+ * Keep mark after split node
340
+ */
341
+ keepOnSplit?: boolean | (() => boolean);
342
+ /**
343
+ * Inclusive
344
+ */
345
+ inclusive?: MarkSpec['inclusive'] | ((this: {
346
+ name: string;
347
+ options: Options;
348
+ storage: Storage;
349
+ parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
350
+ editor?: Editor;
351
+ }) => MarkSpec['inclusive']);
352
+ /**
353
+ * Excludes
354
+ */
355
+ excludes?: MarkSpec['excludes'] | ((this: {
356
+ name: string;
357
+ options: Options;
358
+ storage: Storage;
359
+ parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
360
+ editor?: Editor;
361
+ }) => MarkSpec['excludes']);
362
+ /**
363
+ * Marks this Mark as exitable
364
+ */
365
+ exitable?: boolean | (() => boolean);
366
+ /**
367
+ * Group
368
+ */
369
+ group?: MarkSpec['group'] | ((this: {
370
+ name: string;
371
+ options: Options;
372
+ storage: Storage;
373
+ parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
374
+ editor?: Editor;
375
+ }) => MarkSpec['group']);
376
+ /**
377
+ * Spanning
378
+ */
379
+ spanning?: MarkSpec['spanning'] | ((this: {
380
+ name: string;
381
+ options: Options;
382
+ storage: Storage;
383
+ parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
384
+ editor?: Editor;
385
+ }) => MarkSpec['spanning']);
386
+ /**
387
+ * Code
388
+ */
389
+ code?: boolean | ((this: {
390
+ name: string;
391
+ options: Options;
392
+ storage: Storage;
393
+ parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
394
+ editor?: Editor;
395
+ }) => boolean);
396
+ /**
397
+ * Parse HTML
398
+ */
399
+ parseHTML?: (this: {
400
+ name: string;
401
+ options: Options;
402
+ storage: Storage;
403
+ parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
404
+ editor?: Editor;
405
+ }) => MarkSpec['parseDOM'];
406
+ /**
407
+ * Render HTML
408
+ */
409
+ renderHTML?: ((this: {
410
+ name: string;
411
+ options: Options;
412
+ storage: Storage;
413
+ parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
414
+ editor?: Editor;
415
+ }, props: {
416
+ mark: ProseMirrorMark;
417
+ HTMLAttributes: Record<string, any>;
418
+ }) => DOMOutputSpec) | null;
419
+ /**
420
+ * Attributes
421
+ */
422
+ addAttributes?: (this: {
423
+ name: string;
424
+ options: Options;
425
+ storage: Storage;
426
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
427
+ editor?: Editor;
428
+ }) => Attributes | {};
429
+ }
430
+ }
431
+ /**
432
+ * The Mark class is used to create custom mark extensions.
433
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
434
+ */
435
+ export declare class Mark<Options = any, Storage = any> {
436
+ type: string;
437
+ name: string;
438
+ parent: Mark | null;
439
+ child: Mark | null;
440
+ options: Options;
441
+ storage: Storage;
442
+ config: MarkConfig;
443
+ constructor(config?: Partial<MarkConfig<Options, Storage>>);
444
+ static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
445
+ configure(options?: Partial<Options>): Mark<any, any>;
446
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
447
+ static handleExit({ editor, mark }: {
448
+ editor: Editor;
449
+ mark: Mark;
450
+ }): boolean;
451
+ }