@tiptap/core 2.11.6 → 3.0.0-beta.0

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 (499) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +5 -1
  3. package/dist/index.cjs +5046 -5069
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +3326 -0
  6. package/dist/index.d.ts +3326 -25
  7. package/dist/index.js +4930 -4975
  8. package/dist/index.js.map +1 -1
  9. package/dist/jsx-runtime/jsx-runtime.cjs +56 -0
  10. package/dist/jsx-runtime/jsx-runtime.cjs.map +1 -0
  11. package/dist/jsx-runtime/jsx-runtime.d.cts +22 -0
  12. package/dist/jsx-runtime/jsx-runtime.d.ts +22 -0
  13. package/dist/jsx-runtime/jsx-runtime.js +26 -0
  14. package/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  15. package/jsx-runtime/index.cjs +1 -0
  16. package/jsx-runtime/index.d.cts +1 -0
  17. package/jsx-runtime/index.d.ts +1 -0
  18. package/jsx-runtime/index.js +1 -0
  19. package/package.json +28 -9
  20. package/src/CommandManager.ts +4 -11
  21. package/src/Editor.ts +219 -103
  22. package/src/EventEmitter.ts +7 -10
  23. package/src/Extendable.ts +484 -0
  24. package/src/Extension.ts +17 -492
  25. package/src/ExtensionManager.ts +88 -140
  26. package/src/InputRule.ts +40 -51
  27. package/src/Mark.ts +146 -623
  28. package/src/MarkView.ts +66 -0
  29. package/src/Node.ts +332 -825
  30. package/src/NodePos.ts +3 -5
  31. package/src/NodeView.ts +13 -23
  32. package/src/PasteRule.ts +46 -56
  33. package/src/Tracker.ts +8 -10
  34. package/src/commands/blur.ts +15 -13
  35. package/src/commands/clearContent.ts +13 -6
  36. package/src/commands/clearNodes.ts +33 -31
  37. package/src/commands/command.ts +2 -2
  38. package/src/commands/createParagraphNear.ts +6 -4
  39. package/src/commands/cut.ts +13 -11
  40. package/src/commands/deleteCurrentNode.ts +24 -22
  41. package/src/commands/deleteNode.ts +20 -18
  42. package/src/commands/deleteRange.ts +11 -9
  43. package/src/commands/deleteSelection.ts +6 -4
  44. package/src/commands/enter.ts +7 -5
  45. package/src/commands/exitCode.ts +6 -4
  46. package/src/commands/extendMarkRange.ts +16 -14
  47. package/src/commands/first.ts +3 -5
  48. package/src/commands/focus.ts +50 -53
  49. package/src/commands/forEach.ts +3 -3
  50. package/src/commands/insertContent.ts +14 -16
  51. package/src/commands/insertContentAt.ts +111 -95
  52. package/src/commands/join.ts +21 -13
  53. package/src/commands/joinItemBackward.ts +17 -19
  54. package/src/commands/joinItemForward.ts +17 -19
  55. package/src/commands/joinTextblockBackward.ts +6 -4
  56. package/src/commands/joinTextblockForward.ts +6 -4
  57. package/src/commands/keyboardShortcut.ts +30 -35
  58. package/src/commands/lift.ts +12 -10
  59. package/src/commands/liftEmptyBlock.ts +7 -5
  60. package/src/commands/liftListItem.ts +8 -6
  61. package/src/commands/newlineInCode.ts +6 -4
  62. package/src/commands/resetAttributes.ts +38 -43
  63. package/src/commands/scrollIntoView.ts +10 -8
  64. package/src/commands/selectAll.ts +11 -9
  65. package/src/commands/selectNodeBackward.ts +6 -4
  66. package/src/commands/selectNodeForward.ts +6 -4
  67. package/src/commands/selectParentNode.ts +6 -4
  68. package/src/commands/selectTextblockEnd.ts +6 -4
  69. package/src/commands/selectTextblockStart.ts +6 -4
  70. package/src/commands/setContent.ts +39 -38
  71. package/src/commands/setMark.ts +58 -60
  72. package/src/commands/setMeta.ts +8 -6
  73. package/src/commands/setNode.ts +34 -32
  74. package/src/commands/setNodeSelection.ts +12 -10
  75. package/src/commands/setTextSelection.ts +16 -14
  76. package/src/commands/sinkListItem.ts +8 -6
  77. package/src/commands/splitBlock.ts +70 -78
  78. package/src/commands/splitListItem.ts +95 -107
  79. package/src/commands/toggleList.ts +76 -74
  80. package/src/commands/toggleMark.ts +13 -11
  81. package/src/commands/toggleNode.ts +20 -18
  82. package/src/commands/toggleWrap.ts +12 -10
  83. package/src/commands/undoInputRule.ts +32 -30
  84. package/src/commands/unsetAllMarks.ts +17 -15
  85. package/src/commands/unsetMark.ts +29 -27
  86. package/src/commands/updateAttributes.ts +94 -102
  87. package/src/commands/wrapIn.ts +8 -6
  88. package/src/commands/wrapInList.ts +8 -6
  89. package/src/extensions/clipboardTextSerializer.ts +2 -4
  90. package/src/extensions/delete.ts +89 -0
  91. package/src/extensions/focusEvents.ts +2 -6
  92. package/src/extensions/index.ts +1 -0
  93. package/src/extensions/keymap.ts +54 -50
  94. package/src/extensions/paste.ts +0 -1
  95. package/src/extensions/tabindex.ts +1 -1
  96. package/src/helpers/combineTransactionSteps.ts +3 -6
  97. package/src/helpers/createChainableState.ts +2 -5
  98. package/src/helpers/createDocument.ts +2 -4
  99. package/src/helpers/createNodeFromContent.ts +7 -12
  100. package/src/helpers/defaultBlockAt.ts +1 -1
  101. package/src/helpers/findChildren.ts +2 -2
  102. package/src/helpers/findChildrenInRange.ts +3 -7
  103. package/src/helpers/findParentNode.ts +5 -3
  104. package/src/helpers/findParentNodeClosestToPos.ts +2 -2
  105. package/src/helpers/flattenExtensions.ts +30 -0
  106. package/src/helpers/generateHTML.ts +1 -1
  107. package/src/helpers/generateJSON.ts +1 -1
  108. package/src/helpers/generateText.ts +1 -1
  109. package/src/helpers/getAttributes.ts +3 -6
  110. package/src/helpers/getAttributesFromExtensions.ts +29 -38
  111. package/src/helpers/getChangedRanges.ts +15 -13
  112. package/src/helpers/getDebugJSON.ts +2 -2
  113. package/src/helpers/getExtensionField.ts +12 -12
  114. package/src/helpers/getHTMLFromFragment.ts +2 -1
  115. package/src/helpers/getMarkAttributes.ts +3 -6
  116. package/src/helpers/getMarkRange.ts +7 -17
  117. package/src/helpers/getMarkType.ts +2 -4
  118. package/src/helpers/getMarksBetween.ts +2 -2
  119. package/src/helpers/getNodeAtPosition.ts +2 -2
  120. package/src/helpers/getNodeAttributes.ts +3 -6
  121. package/src/helpers/getNodeType.ts +2 -4
  122. package/src/helpers/getRenderedAttributes.ts +3 -5
  123. package/src/helpers/getSchema.ts +5 -5
  124. package/src/helpers/getSchemaByResolvedExtensions.ts +47 -78
  125. package/src/helpers/getSchemaTypeByName.ts +1 -1
  126. package/src/helpers/getSchemaTypeNameByName.ts +1 -1
  127. package/src/helpers/getSplittedAttributes.ts +5 -5
  128. package/src/helpers/getText.ts +2 -2
  129. package/src/helpers/getTextBetween.ts +2 -2
  130. package/src/helpers/getTextContentFromNodes.ts +9 -12
  131. package/src/helpers/getTextSerializersFromSchema.ts +2 -2
  132. package/src/helpers/index.ts +3 -0
  133. package/src/helpers/injectExtensionAttributesToParseRule.ts +3 -3
  134. package/src/helpers/isActive.ts +2 -6
  135. package/src/helpers/isAtEndOfNode.ts +1 -1
  136. package/src/helpers/isAtStartOfNode.ts +1 -1
  137. package/src/helpers/isExtensionRulesEnabled.ts +2 -4
  138. package/src/helpers/isList.ts +2 -2
  139. package/src/helpers/isMarkActive.ts +3 -3
  140. package/src/helpers/isNodeActive.ts +3 -3
  141. package/src/helpers/isNodeEmpty.ts +3 -3
  142. package/src/helpers/posToDOMRect.ts +1 -1
  143. package/src/helpers/resolveExtensions.ts +25 -0
  144. package/src/helpers/resolveFocusPosition.ts +5 -16
  145. package/src/helpers/rewriteUnknownContent.ts +25 -24
  146. package/src/helpers/selectionToInsertionEnd.ts +2 -1
  147. package/src/helpers/sortExtensions.ts +26 -0
  148. package/src/helpers/splitExtensions.ts +4 -4
  149. package/src/index.ts +3 -7
  150. package/src/inputRules/markInputRule.ts +5 -8
  151. package/src/inputRules/nodeInputRule.ts +6 -12
  152. package/src/inputRules/textInputRule.ts +3 -5
  153. package/src/inputRules/textblockTypeInputRule.ts +6 -11
  154. package/src/inputRules/wrappingInputRule.ts +18 -23
  155. package/src/jsx-runtime.ts +64 -0
  156. package/src/pasteRules/markPasteRule.ts +5 -6
  157. package/src/pasteRules/nodePasteRule.ts +6 -11
  158. package/src/pasteRules/textPasteRule.ts +3 -5
  159. package/src/style.ts +0 -4
  160. package/src/types.ts +534 -179
  161. package/src/utilities/callOrReturn.ts +1 -1
  162. package/src/utilities/createStyleTag.ts +3 -1
  163. package/src/utilities/deleteProps.ts +7 -11
  164. package/src/utilities/elementFromString.ts +3 -0
  165. package/src/utilities/findDuplicates.ts +4 -1
  166. package/src/utilities/index.ts +1 -0
  167. package/src/utilities/isMacOS.ts +1 -3
  168. package/src/utilities/isiOS.ts +5 -10
  169. package/src/utilities/mergeAttributes.ts +16 -6
  170. package/src/utilities/removeDuplicates.ts +1 -3
  171. package/dist/CommandManager.d.ts +0 -21
  172. package/dist/CommandManager.d.ts.map +0 -1
  173. package/dist/Editor.d.ts +0 -166
  174. package/dist/Editor.d.ts.map +0 -1
  175. package/dist/EventEmitter.d.ts +0 -13
  176. package/dist/EventEmitter.d.ts.map +0 -1
  177. package/dist/Extension.d.ts +0 -345
  178. package/dist/Extension.d.ts.map +0 -1
  179. package/dist/ExtensionManager.d.ts +0 -57
  180. package/dist/ExtensionManager.d.ts.map +0 -1
  181. package/dist/InputRule.d.ts +0 -43
  182. package/dist/InputRule.d.ts.map +0 -1
  183. package/dist/Mark.d.ts +0 -453
  184. package/dist/Mark.d.ts.map +0 -1
  185. package/dist/Node.d.ts +0 -629
  186. package/dist/Node.d.ts.map +0 -1
  187. package/dist/NodePos.d.ts +0 -45
  188. package/dist/NodePos.d.ts.map +0 -1
  189. package/dist/NodeView.d.ts +0 -41
  190. package/dist/NodeView.d.ts.map +0 -1
  191. package/dist/PasteRule.d.ts +0 -51
  192. package/dist/PasteRule.d.ts.map +0 -1
  193. package/dist/Tracker.d.ts +0 -12
  194. package/dist/Tracker.d.ts.map +0 -1
  195. package/dist/commands/blur.d.ts +0 -14
  196. package/dist/commands/blur.d.ts.map +0 -1
  197. package/dist/commands/clearContent.d.ts +0 -15
  198. package/dist/commands/clearContent.d.ts.map +0 -1
  199. package/dist/commands/clearNodes.d.ts +0 -14
  200. package/dist/commands/clearNodes.d.ts.map +0 -1
  201. package/dist/commands/command.d.ts +0 -19
  202. package/dist/commands/command.d.ts.map +0 -1
  203. package/dist/commands/createParagraphNear.d.ts +0 -14
  204. package/dist/commands/createParagraphNear.d.ts.map +0 -1
  205. package/dist/commands/cut.d.ts +0 -21
  206. package/dist/commands/cut.d.ts.map +0 -1
  207. package/dist/commands/deleteCurrentNode.d.ts +0 -14
  208. package/dist/commands/deleteCurrentNode.d.ts.map +0 -1
  209. package/dist/commands/deleteNode.d.ts +0 -16
  210. package/dist/commands/deleteNode.d.ts.map +0 -1
  211. package/dist/commands/deleteRange.d.ts +0 -15
  212. package/dist/commands/deleteRange.d.ts.map +0 -1
  213. package/dist/commands/deleteSelection.d.ts +0 -14
  214. package/dist/commands/deleteSelection.d.ts.map +0 -1
  215. package/dist/commands/enter.d.ts +0 -14
  216. package/dist/commands/enter.d.ts.map +0 -1
  217. package/dist/commands/exitCode.d.ts +0 -14
  218. package/dist/commands/exitCode.d.ts.map +0 -1
  219. package/dist/commands/extendMarkRange.d.ts +0 -26
  220. package/dist/commands/extendMarkRange.d.ts.map +0 -1
  221. package/dist/commands/first.d.ts +0 -15
  222. package/dist/commands/first.d.ts.map +0 -1
  223. package/dist/commands/focus.d.ts +0 -28
  224. package/dist/commands/focus.d.ts.map +0 -1
  225. package/dist/commands/forEach.d.ts +0 -15
  226. package/dist/commands/forEach.d.ts.map +0 -1
  227. package/dist/commands/index.d.ts +0 -56
  228. package/dist/commands/index.d.ts.map +0 -1
  229. package/dist/commands/insertContent.d.ts +0 -35
  230. package/dist/commands/insertContent.d.ts.map +0 -1
  231. package/dist/commands/insertContentAt.d.ts +0 -48
  232. package/dist/commands/insertContentAt.d.ts.map +0 -1
  233. package/dist/commands/join.d.ts +0 -42
  234. package/dist/commands/join.d.ts.map +0 -1
  235. package/dist/commands/joinItemBackward.d.ts +0 -14
  236. package/dist/commands/joinItemBackward.d.ts.map +0 -1
  237. package/dist/commands/joinItemForward.d.ts +0 -14
  238. package/dist/commands/joinItemForward.d.ts.map +0 -1
  239. package/dist/commands/joinTextblockBackward.d.ts +0 -13
  240. package/dist/commands/joinTextblockBackward.d.ts.map +0 -1
  241. package/dist/commands/joinTextblockForward.d.ts +0 -13
  242. package/dist/commands/joinTextblockForward.d.ts.map +0 -1
  243. package/dist/commands/keyboardShortcut.d.ts +0 -15
  244. package/dist/commands/keyboardShortcut.d.ts.map +0 -1
  245. package/dist/commands/lift.d.ts +0 -18
  246. package/dist/commands/lift.d.ts.map +0 -1
  247. package/dist/commands/liftEmptyBlock.d.ts +0 -14
  248. package/dist/commands/liftEmptyBlock.d.ts.map +0 -1
  249. package/dist/commands/liftListItem.d.ts +0 -16
  250. package/dist/commands/liftListItem.d.ts.map +0 -1
  251. package/dist/commands/newlineInCode.d.ts +0 -14
  252. package/dist/commands/newlineInCode.d.ts.map +0 -1
  253. package/dist/commands/resetAttributes.d.ts +0 -17
  254. package/dist/commands/resetAttributes.d.ts.map +0 -1
  255. package/dist/commands/scrollIntoView.d.ts +0 -14
  256. package/dist/commands/scrollIntoView.d.ts.map +0 -1
  257. package/dist/commands/selectAll.d.ts +0 -14
  258. package/dist/commands/selectAll.d.ts.map +0 -1
  259. package/dist/commands/selectNodeBackward.d.ts +0 -14
  260. package/dist/commands/selectNodeBackward.d.ts.map +0 -1
  261. package/dist/commands/selectNodeForward.d.ts +0 -14
  262. package/dist/commands/selectNodeForward.d.ts.map +0 -1
  263. package/dist/commands/selectParentNode.d.ts +0 -14
  264. package/dist/commands/selectParentNode.d.ts.map +0 -1
  265. package/dist/commands/selectTextblockEnd.d.ts +0 -14
  266. package/dist/commands/selectTextblockEnd.d.ts.map +0 -1
  267. package/dist/commands/selectTextblockStart.d.ts +0 -14
  268. package/dist/commands/selectTextblockStart.d.ts.map +0 -1
  269. package/dist/commands/setContent.d.ts +0 -41
  270. package/dist/commands/setContent.d.ts.map +0 -1
  271. package/dist/commands/setMark.d.ts +0 -16
  272. package/dist/commands/setMark.d.ts.map +0 -1
  273. package/dist/commands/setMeta.d.ts +0 -17
  274. package/dist/commands/setMeta.d.ts.map +0 -1
  275. package/dist/commands/setNode.d.ts +0 -17
  276. package/dist/commands/setNode.d.ts.map +0 -1
  277. package/dist/commands/setNodeSelection.d.ts +0 -15
  278. package/dist/commands/setNodeSelection.d.ts.map +0 -1
  279. package/dist/commands/setTextSelection.d.ts +0 -15
  280. package/dist/commands/setTextSelection.d.ts.map +0 -1
  281. package/dist/commands/sinkListItem.d.ts +0 -16
  282. package/dist/commands/sinkListItem.d.ts.map +0 -1
  283. package/dist/commands/splitBlock.d.ts +0 -18
  284. package/dist/commands/splitBlock.d.ts.map +0 -1
  285. package/dist/commands/splitListItem.d.ts +0 -17
  286. package/dist/commands/splitListItem.d.ts.map +0 -1
  287. package/dist/commands/toggleList.d.ts +0 -19
  288. package/dist/commands/toggleList.d.ts.map +0 -1
  289. package/dist/commands/toggleMark.d.ts +0 -31
  290. package/dist/commands/toggleMark.d.ts.map +0 -1
  291. package/dist/commands/toggleNode.d.ts +0 -18
  292. package/dist/commands/toggleNode.d.ts.map +0 -1
  293. package/dist/commands/toggleWrap.d.ts +0 -17
  294. package/dist/commands/toggleWrap.d.ts.map +0 -1
  295. package/dist/commands/undoInputRule.d.ts +0 -14
  296. package/dist/commands/undoInputRule.d.ts.map +0 -1
  297. package/dist/commands/unsetAllMarks.d.ts +0 -14
  298. package/dist/commands/unsetAllMarks.d.ts.map +0 -1
  299. package/dist/commands/unsetMark.d.ts +0 -26
  300. package/dist/commands/unsetMark.d.ts.map +0 -1
  301. package/dist/commands/updateAttributes.d.ts +0 -25
  302. package/dist/commands/updateAttributes.d.ts.map +0 -1
  303. package/dist/commands/wrapIn.d.ts +0 -17
  304. package/dist/commands/wrapIn.d.ts.map +0 -1
  305. package/dist/commands/wrapInList.d.ts +0 -17
  306. package/dist/commands/wrapInList.d.ts.map +0 -1
  307. package/dist/extensions/clipboardTextSerializer.d.ts +0 -6
  308. package/dist/extensions/clipboardTextSerializer.d.ts.map +0 -1
  309. package/dist/extensions/commands.d.ts +0 -4
  310. package/dist/extensions/commands.d.ts.map +0 -1
  311. package/dist/extensions/drop.d.ts +0 -3
  312. package/dist/extensions/drop.d.ts.map +0 -1
  313. package/dist/extensions/editable.d.ts +0 -3
  314. package/dist/extensions/editable.d.ts.map +0 -1
  315. package/dist/extensions/focusEvents.d.ts +0 -5
  316. package/dist/extensions/focusEvents.d.ts.map +0 -1
  317. package/dist/extensions/index.d.ts +0 -9
  318. package/dist/extensions/index.d.ts.map +0 -1
  319. package/dist/extensions/keymap.d.ts +0 -3
  320. package/dist/extensions/keymap.d.ts.map +0 -1
  321. package/dist/extensions/paste.d.ts +0 -3
  322. package/dist/extensions/paste.d.ts.map +0 -1
  323. package/dist/extensions/tabindex.d.ts +0 -3
  324. package/dist/extensions/tabindex.d.ts.map +0 -1
  325. package/dist/helpers/combineTransactionSteps.d.ts +0 -11
  326. package/dist/helpers/combineTransactionSteps.d.ts.map +0 -1
  327. package/dist/helpers/createChainableState.d.ts +0 -11
  328. package/dist/helpers/createChainableState.d.ts.map +0 -1
  329. package/dist/helpers/createDocument.d.ts +0 -13
  330. package/dist/helpers/createDocument.d.ts.map +0 -1
  331. package/dist/helpers/createNodeFromContent.d.ts +0 -16
  332. package/dist/helpers/createNodeFromContent.d.ts.map +0 -1
  333. package/dist/helpers/defaultBlockAt.d.ts +0 -8
  334. package/dist/helpers/defaultBlockAt.d.ts.map +0 -1
  335. package/dist/helpers/findChildren.d.ts +0 -10
  336. package/dist/helpers/findChildren.d.ts.map +0 -1
  337. package/dist/helpers/findChildrenInRange.d.ts +0 -11
  338. package/dist/helpers/findChildrenInRange.d.ts.map +0 -1
  339. package/dist/helpers/findParentNode.d.ts +0 -17
  340. package/dist/helpers/findParentNode.d.ts.map +0 -1
  341. package/dist/helpers/findParentNodeClosestToPos.d.ts +0 -18
  342. package/dist/helpers/findParentNodeClosestToPos.d.ts.map +0 -1
  343. package/dist/helpers/generateHTML.d.ts +0 -9
  344. package/dist/helpers/generateHTML.d.ts.map +0 -1
  345. package/dist/helpers/generateJSON.d.ts +0 -9
  346. package/dist/helpers/generateJSON.d.ts.map +0 -1
  347. package/dist/helpers/generateText.d.ts +0 -13
  348. package/dist/helpers/generateText.d.ts.map +0 -1
  349. package/dist/helpers/getAttributes.d.ts +0 -10
  350. package/dist/helpers/getAttributes.d.ts.map +0 -1
  351. package/dist/helpers/getAttributesFromExtensions.d.ts +0 -7
  352. package/dist/helpers/getAttributesFromExtensions.d.ts.map +0 -1
  353. package/dist/helpers/getChangedRanges.d.ts +0 -12
  354. package/dist/helpers/getChangedRanges.d.ts.map +0 -1
  355. package/dist/helpers/getDebugJSON.d.ts +0 -9
  356. package/dist/helpers/getDebugJSON.d.ts.map +0 -1
  357. package/dist/helpers/getExtensionField.d.ts +0 -10
  358. package/dist/helpers/getExtensionField.d.ts.map +0 -1
  359. package/dist/helpers/getHTMLFromFragment.d.ts +0 -3
  360. package/dist/helpers/getHTMLFromFragment.d.ts.map +0 -1
  361. package/dist/helpers/getMarkAttributes.d.ts +0 -4
  362. package/dist/helpers/getMarkAttributes.d.ts.map +0 -1
  363. package/dist/helpers/getMarkRange.d.ts +0 -20
  364. package/dist/helpers/getMarkRange.d.ts.map +0 -1
  365. package/dist/helpers/getMarkType.d.ts +0 -3
  366. package/dist/helpers/getMarkType.d.ts.map +0 -1
  367. package/dist/helpers/getMarksBetween.d.ts +0 -4
  368. package/dist/helpers/getMarksBetween.d.ts.map +0 -1
  369. package/dist/helpers/getNodeAtPosition.d.ts +0 -12
  370. package/dist/helpers/getNodeAtPosition.d.ts.map +0 -1
  371. package/dist/helpers/getNodeAttributes.d.ts +0 -4
  372. package/dist/helpers/getNodeAttributes.d.ts.map +0 -1
  373. package/dist/helpers/getNodeType.d.ts +0 -3
  374. package/dist/helpers/getNodeType.d.ts.map +0 -1
  375. package/dist/helpers/getRenderedAttributes.d.ts +0 -4
  376. package/dist/helpers/getRenderedAttributes.d.ts.map +0 -1
  377. package/dist/helpers/getSchema.d.ts +0 -5
  378. package/dist/helpers/getSchema.d.ts.map +0 -1
  379. package/dist/helpers/getSchemaByResolvedExtensions.d.ts +0 -11
  380. package/dist/helpers/getSchemaByResolvedExtensions.d.ts.map +0 -1
  381. package/dist/helpers/getSchemaTypeByName.d.ts +0 -9
  382. package/dist/helpers/getSchemaTypeByName.d.ts.map +0 -1
  383. package/dist/helpers/getSchemaTypeNameByName.d.ts +0 -9
  384. package/dist/helpers/getSchemaTypeNameByName.d.ts.map +0 -1
  385. package/dist/helpers/getSplittedAttributes.d.ts +0 -10
  386. package/dist/helpers/getSplittedAttributes.d.ts.map +0 -1
  387. package/dist/helpers/getText.d.ts +0 -16
  388. package/dist/helpers/getText.d.ts.map +0 -1
  389. package/dist/helpers/getTextBetween.d.ts +0 -15
  390. package/dist/helpers/getTextBetween.d.ts.map +0 -1
  391. package/dist/helpers/getTextContentFromNodes.d.ts +0 -9
  392. package/dist/helpers/getTextContentFromNodes.d.ts.map +0 -1
  393. package/dist/helpers/getTextSerializersFromSchema.d.ts +0 -9
  394. package/dist/helpers/getTextSerializersFromSchema.d.ts.map +0 -1
  395. package/dist/helpers/index.d.ts +0 -52
  396. package/dist/helpers/index.d.ts.map +0 -1
  397. package/dist/helpers/injectExtensionAttributesToParseRule.d.ts +0 -10
  398. package/dist/helpers/injectExtensionAttributesToParseRule.d.ts.map +0 -1
  399. package/dist/helpers/isActive.d.ts +0 -3
  400. package/dist/helpers/isActive.d.ts.map +0 -1
  401. package/dist/helpers/isAtEndOfNode.d.ts +0 -3
  402. package/dist/helpers/isAtEndOfNode.d.ts.map +0 -1
  403. package/dist/helpers/isAtStartOfNode.d.ts +0 -3
  404. package/dist/helpers/isAtStartOfNode.d.ts.map +0 -1
  405. package/dist/helpers/isExtensionRulesEnabled.d.ts +0 -3
  406. package/dist/helpers/isExtensionRulesEnabled.d.ts.map +0 -1
  407. package/dist/helpers/isList.d.ts +0 -3
  408. package/dist/helpers/isList.d.ts.map +0 -1
  409. package/dist/helpers/isMarkActive.d.ts +0 -4
  410. package/dist/helpers/isMarkActive.d.ts.map +0 -1
  411. package/dist/helpers/isNodeActive.d.ts +0 -4
  412. package/dist/helpers/isNodeActive.d.ts.map +0 -1
  413. package/dist/helpers/isNodeEmpty.d.ts +0 -15
  414. package/dist/helpers/isNodeEmpty.d.ts.map +0 -1
  415. package/dist/helpers/isNodeSelection.d.ts +0 -3
  416. package/dist/helpers/isNodeSelection.d.ts.map +0 -1
  417. package/dist/helpers/isTextSelection.d.ts +0 -3
  418. package/dist/helpers/isTextSelection.d.ts.map +0 -1
  419. package/dist/helpers/posToDOMRect.d.ts +0 -3
  420. package/dist/helpers/posToDOMRect.d.ts.map +0 -1
  421. package/dist/helpers/resolveFocusPosition.d.ts +0 -5
  422. package/dist/helpers/resolveFocusPosition.d.ts.map +0 -1
  423. package/dist/helpers/rewriteUnknownContent.d.ts +0 -46
  424. package/dist/helpers/rewriteUnknownContent.d.ts.map +0 -1
  425. package/dist/helpers/selectionToInsertionEnd.d.ts +0 -3
  426. package/dist/helpers/selectionToInsertionEnd.d.ts.map +0 -1
  427. package/dist/helpers/splitExtensions.d.ts +0 -10
  428. package/dist/helpers/splitExtensions.d.ts.map +0 -1
  429. package/dist/index.d.ts.map +0 -1
  430. package/dist/index.umd.js +0 -5524
  431. package/dist/index.umd.js.map +0 -1
  432. package/dist/inputRules/index.d.ts +0 -6
  433. package/dist/inputRules/index.d.ts.map +0 -1
  434. package/dist/inputRules/markInputRule.d.ts +0 -14
  435. package/dist/inputRules/markInputRule.d.ts.map +0 -1
  436. package/dist/inputRules/nodeInputRule.d.ts +0 -24
  437. package/dist/inputRules/nodeInputRule.d.ts.map +0 -1
  438. package/dist/inputRules/textInputRule.d.ts +0 -11
  439. package/dist/inputRules/textInputRule.d.ts.map +0 -1
  440. package/dist/inputRules/textblockTypeInputRule.d.ts +0 -16
  441. package/dist/inputRules/textblockTypeInputRule.d.ts.map +0 -1
  442. package/dist/inputRules/wrappingInputRule.d.ts +0 -29
  443. package/dist/inputRules/wrappingInputRule.d.ts.map +0 -1
  444. package/dist/pasteRules/index.d.ts +0 -4
  445. package/dist/pasteRules/index.d.ts.map +0 -1
  446. package/dist/pasteRules/markPasteRule.d.ts +0 -14
  447. package/dist/pasteRules/markPasteRule.d.ts.map +0 -1
  448. package/dist/pasteRules/nodePasteRule.d.ts +0 -15
  449. package/dist/pasteRules/nodePasteRule.d.ts.map +0 -1
  450. package/dist/pasteRules/textPasteRule.d.ts +0 -11
  451. package/dist/pasteRules/textPasteRule.d.ts.map +0 -1
  452. package/dist/style.d.ts +0 -2
  453. package/dist/style.d.ts.map +0 -1
  454. package/dist/types.d.ts +0 -323
  455. package/dist/types.d.ts.map +0 -1
  456. package/dist/utilities/callOrReturn.d.ts +0 -10
  457. package/dist/utilities/callOrReturn.d.ts.map +0 -1
  458. package/dist/utilities/createStyleTag.d.ts +0 -2
  459. package/dist/utilities/createStyleTag.d.ts.map +0 -1
  460. package/dist/utilities/deleteProps.d.ts +0 -7
  461. package/dist/utilities/deleteProps.d.ts.map +0 -1
  462. package/dist/utilities/elementFromString.d.ts +0 -2
  463. package/dist/utilities/elementFromString.d.ts.map +0 -1
  464. package/dist/utilities/escapeForRegEx.d.ts +0 -2
  465. package/dist/utilities/escapeForRegEx.d.ts.map +0 -1
  466. package/dist/utilities/findDuplicates.d.ts +0 -2
  467. package/dist/utilities/findDuplicates.d.ts.map +0 -1
  468. package/dist/utilities/fromString.d.ts +0 -2
  469. package/dist/utilities/fromString.d.ts.map +0 -1
  470. package/dist/utilities/index.d.ts +0 -21
  471. package/dist/utilities/index.d.ts.map +0 -1
  472. package/dist/utilities/isAndroid.d.ts +0 -2
  473. package/dist/utilities/isAndroid.d.ts.map +0 -1
  474. package/dist/utilities/isEmptyObject.d.ts +0 -2
  475. package/dist/utilities/isEmptyObject.d.ts.map +0 -1
  476. package/dist/utilities/isFunction.d.ts +0 -2
  477. package/dist/utilities/isFunction.d.ts.map +0 -1
  478. package/dist/utilities/isMacOS.d.ts +0 -2
  479. package/dist/utilities/isMacOS.d.ts.map +0 -1
  480. package/dist/utilities/isNumber.d.ts +0 -2
  481. package/dist/utilities/isNumber.d.ts.map +0 -1
  482. package/dist/utilities/isPlainObject.d.ts +0 -2
  483. package/dist/utilities/isPlainObject.d.ts.map +0 -1
  484. package/dist/utilities/isRegExp.d.ts +0 -2
  485. package/dist/utilities/isRegExp.d.ts.map +0 -1
  486. package/dist/utilities/isString.d.ts +0 -2
  487. package/dist/utilities/isString.d.ts.map +0 -1
  488. package/dist/utilities/isiOS.d.ts +0 -2
  489. package/dist/utilities/isiOS.d.ts.map +0 -1
  490. package/dist/utilities/mergeAttributes.d.ts +0 -2
  491. package/dist/utilities/mergeAttributes.d.ts.map +0 -1
  492. package/dist/utilities/mergeDeep.d.ts +0 -2
  493. package/dist/utilities/mergeDeep.d.ts.map +0 -1
  494. package/dist/utilities/minMax.d.ts +0 -2
  495. package/dist/utilities/minMax.d.ts.map +0 -1
  496. package/dist/utilities/objectIncludes.d.ts +0 -9
  497. package/dist/utilities/objectIncludes.d.ts.map +0 -1
  498. package/dist/utilities/removeDuplicates.d.ts +0 -9
  499. package/dist/utilities/removeDuplicates.d.ts.map +0 -1
@@ -0,0 +1,3326 @@
1
+ import { Transaction, EditorState, Plugin, Selection, NodeSelection, TextSelection, PluginKey } from '@tiptap/pm/state';
2
+ import { Node as Node$1, MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Slice, ParseOptions, Fragment as Fragment$1, Schema, ContentMatch, ResolvedPos, ParseRule } from '@tiptap/pm/model';
3
+ import { EditorProps, EditorView, Decoration, DecorationAttrs, ViewMutationRecord, NodeViewConstructor, NodeView as NodeView$1, MarkViewConstructor, MarkView as MarkView$1 } from '@tiptap/pm/view';
4
+ import { Transform, Mappable } from '@tiptap/pm/transform';
5
+
6
+ type StringKeyOf<T> = Extract<keyof T, string>;
7
+ type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
8
+ type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
9
+ declare class EventEmitter<T extends Record<string, any>> {
10
+ private callbacks;
11
+ on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
12
+ emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
13
+ off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
14
+ once<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
15
+ removeAllListeners(): void;
16
+ }
17
+
18
+ /**
19
+ * Returns a new `Transform` based on all steps of the passed transactions.
20
+ * @param oldDoc The Prosemirror node to start from
21
+ * @param transactions The transactions to combine
22
+ * @returns A new `Transform` with all steps of the passed transactions
23
+ */
24
+ declare function combineTransactionSteps(oldDoc: Node$1, transactions: Transaction[]): Transform;
25
+
26
+ /**
27
+ * Takes a Transaction & Editor State and turns it into a chainable state object
28
+ * @param config The transaction and state to create the chainable state from
29
+ * @returns A chainable Editor state object
30
+ */
31
+ declare function createChainableState(config: {
32
+ transaction: Transaction;
33
+ state: EditorState;
34
+ }): EditorState;
35
+
36
+ type InputRuleMatch = {
37
+ index: number;
38
+ text: string;
39
+ replaceWith?: string;
40
+ match?: RegExpMatchArray;
41
+ data?: Record<string, any>;
42
+ };
43
+ type InputRuleFinder = RegExp | ((text: string) => InputRuleMatch | null);
44
+ declare class InputRule {
45
+ find: InputRuleFinder;
46
+ handler: (props: {
47
+ state: EditorState;
48
+ range: Range;
49
+ match: ExtendedRegExpMatchArray;
50
+ commands: SingleCommands;
51
+ chain: () => ChainedCommands;
52
+ can: () => CanCommands;
53
+ }) => void | null;
54
+ constructor(config: {
55
+ find: InputRuleFinder;
56
+ handler: (props: {
57
+ state: EditorState;
58
+ range: Range;
59
+ match: ExtendedRegExpMatchArray;
60
+ commands: SingleCommands;
61
+ chain: () => ChainedCommands;
62
+ can: () => CanCommands;
63
+ }) => void | null;
64
+ });
65
+ }
66
+ /**
67
+ * Create an input rules plugin. When enabled, it will cause text
68
+ * input that matches any of the given rules to trigger the rule’s
69
+ * action.
70
+ */
71
+ declare function inputRulesPlugin(props: {
72
+ editor: Editor;
73
+ rules: InputRule[];
74
+ }): Plugin;
75
+
76
+ interface MarkConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, MarkConfig<Options, Storage>, MarkType$1> {
77
+ /**
78
+ * Mark View
79
+ */
80
+ addMarkView?: ((this: {
81
+ name: string;
82
+ options: Options;
83
+ storage: Storage;
84
+ editor: Editor;
85
+ type: MarkType$1;
86
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addMarkView'];
87
+ }) => MarkViewRenderer) | null;
88
+ /**
89
+ * Keep mark after split node
90
+ */
91
+ keepOnSplit?: boolean | (() => boolean);
92
+ /**
93
+ * Inclusive
94
+ */
95
+ inclusive?: MarkSpec['inclusive'] | ((this: {
96
+ name: string;
97
+ options: Options;
98
+ storage: Storage;
99
+ parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
100
+ editor?: Editor;
101
+ }) => MarkSpec['inclusive']);
102
+ /**
103
+ * Excludes
104
+ */
105
+ excludes?: MarkSpec['excludes'] | ((this: {
106
+ name: string;
107
+ options: Options;
108
+ storage: Storage;
109
+ parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
110
+ editor?: Editor;
111
+ }) => MarkSpec['excludes']);
112
+ /**
113
+ * Marks this Mark as exitable
114
+ */
115
+ exitable?: boolean | (() => boolean);
116
+ /**
117
+ * Group
118
+ */
119
+ group?: MarkSpec['group'] | ((this: {
120
+ name: string;
121
+ options: Options;
122
+ storage: Storage;
123
+ parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
124
+ editor?: Editor;
125
+ }) => MarkSpec['group']);
126
+ /**
127
+ * Spanning
128
+ */
129
+ spanning?: MarkSpec['spanning'] | ((this: {
130
+ name: string;
131
+ options: Options;
132
+ storage: Storage;
133
+ parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
134
+ editor?: Editor;
135
+ }) => MarkSpec['spanning']);
136
+ /**
137
+ * Code
138
+ */
139
+ code?: boolean | ((this: {
140
+ name: string;
141
+ options: Options;
142
+ storage: Storage;
143
+ parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
144
+ editor?: Editor;
145
+ }) => boolean);
146
+ /**
147
+ * Parse HTML
148
+ */
149
+ parseHTML?: (this: {
150
+ name: string;
151
+ options: Options;
152
+ storage: Storage;
153
+ parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
154
+ editor?: Editor;
155
+ }) => MarkSpec['parseDOM'];
156
+ /**
157
+ * Render HTML
158
+ */
159
+ renderHTML?: ((this: {
160
+ name: string;
161
+ options: Options;
162
+ storage: Storage;
163
+ parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
164
+ editor?: Editor;
165
+ }, props: {
166
+ mark: Mark$1;
167
+ HTMLAttributes: Record<string, any>;
168
+ }) => DOMOutputSpec) | null;
169
+ /**
170
+ * Attributes
171
+ */
172
+ addAttributes?: (this: {
173
+ name: string;
174
+ options: Options;
175
+ storage: Storage;
176
+ parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
177
+ editor?: Editor;
178
+ }) => Attributes$1 | {};
179
+ }
180
+ /**
181
+ * The Mark class is used to create custom mark extensions.
182
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
183
+ */
184
+ declare class Mark<Options = any, Storage = any> extends Extendable<Options, Storage, MarkConfig<Options, Storage>> {
185
+ type: string;
186
+ static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
187
+ static handleExit({ editor, mark }: {
188
+ editor: Editor;
189
+ mark: Mark;
190
+ }): boolean;
191
+ configure(options?: Partial<Options>): Mark<Options, Storage>;
192
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Mark<ExtendedOptions, ExtendedStorage>;
193
+ }
194
+
195
+ interface NodeConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, NodeConfig<Options, Storage>, NodeType$1> {
196
+ /**
197
+ * Node View
198
+ */
199
+ addNodeView?: ((this: {
200
+ name: string;
201
+ options: Options;
202
+ storage: Storage;
203
+ editor: Editor;
204
+ type: NodeType$1;
205
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addNodeView'];
206
+ }) => NodeViewRenderer) | null;
207
+ /**
208
+ * Defines if this node should be a top level node (doc)
209
+ * @default false
210
+ * @example true
211
+ */
212
+ topNode?: boolean;
213
+ /**
214
+ * The content expression for this node, as described in the [schema
215
+ * guide](/docs/guide/#schema.content_expressions). When not given,
216
+ * the node does not allow any content.
217
+ *
218
+ * You can read more about it on the Prosemirror documentation here
219
+ * @see https://prosemirror.net/docs/guide/#schema.content_expressions
220
+ * @default undefined
221
+ * @example content: 'block+'
222
+ * @example content: 'headline paragraph block*'
223
+ */
224
+ content?: NodeSpec['content'] | ((this: {
225
+ name: string;
226
+ options: Options;
227
+ storage: Storage;
228
+ parent: ParentConfig<NodeConfig<Options, Storage>>['content'];
229
+ editor?: Editor;
230
+ }) => NodeSpec['content']);
231
+ /**
232
+ * The marks that are allowed inside of this node. May be a
233
+ * space-separated string referring to mark names or groups, `"_"`
234
+ * to explicitly allow all marks, or `""` to disallow marks. When
235
+ * not given, nodes with inline content default to allowing all
236
+ * marks, other nodes default to not allowing marks.
237
+ *
238
+ * @example marks: 'strong em'
239
+ */
240
+ marks?: NodeSpec['marks'] | ((this: {
241
+ name: string;
242
+ options: Options;
243
+ storage: Storage;
244
+ parent: ParentConfig<NodeConfig<Options, Storage>>['marks'];
245
+ editor?: Editor;
246
+ }) => NodeSpec['marks']);
247
+ /**
248
+ * The group or space-separated groups to which this node belongs,
249
+ * which can be referred to in the content expressions for the
250
+ * schema.
251
+ *
252
+ * By default Tiptap uses the groups 'block' and 'inline' for nodes. You
253
+ * can also use custom groups if you want to group specific nodes together
254
+ * and handle them in your schema.
255
+ * @example group: 'block'
256
+ * @example group: 'inline'
257
+ * @example group: 'customBlock' // this uses a custom group
258
+ */
259
+ group?: NodeSpec['group'] | ((this: {
260
+ name: string;
261
+ options: Options;
262
+ storage: Storage;
263
+ parent: ParentConfig<NodeConfig<Options, Storage>>['group'];
264
+ editor?: Editor;
265
+ }) => NodeSpec['group']);
266
+ /**
267
+ * Should be set to true for inline nodes. (Implied for text nodes.)
268
+ */
269
+ inline?: NodeSpec['inline'] | ((this: {
270
+ name: string;
271
+ options: Options;
272
+ storage: Storage;
273
+ parent: ParentConfig<NodeConfig<Options, Storage>>['inline'];
274
+ editor?: Editor;
275
+ }) => NodeSpec['inline']);
276
+ /**
277
+ * Can be set to true to indicate that, though this isn't a [leaf
278
+ * node](https://prosemirror.net/docs/ref/#model.NodeType.isLeaf), it doesn't have directly editable
279
+ * content and should be treated as a single unit in the view.
280
+ *
281
+ * @example atom: true
282
+ */
283
+ atom?: NodeSpec['atom'] | ((this: {
284
+ name: string;
285
+ options: Options;
286
+ storage: Storage;
287
+ parent: ParentConfig<NodeConfig<Options, Storage>>['atom'];
288
+ editor?: Editor;
289
+ }) => NodeSpec['atom']);
290
+ /**
291
+ * Controls whether nodes of this type can be selected as a [node
292
+ * selection](https://prosemirror.net/docs/ref/#state.NodeSelection). Defaults to true for non-text
293
+ * nodes.
294
+ *
295
+ * @default true
296
+ * @example selectable: false
297
+ */
298
+ selectable?: NodeSpec['selectable'] | ((this: {
299
+ name: string;
300
+ options: Options;
301
+ storage: Storage;
302
+ parent: ParentConfig<NodeConfig<Options, Storage>>['selectable'];
303
+ editor?: Editor;
304
+ }) => NodeSpec['selectable']);
305
+ /**
306
+ * Determines whether nodes of this type can be dragged without
307
+ * being selected. Defaults to false.
308
+ *
309
+ * @default: false
310
+ * @example: draggable: true
311
+ */
312
+ draggable?: NodeSpec['draggable'] | ((this: {
313
+ name: string;
314
+ options: Options;
315
+ storage: Storage;
316
+ parent: ParentConfig<NodeConfig<Options, Storage>>['draggable'];
317
+ editor?: Editor;
318
+ }) => NodeSpec['draggable']);
319
+ /**
320
+ * Can be used to indicate that this node contains code, which
321
+ * causes some commands to behave differently.
322
+ */
323
+ code?: NodeSpec['code'] | ((this: {
324
+ name: string;
325
+ options: Options;
326
+ storage: Storage;
327
+ parent: ParentConfig<NodeConfig<Options, Storage>>['code'];
328
+ editor?: Editor;
329
+ }) => NodeSpec['code']);
330
+ /**
331
+ * Controls way whitespace in this a node is parsed. The default is
332
+ * `"normal"`, which causes the [DOM parser](https://prosemirror.net/docs/ref/#model.DOMParser) to
333
+ * collapse whitespace in normal mode, and normalize it (replacing
334
+ * newlines and such with spaces) otherwise. `"pre"` causes the
335
+ * parser to preserve spaces inside the node. When this option isn't
336
+ * given, but [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) is true, `whitespace`
337
+ * will default to `"pre"`. Note that this option doesn't influence
338
+ * the way the node is rendered—that should be handled by `toDOM`
339
+ * and/or styling.
340
+ */
341
+ whitespace?: NodeSpec['whitespace'] | ((this: {
342
+ name: string;
343
+ options: Options;
344
+ storage: Storage;
345
+ parent: ParentConfig<NodeConfig<Options, Storage>>['whitespace'];
346
+ editor?: Editor;
347
+ }) => NodeSpec['whitespace']);
348
+ /**
349
+ * Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
350
+ * When converting between block types that have whitespace set to "pre"
351
+ * and don't support the linebreak node (e.g. codeBlock) and other block types
352
+ * that do support the linebreak node (e.g. paragraphs) - this node will be used
353
+ * as the linebreak instead of stripping the newline.
354
+ *
355
+ * See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
356
+ */
357
+ linebreakReplacement?: NodeSpec['linebreakReplacement'] | ((this: {
358
+ name: string;
359
+ options: Options;
360
+ storage: Storage;
361
+ parent: ParentConfig<NodeConfig<Options, Storage>>['linebreakReplacement'];
362
+ editor?: Editor;
363
+ }) => NodeSpec['linebreakReplacement']);
364
+ /**
365
+ * When enabled, enables both
366
+ * [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
367
+ * [`definingForContent`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
368
+ *
369
+ * @default false
370
+ * @example isolating: true
371
+ */
372
+ defining?: NodeSpec['defining'] | ((this: {
373
+ name: string;
374
+ options: Options;
375
+ storage: Storage;
376
+ parent: ParentConfig<NodeConfig<Options, Storage>>['defining'];
377
+ editor?: Editor;
378
+ }) => NodeSpec['defining']);
379
+ /**
380
+ * When enabled (default is false), the sides of nodes of this type
381
+ * count as boundaries that regular editing operations, like
382
+ * backspacing or lifting, won't cross. An example of a node that
383
+ * should probably have this enabled is a table cell.
384
+ */
385
+ isolating?: NodeSpec['isolating'] | ((this: {
386
+ name: string;
387
+ options: Options;
388
+ storage: Storage;
389
+ parent: ParentConfig<NodeConfig<Options, Storage>>['isolating'];
390
+ editor?: Editor;
391
+ }) => NodeSpec['isolating']);
392
+ /**
393
+ * Associates DOM parser information with this node, which can be
394
+ * used by [`DOMParser.fromSchema`](https://prosemirror.net/docs/ref/#model.DOMParser^fromSchema) to
395
+ * automatically derive a parser. The `node` field in the rules is
396
+ * implied (the name of this node will be filled in automatically).
397
+ * If you supply your own parser, you do not need to also specify
398
+ * parsing rules in your schema.
399
+ *
400
+ * @example parseHTML: [{ tag: 'div', attrs: { 'data-id': 'my-block' } }]
401
+ */
402
+ parseHTML?: (this: {
403
+ name: string;
404
+ options: Options;
405
+ storage: Storage;
406
+ parent: ParentConfig<NodeConfig<Options, Storage>>['parseHTML'];
407
+ editor?: Editor;
408
+ }) => NodeSpec['parseDOM'];
409
+ /**
410
+ * A description of a DOM structure. Can be either a string, which is
411
+ * interpreted as a text node, a DOM node, which is interpreted as
412
+ * itself, a `{dom, contentDOM}` object, or an array.
413
+ *
414
+ * An array describes a DOM element. The first value in the array
415
+ * should be a string—the name of the DOM element, optionally prefixed
416
+ * by a namespace URL and a space. If the second element is plain
417
+ * object, it is interpreted as a set of attributes for the element.
418
+ * Any elements after that (including the 2nd if it's not an attribute
419
+ * object) are interpreted as children of the DOM elements, and must
420
+ * either be valid `DOMOutputSpec` values, or the number zero.
421
+ *
422
+ * The number zero (pronounced “hole”) is used to indicate the place
423
+ * where a node's child nodes should be inserted. If it occurs in an
424
+ * output spec, it should be the only child element in its parent
425
+ * node.
426
+ *
427
+ * @example toDOM: ['div[data-id="my-block"]', { class: 'my-block' }, 0]
428
+ */
429
+ renderHTML?: ((this: {
430
+ name: string;
431
+ options: Options;
432
+ storage: Storage;
433
+ parent: ParentConfig<NodeConfig<Options, Storage>>['renderHTML'];
434
+ editor?: Editor;
435
+ }, props: {
436
+ node: Node$1;
437
+ HTMLAttributes: Record<string, any>;
438
+ }) => DOMOutputSpec) | null;
439
+ /**
440
+ * renders the node as text
441
+ * @example renderText: () => 'foo
442
+ */
443
+ renderText?: ((this: {
444
+ name: string;
445
+ options: Options;
446
+ storage: Storage;
447
+ parent: ParentConfig<NodeConfig<Options, Storage>>['renderText'];
448
+ editor?: Editor;
449
+ }, props: {
450
+ node: Node$1;
451
+ pos: number;
452
+ parent: Node$1;
453
+ index: number;
454
+ }) => string) | null;
455
+ /**
456
+ * Add attributes to the node
457
+ * @example addAttributes: () => ({ class: 'foo' })
458
+ */
459
+ addAttributes?: (this: {
460
+ name: string;
461
+ options: Options;
462
+ storage: Storage;
463
+ parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
464
+ editor?: Editor;
465
+ }) => Attributes$1 | {};
466
+ }
467
+ /**
468
+ * The Node class is used to create custom node extensions.
469
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
470
+ */
471
+ declare class Node<Options = any, Storage = any> extends Extendable<Options, Storage, NodeConfig<Options, Storage>> {
472
+ type: string;
473
+ static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>>): Node<O, S>;
474
+ configure(options?: Partial<Options>): Node<Options, Storage>;
475
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = NodeConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Node<ExtendedOptions, ExtendedStorage>;
476
+ }
477
+
478
+ type PasteRuleMatch = {
479
+ index: number;
480
+ text: string;
481
+ replaceWith?: string;
482
+ match?: RegExpMatchArray;
483
+ data?: Record<string, any>;
484
+ };
485
+ type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
486
+ /**
487
+ * Paste rules are used to react to pasted content.
488
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
489
+ */
490
+ declare class PasteRule {
491
+ find: PasteRuleFinder;
492
+ handler: (props: {
493
+ state: EditorState;
494
+ range: Range;
495
+ match: ExtendedRegExpMatchArray;
496
+ commands: SingleCommands;
497
+ chain: () => ChainedCommands;
498
+ can: () => CanCommands;
499
+ pasteEvent: ClipboardEvent | null;
500
+ dropEvent: DragEvent | null;
501
+ }) => void | null;
502
+ constructor(config: {
503
+ find: PasteRuleFinder;
504
+ handler: (props: {
505
+ can: () => CanCommands;
506
+ chain: () => ChainedCommands;
507
+ commands: SingleCommands;
508
+ dropEvent: DragEvent | null;
509
+ match: ExtendedRegExpMatchArray;
510
+ pasteEvent: ClipboardEvent | null;
511
+ range: Range;
512
+ state: EditorState;
513
+ }) => void | null;
514
+ });
515
+ }
516
+ /**
517
+ * Create an paste rules plugin. When enabled, it will cause pasted
518
+ * text that matches any of the given rules to trigger the rule’s
519
+ * action.
520
+ */
521
+ declare function pasteRulesPlugin(props: {
522
+ editor: Editor;
523
+ rules: PasteRule[];
524
+ }): Plugin[];
525
+
526
+ interface ExtendableConfig<Options = any, Storage = any, Config extends ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage> | ExtendableConfig<Options, Storage> = ExtendableConfig<Options, Storage, any, any>, PMType = any> {
527
+ /**
528
+ * The extension name - this must be unique.
529
+ * It will be used to identify the extension.
530
+ *
531
+ * @example 'myExtension'
532
+ */
533
+ name: string;
534
+ /**
535
+ * The priority of your extension. The higher, the earlier it will be called
536
+ * and will take precedence over other extensions with a lower priority.
537
+ * @default 100
538
+ * @example 101
539
+ */
540
+ priority?: number;
541
+ /**
542
+ * This method will add options to this extension
543
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#settings
544
+ * @example
545
+ * addOptions() {
546
+ * return {
547
+ * myOption: 'foo',
548
+ * myOtherOption: 10,
549
+ * }
550
+ */
551
+ addOptions?: (this: {
552
+ name: string;
553
+ parent: ParentConfig<Config>['addOptions'];
554
+ }) => Options;
555
+ /**
556
+ * The default storage this extension can save data to.
557
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#storage
558
+ * @example
559
+ * defaultStorage: {
560
+ * prefetchedUsers: [],
561
+ * loading: false,
562
+ * }
563
+ */
564
+ addStorage?: (this: {
565
+ name: string;
566
+ options: Options;
567
+ parent: ParentConfig<Config>['addStorage'];
568
+ }) => Storage;
569
+ /**
570
+ * This function adds globalAttributes to specific nodes.
571
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#global-attributes
572
+ * @example
573
+ * addGlobalAttributes() {
574
+ * return [
575
+ * {
576
+ // Extend the following extensions
577
+ * types: [
578
+ * 'heading',
579
+ * 'paragraph',
580
+ * ],
581
+ * // … with those attributes
582
+ * attributes: {
583
+ * textAlign: {
584
+ * default: 'left',
585
+ * renderHTML: attributes => ({
586
+ * style: `text-align: ${attributes.textAlign}`,
587
+ * }),
588
+ * parseHTML: element => element.style.textAlign || 'left',
589
+ * },
590
+ * },
591
+ * },
592
+ * ]
593
+ * }
594
+ */
595
+ addGlobalAttributes?: (this: {
596
+ name: string;
597
+ options: Options;
598
+ storage: Storage;
599
+ extensions: (Node | Mark)[];
600
+ parent: ParentConfig<Config>['addGlobalAttributes'];
601
+ }) => GlobalAttributes;
602
+ /**
603
+ * This function adds commands to the editor
604
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#commands
605
+ * @example
606
+ * addCommands() {
607
+ * return {
608
+ * myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
609
+ * }
610
+ * }
611
+ */
612
+ addCommands?: (this: {
613
+ name: string;
614
+ options: Options;
615
+ storage: Storage;
616
+ editor: Editor;
617
+ type: PMType;
618
+ parent: ParentConfig<Config>['addCommands'];
619
+ }) => Partial<RawCommands>;
620
+ /**
621
+ * This function registers keyboard shortcuts.
622
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#keyboard-shortcuts
623
+ * @example
624
+ * addKeyboardShortcuts() {
625
+ * return {
626
+ * 'Mod-l': () => this.editor.commands.toggleBulletList(),
627
+ * }
628
+ * },
629
+ */
630
+ addKeyboardShortcuts?: (this: {
631
+ name: string;
632
+ options: Options;
633
+ storage: Storage;
634
+ editor: Editor;
635
+ type: PMType;
636
+ parent: ParentConfig<Config>['addKeyboardShortcuts'];
637
+ }) => {
638
+ [key: string]: KeyboardShortcutCommand;
639
+ };
640
+ /**
641
+ * This function adds input rules to the editor.
642
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#input-rules
643
+ * @example
644
+ * addInputRules() {
645
+ * return [
646
+ * markInputRule({
647
+ * find: inputRegex,
648
+ * type: this.type,
649
+ * }),
650
+ * ]
651
+ * },
652
+ */
653
+ addInputRules?: (this: {
654
+ name: string;
655
+ options: Options;
656
+ storage: Storage;
657
+ editor: Editor;
658
+ type: PMType;
659
+ parent: ParentConfig<Config>['addInputRules'];
660
+ }) => InputRule[];
661
+ /**
662
+ * This function adds paste rules to the editor.
663
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#paste-rules
664
+ * @example
665
+ * addPasteRules() {
666
+ * return [
667
+ * markPasteRule({
668
+ * find: pasteRegex,
669
+ * type: this.type,
670
+ * }),
671
+ * ]
672
+ * },
673
+ */
674
+ addPasteRules?: (this: {
675
+ name: string;
676
+ options: Options;
677
+ storage: Storage;
678
+ editor: Editor;
679
+ type: PMType;
680
+ parent: ParentConfig<Config>['addPasteRules'];
681
+ }) => PasteRule[];
682
+ /**
683
+ * This function adds Prosemirror plugins to the editor
684
+ * @see https://tiptap.dev/docs/editor/guide/custom-extensions#prosemirror-plugins
685
+ * @example
686
+ * addProseMirrorPlugins() {
687
+ * return [
688
+ * customPlugin(),
689
+ * ]
690
+ * }
691
+ */
692
+ addProseMirrorPlugins?: (this: {
693
+ name: string;
694
+ options: Options;
695
+ storage: Storage;
696
+ editor: Editor;
697
+ type: PMType;
698
+ parent: ParentConfig<Config>['addProseMirrorPlugins'];
699
+ }) => Plugin[];
700
+ /**
701
+ * This function adds additional extensions to the editor. This is useful for
702
+ * building extension kits.
703
+ * @example
704
+ * addExtensions() {
705
+ * return [
706
+ * BulletList,
707
+ * OrderedList,
708
+ * ListItem
709
+ * ]
710
+ * }
711
+ */
712
+ addExtensions?: (this: {
713
+ name: string;
714
+ options: Options;
715
+ storage: Storage;
716
+ parent: ParentConfig<Config>['addExtensions'];
717
+ }) => Extensions;
718
+ /**
719
+ * This function extends the schema of the node.
720
+ * @example
721
+ * extendNodeSchema() {
722
+ * return {
723
+ * group: 'inline',
724
+ * selectable: false,
725
+ * }
726
+ * }
727
+ */
728
+ extendNodeSchema?: ((this: {
729
+ name: string;
730
+ options: Options;
731
+ storage: Storage;
732
+ parent: ParentConfig<Config>['extendNodeSchema'];
733
+ }, extension: Node) => Record<string, any>) | null;
734
+ /**
735
+ * This function extends the schema of the mark.
736
+ * @example
737
+ * extendMarkSchema() {
738
+ * return {
739
+ * group: 'inline',
740
+ * selectable: false,
741
+ * }
742
+ * }
743
+ */
744
+ extendMarkSchema?: ((this: {
745
+ name: string;
746
+ options: Options;
747
+ storage: Storage;
748
+ parent: ParentConfig<Config>['extendMarkSchema'];
749
+ }, extension: Mark) => Record<string, any>) | null;
750
+ /**
751
+ * The editor is not ready yet.
752
+ */
753
+ onBeforeCreate?: ((this: {
754
+ name: string;
755
+ options: Options;
756
+ storage: Storage;
757
+ editor: Editor;
758
+ type: PMType;
759
+ parent: ParentConfig<Config>['onBeforeCreate'];
760
+ }, event: EditorEvents['beforeCreate']) => void) | null;
761
+ /**
762
+ * The editor is ready.
763
+ */
764
+ onCreate?: ((this: {
765
+ name: string;
766
+ options: Options;
767
+ storage: Storage;
768
+ editor: Editor;
769
+ type: PMType;
770
+ parent: ParentConfig<Config>['onCreate'];
771
+ }, event: EditorEvents['create']) => void) | null;
772
+ /**
773
+ * The content has changed.
774
+ */
775
+ onUpdate?: ((this: {
776
+ name: string;
777
+ options: Options;
778
+ storage: Storage;
779
+ editor: Editor;
780
+ type: PMType;
781
+ parent: ParentConfig<Config>['onUpdate'];
782
+ }, event: EditorEvents['update']) => void) | null;
783
+ /**
784
+ * The selection has changed.
785
+ */
786
+ onSelectionUpdate?: ((this: {
787
+ name: string;
788
+ options: Options;
789
+ storage: Storage;
790
+ editor: Editor;
791
+ type: PMType;
792
+ parent: ParentConfig<Config>['onSelectionUpdate'];
793
+ }, event: EditorEvents['selectionUpdate']) => void) | null;
794
+ /**
795
+ * The editor state has changed.
796
+ */
797
+ onTransaction?: ((this: {
798
+ name: string;
799
+ options: Options;
800
+ storage: Storage;
801
+ editor: Editor;
802
+ type: PMType;
803
+ parent: ParentConfig<Config>['onTransaction'];
804
+ }, event: EditorEvents['transaction']) => void) | null;
805
+ /**
806
+ * The editor is focused.
807
+ */
808
+ onFocus?: ((this: {
809
+ name: string;
810
+ options: Options;
811
+ storage: Storage;
812
+ editor: Editor;
813
+ type: PMType;
814
+ parent: ParentConfig<Config>['onFocus'];
815
+ }, event: EditorEvents['focus']) => void) | null;
816
+ /**
817
+ * The editor isn’t focused anymore.
818
+ */
819
+ onBlur?: ((this: {
820
+ name: string;
821
+ options: Options;
822
+ storage: Storage;
823
+ editor: Editor;
824
+ type: PMType;
825
+ parent: ParentConfig<Config>['onBlur'];
826
+ }, event: EditorEvents['blur']) => void) | null;
827
+ /**
828
+ * The editor is destroyed.
829
+ */
830
+ onDestroy?: ((this: {
831
+ name: string;
832
+ options: Options;
833
+ storage: Storage;
834
+ editor: Editor;
835
+ type: PMType;
836
+ parent: ParentConfig<Config>['onDestroy'];
837
+ }, event: EditorEvents['destroy']) => void) | null;
838
+ }
839
+ declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>> {
840
+ type: string;
841
+ parent: Extendable | null;
842
+ child: Extendable | null;
843
+ name: string;
844
+ config: Config;
845
+ constructor(config?: Partial<Config>);
846
+ get options(): Options;
847
+ get storage(): Readonly<Storage>;
848
+ configure(options?: Partial<Options>): Extendable<Options, Storage, ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>>;
849
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage> | NodeConfig<ExtendedOptions, ExtendedStorage> | MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Extendable<ExtendedOptions, ExtendedStorage>;
850
+ }
851
+
852
+ type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig;
853
+ type AnyExtension = Extendable;
854
+ type Extensions = AnyExtension[];
855
+ type ParentConfig<T> = Partial<{
856
+ [P in keyof T]: Required<T>[P] extends (...args: any) => any ? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]> : T[P];
857
+ }>;
858
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
859
+ type RemoveThis<T> = T extends (...args: any) => any ? (...args: Parameters<T>) => ReturnType<T> : T;
860
+ type MaybeReturnType<T> = T extends (...args: any) => any ? ReturnType<T> : T;
861
+ type MaybeThisParameterType<T> = Exclude<T, Primitive> extends (...args: any) => any ? ThisParameterType<Exclude<T, Primitive>> : any;
862
+ interface EditorEvents {
863
+ beforeCreate: {
864
+ /**
865
+ * The editor instance
866
+ */
867
+ editor: Editor;
868
+ };
869
+ create: {
870
+ /**
871
+ * The editor instance
872
+ */
873
+ editor: Editor;
874
+ };
875
+ contentError: {
876
+ /**
877
+ * The editor instance
878
+ */
879
+ editor: Editor;
880
+ /**
881
+ * The error that occurred while parsing the content
882
+ */
883
+ error: Error;
884
+ /**
885
+ * If called, will re-initialize the editor with the collaboration extension removed.
886
+ * This will prevent syncing back deletions of content not present in the current schema.
887
+ */
888
+ disableCollaboration: () => void;
889
+ };
890
+ update: {
891
+ /**
892
+ * The editor instance
893
+ */
894
+ editor: Editor;
895
+ /**
896
+ * The transaction that caused the update
897
+ */
898
+ transaction: Transaction;
899
+ /**
900
+ * Appended transactions that were added to the initial transaction by plugins
901
+ */
902
+ appendedTransactions: Transaction[];
903
+ };
904
+ selectionUpdate: {
905
+ /**
906
+ * The editor instance
907
+ */
908
+ editor: Editor;
909
+ /**
910
+ * The transaction that caused the selection update
911
+ */
912
+ transaction: Transaction;
913
+ };
914
+ beforeTransaction: {
915
+ /**
916
+ * The editor instance
917
+ */
918
+ editor: Editor;
919
+ /**
920
+ * The transaction that will be applied
921
+ */
922
+ transaction: Transaction;
923
+ /**
924
+ * The next state of the editor after the transaction is applied
925
+ */
926
+ nextState: EditorState;
927
+ };
928
+ transaction: {
929
+ /**
930
+ * The editor instance
931
+ */
932
+ editor: Editor;
933
+ /**
934
+ * The initial transaction
935
+ */
936
+ transaction: Transaction;
937
+ /**
938
+ * Appended transactions that were added to the initial transaction by plugins
939
+ */
940
+ appendedTransactions: Transaction[];
941
+ };
942
+ focus: {
943
+ /**
944
+ * The editor instance
945
+ */
946
+ editor: Editor;
947
+ /**
948
+ * The focus event
949
+ */
950
+ event: FocusEvent;
951
+ /**
952
+ * The transaction that caused the focus
953
+ */
954
+ transaction: Transaction;
955
+ };
956
+ blur: {
957
+ /**
958
+ * The editor instance
959
+ */
960
+ editor: Editor;
961
+ /**
962
+ * The focus event
963
+ */
964
+ event: FocusEvent;
965
+ /**
966
+ * The transaction that caused the blur
967
+ */
968
+ transaction: Transaction;
969
+ };
970
+ destroy: void;
971
+ paste: {
972
+ /**
973
+ * The editor instance
974
+ */
975
+ editor: Editor;
976
+ /**
977
+ * The clipboard event
978
+ */
979
+ event: ClipboardEvent;
980
+ /**
981
+ * The slice that was pasted
982
+ */
983
+ slice: Slice;
984
+ };
985
+ drop: {
986
+ /**
987
+ * The editor instance
988
+ */
989
+ editor: Editor;
990
+ /**
991
+ * The drag event
992
+ */
993
+ event: DragEvent;
994
+ /**
995
+ * The slice that was dropped
996
+ */
997
+ slice: Slice;
998
+ /**
999
+ * Whether the content was moved (true) or copied (false)
1000
+ */
1001
+ moved: boolean;
1002
+ };
1003
+ delete: {
1004
+ /**
1005
+ * The editor instance
1006
+ */
1007
+ editor: Editor;
1008
+ /**
1009
+ * The range of the deleted content (before the deletion)
1010
+ */
1011
+ deletedRange: Range;
1012
+ /**
1013
+ * The new range of positions of where the deleted content was in the new document (after the deletion)
1014
+ */
1015
+ newRange: Range;
1016
+ /**
1017
+ * The transaction that caused the deletion
1018
+ */
1019
+ transaction: Transaction;
1020
+ /**
1021
+ * The combined transform (including all appended transactions) that caused the deletion
1022
+ */
1023
+ combinedTransform: Transform;
1024
+ /**
1025
+ * Whether the deletion was partial (only a part of this content was deleted)
1026
+ */
1027
+ partial: boolean;
1028
+ /**
1029
+ * This is the start position of the mark in the document (before the deletion)
1030
+ */
1031
+ from: number;
1032
+ /**
1033
+ * This is the end position of the mark in the document (before the deletion)
1034
+ */
1035
+ to: number;
1036
+ } & ({
1037
+ /**
1038
+ * The content that was deleted
1039
+ */
1040
+ type: 'node';
1041
+ /**
1042
+ * The node which the deletion occurred in
1043
+ * @note This can be a parent node of the deleted content
1044
+ */
1045
+ node: Node$1;
1046
+ /**
1047
+ * The new start position of the node in the document (after the deletion)
1048
+ */
1049
+ newFrom: number;
1050
+ /**
1051
+ * The new end position of the node in the document (after the deletion)
1052
+ */
1053
+ newTo: number;
1054
+ } | {
1055
+ /**
1056
+ * The content that was deleted
1057
+ */
1058
+ type: 'mark';
1059
+ /**
1060
+ * The mark that was deleted
1061
+ */
1062
+ mark: Mark$1;
1063
+ });
1064
+ }
1065
+ type EnableRules = (AnyExtension | string)[] | boolean;
1066
+ interface EditorOptions {
1067
+ /**
1068
+ * The element or selector to bind the editor to
1069
+ * If `null` is passed, the editor will not be mounted automatically
1070
+ * If a function is passed, it will be called with the editor's root element
1071
+ */
1072
+ element: Element | null;
1073
+ /**
1074
+ * The content of the editor (HTML, JSON, or a JSON array)
1075
+ */
1076
+ content: Content;
1077
+ /**
1078
+ * The extensions to use
1079
+ */
1080
+ extensions: Extensions;
1081
+ /**
1082
+ * Whether to inject base CSS styles
1083
+ */
1084
+ injectCSS: boolean;
1085
+ /**
1086
+ * A nonce to use for CSP while injecting styles
1087
+ */
1088
+ injectNonce: string | undefined;
1089
+ /**
1090
+ * The editor's initial focus position
1091
+ */
1092
+ autofocus: FocusPosition;
1093
+ /**
1094
+ * Whether the editor is editable
1095
+ */
1096
+ editable: boolean;
1097
+ /**
1098
+ * The editor's props
1099
+ */
1100
+ editorProps: EditorProps;
1101
+ /**
1102
+ * The editor's content parser options
1103
+ */
1104
+ parseOptions: ParseOptions;
1105
+ /**
1106
+ * The editor's core extension options
1107
+ */
1108
+ coreExtensionOptions?: {
1109
+ clipboardTextSerializer?: {
1110
+ blockSeparator?: string;
1111
+ };
1112
+ delete?: {
1113
+ /**
1114
+ * Whether the `delete` extension should be called asynchronously to avoid blocking the editor while processing deletions
1115
+ * @default true deletion events are called asynchronously
1116
+ */
1117
+ async?: boolean;
1118
+ /**
1119
+ * Allows filtering the transactions that are processed by the `delete` extension.
1120
+ * If the function returns `true`, the transaction will be ignored.
1121
+ */
1122
+ filterTransaction?: (transaction: Transaction) => boolean;
1123
+ };
1124
+ };
1125
+ /**
1126
+ * Whether to enable input rules behavior
1127
+ */
1128
+ enableInputRules: EnableRules;
1129
+ /**
1130
+ * Whether to enable paste rules behavior
1131
+ */
1132
+ enablePasteRules: EnableRules;
1133
+ /**
1134
+ * Determines whether core extensions are enabled.
1135
+ *
1136
+ * If set to `false`, all core extensions will be disabled.
1137
+ * To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`.
1138
+ * Extensions not listed in the object will remain enabled.
1139
+ *
1140
+ * @example
1141
+ * // Disable all core extensions
1142
+ * enabledCoreExtensions: false
1143
+ *
1144
+ * @example
1145
+ * // Disable only the keymap core extension
1146
+ * enabledCoreExtensions: { keymap: false }
1147
+ *
1148
+ * @default true
1149
+ */
1150
+ enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste' | 'delete', false>>;
1151
+ /**
1152
+ * If `true`, the editor will check the content for errors on initialization.
1153
+ * Emitting the `contentError` event if the content is invalid.
1154
+ * Which can be used to show a warning or error message to the user.
1155
+ * @default false
1156
+ */
1157
+ enableContentCheck: boolean;
1158
+ /**
1159
+ * Called before the editor is constructed.
1160
+ */
1161
+ onBeforeCreate: (props: EditorEvents['beforeCreate']) => void;
1162
+ /**
1163
+ * Called after the editor is constructed.
1164
+ */
1165
+ onCreate: (props: EditorEvents['create']) => void;
1166
+ /**
1167
+ * Called when the editor encounters an error while parsing the content.
1168
+ * Only enabled if `enableContentCheck` is `true`.
1169
+ */
1170
+ onContentError: (props: EditorEvents['contentError']) => void;
1171
+ /**
1172
+ * Called when the editor's content is updated.
1173
+ */
1174
+ onUpdate: (props: EditorEvents['update']) => void;
1175
+ /**
1176
+ * Called when the editor's selection is updated.
1177
+ */
1178
+ onSelectionUpdate: (props: EditorEvents['selectionUpdate']) => void;
1179
+ /**
1180
+ * Called after a transaction is applied to the editor.
1181
+ */
1182
+ onTransaction: (props: EditorEvents['transaction']) => void;
1183
+ /**
1184
+ * Called on focus events.
1185
+ */
1186
+ onFocus: (props: EditorEvents['focus']) => void;
1187
+ /**
1188
+ * Called on blur events.
1189
+ */
1190
+ onBlur: (props: EditorEvents['blur']) => void;
1191
+ /**
1192
+ * Called when the editor is destroyed.
1193
+ */
1194
+ onDestroy: (props: EditorEvents['destroy']) => void;
1195
+ /**
1196
+ * Called when content is pasted into the editor.
1197
+ */
1198
+ onPaste: (e: ClipboardEvent, slice: Slice) => void;
1199
+ /**
1200
+ * Called when content is dropped into the editor.
1201
+ */
1202
+ onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void;
1203
+ /**
1204
+ * Called when content is deleted from the editor.
1205
+ */
1206
+ onDelete: (props: EditorEvents['delete']) => void;
1207
+ }
1208
+ /**
1209
+ * The editor's content as HTML
1210
+ */
1211
+ type HTMLContent = string;
1212
+ /**
1213
+ * Loosely describes a JSON representation of a Prosemirror document or node
1214
+ */
1215
+ type JSONContent = {
1216
+ type?: string;
1217
+ attrs?: Record<string, any>;
1218
+ content?: JSONContent[];
1219
+ marks?: {
1220
+ type: string;
1221
+ attrs?: Record<string, any>;
1222
+ [key: string]: any;
1223
+ }[];
1224
+ text?: string;
1225
+ [key: string]: any;
1226
+ };
1227
+ /**
1228
+ * A mark type is either a JSON representation of a mark or a Prosemirror mark instance
1229
+ */
1230
+ type MarkType<Type extends string | {
1231
+ name: string;
1232
+ } = any, TAttributes extends undefined | Record<string, any> = any> = {
1233
+ type: Type;
1234
+ attrs: TAttributes;
1235
+ };
1236
+ /**
1237
+ * A node type is either a JSON representation of a node or a Prosemirror node instance
1238
+ */
1239
+ type NodeType<Type extends string | {
1240
+ name: string;
1241
+ } = any, TAttributes extends undefined | Record<string, any> = any, NodeMarkType extends MarkType = any, TContent extends (NodeType | TextType)[] = any> = {
1242
+ type: Type;
1243
+ attrs: TAttributes;
1244
+ content?: TContent;
1245
+ marks?: NodeMarkType[];
1246
+ };
1247
+ /**
1248
+ * A node type is either a JSON representation of a doc node or a Prosemirror doc node instance
1249
+ */
1250
+ type DocumentType<TDocAttributes extends Record<string, any> | undefined = Record<string, any>, TContentType extends NodeType[] = NodeType[]> = Omit<NodeType<'doc', TDocAttributes, never, TContentType>, 'marks' | 'content'> & {
1251
+ content: TContentType;
1252
+ };
1253
+ /**
1254
+ * A node type is either a JSON representation of a text node or a Prosemirror text node instance
1255
+ */
1256
+ type TextType<TMarkType extends MarkType = MarkType> = {
1257
+ type: 'text';
1258
+ text: string;
1259
+ marks: TMarkType[];
1260
+ };
1261
+ /**
1262
+ * Describes the output of a `renderHTML` function in prosemirror
1263
+ * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec
1264
+ */
1265
+ type DOMOutputSpecArray$1 = [string] | [string, Record<string, any>] | [string, 0] | [string, Record<string, any>, 0] | [string, Record<string, any>, DOMOutputSpecArray$1 | 0] | [string, DOMOutputSpecArray$1];
1266
+ type Content = HTMLContent | JSONContent | JSONContent[] | null;
1267
+ type CommandProps = {
1268
+ editor: Editor;
1269
+ tr: Transaction;
1270
+ commands: SingleCommands;
1271
+ can: () => CanCommands;
1272
+ chain: () => ChainedCommands;
1273
+ state: EditorState;
1274
+ view: EditorView;
1275
+ dispatch: ((args?: any) => any) | undefined;
1276
+ };
1277
+ type Command = (props: CommandProps) => boolean;
1278
+ type CommandSpec = (...args: any[]) => Command;
1279
+ type KeyboardShortcutCommand = (props: {
1280
+ editor: Editor;
1281
+ }) => boolean;
1282
+ type Attribute = {
1283
+ default?: any;
1284
+ validate?: string | ((value: any) => void);
1285
+ rendered?: boolean;
1286
+ renderHTML?: ((attributes: Record<string, any>) => Record<string, any> | null) | null;
1287
+ parseHTML?: ((element: HTMLElement) => any | null) | null;
1288
+ keepOnSplit?: boolean;
1289
+ isRequired?: boolean;
1290
+ };
1291
+ type Attributes$1 = {
1292
+ [key: string]: Attribute;
1293
+ };
1294
+ type ExtensionAttribute = {
1295
+ type: string;
1296
+ name: string;
1297
+ attribute: Required<Omit<Attribute, 'validate'>> & Pick<Attribute, 'validate'>;
1298
+ };
1299
+ type GlobalAttributes = {
1300
+ /**
1301
+ * The node & mark types this attribute should be applied to.
1302
+ */
1303
+ types: string[];
1304
+ /**
1305
+ * The attributes to add to the node or mark types.
1306
+ */
1307
+ attributes: Record<string, Attribute | undefined>;
1308
+ }[];
1309
+ type PickValue<T, K extends keyof T> = T[K];
1310
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
1311
+ type Diff<T extends keyof any, U extends keyof any> = ({
1312
+ [P in T]: P;
1313
+ } & {
1314
+ [P in U]: never;
1315
+ } & {
1316
+ [x: string]: never;
1317
+ })[T];
1318
+ type Overwrite<T, U> = Pick<T, Diff<keyof T, keyof U>> & U;
1319
+ type ValuesOf<T> = T[keyof T];
1320
+ type KeysWithTypeOf<T, Type> = {
1321
+ [P in keyof T]: T[P] extends Type ? P : never;
1322
+ }[keyof T];
1323
+ type DOMNode = InstanceType<typeof window.Node>;
1324
+ /**
1325
+ * prosemirror-view does not export the `type` property of `Decoration`.
1326
+ * So, this defines the `DecorationType` interface to include the `type` property.
1327
+ */
1328
+ interface DecorationType {
1329
+ spec: any;
1330
+ map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
1331
+ valid(node: Node, span: Decoration): boolean;
1332
+ eq(other: DecorationType): boolean;
1333
+ destroy(dom: DOMNode): void;
1334
+ readonly attrs: DecorationAttrs;
1335
+ }
1336
+ /**
1337
+ * prosemirror-view does not export the `type` property of `Decoration`.
1338
+ * This adds the `type` property to the `Decoration` type.
1339
+ */
1340
+ type DecorationWithType = Decoration & {
1341
+ type: DecorationType;
1342
+ };
1343
+ interface NodeViewProps extends NodeViewRendererProps {
1344
+ decorations: readonly DecorationWithType[];
1345
+ selected: boolean;
1346
+ updateAttributes: (attributes: Record<string, any>) => void;
1347
+ deleteNode: () => void;
1348
+ }
1349
+ interface NodeViewRendererOptions {
1350
+ stopEvent: ((props: {
1351
+ event: Event;
1352
+ }) => boolean) | null;
1353
+ ignoreMutation: ((props: {
1354
+ mutation: ViewMutationRecord;
1355
+ }) => boolean) | null;
1356
+ contentDOMElementTag: string;
1357
+ }
1358
+ interface NodeViewRendererProps {
1359
+ /**
1360
+ * The node that is being rendered.
1361
+ */
1362
+ node: Parameters<NodeViewConstructor>[0];
1363
+ /**
1364
+ * The editor's view.
1365
+ */
1366
+ view: Parameters<NodeViewConstructor>[1];
1367
+ /**
1368
+ * A function that can be called to get the node's current position in the document.
1369
+ */
1370
+ getPos: Parameters<NodeViewConstructor>[2];
1371
+ /**
1372
+ * is an array of node or inline decorations that are active around the node.
1373
+ * They are automatically drawn in the normal way, and you will usually just want to ignore this, but they can also be used as a way to provide context information to the node view without adding it to the document itself.
1374
+ */
1375
+ decorations: Parameters<NodeViewConstructor>[3];
1376
+ /**
1377
+ * holds the decorations for the node's content. You can safely ignore this if your view has no content or a contentDOM property, since the editor will draw the decorations on the content.
1378
+ * But if you, for example, want to create a nested editor with the content, it may make sense to provide it with the inner decorations.
1379
+ */
1380
+ innerDecorations: Parameters<NodeViewConstructor>[4];
1381
+ /**
1382
+ * The editor instance.
1383
+ */
1384
+ editor: Editor;
1385
+ /**
1386
+ * The extension that is responsible for the node.
1387
+ */
1388
+ extension: Node;
1389
+ /**
1390
+ * The HTML attributes that should be added to the node's DOM element.
1391
+ */
1392
+ HTMLAttributes: Record<string, any>;
1393
+ }
1394
+ type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView$1;
1395
+ interface MarkViewProps extends MarkViewRendererProps {
1396
+ }
1397
+ interface MarkViewRendererProps {
1398
+ /**
1399
+ * The node that is being rendered.
1400
+ */
1401
+ mark: Parameters<MarkViewConstructor>[0];
1402
+ /**
1403
+ * The editor's view.
1404
+ */
1405
+ view: Parameters<MarkViewConstructor>[1];
1406
+ /**
1407
+ * indicates whether the mark's content is inline
1408
+ */
1409
+ inline: Parameters<MarkViewConstructor>[2];
1410
+ /**
1411
+ * The editor instance.
1412
+ */
1413
+ editor: Editor;
1414
+ /**
1415
+ * The extension that is responsible for the mark.
1416
+ */
1417
+ extension: Mark;
1418
+ /**
1419
+ * The HTML attributes that should be added to the mark's DOM element.
1420
+ */
1421
+ HTMLAttributes: Record<string, any>;
1422
+ }
1423
+ type MarkViewRenderer = (props: MarkViewRendererProps) => MarkView$1;
1424
+ interface MarkViewRendererOptions {
1425
+ ignoreMutation: ((props: {
1426
+ mutation: ViewMutationRecord;
1427
+ }) => boolean) | null;
1428
+ }
1429
+ type AnyCommands = Record<string, (...args: any[]) => Command>;
1430
+ type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, object>>>>;
1431
+ type RawCommands = {
1432
+ [Item in keyof UnionCommands]: UnionCommands<Command>[Item];
1433
+ };
1434
+ type SingleCommands = {
1435
+ [Item in keyof UnionCommands]: UnionCommands<boolean>[Item];
1436
+ };
1437
+ type ChainedCommands = {
1438
+ [Item in keyof UnionCommands]: UnionCommands<ChainedCommands>[Item];
1439
+ } & {
1440
+ run: () => boolean;
1441
+ };
1442
+ type CanCommands = SingleCommands & {
1443
+ chain: () => ChainedCommands;
1444
+ };
1445
+ type FocusPosition = 'start' | 'end' | 'all' | number | boolean | null;
1446
+ type Range = {
1447
+ from: number;
1448
+ to: number;
1449
+ };
1450
+ type NodeRange = {
1451
+ node: Node$1;
1452
+ from: number;
1453
+ to: number;
1454
+ };
1455
+ type MarkRange = {
1456
+ mark: Mark$1;
1457
+ from: number;
1458
+ to: number;
1459
+ };
1460
+ type Predicate = (node: Node$1) => boolean;
1461
+ type NodeWithPos = {
1462
+ node: Node$1;
1463
+ pos: number;
1464
+ };
1465
+ type TextSerializer = (props: {
1466
+ node: Node$1;
1467
+ pos: number;
1468
+ parent: Node$1;
1469
+ index: number;
1470
+ range: Range;
1471
+ }) => string;
1472
+ type ExtendedRegExpMatchArray = RegExpMatchArray & {
1473
+ data?: Record<string, any>;
1474
+ };
1475
+ type Dispatch = ((args?: any) => any) | undefined;
1476
+
1477
+ /**
1478
+ * Create a new Prosemirror document node from content.
1479
+ * @param content The JSON or HTML content to create the document from
1480
+ * @param schema The Prosemirror schema to use for the document
1481
+ * @param parseOptions Options for the parser
1482
+ * @returns The created Prosemirror document node
1483
+ */
1484
+ declare function createDocument(content: Content | Node$1 | Fragment$1, schema: Schema, parseOptions?: ParseOptions, options?: {
1485
+ errorOnInvalidContent?: boolean;
1486
+ }): Node$1;
1487
+
1488
+ type CreateNodeFromContentOptions = {
1489
+ slice?: boolean;
1490
+ parseOptions?: ParseOptions;
1491
+ errorOnInvalidContent?: boolean;
1492
+ };
1493
+ /**
1494
+ * Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.
1495
+ * @param content The JSON or HTML content to create the node from
1496
+ * @param schema The Prosemirror schema to use for the node
1497
+ * @param options Options for the parser
1498
+ * @returns The created Prosemirror node or fragment
1499
+ */
1500
+ declare function createNodeFromContent(content: Content | Node$1 | Fragment$1, schema: Schema, options?: CreateNodeFromContentOptions): Node$1 | Fragment$1;
1501
+
1502
+ /**
1503
+ * Gets the default block type at a given match
1504
+ * @param match The content match to get the default block type from
1505
+ * @returns The default block type or null
1506
+ */
1507
+ declare function defaultBlockAt(match: ContentMatch): NodeType$1 | null;
1508
+
1509
+ /**
1510
+ * Find children inside a Prosemirror node that match a predicate.
1511
+ * @param node The Prosemirror node to search in
1512
+ * @param predicate The predicate to match
1513
+ * @returns An array of nodes with their positions
1514
+ */
1515
+ declare function findChildren(node: Node$1, predicate: Predicate): NodeWithPos[];
1516
+
1517
+ /**
1518
+ * Same as `findChildren` but searches only within a `range`.
1519
+ * @param node The Prosemirror node to search in
1520
+ * @param range The range to search in
1521
+ * @param predicate The predicate to match
1522
+ * @returns An array of nodes with their positions
1523
+ */
1524
+ declare function findChildrenInRange(node: Node$1, range: Range, predicate: Predicate): NodeWithPos[];
1525
+
1526
+ /**
1527
+ * Finds the closest parent node to a resolved position that matches a predicate.
1528
+ * @param $pos The resolved position to search from
1529
+ * @param predicate The predicate to match
1530
+ * @returns The closest parent node to the resolved position that matches the predicate
1531
+ * @example ```js
1532
+ * findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')
1533
+ * ```
1534
+ */
1535
+ declare function findParentNodeClosestToPos($pos: ResolvedPos, predicate: Predicate): {
1536
+ pos: number;
1537
+ start: number;
1538
+ depth: number;
1539
+ node: Node$1;
1540
+ } | undefined;
1541
+
1542
+ /**
1543
+ * Finds the closest parent node to the current selection that matches a predicate.
1544
+ * @param predicate The predicate to match
1545
+ * @returns A command that finds the closest parent node to the current selection that matches the predicate
1546
+ * @example ```js
1547
+ * findParentNode(node => node.type.name === 'paragraph')
1548
+ * ```
1549
+ */
1550
+ declare function findParentNode(predicate: Predicate): (selection: Selection) => ReturnType<typeof findParentNodeClosestToPos>;
1551
+
1552
+ /**
1553
+ * Create a flattened array of extensions by traversing the `addExtensions` field.
1554
+ * @param extensions An array of Tiptap extensions
1555
+ * @returns A flattened array of Tiptap extensions
1556
+ */
1557
+ declare function flattenExtensions(extensions: Extensions): Extensions;
1558
+
1559
+ /**
1560
+ * Generate HTML from a JSONContent
1561
+ * @param doc The JSONContent to generate HTML from
1562
+ * @param extensions The extensions to use for the schema
1563
+ * @returns The generated HTML
1564
+ */
1565
+ declare function generateHTML(doc: JSONContent, extensions: Extensions): string;
1566
+
1567
+ /**
1568
+ * Generate JSONContent from HTML
1569
+ * @param html The HTML to generate JSONContent from
1570
+ * @param extensions The extensions to use for the schema
1571
+ * @returns The generated JSONContent
1572
+ */
1573
+ declare function generateJSON(html: string, extensions: Extensions): Record<string, any>;
1574
+
1575
+ /**
1576
+ * Generate raw text from a JSONContent
1577
+ * @param doc The JSONContent to generate text from
1578
+ * @param extensions The extensions to use for the schema
1579
+ * @param options Options for the text generation f.e. blockSeparator or textSerializers
1580
+ * @returns The generated text
1581
+ */
1582
+ declare function generateText(doc: JSONContent, extensions: Extensions, options?: {
1583
+ blockSeparator?: string;
1584
+ textSerializers?: Record<string, TextSerializer>;
1585
+ }): string;
1586
+
1587
+ /**
1588
+ * Get node or mark attributes by type or name on the current editor state
1589
+ * @param state The current editor state
1590
+ * @param typeOrName The node or mark type or name
1591
+ * @returns The attributes of the node or mark or an empty object
1592
+ */
1593
+ declare function getAttributes(state: EditorState, typeOrName: string | NodeType$1 | MarkType$1): Record<string, any>;
1594
+
1595
+ /**
1596
+ * Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.
1597
+ * @param extensions List of extensions
1598
+ */
1599
+ declare function getAttributesFromExtensions(extensions: Extensions): ExtensionAttribute[];
1600
+
1601
+ type ChangedRange = {
1602
+ oldRange: Range;
1603
+ newRange: Range;
1604
+ };
1605
+ /**
1606
+ * Returns a list of changed ranges
1607
+ * based on the first and last state of all steps.
1608
+ */
1609
+ declare function getChangedRanges(transform: Transform): ChangedRange[];
1610
+
1611
+ interface DebugJSONContent extends JSONContent {
1612
+ from: number;
1613
+ to: number;
1614
+ }
1615
+ declare function getDebugJSON(node: Node$1, startOffset?: number): DebugJSONContent;
1616
+
1617
+ interface ExtensionConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, ExtensionConfig<Options, Storage>, null> {
1618
+ }
1619
+ /**
1620
+ * The Extension class is the base class for all extensions.
1621
+ * @see https://tiptap.dev/api/extensions#create-a-new-extension
1622
+ */
1623
+ declare class Extension<Options = any, Storage = any> extends Extendable<Options, Storage, ExtensionConfig<Options, Storage>> {
1624
+ type: string;
1625
+ static create<O = any, S = any>(config?: Partial<ExtensionConfig<O, S>>): Extension<O, S>;
1626
+ configure(options?: Partial<Options>): Extension<Options, Storage>;
1627
+ extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Extension<ExtendedOptions, ExtendedStorage>;
1628
+ }
1629
+
1630
+ /**
1631
+ * Returns a field from an extension
1632
+ * @param extension The Tiptap extension
1633
+ * @param field The field, for example `renderHTML` or `priority`
1634
+ * @param context The context object that should be passed as `this` into the function
1635
+ * @returns The field value
1636
+ */
1637
+ declare function getExtensionField<T = any, E extends AnyExtension = any>(extension: E, field: keyof ExtensionConfig | keyof MarkConfig | keyof NodeConfig, context?: Omit<MaybeThisParameterType<T>, 'parent'>): RemoveThis<T>;
1638
+
1639
+ declare function getHTMLFromFragment(fragment: Fragment$1, schema: Schema): string;
1640
+
1641
+ declare function getMarkAttributes(state: EditorState, typeOrName: string | MarkType$1): Record<string, any>;
1642
+
1643
+ /**
1644
+ * Get the range of a mark at a resolved position.
1645
+ */
1646
+ declare function getMarkRange(
1647
+ /**
1648
+ * The position to get the mark range for.
1649
+ */
1650
+ $pos: ResolvedPos,
1651
+ /**
1652
+ * The mark type to get the range for.
1653
+ */
1654
+ type: MarkType$1,
1655
+ /**
1656
+ * The attributes to match against.
1657
+ * If not provided, only the first mark at the position will be matched.
1658
+ */
1659
+ attributes?: Record<string, any>): Range | void;
1660
+
1661
+ declare function getMarksBetween(from: number, to: number, doc: Node$1): MarkRange[];
1662
+
1663
+ declare function getMarkType(nameOrType: string | MarkType$1, schema: Schema): MarkType$1;
1664
+
1665
+ /**
1666
+ * Finds the first node of a given type or name in the current selection.
1667
+ * @param state The editor state.
1668
+ * @param typeOrName The node type or name.
1669
+ * @param pos The position to start searching from.
1670
+ * @param maxDepth The maximum depth to search.
1671
+ * @returns The node and the depth as an array.
1672
+ */
1673
+ declare const getNodeAtPosition: (state: EditorState, typeOrName: string | NodeType$1, pos: number, maxDepth?: number) => [Node$1 | null, number];
1674
+
1675
+ declare function getNodeAttributes(state: EditorState, typeOrName: string | NodeType$1): Record<string, any>;
1676
+
1677
+ declare function getNodeType(nameOrType: string | NodeType$1, schema: Schema): NodeType$1;
1678
+
1679
+ declare function getRenderedAttributes(nodeOrMark: Node$1 | Mark$1, extensionAttributes: ExtensionAttribute[]): Record<string, any>;
1680
+
1681
+ declare function getSchema(extensions: Extensions, editor?: Editor): Schema;
1682
+
1683
+ /**
1684
+ * Creates a new Prosemirror schema based on the given extensions.
1685
+ * @param extensions An array of Tiptap extensions
1686
+ * @param editor The editor instance
1687
+ * @returns A Prosemirror schema
1688
+ */
1689
+ declare function getSchemaByResolvedExtensions(extensions: Extensions, editor?: Editor): Schema;
1690
+
1691
+ /**
1692
+ * Tries to get a node or mark type by its name.
1693
+ * @param name The name of the node or mark type
1694
+ * @param schema The Prosemiror schema to search in
1695
+ * @returns The node or mark type, or null if it doesn't exist
1696
+ */
1697
+ declare function getSchemaTypeByName(name: string, schema: Schema): NodeType$1 | MarkType$1 | null;
1698
+
1699
+ /**
1700
+ * Get the type of a schema item by its name.
1701
+ * @param name The name of the schema item
1702
+ * @param schema The Prosemiror schema to search in
1703
+ * @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist
1704
+ */
1705
+ declare function getSchemaTypeNameByName(name: string, schema: Schema): 'node' | 'mark' | null;
1706
+
1707
+ /**
1708
+ * Return attributes of an extension that should be splitted by keepOnSplit flag
1709
+ * @param extensionAttributes Array of extension attributes
1710
+ * @param typeName The type of the extension
1711
+ * @param attributes The attributes of the extension
1712
+ * @returns The splitted attributes
1713
+ */
1714
+ declare function getSplittedAttributes(extensionAttributes: ExtensionAttribute[], typeName: string, attributes: Record<string, any>): Record<string, any>;
1715
+
1716
+ /**
1717
+ * Gets the text of a Prosemirror node
1718
+ * @param node The Prosemirror node
1719
+ * @param options Options for the text serializer & block separator
1720
+ * @returns The text of the node
1721
+ * @example ```js
1722
+ * const text = getText(node, { blockSeparator: '\n' })
1723
+ * ```
1724
+ */
1725
+ declare function getText(node: Node$1, options?: {
1726
+ blockSeparator?: string;
1727
+ textSerializers?: Record<string, TextSerializer>;
1728
+ }): string;
1729
+
1730
+ /**
1731
+ * Gets the text between two positions in a Prosemirror node
1732
+ * and serializes it using the given text serializers and block separator (see getText)
1733
+ * @param startNode The Prosemirror node to start from
1734
+ * @param range The range of the text to get
1735
+ * @param options Options for the text serializer & block separator
1736
+ * @returns The text between the two positions
1737
+ */
1738
+ declare function getTextBetween(startNode: Node$1, range: Range, options?: {
1739
+ blockSeparator?: string;
1740
+ textSerializers?: Record<string, TextSerializer>;
1741
+ }): string;
1742
+
1743
+ /**
1744
+ * Returns the text content of a resolved prosemirror position
1745
+ * @param $from The resolved position to get the text content from
1746
+ * @param maxMatch The maximum number of characters to match
1747
+ * @returns The text content
1748
+ */
1749
+ declare const getTextContentFromNodes: ($from: ResolvedPos, maxMatch?: number) => string;
1750
+
1751
+ /**
1752
+ * Find text serializers `toText` in a Prosemirror schema
1753
+ * @param schema The Prosemirror schema to search in
1754
+ * @returns A record of text serializers by node name
1755
+ */
1756
+ declare function getTextSerializersFromSchema(schema: Schema): Record<string, TextSerializer>;
1757
+
1758
+ /**
1759
+ * This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).
1760
+ * Cancels when `getAttrs` returned `false`.
1761
+ * @param parseRule ProseMirror ParseRule
1762
+ * @param extensionAttributes List of attributes to inject
1763
+ */
1764
+ declare function injectExtensionAttributesToParseRule(parseRule: ParseRule, extensionAttributes: ExtensionAttribute[]): ParseRule;
1765
+
1766
+ declare function isActive(state: EditorState, name: string | null, attributes?: Record<string, any>): boolean;
1767
+
1768
+ declare const isAtEndOfNode: (state: EditorState, nodeType?: string) => boolean;
1769
+
1770
+ declare const isAtStartOfNode: (state: EditorState) => boolean;
1771
+
1772
+ declare function isExtensionRulesEnabled(extension: AnyExtension, enabled: EnableRules): boolean;
1773
+
1774
+ declare function isList(name: string, extensions: Extensions): boolean;
1775
+
1776
+ declare function isMarkActive(state: EditorState, typeOrName: MarkType$1 | string | null, attributes?: Record<string, any>): boolean;
1777
+
1778
+ declare function isNodeActive(state: EditorState, typeOrName: NodeType$1 | string | null, attributes?: Record<string, any>): boolean;
1779
+
1780
+ /**
1781
+ * Returns true if the given prosemirror node is empty.
1782
+ */
1783
+ declare function isNodeEmpty(node: Node$1, { checkChildren, ignoreWhitespace, }?: {
1784
+ /**
1785
+ * When true (default), it will also check if all children are empty.
1786
+ */
1787
+ checkChildren?: boolean;
1788
+ /**
1789
+ * When true, it will ignore whitespace when checking for emptiness.
1790
+ */
1791
+ ignoreWhitespace?: boolean;
1792
+ }): boolean;
1793
+
1794
+ declare function isNodeSelection(value: unknown): value is NodeSelection;
1795
+
1796
+ declare function isTextSelection(value: unknown): value is TextSelection;
1797
+
1798
+ declare function posToDOMRect(view: EditorView, from: number, to: number): DOMRect;
1799
+
1800
+ /**
1801
+ * Returns a flattened and sorted extension list while
1802
+ * also checking for duplicated extensions and warns the user.
1803
+ * @param extensions An array of Tiptap extensions
1804
+ * @returns An flattened and sorted array of Tiptap extensions
1805
+ */
1806
+ declare function resolveExtensions(extensions: Extensions): Extensions;
1807
+
1808
+ declare function resolveFocusPosition(doc: Node$1, position?: FocusPosition): Selection | null;
1809
+
1810
+ type RewriteUnknownContentOptions = {
1811
+ /**
1812
+ * If true, unknown nodes will be treated as paragraphs
1813
+ * @default true
1814
+ */
1815
+ fallbackToParagraph?: boolean;
1816
+ };
1817
+ /**
1818
+ * Rewrite unknown nodes and marks within JSON content
1819
+ * Allowing for user within the editor
1820
+ */
1821
+ declare function rewriteUnknownContent(
1822
+ /**
1823
+ * The JSON content to clean of unknown nodes and marks
1824
+ */
1825
+ json: JSONContent,
1826
+ /**
1827
+ * The schema to use for validation
1828
+ */
1829
+ schema: Schema,
1830
+ /**
1831
+ * Options for the cleaning process
1832
+ */
1833
+ options?: RewriteUnknownContentOptions): {
1834
+ /**
1835
+ * The cleaned JSON content
1836
+ */
1837
+ json: JSONContent | null;
1838
+ /**
1839
+ * The array of nodes and marks that were rewritten
1840
+ */
1841
+ rewrittenContent: {
1842
+ /**
1843
+ * The original JSON content that was rewritten
1844
+ */
1845
+ original: JSONContent;
1846
+ /**
1847
+ * The name of the node or mark that was unsupported
1848
+ */
1849
+ unsupported: string;
1850
+ }[];
1851
+ };
1852
+
1853
+ declare function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number): void;
1854
+
1855
+ /**
1856
+ * Sort extensions by priority.
1857
+ * @param extensions An array of Tiptap extensions
1858
+ * @returns A sorted array of Tiptap extensions by priority
1859
+ */
1860
+ declare function sortExtensions(extensions: Extensions): Extensions;
1861
+
1862
+ declare function splitExtensions(extensions: Extensions): {
1863
+ baseExtensions: Extension<any, any>[];
1864
+ nodeExtensions: Node<any, any>[];
1865
+ markExtensions: Mark<any, any>[];
1866
+ };
1867
+
1868
+ declare class ExtensionManager {
1869
+ editor: Editor;
1870
+ schema: Schema;
1871
+ extensions: Extensions;
1872
+ splittableMarks: string[];
1873
+ constructor(extensions: Extensions, editor: Editor);
1874
+ static resolve: typeof resolveExtensions;
1875
+ static sort: typeof sortExtensions;
1876
+ static flatten: typeof flattenExtensions;
1877
+ /**
1878
+ * Get all commands from the extensions.
1879
+ * @returns An object with all commands where the key is the command name and the value is the command function
1880
+ */
1881
+ get commands(): RawCommands;
1882
+ /**
1883
+ * Get all registered Prosemirror plugins from the extensions.
1884
+ * @returns An array of Prosemirror plugins
1885
+ */
1886
+ get plugins(): Plugin[];
1887
+ /**
1888
+ * Get all attributes from the extensions.
1889
+ * @returns An array of attributes
1890
+ */
1891
+ get attributes(): ExtensionAttribute[];
1892
+ /**
1893
+ * Get all node views from the extensions.
1894
+ * @returns An object with all node views where the key is the node name and the value is the node view function
1895
+ */
1896
+ get nodeViews(): Record<string, NodeViewConstructor>;
1897
+ get markViews(): Record<string, MarkViewConstructor>;
1898
+ /**
1899
+ * Go through all extensions, create extension storages & setup marks
1900
+ * & bind editor event listener.
1901
+ */
1902
+ private setupExtensions;
1903
+ }
1904
+
1905
+ declare class NodePos {
1906
+ private resolvedPos;
1907
+ private isBlock;
1908
+ private editor;
1909
+ private get name();
1910
+ constructor(pos: ResolvedPos, editor: Editor, isBlock?: boolean, node?: Node$1 | null);
1911
+ private currentNode;
1912
+ get node(): Node$1;
1913
+ get element(): HTMLElement;
1914
+ actualDepth: number | null;
1915
+ get depth(): number;
1916
+ get pos(): number;
1917
+ get content(): Fragment$1;
1918
+ set content(content: Content);
1919
+ get attributes(): {
1920
+ [key: string]: any;
1921
+ };
1922
+ get textContent(): string;
1923
+ get size(): number;
1924
+ get from(): number;
1925
+ get range(): Range;
1926
+ get to(): number;
1927
+ get parent(): NodePos | null;
1928
+ get before(): NodePos | null;
1929
+ get after(): NodePos | null;
1930
+ get children(): NodePos[];
1931
+ get firstChild(): NodePos | null;
1932
+ get lastChild(): NodePos | null;
1933
+ closest(selector: string, attributes?: {
1934
+ [key: string]: any;
1935
+ }): NodePos | null;
1936
+ querySelector(selector: string, attributes?: {
1937
+ [key: string]: any;
1938
+ }): NodePos | null;
1939
+ querySelectorAll(selector: string, attributes?: {
1940
+ [key: string]: any;
1941
+ }, firstItemOnly?: boolean): NodePos[];
1942
+ setAttribute(attributes: {
1943
+ [key: string]: any;
1944
+ }): void;
1945
+ }
1946
+
1947
+ type ClipboardTextSerializerOptions = {
1948
+ blockSeparator?: string;
1949
+ };
1950
+ declare const ClipboardTextSerializer: Extension<ClipboardTextSerializerOptions, any>;
1951
+
1952
+ declare module '@tiptap/core' {
1953
+ interface Commands<ReturnType> {
1954
+ blur: {
1955
+ /**
1956
+ * Removes focus from the editor.
1957
+ * @example editor.commands.blur()
1958
+ */
1959
+ blur: () => ReturnType;
1960
+ };
1961
+ }
1962
+ }
1963
+
1964
+ declare module '@tiptap/core' {
1965
+ interface Commands<ReturnType> {
1966
+ clearContent: {
1967
+ /**
1968
+ * Clear the whole document.
1969
+ * @example editor.commands.clearContent()
1970
+ */
1971
+ clearContent: (
1972
+ /**
1973
+ * Whether to emit an update event.
1974
+ * @default true
1975
+ */
1976
+ emitUpdate?: boolean) => ReturnType;
1977
+ };
1978
+ }
1979
+ }
1980
+
1981
+ declare module '@tiptap/core' {
1982
+ interface Commands<ReturnType> {
1983
+ clearNodes: {
1984
+ /**
1985
+ * Normalize nodes to a simple paragraph.
1986
+ * @example editor.commands.clearNodes()
1987
+ */
1988
+ clearNodes: () => ReturnType;
1989
+ };
1990
+ }
1991
+ }
1992
+
1993
+ declare module '@tiptap/core' {
1994
+ interface Commands<ReturnType> {
1995
+ command: {
1996
+ /**
1997
+ * Define a command inline.
1998
+ * @param fn The command function.
1999
+ * @example
2000
+ * editor.commands.command(({ tr, state }) => {
2001
+ * ...
2002
+ * return true
2003
+ * })
2004
+ */
2005
+ command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
2006
+ };
2007
+ }
2008
+ }
2009
+
2010
+ declare module '@tiptap/core' {
2011
+ interface Commands<ReturnType> {
2012
+ createParagraphNear: {
2013
+ /**
2014
+ * Create a paragraph nearby.
2015
+ * @example editor.commands.createParagraphNear()
2016
+ */
2017
+ createParagraphNear: () => ReturnType;
2018
+ };
2019
+ }
2020
+ }
2021
+
2022
+ declare module '@tiptap/core' {
2023
+ interface Commands<ReturnType> {
2024
+ cut: {
2025
+ /**
2026
+ * Cuts content from a range and inserts it at a given position.
2027
+ * @param range The range to cut.
2028
+ * @param range.from The start position of the range.
2029
+ * @param range.to The end position of the range.
2030
+ * @param targetPos The position to insert the content at.
2031
+ * @example editor.commands.cut({ from: 1, to: 3 }, 5)
2032
+ */
2033
+ cut: ({ from, to }: {
2034
+ from: number;
2035
+ to: number;
2036
+ }, targetPos: number) => ReturnType;
2037
+ };
2038
+ }
2039
+ }
2040
+
2041
+ declare module '@tiptap/core' {
2042
+ interface Commands<ReturnType> {
2043
+ deleteCurrentNode: {
2044
+ /**
2045
+ * Delete the node that currently has the selection anchor.
2046
+ * @example editor.commands.deleteCurrentNode()
2047
+ */
2048
+ deleteCurrentNode: () => ReturnType;
2049
+ };
2050
+ }
2051
+ }
2052
+
2053
+ declare module '@tiptap/core' {
2054
+ interface Commands<ReturnType> {
2055
+ deleteNode: {
2056
+ /**
2057
+ * Delete a node with a given type or name.
2058
+ * @param typeOrName The type or name of the node.
2059
+ * @example editor.commands.deleteNode('paragraph')
2060
+ */
2061
+ deleteNode: (typeOrName: string | NodeType$1) => ReturnType;
2062
+ };
2063
+ }
2064
+ }
2065
+
2066
+ declare module '@tiptap/core' {
2067
+ interface Commands<ReturnType> {
2068
+ deleteRange: {
2069
+ /**
2070
+ * Delete a given range.
2071
+ * @param range The range to delete.
2072
+ * @example editor.commands.deleteRange({ from: 1, to: 3 })
2073
+ */
2074
+ deleteRange: (range: Range) => ReturnType;
2075
+ };
2076
+ }
2077
+ }
2078
+
2079
+ declare module '@tiptap/core' {
2080
+ interface Commands<ReturnType> {
2081
+ deleteSelection: {
2082
+ /**
2083
+ * Delete the selection, if there is one.
2084
+ * @example editor.commands.deleteSelection()
2085
+ */
2086
+ deleteSelection: () => ReturnType;
2087
+ };
2088
+ }
2089
+ }
2090
+
2091
+ declare module '@tiptap/core' {
2092
+ interface Commands<ReturnType> {
2093
+ enter: {
2094
+ /**
2095
+ * Trigger enter.
2096
+ * @example editor.commands.enter()
2097
+ */
2098
+ enter: () => ReturnType;
2099
+ };
2100
+ }
2101
+ }
2102
+
2103
+ declare module '@tiptap/core' {
2104
+ interface Commands<ReturnType> {
2105
+ exitCode: {
2106
+ /**
2107
+ * Exit from a code block.
2108
+ * @example editor.commands.exitCode()
2109
+ */
2110
+ exitCode: () => ReturnType;
2111
+ };
2112
+ }
2113
+ }
2114
+
2115
+ declare module '@tiptap/core' {
2116
+ interface Commands<ReturnType> {
2117
+ extendMarkRange: {
2118
+ /**
2119
+ * Extends the text selection to the current mark by type or name.
2120
+ * @param typeOrName The type or name of the mark.
2121
+ * @param attributes The attributes of the mark.
2122
+ * @example editor.commands.extendMarkRange('bold')
2123
+ * @example editor.commands.extendMarkRange('mention', { userId: "1" })
2124
+ */
2125
+ extendMarkRange: (
2126
+ /**
2127
+ * The type or name of the mark.
2128
+ */
2129
+ typeOrName: string | MarkType$1,
2130
+ /**
2131
+ * The attributes of the mark.
2132
+ */
2133
+ attributes?: Record<string, any>) => ReturnType;
2134
+ };
2135
+ }
2136
+ }
2137
+
2138
+ declare module '@tiptap/core' {
2139
+ interface Commands<ReturnType> {
2140
+ first: {
2141
+ /**
2142
+ * Runs one command after the other and stops at the first which returns true.
2143
+ * @param commands The commands to run.
2144
+ * @example editor.commands.first([command1, command2])
2145
+ */
2146
+ first: (commands: Command[] | ((props: CommandProps) => Command[])) => ReturnType;
2147
+ };
2148
+ }
2149
+ }
2150
+
2151
+ declare module '@tiptap/core' {
2152
+ interface Commands<ReturnType> {
2153
+ focus: {
2154
+ /**
2155
+ * Focus the editor at the given position.
2156
+ * @param position The position to focus at.
2157
+ * @param options.scrollIntoView Scroll the focused position into view after focusing
2158
+ * @example editor.commands.focus()
2159
+ * @example editor.commands.focus(32, { scrollIntoView: false })
2160
+ */
2161
+ focus: (
2162
+ /**
2163
+ * The position to focus at.
2164
+ */
2165
+ position?: FocusPosition,
2166
+ /**
2167
+ * Optional options
2168
+ * @default { scrollIntoView: true }
2169
+ */
2170
+ options?: {
2171
+ scrollIntoView?: boolean;
2172
+ }) => ReturnType;
2173
+ };
2174
+ }
2175
+ }
2176
+
2177
+ declare module '@tiptap/core' {
2178
+ interface Commands<ReturnType> {
2179
+ forEach: {
2180
+ /**
2181
+ * Loop through an array of items.
2182
+ */
2183
+ forEach: <T>(items: T[], fn: (item: T, props: CommandProps & {
2184
+ index: number;
2185
+ }) => boolean) => ReturnType;
2186
+ };
2187
+ }
2188
+ }
2189
+
2190
+ declare module '@tiptap/core' {
2191
+ interface Commands<ReturnType> {
2192
+ insertContent: {
2193
+ /**
2194
+ * Insert a node or string of HTML at the current position.
2195
+ * @example editor.commands.insertContent('<h1>Example</h1>')
2196
+ * @example editor.commands.insertContent('<h1>Example</h1>', { updateSelection: false })
2197
+ */
2198
+ insertContent: (
2199
+ /**
2200
+ * The ProseMirror content to insert.
2201
+ */
2202
+ value: Content | Node$1 | Fragment$1,
2203
+ /**
2204
+ * Optional options
2205
+ */
2206
+ options?: {
2207
+ /**
2208
+ * Options for parsing the content.
2209
+ */
2210
+ parseOptions?: ParseOptions;
2211
+ /**
2212
+ * Whether to update the selection after inserting the content.
2213
+ */
2214
+ updateSelection?: boolean;
2215
+ applyInputRules?: boolean;
2216
+ applyPasteRules?: boolean;
2217
+ }) => ReturnType;
2218
+ };
2219
+ }
2220
+ }
2221
+
2222
+ declare module '@tiptap/core' {
2223
+ interface Commands<ReturnType> {
2224
+ insertContentAt: {
2225
+ /**
2226
+ * Insert a node or string of HTML at a specific position.
2227
+ * @example editor.commands.insertContentAt(0, '<h1>Example</h1>')
2228
+ */
2229
+ insertContentAt: (
2230
+ /**
2231
+ * The position to insert the content at.
2232
+ */
2233
+ position: number | Range,
2234
+ /**
2235
+ * The ProseMirror content to insert.
2236
+ */
2237
+ value: Content | Node$1 | Fragment$1,
2238
+ /**
2239
+ * Optional options
2240
+ */
2241
+ options?: {
2242
+ /**
2243
+ * Options for parsing the content.
2244
+ */
2245
+ parseOptions?: ParseOptions;
2246
+ /**
2247
+ * Whether to update the selection after inserting the content.
2248
+ */
2249
+ updateSelection?: boolean;
2250
+ /**
2251
+ * Whether to apply input rules after inserting the content.
2252
+ */
2253
+ applyInputRules?: boolean;
2254
+ /**
2255
+ * Whether to apply paste rules after inserting the content.
2256
+ */
2257
+ applyPasteRules?: boolean;
2258
+ /**
2259
+ * Whether to throw an error if the content is invalid.
2260
+ */
2261
+ errorOnInvalidContent?: boolean;
2262
+ }) => ReturnType;
2263
+ };
2264
+ }
2265
+ }
2266
+
2267
+ declare module '@tiptap/core' {
2268
+ interface Commands<ReturnType> {
2269
+ joinUp: {
2270
+ /**
2271
+ * Join the selected block or, if there is a text selection, the closest ancestor block of the selection that can be joined, with the sibling above it.
2272
+ * @example editor.commands.joinUp()
2273
+ */
2274
+ joinUp: () => ReturnType;
2275
+ };
2276
+ joinDown: {
2277
+ /**
2278
+ * Join the selected block, or the closest ancestor of the selection that can be joined, with the sibling after it.
2279
+ * @example editor.commands.joinDown()
2280
+ */
2281
+ joinDown: () => ReturnType;
2282
+ };
2283
+ joinBackward: {
2284
+ /**
2285
+ * If the selection is empty and at the start of a textblock, try to reduce the distance between that block and the one before it—if there's a block directly before it that can be joined, join them.
2286
+ * If not, try to move the selected block closer to the next one in the document structure by lifting it out of its
2287
+ * parent or moving it into a parent of the previous block. Will use the view for accurate (bidi-aware) start-of-textblock detection if given.
2288
+ * @example editor.commands.joinBackward()
2289
+ */
2290
+ joinBackward: () => ReturnType;
2291
+ };
2292
+ joinForward: {
2293
+ /**
2294
+ * If the selection is empty and the cursor is at the end of a textblock, try to reduce or remove the boundary between that block and the one after it,
2295
+ * either by joining them or by moving the other block closer to this one in the tree structure.
2296
+ * Will use the view for accurate start-of-textblock detection if given.
2297
+ * @example editor.commands.joinForward()
2298
+ */
2299
+ joinForward: () => ReturnType;
2300
+ };
2301
+ }
2302
+ }
2303
+
2304
+ declare module '@tiptap/core' {
2305
+ interface Commands<ReturnType> {
2306
+ joinItemBackward: {
2307
+ /**
2308
+ * Join two items backward.
2309
+ * @example editor.commands.joinItemBackward()
2310
+ */
2311
+ joinItemBackward: () => ReturnType;
2312
+ };
2313
+ }
2314
+ }
2315
+
2316
+ declare module '@tiptap/core' {
2317
+ interface Commands<ReturnType> {
2318
+ joinItemForward: {
2319
+ /**
2320
+ * Join two items Forwards.
2321
+ * @example editor.commands.joinItemForward()
2322
+ */
2323
+ joinItemForward: () => ReturnType;
2324
+ };
2325
+ }
2326
+ }
2327
+
2328
+ declare module '@tiptap/core' {
2329
+ interface Commands<ReturnType> {
2330
+ joinTextblockBackward: {
2331
+ /**
2332
+ * A more limited form of joinBackward that only tries to join the current textblock to the one before it, if the cursor is at the start of a textblock.
2333
+ */
2334
+ joinTextblockBackward: () => ReturnType;
2335
+ };
2336
+ }
2337
+ }
2338
+
2339
+ declare module '@tiptap/core' {
2340
+ interface Commands<ReturnType> {
2341
+ joinTextblockForward: {
2342
+ /**
2343
+ * A more limited form of joinForward that only tries to join the current textblock to the one after it, if the cursor is at the end of a textblock.
2344
+ */
2345
+ joinTextblockForward: () => ReturnType;
2346
+ };
2347
+ }
2348
+ }
2349
+
2350
+ declare module '@tiptap/core' {
2351
+ interface Commands<ReturnType> {
2352
+ keyboardShortcut: {
2353
+ /**
2354
+ * Trigger a keyboard shortcut.
2355
+ * @param name The name of the keyboard shortcut.
2356
+ * @example editor.commands.keyboardShortcut('Mod-b')
2357
+ */
2358
+ keyboardShortcut: (name: string) => ReturnType;
2359
+ };
2360
+ }
2361
+ }
2362
+
2363
+ declare module '@tiptap/core' {
2364
+ interface Commands<ReturnType> {
2365
+ lift: {
2366
+ /**
2367
+ * Removes an existing wrap if possible lifting the node out of it
2368
+ * @param typeOrName The type or name of the node.
2369
+ * @param attributes The attributes of the node.
2370
+ * @example editor.commands.lift('paragraph')
2371
+ * @example editor.commands.lift('heading', { level: 1 })
2372
+ */
2373
+ lift: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2374
+ };
2375
+ }
2376
+ }
2377
+
2378
+ declare module '@tiptap/core' {
2379
+ interface Commands<ReturnType> {
2380
+ liftEmptyBlock: {
2381
+ /**
2382
+ * If the cursor is in an empty textblock that can be lifted, lift the block.
2383
+ * @example editor.commands.liftEmptyBlock()
2384
+ */
2385
+ liftEmptyBlock: () => ReturnType;
2386
+ };
2387
+ }
2388
+ }
2389
+
2390
+ declare module '@tiptap/core' {
2391
+ interface Commands<ReturnType> {
2392
+ liftListItem: {
2393
+ /**
2394
+ * Create a command to lift the list item around the selection up into a wrapping list.
2395
+ * @param typeOrName The type or name of the node.
2396
+ * @example editor.commands.liftListItem('listItem')
2397
+ */
2398
+ liftListItem: (typeOrName: string | NodeType$1) => ReturnType;
2399
+ };
2400
+ }
2401
+ }
2402
+
2403
+ declare module '@tiptap/core' {
2404
+ interface Commands<ReturnType> {
2405
+ newlineInCode: {
2406
+ /**
2407
+ * Add a newline character in code.
2408
+ * @example editor.commands.newlineInCode()
2409
+ */
2410
+ newlineInCode: () => ReturnType;
2411
+ };
2412
+ }
2413
+ }
2414
+
2415
+ declare module '@tiptap/core' {
2416
+ interface Commands<ReturnType> {
2417
+ resetAttributes: {
2418
+ /**
2419
+ * Resets some node attributes to the default value.
2420
+ * @param typeOrName The type or name of the node.
2421
+ * @param attributes The attributes of the node to reset.
2422
+ * @example editor.commands.resetAttributes('heading', 'level')
2423
+ */
2424
+ resetAttributes: (typeOrName: string | NodeType$1 | MarkType$1, attributes: string | string[]) => ReturnType;
2425
+ };
2426
+ }
2427
+ }
2428
+
2429
+ declare module '@tiptap/core' {
2430
+ interface Commands<ReturnType> {
2431
+ scrollIntoView: {
2432
+ /**
2433
+ * Scroll the selection into view.
2434
+ * @example editor.commands.scrollIntoView()
2435
+ */
2436
+ scrollIntoView: () => ReturnType;
2437
+ };
2438
+ }
2439
+ }
2440
+
2441
+ declare module '@tiptap/core' {
2442
+ interface Commands<ReturnType> {
2443
+ selectAll: {
2444
+ /**
2445
+ * Select the whole document.
2446
+ * @example editor.commands.selectAll()
2447
+ */
2448
+ selectAll: () => ReturnType;
2449
+ };
2450
+ }
2451
+ }
2452
+
2453
+ declare module '@tiptap/core' {
2454
+ interface Commands<ReturnType> {
2455
+ selectNodeBackward: {
2456
+ /**
2457
+ * Select a node backward.
2458
+ * @example editor.commands.selectNodeBackward()
2459
+ */
2460
+ selectNodeBackward: () => ReturnType;
2461
+ };
2462
+ }
2463
+ }
2464
+
2465
+ declare module '@tiptap/core' {
2466
+ interface Commands<ReturnType> {
2467
+ selectNodeForward: {
2468
+ /**
2469
+ * Select a node forward.
2470
+ * @example editor.commands.selectNodeForward()
2471
+ */
2472
+ selectNodeForward: () => ReturnType;
2473
+ };
2474
+ }
2475
+ }
2476
+
2477
+ declare module '@tiptap/core' {
2478
+ interface Commands<ReturnType> {
2479
+ selectParentNode: {
2480
+ /**
2481
+ * Select the parent node.
2482
+ * @example editor.commands.selectParentNode()
2483
+ */
2484
+ selectParentNode: () => ReturnType;
2485
+ };
2486
+ }
2487
+ }
2488
+
2489
+ declare module '@tiptap/core' {
2490
+ interface Commands<ReturnType> {
2491
+ selectTextblockEnd: {
2492
+ /**
2493
+ * Moves the cursor to the end of current text block.
2494
+ * @example editor.commands.selectTextblockEnd()
2495
+ */
2496
+ selectTextblockEnd: () => ReturnType;
2497
+ };
2498
+ }
2499
+ }
2500
+
2501
+ declare module '@tiptap/core' {
2502
+ interface Commands<ReturnType> {
2503
+ selectTextblockStart: {
2504
+ /**
2505
+ * Moves the cursor to the start of current text block.
2506
+ * @example editor.commands.selectTextblockStart()
2507
+ */
2508
+ selectTextblockStart: () => ReturnType;
2509
+ };
2510
+ }
2511
+ }
2512
+
2513
+ declare module '@tiptap/core' {
2514
+ interface Commands<ReturnType> {
2515
+ setContent: {
2516
+ /**
2517
+ * Replace the whole document with new content.
2518
+ * @param content The new content.
2519
+ * @param emitUpdate Whether to emit an update event.
2520
+ * @param parseOptions Options for parsing the content.
2521
+ * @example editor.commands.setContent('<p>Example text</p>')
2522
+ */
2523
+ setContent: (
2524
+ /**
2525
+ * The new content.
2526
+ */
2527
+ content: Content | Fragment$1 | Node$1,
2528
+ /**
2529
+ * Options for `setContent`.
2530
+ */
2531
+ options?: {
2532
+ /**
2533
+ * Options for parsing the content.
2534
+ * @default {}
2535
+ */
2536
+ parseOptions?: ParseOptions;
2537
+ /**
2538
+ * Whether to throw an error if the content is invalid.
2539
+ */
2540
+ errorOnInvalidContent?: boolean;
2541
+ /**
2542
+ * Whether to emit an update event.
2543
+ * @default true
2544
+ */
2545
+ emitUpdate?: boolean;
2546
+ }) => ReturnType;
2547
+ };
2548
+ }
2549
+ }
2550
+
2551
+ declare module '@tiptap/core' {
2552
+ interface Commands<ReturnType> {
2553
+ setMark: {
2554
+ /**
2555
+ * Add a mark with new attributes.
2556
+ * @param typeOrName The mark type or name.
2557
+ * @example editor.commands.setMark('bold', { level: 1 })
2558
+ */
2559
+ setMark: (typeOrName: string | MarkType$1, attributes?: Record<string, any>) => ReturnType;
2560
+ };
2561
+ }
2562
+ }
2563
+
2564
+ declare module '@tiptap/core' {
2565
+ interface Commands<ReturnType> {
2566
+ setMeta: {
2567
+ /**
2568
+ * Store a metadata property in the current transaction.
2569
+ * @param key The key of the metadata property.
2570
+ * @param value The value to store.
2571
+ * @example editor.commands.setMeta('foo', 'bar')
2572
+ */
2573
+ setMeta: (key: string | Plugin | PluginKey, value: any) => ReturnType;
2574
+ };
2575
+ }
2576
+ }
2577
+
2578
+ declare module '@tiptap/core' {
2579
+ interface Commands<ReturnType> {
2580
+ setNode: {
2581
+ /**
2582
+ * Replace a given range with a node.
2583
+ * @param typeOrName The type or name of the node
2584
+ * @param attributes The attributes of the node
2585
+ * @example editor.commands.setNode('paragraph')
2586
+ */
2587
+ setNode: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2588
+ };
2589
+ }
2590
+ }
2591
+
2592
+ declare module '@tiptap/core' {
2593
+ interface Commands<ReturnType> {
2594
+ setNodeSelection: {
2595
+ /**
2596
+ * Creates a NodeSelection.
2597
+ * @param position - Position of the node.
2598
+ * @example editor.commands.setNodeSelection(10)
2599
+ */
2600
+ setNodeSelection: (position: number) => ReturnType;
2601
+ };
2602
+ }
2603
+ }
2604
+
2605
+ declare module '@tiptap/core' {
2606
+ interface Commands<ReturnType> {
2607
+ setTextSelection: {
2608
+ /**
2609
+ * Creates a TextSelection.
2610
+ * @param position The position of the selection.
2611
+ * @example editor.commands.setTextSelection(10)
2612
+ */
2613
+ setTextSelection: (position: number | Range) => ReturnType;
2614
+ };
2615
+ }
2616
+ }
2617
+
2618
+ declare module '@tiptap/core' {
2619
+ interface Commands<ReturnType> {
2620
+ sinkListItem: {
2621
+ /**
2622
+ * Sink the list item down into an inner list.
2623
+ * @param typeOrName The type or name of the node.
2624
+ * @example editor.commands.sinkListItem('listItem')
2625
+ */
2626
+ sinkListItem: (typeOrName: string | NodeType$1) => ReturnType;
2627
+ };
2628
+ }
2629
+ }
2630
+
2631
+ declare module '@tiptap/core' {
2632
+ interface Commands<ReturnType> {
2633
+ splitBlock: {
2634
+ /**
2635
+ * Forks a new node from an existing node.
2636
+ * @param options.keepMarks Keep marks from the previous node.
2637
+ * @example editor.commands.splitBlock()
2638
+ * @example editor.commands.splitBlock({ keepMarks: true })
2639
+ */
2640
+ splitBlock: (options?: {
2641
+ keepMarks?: boolean;
2642
+ }) => ReturnType;
2643
+ };
2644
+ }
2645
+ }
2646
+
2647
+ declare module '@tiptap/core' {
2648
+ interface Commands<ReturnType> {
2649
+ splitListItem: {
2650
+ /**
2651
+ * Splits one list item into two list items.
2652
+ * @param typeOrName The type or name of the node.
2653
+ * @param overrideAttrs The attributes to ensure on the new node.
2654
+ * @example editor.commands.splitListItem('listItem')
2655
+ */
2656
+ splitListItem: (typeOrName: string | NodeType$1, overrideAttrs?: Record<string, any>) => ReturnType;
2657
+ };
2658
+ }
2659
+ }
2660
+
2661
+ declare module '@tiptap/core' {
2662
+ interface Commands<ReturnType> {
2663
+ toggleList: {
2664
+ /**
2665
+ * Toggle between different list types.
2666
+ * @param listTypeOrName The type or name of the list.
2667
+ * @param itemTypeOrName The type or name of the list item.
2668
+ * @param keepMarks Keep marks when toggling.
2669
+ * @param attributes Attributes for the new list.
2670
+ * @example editor.commands.toggleList('bulletList', 'listItem')
2671
+ */
2672
+ toggleList: (listTypeOrName: string | NodeType$1, itemTypeOrName: string | NodeType$1, keepMarks?: boolean, attributes?: Record<string, any>) => ReturnType;
2673
+ };
2674
+ }
2675
+ }
2676
+
2677
+ declare module '@tiptap/core' {
2678
+ interface Commands<ReturnType> {
2679
+ toggleMark: {
2680
+ /**
2681
+ * Toggle a mark on and off.
2682
+ * @param typeOrName The mark type or name.
2683
+ * @param attributes The attributes of the mark.
2684
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
2685
+ * @example editor.commands.toggleMark('bold')
2686
+ */
2687
+ toggleMark: (
2688
+ /**
2689
+ * The mark type or name.
2690
+ */
2691
+ typeOrName: string | MarkType$1,
2692
+ /**
2693
+ * The attributes of the mark.
2694
+ */
2695
+ attributes?: Record<string, any>, options?: {
2696
+ /**
2697
+ * Removes the mark even across the current selection. Defaults to `false`.
2698
+ */
2699
+ extendEmptyMarkRange?: boolean;
2700
+ }) => ReturnType;
2701
+ };
2702
+ }
2703
+ }
2704
+
2705
+ declare module '@tiptap/core' {
2706
+ interface Commands<ReturnType> {
2707
+ toggleNode: {
2708
+ /**
2709
+ * Toggle a node with another node.
2710
+ * @param typeOrName The type or name of the node.
2711
+ * @param toggleTypeOrName The type or name of the node to toggle.
2712
+ * @param attributes The attributes of the node.
2713
+ * @example editor.commands.toggleNode('heading', 'paragraph')
2714
+ */
2715
+ toggleNode: (typeOrName: string | NodeType$1, toggleTypeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2716
+ };
2717
+ }
2718
+ }
2719
+
2720
+ declare module '@tiptap/core' {
2721
+ interface Commands<ReturnType> {
2722
+ toggleWrap: {
2723
+ /**
2724
+ * Wraps nodes in another node, or removes an existing wrap.
2725
+ * @param typeOrName The type or name of the node.
2726
+ * @param attributes The attributes of the node.
2727
+ * @example editor.commands.toggleWrap('blockquote')
2728
+ */
2729
+ toggleWrap: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2730
+ };
2731
+ }
2732
+ }
2733
+
2734
+ declare module '@tiptap/core' {
2735
+ interface Commands<ReturnType> {
2736
+ undoInputRule: {
2737
+ /**
2738
+ * Undo an input rule.
2739
+ * @example editor.commands.undoInputRule()
2740
+ */
2741
+ undoInputRule: () => ReturnType;
2742
+ };
2743
+ }
2744
+ }
2745
+
2746
+ declare module '@tiptap/core' {
2747
+ interface Commands<ReturnType> {
2748
+ unsetAllMarks: {
2749
+ /**
2750
+ * Remove all marks in the current selection.
2751
+ * @example editor.commands.unsetAllMarks()
2752
+ */
2753
+ unsetAllMarks: () => ReturnType;
2754
+ };
2755
+ }
2756
+ }
2757
+
2758
+ declare module '@tiptap/core' {
2759
+ interface Commands<ReturnType> {
2760
+ unsetMark: {
2761
+ /**
2762
+ * Remove all marks in the current selection.
2763
+ * @param typeOrName The mark type or name.
2764
+ * @param options.extendEmptyMarkRange Removes the mark even across the current selection. Defaults to `false`.
2765
+ * @example editor.commands.unsetMark('bold')
2766
+ */
2767
+ unsetMark: (
2768
+ /**
2769
+ * The mark type or name.
2770
+ */
2771
+ typeOrName: string | MarkType$1, options?: {
2772
+ /**
2773
+ * Removes the mark even across the current selection. Defaults to `false`.
2774
+ */
2775
+ extendEmptyMarkRange?: boolean;
2776
+ }) => ReturnType;
2777
+ };
2778
+ }
2779
+ }
2780
+
2781
+ declare module '@tiptap/core' {
2782
+ interface Commands<ReturnType> {
2783
+ updateAttributes: {
2784
+ /**
2785
+ * Update attributes of a node or mark.
2786
+ * @param typeOrName The type or name of the node or mark.
2787
+ * @param attributes The attributes of the node or mark.
2788
+ * @example editor.commands.updateAttributes('mention', { userId: "2" })
2789
+ */
2790
+ updateAttributes: (
2791
+ /**
2792
+ * The type or name of the node or mark.
2793
+ */
2794
+ typeOrName: string | NodeType$1 | MarkType$1,
2795
+ /**
2796
+ * The attributes of the node or mark.
2797
+ */
2798
+ attributes: Record<string, any>) => ReturnType;
2799
+ };
2800
+ }
2801
+ }
2802
+
2803
+ declare module '@tiptap/core' {
2804
+ interface Commands<ReturnType> {
2805
+ wrapIn: {
2806
+ /**
2807
+ * Wraps nodes in another node.
2808
+ * @param typeOrName The type or name of the node.
2809
+ * @param attributes The attributes of the node.
2810
+ * @example editor.commands.wrapIn('blockquote')
2811
+ */
2812
+ wrapIn: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2813
+ };
2814
+ }
2815
+ }
2816
+
2817
+ declare module '@tiptap/core' {
2818
+ interface Commands<ReturnType> {
2819
+ wrapInList: {
2820
+ /**
2821
+ * Wrap a node in a list.
2822
+ * @param typeOrName The type or name of the node.
2823
+ * @param attributes The attributes of the node.
2824
+ * @example editor.commands.wrapInList('bulletList')
2825
+ */
2826
+ wrapInList: (typeOrName: string | NodeType$1, attributes?: Record<string, any>) => ReturnType;
2827
+ };
2828
+ }
2829
+ }
2830
+
2831
+ declare const Commands$1: Extension<any, any>;
2832
+
2833
+ /**
2834
+ * This extension allows you to be notified when the user deletes content you are interested in.
2835
+ */
2836
+ declare const Delete: Extension<any, any>;
2837
+
2838
+ declare const Drop: Extension<any, any>;
2839
+
2840
+ declare const Editable: Extension<any, any>;
2841
+
2842
+ declare const focusEventsPluginKey: PluginKey<any>;
2843
+ declare const FocusEvents: Extension<any, any>;
2844
+
2845
+ declare const Keymap: Extension<any, any>;
2846
+
2847
+ declare const Paste: Extension<any, any>;
2848
+
2849
+ declare const Tabindex: Extension<any, any>;
2850
+
2851
+ declare const index_ClipboardTextSerializer: typeof ClipboardTextSerializer;
2852
+ declare const index_Delete: typeof Delete;
2853
+ declare const index_Drop: typeof Drop;
2854
+ declare const index_Editable: typeof Editable;
2855
+ declare const index_FocusEvents: typeof FocusEvents;
2856
+ declare const index_Keymap: typeof Keymap;
2857
+ declare const index_Paste: typeof Paste;
2858
+ declare const index_Tabindex: typeof Tabindex;
2859
+ declare const index_focusEventsPluginKey: typeof focusEventsPluginKey;
2860
+ declare namespace index {
2861
+ export { index_ClipboardTextSerializer as ClipboardTextSerializer, Commands$1 as Commands, index_Delete as Delete, index_Drop as Drop, index_Editable as Editable, index_FocusEvents as FocusEvents, index_Keymap as Keymap, index_Paste as Paste, index_Tabindex as Tabindex, index_focusEventsPluginKey as focusEventsPluginKey };
2862
+ }
2863
+
2864
+ interface TiptapEditorHTMLElement extends HTMLElement {
2865
+ editor?: Editor;
2866
+ }
2867
+ declare class Editor extends EventEmitter<EditorEvents> {
2868
+ private commandManager;
2869
+ extensionManager: ExtensionManager;
2870
+ private css;
2871
+ schema: Schema;
2872
+ private editorView;
2873
+ isFocused: boolean;
2874
+ private editorState;
2875
+ /**
2876
+ * The editor is considered initialized after the `create` event has been emitted.
2877
+ */
2878
+ isInitialized: boolean;
2879
+ extensionStorage: Storage;
2880
+ /**
2881
+ * A unique ID for this editor instance.
2882
+ */
2883
+ instanceId: string;
2884
+ options: EditorOptions;
2885
+ constructor(options?: Partial<EditorOptions>);
2886
+ /**
2887
+ * Attach the editor to the DOM, creating a new editor view.
2888
+ */
2889
+ mount(el: NonNullable<EditorOptions['element']> & {}): void;
2890
+ /**
2891
+ * Remove the editor from the DOM, but still allow remounting at a different point in time
2892
+ */
2893
+ unmount(): void;
2894
+ /**
2895
+ * Returns the editor storage.
2896
+ */
2897
+ get storage(): Storage;
2898
+ /**
2899
+ * An object of all registered commands.
2900
+ */
2901
+ get commands(): SingleCommands;
2902
+ /**
2903
+ * Create a command chain to call multiple commands at once.
2904
+ */
2905
+ chain(): ChainedCommands;
2906
+ /**
2907
+ * Check if a command or a command chain can be executed. Without executing it.
2908
+ */
2909
+ can(): CanCommands;
2910
+ /**
2911
+ * Inject CSS styles.
2912
+ */
2913
+ private injectCSS;
2914
+ /**
2915
+ * Update editor options.
2916
+ *
2917
+ * @param options A list of options
2918
+ */
2919
+ setOptions(options?: Partial<EditorOptions>): void;
2920
+ /**
2921
+ * Update editable state of the editor.
2922
+ */
2923
+ setEditable(editable: boolean, emitUpdate?: boolean): void;
2924
+ /**
2925
+ * Returns whether the editor is editable.
2926
+ */
2927
+ get isEditable(): boolean;
2928
+ /**
2929
+ * Returns the editor state.
2930
+ */
2931
+ get view(): EditorView;
2932
+ /**
2933
+ * Returns the editor state.
2934
+ */
2935
+ get state(): EditorState;
2936
+ /**
2937
+ * Register a ProseMirror plugin.
2938
+ *
2939
+ * @param plugin A ProseMirror plugin
2940
+ * @param handlePlugins Control how to merge the plugin into the existing plugins.
2941
+ * @returns The new editor state
2942
+ */
2943
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
2944
+ /**
2945
+ * Unregister a ProseMirror plugin.
2946
+ *
2947
+ * @param nameOrPluginKeyToRemove The plugins name
2948
+ * @returns The new editor state or undefined if the editor is destroyed
2949
+ */
2950
+ unregisterPlugin(nameOrPluginKeyToRemove: string | PluginKey | (string | PluginKey)[]): EditorState | undefined;
2951
+ /**
2952
+ * Creates an extension manager.
2953
+ */
2954
+ private createExtensionManager;
2955
+ /**
2956
+ * Creates an command manager.
2957
+ */
2958
+ private createCommandManager;
2959
+ /**
2960
+ * Creates a ProseMirror schema.
2961
+ */
2962
+ private createSchema;
2963
+ /**
2964
+ * Creates the initial document.
2965
+ */
2966
+ private createDoc;
2967
+ /**
2968
+ * Creates a ProseMirror view.
2969
+ */
2970
+ private createView;
2971
+ /**
2972
+ * Creates all node and mark views.
2973
+ */
2974
+ createNodeViews(): void;
2975
+ /**
2976
+ * Prepend class name to element.
2977
+ */
2978
+ prependClass(): void;
2979
+ isCapturingTransaction: boolean;
2980
+ private capturedTransaction;
2981
+ captureTransaction(fn: () => void): Transaction | null;
2982
+ /**
2983
+ * The callback over which to send transactions (state updates) produced by the view.
2984
+ *
2985
+ * @param transaction An editor state transaction
2986
+ */
2987
+ private dispatchTransaction;
2988
+ /**
2989
+ * Get attributes of the currently selected node or mark.
2990
+ */
2991
+ getAttributes(nameOrType: string | NodeType$1 | MarkType$1): Record<string, any>;
2992
+ /**
2993
+ * Returns if the currently selected node or mark is active.
2994
+ *
2995
+ * @param name Name of the node or mark
2996
+ * @param attributes Attributes of the node or mark
2997
+ */
2998
+ isActive(name: string, attributes?: {}): boolean;
2999
+ isActive(attributes: {}): boolean;
3000
+ /**
3001
+ * Get the document as JSON.
3002
+ */
3003
+ getJSON(): DocumentType<Record<string, any> | undefined, NodeType<string, undefined | Record<string, any>, any, (NodeType | TextType)[]>[]>;
3004
+ /**
3005
+ * Get the document as HTML.
3006
+ */
3007
+ getHTML(): string;
3008
+ /**
3009
+ * Get the document as text.
3010
+ */
3011
+ getText(options?: {
3012
+ blockSeparator?: string;
3013
+ textSerializers?: Record<string, TextSerializer>;
3014
+ }): string;
3015
+ /**
3016
+ * Check if there is no content.
3017
+ */
3018
+ get isEmpty(): boolean;
3019
+ /**
3020
+ * Destroy the editor.
3021
+ */
3022
+ destroy(): void;
3023
+ /**
3024
+ * Check if the editor is already destroyed.
3025
+ */
3026
+ get isDestroyed(): boolean;
3027
+ $node(selector: string, attributes?: {
3028
+ [key: string]: any;
3029
+ }): NodePos | null;
3030
+ $nodes(selector: string, attributes?: {
3031
+ [key: string]: any;
3032
+ }): NodePos[] | null;
3033
+ $pos(pos: number): NodePos;
3034
+ get $doc(): NodePos;
3035
+ }
3036
+
3037
+ declare class CommandManager {
3038
+ editor: Editor;
3039
+ rawCommands: AnyCommands;
3040
+ customState?: EditorState;
3041
+ constructor(props: {
3042
+ editor: Editor;
3043
+ state?: EditorState;
3044
+ });
3045
+ get hasCustomState(): boolean;
3046
+ get state(): EditorState;
3047
+ get commands(): SingleCommands;
3048
+ get chain(): () => ChainedCommands;
3049
+ get can(): () => CanCommands;
3050
+ createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
3051
+ createCan(startTr?: Transaction): CanCommands;
3052
+ buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
3053
+ }
3054
+
3055
+ /**
3056
+ * Build an input rule that adds a mark when the
3057
+ * matched text is typed into it.
3058
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3059
+ */
3060
+ declare function markInputRule(config: {
3061
+ find: InputRuleFinder;
3062
+ type: MarkType$1;
3063
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3064
+ }): InputRule;
3065
+
3066
+ /**
3067
+ * Build an input rule that adds a node when the
3068
+ * matched text is typed into it.
3069
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3070
+ */
3071
+ declare function nodeInputRule(config: {
3072
+ /**
3073
+ * The regex to match.
3074
+ */
3075
+ find: InputRuleFinder;
3076
+ /**
3077
+ * The node type to add.
3078
+ */
3079
+ type: NodeType$1;
3080
+ /**
3081
+ * A function that returns the attributes for the node
3082
+ * can also be an object of attributes
3083
+ */
3084
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3085
+ }): InputRule;
3086
+
3087
+ /**
3088
+ * Build an input rule that changes the type of a textblock when the
3089
+ * matched text is typed into it. When using a regular expresion you’ll
3090
+ * probably want the regexp to start with `^`, so that the pattern can
3091
+ * only occur at the start of a textblock.
3092
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3093
+ */
3094
+ declare function textblockTypeInputRule(config: {
3095
+ find: InputRuleFinder;
3096
+ type: NodeType$1;
3097
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3098
+ }): InputRule;
3099
+
3100
+ /**
3101
+ * Build an input rule that replaces text when the
3102
+ * matched text is typed into it.
3103
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3104
+ */
3105
+ declare function textInputRule(config: {
3106
+ find: InputRuleFinder;
3107
+ replace: string;
3108
+ }): InputRule;
3109
+
3110
+ /**
3111
+ * Build an input rule for automatically wrapping a textblock when a
3112
+ * given string is typed. When using a regular expresion you’ll
3113
+ * probably want the regexp to start with `^`, so that the pattern can
3114
+ * only occur at the start of a textblock.
3115
+ *
3116
+ * `type` is the type of node to wrap in.
3117
+ *
3118
+ * By default, if there’s a node with the same type above the newly
3119
+ * wrapped node, the rule will try to join those
3120
+ * two nodes. You can pass a join predicate, which takes a regular
3121
+ * expression match and the node before the wrapped node, and can
3122
+ * return a boolean to indicate whether a join should happen.
3123
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
3124
+ */
3125
+ declare function wrappingInputRule(config: {
3126
+ find: InputRuleFinder;
3127
+ type: NodeType$1;
3128
+ keepMarks?: boolean;
3129
+ keepAttributes?: boolean;
3130
+ editor?: Editor;
3131
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
3132
+ joinPredicate?: (match: ExtendedRegExpMatchArray, node: Node$1) => boolean;
3133
+ }): InputRule;
3134
+
3135
+ type Attributes = Record<string, any>;
3136
+ type DOMOutputSpecElement = 0 | Attributes | DOMOutputSpecArray;
3137
+ /**
3138
+ * Better describes the output of a `renderHTML` function in prosemirror
3139
+ * @see https://prosemirror.net/docs/ref/#model.DOMOutputSpec
3140
+ */
3141
+ type DOMOutputSpecArray = [string] | [string, Attributes] | [string, 0] | [string, Attributes, 0] | [string, Attributes, DOMOutputSpecArray | 0] | [string, DOMOutputSpecArray];
3142
+ declare global {
3143
+ namespace JSX {
3144
+ type Element = [string, ...any[]];
3145
+ interface IntrinsicElements {
3146
+ [key: string]: any;
3147
+ }
3148
+ }
3149
+ }
3150
+ type JSXRenderer = (tag: 'slot' | string | ((props?: Attributes) => DOMOutputSpecArray | DOMOutputSpecElement), props?: Attributes, ...children: JSXRenderer[]) => DOMOutputSpecArray | DOMOutputSpecElement;
3151
+ declare function Fragment(props: {
3152
+ children: JSXRenderer[];
3153
+ }): JSXRenderer[];
3154
+ declare const h: JSXRenderer;
3155
+
3156
+ declare class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
3157
+ component: Component;
3158
+ editor: Editor;
3159
+ options: Options;
3160
+ mark: MarkViewProps['mark'];
3161
+ HTMLAttributes: MarkViewProps['HTMLAttributes'];
3162
+ constructor(component: Component, props: MarkViewProps, options?: Partial<Options>);
3163
+ get dom(): HTMLElement;
3164
+ get contentDOM(): HTMLElement | null;
3165
+ ignoreMutation(mutation: ViewMutationRecord): boolean;
3166
+ }
3167
+
3168
+ /**
3169
+ * Node views are used to customize the rendered DOM structure of a node.
3170
+ * @see https://tiptap.dev/guide/node-views
3171
+ */
3172
+ declare class NodeView<Component, NodeEditor extends Editor = Editor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> implements NodeView$1 {
3173
+ component: Component;
3174
+ editor: NodeEditor;
3175
+ options: Options;
3176
+ extension: NodeViewRendererProps['extension'];
3177
+ node: NodeViewRendererProps['node'];
3178
+ decorations: NodeViewRendererProps['decorations'];
3179
+ innerDecorations: NodeViewRendererProps['innerDecorations'];
3180
+ view: NodeViewRendererProps['view'];
3181
+ getPos: NodeViewRendererProps['getPos'];
3182
+ HTMLAttributes: NodeViewRendererProps['HTMLAttributes'];
3183
+ isDragging: boolean;
3184
+ constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
3185
+ mount(): void;
3186
+ get dom(): HTMLElement;
3187
+ get contentDOM(): HTMLElement | null;
3188
+ onDragStart(event: DragEvent): void;
3189
+ stopEvent(event: Event): boolean;
3190
+ /**
3191
+ * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.
3192
+ * @return `false` if the editor should re-read the selection or re-parse the range around the mutation
3193
+ * @return `true` if it can safely be ignored.
3194
+ */
3195
+ ignoreMutation(mutation: ViewMutationRecord): boolean;
3196
+ /**
3197
+ * Update the attributes of the prosemirror node.
3198
+ */
3199
+ updateAttributes(attributes: Record<string, any>): void;
3200
+ /**
3201
+ * Delete the node.
3202
+ */
3203
+ deleteNode(): void;
3204
+ }
3205
+
3206
+ /**
3207
+ * Build an paste rule that adds a mark when the
3208
+ * matched text is pasted into it.
3209
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
3210
+ */
3211
+ declare function markPasteRule(config: {
3212
+ find: PasteRuleFinder;
3213
+ type: MarkType$1;
3214
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray, event: ClipboardEvent) => Record<string, any>) | false | null;
3215
+ }): PasteRule;
3216
+
3217
+ /**
3218
+ * Build an paste rule that adds a node when the
3219
+ * matched text is pasted into it.
3220
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
3221
+ */
3222
+ declare function nodePasteRule(config: {
3223
+ find: PasteRuleFinder;
3224
+ type: NodeType$1;
3225
+ getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray, event: ClipboardEvent) => Record<string, any>) | false | null;
3226
+ getContent?: JSONContent[] | ((attrs: Record<string, any>) => JSONContent[]) | false | null;
3227
+ }): PasteRule;
3228
+
3229
+ /**
3230
+ * Build an paste rule that replaces text when the
3231
+ * matched text is pasted into it.
3232
+ * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
3233
+ */
3234
+ declare function textPasteRule(config: {
3235
+ find: PasteRuleFinder;
3236
+ replace: string;
3237
+ }): PasteRule;
3238
+
3239
+ interface TrackerResult {
3240
+ position: number;
3241
+ deleted: boolean;
3242
+ }
3243
+ declare class Tracker {
3244
+ transaction: Transaction;
3245
+ currentStep: number;
3246
+ constructor(transaction: Transaction);
3247
+ map(position: number): TrackerResult;
3248
+ }
3249
+
3250
+ /**
3251
+ * Optionally calls `value` as a function.
3252
+ * Otherwise it is returned directly.
3253
+ * @param value Function or any value.
3254
+ * @param context Optional context to bind to function.
3255
+ * @param props Optional props to pass to function.
3256
+ */
3257
+ declare function callOrReturn<T>(value: T, context?: any, ...props: any[]): MaybeReturnType<T>;
3258
+
3259
+ declare function createStyleTag(style: string, nonce?: string, suffix?: string): HTMLStyleElement;
3260
+
3261
+ /**
3262
+ * Remove a property or an array of properties from an object
3263
+ * @param obj Object
3264
+ * @param key Key to remove
3265
+ */
3266
+ declare function deleteProps(obj: Record<string, any>, propOrProps: string | string[]): Record<string, any>;
3267
+
3268
+ declare function elementFromString(value: string): HTMLElement;
3269
+
3270
+ declare function escapeForRegEx(string: string): string;
3271
+
3272
+ /**
3273
+ * Find duplicates in an array.
3274
+ */
3275
+ declare function findDuplicates<T>(items: T[]): T[];
3276
+
3277
+ declare function fromString(value: any): any;
3278
+
3279
+ declare function isAndroid(): boolean;
3280
+
3281
+ declare function isEmptyObject(value?: {}): boolean;
3282
+
3283
+ declare function isFunction(value: any): value is Function;
3284
+
3285
+ declare function isiOS(): boolean;
3286
+
3287
+ declare function isMacOS(): boolean;
3288
+
3289
+ declare function isNumber(value: any): value is number;
3290
+
3291
+ declare function isPlainObject(value: any): value is Record<string, any>;
3292
+
3293
+ declare function isRegExp(value: any): value is RegExp;
3294
+
3295
+ declare function isString(value: any): value is string;
3296
+
3297
+ declare function mergeAttributes(...objects: Record<string, any>[]): Record<string, any>;
3298
+
3299
+ declare function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
3300
+
3301
+ declare function minMax(value?: number, min?: number, max?: number): number;
3302
+
3303
+ /**
3304
+ * Check if object1 includes object2
3305
+ * @param object1 Object
3306
+ * @param object2 Object
3307
+ */
3308
+ declare function objectIncludes(object1: Record<string, any>, object2: Record<string, any>, options?: {
3309
+ strict: boolean;
3310
+ }): boolean;
3311
+
3312
+ /**
3313
+ * Removes duplicated values within an array.
3314
+ * Supports numbers, strings and objects.
3315
+ */
3316
+ declare function removeDuplicates<T>(array: T[], by?: {
3317
+ (value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
3318
+ (value: any, replacer?: (number | string)[] | null, space?: string | number): string;
3319
+ }): T[];
3320
+
3321
+ interface Commands<ReturnType = any> {
3322
+ }
3323
+ interface Storage {
3324
+ }
3325
+
3326
+ export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes$1 as Attributes, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type Storage, type TextSerializer, type TextType, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, combineTransactionSteps, createChainableState, createDocument, h as createElement, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, h, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };