@tiptap/extension-character-count 3.0.0 → 3.0.1
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/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +32 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -92
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/index.ts +3 -2
- package/dist/index.umd.js +0 -100
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -161
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -343
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -451
- package/dist/packages/core/src/Node.d.ts +0 -611
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -255
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-character-count/src/character-count.d.ts +0 -42
- package/dist/packages/extension-character-count/src/index.d.ts +0 -3
- package/src/character-count.ts +0 -144
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
import { DOMOutputSpec, Mark as ProseMirrorMark, MarkSpec, MarkType } from '@tiptap/pm/model';
|
|
2
|
-
import { Plugin, Transaction } from '@tiptap/pm/state';
|
|
3
|
-
import { Editor } from './Editor.js';
|
|
4
|
-
import { MarkConfig } from './index.js';
|
|
5
|
-
import { InputRule } from './InputRule.js';
|
|
6
|
-
import { Node } from './Node.js';
|
|
7
|
-
import { PasteRule } from './PasteRule.js';
|
|
8
|
-
import { Attributes, Extensions, GlobalAttributes, KeyboardShortcutCommand, ParentConfig, RawCommands } from './types.js';
|
|
9
|
-
declare module '@tiptap/core' {
|
|
10
|
-
interface MarkConfig<Options = any, Storage = any> {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
/**
|
|
13
|
-
* The extension name - this must be unique.
|
|
14
|
-
* It will be used to identify the extension.
|
|
15
|
-
*
|
|
16
|
-
* @example 'myExtension'
|
|
17
|
-
*/
|
|
18
|
-
name: string;
|
|
19
|
-
/**
|
|
20
|
-
* The priority of your extension. The higher, the later it will be called
|
|
21
|
-
* and will take precedence over other extensions with a lower priority.
|
|
22
|
-
* @default 1000
|
|
23
|
-
* @example 1001
|
|
24
|
-
*/
|
|
25
|
-
priority?: number;
|
|
26
|
-
/**
|
|
27
|
-
* The default options for this extension.
|
|
28
|
-
* @example
|
|
29
|
-
* defaultOptions: {
|
|
30
|
-
* myOption: 'foo',
|
|
31
|
-
* myOtherOption: 10,
|
|
32
|
-
* }
|
|
33
|
-
*/
|
|
34
|
-
defaultOptions?: Options;
|
|
35
|
-
/**
|
|
36
|
-
* This method will add options to this extension
|
|
37
|
-
* @see https://tiptap.dev/guide/custom-extensions#settings
|
|
38
|
-
* @example
|
|
39
|
-
* addOptions() {
|
|
40
|
-
* return {
|
|
41
|
-
* myOption: 'foo',
|
|
42
|
-
* myOtherOption: 10,
|
|
43
|
-
* }
|
|
44
|
-
*/
|
|
45
|
-
addOptions?: (this: {
|
|
46
|
-
name: string;
|
|
47
|
-
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>;
|
|
48
|
-
}) => Options;
|
|
49
|
-
/**
|
|
50
|
-
* The default storage this extension can save data to.
|
|
51
|
-
* @see https://tiptap.dev/guide/custom-extensions#storage
|
|
52
|
-
* @example
|
|
53
|
-
* defaultStorage: {
|
|
54
|
-
* prefetchedUsers: [],
|
|
55
|
-
* loading: false,
|
|
56
|
-
* }
|
|
57
|
-
*/
|
|
58
|
-
addStorage?: (this: {
|
|
59
|
-
name: string;
|
|
60
|
-
options: Options;
|
|
61
|
-
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>;
|
|
62
|
-
}) => Storage;
|
|
63
|
-
/**
|
|
64
|
-
* This function adds globalAttributes to specific nodes.
|
|
65
|
-
* @see https://tiptap.dev/guide/custom-extensions#global-attributes
|
|
66
|
-
* @example
|
|
67
|
-
* addGlobalAttributes() {
|
|
68
|
-
* return [
|
|
69
|
-
* {
|
|
70
|
-
// Extend the following extensions
|
|
71
|
-
* types: [
|
|
72
|
-
* 'heading',
|
|
73
|
-
* 'paragraph',
|
|
74
|
-
* ],
|
|
75
|
-
* // … with those attributes
|
|
76
|
-
* attributes: {
|
|
77
|
-
* textAlign: {
|
|
78
|
-
* default: 'left',
|
|
79
|
-
* renderHTML: attributes => ({
|
|
80
|
-
* style: `text-align: ${attributes.textAlign}`,
|
|
81
|
-
* }),
|
|
82
|
-
* parseHTML: element => element.style.textAlign || 'left',
|
|
83
|
-
* },
|
|
84
|
-
* },
|
|
85
|
-
* },
|
|
86
|
-
* ]
|
|
87
|
-
* }
|
|
88
|
-
*/
|
|
89
|
-
addGlobalAttributes?: (this: {
|
|
90
|
-
name: string;
|
|
91
|
-
options: Options;
|
|
92
|
-
storage: Storage;
|
|
93
|
-
extensions: (Node | Mark)[];
|
|
94
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'];
|
|
95
|
-
}) => GlobalAttributes;
|
|
96
|
-
/**
|
|
97
|
-
* This function adds commands to the editor
|
|
98
|
-
* @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
|
|
99
|
-
* @example
|
|
100
|
-
* addCommands() {
|
|
101
|
-
* return {
|
|
102
|
-
* myCommand: () => ({ chain }) => chain().setMark('type', 'foo').run(),
|
|
103
|
-
* }
|
|
104
|
-
* }
|
|
105
|
-
*/
|
|
106
|
-
addCommands?: (this: {
|
|
107
|
-
name: string;
|
|
108
|
-
options: Options;
|
|
109
|
-
storage: Storage;
|
|
110
|
-
editor: Editor;
|
|
111
|
-
type: MarkType;
|
|
112
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addCommands'];
|
|
113
|
-
}) => Partial<RawCommands>;
|
|
114
|
-
/**
|
|
115
|
-
* This function registers keyboard shortcuts.
|
|
116
|
-
* @see https://tiptap.dev/guide/custom-extensions#keyboard-shortcuts
|
|
117
|
-
* @example
|
|
118
|
-
* addKeyboardShortcuts() {
|
|
119
|
-
* return {
|
|
120
|
-
* 'Mod-l': () => this.editor.commands.toggleBulletList(),
|
|
121
|
-
* }
|
|
122
|
-
* },
|
|
123
|
-
*/
|
|
124
|
-
addKeyboardShortcuts?: (this: {
|
|
125
|
-
name: string;
|
|
126
|
-
options: Options;
|
|
127
|
-
storage: Storage;
|
|
128
|
-
editor: Editor;
|
|
129
|
-
type: MarkType;
|
|
130
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
131
|
-
}) => {
|
|
132
|
-
[key: string]: KeyboardShortcutCommand;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* This function adds input rules to the editor.
|
|
136
|
-
* @see https://tiptap.dev/guide/custom-extensions#input-rules
|
|
137
|
-
* @example
|
|
138
|
-
* addInputRules() {
|
|
139
|
-
* return [
|
|
140
|
-
* markInputRule({
|
|
141
|
-
* find: inputRegex,
|
|
142
|
-
* type: this.type,
|
|
143
|
-
* }),
|
|
144
|
-
* ]
|
|
145
|
-
* },
|
|
146
|
-
*/
|
|
147
|
-
addInputRules?: (this: {
|
|
148
|
-
name: string;
|
|
149
|
-
options: Options;
|
|
150
|
-
storage: Storage;
|
|
151
|
-
editor: Editor;
|
|
152
|
-
type: MarkType;
|
|
153
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addInputRules'];
|
|
154
|
-
}) => InputRule[];
|
|
155
|
-
/**
|
|
156
|
-
* This function adds paste rules to the editor.
|
|
157
|
-
* @see https://tiptap.dev/guide/custom-extensions#paste-rules
|
|
158
|
-
* @example
|
|
159
|
-
* addPasteRules() {
|
|
160
|
-
* return [
|
|
161
|
-
* markPasteRule({
|
|
162
|
-
* find: pasteRegex,
|
|
163
|
-
* type: this.type,
|
|
164
|
-
* }),
|
|
165
|
-
* ]
|
|
166
|
-
* },
|
|
167
|
-
*/
|
|
168
|
-
addPasteRules?: (this: {
|
|
169
|
-
name: string;
|
|
170
|
-
options: Options;
|
|
171
|
-
storage: Storage;
|
|
172
|
-
editor: Editor;
|
|
173
|
-
type: MarkType;
|
|
174
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addPasteRules'];
|
|
175
|
-
}) => PasteRule[];
|
|
176
|
-
/**
|
|
177
|
-
* This function adds Prosemirror plugins to the editor
|
|
178
|
-
* @see https://tiptap.dev/guide/custom-extensions#prosemirror-plugins
|
|
179
|
-
* @example
|
|
180
|
-
* addProseMirrorPlugins() {
|
|
181
|
-
* return [
|
|
182
|
-
* customPlugin(),
|
|
183
|
-
* ]
|
|
184
|
-
* }
|
|
185
|
-
*/
|
|
186
|
-
addProseMirrorPlugins?: (this: {
|
|
187
|
-
name: string;
|
|
188
|
-
options: Options;
|
|
189
|
-
storage: Storage;
|
|
190
|
-
editor: Editor;
|
|
191
|
-
type: MarkType;
|
|
192
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
193
|
-
}) => Plugin[];
|
|
194
|
-
/**
|
|
195
|
-
* This function adds additional extensions to the editor. This is useful for
|
|
196
|
-
* building extension kits.
|
|
197
|
-
* @example
|
|
198
|
-
* addExtensions() {
|
|
199
|
-
* return [
|
|
200
|
-
* BulletList,
|
|
201
|
-
* OrderedList,
|
|
202
|
-
* ListItem
|
|
203
|
-
* ]
|
|
204
|
-
* }
|
|
205
|
-
*/
|
|
206
|
-
addExtensions?: (this: {
|
|
207
|
-
name: string;
|
|
208
|
-
options: Options;
|
|
209
|
-
storage: Storage;
|
|
210
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addExtensions'];
|
|
211
|
-
}) => Extensions;
|
|
212
|
-
/**
|
|
213
|
-
* This function extends the schema of the node.
|
|
214
|
-
* @example
|
|
215
|
-
* extendNodeSchema() {
|
|
216
|
-
* return {
|
|
217
|
-
* group: 'inline',
|
|
218
|
-
* selectable: false,
|
|
219
|
-
* }
|
|
220
|
-
* }
|
|
221
|
-
*/
|
|
222
|
-
extendNodeSchema?: ((this: {
|
|
223
|
-
name: string;
|
|
224
|
-
options: Options;
|
|
225
|
-
storage: Storage;
|
|
226
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['extendNodeSchema'];
|
|
227
|
-
}, extension: Node) => Record<string, any>) | null;
|
|
228
|
-
/**
|
|
229
|
-
* This function extends the schema of the mark.
|
|
230
|
-
* @example
|
|
231
|
-
* extendMarkSchema() {
|
|
232
|
-
* return {
|
|
233
|
-
* group: 'inline',
|
|
234
|
-
* selectable: false,
|
|
235
|
-
* }
|
|
236
|
-
* }
|
|
237
|
-
*/
|
|
238
|
-
extendMarkSchema?: ((this: {
|
|
239
|
-
name: string;
|
|
240
|
-
options: Options;
|
|
241
|
-
storage: Storage;
|
|
242
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['extendMarkSchema'];
|
|
243
|
-
}, extension: Mark) => Record<string, any>) | null;
|
|
244
|
-
/**
|
|
245
|
-
* The editor is not ready yet.
|
|
246
|
-
*/
|
|
247
|
-
onBeforeCreate?: ((this: {
|
|
248
|
-
name: string;
|
|
249
|
-
options: Options;
|
|
250
|
-
storage: Storage;
|
|
251
|
-
editor: Editor;
|
|
252
|
-
type: MarkType;
|
|
253
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onBeforeCreate'];
|
|
254
|
-
}) => void) | null;
|
|
255
|
-
/**
|
|
256
|
-
* The editor is ready.
|
|
257
|
-
*/
|
|
258
|
-
onCreate?: ((this: {
|
|
259
|
-
name: string;
|
|
260
|
-
options: Options;
|
|
261
|
-
storage: Storage;
|
|
262
|
-
editor: Editor;
|
|
263
|
-
type: MarkType;
|
|
264
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onCreate'];
|
|
265
|
-
}) => void) | null;
|
|
266
|
-
/**
|
|
267
|
-
* The content has changed.
|
|
268
|
-
*/
|
|
269
|
-
onUpdate?: ((this: {
|
|
270
|
-
name: string;
|
|
271
|
-
options: Options;
|
|
272
|
-
storage: Storage;
|
|
273
|
-
editor: Editor;
|
|
274
|
-
type: MarkType;
|
|
275
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onUpdate'];
|
|
276
|
-
}) => void) | null;
|
|
277
|
-
/**
|
|
278
|
-
* The selection has changed.
|
|
279
|
-
*/
|
|
280
|
-
onSelectionUpdate?: ((this: {
|
|
281
|
-
name: string;
|
|
282
|
-
options: Options;
|
|
283
|
-
storage: Storage;
|
|
284
|
-
editor: Editor;
|
|
285
|
-
type: MarkType;
|
|
286
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onSelectionUpdate'];
|
|
287
|
-
}) => void) | null;
|
|
288
|
-
/**
|
|
289
|
-
* The editor state has changed.
|
|
290
|
-
*/
|
|
291
|
-
onTransaction?: ((this: {
|
|
292
|
-
name: string;
|
|
293
|
-
options: Options;
|
|
294
|
-
storage: Storage;
|
|
295
|
-
editor: Editor;
|
|
296
|
-
type: MarkType;
|
|
297
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onTransaction'];
|
|
298
|
-
}, props: {
|
|
299
|
-
transaction: Transaction;
|
|
300
|
-
}) => void) | null;
|
|
301
|
-
/**
|
|
302
|
-
* The editor is focused.
|
|
303
|
-
*/
|
|
304
|
-
onFocus?: ((this: {
|
|
305
|
-
name: string;
|
|
306
|
-
options: Options;
|
|
307
|
-
storage: Storage;
|
|
308
|
-
editor: Editor;
|
|
309
|
-
type: MarkType;
|
|
310
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
|
|
311
|
-
}, props: {
|
|
312
|
-
event: FocusEvent;
|
|
313
|
-
}) => void) | null;
|
|
314
|
-
/**
|
|
315
|
-
* The editor isn’t focused anymore.
|
|
316
|
-
*/
|
|
317
|
-
onBlur?: ((this: {
|
|
318
|
-
name: string;
|
|
319
|
-
options: Options;
|
|
320
|
-
storage: Storage;
|
|
321
|
-
editor: Editor;
|
|
322
|
-
type: MarkType;
|
|
323
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
|
|
324
|
-
}, props: {
|
|
325
|
-
event: FocusEvent;
|
|
326
|
-
}) => void) | null;
|
|
327
|
-
/**
|
|
328
|
-
* The editor is destroyed.
|
|
329
|
-
*/
|
|
330
|
-
onDestroy?: ((this: {
|
|
331
|
-
name: string;
|
|
332
|
-
options: Options;
|
|
333
|
-
storage: Storage;
|
|
334
|
-
editor: Editor;
|
|
335
|
-
type: MarkType;
|
|
336
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
|
|
337
|
-
}) => void) | null;
|
|
338
|
-
/**
|
|
339
|
-
* Keep mark after split node
|
|
340
|
-
*/
|
|
341
|
-
keepOnSplit?: boolean | (() => boolean);
|
|
342
|
-
/**
|
|
343
|
-
* Inclusive
|
|
344
|
-
*/
|
|
345
|
-
inclusive?: MarkSpec['inclusive'] | ((this: {
|
|
346
|
-
name: string;
|
|
347
|
-
options: Options;
|
|
348
|
-
storage: Storage;
|
|
349
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
|
|
350
|
-
editor?: Editor;
|
|
351
|
-
}) => MarkSpec['inclusive']);
|
|
352
|
-
/**
|
|
353
|
-
* Excludes
|
|
354
|
-
*/
|
|
355
|
-
excludes?: MarkSpec['excludes'] | ((this: {
|
|
356
|
-
name: string;
|
|
357
|
-
options: Options;
|
|
358
|
-
storage: Storage;
|
|
359
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
|
|
360
|
-
editor?: Editor;
|
|
361
|
-
}) => MarkSpec['excludes']);
|
|
362
|
-
/**
|
|
363
|
-
* Marks this Mark as exitable
|
|
364
|
-
*/
|
|
365
|
-
exitable?: boolean | (() => boolean);
|
|
366
|
-
/**
|
|
367
|
-
* Group
|
|
368
|
-
*/
|
|
369
|
-
group?: MarkSpec['group'] | ((this: {
|
|
370
|
-
name: string;
|
|
371
|
-
options: Options;
|
|
372
|
-
storage: Storage;
|
|
373
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
|
|
374
|
-
editor?: Editor;
|
|
375
|
-
}) => MarkSpec['group']);
|
|
376
|
-
/**
|
|
377
|
-
* Spanning
|
|
378
|
-
*/
|
|
379
|
-
spanning?: MarkSpec['spanning'] | ((this: {
|
|
380
|
-
name: string;
|
|
381
|
-
options: Options;
|
|
382
|
-
storage: Storage;
|
|
383
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
|
|
384
|
-
editor?: Editor;
|
|
385
|
-
}) => MarkSpec['spanning']);
|
|
386
|
-
/**
|
|
387
|
-
* Code
|
|
388
|
-
*/
|
|
389
|
-
code?: boolean | ((this: {
|
|
390
|
-
name: string;
|
|
391
|
-
options: Options;
|
|
392
|
-
storage: Storage;
|
|
393
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
|
|
394
|
-
editor?: Editor;
|
|
395
|
-
}) => boolean);
|
|
396
|
-
/**
|
|
397
|
-
* Parse HTML
|
|
398
|
-
*/
|
|
399
|
-
parseHTML?: (this: {
|
|
400
|
-
name: string;
|
|
401
|
-
options: Options;
|
|
402
|
-
storage: Storage;
|
|
403
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
|
|
404
|
-
editor?: Editor;
|
|
405
|
-
}) => MarkSpec['parseDOM'];
|
|
406
|
-
/**
|
|
407
|
-
* Render HTML
|
|
408
|
-
*/
|
|
409
|
-
renderHTML?: ((this: {
|
|
410
|
-
name: string;
|
|
411
|
-
options: Options;
|
|
412
|
-
storage: Storage;
|
|
413
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
|
|
414
|
-
editor?: Editor;
|
|
415
|
-
}, props: {
|
|
416
|
-
mark: ProseMirrorMark;
|
|
417
|
-
HTMLAttributes: Record<string, any>;
|
|
418
|
-
}) => DOMOutputSpec) | null;
|
|
419
|
-
/**
|
|
420
|
-
* Attributes
|
|
421
|
-
*/
|
|
422
|
-
addAttributes?: (this: {
|
|
423
|
-
name: string;
|
|
424
|
-
options: Options;
|
|
425
|
-
storage: Storage;
|
|
426
|
-
parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
|
|
427
|
-
editor?: Editor;
|
|
428
|
-
}) => Attributes | {};
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* The Mark class is used to create custom mark extensions.
|
|
433
|
-
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
434
|
-
*/
|
|
435
|
-
export declare class Mark<Options = any, Storage = any> {
|
|
436
|
-
type: string;
|
|
437
|
-
name: string;
|
|
438
|
-
parent: Mark | null;
|
|
439
|
-
child: Mark | null;
|
|
440
|
-
options: Options;
|
|
441
|
-
storage: Storage;
|
|
442
|
-
config: MarkConfig;
|
|
443
|
-
constructor(config?: Partial<MarkConfig<Options, Storage>>);
|
|
444
|
-
static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
|
|
445
|
-
configure(options?: Partial<Options>): Mark<any, any>;
|
|
446
|
-
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
|
|
447
|
-
static handleExit({ editor, mark }: {
|
|
448
|
-
editor: Editor;
|
|
449
|
-
mark: Mark;
|
|
450
|
-
}): boolean;
|
|
451
|
-
}
|