@tiptap/core 2.0.0-beta.14 → 2.0.0-beta.140

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 (272) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +2 -2
  3. package/dist/packages/core/src/CommandManager.d.ts +12 -5
  4. package/dist/packages/core/src/Editor.d.ts +19 -20
  5. package/dist/packages/core/src/EventEmitter.d.ts +8 -4
  6. package/dist/packages/core/src/Extension.d.ts +102 -26
  7. package/dist/packages/core/src/ExtensionManager.d.ts +6 -11
  8. package/dist/packages/core/src/InputRule.d.ts +42 -0
  9. package/dist/packages/core/src/Mark.d.ts +134 -30
  10. package/dist/packages/core/src/Node.d.ts +151 -32
  11. package/dist/packages/core/src/NodeView.d.ts +5 -9
  12. package/dist/packages/core/src/PasteRule.d.ts +42 -0
  13. package/dist/packages/core/src/Tracker.d.ts +11 -0
  14. package/dist/packages/core/src/commands/blur.d.ts +3 -3
  15. package/dist/packages/core/src/commands/clearContent.d.ts +3 -3
  16. package/dist/packages/core/src/commands/clearNodes.d.ts +3 -3
  17. package/dist/packages/core/src/commands/command.d.ts +2 -2
  18. package/dist/packages/core/src/commands/createParagraphNear.d.ts +3 -3
  19. package/dist/packages/core/src/commands/deleteNode.d.ts +13 -0
  20. package/dist/packages/core/src/commands/deleteRange.d.ts +3 -3
  21. package/dist/packages/core/src/commands/deleteSelection.d.ts +3 -3
  22. package/dist/packages/core/src/commands/enter.d.ts +3 -3
  23. package/dist/packages/core/src/commands/exitCode.d.ts +3 -3
  24. package/dist/packages/core/src/commands/extendMarkRange.d.ts +3 -3
  25. package/dist/packages/core/src/commands/first.d.ts +3 -3
  26. package/dist/packages/core/src/commands/focus.d.ts +3 -3
  27. package/dist/packages/core/src/commands/forEach.d.ts +14 -0
  28. package/dist/packages/core/src/commands/insertContent.d.ts +16 -0
  29. package/dist/packages/core/src/commands/insertContentAt.d.ts +16 -0
  30. package/dist/packages/core/src/commands/joinBackward.d.ts +3 -3
  31. package/dist/packages/core/src/commands/joinForward.d.ts +3 -3
  32. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +3 -3
  33. package/dist/packages/core/src/commands/lift.d.ts +3 -3
  34. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +3 -3
  35. package/dist/packages/core/src/commands/liftListItem.d.ts +3 -3
  36. package/dist/packages/core/src/commands/newlineInCode.d.ts +3 -3
  37. package/dist/packages/core/src/commands/resetAttributes.d.ts +13 -0
  38. package/dist/packages/core/src/commands/scrollIntoView.d.ts +3 -3
  39. package/dist/packages/core/src/commands/selectAll.d.ts +3 -3
  40. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +3 -3
  41. package/dist/packages/core/src/commands/selectNodeForward.d.ts +3 -3
  42. package/dist/packages/core/src/commands/selectParentNode.d.ts +3 -3
  43. package/dist/packages/core/src/commands/setContent.d.ts +4 -3
  44. package/dist/packages/core/src/commands/setMark.d.ts +3 -3
  45. package/dist/packages/core/src/commands/setMeta.d.ts +12 -0
  46. package/dist/packages/core/src/commands/setNode.d.ts +3 -3
  47. package/dist/packages/core/src/commands/setNodeSelection.d.ts +12 -0
  48. package/dist/packages/core/src/commands/setTextSelection.d.ts +12 -0
  49. package/dist/packages/core/src/commands/sinkListItem.d.ts +3 -3
  50. package/dist/packages/core/src/commands/splitBlock.d.ts +3 -3
  51. package/dist/packages/core/src/commands/splitListItem.d.ts +3 -3
  52. package/dist/packages/core/src/commands/toggleList.d.ts +3 -3
  53. package/dist/packages/core/src/commands/toggleMark.d.ts +8 -3
  54. package/dist/packages/core/src/commands/toggleNode.d.ts +3 -3
  55. package/dist/packages/core/src/commands/toggleWrap.d.ts +3 -3
  56. package/dist/packages/core/src/commands/undoInputRule.d.ts +3 -3
  57. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +3 -3
  58. package/dist/packages/core/src/commands/unsetMark.d.ts +8 -3
  59. package/dist/packages/core/src/commands/updateAttributes.d.ts +13 -0
  60. package/dist/packages/core/src/commands/wrapIn.d.ts +3 -3
  61. package/dist/packages/core/src/commands/wrapInList.d.ts +3 -3
  62. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +1 -1
  63. package/dist/packages/core/src/extensions/commands.d.ts +19 -15
  64. package/dist/packages/core/src/extensions/editable.d.ts +1 -1
  65. package/dist/packages/core/src/extensions/focusEvents.d.ts +1 -1
  66. package/dist/packages/core/src/extensions/index.d.ts +1 -0
  67. package/dist/packages/core/src/extensions/keymap.d.ts +1 -1
  68. package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
  69. package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
  70. package/dist/packages/core/src/helpers/createDocument.d.ts +3 -0
  71. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +7 -0
  72. package/dist/packages/core/src/helpers/findChildren.d.ts +3 -0
  73. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +6 -0
  74. package/dist/packages/core/src/helpers/generateHTML.d.ts +2 -2
  75. package/dist/packages/core/src/helpers/generateJSON.d.ts +2 -0
  76. package/dist/packages/core/src/helpers/generateText.d.ts +5 -0
  77. package/dist/packages/core/src/helpers/getAttributes.d.ts +3 -0
  78. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
  79. package/dist/packages/core/src/helpers/getExtensionField.d.ts +2 -0
  80. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -2
  81. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +1 -2
  82. package/dist/packages/core/src/helpers/getMarkRange.d.ts +1 -1
  83. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +1 -2
  84. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +2 -2
  85. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +3 -0
  86. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +2 -2
  87. package/dist/packages/core/src/helpers/getText.d.ts +6 -0
  88. package/dist/packages/core/src/helpers/getTextBetween.d.ts +6 -0
  89. package/dist/packages/core/src/helpers/getTextSeralizersFromSchema.d.ts +3 -0
  90. package/dist/packages/core/src/helpers/isActive.d.ts +1 -2
  91. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
  92. package/dist/packages/core/src/helpers/isMarkActive.d.ts +1 -2
  93. package/dist/packages/core/src/helpers/isNodeActive.d.ts +1 -2
  94. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
  95. package/dist/packages/core/src/helpers/splitExtensions.d.ts +3 -3
  96. package/dist/packages/core/src/index.d.ts +32 -5
  97. package/dist/packages/core/src/inputRules/markInputRule.d.ts +11 -2
  98. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +11 -2
  99. package/dist/packages/core/src/inputRules/textInputRule.d.ts +9 -0
  100. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +14 -0
  101. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +23 -0
  102. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +11 -2
  103. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
  104. package/dist/packages/core/src/style.d.ts +1 -1
  105. package/dist/packages/core/src/types.d.ts +104 -51
  106. package/dist/packages/core/src/utilities/callOrReturn.d.ts +2 -1
  107. package/dist/packages/core/src/utilities/deleteProps.d.ts +1 -2
  108. package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
  109. package/dist/packages/core/src/utilities/isClass.d.ts +1 -1
  110. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -1
  111. package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
  112. package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
  113. package/dist/packages/core/src/utilities/isObject.d.ts +1 -1
  114. package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -1
  115. package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
  116. package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
  117. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -2
  118. package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -2
  119. package/dist/packages/core/src/utilities/objectIncludes.d.ts +3 -2
  120. package/dist/tiptap-core.cjs.js +2695 -1451
  121. package/dist/tiptap-core.cjs.js.map +1 -1
  122. package/dist/tiptap-core.esm.js +3244 -2026
  123. package/dist/tiptap-core.esm.js.map +1 -1
  124. package/dist/tiptap-core.umd.js +3182 -1937
  125. package/dist/tiptap-core.umd.js.map +1 -1
  126. package/package.json +19 -16
  127. package/src/CommandManager.ts +59 -61
  128. package/src/Editor.ts +91 -95
  129. package/src/EventEmitter.ts +14 -4
  130. package/src/Extension.ts +202 -40
  131. package/src/ExtensionManager.ts +234 -70
  132. package/src/InputRule.ts +268 -0
  133. package/src/Mark.ts +248 -46
  134. package/src/Node.ts +275 -51
  135. package/src/NodeView.ts +105 -42
  136. package/src/PasteRule.ts +215 -0
  137. package/src/Tracker.ts +42 -0
  138. package/src/commands/blur.ts +9 -7
  139. package/src/commands/clearContent.ts +3 -3
  140. package/src/commands/clearNodes.ts +25 -19
  141. package/src/commands/command.ts +2 -2
  142. package/src/commands/createParagraphNear.ts +3 -3
  143. package/src/commands/deleteNode.ts +36 -0
  144. package/src/commands/deleteRange.ts +3 -3
  145. package/src/commands/deleteSelection.ts +3 -3
  146. package/src/commands/enter.ts +3 -3
  147. package/src/commands/exitCode.ts +3 -3
  148. package/src/commands/extendMarkRange.ts +8 -8
  149. package/src/commands/first.ts +3 -3
  150. package/src/commands/focus.ts +31 -9
  151. package/src/commands/forEach.ts +24 -0
  152. package/src/commands/insertContent.ts +23 -0
  153. package/src/commands/insertContentAt.ts +93 -0
  154. package/src/commands/joinBackward.ts +3 -3
  155. package/src/commands/joinForward.ts +3 -3
  156. package/src/commands/keyboardShortcut.ts +3 -3
  157. package/src/commands/lift.ts +3 -3
  158. package/src/commands/liftEmptyBlock.ts +3 -3
  159. package/src/commands/liftListItem.ts +3 -3
  160. package/src/commands/newlineInCode.ts +3 -3
  161. package/src/commands/resetAttributes.ts +61 -0
  162. package/src/commands/scrollIntoView.ts +3 -3
  163. package/src/commands/selectAll.ts +8 -6
  164. package/src/commands/selectNodeBackward.ts +3 -3
  165. package/src/commands/selectNodeForward.ts +3 -3
  166. package/src/commands/selectParentNode.ts +3 -3
  167. package/src/commands/setContent.ts +10 -5
  168. package/src/commands/setMark.ts +33 -10
  169. package/src/commands/setMeta.ts +18 -0
  170. package/src/commands/setNode.ts +3 -3
  171. package/src/commands/setNodeSelection.ts +28 -0
  172. package/src/commands/setTextSelection.ts +32 -0
  173. package/src/commands/sinkListItem.ts +3 -3
  174. package/src/commands/splitBlock.ts +13 -8
  175. package/src/commands/splitListItem.ts +39 -13
  176. package/src/commands/toggleList.ts +4 -4
  177. package/src/commands/toggleMark.ts +15 -5
  178. package/src/commands/toggleNode.ts +3 -3
  179. package/src/commands/toggleWrap.ts +3 -3
  180. package/src/commands/undoInputRule.ts +33 -5
  181. package/src/commands/unsetAllMarks.ts +3 -3
  182. package/src/commands/unsetMark.ts +32 -20
  183. package/src/commands/updateAttributes.ts +72 -0
  184. package/src/commands/wrapIn.ts +3 -3
  185. package/src/commands/wrapInList.ts +3 -3
  186. package/src/extensions/clipboardTextSerializer.ts +11 -35
  187. package/src/extensions/commands.ts +27 -21
  188. package/src/extensions/focusEvents.ts +0 -3
  189. package/src/extensions/index.ts +1 -0
  190. package/src/extensions/keymap.ts +6 -6
  191. package/src/extensions/tabindex.ts +19 -0
  192. package/src/helpers/createChainableState.ts +37 -0
  193. package/src/helpers/createDocument.ts +11 -0
  194. package/src/helpers/createNodeFromContent.ts +56 -0
  195. package/src/helpers/findChildren.ts +17 -0
  196. package/src/helpers/findChildrenInRange.ts +31 -0
  197. package/src/helpers/generateHTML.ts +3 -3
  198. package/src/helpers/generateJSON.ts +13 -0
  199. package/src/helpers/generateText.ts +29 -0
  200. package/src/helpers/getAttributes.ts +27 -0
  201. package/src/helpers/getAttributesFromExtensions.ts +26 -5
  202. package/src/helpers/getDebugJSON.ts +46 -0
  203. package/src/helpers/getExtensionField.ts +25 -0
  204. package/src/helpers/getHTMLFromFragment.ts +5 -5
  205. package/src/helpers/getMarkAttributes.ts +11 -8
  206. package/src/helpers/getMarkRange.ts +34 -6
  207. package/src/helpers/getMarkType.ts +4 -0
  208. package/src/helpers/getMarksBetween.ts +3 -3
  209. package/src/helpers/getNodeAttributes.ts +6 -7
  210. package/src/helpers/getNodeType.ts +4 -0
  211. package/src/helpers/getRenderedAttributes.ts +3 -5
  212. package/src/helpers/getSchema.ts +5 -132
  213. package/src/helpers/getSchemaByResolvedExtensions.ts +147 -0
  214. package/src/helpers/getSchemaTypeByName.ts +1 -9
  215. package/src/helpers/getSplittedAttributes.ts +3 -3
  216. package/src/helpers/getText.ts +18 -0
  217. package/src/helpers/getTextBetween.ts +45 -0
  218. package/src/helpers/getTextSeralizersFromSchema.ts +9 -0
  219. package/src/helpers/injectExtensionAttributesToParseRule.ts +12 -8
  220. package/src/helpers/isActive.ts +1 -2
  221. package/src/helpers/isExtensionRulesEnabled.ts +15 -0
  222. package/src/helpers/isList.ts +11 -4
  223. package/src/helpers/isMarkActive.ts +40 -16
  224. package/src/helpers/isNodeActive.ts +23 -31
  225. package/src/helpers/posToDOMRect.ts +34 -0
  226. package/src/index.ts +34 -5
  227. package/src/inputRules/markInputRule.ts +57 -38
  228. package/src/inputRules/nodeInputRule.ts +43 -11
  229. package/src/inputRules/textInputRule.ts +35 -0
  230. package/src/inputRules/textblockTypeInputRule.ts +37 -0
  231. package/src/inputRules/wrappingInputRule.ts +59 -0
  232. package/src/pasteRules/markPasteRule.ts +61 -53
  233. package/src/pasteRules/textPasteRule.ts +35 -0
  234. package/src/style.ts +14 -0
  235. package/src/types.ts +118 -36
  236. package/src/utilities/callOrReturn.ts +6 -3
  237. package/src/utilities/createStyleTag.ts +7 -0
  238. package/src/utilities/deleteProps.ts +2 -4
  239. package/src/utilities/elementFromString.ts +3 -4
  240. package/src/utilities/findDuplicates.ts +5 -0
  241. package/src/utilities/fromString.ts +1 -1
  242. package/src/utilities/isClass.ts +2 -2
  243. package/src/utilities/isEmptyObject.ts +2 -2
  244. package/src/utilities/isFunction.ts +3 -0
  245. package/src/utilities/isNumber.ts +3 -0
  246. package/src/utilities/isObject.ts +5 -5
  247. package/src/utilities/isPlainObject.ts +5 -5
  248. package/src/utilities/isRegExp.ts +3 -0
  249. package/src/utilities/isString.ts +3 -0
  250. package/src/utilities/isiOS.ts +12 -0
  251. package/src/utilities/mergeAttributes.ts +2 -3
  252. package/src/utilities/mergeDeep.ts +1 -2
  253. package/src/utilities/objectIncludes.ts +17 -5
  254. package/CHANGELOG.md +0 -294
  255. package/dist/packages/core/src/commands/insertHTML.d.ts +0 -12
  256. package/dist/packages/core/src/commands/insertNode.d.ts +0 -13
  257. package/dist/packages/core/src/commands/insertText.d.ts +0 -12
  258. package/dist/packages/core/src/commands/replace.d.ts +0 -13
  259. package/dist/packages/core/src/commands/replaceRange.d.ts +0 -13
  260. package/dist/packages/core/src/commands/resetNodeAttributes.d.ts +0 -13
  261. package/dist/packages/core/src/commands/updateNodeAttributes.d.ts +0 -13
  262. package/dist/packages/core/src/utilities/removeElement.d.ts +0 -1
  263. package/dist/tiptap-core.bundle.umd.min.js +0 -17
  264. package/dist/tiptap-core.bundle.umd.min.js.map +0 -1
  265. package/src/commands/insertHTML.ts +0 -28
  266. package/src/commands/insertNode.ts +0 -31
  267. package/src/commands/insertText.ts +0 -20
  268. package/src/commands/replace.ts +0 -20
  269. package/src/commands/replaceRange.ts +0 -36
  270. package/src/commands/resetNodeAttributes.ts +0 -31
  271. package/src/commands/updateNodeAttributes.ts +0 -33
  272. package/src/utilities/removeElement.ts +0 -5
@@ -4,6 +4,7 @@ import * as clearContent from '../commands/clearContent';
4
4
  import * as clearNodes from '../commands/clearNodes';
5
5
  import * as command from '../commands/command';
6
6
  import * as createParagraphNear from '../commands/createParagraphNear';
7
+ import * as deleteNode from '../commands/deleteNode';
7
8
  import * as deleteRange from '../commands/deleteRange';
8
9
  import * as deleteSelection from '../commands/deleteSelection';
9
10
  import * as enter from '../commands/enter';
@@ -11,9 +12,9 @@ import * as exitCode from '../commands/exitCode';
11
12
  import * as extendMarkRange from '../commands/extendMarkRange';
12
13
  import * as first from '../commands/first';
13
14
  import * as focus from '../commands/focus';
14
- import * as insertHTML from '../commands/insertHTML';
15
- import * as insertNode from '../commands/insertNode';
16
- import * as insertText from '../commands/insertText';
15
+ import * as forEach from '../commands/forEach';
16
+ import * as insertContent from '../commands/insertContent';
17
+ import * as insertContentAt from '../commands/insertContentAt';
17
18
  import * as joinBackward from '../commands/joinBackward';
18
19
  import * as joinForward from '../commands/joinForward';
19
20
  import * as keyboardShortcut from '../commands/keyboardShortcut';
@@ -21,9 +22,7 @@ import * as lift from '../commands/lift';
21
22
  import * as liftEmptyBlock from '../commands/liftEmptyBlock';
22
23
  import * as liftListItem from '../commands/liftListItem';
23
24
  import * as newlineInCode from '../commands/newlineInCode';
24
- import * as replace from '../commands/replace';
25
- import * as replaceRange from '../commands/replaceRange';
26
- import * as resetNodeAttributes from '../commands/resetNodeAttributes';
25
+ import * as resetAttributes from '../commands/resetAttributes';
27
26
  import * as scrollIntoView from '../commands/scrollIntoView';
28
27
  import * as selectAll from '../commands/selectAll';
29
28
  import * as selectNodeBackward from '../commands/selectNodeBackward';
@@ -31,7 +30,10 @@ import * as selectNodeForward from '../commands/selectNodeForward';
31
30
  import * as selectParentNode from '../commands/selectParentNode';
32
31
  import * as setContent from '../commands/setContent';
33
32
  import * as setMark from '../commands/setMark';
33
+ import * as setMeta from '../commands/setMeta';
34
34
  import * as setNode from '../commands/setNode';
35
+ import * as setNodeSelection from '../commands/setNodeSelection';
36
+ import * as setTextSelection from '../commands/setTextSelection';
35
37
  import * as sinkListItem from '../commands/sinkListItem';
36
38
  import * as splitBlock from '../commands/splitBlock';
37
39
  import * as splitListItem from '../commands/splitListItem';
@@ -42,7 +44,7 @@ import * as toggleWrap from '../commands/toggleWrap';
42
44
  import * as undoInputRule from '../commands/undoInputRule';
43
45
  import * as unsetAllMarks from '../commands/unsetAllMarks';
44
46
  import * as unsetMark from '../commands/unsetMark';
45
- import * as updateNodeAttributes from '../commands/updateNodeAttributes';
47
+ import * as updateAttributes from '../commands/updateAttributes';
46
48
  import * as wrapIn from '../commands/wrapIn';
47
49
  import * as wrapInList from '../commands/wrapInList';
48
50
  export { blur };
@@ -50,6 +52,7 @@ export { clearContent };
50
52
  export { clearNodes };
51
53
  export { command };
52
54
  export { createParagraphNear };
55
+ export { deleteNode };
53
56
  export { deleteRange };
54
57
  export { deleteSelection };
55
58
  export { enter };
@@ -57,9 +60,9 @@ export { exitCode };
57
60
  export { extendMarkRange };
58
61
  export { first };
59
62
  export { focus };
60
- export { insertHTML };
61
- export { insertNode };
62
- export { insertText };
63
+ export { forEach };
64
+ export { insertContent };
65
+ export { insertContentAt };
63
66
  export { joinBackward };
64
67
  export { joinForward };
65
68
  export { keyboardShortcut };
@@ -67,9 +70,7 @@ export { lift };
67
70
  export { liftEmptyBlock };
68
71
  export { liftListItem };
69
72
  export { newlineInCode };
70
- export { replace };
71
- export { replaceRange };
72
- export { resetNodeAttributes };
73
+ export { resetAttributes };
73
74
  export { scrollIntoView };
74
75
  export { selectAll };
75
76
  export { selectNodeBackward };
@@ -77,7 +78,10 @@ export { selectNodeForward };
77
78
  export { selectParentNode };
78
79
  export { setContent };
79
80
  export { setMark };
81
+ export { setMeta };
80
82
  export { setNode };
83
+ export { setNodeSelection };
84
+ export { setTextSelection };
81
85
  export { sinkListItem };
82
86
  export { splitBlock };
83
87
  export { splitListItem };
@@ -88,7 +92,7 @@ export { toggleWrap };
88
92
  export { undoInputRule };
89
93
  export { unsetAllMarks };
90
94
  export { unsetMark };
91
- export { updateNodeAttributes };
95
+ export { updateAttributes };
92
96
  export { wrapIn };
93
97
  export { wrapInList };
94
- export declare const Commands: Extension<unknown>;
98
+ export declare const Commands: Extension<any, any>;
@@ -1,2 +1,2 @@
1
1
  import { Extension } from '../Extension';
2
- export declare const Editable: Extension<unknown>;
2
+ export declare const Editable: Extension<any, any>;
@@ -1,2 +1,2 @@
1
1
  import { Extension } from '../Extension';
2
- export declare const FocusEvents: Extension<unknown>;
2
+ export declare const FocusEvents: Extension<any, any>;
@@ -3,3 +3,4 @@ export { Commands } from './commands';
3
3
  export { Editable } from './editable';
4
4
  export { FocusEvents } from './focusEvents';
5
5
  export { Keymap } from './keymap';
6
+ export { Tabindex } from './tabindex';
@@ -1,2 +1,2 @@
1
1
  import { Extension } from '../Extension';
2
- export declare const Keymap: Extension<unknown>;
2
+ export declare const Keymap: Extension<any, any>;
@@ -0,0 +1,2 @@
1
+ import { Extension } from '../Extension';
2
+ export declare const Tabindex: Extension<any, any>;
@@ -0,0 +1,5 @@
1
+ import { EditorState, Transaction } from 'prosemirror-state';
2
+ export default function createChainableState(config: {
3
+ transaction: Transaction;
4
+ state: EditorState;
5
+ }): EditorState;
@@ -0,0 +1,3 @@
1
+ import { Schema, Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model';
2
+ import { Content } from '../types';
3
+ export default function createDocument(content: Content, schema: Schema, parseOptions?: ParseOptions): ProseMirrorNode;
@@ -0,0 +1,7 @@
1
+ import { Schema, Node as ProseMirrorNode, Fragment, ParseOptions } from 'prosemirror-model';
2
+ import { Content } from '../types';
3
+ export declare type CreateNodeFromContentOptions = {
4
+ slice?: boolean;
5
+ parseOptions?: ParseOptions;
6
+ };
7
+ export default function createNodeFromContent(content: Content, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode | Fragment;
@@ -0,0 +1,3 @@
1
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
2
+ import { Predicate, NodeWithPos } from '../types';
3
+ export default function findChildren(node: ProseMirrorNode, predicate: Predicate): NodeWithPos[];
@@ -0,0 +1,6 @@
1
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
2
+ import { Predicate, Range, NodeWithPos } from '../types';
3
+ /**
4
+ * Same as `findChildren` but searches only within a `range`.
5
+ */
6
+ export default function findChildrenInRange(node: ProseMirrorNode, range: Range, predicate: Predicate): NodeWithPos[];
@@ -1,2 +1,2 @@
1
- import { Extensions } from '../types';
2
- export default function generateHTML(doc: object, extensions: Extensions): string;
1
+ import { Extensions, JSONContent } from '../types';
2
+ export default function generateHTML(doc: JSONContent, extensions: Extensions): string;
@@ -0,0 +1,2 @@
1
+ import { Extensions } from '../types';
2
+ export default function generateJSON(html: string, extensions: Extensions): Record<string, any>;
@@ -0,0 +1,5 @@
1
+ import { Extensions, JSONContent, TextSerializer } from '../types';
2
+ export default function generateText(doc: JSONContent, extensions: Extensions, options?: {
3
+ blockSeparator?: string;
4
+ textSerializers?: Record<string, TextSerializer>;
5
+ }): string;
@@ -0,0 +1,3 @@
1
+ import { MarkType, NodeType } from 'prosemirror-model';
2
+ import { EditorState } from 'prosemirror-state';
3
+ export default function getAttributes(state: EditorState, typeOrName: string | NodeType | MarkType): Record<string, any>;
@@ -0,0 +1,8 @@
1
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
2
+ import { JSONContent } from '../types';
3
+ interface DebugJSONContent extends JSONContent {
4
+ from: number;
5
+ to: number;
6
+ }
7
+ export default function getDebugJSON(node: ProseMirrorNode, startOffset?: number): DebugJSONContent;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { AnyExtension, RemoveThis, MaybeThisParameterType } from '../types';
2
+ export default function getExtensionField<T = any>(extension: AnyExtension, field: string, context?: Omit<MaybeThisParameterType<T>, 'parent'>): RemoveThis<T>;
@@ -1,2 +1,2 @@
1
- import { Node, Schema } from 'prosemirror-model';
2
- export default function getHTMLFromFragment(doc: Node, schema: Schema): string;
1
+ import { Schema, Fragment } from 'prosemirror-model';
2
+ export default function getHTMLFromFragment(fragment: Fragment, schema: Schema): string;
@@ -1,4 +1,3 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
2
  import { MarkType } from 'prosemirror-model';
3
- import { AnyObject } from '../types';
4
- export default function getMarkAttributes(state: EditorState, typeOrName: string | MarkType): AnyObject;
3
+ export default function getMarkAttributes(state: EditorState, typeOrName: string | MarkType): Record<string, any>;
@@ -1,3 +1,3 @@
1
1
  import { MarkType, ResolvedPos } from 'prosemirror-model';
2
2
  import { Range } from '../types';
3
- export default function getMarkRange($pos: ResolvedPos, type: MarkType): Range | void;
3
+ export default function getMarkRange($pos: ResolvedPos, type: MarkType, attributes?: Record<string, any>): Range | void;
@@ -1,4 +1,3 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
2
  import { NodeType } from 'prosemirror-model';
3
- import { AnyObject } from '../types';
4
- export default function getNodeAttributes(state: EditorState, typeOrName: string | NodeType): AnyObject;
3
+ export default function getNodeAttributes(state: EditorState, typeOrName: string | NodeType): Record<string, any>;
@@ -1,3 +1,3 @@
1
1
  import { Node, Mark } from 'prosemirror-model';
2
- import { ExtensionAttribute, AnyObject } from '../types';
3
- export default function getRenderedAttributes(nodeOrMark: Node | Mark, extensionAttributes: ExtensionAttribute[]): AnyObject;
2
+ import { ExtensionAttribute } from '../types';
3
+ export default function getRenderedAttributes(nodeOrMark: Node | Mark, extensionAttributes: ExtensionAttribute[]): Record<string, any>;
@@ -0,0 +1,3 @@
1
+ import { Schema } from 'prosemirror-model';
2
+ import { Extensions } from '../types';
3
+ export default function getSchemaByResolvedExtensions(extensions: Extensions): Schema;
@@ -1,2 +1,2 @@
1
- import { AnyObject, ExtensionAttribute } from '../types';
2
- export default function getSplittedAttributes(extensionAttributes: ExtensionAttribute[], typeName: string, attributes: AnyObject): AnyObject;
1
+ import { ExtensionAttribute } from '../types';
2
+ export default function getSplittedAttributes(extensionAttributes: ExtensionAttribute[], typeName: string, attributes: Record<string, any>): Record<string, any>;
@@ -0,0 +1,6 @@
1
+ import { TextSerializer } from '../types';
2
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
3
+ export default function getText(node: ProseMirrorNode, options?: {
4
+ blockSeparator?: string;
5
+ textSerializers?: Record<string, TextSerializer>;
6
+ }): string;
@@ -0,0 +1,6 @@
1
+ import { Range, TextSerializer } from '../types';
2
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
3
+ export default function getTextBetween(startNode: ProseMirrorNode, range: Range, options?: {
4
+ blockSeparator?: string;
5
+ textSerializers?: Record<string, TextSerializer>;
6
+ }): string;
@@ -0,0 +1,3 @@
1
+ import { Schema } from 'prosemirror-model';
2
+ import { TextSerializer } from '../types';
3
+ export default function getTextSeralizersFromSchema(schema: Schema): Record<string, TextSerializer>;
@@ -1,3 +1,2 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
- import { AnyObject } from '../types';
3
- export default function isActive(state: EditorState, name: string | null, attributes?: AnyObject): boolean;
2
+ export default function isActive(state: EditorState, name: string | null, attributes?: Record<string, any>): boolean;
@@ -0,0 +1,2 @@
1
+ import { AnyExtension, EnableRules } from '../types';
2
+ export default function isExtensionRulesEnabled(extension: AnyExtension, enabled: EnableRules): boolean;
@@ -1,4 +1,3 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
2
  import { MarkType } from 'prosemirror-model';
3
- import { AnyObject } from '../types';
4
- export default function isMarkActive(state: EditorState, typeOrName: MarkType | string | null, attributes?: AnyObject): boolean;
3
+ export default function isMarkActive(state: EditorState, typeOrName: MarkType | string | null, attributes?: Record<string, any>): boolean;
@@ -1,4 +1,3 @@
1
1
  import { EditorState } from 'prosemirror-state';
2
2
  import { NodeType } from 'prosemirror-model';
3
- import { AnyObject } from '../types';
4
- export default function isNodeActive(state: EditorState, typeOrName: NodeType | string | null, attributes?: AnyObject): boolean;
3
+ export default function isNodeActive(state: EditorState, typeOrName: NodeType | string | null, attributes?: Record<string, any>): boolean;
@@ -0,0 +1,2 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ export default function posToDOMRect(view: EditorView, from: number, to: number): DOMRect;
@@ -3,7 +3,7 @@ import { Extension } from '../Extension';
3
3
  import { Node } from '../Node';
4
4
  import { Mark } from '../Mark';
5
5
  export default function splitExtensions(extensions: Extensions): {
6
- baseExtensions: Extension<any>[];
7
- nodeExtensions: Node<any>[];
8
- markExtensions: Mark<any>[];
6
+ baseExtensions: Extension<any, any>[];
7
+ nodeExtensions: Node<any, any>[];
8
+ markExtensions: Mark<any, any>[];
9
9
  };
@@ -1,30 +1,57 @@
1
+ import * as extensions from './extensions';
2
+ export { extensions };
1
3
  export * from './Editor';
2
4
  export * from './Extension';
3
5
  export * from './Node';
4
6
  export * from './Mark';
5
7
  export * from './NodeView';
8
+ export * from './Tracker';
9
+ export * from './InputRule';
10
+ export * from './PasteRule';
11
+ export * from './CommandManager';
6
12
  export * from './types';
7
13
  export { default as nodeInputRule } from './inputRules/nodeInputRule';
8
14
  export { default as markInputRule } from './inputRules/markInputRule';
15
+ export { default as textblockTypeInputRule } from './inputRules/textblockTypeInputRule';
16
+ export { default as textInputRule } from './inputRules/textInputRule';
17
+ export { default as wrappingInputRule } from './inputRules/wrappingInputRule';
9
18
  export { default as markPasteRule } from './pasteRules/markPasteRule';
19
+ export { default as textPasteRule } from './pasteRules/textPasteRule';
10
20
  export { default as callOrReturn } from './utilities/callOrReturn';
11
21
  export { default as mergeAttributes } from './utilities/mergeAttributes';
22
+ export { default as getExtensionField } from './helpers/getExtensionField';
23
+ export { default as findChildren } from './helpers/findChildren';
24
+ export { default as findChildrenInRange } from './helpers/findChildrenInRange';
25
+ export { default as findParentNode } from './helpers/findParentNode';
26
+ export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos';
12
27
  export { default as generateHTML } from './helpers/generateHTML';
28
+ export { default as generateJSON } from './helpers/generateJSON';
29
+ export { default as generateText } from './helpers/generateText';
13
30
  export { default as getSchema } from './helpers/getSchema';
14
31
  export { default as getHTMLFromFragment } from './helpers/getHTMLFromFragment';
32
+ export { default as getDebugJSON } from './helpers/getDebugJSON';
33
+ export { default as getAttributes } from './helpers/getAttributes';
15
34
  export { default as getMarkAttributes } from './helpers/getMarkAttributes';
35
+ export { default as getMarkRange } from './helpers/getMarkRange';
36
+ export { default as getMarkType } from './helpers/getMarkType';
37
+ export { default as getMarksBetween } from './helpers/getMarksBetween';
38
+ export { default as getNodeAttributes } from './helpers/getNodeAttributes';
39
+ export { default as getNodeType } from './helpers/getNodeType';
40
+ export { default as getText } from './helpers/getText';
41
+ export { default as getTextBetween } from './helpers/getTextBetween';
16
42
  export { default as isActive } from './helpers/isActive';
43
+ export { default as isList } from './helpers/isList';
17
44
  export { default as isMarkActive } from './helpers/isMarkActive';
18
45
  export { default as isNodeActive } from './helpers/isNodeActive';
19
46
  export { default as isNodeEmpty } from './helpers/isNodeEmpty';
20
47
  export { default as isNodeSelection } from './helpers/isNodeSelection';
21
48
  export { default as isTextSelection } from './helpers/isTextSelection';
22
- export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos';
23
- export interface Commands {
49
+ export { default as posToDOMRect } from './helpers/posToDOMRect';
50
+ export interface Commands<ReturnType = any> {
24
51
  }
25
- export interface ExtensionConfig<Options = any> {
52
+ export interface ExtensionConfig<Options = any, Storage = any> {
26
53
  }
27
- export interface NodeConfig<Options = any> {
54
+ export interface NodeConfig<Options = any, Storage = any> {
28
55
  }
29
- export interface MarkConfig<Options = any> {
56
+ export interface MarkConfig<Options = any, Storage = any> {
30
57
  }
@@ -1,3 +1,12 @@
1
- import { InputRule } from 'prosemirror-inputrules';
1
+ import { InputRule, InputRuleFinder } from '../InputRule';
2
2
  import { MarkType } from 'prosemirror-model';
3
- export default function (regexp: RegExp, markType: MarkType, getAttributes?: Function): InputRule;
3
+ import { ExtendedRegExpMatchArray } from '../types';
4
+ /**
5
+ * Build an input rule that adds a mark when the
6
+ * matched text is typed into it.
7
+ */
8
+ export default function markInputRule(config: {
9
+ find: InputRuleFinder;
10
+ type: MarkType;
11
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
12
+ }): InputRule;
@@ -1,3 +1,12 @@
1
- import { InputRule } from 'prosemirror-inputrules';
2
1
  import { NodeType } from 'prosemirror-model';
3
- export default function (regexp: RegExp, type: NodeType, getAttributes?: (match: any) => any): InputRule;
2
+ import { InputRule, InputRuleFinder } from '../InputRule';
3
+ import { ExtendedRegExpMatchArray } from '../types';
4
+ /**
5
+ * Build an input rule that adds a node when the
6
+ * matched text is typed into it.
7
+ */
8
+ export default function nodeInputRule(config: {
9
+ find: InputRuleFinder;
10
+ type: NodeType;
11
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
12
+ }): InputRule;
@@ -0,0 +1,9 @@
1
+ import { InputRule, InputRuleFinder } from '../InputRule';
2
+ /**
3
+ * Build an input rule that replaces text when the
4
+ * matched text is typed into it.
5
+ */
6
+ export default function textInputRule(config: {
7
+ find: InputRuleFinder;
8
+ replace: string;
9
+ }): InputRule;
@@ -0,0 +1,14 @@
1
+ import { InputRule, InputRuleFinder } from '../InputRule';
2
+ import { NodeType } from 'prosemirror-model';
3
+ import { ExtendedRegExpMatchArray } from '../types';
4
+ /**
5
+ * Build an input rule that changes the type of a textblock when the
6
+ * matched text is typed into it. When using a regular expresion you’ll
7
+ * probably want the regexp to start with `^`, so that the pattern can
8
+ * only occur at the start of a textblock.
9
+ */
10
+ export default function textblockTypeInputRule(config: {
11
+ find: InputRuleFinder;
12
+ type: NodeType;
13
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
14
+ }): InputRule;
@@ -0,0 +1,23 @@
1
+ import { InputRule, InputRuleFinder } from '../InputRule';
2
+ import { NodeType, Node as ProseMirrorNode } from 'prosemirror-model';
3
+ import { ExtendedRegExpMatchArray } from '../types';
4
+ /**
5
+ * Build an input rule for automatically wrapping a textblock when a
6
+ * given string is typed. When using a regular expresion you’ll
7
+ * probably want the regexp to start with `^`, so that the pattern can
8
+ * only occur at the start of a textblock.
9
+ *
10
+ * `type` is the type of node to wrap in.
11
+ *
12
+ * By default, if there’s a node with the same type above the newly
13
+ * wrapped node, the rule will try to join those
14
+ * two nodes. You can pass a join predicate, which takes a regular
15
+ * expression match and the node before the wrapped node, and can
16
+ * return a boolean to indicate whether a join should happen.
17
+ */
18
+ export default function wrappingInputRule(config: {
19
+ find: InputRuleFinder;
20
+ type: NodeType;
21
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
22
+ joinPredicate?: (match: ExtendedRegExpMatchArray, node: ProseMirrorNode) => boolean;
23
+ }): InputRule;
@@ -1,3 +1,12 @@
1
- import { Plugin } from 'prosemirror-state';
1
+ import { PasteRule, PasteRuleFinder } from '../PasteRule';
2
2
  import { MarkType } from 'prosemirror-model';
3
- export default function (regexp: RegExp, type: MarkType, getAttrs?: (match: any) => any): Plugin;
3
+ import { ExtendedRegExpMatchArray } from '../types';
4
+ /**
5
+ * Build an paste rule that adds a mark when the
6
+ * matched text is pasted into it.
7
+ */
8
+ export default function markPasteRule(config: {
9
+ find: PasteRuleFinder;
10
+ type: MarkType;
11
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
12
+ }): PasteRule;
@@ -0,0 +1,9 @@
1
+ import { PasteRule, PasteRuleFinder } from '../PasteRule';
2
+ /**
3
+ * Build an paste rule that replaces text when the
4
+ * matched text is pasted into it.
5
+ */
6
+ export default function textPasteRule(config: {
7
+ find: PasteRuleFinder;
8
+ replace: string;
9
+ }): PasteRule;
@@ -1,2 +1,2 @@
1
- declare const style = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}";
1
+ declare const style = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 1px !important;\n height: 1px !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}";
2
2
  export default style;