@tiptap/core 2.0.0-beta.209 → 2.0.0-beta.210

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 (259) hide show
  1. package/dist/index.cjs +4311 -0
  2. package/dist/index.d.ts +2330 -0
  3. package/dist/index.js +4311 -0
  4. package/package.json +24 -23
  5. package/src/CommandManager.ts +27 -36
  6. package/src/Editor.ts +27 -37
  7. package/src/Extension.ts +193 -179
  8. package/src/ExtensionManager.ts +82 -98
  9. package/src/InputRule.ts +38 -43
  10. package/src/Mark.ts +277 -264
  11. package/src/Node.ts +349 -314
  12. package/src/NodeView.ts +24 -23
  13. package/src/PasteRule.ts +37 -44
  14. package/src/Tracker.ts +4 -8
  15. package/src/commands/clearNodes.ts +1 -1
  16. package/src/commands/createParagraphNear.ts +2 -2
  17. package/src/commands/deleteNode.ts +1 -1
  18. package/src/commands/deleteSelection.ts +2 -2
  19. package/src/commands/exitCode.ts +2 -2
  20. package/src/commands/extendMarkRange.ts +6 -3
  21. package/src/commands/insertContent.ts +9 -5
  22. package/src/commands/insertContentAt.ts +10 -24
  23. package/src/commands/join.ts +9 -6
  24. package/src/commands/lift.ts +3 -3
  25. package/src/commands/liftEmptyBlock.ts +1 -1
  26. package/src/commands/liftListItem.ts +3 -3
  27. package/src/commands/newlineInCode.ts +2 -2
  28. package/src/commands/resetAttributes.ts +11 -6
  29. package/src/commands/selectNodeBackward.ts +2 -2
  30. package/src/commands/selectNodeForward.ts +2 -2
  31. package/src/commands/selectParentNode.ts +2 -2
  32. package/src/commands/selectTextblockEnd.ts +2 -2
  33. package/src/commands/selectTextblockStart.ts +2 -2
  34. package/src/commands/setContent.ts +3 -4
  35. package/src/commands/setMark.ts +26 -16
  36. package/src/commands/setNode.ts +19 -17
  37. package/src/commands/setNodeSelection.ts +2 -2
  38. package/src/commands/setTextSelection.ts +3 -5
  39. package/src/commands/sinkListItem.ts +3 -3
  40. package/src/commands/splitBlock.ts +20 -25
  41. package/src/commands/splitListItem.ts +15 -25
  42. package/src/commands/toggleList.ts +27 -24
  43. package/src/commands/toggleMark.ts +3 -3
  44. package/src/commands/toggleNode.ts +6 -2
  45. package/src/commands/toggleWrap.ts +2 -2
  46. package/src/commands/unsetMark.ts +3 -3
  47. package/src/commands/updateAttributes.ts +14 -9
  48. package/src/commands/wrapIn.ts +3 -3
  49. package/src/commands/wrapInList.ts +3 -3
  50. package/src/extensions/clipboardTextSerializer.ts +1 -1
  51. package/src/extensions/editable.ts +1 -1
  52. package/src/extensions/focusEvents.ts +1 -1
  53. package/src/extensions/keymap.ts +2 -7
  54. package/src/extensions/tabindex.ts +1 -1
  55. package/src/helpers/combineTransactionSteps.ts +7 -4
  56. package/src/helpers/createChainableState.ts +3 -3
  57. package/src/helpers/createDocument.ts +1 -1
  58. package/src/helpers/createNodeFromContent.ts +4 -10
  59. package/src/helpers/defaultBlockAt.ts +1 -1
  60. package/src/helpers/findChildren.ts +1 -1
  61. package/src/helpers/findChildrenInRange.ts +6 -2
  62. package/src/helpers/findParentNode.ts +1 -1
  63. package/src/helpers/findParentNodeClosestToPos.ts +12 -7
  64. package/src/helpers/generateHTML.ts +1 -1
  65. package/src/helpers/generateJSON.ts +2 -4
  66. package/src/helpers/generateText.ts +4 -7
  67. package/src/helpers/getAttributes.ts +3 -5
  68. package/src/helpers/getChangedRanges.ts +1 -1
  69. package/src/helpers/getDebugJSON.ts +4 -4
  70. package/src/helpers/getHTMLFromFragment.ts +2 -4
  71. package/src/helpers/getMarkAttributes.ts +6 -3
  72. package/src/helpers/getMarkRange.ts +1 -1
  73. package/src/helpers/getMarkType.ts +4 -2
  74. package/src/helpers/getMarksBetween.ts +8 -6
  75. package/src/helpers/getNodeAttributes.ts +7 -6
  76. package/src/helpers/getNodeType.ts +4 -2
  77. package/src/helpers/getRenderedAttributes.ts +5 -2
  78. package/src/helpers/getSchema.ts +1 -1
  79. package/src/helpers/getSchemaByResolvedExtensions.ts +151 -107
  80. package/src/helpers/getSchemaTypeByName.ts +1 -1
  81. package/src/helpers/getSchemaTypeNameByName.ts +1 -1
  82. package/src/helpers/getText.ts +3 -3
  83. package/src/helpers/getTextBetween.ts +4 -7
  84. package/src/helpers/getTextContentFromNodes.ts +8 -3
  85. package/src/helpers/getTextSerializersFromSchema.ts +6 -5
  86. package/src/helpers/injectExtensionAttributesToParseRule.ts +6 -5
  87. package/src/helpers/isActive.ts +6 -2
  88. package/src/helpers/isMarkActive.ts +12 -15
  89. package/src/helpers/isNodeActive.ts +4 -7
  90. package/src/helpers/isNodeEmpty.ts +1 -1
  91. package/src/helpers/isNodeSelection.ts +1 -1
  92. package/src/helpers/isTextSelection.ts +1 -1
  93. package/src/helpers/posToDOMRect.ts +1 -1
  94. package/src/helpers/resolveFocusPosition.ts +2 -3
  95. package/src/helpers/selectionToInsertionEnd.ts +2 -2
  96. package/src/inputRules/markInputRule.ts +3 -4
  97. package/src/inputRules/nodeInputRule.ts +3 -4
  98. package/src/inputRules/textblockTypeInputRule.ts +3 -4
  99. package/src/inputRules/wrappingInputRule.ts +5 -6
  100. package/src/pasteRules/markPasteRule.ts +3 -4
  101. package/src/pasteRules/nodePasteRule.ts +8 -10
  102. package/src/types.ts +109 -125
  103. package/dist/packages/core/src/CommandManager.d.ts +0 -20
  104. package/dist/packages/core/src/Editor.d.ts +0 -147
  105. package/dist/packages/core/src/EventEmitter.d.ts +0 -11
  106. package/dist/packages/core/src/Extension.d.ts +0 -227
  107. package/dist/packages/core/src/ExtensionManager.d.ts +0 -18
  108. package/dist/packages/core/src/InputRule.d.ts +0 -42
  109. package/dist/packages/core/src/Mark.d.ts +0 -327
  110. package/dist/packages/core/src/Node.d.ts +0 -397
  111. package/dist/packages/core/src/NodeView.d.ts +0 -27
  112. package/dist/packages/core/src/PasteRule.d.ts +0 -42
  113. package/dist/packages/core/src/Tracker.d.ts +0 -11
  114. package/dist/packages/core/src/commands/blur.d.ts +0 -12
  115. package/dist/packages/core/src/commands/clearContent.d.ts +0 -12
  116. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -12
  117. package/dist/packages/core/src/commands/command.d.ts +0 -12
  118. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -12
  119. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -12
  120. package/dist/packages/core/src/commands/deleteNode.d.ts +0 -13
  121. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -12
  122. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -12
  123. package/dist/packages/core/src/commands/enter.d.ts +0 -12
  124. package/dist/packages/core/src/commands/exitCode.d.ts +0 -12
  125. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -13
  126. package/dist/packages/core/src/commands/first.d.ts +0 -12
  127. package/dist/packages/core/src/commands/focus.d.ts +0 -14
  128. package/dist/packages/core/src/commands/forEach.d.ts +0 -14
  129. package/dist/packages/core/src/commands/index.d.ts +0 -50
  130. package/dist/packages/core/src/commands/insertContent.d.ts +0 -16
  131. package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -16
  132. package/dist/packages/core/src/commands/join.d.ts +0 -33
  133. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -12
  134. package/dist/packages/core/src/commands/lift.d.ts +0 -13
  135. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -12
  136. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -13
  137. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -12
  138. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -13
  139. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -12
  140. package/dist/packages/core/src/commands/selectAll.d.ts +0 -12
  141. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -12
  142. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -12
  143. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -12
  144. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -12
  145. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -12
  146. package/dist/packages/core/src/commands/setContent.d.ts +0 -13
  147. package/dist/packages/core/src/commands/setMark.d.ts +0 -13
  148. package/dist/packages/core/src/commands/setMeta.d.ts +0 -12
  149. package/dist/packages/core/src/commands/setNode.d.ts +0 -13
  150. package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -12
  151. package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -12
  152. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -13
  153. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -14
  154. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -13
  155. package/dist/packages/core/src/commands/toggleList.d.ts +0 -13
  156. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -18
  157. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -13
  158. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -13
  159. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -12
  160. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -12
  161. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -18
  162. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -13
  163. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -13
  164. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -13
  165. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -2
  166. package/dist/packages/core/src/extensions/commands.d.ts +0 -3
  167. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  168. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  169. package/dist/packages/core/src/extensions/index.d.ts +0 -6
  170. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  171. package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
  172. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -7
  173. package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -5
  174. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -3
  175. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -7
  176. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -2
  177. package/dist/packages/core/src/helpers/findChildren.d.ts +0 -3
  178. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -6
  179. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -8
  180. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -8
  181. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -2
  182. package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -2
  183. package/dist/packages/core/src/helpers/generateText.d.ts +0 -5
  184. package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -3
  185. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  186. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
  187. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
  188. package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -2
  189. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  190. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
  191. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  192. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  193. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  194. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
  195. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  196. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  197. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -3
  198. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -3
  199. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -2
  200. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -2
  201. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -2
  202. package/dist/packages/core/src/helpers/getText.d.ts +0 -6
  203. package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -6
  204. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -2
  205. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -3
  206. package/dist/packages/core/src/helpers/index.d.ts +0 -33
  207. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  208. package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
  209. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
  210. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  211. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
  212. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
  213. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
  214. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  215. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  216. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
  217. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
  218. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  219. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  220. package/dist/packages/core/src/index.d.ts +0 -23
  221. package/dist/packages/core/src/inputRules/index.d.ts +0 -5
  222. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -12
  223. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -12
  224. package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -9
  225. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -14
  226. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -23
  227. package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
  228. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -12
  229. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -12
  230. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -9
  231. package/dist/packages/core/src/style.d.ts +0 -1
  232. package/dist/packages/core/src/types.d.ts +0 -214
  233. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
  234. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  235. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
  236. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  237. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
  238. package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
  239. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  240. package/dist/packages/core/src/utilities/index.d.ts +0 -20
  241. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  242. package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
  243. package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
  244. package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
  245. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  246. package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
  247. package/dist/packages/core/src/utilities/isString.d.ts +0 -1
  248. package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
  249. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
  250. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
  251. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  252. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
  253. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
  254. package/dist/tiptap-core.cjs +0 -4360
  255. package/dist/tiptap-core.cjs.map +0 -1
  256. package/dist/tiptap-core.esm.js +0 -4284
  257. package/dist/tiptap-core.esm.js.map +0 -1
  258. package/dist/tiptap-core.umd.js +0 -4358
  259. package/dist/tiptap-core.umd.js.map +0 -1
@@ -1,227 +0,0 @@
1
- import { Plugin, Transaction } from 'prosemirror-state';
2
- import { ExtensionConfig } from '.';
3
- import { Editor } from './Editor';
4
- import { InputRule } from './InputRule';
5
- import { Mark } from './Mark';
6
- import { Node } from './Node';
7
- import { PasteRule } from './PasteRule';
8
- import { Extensions, GlobalAttributes, KeyboardShortcutCommand, ParentConfig, RawCommands } from './types';
9
- declare module '@tiptap/core' {
10
- interface ExtensionConfig<Options = any, Storage = any> {
11
- [key: string]: any;
12
- /**
13
- * Name
14
- */
15
- name: string;
16
- /**
17
- * Priority
18
- */
19
- priority?: number;
20
- /**
21
- * Default options
22
- */
23
- defaultOptions?: Options;
24
- /**
25
- * Default Options
26
- */
27
- addOptions?: (this: {
28
- name: string;
29
- parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addOptions'], undefined>;
30
- }) => Options;
31
- /**
32
- * Default Storage
33
- */
34
- addStorage?: (this: {
35
- name: string;
36
- options: Options;
37
- parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addStorage'], undefined>;
38
- }) => Storage;
39
- /**
40
- * Global attributes
41
- */
42
- addGlobalAttributes?: (this: {
43
- name: string;
44
- options: Options;
45
- storage: Storage;
46
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addGlobalAttributes'];
47
- }) => GlobalAttributes | {};
48
- /**
49
- * Raw
50
- */
51
- addCommands?: (this: {
52
- name: string;
53
- options: Options;
54
- storage: Storage;
55
- editor: Editor;
56
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addCommands'];
57
- }) => Partial<RawCommands>;
58
- /**
59
- * Keyboard shortcuts
60
- */
61
- addKeyboardShortcuts?: (this: {
62
- name: string;
63
- options: Options;
64
- storage: Storage;
65
- editor: Editor;
66
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addKeyboardShortcuts'];
67
- }) => {
68
- [key: string]: KeyboardShortcutCommand;
69
- };
70
- /**
71
- * Input rules
72
- */
73
- addInputRules?: (this: {
74
- name: string;
75
- options: Options;
76
- storage: Storage;
77
- editor: Editor;
78
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addInputRules'];
79
- }) => InputRule[];
80
- /**
81
- * Paste rules
82
- */
83
- addPasteRules?: (this: {
84
- name: string;
85
- options: Options;
86
- storage: Storage;
87
- editor: Editor;
88
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addPasteRules'];
89
- }) => PasteRule[];
90
- /**
91
- * ProseMirror plugins
92
- */
93
- addProseMirrorPlugins?: (this: {
94
- name: string;
95
- options: Options;
96
- storage: Storage;
97
- editor: Editor;
98
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addProseMirrorPlugins'];
99
- }) => Plugin[];
100
- /**
101
- * Extensions
102
- */
103
- addExtensions?: (this: {
104
- name: string;
105
- options: Options;
106
- storage: Storage;
107
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['addExtensions'];
108
- }) => Extensions;
109
- /**
110
- * Extend Node Schema
111
- */
112
- extendNodeSchema?: ((this: {
113
- name: string;
114
- options: Options;
115
- storage: Storage;
116
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['extendNodeSchema'];
117
- }, extension: Node) => Record<string, any>) | null;
118
- /**
119
- * Extend Mark Schema
120
- */
121
- extendMarkSchema?: ((this: {
122
- name: string;
123
- options: Options;
124
- storage: Storage;
125
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['extendMarkSchema'];
126
- }, extension: Mark) => Record<string, any>) | null;
127
- /**
128
- * The editor is not ready yet.
129
- */
130
- onBeforeCreate?: ((this: {
131
- name: string;
132
- options: Options;
133
- storage: Storage;
134
- editor: Editor;
135
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBeforeCreate'];
136
- }) => void) | null;
137
- /**
138
- * The editor is ready.
139
- */
140
- onCreate?: ((this: {
141
- name: string;
142
- options: Options;
143
- storage: Storage;
144
- editor: Editor;
145
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onCreate'];
146
- }) => void) | null;
147
- /**
148
- * The content has changed.
149
- */
150
- onUpdate?: ((this: {
151
- name: string;
152
- options: Options;
153
- storage: Storage;
154
- editor: Editor;
155
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onUpdate'];
156
- }) => void) | null;
157
- /**
158
- * The selection has changed.
159
- */
160
- onSelectionUpdate?: ((this: {
161
- name: string;
162
- options: Options;
163
- storage: Storage;
164
- editor: Editor;
165
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onSelectionUpdate'];
166
- }) => void) | null;
167
- /**
168
- * The editor state has changed.
169
- */
170
- onTransaction?: ((this: {
171
- name: string;
172
- options: Options;
173
- storage: Storage;
174
- editor: Editor;
175
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onTransaction'];
176
- }, props: {
177
- transaction: Transaction;
178
- }) => void) | null;
179
- /**
180
- * The editor is focused.
181
- */
182
- onFocus?: ((this: {
183
- name: string;
184
- options: Options;
185
- storage: Storage;
186
- editor: Editor;
187
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onFocus'];
188
- }, props: {
189
- event: FocusEvent;
190
- }) => void) | null;
191
- /**
192
- * The editor isn’t focused anymore.
193
- */
194
- onBlur?: ((this: {
195
- name: string;
196
- options: Options;
197
- storage: Storage;
198
- editor: Editor;
199
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBlur'];
200
- }, props: {
201
- event: FocusEvent;
202
- }) => void) | null;
203
- /**
204
- * The editor is destroyed.
205
- */
206
- onDestroy?: ((this: {
207
- name: string;
208
- options: Options;
209
- storage: Storage;
210
- editor: Editor;
211
- parent: ParentConfig<ExtensionConfig<Options, Storage>>['onDestroy'];
212
- }) => void) | null;
213
- }
214
- }
215
- export declare class Extension<Options = any, Storage = any> {
216
- type: string;
217
- name: string;
218
- parent: Extension | null;
219
- child: Extension | null;
220
- options: Options;
221
- storage: Storage;
222
- config: ExtensionConfig;
223
- constructor(config?: Partial<ExtensionConfig<Options, Storage>>);
224
- static create<O = any, S = any>(config?: Partial<ExtensionConfig<O, S>>): Extension<O, S>;
225
- configure(options?: Partial<Options>): Extension<Options, Storage>;
226
- extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>): Extension<ExtendedOptions, ExtendedStorage>;
227
- }
@@ -1,18 +0,0 @@
1
- import { Schema } from 'prosemirror-model';
2
- import { Plugin } from 'prosemirror-state';
3
- import { Editor } from './Editor';
4
- import { Extensions, RawCommands } from './types';
5
- export declare class ExtensionManager {
6
- editor: Editor;
7
- schema: Schema;
8
- extensions: Extensions;
9
- splittableMarks: string[];
10
- constructor(extensions: Extensions, editor: Editor);
11
- static resolve(extensions: Extensions): Extensions;
12
- static flatten(extensions: Extensions): Extensions;
13
- static sort(extensions: Extensions): Extensions;
14
- get commands(): RawCommands;
15
- get plugins(): Plugin[];
16
- get attributes(): import("@tiptap/core").ExtensionAttribute[];
17
- get nodeViews(): any;
18
- }
@@ -1,42 +0,0 @@
1
- import { EditorState, Plugin } from 'prosemirror-state';
2
- import { Editor } from './Editor';
3
- import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types';
4
- export declare type InputRuleMatch = {
5
- index: number;
6
- text: string;
7
- replaceWith?: string;
8
- match?: RegExpMatchArray;
9
- data?: Record<string, any>;
10
- };
11
- export declare 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,327 +0,0 @@
1
- import { DOMOutputSpec, Mark as ProseMirrorMark, MarkSpec, MarkType } from 'prosemirror-model';
2
- import { Plugin, Transaction } from 'prosemirror-state';
3
- import { MarkConfig } from '.';
4
- import { Editor } from './Editor';
5
- import { InputRule } from './InputRule';
6
- import { Node } from './Node';
7
- import { PasteRule } from './PasteRule';
8
- import { Attributes, Extensions, GlobalAttributes, KeyboardShortcutCommand, ParentConfig, RawCommands } from './types';
9
- declare module '@tiptap/core' {
10
- interface MarkConfig<Options = any, Storage = any> {
11
- [key: string]: any;
12
- /**
13
- * Name
14
- */
15
- name: string;
16
- /**
17
- * Priority
18
- */
19
- priority?: number;
20
- /**
21
- * Default options
22
- */
23
- defaultOptions?: Options;
24
- /**
25
- * Default Options
26
- */
27
- addOptions?: (this: {
28
- name: string;
29
- parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>;
30
- }) => Options;
31
- /**
32
- * Default Storage
33
- */
34
- addStorage?: (this: {
35
- name: string;
36
- options: Options;
37
- parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>;
38
- }) => Storage;
39
- /**
40
- * Global attributes
41
- */
42
- addGlobalAttributes?: (this: {
43
- name: string;
44
- options: Options;
45
- storage: Storage;
46
- parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'];
47
- }) => GlobalAttributes | {};
48
- /**
49
- * Raw
50
- */
51
- addCommands?: (this: {
52
- name: string;
53
- options: Options;
54
- storage: Storage;
55
- editor: Editor;
56
- type: MarkType;
57
- parent: ParentConfig<MarkConfig<Options, Storage>>['addCommands'];
58
- }) => Partial<RawCommands>;
59
- /**
60
- * Keyboard shortcuts
61
- */
62
- addKeyboardShortcuts?: (this: {
63
- name: string;
64
- options: Options;
65
- storage: Storage;
66
- editor: Editor;
67
- type: MarkType;
68
- parent: ParentConfig<MarkConfig<Options, Storage>>['addKeyboardShortcuts'];
69
- }) => {
70
- [key: string]: KeyboardShortcutCommand;
71
- };
72
- /**
73
- * Input rules
74
- */
75
- addInputRules?: (this: {
76
- name: string;
77
- options: Options;
78
- storage: Storage;
79
- editor: Editor;
80
- type: MarkType;
81
- parent: ParentConfig<MarkConfig<Options, Storage>>['addInputRules'];
82
- }) => InputRule[];
83
- /**
84
- * Paste rules
85
- */
86
- addPasteRules?: (this: {
87
- name: string;
88
- options: Options;
89
- storage: Storage;
90
- editor: Editor;
91
- type: MarkType;
92
- parent: ParentConfig<MarkConfig<Options, Storage>>['addPasteRules'];
93
- }) => PasteRule[];
94
- /**
95
- * ProseMirror plugins
96
- */
97
- addProseMirrorPlugins?: (this: {
98
- name: string;
99
- options: Options;
100
- storage: Storage;
101
- editor: Editor;
102
- type: MarkType;
103
- parent: ParentConfig<MarkConfig<Options, Storage>>['addProseMirrorPlugins'];
104
- }) => Plugin[];
105
- /**
106
- * Extensions
107
- */
108
- addExtensions?: (this: {
109
- name: string;
110
- options: Options;
111
- storage: Storage;
112
- parent: ParentConfig<MarkConfig<Options, Storage>>['addExtensions'];
113
- }) => Extensions;
114
- /**
115
- * Extend Node Schema
116
- */
117
- extendNodeSchema?: ((this: {
118
- name: string;
119
- options: Options;
120
- storage: Storage;
121
- parent: ParentConfig<MarkConfig<Options, Storage>>['extendNodeSchema'];
122
- }, extension: Node) => Record<string, any>) | null;
123
- /**
124
- * Extend Mark Schema
125
- */
126
- extendMarkSchema?: ((this: {
127
- name: string;
128
- options: Options;
129
- storage: Storage;
130
- parent: ParentConfig<MarkConfig<Options, Storage>>['extendMarkSchema'];
131
- }, extension: Mark) => Record<string, any>) | null;
132
- /**
133
- * The editor is not ready yet.
134
- */
135
- onBeforeCreate?: ((this: {
136
- name: string;
137
- options: Options;
138
- storage: Storage;
139
- editor: Editor;
140
- type: MarkType;
141
- parent: ParentConfig<MarkConfig<Options, Storage>>['onBeforeCreate'];
142
- }) => void) | null;
143
- /**
144
- * The editor is ready.
145
- */
146
- onCreate?: ((this: {
147
- name: string;
148
- options: Options;
149
- storage: Storage;
150
- editor: Editor;
151
- type: MarkType;
152
- parent: ParentConfig<MarkConfig<Options, Storage>>['onCreate'];
153
- }) => void) | null;
154
- /**
155
- * The content has changed.
156
- */
157
- onUpdate?: ((this: {
158
- name: string;
159
- options: Options;
160
- storage: Storage;
161
- editor: Editor;
162
- type: MarkType;
163
- parent: ParentConfig<MarkConfig<Options, Storage>>['onUpdate'];
164
- }) => void) | null;
165
- /**
166
- * The selection has changed.
167
- */
168
- onSelectionUpdate?: ((this: {
169
- name: string;
170
- options: Options;
171
- storage: Storage;
172
- editor: Editor;
173
- type: MarkType;
174
- parent: ParentConfig<MarkConfig<Options, Storage>>['onSelectionUpdate'];
175
- }) => void) | null;
176
- /**
177
- * The editor state has changed.
178
- */
179
- onTransaction?: ((this: {
180
- name: string;
181
- options: Options;
182
- storage: Storage;
183
- editor: Editor;
184
- type: MarkType;
185
- parent: ParentConfig<MarkConfig<Options, Storage>>['onTransaction'];
186
- }, props: {
187
- transaction: Transaction;
188
- }) => void) | null;
189
- /**
190
- * The editor is focused.
191
- */
192
- onFocus?: ((this: {
193
- name: string;
194
- options: Options;
195
- storage: Storage;
196
- editor: Editor;
197
- type: MarkType;
198
- parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
199
- }, props: {
200
- event: FocusEvent;
201
- }) => void) | null;
202
- /**
203
- * The editor isn’t focused anymore.
204
- */
205
- onBlur?: ((this: {
206
- name: string;
207
- options: Options;
208
- storage: Storage;
209
- editor: Editor;
210
- type: MarkType;
211
- parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
212
- }, props: {
213
- event: FocusEvent;
214
- }) => void) | null;
215
- /**
216
- * The editor is destroyed.
217
- */
218
- onDestroy?: ((this: {
219
- name: string;
220
- options: Options;
221
- storage: Storage;
222
- editor: Editor;
223
- type: MarkType;
224
- parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
225
- }) => void) | null;
226
- /**
227
- * Keep mark after split node
228
- */
229
- keepOnSplit?: boolean | (() => boolean);
230
- /**
231
- * Inclusive
232
- */
233
- inclusive?: MarkSpec['inclusive'] | ((this: {
234
- name: string;
235
- options: Options;
236
- storage: Storage;
237
- parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
238
- }) => MarkSpec['inclusive']);
239
- /**
240
- * Excludes
241
- */
242
- excludes?: MarkSpec['excludes'] | ((this: {
243
- name: string;
244
- options: Options;
245
- storage: Storage;
246
- parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
247
- }) => MarkSpec['excludes']);
248
- /**
249
- * Marks this Mark as exitable
250
- */
251
- exitable?: boolean | (() => boolean);
252
- /**
253
- * Group
254
- */
255
- group?: MarkSpec['group'] | ((this: {
256
- name: string;
257
- options: Options;
258
- storage: Storage;
259
- parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
260
- }) => MarkSpec['group']);
261
- /**
262
- * Spanning
263
- */
264
- spanning?: MarkSpec['spanning'] | ((this: {
265
- name: string;
266
- options: Options;
267
- storage: Storage;
268
- parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
269
- }) => MarkSpec['spanning']);
270
- /**
271
- * Code
272
- */
273
- code?: boolean | ((this: {
274
- name: string;
275
- options: Options;
276
- storage: Storage;
277
- parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
278
- }) => boolean);
279
- /**
280
- * Parse HTML
281
- */
282
- parseHTML?: (this: {
283
- name: string;
284
- options: Options;
285
- storage: Storage;
286
- parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
287
- }) => MarkSpec['parseDOM'];
288
- /**
289
- * Render HTML
290
- */
291
- renderHTML?: ((this: {
292
- name: string;
293
- options: Options;
294
- storage: Storage;
295
- parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
296
- }, props: {
297
- mark: ProseMirrorMark;
298
- HTMLAttributes: Record<string, any>;
299
- }) => DOMOutputSpec) | null;
300
- /**
301
- * Attributes
302
- */
303
- addAttributes?: (this: {
304
- name: string;
305
- options: Options;
306
- storage: Storage;
307
- parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
308
- }) => Attributes | {};
309
- }
310
- }
311
- export declare class Mark<Options = any, Storage = any> {
312
- type: string;
313
- name: string;
314
- parent: Mark | null;
315
- child: Mark | null;
316
- options: Options;
317
- storage: Storage;
318
- config: MarkConfig;
319
- constructor(config?: Partial<MarkConfig<Options, Storage>>);
320
- static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
321
- configure(options?: Partial<Options>): Mark<Options, Storage>;
322
- extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
323
- static handleExit({ editor, mark, }: {
324
- editor: Editor;
325
- mark: Mark;
326
- }): boolean;
327
- }