@tiptap/core 2.0.0-beta.21 → 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 (289) hide show
  1. package/README.md +2 -2
  2. package/dist/index.cjs +4311 -0
  3. package/dist/index.d.ts +2330 -0
  4. package/dist/index.js +4311 -0
  5. package/package.json +39 -25
  6. package/src/CommandManager.ts +76 -86
  7. package/src/Editor.ts +120 -81
  8. package/src/EventEmitter.ts +14 -4
  9. package/src/Extension.ts +280 -108
  10. package/src/ExtensionManager.ts +254 -108
  11. package/src/InputRule.ts +260 -0
  12. package/src/Mark.ts +398 -147
  13. package/src/Node.ts +437 -171
  14. package/src/NodeView.ts +132 -63
  15. package/src/PasteRule.ts +240 -0
  16. package/src/Tracker.ts +38 -0
  17. package/src/commands/blur.ts +12 -6
  18. package/src/commands/clearContent.ts +3 -3
  19. package/src/commands/clearNodes.ts +31 -19
  20. package/src/commands/command.ts +2 -2
  21. package/src/commands/createParagraphNear.ts +5 -4
  22. package/src/commands/deleteCurrentNode.ts +41 -0
  23. package/src/commands/deleteNode.ts +37 -0
  24. package/src/commands/deleteRange.ts +3 -3
  25. package/src/commands/deleteSelection.ts +5 -4
  26. package/src/commands/enter.ts +3 -3
  27. package/src/commands/exitCode.ts +5 -4
  28. package/src/commands/extendMarkRange.ts +16 -12
  29. package/src/commands/first.ts +3 -3
  30. package/src/commands/focus.ts +47 -44
  31. package/src/commands/forEach.ts +24 -0
  32. package/src/commands/index.ts +50 -0
  33. package/src/commands/insertContent.ts +17 -24
  34. package/src/commands/insertContentAt.ts +94 -0
  35. package/src/commands/join.ts +53 -0
  36. package/src/commands/keyboardShortcut.ts +6 -6
  37. package/src/commands/lift.ts +8 -7
  38. package/src/commands/liftEmptyBlock.ts +5 -4
  39. package/src/commands/liftListItem.ts +7 -6
  40. package/src/commands/newlineInCode.ts +5 -4
  41. package/src/commands/resetAttributes.ts +18 -12
  42. package/src/commands/scrollIntoView.ts +3 -3
  43. package/src/commands/selectAll.ts +8 -6
  44. package/src/commands/selectNodeBackward.ts +5 -4
  45. package/src/commands/selectNodeForward.ts +5 -4
  46. package/src/commands/selectParentNode.ts +5 -4
  47. package/src/commands/selectTextblockEnd.ts +20 -0
  48. package/src/commands/selectTextblockStart.ts +20 -0
  49. package/src/commands/setContent.ts +9 -16
  50. package/src/commands/setMark.ts +90 -14
  51. package/src/commands/setMeta.ts +18 -0
  52. package/src/commands/setNode.ts +32 -8
  53. package/src/commands/setNodeSelection.ts +27 -0
  54. package/src/commands/setTextSelection.ts +31 -0
  55. package/src/commands/sinkListItem.ts +7 -6
  56. package/src/commands/splitBlock.ts +31 -41
  57. package/src/commands/splitListItem.ts +46 -29
  58. package/src/commands/toggleList.ts +88 -20
  59. package/src/commands/toggleMark.ts +19 -8
  60. package/src/commands/toggleNode.ts +11 -6
  61. package/src/commands/toggleWrap.ts +10 -10
  62. package/src/commands/undoInputRule.ts +34 -5
  63. package/src/commands/unsetAllMarks.ts +7 -11
  64. package/src/commands/unsetMark.ts +36 -23
  65. package/src/commands/updateAttributes.ts +27 -15
  66. package/src/commands/wrapIn.ts +7 -12
  67. package/src/commands/wrapInList.ts +7 -6
  68. package/src/extensions/clipboardTextSerializer.ts +15 -36
  69. package/src/extensions/commands.ts +3 -147
  70. package/src/extensions/editable.ts +2 -1
  71. package/src/extensions/focusEvents.ts +4 -6
  72. package/src/extensions/index.ts +1 -0
  73. package/src/extensions/keymap.ts +106 -13
  74. package/src/extensions/tabindex.ts +18 -0
  75. package/src/helpers/combineTransactionSteps.ts +21 -0
  76. package/src/helpers/createChainableState.ts +38 -0
  77. package/src/helpers/createDocument.ts +5 -6
  78. package/src/helpers/createNodeFromContent.ts +20 -28
  79. package/src/helpers/defaultBlockAt.ts +13 -0
  80. package/src/helpers/findChildren.ts +18 -0
  81. package/src/helpers/findChildrenInRange.ts +36 -0
  82. package/src/helpers/findParentNode.ts +4 -3
  83. package/src/helpers/findParentNodeClosestToPos.ts +13 -7
  84. package/src/helpers/generateHTML.ts +7 -6
  85. package/src/helpers/generateJSON.ts +12 -0
  86. package/src/helpers/generateText.ts +27 -0
  87. package/src/helpers/getAttributes.ts +26 -0
  88. package/src/helpers/getAttributesFromExtensions.ts +42 -14
  89. package/src/helpers/getChangedRanges.ts +83 -0
  90. package/src/helpers/getDebugJSON.ts +54 -0
  91. package/src/helpers/getExtensionField.ts +25 -0
  92. package/src/helpers/getHTMLFromFragment.ts +5 -6
  93. package/src/helpers/getMarkAttributes.ts +18 -11
  94. package/src/helpers/getMarkRange.ts +41 -8
  95. package/src/helpers/getMarkType.ts +8 -2
  96. package/src/helpers/getMarksBetween.ts +34 -10
  97. package/src/helpers/getNodeAttributes.ts +14 -13
  98. package/src/helpers/getNodeType.ts +8 -2
  99. package/src/helpers/getRenderedAttributes.ts +9 -7
  100. package/src/helpers/getSchema.ts +7 -133
  101. package/src/helpers/getSchemaByResolvedExtensions.ts +192 -0
  102. package/src/helpers/getSchemaTypeByName.ts +3 -11
  103. package/src/helpers/getSchemaTypeNameByName.ts +2 -2
  104. package/src/helpers/getSplittedAttributes.ts +4 -4
  105. package/src/helpers/getText.ts +19 -0
  106. package/src/helpers/getTextBetween.ts +46 -0
  107. package/src/helpers/getTextContentFromNodes.ts +26 -0
  108. package/src/helpers/getTextSerializersFromSchema.ts +11 -0
  109. package/src/helpers/index.ts +33 -0
  110. package/src/helpers/injectExtensionAttributesToParseRule.ts +22 -23
  111. package/src/helpers/isActive.ts +10 -6
  112. package/src/helpers/isExtensionRulesEnabled.ts +15 -0
  113. package/src/helpers/isList.ts +14 -7
  114. package/src/helpers/isMarkActive.ts +49 -27
  115. package/src/helpers/isNodeActive.ts +29 -39
  116. package/src/helpers/isNodeEmpty.ts +2 -2
  117. package/src/helpers/isNodeSelection.ts +3 -4
  118. package/src/helpers/isTextSelection.ts +3 -4
  119. package/src/helpers/posToDOMRect.ts +35 -0
  120. package/src/helpers/resolveFocusPosition.ts +42 -0
  121. package/src/helpers/selectionToInsertionEnd.ts +3 -3
  122. package/src/helpers/splitExtensions.ts +3 -3
  123. package/src/index.ts +15 -24
  124. package/src/inputRules/index.ts +5 -0
  125. package/src/inputRules/markInputRule.ts +59 -40
  126. package/src/inputRules/nodeInputRule.ts +45 -12
  127. package/src/inputRules/textInputRule.ts +35 -0
  128. package/src/inputRules/textblockTypeInputRule.ts +37 -0
  129. package/src/inputRules/wrappingInputRule.ts +59 -0
  130. package/src/pasteRules/index.ts +3 -0
  131. package/src/pasteRules/markPasteRule.ts +61 -53
  132. package/src/pasteRules/nodePasteRule.ts +37 -0
  133. package/src/pasteRules/textPasteRule.ts +35 -0
  134. package/src/style.ts +16 -3
  135. package/src/types.ts +170 -97
  136. package/src/utilities/callOrReturn.ts +6 -3
  137. package/src/utilities/createStyleTag.ts +12 -1
  138. package/src/utilities/deleteProps.ts +2 -4
  139. package/src/utilities/elementFromString.ts +4 -5
  140. package/src/utilities/escapeForRegEx.ts +4 -0
  141. package/src/utilities/findDuplicates.ts +5 -0
  142. package/src/utilities/fromString.ts +2 -2
  143. package/src/utilities/index.ts +20 -0
  144. package/src/utilities/isEmptyObject.ts +2 -2
  145. package/src/utilities/isFunction.ts +3 -0
  146. package/src/utilities/isMacOS.ts +5 -0
  147. package/src/utilities/isNumber.ts +3 -0
  148. package/src/utilities/isPlainObject.ts +8 -5
  149. package/src/utilities/isRegExp.ts +3 -0
  150. package/src/utilities/isString.ts +3 -0
  151. package/src/utilities/isiOS.ts +12 -0
  152. package/src/utilities/mergeAttributes.ts +2 -3
  153. package/src/utilities/mergeDeep.ts +2 -3
  154. package/src/utilities/minMax.ts +1 -1
  155. package/src/utilities/objectIncludes.ts +17 -5
  156. package/src/utilities/removeDuplicates.ts +15 -0
  157. package/CHANGELOG.md +0 -365
  158. package/LICENSE.md +0 -21
  159. package/dist/packages/core/src/CommandManager.d.ts +0 -13
  160. package/dist/packages/core/src/Editor.d.ts +0 -142
  161. package/dist/packages/core/src/EventEmitter.d.ts +0 -7
  162. package/dist/packages/core/src/Extension.d.ts +0 -148
  163. package/dist/packages/core/src/ExtensionManager.d.ts +0 -24
  164. package/dist/packages/core/src/Mark.d.ts +0 -211
  165. package/dist/packages/core/src/Node.d.ts +0 -265
  166. package/dist/packages/core/src/NodeView.d.ts +0 -31
  167. package/dist/packages/core/src/commands/blur.d.ts +0 -12
  168. package/dist/packages/core/src/commands/clearContent.d.ts +0 -12
  169. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -12
  170. package/dist/packages/core/src/commands/command.d.ts +0 -12
  171. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -12
  172. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -12
  173. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -12
  174. package/dist/packages/core/src/commands/enter.d.ts +0 -12
  175. package/dist/packages/core/src/commands/exitCode.d.ts +0 -12
  176. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -13
  177. package/dist/packages/core/src/commands/first.d.ts +0 -12
  178. package/dist/packages/core/src/commands/focus.d.ts +0 -12
  179. package/dist/packages/core/src/commands/insertContent.d.ts +0 -12
  180. package/dist/packages/core/src/commands/insertHTML.d.ts +0 -12
  181. package/dist/packages/core/src/commands/insertNode.d.ts +0 -13
  182. package/dist/packages/core/src/commands/insertText.d.ts +0 -12
  183. package/dist/packages/core/src/commands/joinBackward.d.ts +0 -12
  184. package/dist/packages/core/src/commands/joinForward.d.ts +0 -12
  185. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -12
  186. package/dist/packages/core/src/commands/lift.d.ts +0 -13
  187. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -12
  188. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -13
  189. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -12
  190. package/dist/packages/core/src/commands/replace.d.ts +0 -13
  191. package/dist/packages/core/src/commands/replaceRange.d.ts +0 -13
  192. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -13
  193. package/dist/packages/core/src/commands/resetNodeAttributes.d.ts +0 -13
  194. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -12
  195. package/dist/packages/core/src/commands/selectAll.d.ts +0 -12
  196. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -12
  197. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -12
  198. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -12
  199. package/dist/packages/core/src/commands/setContent.d.ts +0 -12
  200. package/dist/packages/core/src/commands/setMark.d.ts +0 -13
  201. package/dist/packages/core/src/commands/setNode.d.ts +0 -13
  202. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -13
  203. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -14
  204. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -13
  205. package/dist/packages/core/src/commands/toggleList.d.ts +0 -13
  206. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -13
  207. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -13
  208. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -13
  209. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -12
  210. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -12
  211. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -13
  212. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -13
  213. package/dist/packages/core/src/commands/updateNodeAttributes.d.ts +0 -13
  214. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -13
  215. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -13
  216. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -2
  217. package/dist/packages/core/src/extensions/commands.d.ts +0 -100
  218. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  219. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  220. package/dist/packages/core/src/extensions/index.d.ts +0 -5
  221. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  222. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -4
  223. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -8
  224. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -9
  225. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -8
  226. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -2
  227. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  228. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  229. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -4
  230. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  231. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  232. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  233. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -4
  234. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  235. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  236. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -3
  237. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -2
  238. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -2
  239. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -2
  240. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  241. package/dist/packages/core/src/helpers/isActive.d.ts +0 -3
  242. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  243. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -4
  244. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -4
  245. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
  246. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  247. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  248. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  249. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  250. package/dist/packages/core/src/index.d.ts +0 -30
  251. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -3
  252. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -3
  253. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -3
  254. package/dist/packages/core/src/style.d.ts +0 -2
  255. package/dist/packages/core/src/types.d.ts +0 -154
  256. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -8
  257. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  258. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -7
  259. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  260. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  261. package/dist/packages/core/src/utilities/isClass.d.ts +0 -1
  262. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  263. package/dist/packages/core/src/utilities/isObject.d.ts +0 -1
  264. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  265. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -2
  266. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -2
  267. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  268. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -7
  269. package/dist/packages/core/src/utilities/removeElement.d.ts +0 -1
  270. package/dist/tiptap-core.bundle.umd.min.js +0 -17
  271. package/dist/tiptap-core.bundle.umd.min.js.map +0 -1
  272. package/dist/tiptap-core.cjs.js +0 -3027
  273. package/dist/tiptap-core.cjs.js.map +0 -1
  274. package/dist/tiptap-core.esm.js +0 -3002
  275. package/dist/tiptap-core.esm.js.map +0 -1
  276. package/dist/tiptap-core.umd.js +0 -3024
  277. package/dist/tiptap-core.umd.js.map +0 -1
  278. package/src/commands/insertHTML.ts +0 -30
  279. package/src/commands/insertNode.ts +0 -33
  280. package/src/commands/insertText.ts +0 -22
  281. package/src/commands/joinBackward.ts +0 -17
  282. package/src/commands/joinForward.ts +0 -17
  283. package/src/commands/replace.ts +0 -20
  284. package/src/commands/replaceRange.ts +0 -36
  285. package/src/commands/resetNodeAttributes.ts +0 -33
  286. package/src/commands/updateNodeAttributes.ts +0 -35
  287. package/src/utilities/isClass.ts +0 -7
  288. package/src/utilities/isObject.ts +0 -10
  289. package/src/utilities/removeElement.ts +0 -5
@@ -1,24 +0,0 @@
1
- import { Schema, Node as ProsemirrorNode } from 'prosemirror-model';
2
- import { EditorView, Decoration } from 'prosemirror-view';
3
- import { Plugin } from 'prosemirror-state';
4
- import { Editor } from './Editor';
5
- import { Extensions, RawCommands } from './types';
6
- export default class ExtensionManager {
7
- editor: Editor;
8
- schema: Schema;
9
- extensions: Extensions;
10
- splittableMarks: string[];
11
- constructor(extensions: Extensions, editor: Editor);
12
- private sort;
13
- get commands(): RawCommands;
14
- get plugins(): Plugin[];
15
- get attributes(): import("./types").ExtensionAttribute[];
16
- get nodeViews(): {
17
- [k: string]: (node: ProsemirrorNode, view: EditorView, getPos: (() => number) | boolean, decorations: Decoration[]) => {} | import("prosemirror-view").NodeView<any>;
18
- };
19
- get textSerializers(): {
20
- [k: string]: (props: {
21
- node: ProsemirrorNode;
22
- }) => string | undefined;
23
- };
24
- }
@@ -1,211 +0,0 @@
1
- import { DOMOutputSpec, MarkSpec, Mark as ProseMirrorMark, MarkType } from 'prosemirror-model';
2
- import { Plugin, Transaction } from 'prosemirror-state';
3
- import { Command as ProseMirrorCommand } from 'prosemirror-commands';
4
- import { InputRule } from 'prosemirror-inputrules';
5
- import { Attributes, RawCommands, GlobalAttributes } from './types';
6
- import { MarkConfig } from '.';
7
- import { Editor } from './Editor';
8
- declare module '@tiptap/core' {
9
- interface MarkConfig<Options = any> {
10
- [key: string]: any;
11
- /**
12
- * Name
13
- */
14
- name: string;
15
- /**
16
- * Priority
17
- */
18
- priority?: number;
19
- /**
20
- * Default options
21
- */
22
- defaultOptions?: Options;
23
- /**
24
- * Global attributes
25
- */
26
- addGlobalAttributes?: (this: {
27
- options: Options;
28
- }) => GlobalAttributes | {};
29
- /**
30
- * Raw
31
- */
32
- addCommands?: (this: {
33
- options: Options;
34
- editor: Editor;
35
- type: MarkType;
36
- }) => Partial<RawCommands>;
37
- /**
38
- * Keyboard shortcuts
39
- */
40
- addKeyboardShortcuts?: (this: {
41
- options: Options;
42
- editor: Editor;
43
- type: MarkType;
44
- }) => {
45
- [key: string]: ProseMirrorCommand;
46
- };
47
- /**
48
- * Input rules
49
- */
50
- addInputRules?: (this: {
51
- options: Options;
52
- editor: Editor;
53
- type: MarkType;
54
- }) => InputRule[];
55
- /**
56
- * Paste rules
57
- */
58
- addPasteRules?: (this: {
59
- options: Options;
60
- editor: Editor;
61
- type: MarkType;
62
- }) => Plugin[];
63
- /**
64
- * ProseMirror plugins
65
- */
66
- addProseMirrorPlugins?: (this: {
67
- options: Options;
68
- editor: Editor;
69
- type: MarkType;
70
- }) => Plugin[];
71
- /**
72
- * Extend Node Schema
73
- */
74
- extendNodeSchema?: ((this: {
75
- options: Options;
76
- }, extension: Node) => {
77
- [key: string]: any;
78
- }) | null;
79
- /**
80
- * Extend Mark Schema
81
- */
82
- extendMarkSchema?: ((this: {
83
- options: Options;
84
- }, extension: Node) => {
85
- [key: string]: any;
86
- }) | null;
87
- /**
88
- * The editor is ready.
89
- */
90
- onCreate?: ((this: {
91
- options: Options;
92
- editor: Editor;
93
- type: MarkType;
94
- }) => void) | null;
95
- /**
96
- * The content has changed.
97
- */
98
- onUpdate?: ((this: {
99
- options: Options;
100
- editor: Editor;
101
- type: MarkType;
102
- }) => void) | null;
103
- /**
104
- * The selection has changed.
105
- */
106
- onSelectionUpdate?: ((this: {
107
- options: Options;
108
- editor: Editor;
109
- type: MarkType;
110
- }) => void) | null;
111
- /**
112
- * The editor state has changed.
113
- */
114
- onTransaction?: ((this: {
115
- options: Options;
116
- editor: Editor;
117
- type: MarkType;
118
- }, props: {
119
- transaction: Transaction;
120
- }) => void) | null;
121
- /**
122
- * The editor is focused.
123
- */
124
- onFocus?: ((this: {
125
- options: Options;
126
- editor: Editor;
127
- type: MarkType;
128
- }, props: {
129
- event: FocusEvent;
130
- }) => void) | null;
131
- /**
132
- * The editor isn’t focused anymore.
133
- */
134
- onBlur?: ((this: {
135
- options: Options;
136
- editor: Editor;
137
- type: MarkType;
138
- }, props: {
139
- event: FocusEvent;
140
- }) => void) | null;
141
- /**
142
- * The editor is destroyed.
143
- */
144
- onDestroy?: ((this: {
145
- options: Options;
146
- editor: Editor;
147
- type: MarkType;
148
- }) => void) | null;
149
- /**
150
- * Keep mark after split node
151
- */
152
- keepOnSplit?: boolean | (() => boolean);
153
- /**
154
- * Inclusive
155
- */
156
- inclusive?: MarkSpec['inclusive'] | ((this: {
157
- options: Options;
158
- }) => MarkSpec['inclusive']);
159
- /**
160
- * Excludes
161
- */
162
- excludes?: MarkSpec['excludes'] | ((this: {
163
- options: Options;
164
- }) => MarkSpec['excludes']);
165
- /**
166
- * Group
167
- */
168
- group?: MarkSpec['group'] | ((this: {
169
- options: Options;
170
- }) => MarkSpec['group']);
171
- /**
172
- * Spanning
173
- */
174
- spanning?: MarkSpec['spanning'] | ((this: {
175
- options: Options;
176
- }) => MarkSpec['spanning']);
177
- /**
178
- * Parse HTML
179
- */
180
- parseHTML?: (this: {
181
- options: Options;
182
- }) => MarkSpec['parseDOM'];
183
- /**
184
- * Render HTML
185
- */
186
- renderHTML?: ((this: {
187
- options: Options;
188
- }, props: {
189
- mark: ProseMirrorMark;
190
- HTMLAttributes: {
191
- [key: string]: any;
192
- };
193
- }) => DOMOutputSpec) | null;
194
- /**
195
- * Attributes
196
- */
197
- addAttributes?: (this: {
198
- options: Options;
199
- }) => Attributes | {};
200
- }
201
- }
202
- export declare class Mark<Options = any> {
203
- #private;
204
- type: string;
205
- config: MarkConfig;
206
- options: Options;
207
- constructor(config: MarkConfig<Options>);
208
- static create<O>(config: MarkConfig<O>): Mark<O>;
209
- configure(options?: Partial<Options>): Mark<Options>;
210
- extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>>): Mark<ExtendedOptions>;
211
- }
@@ -1,265 +0,0 @@
1
- import { DOMOutputSpec, NodeSpec, Node as ProseMirrorNode, NodeType } from 'prosemirror-model';
2
- import { Command as ProseMirrorCommand } from 'prosemirror-commands';
3
- import { Plugin, Transaction } from 'prosemirror-state';
4
- import { InputRule } from 'prosemirror-inputrules';
5
- import { Attributes, NodeViewRenderer, GlobalAttributes, RawCommands } from './types';
6
- import { NodeConfig } from '.';
7
- import { Editor } from './Editor';
8
- declare module '@tiptap/core' {
9
- interface NodeConfig<Options = any> {
10
- [key: string]: any;
11
- /**
12
- * Name
13
- */
14
- name: string;
15
- /**
16
- * Priority
17
- */
18
- priority?: number;
19
- /**
20
- * Default options
21
- */
22
- defaultOptions?: Options;
23
- /**
24
- * Global attributes
25
- */
26
- addGlobalAttributes?: (this: {
27
- options: Options;
28
- }) => GlobalAttributes | {};
29
- /**
30
- * Raw
31
- */
32
- addCommands?: (this: {
33
- options: Options;
34
- editor: Editor;
35
- type: NodeType;
36
- }) => Partial<RawCommands>;
37
- /**
38
- * Keyboard shortcuts
39
- */
40
- addKeyboardShortcuts?: (this: {
41
- options: Options;
42
- editor: Editor;
43
- type: NodeType;
44
- }) => {
45
- [key: string]: ProseMirrorCommand;
46
- };
47
- /**
48
- * Input rules
49
- */
50
- addInputRules?: (this: {
51
- options: Options;
52
- editor: Editor;
53
- type: NodeType;
54
- }) => InputRule[];
55
- /**
56
- * Paste rules
57
- */
58
- addPasteRules?: (this: {
59
- options: Options;
60
- editor: Editor;
61
- type: NodeType;
62
- }) => Plugin[];
63
- /**
64
- * ProseMirror plugins
65
- */
66
- addProseMirrorPlugins?: (this: {
67
- options: Options;
68
- editor: Editor;
69
- type: NodeType;
70
- }) => Plugin[];
71
- /**
72
- * Extend Node Schema
73
- */
74
- extendNodeSchema?: ((this: {
75
- options: Options;
76
- }, extension: Node) => {
77
- [key: string]: any;
78
- }) | null;
79
- /**
80
- * Extend Mark Schema
81
- */
82
- extendMarkSchema?: ((this: {
83
- options: Options;
84
- }, extension: Node) => {
85
- [key: string]: any;
86
- }) | null;
87
- /**
88
- * The editor is ready.
89
- */
90
- onCreate?: ((this: {
91
- options: Options;
92
- editor: Editor;
93
- type: NodeType;
94
- }) => void) | null;
95
- /**
96
- * The content has changed.
97
- */
98
- onUpdate?: ((this: {
99
- options: Options;
100
- editor: Editor;
101
- type: NodeType;
102
- }) => void) | null;
103
- /**
104
- * The selection has changed.
105
- */
106
- onSelectionUpdate?: ((this: {
107
- options: Options;
108
- editor: Editor;
109
- type: NodeType;
110
- }) => void) | null;
111
- /**
112
- * The editor state has changed.
113
- */
114
- onTransaction?: ((this: {
115
- options: Options;
116
- editor: Editor;
117
- type: NodeType;
118
- }, props: {
119
- transaction: Transaction;
120
- }) => void) | null;
121
- /**
122
- * The editor is focused.
123
- */
124
- onFocus?: ((this: {
125
- options: Options;
126
- editor: Editor;
127
- type: NodeType;
128
- }, props: {
129
- event: FocusEvent;
130
- }) => void) | null;
131
- /**
132
- * The editor isn’t focused anymore.
133
- */
134
- onBlur?: ((this: {
135
- options: Options;
136
- editor: Editor;
137
- type: NodeType;
138
- }, props: {
139
- event: FocusEvent;
140
- }) => void) | null;
141
- /**
142
- * The editor is destroyed.
143
- */
144
- onDestroy?: ((this: {
145
- options: Options;
146
- editor: Editor;
147
- type: NodeType;
148
- }) => void) | null;
149
- /**
150
- * Node View
151
- */
152
- addNodeView?: ((this: {
153
- options: Options;
154
- editor: Editor;
155
- type: NodeType;
156
- }) => NodeViewRenderer) | null;
157
- /**
158
- * TopNode
159
- */
160
- topNode?: boolean;
161
- /**
162
- * Content
163
- */
164
- content?: NodeSpec['content'] | ((this: {
165
- options: Options;
166
- }) => NodeSpec['content']);
167
- /**
168
- * Marks
169
- */
170
- marks?: NodeSpec['marks'] | ((this: {
171
- options: Options;
172
- }) => NodeSpec['marks']);
173
- /**
174
- * Group
175
- */
176
- group?: NodeSpec['group'] | ((this: {
177
- options: Options;
178
- }) => NodeSpec['group']);
179
- /**
180
- * Inline
181
- */
182
- inline?: NodeSpec['inline'] | ((this: {
183
- options: Options;
184
- }) => NodeSpec['inline']);
185
- /**
186
- * Atom
187
- */
188
- atom?: NodeSpec['atom'] | ((this: {
189
- options: Options;
190
- }) => NodeSpec['atom']);
191
- /**
192
- * Selectable
193
- */
194
- selectable?: NodeSpec['selectable'] | ((this: {
195
- options: Options;
196
- }) => NodeSpec['selectable']);
197
- /**
198
- * Draggable
199
- */
200
- draggable?: NodeSpec['draggable'] | ((this: {
201
- options: Options;
202
- }) => NodeSpec['draggable']);
203
- /**
204
- * Code
205
- */
206
- code?: NodeSpec['code'] | ((this: {
207
- options: Options;
208
- }) => NodeSpec['code']);
209
- /**
210
- * Defining
211
- */
212
- defining?: NodeSpec['defining'] | ((this: {
213
- options: Options;
214
- }) => NodeSpec['defining']);
215
- /**
216
- * Isolating
217
- */
218
- isolating?: NodeSpec['isolating'] | ((this: {
219
- options: Options;
220
- }) => NodeSpec['isolating']);
221
- /**
222
- * Parse HTML
223
- */
224
- parseHTML?: (this: {
225
- options: Options;
226
- }) => NodeSpec['parseDOM'];
227
- /**
228
- * Render HTML
229
- */
230
- renderHTML?: ((this: {
231
- options: Options;
232
- }, props: {
233
- node: ProseMirrorNode;
234
- HTMLAttributes: {
235
- [key: string]: any;
236
- };
237
- }) => DOMOutputSpec) | null;
238
- /**
239
- * Render Text
240
- */
241
- renderText?: ((this: {
242
- options: Options;
243
- editor: Editor;
244
- type: NodeType;
245
- }, props: {
246
- node: ProseMirrorNode;
247
- }) => string) | null;
248
- /**
249
- * Add Attributes
250
- */
251
- addAttributes?: (this: {
252
- options: Options;
253
- }) => Attributes | {};
254
- }
255
- }
256
- export declare class Node<Options = any> {
257
- #private;
258
- type: string;
259
- config: NodeConfig;
260
- options: Options;
261
- constructor(config: NodeConfig<Options>);
262
- static create<O>(config: NodeConfig<O>): Node<O>;
263
- configure(options?: Partial<Options>): Node<Options>;
264
- extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>>): Node<ExtendedOptions>;
265
- }
@@ -1,31 +0,0 @@
1
- import { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view';
2
- import { Node as ProseMirrorNode } from 'prosemirror-model';
3
- import { Editor as CoreEditor } from './Editor';
4
- import { Node } from './Node';
5
- import { NodeViewRendererProps } from './types';
6
- interface NodeViewRendererOptions {
7
- stopEvent: ((event: Event) => boolean) | null;
8
- update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null;
9
- }
10
- export declare class NodeView<Component, Editor extends CoreEditor = CoreEditor> implements ProseMirrorNodeView {
11
- component: Component;
12
- editor: Editor;
13
- extension: Node;
14
- node: ProseMirrorNode;
15
- decorations: Decoration[];
16
- getPos: any;
17
- isDragging: boolean;
18
- options: NodeViewRendererOptions;
19
- constructor(component: Component, props: NodeViewRendererProps, options?: Partial<NodeViewRendererOptions>);
20
- mount(): void;
21
- get dom(): Element | null;
22
- get contentDOM(): Element | null;
23
- onDragStart(event: DragEvent): void;
24
- stopEvent(event: Event): boolean;
25
- ignoreMutation(mutation: MutationRecord | {
26
- type: 'selection';
27
- target: Element;
28
- }): boolean;
29
- updateAttributes(attributes: {}): void;
30
- }
31
- export {};
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- blur: {
5
- /**
6
- * Removes focus from the editor.
7
- */
8
- blur: () => Command;
9
- };
10
- }
11
- }
12
- export declare const blur: RawCommands['blur'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- clearContent: {
5
- /**
6
- * Clear the whole document.
7
- */
8
- clearContent: (emitUpdate: Boolean) => Command;
9
- };
10
- }
11
- }
12
- export declare const clearContent: RawCommands['clearContent'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- clearNodes: {
5
- /**
6
- * Normalize nodes to a simple paragraph.
7
- */
8
- clearNodes: () => Command;
9
- };
10
- }
11
- }
12
- export declare const clearNodes: RawCommands['clearNodes'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- command: {
5
- /**
6
- * Define a command inline.
7
- */
8
- command: (fn: (props: Parameters<Command>[0]) => boolean) => Command;
9
- };
10
- }
11
- }
12
- export declare const command: RawCommands['command'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- createParagraphNear: {
5
- /**
6
- * Create a paragraph nearby.
7
- */
8
- createParagraphNear: () => Command;
9
- };
10
- }
11
- }
12
- export declare const createParagraphNear: RawCommands['createParagraphNear'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands, Range } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- deleteRange: {
5
- /**
6
- * Delete a given range.
7
- */
8
- deleteRange: (range: Range) => Command;
9
- };
10
- }
11
- }
12
- export declare const deleteRange: RawCommands['deleteRange'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- deleteSelection: {
5
- /**
6
- * Delete the selection, if there is one.
7
- */
8
- deleteSelection: () => Command;
9
- };
10
- }
11
- }
12
- export declare const deleteSelection: RawCommands['deleteSelection'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- enter: {
5
- /**
6
- * Trigger enter.
7
- */
8
- enter: () => Command;
9
- };
10
- }
11
- }
12
- export declare const enter: RawCommands['enter'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- exitCode: {
5
- /**
6
- * Exit from a code block.
7
- */
8
- exitCode: () => Command;
9
- };
10
- }
11
- }
12
- export declare const exitCode: RawCommands['exitCode'];
@@ -1,13 +0,0 @@
1
- import { MarkType } from 'prosemirror-model';
2
- import { Command, RawCommands } from '../types';
3
- declare module '@tiptap/core' {
4
- interface Commands {
5
- extendMarkRange: {
6
- /**
7
- * Extends the text selection to the current mark.
8
- */
9
- extendMarkRange: (typeOrName: string | MarkType) => Command;
10
- };
11
- }
12
- }
13
- export declare const extendMarkRange: RawCommands['extendMarkRange'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- first: {
5
- /**
6
- * Runs one command after the other and stops at the first which returns true.
7
- */
8
- first: (commands: Command[] | ((props: Parameters<Command>[0]) => Command[])) => Command;
9
- };
10
- }
11
- }
12
- export declare const first: RawCommands['first'];
@@ -1,12 +0,0 @@
1
- import { Command, RawCommands, FocusPosition } from '../types';
2
- declare module '@tiptap/core' {
3
- interface Commands {
4
- focus: {
5
- /**
6
- * Focus the editor at the given position.
7
- */
8
- focus: (position?: FocusPosition) => Command;
9
- };
10
- }
11
- }
12
- export declare const focus: RawCommands['focus'];