@tiptap/core 2.1.0-rc.9 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +383 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +372 -98
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +383 -99
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/CommandManager.d.ts +2 -2
- package/dist/packages/core/src/Editor.d.ts +4 -4
- package/dist/packages/core/src/Extension.d.ts +7 -7
- package/dist/packages/core/src/ExtensionManager.d.ts +2 -2
- package/dist/packages/core/src/InputRule.d.ts +2 -2
- package/dist/packages/core/src/Mark.d.ts +6 -6
- package/dist/packages/core/src/Node.d.ts +5 -5
- package/dist/packages/core/src/NodeView.d.ts +3 -3
- package/dist/packages/core/src/PasteRule.d.ts +2 -2
- package/dist/packages/core/src/commands/blur.d.ts +1 -1
- package/dist/packages/core/src/commands/clearContent.d.ts +1 -1
- package/dist/packages/core/src/commands/clearNodes.d.ts +1 -1
- package/dist/packages/core/src/commands/command.d.ts +1 -1
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +1 -1
- package/dist/packages/core/src/commands/cut.d.ts +15 -0
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +1 -1
- package/dist/packages/core/src/commands/deleteNode.d.ts +1 -1
- package/dist/packages/core/src/commands/deleteRange.d.ts +1 -1
- package/dist/packages/core/src/commands/deleteSelection.d.ts +1 -1
- package/dist/packages/core/src/commands/enter.d.ts +1 -1
- package/dist/packages/core/src/commands/exitCode.d.ts +1 -1
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +1 -1
- package/dist/packages/core/src/commands/first.d.ts +1 -1
- package/dist/packages/core/src/commands/focus.d.ts +1 -1
- package/dist/packages/core/src/commands/forEach.d.ts +1 -1
- package/dist/packages/core/src/commands/index.d.ts +53 -50
- 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/join.d.ts +1 -1
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +12 -0
- package/dist/packages/core/src/commands/joinItemForward.d.ts +12 -0
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +1 -1
- package/dist/packages/core/src/commands/lift.d.ts +1 -1
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +1 -1
- package/dist/packages/core/src/commands/liftListItem.d.ts +1 -1
- package/dist/packages/core/src/commands/newlineInCode.d.ts +1 -1
- package/dist/packages/core/src/commands/resetAttributes.d.ts +1 -1
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +1 -1
- package/dist/packages/core/src/commands/selectAll.d.ts +1 -1
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +1 -1
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +1 -1
- package/dist/packages/core/src/commands/selectParentNode.d.ts +1 -1
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +1 -1
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +1 -1
- package/dist/packages/core/src/commands/setContent.d.ts +1 -1
- package/dist/packages/core/src/commands/setMark.d.ts +1 -1
- package/dist/packages/core/src/commands/setMeta.d.ts +1 -1
- package/dist/packages/core/src/commands/setNode.d.ts +1 -1
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +1 -1
- package/dist/packages/core/src/commands/setTextSelection.d.ts +1 -1
- package/dist/packages/core/src/commands/sinkListItem.d.ts +1 -1
- package/dist/packages/core/src/commands/splitBlock.d.ts +1 -1
- package/dist/packages/core/src/commands/splitListItem.d.ts +1 -1
- package/dist/packages/core/src/commands/toggleList.d.ts +1 -1
- package/dist/packages/core/src/commands/toggleMark.d.ts +1 -1
- package/dist/packages/core/src/commands/toggleNode.d.ts +1 -1
- package/dist/packages/core/src/commands/toggleWrap.d.ts +1 -1
- package/dist/packages/core/src/commands/undoInputRule.d.ts +1 -1
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +1 -1
- package/dist/packages/core/src/commands/unsetMark.d.ts +1 -1
- package/dist/packages/core/src/commands/updateAttributes.d.ts +1 -1
- package/dist/packages/core/src/commands/wrapIn.d.ts +1 -1
- package/dist/packages/core/src/commands/wrapInList.d.ts +1 -1
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +1 -1
- package/dist/packages/core/src/extensions/commands.d.ts +2 -2
- 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 +6 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +1 -1
- package/dist/packages/core/src/extensions/tabindex.d.ts +1 -1
- 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 -1
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateHTML.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateJSON.d.ts +1 -1
- package/dist/packages/core/src/helpers/generateText.d.ts +1 -1
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +1 -1
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +1 -1
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +1 -1
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +1 -1
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +1 -1
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +1 -1
- package/dist/packages/core/src/helpers/getSchema.d.ts +2 -2
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +2 -2
- package/dist/packages/core/src/helpers/getSplittedAttributes.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/getTextSerializersFromSchema.d.ts +1 -1
- package/dist/packages/core/src/helpers/index.d.ts +51 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +1 -1
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +1 -1
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +1 -1
- package/dist/packages/core/src/helpers/isList.d.ts +1 -1
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +1 -1
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +4 -4
- package/dist/packages/core/src/index.d.ts +15 -15
- package/dist/packages/core/src/inputRules/index.d.ts +5 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +2 -2
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +22 -2
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +1 -1
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +2 -2
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +3 -3
- package/dist/packages/core/src/pasteRules/index.d.ts +3 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +2 -2
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +2 -2
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +1 -1
- package/dist/packages/core/src/types.d.ts +5 -5
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +1 -1
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +1 -1
- package/dist/packages/core/src/utilities/index.d.ts +20 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +1 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/findListItemPos.d.ts +6 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/getNextListDepth.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/handleBackspace.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/handleDelete.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/hasListBefore.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/hasListItemAfter.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/hasListItemBefore.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/index.d.ts +10 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/listItemHasSubList.d.ts +3 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/nextListIsDeeper.d.ts +2 -0
- package/dist/packages/extension-list-keymap/src/listHelpers/nextListIsHigher.d.ts +2 -0
- package/package.json +2 -2
- package/src/CommandManager.ts +4 -8
- package/src/Editor.ts +16 -16
- package/src/Extension.ts +10 -10
- package/src/ExtensionManager.ts +15 -15
- package/src/InputRule.ts +6 -6
- package/src/Mark.ts +9 -9
- package/src/Node.ts +8 -8
- package/src/NodeView.ts +8 -6
- package/src/PasteRule.ts +6 -6
- package/src/commands/blur.ts +1 -1
- package/src/commands/clearContent.ts +1 -1
- package/src/commands/clearNodes.ts +1 -1
- package/src/commands/command.ts +1 -1
- package/src/commands/createParagraphNear.ts +1 -1
- package/src/commands/cut.ts +29 -0
- package/src/commands/deleteCurrentNode.ts +1 -1
- package/src/commands/deleteNode.ts +2 -2
- package/src/commands/deleteRange.ts +1 -1
- package/src/commands/deleteSelection.ts +1 -1
- package/src/commands/enter.ts +1 -1
- package/src/commands/exitCode.ts +1 -1
- package/src/commands/extendMarkRange.ts +3 -3
- package/src/commands/first.ts +1 -1
- package/src/commands/focus.ts +4 -4
- package/src/commands/forEach.ts +1 -1
- package/src/commands/index.ts +53 -50
- package/src/commands/insertContent.ts +1 -1
- package/src/commands/insertContentAt.ts +4 -4
- package/src/commands/join.ts +1 -1
- package/src/commands/joinItemBackward.ts +36 -0
- package/src/commands/joinItemForward.ts +38 -0
- package/src/commands/keyboardShortcut.ts +3 -3
- package/src/commands/lift.ts +3 -3
- package/src/commands/liftEmptyBlock.ts +1 -1
- package/src/commands/liftListItem.ts +2 -2
- package/src/commands/newlineInCode.ts +1 -1
- package/src/commands/resetAttributes.ts +5 -5
- package/src/commands/scrollIntoView.ts +1 -1
- package/src/commands/selectAll.ts +1 -1
- package/src/commands/selectNodeBackward.ts +1 -1
- package/src/commands/selectNodeForward.ts +1 -1
- package/src/commands/selectParentNode.ts +1 -1
- package/src/commands/selectTextblockEnd.ts +1 -1
- package/src/commands/selectTextblockStart.ts +1 -1
- package/src/commands/setContent.ts +2 -2
- package/src/commands/setMark.ts +4 -4
- package/src/commands/setMeta.ts +1 -1
- package/src/commands/setNode.ts +2 -2
- package/src/commands/setNodeSelection.ts +2 -2
- package/src/commands/setTextSelection.ts +2 -2
- package/src/commands/sinkListItem.ts +2 -2
- package/src/commands/splitBlock.ts +3 -3
- package/src/commands/splitListItem.ts +3 -3
- package/src/commands/toggleList.ts +4 -4
- package/src/commands/toggleMark.ts +3 -3
- package/src/commands/toggleNode.ts +3 -3
- package/src/commands/toggleWrap.ts +3 -3
- package/src/commands/undoInputRule.ts +1 -1
- package/src/commands/unsetAllMarks.ts +1 -1
- package/src/commands/unsetMark.ts +3 -3
- package/src/commands/updateAttributes.ts +4 -4
- package/src/commands/wrapIn.ts +2 -2
- package/src/commands/wrapInList.ts +2 -2
- package/src/extensions/clipboardTextSerializer.ts +3 -3
- package/src/extensions/commands.ts +3 -3
- package/src/extensions/editable.ts +1 -1
- package/src/extensions/focusEvents.ts +1 -1
- package/src/extensions/index.ts +6 -6
- package/src/extensions/keymap.ts +7 -5
- package/src/extensions/tabindex.ts +1 -1
- package/src/helpers/createDocument.ts +2 -2
- package/src/helpers/createNodeFromContent.ts +2 -2
- package/src/helpers/findChildren.ts +1 -1
- package/src/helpers/findChildrenInRange.ts +1 -1
- package/src/helpers/findParentNode.ts +2 -2
- package/src/helpers/findParentNodeClosestToPos.ts +1 -1
- package/src/helpers/generateHTML.ts +3 -3
- package/src/helpers/generateJSON.ts +3 -3
- package/src/helpers/generateText.ts +4 -4
- package/src/helpers/getAttributes.ts +3 -3
- package/src/helpers/getAttributesFromExtensions.ts +4 -4
- package/src/helpers/getChangedRanges.ts +2 -2
- package/src/helpers/getDebugJSON.ts +1 -1
- package/src/helpers/getExtensionField.ts +1 -1
- package/src/helpers/getMarkAttributes.ts +1 -1
- package/src/helpers/getMarkRange.ts +2 -2
- package/src/helpers/getMarksBetween.ts +2 -2
- package/src/helpers/getNodeAttributes.ts +1 -1
- package/src/helpers/getRenderedAttributes.ts +2 -2
- package/src/helpers/getSchema.ts +4 -4
- package/src/helpers/getSchemaByResolvedExtensions.ts +9 -9
- package/src/helpers/getSplittedAttributes.ts +1 -1
- package/src/helpers/getText.ts +2 -2
- package/src/helpers/getTextBetween.ts +1 -1
- package/src/helpers/getTextSerializersFromSchema.ts +1 -1
- package/src/helpers/index.ts +51 -50
- package/src/helpers/injectExtensionAttributesToParseRule.ts +2 -2
- package/src/helpers/isActive.ts +3 -3
- package/src/helpers/isAtEndOfNode.ts +20 -2
- package/src/helpers/isExtensionRulesEnabled.ts +1 -1
- package/src/helpers/isList.ts +5 -5
- package/src/helpers/isMarkActive.ts +3 -3
- package/src/helpers/isNodeActive.ts +3 -3
- package/src/helpers/posToDOMRect.ts +1 -1
- package/src/helpers/resolveFocusPosition.ts +2 -2
- package/src/helpers/splitExtensions.ts +4 -4
- package/src/index.ts +15 -15
- package/src/inputRules/index.ts +5 -5
- package/src/inputRules/markInputRule.ts +5 -6
- package/src/inputRules/nodeInputRule.ts +59 -6
- package/src/inputRules/textInputRule.ts +1 -1
- package/src/inputRules/textblockTypeInputRule.ts +3 -3
- package/src/inputRules/wrappingInputRule.ts +4 -4
- package/src/pasteRules/index.ts +3 -3
- package/src/pasteRules/markPasteRule.ts +4 -4
- package/src/pasteRules/nodePasteRule.ts +3 -3
- package/src/pasteRules/textPasteRule.ts +1 -1
- package/src/types.ts +5 -5
- package/src/utilities/callOrReturn.ts +2 -2
- package/src/utilities/createStyleTag.ts +3 -3
- package/src/utilities/index.ts +20 -20
- package/src/utilities/isAndroid.ts +3 -0
- package/src/utilities/mergeAttributes.ts +8 -1
- package/src/utilities/mergeDeep.ts +1 -1
- package/src/utilities/objectIncludes.ts +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export * from './callOrReturn';
|
|
2
|
-
export * from './createStyleTag';
|
|
3
|
-
export * from './deleteProps';
|
|
4
|
-
export * from './elementFromString';
|
|
5
|
-
export * from './escapeForRegEx';
|
|
6
|
-
export * from './findDuplicates';
|
|
7
|
-
export * from './fromString';
|
|
8
|
-
export * from './isEmptyObject';
|
|
9
|
-
export * from './isFunction';
|
|
10
|
-
export * from './isiOS';
|
|
11
|
-
export * from './isMacOS';
|
|
12
|
-
export * from './isNumber';
|
|
13
|
-
export * from './isPlainObject';
|
|
14
|
-
export * from './isRegExp';
|
|
15
|
-
export * from './isString';
|
|
16
|
-
export * from './mergeAttributes';
|
|
17
|
-
export * from './mergeDeep';
|
|
18
|
-
export * from './minMax';
|
|
19
|
-
export * from './objectIncludes';
|
|
20
|
-
export * from './removeDuplicates';
|
|
1
|
+
export * from './callOrReturn.js';
|
|
2
|
+
export * from './createStyleTag.js';
|
|
3
|
+
export * from './deleteProps.js';
|
|
4
|
+
export * from './elementFromString.js';
|
|
5
|
+
export * from './escapeForRegEx.js';
|
|
6
|
+
export * from './findDuplicates.js';
|
|
7
|
+
export * from './fromString.js';
|
|
8
|
+
export * from './isEmptyObject.js';
|
|
9
|
+
export * from './isFunction.js';
|
|
10
|
+
export * from './isiOS.js';
|
|
11
|
+
export * from './isMacOS.js';
|
|
12
|
+
export * from './isNumber.js';
|
|
13
|
+
export * from './isPlainObject.js';
|
|
14
|
+
export * from './isRegExp.js';
|
|
15
|
+
export * from './isString.js';
|
|
16
|
+
export * from './mergeAttributes.js';
|
|
17
|
+
export * from './mergeDeep.js';
|
|
18
|
+
export * from './minMax.js';
|
|
19
|
+
export * from './objectIncludes.js';
|
|
20
|
+
export * from './removeDuplicates.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isAndroid(): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './findListItemPos.js';
|
|
2
|
+
export * from './getNextListDepth.js';
|
|
3
|
+
export * from './handleBackspace.js';
|
|
4
|
+
export * from './handleDelete.js';
|
|
5
|
+
export * from './hasListBefore.js';
|
|
6
|
+
export * from './hasListItemAfter.js';
|
|
7
|
+
export * from './hasListItemBefore.js';
|
|
8
|
+
export * from './listItemHasSubList.js';
|
|
9
|
+
export * from './nextListIsDeeper.js';
|
|
10
|
+
export * from './nextListIsHigher.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/core",
|
|
3
3
|
"description": "headless rich text editor",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.1",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@tiptap/pm": "^2.1.
|
|
35
|
+
"@tiptap/pm": "^2.1.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tiptap/pm": "^2.0.0"
|
package/src/CommandManager.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EditorState, Transaction } from '@tiptap/pm/state'
|
|
2
2
|
|
|
3
|
-
import { Editor } from './Editor'
|
|
4
|
-
import { createChainableState } from './helpers/createChainableState'
|
|
3
|
+
import { Editor } from './Editor.js'
|
|
4
|
+
import { createChainableState } from './helpers/createChainableState.js'
|
|
5
5
|
import {
|
|
6
6
|
AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands,
|
|
7
|
-
} from './types'
|
|
7
|
+
} from './types.js'
|
|
8
8
|
|
|
9
9
|
export class CommandManager {
|
|
10
10
|
editor: Editor
|
|
@@ -120,10 +120,6 @@ export class CommandManager {
|
|
|
120
120
|
const { rawCommands, editor, state } = this
|
|
121
121
|
const { view } = editor
|
|
122
122
|
|
|
123
|
-
if (state.storedMarks) {
|
|
124
|
-
tr.setStoredMarks(state.storedMarks)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
123
|
const props: CommandProps = {
|
|
128
124
|
tr,
|
|
129
125
|
editor,
|
|
@@ -133,7 +129,7 @@ export class CommandManager {
|
|
|
133
129
|
transaction: tr,
|
|
134
130
|
}),
|
|
135
131
|
dispatch: shouldDispatch ? () => undefined : undefined,
|
|
136
|
-
chain: () => this.createChain(tr),
|
|
132
|
+
chain: () => this.createChain(tr, shouldDispatch),
|
|
137
133
|
can: () => this.createCan(tr),
|
|
138
134
|
get commands() {
|
|
139
135
|
return Object.fromEntries(
|
package/src/Editor.ts
CHANGED
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
} from '@tiptap/pm/state'
|
|
5
5
|
import { EditorView } from '@tiptap/pm/view'
|
|
6
6
|
|
|
7
|
-
import { CommandManager } from './CommandManager'
|
|
8
|
-
import { EventEmitter } from './EventEmitter'
|
|
9
|
-
import { ExtensionManager } from './ExtensionManager'
|
|
10
|
-
import * as extensions from './extensions'
|
|
11
|
-
import { createDocument } from './helpers/createDocument'
|
|
12
|
-
import { getAttributes } from './helpers/getAttributes'
|
|
13
|
-
import { getHTMLFromFragment } from './helpers/getHTMLFromFragment'
|
|
14
|
-
import { getText } from './helpers/getText'
|
|
15
|
-
import { getTextSerializersFromSchema } from './helpers/getTextSerializersFromSchema'
|
|
16
|
-
import { isActive } from './helpers/isActive'
|
|
17
|
-
import { isNodeEmpty } from './helpers/isNodeEmpty'
|
|
18
|
-
import { resolveFocusPosition } from './helpers/resolveFocusPosition'
|
|
19
|
-
import { style } from './style'
|
|
7
|
+
import { CommandManager } from './CommandManager.js'
|
|
8
|
+
import { EventEmitter } from './EventEmitter.js'
|
|
9
|
+
import { ExtensionManager } from './ExtensionManager.js'
|
|
10
|
+
import * as extensions from './extensions/index.js'
|
|
11
|
+
import { createDocument } from './helpers/createDocument.js'
|
|
12
|
+
import { getAttributes } from './helpers/getAttributes.js'
|
|
13
|
+
import { getHTMLFromFragment } from './helpers/getHTMLFromFragment.js'
|
|
14
|
+
import { getText } from './helpers/getText.js'
|
|
15
|
+
import { getTextSerializersFromSchema } from './helpers/getTextSerializersFromSchema.js'
|
|
16
|
+
import { isActive } from './helpers/isActive.js'
|
|
17
|
+
import { isNodeEmpty } from './helpers/isNodeEmpty.js'
|
|
18
|
+
import { resolveFocusPosition } from './helpers/resolveFocusPosition.js'
|
|
19
|
+
import { style } from './style.js'
|
|
20
20
|
import {
|
|
21
21
|
CanCommands,
|
|
22
22
|
ChainedCommands,
|
|
@@ -25,9 +25,9 @@ import {
|
|
|
25
25
|
JSONContent,
|
|
26
26
|
SingleCommands,
|
|
27
27
|
TextSerializer,
|
|
28
|
-
} from './types'
|
|
29
|
-
import { createStyleTag } from './utilities/createStyleTag'
|
|
30
|
-
import { isFunction } from './utilities/isFunction'
|
|
28
|
+
} from './types.js'
|
|
29
|
+
import { createStyleTag } from './utilities/createStyleTag.js'
|
|
30
|
+
import { isFunction } from './utilities/isFunction.js'
|
|
31
31
|
|
|
32
32
|
export { extensions }
|
|
33
33
|
|
package/src/Extension.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Plugin, Transaction } from '@tiptap/pm/state'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { InputRule } from './InputRule'
|
|
7
|
-
import { Mark } from './Mark'
|
|
8
|
-
import { Node } from './Node'
|
|
9
|
-
import { PasteRule } from './PasteRule'
|
|
3
|
+
import { Editor } from './Editor.js'
|
|
4
|
+
import { getExtensionField } from './helpers/getExtensionField.js'
|
|
5
|
+
import { ExtensionConfig } from './index.js'
|
|
6
|
+
import { InputRule } from './InputRule.js'
|
|
7
|
+
import { Mark } from './Mark.js'
|
|
8
|
+
import { Node } from './Node.js'
|
|
9
|
+
import { PasteRule } from './PasteRule.js'
|
|
10
10
|
import {
|
|
11
11
|
AnyConfig,
|
|
12
12
|
Extensions,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
KeyboardShortcutCommand,
|
|
15
15
|
ParentConfig,
|
|
16
16
|
RawCommands,
|
|
17
|
-
} from './types'
|
|
18
|
-
import { callOrReturn } from './utilities/callOrReturn'
|
|
19
|
-
import { mergeDeep } from './utilities/mergeDeep'
|
|
17
|
+
} from './types.js'
|
|
18
|
+
import { callOrReturn } from './utilities/callOrReturn.js'
|
|
19
|
+
import { mergeDeep } from './utilities/mergeDeep.js'
|
|
20
20
|
|
|
21
21
|
declare module '@tiptap/core' {
|
|
22
22
|
interface ExtensionConfig<Options = any, Storage = any> {
|
package/src/ExtensionManager.ts
CHANGED
|
@@ -3,21 +3,21 @@ import { Node as ProsemirrorNode, Schema } from '@tiptap/pm/model'
|
|
|
3
3
|
import { Plugin } from '@tiptap/pm/state'
|
|
4
4
|
import { Decoration, EditorView } from '@tiptap/pm/view'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { inputRulesPlugin } from './InputRule'
|
|
17
|
-
import { pasteRulesPlugin } from './PasteRule'
|
|
18
|
-
import { AnyConfig, Extensions, RawCommands } from './types'
|
|
19
|
-
import { callOrReturn } from './utilities/callOrReturn'
|
|
20
|
-
import { findDuplicates } from './utilities/findDuplicates'
|
|
6
|
+
import { Editor } from './Editor.js'
|
|
7
|
+
import { getAttributesFromExtensions } from './helpers/getAttributesFromExtensions.js'
|
|
8
|
+
import { getExtensionField } from './helpers/getExtensionField.js'
|
|
9
|
+
import { getNodeType } from './helpers/getNodeType.js'
|
|
10
|
+
import { getRenderedAttributes } from './helpers/getRenderedAttributes.js'
|
|
11
|
+
import { getSchemaByResolvedExtensions } from './helpers/getSchemaByResolvedExtensions.js'
|
|
12
|
+
import { getSchemaTypeByName } from './helpers/getSchemaTypeByName.js'
|
|
13
|
+
import { isExtensionRulesEnabled } from './helpers/isExtensionRulesEnabled.js'
|
|
14
|
+
import { splitExtensions } from './helpers/splitExtensions.js'
|
|
15
|
+
import { Mark, NodeConfig } from './index.js'
|
|
16
|
+
import { inputRulesPlugin } from './InputRule.js'
|
|
17
|
+
import { pasteRulesPlugin } from './PasteRule.js'
|
|
18
|
+
import { AnyConfig, Extensions, RawCommands } from './types.js'
|
|
19
|
+
import { callOrReturn } from './utilities/callOrReturn.js'
|
|
20
|
+
import { findDuplicates } from './utilities/findDuplicates.js'
|
|
21
21
|
|
|
22
22
|
export class ExtensionManager {
|
|
23
23
|
editor: Editor
|
package/src/InputRule.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { EditorState, Plugin, TextSelection } from '@tiptap/pm/state'
|
|
2
2
|
|
|
3
|
-
import { CommandManager } from './CommandManager'
|
|
4
|
-
import { Editor } from './Editor'
|
|
5
|
-
import { createChainableState } from './helpers/createChainableState'
|
|
6
|
-
import { getTextContentFromNodes } from './helpers/getTextContentFromNodes'
|
|
3
|
+
import { CommandManager } from './CommandManager.js'
|
|
4
|
+
import { Editor } from './Editor.js'
|
|
5
|
+
import { createChainableState } from './helpers/createChainableState.js'
|
|
6
|
+
import { getTextContentFromNodes } from './helpers/getTextContentFromNodes.js'
|
|
7
7
|
import {
|
|
8
8
|
CanCommands,
|
|
9
9
|
ChainedCommands,
|
|
10
10
|
ExtendedRegExpMatchArray,
|
|
11
11
|
Range,
|
|
12
12
|
SingleCommands,
|
|
13
|
-
} from './types'
|
|
14
|
-
import { isRegExp } from './utilities/isRegExp'
|
|
13
|
+
} from './types.js'
|
|
14
|
+
import { isRegExp } from './utilities/isRegExp.js'
|
|
15
15
|
|
|
16
16
|
export type InputRuleMatch = {
|
|
17
17
|
index: number
|
package/src/Mark.ts
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from '@tiptap/pm/model'
|
|
4
4
|
import { Plugin, Transaction } from '@tiptap/pm/state'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { InputRule } from './InputRule'
|
|
10
|
-
import { Node } from './Node'
|
|
11
|
-
import { PasteRule } from './PasteRule'
|
|
6
|
+
import { Editor } from './Editor.js'
|
|
7
|
+
import { getExtensionField } from './helpers/getExtensionField.js'
|
|
8
|
+
import { MarkConfig } from './index.js'
|
|
9
|
+
import { InputRule } from './InputRule.js'
|
|
10
|
+
import { Node } from './Node.js'
|
|
11
|
+
import { PasteRule } from './PasteRule.js'
|
|
12
12
|
import {
|
|
13
13
|
AnyConfig,
|
|
14
14
|
Attributes,
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
KeyboardShortcutCommand,
|
|
18
18
|
ParentConfig,
|
|
19
19
|
RawCommands,
|
|
20
|
-
} from './types'
|
|
21
|
-
import { callOrReturn } from './utilities/callOrReturn'
|
|
22
|
-
import { mergeDeep } from './utilities/mergeDeep'
|
|
20
|
+
} from './types.js'
|
|
21
|
+
import { callOrReturn } from './utilities/callOrReturn.js'
|
|
22
|
+
import { mergeDeep } from './utilities/mergeDeep.js'
|
|
23
23
|
|
|
24
24
|
declare module '@tiptap/core' {
|
|
25
25
|
export interface MarkConfig<Options = any, Storage = any> {
|
package/src/Node.ts
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from '@tiptap/pm/model'
|
|
4
4
|
import { Plugin, Transaction } from '@tiptap/pm/state'
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { InputRule } from './InputRule'
|
|
10
|
-
import { PasteRule } from './PasteRule'
|
|
6
|
+
import { Editor } from './Editor.js'
|
|
7
|
+
import { getExtensionField } from './helpers/getExtensionField.js'
|
|
8
|
+
import { NodeConfig } from './index.js'
|
|
9
|
+
import { InputRule } from './InputRule.js'
|
|
10
|
+
import { PasteRule } from './PasteRule.js'
|
|
11
11
|
import {
|
|
12
12
|
AnyConfig,
|
|
13
13
|
Attributes,
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
NodeViewRenderer,
|
|
18
18
|
ParentConfig,
|
|
19
19
|
RawCommands,
|
|
20
|
-
} from './types'
|
|
21
|
-
import { callOrReturn } from './utilities/callOrReturn'
|
|
22
|
-
import { mergeDeep } from './utilities/mergeDeep'
|
|
20
|
+
} from './types.js'
|
|
21
|
+
import { callOrReturn } from './utilities/callOrReturn.js'
|
|
22
|
+
import { mergeDeep } from './utilities/mergeDeep.js'
|
|
23
23
|
|
|
24
24
|
declare module '@tiptap/core' {
|
|
25
25
|
interface NodeConfig<Options = any, Storage = any> {
|
package/src/NodeView.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
|
2
2
|
import { NodeSelection } from '@tiptap/pm/state'
|
|
3
3
|
import { NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'
|
|
4
4
|
|
|
5
|
-
import { Editor as CoreEditor } from './Editor'
|
|
6
|
-
import { Node } from './Node'
|
|
7
|
-
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types'
|
|
8
|
-
import {
|
|
5
|
+
import { Editor as CoreEditor } from './Editor.js'
|
|
6
|
+
import { Node } from './Node.js'
|
|
7
|
+
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js'
|
|
8
|
+
import { isAndroid } from './utilities/isAndroid.js'
|
|
9
|
+
import { isiOS } from './utilities/isiOS.js'
|
|
9
10
|
|
|
10
11
|
export class NodeView<
|
|
11
12
|
Component,
|
|
@@ -212,14 +213,15 @@ export class NodeView<
|
|
|
212
213
|
return false
|
|
213
214
|
}
|
|
214
215
|
|
|
215
|
-
// try to prevent a bug on iOS that will break node views on enter
|
|
216
|
+
// try to prevent a bug on iOS and Android that will break node views on enter
|
|
216
217
|
// this is because ProseMirror can’t preventDispatch on enter
|
|
217
218
|
// this will lead to a re-render of the node view on enter
|
|
218
219
|
// see: https://github.com/ueberdosis/tiptap/issues/1214
|
|
220
|
+
// see: https://github.com/ueberdosis/tiptap/issues/2534
|
|
219
221
|
if (
|
|
220
222
|
this.dom.contains(mutation.target)
|
|
221
223
|
&& mutation.type === 'childList'
|
|
222
|
-
&& isiOS()
|
|
224
|
+
&& (isiOS() || isAndroid())
|
|
223
225
|
&& this.editor.isFocused
|
|
224
226
|
) {
|
|
225
227
|
const changedNodes = [
|
package/src/PasteRule.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { EditorState, Plugin } from '@tiptap/pm/state'
|
|
2
2
|
|
|
3
|
-
import { CommandManager } from './CommandManager'
|
|
4
|
-
import { Editor } from './Editor'
|
|
5
|
-
import { createChainableState } from './helpers/createChainableState'
|
|
3
|
+
import { CommandManager } from './CommandManager.js'
|
|
4
|
+
import { Editor } from './Editor.js'
|
|
5
|
+
import { createChainableState } from './helpers/createChainableState.js'
|
|
6
6
|
import {
|
|
7
7
|
CanCommands,
|
|
8
8
|
ChainedCommands,
|
|
9
9
|
ExtendedRegExpMatchArray,
|
|
10
10
|
Range,
|
|
11
11
|
SingleCommands,
|
|
12
|
-
} from './types'
|
|
13
|
-
import { isNumber } from './utilities/isNumber'
|
|
14
|
-
import { isRegExp } from './utilities/isRegExp'
|
|
12
|
+
} from './types.js'
|
|
13
|
+
import { isNumber } from './utilities/isNumber.js'
|
|
14
|
+
import { isRegExp } from './utilities/isRegExp.js'
|
|
15
15
|
|
|
16
16
|
export type PasteRuleMatch = {
|
|
17
17
|
index: number
|
package/src/commands/blur.ts
CHANGED
package/src/commands/command.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TextSelection } from '@tiptap/pm/state'
|
|
2
|
+
|
|
3
|
+
import { RawCommands } from '../types.js'
|
|
4
|
+
|
|
5
|
+
declare module '@tiptap/core' {
|
|
6
|
+
interface Commands<ReturnType> {
|
|
7
|
+
cut: {
|
|
8
|
+
/**
|
|
9
|
+
* Cuts content from a range and inserts it at a given position.
|
|
10
|
+
*/
|
|
11
|
+
cut: ({ from, to }: { from: number, to: number }, targetPos: number) => ReturnType,
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const cut: RawCommands['cut'] = (originRange, targetPos) => ({ editor, tr }) => {
|
|
17
|
+
const { state } = editor
|
|
18
|
+
|
|
19
|
+
const contentSlice = state.doc.slice(originRange.from, originRange.to)
|
|
20
|
+
|
|
21
|
+
tr.deleteRange(originRange.from, originRange.to)
|
|
22
|
+
const newPos = tr.mapping.map(targetPos)
|
|
23
|
+
|
|
24
|
+
tr.insert(newPos, contentSlice.content)
|
|
25
|
+
|
|
26
|
+
tr.setSelection(new TextSelection(tr.doc.resolve(newPos - 1)))
|
|
27
|
+
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NodeType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import { getNodeType } from '../helpers/getNodeType'
|
|
4
|
-
import { RawCommands } from '../types'
|
|
3
|
+
import { getNodeType } from '../helpers/getNodeType.js'
|
|
4
|
+
import { RawCommands } from '../types.js'
|
|
5
5
|
|
|
6
6
|
declare module '@tiptap/core' {
|
|
7
7
|
interface Commands<ReturnType> {
|
package/src/commands/enter.ts
CHANGED
package/src/commands/exitCode.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MarkType } from '@tiptap/pm/model'
|
|
2
2
|
import { TextSelection } from '@tiptap/pm/state'
|
|
3
3
|
|
|
4
|
-
import { getMarkRange } from '../helpers/getMarkRange'
|
|
5
|
-
import { getMarkType } from '../helpers/getMarkType'
|
|
6
|
-
import { RawCommands } from '../types'
|
|
4
|
+
import { getMarkRange } from '../helpers/getMarkRange.js'
|
|
5
|
+
import { getMarkType } from '../helpers/getMarkType.js'
|
|
6
|
+
import { RawCommands } from '../types.js'
|
|
7
7
|
|
|
8
8
|
declare module '@tiptap/core' {
|
|
9
9
|
interface Commands<ReturnType> {
|
package/src/commands/first.ts
CHANGED
package/src/commands/focus.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isTextSelection } from '../helpers/isTextSelection'
|
|
2
|
-
import { resolveFocusPosition } from '../helpers/resolveFocusPosition'
|
|
3
|
-
import { FocusPosition, RawCommands } from '../types'
|
|
4
|
-
import { isiOS } from '../utilities/isiOS'
|
|
1
|
+
import { isTextSelection } from '../helpers/isTextSelection.js'
|
|
2
|
+
import { resolveFocusPosition } from '../helpers/resolveFocusPosition.js'
|
|
3
|
+
import { FocusPosition, RawCommands } from '../types.js'
|
|
4
|
+
import { isiOS } from '../utilities/isiOS.js'
|
|
5
5
|
|
|
6
6
|
declare module '@tiptap/core' {
|
|
7
7
|
interface Commands<ReturnType> {
|
package/src/commands/forEach.ts
CHANGED