@tiptap/core 3.0.0-next.6 → 3.0.0-next.7

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 (138) hide show
  1. package/dist/index.cjs +48 -13
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +32 -17
  4. package/dist/index.d.ts +32 -17
  5. package/dist/index.js +74 -39
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/CommandManager.ts +3 -3
  9. package/src/Editor.ts +30 -15
  10. package/src/Extendable.ts +10 -9
  11. package/src/Extension.ts +17 -1
  12. package/src/ExtensionManager.ts +8 -6
  13. package/src/InputRule.ts +6 -4
  14. package/src/Mark.ts +13 -1
  15. package/src/MarkView.ts +3 -3
  16. package/src/Node.ts +13 -1
  17. package/src/NodePos.ts +3 -3
  18. package/src/NodeView.ts +3 -3
  19. package/src/PasteRule.ts +6 -4
  20. package/src/Tracker.ts +1 -1
  21. package/src/commands/blur.ts +1 -1
  22. package/src/commands/clearContent.ts +1 -1
  23. package/src/commands/clearNodes.ts +1 -1
  24. package/src/commands/command.ts +1 -1
  25. package/src/commands/createParagraphNear.ts +1 -1
  26. package/src/commands/cut.ts +1 -1
  27. package/src/commands/deleteCurrentNode.ts +1 -1
  28. package/src/commands/deleteNode.ts +2 -2
  29. package/src/commands/deleteRange.ts +1 -1
  30. package/src/commands/deleteSelection.ts +1 -1
  31. package/src/commands/enter.ts +1 -1
  32. package/src/commands/exitCode.ts +1 -1
  33. package/src/commands/extendMarkRange.ts +2 -2
  34. package/src/commands/first.ts +1 -1
  35. package/src/commands/focus.ts +1 -1
  36. package/src/commands/forEach.ts +1 -1
  37. package/src/commands/insertContent.ts +2 -2
  38. package/src/commands/insertContentAt.ts +3 -2
  39. package/src/commands/join.ts +1 -1
  40. package/src/commands/joinItemBackward.ts +1 -1
  41. package/src/commands/joinItemForward.ts +1 -1
  42. package/src/commands/joinTextblockBackward.ts +1 -1
  43. package/src/commands/joinTextblockForward.ts +1 -1
  44. package/src/commands/keyboardShortcut.ts +1 -1
  45. package/src/commands/lift.ts +2 -2
  46. package/src/commands/liftEmptyBlock.ts +1 -1
  47. package/src/commands/liftListItem.ts +2 -2
  48. package/src/commands/newlineInCode.ts +1 -1
  49. package/src/commands/resetAttributes.ts +2 -2
  50. package/src/commands/scrollIntoView.ts +1 -1
  51. package/src/commands/selectAll.ts +1 -1
  52. package/src/commands/selectNodeBackward.ts +1 -1
  53. package/src/commands/selectNodeForward.ts +1 -1
  54. package/src/commands/selectParentNode.ts +1 -1
  55. package/src/commands/selectTextblockEnd.ts +1 -1
  56. package/src/commands/selectTextblockStart.ts +1 -1
  57. package/src/commands/setContent.ts +2 -2
  58. package/src/commands/setMark.ts +3 -3
  59. package/src/commands/setMeta.ts +1 -1
  60. package/src/commands/setNode.ts +2 -2
  61. package/src/commands/setNodeSelection.ts +1 -1
  62. package/src/commands/setTextSelection.ts +1 -1
  63. package/src/commands/sinkListItem.ts +2 -2
  64. package/src/commands/splitBlock.ts +3 -2
  65. package/src/commands/splitListItem.ts +3 -2
  66. package/src/commands/toggleList.ts +3 -3
  67. package/src/commands/toggleMark.ts +2 -2
  68. package/src/commands/toggleNode.ts +2 -2
  69. package/src/commands/toggleWrap.ts +2 -2
  70. package/src/commands/undoInputRule.ts +1 -1
  71. package/src/commands/unsetAllMarks.ts +1 -1
  72. package/src/commands/unsetMark.ts +2 -2
  73. package/src/commands/updateAttributes.ts +3 -3
  74. package/src/commands/wrapIn.ts +2 -2
  75. package/src/commands/wrapInList.ts +2 -2
  76. package/src/extensions/focusEvents.ts +3 -1
  77. package/src/extensions/index.ts +1 -1
  78. package/src/helpers/combineTransactionSteps.ts +2 -2
  79. package/src/helpers/createChainableState.ts +1 -1
  80. package/src/helpers/createDocument.ts +2 -2
  81. package/src/helpers/createNodeFromContent.ts +3 -2
  82. package/src/helpers/defaultBlockAt.ts +1 -1
  83. package/src/helpers/findChildren.ts +2 -2
  84. package/src/helpers/findChildrenInRange.ts +2 -2
  85. package/src/helpers/findParentNode.ts +2 -2
  86. package/src/helpers/findParentNodeClosestToPos.ts +2 -2
  87. package/src/helpers/flattenExtensions.ts +1 -1
  88. package/src/helpers/generateHTML.ts +1 -1
  89. package/src/helpers/generateJSON.ts +1 -1
  90. package/src/helpers/generateText.ts +1 -1
  91. package/src/helpers/getAttributes.ts +2 -2
  92. package/src/helpers/getAttributesFromExtensions.ts +1 -1
  93. package/src/helpers/getChangedRanges.ts +2 -2
  94. package/src/helpers/getDebugJSON.ts +2 -2
  95. package/src/helpers/getExtensionField.ts +4 -4
  96. package/src/helpers/getHTMLFromFragment.ts +2 -1
  97. package/src/helpers/getMarkAttributes.ts +2 -2
  98. package/src/helpers/getMarkRange.ts +2 -2
  99. package/src/helpers/getMarkType.ts +1 -1
  100. package/src/helpers/getMarksBetween.ts +2 -2
  101. package/src/helpers/getNodeAtPosition.ts +2 -2
  102. package/src/helpers/getNodeAttributes.ts +2 -2
  103. package/src/helpers/getNodeType.ts +1 -1
  104. package/src/helpers/getRenderedAttributes.ts +2 -2
  105. package/src/helpers/getSchema.ts +3 -3
  106. package/src/helpers/getSchemaByResolvedExtensions.ts +3 -2
  107. package/src/helpers/getSchemaTypeByName.ts +1 -1
  108. package/src/helpers/getSchemaTypeNameByName.ts +1 -1
  109. package/src/helpers/getSplittedAttributes.ts +1 -1
  110. package/src/helpers/getText.ts +2 -2
  111. package/src/helpers/getTextBetween.ts +2 -2
  112. package/src/helpers/getTextContentFromNodes.ts +1 -1
  113. package/src/helpers/getTextSerializersFromSchema.ts +2 -2
  114. package/src/helpers/injectExtensionAttributesToParseRule.ts +2 -2
  115. package/src/helpers/isActive.ts +1 -1
  116. package/src/helpers/isAtEndOfNode.ts +1 -1
  117. package/src/helpers/isAtStartOfNode.ts +1 -1
  118. package/src/helpers/isExtensionRulesEnabled.ts +1 -1
  119. package/src/helpers/isList.ts +1 -1
  120. package/src/helpers/isMarkActive.ts +3 -3
  121. package/src/helpers/isNodeActive.ts +3 -3
  122. package/src/helpers/isNodeEmpty.ts +1 -1
  123. package/src/helpers/posToDOMRect.ts +1 -1
  124. package/src/helpers/resolveExtensions.ts +1 -1
  125. package/src/helpers/resolveFocusPosition.ts +2 -2
  126. package/src/helpers/selectionToInsertionEnd.ts +2 -1
  127. package/src/helpers/sortExtensions.ts +1 -1
  128. package/src/helpers/splitExtensions.ts +4 -4
  129. package/src/inputRules/markInputRule.ts +4 -3
  130. package/src/inputRules/nodeInputRule.ts +4 -3
  131. package/src/inputRules/textInputRule.ts +2 -1
  132. package/src/inputRules/textblockTypeInputRule.ts +4 -3
  133. package/src/inputRules/wrappingInputRule.ts +5 -4
  134. package/src/pasteRules/markPasteRule.ts +4 -3
  135. package/src/pasteRules/nodePasteRule.ts +4 -3
  136. package/src/pasteRules/textPasteRule.ts +2 -1
  137. package/src/types.ts +10 -10
  138. package/src/utilities/callOrReturn.ts +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "3.0.0-next.6",
4
+ "version": "3.0.0-next.7",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -51,7 +51,7 @@
51
51
  "jsx-runtime"
52
52
  ],
53
53
  "devDependencies": {
54
- "@tiptap/pm": "^3.0.0-next.6"
54
+ "@tiptap/pm": "^3.0.0-next.7"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@tiptap/pm": "^3.0.0-next.1"
@@ -1,8 +1,8 @@
1
- import { EditorState, Transaction } from '@tiptap/pm/state'
1
+ import type { EditorState, Transaction } from '@tiptap/pm/state'
2
2
 
3
- import { Editor } from './Editor.js'
3
+ import type { Editor } from './Editor.js'
4
4
  import { createChainableState } from './helpers/createChainableState.js'
5
- import { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js'
5
+ import type { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js'
6
6
 
7
7
  export class CommandManager {
8
8
  editor: Editor
package/src/Editor.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-object-type */
2
- import { MarkType, Node as ProseMirrorNode, NodeType, Schema } from '@tiptap/pm/model'
3
- import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state'
2
+ import type { MarkType, Node as ProseMirrorNode, NodeType, Schema } from '@tiptap/pm/model'
3
+ import type { Plugin, PluginKey, Transaction } from '@tiptap/pm/state'
4
+ import { EditorState } from '@tiptap/pm/state'
4
5
  import { EditorView } from '@tiptap/pm/view'
5
6
 
6
7
  import { CommandManager } from './CommandManager.js'
@@ -28,7 +29,7 @@ import { resolveFocusPosition } from './helpers/resolveFocusPosition.js'
28
29
  import type { Storage } from './index.js'
29
30
  import { NodePos } from './NodePos.js'
30
31
  import { style } from './style.js'
31
- import {
32
+ import type {
32
33
  CanCommands,
33
34
  ChainedCommands,
34
35
  DocumentType,
@@ -54,7 +55,7 @@ export class Editor extends EventEmitter<EditorEvents> {
54
55
 
55
56
  public extensionManager!: ExtensionManager
56
57
 
57
- private css!: HTMLStyleElement
58
+ private css: HTMLStyleElement | null = null
58
59
 
59
60
  public schema!: Schema
60
61
 
@@ -142,6 +143,9 @@ export class Editor extends EventEmitter<EditorEvents> {
142
143
  }
143
144
  }
144
145
 
146
+ /**
147
+ * Attach the editor to the DOM, creating a new editor view.
148
+ */
145
149
  public mount(el: NonNullable<EditorOptions['element']> & {}) {
146
150
  if (typeof document === 'undefined') {
147
151
  throw new Error(
@@ -161,6 +165,26 @@ export class Editor extends EventEmitter<EditorEvents> {
161
165
  }, 0)
162
166
  }
163
167
 
168
+ /**
169
+ * Remove the editor from the DOM, but still allow remounting at a different point in time
170
+ */
171
+ public unmount() {
172
+ if (this.editorView) {
173
+ // Cleanup our reference to prevent circular references which caused memory leaks
174
+ // @ts-ignore
175
+ const dom = this.editorView.dom as TiptapEditorHTMLElement
176
+
177
+ if (dom?.editor) {
178
+ delete dom.editor
179
+ }
180
+ this.editorView.destroy()
181
+ }
182
+ this.editorView = null
183
+ this.isInitialized = false
184
+ this.css?.remove()
185
+ this.css = null
186
+ }
187
+
164
188
  /**
165
189
  * Returns the editor storage.
166
190
  */
@@ -484,7 +508,7 @@ export class Editor extends EventEmitter<EditorEvents> {
484
508
  }
485
509
 
486
510
  /**
487
- * Creates all node views.
511
+ * Creates all node and mark views.
488
512
  */
489
513
  public createNodeViews(): void {
490
514
  if (this.view.isDestroyed) {
@@ -684,16 +708,7 @@ export class Editor extends EventEmitter<EditorEvents> {
684
708
  public destroy(): void {
685
709
  this.emit('destroy')
686
710
 
687
- if (this.editorView) {
688
- // Cleanup our reference to prevent circular references which caused memory leaks
689
- // @ts-ignore
690
- const dom = this.editorView.dom as TiptapEditorHTMLElement
691
-
692
- if (dom && dom.editor) {
693
- delete dom.editor
694
- }
695
- this.editorView.destroy()
696
- }
711
+ this.unmount()
697
712
 
698
713
  this.removeAllListeners()
699
714
  }
package/src/Extendable.ts CHANGED
@@ -2,12 +2,13 @@ import type { Plugin } from '@tiptap/pm/state'
2
2
 
3
3
  import type { Editor } from './Editor.js'
4
4
  import { getExtensionField } from './helpers/getExtensionField.js'
5
- import { ExtensionConfig, MarkConfig, NodeConfig } from './index.js'
5
+ import type { ExtensionConfig, MarkConfig, NodeConfig } from './index.js'
6
6
  import type { InputRule } from './InputRule.js'
7
7
  import type { Mark } from './Mark.js'
8
8
  import type { Node } from './Node.js'
9
9
  import type { PasteRule } from './PasteRule.js'
10
10
  import type {
11
+ AnyConfig,
11
12
  EditorEvents,
12
13
  Extensions,
13
14
  GlobalAttributes,
@@ -15,7 +16,6 @@ import type {
15
16
  ParentConfig,
16
17
  RawCommands,
17
18
  } from './types.js'
18
- import { AnyConfig } from './types.js'
19
19
  import { callOrReturn } from './utilities/callOrReturn.js'
20
20
  import { mergeDeep } from './utilities/mergeDeep.js'
21
21
 
@@ -452,7 +452,7 @@ export class Extendable<
452
452
  }
453
453
 
454
454
  configure(options: Partial<Options> = {}) {
455
- const extension = this.extend<Options, Storage>({
455
+ const extension = this.extend<Options, Storage, Config>({
456
456
  ...this.config,
457
457
  addOptions: () => {
458
458
  return mergeDeep(this.options as Record<string, any>, options) as Options
@@ -465,18 +465,19 @@ export class Extendable<
465
465
  return extension
466
466
  }
467
467
 
468
- extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
469
- extendedConfig: Partial<
468
+ extend<
469
+ ExtendedOptions = Options,
470
+ ExtendedStorage = Storage,
471
+ ExtendedConfig =
470
472
  | ExtensionConfig<ExtendedOptions, ExtendedStorage>
471
473
  | NodeConfig<ExtendedOptions, ExtendedStorage>
472
- | MarkConfig<ExtendedOptions, ExtendedStorage>
473
- > = {},
474
- ): Extendable<ExtendedOptions, ExtendedStorage> {
474
+ | MarkConfig<ExtendedOptions, ExtendedStorage>,
475
+ >(extendedConfig: Partial<ExtendedConfig> = {}): Extendable<ExtendedOptions, ExtendedStorage> {
475
476
  const extension = new (this.constructor as any)({ ...this.config, ...extendedConfig })
476
477
 
477
478
  extension.parent = this
478
479
  this.child = extension
479
- extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name
480
+ extension.name = 'name' in extendedConfig ? extendedConfig.name : extension.parent.name
480
481
 
481
482
  return extension
482
483
  }
package/src/Extension.ts CHANGED
@@ -8,10 +8,26 @@ export interface ExtensionConfig<Options = any, Storage = any>
8
8
  * The Extension class is the base class for all extensions.
9
9
  * @see https://tiptap.dev/api/extensions#create-a-new-extension
10
10
  */
11
- export class Extension<Options = any, Storage = any> extends Extendable<Options, Storage> {
11
+ export class Extension<Options = any, Storage = any> extends Extendable<
12
+ Options,
13
+ Storage,
14
+ ExtensionConfig<Options, Storage>
15
+ > {
12
16
  type = 'extension'
13
17
 
14
18
  static create<O = any, S = any>(config: Partial<ExtensionConfig<O, S>> = {}) {
15
19
  return new Extension<O, S>(config)
16
20
  }
21
+
22
+ configure(options?: Partial<Options>) {
23
+ return super.configure(options) as Extension<Options, Storage>
24
+ }
25
+
26
+ extend<
27
+ ExtendedOptions = Options,
28
+ ExtendedStorage = Storage,
29
+ ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage>,
30
+ >(extendedConfig?: Partial<ExtendedConfig>) {
31
+ return super.extend(extendedConfig) as Extension<ExtendedOptions, ExtendedStorage>
32
+ }
17
33
  }
@@ -1,7 +1,7 @@
1
1
  import { keymap } from '@tiptap/pm/keymap'
2
- import { Schema } from '@tiptap/pm/model'
3
- import { Plugin } from '@tiptap/pm/state'
4
- import { MarkViewConstructor, NodeViewConstructor } from '@tiptap/pm/view'
2
+ import type { Schema } from '@tiptap/pm/model'
3
+ import type { Plugin } from '@tiptap/pm/state'
4
+ import type { MarkViewConstructor, NodeViewConstructor } from '@tiptap/pm/view'
5
5
 
6
6
  import type { Editor } from './Editor.js'
7
7
  import {
@@ -18,10 +18,12 @@ import {
18
18
  splitExtensions,
19
19
  } from './helpers/index.js'
20
20
  import { type MarkConfig, type NodeConfig, type Storage, getMarkType } from './index.js'
21
- import { InputRule, inputRulesPlugin } from './InputRule.js'
21
+ import type { InputRule } from './InputRule.js'
22
+ import { inputRulesPlugin } from './InputRule.js'
22
23
  import { Mark } from './Mark.js'
23
- import { PasteRule, pasteRulesPlugin } from './PasteRule.js'
24
- import { AnyConfig, Extensions, RawCommands } from './types.js'
24
+ import type { PasteRule } from './PasteRule.js'
25
+ import { pasteRulesPlugin } from './PasteRule.js'
26
+ import type { AnyConfig, Extensions, RawCommands } from './types.js'
25
27
  import { callOrReturn } from './utilities/callOrReturn.js'
26
28
 
27
29
  export class ExtensionManager {
package/src/InputRule.ts CHANGED
@@ -1,12 +1,14 @@
1
- import { Fragment, Node as ProseMirrorNode } from '@tiptap/pm/model'
2
- import { EditorState, Plugin, TextSelection } from '@tiptap/pm/state'
1
+ import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
2
+ import { Fragment } from '@tiptap/pm/model'
3
+ import type { EditorState, TextSelection } from '@tiptap/pm/state'
4
+ import { Plugin } from '@tiptap/pm/state'
3
5
 
4
6
  import { CommandManager } from './CommandManager.js'
5
- import { Editor } from './Editor.js'
7
+ import type { Editor } from './Editor.js'
6
8
  import { createChainableState } from './helpers/createChainableState.js'
7
9
  import { getHTMLFromFragment } from './helpers/getHTMLFromFragment.js'
8
10
  import { getTextContentFromNodes } from './helpers/getTextContentFromNodes.js'
9
- import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js'
11
+ import type { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js'
10
12
  import { isRegExp } from './utilities/isRegExp.js'
11
13
 
12
14
  export type InputRuleMatch = {
package/src/Mark.ts CHANGED
@@ -143,7 +143,7 @@ export interface MarkConfig<Options = any, Storage = any>
143
143
  * The Mark class is used to create custom mark extensions.
144
144
  * @see https://tiptap.dev/api/extensions#create-a-new-extension
145
145
  */
146
- export class Mark<Options = any, Storage = any> extends Extendable<Options, Storage> {
146
+ export class Mark<Options = any, Storage = any> extends Extendable<Options, Storage, MarkConfig<Options, Storage>> {
147
147
  type = 'mark'
148
148
 
149
149
  static create<O = any, S = any>(config: Partial<MarkConfig<O, S>> = {}) {
@@ -177,4 +177,16 @@ export class Mark<Options = any, Storage = any> extends Extendable<Options, Stor
177
177
 
178
178
  return false
179
179
  }
180
+
181
+ configure(options?: Partial<Options>) {
182
+ return super.configure(options) as Mark<Options, Storage>
183
+ }
184
+
185
+ extend<
186
+ ExtendedOptions = Options,
187
+ ExtendedStorage = Storage,
188
+ ExtendedConfig = MarkConfig<ExtendedOptions, ExtendedStorage>,
189
+ >(extendedConfig?: Partial<ExtendedConfig>) {
190
+ return super.extend(extendedConfig) as Mark<ExtendedOptions, ExtendedStorage>
191
+ }
180
192
  }
package/src/MarkView.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ViewMutationRecord } from '@tiptap/pm/view'
1
+ import type { ViewMutationRecord } from '@tiptap/pm/view'
2
2
 
3
- import { Editor } from './Editor.js'
4
- import { MarkViewProps, MarkViewRendererOptions } from './types.js'
3
+ import type { Editor } from './Editor.js'
4
+ import type { MarkViewProps, MarkViewRendererOptions } from './types.js'
5
5
  import { isAndroid, isiOS } from './utilities/index.js'
6
6
 
7
7
  export class MarkView<Component, Options extends MarkViewRendererOptions = MarkViewRendererOptions> {
package/src/Node.ts CHANGED
@@ -337,10 +337,22 @@ export interface NodeConfig<Options = any, Storage = any>
337
337
  * The Node class is used to create custom node extensions.
338
338
  * @see https://tiptap.dev/api/extensions#create-a-new-extension
339
339
  */
340
- export class Node<Options = any, Storage = any> extends Extendable<Options, Storage> {
340
+ export class Node<Options = any, Storage = any> extends Extendable<Options, Storage, NodeConfig<Options, Storage>> {
341
341
  type = 'node'
342
342
 
343
343
  static create<O = any, S = any>(config: Partial<NodeConfig<O, S>> = {}) {
344
344
  return new Node<O, S>(config)
345
345
  }
346
+
347
+ configure(options?: Partial<Options>) {
348
+ return super.configure(options) as Node<Options, Storage>
349
+ }
350
+
351
+ extend<
352
+ ExtendedOptions = Options,
353
+ ExtendedStorage = Storage,
354
+ ExtendedConfig = NodeConfig<ExtendedOptions, ExtendedStorage>,
355
+ >(extendedConfig?: Partial<ExtendedConfig>) {
356
+ return super.extend(extendedConfig) as Node<ExtendedOptions, ExtendedStorage>
357
+ }
346
358
  }
package/src/NodePos.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Fragment, Node, ResolvedPos } from '@tiptap/pm/model'
1
+ import type { Fragment, Node, ResolvedPos } from '@tiptap/pm/model'
2
2
 
3
- import { Editor } from './Editor.js'
4
- import { Content, Range } from './types.js'
3
+ import type { Editor } from './Editor.js'
4
+ import type { Content, Range } from './types.js'
5
5
 
6
6
  export class NodePos {
7
7
  private resolvedPos: ResolvedPos
package/src/NodeView.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { NodeSelection } from '@tiptap/pm/state'
2
- import { NodeView as ProseMirrorNodeView, ViewMutationRecord } from '@tiptap/pm/view'
2
+ import type { NodeView as ProseMirrorNodeView, ViewMutationRecord } from '@tiptap/pm/view'
3
3
 
4
- import { Editor as CoreEditor } from './Editor.js'
5
- import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js'
4
+ import type { Editor as CoreEditor } from './Editor.js'
5
+ import type { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js'
6
6
  import { isAndroid } from './utilities/isAndroid.js'
7
7
  import { isiOS } from './utilities/isiOS.js'
8
8
 
package/src/PasteRule.ts CHANGED
@@ -1,11 +1,13 @@
1
- import { Fragment, Node as ProseMirrorNode } from '@tiptap/pm/model'
2
- import { EditorState, Plugin } from '@tiptap/pm/state'
1
+ import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
2
+ import { Fragment } from '@tiptap/pm/model'
3
+ import type { EditorState } from '@tiptap/pm/state'
4
+ import { Plugin } from '@tiptap/pm/state'
3
5
 
4
6
  import { CommandManager } from './CommandManager.js'
5
- import { Editor } from './Editor.js'
7
+ import type { Editor } from './Editor.js'
6
8
  import { createChainableState } from './helpers/createChainableState.js'
7
9
  import { getHTMLFromFragment } from './helpers/getHTMLFromFragment.js'
8
- import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js'
10
+ import type { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js'
9
11
  import { isNumber } from './utilities/isNumber.js'
10
12
  import { isRegExp } from './utilities/isRegExp.js'
11
13
 
package/src/Tracker.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Transaction } from '@tiptap/pm/state'
1
+ import type { Transaction } from '@tiptap/pm/state'
2
2
 
3
3
  export interface TrackerResult {
4
4
  position: number
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types.js'
1
+ import type { 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.js'
1
+ import type { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { liftTarget } from '@tiptap/pm/transform'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { Command, RawCommands } from '../types.js'
1
+ import type { Command, RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { createParagraphNear as originalCreateParagraphNear } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { TextSelection } from '@tiptap/pm/state'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types.js'
1
+ import type { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,7 +1,7 @@
1
- import { NodeType } from '@tiptap/pm/model'
1
+ import type { NodeType } from '@tiptap/pm/model'
2
2
 
3
3
  import { getNodeType } from '../helpers/getNodeType.js'
4
- import { RawCommands } from '../types.js'
4
+ import type { RawCommands } from '../types.js'
5
5
 
6
6
  declare module '@tiptap/core' {
7
7
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { Range, RawCommands } from '../types.js'
1
+ import type { Range, RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { deleteSelection as originalDeleteSelection } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types.js'
1
+ import type { RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { exitCode as originalExitCode } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,9 +1,9 @@
1
- import { MarkType } from '@tiptap/pm/model'
1
+ import type { MarkType } from '@tiptap/pm/model'
2
2
  import { TextSelection } from '@tiptap/pm/state'
3
3
 
4
4
  import { getMarkRange } from '../helpers/getMarkRange.js'
5
5
  import { getMarkType } from '../helpers/getMarkType.js'
6
- import { RawCommands } from '../types.js'
6
+ import type { RawCommands } from '../types.js'
7
7
 
8
8
  declare module '@tiptap/core' {
9
9
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { Command, CommandProps, RawCommands } from '../types.js'
1
+ import type { Command, CommandProps, RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { isTextSelection } from '../helpers/isTextSelection.js'
2
2
  import { resolveFocusPosition } from '../helpers/resolveFocusPosition.js'
3
- import { FocusPosition, RawCommands } from '../types.js'
3
+ import type { FocusPosition, RawCommands } from '../types.js'
4
4
  import { isAndroid } from '../utilities/isAndroid.js'
5
5
  import { isiOS } from '../utilities/isiOS.js'
6
6
 
@@ -1,4 +1,4 @@
1
- import { CommandProps, RawCommands } from '../types.js'
1
+ import type { CommandProps, RawCommands } from '../types.js'
2
2
 
3
3
  declare module '@tiptap/core' {
4
4
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
- import { Fragment, Node as ProseMirrorNode, ParseOptions } from '@tiptap/pm/model'
1
+ import type { Fragment, Node as ProseMirrorNode, ParseOptions } from '@tiptap/pm/model'
2
2
 
3
- import { Content, RawCommands } from '../types.js'
3
+ import type { Content, RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,8 +1,9 @@
1
- import { Fragment, Node as ProseMirrorNode, ParseOptions } from '@tiptap/pm/model'
1
+ import type { Node as ProseMirrorNode, ParseOptions } from '@tiptap/pm/model'
2
+ import { Fragment } from '@tiptap/pm/model'
2
3
 
3
4
  import { createNodeFromContent } from '../helpers/createNodeFromContent.js'
4
5
  import { selectionToInsertionEnd } from '../helpers/selectionToInsertionEnd.js'
5
- import { Content, Range, RawCommands } from '../types.js'
6
+ import type { Content, Range, RawCommands } from '../types.js'
6
7
 
7
8
  declare module '@tiptap/core' {
8
9
  interface Commands<ReturnType> {
@@ -5,7 +5,7 @@ import {
5
5
  joinUp as originalJoinUp,
6
6
  } from '@tiptap/pm/commands'
7
7
 
8
- import { RawCommands } from '../types.js'
8
+ import type { RawCommands } from '../types.js'
9
9
 
10
10
  declare module '@tiptap/core' {
11
11
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { joinPoint } from '@tiptap/pm/transform'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { joinPoint } from '@tiptap/pm/transform'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { joinTextblockBackward as originalCommand } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,6 +1,6 @@
1
1
  import { joinTextblockForward as originalCommand } from '@tiptap/pm/commands'
2
2
 
3
- import { RawCommands } from '../types.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,4 +1,4 @@
1
- import { RawCommands } from '../types.js'
1
+ import type { RawCommands } from '../types.js'
2
2
  import { isiOS } from '../utilities/isiOS.js'
3
3
  import { isMacOS } from '../utilities/isMacOS.js'
4
4
 
@@ -1,9 +1,9 @@
1
1
  import { lift as originalLift } from '@tiptap/pm/commands'
2
- import { NodeType } from '@tiptap/pm/model'
2
+ import type { NodeType } from '@tiptap/pm/model'
3
3
 
4
4
  import { getNodeType } from '../helpers/getNodeType.js'
5
5
  import { isNodeActive } from '../helpers/isNodeActive.js'
6
- import { RawCommands } from '../types.js'
6
+ import type { 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.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {
@@ -1,8 +1,8 @@
1
- import { NodeType } from '@tiptap/pm/model'
1
+ import type { NodeType } from '@tiptap/pm/model'
2
2
  import { liftListItem as originalLiftListItem } from '@tiptap/pm/schema-list'
3
3
 
4
4
  import { getNodeType } from '../helpers/getNodeType.js'
5
- import { RawCommands } from '../types.js'
5
+ import type { 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.js'
3
+ import type { RawCommands } from '../types.js'
4
4
 
5
5
  declare module '@tiptap/core' {
6
6
  interface Commands<ReturnType> {