@tiptap/core 2.0.0-beta.148 → 2.0.0-beta.151

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 (195) hide show
  1. package/dist/packages/core/src/CommandManager.d.ts +1 -1
  2. package/dist/packages/core/src/Editor.d.ts +4 -2
  3. package/dist/packages/core/src/EventEmitter.d.ts +1 -1
  4. package/dist/packages/core/src/ExtensionManager.d.ts +1 -1
  5. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +1 -1
  6. package/dist/packages/core/src/helpers/createChainableState.d.ts +1 -1
  7. package/dist/packages/core/src/helpers/createDocument.d.ts +1 -1
  8. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +1 -1
  9. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +1 -1
  10. package/dist/packages/core/src/helpers/findChildren.d.ts +1 -1
  11. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +1 -1
  12. package/dist/packages/core/src/helpers/findParentNode.d.ts +1 -1
  13. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +1 -1
  14. package/dist/packages/core/src/helpers/generateHTML.d.ts +1 -1
  15. package/dist/packages/core/src/helpers/generateJSON.d.ts +1 -1
  16. package/dist/packages/core/src/helpers/generateText.d.ts +1 -1
  17. package/dist/packages/core/src/helpers/getAttributes.d.ts +1 -1
  18. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +1 -1
  19. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +1 -1
  20. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +1 -1
  21. package/dist/packages/core/src/helpers/getExtensionField.d.ts +1 -1
  22. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +1 -1
  23. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +1 -1
  24. package/dist/packages/core/src/helpers/getMarkRange.d.ts +1 -1
  25. package/dist/packages/core/src/helpers/getMarkType.d.ts +1 -1
  26. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +1 -1
  27. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +1 -1
  28. package/dist/packages/core/src/helpers/getNodeType.d.ts +1 -1
  29. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +1 -1
  30. package/dist/packages/core/src/helpers/getSchema.d.ts +1 -1
  31. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +1 -1
  32. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +1 -1
  33. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +1 -1
  34. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +1 -1
  35. package/dist/packages/core/src/helpers/getText.d.ts +1 -1
  36. package/dist/packages/core/src/helpers/getTextBetween.d.ts +1 -1
  37. package/dist/packages/core/src/helpers/getTextSeralizersFromSchema.d.ts +1 -1
  38. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +1 -1
  39. package/dist/packages/core/src/helpers/isActive.d.ts +1 -1
  40. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +1 -1
  41. package/dist/packages/core/src/helpers/isList.d.ts +1 -1
  42. package/dist/packages/core/src/helpers/isMarkActive.d.ts +1 -1
  43. package/dist/packages/core/src/helpers/isNodeActive.d.ts +1 -1
  44. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +1 -1
  45. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +1 -1
  46. package/dist/packages/core/src/helpers/isTextSelection.d.ts +1 -1
  47. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +1 -1
  48. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +1 -1
  49. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +1 -1
  50. package/dist/packages/core/src/helpers/splitExtensions.d.ts +1 -1
  51. package/dist/packages/core/src/index.d.ts +40 -40
  52. package/dist/packages/core/src/inputRules/markInputRule.d.ts +1 -1
  53. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +1 -1
  54. package/dist/packages/core/src/inputRules/textInputRule.d.ts +1 -1
  55. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +1 -1
  56. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +1 -1
  57. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +1 -1
  58. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +1 -1
  59. package/dist/packages/core/src/style.d.ts +1 -2
  60. package/dist/packages/core/src/utilities/callOrReturn.d.ts +1 -1
  61. package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -1
  62. package/dist/packages/core/src/utilities/deleteProps.d.ts +1 -1
  63. package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -1
  64. package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -1
  65. package/dist/packages/core/src/utilities/fromString.d.ts +1 -1
  66. package/dist/packages/core/src/utilities/isClass.d.ts +1 -1
  67. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -1
  68. package/dist/packages/core/src/utilities/isFunction.d.ts +1 -1
  69. package/dist/packages/core/src/utilities/isNumber.d.ts +1 -1
  70. package/dist/packages/core/src/utilities/isObject.d.ts +1 -1
  71. package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -1
  72. package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -1
  73. package/dist/packages/core/src/utilities/isiOS.d.ts +1 -1
  74. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -1
  75. package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -1
  76. package/dist/packages/core/src/utilities/minMax.d.ts +1 -1
  77. package/dist/packages/core/src/utilities/objectIncludes.d.ts +1 -1
  78. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +1 -1
  79. package/dist/tiptap-core.cjs.js +13 -11
  80. package/dist/tiptap-core.cjs.js.map +1 -1
  81. package/dist/tiptap-core.esm.js +13 -12
  82. package/dist/tiptap-core.esm.js.map +1 -1
  83. package/dist/tiptap-core.umd.js +13 -11
  84. package/dist/tiptap-core.umd.js.map +1 -1
  85. package/package.json +2 -2
  86. package/src/CommandManager.ts +2 -2
  87. package/src/Editor.ts +18 -14
  88. package/src/EventEmitter.ts +1 -1
  89. package/src/Extension.ts +3 -3
  90. package/src/ExtensionManager.ts +11 -11
  91. package/src/InputRule.ts +3 -3
  92. package/src/Mark.ts +3 -3
  93. package/src/Node.ts +3 -3
  94. package/src/NodeView.ts +1 -1
  95. package/src/PasteRule.ts +4 -4
  96. package/src/commands/deleteNode.ts +1 -1
  97. package/src/commands/extendMarkRange.ts +2 -2
  98. package/src/commands/focus.ts +3 -3
  99. package/src/commands/insertContentAt.ts +2 -2
  100. package/src/commands/lift.ts +2 -2
  101. package/src/commands/liftListItem.ts +1 -1
  102. package/src/commands/resetAttributes.ts +4 -4
  103. package/src/commands/setContent.ts +1 -1
  104. package/src/commands/setMark.ts +2 -2
  105. package/src/commands/setNode.ts +1 -1
  106. package/src/commands/setNodeSelection.ts +1 -1
  107. package/src/commands/setTextSelection.ts +1 -1
  108. package/src/commands/sinkListItem.ts +1 -1
  109. package/src/commands/splitBlock.ts +1 -1
  110. package/src/commands/splitListItem.ts +2 -2
  111. package/src/commands/toggleList.ts +3 -3
  112. package/src/commands/toggleMark.ts +2 -2
  113. package/src/commands/toggleNode.ts +2 -2
  114. package/src/commands/toggleWrap.ts +2 -2
  115. package/src/commands/unsetAllMarks.ts +4 -8
  116. package/src/commands/unsetMark.ts +2 -2
  117. package/src/commands/updateAttributes.ts +3 -3
  118. package/src/commands/wrapIn.ts +2 -2
  119. package/src/commands/wrapInList.ts +1 -1
  120. package/src/extensions/clipboardTextSerializer.ts +5 -3
  121. package/src/helpers/combineTransactionSteps.ts +1 -1
  122. package/src/helpers/createChainableState.ts +1 -1
  123. package/src/helpers/createDocument.ts +2 -2
  124. package/src/helpers/createNodeFromContent.ts +2 -2
  125. package/src/helpers/defaultBlockAt.ts +1 -1
  126. package/src/helpers/findChildren.ts +1 -1
  127. package/src/helpers/findChildrenInRange.ts +1 -1
  128. package/src/helpers/findParentNode.ts +2 -2
  129. package/src/helpers/findParentNodeClosestToPos.ts +1 -1
  130. package/src/helpers/generateHTML.ts +3 -3
  131. package/src/helpers/generateJSON.ts +3 -3
  132. package/src/helpers/generateText.ts +4 -4
  133. package/src/helpers/getAttributes.ts +4 -4
  134. package/src/helpers/getAttributesFromExtensions.ts +3 -3
  135. package/src/helpers/getChangedRanges.ts +2 -2
  136. package/src/helpers/getDebugJSON.ts +1 -1
  137. package/src/helpers/getExtensionField.ts +1 -1
  138. package/src/helpers/getHTMLFromFragment.ts +1 -1
  139. package/src/helpers/getMarkAttributes.ts +2 -2
  140. package/src/helpers/getMarkRange.ts +2 -2
  141. package/src/helpers/getMarkType.ts +1 -1
  142. package/src/helpers/getMarksBetween.ts +2 -2
  143. package/src/helpers/getNodeAttributes.ts +2 -2
  144. package/src/helpers/getNodeType.ts +1 -1
  145. package/src/helpers/getRenderedAttributes.ts +2 -2
  146. package/src/helpers/getSchema.ts +3 -3
  147. package/src/helpers/getSchemaByResolvedExtensions.ts +8 -8
  148. package/src/helpers/getSchemaTypeByName.ts +1 -1
  149. package/src/helpers/getSchemaTypeNameByName.ts +1 -1
  150. package/src/helpers/getSplittedAttributes.ts +1 -1
  151. package/src/helpers/getText.ts +2 -2
  152. package/src/helpers/getTextBetween.ts +1 -1
  153. package/src/helpers/getTextSeralizersFromSchema.ts +1 -1
  154. package/src/helpers/injectExtensionAttributesToParseRule.ts +3 -3
  155. package/src/helpers/isActive.ts +4 -4
  156. package/src/helpers/isExtensionRulesEnabled.ts +1 -1
  157. package/src/helpers/isList.ts +4 -4
  158. package/src/helpers/isMarkActive.ts +3 -3
  159. package/src/helpers/isNodeActive.ts +3 -3
  160. package/src/helpers/isNodeEmpty.ts +1 -1
  161. package/src/helpers/isNodeSelection.ts +2 -2
  162. package/src/helpers/isTextSelection.ts +2 -2
  163. package/src/helpers/posToDOMRect.ts +2 -2
  164. package/src/helpers/resolveFocusPosition.ts +2 -2
  165. package/src/helpers/selectionToInsertionEnd.ts +1 -1
  166. package/src/helpers/splitExtensions.ts +1 -1
  167. package/src/index.ts +40 -40
  168. package/src/inputRules/markInputRule.ts +3 -3
  169. package/src/inputRules/nodeInputRule.ts +2 -2
  170. package/src/inputRules/textInputRule.ts +1 -1
  171. package/src/inputRules/textblockTypeInputRule.ts +2 -2
  172. package/src/inputRules/wrappingInputRule.ts +2 -2
  173. package/src/pasteRules/markPasteRule.ts +3 -3
  174. package/src/pasteRules/textPasteRule.ts +1 -1
  175. package/src/style.ts +1 -3
  176. package/src/utilities/callOrReturn.ts +2 -2
  177. package/src/utilities/createStyleTag.ts +1 -1
  178. package/src/utilities/deleteProps.ts +1 -1
  179. package/src/utilities/elementFromString.ts +1 -1
  180. package/src/utilities/findDuplicates.ts +1 -1
  181. package/src/utilities/fromString.ts +1 -1
  182. package/src/utilities/isClass.ts +1 -1
  183. package/src/utilities/isEmptyObject.ts +1 -1
  184. package/src/utilities/isFunction.ts +1 -1
  185. package/src/utilities/isNumber.ts +1 -1
  186. package/src/utilities/isObject.ts +2 -2
  187. package/src/utilities/isPlainObject.ts +1 -1
  188. package/src/utilities/isRegExp.ts +1 -1
  189. package/src/utilities/isString.ts +1 -1
  190. package/src/utilities/isiOS.ts +1 -1
  191. package/src/utilities/mergeAttributes.ts +1 -1
  192. package/src/utilities/mergeDeep.ts +2 -2
  193. package/src/utilities/minMax.ts +1 -1
  194. package/src/utilities/objectIncludes.ts +2 -2
  195. package/src/utilities/removeDuplicates.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  import { InputRule, InputRuleFinder } from '../InputRule'
2
2
  import { NodeType } from 'prosemirror-model'
3
3
  import { ExtendedRegExpMatchArray } from '../types'
4
- import callOrReturn from '../utilities/callOrReturn'
4
+ import { callOrReturn } from '../utilities/callOrReturn'
5
5
 
6
6
  /**
7
7
  * Build an input rule that changes the type of a textblock when the
@@ -9,7 +9,7 @@ import callOrReturn from '../utilities/callOrReturn'
9
9
  * probably want the regexp to start with `^`, so that the pattern can
10
10
  * only occur at the start of a textblock.
11
11
  */
12
- export default function textblockTypeInputRule(config: {
12
+ export function textblockTypeInputRule(config: {
13
13
  find: InputRuleFinder,
14
14
  type: NodeType,
15
15
  getAttributes?:
@@ -2,7 +2,7 @@ import { InputRule, InputRuleFinder } from '../InputRule'
2
2
  import { NodeType, Node as ProseMirrorNode } from 'prosemirror-model'
3
3
  import { findWrapping, canJoin } from 'prosemirror-transform'
4
4
  import { ExtendedRegExpMatchArray } from '../types'
5
- import callOrReturn from '../utilities/callOrReturn'
5
+ import { callOrReturn } from '../utilities/callOrReturn'
6
6
 
7
7
  /**
8
8
  * Build an input rule for automatically wrapping a textblock when a
@@ -18,7 +18,7 @@ import callOrReturn from '../utilities/callOrReturn'
18
18
  * expression match and the node before the wrapped node, and can
19
19
  * return a boolean to indicate whether a join should happen.
20
20
  */
21
- export default function wrappingInputRule(config: {
21
+ export function wrappingInputRule(config: {
22
22
  find: InputRuleFinder,
23
23
  type: NodeType,
24
24
  getAttributes?:
@@ -1,14 +1,14 @@
1
1
  import { PasteRule, PasteRuleFinder } from '../PasteRule'
2
2
  import { MarkType } from 'prosemirror-model'
3
- import getMarksBetween from '../helpers/getMarksBetween'
4
- import callOrReturn from '../utilities/callOrReturn'
3
+ import { getMarksBetween } from '../helpers/getMarksBetween'
4
+ import { callOrReturn } from '../utilities/callOrReturn'
5
5
  import { ExtendedRegExpMatchArray } from '../types'
6
6
 
7
7
  /**
8
8
  * Build an paste rule that adds a mark when the
9
9
  * matched text is pasted into it.
10
10
  */
11
- export default function markPasteRule(config: {
11
+ export function markPasteRule(config: {
12
12
  find: PasteRuleFinder,
13
13
  type: MarkType,
14
14
  getAttributes?:
@@ -4,7 +4,7 @@ import { PasteRule, PasteRuleFinder } from '../PasteRule'
4
4
  * Build an paste rule that replaces text when the
5
5
  * matched text is pasted into it.
6
6
  */
7
- export default function textPasteRule(config: {
7
+ export function textPasteRule(config: {
8
8
  find: PasteRuleFinder,
9
9
  replace: string,
10
10
  }) {
package/src/style.ts CHANGED
@@ -1,4 +1,4 @@
1
- const style = `.ProseMirror {
1
+ export const style = `.ProseMirror {
2
2
  position: relative;
3
3
  }
4
4
 
@@ -73,5 +73,3 @@ img.ProseMirror-separator {
73
73
  .tippy-box[data-animation=fade][data-state=hidden] {
74
74
  opacity: 0
75
75
  }`
76
-
77
- export default style
@@ -1,5 +1,5 @@
1
1
  import { MaybeReturnType } from '../types'
2
- import isFunction from './isFunction'
2
+ import { isFunction } from './isFunction'
3
3
 
4
4
  /**
5
5
  * Optionally calls `value` as a function.
@@ -8,7 +8,7 @@ import isFunction from './isFunction'
8
8
  * @param context Optional context to bind to function.
9
9
  * @param props Optional props to pass to function.
10
10
  */
11
- export default function callOrReturn<T>(value: T, context: any = undefined, ...props: any[]): MaybeReturnType<T> {
11
+ export function callOrReturn<T>(value: T, context: any = undefined, ...props: any[]): MaybeReturnType<T> {
12
12
  if (isFunction(value)) {
13
13
  if (context) {
14
14
  return value.bind(context)(...props)
@@ -1,4 +1,4 @@
1
- export default function createStyleTag(style: string): HTMLStyleElement {
1
+ export function createStyleTag(style: string): HTMLStyleElement {
2
2
  const tipTapStyleTag = (<HTMLStyleElement>document.querySelector('style[data-tiptap-style]'))
3
3
 
4
4
  if (tipTapStyleTag !== null) {
@@ -3,7 +3,7 @@
3
3
  * @param obj Object
4
4
  * @param key Key to remove
5
5
  */
6
- export default function deleteProps(obj: Record<string, any>, propOrProps: string | string[]): Record<string, any> {
6
+ export function deleteProps(obj: Record<string, any>, propOrProps: string | string[]): Record<string, any> {
7
7
  const props = typeof propOrProps === 'string'
8
8
  ? [propOrProps]
9
9
  : propOrProps
@@ -1,4 +1,4 @@
1
- export default function elementFromString(value: string): HTMLElement {
1
+ export function elementFromString(value: string): HTMLElement {
2
2
  // add a wrapper to preserve leading and trailing whitespace
3
3
  const wrappedValue = `<body>${value}</body>`
4
4
 
@@ -1,4 +1,4 @@
1
- export default function findDuplicates(items: any[]): any[] {
1
+ export function findDuplicates(items: any[]): any[] {
2
2
  const filtered = items.filter((el, index) => items.indexOf(el) !== index)
3
3
 
4
4
  return [...new Set(filtered)]
@@ -1,4 +1,4 @@
1
- export default function fromString(value: any): any {
1
+ export function fromString(value: any): any {
2
2
  if (typeof value !== 'string') {
3
3
  return value
4
4
  }
@@ -1,4 +1,4 @@
1
- export default function isClass(value: any): boolean {
1
+ export function isClass(value: any): boolean {
2
2
  if (value.constructor?.toString().substring(0, 5) !== 'class') {
3
3
  return false
4
4
  }
@@ -1,3 +1,3 @@
1
- export default function isEmptyObject(value = {}): boolean {
1
+ export function isEmptyObject(value = {}): boolean {
2
2
  return Object.keys(value).length === 0 && value.constructor === Object
3
3
  }
@@ -1,3 +1,3 @@
1
- export default function isObject(value: any): value is Function {
1
+ export function isFunction(value: any): value is Function {
2
2
  return typeof value === 'function'
3
3
  }
@@ -1,3 +1,3 @@
1
- export default function isNumber(value: any): value is number {
1
+ export function isNumber(value: any): value is number {
2
2
  return typeof value === 'number'
3
3
  }
@@ -1,6 +1,6 @@
1
- import isClass from './isClass'
1
+ import { isClass } from './isClass'
2
2
 
3
- export default function isObject(value: any): boolean {
3
+ export function isObject(value: any): boolean {
4
4
  return (
5
5
  value
6
6
  && typeof value === 'object'
@@ -4,7 +4,7 @@ function getType(value: any): string {
4
4
  return Object.prototype.toString.call(value).slice(8, -1)
5
5
  }
6
6
 
7
- export default function isPlainObject(value: any): value is Record<string, any> {
7
+ export function isPlainObject(value: any): value is Record<string, any> {
8
8
  if (getType(value) !== 'Object') {
9
9
  return false
10
10
  }
@@ -1,3 +1,3 @@
1
- export default function isRegExp(value: any): value is RegExp {
1
+ export function isRegExp(value: any): value is RegExp {
2
2
  return Object.prototype.toString.call(value) === '[object RegExp]'
3
3
  }
@@ -1,3 +1,3 @@
1
- export default function isString(value: any): value is string {
1
+ export function isString(value: any): value is string {
2
2
  return typeof value === 'string'
3
3
  }
@@ -1,4 +1,4 @@
1
- export default function isiOS(): boolean {
1
+ export function isiOS(): boolean {
2
2
  return [
3
3
  'iPad Simulator',
4
4
  'iPhone Simulator',
@@ -1,4 +1,4 @@
1
- export default function mergeAttributes(...objects: Record<string, any>[]): Record<string, any> {
1
+ export function mergeAttributes(...objects: Record<string, any>[]): Record<string, any> {
2
2
  return objects
3
3
  .filter(item => !!item)
4
4
  .reduce((items, item) => {
@@ -1,6 +1,6 @@
1
- import isPlainObject from './isPlainObject'
1
+ import { isPlainObject } from './isPlainObject'
2
2
 
3
- export default function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any> {
3
+ export function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any> {
4
4
  const output = { ...target }
5
5
 
6
6
  if (isPlainObject(target) && isPlainObject(source)) {
@@ -1,3 +1,3 @@
1
- export default function minMax(value = 0, min = 0, max = 0): number {
1
+ export function minMax(value = 0, min = 0, max = 0): number {
2
2
  return Math.min(Math.max(value, min), max)
3
3
  }
@@ -1,11 +1,11 @@
1
- import isRegExp from './isRegExp'
1
+ import { isRegExp } from './isRegExp'
2
2
 
3
3
  /**
4
4
  * Check if object1 includes object2
5
5
  * @param object1 Object
6
6
  * @param object2 Object
7
7
  */
8
- export default function objectIncludes(
8
+ export function objectIncludes(
9
9
  object1: Record<string, any>,
10
10
  object2: Record<string, any>,
11
11
  options: { strict: boolean } = { strict: true },
@@ -2,7 +2,7 @@
2
2
  * Removes duplicated values within an array.
3
3
  * Supports numbers, strings and objects.
4
4
  */
5
- export default function removeDuplicates<T>(array: T[], by = JSON.stringify): T[] {
5
+ export function removeDuplicates<T>(array: T[], by = JSON.stringify): T[] {
6
6
  const seen: Record<any, any> = {}
7
7
 
8
8
  return array.filter(item => {