@tiptap/react 2.0.0-beta.91 → 2.0.0-beta.95
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/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/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/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 +210 -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 +8 -0
- package/dist/packages/react/src/Editor.d.ts +6 -0
- package/dist/packages/react/src/EditorContent.d.ts +19 -0
- package/dist/packages/react/src/FloatingMenu.d.ts +8 -0
- package/dist/packages/react/src/NodeViewContent.d.ts +6 -0
- package/dist/packages/react/src/NodeViewWrapper.d.ts +6 -0
- package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +13 -0
- package/dist/packages/react/src/ReactRenderer.d.ts +27 -0
- package/dist/packages/react/src/index.d.ts +10 -0
- package/dist/packages/react/src/useEditor.d.ts +4 -0
- package/dist/packages/react/src/useReactNodeView.d.ts +7 -0
- 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 +375 -0
- package/dist/tiptap-react.cjs.js.map +1 -0
- package/dist/tiptap-react.esm.js +352 -0
- package/dist/tiptap-react.esm.js.map +1 -0
- package/dist/tiptap-react.umd.js +375 -0
- package/dist/tiptap-react.umd.js.map +1 -0
- package/package.json +6 -6
- package/src/ReactNodeViewRenderer.tsx +1 -0
- package/src/ReactRenderer.tsx +12 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { Editor } from './Editor';
|
|
3
|
+
import { SingleCommands, ChainedCommands, CanCommands, AnyCommands, CommandProps } from './types';
|
|
4
|
+
export default class CommandManager {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
rawCommands: AnyCommands;
|
|
7
|
+
customState?: EditorState;
|
|
8
|
+
constructor(props: {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
state?: EditorState;
|
|
11
|
+
});
|
|
12
|
+
get hasCustomState(): boolean;
|
|
13
|
+
get state(): EditorState;
|
|
14
|
+
get commands(): SingleCommands;
|
|
15
|
+
get chain(): () => ChainedCommands;
|
|
16
|
+
get can(): () => CanCommands;
|
|
17
|
+
createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
|
|
18
|
+
createCan(startTr?: Transaction): CanCommands;
|
|
19
|
+
buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
|
|
20
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { Schema, MarkType, NodeType } from 'prosemirror-model';
|
|
4
|
+
import ExtensionManager from './ExtensionManager';
|
|
5
|
+
import EventEmitter from './EventEmitter';
|
|
6
|
+
import { EditorOptions, CanCommands, ChainedCommands, JSONContent, SingleCommands, TextSerializer, EditorEvents } from './types';
|
|
7
|
+
import * as extensions from './extensions';
|
|
8
|
+
export { extensions };
|
|
9
|
+
export interface HTMLElement {
|
|
10
|
+
editor?: Editor;
|
|
11
|
+
}
|
|
12
|
+
export declare class Editor extends EventEmitter<EditorEvents> {
|
|
13
|
+
private commandManager;
|
|
14
|
+
extensionManager: ExtensionManager;
|
|
15
|
+
private css;
|
|
16
|
+
schema: Schema;
|
|
17
|
+
view: EditorView;
|
|
18
|
+
isFocused: boolean;
|
|
19
|
+
extensionStorage: Record<string, any>;
|
|
20
|
+
options: EditorOptions;
|
|
21
|
+
constructor(options?: Partial<EditorOptions>);
|
|
22
|
+
/**
|
|
23
|
+
* Returns the editor storage.
|
|
24
|
+
*/
|
|
25
|
+
get storage(): Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* An object of all registered commands.
|
|
28
|
+
*/
|
|
29
|
+
get commands(): SingleCommands;
|
|
30
|
+
/**
|
|
31
|
+
* Create a command chain to call multiple commands at once.
|
|
32
|
+
*/
|
|
33
|
+
chain(): ChainedCommands;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a command or a command chain can be executed. Without executing it.
|
|
36
|
+
*/
|
|
37
|
+
can(): CanCommands;
|
|
38
|
+
/**
|
|
39
|
+
* Inject CSS styles.
|
|
40
|
+
*/
|
|
41
|
+
private injectCSS;
|
|
42
|
+
/**
|
|
43
|
+
* Update editor options.
|
|
44
|
+
*
|
|
45
|
+
* @param options A list of options
|
|
46
|
+
*/
|
|
47
|
+
setOptions(options?: Partial<EditorOptions>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Update editable state of the editor.
|
|
50
|
+
*/
|
|
51
|
+
setEditable(editable: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Returns whether the editor is editable.
|
|
54
|
+
*/
|
|
55
|
+
get isEditable(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the editor state.
|
|
58
|
+
*/
|
|
59
|
+
get state(): EditorState;
|
|
60
|
+
/**
|
|
61
|
+
* Register a ProseMirror plugin.
|
|
62
|
+
*
|
|
63
|
+
* @param plugin A ProseMirror plugin
|
|
64
|
+
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
65
|
+
*/
|
|
66
|
+
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
|
|
67
|
+
/**
|
|
68
|
+
* Unregister a ProseMirror plugin.
|
|
69
|
+
*
|
|
70
|
+
* @param nameOrPluginKey The plugins name
|
|
71
|
+
*/
|
|
72
|
+
unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
|
|
73
|
+
/**
|
|
74
|
+
* Creates an extension manager.
|
|
75
|
+
*/
|
|
76
|
+
private createExtensionManager;
|
|
77
|
+
/**
|
|
78
|
+
* Creates an command manager.
|
|
79
|
+
*/
|
|
80
|
+
private createCommandManager;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a ProseMirror schema.
|
|
83
|
+
*/
|
|
84
|
+
private createSchema;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a ProseMirror view.
|
|
87
|
+
*/
|
|
88
|
+
private createView;
|
|
89
|
+
/**
|
|
90
|
+
* Creates all node views.
|
|
91
|
+
*/
|
|
92
|
+
createNodeViews(): void;
|
|
93
|
+
isCapturingTransaction: boolean;
|
|
94
|
+
private capturedTransaction;
|
|
95
|
+
captureTransaction(fn: Function): Transaction<any> | null;
|
|
96
|
+
/**
|
|
97
|
+
* The callback over which to send transactions (state updates) produced by the view.
|
|
98
|
+
*
|
|
99
|
+
* @param transaction An editor state transaction
|
|
100
|
+
*/
|
|
101
|
+
private dispatchTransaction;
|
|
102
|
+
/**
|
|
103
|
+
* Get attributes of the currently selected node or mark.
|
|
104
|
+
*/
|
|
105
|
+
getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
|
|
106
|
+
/**
|
|
107
|
+
* Returns if the currently selected node or mark is active.
|
|
108
|
+
*
|
|
109
|
+
* @param name Name of the node or mark
|
|
110
|
+
* @param attributes Attributes of the node or mark
|
|
111
|
+
*/
|
|
112
|
+
isActive(name: string, attributes?: {}): boolean;
|
|
113
|
+
isActive(attributes: {}): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Get the document as JSON.
|
|
116
|
+
*/
|
|
117
|
+
getJSON(): JSONContent;
|
|
118
|
+
/**
|
|
119
|
+
* Get the document as HTML.
|
|
120
|
+
*/
|
|
121
|
+
getHTML(): string;
|
|
122
|
+
/**
|
|
123
|
+
* Get the document as text.
|
|
124
|
+
*/
|
|
125
|
+
getText(options?: {
|
|
126
|
+
blockSeparator?: string;
|
|
127
|
+
textSerializers?: Record<string, TextSerializer>;
|
|
128
|
+
}): string;
|
|
129
|
+
/**
|
|
130
|
+
* Check if there is no content.
|
|
131
|
+
*/
|
|
132
|
+
get isEmpty(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Get the number of characters for the current document.
|
|
135
|
+
*/
|
|
136
|
+
getCharacterCount(): number;
|
|
137
|
+
/**
|
|
138
|
+
* Destroy the editor.
|
|
139
|
+
*/
|
|
140
|
+
destroy(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Check if the editor is already destroyed.
|
|
143
|
+
*/
|
|
144
|
+
get isDestroyed(): boolean;
|
|
145
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare type StringKeyOf<T> = Extract<keyof T, string>;
|
|
2
|
+
declare type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
|
|
3
|
+
declare type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
|
|
4
|
+
export default class EventEmitter<T extends Record<string, any>> {
|
|
5
|
+
private callbacks;
|
|
6
|
+
on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
|
|
7
|
+
protected emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
|
|
8
|
+
off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
|
|
9
|
+
protected removeAllListeners(): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { Plugin, Transaction } from 'prosemirror-state';
|
|
2
|
+
import { InputRule } from './InputRule';
|
|
3
|
+
import { PasteRule } from './PasteRule';
|
|
4
|
+
import { Editor } from './Editor';
|
|
5
|
+
import { Node } from './Node';
|
|
6
|
+
import { Mark } from './Mark';
|
|
7
|
+
import { Extensions, GlobalAttributes, RawCommands, ParentConfig, KeyboardShortcutCommand } from './types';
|
|
8
|
+
import { ExtensionConfig } from '.';
|
|
9
|
+
declare module '@tiptap/core' {
|
|
10
|
+
interface ExtensionConfig<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<ExtensionConfig<Options, Storage>>['addOptions'], undefined>;
|
|
30
|
+
}) => Options;
|
|
31
|
+
/**
|
|
32
|
+
* Default Storage
|
|
33
|
+
*/
|
|
34
|
+
addStorage?: (this: {
|
|
35
|
+
name: string;
|
|
36
|
+
options: Options;
|
|
37
|
+
parent: Exclude<ParentConfig<ExtensionConfig<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<ExtensionConfig<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
|
+
parent: ParentConfig<ExtensionConfig<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
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addKeyboardShortcuts'];
|
|
67
|
+
}) => {
|
|
68
|
+
[key: string]: KeyboardShortcutCommand;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Input rules
|
|
72
|
+
*/
|
|
73
|
+
addInputRules?: (this: {
|
|
74
|
+
name: string;
|
|
75
|
+
options: Options;
|
|
76
|
+
storage: Storage;
|
|
77
|
+
editor: Editor;
|
|
78
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addInputRules'];
|
|
79
|
+
}) => InputRule[];
|
|
80
|
+
/**
|
|
81
|
+
* Paste rules
|
|
82
|
+
*/
|
|
83
|
+
addPasteRules?: (this: {
|
|
84
|
+
name: string;
|
|
85
|
+
options: Options;
|
|
86
|
+
storage: Storage;
|
|
87
|
+
editor: Editor;
|
|
88
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addPasteRules'];
|
|
89
|
+
}) => PasteRule[];
|
|
90
|
+
/**
|
|
91
|
+
* ProseMirror plugins
|
|
92
|
+
*/
|
|
93
|
+
addProseMirrorPlugins?: (this: {
|
|
94
|
+
name: string;
|
|
95
|
+
options: Options;
|
|
96
|
+
storage: Storage;
|
|
97
|
+
editor: Editor;
|
|
98
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addProseMirrorPlugins'];
|
|
99
|
+
}) => Plugin[];
|
|
100
|
+
/**
|
|
101
|
+
* Extensions
|
|
102
|
+
*/
|
|
103
|
+
addExtensions?: (this: {
|
|
104
|
+
name: string;
|
|
105
|
+
options: Options;
|
|
106
|
+
storage: Storage;
|
|
107
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addExtensions'];
|
|
108
|
+
}) => Extensions;
|
|
109
|
+
/**
|
|
110
|
+
* Extend Node Schema
|
|
111
|
+
*/
|
|
112
|
+
extendNodeSchema?: ((this: {
|
|
113
|
+
name: string;
|
|
114
|
+
options: Options;
|
|
115
|
+
storage: Storage;
|
|
116
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['extendNodeSchema'];
|
|
117
|
+
}, extension: Node) => Record<string, any>) | null;
|
|
118
|
+
/**
|
|
119
|
+
* Extend Mark Schema
|
|
120
|
+
*/
|
|
121
|
+
extendMarkSchema?: ((this: {
|
|
122
|
+
name: string;
|
|
123
|
+
options: Options;
|
|
124
|
+
storage: Storage;
|
|
125
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['extendMarkSchema'];
|
|
126
|
+
}, extension: Mark) => Record<string, any>) | null;
|
|
127
|
+
/**
|
|
128
|
+
* The editor is not ready yet.
|
|
129
|
+
*/
|
|
130
|
+
onBeforeCreate?: ((this: {
|
|
131
|
+
name: string;
|
|
132
|
+
options: Options;
|
|
133
|
+
storage: Storage;
|
|
134
|
+
editor: Editor;
|
|
135
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBeforeCreate'];
|
|
136
|
+
}) => void) | null;
|
|
137
|
+
/**
|
|
138
|
+
* The editor is ready.
|
|
139
|
+
*/
|
|
140
|
+
onCreate?: ((this: {
|
|
141
|
+
name: string;
|
|
142
|
+
options: Options;
|
|
143
|
+
storage: Storage;
|
|
144
|
+
editor: Editor;
|
|
145
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onCreate'];
|
|
146
|
+
}) => void) | null;
|
|
147
|
+
/**
|
|
148
|
+
* The content has changed.
|
|
149
|
+
*/
|
|
150
|
+
onUpdate?: ((this: {
|
|
151
|
+
name: string;
|
|
152
|
+
options: Options;
|
|
153
|
+
storage: Storage;
|
|
154
|
+
editor: Editor;
|
|
155
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onUpdate'];
|
|
156
|
+
}) => void) | null;
|
|
157
|
+
/**
|
|
158
|
+
* The selection has changed.
|
|
159
|
+
*/
|
|
160
|
+
onSelectionUpdate?: ((this: {
|
|
161
|
+
name: string;
|
|
162
|
+
options: Options;
|
|
163
|
+
storage: Storage;
|
|
164
|
+
editor: Editor;
|
|
165
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onSelectionUpdate'];
|
|
166
|
+
}) => void) | null;
|
|
167
|
+
/**
|
|
168
|
+
* The editor state has changed.
|
|
169
|
+
*/
|
|
170
|
+
onTransaction?: ((this: {
|
|
171
|
+
name: string;
|
|
172
|
+
options: Options;
|
|
173
|
+
storage: Storage;
|
|
174
|
+
editor: Editor;
|
|
175
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onTransaction'];
|
|
176
|
+
}, props: {
|
|
177
|
+
transaction: Transaction;
|
|
178
|
+
}) => void) | null;
|
|
179
|
+
/**
|
|
180
|
+
* The editor is focused.
|
|
181
|
+
*/
|
|
182
|
+
onFocus?: ((this: {
|
|
183
|
+
name: string;
|
|
184
|
+
options: Options;
|
|
185
|
+
storage: Storage;
|
|
186
|
+
editor: Editor;
|
|
187
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onFocus'];
|
|
188
|
+
}, props: {
|
|
189
|
+
event: FocusEvent;
|
|
190
|
+
}) => void) | null;
|
|
191
|
+
/**
|
|
192
|
+
* The editor isn’t focused anymore.
|
|
193
|
+
*/
|
|
194
|
+
onBlur?: ((this: {
|
|
195
|
+
name: string;
|
|
196
|
+
options: Options;
|
|
197
|
+
storage: Storage;
|
|
198
|
+
editor: Editor;
|
|
199
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onBlur'];
|
|
200
|
+
}, props: {
|
|
201
|
+
event: FocusEvent;
|
|
202
|
+
}) => void) | null;
|
|
203
|
+
/**
|
|
204
|
+
* The editor is destroyed.
|
|
205
|
+
*/
|
|
206
|
+
onDestroy?: ((this: {
|
|
207
|
+
name: string;
|
|
208
|
+
options: Options;
|
|
209
|
+
storage: Storage;
|
|
210
|
+
editor: Editor;
|
|
211
|
+
parent: ParentConfig<ExtensionConfig<Options, Storage>>['onDestroy'];
|
|
212
|
+
}) => void) | null;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export declare class Extension<Options = any, Storage = any> {
|
|
216
|
+
type: string;
|
|
217
|
+
name: string;
|
|
218
|
+
parent: Extension | null;
|
|
219
|
+
child: Extension | null;
|
|
220
|
+
options: Options;
|
|
221
|
+
storage: Storage;
|
|
222
|
+
config: ExtensionConfig;
|
|
223
|
+
constructor(config?: Partial<ExtensionConfig<Options, Storage>>);
|
|
224
|
+
static create<O = any, S = any>(config?: Partial<ExtensionConfig<O, S>>): Extension<O, S>;
|
|
225
|
+
configure(options?: Partial<Options>): Extension<Options, Storage>;
|
|
226
|
+
extend<ExtendedOptions = Options, ExtendedStorage = Storage>(extendedConfig?: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>>): Extension<ExtendedOptions, ExtendedStorage>;
|
|
227
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Schema } from 'prosemirror-model';
|
|
2
|
+
import { Plugin } from 'prosemirror-state';
|
|
3
|
+
import { Editor } from './Editor';
|
|
4
|
+
import { Extensions, RawCommands } from './types';
|
|
5
|
+
export default class ExtensionManager {
|
|
6
|
+
editor: Editor;
|
|
7
|
+
schema: Schema;
|
|
8
|
+
extensions: Extensions;
|
|
9
|
+
splittableMarks: string[];
|
|
10
|
+
constructor(extensions: Extensions, editor: Editor);
|
|
11
|
+
static resolve(extensions: Extensions): Extensions;
|
|
12
|
+
static flatten(extensions: Extensions): Extensions;
|
|
13
|
+
static sort(extensions: Extensions): Extensions;
|
|
14
|
+
get commands(): RawCommands;
|
|
15
|
+
get plugins(): Plugin[];
|
|
16
|
+
get attributes(): import("@tiptap/core").ExtensionAttribute[];
|
|
17
|
+
get nodeViews(): any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EditorState, Plugin } from 'prosemirror-state';
|
|
2
|
+
import { Editor } from './Editor';
|
|
3
|
+
import { Range, ExtendedRegExpMatchArray, SingleCommands, ChainedCommands, CanCommands } from './types';
|
|
4
|
+
export declare type InputRuleMatch = {
|
|
5
|
+
index: number;
|
|
6
|
+
text: string;
|
|
7
|
+
replaceWith?: string;
|
|
8
|
+
match?: RegExpMatchArray;
|
|
9
|
+
data?: Record<string, any>;
|
|
10
|
+
};
|
|
11
|
+
export declare type InputRuleFinder = RegExp | ((text: string) => InputRuleMatch | null);
|
|
12
|
+
export declare class InputRule {
|
|
13
|
+
find: InputRuleFinder;
|
|
14
|
+
handler: (props: {
|
|
15
|
+
state: EditorState;
|
|
16
|
+
range: Range;
|
|
17
|
+
match: ExtendedRegExpMatchArray;
|
|
18
|
+
commands: SingleCommands;
|
|
19
|
+
chain: () => ChainedCommands;
|
|
20
|
+
can: () => CanCommands;
|
|
21
|
+
}) => void;
|
|
22
|
+
constructor(config: {
|
|
23
|
+
find: InputRuleFinder;
|
|
24
|
+
handler: (props: {
|
|
25
|
+
state: EditorState;
|
|
26
|
+
range: Range;
|
|
27
|
+
match: ExtendedRegExpMatchArray;
|
|
28
|
+
commands: SingleCommands;
|
|
29
|
+
chain: () => ChainedCommands;
|
|
30
|
+
can: () => CanCommands;
|
|
31
|
+
}) => void;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create an input rules plugin. When enabled, it will cause text
|
|
36
|
+
* input that matches any of the given rules to trigger the rule’s
|
|
37
|
+
* action.
|
|
38
|
+
*/
|
|
39
|
+
export declare function inputRulesPlugin(props: {
|
|
40
|
+
editor: Editor;
|
|
41
|
+
rules: InputRule[];
|
|
42
|
+
}): Plugin;
|