@tiptap/react 2.0.0-beta.8 → 2.0.0-beta.83

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 (291) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +2 -2
  3. package/dist/packages/core/src/CommandManager.d.ts +20 -0
  4. package/dist/packages/core/src/Editor.d.ts +140 -0
  5. package/dist/packages/core/src/EventEmitter.d.ts +11 -0
  6. package/dist/packages/core/src/Extension.d.ts +194 -0
  7. package/dist/packages/core/src/ExtensionManager.d.ts +18 -0
  8. package/dist/packages/core/src/InputRule.d.ts +42 -0
  9. package/dist/packages/core/src/Mark.d.ts +278 -0
  10. package/dist/packages/core/src/Node.d.ts +340 -0
  11. package/dist/packages/core/src/NodeView.d.ts +27 -0
  12. package/dist/packages/core/src/PasteRule.d.ts +42 -0
  13. package/dist/packages/core/src/Tracker.d.ts +11 -0
  14. package/dist/packages/core/src/commands/blur.d.ts +12 -0
  15. package/dist/packages/core/src/commands/clearContent.d.ts +12 -0
  16. package/dist/packages/core/src/commands/clearNodes.d.ts +12 -0
  17. package/dist/packages/core/src/commands/command.d.ts +12 -0
  18. package/dist/packages/core/src/commands/createParagraphNear.d.ts +12 -0
  19. package/dist/packages/core/src/commands/deleteNode.d.ts +13 -0
  20. package/dist/packages/core/src/commands/deleteRange.d.ts +12 -0
  21. package/dist/packages/core/src/commands/deleteSelection.d.ts +12 -0
  22. package/dist/packages/core/src/commands/enter.d.ts +12 -0
  23. package/dist/packages/core/src/commands/exitCode.d.ts +12 -0
  24. package/dist/packages/core/src/commands/extendMarkRange.d.ts +13 -0
  25. package/dist/packages/core/src/commands/first.d.ts +12 -0
  26. package/dist/packages/core/src/commands/focus.d.ts +12 -0
  27. package/dist/packages/core/src/commands/forEach.d.ts +14 -0
  28. package/dist/packages/core/src/commands/insertContent.d.ts +16 -0
  29. package/dist/packages/core/src/commands/insertContentAt.d.ts +16 -0
  30. package/dist/packages/core/src/commands/joinBackward.d.ts +12 -0
  31. package/dist/packages/core/src/commands/joinForward.d.ts +12 -0
  32. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +12 -0
  33. package/dist/packages/core/src/commands/lift.d.ts +13 -0
  34. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +12 -0
  35. package/dist/packages/core/src/commands/liftListItem.d.ts +13 -0
  36. package/dist/packages/core/src/commands/newlineInCode.d.ts +12 -0
  37. package/dist/packages/core/src/commands/resetAttributes.d.ts +13 -0
  38. package/dist/packages/core/src/commands/scrollIntoView.d.ts +12 -0
  39. package/dist/packages/core/src/commands/selectAll.d.ts +12 -0
  40. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +12 -0
  41. package/dist/packages/core/src/commands/selectNodeForward.d.ts +12 -0
  42. package/dist/packages/core/src/commands/selectParentNode.d.ts +12 -0
  43. package/dist/packages/core/src/commands/setContent.d.ts +13 -0
  44. package/dist/packages/core/src/commands/setMark.d.ts +13 -0
  45. package/dist/packages/core/src/commands/setMeta.d.ts +12 -0
  46. package/dist/packages/core/src/commands/setNode.d.ts +13 -0
  47. package/dist/packages/core/src/commands/setNodeSelection.d.ts +12 -0
  48. package/dist/packages/core/src/commands/setTextSelection.d.ts +12 -0
  49. package/dist/packages/core/src/commands/sinkListItem.d.ts +13 -0
  50. package/dist/packages/core/src/commands/splitBlock.d.ts +14 -0
  51. package/dist/packages/core/src/commands/splitListItem.d.ts +13 -0
  52. package/dist/packages/core/src/commands/toggleList.d.ts +13 -0
  53. package/dist/packages/core/src/commands/toggleMark.d.ts +18 -0
  54. package/dist/packages/core/src/commands/toggleNode.d.ts +13 -0
  55. package/dist/packages/core/src/commands/toggleWrap.d.ts +13 -0
  56. package/dist/packages/core/src/commands/undoInputRule.d.ts +12 -0
  57. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +12 -0
  58. package/dist/packages/core/src/commands/unsetMark.d.ts +18 -0
  59. package/dist/packages/core/src/commands/updateAttributes.d.ts +13 -0
  60. package/dist/packages/core/src/commands/wrapIn.d.ts +13 -0
  61. package/dist/packages/core/src/commands/wrapInList.d.ts +13 -0
  62. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +2 -0
  63. package/dist/packages/core/src/extensions/commands.d.ts +98 -0
  64. package/dist/packages/core/src/extensions/editable.d.ts +2 -0
  65. package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
  66. package/dist/packages/core/src/extensions/index.d.ts +6 -0
  67. package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
  68. package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
  69. package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
  70. package/dist/packages/core/src/helpers/createDocument.d.ts +3 -0
  71. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +7 -0
  72. package/dist/packages/core/src/helpers/findChildren.d.ts +3 -0
  73. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +6 -0
  74. package/dist/packages/core/src/helpers/findParentNode.d.ts +9 -0
  75. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +8 -0
  76. package/dist/packages/core/src/helpers/generateHTML.d.ts +2 -0
  77. package/dist/packages/core/src/helpers/generateJSON.d.ts +2 -0
  78. package/dist/packages/core/src/helpers/generateText.d.ts +5 -0
  79. package/dist/packages/core/src/helpers/getAttributes.d.ts +3 -0
  80. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
  81. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
  82. package/dist/packages/core/src/helpers/getExtensionField.d.ts +2 -0
  83. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
  84. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
  85. package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
  86. package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
  87. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
  88. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
  89. package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
  90. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
  91. package/dist/packages/core/src/helpers/getSchema.d.ts +3 -0
  92. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +3 -0
  93. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +2 -0
  94. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +2 -0
  95. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +2 -0
  96. package/dist/packages/core/src/helpers/getText.d.ts +6 -0
  97. package/dist/packages/core/src/helpers/getTextBetween.d.ts +6 -0
  98. package/dist/packages/core/src/helpers/getTextSeralizersFromSchema.d.ts +3 -0
  99. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
  100. package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
  101. package/dist/packages/core/src/helpers/isList.d.ts +2 -0
  102. package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
  103. package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
  104. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
  105. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
  106. package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
  107. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
  108. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
  109. package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
  110. package/dist/packages/core/src/index.d.ts +57 -0
  111. package/dist/packages/core/src/inputRules/markInputRule.d.ts +12 -0
  112. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +12 -0
  113. package/dist/packages/core/src/inputRules/textInputRule.d.ts +9 -0
  114. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +14 -0
  115. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +23 -0
  116. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +12 -0
  117. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
  118. package/dist/packages/core/src/style.d.ts +2 -0
  119. package/dist/packages/core/src/types.d.ts +207 -0
  120. package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
  121. package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
  122. package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
  123. package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
  124. package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
  125. package/dist/packages/core/src/utilities/isClass.d.ts +1 -0
  126. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
  127. package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
  128. package/dist/packages/core/src/utilities/isObject.d.ts +1 -0
  129. package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
  130. package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
  131. package/dist/packages/core/src/utilities/isString.d.ts +1 -0
  132. package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
  133. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
  134. package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
  135. package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
  136. package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
  137. package/dist/packages/core/src/utilities/removeElement.d.ts +1 -0
  138. package/dist/packages/extension-blockquote/src/blockquote.d.ts +24 -0
  139. package/dist/packages/extension-blockquote/src/index.d.ts +3 -0
  140. package/dist/packages/extension-bold/src/bold.d.ts +27 -0
  141. package/dist/packages/extension-bold/src/index.d.ts +3 -0
  142. package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +43 -0
  143. package/dist/packages/extension-bubble-menu/src/bubble-menu.d.ts +6 -0
  144. package/dist/packages/extension-bubble-menu/src/index.d.ts +4 -0
  145. package/dist/packages/extension-bullet-list/src/bullet-list.d.ts +16 -0
  146. package/dist/packages/extension-bullet-list/src/index.d.ts +3 -0
  147. package/dist/packages/extension-character-count/src/character-count.d.ts +7 -0
  148. package/dist/packages/extension-character-count/src/index.d.ts +3 -0
  149. package/dist/packages/extension-code/src/code.d.ts +25 -0
  150. package/dist/packages/extension-code/src/index.d.ts +3 -0
  151. package/dist/packages/extension-code-block/src/code-block.d.ts +26 -0
  152. package/dist/packages/extension-code-block/src/index.d.ts +3 -0
  153. package/dist/packages/extension-code-block-lowlight/src/code-block-lowlight.d.ts +5 -0
  154. package/dist/packages/extension-code-block-lowlight/src/index.d.ts +3 -0
  155. package/dist/packages/extension-code-block-lowlight/src/lowlight-plugin.d.ts +5 -0
  156. package/dist/packages/extension-collaboration/src/collaboration.d.ts +30 -0
  157. package/dist/packages/extension-collaboration/src/helpers/isChangeOrigin.d.ts +2 -0
  158. package/dist/packages/extension-collaboration/src/index.d.ts +4 -0
  159. package/dist/packages/extension-collaboration-cursor/src/collaboration-cursor.d.ts +21 -0
  160. package/dist/packages/extension-collaboration-cursor/src/index.d.ts +3 -0
  161. package/dist/packages/extension-color/src/color.d.ts +21 -0
  162. package/dist/packages/extension-color/src/index.d.ts +3 -0
  163. package/dist/packages/extension-document/src/document.d.ts +2 -0
  164. package/dist/packages/extension-document/src/index.d.ts +3 -0
  165. package/dist/packages/extension-dropcursor/src/dropcursor.d.ts +7 -0
  166. package/dist/packages/extension-dropcursor/src/index.d.ts +3 -0
  167. package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +40 -0
  168. package/dist/packages/extension-floating-menu/src/floating-menu.d.ts +6 -0
  169. package/dist/packages/extension-floating-menu/src/index.d.ts +4 -0
  170. package/dist/packages/extension-focus/src/focus.d.ts +6 -0
  171. package/dist/packages/extension-focus/src/index.d.ts +3 -0
  172. package/dist/packages/extension-font-family/src/font-family.d.ts +21 -0
  173. package/dist/packages/extension-font-family/src/index.d.ts +3 -0
  174. package/dist/packages/extension-gapcursor/src/gapcursor.d.ts +14 -0
  175. package/dist/packages/extension-gapcursor/src/index.d.ts +3 -0
  176. package/dist/packages/extension-hard-break/src/hard-break.d.ts +16 -0
  177. package/dist/packages/extension-hard-break/src/index.d.ts +3 -0
  178. package/dist/packages/extension-heading/src/heading.d.ts +26 -0
  179. package/dist/packages/extension-heading/src/index.d.ts +3 -0
  180. package/dist/packages/extension-highlight/src/highlight.d.ts +30 -0
  181. package/dist/packages/extension-highlight/src/index.d.ts +3 -0
  182. package/dist/packages/extension-history/src/history.d.ts +20 -0
  183. package/dist/packages/extension-history/src/index.d.ts +3 -0
  184. package/dist/packages/extension-horizontal-rule/src/horizontal-rule.d.ts +15 -0
  185. package/dist/packages/extension-horizontal-rule/src/index.d.ts +3 -0
  186. package/dist/packages/extension-image/src/image.d.ts +21 -0
  187. package/dist/packages/extension-image/src/index.d.ts +3 -0
  188. package/dist/packages/extension-italic/src/index.d.ts +3 -0
  189. package/dist/packages/extension-italic/src/italic.d.ts +27 -0
  190. package/dist/packages/extension-link/src/index.d.ts +3 -0
  191. package/dist/packages/extension-link/src/link.d.ts +40 -0
  192. package/dist/packages/extension-list-item/src/index.d.ts +3 -0
  193. package/dist/packages/extension-list-item/src/list-item.d.ts +5 -0
  194. package/dist/packages/extension-mention/src/index.d.ts +3 -0
  195. package/dist/packages/extension-mention/src/mention.d.ts +14 -0
  196. package/dist/packages/extension-ordered-list/src/index.d.ts +3 -0
  197. package/dist/packages/extension-ordered-list/src/ordered-list.d.ts +16 -0
  198. package/dist/packages/extension-paragraph/src/index.d.ts +3 -0
  199. package/dist/packages/extension-paragraph/src/paragraph.d.ts +15 -0
  200. package/dist/packages/extension-placeholder/src/index.d.ts +3 -0
  201. package/dist/packages/extension-placeholder/src/placeholder.d.ts +15 -0
  202. package/dist/packages/extension-strike/src/index.d.ts +3 -0
  203. package/dist/packages/extension-strike/src/strike.d.ts +25 -0
  204. package/dist/packages/extension-subscript/src/index.d.ts +3 -0
  205. package/dist/packages/extension-subscript/src/subscript.d.ts +23 -0
  206. package/dist/packages/extension-superscript/src/index.d.ts +3 -0
  207. package/dist/packages/extension-superscript/src/superscript.d.ts +23 -0
  208. package/dist/packages/extension-table/src/TableView.d.ts +17 -0
  209. package/dist/packages/extension-table/src/index.d.ts +4 -0
  210. package/dist/packages/extension-table/src/table.d.ts +54 -0
  211. package/dist/packages/extension-table/src/utilities/createCell.d.ts +2 -0
  212. package/dist/packages/extension-table/src/utilities/createTable.d.ts +2 -0
  213. package/dist/packages/extension-table/src/utilities/deleteTableWhenAllCellsSelected.d.ts +2 -0
  214. package/dist/packages/extension-table/src/utilities/getTableNodeTypes.d.ts +4 -0
  215. package/dist/packages/extension-table/src/utilities/isCellSelection.d.ts +2 -0
  216. package/dist/packages/extension-table-cell/src/index.d.ts +3 -0
  217. package/dist/packages/extension-table-cell/src/table-cell.d.ts +5 -0
  218. package/dist/packages/extension-table-header/src/index.d.ts +3 -0
  219. package/dist/packages/extension-table-header/src/table-header.d.ts +5 -0
  220. package/dist/packages/extension-table-row/src/index.d.ts +3 -0
  221. package/dist/packages/extension-table-row/src/table-row.d.ts +5 -0
  222. package/dist/packages/extension-task-item/src/index.d.ts +3 -0
  223. package/dist/packages/extension-task-item/src/task-item.d.ts +7 -0
  224. package/dist/packages/extension-task-list/src/index.d.ts +3 -0
  225. package/dist/packages/extension-task-list/src/task-list.d.ts +15 -0
  226. package/dist/packages/extension-text/src/index.d.ts +3 -0
  227. package/dist/packages/extension-text/src/text.d.ts +2 -0
  228. package/dist/packages/extension-text-align/src/index.d.ts +3 -0
  229. package/dist/packages/extension-text-align/src/text-align.d.ts +21 -0
  230. package/dist/packages/extension-text-style/src/index.d.ts +3 -0
  231. package/dist/packages/extension-text-style/src/text-style.d.ts +15 -0
  232. package/dist/packages/extension-typography/src/index.d.ts +3 -0
  233. package/dist/packages/extension-typography/src/typography.d.ts +23 -0
  234. package/dist/packages/extension-underline/src/index.d.ts +3 -0
  235. package/dist/packages/extension-underline/src/underline.d.ts +23 -0
  236. package/dist/packages/html/src/generateHTML.d.ts +2 -0
  237. package/dist/packages/html/src/generateJSON.d.ts +2 -0
  238. package/dist/packages/html/src/getHTMLFromFragment.d.ts +2 -0
  239. package/dist/packages/html/src/index.d.ts +2 -0
  240. package/dist/packages/react/src/BubbleMenu.d.ts +3 -1
  241. package/dist/packages/react/src/EditorContent.d.ts +2 -2
  242. package/dist/packages/react/src/FloatingMenu.d.ts +8 -0
  243. package/dist/packages/react/src/NodeViewContent.d.ts +2 -2
  244. package/dist/packages/react/src/NodeViewWrapper.d.ts +2 -2
  245. package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +9 -5
  246. package/dist/packages/react/src/ReactRenderer.d.ts +15 -10
  247. package/dist/packages/react/src/index.d.ts +1 -0
  248. package/dist/packages/react/src/useEditor.d.ts +2 -1
  249. package/dist/packages/react/src/useReactNodeView.d.ts +1 -1
  250. package/dist/packages/starter-kit/src/index.d.ts +3 -0
  251. package/dist/packages/starter-kit/src/starter-kit.d.ts +37 -0
  252. package/dist/packages/suggestion/src/findSuggestionMatch.d.ts +15 -0
  253. package/dist/packages/suggestion/src/index.d.ts +4 -0
  254. package/dist/packages/suggestion/src/suggestion.d.ts +46 -0
  255. package/dist/tests/cypress/integration/core/can.spec.d.ts +1 -0
  256. package/dist/tests/cypress/integration/core/editorProps.spec.d.ts +1 -0
  257. package/dist/tests/cypress/integration/core/extendExtensions.spec.d.ts +1 -0
  258. package/dist/tests/cypress/integration/core/extendMarkRange.spec.d.ts +1 -0
  259. package/dist/tests/cypress/integration/core/extensionOptions.spec.d.ts +1 -0
  260. package/dist/tests/cypress/integration/core/fromString.spec.d.ts +1 -0
  261. package/dist/tests/cypress/integration/core/generateHTML.spec.d.ts +1 -0
  262. package/dist/tests/cypress/integration/core/generateJSON.spec.d.ts +1 -0
  263. package/dist/tests/cypress/integration/core/isActive.spec.d.ts +1 -0
  264. package/dist/tests/cypress/integration/core/isClass.spec.d.ts +1 -0
  265. package/dist/tests/cypress/integration/core/mergeAttributes.spec.d.ts +1 -0
  266. package/dist/tests/cypress/integration/core/mergeDeep.spec.d.ts +1 -0
  267. package/dist/tests/cypress/integration/core/pluginOrder.spec.d.ts +1 -0
  268. package/dist/tests/cypress/integration/extensions/bold.spec.d.ts +1 -0
  269. package/dist/tests/cypress/integration/extensions/codeBlockLowlight.spec.d.ts +1 -0
  270. package/dist/tests/cypress/integration/html/generateHTML.spec.d.ts +1 -0
  271. package/dist/tests/cypress/integration/html/generateJSON.spec.d.ts +1 -0
  272. package/dist/tiptap-react.cjs.js +118 -51
  273. package/dist/tiptap-react.cjs.js.map +1 -1
  274. package/dist/tiptap-react.esm.js +111 -43
  275. package/dist/tiptap-react.esm.js.map +1 -1
  276. package/dist/tiptap-react.umd.js +122 -56
  277. package/dist/tiptap-react.umd.js.map +1 -1
  278. package/package.json +17 -9
  279. package/src/BubbleMenu.tsx +23 -7
  280. package/src/EditorContent.tsx +8 -7
  281. package/src/FloatingMenu.tsx +46 -0
  282. package/src/NodeViewContent.tsx +9 -6
  283. package/src/NodeViewWrapper.tsx +11 -9
  284. package/src/ReactNodeViewRenderer.tsx +67 -27
  285. package/src/ReactRenderer.tsx +26 -14
  286. package/src/index.ts +1 -0
  287. package/src/useEditor.ts +3 -3
  288. package/src/useReactNodeView.ts +1 -2
  289. package/CHANGELOG.md +0 -72
  290. package/dist/tiptap-react.bundle.umd.min.js +0 -54
  291. package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
@@ -0,0 +1,278 @@
1
+ import { DOMOutputSpec, MarkSpec, Mark as ProseMirrorMark, MarkType } from 'prosemirror-model';
2
+ import { Plugin, Transaction } from 'prosemirror-state';
3
+ import { InputRule } from './InputRule';
4
+ import { PasteRule } from './PasteRule';
5
+ import { Extensions, Attributes, RawCommands, GlobalAttributes, ParentConfig, KeyboardShortcutCommand } from './types';
6
+ import { Node } from './Node';
7
+ import { MarkConfig } from '.';
8
+ import { Editor } from './Editor';
9
+ declare module '@tiptap/core' {
10
+ interface MarkConfig<Options = any> {
11
+ [key: string]: any;
12
+ /**
13
+ * Name
14
+ */
15
+ name: string;
16
+ /**
17
+ * Priority
18
+ */
19
+ priority?: number;
20
+ /**
21
+ * Default options
22
+ */
23
+ defaultOptions?: Options;
24
+ /**
25
+ * Global attributes
26
+ */
27
+ addGlobalAttributes?: (this: {
28
+ name: string;
29
+ options: Options;
30
+ parent: ParentConfig<MarkConfig<Options>>['addGlobalAttributes'];
31
+ }) => GlobalAttributes | {};
32
+ /**
33
+ * Raw
34
+ */
35
+ addCommands?: (this: {
36
+ name: string;
37
+ options: Options;
38
+ editor: Editor;
39
+ type: MarkType;
40
+ parent: ParentConfig<MarkConfig<Options>>['addCommands'];
41
+ }) => Partial<RawCommands>;
42
+ /**
43
+ * Keyboard shortcuts
44
+ */
45
+ addKeyboardShortcuts?: (this: {
46
+ name: string;
47
+ options: Options;
48
+ editor: Editor;
49
+ type: MarkType;
50
+ parent: ParentConfig<MarkConfig<Options>>['addKeyboardShortcuts'];
51
+ }) => {
52
+ [key: string]: KeyboardShortcutCommand;
53
+ };
54
+ /**
55
+ * Input rules
56
+ */
57
+ addInputRules?: (this: {
58
+ name: string;
59
+ options: Options;
60
+ editor: Editor;
61
+ type: MarkType;
62
+ parent: ParentConfig<MarkConfig<Options>>['addInputRules'];
63
+ }) => InputRule[];
64
+ /**
65
+ * Paste rules
66
+ */
67
+ addPasteRules?: (this: {
68
+ name: string;
69
+ options: Options;
70
+ editor: Editor;
71
+ type: MarkType;
72
+ parent: ParentConfig<MarkConfig<Options>>['addPasteRules'];
73
+ }) => PasteRule[];
74
+ /**
75
+ * ProseMirror plugins
76
+ */
77
+ addProseMirrorPlugins?: (this: {
78
+ name: string;
79
+ options: Options;
80
+ editor: Editor;
81
+ type: MarkType;
82
+ parent: ParentConfig<MarkConfig<Options>>['addProseMirrorPlugins'];
83
+ }) => Plugin[];
84
+ /**
85
+ * Extensions
86
+ */
87
+ addExtensions?: (this: {
88
+ name: string;
89
+ options: Options;
90
+ parent: ParentConfig<MarkConfig<Options>>['addExtensions'];
91
+ }) => Extensions;
92
+ /**
93
+ * Extend Node Schema
94
+ */
95
+ extendNodeSchema?: ((this: {
96
+ name: string;
97
+ options: Options;
98
+ parent: ParentConfig<MarkConfig<Options>>['extendNodeSchema'];
99
+ }, extension: Node) => Record<string, any>) | null;
100
+ /**
101
+ * Extend Mark Schema
102
+ */
103
+ extendMarkSchema?: ((this: {
104
+ name: string;
105
+ options: Options;
106
+ parent: ParentConfig<MarkConfig<Options>>['extendMarkSchema'];
107
+ }, extension: Mark) => Record<string, any>) | null;
108
+ /**
109
+ * The editor is not ready yet.
110
+ */
111
+ onBeforeCreate?: ((this: {
112
+ name: string;
113
+ options: Options;
114
+ editor: Editor;
115
+ type: MarkType;
116
+ parent: ParentConfig<MarkConfig<Options>>['onBeforeCreate'];
117
+ }) => void) | null;
118
+ /**
119
+ * The editor is ready.
120
+ */
121
+ onCreate?: ((this: {
122
+ name: string;
123
+ options: Options;
124
+ editor: Editor;
125
+ type: MarkType;
126
+ parent: ParentConfig<MarkConfig<Options>>['onCreate'];
127
+ }) => void) | null;
128
+ /**
129
+ * The content has changed.
130
+ */
131
+ onUpdate?: ((this: {
132
+ name: string;
133
+ options: Options;
134
+ editor: Editor;
135
+ type: MarkType;
136
+ parent: ParentConfig<MarkConfig<Options>>['onUpdate'];
137
+ }) => void) | null;
138
+ /**
139
+ * The selection has changed.
140
+ */
141
+ onSelectionUpdate?: ((this: {
142
+ name: string;
143
+ options: Options;
144
+ editor: Editor;
145
+ type: MarkType;
146
+ parent: ParentConfig<MarkConfig<Options>>['onSelectionUpdate'];
147
+ }) => void) | null;
148
+ /**
149
+ * The editor state has changed.
150
+ */
151
+ onTransaction?: ((this: {
152
+ name: string;
153
+ options: Options;
154
+ editor: Editor;
155
+ type: MarkType;
156
+ parent: ParentConfig<MarkConfig<Options>>['onTransaction'];
157
+ }, props: {
158
+ transaction: Transaction;
159
+ }) => void) | null;
160
+ /**
161
+ * The editor is focused.
162
+ */
163
+ onFocus?: ((this: {
164
+ name: string;
165
+ options: Options;
166
+ editor: Editor;
167
+ type: MarkType;
168
+ parent: ParentConfig<MarkConfig<Options>>['onFocus'];
169
+ }, props: {
170
+ event: FocusEvent;
171
+ }) => void) | null;
172
+ /**
173
+ * The editor isn’t focused anymore.
174
+ */
175
+ onBlur?: ((this: {
176
+ name: string;
177
+ options: Options;
178
+ editor: Editor;
179
+ type: MarkType;
180
+ parent: ParentConfig<MarkConfig<Options>>['onBlur'];
181
+ }, props: {
182
+ event: FocusEvent;
183
+ }) => void) | null;
184
+ /**
185
+ * The editor is destroyed.
186
+ */
187
+ onDestroy?: ((this: {
188
+ name: string;
189
+ options: Options;
190
+ editor: Editor;
191
+ type: MarkType;
192
+ parent: ParentConfig<MarkConfig<Options>>['onDestroy'];
193
+ }) => void) | null;
194
+ /**
195
+ * Keep mark after split node
196
+ */
197
+ keepOnSplit?: boolean | (() => boolean);
198
+ /**
199
+ * Inclusive
200
+ */
201
+ inclusive?: MarkSpec['inclusive'] | ((this: {
202
+ name: string;
203
+ options: Options;
204
+ parent: ParentConfig<MarkConfig<Options>>['inclusive'];
205
+ }) => MarkSpec['inclusive']);
206
+ /**
207
+ * Excludes
208
+ */
209
+ excludes?: MarkSpec['excludes'] | ((this: {
210
+ name: string;
211
+ options: Options;
212
+ parent: ParentConfig<MarkConfig<Options>>['excludes'];
213
+ }) => MarkSpec['excludes']);
214
+ /**
215
+ * Group
216
+ */
217
+ group?: MarkSpec['group'] | ((this: {
218
+ name: string;
219
+ options: Options;
220
+ parent: ParentConfig<MarkConfig<Options>>['group'];
221
+ }) => MarkSpec['group']);
222
+ /**
223
+ * Spanning
224
+ */
225
+ spanning?: MarkSpec['spanning'] | ((this: {
226
+ name: string;
227
+ options: Options;
228
+ parent: ParentConfig<MarkConfig<Options>>['spanning'];
229
+ }) => MarkSpec['spanning']);
230
+ /**
231
+ * Code
232
+ */
233
+ code?: boolean | ((this: {
234
+ name: string;
235
+ options: Options;
236
+ parent: ParentConfig<MarkConfig<Options>>['code'];
237
+ }) => boolean);
238
+ /**
239
+ * Parse HTML
240
+ */
241
+ parseHTML?: (this: {
242
+ name: string;
243
+ options: Options;
244
+ parent: ParentConfig<MarkConfig<Options>>['parseHTML'];
245
+ }) => MarkSpec['parseDOM'];
246
+ /**
247
+ * Render HTML
248
+ */
249
+ renderHTML?: ((this: {
250
+ name: string;
251
+ options: Options;
252
+ parent: ParentConfig<MarkConfig<Options>>['renderHTML'];
253
+ }, props: {
254
+ mark: ProseMirrorMark;
255
+ HTMLAttributes: Record<string, any>;
256
+ }) => DOMOutputSpec) | null;
257
+ /**
258
+ * Attributes
259
+ */
260
+ addAttributes?: (this: {
261
+ name: string;
262
+ options: Options;
263
+ parent: ParentConfig<MarkConfig<Options>>['addAttributes'];
264
+ }) => Attributes | {};
265
+ }
266
+ }
267
+ export declare class Mark<Options = any> {
268
+ type: string;
269
+ name: string;
270
+ parent: Mark | null;
271
+ child: Mark | null;
272
+ options: Options;
273
+ config: MarkConfig;
274
+ constructor(config?: Partial<MarkConfig<Options>>);
275
+ static create<O>(config?: Partial<MarkConfig<O>>): Mark<O>;
276
+ configure(options?: Partial<Options>): Mark<Options>;
277
+ extend<ExtendedOptions = Options>(extendedConfig?: Partial<MarkConfig<ExtendedOptions>>): Mark<ExtendedOptions>;
278
+ }
@@ -0,0 +1,340 @@
1
+ import { DOMOutputSpec, NodeSpec, Node as ProseMirrorNode, NodeType } from 'prosemirror-model';
2
+ import { Plugin, Transaction } from 'prosemirror-state';
3
+ import { InputRule } from './InputRule';
4
+ import { PasteRule } from './PasteRule';
5
+ import { Extensions, Attributes, NodeViewRenderer, GlobalAttributes, RawCommands, ParentConfig, KeyboardShortcutCommand } from './types';
6
+ import { NodeConfig } from '.';
7
+ import { Editor } from './Editor';
8
+ declare module '@tiptap/core' {
9
+ interface NodeConfig<Options = any> {
10
+ [key: string]: any;
11
+ /**
12
+ * Name
13
+ */
14
+ name: string;
15
+ /**
16
+ * Priority
17
+ */
18
+ priority?: number;
19
+ /**
20
+ * Default options
21
+ */
22
+ defaultOptions?: Options;
23
+ /**
24
+ * Global attributes
25
+ */
26
+ addGlobalAttributes?: (this: {
27
+ name: string;
28
+ options: Options;
29
+ parent: ParentConfig<NodeConfig<Options>>['addGlobalAttributes'];
30
+ }) => GlobalAttributes | {};
31
+ /**
32
+ * Raw
33
+ */
34
+ addCommands?: (this: {
35
+ name: string;
36
+ options: Options;
37
+ editor: Editor;
38
+ type: NodeType;
39
+ parent: ParentConfig<NodeConfig<Options>>['addCommands'];
40
+ }) => Partial<RawCommands>;
41
+ /**
42
+ * Keyboard shortcuts
43
+ */
44
+ addKeyboardShortcuts?: (this: {
45
+ name: string;
46
+ options: Options;
47
+ editor: Editor;
48
+ type: NodeType;
49
+ parent: ParentConfig<NodeConfig<Options>>['addKeyboardShortcuts'];
50
+ }) => {
51
+ [key: string]: KeyboardShortcutCommand;
52
+ };
53
+ /**
54
+ * Input rules
55
+ */
56
+ addInputRules?: (this: {
57
+ name: string;
58
+ options: Options;
59
+ editor: Editor;
60
+ type: NodeType;
61
+ parent: ParentConfig<NodeConfig<Options>>['addInputRules'];
62
+ }) => InputRule[];
63
+ /**
64
+ * Paste rules
65
+ */
66
+ addPasteRules?: (this: {
67
+ name: string;
68
+ options: Options;
69
+ editor: Editor;
70
+ type: NodeType;
71
+ parent: ParentConfig<NodeConfig<Options>>['addPasteRules'];
72
+ }) => PasteRule[];
73
+ /**
74
+ * ProseMirror plugins
75
+ */
76
+ addProseMirrorPlugins?: (this: {
77
+ name: string;
78
+ options: Options;
79
+ editor: Editor;
80
+ type: NodeType;
81
+ parent: ParentConfig<NodeConfig<Options>>['addProseMirrorPlugins'];
82
+ }) => Plugin[];
83
+ /**
84
+ * Extensions
85
+ */
86
+ addExtensions?: (this: {
87
+ name: string;
88
+ options: Options;
89
+ parent: ParentConfig<NodeConfig<Options>>['addExtensions'];
90
+ }) => Extensions;
91
+ /**
92
+ * Extend Node Schema
93
+ */
94
+ extendNodeSchema?: ((this: {
95
+ name: string;
96
+ options: Options;
97
+ parent: ParentConfig<NodeConfig<Options>>['extendNodeSchema'];
98
+ }, extension: Node) => Record<string, any>) | null;
99
+ /**
100
+ * Extend Mark Schema
101
+ */
102
+ extendMarkSchema?: ((this: {
103
+ name: string;
104
+ options: Options;
105
+ parent: ParentConfig<NodeConfig<Options>>['extendMarkSchema'];
106
+ }, extension: Node) => Record<string, any>) | null;
107
+ /**
108
+ * The editor is not ready yet.
109
+ */
110
+ onBeforeCreate?: ((this: {
111
+ name: string;
112
+ options: Options;
113
+ editor: Editor;
114
+ type: NodeType;
115
+ parent: ParentConfig<NodeConfig<Options>>['onBeforeCreate'];
116
+ }) => void) | null;
117
+ /**
118
+ * The editor is ready.
119
+ */
120
+ onCreate?: ((this: {
121
+ name: string;
122
+ options: Options;
123
+ editor: Editor;
124
+ type: NodeType;
125
+ parent: ParentConfig<NodeConfig<Options>>['onCreate'];
126
+ }) => void) | null;
127
+ /**
128
+ * The content has changed.
129
+ */
130
+ onUpdate?: ((this: {
131
+ name: string;
132
+ options: Options;
133
+ editor: Editor;
134
+ type: NodeType;
135
+ parent: ParentConfig<NodeConfig<Options>>['onUpdate'];
136
+ }) => void) | null;
137
+ /**
138
+ * The selection has changed.
139
+ */
140
+ onSelectionUpdate?: ((this: {
141
+ name: string;
142
+ options: Options;
143
+ editor: Editor;
144
+ type: NodeType;
145
+ parent: ParentConfig<NodeConfig<Options>>['onSelectionUpdate'];
146
+ }) => void) | null;
147
+ /**
148
+ * The editor state has changed.
149
+ */
150
+ onTransaction?: ((this: {
151
+ name: string;
152
+ options: Options;
153
+ editor: Editor;
154
+ type: NodeType;
155
+ parent: ParentConfig<NodeConfig<Options>>['onTransaction'];
156
+ }, props: {
157
+ transaction: Transaction;
158
+ }) => void) | null;
159
+ /**
160
+ * The editor is focused.
161
+ */
162
+ onFocus?: ((this: {
163
+ name: string;
164
+ options: Options;
165
+ editor: Editor;
166
+ type: NodeType;
167
+ parent: ParentConfig<NodeConfig<Options>>['onFocus'];
168
+ }, props: {
169
+ event: FocusEvent;
170
+ }) => void) | null;
171
+ /**
172
+ * The editor isn’t focused anymore.
173
+ */
174
+ onBlur?: ((this: {
175
+ name: string;
176
+ options: Options;
177
+ editor: Editor;
178
+ type: NodeType;
179
+ parent: ParentConfig<NodeConfig<Options>>['onBlur'];
180
+ }, props: {
181
+ event: FocusEvent;
182
+ }) => void) | null;
183
+ /**
184
+ * The editor is destroyed.
185
+ */
186
+ onDestroy?: ((this: {
187
+ name: string;
188
+ options: Options;
189
+ editor: Editor;
190
+ type: NodeType;
191
+ parent: ParentConfig<NodeConfig<Options>>['onDestroy'];
192
+ }) => void) | null;
193
+ /**
194
+ * Node View
195
+ */
196
+ addNodeView?: ((this: {
197
+ name: string;
198
+ options: Options;
199
+ editor: Editor;
200
+ type: NodeType;
201
+ parent: ParentConfig<NodeConfig<Options>>['addNodeView'];
202
+ }) => NodeViewRenderer) | null;
203
+ /**
204
+ * TopNode
205
+ */
206
+ topNode?: boolean;
207
+ /**
208
+ * Content
209
+ */
210
+ content?: NodeSpec['content'] | ((this: {
211
+ name: string;
212
+ options: Options;
213
+ parent: ParentConfig<NodeConfig<Options>>['content'];
214
+ }) => NodeSpec['content']);
215
+ /**
216
+ * Marks
217
+ */
218
+ marks?: NodeSpec['marks'] | ((this: {
219
+ name: string;
220
+ options: Options;
221
+ parent: ParentConfig<NodeConfig<Options>>['marks'];
222
+ }) => NodeSpec['marks']);
223
+ /**
224
+ * Group
225
+ */
226
+ group?: NodeSpec['group'] | ((this: {
227
+ name: string;
228
+ options: Options;
229
+ parent: ParentConfig<NodeConfig<Options>>['group'];
230
+ }) => NodeSpec['group']);
231
+ /**
232
+ * Inline
233
+ */
234
+ inline?: NodeSpec['inline'] | ((this: {
235
+ name: string;
236
+ options: Options;
237
+ parent: ParentConfig<NodeConfig<Options>>['inline'];
238
+ }) => NodeSpec['inline']);
239
+ /**
240
+ * Atom
241
+ */
242
+ atom?: NodeSpec['atom'] | ((this: {
243
+ name: string;
244
+ options: Options;
245
+ parent: ParentConfig<NodeConfig<Options>>['atom'];
246
+ }) => NodeSpec['atom']);
247
+ /**
248
+ * Selectable
249
+ */
250
+ selectable?: NodeSpec['selectable'] | ((this: {
251
+ name: string;
252
+ options: Options;
253
+ parent: ParentConfig<NodeConfig<Options>>['selectable'];
254
+ }) => NodeSpec['selectable']);
255
+ /**
256
+ * Draggable
257
+ */
258
+ draggable?: NodeSpec['draggable'] | ((this: {
259
+ name: string;
260
+ options: Options;
261
+ parent: ParentConfig<NodeConfig<Options>>['draggable'];
262
+ }) => NodeSpec['draggable']);
263
+ /**
264
+ * Code
265
+ */
266
+ code?: NodeSpec['code'] | ((this: {
267
+ name: string;
268
+ options: Options;
269
+ parent: ParentConfig<NodeConfig<Options>>['code'];
270
+ }) => NodeSpec['code']);
271
+ /**
272
+ * Defining
273
+ */
274
+ defining?: NodeSpec['defining'] | ((this: {
275
+ name: string;
276
+ options: Options;
277
+ parent: ParentConfig<NodeConfig<Options>>['defining'];
278
+ }) => NodeSpec['defining']);
279
+ /**
280
+ * Isolating
281
+ */
282
+ isolating?: NodeSpec['isolating'] | ((this: {
283
+ name: string;
284
+ options: Options;
285
+ parent: ParentConfig<NodeConfig<Options>>['isolating'];
286
+ }) => NodeSpec['isolating']);
287
+ /**
288
+ * Parse HTML
289
+ */
290
+ parseHTML?: (this: {
291
+ name: string;
292
+ options: Options;
293
+ parent: ParentConfig<NodeConfig<Options>>['parseHTML'];
294
+ }) => NodeSpec['parseDOM'];
295
+ /**
296
+ * Render HTML
297
+ */
298
+ renderHTML?: ((this: {
299
+ name: string;
300
+ options: Options;
301
+ parent: ParentConfig<NodeConfig<Options>>['renderHTML'];
302
+ }, props: {
303
+ node: ProseMirrorNode;
304
+ HTMLAttributes: Record<string, any>;
305
+ }) => DOMOutputSpec) | null;
306
+ /**
307
+ * Render Text
308
+ */
309
+ renderText?: ((this: {
310
+ name: string;
311
+ options: Options;
312
+ parent: ParentConfig<NodeConfig<Options>>['renderText'];
313
+ }, props: {
314
+ node: ProseMirrorNode;
315
+ pos: number;
316
+ parent: ProseMirrorNode;
317
+ index: number;
318
+ }) => string) | null;
319
+ /**
320
+ * Add Attributes
321
+ */
322
+ addAttributes?: (this: {
323
+ name: string;
324
+ options: Options;
325
+ parent: ParentConfig<NodeConfig<Options>>['addAttributes'];
326
+ }) => Attributes | {};
327
+ }
328
+ }
329
+ export declare class Node<Options = any> {
330
+ type: string;
331
+ name: string;
332
+ parent: Node | null;
333
+ child: Node | null;
334
+ options: Options;
335
+ config: NodeConfig;
336
+ constructor(config?: Partial<NodeConfig<Options>>);
337
+ static create<O>(config?: Partial<NodeConfig<O>>): Node<O>;
338
+ configure(options?: Partial<Options>): Node<Options>;
339
+ extend<ExtendedOptions = Options>(extendedConfig?: Partial<NodeConfig<ExtendedOptions>>): Node<ExtendedOptions>;
340
+ }
@@ -0,0 +1,27 @@
1
+ import { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view';
2
+ import { Node as ProseMirrorNode } from 'prosemirror-model';
3
+ import { Editor as CoreEditor } from './Editor';
4
+ import { Node } from './Node';
5
+ import { NodeViewRendererProps, NodeViewRendererOptions } from './types';
6
+ export declare class NodeView<Component, Editor extends CoreEditor = CoreEditor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> implements ProseMirrorNodeView {
7
+ component: Component;
8
+ editor: Editor;
9
+ options: Options;
10
+ extension: Node;
11
+ node: ProseMirrorNode;
12
+ decorations: Decoration[];
13
+ getPos: any;
14
+ isDragging: boolean;
15
+ constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
16
+ mount(): void;
17
+ get dom(): Element | null;
18
+ get contentDOM(): Element | null;
19
+ onDragStart(event: DragEvent): void;
20
+ stopEvent(event: Event): boolean;
21
+ ignoreMutation(mutation: MutationRecord | {
22
+ type: 'selection';
23
+ target: Element;
24
+ }): boolean;
25
+ updateAttributes(attributes: {}): void;
26
+ deleteNode(): void;
27
+ }
@@ -0,0 +1,42 @@
1
+ import { EditorState, Plugin } from 'prosemirror-state';
2
+ import { Editor } from './Editor';
3
+ import { Range, ExtendedRegExpMatchArray, SingleCommands, ChainedCommands, CanCommands } from './types';
4
+ export declare type PasteRuleMatch = {
5
+ index: number;
6
+ text: string;
7
+ replaceWith?: string;
8
+ match?: RegExpMatchArray;
9
+ data?: Record<string, any>;
10
+ };
11
+ export declare type PasteRuleFinder = RegExp | ((text: string) => PasteRuleMatch[] | null | undefined);
12
+ export declare class PasteRule {
13
+ find: PasteRuleFinder;
14
+ handler: (props: {
15
+ state: EditorState;
16
+ range: Range;
17
+ match: ExtendedRegExpMatchArray;
18
+ commands: SingleCommands;
19
+ chain: () => ChainedCommands;
20
+ can: () => CanCommands;
21
+ }) => void;
22
+ constructor(config: {
23
+ find: PasteRuleFinder;
24
+ handler: (props: {
25
+ state: EditorState;
26
+ range: Range;
27
+ match: ExtendedRegExpMatchArray;
28
+ commands: SingleCommands;
29
+ chain: () => ChainedCommands;
30
+ can: () => CanCommands;
31
+ }) => void;
32
+ });
33
+ }
34
+ /**
35
+ * Create an paste rules plugin. When enabled, it will cause pasted
36
+ * text that matches any of the given rules to trigger the rule’s
37
+ * action.
38
+ */
39
+ export declare function pasteRulesPlugin(props: {
40
+ editor: Editor;
41
+ rules: PasteRule[];
42
+ }): Plugin;
@@ -0,0 +1,11 @@
1
+ import { Transaction } from 'prosemirror-state';
2
+ export interface TrackerResult {
3
+ position: number;
4
+ deleted: boolean;
5
+ }
6
+ export declare class Tracker {
7
+ transaction: Transaction;
8
+ currentStep: number;
9
+ constructor(transaction: Transaction);
10
+ map(position: number): TrackerResult;
11
+ }