@tiptap/core 3.0.0-next.5 → 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.
- package/dist/index.cjs +48 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -17
- package/dist/index.d.ts +32 -17
- package/dist/index.js +74 -39
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/CommandManager.ts +3 -3
- package/src/Editor.ts +30 -15
- package/src/Extendable.ts +10 -9
- package/src/Extension.ts +17 -1
- package/src/ExtensionManager.ts +8 -6
- package/src/InputRule.ts +6 -4
- package/src/Mark.ts +13 -1
- package/src/MarkView.ts +3 -3
- package/src/Node.ts +13 -1
- package/src/NodePos.ts +3 -3
- package/src/NodeView.ts +3 -3
- package/src/PasteRule.ts +6 -4
- package/src/Tracker.ts +1 -1
- package/src/commands/blur.ts +1 -1
- package/src/commands/clearContent.ts +1 -1
- package/src/commands/clearNodes.ts +1 -1
- package/src/commands/command.ts +1 -1
- package/src/commands/createParagraphNear.ts +1 -1
- package/src/commands/cut.ts +1 -1
- package/src/commands/deleteCurrentNode.ts +1 -1
- package/src/commands/deleteNode.ts +2 -2
- package/src/commands/deleteRange.ts +1 -1
- package/src/commands/deleteSelection.ts +1 -1
- package/src/commands/enter.ts +1 -1
- package/src/commands/exitCode.ts +1 -1
- package/src/commands/extendMarkRange.ts +2 -2
- package/src/commands/first.ts +1 -1
- package/src/commands/focus.ts +1 -1
- package/src/commands/forEach.ts +1 -1
- package/src/commands/insertContent.ts +2 -2
- package/src/commands/insertContentAt.ts +3 -2
- package/src/commands/join.ts +1 -1
- package/src/commands/joinItemBackward.ts +1 -1
- package/src/commands/joinItemForward.ts +1 -1
- package/src/commands/joinTextblockBackward.ts +1 -1
- package/src/commands/joinTextblockForward.ts +1 -1
- package/src/commands/keyboardShortcut.ts +1 -1
- package/src/commands/lift.ts +2 -2
- package/src/commands/liftEmptyBlock.ts +1 -1
- package/src/commands/liftListItem.ts +2 -2
- package/src/commands/newlineInCode.ts +1 -1
- package/src/commands/resetAttributes.ts +2 -2
- package/src/commands/scrollIntoView.ts +1 -1
- package/src/commands/selectAll.ts +1 -1
- package/src/commands/selectNodeBackward.ts +1 -1
- package/src/commands/selectNodeForward.ts +1 -1
- package/src/commands/selectParentNode.ts +1 -1
- package/src/commands/selectTextblockEnd.ts +1 -1
- package/src/commands/selectTextblockStart.ts +1 -1
- package/src/commands/setContent.ts +2 -2
- package/src/commands/setMark.ts +3 -3
- package/src/commands/setMeta.ts +1 -1
- package/src/commands/setNode.ts +2 -2
- package/src/commands/setNodeSelection.ts +1 -1
- package/src/commands/setTextSelection.ts +1 -1
- package/src/commands/sinkListItem.ts +2 -2
- package/src/commands/splitBlock.ts +3 -2
- package/src/commands/splitListItem.ts +3 -2
- package/src/commands/toggleList.ts +3 -3
- package/src/commands/toggleMark.ts +2 -2
- package/src/commands/toggleNode.ts +2 -2
- package/src/commands/toggleWrap.ts +2 -2
- package/src/commands/undoInputRule.ts +1 -1
- package/src/commands/unsetAllMarks.ts +1 -1
- package/src/commands/unsetMark.ts +2 -2
- package/src/commands/updateAttributes.ts +3 -3
- package/src/commands/wrapIn.ts +2 -2
- package/src/commands/wrapInList.ts +2 -2
- package/src/extensions/focusEvents.ts +3 -1
- package/src/extensions/index.ts +1 -1
- package/src/helpers/combineTransactionSteps.ts +2 -2
- package/src/helpers/createChainableState.ts +1 -1
- package/src/helpers/createDocument.ts +2 -2
- package/src/helpers/createNodeFromContent.ts +3 -2
- package/src/helpers/defaultBlockAt.ts +1 -1
- package/src/helpers/findChildren.ts +2 -2
- package/src/helpers/findChildrenInRange.ts +2 -2
- package/src/helpers/findParentNode.ts +2 -2
- package/src/helpers/findParentNodeClosestToPos.ts +2 -2
- package/src/helpers/flattenExtensions.ts +1 -1
- package/src/helpers/generateHTML.ts +1 -1
- package/src/helpers/generateJSON.ts +1 -1
- package/src/helpers/generateText.ts +1 -1
- package/src/helpers/getAttributes.ts +2 -2
- package/src/helpers/getAttributesFromExtensions.ts +1 -1
- package/src/helpers/getChangedRanges.ts +2 -2
- package/src/helpers/getDebugJSON.ts +2 -2
- package/src/helpers/getExtensionField.ts +4 -4
- package/src/helpers/getHTMLFromFragment.ts +2 -1
- package/src/helpers/getMarkAttributes.ts +2 -2
- package/src/helpers/getMarkRange.ts +2 -2
- package/src/helpers/getMarkType.ts +1 -1
- package/src/helpers/getMarksBetween.ts +2 -2
- package/src/helpers/getNodeAtPosition.ts +2 -2
- package/src/helpers/getNodeAttributes.ts +2 -2
- package/src/helpers/getNodeType.ts +1 -1
- package/src/helpers/getRenderedAttributes.ts +2 -2
- package/src/helpers/getSchema.ts +3 -3
- package/src/helpers/getSchemaByResolvedExtensions.ts +3 -2
- package/src/helpers/getSchemaTypeByName.ts +1 -1
- package/src/helpers/getSchemaTypeNameByName.ts +1 -1
- package/src/helpers/getSplittedAttributes.ts +1 -1
- package/src/helpers/getText.ts +2 -2
- package/src/helpers/getTextBetween.ts +2 -2
- package/src/helpers/getTextContentFromNodes.ts +1 -1
- package/src/helpers/getTextSerializersFromSchema.ts +2 -2
- package/src/helpers/injectExtensionAttributesToParseRule.ts +2 -2
- package/src/helpers/isActive.ts +1 -1
- package/src/helpers/isAtEndOfNode.ts +1 -1
- package/src/helpers/isAtStartOfNode.ts +1 -1
- package/src/helpers/isExtensionRulesEnabled.ts +1 -1
- package/src/helpers/isList.ts +1 -1
- package/src/helpers/isMarkActive.ts +3 -3
- package/src/helpers/isNodeActive.ts +3 -3
- package/src/helpers/isNodeEmpty.ts +1 -1
- package/src/helpers/posToDOMRect.ts +1 -1
- package/src/helpers/resolveExtensions.ts +1 -1
- package/src/helpers/resolveFocusPosition.ts +2 -2
- package/src/helpers/selectionToInsertionEnd.ts +2 -1
- package/src/helpers/sortExtensions.ts +1 -1
- package/src/helpers/splitExtensions.ts +4 -4
- package/src/inputRules/markInputRule.ts +4 -3
- package/src/inputRules/nodeInputRule.ts +4 -3
- package/src/inputRules/textInputRule.ts +2 -1
- package/src/inputRules/textblockTypeInputRule.ts +4 -3
- package/src/inputRules/wrappingInputRule.ts +5 -4
- package/src/pasteRules/markPasteRule.ts +4 -3
- package/src/pasteRules/nodePasteRule.ts +4 -3
- package/src/pasteRules/textPasteRule.ts +2 -1
- package/src/types.ts +10 -10
- package/src/utilities/callOrReturn.ts +1 -1
package/src/helpers/getText.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import { TextSerializer } from '../types.js'
|
|
3
|
+
import type { TextSerializer } from '../types.js'
|
|
4
4
|
import { getTextBetween } from './getTextBetween.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import { Range, TextSerializer } from '../types.js'
|
|
3
|
+
import type { Range, TextSerializer } from '../types.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Gets the text between two positions in a Prosemirror node
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ParseRule } from '@tiptap/pm/model'
|
|
1
|
+
import type { ParseRule } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import { ExtensionAttribute } from '../types.js'
|
|
3
|
+
import type { ExtensionAttribute } from '../types.js'
|
|
4
4
|
import { fromString } from '../utilities/fromString.js'
|
|
5
5
|
|
|
6
6
|
/**
|
package/src/helpers/isActive.ts
CHANGED
package/src/helpers/isList.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getExtensionField } from '../helpers/getExtensionField.js'
|
|
2
2
|
import type { NodeConfig } from '../index.js'
|
|
3
|
-
import { Extensions } from '../types.js'
|
|
3
|
+
import type { Extensions } from '../types.js'
|
|
4
4
|
import { callOrReturn } from '../utilities/callOrReturn.js'
|
|
5
5
|
import { splitExtensions } from './splitExtensions.js'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MarkType } from '@tiptap/pm/model'
|
|
2
|
-
import { EditorState } from '@tiptap/pm/state'
|
|
1
|
+
import type { MarkType } from '@tiptap/pm/model'
|
|
2
|
+
import type { EditorState } from '@tiptap/pm/state'
|
|
3
3
|
|
|
4
|
-
import { MarkRange } from '../types.js'
|
|
4
|
+
import type { MarkRange } from '../types.js'
|
|
5
5
|
import { objectIncludes } from '../utilities/objectIncludes.js'
|
|
6
6
|
import { getMarkType } from './getMarkType.js'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { NodeType } from '@tiptap/pm/model'
|
|
2
|
-
import { EditorState } from '@tiptap/pm/state'
|
|
1
|
+
import type { NodeType } from '@tiptap/pm/model'
|
|
2
|
+
import type { EditorState } from '@tiptap/pm/state'
|
|
3
3
|
|
|
4
|
-
import { NodeRange } from '../types.js'
|
|
4
|
+
import type { NodeRange } from '../types.js'
|
|
5
5
|
import { objectIncludes } from '../utilities/objectIncludes.js'
|
|
6
6
|
import { getNodeType } from './getNodeType.js'
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
2
2
|
import { Selection, TextSelection } from '@tiptap/pm/state'
|
|
3
3
|
|
|
4
|
-
import { FocusPosition } from '../types.js'
|
|
4
|
+
import type { FocusPosition } from '../types.js'
|
|
5
5
|
import { minMax } from '../utilities/minMax.js'
|
|
6
6
|
|
|
7
7
|
export function resolveFocusPosition(doc: ProseMirrorNode, position: FocusPosition = null): Selection | null {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Transaction } from '@tiptap/pm/state'
|
|
2
|
+
import { Selection } from '@tiptap/pm/state'
|
|
2
3
|
import { ReplaceAroundStep, ReplaceStep } from '@tiptap/pm/transform'
|
|
3
4
|
|
|
4
5
|
// source: https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Extension } from '../Extension.js'
|
|
2
|
-
import { Mark } from '../Mark.js'
|
|
3
|
-
import { Node } from '../Node.js'
|
|
4
|
-
import { Extensions } from '../types.js'
|
|
1
|
+
import type { Extension } from '../Extension.js'
|
|
2
|
+
import type { Mark } from '../Mark.js'
|
|
3
|
+
import type { Node } from '../Node.js'
|
|
4
|
+
import type { Extensions } from '../types.js'
|
|
5
5
|
|
|
6
6
|
export function splitExtensions(extensions: Extensions) {
|
|
7
7
|
const baseExtensions = extensions.filter(extension => extension.type === 'extension') as Extension[]
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { MarkType } from '@tiptap/pm/model'
|
|
1
|
+
import type { MarkType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
3
|
import { getMarksBetween } from '../helpers/getMarksBetween.js'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import type { InputRuleFinder } from '../InputRule.js'
|
|
5
|
+
import { InputRule } from '../InputRule.js'
|
|
6
|
+
import type { ExtendedRegExpMatchArray } from '../types.js'
|
|
6
7
|
import { callOrReturn } from '../utilities/callOrReturn.js'
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { NodeType } from '@tiptap/pm/model'
|
|
1
|
+
import type { NodeType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { InputRuleFinder } from '../InputRule.js'
|
|
4
|
+
import { InputRule } from '../InputRule.js'
|
|
5
|
+
import type { ExtendedRegExpMatchArray } from '../types.js'
|
|
5
6
|
import { callOrReturn } from '../utilities/callOrReturn.js'
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { NodeType } from '@tiptap/pm/model'
|
|
1
|
+
import type { NodeType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { InputRuleFinder } from '../InputRule.js'
|
|
4
|
+
import { InputRule } from '../InputRule.js'
|
|
5
|
+
import type { ExtendedRegExpMatchArray } from '../types.js'
|
|
5
6
|
import { callOrReturn } from '../utilities/callOrReturn.js'
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Node as ProseMirrorNode, NodeType } from '@tiptap/pm/model'
|
|
1
|
+
import type { Node as ProseMirrorNode, NodeType } from '@tiptap/pm/model'
|
|
2
2
|
import { canJoin, findWrapping } from '@tiptap/pm/transform'
|
|
3
3
|
|
|
4
|
-
import { Editor } from '../Editor.js'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import type { Editor } from '../Editor.js'
|
|
5
|
+
import type { InputRuleFinder } from '../InputRule.js'
|
|
6
|
+
import { InputRule } from '../InputRule.js'
|
|
7
|
+
import type { ExtendedRegExpMatchArray } from '../types.js'
|
|
7
8
|
import { callOrReturn } from '../utilities/callOrReturn.js'
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { MarkType } from '@tiptap/pm/model'
|
|
1
|
+
import type { MarkType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
3
|
import { getMarksBetween } from '../helpers/getMarksBetween.js'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import type { PasteRuleFinder } from '../PasteRule.js'
|
|
5
|
+
import { PasteRule } from '../PasteRule.js'
|
|
6
|
+
import type { ExtendedRegExpMatchArray } from '../types.js'
|
|
6
7
|
import { callOrReturn } from '../utilities/callOrReturn.js'
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { NodeType } from '@tiptap/pm/model'
|
|
1
|
+
import type { NodeType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { PasteRuleFinder } from '../PasteRule.js'
|
|
4
|
+
import { PasteRule } from '../PasteRule.js'
|
|
5
|
+
import type { ExtendedRegExpMatchArray, JSONContent } from '../types.js'
|
|
5
6
|
import { callOrReturn } from '../utilities/index.js'
|
|
6
7
|
|
|
7
8
|
/**
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Mark as ProseMirrorMark, Node as ProseMirrorNode, ParseOptions, Slice } from '@tiptap/pm/model'
|
|
2
|
-
import { EditorState, Transaction } from '@tiptap/pm/state'
|
|
3
|
-
import { Mappable, Transform } from '@tiptap/pm/transform'
|
|
4
|
-
import {
|
|
1
|
+
import type { Mark as ProseMirrorMark, Node as ProseMirrorNode, ParseOptions, Slice } from '@tiptap/pm/model'
|
|
2
|
+
import type { EditorState, Transaction } from '@tiptap/pm/state'
|
|
3
|
+
import type { Mappable, Transform } from '@tiptap/pm/transform'
|
|
4
|
+
import type {
|
|
5
5
|
Decoration,
|
|
6
6
|
DecorationAttrs,
|
|
7
7
|
EditorProps,
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
ViewMutationRecord,
|
|
14
14
|
} from '@tiptap/pm/view'
|
|
15
15
|
|
|
16
|
-
import { Editor } from './Editor.js'
|
|
17
|
-
import {
|
|
18
|
-
import { Commands, ExtensionConfig, MarkConfig, NodeConfig } from './index.js'
|
|
19
|
-
import { Mark } from './Mark.js'
|
|
20
|
-
import { Node } from './Node.js'
|
|
16
|
+
import type { Editor } from './Editor.js'
|
|
17
|
+
import type { Extendable } from './Extendable.js'
|
|
18
|
+
import type { Commands, ExtensionConfig, MarkConfig, NodeConfig } from './index.js'
|
|
19
|
+
import type { Mark } from './Mark.js'
|
|
20
|
+
import type { Node } from './Node.js'
|
|
21
21
|
|
|
22
22
|
export type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig
|
|
23
|
-
export type AnyExtension =
|
|
23
|
+
export type AnyExtension = Extendable
|
|
24
24
|
export type Extensions = AnyExtension[]
|
|
25
25
|
|
|
26
26
|
export type ParentConfig<T> = Partial<{
|