@tiptap/extension-typography 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 +191 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +190 -190
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +191 -191
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/CommandManager.d.ts +20 -0
- package/dist/packages/core/src/Editor.d.ts +161 -0
- package/dist/packages/core/src/EventEmitter.d.ts +11 -0
- package/dist/packages/core/src/Extension.d.ts +343 -0
- package/dist/packages/core/src/ExtensionManager.d.ts +55 -0
- package/dist/packages/core/src/InputRule.d.ts +42 -0
- package/dist/packages/core/src/Mark.d.ts +451 -0
- package/dist/packages/core/src/Node.d.ts +611 -0
- package/dist/packages/core/src/NodePos.d.ts +44 -0
- package/dist/packages/core/src/NodeView.d.ts +31 -0
- package/dist/packages/core/src/PasteRule.d.ts +50 -0
- package/dist/packages/core/src/Tracker.d.ts +11 -0
- package/dist/packages/core/src/commands/blur.d.ts +13 -0
- package/dist/packages/core/src/commands/clearContent.d.ts +14 -0
- package/dist/packages/core/src/commands/clearNodes.d.ts +13 -0
- package/dist/packages/core/src/commands/command.d.ts +18 -0
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +13 -0
- package/dist/packages/core/src/commands/cut.d.ts +20 -0
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +13 -0
- package/dist/packages/core/src/commands/deleteNode.d.ts +15 -0
- package/dist/packages/core/src/commands/deleteRange.d.ts +14 -0
- package/dist/packages/core/src/commands/deleteSelection.d.ts +13 -0
- package/dist/packages/core/src/commands/enter.d.ts +13 -0
- package/dist/packages/core/src/commands/exitCode.d.ts +13 -0
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +25 -0
- package/dist/packages/core/src/commands/first.d.ts +14 -0
- package/dist/packages/core/src/commands/focus.d.ts +27 -0
- package/dist/packages/core/src/commands/forEach.d.ts +14 -0
- package/dist/packages/core/src/commands/index.d.ts +55 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +34 -0
- package/dist/packages/core/src/commands/insertContentAt.d.ts +47 -0
- package/dist/packages/core/src/commands/join.d.ts +41 -0
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +13 -0
- package/dist/packages/core/src/commands/joinItemForward.d.ts +13 -0
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +12 -0
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +12 -0
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +14 -0
- package/dist/packages/core/src/commands/lift.d.ts +17 -0
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +13 -0
- package/dist/packages/core/src/commands/liftListItem.d.ts +15 -0
- package/dist/packages/core/src/commands/newlineInCode.d.ts +13 -0
- package/dist/packages/core/src/commands/resetAttributes.d.ts +16 -0
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +13 -0
- package/dist/packages/core/src/commands/selectAll.d.ts +13 -0
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +13 -0
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +13 -0
- package/dist/packages/core/src/commands/selectParentNode.d.ts +13 -0
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +13 -0
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +13 -0
- package/dist/packages/core/src/commands/setContent.d.ts +40 -0
- package/dist/packages/core/src/commands/setMark.d.ts +15 -0
- package/dist/packages/core/src/commands/setMeta.d.ts +15 -0
- package/dist/packages/core/src/commands/setNode.d.ts +16 -0
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +14 -0
- package/dist/packages/core/src/commands/setTextSelection.d.ts +14 -0
- package/dist/packages/core/src/commands/sinkListItem.d.ts +15 -0
- package/dist/packages/core/src/commands/splitBlock.d.ts +17 -0
- package/dist/packages/core/src/commands/splitListItem.d.ts +15 -0
- package/dist/packages/core/src/commands/toggleList.d.ts +18 -0
- package/dist/packages/core/src/commands/toggleMark.d.ts +30 -0
- package/dist/packages/core/src/commands/toggleNode.d.ts +17 -0
- package/dist/packages/core/src/commands/toggleWrap.d.ts +16 -0
- package/dist/packages/core/src/commands/undoInputRule.d.ts +13 -0
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +13 -0
- package/dist/packages/core/src/commands/unsetMark.d.ts +25 -0
- package/dist/packages/core/src/commands/updateAttributes.d.ts +24 -0
- package/dist/packages/core/src/commands/wrapIn.d.ts +16 -0
- package/dist/packages/core/src/commands/wrapInList.d.ts +16 -0
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +5 -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 +10 -0
- package/dist/packages/core/src/helpers/createChainableState.d.ts +10 -0
- package/dist/packages/core/src/helpers/createDocument.d.ts +12 -0
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +15 -0
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +7 -0
- package/dist/packages/core/src/helpers/findChildren.d.ts +9 -0
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +10 -0
- package/dist/packages/core/src/helpers/findParentNode.d.ts +16 -0
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +17 -0
- package/dist/packages/core/src/helpers/generateHTML.d.ts +8 -0
- package/dist/packages/core/src/helpers/generateJSON.d.ts +8 -0
- package/dist/packages/core/src/helpers/generateText.d.ts +12 -0
- package/dist/packages/core/src/helpers/getAttributes.d.ts +9 -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 +9 -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/getNodeAtPosition.d.ts +11 -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 +4 -0
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +10 -0
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +8 -0
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +8 -0
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +9 -0
- package/dist/packages/core/src/helpers/getText.d.ts +15 -0
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +14 -0
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +8 -0
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +8 -0
- package/dist/packages/core/src/helpers/index.d.ts +50 -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/isAtEndOfNode.d.ts +2 -0
- package/dist/packages/core/src/helpers/isAtStartOfNode.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 +24 -0
- package/dist/packages/core/src/inputRules/index.d.ts +5 -0
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +13 -0
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +23 -0
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +10 -0
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +15 -0
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +28 -0
- package/dist/packages/core/src/pasteRules/index.d.ts +3 -0
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +13 -0
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +13 -0
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +10 -0
- package/dist/packages/core/src/style.d.ts +1 -0
- package/dist/packages/core/src/types.d.ts +250 -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/isAndroid.d.ts +1 -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/dist/packages/extension-typography/src/index.d.ts +3 -3
- package/dist/packages/extension-typography/src/typography.d.ts +140 -140
- package/package.json +2 -2
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { Mark as ProseMirrorMark, Node as ProseMirrorNode, NodeType, ParseOptions } from '@tiptap/pm/model';
|
|
2
|
+
import { EditorState, Transaction } from '@tiptap/pm/state';
|
|
3
|
+
import { Decoration, EditorProps, EditorView, NodeView } from '@tiptap/pm/view';
|
|
4
|
+
import { Editor } from './Editor.js';
|
|
5
|
+
import { Extension } from './Extension.js';
|
|
6
|
+
import { Commands, ExtensionConfig, MarkConfig, NodeConfig } from './index.js';
|
|
7
|
+
import { Mark } from './Mark.js';
|
|
8
|
+
import { Node } from './Node.js';
|
|
9
|
+
export type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig;
|
|
10
|
+
export type AnyExtension = Extension | Node | Mark;
|
|
11
|
+
export type Extensions = AnyExtension[];
|
|
12
|
+
export type ParentConfig<T> = Partial<{
|
|
13
|
+
[P in keyof T]: Required<T>[P] extends (...args: any) => any ? (...args: Parameters<Required<T>[P]>) => ReturnType<Required<T>[P]> : T[P];
|
|
14
|
+
}>;
|
|
15
|
+
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
16
|
+
export type RemoveThis<T> = T extends (...args: any) => any ? (...args: Parameters<T>) => ReturnType<T> : T;
|
|
17
|
+
export type MaybeReturnType<T> = T extends (...args: any) => any ? ReturnType<T> : T;
|
|
18
|
+
export type MaybeThisParameterType<T> = Exclude<T, Primitive> extends (...args: any) => any ? ThisParameterType<Exclude<T, Primitive>> : any;
|
|
19
|
+
export interface EditorEvents {
|
|
20
|
+
beforeCreate: {
|
|
21
|
+
editor: Editor;
|
|
22
|
+
};
|
|
23
|
+
create: {
|
|
24
|
+
editor: Editor;
|
|
25
|
+
};
|
|
26
|
+
contentError: {
|
|
27
|
+
editor: Editor;
|
|
28
|
+
error: Error;
|
|
29
|
+
/**
|
|
30
|
+
* If called, will re-initialize the editor with the collaboration extension removed.
|
|
31
|
+
* This will prevent syncing back deletions of content not present in the current schema.
|
|
32
|
+
*/
|
|
33
|
+
disableCollaboration: () => void;
|
|
34
|
+
};
|
|
35
|
+
update: {
|
|
36
|
+
editor: Editor;
|
|
37
|
+
transaction: Transaction;
|
|
38
|
+
};
|
|
39
|
+
selectionUpdate: {
|
|
40
|
+
editor: Editor;
|
|
41
|
+
transaction: Transaction;
|
|
42
|
+
};
|
|
43
|
+
transaction: {
|
|
44
|
+
editor: Editor;
|
|
45
|
+
transaction: Transaction;
|
|
46
|
+
};
|
|
47
|
+
focus: {
|
|
48
|
+
editor: Editor;
|
|
49
|
+
event: FocusEvent;
|
|
50
|
+
transaction: Transaction;
|
|
51
|
+
};
|
|
52
|
+
blur: {
|
|
53
|
+
editor: Editor;
|
|
54
|
+
event: FocusEvent;
|
|
55
|
+
transaction: Transaction;
|
|
56
|
+
};
|
|
57
|
+
destroy: void;
|
|
58
|
+
}
|
|
59
|
+
export type EnableRules = (AnyExtension | string)[] | boolean;
|
|
60
|
+
export interface EditorOptions {
|
|
61
|
+
element: Element;
|
|
62
|
+
content: Content;
|
|
63
|
+
extensions: Extensions;
|
|
64
|
+
injectCSS: boolean;
|
|
65
|
+
injectNonce: string | undefined;
|
|
66
|
+
autofocus: FocusPosition;
|
|
67
|
+
editable: boolean;
|
|
68
|
+
editorProps: EditorProps;
|
|
69
|
+
parseOptions: ParseOptions;
|
|
70
|
+
coreExtensionOptions?: {
|
|
71
|
+
clipboardTextSerializer?: {
|
|
72
|
+
blockSeparator?: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
enableInputRules: EnableRules;
|
|
76
|
+
enablePasteRules: EnableRules;
|
|
77
|
+
enableCoreExtensions: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* If `true`, the editor will check the content for errors on initialization.
|
|
80
|
+
* Emitting the `contentError` event if the content is invalid.
|
|
81
|
+
* Which can be used to show a warning or error message to the user.
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
enableContentCheck: boolean;
|
|
85
|
+
onBeforeCreate: (props: EditorEvents['beforeCreate']) => void;
|
|
86
|
+
onCreate: (props: EditorEvents['create']) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Called when the editor encounters an error while parsing the content.
|
|
89
|
+
* Only enabled if `enableContentCheck` is `true`.
|
|
90
|
+
*/
|
|
91
|
+
onContentError: (props: EditorEvents['contentError']) => void;
|
|
92
|
+
onUpdate: (props: EditorEvents['update']) => void;
|
|
93
|
+
onSelectionUpdate: (props: EditorEvents['selectionUpdate']) => void;
|
|
94
|
+
onTransaction: (props: EditorEvents['transaction']) => void;
|
|
95
|
+
onFocus: (props: EditorEvents['focus']) => void;
|
|
96
|
+
onBlur: (props: EditorEvents['blur']) => void;
|
|
97
|
+
onDestroy: (props: EditorEvents['destroy']) => void;
|
|
98
|
+
}
|
|
99
|
+
export type HTMLContent = string;
|
|
100
|
+
export type JSONContent = {
|
|
101
|
+
type?: string;
|
|
102
|
+
attrs?: Record<string, any>;
|
|
103
|
+
content?: JSONContent[];
|
|
104
|
+
marks?: {
|
|
105
|
+
type: string;
|
|
106
|
+
attrs?: Record<string, any>;
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
}[];
|
|
109
|
+
text?: string;
|
|
110
|
+
[key: string]: any;
|
|
111
|
+
};
|
|
112
|
+
export type Content = HTMLContent | JSONContent | JSONContent[] | null;
|
|
113
|
+
export type CommandProps = {
|
|
114
|
+
editor: Editor;
|
|
115
|
+
tr: Transaction;
|
|
116
|
+
commands: SingleCommands;
|
|
117
|
+
can: () => CanCommands;
|
|
118
|
+
chain: () => ChainedCommands;
|
|
119
|
+
state: EditorState;
|
|
120
|
+
view: EditorView;
|
|
121
|
+
dispatch: ((args?: any) => any) | undefined;
|
|
122
|
+
};
|
|
123
|
+
export type Command = (props: CommandProps) => boolean;
|
|
124
|
+
export type CommandSpec = (...args: any[]) => Command;
|
|
125
|
+
export type KeyboardShortcutCommand = (props: {
|
|
126
|
+
editor: Editor;
|
|
127
|
+
}) => boolean;
|
|
128
|
+
export type Attribute = {
|
|
129
|
+
default?: any;
|
|
130
|
+
rendered?: boolean;
|
|
131
|
+
renderHTML?: ((attributes: Record<string, any>) => Record<string, any> | null) | null;
|
|
132
|
+
parseHTML?: ((element: HTMLElement) => any | null) | null;
|
|
133
|
+
keepOnSplit?: boolean;
|
|
134
|
+
isRequired?: boolean;
|
|
135
|
+
};
|
|
136
|
+
export type Attributes = {
|
|
137
|
+
[key: string]: Attribute;
|
|
138
|
+
};
|
|
139
|
+
export type ExtensionAttribute = {
|
|
140
|
+
type: string;
|
|
141
|
+
name: string;
|
|
142
|
+
attribute: Required<Attribute>;
|
|
143
|
+
};
|
|
144
|
+
export type GlobalAttributes = {
|
|
145
|
+
/**
|
|
146
|
+
* The node & mark types this attribute should be applied to.
|
|
147
|
+
*/
|
|
148
|
+
types: string[];
|
|
149
|
+
/**
|
|
150
|
+
* The attributes to add to the node or mark types.
|
|
151
|
+
*/
|
|
152
|
+
attributes: {
|
|
153
|
+
[key: string]: Attribute;
|
|
154
|
+
};
|
|
155
|
+
}[];
|
|
156
|
+
export type PickValue<T, K extends keyof T> = T[K];
|
|
157
|
+
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
158
|
+
export type Diff<T extends keyof any, U extends keyof any> = ({
|
|
159
|
+
[P in T]: P;
|
|
160
|
+
} & {
|
|
161
|
+
[P in U]: never;
|
|
162
|
+
} & {
|
|
163
|
+
[x: string]: never;
|
|
164
|
+
})[T];
|
|
165
|
+
export type Overwrite<T, U> = Pick<T, Diff<keyof T, keyof U>> & U;
|
|
166
|
+
export type ValuesOf<T> = T[keyof T];
|
|
167
|
+
export type KeysWithTypeOf<T, Type> = {
|
|
168
|
+
[P in keyof T]: T[P] extends Type ? P : never;
|
|
169
|
+
}[keyof T];
|
|
170
|
+
export type DecorationWithType = Decoration & {
|
|
171
|
+
type: NodeType;
|
|
172
|
+
};
|
|
173
|
+
export type NodeViewProps = {
|
|
174
|
+
editor: Editor;
|
|
175
|
+
node: ProseMirrorNode;
|
|
176
|
+
decorations: DecorationWithType[];
|
|
177
|
+
selected: boolean;
|
|
178
|
+
extension: Node;
|
|
179
|
+
getPos: () => number;
|
|
180
|
+
updateAttributes: (attributes: Record<string, any>) => void;
|
|
181
|
+
deleteNode: () => void;
|
|
182
|
+
};
|
|
183
|
+
export interface NodeViewRendererOptions {
|
|
184
|
+
stopEvent: ((props: {
|
|
185
|
+
event: Event;
|
|
186
|
+
}) => boolean) | null;
|
|
187
|
+
ignoreMutation: ((props: {
|
|
188
|
+
mutation: MutationRecord | {
|
|
189
|
+
type: 'selection';
|
|
190
|
+
target: Element;
|
|
191
|
+
};
|
|
192
|
+
}) => boolean) | null;
|
|
193
|
+
contentDOMElementTag: string;
|
|
194
|
+
}
|
|
195
|
+
export type NodeViewRendererProps = {
|
|
196
|
+
editor: Editor;
|
|
197
|
+
node: ProseMirrorNode;
|
|
198
|
+
getPos: (() => number) | boolean;
|
|
199
|
+
HTMLAttributes: Record<string, any>;
|
|
200
|
+
decorations: Decoration[];
|
|
201
|
+
extension: Node;
|
|
202
|
+
};
|
|
203
|
+
export type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView | {};
|
|
204
|
+
export type AnyCommands = Record<string, (...args: any[]) => Command>;
|
|
205
|
+
export type UnionCommands<T = Command> = UnionToIntersection<ValuesOf<Pick<Commands<T>, KeysWithTypeOf<Commands<T>, {}>>>>;
|
|
206
|
+
export type RawCommands = {
|
|
207
|
+
[Item in keyof UnionCommands]: UnionCommands<Command>[Item];
|
|
208
|
+
};
|
|
209
|
+
export type SingleCommands = {
|
|
210
|
+
[Item in keyof UnionCommands]: UnionCommands<boolean>[Item];
|
|
211
|
+
};
|
|
212
|
+
export type ChainedCommands = {
|
|
213
|
+
[Item in keyof UnionCommands]: UnionCommands<ChainedCommands>[Item];
|
|
214
|
+
} & {
|
|
215
|
+
run: () => boolean;
|
|
216
|
+
};
|
|
217
|
+
export type CanCommands = SingleCommands & {
|
|
218
|
+
chain: () => ChainedCommands;
|
|
219
|
+
};
|
|
220
|
+
export type FocusPosition = 'start' | 'end' | 'all' | number | boolean | null;
|
|
221
|
+
export type Range = {
|
|
222
|
+
from: number;
|
|
223
|
+
to: number;
|
|
224
|
+
};
|
|
225
|
+
export type NodeRange = {
|
|
226
|
+
node: ProseMirrorNode;
|
|
227
|
+
from: number;
|
|
228
|
+
to: number;
|
|
229
|
+
};
|
|
230
|
+
export type MarkRange = {
|
|
231
|
+
mark: ProseMirrorMark;
|
|
232
|
+
from: number;
|
|
233
|
+
to: number;
|
|
234
|
+
};
|
|
235
|
+
export type Predicate = (node: ProseMirrorNode) => boolean;
|
|
236
|
+
export type NodeWithPos = {
|
|
237
|
+
node: ProseMirrorNode;
|
|
238
|
+
pos: number;
|
|
239
|
+
};
|
|
240
|
+
export type TextSerializer = (props: {
|
|
241
|
+
node: ProseMirrorNode;
|
|
242
|
+
pos: number;
|
|
243
|
+
parent: ProseMirrorNode;
|
|
244
|
+
index: number;
|
|
245
|
+
range: Range;
|
|
246
|
+
}) => string;
|
|
247
|
+
export type ExtendedRegExpMatchArray = RegExpMatchArray & {
|
|
248
|
+
data?: Record<string, any>;
|
|
249
|
+
};
|
|
250
|
+
export type Dispatch = ((args?: any) => any) | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MaybeReturnType } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Optionally calls `value` as a function.
|
|
4
|
+
* Otherwise it is returned directly.
|
|
5
|
+
* @param value Function or any value.
|
|
6
|
+
* @param context Optional context to bind to function.
|
|
7
|
+
* @param props Optional props to pass to function.
|
|
8
|
+
*/
|
|
9
|
+
export declare function callOrReturn<T>(value: T, context?: any, ...props: any[]): MaybeReturnType<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createStyleTag(style: string, nonce?: string, suffix?: string): HTMLStyleElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function elementFromString(value: string): HTMLElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function escapeForRegEx(string: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findDuplicates(items: any[]): any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fromString(value: any): any;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from './callOrReturn.js';
|
|
2
|
+
export * from './createStyleTag.js';
|
|
3
|
+
export * from './deleteProps.js';
|
|
4
|
+
export * from './elementFromString.js';
|
|
5
|
+
export * from './escapeForRegEx.js';
|
|
6
|
+
export * from './findDuplicates.js';
|
|
7
|
+
export * from './fromString.js';
|
|
8
|
+
export * from './isEmptyObject.js';
|
|
9
|
+
export * from './isFunction.js';
|
|
10
|
+
export * from './isiOS.js';
|
|
11
|
+
export * from './isMacOS.js';
|
|
12
|
+
export * from './isNumber.js';
|
|
13
|
+
export * from './isPlainObject.js';
|
|
14
|
+
export * from './isRegExp.js';
|
|
15
|
+
export * from './isString.js';
|
|
16
|
+
export * from './mergeAttributes.js';
|
|
17
|
+
export * from './mergeDeep.js';
|
|
18
|
+
export * from './minMax.js';
|
|
19
|
+
export * from './objectIncludes.js';
|
|
20
|
+
export * from './removeDuplicates.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAndroid(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isEmptyObject(value?: {}): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isFunction(value: any): value is Function;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMacOS(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isNumber(value: any): value is number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPlainObject(value: any): value is Record<string, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isRegExp(value: any): value is RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isString(value: any): value is string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isiOS(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeAttributes(...objects: Record<string, any>[]): Record<string, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function minMax(value?: number, min?: number, max?: number): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes duplicated values within an array.
|
|
3
|
+
* Supports numbers, strings and objects.
|
|
4
|
+
*/
|
|
5
|
+
export declare function removeDuplicates<T>(array: T[], by?: {
|
|
6
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
7
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
8
|
+
}): T[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Typography } from './typography.js';
|
|
2
|
-
export * from './typography.js';
|
|
3
|
-
export default Typography;
|
|
1
|
+
import { Typography } from './typography.js';
|
|
2
|
+
export * from './typography.js';
|
|
3
|
+
export default Typography;
|
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export interface TypographyOptions {
|
|
3
|
-
/**
|
|
4
|
-
* The em dash character.
|
|
5
|
-
* @default '—'
|
|
6
|
-
*/
|
|
7
|
-
emDash: false | string;
|
|
8
|
-
/**
|
|
9
|
-
* The ellipsis character.
|
|
10
|
-
* @default '…'
|
|
11
|
-
*/
|
|
12
|
-
ellipsis: false | string;
|
|
13
|
-
/**
|
|
14
|
-
* The open double quote character.
|
|
15
|
-
* @default '“'
|
|
16
|
-
*/
|
|
17
|
-
openDoubleQuote: false | string;
|
|
18
|
-
/**
|
|
19
|
-
* The close double quote character.
|
|
20
|
-
* @default '”'
|
|
21
|
-
*/
|
|
22
|
-
closeDoubleQuote: false | string;
|
|
23
|
-
/**
|
|
24
|
-
* The open single quote character.
|
|
25
|
-
* @default '‘'
|
|
26
|
-
*/
|
|
27
|
-
openSingleQuote: false | string;
|
|
28
|
-
/**
|
|
29
|
-
* The close single quote character.
|
|
30
|
-
* @default '’'
|
|
31
|
-
*/
|
|
32
|
-
closeSingleQuote: false | string;
|
|
33
|
-
/**
|
|
34
|
-
* The left arrow character.
|
|
35
|
-
* @default '←'
|
|
36
|
-
*/
|
|
37
|
-
leftArrow: false | string;
|
|
38
|
-
/**
|
|
39
|
-
* The right arrow character.
|
|
40
|
-
* @default '→'
|
|
41
|
-
*/
|
|
42
|
-
rightArrow: false | string;
|
|
43
|
-
/**
|
|
44
|
-
* The copyright character.
|
|
45
|
-
* @default '©'
|
|
46
|
-
*/
|
|
47
|
-
copyright: false | string;
|
|
48
|
-
/**
|
|
49
|
-
* The trademark character.
|
|
50
|
-
* @default '™'
|
|
51
|
-
*/
|
|
52
|
-
trademark: false | string;
|
|
53
|
-
/**
|
|
54
|
-
* The servicemark character.
|
|
55
|
-
* @default '℠'
|
|
56
|
-
*/
|
|
57
|
-
servicemark: false | string;
|
|
58
|
-
/**
|
|
59
|
-
* The registered trademark character.
|
|
60
|
-
* @default '®'
|
|
61
|
-
*/
|
|
62
|
-
registeredTrademark: false | string;
|
|
63
|
-
/**
|
|
64
|
-
* The one half character.
|
|
65
|
-
* @default '½'
|
|
66
|
-
*/
|
|
67
|
-
oneHalf: false | string;
|
|
68
|
-
/**
|
|
69
|
-
* The plus minus character.
|
|
70
|
-
* @default '±'
|
|
71
|
-
*/
|
|
72
|
-
plusMinus: false | string;
|
|
73
|
-
/**
|
|
74
|
-
* The not equal character.
|
|
75
|
-
* @default '≠'
|
|
76
|
-
*/
|
|
77
|
-
notEqual: false | string;
|
|
78
|
-
/**
|
|
79
|
-
* The laquo character.
|
|
80
|
-
* @default '«'
|
|
81
|
-
*/
|
|
82
|
-
laquo: false | string;
|
|
83
|
-
/**
|
|
84
|
-
* The raquo character.
|
|
85
|
-
* @default '»'
|
|
86
|
-
*/
|
|
87
|
-
raquo: false | string;
|
|
88
|
-
/**
|
|
89
|
-
* The multiplication character.
|
|
90
|
-
* @default '×'
|
|
91
|
-
*/
|
|
92
|
-
multiplication: false | string;
|
|
93
|
-
/**
|
|
94
|
-
* The superscript two character.
|
|
95
|
-
* @default '²'
|
|
96
|
-
*/
|
|
97
|
-
superscriptTwo: false | string;
|
|
98
|
-
/**
|
|
99
|
-
* The superscript three character.
|
|
100
|
-
* @default '³'
|
|
101
|
-
*/
|
|
102
|
-
superscriptThree: false | string;
|
|
103
|
-
/**
|
|
104
|
-
* The one quarter character.
|
|
105
|
-
* @default '¼'
|
|
106
|
-
*/
|
|
107
|
-
oneQuarter: false | string;
|
|
108
|
-
/**
|
|
109
|
-
* The three quarters character.
|
|
110
|
-
* @default '¾'
|
|
111
|
-
*/
|
|
112
|
-
threeQuarters: false | string;
|
|
113
|
-
}
|
|
114
|
-
export declare const emDash: (override?: string) => import("@tiptap/core").InputRule;
|
|
115
|
-
export declare const ellipsis: (override?: string) => import("@tiptap/core").InputRule;
|
|
116
|
-
export declare const openDoubleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
117
|
-
export declare const closeDoubleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
118
|
-
export declare const openSingleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
119
|
-
export declare const closeSingleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
120
|
-
export declare const leftArrow: (override?: string) => import("@tiptap/core").InputRule;
|
|
121
|
-
export declare const rightArrow: (override?: string) => import("@tiptap/core").InputRule;
|
|
122
|
-
export declare const copyright: (override?: string) => import("@tiptap/core").InputRule;
|
|
123
|
-
export declare const trademark: (override?: string) => import("@tiptap/core").InputRule;
|
|
124
|
-
export declare const servicemark: (override?: string) => import("@tiptap/core").InputRule;
|
|
125
|
-
export declare const registeredTrademark: (override?: string) => import("@tiptap/core").InputRule;
|
|
126
|
-
export declare const oneHalf: (override?: string) => import("@tiptap/core").InputRule;
|
|
127
|
-
export declare const plusMinus: (override?: string) => import("@tiptap/core").InputRule;
|
|
128
|
-
export declare const notEqual: (override?: string) => import("@tiptap/core").InputRule;
|
|
129
|
-
export declare const laquo: (override?: string) => import("@tiptap/core").InputRule;
|
|
130
|
-
export declare const raquo: (override?: string) => import("@tiptap/core").InputRule;
|
|
131
|
-
export declare const multiplication: (override?: string) => import("@tiptap/core").InputRule;
|
|
132
|
-
export declare const superscriptTwo: (override?: string) => import("@tiptap/core").InputRule;
|
|
133
|
-
export declare const superscriptThree: (override?: string) => import("@tiptap/core").InputRule;
|
|
134
|
-
export declare const oneQuarter: (override?: string) => import("@tiptap/core").InputRule;
|
|
135
|
-
export declare const threeQuarters: (override?: string) => import("@tiptap/core").InputRule;
|
|
136
|
-
/**
|
|
137
|
-
* This extension allows you to add typography replacements for specific characters.
|
|
138
|
-
* @see https://www.tiptap.dev/api/extensions/typography
|
|
139
|
-
*/
|
|
140
|
-
export declare const Typography: Extension<TypographyOptions, any>;
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
export interface TypographyOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The em dash character.
|
|
5
|
+
* @default '—'
|
|
6
|
+
*/
|
|
7
|
+
emDash: false | string;
|
|
8
|
+
/**
|
|
9
|
+
* The ellipsis character.
|
|
10
|
+
* @default '…'
|
|
11
|
+
*/
|
|
12
|
+
ellipsis: false | string;
|
|
13
|
+
/**
|
|
14
|
+
* The open double quote character.
|
|
15
|
+
* @default '“'
|
|
16
|
+
*/
|
|
17
|
+
openDoubleQuote: false | string;
|
|
18
|
+
/**
|
|
19
|
+
* The close double quote character.
|
|
20
|
+
* @default '”'
|
|
21
|
+
*/
|
|
22
|
+
closeDoubleQuote: false | string;
|
|
23
|
+
/**
|
|
24
|
+
* The open single quote character.
|
|
25
|
+
* @default '‘'
|
|
26
|
+
*/
|
|
27
|
+
openSingleQuote: false | string;
|
|
28
|
+
/**
|
|
29
|
+
* The close single quote character.
|
|
30
|
+
* @default '’'
|
|
31
|
+
*/
|
|
32
|
+
closeSingleQuote: false | string;
|
|
33
|
+
/**
|
|
34
|
+
* The left arrow character.
|
|
35
|
+
* @default '←'
|
|
36
|
+
*/
|
|
37
|
+
leftArrow: false | string;
|
|
38
|
+
/**
|
|
39
|
+
* The right arrow character.
|
|
40
|
+
* @default '→'
|
|
41
|
+
*/
|
|
42
|
+
rightArrow: false | string;
|
|
43
|
+
/**
|
|
44
|
+
* The copyright character.
|
|
45
|
+
* @default '©'
|
|
46
|
+
*/
|
|
47
|
+
copyright: false | string;
|
|
48
|
+
/**
|
|
49
|
+
* The trademark character.
|
|
50
|
+
* @default '™'
|
|
51
|
+
*/
|
|
52
|
+
trademark: false | string;
|
|
53
|
+
/**
|
|
54
|
+
* The servicemark character.
|
|
55
|
+
* @default '℠'
|
|
56
|
+
*/
|
|
57
|
+
servicemark: false | string;
|
|
58
|
+
/**
|
|
59
|
+
* The registered trademark character.
|
|
60
|
+
* @default '®'
|
|
61
|
+
*/
|
|
62
|
+
registeredTrademark: false | string;
|
|
63
|
+
/**
|
|
64
|
+
* The one half character.
|
|
65
|
+
* @default '½'
|
|
66
|
+
*/
|
|
67
|
+
oneHalf: false | string;
|
|
68
|
+
/**
|
|
69
|
+
* The plus minus character.
|
|
70
|
+
* @default '±'
|
|
71
|
+
*/
|
|
72
|
+
plusMinus: false | string;
|
|
73
|
+
/**
|
|
74
|
+
* The not equal character.
|
|
75
|
+
* @default '≠'
|
|
76
|
+
*/
|
|
77
|
+
notEqual: false | string;
|
|
78
|
+
/**
|
|
79
|
+
* The laquo character.
|
|
80
|
+
* @default '«'
|
|
81
|
+
*/
|
|
82
|
+
laquo: false | string;
|
|
83
|
+
/**
|
|
84
|
+
* The raquo character.
|
|
85
|
+
* @default '»'
|
|
86
|
+
*/
|
|
87
|
+
raquo: false | string;
|
|
88
|
+
/**
|
|
89
|
+
* The multiplication character.
|
|
90
|
+
* @default '×'
|
|
91
|
+
*/
|
|
92
|
+
multiplication: false | string;
|
|
93
|
+
/**
|
|
94
|
+
* The superscript two character.
|
|
95
|
+
* @default '²'
|
|
96
|
+
*/
|
|
97
|
+
superscriptTwo: false | string;
|
|
98
|
+
/**
|
|
99
|
+
* The superscript three character.
|
|
100
|
+
* @default '³'
|
|
101
|
+
*/
|
|
102
|
+
superscriptThree: false | string;
|
|
103
|
+
/**
|
|
104
|
+
* The one quarter character.
|
|
105
|
+
* @default '¼'
|
|
106
|
+
*/
|
|
107
|
+
oneQuarter: false | string;
|
|
108
|
+
/**
|
|
109
|
+
* The three quarters character.
|
|
110
|
+
* @default '¾'
|
|
111
|
+
*/
|
|
112
|
+
threeQuarters: false | string;
|
|
113
|
+
}
|
|
114
|
+
export declare const emDash: (override?: string) => import("@tiptap/core").InputRule;
|
|
115
|
+
export declare const ellipsis: (override?: string) => import("@tiptap/core").InputRule;
|
|
116
|
+
export declare const openDoubleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
117
|
+
export declare const closeDoubleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
118
|
+
export declare const openSingleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
119
|
+
export declare const closeSingleQuote: (override?: string) => import("@tiptap/core").InputRule;
|
|
120
|
+
export declare const leftArrow: (override?: string) => import("@tiptap/core").InputRule;
|
|
121
|
+
export declare const rightArrow: (override?: string) => import("@tiptap/core").InputRule;
|
|
122
|
+
export declare const copyright: (override?: string) => import("@tiptap/core").InputRule;
|
|
123
|
+
export declare const trademark: (override?: string) => import("@tiptap/core").InputRule;
|
|
124
|
+
export declare const servicemark: (override?: string) => import("@tiptap/core").InputRule;
|
|
125
|
+
export declare const registeredTrademark: (override?: string) => import("@tiptap/core").InputRule;
|
|
126
|
+
export declare const oneHalf: (override?: string) => import("@tiptap/core").InputRule;
|
|
127
|
+
export declare const plusMinus: (override?: string) => import("@tiptap/core").InputRule;
|
|
128
|
+
export declare const notEqual: (override?: string) => import("@tiptap/core").InputRule;
|
|
129
|
+
export declare const laquo: (override?: string) => import("@tiptap/core").InputRule;
|
|
130
|
+
export declare const raquo: (override?: string) => import("@tiptap/core").InputRule;
|
|
131
|
+
export declare const multiplication: (override?: string) => import("@tiptap/core").InputRule;
|
|
132
|
+
export declare const superscriptTwo: (override?: string) => import("@tiptap/core").InputRule;
|
|
133
|
+
export declare const superscriptThree: (override?: string) => import("@tiptap/core").InputRule;
|
|
134
|
+
export declare const oneQuarter: (override?: string) => import("@tiptap/core").InputRule;
|
|
135
|
+
export declare const threeQuarters: (override?: string) => import("@tiptap/core").InputRule;
|
|
136
|
+
/**
|
|
137
|
+
* This extension allows you to add typography replacements for specific characters.
|
|
138
|
+
* @see https://www.tiptap.dev/api/extensions/typography
|
|
139
|
+
*/
|
|
140
|
+
export declare const Typography: Extension<TypographyOptions, any>;
|