@tiptap/react 2.0.0-beta.9 → 2.0.0-beta.94
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 +1 -1
- package/README.md +2 -2
- package/dist/packages/core/src/CommandManager.d.ts +20 -0
- package/dist/packages/core/src/Editor.d.ts +145 -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 +319 -0
- package/dist/packages/core/src/Node.d.ts +388 -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/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 +12 -0
- package/dist/packages/core/src/commands/forEach.d.ts +14 -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/joinBackward.d.ts +12 -0
- package/dist/packages/core/src/commands/joinForward.d.ts +12 -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/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 +98 -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/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/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 +9 -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/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/getTextSeralizersFromSchema.d.ts +3 -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/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/selectionToInsertionEnd.d.ts +2 -0
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +9 -0
- package/dist/packages/core/src/index.d.ts +57 -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/markPasteRule.d.ts +12 -0
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
- package/dist/packages/core/src/style.d.ts +2 -0
- package/dist/packages/core/src/types.d.ts +209 -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/findDuplicates.d.ts +1 -0
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -0
- package/dist/packages/core/src/utilities/isClass.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/isNumber.d.ts +1 -0
- package/dist/packages/core/src/utilities/isObject.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/extension-blockquote/src/blockquote.d.ts +24 -0
- package/dist/packages/extension-blockquote/src/index.d.ts +3 -0
- package/dist/packages/extension-bold/src/bold.d.ts +27 -0
- package/dist/packages/extension-bold/src/index.d.ts +3 -0
- package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +43 -0
- package/dist/packages/extension-bubble-menu/src/bubble-menu.d.ts +6 -0
- package/dist/packages/extension-bubble-menu/src/index.d.ts +4 -0
- package/dist/packages/extension-bullet-list/src/bullet-list.d.ts +16 -0
- package/dist/packages/extension-bullet-list/src/index.d.ts +3 -0
- package/dist/packages/extension-character-count/src/character-count.d.ts +7 -0
- package/dist/packages/extension-character-count/src/index.d.ts +3 -0
- package/dist/packages/extension-code/src/code.d.ts +25 -0
- package/dist/packages/extension-code/src/index.d.ts +3 -0
- package/dist/packages/extension-code-block/src/code-block.d.ts +26 -0
- package/dist/packages/extension-code-block/src/index.d.ts +3 -0
- package/dist/packages/extension-code-block-lowlight/src/code-block-lowlight.d.ts +6 -0
- package/dist/packages/extension-code-block-lowlight/src/index.d.ts +3 -0
- package/dist/packages/extension-code-block-lowlight/src/lowlight-plugin.d.ts +6 -0
- package/dist/packages/extension-collaboration/src/collaboration.d.ts +30 -0
- package/dist/packages/extension-collaboration/src/helpers/isChangeOrigin.d.ts +2 -0
- package/dist/packages/extension-collaboration/src/index.d.ts +4 -0
- package/dist/packages/extension-collaboration-cursor/src/collaboration-cursor.d.ts +37 -0
- package/dist/packages/extension-collaboration-cursor/src/index.d.ts +3 -0
- package/dist/packages/extension-color/src/color.d.ts +21 -0
- package/dist/packages/extension-color/src/index.d.ts +3 -0
- package/dist/packages/extension-document/src/document.d.ts +2 -0
- package/dist/packages/extension-document/src/index.d.ts +3 -0
- package/dist/packages/extension-dropcursor/src/dropcursor.d.ts +7 -0
- package/dist/packages/extension-dropcursor/src/index.d.ts +3 -0
- package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +40 -0
- package/dist/packages/extension-floating-menu/src/floating-menu.d.ts +6 -0
- package/dist/packages/extension-floating-menu/src/index.d.ts +4 -0
- package/dist/packages/extension-focus/src/focus.d.ts +6 -0
- package/dist/packages/extension-focus/src/index.d.ts +3 -0
- package/dist/packages/extension-font-family/src/font-family.d.ts +21 -0
- package/dist/packages/extension-font-family/src/index.d.ts +3 -0
- package/dist/packages/extension-gapcursor/src/gapcursor.d.ts +15 -0
- package/dist/packages/extension-gapcursor/src/index.d.ts +3 -0
- package/dist/packages/extension-hard-break/src/hard-break.d.ts +16 -0
- package/dist/packages/extension-hard-break/src/index.d.ts +3 -0
- package/dist/packages/extension-heading/src/heading.d.ts +26 -0
- package/dist/packages/extension-heading/src/index.d.ts +3 -0
- package/dist/packages/extension-highlight/src/highlight.d.ts +30 -0
- package/dist/packages/extension-highlight/src/index.d.ts +3 -0
- package/dist/packages/extension-history/src/history.d.ts +20 -0
- package/dist/packages/extension-history/src/index.d.ts +3 -0
- package/dist/packages/extension-horizontal-rule/src/horizontal-rule.d.ts +15 -0
- package/dist/packages/extension-horizontal-rule/src/index.d.ts +3 -0
- package/dist/packages/extension-image/src/image.d.ts +21 -0
- package/dist/packages/extension-image/src/index.d.ts +3 -0
- package/dist/packages/extension-italic/src/index.d.ts +3 -0
- package/dist/packages/extension-italic/src/italic.d.ts +27 -0
- package/dist/packages/extension-link/src/index.d.ts +3 -0
- package/dist/packages/extension-link/src/link.d.ts +40 -0
- package/dist/packages/extension-list-item/src/index.d.ts +3 -0
- package/dist/packages/extension-list-item/src/list-item.d.ts +5 -0
- package/dist/packages/extension-mention/src/index.d.ts +3 -0
- package/dist/packages/extension-mention/src/mention.d.ts +14 -0
- package/dist/packages/extension-ordered-list/src/index.d.ts +3 -0
- package/dist/packages/extension-ordered-list/src/ordered-list.d.ts +16 -0
- package/dist/packages/extension-paragraph/src/index.d.ts +3 -0
- package/dist/packages/extension-paragraph/src/paragraph.d.ts +15 -0
- package/dist/packages/extension-placeholder/src/index.d.ts +3 -0
- package/dist/packages/extension-placeholder/src/placeholder.d.ts +15 -0
- package/dist/packages/extension-strike/src/index.d.ts +3 -0
- package/dist/packages/extension-strike/src/strike.d.ts +25 -0
- package/dist/packages/extension-subscript/src/index.d.ts +3 -0
- package/dist/packages/extension-subscript/src/subscript.d.ts +23 -0
- package/dist/packages/extension-superscript/src/index.d.ts +3 -0
- package/dist/packages/extension-superscript/src/superscript.d.ts +23 -0
- package/dist/packages/extension-table/src/TableView.d.ts +17 -0
- package/dist/packages/extension-table/src/index.d.ts +4 -0
- package/dist/packages/extension-table/src/table.d.ts +55 -0
- package/dist/packages/extension-table/src/utilities/createCell.d.ts +2 -0
- package/dist/packages/extension-table/src/utilities/createTable.d.ts +2 -0
- package/dist/packages/extension-table/src/utilities/deleteTableWhenAllCellsSelected.d.ts +2 -0
- package/dist/packages/extension-table/src/utilities/getTableNodeTypes.d.ts +4 -0
- package/dist/packages/extension-table/src/utilities/isCellSelection.d.ts +2 -0
- package/dist/packages/extension-table-cell/src/index.d.ts +3 -0
- package/dist/packages/extension-table-cell/src/table-cell.d.ts +5 -0
- package/dist/packages/extension-table-header/src/index.d.ts +3 -0
- package/dist/packages/extension-table-header/src/table-header.d.ts +5 -0
- package/dist/packages/extension-table-row/src/index.d.ts +3 -0
- package/dist/packages/extension-table-row/src/table-row.d.ts +5 -0
- package/dist/packages/extension-task-item/src/index.d.ts +3 -0
- package/dist/packages/extension-task-item/src/task-item.d.ts +7 -0
- package/dist/packages/extension-task-list/src/index.d.ts +3 -0
- package/dist/packages/extension-task-list/src/task-list.d.ts +15 -0
- package/dist/packages/extension-text/src/index.d.ts +3 -0
- package/dist/packages/extension-text/src/text.d.ts +2 -0
- package/dist/packages/extension-text-align/src/index.d.ts +3 -0
- package/dist/packages/extension-text-align/src/text-align.d.ts +21 -0
- package/dist/packages/extension-text-style/src/index.d.ts +3 -0
- package/dist/packages/extension-text-style/src/text-style.d.ts +15 -0
- package/dist/packages/extension-typography/src/index.d.ts +3 -0
- package/dist/packages/extension-typography/src/typography.d.ts +23 -0
- package/dist/packages/extension-underline/src/index.d.ts +3 -0
- package/dist/packages/extension-underline/src/underline.d.ts +23 -0
- package/dist/packages/html/src/generateHTML.d.ts +2 -0
- package/dist/packages/html/src/generateJSON.d.ts +2 -0
- package/dist/packages/html/src/getHTMLFromFragment.d.ts +2 -0
- package/dist/packages/html/src/index.d.ts +2 -0
- package/dist/packages/react/src/BubbleMenu.d.ts +3 -1
- package/dist/packages/react/src/EditorContent.d.ts +2 -2
- package/dist/packages/react/src/FloatingMenu.d.ts +8 -0
- package/dist/packages/react/src/NodeViewContent.d.ts +2 -2
- package/dist/packages/react/src/NodeViewWrapper.d.ts +2 -2
- package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +9 -5
- package/dist/packages/react/src/ReactRenderer.d.ts +15 -10
- package/dist/packages/react/src/index.d.ts +1 -0
- package/dist/packages/react/src/useEditor.d.ts +2 -1
- package/dist/packages/react/src/useReactNodeView.d.ts +1 -1
- package/dist/packages/starter-kit/src/index.d.ts +3 -0
- package/dist/packages/starter-kit/src/starter-kit.d.ts +37 -0
- package/dist/packages/suggestion/src/findSuggestionMatch.d.ts +15 -0
- package/dist/packages/suggestion/src/index.d.ts +4 -0
- package/dist/packages/suggestion/src/suggestion.d.ts +49 -0
- package/dist/tests/cypress/integration/core/can.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/editorProps.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/extendExtensions.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/extendMarkRange.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/extensionOptions.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/fromString.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/generateHTML.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/generateJSON.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/isActive.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/isClass.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/mergeAttributes.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/mergeDeep.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/core/pluginOrder.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/extensions/bold.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/extensions/codeBlockLowlight.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/html/generateHTML.spec.d.ts +1 -0
- package/dist/tests/cypress/integration/html/generateJSON.spec.d.ts +1 -0
- package/dist/tiptap-react.cjs.js +127 -54
- package/dist/tiptap-react.cjs.js.map +1 -1
- package/dist/tiptap-react.esm.js +120 -46
- package/dist/tiptap-react.esm.js.map +1 -1
- package/dist/tiptap-react.umd.js +131 -59
- package/dist/tiptap-react.umd.js.map +1 -1
- package/package.json +17 -9
- package/src/BubbleMenu.tsx +23 -7
- package/src/EditorContent.tsx +8 -7
- package/src/FloatingMenu.tsx +46 -0
- package/src/NodeViewContent.tsx +9 -6
- package/src/NodeViewWrapper.tsx +11 -9
- package/src/ReactNodeViewRenderer.tsx +68 -28
- package/src/ReactRenderer.tsx +26 -14
- package/src/index.ts +1 -0
- package/src/useEditor.ts +10 -4
- package/src/useReactNodeView.ts +1 -2
- package/CHANGELOG.md +0 -80
- package/dist/tiptap-react.bundle.umd.min.js +0 -54
- package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { DOMOutputSpec, MarkSpec, Mark as ProseMirrorMark, MarkType } from 'prosemirror-model';
|
|
2
|
+
import { Plugin, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { InputRule } from './InputRule';
|
|
4
|
+
import { PasteRule } from './PasteRule';
|
|
5
|
+
import { Extensions, Attributes, RawCommands, GlobalAttributes, ParentConfig, KeyboardShortcutCommand } from './types';
|
|
6
|
+
import { Node } from './Node';
|
|
7
|
+
import { MarkConfig } from '.';
|
|
8
|
+
import { Editor } from './Editor';
|
|
9
|
+
declare module '@tiptap/core' {
|
|
10
|
+
interface MarkConfig<Options = any, Storage = any> {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
/**
|
|
13
|
+
* Name
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Priority
|
|
18
|
+
*/
|
|
19
|
+
priority?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Default options
|
|
22
|
+
*/
|
|
23
|
+
defaultOptions?: Options;
|
|
24
|
+
/**
|
|
25
|
+
* Default Options
|
|
26
|
+
*/
|
|
27
|
+
addOptions?: (this: {
|
|
28
|
+
name: string;
|
|
29
|
+
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>;
|
|
30
|
+
}) => Options;
|
|
31
|
+
/**
|
|
32
|
+
* Default Storage
|
|
33
|
+
*/
|
|
34
|
+
addStorage?: (this: {
|
|
35
|
+
name: string;
|
|
36
|
+
options: Options;
|
|
37
|
+
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>;
|
|
38
|
+
}) => Storage;
|
|
39
|
+
/**
|
|
40
|
+
* Global attributes
|
|
41
|
+
*/
|
|
42
|
+
addGlobalAttributes?: (this: {
|
|
43
|
+
name: string;
|
|
44
|
+
options: Options;
|
|
45
|
+
storage: Storage;
|
|
46
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addGlobalAttributes'];
|
|
47
|
+
}) => GlobalAttributes | {};
|
|
48
|
+
/**
|
|
49
|
+
* Raw
|
|
50
|
+
*/
|
|
51
|
+
addCommands?: (this: {
|
|
52
|
+
name: string;
|
|
53
|
+
options: Options;
|
|
54
|
+
storage: Storage;
|
|
55
|
+
editor: Editor;
|
|
56
|
+
type: MarkType;
|
|
57
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addCommands'];
|
|
58
|
+
}) => Partial<RawCommands>;
|
|
59
|
+
/**
|
|
60
|
+
* Keyboard shortcuts
|
|
61
|
+
*/
|
|
62
|
+
addKeyboardShortcuts?: (this: {
|
|
63
|
+
name: string;
|
|
64
|
+
options: Options;
|
|
65
|
+
storage: Storage;
|
|
66
|
+
editor: Editor;
|
|
67
|
+
type: MarkType;
|
|
68
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
69
|
+
}) => {
|
|
70
|
+
[key: string]: KeyboardShortcutCommand;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Input rules
|
|
74
|
+
*/
|
|
75
|
+
addInputRules?: (this: {
|
|
76
|
+
name: string;
|
|
77
|
+
options: Options;
|
|
78
|
+
storage: Storage;
|
|
79
|
+
editor: Editor;
|
|
80
|
+
type: MarkType;
|
|
81
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addInputRules'];
|
|
82
|
+
}) => InputRule[];
|
|
83
|
+
/**
|
|
84
|
+
* Paste rules
|
|
85
|
+
*/
|
|
86
|
+
addPasteRules?: (this: {
|
|
87
|
+
name: string;
|
|
88
|
+
options: Options;
|
|
89
|
+
storage: Storage;
|
|
90
|
+
editor: Editor;
|
|
91
|
+
type: MarkType;
|
|
92
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addPasteRules'];
|
|
93
|
+
}) => PasteRule[];
|
|
94
|
+
/**
|
|
95
|
+
* ProseMirror plugins
|
|
96
|
+
*/
|
|
97
|
+
addProseMirrorPlugins?: (this: {
|
|
98
|
+
name: string;
|
|
99
|
+
options: Options;
|
|
100
|
+
storage: Storage;
|
|
101
|
+
editor: Editor;
|
|
102
|
+
type: MarkType;
|
|
103
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
104
|
+
}) => Plugin[];
|
|
105
|
+
/**
|
|
106
|
+
* Extensions
|
|
107
|
+
*/
|
|
108
|
+
addExtensions?: (this: {
|
|
109
|
+
name: string;
|
|
110
|
+
options: Options;
|
|
111
|
+
storage: Storage;
|
|
112
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addExtensions'];
|
|
113
|
+
}) => Extensions;
|
|
114
|
+
/**
|
|
115
|
+
* Extend Node Schema
|
|
116
|
+
*/
|
|
117
|
+
extendNodeSchema?: ((this: {
|
|
118
|
+
name: string;
|
|
119
|
+
options: Options;
|
|
120
|
+
storage: Storage;
|
|
121
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['extendNodeSchema'];
|
|
122
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
123
|
+
/**
|
|
124
|
+
* Extend Mark Schema
|
|
125
|
+
*/
|
|
126
|
+
extendMarkSchema?: ((this: {
|
|
127
|
+
name: string;
|
|
128
|
+
options: Options;
|
|
129
|
+
storage: Storage;
|
|
130
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['extendMarkSchema'];
|
|
131
|
+
}, extension: Mark) => Record<string, any>) | null;
|
|
132
|
+
/**
|
|
133
|
+
* The editor is not ready yet.
|
|
134
|
+
*/
|
|
135
|
+
onBeforeCreate?: ((this: {
|
|
136
|
+
name: string;
|
|
137
|
+
options: Options;
|
|
138
|
+
storage: Storage;
|
|
139
|
+
editor: Editor;
|
|
140
|
+
type: MarkType;
|
|
141
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onBeforeCreate'];
|
|
142
|
+
}) => void) | null;
|
|
143
|
+
/**
|
|
144
|
+
* The editor is ready.
|
|
145
|
+
*/
|
|
146
|
+
onCreate?: ((this: {
|
|
147
|
+
name: string;
|
|
148
|
+
options: Options;
|
|
149
|
+
storage: Storage;
|
|
150
|
+
editor: Editor;
|
|
151
|
+
type: MarkType;
|
|
152
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onCreate'];
|
|
153
|
+
}) => void) | null;
|
|
154
|
+
/**
|
|
155
|
+
* The content has changed.
|
|
156
|
+
*/
|
|
157
|
+
onUpdate?: ((this: {
|
|
158
|
+
name: string;
|
|
159
|
+
options: Options;
|
|
160
|
+
storage: Storage;
|
|
161
|
+
editor: Editor;
|
|
162
|
+
type: MarkType;
|
|
163
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onUpdate'];
|
|
164
|
+
}) => void) | null;
|
|
165
|
+
/**
|
|
166
|
+
* The selection has changed.
|
|
167
|
+
*/
|
|
168
|
+
onSelectionUpdate?: ((this: {
|
|
169
|
+
name: string;
|
|
170
|
+
options: Options;
|
|
171
|
+
storage: Storage;
|
|
172
|
+
editor: Editor;
|
|
173
|
+
type: MarkType;
|
|
174
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onSelectionUpdate'];
|
|
175
|
+
}) => void) | null;
|
|
176
|
+
/**
|
|
177
|
+
* The editor state has changed.
|
|
178
|
+
*/
|
|
179
|
+
onTransaction?: ((this: {
|
|
180
|
+
name: string;
|
|
181
|
+
options: Options;
|
|
182
|
+
storage: Storage;
|
|
183
|
+
editor: Editor;
|
|
184
|
+
type: MarkType;
|
|
185
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onTransaction'];
|
|
186
|
+
}, props: {
|
|
187
|
+
transaction: Transaction;
|
|
188
|
+
}) => void) | null;
|
|
189
|
+
/**
|
|
190
|
+
* The editor is focused.
|
|
191
|
+
*/
|
|
192
|
+
onFocus?: ((this: {
|
|
193
|
+
name: string;
|
|
194
|
+
options: Options;
|
|
195
|
+
storage: Storage;
|
|
196
|
+
editor: Editor;
|
|
197
|
+
type: MarkType;
|
|
198
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onFocus'];
|
|
199
|
+
}, props: {
|
|
200
|
+
event: FocusEvent;
|
|
201
|
+
}) => void) | null;
|
|
202
|
+
/**
|
|
203
|
+
* The editor isn’t focused anymore.
|
|
204
|
+
*/
|
|
205
|
+
onBlur?: ((this: {
|
|
206
|
+
name: string;
|
|
207
|
+
options: Options;
|
|
208
|
+
storage: Storage;
|
|
209
|
+
editor: Editor;
|
|
210
|
+
type: MarkType;
|
|
211
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onBlur'];
|
|
212
|
+
}, props: {
|
|
213
|
+
event: FocusEvent;
|
|
214
|
+
}) => void) | null;
|
|
215
|
+
/**
|
|
216
|
+
* The editor is destroyed.
|
|
217
|
+
*/
|
|
218
|
+
onDestroy?: ((this: {
|
|
219
|
+
name: string;
|
|
220
|
+
options: Options;
|
|
221
|
+
storage: Storage;
|
|
222
|
+
editor: Editor;
|
|
223
|
+
type: MarkType;
|
|
224
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['onDestroy'];
|
|
225
|
+
}) => void) | null;
|
|
226
|
+
/**
|
|
227
|
+
* Keep mark after split node
|
|
228
|
+
*/
|
|
229
|
+
keepOnSplit?: boolean | (() => boolean);
|
|
230
|
+
/**
|
|
231
|
+
* Inclusive
|
|
232
|
+
*/
|
|
233
|
+
inclusive?: MarkSpec['inclusive'] | ((this: {
|
|
234
|
+
name: string;
|
|
235
|
+
options: Options;
|
|
236
|
+
storage: Storage;
|
|
237
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['inclusive'];
|
|
238
|
+
}) => MarkSpec['inclusive']);
|
|
239
|
+
/**
|
|
240
|
+
* Excludes
|
|
241
|
+
*/
|
|
242
|
+
excludes?: MarkSpec['excludes'] | ((this: {
|
|
243
|
+
name: string;
|
|
244
|
+
options: Options;
|
|
245
|
+
storage: Storage;
|
|
246
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['excludes'];
|
|
247
|
+
}) => MarkSpec['excludes']);
|
|
248
|
+
/**
|
|
249
|
+
* Group
|
|
250
|
+
*/
|
|
251
|
+
group?: MarkSpec['group'] | ((this: {
|
|
252
|
+
name: string;
|
|
253
|
+
options: Options;
|
|
254
|
+
storage: Storage;
|
|
255
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['group'];
|
|
256
|
+
}) => MarkSpec['group']);
|
|
257
|
+
/**
|
|
258
|
+
* Spanning
|
|
259
|
+
*/
|
|
260
|
+
spanning?: MarkSpec['spanning'] | ((this: {
|
|
261
|
+
name: string;
|
|
262
|
+
options: Options;
|
|
263
|
+
storage: Storage;
|
|
264
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['spanning'];
|
|
265
|
+
}) => MarkSpec['spanning']);
|
|
266
|
+
/**
|
|
267
|
+
* Code
|
|
268
|
+
*/
|
|
269
|
+
code?: boolean | ((this: {
|
|
270
|
+
name: string;
|
|
271
|
+
options: Options;
|
|
272
|
+
storage: Storage;
|
|
273
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['code'];
|
|
274
|
+
}) => boolean);
|
|
275
|
+
/**
|
|
276
|
+
* Parse HTML
|
|
277
|
+
*/
|
|
278
|
+
parseHTML?: (this: {
|
|
279
|
+
name: string;
|
|
280
|
+
options: Options;
|
|
281
|
+
storage: Storage;
|
|
282
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['parseHTML'];
|
|
283
|
+
}) => MarkSpec['parseDOM'];
|
|
284
|
+
/**
|
|
285
|
+
* Render HTML
|
|
286
|
+
*/
|
|
287
|
+
renderHTML?: ((this: {
|
|
288
|
+
name: string;
|
|
289
|
+
options: Options;
|
|
290
|
+
storage: Storage;
|
|
291
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['renderHTML'];
|
|
292
|
+
}, props: {
|
|
293
|
+
mark: ProseMirrorMark;
|
|
294
|
+
HTMLAttributes: Record<string, any>;
|
|
295
|
+
}) => DOMOutputSpec) | null;
|
|
296
|
+
/**
|
|
297
|
+
* Attributes
|
|
298
|
+
*/
|
|
299
|
+
addAttributes?: (this: {
|
|
300
|
+
name: string;
|
|
301
|
+
options: Options;
|
|
302
|
+
storage: Storage;
|
|
303
|
+
parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
|
|
304
|
+
}) => Attributes | {};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
export declare class Mark<Options = any, Storage = any> {
|
|
308
|
+
type: string;
|
|
309
|
+
name: string;
|
|
310
|
+
parent: Mark | null;
|
|
311
|
+
child: Mark | null;
|
|
312
|
+
options: Options;
|
|
313
|
+
storage: Storage;
|
|
314
|
+
config: MarkConfig;
|
|
315
|
+
constructor(config?: Partial<MarkConfig<Options, Storage>>);
|
|
316
|
+
static create<O = any, S = any>(config?: Partial<MarkConfig<O, S>>): Mark<O, S>;
|
|
317
|
+
configure(options?: Partial<Options>): Mark<Options, Storage>;
|
|
318
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>>): Mark<ExtendedOptions, ExtendedStorage>;
|
|
319
|
+
}
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { DOMOutputSpec, NodeSpec, Node as ProseMirrorNode, NodeType } from 'prosemirror-model';
|
|
2
|
+
import { Plugin, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { InputRule } from './InputRule';
|
|
4
|
+
import { PasteRule } from './PasteRule';
|
|
5
|
+
import { Extensions, Attributes, NodeViewRenderer, GlobalAttributes, RawCommands, ParentConfig, KeyboardShortcutCommand } from './types';
|
|
6
|
+
import { NodeConfig } from '.';
|
|
7
|
+
import { Editor } from './Editor';
|
|
8
|
+
declare module '@tiptap/core' {
|
|
9
|
+
interface NodeConfig<Options = any, Storage = any> {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
/**
|
|
12
|
+
* Name
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* Priority
|
|
17
|
+
*/
|
|
18
|
+
priority?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Default options
|
|
21
|
+
*/
|
|
22
|
+
defaultOptions?: Options;
|
|
23
|
+
/**
|
|
24
|
+
* Default Options
|
|
25
|
+
*/
|
|
26
|
+
addOptions?: (this: {
|
|
27
|
+
name: string;
|
|
28
|
+
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addOptions'], undefined>;
|
|
29
|
+
}) => Options;
|
|
30
|
+
/**
|
|
31
|
+
* Default Storage
|
|
32
|
+
*/
|
|
33
|
+
addStorage?: (this: {
|
|
34
|
+
name: string;
|
|
35
|
+
options: Options;
|
|
36
|
+
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addStorage'], undefined>;
|
|
37
|
+
}) => Storage;
|
|
38
|
+
/**
|
|
39
|
+
* Global attributes
|
|
40
|
+
*/
|
|
41
|
+
addGlobalAttributes?: (this: {
|
|
42
|
+
name: string;
|
|
43
|
+
options: Options;
|
|
44
|
+
storage: Storage;
|
|
45
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addGlobalAttributes'];
|
|
46
|
+
}) => GlobalAttributes | {};
|
|
47
|
+
/**
|
|
48
|
+
* Raw
|
|
49
|
+
*/
|
|
50
|
+
addCommands?: (this: {
|
|
51
|
+
name: string;
|
|
52
|
+
options: Options;
|
|
53
|
+
storage: Storage;
|
|
54
|
+
editor: Editor;
|
|
55
|
+
type: NodeType;
|
|
56
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addCommands'];
|
|
57
|
+
}) => Partial<RawCommands>;
|
|
58
|
+
/**
|
|
59
|
+
* Keyboard shortcuts
|
|
60
|
+
*/
|
|
61
|
+
addKeyboardShortcuts?: (this: {
|
|
62
|
+
name: string;
|
|
63
|
+
options: Options;
|
|
64
|
+
storage: Storage;
|
|
65
|
+
editor: Editor;
|
|
66
|
+
type: NodeType;
|
|
67
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
68
|
+
}) => {
|
|
69
|
+
[key: string]: KeyboardShortcutCommand;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Input rules
|
|
73
|
+
*/
|
|
74
|
+
addInputRules?: (this: {
|
|
75
|
+
name: string;
|
|
76
|
+
options: Options;
|
|
77
|
+
storage: Storage;
|
|
78
|
+
editor: Editor;
|
|
79
|
+
type: NodeType;
|
|
80
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addInputRules'];
|
|
81
|
+
}) => InputRule[];
|
|
82
|
+
/**
|
|
83
|
+
* Paste rules
|
|
84
|
+
*/
|
|
85
|
+
addPasteRules?: (this: {
|
|
86
|
+
name: string;
|
|
87
|
+
options: Options;
|
|
88
|
+
storage: Storage;
|
|
89
|
+
editor: Editor;
|
|
90
|
+
type: NodeType;
|
|
91
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addPasteRules'];
|
|
92
|
+
}) => PasteRule[];
|
|
93
|
+
/**
|
|
94
|
+
* ProseMirror plugins
|
|
95
|
+
*/
|
|
96
|
+
addProseMirrorPlugins?: (this: {
|
|
97
|
+
name: string;
|
|
98
|
+
options: Options;
|
|
99
|
+
storage: Storage;
|
|
100
|
+
editor: Editor;
|
|
101
|
+
type: NodeType;
|
|
102
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
103
|
+
}) => Plugin[];
|
|
104
|
+
/**
|
|
105
|
+
* Extensions
|
|
106
|
+
*/
|
|
107
|
+
addExtensions?: (this: {
|
|
108
|
+
name: string;
|
|
109
|
+
options: Options;
|
|
110
|
+
storage: Storage;
|
|
111
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addExtensions'];
|
|
112
|
+
}) => Extensions;
|
|
113
|
+
/**
|
|
114
|
+
* Extend Node Schema
|
|
115
|
+
*/
|
|
116
|
+
extendNodeSchema?: ((this: {
|
|
117
|
+
name: string;
|
|
118
|
+
options: Options;
|
|
119
|
+
storage: Storage;
|
|
120
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['extendNodeSchema'];
|
|
121
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
122
|
+
/**
|
|
123
|
+
* Extend Mark Schema
|
|
124
|
+
*/
|
|
125
|
+
extendMarkSchema?: ((this: {
|
|
126
|
+
name: string;
|
|
127
|
+
options: Options;
|
|
128
|
+
storage: Storage;
|
|
129
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['extendMarkSchema'];
|
|
130
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
131
|
+
/**
|
|
132
|
+
* The editor is not ready yet.
|
|
133
|
+
*/
|
|
134
|
+
onBeforeCreate?: ((this: {
|
|
135
|
+
name: string;
|
|
136
|
+
options: Options;
|
|
137
|
+
storage: Storage;
|
|
138
|
+
editor: Editor;
|
|
139
|
+
type: NodeType;
|
|
140
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onBeforeCreate'];
|
|
141
|
+
}) => void) | null;
|
|
142
|
+
/**
|
|
143
|
+
* The editor is ready.
|
|
144
|
+
*/
|
|
145
|
+
onCreate?: ((this: {
|
|
146
|
+
name: string;
|
|
147
|
+
options: Options;
|
|
148
|
+
storage: Storage;
|
|
149
|
+
editor: Editor;
|
|
150
|
+
type: NodeType;
|
|
151
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onCreate'];
|
|
152
|
+
}) => void) | null;
|
|
153
|
+
/**
|
|
154
|
+
* The content has changed.
|
|
155
|
+
*/
|
|
156
|
+
onUpdate?: ((this: {
|
|
157
|
+
name: string;
|
|
158
|
+
options: Options;
|
|
159
|
+
storage: Storage;
|
|
160
|
+
editor: Editor;
|
|
161
|
+
type: NodeType;
|
|
162
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onUpdate'];
|
|
163
|
+
}) => void) | null;
|
|
164
|
+
/**
|
|
165
|
+
* The selection has changed.
|
|
166
|
+
*/
|
|
167
|
+
onSelectionUpdate?: ((this: {
|
|
168
|
+
name: string;
|
|
169
|
+
options: Options;
|
|
170
|
+
storage: Storage;
|
|
171
|
+
editor: Editor;
|
|
172
|
+
type: NodeType;
|
|
173
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onSelectionUpdate'];
|
|
174
|
+
}) => void) | null;
|
|
175
|
+
/**
|
|
176
|
+
* The editor state has changed.
|
|
177
|
+
*/
|
|
178
|
+
onTransaction?: ((this: {
|
|
179
|
+
name: string;
|
|
180
|
+
options: Options;
|
|
181
|
+
storage: Storage;
|
|
182
|
+
editor: Editor;
|
|
183
|
+
type: NodeType;
|
|
184
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onTransaction'];
|
|
185
|
+
}, props: {
|
|
186
|
+
transaction: Transaction;
|
|
187
|
+
}) => void) | null;
|
|
188
|
+
/**
|
|
189
|
+
* The editor is focused.
|
|
190
|
+
*/
|
|
191
|
+
onFocus?: ((this: {
|
|
192
|
+
name: string;
|
|
193
|
+
options: Options;
|
|
194
|
+
storage: Storage;
|
|
195
|
+
editor: Editor;
|
|
196
|
+
type: NodeType;
|
|
197
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onFocus'];
|
|
198
|
+
}, props: {
|
|
199
|
+
event: FocusEvent;
|
|
200
|
+
}) => void) | null;
|
|
201
|
+
/**
|
|
202
|
+
* The editor isn’t focused anymore.
|
|
203
|
+
*/
|
|
204
|
+
onBlur?: ((this: {
|
|
205
|
+
name: string;
|
|
206
|
+
options: Options;
|
|
207
|
+
storage: Storage;
|
|
208
|
+
editor: Editor;
|
|
209
|
+
type: NodeType;
|
|
210
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onBlur'];
|
|
211
|
+
}, props: {
|
|
212
|
+
event: FocusEvent;
|
|
213
|
+
}) => void) | null;
|
|
214
|
+
/**
|
|
215
|
+
* The editor is destroyed.
|
|
216
|
+
*/
|
|
217
|
+
onDestroy?: ((this: {
|
|
218
|
+
name: string;
|
|
219
|
+
options: Options;
|
|
220
|
+
storage: Storage;
|
|
221
|
+
editor: Editor;
|
|
222
|
+
type: NodeType;
|
|
223
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['onDestroy'];
|
|
224
|
+
}) => void) | null;
|
|
225
|
+
/**
|
|
226
|
+
* Node View
|
|
227
|
+
*/
|
|
228
|
+
addNodeView?: ((this: {
|
|
229
|
+
name: string;
|
|
230
|
+
options: Options;
|
|
231
|
+
storage: Storage;
|
|
232
|
+
editor: Editor;
|
|
233
|
+
type: NodeType;
|
|
234
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addNodeView'];
|
|
235
|
+
}) => NodeViewRenderer) | null;
|
|
236
|
+
/**
|
|
237
|
+
* TopNode
|
|
238
|
+
*/
|
|
239
|
+
topNode?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Content
|
|
242
|
+
*/
|
|
243
|
+
content?: NodeSpec['content'] | ((this: {
|
|
244
|
+
name: string;
|
|
245
|
+
options: Options;
|
|
246
|
+
storage: Storage;
|
|
247
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['content'];
|
|
248
|
+
}) => NodeSpec['content']);
|
|
249
|
+
/**
|
|
250
|
+
* Marks
|
|
251
|
+
*/
|
|
252
|
+
marks?: NodeSpec['marks'] | ((this: {
|
|
253
|
+
name: string;
|
|
254
|
+
options: Options;
|
|
255
|
+
storage: Storage;
|
|
256
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['marks'];
|
|
257
|
+
}) => NodeSpec['marks']);
|
|
258
|
+
/**
|
|
259
|
+
* Group
|
|
260
|
+
*/
|
|
261
|
+
group?: NodeSpec['group'] | ((this: {
|
|
262
|
+
name: string;
|
|
263
|
+
options: Options;
|
|
264
|
+
storage: Storage;
|
|
265
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['group'];
|
|
266
|
+
}) => NodeSpec['group']);
|
|
267
|
+
/**
|
|
268
|
+
* Inline
|
|
269
|
+
*/
|
|
270
|
+
inline?: NodeSpec['inline'] | ((this: {
|
|
271
|
+
name: string;
|
|
272
|
+
options: Options;
|
|
273
|
+
storage: Storage;
|
|
274
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['inline'];
|
|
275
|
+
}) => NodeSpec['inline']);
|
|
276
|
+
/**
|
|
277
|
+
* Atom
|
|
278
|
+
*/
|
|
279
|
+
atom?: NodeSpec['atom'] | ((this: {
|
|
280
|
+
name: string;
|
|
281
|
+
options: Options;
|
|
282
|
+
storage: Storage;
|
|
283
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['atom'];
|
|
284
|
+
}) => NodeSpec['atom']);
|
|
285
|
+
/**
|
|
286
|
+
* Selectable
|
|
287
|
+
*/
|
|
288
|
+
selectable?: NodeSpec['selectable'] | ((this: {
|
|
289
|
+
name: string;
|
|
290
|
+
options: Options;
|
|
291
|
+
storage: Storage;
|
|
292
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['selectable'];
|
|
293
|
+
}) => NodeSpec['selectable']);
|
|
294
|
+
/**
|
|
295
|
+
* Draggable
|
|
296
|
+
*/
|
|
297
|
+
draggable?: NodeSpec['draggable'] | ((this: {
|
|
298
|
+
name: string;
|
|
299
|
+
options: Options;
|
|
300
|
+
storage: Storage;
|
|
301
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['draggable'];
|
|
302
|
+
}) => NodeSpec['draggable']);
|
|
303
|
+
/**
|
|
304
|
+
* Code
|
|
305
|
+
*/
|
|
306
|
+
code?: NodeSpec['code'] | ((this: {
|
|
307
|
+
name: string;
|
|
308
|
+
options: Options;
|
|
309
|
+
storage: Storage;
|
|
310
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['code'];
|
|
311
|
+
}) => NodeSpec['code']);
|
|
312
|
+
/**
|
|
313
|
+
* Defining
|
|
314
|
+
*/
|
|
315
|
+
defining?: NodeSpec['defining'] | ((this: {
|
|
316
|
+
name: string;
|
|
317
|
+
options: Options;
|
|
318
|
+
storage: Storage;
|
|
319
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['defining'];
|
|
320
|
+
}) => NodeSpec['defining']);
|
|
321
|
+
/**
|
|
322
|
+
* Isolating
|
|
323
|
+
*/
|
|
324
|
+
isolating?: NodeSpec['isolating'] | ((this: {
|
|
325
|
+
name: string;
|
|
326
|
+
options: Options;
|
|
327
|
+
storage: Storage;
|
|
328
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['isolating'];
|
|
329
|
+
}) => NodeSpec['isolating']);
|
|
330
|
+
/**
|
|
331
|
+
* Parse HTML
|
|
332
|
+
*/
|
|
333
|
+
parseHTML?: (this: {
|
|
334
|
+
name: string;
|
|
335
|
+
options: Options;
|
|
336
|
+
storage: Storage;
|
|
337
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['parseHTML'];
|
|
338
|
+
}) => NodeSpec['parseDOM'];
|
|
339
|
+
/**
|
|
340
|
+
* Render HTML
|
|
341
|
+
*/
|
|
342
|
+
renderHTML?: ((this: {
|
|
343
|
+
name: string;
|
|
344
|
+
options: Options;
|
|
345
|
+
storage: Storage;
|
|
346
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['renderHTML'];
|
|
347
|
+
}, props: {
|
|
348
|
+
node: ProseMirrorNode;
|
|
349
|
+
HTMLAttributes: Record<string, any>;
|
|
350
|
+
}) => DOMOutputSpec) | null;
|
|
351
|
+
/**
|
|
352
|
+
* Render Text
|
|
353
|
+
*/
|
|
354
|
+
renderText?: ((this: {
|
|
355
|
+
name: string;
|
|
356
|
+
options: Options;
|
|
357
|
+
storage: Storage;
|
|
358
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['renderText'];
|
|
359
|
+
}, props: {
|
|
360
|
+
node: ProseMirrorNode;
|
|
361
|
+
pos: number;
|
|
362
|
+
parent: ProseMirrorNode;
|
|
363
|
+
index: number;
|
|
364
|
+
}) => string) | null;
|
|
365
|
+
/**
|
|
366
|
+
* Add Attributes
|
|
367
|
+
*/
|
|
368
|
+
addAttributes?: (this: {
|
|
369
|
+
name: string;
|
|
370
|
+
options: Options;
|
|
371
|
+
storage: Storage;
|
|
372
|
+
parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
|
|
373
|
+
}) => Attributes | {};
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
export declare class Node<Options = any, Storage = any> {
|
|
377
|
+
type: string;
|
|
378
|
+
name: string;
|
|
379
|
+
parent: Node | null;
|
|
380
|
+
child: Node | null;
|
|
381
|
+
options: Options;
|
|
382
|
+
storage: Storage;
|
|
383
|
+
config: NodeConfig;
|
|
384
|
+
constructor(config?: Partial<NodeConfig<Options, Storage>>);
|
|
385
|
+
static create<O = any, S = any>(config?: Partial<NodeConfig<O, S>>): Node<O, S>;
|
|
386
|
+
configure(options?: Partial<Options>): Node<Options, Storage>;
|
|
387
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>>): Node<ExtendedOptions, ExtendedStorage>;
|
|
388
|
+
}
|