@tiptap/core 2.0.0-beta.216 → 2.0.0-beta.218
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 +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +5 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +2 -2
- package/package.json +2 -2
- package/src/NodeView.ts +10 -2
- package/src/pasteRules/nodePasteRule.ts +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
-
import { PasteRule } from '../PasteRule';
|
|
2
|
+
import { PasteRule, PasteRuleFinder } from '../PasteRule';
|
|
3
3
|
import { ExtendedRegExpMatchArray } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Build an paste rule that adds a node when the
|
|
6
6
|
* matched text is pasted into it.
|
|
7
7
|
*/
|
|
8
8
|
export declare function nodePasteRule(config: {
|
|
9
|
-
find:
|
|
9
|
+
find: PasteRuleFinder;
|
|
10
10
|
type: NodeType;
|
|
11
11
|
getAttributes?: Record<string, any> | ((match: ExtendedRegExpMatchArray) => Record<string, any>) | false | null;
|
|
12
12
|
}): PasteRule;
|
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.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.218",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@tiptap/pm": "^2.0.0-beta.209"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@tiptap/pm": "^2.0.0-beta.
|
|
38
|
+
"@tiptap/pm": "^2.0.0-beta.218"
|
|
39
39
|
},
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
package/src/NodeView.ts
CHANGED
|
@@ -113,11 +113,12 @@ export class NodeView<
|
|
|
113
113
|
return false
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
const isDragEvent = event.type.startsWith('drag')
|
|
116
117
|
const isDropEvent = event.type === 'drop'
|
|
117
118
|
const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName) || target.isContentEditable
|
|
118
119
|
|
|
119
120
|
// any input event within node views should be ignored by ProseMirror
|
|
120
|
-
if (isInput && !isDropEvent) {
|
|
121
|
+
if (isInput && !isDropEvent && !isDragEvent) {
|
|
121
122
|
return true
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -129,7 +130,6 @@ export class NodeView<
|
|
|
129
130
|
const isPasteEvent = event.type === 'paste'
|
|
130
131
|
const isCutEvent = event.type === 'cut'
|
|
131
132
|
const isClickEvent = event.type === 'mousedown'
|
|
132
|
-
const isDragEvent = event.type.startsWith('drag')
|
|
133
133
|
|
|
134
134
|
// ProseMirror tries to drag selectable nodes
|
|
135
135
|
// even if `draggable` is set to `false`
|
|
@@ -159,6 +159,14 @@ export class NodeView<
|
|
|
159
159
|
{ once: true },
|
|
160
160
|
)
|
|
161
161
|
|
|
162
|
+
document.addEventListener(
|
|
163
|
+
'drop',
|
|
164
|
+
() => {
|
|
165
|
+
this.isDragging = false
|
|
166
|
+
},
|
|
167
|
+
{ once: true },
|
|
168
|
+
)
|
|
169
|
+
|
|
162
170
|
document.addEventListener(
|
|
163
171
|
'mouseup',
|
|
164
172
|
() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeType } from '@tiptap/pm/model'
|
|
2
2
|
|
|
3
|
-
import { PasteRule } from '../PasteRule'
|
|
3
|
+
import { PasteRule, PasteRuleFinder } from '../PasteRule'
|
|
4
4
|
import { ExtendedRegExpMatchArray } from '../types'
|
|
5
5
|
import { callOrReturn } from '../utilities'
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ import { callOrReturn } from '../utilities'
|
|
|
9
9
|
* matched text is pasted into it.
|
|
10
10
|
*/
|
|
11
11
|
export function nodePasteRule(config: {
|
|
12
|
-
find:
|
|
12
|
+
find: PasteRuleFinder
|
|
13
13
|
type: NodeType
|
|
14
14
|
getAttributes?:
|
|
15
15
|
| Record<string, any>
|