@tiptap/core 2.5.0-beta.1 → 2.5.0-beta.3
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 +4534 -4528
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4534 -4526
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +4534 -4528
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/CommandManager.d.ts +20 -20
- package/dist/packages/core/src/Editor.d.ts +161 -161
- package/dist/packages/core/src/EventEmitter.d.ts +11 -11
- package/dist/packages/core/src/Extension.d.ts +343 -342
- package/dist/packages/core/src/ExtensionManager.d.ts +55 -55
- package/dist/packages/core/src/InputRule.d.ts +42 -42
- package/dist/packages/core/src/Mark.d.ts +451 -450
- package/dist/packages/core/src/Node.d.ts +611 -609
- package/dist/packages/core/src/NodePos.d.ts +44 -44
- package/dist/packages/core/src/NodeView.d.ts +31 -31
- package/dist/packages/core/src/PasteRule.d.ts +50 -50
- package/dist/packages/core/src/Tracker.d.ts +11 -11
- package/dist/packages/core/src/commands/blur.d.ts +13 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +14 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +13 -13
- package/dist/packages/core/src/commands/command.d.ts +18 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +13 -13
- package/dist/packages/core/src/commands/cut.d.ts +20 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +13 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +15 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +14 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +13 -13
- package/dist/packages/core/src/commands/enter.d.ts +13 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +13 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +25 -25
- package/dist/packages/core/src/commands/first.d.ts +14 -14
- package/dist/packages/core/src/commands/focus.d.ts +27 -27
- package/dist/packages/core/src/commands/forEach.d.ts +14 -14
- package/dist/packages/core/src/commands/index.d.ts +55 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +34 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +47 -47
- package/dist/packages/core/src/commands/join.d.ts +41 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +13 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +13 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +12 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +12 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +14 -14
- package/dist/packages/core/src/commands/lift.d.ts +17 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +13 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +15 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +13 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +16 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +13 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +13 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +13 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +13 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +13 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +13 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +13 -13
- package/dist/packages/core/src/commands/setContent.d.ts +40 -40
- package/dist/packages/core/src/commands/setMark.d.ts +15 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +15 -15
- package/dist/packages/core/src/commands/setNode.d.ts +16 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +14 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +14 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +15 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +17 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +15 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +18 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +30 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +17 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +16 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +13 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +13 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +25 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +24 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +16 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +16 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +5 -5
- package/dist/packages/core/src/extensions/commands.d.ts +3 -3
- package/dist/packages/core/src/extensions/editable.d.ts +2 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -2
- package/dist/packages/core/src/extensions/index.d.ts +6 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +2 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +2 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +10 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +10 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +12 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +15 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +7 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +9 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +10 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +16 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +17 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +8 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +8 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +12 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +9 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +9 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +11 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +4 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +10 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +8 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +8 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +9 -9
- package/dist/packages/core/src/helpers/getText.d.ts +15 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +14 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +8 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +8 -8
- package/dist/packages/core/src/helpers/index.d.ts +50 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +2 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +2 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +2 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -2
- package/dist/packages/core/src/helpers/isList.d.ts +2 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -9
- package/dist/packages/core/src/index.d.ts +24 -24
- package/dist/packages/core/src/inputRules/index.d.ts +5 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +13 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +23 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +10 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +15 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +28 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +3 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +13 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +13 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +10 -10
- package/dist/packages/core/src/style.d.ts +1 -1
- package/dist/packages/core/src/types.d.ts +250 -244
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -1
- package/dist/packages/core/src/utilities/index.d.ts +20 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +1 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +1 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +1 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -1
- package/dist/packages/core/src/utilities/isString.d.ts +1 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +1 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +1 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -8
- package/package.json +2 -2
- package/src/Extension.ts +3 -1
- package/src/ExtensionManager.ts +1 -1
- package/src/Mark.ts +3 -1
- package/src/Node.ts +4 -1
- package/src/commands/insertContentAt.ts +1 -1
- package/src/commands/updateAttributes.ts +40 -25
- package/src/helpers/getAttributesFromExtensions.ts +2 -3
- package/src/helpers/getSchemaByResolvedExtensions.ts +4 -2
- package/src/helpers/injectExtensionAttributesToParseRule.ts +4 -4
- package/src/helpers/isNodeEmpty.ts +6 -3
- package/src/types.ts +8 -2
- package/src/utilities/mergeDeep.ts +3 -7
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { Fragment, Node, ResolvedPos } from '@tiptap/pm/model';
|
|
2
|
-
import { Editor } from './Editor.js';
|
|
3
|
-
import { Content, Range } from './types.js';
|
|
4
|
-
export declare class NodePos {
|
|
5
|
-
private resolvedPos;
|
|
6
|
-
private isBlock;
|
|
7
|
-
private editor;
|
|
8
|
-
private get name();
|
|
9
|
-
constructor(pos: ResolvedPos, editor: Editor, isBlock?: boolean, node?: Node | null);
|
|
10
|
-
private currentNode;
|
|
11
|
-
get node(): Node;
|
|
12
|
-
get element(): HTMLElement;
|
|
13
|
-
actualDepth: number | null;
|
|
14
|
-
get depth(): number;
|
|
15
|
-
get pos(): number;
|
|
16
|
-
get content(): Fragment;
|
|
17
|
-
set content(content: Content);
|
|
18
|
-
get attributes(): {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
};
|
|
21
|
-
get textContent(): string;
|
|
22
|
-
get size(): number;
|
|
23
|
-
get from(): number;
|
|
24
|
-
get range(): Range;
|
|
25
|
-
get to(): number;
|
|
26
|
-
get parent(): NodePos | null;
|
|
27
|
-
get before(): NodePos | null;
|
|
28
|
-
get after(): NodePos | null;
|
|
29
|
-
get children(): NodePos[];
|
|
30
|
-
get firstChild(): NodePos | null;
|
|
31
|
-
get lastChild(): NodePos | null;
|
|
32
|
-
closest(selector: string, attributes?: {
|
|
33
|
-
[key: string]: any;
|
|
34
|
-
}): NodePos | null;
|
|
35
|
-
querySelector(selector: string, attributes?: {
|
|
36
|
-
[key: string]: any;
|
|
37
|
-
}): NodePos | null;
|
|
38
|
-
querySelectorAll(selector: string, attributes?: {
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
}, firstItemOnly?: boolean): NodePos[];
|
|
41
|
-
setAttribute(attributes: {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}): void;
|
|
44
|
-
}
|
|
1
|
+
import { Fragment, Node, ResolvedPos } from '@tiptap/pm/model';
|
|
2
|
+
import { Editor } from './Editor.js';
|
|
3
|
+
import { Content, Range } from './types.js';
|
|
4
|
+
export declare class NodePos {
|
|
5
|
+
private resolvedPos;
|
|
6
|
+
private isBlock;
|
|
7
|
+
private editor;
|
|
8
|
+
private get name();
|
|
9
|
+
constructor(pos: ResolvedPos, editor: Editor, isBlock?: boolean, node?: Node | null);
|
|
10
|
+
private currentNode;
|
|
11
|
+
get node(): Node;
|
|
12
|
+
get element(): HTMLElement;
|
|
13
|
+
actualDepth: number | null;
|
|
14
|
+
get depth(): number;
|
|
15
|
+
get pos(): number;
|
|
16
|
+
get content(): Fragment;
|
|
17
|
+
set content(content: Content);
|
|
18
|
+
get attributes(): {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
get textContent(): string;
|
|
22
|
+
get size(): number;
|
|
23
|
+
get from(): number;
|
|
24
|
+
get range(): Range;
|
|
25
|
+
get to(): number;
|
|
26
|
+
get parent(): NodePos | null;
|
|
27
|
+
get before(): NodePos | null;
|
|
28
|
+
get after(): NodePos | null;
|
|
29
|
+
get children(): NodePos[];
|
|
30
|
+
get firstChild(): NodePos | null;
|
|
31
|
+
get lastChild(): NodePos | null;
|
|
32
|
+
closest(selector: string, attributes?: {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}): NodePos | null;
|
|
35
|
+
querySelector(selector: string, attributes?: {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}): NodePos | null;
|
|
38
|
+
querySelectorAll(selector: string, attributes?: {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}, firstItemOnly?: boolean): NodePos[];
|
|
41
|
+
setAttribute(attributes: {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}): void;
|
|
44
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
-
import { NodeView as ProseMirrorNodeView } from '@tiptap/pm/view';
|
|
3
|
-
import { Editor as CoreEditor } from './Editor.js';
|
|
4
|
-
import { Node } from './Node.js';
|
|
5
|
-
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Node views are used to customize the rendered DOM structure of a node.
|
|
8
|
-
* @see https://tiptap.dev/guide/node-views
|
|
9
|
-
*/
|
|
10
|
-
export declare class NodeView<Component, NodeEditor extends CoreEditor = CoreEditor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> implements ProseMirrorNodeView {
|
|
11
|
-
component: Component;
|
|
12
|
-
editor: NodeEditor;
|
|
13
|
-
options: Options;
|
|
14
|
-
extension: Node;
|
|
15
|
-
node: ProseMirrorNode;
|
|
16
|
-
decorations: DecorationWithType[];
|
|
17
|
-
getPos: any;
|
|
18
|
-
isDragging: boolean;
|
|
19
|
-
constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
|
|
20
|
-
mount(): void;
|
|
21
|
-
get dom(): HTMLElement;
|
|
22
|
-
get contentDOM(): HTMLElement | null;
|
|
23
|
-
onDragStart(event: DragEvent): void;
|
|
24
|
-
stopEvent(event: Event): boolean;
|
|
25
|
-
ignoreMutation(mutation: MutationRecord | {
|
|
26
|
-
type: 'selection';
|
|
27
|
-
target: Element;
|
|
28
|
-
}): boolean;
|
|
29
|
-
updateAttributes(attributes: {}): void;
|
|
30
|
-
deleteNode(): void;
|
|
31
|
-
}
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { NodeView as ProseMirrorNodeView } from '@tiptap/pm/view';
|
|
3
|
+
import { Editor as CoreEditor } from './Editor.js';
|
|
4
|
+
import { Node } from './Node.js';
|
|
5
|
+
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Node views are used to customize the rendered DOM structure of a node.
|
|
8
|
+
* @see https://tiptap.dev/guide/node-views
|
|
9
|
+
*/
|
|
10
|
+
export declare class NodeView<Component, NodeEditor extends CoreEditor = CoreEditor, Options extends NodeViewRendererOptions = NodeViewRendererOptions> implements ProseMirrorNodeView {
|
|
11
|
+
component: Component;
|
|
12
|
+
editor: NodeEditor;
|
|
13
|
+
options: Options;
|
|
14
|
+
extension: Node;
|
|
15
|
+
node: ProseMirrorNode;
|
|
16
|
+
decorations: DecorationWithType[];
|
|
17
|
+
getPos: any;
|
|
18
|
+
isDragging: boolean;
|
|
19
|
+
constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
|
|
20
|
+
mount(): void;
|
|
21
|
+
get dom(): HTMLElement;
|
|
22
|
+
get contentDOM(): HTMLElement | null;
|
|
23
|
+
onDragStart(event: DragEvent): void;
|
|
24
|
+
stopEvent(event: Event): boolean;
|
|
25
|
+
ignoreMutation(mutation: MutationRecord | {
|
|
26
|
+
type: 'selection';
|
|
27
|
+
target: Element;
|
|
28
|
+
}): boolean;
|
|
29
|
+
updateAttributes(attributes: {}): void;
|
|
30
|
+
deleteNode(): void;
|
|
31
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { EditorState, Plugin } from '@tiptap/pm/state';
|
|
2
|
-
import { Editor } from './Editor.js';
|
|
3
|
-
import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js';
|
|
4
|
-
export
|
|
5
|
-
index: number;
|
|
6
|
-
text: string;
|
|
7
|
-
replaceWith?: string;
|
|
8
|
-
match?: RegExpMatchArray;
|
|
9
|
-
data?: Record<string, any>;
|
|
10
|
-
};
|
|
11
|
-
export
|
|
12
|
-
/**
|
|
13
|
-
* Paste rules are used to react to pasted content.
|
|
14
|
-
* @see https://tiptap.dev/guide/custom-extensions/#paste-rules
|
|
15
|
-
*/
|
|
16
|
-
export declare class PasteRule {
|
|
17
|
-
find: PasteRuleFinder;
|
|
18
|
-
handler: (props: {
|
|
19
|
-
state: EditorState;
|
|
20
|
-
range: Range;
|
|
21
|
-
match: ExtendedRegExpMatchArray;
|
|
22
|
-
commands: SingleCommands;
|
|
23
|
-
chain: () => ChainedCommands;
|
|
24
|
-
can: () => CanCommands;
|
|
25
|
-
pasteEvent: ClipboardEvent | null;
|
|
26
|
-
dropEvent: DragEvent | null;
|
|
27
|
-
}) => void | null;
|
|
28
|
-
constructor(config: {
|
|
29
|
-
find: PasteRuleFinder;
|
|
30
|
-
handler: (props: {
|
|
31
|
-
can: () => CanCommands;
|
|
32
|
-
chain: () => ChainedCommands;
|
|
33
|
-
commands: SingleCommands;
|
|
34
|
-
dropEvent: DragEvent | null;
|
|
35
|
-
match: ExtendedRegExpMatchArray;
|
|
36
|
-
pasteEvent: ClipboardEvent | null;
|
|
37
|
-
range: Range;
|
|
38
|
-
state: EditorState;
|
|
39
|
-
}) => void | null;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Create an paste rules plugin. When enabled, it will cause pasted
|
|
44
|
-
* text that matches any of the given rules to trigger the rule’s
|
|
45
|
-
* action.
|
|
46
|
-
*/
|
|
47
|
-
export declare function pasteRulesPlugin(props: {
|
|
48
|
-
editor: Editor;
|
|
49
|
-
rules: PasteRule[];
|
|
50
|
-
}): Plugin[];
|
|
1
|
+
import { EditorState, Plugin } from '@tiptap/pm/state';
|
|
2
|
+
import { Editor } from './Editor.js';
|
|
3
|
+
import { CanCommands, ChainedCommands, ExtendedRegExpMatchArray, Range, SingleCommands } from './types.js';
|
|
4
|
+
export type PasteRuleMatch = {
|
|
5
|
+
index: number;
|
|
6
|
+
text: string;
|
|
7
|
+
replaceWith?: string;
|
|
8
|
+
match?: RegExpMatchArray;
|
|
9
|
+
data?: Record<string, any>;
|
|
10
|
+
};
|
|
11
|
+
export type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
|
|
12
|
+
/**
|
|
13
|
+
* Paste rules are used to react to pasted content.
|
|
14
|
+
* @see https://tiptap.dev/guide/custom-extensions/#paste-rules
|
|
15
|
+
*/
|
|
16
|
+
export declare class PasteRule {
|
|
17
|
+
find: PasteRuleFinder;
|
|
18
|
+
handler: (props: {
|
|
19
|
+
state: EditorState;
|
|
20
|
+
range: Range;
|
|
21
|
+
match: ExtendedRegExpMatchArray;
|
|
22
|
+
commands: SingleCommands;
|
|
23
|
+
chain: () => ChainedCommands;
|
|
24
|
+
can: () => CanCommands;
|
|
25
|
+
pasteEvent: ClipboardEvent | null;
|
|
26
|
+
dropEvent: DragEvent | null;
|
|
27
|
+
}) => void | null;
|
|
28
|
+
constructor(config: {
|
|
29
|
+
find: PasteRuleFinder;
|
|
30
|
+
handler: (props: {
|
|
31
|
+
can: () => CanCommands;
|
|
32
|
+
chain: () => ChainedCommands;
|
|
33
|
+
commands: SingleCommands;
|
|
34
|
+
dropEvent: DragEvent | null;
|
|
35
|
+
match: ExtendedRegExpMatchArray;
|
|
36
|
+
pasteEvent: ClipboardEvent | null;
|
|
37
|
+
range: Range;
|
|
38
|
+
state: EditorState;
|
|
39
|
+
}) => void | null;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create an paste rules plugin. When enabled, it will cause pasted
|
|
44
|
+
* text that matches any of the given rules to trigger the rule’s
|
|
45
|
+
* action.
|
|
46
|
+
*/
|
|
47
|
+
export declare function pasteRulesPlugin(props: {
|
|
48
|
+
editor: Editor;
|
|
49
|
+
rules: PasteRule[];
|
|
50
|
+
}): Plugin[];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Transaction } from '@tiptap/pm/state';
|
|
2
|
-
export interface TrackerResult {
|
|
3
|
-
position: number;
|
|
4
|
-
deleted: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare class Tracker {
|
|
7
|
-
transaction: Transaction;
|
|
8
|
-
currentStep: number;
|
|
9
|
-
constructor(transaction: Transaction);
|
|
10
|
-
map(position: number): TrackerResult;
|
|
11
|
-
}
|
|
1
|
+
import { Transaction } from '@tiptap/pm/state';
|
|
2
|
+
export interface TrackerResult {
|
|
3
|
+
position: number;
|
|
4
|
+
deleted: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class Tracker {
|
|
7
|
+
transaction: Transaction;
|
|
8
|
+
currentStep: number;
|
|
9
|
+
constructor(transaction: Transaction);
|
|
10
|
+
map(position: number): TrackerResult;
|
|
11
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
blur: {
|
|
5
|
-
/**
|
|
6
|
-
* Removes focus from the editor.
|
|
7
|
-
* @example editor.commands.blur()
|
|
8
|
-
*/
|
|
9
|
-
blur: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const blur: RawCommands['blur'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
blur: {
|
|
5
|
+
/**
|
|
6
|
+
* Removes focus from the editor.
|
|
7
|
+
* @example editor.commands.blur()
|
|
8
|
+
*/
|
|
9
|
+
blur: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const blur: RawCommands['blur'];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
clearContent: {
|
|
5
|
-
/**
|
|
6
|
-
* Clear the whole document.
|
|
7
|
-
* @param emitUpdate Whether to emit an update event.
|
|
8
|
-
* @example editor.commands.clearContent()
|
|
9
|
-
*/
|
|
10
|
-
clearContent: (emitUpdate?: boolean) => ReturnType;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export declare const clearContent: RawCommands['clearContent'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
clearContent: {
|
|
5
|
+
/**
|
|
6
|
+
* Clear the whole document.
|
|
7
|
+
* @param emitUpdate Whether to emit an update event.
|
|
8
|
+
* @example editor.commands.clearContent()
|
|
9
|
+
*/
|
|
10
|
+
clearContent: (emitUpdate?: boolean) => ReturnType;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const clearContent: RawCommands['clearContent'];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
clearNodes: {
|
|
5
|
-
/**
|
|
6
|
-
* Normalize nodes to a simple paragraph.
|
|
7
|
-
* @example editor.commands.clearNodes()
|
|
8
|
-
*/
|
|
9
|
-
clearNodes: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const clearNodes: RawCommands['clearNodes'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
clearNodes: {
|
|
5
|
+
/**
|
|
6
|
+
* Normalize nodes to a simple paragraph.
|
|
7
|
+
* @example editor.commands.clearNodes()
|
|
8
|
+
*/
|
|
9
|
+
clearNodes: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const clearNodes: RawCommands['clearNodes'];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Command, RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
command: {
|
|
5
|
-
/**
|
|
6
|
-
* Define a command inline.
|
|
7
|
-
* @param fn The command function.
|
|
8
|
-
* @example
|
|
9
|
-
* editor.commands.command(({ tr, state }) => {
|
|
10
|
-
* ...
|
|
11
|
-
* return true
|
|
12
|
-
* })
|
|
13
|
-
*/
|
|
14
|
-
command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export declare const command: RawCommands['command'];
|
|
1
|
+
import { Command, RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
command: {
|
|
5
|
+
/**
|
|
6
|
+
* Define a command inline.
|
|
7
|
+
* @param fn The command function.
|
|
8
|
+
* @example
|
|
9
|
+
* editor.commands.command(({ tr, state }) => {
|
|
10
|
+
* ...
|
|
11
|
+
* return true
|
|
12
|
+
* })
|
|
13
|
+
*/
|
|
14
|
+
command: (fn: (props: Parameters<Command>[0]) => boolean) => ReturnType;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export declare const command: RawCommands['command'];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
createParagraphNear: {
|
|
5
|
-
/**
|
|
6
|
-
* Create a paragraph nearby.
|
|
7
|
-
* @example editor.commands.createParagraphNear()
|
|
8
|
-
*/
|
|
9
|
-
createParagraphNear: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const createParagraphNear: RawCommands['createParagraphNear'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
createParagraphNear: {
|
|
5
|
+
/**
|
|
6
|
+
* Create a paragraph nearby.
|
|
7
|
+
* @example editor.commands.createParagraphNear()
|
|
8
|
+
*/
|
|
9
|
+
createParagraphNear: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const createParagraphNear: RawCommands['createParagraphNear'];
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
cut: {
|
|
5
|
-
/**
|
|
6
|
-
* Cuts content from a range and inserts it at a given position.
|
|
7
|
-
* @param range The range to cut.
|
|
8
|
-
* @param range.from The start position of the range.
|
|
9
|
-
* @param range.to The end position of the range.
|
|
10
|
-
* @param targetPos The position to insert the content at.
|
|
11
|
-
* @example editor.commands.cut({ from: 1, to: 3 }, 5)
|
|
12
|
-
*/
|
|
13
|
-
cut: ({ from, to }: {
|
|
14
|
-
from: number;
|
|
15
|
-
to: number;
|
|
16
|
-
}, targetPos: number) => ReturnType;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export declare const cut: RawCommands['cut'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
cut: {
|
|
5
|
+
/**
|
|
6
|
+
* Cuts content from a range and inserts it at a given position.
|
|
7
|
+
* @param range The range to cut.
|
|
8
|
+
* @param range.from The start position of the range.
|
|
9
|
+
* @param range.to The end position of the range.
|
|
10
|
+
* @param targetPos The position to insert the content at.
|
|
11
|
+
* @example editor.commands.cut({ from: 1, to: 3 }, 5)
|
|
12
|
+
*/
|
|
13
|
+
cut: ({ from, to }: {
|
|
14
|
+
from: number;
|
|
15
|
+
to: number;
|
|
16
|
+
}, targetPos: number) => ReturnType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const cut: RawCommands['cut'];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
deleteCurrentNode: {
|
|
5
|
-
/**
|
|
6
|
-
* Delete the node that currently has the selection anchor.
|
|
7
|
-
* @example editor.commands.deleteCurrentNode()
|
|
8
|
-
*/
|
|
9
|
-
deleteCurrentNode: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const deleteCurrentNode: RawCommands['deleteCurrentNode'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
deleteCurrentNode: {
|
|
5
|
+
/**
|
|
6
|
+
* Delete the node that currently has the selection anchor.
|
|
7
|
+
* @example editor.commands.deleteCurrentNode()
|
|
8
|
+
*/
|
|
9
|
+
deleteCurrentNode: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const deleteCurrentNode: RawCommands['deleteCurrentNode'];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
-
import { RawCommands } from '../types.js';
|
|
3
|
-
declare module '@tiptap/core' {
|
|
4
|
-
interface Commands<ReturnType> {
|
|
5
|
-
deleteNode: {
|
|
6
|
-
/**
|
|
7
|
-
* Delete a node with a given type or name.
|
|
8
|
-
* @param typeOrName The type or name of the node.
|
|
9
|
-
* @example editor.commands.deleteNode('paragraph')
|
|
10
|
-
*/
|
|
11
|
-
deleteNode: (typeOrName: string | NodeType) => ReturnType;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export declare const deleteNode: RawCommands['deleteNode'];
|
|
1
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { RawCommands } from '../types.js';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
deleteNode: {
|
|
6
|
+
/**
|
|
7
|
+
* Delete a node with a given type or name.
|
|
8
|
+
* @param typeOrName The type or name of the node.
|
|
9
|
+
* @example editor.commands.deleteNode('paragraph')
|
|
10
|
+
*/
|
|
11
|
+
deleteNode: (typeOrName: string | NodeType) => ReturnType;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare const deleteNode: RawCommands['deleteNode'];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Range, RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
deleteRange: {
|
|
5
|
-
/**
|
|
6
|
-
* Delete a given range.
|
|
7
|
-
* @param range The range to delete.
|
|
8
|
-
* @example editor.commands.deleteRange({ from: 1, to: 3 })
|
|
9
|
-
*/
|
|
10
|
-
deleteRange: (range: Range) => ReturnType;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export declare const deleteRange: RawCommands['deleteRange'];
|
|
1
|
+
import { Range, RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
deleteRange: {
|
|
5
|
+
/**
|
|
6
|
+
* Delete a given range.
|
|
7
|
+
* @param range The range to delete.
|
|
8
|
+
* @example editor.commands.deleteRange({ from: 1, to: 3 })
|
|
9
|
+
*/
|
|
10
|
+
deleteRange: (range: Range) => ReturnType;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const deleteRange: RawCommands['deleteRange'];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
deleteSelection: {
|
|
5
|
-
/**
|
|
6
|
-
* Delete the selection, if there is one.
|
|
7
|
-
* @example editor.commands.deleteSelection()
|
|
8
|
-
*/
|
|
9
|
-
deleteSelection: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const deleteSelection: RawCommands['deleteSelection'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
deleteSelection: {
|
|
5
|
+
/**
|
|
6
|
+
* Delete the selection, if there is one.
|
|
7
|
+
* @example editor.commands.deleteSelection()
|
|
8
|
+
*/
|
|
9
|
+
deleteSelection: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const deleteSelection: RawCommands['deleteSelection'];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
enter: {
|
|
5
|
-
/**
|
|
6
|
-
* Trigger enter.
|
|
7
|
-
* @example editor.commands.enter()
|
|
8
|
-
*/
|
|
9
|
-
enter: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const enter: RawCommands['enter'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
enter: {
|
|
5
|
+
/**
|
|
6
|
+
* Trigger enter.
|
|
7
|
+
* @example editor.commands.enter()
|
|
8
|
+
*/
|
|
9
|
+
enter: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const enter: RawCommands['enter'];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { RawCommands } from '../types.js';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
exitCode: {
|
|
5
|
-
/**
|
|
6
|
-
* Exit from a code block.
|
|
7
|
-
* @example editor.commands.exitCode()
|
|
8
|
-
*/
|
|
9
|
-
exitCode: () => ReturnType;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export declare const exitCode: RawCommands['exitCode'];
|
|
1
|
+
import { RawCommands } from '../types.js';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
exitCode: {
|
|
5
|
+
/**
|
|
6
|
+
* Exit from a code block.
|
|
7
|
+
* @example editor.commands.exitCode()
|
|
8
|
+
*/
|
|
9
|
+
exitCode: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export declare const exitCode: RawCommands['exitCode'];
|