@tiptap/core 2.1.0-rc.9 → 2.1.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 (258) hide show
  1. package/dist/index.cjs +384 -99
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +373 -98
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.js +384 -99
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/packages/core/src/CommandManager.d.ts +2 -2
  8. package/dist/packages/core/src/Editor.d.ts +4 -4
  9. package/dist/packages/core/src/Extension.d.ts +7 -7
  10. package/dist/packages/core/src/ExtensionManager.d.ts +2 -2
  11. package/dist/packages/core/src/InputRule.d.ts +2 -2
  12. package/dist/packages/core/src/Mark.d.ts +6 -6
  13. package/dist/packages/core/src/Node.d.ts +5 -5
  14. package/dist/packages/core/src/NodeView.d.ts +3 -3
  15. package/dist/packages/core/src/PasteRule.d.ts +2 -2
  16. package/dist/packages/core/src/commands/blur.d.ts +1 -1
  17. package/dist/packages/core/src/commands/clearContent.d.ts +1 -1
  18. package/dist/packages/core/src/commands/clearNodes.d.ts +1 -1
  19. package/dist/packages/core/src/commands/command.d.ts +1 -1
  20. package/dist/packages/core/src/commands/createParagraphNear.d.ts +1 -1
  21. package/dist/packages/core/src/commands/cut.d.ts +15 -0
  22. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +1 -1
  23. package/dist/packages/core/src/commands/deleteNode.d.ts +1 -1
  24. package/dist/packages/core/src/commands/deleteRange.d.ts +1 -1
  25. package/dist/packages/core/src/commands/deleteSelection.d.ts +1 -1
  26. package/dist/packages/core/src/commands/enter.d.ts +1 -1
  27. package/dist/packages/core/src/commands/exitCode.d.ts +1 -1
  28. package/dist/packages/core/src/commands/extendMarkRange.d.ts +1 -1
  29. package/dist/packages/core/src/commands/first.d.ts +1 -1
  30. package/dist/packages/core/src/commands/focus.d.ts +1 -1
  31. package/dist/packages/core/src/commands/forEach.d.ts +1 -1
  32. package/dist/packages/core/src/commands/index.d.ts +53 -50
  33. package/dist/packages/core/src/commands/insertContent.d.ts +1 -1
  34. package/dist/packages/core/src/commands/insertContentAt.d.ts +1 -1
  35. package/dist/packages/core/src/commands/join.d.ts +1 -1
  36. package/dist/packages/core/src/commands/joinItemBackward.d.ts +12 -0
  37. package/dist/packages/core/src/commands/joinItemForward.d.ts +12 -0
  38. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +1 -1
  39. package/dist/packages/core/src/commands/lift.d.ts +1 -1
  40. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +1 -1
  41. package/dist/packages/core/src/commands/liftListItem.d.ts +1 -1
  42. package/dist/packages/core/src/commands/newlineInCode.d.ts +1 -1
  43. package/dist/packages/core/src/commands/resetAttributes.d.ts +1 -1
  44. package/dist/packages/core/src/commands/scrollIntoView.d.ts +1 -1
  45. package/dist/packages/core/src/commands/selectAll.d.ts +1 -1
  46. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +1 -1
  47. package/dist/packages/core/src/commands/selectNodeForward.d.ts +1 -1
  48. package/dist/packages/core/src/commands/selectParentNode.d.ts +1 -1
  49. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +1 -1
  50. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +1 -1
  51. package/dist/packages/core/src/commands/setContent.d.ts +1 -1
  52. package/dist/packages/core/src/commands/setMark.d.ts +1 -1
  53. package/dist/packages/core/src/commands/setMeta.d.ts +1 -1
  54. package/dist/packages/core/src/commands/setNode.d.ts +1 -1
  55. package/dist/packages/core/src/commands/setNodeSelection.d.ts +1 -1
  56. package/dist/packages/core/src/commands/setTextSelection.d.ts +1 -1
  57. package/dist/packages/core/src/commands/sinkListItem.d.ts +1 -1
  58. package/dist/packages/core/src/commands/splitBlock.d.ts +1 -1
  59. package/dist/packages/core/src/commands/splitListItem.d.ts +1 -1
  60. package/dist/packages/core/src/commands/toggleList.d.ts +1 -1
  61. package/dist/packages/core/src/commands/toggleMark.d.ts +1 -1
  62. package/dist/packages/core/src/commands/toggleNode.d.ts +1 -1
  63. package/dist/packages/core/src/commands/toggleWrap.d.ts +1 -1
  64. package/dist/packages/core/src/commands/undoInputRule.d.ts +1 -1
  65. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +1 -1
  66. package/dist/packages/core/src/commands/unsetMark.d.ts +1 -1
  67. package/dist/packages/core/src/commands/updateAttributes.d.ts +1 -1
  68. package/dist/packages/core/src/commands/wrapIn.d.ts +1 -1
  69. package/dist/packages/core/src/commands/wrapInList.d.ts +1 -1
  70. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +1 -1
  71. package/dist/packages/core/src/extensions/commands.d.ts +2 -2
  72. package/dist/packages/core/src/extensions/editable.d.ts +1 -1
  73. package/dist/packages/core/src/extensions/focusEvents.d.ts +1 -1
  74. package/dist/packages/core/src/extensions/index.d.ts +6 -6
  75. package/dist/packages/core/src/extensions/keymap.d.ts +1 -1
  76. package/dist/packages/core/src/extensions/tabindex.d.ts +1 -1
  77. package/dist/packages/core/src/helpers/createDocument.d.ts +1 -1
  78. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +1 -1
  79. package/dist/packages/core/src/helpers/findChildren.d.ts +1 -1
  80. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +1 -1
  81. package/dist/packages/core/src/helpers/findParentNode.d.ts +1 -1
  82. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +1 -1
  83. package/dist/packages/core/src/helpers/generateHTML.d.ts +1 -1
  84. package/dist/packages/core/src/helpers/generateJSON.d.ts +1 -1
  85. package/dist/packages/core/src/helpers/generateText.d.ts +1 -1
  86. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +1 -1
  87. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +1 -1
  88. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +1 -1
  89. package/dist/packages/core/src/helpers/getExtensionField.d.ts +1 -1
  90. package/dist/packages/core/src/helpers/getMarkRange.d.ts +1 -1
  91. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +1 -1
  92. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +1 -1
  93. package/dist/packages/core/src/helpers/getSchema.d.ts +2 -2
  94. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +2 -2
  95. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +1 -1
  96. package/dist/packages/core/src/helpers/getText.d.ts +1 -1
  97. package/dist/packages/core/src/helpers/getTextBetween.d.ts +1 -1
  98. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +1 -1
  99. package/dist/packages/core/src/helpers/index.d.ts +51 -50
  100. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +1 -1
  101. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +1 -1
  102. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +1 -1
  103. package/dist/packages/core/src/helpers/isList.d.ts +1 -1
  104. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +1 -1
  105. package/dist/packages/core/src/helpers/splitExtensions.d.ts +4 -4
  106. package/dist/packages/core/src/index.d.ts +15 -15
  107. package/dist/packages/core/src/inputRules/index.d.ts +5 -5
  108. package/dist/packages/core/src/inputRules/markInputRule.d.ts +2 -2
  109. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +22 -2
  110. package/dist/packages/core/src/inputRules/textInputRule.d.ts +1 -1
  111. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +2 -2
  112. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +3 -3
  113. package/dist/packages/core/src/pasteRules/index.d.ts +3 -3
  114. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +2 -2
  115. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +2 -2
  116. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +1 -1
  117. package/dist/packages/core/src/types.d.ts +5 -5
  118. package/dist/packages/core/src/utilities/callOrReturn.d.ts +1 -1
  119. package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -1
  120. package/dist/packages/core/src/utilities/index.d.ts +20 -20
  121. package/dist/packages/core/src/utilities/isAndroid.d.ts +1 -0
  122. package/dist/packages/extension-list-keymap/src/listHelpers/findListItemPos.d.ts +6 -0
  123. package/dist/packages/extension-list-keymap/src/listHelpers/getNextListDepth.d.ts +2 -0
  124. package/dist/packages/extension-list-keymap/src/listHelpers/handleBackspace.d.ts +2 -0
  125. package/dist/packages/extension-list-keymap/src/listHelpers/handleDelete.d.ts +2 -0
  126. package/dist/packages/extension-list-keymap/src/listHelpers/hasListBefore.d.ts +2 -0
  127. package/dist/packages/extension-list-keymap/src/listHelpers/hasListItemAfter.d.ts +2 -0
  128. package/dist/packages/extension-list-keymap/src/listHelpers/hasListItemBefore.d.ts +2 -0
  129. package/dist/packages/extension-list-keymap/src/listHelpers/index.d.ts +10 -0
  130. package/dist/packages/extension-list-keymap/src/listHelpers/listItemHasSubList.d.ts +3 -0
  131. package/dist/packages/extension-list-keymap/src/listHelpers/nextListIsDeeper.d.ts +2 -0
  132. package/dist/packages/extension-list-keymap/src/listHelpers/nextListIsHigher.d.ts +2 -0
  133. package/package.json +2 -2
  134. package/src/CommandManager.ts +4 -8
  135. package/src/Editor.ts +16 -16
  136. package/src/Extension.ts +10 -10
  137. package/src/ExtensionManager.ts +15 -15
  138. package/src/InputRule.ts +6 -6
  139. package/src/Mark.ts +9 -9
  140. package/src/Node.ts +8 -8
  141. package/src/NodeView.ts +8 -6
  142. package/src/PasteRule.ts +6 -6
  143. package/src/commands/blur.ts +1 -1
  144. package/src/commands/clearContent.ts +1 -1
  145. package/src/commands/clearNodes.ts +1 -1
  146. package/src/commands/command.ts +1 -1
  147. package/src/commands/createParagraphNear.ts +1 -1
  148. package/src/commands/cut.ts +29 -0
  149. package/src/commands/deleteCurrentNode.ts +1 -1
  150. package/src/commands/deleteNode.ts +2 -2
  151. package/src/commands/deleteRange.ts +1 -1
  152. package/src/commands/deleteSelection.ts +1 -1
  153. package/src/commands/enter.ts +1 -1
  154. package/src/commands/exitCode.ts +1 -1
  155. package/src/commands/extendMarkRange.ts +3 -3
  156. package/src/commands/first.ts +1 -1
  157. package/src/commands/focus.ts +4 -4
  158. package/src/commands/forEach.ts +1 -1
  159. package/src/commands/index.ts +53 -50
  160. package/src/commands/insertContent.ts +1 -1
  161. package/src/commands/insertContentAt.ts +4 -4
  162. package/src/commands/join.ts +1 -1
  163. package/src/commands/joinItemBackward.ts +36 -0
  164. package/src/commands/joinItemForward.ts +38 -0
  165. package/src/commands/keyboardShortcut.ts +3 -3
  166. package/src/commands/lift.ts +3 -3
  167. package/src/commands/liftEmptyBlock.ts +1 -1
  168. package/src/commands/liftListItem.ts +2 -2
  169. package/src/commands/newlineInCode.ts +1 -1
  170. package/src/commands/resetAttributes.ts +5 -5
  171. package/src/commands/scrollIntoView.ts +1 -1
  172. package/src/commands/selectAll.ts +1 -1
  173. package/src/commands/selectNodeBackward.ts +1 -1
  174. package/src/commands/selectNodeForward.ts +1 -1
  175. package/src/commands/selectParentNode.ts +1 -1
  176. package/src/commands/selectTextblockEnd.ts +1 -1
  177. package/src/commands/selectTextblockStart.ts +1 -1
  178. package/src/commands/setContent.ts +2 -2
  179. package/src/commands/setMark.ts +4 -4
  180. package/src/commands/setMeta.ts +1 -1
  181. package/src/commands/setNode.ts +2 -2
  182. package/src/commands/setNodeSelection.ts +2 -2
  183. package/src/commands/setTextSelection.ts +2 -2
  184. package/src/commands/sinkListItem.ts +2 -2
  185. package/src/commands/splitBlock.ts +3 -3
  186. package/src/commands/splitListItem.ts +3 -3
  187. package/src/commands/toggleList.ts +4 -4
  188. package/src/commands/toggleMark.ts +3 -3
  189. package/src/commands/toggleNode.ts +3 -3
  190. package/src/commands/toggleWrap.ts +3 -3
  191. package/src/commands/undoInputRule.ts +1 -1
  192. package/src/commands/unsetAllMarks.ts +1 -1
  193. package/src/commands/unsetMark.ts +3 -3
  194. package/src/commands/updateAttributes.ts +4 -4
  195. package/src/commands/wrapIn.ts +2 -2
  196. package/src/commands/wrapInList.ts +2 -2
  197. package/src/extensions/clipboardTextSerializer.ts +3 -3
  198. package/src/extensions/commands.ts +3 -3
  199. package/src/extensions/editable.ts +1 -1
  200. package/src/extensions/focusEvents.ts +1 -1
  201. package/src/extensions/index.ts +6 -6
  202. package/src/extensions/keymap.ts +7 -5
  203. package/src/extensions/tabindex.ts +1 -1
  204. package/src/helpers/createDocument.ts +2 -2
  205. package/src/helpers/createNodeFromContent.ts +2 -2
  206. package/src/helpers/findChildren.ts +1 -1
  207. package/src/helpers/findChildrenInRange.ts +1 -1
  208. package/src/helpers/findParentNode.ts +2 -2
  209. package/src/helpers/findParentNodeClosestToPos.ts +1 -1
  210. package/src/helpers/generateHTML.ts +3 -3
  211. package/src/helpers/generateJSON.ts +3 -3
  212. package/src/helpers/generateText.ts +4 -4
  213. package/src/helpers/getAttributes.ts +3 -3
  214. package/src/helpers/getAttributesFromExtensions.ts +4 -4
  215. package/src/helpers/getChangedRanges.ts +2 -2
  216. package/src/helpers/getDebugJSON.ts +1 -1
  217. package/src/helpers/getExtensionField.ts +1 -1
  218. package/src/helpers/getMarkAttributes.ts +1 -1
  219. package/src/helpers/getMarkRange.ts +2 -2
  220. package/src/helpers/getMarksBetween.ts +2 -2
  221. package/src/helpers/getNodeAttributes.ts +1 -1
  222. package/src/helpers/getRenderedAttributes.ts +2 -2
  223. package/src/helpers/getSchema.ts +4 -4
  224. package/src/helpers/getSchemaByResolvedExtensions.ts +9 -9
  225. package/src/helpers/getSplittedAttributes.ts +1 -1
  226. package/src/helpers/getText.ts +2 -2
  227. package/src/helpers/getTextBetween.ts +1 -1
  228. package/src/helpers/getTextSerializersFromSchema.ts +1 -1
  229. package/src/helpers/index.ts +51 -50
  230. package/src/helpers/injectExtensionAttributesToParseRule.ts +2 -2
  231. package/src/helpers/isActive.ts +3 -3
  232. package/src/helpers/isAtEndOfNode.ts +20 -2
  233. package/src/helpers/isExtensionRulesEnabled.ts +1 -1
  234. package/src/helpers/isList.ts +5 -5
  235. package/src/helpers/isMarkActive.ts +3 -3
  236. package/src/helpers/isNodeActive.ts +3 -3
  237. package/src/helpers/posToDOMRect.ts +1 -1
  238. package/src/helpers/resolveFocusPosition.ts +2 -2
  239. package/src/helpers/splitExtensions.ts +4 -4
  240. package/src/index.ts +15 -15
  241. package/src/inputRules/index.ts +5 -5
  242. package/src/inputRules/markInputRule.ts +5 -6
  243. package/src/inputRules/nodeInputRule.ts +60 -6
  244. package/src/inputRules/textInputRule.ts +1 -1
  245. package/src/inputRules/textblockTypeInputRule.ts +3 -3
  246. package/src/inputRules/wrappingInputRule.ts +4 -4
  247. package/src/pasteRules/index.ts +3 -3
  248. package/src/pasteRules/markPasteRule.ts +4 -4
  249. package/src/pasteRules/nodePasteRule.ts +3 -3
  250. package/src/pasteRules/textPasteRule.ts +1 -1
  251. package/src/types.ts +5 -5
  252. package/src/utilities/callOrReturn.ts +2 -2
  253. package/src/utilities/createStyleTag.ts +3 -3
  254. package/src/utilities/index.ts +20 -20
  255. package/src/utilities/isAndroid.ts +3 -0
  256. package/src/utilities/mergeAttributes.ts +8 -1
  257. package/src/utilities/mergeDeep.ts +1 -1
  258. package/src/utilities/objectIncludes.ts +1 -1
@@ -1,50 +1,53 @@
1
- export * from './blur'
2
- export * from './clearContent'
3
- export * from './clearNodes'
4
- export * from './command'
5
- export * from './createParagraphNear'
6
- export * from './deleteCurrentNode'
7
- export * from './deleteNode'
8
- export * from './deleteRange'
9
- export * from './deleteSelection'
10
- export * from './enter'
11
- export * from './exitCode'
12
- export * from './extendMarkRange'
13
- export * from './first'
14
- export * from './focus'
15
- export * from './forEach'
16
- export * from './insertContent'
17
- export * from './insertContentAt'
18
- export * from './join'
19
- export * from './keyboardShortcut'
20
- export * from './lift'
21
- export * from './liftEmptyBlock'
22
- export * from './liftListItem'
23
- export * from './newlineInCode'
24
- export * from './resetAttributes'
25
- export * from './scrollIntoView'
26
- export * from './selectAll'
27
- export * from './selectNodeBackward'
28
- export * from './selectNodeForward'
29
- export * from './selectParentNode'
30
- export * from './selectTextblockEnd'
31
- export * from './selectTextblockStart'
32
- export * from './setContent'
33
- export * from './setMark'
34
- export * from './setMeta'
35
- export * from './setNode'
36
- export * from './setNodeSelection'
37
- export * from './setTextSelection'
38
- export * from './sinkListItem'
39
- export * from './splitBlock'
40
- export * from './splitListItem'
41
- export * from './toggleList'
42
- export * from './toggleMark'
43
- export * from './toggleNode'
44
- export * from './toggleWrap'
45
- export * from './undoInputRule'
46
- export * from './unsetAllMarks'
47
- export * from './unsetMark'
48
- export * from './updateAttributes'
49
- export * from './wrapIn'
50
- export * from './wrapInList'
1
+ export * from './blur.js'
2
+ export * from './clearContent.js'
3
+ export * from './clearNodes.js'
4
+ export * from './command.js'
5
+ export * from './createParagraphNear.js'
6
+ export * from './cut.js'
7
+ export * from './deleteCurrentNode.js'
8
+ export * from './deleteNode.js'
9
+ export * from './deleteRange.js'
10
+ export * from './deleteSelection.js'
11
+ export * from './enter.js'
12
+ export * from './exitCode.js'
13
+ export * from './extendMarkRange.js'
14
+ export * from './first.js'
15
+ export * from './focus.js'
16
+ export * from './forEach.js'
17
+ export * from './insertContent.js'
18
+ export * from './insertContentAt.js'
19
+ export * from './join.js'
20
+ export * from './joinItemBackward.js'
21
+ export * from './joinItemForward.js'
22
+ export * from './keyboardShortcut.js'
23
+ export * from './lift.js'
24
+ export * from './liftEmptyBlock.js'
25
+ export * from './liftListItem.js'
26
+ export * from './newlineInCode.js'
27
+ export * from './resetAttributes.js'
28
+ export * from './scrollIntoView.js'
29
+ export * from './selectAll.js'
30
+ export * from './selectNodeBackward.js'
31
+ export * from './selectNodeForward.js'
32
+ export * from './selectParentNode.js'
33
+ export * from './selectTextblockEnd.js'
34
+ export * from './selectTextblockStart.js'
35
+ export * from './setContent.js'
36
+ export * from './setMark.js'
37
+ export * from './setMeta.js'
38
+ export * from './setNode.js'
39
+ export * from './setNodeSelection.js'
40
+ export * from './setTextSelection.js'
41
+ export * from './sinkListItem.js'
42
+ export * from './splitBlock.js'
43
+ export * from './splitListItem.js'
44
+ export * from './toggleList.js'
45
+ export * from './toggleMark.js'
46
+ export * from './toggleNode.js'
47
+ export * from './toggleWrap.js'
48
+ export * from './undoInputRule.js'
49
+ export * from './unsetAllMarks.js'
50
+ export * from './unsetMark.js'
51
+ export * from './updateAttributes.js'
52
+ export * from './wrapIn.js'
53
+ export * from './wrapInList.js'
@@ -1,6 +1,6 @@
1
1
  import { ParseOptions } from '@tiptap/pm/model'
2
2
 
3
- import { Content, RawCommands } from '../types'
3
+ import { Content, RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { Fragment, Node as ProseMirrorNode, ParseOptions } from '@tiptap/pm/model'
2
2
 
3
- import { createNodeFromContent } from '../helpers/createNodeFromContent'
4
- import { selectionToInsertionEnd } from '../helpers/selectionToInsertionEnd'
5
- import { Content, Range, RawCommands } from '../types'
3
+ import { createNodeFromContent } from '../helpers/createNodeFromContent.js'
4
+ import { selectionToInsertionEnd } from '../helpers/selectionToInsertionEnd.js'
5
+ import { Content, Range, RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -46,7 +46,7 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value,
46
46
  return true
47
47
  }
48
48
 
49
- let { from, to } = typeof position === 'number' ? { from: position, to: position } : position
49
+ let { from, to } = typeof position === 'number' ? { from: position, to: position } : { from: position.from, to: position.to }
50
50
 
51
51
  let isOnlyTextContent = true
52
52
  let isOnlyBlockContent = true
@@ -5,7 +5,7 @@ import {
5
5
  joinUp as originalJoinUp,
6
6
  } from '@tiptap/pm/commands'
7
7
 
8
- import { RawCommands } from '../types'
8
+ import { RawCommands } from '../types.js'
9
9
 
10
10
  declare module '@tiptap/core' {
11
11
  interface Commands<ReturnType> {
@@ -0,0 +1,36 @@
1
+ import { joinPoint } from '@tiptap/pm/transform'
2
+
3
+ import { RawCommands } from '../types.js'
4
+
5
+ declare module '@tiptap/core' {
6
+ interface Commands<ReturnType> {
7
+ joinItemBackward: {
8
+ /**
9
+ * Join two nodes Forwards.
10
+ */
11
+ joinItemBackward: () => ReturnType
12
+ }
13
+ }
14
+ }
15
+
16
+ export const joinItemBackward: RawCommands['joinItemBackward'] = () => ({
17
+ tr, state, dispatch,
18
+ }) => {
19
+ try {
20
+ const point = joinPoint(state.doc, state.selection.$from.pos, -1)
21
+
22
+ if (point === null || point === undefined) {
23
+ return false
24
+ }
25
+
26
+ tr.join(point, 2)
27
+
28
+ if (dispatch) {
29
+ dispatch(tr)
30
+ }
31
+
32
+ return true
33
+ } catch {
34
+ return false
35
+ }
36
+ }
@@ -0,0 +1,38 @@
1
+ import { joinPoint } from '@tiptap/pm/transform'
2
+
3
+ import { RawCommands } from '../types.js'
4
+
5
+ declare module '@tiptap/core' {
6
+ interface Commands<ReturnType> {
7
+ joinItemForward: {
8
+ /**
9
+ * Join two nodes Forwards.
10
+ */
11
+ joinItemForward: () => ReturnType
12
+ }
13
+ }
14
+ }
15
+
16
+ export const joinItemForward: RawCommands['joinItemForward'] = () => ({
17
+ state,
18
+ dispatch,
19
+ tr,
20
+ }) => {
21
+ try {
22
+ const point = joinPoint(state.doc, state.selection.$from.pos, +1)
23
+
24
+ if (point === null || point === undefined) {
25
+ return false
26
+ }
27
+
28
+ tr.join(point, 2)
29
+
30
+ if (dispatch) {
31
+ dispatch(tr)
32
+ }
33
+
34
+ return true
35
+ } catch (e) {
36
+ return false
37
+ }
38
+ }
@@ -1,6 +1,6 @@
1
- import { RawCommands } from '../types'
2
- import { isiOS } from '../utilities/isiOS'
3
- import { isMacOS } from '../utilities/isMacOS'
1
+ import { RawCommands } from '../types.js'
2
+ import { isiOS } from '../utilities/isiOS.js'
3
+ import { isMacOS } from '../utilities/isMacOS.js'
4
4
 
5
5
  function normalizeKeyName(name: string) {
6
6
  const parts = name.split(/-(?!$)/)
@@ -1,9 +1,9 @@
1
1
  import { lift as originalLift } from '@tiptap/pm/commands'
2
2
  import { NodeType } from '@tiptap/pm/model'
3
3
 
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { isNodeActive } from '../helpers/isNodeActive'
6
- import { RawCommands } from '../types'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { isNodeActive } from '../helpers/isNodeActive.js'
6
+ import { RawCommands } from '../types.js'
7
7
 
8
8
  declare module '@tiptap/core' {
9
9
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { liftEmptyBlock as originalLiftEmptyBlock } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types'
3
+ import { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { NodeType } from '@tiptap/pm/model'
2
2
  import { liftListItem as originalLiftListItem } from '@tiptap/pm/schema-list'
3
3
 
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { RawCommands } from '../types'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { newlineInCode as originalNewlineInCode } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types'
3
+ import { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,10 +1,10 @@
1
1
  import { MarkType, NodeType } from '@tiptap/pm/model'
2
2
 
3
- import { getMarkType } from '../helpers/getMarkType'
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { getSchemaTypeNameByName } from '../helpers/getSchemaTypeNameByName'
6
- import { RawCommands } from '../types'
7
- import { deleteProps } from '../utilities/deleteProps'
3
+ import { getMarkType } from '../helpers/getMarkType.js'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { getSchemaTypeNameByName } from '../helpers/getSchemaTypeNameByName.js'
6
+ import { RawCommands } from '../types.js'
7
+ import { deleteProps } from '../utilities/deleteProps.js'
8
8
 
9
9
  declare module '@tiptap/core' {
10
10
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types'
1
+ import { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types'
1
+ import { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { selectNodeBackward as originalSelectNodeBackward } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types'
3
+ import { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { selectNodeForward as originalSelectNodeForward } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types'
3
+ import { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { selectParentNode as originalSelectParentNode } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types'
3
+ import { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -2,7 +2,7 @@
2
2
  // TODO: add types to @types/prosemirror-commands
3
3
  import { selectTextblockEnd as originalSelectTextblockEnd } from '@tiptap/pm/commands'
4
4
 
5
- import { RawCommands } from '../types'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -2,7 +2,7 @@
2
2
  // TODO: add types to @types/prosemirror-commands
3
3
  import { selectTextblockStart as originalSelectTextblockStart } from '@tiptap/pm/commands'
4
4
 
5
- import { RawCommands } from '../types'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,7 +1,7 @@
1
1
  import { ParseOptions } from '@tiptap/pm/model'
2
2
 
3
- import { createDocument } from '../helpers/createDocument'
4
- import { Content, RawCommands } from '../types'
3
+ import { createDocument } from '../helpers/createDocument.js'
4
+ import { Content, RawCommands } from '../types.js'
5
5
 
6
6
  declare module '@tiptap/core' {
7
7
  interface Commands<ReturnType> {
@@ -1,10 +1,10 @@
1
1
  import { MarkType, ResolvedPos } from '@tiptap/pm/model'
2
2
  import { EditorState, Transaction } from '@tiptap/pm/state'
3
3
 
4
- import { isTextSelection } from '../helpers'
5
- import { getMarkAttributes } from '../helpers/getMarkAttributes'
6
- import { getMarkType } from '../helpers/getMarkType'
7
- import { RawCommands } from '../types'
4
+ import { getMarkAttributes } from '../helpers/getMarkAttributes.js'
5
+ import { getMarkType } from '../helpers/getMarkType.js'
6
+ import { isTextSelection } from '../helpers/index.js'
7
+ import { RawCommands } from '../types.js'
8
8
 
9
9
  declare module '@tiptap/core' {
10
10
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types'
1
+ import { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { setBlockType } from '@tiptap/pm/commands'
2
2
  import { NodeType } from '@tiptap/pm/model'
3
3
 
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { RawCommands } from '../types'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,7 +1,7 @@
1
1
  import { NodeSelection } from '@tiptap/pm/state'
2
2
 
3
- import { RawCommands } from '../types'
4
- import { minMax } from '../utilities/minMax'
3
+ import { RawCommands } from '../types.js'
4
+ import { minMax } from '../utilities/minMax.js'
5
5
 
6
6
  declare module '@tiptap/core' {
7
7
  interface Commands<ReturnType> {
@@ -1,7 +1,7 @@
1
1
  import { TextSelection } from '@tiptap/pm/state'
2
2
 
3
- import { Range, RawCommands } from '../types'
4
- import { minMax } from '../utilities/minMax'
3
+ import { Range, RawCommands } from '../types.js'
4
+ import { minMax } from '../utilities/minMax.js'
5
5
 
6
6
  declare module '@tiptap/core' {
7
7
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { NodeType } from '@tiptap/pm/model'
2
2
  import { sinkListItem as originalSinkListItem } from '@tiptap/pm/schema-list'
3
3
 
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { RawCommands } from '../types'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,9 +1,9 @@
1
1
  import { EditorState, NodeSelection, TextSelection } from '@tiptap/pm/state'
2
2
  import { canSplit } from '@tiptap/pm/transform'
3
3
 
4
- import { defaultBlockAt } from '../helpers/defaultBlockAt'
5
- import { getSplittedAttributes } from '../helpers/getSplittedAttributes'
6
- import { RawCommands } from '../types'
4
+ import { defaultBlockAt } from '../helpers/defaultBlockAt.js'
5
+ import { getSplittedAttributes } from '../helpers/getSplittedAttributes.js'
6
+ import { RawCommands } from '../types.js'
7
7
 
8
8
  function ensureMarks(state: EditorState, splittableMarks?: string[]) {
9
9
  const marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks())
@@ -4,9 +4,9 @@ import {
4
4
  import { TextSelection } from '@tiptap/pm/state'
5
5
  import { canSplit } from '@tiptap/pm/transform'
6
6
 
7
- import { getNodeType } from '../helpers/getNodeType'
8
- import { getSplittedAttributes } from '../helpers/getSplittedAttributes'
9
- import { RawCommands } from '../types'
7
+ import { getNodeType } from '../helpers/getNodeType.js'
8
+ import { getSplittedAttributes } from '../helpers/getSplittedAttributes.js'
9
+ import { RawCommands } from '../types.js'
10
10
 
11
11
  declare module '@tiptap/core' {
12
12
  interface Commands<ReturnType> {
@@ -2,10 +2,10 @@ import { NodeType } from '@tiptap/pm/model'
2
2
  import { Transaction } from '@tiptap/pm/state'
3
3
  import { canJoin } from '@tiptap/pm/transform'
4
4
 
5
- import { findParentNode } from '../helpers/findParentNode'
6
- import { getNodeType } from '../helpers/getNodeType'
7
- import { isList } from '../helpers/isList'
8
- import { RawCommands } from '../types'
5
+ import { findParentNode } from '../helpers/findParentNode.js'
6
+ import { getNodeType } from '../helpers/getNodeType.js'
7
+ import { isList } from '../helpers/isList.js'
8
+ import { RawCommands } from '../types.js'
9
9
 
10
10
  const joinListBackwards = (tr: Transaction, listType: NodeType): boolean => {
11
11
  const list = findParentNode(node => node.type === listType)(tr.selection)
@@ -1,8 +1,8 @@
1
1
  import { MarkType } from '@tiptap/pm/model'
2
2
 
3
- import { getMarkType } from '../helpers/getMarkType'
4
- import { isMarkActive } from '../helpers/isMarkActive'
5
- import { RawCommands } from '../types'
3
+ import { getMarkType } from '../helpers/getMarkType.js'
4
+ import { isMarkActive } from '../helpers/isMarkActive.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { NodeType } from '@tiptap/pm/model'
2
2
 
3
- import { getNodeType } from '../helpers/getNodeType'
4
- import { isNodeActive } from '../helpers/isNodeActive'
5
- import { RawCommands } from '../types'
3
+ import { getNodeType } from '../helpers/getNodeType.js'
4
+ import { isNodeActive } from '../helpers/isNodeActive.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { NodeType } from '@tiptap/pm/model'
2
2
 
3
- import { getNodeType } from '../helpers/getNodeType'
4
- import { isNodeActive } from '../helpers/isNodeActive'
5
- import { RawCommands } from '../types'
3
+ import { getNodeType } from '../helpers/getNodeType.js'
4
+ import { isNodeActive } from '../helpers/isNodeActive.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types'
1
+ import { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types'
1
+ import { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { MarkType } from '@tiptap/pm/model'
2
2
 
3
- import { getMarkRange } from '../helpers/getMarkRange'
4
- import { getMarkType } from '../helpers/getMarkType'
5
- import { RawCommands } from '../types'
3
+ import { getMarkRange } from '../helpers/getMarkRange.js'
4
+ import { getMarkType } from '../helpers/getMarkType.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,9 +1,9 @@
1
1
  import { MarkType, NodeType } from '@tiptap/pm/model'
2
2
 
3
- import { getMarkType } from '../helpers/getMarkType'
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { getSchemaTypeNameByName } from '../helpers/getSchemaTypeNameByName'
6
- import { RawCommands } from '../types'
3
+ import { getMarkType } from '../helpers/getMarkType.js'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { getSchemaTypeNameByName } from '../helpers/getSchemaTypeNameByName.js'
6
+ import { RawCommands } from '../types.js'
7
7
 
8
8
  declare module '@tiptap/core' {
9
9
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { wrapIn as originalWrapIn } from '@tiptap/pm/commands'
2
2
  import { NodeType } from '@tiptap/pm/model'
3
3
 
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { RawCommands } from '../types'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { NodeType } from '@tiptap/pm/model'
2
2
  import { wrapInList as originalWrapInList } from '@tiptap/pm/schema-list'
3
3
 
4
- import { getNodeType } from '../helpers/getNodeType'
5
- import { RawCommands } from '../types'
4
+ import { getNodeType } from '../helpers/getNodeType.js'
5
+ import { RawCommands } from '../types.js'
6
6
 
7
7
  declare module '@tiptap/core' {
8
8
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
1
  import { Plugin, PluginKey } from '@tiptap/pm/state'
2
2
 
3
- import { Extension } from '../Extension'
4
- import { getTextBetween } from '../helpers/getTextBetween'
5
- import { getTextSerializersFromSchema } from '../helpers/getTextSerializersFromSchema'
3
+ import { Extension } from '../Extension.js'
4
+ import { getTextBetween } from '../helpers/getTextBetween.js'
5
+ import { getTextSerializersFromSchema } from '../helpers/getTextSerializersFromSchema.js'
6
6
 
7
7
  export const ClipboardTextSerializer = Extension.create({
8
8
  name: 'clipboardTextSerializer',
@@ -1,7 +1,7 @@
1
- import * as commands from '../commands'
2
- import { Extension } from '../Extension'
1
+ import * as commands from '../commands/index.js'
2
+ import { Extension } from '../Extension.js'
3
3
 
4
- export * from '../commands'
4
+ export * from '../commands/index.js'
5
5
 
6
6
  export const Commands = Extension.create({
7
7
  name: 'commands',
@@ -1,6 +1,6 @@
1
1
  import { Plugin, PluginKey } from '@tiptap/pm/state'
2
2
 
3
- import { Extension } from '../Extension'
3
+ import { Extension } from '../Extension.js'
4
4
 
5
5
  export const Editable = Extension.create({
6
6
  name: 'editable',
@@ -1,6 +1,6 @@
1
1
  import { Plugin, PluginKey } from '@tiptap/pm/state'
2
2
 
3
- import { Extension } from '../Extension'
3
+ import { Extension } from '../Extension.js'
4
4
 
5
5
  export const FocusEvents = Extension.create({
6
6
  name: 'focusEvents',