@tiptap/core 3.0.0-next.1 → 3.0.0-next.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 +403 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +177 -53
- package/dist/index.d.ts +177 -53
- package/dist/index.js +375 -108
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Editor.ts +60 -10
- package/src/EventEmitter.ts +9 -0
- package/src/ExtensionManager.ts +16 -11
- package/src/InputRule.ts +45 -30
- package/src/Node.ts +19 -0
- package/src/NodePos.ts +9 -4
- package/src/NodeView.ts +43 -12
- package/src/PasteRule.ts +96 -42
- package/src/commands/focus.ts +1 -6
- package/src/commands/insertContent.ts +9 -9
- package/src/commands/insertContentAt.ts +23 -3
- package/src/commands/selectAll.ts +10 -5
- package/src/commands/setContent.ts +10 -14
- package/src/commands/setNode.ts +9 -2
- package/src/commands/toggleNode.ts +11 -2
- package/src/commands/updateAttributes.ts +72 -12
- package/src/extensions/drop.ts +26 -0
- package/src/extensions/index.ts +2 -0
- package/src/extensions/keymap.ts +5 -2
- package/src/extensions/paste.ts +26 -0
- package/src/helpers/createDocument.ts +4 -2
- package/src/helpers/createNodeFromContent.ts +11 -2
- package/src/helpers/getMarkRange.ts +35 -8
- package/src/helpers/getRenderedAttributes.ts +3 -0
- package/src/helpers/getSchemaByResolvedExtensions.ts +2 -1
- package/src/inputRules/markInputRule.ts +1 -1
- package/src/inputRules/nodeInputRule.ts +1 -1
- package/src/inputRules/textInputRule.ts +1 -1
- package/src/inputRules/textblockTypeInputRule.ts +1 -1
- package/src/inputRules/wrappingInputRule.ts +1 -1
- package/src/pasteRules/markPasteRule.ts +1 -1
- package/src/pasteRules/nodePasteRule.ts +1 -1
- package/src/pasteRules/textPasteRule.ts +1 -1
- package/src/types.ts +107 -19
- package/src/utilities/mergeAttributes.ts +18 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EditorState, Plugin, Transaction, PluginKey, Selection, NodeSelection, TextSelection } from '@tiptap/pm/state';
|
|
2
|
-
import { NodeType, NodeSpec, Node as Node$1, DOMOutputSpec, MarkType, MarkSpec, Mark as Mark$1, ParseOptions, Schema, ResolvedPos, Fragment, ContentMatch, ParseRule } from '@tiptap/pm/model';
|
|
3
|
-
import { NodeView as NodeView$1, EditorProps, EditorView, Decoration } from '@tiptap/pm/view';
|
|
4
|
-
import { Transform } from '@tiptap/pm/transform';
|
|
2
|
+
import { NodeType, NodeSpec, Node as Node$1, DOMOutputSpec, MarkType, MarkSpec, Mark as Mark$1, Slice, ParseOptions, Schema, ResolvedPos, Fragment, ContentMatch, ParseRule } from '@tiptap/pm/model';
|
|
3
|
+
import { NodeView as NodeView$1, EditorProps, EditorView, Decoration, DecorationAttrs, ViewMutationRecord, NodeViewConstructor } from '@tiptap/pm/view';
|
|
4
|
+
import { Mappable, Transform } from '@tiptap/pm/transform';
|
|
5
5
|
import * as prosemirror_model from 'prosemirror-model';
|
|
6
6
|
|
|
7
7
|
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
@@ -12,6 +12,7 @@ declare class EventEmitter<T extends Record<string, any>> {
|
|
|
12
12
|
on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
|
|
13
13
|
emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
|
|
14
14
|
off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
|
|
15
|
+
once<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
|
|
15
16
|
removeAllListeners(): void;
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -65,7 +66,7 @@ type PasteRuleMatch = {
|
|
|
65
66
|
type PasteRuleFinder = RegExp | ((text: string, event?: ClipboardEvent | null) => PasteRuleMatch[] | null | undefined);
|
|
66
67
|
/**
|
|
67
68
|
* Paste rules are used to react to pasted content.
|
|
68
|
-
* @see https://tiptap.dev/
|
|
69
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
|
|
69
70
|
*/
|
|
70
71
|
declare class PasteRule {
|
|
71
72
|
find: PasteRuleFinder;
|
|
@@ -586,6 +587,22 @@ declare module '@tiptap/core' {
|
|
|
586
587
|
parent: ParentConfig<NodeConfig<Options, Storage>>['whitespace'];
|
|
587
588
|
editor?: Editor;
|
|
588
589
|
}) => NodeSpec['whitespace']);
|
|
590
|
+
/**
|
|
591
|
+
* Allows a **single** node to be set as linebreak equivalent (e.g. hardBreak).
|
|
592
|
+
* When converting between block types that have whitespace set to "pre"
|
|
593
|
+
* and don't support the linebreak node (e.g. codeBlock) and other block types
|
|
594
|
+
* that do support the linebreak node (e.g. paragraphs) - this node will be used
|
|
595
|
+
* as the linebreak instead of stripping the newline.
|
|
596
|
+
*
|
|
597
|
+
* See [linebreakReplacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement).
|
|
598
|
+
*/
|
|
599
|
+
linebreakReplacement?: NodeSpec['linebreakReplacement'] | ((this: {
|
|
600
|
+
name: string;
|
|
601
|
+
options: Options;
|
|
602
|
+
storage: Storage;
|
|
603
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['linebreakReplacement'];
|
|
604
|
+
editor?: Editor;
|
|
605
|
+
}) => NodeSpec['linebreakReplacement']);
|
|
589
606
|
/**
|
|
590
607
|
* When enabled, enables both
|
|
591
608
|
* [`definingAsContext`](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext) and
|
|
@@ -1544,6 +1561,17 @@ interface EditorEvents {
|
|
|
1544
1561
|
transaction: Transaction;
|
|
1545
1562
|
};
|
|
1546
1563
|
destroy: void;
|
|
1564
|
+
paste: {
|
|
1565
|
+
editor: Editor;
|
|
1566
|
+
event: ClipboardEvent;
|
|
1567
|
+
slice: Slice;
|
|
1568
|
+
};
|
|
1569
|
+
drop: {
|
|
1570
|
+
editor: Editor;
|
|
1571
|
+
event: DragEvent;
|
|
1572
|
+
slice: Slice;
|
|
1573
|
+
moved: boolean;
|
|
1574
|
+
};
|
|
1547
1575
|
}
|
|
1548
1576
|
type EnableRules = (AnyExtension | string)[] | boolean;
|
|
1549
1577
|
interface EditorOptions {
|
|
@@ -1563,7 +1591,24 @@ interface EditorOptions {
|
|
|
1563
1591
|
};
|
|
1564
1592
|
enableInputRules: EnableRules;
|
|
1565
1593
|
enablePasteRules: EnableRules;
|
|
1566
|
-
|
|
1594
|
+
/**
|
|
1595
|
+
* Determines whether core extensions are enabled.
|
|
1596
|
+
*
|
|
1597
|
+
* If set to `false`, all core extensions will be disabled.
|
|
1598
|
+
* To disable specific core extensions, provide an object where the keys are the extension names and the values are `false`.
|
|
1599
|
+
* Extensions not listed in the object will remain enabled.
|
|
1600
|
+
*
|
|
1601
|
+
* @example
|
|
1602
|
+
* // Disable all core extensions
|
|
1603
|
+
* enabledCoreExtensions: false
|
|
1604
|
+
*
|
|
1605
|
+
* @example
|
|
1606
|
+
* // Disable only the keymap core extension
|
|
1607
|
+
* enabledCoreExtensions: { keymap: false }
|
|
1608
|
+
*
|
|
1609
|
+
* @default true
|
|
1610
|
+
*/
|
|
1611
|
+
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste', false>>;
|
|
1567
1612
|
/**
|
|
1568
1613
|
* If `true`, the editor will check the content for errors on initialization.
|
|
1569
1614
|
* Emitting the `contentError` event if the content is invalid.
|
|
@@ -1584,6 +1629,8 @@ interface EditorOptions {
|
|
|
1584
1629
|
onFocus: (props: EditorEvents['focus']) => void;
|
|
1585
1630
|
onBlur: (props: EditorEvents['blur']) => void;
|
|
1586
1631
|
onDestroy: (props: EditorEvents['destroy']) => void;
|
|
1632
|
+
onPaste: (e: ClipboardEvent, slice: Slice) => void;
|
|
1633
|
+
onDrop: (e: DragEvent, slice: Slice, moved: boolean) => void;
|
|
1587
1634
|
}
|
|
1588
1635
|
type HTMLContent = string;
|
|
1589
1636
|
type JSONContent = {
|
|
@@ -1654,40 +1701,78 @@ type ValuesOf<T> = T[keyof T];
|
|
|
1654
1701
|
type KeysWithTypeOf<T, Type> = {
|
|
1655
1702
|
[P in keyof T]: T[P] extends Type ? P : never;
|
|
1656
1703
|
}[keyof T];
|
|
1704
|
+
type DOMNode = InstanceType<typeof window.Node>;
|
|
1705
|
+
/**
|
|
1706
|
+
* prosemirror-view does not export the `type` property of `Decoration`.
|
|
1707
|
+
* So, this defines the `DecorationType` interface to include the `type` property.
|
|
1708
|
+
*/
|
|
1709
|
+
interface DecorationType {
|
|
1710
|
+
spec: any;
|
|
1711
|
+
map(mapping: Mappable, span: Decoration, offset: number, oldOffset: number): Decoration | null;
|
|
1712
|
+
valid(node: Node, span: Decoration): boolean;
|
|
1713
|
+
eq(other: DecorationType): boolean;
|
|
1714
|
+
destroy(dom: DOMNode): void;
|
|
1715
|
+
readonly attrs: DecorationAttrs;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* prosemirror-view does not export the `type` property of `Decoration`.
|
|
1719
|
+
* This adds the `type` property to the `Decoration` type.
|
|
1720
|
+
*/
|
|
1657
1721
|
type DecorationWithType = Decoration & {
|
|
1658
|
-
type:
|
|
1722
|
+
type: DecorationType;
|
|
1659
1723
|
};
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
node: Node$1;
|
|
1663
|
-
decorations: DecorationWithType[];
|
|
1724
|
+
interface NodeViewProps extends NodeViewRendererProps {
|
|
1725
|
+
decorations: readonly DecorationWithType[];
|
|
1664
1726
|
selected: boolean;
|
|
1665
|
-
extension: Node;
|
|
1666
|
-
getPos: () => number;
|
|
1667
1727
|
updateAttributes: (attributes: Record<string, any>) => void;
|
|
1668
1728
|
deleteNode: () => void;
|
|
1669
|
-
}
|
|
1729
|
+
}
|
|
1670
1730
|
interface NodeViewRendererOptions {
|
|
1671
1731
|
stopEvent: ((props: {
|
|
1672
1732
|
event: Event;
|
|
1673
1733
|
}) => boolean) | null;
|
|
1674
1734
|
ignoreMutation: ((props: {
|
|
1675
|
-
mutation:
|
|
1676
|
-
type: 'selection';
|
|
1677
|
-
target: Element;
|
|
1678
|
-
};
|
|
1735
|
+
mutation: ViewMutationRecord;
|
|
1679
1736
|
}) => boolean) | null;
|
|
1680
1737
|
contentDOMElementTag: string;
|
|
1681
1738
|
}
|
|
1682
|
-
|
|
1739
|
+
interface NodeViewRendererProps {
|
|
1740
|
+
/**
|
|
1741
|
+
* The node that is being rendered.
|
|
1742
|
+
*/
|
|
1743
|
+
node: Parameters<NodeViewConstructor>[0];
|
|
1744
|
+
/**
|
|
1745
|
+
* The editor's view.
|
|
1746
|
+
*/
|
|
1747
|
+
view: Parameters<NodeViewConstructor>[1];
|
|
1748
|
+
/**
|
|
1749
|
+
* A function that can be called to get the node's current position in the document.
|
|
1750
|
+
*/
|
|
1751
|
+
getPos: Parameters<NodeViewConstructor>[2];
|
|
1752
|
+
/**
|
|
1753
|
+
* is an array of node or inline decorations that are active around the node.
|
|
1754
|
+
* They are automatically drawn in the normal way, and you will usually just want to ignore this, but they can also be used as a way to provide context information to the node view without adding it to the document itself.
|
|
1755
|
+
*/
|
|
1756
|
+
decorations: Parameters<NodeViewConstructor>[3];
|
|
1757
|
+
/**
|
|
1758
|
+
* holds the decorations for the node's content. You can safely ignore this if your view has no content or a contentDOM property, since the editor will draw the decorations on the content.
|
|
1759
|
+
* But if you, for example, want to create a nested editor with the content, it may make sense to provide it with the inner decorations.
|
|
1760
|
+
*/
|
|
1761
|
+
innerDecorations: Parameters<NodeViewConstructor>[4];
|
|
1762
|
+
/**
|
|
1763
|
+
* The editor instance.
|
|
1764
|
+
*/
|
|
1683
1765
|
editor: Editor;
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
decorations: Decoration[];
|
|
1766
|
+
/**
|
|
1767
|
+
* The extension that is responsible for the node.
|
|
1768
|
+
*/
|
|
1688
1769
|
extension: Node;
|
|
1689
|
-
|
|
1690
|
-
|
|
1770
|
+
/**
|
|
1771
|
+
* The HTML attributes that should be added to the node's DOM element.
|
|
1772
|
+
*/
|
|
1773
|
+
HTMLAttributes: Record<string, any>;
|
|
1774
|
+
}
|
|
1775
|
+
type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView$1;
|
|
1691
1776
|
type AnyCommands = Record<string, (...args: any[]) => Command>;
|
|
1692
1777
|
type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, {}>>>>;
|
|
1693
1778
|
type RawCommands = {
|
|
@@ -1780,7 +1865,7 @@ declare class ExtensionManager {
|
|
|
1780
1865
|
* Get all node views from the extensions.
|
|
1781
1866
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
1782
1867
|
*/
|
|
1783
|
-
get nodeViews():
|
|
1868
|
+
get nodeViews(): Record<string, NodeViewConstructor>;
|
|
1784
1869
|
/**
|
|
1785
1870
|
* Go through all extensions, create extension storages & setup marks
|
|
1786
1871
|
* & bind editor event listener.
|
|
@@ -2081,7 +2166,7 @@ declare module '@tiptap/core' {
|
|
|
2081
2166
|
/**
|
|
2082
2167
|
* The ProseMirror content to insert.
|
|
2083
2168
|
*/
|
|
2084
|
-
value: Content,
|
|
2169
|
+
value: Content | Node$1 | Fragment,
|
|
2085
2170
|
/**
|
|
2086
2171
|
* Optional options
|
|
2087
2172
|
*/
|
|
@@ -2116,7 +2201,7 @@ declare module '@tiptap/core' {
|
|
|
2116
2201
|
/**
|
|
2117
2202
|
* The ProseMirror content to insert.
|
|
2118
2203
|
*/
|
|
2119
|
-
value: Content,
|
|
2204
|
+
value: Content | Node$1 | Fragment,
|
|
2120
2205
|
/**
|
|
2121
2206
|
* Optional options
|
|
2122
2207
|
*/
|
|
@@ -2406,7 +2491,7 @@ declare module '@tiptap/core' {
|
|
|
2406
2491
|
/**
|
|
2407
2492
|
* The new content.
|
|
2408
2493
|
*/
|
|
2409
|
-
content: Content,
|
|
2494
|
+
content: Content | Fragment | Node$1,
|
|
2410
2495
|
/**
|
|
2411
2496
|
* Whether to emit an update event.
|
|
2412
2497
|
* @default false
|
|
@@ -2712,21 +2797,27 @@ declare module '@tiptap/core' {
|
|
|
2712
2797
|
|
|
2713
2798
|
declare const Commands$1: Extension<any, any>;
|
|
2714
2799
|
|
|
2800
|
+
declare const Drop: Extension<any, any>;
|
|
2801
|
+
|
|
2715
2802
|
declare const Editable: Extension<any, any>;
|
|
2716
2803
|
|
|
2717
2804
|
declare const FocusEvents: Extension<any, any>;
|
|
2718
2805
|
|
|
2719
2806
|
declare const Keymap: Extension<any, any>;
|
|
2720
2807
|
|
|
2808
|
+
declare const Paste: Extension<any, any>;
|
|
2809
|
+
|
|
2721
2810
|
declare const Tabindex: Extension<any, any>;
|
|
2722
2811
|
|
|
2723
2812
|
declare const index_ClipboardTextSerializer: typeof ClipboardTextSerializer;
|
|
2813
|
+
declare const index_Drop: typeof Drop;
|
|
2724
2814
|
declare const index_Editable: typeof Editable;
|
|
2725
2815
|
declare const index_FocusEvents: typeof FocusEvents;
|
|
2726
2816
|
declare const index_Keymap: typeof Keymap;
|
|
2817
|
+
declare const index_Paste: typeof Paste;
|
|
2727
2818
|
declare const index_Tabindex: typeof Tabindex;
|
|
2728
2819
|
declare namespace index {
|
|
2729
|
-
export { index_ClipboardTextSerializer as ClipboardTextSerializer, Commands$1 as Commands, index_Editable as Editable, index_FocusEvents as FocusEvents, index_Keymap as Keymap, index_Tabindex as Tabindex };
|
|
2820
|
+
export { index_ClipboardTextSerializer as ClipboardTextSerializer, Commands$1 as Commands, index_Drop as Drop, index_Editable as Editable, index_FocusEvents as FocusEvents, index_Keymap as Keymap, index_Paste as Paste, index_Tabindex as Tabindex };
|
|
2730
2821
|
}
|
|
2731
2822
|
|
|
2732
2823
|
interface TiptapEditorHTMLElement extends HTMLElement {
|
|
@@ -2744,6 +2835,10 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2744
2835
|
*/
|
|
2745
2836
|
isInitialized: boolean;
|
|
2746
2837
|
extensionStorage: Record<string, any>;
|
|
2838
|
+
/**
|
|
2839
|
+
* A unique ID for this editor instance.
|
|
2840
|
+
*/
|
|
2841
|
+
instanceId: string;
|
|
2747
2842
|
options: EditorOptions;
|
|
2748
2843
|
constructor(options?: Partial<EditorOptions>);
|
|
2749
2844
|
/**
|
|
@@ -2789,14 +2884,16 @@ declare class Editor extends EventEmitter<EditorEvents> {
|
|
|
2789
2884
|
*
|
|
2790
2885
|
* @param plugin A ProseMirror plugin
|
|
2791
2886
|
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
2887
|
+
* @returns The new editor state
|
|
2792
2888
|
*/
|
|
2793
|
-
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]):
|
|
2889
|
+
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
|
|
2794
2890
|
/**
|
|
2795
2891
|
* Unregister a ProseMirror plugin.
|
|
2796
2892
|
*
|
|
2797
|
-
* @param
|
|
2893
|
+
* @param nameOrPluginKeyToRemove The plugins name
|
|
2894
|
+
* @returns The new editor state or undefined if the editor is destroyed
|
|
2798
2895
|
*/
|
|
2799
|
-
unregisterPlugin(
|
|
2896
|
+
unregisterPlugin(nameOrPluginKeyToRemove: string | PluginKey | (string | PluginKey)[]): EditorState | undefined;
|
|
2800
2897
|
/**
|
|
2801
2898
|
* Creates an extension manager.
|
|
2802
2899
|
*/
|
|
@@ -2928,7 +3025,7 @@ declare function createChainableState(config: {
|
|
|
2928
3025
|
* @param parseOptions Options for the parser
|
|
2929
3026
|
* @returns The created Prosemirror document node
|
|
2930
3027
|
*/
|
|
2931
|
-
declare function createDocument(content: Content, schema: Schema, parseOptions?: ParseOptions, options?: {
|
|
3028
|
+
declare function createDocument(content: Content | Node$1 | Fragment, schema: Schema, parseOptions?: ParseOptions, options?: {
|
|
2932
3029
|
errorOnInvalidContent?: boolean;
|
|
2933
3030
|
}): Node$1;
|
|
2934
3031
|
|
|
@@ -2944,7 +3041,7 @@ type CreateNodeFromContentOptions = {
|
|
|
2944
3041
|
* @param options Options for the parser
|
|
2945
3042
|
* @returns The created Prosemirror node or fragment
|
|
2946
3043
|
*/
|
|
2947
|
-
declare function createNodeFromContent(content: Content, schema: Schema, options?: CreateNodeFromContentOptions): Node$1 | Fragment;
|
|
3044
|
+
declare function createNodeFromContent(content: Content | Node$1 | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): Node$1 | Fragment;
|
|
2948
3045
|
|
|
2949
3046
|
/**
|
|
2950
3047
|
* Gets the default block type at a given match
|
|
@@ -3072,7 +3169,23 @@ declare function getHTMLFromFragment(fragment: Fragment, schema: Schema): string
|
|
|
3072
3169
|
|
|
3073
3170
|
declare function getMarkAttributes(state: EditorState, typeOrName: string | MarkType): Record<string, any>;
|
|
3074
3171
|
|
|
3075
|
-
|
|
3172
|
+
/**
|
|
3173
|
+
* Get the range of a mark at a resolved position.
|
|
3174
|
+
*/
|
|
3175
|
+
declare function getMarkRange(
|
|
3176
|
+
/**
|
|
3177
|
+
* The position to get the mark range for.
|
|
3178
|
+
*/
|
|
3179
|
+
$pos: ResolvedPos,
|
|
3180
|
+
/**
|
|
3181
|
+
* The mark type to get the range for.
|
|
3182
|
+
*/
|
|
3183
|
+
type: MarkType,
|
|
3184
|
+
/**
|
|
3185
|
+
* The attributes to match against.
|
|
3186
|
+
* If not provided, only the first mark at the position will be matched.
|
|
3187
|
+
*/
|
|
3188
|
+
attributes?: Record<string, any>): Range | void;
|
|
3076
3189
|
|
|
3077
3190
|
declare function getMarksBetween(from: number, to: number, doc: Node$1): MarkRange[];
|
|
3078
3191
|
|
|
@@ -3226,7 +3339,7 @@ declare function splitExtensions(extensions: Extensions): {
|
|
|
3226
3339
|
/**
|
|
3227
3340
|
* Build an input rule that adds a mark when the
|
|
3228
3341
|
* matched text is typed into it.
|
|
3229
|
-
* @see https://tiptap.dev/
|
|
3342
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
|
|
3230
3343
|
*/
|
|
3231
3344
|
declare function markInputRule(config: {
|
|
3232
3345
|
find: InputRuleFinder;
|
|
@@ -3237,7 +3350,7 @@ declare function markInputRule(config: {
|
|
|
3237
3350
|
/**
|
|
3238
3351
|
* Build an input rule that adds a node when the
|
|
3239
3352
|
* matched text is typed into it.
|
|
3240
|
-
* @see https://tiptap.dev/
|
|
3353
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
|
|
3241
3354
|
*/
|
|
3242
3355
|
declare function nodeInputRule(config: {
|
|
3243
3356
|
/**
|
|
@@ -3260,7 +3373,7 @@ declare function nodeInputRule(config: {
|
|
|
3260
3373
|
* matched text is typed into it. When using a regular expresion you’ll
|
|
3261
3374
|
* probably want the regexp to start with `^`, so that the pattern can
|
|
3262
3375
|
* only occur at the start of a textblock.
|
|
3263
|
-
* @see https://tiptap.dev/
|
|
3376
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
|
|
3264
3377
|
*/
|
|
3265
3378
|
declare function textblockTypeInputRule(config: {
|
|
3266
3379
|
find: InputRuleFinder;
|
|
@@ -3271,7 +3384,7 @@ declare function textblockTypeInputRule(config: {
|
|
|
3271
3384
|
/**
|
|
3272
3385
|
* Build an input rule that replaces text when the
|
|
3273
3386
|
* matched text is typed into it.
|
|
3274
|
-
* @see https://tiptap.dev/
|
|
3387
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
|
|
3275
3388
|
*/
|
|
3276
3389
|
declare function textInputRule(config: {
|
|
3277
3390
|
find: InputRuleFinder;
|
|
@@ -3291,7 +3404,7 @@ declare function textInputRule(config: {
|
|
|
3291
3404
|
* two nodes. You can pass a join predicate, which takes a regular
|
|
3292
3405
|
* expression match and the node before the wrapped node, and can
|
|
3293
3406
|
* return a boolean to indicate whether a join should happen.
|
|
3294
|
-
* @see https://tiptap.dev/
|
|
3407
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules
|
|
3295
3408
|
*/
|
|
3296
3409
|
declare function wrappingInputRule(config: {
|
|
3297
3410
|
find: InputRuleFinder;
|
|
@@ -3311,10 +3424,13 @@ declare class NodeView<Component, NodeEditor extends Editor = Editor, Options ex
|
|
|
3311
3424
|
component: Component;
|
|
3312
3425
|
editor: NodeEditor;
|
|
3313
3426
|
options: Options;
|
|
3314
|
-
extension:
|
|
3315
|
-
node:
|
|
3316
|
-
decorations:
|
|
3317
|
-
|
|
3427
|
+
extension: NodeViewRendererProps['extension'];
|
|
3428
|
+
node: NodeViewRendererProps['node'];
|
|
3429
|
+
decorations: NodeViewRendererProps['decorations'];
|
|
3430
|
+
innerDecorations: NodeViewRendererProps['innerDecorations'];
|
|
3431
|
+
view: NodeViewRendererProps['view'];
|
|
3432
|
+
getPos: NodeViewRendererProps['getPos'];
|
|
3433
|
+
HTMLAttributes: NodeViewRendererProps['HTMLAttributes'];
|
|
3318
3434
|
isDragging: boolean;
|
|
3319
3435
|
constructor(component: Component, props: NodeViewRendererProps, options?: Partial<Options>);
|
|
3320
3436
|
mount(): void;
|
|
@@ -3322,18 +3438,26 @@ declare class NodeView<Component, NodeEditor extends Editor = Editor, Options ex
|
|
|
3322
3438
|
get contentDOM(): HTMLElement | null;
|
|
3323
3439
|
onDragStart(event: DragEvent): void;
|
|
3324
3440
|
stopEvent(event: Event): boolean;
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3441
|
+
/**
|
|
3442
|
+
* Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.
|
|
3443
|
+
* @return `false` if the editor should re-read the selection or re-parse the range around the mutation
|
|
3444
|
+
* @return `true` if it can safely be ignored.
|
|
3445
|
+
*/
|
|
3446
|
+
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
3447
|
+
/**
|
|
3448
|
+
* Update the attributes of the prosemirror node.
|
|
3449
|
+
*/
|
|
3450
|
+
updateAttributes(attributes: Record<string, any>): void;
|
|
3451
|
+
/**
|
|
3452
|
+
* Delete the node.
|
|
3453
|
+
*/
|
|
3330
3454
|
deleteNode(): void;
|
|
3331
3455
|
}
|
|
3332
3456
|
|
|
3333
3457
|
/**
|
|
3334
3458
|
* Build an paste rule that adds a mark when the
|
|
3335
3459
|
* matched text is pasted into it.
|
|
3336
|
-
* @see https://tiptap.dev/
|
|
3460
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
|
|
3337
3461
|
*/
|
|
3338
3462
|
declare function markPasteRule(config: {
|
|
3339
3463
|
find: PasteRuleFinder;
|
|
@@ -3344,7 +3468,7 @@ declare function markPasteRule(config: {
|
|
|
3344
3468
|
/**
|
|
3345
3469
|
* Build an paste rule that adds a node when the
|
|
3346
3470
|
* matched text is pasted into it.
|
|
3347
|
-
* @see https://tiptap.dev/
|
|
3471
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
|
|
3348
3472
|
*/
|
|
3349
3473
|
declare function nodePasteRule(config: {
|
|
3350
3474
|
find: PasteRuleFinder;
|
|
@@ -3356,7 +3480,7 @@ declare function nodePasteRule(config: {
|
|
|
3356
3480
|
/**
|
|
3357
3481
|
* Build an paste rule that replaces text when the
|
|
3358
3482
|
* matched text is pasted into it.
|
|
3359
|
-
* @see https://tiptap.dev/
|
|
3483
|
+
* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules
|
|
3360
3484
|
*/
|
|
3361
3485
|
declare function textPasteRule(config: {
|
|
3362
3486
|
find: PasteRuleFinder;
|
|
@@ -3449,4 +3573,4 @@ interface NodeConfig<Options = any, Storage = any> {
|
|
|
3449
3573
|
interface MarkConfig<Options = any, Storage = any> {
|
|
3450
3574
|
}
|
|
3451
3575
|
|
|
3452
|
-
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DecorationWithType, type Diff, type Dispatch, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type TextSerializer, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, combineTransactionSteps, createChainableState, createDocument, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveFocusPosition, selectionToInsertionEnd, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|
|
3576
|
+
export { type AnyCommands, type AnyConfig, type AnyExtension, type Attribute, type Attributes, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DecorationType, type DecorationWithType, type Diff, type Dispatch, Editor, type EditorEvents, type EditorOptions, type EnableRules, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, type GlobalAttributes, type HTMLContent, InputRule, type InputRuleFinder, type InputRuleMatch, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type SingleCommands, type TextSerializer, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, callOrReturn, combineTransactionSteps, createChainableState, createDocument, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveFocusPosition, selectionToInsertionEnd, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|