@tiptap/core 2.3.2 → 2.5.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 (186) hide show
  1. package/dist/index.cjs +277 -67
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +277 -67
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.umd.js +277 -67
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/packages/core/src/EventEmitter.d.ts +2 -2
  8. package/dist/packages/core/src/Extension.d.ts +129 -14
  9. package/dist/packages/core/src/ExtensionManager.d.ts +37 -0
  10. package/dist/packages/core/src/Mark.d.ts +129 -14
  11. package/dist/packages/core/src/Node.d.ts +226 -30
  12. package/dist/packages/core/src/NodeView.d.ts +4 -0
  13. package/dist/packages/core/src/PasteRule.d.ts +4 -0
  14. package/dist/packages/core/src/commands/blur.d.ts +1 -0
  15. package/dist/packages/core/src/commands/clearContent.d.ts +2 -0
  16. package/dist/packages/core/src/commands/clearNodes.d.ts +1 -0
  17. package/dist/packages/core/src/commands/command.d.ts +6 -0
  18. package/dist/packages/core/src/commands/createParagraphNear.d.ts +1 -0
  19. package/dist/packages/core/src/commands/cut.d.ts +5 -0
  20. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +1 -0
  21. package/dist/packages/core/src/commands/deleteNode.d.ts +3 -1
  22. package/dist/packages/core/src/commands/deleteRange.d.ts +2 -0
  23. package/dist/packages/core/src/commands/deleteSelection.d.ts +1 -0
  24. package/dist/packages/core/src/commands/enter.d.ts +1 -0
  25. package/dist/packages/core/src/commands/exitCode.d.ts +1 -0
  26. package/dist/packages/core/src/commands/extendMarkRange.d.ts +14 -2
  27. package/dist/packages/core/src/commands/first.d.ts +2 -0
  28. package/dist/packages/core/src/commands/focus.d.ts +14 -1
  29. package/dist/packages/core/src/commands/insertContent.d.ts +17 -1
  30. package/dist/packages/core/src/commands/insertContentAt.d.ts +20 -1
  31. package/dist/packages/core/src/commands/join.d.ts +12 -4
  32. package/dist/packages/core/src/commands/joinItemBackward.d.ts +2 -1
  33. package/dist/packages/core/src/commands/joinItemForward.d.ts +2 -1
  34. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +2 -0
  35. package/dist/packages/core/src/commands/lift.d.ts +5 -1
  36. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +2 -1
  37. package/dist/packages/core/src/commands/liftListItem.d.ts +3 -1
  38. package/dist/packages/core/src/commands/newlineInCode.d.ts +1 -0
  39. package/dist/packages/core/src/commands/resetAttributes.d.ts +3 -0
  40. package/dist/packages/core/src/commands/scrollIntoView.d.ts +1 -0
  41. package/dist/packages/core/src/commands/selectAll.d.ts +1 -0
  42. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +1 -0
  43. package/dist/packages/core/src/commands/selectNodeForward.d.ts +1 -0
  44. package/dist/packages/core/src/commands/selectParentNode.d.ts +1 -0
  45. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +1 -0
  46. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +1 -0
  47. package/dist/packages/core/src/commands/setContent.d.ts +19 -1
  48. package/dist/packages/core/src/commands/setMark.d.ts +2 -0
  49. package/dist/packages/core/src/commands/setMeta.d.ts +3 -0
  50. package/dist/packages/core/src/commands/setNode.d.ts +3 -0
  51. package/dist/packages/core/src/commands/setNodeSelection.d.ts +2 -0
  52. package/dist/packages/core/src/commands/setTextSelection.d.ts +2 -0
  53. package/dist/packages/core/src/commands/sinkListItem.d.ts +2 -0
  54. package/dist/packages/core/src/commands/splitBlock.d.ts +3 -0
  55. package/dist/packages/core/src/commands/splitListItem.d.ts +2 -0
  56. package/dist/packages/core/src/commands/toggleList.d.ts +5 -0
  57. package/dist/packages/core/src/commands/toggleMark.d.ts +13 -1
  58. package/dist/packages/core/src/commands/toggleNode.d.ts +4 -0
  59. package/dist/packages/core/src/commands/toggleWrap.d.ts +3 -0
  60. package/dist/packages/core/src/commands/undoInputRule.d.ts +1 -0
  61. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +1 -0
  62. package/dist/packages/core/src/commands/unsetMark.d.ts +8 -1
  63. package/dist/packages/core/src/commands/updateAttributes.d.ts +12 -1
  64. package/dist/packages/core/src/commands/wrapIn.d.ts +3 -0
  65. package/dist/packages/core/src/commands/wrapInList.d.ts +3 -0
  66. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +3 -0
  67. package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
  68. package/dist/packages/core/src/helpers/createDocument.d.ts +7 -0
  69. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +7 -0
  70. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +5 -0
  71. package/dist/packages/core/src/helpers/findChildren.d.ts +6 -0
  72. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +4 -0
  73. package/dist/packages/core/src/helpers/findParentNode.d.ts +8 -0
  74. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +9 -0
  75. package/dist/packages/core/src/helpers/generateHTML.d.ts +6 -0
  76. package/dist/packages/core/src/helpers/generateJSON.d.ts +6 -0
  77. package/dist/packages/core/src/helpers/generateText.d.ts +7 -0
  78. package/dist/packages/core/src/helpers/getAttributes.d.ts +6 -0
  79. package/dist/packages/core/src/helpers/getExtensionField.d.ts +7 -0
  80. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +6 -0
  81. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +6 -0
  82. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +6 -0
  83. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +7 -0
  84. package/dist/packages/core/src/helpers/getText.d.ts +9 -0
  85. package/dist/packages/core/src/helpers/getTextBetween.d.ts +8 -0
  86. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +6 -0
  87. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +5 -0
  88. package/dist/packages/core/src/inputRules/markInputRule.d.ts +1 -0
  89. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +1 -0
  90. package/dist/packages/core/src/inputRules/textInputRule.d.ts +1 -0
  91. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +1 -0
  92. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +1 -0
  93. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +1 -0
  94. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +1 -0
  95. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +1 -0
  96. package/package.json +2 -2
  97. package/src/EventEmitter.ts +2 -2
  98. package/src/Extension.ts +130 -14
  99. package/src/ExtensionManager.ts +117 -85
  100. package/src/Mark.ts +129 -14
  101. package/src/Node.ts +226 -30
  102. package/src/NodeView.ts +4 -0
  103. package/src/PasteRule.ts +4 -0
  104. package/src/commands/blur.ts +1 -0
  105. package/src/commands/clearContent.ts +2 -0
  106. package/src/commands/clearNodes.ts +1 -0
  107. package/src/commands/command.ts +6 -0
  108. package/src/commands/createParagraphNear.ts +1 -0
  109. package/src/commands/cut.ts +5 -0
  110. package/src/commands/deleteCurrentNode.ts +1 -0
  111. package/src/commands/deleteNode.ts +3 -1
  112. package/src/commands/deleteRange.ts +2 -0
  113. package/src/commands/deleteSelection.ts +1 -0
  114. package/src/commands/enter.ts +1 -0
  115. package/src/commands/exitCode.ts +1 -0
  116. package/src/commands/extendMarkRange.ts +12 -1
  117. package/src/commands/first.ts +2 -0
  118. package/src/commands/focus.ts +12 -0
  119. package/src/commands/insertContent.ts +16 -0
  120. package/src/commands/insertContentAt.ts +19 -0
  121. package/src/commands/join.ts +12 -4
  122. package/src/commands/joinItemBackward.ts +6 -3
  123. package/src/commands/joinItemForward.ts +2 -1
  124. package/src/commands/keyboardShortcut.ts +2 -0
  125. package/src/commands/lift.ts +5 -1
  126. package/src/commands/liftEmptyBlock.ts +2 -1
  127. package/src/commands/liftListItem.ts +3 -1
  128. package/src/commands/newlineInCode.ts +1 -0
  129. package/src/commands/resetAttributes.ts +3 -0
  130. package/src/commands/scrollIntoView.ts +1 -0
  131. package/src/commands/selectAll.ts +1 -0
  132. package/src/commands/selectNodeBackward.ts +1 -0
  133. package/src/commands/selectNodeForward.ts +1 -0
  134. package/src/commands/selectParentNode.ts +1 -0
  135. package/src/commands/selectTextblockEnd.ts +1 -0
  136. package/src/commands/selectTextblockStart.ts +1 -0
  137. package/src/commands/setContent.ts +17 -0
  138. package/src/commands/setMark.ts +2 -0
  139. package/src/commands/setMeta.ts +3 -0
  140. package/src/commands/setNode.ts +3 -0
  141. package/src/commands/setNodeSelection.ts +2 -0
  142. package/src/commands/setTextSelection.ts +2 -0
  143. package/src/commands/sinkListItem.ts +2 -0
  144. package/src/commands/splitBlock.ts +3 -0
  145. package/src/commands/splitListItem.ts +2 -0
  146. package/src/commands/toggleList.ts +5 -0
  147. package/src/commands/toggleMark.ts +12 -0
  148. package/src/commands/toggleNode.ts +4 -0
  149. package/src/commands/toggleWrap.ts +3 -0
  150. package/src/commands/undoInputRule.ts +1 -0
  151. package/src/commands/unsetAllMarks.ts +1 -0
  152. package/src/commands/unsetMark.ts +7 -0
  153. package/src/commands/updateAttributes.ts +10 -0
  154. package/src/commands/wrapIn.ts +3 -0
  155. package/src/commands/wrapInList.ts +3 -0
  156. package/src/extensions/keymap.ts +7 -1
  157. package/src/helpers/combineTransactionSteps.ts +3 -0
  158. package/src/helpers/createChainableState.ts +5 -0
  159. package/src/helpers/createDocument.ts +7 -0
  160. package/src/helpers/createNodeFromContent.ts +16 -3
  161. package/src/helpers/defaultBlockAt.ts +5 -0
  162. package/src/helpers/findChildren.ts +6 -0
  163. package/src/helpers/findChildrenInRange.ts +4 -0
  164. package/src/helpers/findParentNode.ts +8 -0
  165. package/src/helpers/findParentNodeClosestToPos.ts +9 -0
  166. package/src/helpers/generateHTML.ts +6 -0
  167. package/src/helpers/generateJSON.ts +6 -0
  168. package/src/helpers/generateText.ts +7 -0
  169. package/src/helpers/getAttributes.ts +6 -0
  170. package/src/helpers/getExtensionField.ts +7 -0
  171. package/src/helpers/getSchemaByResolvedExtensions.ts +6 -0
  172. package/src/helpers/getSchemaTypeByName.ts +6 -0
  173. package/src/helpers/getSchemaTypeNameByName.ts +6 -0
  174. package/src/helpers/getSplittedAttributes.ts +7 -0
  175. package/src/helpers/getText.ts +9 -0
  176. package/src/helpers/getTextBetween.ts +12 -10
  177. package/src/helpers/getTextContentFromNodes.ts +6 -0
  178. package/src/helpers/getTextSerializersFromSchema.ts +5 -0
  179. package/src/inputRules/markInputRule.ts +1 -0
  180. package/src/inputRules/nodeInputRule.ts +4 -1
  181. package/src/inputRules/textInputRule.ts +1 -0
  182. package/src/inputRules/textblockTypeInputRule.ts +1 -0
  183. package/src/inputRules/wrappingInputRule.ts +1 -0
  184. package/src/pasteRules/markPasteRule.ts +1 -0
  185. package/src/pasteRules/nodePasteRule.ts +1 -0
  186. package/src/pasteRules/textPasteRule.ts +1 -0
@@ -2,6 +2,15 @@ import { Node as ProseMirrorNode, ResolvedPos } from '@tiptap/pm/model'
2
2
 
3
3
  import { Predicate } from '../types.js'
4
4
 
5
+ /**
6
+ * Finds the closest parent node to a resolved position that matches a predicate.
7
+ * @param $pos The resolved position to search from
8
+ * @param predicate The predicate to match
9
+ * @returns The closest parent node to the resolved position that matches the predicate
10
+ * @example ```js
11
+ * findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')
12
+ * ```
13
+ */
5
14
  export function findParentNodeClosestToPos(
6
15
  $pos: ResolvedPos,
7
16
  predicate: Predicate,
@@ -4,6 +4,12 @@ import { Extensions, JSONContent } from '../types.js'
4
4
  import { getHTMLFromFragment } from './getHTMLFromFragment.js'
5
5
  import { getSchema } from './getSchema.js'
6
6
 
7
+ /**
8
+ * Generate HTML from a JSONContent
9
+ * @param doc The JSONContent to generate HTML from
10
+ * @param extensions The extensions to use for the schema
11
+ * @returns The generated HTML
12
+ */
7
13
  export function generateHTML(doc: JSONContent, extensions: Extensions): string {
8
14
  const schema = getSchema(extensions)
9
15
  const contentNode = Node.fromJSON(schema, doc)
@@ -4,6 +4,12 @@ import { Extensions } from '../types.js'
4
4
  import { elementFromString } from '../utilities/elementFromString.js'
5
5
  import { getSchema } from './getSchema.js'
6
6
 
7
+ /**
8
+ * Generate JSONContent from HTML
9
+ * @param html The HTML to generate JSONContent from
10
+ * @param extensions The extensions to use for the schema
11
+ * @returns The generated JSONContent
12
+ */
7
13
  export function generateJSON(html: string, extensions: Extensions): Record<string, any> {
8
14
  const schema = getSchema(extensions)
9
15
  const dom = elementFromString(html)
@@ -5,6 +5,13 @@ import { getSchema } from './getSchema.js'
5
5
  import { getText } from './getText.js'
6
6
  import { getTextSerializersFromSchema } from './getTextSerializersFromSchema.js'
7
7
 
8
+ /**
9
+ * Generate raw text from a JSONContent
10
+ * @param doc The JSONContent to generate text from
11
+ * @param extensions The extensions to use for the schema
12
+ * @param options Options for the text generation f.e. blockSeparator or textSerializers
13
+ * @returns The generated text
14
+ */
8
15
  export function generateText(
9
16
  doc: JSONContent,
10
17
  extensions: Extensions,
@@ -5,6 +5,12 @@ import { getMarkAttributes } from './getMarkAttributes.js'
5
5
  import { getNodeAttributes } from './getNodeAttributes.js'
6
6
  import { getSchemaTypeNameByName } from './getSchemaTypeNameByName.js'
7
7
 
8
+ /**
9
+ * Get node or mark attributes by type or name on the current editor state
10
+ * @param state The current editor state
11
+ * @param typeOrName The node or mark type or name
12
+ * @returns The attributes of the node or mark or an empty object
13
+ */
8
14
  export function getAttributes(
9
15
  state: EditorState,
10
16
  typeOrName: string | NodeType | MarkType,
@@ -1,5 +1,12 @@
1
1
  import { AnyExtension, MaybeThisParameterType, RemoveThis } from '../types.js'
2
2
 
3
+ /**
4
+ * Returns a field from an extension
5
+ * @param extension The Tiptap extension
6
+ * @param field The field, for example `renderHTML` or `priority`
7
+ * @param context The context object that should be passed as `this` into the function
8
+ * @returns The field value
9
+ */
3
10
  export function getExtensionField<T = any>(
4
11
  extension: AnyExtension,
5
12
  field: string,
@@ -23,6 +23,12 @@ function cleanUpSchemaItem<T>(data: T) {
23
23
  ) as T
24
24
  }
25
25
 
26
+ /**
27
+ * Creates a new Prosemirror schema based on the given extensions.
28
+ * @param extensions An array of Tiptap extensions
29
+ * @param editor The editor instance
30
+ * @returns A Prosemirror schema
31
+ */
26
32
  export function getSchemaByResolvedExtensions(extensions: Extensions, editor?: Editor): Schema {
27
33
  const allAttributes = getAttributesFromExtensions(extensions)
28
34
  const { nodeExtensions, markExtensions } = splitExtensions(extensions)
@@ -1,5 +1,11 @@
1
1
  import { MarkType, NodeType, Schema } from '@tiptap/pm/model'
2
2
 
3
+ /**
4
+ * Tries to get a node or mark type by its name.
5
+ * @param name The name of the node or mark type
6
+ * @param schema The Prosemiror schema to search in
7
+ * @returns The node or mark type, or null if it doesn't exist
8
+ */
3
9
  export function getSchemaTypeByName(name: string, schema: Schema): NodeType | MarkType | null {
4
10
  return schema.nodes[name] || schema.marks[name] || null
5
11
  }
@@ -1,5 +1,11 @@
1
1
  import { Schema } from '@tiptap/pm/model'
2
2
 
3
+ /**
4
+ * Get the type of a schema item by its name.
5
+ * @param name The name of the schema item
6
+ * @param schema The Prosemiror schema to search in
7
+ * @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist
8
+ */
3
9
  export function getSchemaTypeNameByName(name: string, schema: Schema): 'node' | 'mark' | null {
4
10
  if (schema.nodes[name]) {
5
11
  return 'node'
@@ -1,5 +1,12 @@
1
1
  import { ExtensionAttribute } from '../types.js'
2
2
 
3
+ /**
4
+ * Return attributes of an extension that should be splitted by keepOnSplit flag
5
+ * @param extensionAttributes Array of extension attributes
6
+ * @param typeName The type of the extension
7
+ * @param attributes The attributes of the extension
8
+ * @returns The splitted attributes
9
+ */
3
10
  export function getSplittedAttributes(
4
11
  extensionAttributes: ExtensionAttribute[],
5
12
  typeName: string,
@@ -3,6 +3,15 @@ import { Node as ProseMirrorNode } from '@tiptap/pm/model'
3
3
  import { TextSerializer } from '../types.js'
4
4
  import { getTextBetween } from './getTextBetween.js'
5
5
 
6
+ /**
7
+ * Gets the text of a Prosemirror node
8
+ * @param node The Prosemirror node
9
+ * @param options Options for the text serializer & block separator
10
+ * @returns The text of the node
11
+ * @example ```js
12
+ * const text = getText(node, { blockSeparator: '\n' })
13
+ * ```
14
+ */
6
15
  export function getText(
7
16
  node: ProseMirrorNode,
8
17
  options?: {
@@ -2,6 +2,14 @@ import { Node as ProseMirrorNode } from '@tiptap/pm/model'
2
2
 
3
3
  import { Range, TextSerializer } from '../types.js'
4
4
 
5
+ /**
6
+ * Gets the text between two positions in a Prosemirror node
7
+ * and serializes it using the given text serializers and block separator (see getText)
8
+ * @param startNode The Prosemirror node to start from
9
+ * @param range The range of the text to get
10
+ * @param options Options for the text serializer & block separator
11
+ * @returns The text between the two positions
12
+ */
5
13
  export function getTextBetween(
6
14
  startNode: ProseMirrorNode,
7
15
  range: Range,
@@ -13,17 +21,15 @@ export function getTextBetween(
13
21
  const { from, to } = range
14
22
  const { blockSeparator = '\n\n', textSerializers = {} } = options || {}
15
23
  let text = ''
16
- let separated = true
17
24
 
18
25
  startNode.nodesBetween(from, to, (node, pos, parent, index) => {
26
+ if (node.isBlock && pos > from) {
27
+ text += blockSeparator
28
+ }
29
+
19
30
  const textSerializer = textSerializers?.[node.type.name]
20
31
 
21
32
  if (textSerializer) {
22
- if (node.isBlock && !separated) {
23
- text += blockSeparator
24
- separated = true
25
- }
26
-
27
33
  if (parent) {
28
34
  text += textSerializer({
29
35
  node,
@@ -39,10 +45,6 @@ export function getTextBetween(
39
45
 
40
46
  if (node.isText) {
41
47
  text += node?.text?.slice(Math.max(from, pos) - pos, to - pos) // eslint-disable-line
42
- separated = false
43
- } else if (node.isBlock && !separated) {
44
- text += blockSeparator
45
- separated = true
46
48
  }
47
49
  })
48
50
 
@@ -1,5 +1,11 @@
1
1
  import { ResolvedPos } from '@tiptap/pm/model'
2
2
 
3
+ /**
4
+ * Returns the text content of a resolved prosemirror position
5
+ * @param $from The resolved position to get the text content from
6
+ * @param maxMatch The maximum number of characters to match
7
+ * @returns The text content
8
+ */
3
9
  export const getTextContentFromNodes = ($from: ResolvedPos, maxMatch = 500) => {
4
10
  let textBefore = ''
5
11
 
@@ -2,6 +2,11 @@ import { Schema } from '@tiptap/pm/model'
2
2
 
3
3
  import { TextSerializer } from '../types.js'
4
4
 
5
+ /**
6
+ * Find text serializers `toText` in a Prosemirror schema
7
+ * @param schema The Prosemirror schema to search in
8
+ * @returns A record of text serializers by node name
9
+ */
5
10
  export function getTextSerializersFromSchema(schema: Schema): Record<string, TextSerializer> {
6
11
  return Object.fromEntries(
7
12
  Object.entries(schema.nodes)
@@ -8,6 +8,7 @@ import { callOrReturn } from '../utilities/callOrReturn.js'
8
8
  /**
9
9
  * Build an input rule that adds a mark when the
10
10
  * matched text is typed into it.
11
+ * @see https://tiptap.dev/guide/custom-extensions/#input-rules
11
12
  */
12
13
  export function markInputRule(config: {
13
14
  find: InputRuleFinder
@@ -7,6 +7,7 @@ import { callOrReturn } from '../utilities/callOrReturn.js'
7
7
  /**
8
8
  * Build an input rule that adds a node when the
9
9
  * matched text is typed into it.
10
+ * @see https://tiptap.dev/guide/custom-extensions/#input-rules
10
11
  */
11
12
  export function nodeInputRule(config: {
12
13
  /**
@@ -57,7 +58,9 @@ export function nodeInputRule(config: {
57
58
  // insert node from input rule
58
59
  tr.replaceWith(matchStart, end, newNode)
59
60
  } else if (match[0]) {
60
- tr.insert(start - 1, config.type.create(attributes)).delete(
61
+ const insertionStart = config.type.isInline ? start : start - 1
62
+
63
+ tr.insert(insertionStart, config.type.create(attributes)).delete(
61
64
  tr.mapping.map(start),
62
65
  tr.mapping.map(end),
63
66
  )
@@ -3,6 +3,7 @@ import { InputRule, InputRuleFinder } from '../InputRule.js'
3
3
  /**
4
4
  * Build an input rule that replaces text when the
5
5
  * matched text is typed into it.
6
+ * @see https://tiptap.dev/guide/custom-extensions/#input-rules
6
7
  */
7
8
  export function textInputRule(config: {
8
9
  find: InputRuleFinder,
@@ -9,6 +9,7 @@ import { callOrReturn } from '../utilities/callOrReturn.js'
9
9
  * matched text is typed into it. When using a regular expresion you’ll
10
10
  * probably want the regexp to start with `^`, so that the pattern can
11
11
  * only occur at the start of a textblock.
12
+ * @see https://tiptap.dev/guide/custom-extensions/#input-rules
12
13
  */
13
14
  export function textblockTypeInputRule(config: {
14
15
  find: InputRuleFinder
@@ -19,6 +19,7 @@ import { callOrReturn } from '../utilities/callOrReturn.js'
19
19
  * two nodes. You can pass a join predicate, which takes a regular
20
20
  * expression match and the node before the wrapped node, and can
21
21
  * return a boolean to indicate whether a join should happen.
22
+ * @see https://tiptap.dev/guide/custom-extensions/#input-rules
22
23
  */
23
24
  export function wrappingInputRule(config: {
24
25
  find: InputRuleFinder,
@@ -8,6 +8,7 @@ import { callOrReturn } from '../utilities/callOrReturn.js'
8
8
  /**
9
9
  * Build an paste rule that adds a mark when the
10
10
  * matched text is pasted into it.
11
+ * @see https://tiptap.dev/guide/custom-extensions/#paste-rules
11
12
  */
12
13
  export function markPasteRule(config: {
13
14
  find: PasteRuleFinder
@@ -7,6 +7,7 @@ import { callOrReturn } from '../utilities/index.js'
7
7
  /**
8
8
  * Build an paste rule that adds a node when the
9
9
  * matched text is pasted into it.
10
+ * @see https://tiptap.dev/guide/custom-extensions/#paste-rules
10
11
  */
11
12
  export function nodePasteRule(config: {
12
13
  find: PasteRuleFinder
@@ -3,6 +3,7 @@ import { PasteRule, PasteRuleFinder } from '../PasteRule.js'
3
3
  /**
4
4
  * Build an paste rule that replaces text when the
5
5
  * matched text is pasted into it.
6
+ * @see https://tiptap.dev/guide/custom-extensions/#paste-rules
6
7
  */
7
8
  export function textPasteRule(config: {
8
9
  find: PasteRuleFinder,