@tiptap/core 2.0.0-beta.17 → 2.0.0-beta.170
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 +13 -6
- package/dist/packages/core/src/Editor.d.ts +23 -18
- package/dist/packages/core/src/EventEmitter.d.ts +8 -4
- package/dist/packages/core/src/Extension.d.ts +102 -26
- package/dist/packages/core/src/ExtensionManager.d.ts +7 -12
- package/dist/packages/core/src/InputRule.d.ts +42 -0
- package/dist/packages/core/src/Mark.d.ts +134 -30
- package/dist/packages/core/src/Node.d.ts +160 -32
- package/dist/packages/core/src/NodeView.d.ts +5 -9
- 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 +3 -3
- package/dist/packages/core/src/commands/clearContent.d.ts +3 -3
- package/dist/packages/core/src/commands/clearNodes.d.ts +3 -3
- package/dist/packages/core/src/commands/command.d.ts +2 -2
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +3 -3
- package/dist/packages/core/src/commands/deleteNode.d.ts +13 -0
- package/dist/packages/core/src/commands/deleteRange.d.ts +3 -3
- package/dist/packages/core/src/commands/deleteSelection.d.ts +3 -3
- package/dist/packages/core/src/commands/enter.d.ts +3 -3
- package/dist/packages/core/src/commands/exitCode.d.ts +3 -3
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +3 -3
- package/dist/packages/core/src/commands/first.d.ts +3 -3
- package/dist/packages/core/src/commands/focus.d.ts +5 -3
- package/dist/packages/core/src/commands/forEach.d.ts +14 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +7 -3
- package/dist/packages/core/src/commands/insertContentAt.d.ts +16 -0
- package/dist/packages/core/src/commands/joinBackward.d.ts +3 -3
- package/dist/packages/core/src/commands/joinForward.d.ts +3 -3
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +3 -3
- package/dist/packages/core/src/commands/lift.d.ts +3 -3
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +3 -3
- package/dist/packages/core/src/commands/liftListItem.d.ts +3 -3
- package/dist/packages/core/src/commands/newlineInCode.d.ts +3 -3
- package/dist/packages/core/src/commands/resetAttributes.d.ts +13 -0
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +3 -3
- package/dist/packages/core/src/commands/selectAll.d.ts +3 -3
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +3 -3
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +3 -3
- package/dist/packages/core/src/commands/selectParentNode.d.ts +3 -3
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +12 -0
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +12 -0
- package/dist/packages/core/src/commands/setContent.d.ts +4 -3
- package/dist/packages/core/src/commands/setMark.d.ts +3 -3
- package/dist/packages/core/src/commands/setMeta.d.ts +12 -0
- package/dist/packages/core/src/commands/setNode.d.ts +3 -3
- 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 +3 -3
- package/dist/packages/core/src/commands/splitBlock.d.ts +3 -3
- package/dist/packages/core/src/commands/splitListItem.d.ts +3 -3
- package/dist/packages/core/src/commands/toggleList.d.ts +3 -3
- package/dist/packages/core/src/commands/toggleMark.d.ts +8 -3
- package/dist/packages/core/src/commands/toggleNode.d.ts +3 -3
- package/dist/packages/core/src/commands/toggleWrap.d.ts +3 -3
- package/dist/packages/core/src/commands/undoInputRule.d.ts +3 -3
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +3 -3
- package/dist/packages/core/src/commands/unsetMark.d.ts +8 -3
- package/dist/packages/core/src/commands/updateAttributes.d.ts +13 -0
- package/dist/packages/core/src/commands/wrapIn.d.ts +3 -3
- package/dist/packages/core/src/commands/wrapInList.d.ts +3 -3
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +1 -1
- package/dist/packages/core/src/extensions/commands.d.ts +21 -15
- package/dist/packages/core/src/extensions/editable.d.ts +1 -1
- package/dist/packages/core/src/extensions/focusEvents.d.ts +1 -1
- package/dist/packages/core/src/extensions/index.d.ts +1 -0
- package/dist/packages/core/src/extensions/keymap.d.ts +1 -1
- package/dist/packages/core/src/extensions/tabindex.d.ts +2 -0
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +7 -0
- package/dist/packages/core/src/helpers/createChainableState.d.ts +5 -0
- package/dist/packages/core/src/helpers/createDocument.d.ts +3 -4
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +4 -5
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +2 -0
- package/dist/packages/core/src/helpers/findChildren.d.ts +3 -0
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +6 -0
- package/dist/packages/core/src/helpers/findParentNode.d.ts +1 -1
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateHTML.d.ts +2 -2
- 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 +1 -1
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +11 -0
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +8 -0
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +2 -0
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +2 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +1 -2
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarkType.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +2 -2
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +1 -2
- package/dist/packages/core/src/helpers/getNodeType.d.ts +1 -1
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +2 -2
- package/dist/packages/core/src/helpers/getSchema.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +3 -0
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +2 -2
- 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 +1 -1
- package/dist/packages/core/src/helpers/isActive.d.ts +1 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +2 -0
- package/dist/packages/core/src/helpers/isList.d.ts +1 -1
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +1 -2
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +1 -2
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +1 -1
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +1 -1
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +1 -1
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +2 -0
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +4 -0
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +1 -1
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +4 -4
- package/dist/packages/core/src/index.d.ts +51 -20
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +11 -2
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +11 -2
- 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 +11 -2
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +9 -0
- package/dist/packages/core/src/style.d.ts +1 -2
- package/dist/packages/core/src/types.d.ts +105 -52
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +2 -1
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +1 -2
- package/dist/packages/core/src/utilities/elementFromString.d.ts +1 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +1 -0
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +1 -0
- package/dist/packages/core/src/utilities/fromString.d.ts +1 -1
- package/dist/packages/core/src/utilities/isClass.d.ts +1 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +1 -0
- package/dist/packages/core/src/utilities/isMacOS.d.ts +1 -0
- package/dist/packages/core/src/utilities/isNumber.d.ts +1 -0
- package/dist/packages/core/src/utilities/isObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +1 -1
- package/dist/packages/core/src/utilities/isRegExp.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 -2
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +1 -2
- package/dist/packages/core/src/utilities/minMax.d.ts +1 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +3 -2
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +8 -0
- package/dist/tiptap-core.cjs.js +3572 -2041
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +3544 -2044
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +3430 -1898
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +20 -16
- package/src/CommandManager.ts +60 -62
- package/src/Editor.ts +109 -74
- package/src/EventEmitter.ts +14 -4
- package/src/Extension.ts +196 -41
- package/src/ExtensionManager.ts +242 -78
- package/src/InputRule.ts +268 -0
- package/src/Mark.ts +242 -47
- package/src/Node.ts +279 -52
- package/src/NodeView.ts +105 -42
- package/src/PasteRule.ts +246 -0
- package/src/Tracker.ts +42 -0
- package/src/commands/blur.ts +12 -6
- package/src/commands/clearContent.ts +3 -3
- package/src/commands/clearNodes.ts +29 -18
- package/src/commands/command.ts +2 -2
- package/src/commands/createParagraphNear.ts +3 -3
- package/src/commands/deleteNode.ts +36 -0
- package/src/commands/deleteRange.ts +3 -3
- package/src/commands/deleteSelection.ts +3 -3
- package/src/commands/enter.ts +3 -3
- package/src/commands/exitCode.ts +3 -3
- package/src/commands/extendMarkRange.ts +10 -10
- package/src/commands/first.ts +3 -3
- package/src/commands/focus.ts +45 -44
- package/src/commands/forEach.ts +24 -0
- package/src/commands/insertContent.ts +12 -24
- package/src/commands/insertContentAt.ts +107 -0
- package/src/commands/joinBackward.ts +3 -3
- package/src/commands/joinForward.ts +3 -3
- package/src/commands/keyboardShortcut.ts +6 -6
- package/src/commands/lift.ts +5 -5
- package/src/commands/liftEmptyBlock.ts +3 -3
- package/src/commands/liftListItem.ts +4 -4
- package/src/commands/newlineInCode.ts +3 -3
- package/src/commands/resetAttributes.ts +61 -0
- package/src/commands/scrollIntoView.ts +3 -3
- package/src/commands/selectAll.ts +8 -6
- package/src/commands/selectNodeBackward.ts +3 -3
- package/src/commands/selectNodeForward.ts +3 -3
- package/src/commands/selectParentNode.ts +3 -3
- package/src/commands/selectTextblockEnd.ts +19 -0
- package/src/commands/selectTextblockStart.ts +19 -0
- package/src/commands/setContent.ts +7 -11
- package/src/commands/setMark.ts +35 -12
- package/src/commands/setMeta.ts +18 -0
- package/src/commands/setNode.ts +27 -6
- package/src/commands/setNodeSelection.ts +28 -0
- package/src/commands/setTextSelection.ts +32 -0
- package/src/commands/sinkListItem.ts +4 -4
- package/src/commands/splitBlock.ts +14 -9
- package/src/commands/splitListItem.ts +41 -15
- package/src/commands/toggleList.ts +82 -18
- package/src/commands/toggleMark.ts +17 -7
- package/src/commands/toggleNode.ts +5 -5
- package/src/commands/toggleWrap.ts +8 -9
- package/src/commands/undoInputRule.ts +34 -5
- package/src/commands/unsetAllMarks.ts +7 -11
- package/src/commands/unsetMark.ts +34 -22
- package/src/commands/updateAttributes.ts +72 -0
- package/src/commands/wrapIn.ts +4 -10
- package/src/commands/wrapInList.ts +4 -4
- package/src/extensions/clipboardTextSerializer.ts +13 -35
- package/src/extensions/commands.ts +30 -21
- package/src/extensions/focusEvents.ts +0 -3
- package/src/extensions/index.ts +1 -0
- package/src/extensions/keymap.ts +111 -13
- package/src/extensions/tabindex.ts +19 -0
- package/src/helpers/combineTransactionSteps.ts +18 -0
- package/src/helpers/createChainableState.ts +37 -0
- package/src/helpers/createDocument.ts +5 -7
- package/src/helpers/createNodeFromContent.ts +15 -18
- package/src/helpers/defaultBlockAt.ts +13 -0
- package/src/helpers/findChildren.ts +17 -0
- package/src/helpers/findChildrenInRange.ts +31 -0
- package/src/helpers/findParentNode.ts +2 -2
- package/src/helpers/findParentNodeClosestToPos.ts +1 -1
- package/src/helpers/generateHTML.ts +5 -5
- package/src/helpers/generateJSON.ts +13 -0
- package/src/helpers/generateText.ts +29 -0
- package/src/helpers/getAttributes.ts +27 -0
- package/src/helpers/getAttributesFromExtensions.ts +28 -7
- package/src/helpers/getChangedRanges.ts +82 -0
- package/src/helpers/getDebugJSON.ts +53 -0
- package/src/helpers/getExtensionField.ts +25 -0
- package/src/helpers/getHTMLFromFragment.ts +6 -5
- package/src/helpers/getMarkAttributes.ts +12 -9
- package/src/helpers/getMarkRange.ts +34 -6
- package/src/helpers/getMarkType.ts +5 -1
- package/src/helpers/getMarksBetween.ts +31 -10
- package/src/helpers/getNodeAttributes.ts +7 -8
- package/src/helpers/getNodeType.ts +5 -1
- package/src/helpers/getRenderedAttributes.ts +4 -6
- package/src/helpers/getSchema.ts +6 -133
- package/src/helpers/getSchemaByResolvedExtensions.ts +147 -0
- package/src/helpers/getSchemaTypeByName.ts +2 -10
- package/src/helpers/getSchemaTypeNameByName.ts +1 -1
- package/src/helpers/getSplittedAttributes.ts +4 -4
- package/src/helpers/getText.ts +18 -0
- package/src/helpers/getTextBetween.ts +45 -0
- package/src/helpers/getTextSeralizersFromSchema.ts +9 -0
- package/src/helpers/injectExtensionAttributesToParseRule.ts +15 -17
- package/src/helpers/isActive.ts +4 -5
- package/src/helpers/isExtensionRulesEnabled.ts +15 -0
- package/src/helpers/isList.ts +14 -7
- package/src/helpers/isMarkActive.ts +43 -19
- package/src/helpers/isNodeActive.ts +26 -34
- package/src/helpers/isNodeEmpty.ts +1 -1
- package/src/helpers/isNodeSelection.ts +2 -2
- package/src/helpers/isTextSelection.ts +2 -2
- package/src/helpers/posToDOMRect.ts +34 -0
- package/src/helpers/resolveFocusPosition.ts +34 -0
- package/src/helpers/selectionToInsertionEnd.ts +1 -1
- package/src/helpers/splitExtensions.ts +1 -1
- package/src/index.ts +53 -20
- package/src/inputRules/markInputRule.ts +58 -39
- package/src/inputRules/nodeInputRule.ts +44 -11
- package/src/inputRules/textInputRule.ts +35 -0
- package/src/inputRules/textblockTypeInputRule.ts +37 -0
- package/src/inputRules/wrappingInputRule.ts +59 -0
- package/src/pasteRules/markPasteRule.ts +61 -53
- package/src/pasteRules/textPasteRule.ts +35 -0
- package/src/style.ts +16 -3
- package/src/types.ts +119 -37
- package/src/utilities/callOrReturn.ts +6 -3
- package/src/utilities/createStyleTag.ts +8 -1
- package/src/utilities/deleteProps.ts +2 -4
- package/src/utilities/elementFromString.ts +4 -5
- package/src/utilities/escapeForRegEx.ts +4 -0
- package/src/utilities/findDuplicates.ts +5 -0
- package/src/utilities/fromString.ts +2 -2
- package/src/utilities/isClass.ts +2 -2
- package/src/utilities/isEmptyObject.ts +2 -2
- package/src/utilities/isFunction.ts +3 -0
- package/src/utilities/isMacOS.ts +5 -0
- package/src/utilities/isNumber.ts +3 -0
- package/src/utilities/isObject.ts +6 -6
- package/src/utilities/isPlainObject.ts +8 -5
- package/src/utilities/isRegExp.ts +3 -0
- package/src/utilities/isString.ts +3 -0
- package/src/utilities/isiOS.ts +12 -0
- package/src/utilities/mergeAttributes.ts +2 -3
- package/src/utilities/mergeDeep.ts +2 -3
- package/src/utilities/minMax.ts +1 -1
- package/src/utilities/objectIncludes.ts +17 -5
- package/src/utilities/removeDuplicates.ts +15 -0
- package/CHANGELOG.md +0 -324
- package/dist/packages/core/src/commands/insertHTML.d.ts +0 -12
- package/dist/packages/core/src/commands/insertNode.d.ts +0 -13
- package/dist/packages/core/src/commands/insertText.d.ts +0 -12
- package/dist/packages/core/src/commands/replace.d.ts +0 -13
- package/dist/packages/core/src/commands/replaceRange.d.ts +0 -13
- package/dist/packages/core/src/commands/resetNodeAttributes.d.ts +0 -13
- package/dist/packages/core/src/commands/updateNodeAttributes.d.ts +0 -13
- package/dist/packages/core/src/utilities/removeElement.d.ts +0 -1
- package/dist/tiptap-core.bundle.umd.min.js +0 -17
- package/dist/tiptap-core.bundle.umd.min.js.map +0 -1
- package/src/commands/insertHTML.ts +0 -30
- package/src/commands/insertNode.ts +0 -33
- package/src/commands/insertText.ts +0 -22
- package/src/commands/replace.ts +0 -20
- package/src/commands/replaceRange.ts +0 -36
- package/src/commands/resetNodeAttributes.ts +0 -31
- package/src/commands/updateNodeAttributes.ts +0 -33
- package/src/utilities/removeElement.ts +0 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TextSerializer } from '../types'
|
|
2
|
+
import { Node as ProseMirrorNode } from 'prosemirror-model'
|
|
3
|
+
import { getTextBetween } from './getTextBetween'
|
|
4
|
+
|
|
5
|
+
export function getText(
|
|
6
|
+
node: ProseMirrorNode,
|
|
7
|
+
options?: {
|
|
8
|
+
blockSeparator?: string,
|
|
9
|
+
textSerializers?: Record<string, TextSerializer>,
|
|
10
|
+
},
|
|
11
|
+
) {
|
|
12
|
+
const range = {
|
|
13
|
+
from: 0,
|
|
14
|
+
to: node.content.size,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return getTextBetween(node, range, options)
|
|
18
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Range, TextSerializer } from '../types'
|
|
2
|
+
import { Node as ProseMirrorNode } from 'prosemirror-model'
|
|
3
|
+
|
|
4
|
+
export function getTextBetween(
|
|
5
|
+
startNode: ProseMirrorNode,
|
|
6
|
+
range: Range,
|
|
7
|
+
options?: {
|
|
8
|
+
blockSeparator?: string,
|
|
9
|
+
textSerializers?: Record<string, TextSerializer>,
|
|
10
|
+
},
|
|
11
|
+
): string {
|
|
12
|
+
const { from, to } = range
|
|
13
|
+
const {
|
|
14
|
+
blockSeparator = '\n\n',
|
|
15
|
+
textSerializers = {},
|
|
16
|
+
} = options || {}
|
|
17
|
+
let text = ''
|
|
18
|
+
let separated = true
|
|
19
|
+
|
|
20
|
+
startNode.nodesBetween(from, to, (node, pos, parent, index) => {
|
|
21
|
+
const textSerializer = textSerializers?.[node.type.name]
|
|
22
|
+
|
|
23
|
+
if (textSerializer) {
|
|
24
|
+
if (node.isBlock && !separated) {
|
|
25
|
+
text += blockSeparator
|
|
26
|
+
separated = true
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
text += textSerializer({
|
|
30
|
+
node,
|
|
31
|
+
pos,
|
|
32
|
+
parent,
|
|
33
|
+
index,
|
|
34
|
+
})
|
|
35
|
+
} else if (node.isText) {
|
|
36
|
+
text += node?.text?.slice(Math.max(from, pos) - pos, to - pos)
|
|
37
|
+
separated = false
|
|
38
|
+
} else if (node.isBlock && !separated) {
|
|
39
|
+
text += blockSeparator
|
|
40
|
+
separated = true
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return text
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Schema } from 'prosemirror-model'
|
|
2
|
+
import { TextSerializer } from '../types'
|
|
3
|
+
|
|
4
|
+
export function getTextSeralizersFromSchema(schema: Schema): Record<string, TextSerializer> {
|
|
5
|
+
return Object.fromEntries(Object
|
|
6
|
+
.entries(schema.nodes)
|
|
7
|
+
.filter(([, node]) => node.spec.toText)
|
|
8
|
+
.map(([name, node]) => [name, node.spec.toText]))
|
|
9
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ParseRule } from 'prosemirror-model'
|
|
2
2
|
import { ExtensionAttribute } from '../types'
|
|
3
|
-
import fromString from '../utilities/fromString'
|
|
3
|
+
import { fromString } from '../utilities/fromString'
|
|
4
|
+
import { isObject } from '../utilities/isObject'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).
|
|
@@ -8,7 +9,7 @@ import fromString from '../utilities/fromString'
|
|
|
8
9
|
* @param parseRule ProseMirror ParseRule
|
|
9
10
|
* @param extensionAttributes List of attributes to inject
|
|
10
11
|
*/
|
|
11
|
-
export
|
|
12
|
+
export function injectExtensionAttributesToParseRule(parseRule: ParseRule, extensionAttributes: ExtensionAttribute[]): ParseRule {
|
|
12
13
|
if (parseRule.style) {
|
|
13
14
|
return parseRule
|
|
14
15
|
}
|
|
@@ -24,23 +25,20 @@ export default function injectExtensionAttributesToParseRule(parseRule: ParseRul
|
|
|
24
25
|
return false
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
const newAttributes = extensionAttributes
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
? item.attribute.parseHTML(node as HTMLElement) || {}
|
|
32
|
-
: {
|
|
33
|
-
[item.name]: fromString((node as HTMLElement).getAttribute(item.name)),
|
|
34
|
-
}
|
|
28
|
+
const newAttributes = extensionAttributes.reduce((items, item) => {
|
|
29
|
+
const value = item.attribute.parseHTML
|
|
30
|
+
? item.attribute.parseHTML(node as HTMLElement)
|
|
31
|
+
: fromString((node as HTMLElement).getAttribute(item.name))
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (value === null || value === undefined) {
|
|
34
|
+
return items
|
|
35
|
+
}
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
return {
|
|
38
|
+
...items,
|
|
39
|
+
[item.name]: value,
|
|
40
|
+
}
|
|
41
|
+
}, {})
|
|
44
42
|
|
|
45
43
|
return { ...oldAttributes, ...newAttributes }
|
|
46
44
|
},
|
package/src/helpers/isActive.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state'
|
|
2
|
-
import isNodeActive from './isNodeActive'
|
|
3
|
-
import isMarkActive from './isMarkActive'
|
|
4
|
-
import getSchemaTypeNameByName from './getSchemaTypeNameByName'
|
|
5
|
-
import { AnyObject } from '../types'
|
|
2
|
+
import { isNodeActive } from './isNodeActive'
|
|
3
|
+
import { isMarkActive } from './isMarkActive'
|
|
4
|
+
import { getSchemaTypeNameByName } from './getSchemaTypeNameByName'
|
|
6
5
|
|
|
7
|
-
export
|
|
6
|
+
export function isActive(state: EditorState, name: string | null, attributes: Record<string, any> = {}): boolean {
|
|
8
7
|
if (!name) {
|
|
9
8
|
return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes)
|
|
10
9
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AnyExtension, EnableRules } from '../types'
|
|
2
|
+
|
|
3
|
+
export function isExtensionRulesEnabled(extension: AnyExtension, enabled: EnableRules): boolean {
|
|
4
|
+
if (Array.isArray(enabled)) {
|
|
5
|
+
return enabled.some(enabledExtension => {
|
|
6
|
+
const name = typeof enabledExtension === 'string'
|
|
7
|
+
? enabledExtension
|
|
8
|
+
: enabledExtension.name
|
|
9
|
+
|
|
10
|
+
return name === extension.name
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return enabled
|
|
15
|
+
}
|
package/src/helpers/isList.ts
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { Extensions } from '../types'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { NodeConfig } from '..'
|
|
3
|
+
import { splitExtensions } from './splitExtensions'
|
|
4
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
5
|
+
import { getExtensionField } from '../helpers/getExtensionField'
|
|
4
6
|
|
|
5
|
-
export
|
|
7
|
+
export function isList(name: string, extensions: Extensions): boolean {
|
|
6
8
|
const { nodeExtensions } = splitExtensions(extensions)
|
|
7
|
-
const extension = nodeExtensions.find(item => item.
|
|
9
|
+
const extension = nodeExtensions.find(item => item.name === name)
|
|
8
10
|
|
|
9
11
|
if (!extension) {
|
|
10
12
|
return false
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
const
|
|
15
|
+
const context = {
|
|
16
|
+
name: extension.name,
|
|
17
|
+
options: extension.options,
|
|
18
|
+
storage: extension.storage,
|
|
19
|
+
}
|
|
20
|
+
const group = callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context))
|
|
14
21
|
|
|
15
|
-
if (typeof
|
|
22
|
+
if (typeof group !== 'string') {
|
|
16
23
|
return false
|
|
17
24
|
}
|
|
18
25
|
|
|
19
|
-
return
|
|
26
|
+
return group.split(' ').includes('list')
|
|
20
27
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state'
|
|
2
2
|
import { MarkType } from 'prosemirror-model'
|
|
3
|
-
import objectIncludes from '../utilities/objectIncludes'
|
|
4
|
-
import getMarkType from './getMarkType'
|
|
5
|
-
import {
|
|
3
|
+
import { objectIncludes } from '../utilities/objectIncludes'
|
|
4
|
+
import { getMarkType } from './getMarkType'
|
|
5
|
+
import { MarkRange } from '../types'
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export function isMarkActive(
|
|
8
8
|
state: EditorState,
|
|
9
9
|
typeOrName: MarkType | string | null,
|
|
10
|
-
attributes:
|
|
10
|
+
attributes: Record<string, any> = {},
|
|
11
11
|
): boolean {
|
|
12
|
-
const {
|
|
12
|
+
const { empty, ranges } = state.selection
|
|
13
13
|
const type = typeOrName
|
|
14
14
|
? getMarkType(typeOrName, state.schema)
|
|
15
15
|
: null
|
|
@@ -23,33 +23,41 @@ export default function isMarkActive(
|
|
|
23
23
|
|
|
24
24
|
return type.name === mark.type.name
|
|
25
25
|
})
|
|
26
|
-
.find(mark => objectIncludes(mark.attrs, attributes))
|
|
26
|
+
.find(mark => objectIncludes(mark.attrs, attributes, { strict: false }))
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
let selectionRange = 0
|
|
30
|
-
|
|
30
|
+
const markRanges: MarkRange[] = []
|
|
31
|
+
|
|
32
|
+
ranges.forEach(({ $from, $to }) => {
|
|
33
|
+
const from = $from.pos
|
|
34
|
+
const to = $to.pos
|
|
35
|
+
|
|
36
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
37
|
+
if (!node.isText && !node.marks.length) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
31
40
|
|
|
32
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
33
|
-
if (node.isText) {
|
|
34
41
|
const relativeFrom = Math.max(from, pos)
|
|
35
42
|
const relativeTo = Math.min(to, pos + node.nodeSize)
|
|
36
43
|
const range = relativeTo - relativeFrom
|
|
37
44
|
|
|
38
45
|
selectionRange += range
|
|
39
46
|
|
|
40
|
-
markRanges
|
|
47
|
+
markRanges.push(...node.marks.map(mark => ({
|
|
41
48
|
mark,
|
|
42
49
|
from: relativeFrom,
|
|
43
50
|
to: relativeTo,
|
|
44
|
-
}))
|
|
45
|
-
}
|
|
51
|
+
})))
|
|
52
|
+
})
|
|
46
53
|
})
|
|
47
54
|
|
|
48
55
|
if (selectionRange === 0) {
|
|
49
56
|
return false
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
// calculate range of matched mark
|
|
60
|
+
const matchedRange = markRanges
|
|
53
61
|
.filter(markRange => {
|
|
54
62
|
if (!type) {
|
|
55
63
|
return true
|
|
@@ -57,11 +65,27 @@ export default function isMarkActive(
|
|
|
57
65
|
|
|
58
66
|
return type.name === markRange.mark.type.name
|
|
59
67
|
})
|
|
60
|
-
.filter(markRange => objectIncludes(markRange.mark.attrs, attributes))
|
|
61
|
-
.reduce((sum, markRange) =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
.filter(markRange => objectIncludes(markRange.mark.attrs, attributes, { strict: false }))
|
|
69
|
+
.reduce((sum, markRange) => sum + markRange.to - markRange.from, 0)
|
|
70
|
+
|
|
71
|
+
// calculate range of marks that excludes the searched mark
|
|
72
|
+
// for example `code` doesn’t allow any other marks
|
|
73
|
+
const excludedRange = markRanges
|
|
74
|
+
.filter(markRange => {
|
|
75
|
+
if (!type) {
|
|
76
|
+
return true
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return markRange.mark.type !== type
|
|
80
|
+
&& markRange.mark.type.excludes(type)
|
|
81
|
+
})
|
|
82
|
+
.reduce((sum, markRange) => sum + markRange.to - markRange.from, 0)
|
|
83
|
+
|
|
84
|
+
// we only include the result of `excludedRange`
|
|
85
|
+
// if there is a match at all
|
|
86
|
+
const range = matchedRange > 0
|
|
87
|
+
? matchedRange + excludedRange
|
|
88
|
+
: matchedRange
|
|
65
89
|
|
|
66
90
|
return range >= selectionRange
|
|
67
91
|
}
|
|
@@ -1,49 +1,38 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state'
|
|
2
2
|
import { NodeType } from 'prosemirror-model'
|
|
3
|
-
import objectIncludes from '../utilities/objectIncludes'
|
|
4
|
-
import getNodeType from './getNodeType'
|
|
5
|
-
import {
|
|
3
|
+
import { objectIncludes } from '../utilities/objectIncludes'
|
|
4
|
+
import { getNodeType } from './getNodeType'
|
|
5
|
+
import { NodeRange } from '../types'
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export function isNodeActive(
|
|
8
8
|
state: EditorState,
|
|
9
9
|
typeOrName: NodeType | string | null,
|
|
10
|
-
attributes:
|
|
10
|
+
attributes: Record<string, any> = {},
|
|
11
11
|
): boolean {
|
|
12
12
|
const { from, to, empty } = state.selection
|
|
13
13
|
const type = typeOrName
|
|
14
14
|
? getNodeType(typeOrName, state.schema)
|
|
15
15
|
: null
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const nodeRanges: NodeRange[] = []
|
|
18
18
|
|
|
19
19
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
const relativeTo = Math.min(to, pos + node.nodeSize)
|
|
23
|
-
|
|
24
|
-
nodeRanges = [...nodeRanges, {
|
|
25
|
-
node,
|
|
26
|
-
from: relativeFrom,
|
|
27
|
-
to: relativeTo,
|
|
28
|
-
}]
|
|
20
|
+
if (node.isText) {
|
|
21
|
+
return
|
|
29
22
|
}
|
|
30
|
-
})
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.filter(nodeRange => {
|
|
35
|
-
if (!type) {
|
|
36
|
-
return true
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return type.name === nodeRange.node.type.name
|
|
40
|
-
})
|
|
41
|
-
.find(nodeRange => objectIncludes(nodeRange.node.attrs, attributes))
|
|
42
|
-
}
|
|
24
|
+
const relativeFrom = Math.max(from, pos)
|
|
25
|
+
const relativeTo = Math.min(to, pos + node.nodeSize)
|
|
43
26
|
|
|
44
|
-
|
|
27
|
+
nodeRanges.push({
|
|
28
|
+
node,
|
|
29
|
+
from: relativeFrom,
|
|
30
|
+
to: relativeTo,
|
|
31
|
+
})
|
|
32
|
+
})
|
|
45
33
|
|
|
46
|
-
const
|
|
34
|
+
const selectionRange = to - from
|
|
35
|
+
const matchedNodeRanges = nodeRanges
|
|
47
36
|
.filter(nodeRange => {
|
|
48
37
|
if (!type) {
|
|
49
38
|
return true
|
|
@@ -51,11 +40,14 @@ export default function isNodeActive(
|
|
|
51
40
|
|
|
52
41
|
return type.name === nodeRange.node.type.name
|
|
53
42
|
})
|
|
54
|
-
.filter(nodeRange => objectIncludes(nodeRange.node.attrs, attributes))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
.filter(nodeRange => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }))
|
|
44
|
+
|
|
45
|
+
if (empty) {
|
|
46
|
+
return !!matchedNodeRanges.length
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const range = matchedNodeRanges
|
|
50
|
+
.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0)
|
|
59
51
|
|
|
60
52
|
return range >= selectionRange
|
|
61
53
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Node as ProseMirrorNode } from 'prosemirror-model'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function isNodeEmpty(node: ProseMirrorNode): boolean {
|
|
4
4
|
const defaultContent = node.type.createAndFill()?.toJSON()
|
|
5
5
|
const content = node.toJSON()
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeSelection } from 'prosemirror-state'
|
|
2
|
-
import isObject from '../utilities/isObject'
|
|
2
|
+
import { isObject } from '../utilities/isObject'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function isNodeSelection(value: unknown): value is NodeSelection {
|
|
5
5
|
return isObject(value) && value instanceof NodeSelection
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from 'prosemirror-state'
|
|
2
|
-
import isObject from '../utilities/isObject'
|
|
2
|
+
import { isObject } from '../utilities/isObject'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function isTextSelection(value: unknown): value is TextSelection {
|
|
5
5
|
return isObject(value) && value instanceof TextSelection
|
|
6
6
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view'
|
|
2
|
+
import { minMax } from '../utilities/minMax'
|
|
3
|
+
|
|
4
|
+
export function posToDOMRect(view: EditorView, from: number, to: number): DOMRect {
|
|
5
|
+
const minPos = 0
|
|
6
|
+
const maxPos = view.state.doc.content.size
|
|
7
|
+
const resolvedFrom = minMax(from, minPos, maxPos)
|
|
8
|
+
const resolvedEnd = minMax(to, minPos, maxPos)
|
|
9
|
+
const start = view.coordsAtPos(resolvedFrom)
|
|
10
|
+
const end = view.coordsAtPos(resolvedEnd, -1)
|
|
11
|
+
const top = Math.min(start.top, end.top)
|
|
12
|
+
const bottom = Math.max(start.bottom, end.bottom)
|
|
13
|
+
const left = Math.min(start.left, end.left)
|
|
14
|
+
const right = Math.max(start.right, end.right)
|
|
15
|
+
const width = right - left
|
|
16
|
+
const height = bottom - top
|
|
17
|
+
const x = left
|
|
18
|
+
const y = top
|
|
19
|
+
const data = {
|
|
20
|
+
top,
|
|
21
|
+
bottom,
|
|
22
|
+
left,
|
|
23
|
+
right,
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
26
|
+
x,
|
|
27
|
+
y,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
...data,
|
|
32
|
+
toJSON: () => data,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from 'prosemirror-model'
|
|
2
|
+
import { Selection, TextSelection } from 'prosemirror-state'
|
|
3
|
+
import { FocusPosition } from '../types'
|
|
4
|
+
import { minMax } from '../utilities/minMax'
|
|
5
|
+
|
|
6
|
+
export function resolveFocusPosition(
|
|
7
|
+
doc: ProseMirrorNode,
|
|
8
|
+
position: FocusPosition = null,
|
|
9
|
+
): Selection | null {
|
|
10
|
+
|
|
11
|
+
if (!position) {
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (position === 'start' || position === true) {
|
|
16
|
+
return Selection.atStart(doc)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (position === 'end') {
|
|
20
|
+
return Selection.atEnd(doc)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (position === 'all') {
|
|
24
|
+
return TextSelection.create(doc, 0, doc.content.size)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check if `position` is in bounds of the doc if `position` is a number.
|
|
28
|
+
const minPos = Selection.atStart(doc).from
|
|
29
|
+
const maxPos = Selection.atEnd(doc).to
|
|
30
|
+
const resolvedFrom = minMax(position, minPos, maxPos)
|
|
31
|
+
const resolvedEnd = minMax(position, minPos, maxPos)
|
|
32
|
+
|
|
33
|
+
return TextSelection.create(doc, resolvedFrom, resolvedEnd)
|
|
34
|
+
}
|
|
@@ -2,7 +2,7 @@ import { Selection, Transaction } from 'prosemirror-state'
|
|
|
2
2
|
import { ReplaceStep, ReplaceAroundStep } from 'prosemirror-transform'
|
|
3
3
|
|
|
4
4
|
// source: https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466
|
|
5
|
-
export
|
|
5
|
+
export function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number) {
|
|
6
6
|
const last = tr.steps.length - 1
|
|
7
7
|
|
|
8
8
|
if (last < startLen) {
|
|
@@ -3,7 +3,7 @@ import { Extension } from '../Extension'
|
|
|
3
3
|
import { Node } from '../Node'
|
|
4
4
|
import { Mark } from '../Mark'
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function splitExtensions(extensions: Extensions) {
|
|
7
7
|
const baseExtensions = extensions.filter(extension => extension.type === 'extension') as Extension[]
|
|
8
8
|
const nodeExtensions = extensions.filter(extension => extension.type === 'node') as Node[]
|
|
9
9
|
const markExtensions = extensions.filter(extension => extension.type === 'mark') as Mark[]
|
package/src/index.ts
CHANGED
|
@@ -1,36 +1,69 @@
|
|
|
1
|
+
import * as extensions from './extensions'
|
|
2
|
+
|
|
3
|
+
export { extensions }
|
|
1
4
|
export * from './Editor'
|
|
2
5
|
export * from './Extension'
|
|
3
6
|
export * from './Node'
|
|
4
7
|
export * from './Mark'
|
|
5
8
|
export * from './NodeView'
|
|
9
|
+
export * from './Tracker'
|
|
10
|
+
export * from './InputRule'
|
|
11
|
+
export * from './PasteRule'
|
|
12
|
+
export * from './CommandManager'
|
|
6
13
|
export * from './types'
|
|
7
14
|
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
15
|
+
export * from './inputRules/nodeInputRule'
|
|
16
|
+
export * from './inputRules/markInputRule'
|
|
17
|
+
export * from './inputRules/textblockTypeInputRule'
|
|
18
|
+
export * from './inputRules/textInputRule'
|
|
19
|
+
export * from './inputRules/wrappingInputRule'
|
|
20
|
+
export * from './pasteRules/markPasteRule'
|
|
21
|
+
export * from './pasteRules/textPasteRule'
|
|
11
22
|
|
|
12
|
-
export
|
|
13
|
-
export
|
|
23
|
+
export * from './utilities/callOrReturn'
|
|
24
|
+
export * from './utilities/escapeForRegEx'
|
|
25
|
+
export * from './utilities/mergeAttributes'
|
|
14
26
|
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
27
|
+
export * from './helpers/combineTransactionSteps'
|
|
28
|
+
export * from './helpers/defaultBlockAt'
|
|
29
|
+
export * from './helpers/getExtensionField'
|
|
30
|
+
export * from './helpers/findChildren'
|
|
31
|
+
export * from './helpers/findChildrenInRange'
|
|
32
|
+
export * from './helpers/findParentNode'
|
|
33
|
+
export * from './helpers/findParentNodeClosestToPos'
|
|
34
|
+
export * from './helpers/generateHTML'
|
|
35
|
+
export * from './helpers/generateJSON'
|
|
36
|
+
export * from './helpers/generateText'
|
|
37
|
+
export * from './helpers/getChangedRanges'
|
|
38
|
+
export * from './helpers/getSchema'
|
|
39
|
+
export * from './helpers/getHTMLFromFragment'
|
|
40
|
+
export * from './helpers/getDebugJSON'
|
|
41
|
+
export * from './helpers/getAttributes'
|
|
42
|
+
export * from './helpers/getMarkAttributes'
|
|
43
|
+
export * from './helpers/getMarkRange'
|
|
44
|
+
export * from './helpers/getMarkType'
|
|
45
|
+
export * from './helpers/getMarksBetween'
|
|
46
|
+
export * from './helpers/getNodeAttributes'
|
|
47
|
+
export * from './helpers/getNodeType'
|
|
48
|
+
export * from './helpers/getText'
|
|
49
|
+
export * from './helpers/getTextBetween'
|
|
50
|
+
export * from './helpers/isActive'
|
|
51
|
+
export * from './helpers/isList'
|
|
52
|
+
export * from './helpers/isMarkActive'
|
|
53
|
+
export * from './helpers/isNodeActive'
|
|
54
|
+
export * from './helpers/isNodeEmpty'
|
|
55
|
+
export * from './helpers/isNodeSelection'
|
|
56
|
+
export * from './helpers/isTextSelection'
|
|
57
|
+
export * from './helpers/posToDOMRect'
|
|
26
58
|
|
|
27
|
-
|
|
59
|
+
// eslint-disable-next-line
|
|
60
|
+
export interface Commands<ReturnType = any> {}
|
|
28
61
|
|
|
29
62
|
// eslint-disable-next-line
|
|
30
|
-
export interface ExtensionConfig<Options = any> {}
|
|
63
|
+
export interface ExtensionConfig<Options = any, Storage = any> {}
|
|
31
64
|
|
|
32
65
|
// eslint-disable-next-line
|
|
33
|
-
export interface NodeConfig<Options = any> {}
|
|
66
|
+
export interface NodeConfig<Options = any, Storage = any> {}
|
|
34
67
|
|
|
35
68
|
// eslint-disable-next-line
|
|
36
|
-
export interface MarkConfig<Options = any> {}
|
|
69
|
+
export interface MarkConfig<Options = any, Storage = any> {}
|