@tiptap/core 2.0.0-beta.176 → 2.0.0-beta.180
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 +1 -1
- package/dist/packages/core/src/Editor.d.ts +4 -4
- package/dist/packages/core/src/Extension.d.ts +5 -5
- package/dist/packages/core/src/InputRule.d.ts +1 -1
- package/dist/packages/core/src/Mark.d.ts +5 -5
- package/dist/packages/core/src/Node.d.ts +4 -4
- package/dist/packages/core/src/NodeView.d.ts +4 -4
- package/dist/packages/core/src/PasteRule.d.ts +1 -1
- package/dist/packages/core/src/commands/deleteRange.d.ts +1 -1
- package/dist/packages/core/src/commands/focus.d.ts +1 -1
- package/dist/packages/core/src/commands/index.d.ts +50 -0
- package/dist/packages/core/src/commands/insertContent.d.ts +1 -1
- package/dist/packages/core/src/commands/insertContentAt.d.ts +1 -1
- package/dist/packages/core/src/commands/resetAttributes.d.ts +1 -1
- package/dist/packages/core/src/commands/setContent.d.ts +1 -1
- package/dist/packages/core/src/commands/setTextSelection.d.ts +1 -1
- package/dist/packages/core/src/commands/updateAttributes.d.ts +1 -1
- package/dist/packages/core/src/extensions/commands.d.ts +1 -100
- package/dist/packages/core/src/helpers/createDocument.d.ts +1 -1
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +1 -1
- package/dist/packages/core/src/helpers/findChildren.d.ts +1 -1
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +1 -1
- package/dist/packages/core/src/helpers/findParentNode.d.ts +1 -2
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +1 -1
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +1 -1
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +1 -1
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getText.d.ts +1 -1
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +1 -1
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +2 -0
- package/dist/packages/core/src/helpers/index.d.ts +33 -0
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +1 -1
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +1 -1
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +2 -2
- package/dist/packages/core/src/index.d.ts +9 -48
- package/dist/packages/core/src/inputRules/index.d.ts +5 -0
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +1 -1
- package/dist/packages/core/src/pasteRules/index.d.ts +2 -0
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +1 -1
- package/dist/packages/core/src/types.d.ts +6 -5
- package/dist/packages/core/src/utilities/index.d.ts +3 -0
- package/dist/tiptap-core.cjs.js +3471 -3703
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +3431 -3664
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +3276 -3508
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +9 -16
- package/src/CommandManager.ts +4 -3
- package/src/Editor.ts +16 -15
- package/src/Extension.ts +10 -9
- package/src/ExtensionManager.ts +11 -10
- package/src/InputRule.ts +10 -13
- package/src/Mark.ts +11 -10
- package/src/Node.ts +11 -10
- package/src/NodeView.ts +7 -6
- package/src/PasteRule.ts +8 -7
- package/src/commands/clearNodes.ts +1 -0
- package/src/commands/createParagraphNear.ts +1 -0
- package/src/commands/deleteNode.ts +1 -0
- package/src/commands/deleteRange.ts +1 -1
- package/src/commands/deleteSelection.ts +1 -0
- package/src/commands/exitCode.ts +1 -0
- package/src/commands/extendMarkRange.ts +4 -3
- package/src/commands/focus.ts +3 -3
- package/src/commands/index.ts +50 -0
- package/src/commands/insertContent.ts +2 -1
- package/src/commands/insertContentAt.ts +2 -1
- package/src/commands/joinBackward.ts +1 -0
- package/src/commands/joinForward.ts +1 -0
- package/src/commands/lift.ts +3 -2
- package/src/commands/liftEmptyBlock.ts +1 -0
- package/src/commands/liftListItem.ts +3 -2
- package/src/commands/newlineInCode.ts +1 -0
- package/src/commands/resetAttributes.ts +4 -3
- package/src/commands/selectNodeBackward.ts +1 -0
- package/src/commands/selectNodeForward.ts +1 -0
- package/src/commands/selectParentNode.ts +1 -0
- package/src/commands/selectTextblockEnd.ts +1 -0
- package/src/commands/selectTextblockStart.ts +1 -0
- package/src/commands/setContent.ts +3 -2
- package/src/commands/setMark.ts +3 -2
- package/src/commands/setNode.ts +3 -2
- package/src/commands/setNodeSelection.ts +3 -2
- package/src/commands/setTextSelection.ts +2 -1
- package/src/commands/sinkListItem.ts +3 -2
- package/src/commands/splitBlock.ts +3 -2
- package/src/commands/splitListItem.ts +5 -4
- package/src/commands/toggleList.ts +3 -2
- package/src/commands/toggleMark.ts +2 -1
- package/src/commands/toggleNode.ts +3 -2
- package/src/commands/toggleWrap.ts +3 -2
- package/src/commands/unsetMark.ts +3 -2
- package/src/commands/updateAttributes.ts +3 -2
- package/src/commands/wrapIn.ts +2 -1
- package/src/commands/wrapInList.ts +3 -2
- package/src/extensions/clipboardTextSerializer.ts +1 -0
- package/src/extensions/commands.ts +3 -150
- package/src/extensions/editable.ts +1 -0
- package/src/extensions/focusEvents.ts +1 -0
- package/src/extensions/keymap.ts +3 -2
- package/src/extensions/tabindex.ts +2 -7
- package/src/helpers/createChainableState.ts +3 -2
- package/src/helpers/createDocument.ts +2 -1
- package/src/helpers/createNodeFromContent.ts +4 -3
- package/src/helpers/findChildren.ts +2 -1
- package/src/helpers/findChildrenInRange.ts +2 -1
- package/src/helpers/findParentNode.ts +2 -1
- package/src/helpers/findParentNodeClosestToPos.ts +2 -1
- package/src/helpers/generateHTML.ts +3 -2
- package/src/helpers/generateJSON.ts +3 -2
- package/src/helpers/generateText.ts +3 -2
- package/src/helpers/getAttributes.ts +3 -2
- package/src/helpers/getAttributesFromExtensions.ts +18 -11
- package/src/helpers/getChangedRanges.ts +2 -1
- package/src/helpers/getDebugJSON.ts +1 -0
- package/src/helpers/getExtensionField.ts +1 -1
- package/src/helpers/getHTMLFromFragment.ts +1 -1
- package/src/helpers/getMarkAttributes.ts +2 -1
- package/src/helpers/getMarkRange.ts +5 -4
- package/src/helpers/getMarksBetween.ts +1 -0
- package/src/helpers/getNodeAttributes.ts +2 -1
- package/src/helpers/getRenderedAttributes.ts +2 -1
- package/src/helpers/getSchema.ts +2 -1
- package/src/helpers/getSchemaByResolvedExtensions.ts +7 -6
- package/src/helpers/getText.ts +2 -1
- package/src/helpers/getTextBetween.ts +12 -9
- package/src/helpers/getTextContentFromNodes.ts +17 -0
- package/src/helpers/getTextSerializersFromSchema.ts +1 -0
- package/src/helpers/index.ts +33 -0
- package/src/helpers/injectExtensionAttributesToParseRule.ts +1 -0
- package/src/helpers/isActive.ts +3 -2
- package/src/helpers/isList.ts +3 -3
- package/src/helpers/isMarkActive.ts +3 -2
- package/src/helpers/isNodeActive.ts +3 -2
- package/src/helpers/isNodeSelection.ts +1 -0
- package/src/helpers/isTextSelection.ts +1 -0
- package/src/helpers/posToDOMRect.ts +1 -0
- package/src/helpers/resolveFocusPosition.ts +1 -0
- package/src/helpers/selectionToInsertionEnd.ts +1 -1
- package/src/helpers/splitExtensions.ts +2 -2
- package/src/index.ts +9 -52
- package/src/inputRules/index.ts +5 -0
- package/src/inputRules/markInputRule.ts +3 -2
- package/src/inputRules/nodeInputRule.ts +1 -0
- package/src/inputRules/textblockTypeInputRule.ts +2 -1
- package/src/inputRules/wrappingInputRule.ts +3 -2
- package/src/pasteRules/index.ts +2 -0
- package/src/pasteRules/markPasteRule.ts +3 -2
- package/src/types.ts +11 -9
- package/src/utilities/index.ts +3 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Mark as ProseMirrorMark, MarkType, ResolvedPos } from 'prosemirror-model'
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { Range } from '../types'
|
|
4
|
+
import { objectIncludes } from '../utilities/objectIncludes'
|
|
4
5
|
|
|
5
6
|
function findMarkInSet(
|
|
6
7
|
marks: ProseMirrorMark[],
|
|
@@ -39,7 +40,7 @@ export function getMarkRange(
|
|
|
39
40
|
return
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
const mark = findMarkInSet(start.node.marks, type, attributes)
|
|
43
|
+
const mark = findMarkInSet([...start.node.marks], type, attributes)
|
|
43
44
|
|
|
44
45
|
if (!mark) {
|
|
45
46
|
return
|
|
@@ -50,7 +51,7 @@ export function getMarkRange(
|
|
|
50
51
|
let endIndex = startIndex + 1
|
|
51
52
|
let endPos = startPos + start.node.nodeSize
|
|
52
53
|
|
|
53
|
-
findMarkInSet(start.node.marks, type, attributes)
|
|
54
|
+
findMarkInSet([...start.node.marks], type, attributes)
|
|
54
55
|
|
|
55
56
|
while (startIndex > 0 && mark.isInSet($pos.parent.child(startIndex - 1).marks)) {
|
|
56
57
|
startIndex -= 1
|
|
@@ -59,7 +60,7 @@ export function getMarkRange(
|
|
|
59
60
|
|
|
60
61
|
while (
|
|
61
62
|
endIndex < $pos.parent.childCount
|
|
62
|
-
&& isMarkInSet(
|
|
63
|
+
&& isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)
|
|
63
64
|
) {
|
|
64
65
|
endPos += $pos.parent.child(endIndex).nodeSize
|
|
65
66
|
endIndex += 1
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { EditorState } from 'prosemirror-state'
|
|
2
1
|
import { Node, NodeType } from 'prosemirror-model'
|
|
2
|
+
import { EditorState } from 'prosemirror-state'
|
|
3
|
+
|
|
3
4
|
import { getNodeType } from './getNodeType'
|
|
4
5
|
|
|
5
6
|
export function getNodeAttributes(state: EditorState, typeOrName: string | NodeType): Record<string, any> {
|
package/src/helpers/getSchema.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Schema } from 'prosemirror-model'
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { ExtensionManager } from '../ExtensionManager'
|
|
4
4
|
import { Extensions } from '../types'
|
|
5
|
+
import { getSchemaByResolvedExtensions } from './getSchemaByResolvedExtensions'
|
|
5
6
|
|
|
6
7
|
export function getSchema(extensions: Extensions): Schema {
|
|
7
8
|
const resolvedExtensions = ExtensionManager.resolve(extensions)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model'
|
|
2
|
+
|
|
3
|
+
import { MarkConfig, NodeConfig } from '..'
|
|
2
4
|
import { AnyConfig, Extensions } from '../types'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
6
|
+
import { isEmptyObject } from '../utilities/isEmptyObject'
|
|
5
7
|
import { getAttributesFromExtensions } from './getAttributesFromExtensions'
|
|
8
|
+
import { getExtensionField } from './getExtensionField'
|
|
6
9
|
import { getRenderedAttributes } from './getRenderedAttributes'
|
|
7
|
-
import { isEmptyObject } from '../utilities/isEmptyObject'
|
|
8
10
|
import { injectExtensionAttributesToParseRule } from './injectExtensionAttributesToParseRule'
|
|
9
|
-
import {
|
|
10
|
-
import { getExtensionField } from './getExtensionField'
|
|
11
|
+
import { splitExtensions } from './splitExtensions'
|
|
11
12
|
|
|
12
13
|
function cleanUpSchemaItem<T>(data: T) {
|
|
13
14
|
return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
|
package/src/helpers/getText.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Range, TextSerializer } from '../types'
|
|
2
1
|
import { Node as ProseMirrorNode } from 'prosemirror-model'
|
|
3
2
|
|
|
3
|
+
import { Range, TextSerializer } from '../types'
|
|
4
|
+
|
|
4
5
|
export function getTextBetween(
|
|
5
6
|
startNode: ProseMirrorNode,
|
|
6
7
|
range: Range,
|
|
@@ -26,15 +27,17 @@ export function getTextBetween(
|
|
|
26
27
|
separated = true
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
if (parent) {
|
|
31
|
+
text += textSerializer({
|
|
32
|
+
node,
|
|
33
|
+
pos,
|
|
34
|
+
parent,
|
|
35
|
+
index,
|
|
36
|
+
range,
|
|
37
|
+
})
|
|
38
|
+
}
|
|
36
39
|
} else if (node.isText) {
|
|
37
|
-
text += node?.text?.slice(Math.max(from, pos) - pos, to - pos)
|
|
40
|
+
text += node?.text?.slice(Math.max(from, pos) - pos, to - pos) // eslint-disable-line
|
|
38
41
|
separated = false
|
|
39
42
|
} else if (node.isBlock && !separated) {
|
|
40
43
|
text += blockSeparator
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model'
|
|
2
|
+
|
|
3
|
+
export const getTextContentFromNodes = ($from: ResolvedPos, maxMatch = 500) => {
|
|
4
|
+
let textBefore = ''
|
|
5
|
+
|
|
6
|
+
$from.parent.nodesBetween(
|
|
7
|
+
Math.max(0, $from.parentOffset - maxMatch),
|
|
8
|
+
$from.parentOffset,
|
|
9
|
+
(node, pos, parent, index) => {
|
|
10
|
+
textBefore += node.type.spec.toText?.({
|
|
11
|
+
node, pos, parent, index,
|
|
12
|
+
}) || node.textContent || '%leaf%'
|
|
13
|
+
},
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
return textBefore
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './combineTransactionSteps'
|
|
2
|
+
export * from './defaultBlockAt'
|
|
3
|
+
export * from './findChildren'
|
|
4
|
+
export * from './findChildrenInRange'
|
|
5
|
+
export * from './findParentNode'
|
|
6
|
+
export * from './findParentNodeClosestToPos'
|
|
7
|
+
export * from './generateHTML'
|
|
8
|
+
export * from './generateJSON'
|
|
9
|
+
export * from './generateText'
|
|
10
|
+
export * from './getAttributes'
|
|
11
|
+
export * from './getChangedRanges'
|
|
12
|
+
export * from './getDebugJSON'
|
|
13
|
+
export * from './getExtensionField'
|
|
14
|
+
export * from './getHTMLFromFragment'
|
|
15
|
+
export * from './getMarkAttributes'
|
|
16
|
+
export * from './getMarkRange'
|
|
17
|
+
export * from './getMarksBetween'
|
|
18
|
+
export * from './getMarkType'
|
|
19
|
+
export * from './getNodeAttributes'
|
|
20
|
+
export * from './getNodeType'
|
|
21
|
+
export * from './getSchema'
|
|
22
|
+
export * from './getText'
|
|
23
|
+
export * from './getTextBetween'
|
|
24
|
+
export * from './getTextContentFromNodes'
|
|
25
|
+
export * from './getTextSerializersFromSchema'
|
|
26
|
+
export * from './isActive'
|
|
27
|
+
export * from './isList'
|
|
28
|
+
export * from './isMarkActive'
|
|
29
|
+
export * from './isNodeActive'
|
|
30
|
+
export * from './isNodeEmpty'
|
|
31
|
+
export * from './isNodeSelection'
|
|
32
|
+
export * from './isTextSelection'
|
|
33
|
+
export * from './posToDOMRect'
|
package/src/helpers/isActive.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state'
|
|
2
|
-
|
|
3
|
-
import { isMarkActive } from './isMarkActive'
|
|
2
|
+
|
|
4
3
|
import { getSchemaTypeNameByName } from './getSchemaTypeNameByName'
|
|
4
|
+
import { isMarkActive } from './isMarkActive'
|
|
5
|
+
import { isNodeActive } from './isNodeActive'
|
|
5
6
|
|
|
6
7
|
export function isActive(state: EditorState, name: string | null, attributes: Record<string, any> = {}): boolean {
|
|
7
8
|
if (!name) {
|
package/src/helpers/isList.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Extensions } from '../types'
|
|
2
1
|
import { NodeConfig } from '..'
|
|
3
|
-
import { splitExtensions } from './splitExtensions'
|
|
4
|
-
import { callOrReturn } from '../utilities/callOrReturn'
|
|
5
2
|
import { getExtensionField } from '../helpers/getExtensionField'
|
|
3
|
+
import { Extensions } from '../types'
|
|
4
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
5
|
+
import { splitExtensions } from './splitExtensions'
|
|
6
6
|
|
|
7
7
|
export function isList(name: string, extensions: Extensions): boolean {
|
|
8
8
|
const { nodeExtensions } = splitExtensions(extensions)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EditorState } from 'prosemirror-state'
|
|
2
1
|
import { MarkType } from 'prosemirror-model'
|
|
2
|
+
import { EditorState } from 'prosemirror-state'
|
|
3
|
+
|
|
4
|
+
import { MarkRange } from '../types'
|
|
3
5
|
import { objectIncludes } from '../utilities/objectIncludes'
|
|
4
6
|
import { getMarkType } from './getMarkType'
|
|
5
|
-
import { MarkRange } from '../types'
|
|
6
7
|
|
|
7
8
|
export function isMarkActive(
|
|
8
9
|
state: EditorState,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EditorState } from 'prosemirror-state'
|
|
2
1
|
import { NodeType } from 'prosemirror-model'
|
|
2
|
+
import { EditorState } from 'prosemirror-state'
|
|
3
|
+
|
|
4
|
+
import { NodeRange } from '../types'
|
|
3
5
|
import { objectIncludes } from '../utilities/objectIncludes'
|
|
4
6
|
import { getNodeType } from './getNodeType'
|
|
5
|
-
import { NodeRange } from '../types'
|
|
6
7
|
|
|
7
8
|
export function isNodeActive(
|
|
8
9
|
state: EditorState,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Selection, Transaction } from 'prosemirror-state'
|
|
2
|
-
import {
|
|
2
|
+
import { ReplaceAroundStep, ReplaceStep } from 'prosemirror-transform'
|
|
3
3
|
|
|
4
4
|
// source: https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466
|
|
5
5
|
export function selectionToInsertionEnd(tr: Transaction, startLen: number, bias: number) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Extensions } from '../types'
|
|
2
1
|
import { Extension } from '../Extension'
|
|
3
|
-
import { Node } from '../Node'
|
|
4
2
|
import { Mark } from '../Mark'
|
|
3
|
+
import { Node } from '../Node'
|
|
4
|
+
import { Extensions } from '../types'
|
|
5
5
|
|
|
6
6
|
export function splitExtensions(extensions: Extensions) {
|
|
7
7
|
const baseExtensions = extensions.filter(extension => extension.type === 'extension') as Extension[]
|
package/src/index.ts
CHANGED
|
@@ -1,61 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { extensions }
|
|
1
|
+
export * from './CommandManager'
|
|
4
2
|
export * from './Editor'
|
|
5
3
|
export * from './Extension'
|
|
6
|
-
export * from './
|
|
4
|
+
export * as extensions from './extensions'
|
|
5
|
+
export * from './helpers'
|
|
6
|
+
export * from './InputRule'
|
|
7
|
+
export * from './inputRules'
|
|
7
8
|
export * from './Mark'
|
|
9
|
+
export * from './Node'
|
|
8
10
|
export * from './NodeView'
|
|
9
|
-
export * from './Tracker'
|
|
10
|
-
export * from './InputRule'
|
|
11
11
|
export * from './PasteRule'
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './pasteRules'
|
|
13
|
+
export * from './Tracker'
|
|
13
14
|
export * from './types'
|
|
14
|
-
|
|
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'
|
|
22
|
-
|
|
23
|
-
export * from './utilities/callOrReturn'
|
|
24
|
-
export * from './utilities/escapeForRegEx'
|
|
25
|
-
export * from './utilities/mergeAttributes'
|
|
26
|
-
|
|
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/getTextSerializersFromSchema'
|
|
51
|
-
export * from './helpers/isActive'
|
|
52
|
-
export * from './helpers/isList'
|
|
53
|
-
export * from './helpers/isMarkActive'
|
|
54
|
-
export * from './helpers/isNodeActive'
|
|
55
|
-
export * from './helpers/isNodeEmpty'
|
|
56
|
-
export * from './helpers/isNodeSelection'
|
|
57
|
-
export * from './helpers/isTextSelection'
|
|
58
|
-
export * from './helpers/posToDOMRect'
|
|
15
|
+
export * from './utilities'
|
|
59
16
|
|
|
60
17
|
// eslint-disable-next-line
|
|
61
18
|
export interface Commands<ReturnType = any> {}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { InputRule, InputRuleFinder } from '../InputRule'
|
|
2
1
|
import { MarkType } from 'prosemirror-model'
|
|
2
|
+
|
|
3
3
|
import { getMarksBetween } from '../helpers/getMarksBetween'
|
|
4
|
-
import {
|
|
4
|
+
import { InputRule, InputRuleFinder } from '../InputRule'
|
|
5
5
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
6
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Build an input rule that adds a mark when the
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { InputRule, InputRuleFinder } from '../InputRule'
|
|
2
1
|
import { NodeType } from 'prosemirror-model'
|
|
2
|
+
|
|
3
|
+
import { InputRule, InputRuleFinder } from '../InputRule'
|
|
3
4
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
4
5
|
import { callOrReturn } from '../utilities/callOrReturn'
|
|
5
6
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode, NodeType } from 'prosemirror-model'
|
|
2
|
+
import { canJoin, findWrapping } from 'prosemirror-transform'
|
|
3
|
+
|
|
1
4
|
import { InputRule, InputRuleFinder } from '../InputRule'
|
|
2
|
-
import { NodeType, Node as ProseMirrorNode } from 'prosemirror-model'
|
|
3
|
-
import { findWrapping, canJoin } from 'prosemirror-transform'
|
|
4
5
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
5
6
|
import { callOrReturn } from '../utilities/callOrReturn'
|
|
6
7
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { PasteRule, PasteRuleFinder } from '../PasteRule'
|
|
2
1
|
import { MarkType } from 'prosemirror-model'
|
|
2
|
+
|
|
3
3
|
import { getMarksBetween } from '../helpers/getMarksBetween'
|
|
4
|
-
import {
|
|
4
|
+
import { PasteRule, PasteRuleFinder } from '../PasteRule'
|
|
5
5
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
6
|
+
import { callOrReturn } from '../utilities/callOrReturn'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Build an paste rule that adds a mark when the
|
package/src/types.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Node as ProseMirrorNode,
|
|
3
2
|
Mark as ProseMirrorMark,
|
|
3
|
+
Node as ProseMirrorNode,
|
|
4
4
|
ParseOptions,
|
|
5
5
|
} from 'prosemirror-model'
|
|
6
|
+
import { EditorState, Transaction } from 'prosemirror-state'
|
|
6
7
|
import {
|
|
7
|
-
EditorView,
|
|
8
8
|
Decoration,
|
|
9
|
-
NodeView,
|
|
10
9
|
EditorProps,
|
|
10
|
+
EditorView,
|
|
11
|
+
NodeView,
|
|
11
12
|
} from 'prosemirror-view'
|
|
12
|
-
|
|
13
|
-
import { Extension } from './Extension'
|
|
14
|
-
import { Node } from './Node'
|
|
15
|
-
import { Mark } from './Mark'
|
|
16
|
-
import { Editor } from './Editor'
|
|
13
|
+
|
|
17
14
|
import {
|
|
18
15
|
Commands,
|
|
19
16
|
ExtensionConfig,
|
|
20
|
-
NodeConfig,
|
|
21
17
|
MarkConfig,
|
|
18
|
+
NodeConfig,
|
|
22
19
|
} from '.'
|
|
20
|
+
import { Editor } from './Editor'
|
|
21
|
+
import { Extension } from './Extension'
|
|
22
|
+
import { Mark } from './Mark'
|
|
23
|
+
import { Node } from './Node'
|
|
23
24
|
|
|
24
25
|
export type AnyConfig = ExtensionConfig | NodeConfig | MarkConfig
|
|
25
26
|
export type AnyExtension = Extension | Node | Mark
|
|
@@ -128,6 +129,7 @@ export type Attribute = {
|
|
|
128
129
|
renderHTML?: ((attributes: Record<string, any>) => Record<string, any> | null) | null,
|
|
129
130
|
parseHTML?: ((element: HTMLElement) => any | null) | null,
|
|
130
131
|
keepOnSplit: boolean,
|
|
132
|
+
isRequired?: boolean,
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
export type Attributes = {
|