@tiptap/extension-highlight 2.6.2 → 3.0.0-next.1

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 (171) hide show
  1. package/dist/index.cjs +110 -91
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/{packages/extension-highlight/src/highlight.d.ts → index.d.cts} +7 -4
  4. package/dist/index.d.ts +58 -0
  5. package/dist/index.js +88 -86
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -8
  8. package/dist/index.umd.js +0 -101
  9. package/dist/index.umd.js.map +0 -1
  10. package/dist/packages/core/src/CommandManager.d.ts +0 -20
  11. package/dist/packages/core/src/Editor.d.ts +0 -163
  12. package/dist/packages/core/src/EventEmitter.d.ts +0 -11
  13. package/dist/packages/core/src/Extension.d.ts +0 -344
  14. package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
  15. package/dist/packages/core/src/InputRule.d.ts +0 -42
  16. package/dist/packages/core/src/Mark.d.ts +0 -452
  17. package/dist/packages/core/src/Node.d.ts +0 -612
  18. package/dist/packages/core/src/NodePos.d.ts +0 -44
  19. package/dist/packages/core/src/NodeView.d.ts +0 -31
  20. package/dist/packages/core/src/PasteRule.d.ts +0 -50
  21. package/dist/packages/core/src/Tracker.d.ts +0 -11
  22. package/dist/packages/core/src/commands/blur.d.ts +0 -13
  23. package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
  24. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
  25. package/dist/packages/core/src/commands/command.d.ts +0 -18
  26. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
  27. package/dist/packages/core/src/commands/cut.d.ts +0 -20
  28. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
  29. package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
  30. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
  31. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
  32. package/dist/packages/core/src/commands/enter.d.ts +0 -13
  33. package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
  34. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
  35. package/dist/packages/core/src/commands/first.d.ts +0 -14
  36. package/dist/packages/core/src/commands/focus.d.ts +0 -27
  37. package/dist/packages/core/src/commands/forEach.d.ts +0 -14
  38. package/dist/packages/core/src/commands/index.d.ts +0 -55
  39. package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
  40. package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
  41. package/dist/packages/core/src/commands/join.d.ts +0 -41
  42. package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
  43. package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
  44. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
  45. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
  46. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
  47. package/dist/packages/core/src/commands/lift.d.ts +0 -17
  48. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
  49. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
  50. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
  51. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
  52. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
  53. package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
  54. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
  55. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
  56. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
  57. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
  58. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
  59. package/dist/packages/core/src/commands/setContent.d.ts +0 -40
  60. package/dist/packages/core/src/commands/setMark.d.ts +0 -15
  61. package/dist/packages/core/src/commands/setMeta.d.ts +0 -16
  62. package/dist/packages/core/src/commands/setNode.d.ts +0 -16
  63. package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
  64. package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
  65. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
  66. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
  67. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -16
  68. package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
  69. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
  70. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
  71. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
  72. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
  73. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
  74. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
  75. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
  76. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
  77. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
  78. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
  79. package/dist/packages/core/src/extensions/commands.d.ts +0 -3
  80. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  81. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  82. package/dist/packages/core/src/extensions/index.d.ts +0 -6
  83. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  84. package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
  85. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
  86. package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
  87. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
  88. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
  89. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
  90. package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
  91. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
  92. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
  93. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
  94. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
  95. package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
  96. package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
  97. package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
  98. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  99. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
  100. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
  101. package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
  102. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  103. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
  104. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  105. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  106. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  107. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
  108. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
  109. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  110. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  111. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
  112. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
  113. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
  114. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
  115. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
  116. package/dist/packages/core/src/helpers/getText.d.ts +0 -15
  117. package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
  118. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
  119. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
  120. package/dist/packages/core/src/helpers/index.d.ts +0 -50
  121. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  122. package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
  123. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
  124. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
  125. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
  126. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  127. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
  128. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
  129. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -14
  130. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  131. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  132. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
  133. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
  134. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  135. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  136. package/dist/packages/core/src/index.d.ts +0 -24
  137. package/dist/packages/core/src/inputRules/index.d.ts +0 -5
  138. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
  139. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
  140. package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
  141. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
  142. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
  143. package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
  144. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
  145. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -14
  146. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
  147. package/dist/packages/core/src/style.d.ts +0 -1
  148. package/dist/packages/core/src/types.d.ts +0 -253
  149. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
  150. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  151. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
  152. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  153. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
  154. package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
  155. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  156. package/dist/packages/core/src/utilities/index.d.ts +0 -20
  157. package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
  158. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  159. package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
  160. package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
  161. package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
  162. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  163. package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
  164. package/dist/packages/core/src/utilities/isString.d.ts +0 -1
  165. package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
  166. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
  167. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
  168. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  169. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
  170. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
  171. package/dist/packages/extension-highlight/src/index.d.ts +0 -3
@@ -1,55 +0,0 @@
1
- import { Schema } from '@tiptap/pm/model';
2
- import { Plugin } from '@tiptap/pm/state';
3
- import type { Editor } from './Editor.js';
4
- import { Extensions, RawCommands } from './types.js';
5
- export declare class ExtensionManager {
6
- editor: Editor;
7
- schema: Schema;
8
- extensions: Extensions;
9
- splittableMarks: string[];
10
- constructor(extensions: Extensions, editor: Editor);
11
- /**
12
- * Returns a flattened and sorted extension list while
13
- * also checking for duplicated extensions and warns the user.
14
- * @param extensions An array of Tiptap extensions
15
- * @returns An flattened and sorted array of Tiptap extensions
16
- */
17
- static resolve(extensions: Extensions): Extensions;
18
- /**
19
- * Create a flattened array of extensions by traversing the `addExtensions` field.
20
- * @param extensions An array of Tiptap extensions
21
- * @returns A flattened array of Tiptap extensions
22
- */
23
- static flatten(extensions: Extensions): Extensions;
24
- /**
25
- * Sort extensions by priority.
26
- * @param extensions An array of Tiptap extensions
27
- * @returns A sorted array of Tiptap extensions by priority
28
- */
29
- static sort(extensions: Extensions): Extensions;
30
- /**
31
- * Get all commands from the extensions.
32
- * @returns An object with all commands where the key is the command name and the value is the command function
33
- */
34
- get commands(): RawCommands;
35
- /**
36
- * Get all registered Prosemirror plugins from the extensions.
37
- * @returns An array of Prosemirror plugins
38
- */
39
- get plugins(): Plugin[];
40
- /**
41
- * Get all attributes from the extensions.
42
- * @returns An array of attributes
43
- */
44
- get attributes(): import("@tiptap/core").ExtensionAttribute[];
45
- /**
46
- * Get all node views from the extensions.
47
- * @returns An object with all node views where the key is the node name and the value is the node view function
48
- */
49
- get nodeViews(): any;
50
- /**
51
- * Go through all extensions, create extension storages & setup marks
52
- * & bind editor event listener.
53
- */
54
- private setupExtensions;
55
- }
@@ -1,42 +0,0 @@
1
- import { EditorState, Plugin } from '@tiptap/pm/state';
2
- import { Editor } from './Editor.js';
3
- import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js';
4
- export type InputRuleMatch = {
5
- index: number;
6
- text: string;
7
- replaceWith?: string;
8
- match?: RegExpMatchArray;
9
- data?: Record<string, any>;
10
- };
11
- export type InputRuleFinder = RegExp | ((text: string) => InputRuleMatch | null);
12
- export declare class InputRule {
13
- find: InputRuleFinder;
14
- handler: (props: {
15
- state: EditorState;
16
- range: Range;
17
- match: ExtendedRegExpMatchArray;
18
- commands: SingleCommands;
19
- chain: () => ChainedCommands;
20
- can: () => CanCommands;
21
- }) => void | null;
22
- constructor(config: {
23
- find: InputRuleFinder;
24
- handler: (props: {
25
- state: EditorState;
26
- range: Range;
27
- match: ExtendedRegExpMatchArray;
28
- commands: SingleCommands;
29
- chain: () => ChainedCommands;
30
- can: () => CanCommands;
31
- }) => void | null;
32
- });
33
- }
34
- /**
35
- * Create an input rules plugin. When enabled, it will cause text
36
- * input that matches any of the given rules to trigger the rule’s
37
- * action.
38
- */
39
- export declare function inputRulesPlugin(props: {
40
- editor: Editor;
41
- rules: InputRule[];
42
- }): Plugin;
@@ -1,452 +0,0 @@
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 earlier it will be called
21
- * and will take precedence over other extensions with a lower priority.
22
- * @default 100
23
- * @example 101
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
- editor: Editor;
300
- transaction: Transaction;
301
- }) => void) | null;
302
- /**
303
- * The editor is focused.
304
- */
305
- onFocus?: ((this: {
306
- name: string;
307
- options: Options;
308
- storage: Storage;
309
- editor: Editor;
310
- type: MarkType;
311
- parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
312
- }, props: {
313
- event: FocusEvent;
314
- }) => void) | null;
315
- /**
316
- * The editor isn’t focused anymore.
317
- */
318
- onBlur?: ((this: {
319
- name: string;
320
- options: Options;
321
- storage: Storage;
322
- editor: Editor;
323
- type: MarkType;
324
- parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
325
- }, props: {
326
- event: FocusEvent;
327
- }) => void) | null;
328
- /**
329
- * The editor is destroyed.
330
- */
331
- onDestroy?: ((this: {
332
- name: string;
333
- options: Options;
334
- storage: Storage;
335
- editor: Editor;
336
- type: MarkType;
337
- parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
338
- }) => void) | null;
339
- /**
340
- * Keep mark after split node
341
- */
342
- keepOnSplit?: boolean | (() => boolean);
343
- /**
344
- * Inclusive
345
- */
346
- inclusive?: MarkSpec['inclusive'] | ((this: {
347
- name: string;
348
- options: Options;
349
- storage: Storage;
350
- parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
351
- editor?: Editor;
352
- }) => MarkSpec['inclusive']);
353
- /**
354
- * Excludes
355
- */
356
- excludes?: MarkSpec['excludes'] | ((this: {
357
- name: string;
358
- options: Options;
359
- storage: Storage;
360
- parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
361
- editor?: Editor;
362
- }) => MarkSpec['excludes']);
363
- /**
364
- * Marks this Mark as exitable
365
- */
366
- exitable?: boolean | (() => boolean);
367
- /**
368
- * Group
369
- */
370
- group?: MarkSpec['group'] | ((this: {
371
- name: string;
372
- options: Options;
373
- storage: Storage;
374
- parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
375
- editor?: Editor;
376
- }) => MarkSpec['group']);
377
- /**
378
- * Spanning
379
- */
380
- spanning?: MarkSpec['spanning'] | ((this: {
381
- name: string;
382
- options: Options;
383
- storage: Storage;
384
- parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
385
- editor?: Editor;
386
- }) => MarkSpec['spanning']);
387
- /**
388
- * Code
389
- */
390
- code?: boolean | ((this: {
391
- name: string;
392
- options: Options;
393
- storage: Storage;
394
- parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
395
- editor?: Editor;
396
- }) => boolean);
397
- /**
398
- * Parse HTML
399
- */
400
- parseHTML?: (this: {
401
- name: string;
402
- options: Options;
403
- storage: Storage;
404
- parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
405
- editor?: Editor;
406
- }) => MarkSpec['parseDOM'];
407
- /**
408
- * Render HTML
409
- */
410
- renderHTML?: ((this: {
411
- name: string;
412
- options: Options;
413
- storage: Storage;
414
- parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
415
- editor?: Editor;
416
- }, props: {
417
- mark: ProseMirrorMark;
418
- HTMLAttributes: Record<string, any>;
419
- }) => DOMOutputSpec) | null;
420
- /**
421
- * Attributes
422
- */
423
- addAttributes?: (this: {
424
- name: string;
425
- options: Options;
426
- storage: Storage;
427
- parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
428
- editor?: Editor;
429
- }) => Attributes | {};
430
- }
431
- }
432
- /**
433
- * The Mark class is used to create custom mark extensions.
434
- * @see https://tiptap.dev/api/extensions#create-a-new-extension
435
- */
436
- export declare class Mark<Options = any, Storage = any> {
437
- type: string;
438
- name: string;
439
- parent: Mark | null;
440
- child: Mark | null;
441
- options: Options;
442
- storage: Storage;
443
- config: MarkConfig;
444
- constructor(config?: Partial<MarkConfig<Options, Storage>>);
445
- static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
446
- configure(options?: Partial<Options>): Mark<Options, Storage>;
447
- extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
448
- static handleExit({ editor, mark }: {
449
- editor: Editor;
450
- mark: Mark;
451
- }): boolean;
452
- }