@tiptap/core 2.0.0-beta.213 → 2.0.0-beta.214
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 +16662 -4000
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +16603 -4017
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +16979 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/packages/core/src/CommandManager.d.ts +20 -0
- package/dist/packages/core/src/Editor.d.ts +147 -0
- package/dist/packages/core/src/EventEmitter.d.ts +11 -0
- package/dist/packages/core/src/Extension.d.ts +227 -0
- package/dist/packages/core/src/ExtensionManager.d.ts +18 -0
- package/dist/packages/core/src/InputRule.d.ts +42 -0
- package/dist/packages/core/src/Mark.d.ts +327 -0
- package/dist/packages/core/src/Node.d.ts +397 -0
- package/dist/packages/core/src/NodeView.d.ts +27 -0
- package/dist/packages/core/src/PasteRule.d.ts +42 -0
- package/dist/packages/core/src/Tracker.d.ts +11 -0
- package/dist/packages/core/src/commands/blur.d.ts +12 -0
- package/dist/packages/core/src/commands/clearContent.d.ts +12 -0
- package/dist/packages/core/src/commands/clearNodes.d.ts +12 -0
- package/dist/packages/core/src/commands/command.d.ts +12 -0
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +12 -0
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +12 -0
- package/dist/packages/core/src/commands/deleteNode.d.ts +13 -0
- package/dist/packages/core/src/commands/deleteRange.d.ts +12 -0
- package/dist/packages/core/src/commands/deleteSelection.d.ts +12 -0
- package/dist/packages/core/src/commands/enter.d.ts +12 -0
- package/dist/packages/core/src/commands/exitCode.d.ts +12 -0
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +13 -0
- package/dist/packages/core/src/commands/first.d.ts +12 -0
- package/dist/packages/core/src/commands/focus.d.ts +14 -0
- package/dist/packages/core/src/commands/forEach.d.ts +14 -0
- package/dist/packages/core/src/commands/index.d.ts +50 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +16 -0
- package/dist/packages/core/src/commands/insertContentAt.d.ts +16 -0
- package/dist/packages/core/src/commands/join.d.ts +33 -0
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +12 -0
- package/dist/packages/core/src/commands/lift.d.ts +13 -0
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +12 -0
- package/dist/packages/core/src/commands/liftListItem.d.ts +13 -0
- package/dist/packages/core/src/commands/newlineInCode.d.ts +12 -0
- package/dist/packages/core/src/commands/resetAttributes.d.ts +13 -0
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +12 -0
- package/dist/packages/core/src/commands/selectAll.d.ts +12 -0
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +12 -0
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +12 -0
- package/dist/packages/core/src/commands/selectParentNode.d.ts +12 -0
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +12 -0
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +12 -0
- package/dist/packages/core/src/commands/setContent.d.ts +13 -0
- package/dist/packages/core/src/commands/setMark.d.ts +13 -0
- package/dist/packages/core/src/commands/setMeta.d.ts +12 -0
- package/dist/packages/core/src/commands/setNode.d.ts +13 -0
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +12 -0
- package/dist/packages/core/src/commands/setTextSelection.d.ts +12 -0
- package/dist/packages/core/src/commands/sinkListItem.d.ts +13 -0
- package/dist/packages/core/src/commands/splitBlock.d.ts +14 -0
- package/dist/packages/core/src/commands/splitListItem.d.ts +13 -0
- package/dist/packages/core/src/commands/toggleList.d.ts +13 -0
- package/dist/packages/core/src/commands/toggleMark.d.ts +18 -0
- package/dist/packages/core/src/commands/toggleNode.d.ts +13 -0
- package/dist/packages/core/src/commands/toggleWrap.d.ts +13 -0
- package/dist/packages/core/src/commands/undoInputRule.d.ts +12 -0
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +12 -0
- package/dist/packages/core/src/commands/unsetMark.d.ts +18 -0
- package/dist/packages/core/src/commands/updateAttributes.d.ts +13 -0
- package/dist/packages/core/src/commands/wrapIn.d.ts +13 -0
- package/dist/packages/core/src/commands/wrapInList.d.ts +13 -0
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +2 -0
- package/dist/packages/core/src/extensions/commands.d.ts +3 -0
- package/dist/packages/core/src/extensions/editable.d.ts +2 -0
- package/dist/packages/core/src/extensions/focusEvents.d.ts +2 -0
- package/dist/packages/core/src/extensions/index.d.ts +6 -0
- package/dist/packages/core/src/extensions/keymap.d.ts +2 -0
- package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +7 -0
- package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
- package/dist/packages/core/src/helpers/createDocument.d.ts +3 -0
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +7 -0
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +2 -0
- package/dist/packages/core/src/helpers/findChildren.d.ts +3 -0
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +6 -0
- package/dist/packages/core/src/helpers/findParentNode.d.ts +8 -0
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +8 -0
- package/dist/packages/core/src/helpers/generateHTML.d.ts +2 -0
- package/dist/packages/core/src/helpers/generateJSON.d.ts +2 -0
- package/dist/packages/core/src/helpers/generateText.d.ts +5 -0
- package/dist/packages/core/src/helpers/getAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +6 -0
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +2 -0
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -0
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +3 -0
- package/dist/packages/core/src/helpers/getMarkType.d.ts +2 -0
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +3 -0
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getNodeType.d.ts +2 -0
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchema.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +2 -0
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +2 -0
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +2 -0
- package/dist/packages/core/src/helpers/getText.d.ts +6 -0
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +6 -0
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +2 -0
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +3 -0
- package/dist/packages/core/src/helpers/index.d.ts +33 -0
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +9 -0
- package/dist/packages/core/src/helpers/isActive.d.ts +2 -0
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
- package/dist/packages/core/src/helpers/isList.d.ts +2 -0
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +3 -0
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +3 -0
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +2 -0
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +2 -0
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +2 -0
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +2 -0
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
- package/dist/packages/core/src/index.d.ts +23 -0
- package/dist/packages/core/src/inputRules/index.d.ts +5 -0
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +12 -0
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +12 -0
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +9 -0
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +14 -0
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +23 -0
- package/dist/packages/core/src/pasteRules/index.d.ts +3 -0
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +12 -0
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +12 -0
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
- package/dist/packages/core/src/style.d.ts +1 -0
- package/dist/packages/core/src/types.d.ts +214 -0
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +9 -0
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -0
- package/dist/packages/core/src/utilities/deleteProps.d.ts +6 -0
- package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -0
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/index.d.ts +20 -0
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -0
- package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
- package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -0
- package/dist/packages/core/src/utilities/isRegExp.d.ts +1 -0
- package/dist/packages/core/src/utilities/isString.d.ts +1 -0
- package/dist/packages/core/src/utilities/isiOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +1 -0
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -0
- package/dist/packages/core/src/utilities/minMax.d.ts +1 -0
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +8 -0
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
- package/package.json +7 -16
- package/dist/index.d.ts +0 -2330
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Fragment, Node as ProseMirrorNode, ParseOptions, Schema } from '@tiptap/pm/model';
|
|
2
|
+
import { Content } from '../types';
|
|
3
|
+
export declare type CreateNodeFromContentOptions = {
|
|
4
|
+
slice?: boolean;
|
|
5
|
+
parseOptions?: ParseOptions;
|
|
6
|
+
};
|
|
7
|
+
export declare function createNodeFromContent(content: Content, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode | Fragment;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { NodeWithPos, Predicate, Range } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Same as `findChildren` but searches only within a `range`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findChildrenInRange(node: ProseMirrorNode, range: Range, predicate: Predicate): NodeWithPos[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Selection } from '@tiptap/pm/state';
|
|
2
|
+
import { Predicate } from '../types';
|
|
3
|
+
export declare function findParentNode(predicate: Predicate): (selection: Selection) => {
|
|
4
|
+
pos: number;
|
|
5
|
+
start: number;
|
|
6
|
+
depth: number;
|
|
7
|
+
node: import("prosemirror-model").Node;
|
|
8
|
+
} | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode, ResolvedPos } from '@tiptap/pm/model';
|
|
2
|
+
import { Predicate } from '../types';
|
|
3
|
+
export declare function findParentNodeClosestToPos($pos: ResolvedPos, predicate: Predicate): {
|
|
4
|
+
pos: number;
|
|
5
|
+
start: number;
|
|
6
|
+
depth: number;
|
|
7
|
+
node: ProseMirrorNode;
|
|
8
|
+
} | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExtensionAttribute, Extensions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.
|
|
4
|
+
* @param extensions List of extensions
|
|
5
|
+
*/
|
|
6
|
+
export declare function getAttributesFromExtensions(extensions: Extensions): ExtensionAttribute[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Transform } from '@tiptap/pm/transform';
|
|
2
|
+
import { Range } from '../types';
|
|
3
|
+
export declare type ChangedRange = {
|
|
4
|
+
oldRange: Range;
|
|
5
|
+
newRange: Range;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Returns a list of changed ranges
|
|
9
|
+
* based on the first and last state of all steps.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getChangedRanges(transform: Transform): ChangedRange[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { JSONContent } from '../types';
|
|
3
|
+
interface DebugJSONContent extends JSONContent {
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function getDebugJSON(node: ProseMirrorNode, startOffset?: number): DebugJSONContent;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
import { Range, TextSerializer } from '../types';
|
|
3
|
+
export declare function getTextBetween(startNode: ProseMirrorNode, range: Range, options?: {
|
|
4
|
+
blockSeparator?: string;
|
|
5
|
+
textSerializers?: Record<string, TextSerializer>;
|
|
6
|
+
}): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './combineTransactionSteps';
|
|
2
|
+
export * from './defaultBlockAt';
|
|
3
|
+
export * from './findChildren';
|
|
4
|
+
export * from './findChildrenInRange';
|
|
5
|
+
export * from './findParentNode';
|
|
6
|
+
export * from './findParentNodeClosestToPos';
|
|
7
|
+
export * from './generateHTML';
|
|
8
|
+
export * from './generateJSON';
|
|
9
|
+
export * from './generateText';
|
|
10
|
+
export * from './getAttributes';
|
|
11
|
+
export * from './getChangedRanges';
|
|
12
|
+
export * from './getDebugJSON';
|
|
13
|
+
export * from './getExtensionField';
|
|
14
|
+
export * from './getHTMLFromFragment';
|
|
15
|
+
export * from './getMarkAttributes';
|
|
16
|
+
export * from './getMarkRange';
|
|
17
|
+
export * from './getMarksBetween';
|
|
18
|
+
export * from './getMarkType';
|
|
19
|
+
export * from './getNodeAttributes';
|
|
20
|
+
export * from './getNodeType';
|
|
21
|
+
export * from './getSchema';
|
|
22
|
+
export * from './getText';
|
|
23
|
+
export * from './getTextBetween';
|
|
24
|
+
export * from './getTextContentFromNodes';
|
|
25
|
+
export * from './getTextSerializersFromSchema';
|
|
26
|
+
export * from './isActive';
|
|
27
|
+
export * from './isList';
|
|
28
|
+
export * from './isMarkActive';
|
|
29
|
+
export * from './isNodeActive';
|
|
30
|
+
export * from './isNodeEmpty';
|
|
31
|
+
export * from './isNodeSelection';
|
|
32
|
+
export * from './isTextSelection';
|
|
33
|
+
export * from './posToDOMRect';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ParseRule } from '@tiptap/pm/model';
|
|
2
|
+
import { ExtensionAttribute } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).
|
|
5
|
+
* Cancels when `getAttrs` returned `false`.
|
|
6
|
+
* @param parseRule ProseMirror ParseRule
|
|
7
|
+
* @param extensionAttributes List of attributes to inject
|
|
8
|
+
*/
|
|
9
|
+
export declare function injectExtensionAttributesToParseRule(parseRule: ParseRule, extensionAttributes: ExtensionAttribute[]): ParseRule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Extension } from '../Extension';
|
|
2
|
+
import { Mark } from '../Mark';
|
|
3
|
+
import { Node } from '../Node';
|
|
4
|
+
import { Extensions } from '../types';
|
|
5
|
+
export declare function splitExtensions(extensions: Extensions): {
|
|
6
|
+
baseExtensions: Extension<any, any>[];
|
|
7
|
+
nodeExtensions: Node<any, any>[];
|
|
8
|
+
markExtensions: Mark<any, any>[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './CommandManager';
|
|
2
|
+
export * from './Editor';
|
|
3
|
+
export * from './Extension';
|
|
4
|
+
export * as extensions from './extensions';
|
|
5
|
+
export * from './helpers';
|
|
6
|
+
export * from './InputRule';
|
|
7
|
+
export * from './inputRules';
|
|
8
|
+
export * from './Mark';
|
|
9
|
+
export * from './Node';
|
|
10
|
+
export * from './NodeView';
|
|
11
|
+
export * from './PasteRule';
|
|
12
|
+
export * from './pasteRules';
|
|
13
|
+
export * from './Tracker';
|
|
14
|
+
export * from './types';
|
|
15
|
+
export * from './utilities';
|
|
16
|
+
export interface Commands<ReturnType = any> {
|
|
17
|
+
}
|
|
18
|
+
export interface ExtensionConfig<Options = any, Storage = any> {
|
|
19
|
+
}
|
|
20
|
+
export interface NodeConfig<Options = any, Storage = any> {
|
|
21
|
+
}
|
|
22
|
+
export interface MarkConfig<Options = any, Storage = any> {
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MarkType } from '@tiptap/pm/model';
|
|
2
|
+
import { InputRule, InputRuleFinder } from '../InputRule';
|
|
3
|
+
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an input rule that adds a mark when the
|
|
6
|
+
* matched text is typed into it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function markInputRule(config: {
|
|
9
|
+
find: InputRuleFinder;
|
|
10
|
+
type: MarkType;
|
|
11
|
+
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
12
|
+
}): InputRule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { InputRule, InputRuleFinder } from '../InputRule';
|
|
3
|
+
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an input rule that adds a node when the
|
|
6
|
+
* matched text is typed into it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nodeInputRule(config: {
|
|
9
|
+
find: InputRuleFinder;
|
|
10
|
+
type: NodeType;
|
|
11
|
+
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
12
|
+
}): InputRule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InputRule, InputRuleFinder } from '../InputRule';
|
|
2
|
+
/**
|
|
3
|
+
* Build an input rule that replaces text when the
|
|
4
|
+
* matched text is typed into it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function textInputRule(config: {
|
|
7
|
+
find: InputRuleFinder;
|
|
8
|
+
replace: string;
|
|
9
|
+
}): InputRule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { InputRule, InputRuleFinder } from '../InputRule';
|
|
3
|
+
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an input rule that changes the type of a textblock when the
|
|
6
|
+
* matched text is typed into it. When using a regular expresion you’ll
|
|
7
|
+
* probably want the regexp to start with `^`, so that the pattern can
|
|
8
|
+
* only occur at the start of a textblock.
|
|
9
|
+
*/
|
|
10
|
+
export declare function textblockTypeInputRule(config: {
|
|
11
|
+
find: InputRuleFinder;
|
|
12
|
+
type: NodeType;
|
|
13
|
+
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
14
|
+
}): InputRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode, NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { InputRule, InputRuleFinder } from '../InputRule';
|
|
3
|
+
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an input rule for automatically wrapping a textblock when a
|
|
6
|
+
* given string is typed. When using a regular expresion you’ll
|
|
7
|
+
* probably want the regexp to start with `^`, so that the pattern can
|
|
8
|
+
* only occur at the start of a textblock.
|
|
9
|
+
*
|
|
10
|
+
* `type` is the type of node to wrap in.
|
|
11
|
+
*
|
|
12
|
+
* By default, if there’s a node with the same type above the newly
|
|
13
|
+
* wrapped node, the rule will try to join those
|
|
14
|
+
* two nodes. You can pass a join predicate, which takes a regular
|
|
15
|
+
* expression match and the node before the wrapped node, and can
|
|
16
|
+
* return a boolean to indicate whether a join should happen.
|
|
17
|
+
*/
|
|
18
|
+
export declare function wrappingInputRule(config: {
|
|
19
|
+
find: InputRuleFinder;
|
|
20
|
+
type: NodeType;
|
|
21
|
+
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
22
|
+
joinPredicate?: (match: ExtendedRegExpMatchArray, node: ProseMirrorNode) => boolean;
|
|
23
|
+
}): InputRule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MarkType } from '@tiptap/pm/model';
|
|
2
|
+
import { PasteRule, PasteRuleFinder } from '../PasteRule';
|
|
3
|
+
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an paste rule that adds a mark when the
|
|
6
|
+
* matched text is pasted into it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function markPasteRule(config: {
|
|
9
|
+
find: PasteRuleFinder;
|
|
10
|
+
type: MarkType;
|
|
11
|
+
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
12
|
+
}): PasteRule;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { PasteRule } from '../PasteRule';
|
|
3
|
+
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Build an paste rule that adds a node when the
|
|
6
|
+
* matched text is pasted into it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nodePasteRule(config: {
|
|
9
|
+
find: RegExp;
|
|
10
|
+
type: NodeType;
|
|
11
|
+
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
12
|
+
}): PasteRule;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PasteRule, PasteRuleFinder } from '../PasteRule';
|
|
2
|
+
/**
|
|
3
|
+
* Build an paste rule that replaces text when the
|
|
4
|
+
* matched text is pasted into it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function textPasteRule(config: {
|
|
7
|
+
find: PasteRuleFinder;
|
|
8
|
+
replace: string;
|
|
9
|
+
}): PasteRule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 1px !important;\n height: 1px !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}";
|