File tree Expand file tree Collapse file tree 5 files changed +9
-19
lines changed Expand file tree Collapse file tree 5 files changed +9
-19
lines changed Original file line number Diff line number Diff line change 1
1
// adapted from prosemirror-dropcursor
2
2
// https://github.com/ProseMirror/prosemirror-dropcursor
3
3
4
- import { Plugin , type EditorState } from 'prosemirror- state' ;
5
- import { dropPoint } from 'prosemirror- transform' ;
6
- import { type EditorView } from 'prosemirror- view' ;
4
+ import { Plugin , type EditorState } from '@tiptap/pm/ state' ;
5
+ import { dropPoint } from '@tiptap/pm/ transform' ;
6
+ import { type EditorView } from '@tiptap/pm/ view' ;
7
7
import { isValidDropPosition } from '~/lib/block-editor/utils' ;
8
8
9
9
type DropCursorOptions = {
Original file line number Diff line number Diff line change 1
- import type { Editor , Node } from '@tiptap/react' ;
1
+ import { type Node } from '@tiptap/pm/model' ;
2
+ import type { Editor } from '@tiptap/react' ;
2
3
3
4
export function toggleGroupRequired ( editor : Editor ) {
4
5
if ( ! editor ) return ;
Original file line number Diff line number Diff line change
1
+ import { type EditorView } from '@tiptap/pm/view' ;
1
2
import { type Editor } from '@tiptap/react' ;
2
- import { type EditorView } from 'prosemirror-view' ;
3
3
import type { TVariableDefinition } from '~/schemas/protocol/variables' ;
4
4
import { contentMap , type TiptapContent } from './contentTypes' ;
5
5
import { handleVariableDrop } from './extensions/Variable/utils' ;
@@ -63,10 +63,10 @@ export const handleDrag = (
63
63
64
64
export const handleDrop = (
65
65
view : EditorView ,
66
- event : React . DragEvent ,
66
+ event : DragEvent ,
67
67
editor : Editor ,
68
68
) => {
69
- const type = event . dataTransfer . getData ( 'application/x-content-type' ) ;
69
+ const type = event ? .dataTransfer ? .getData ( 'application/x-content-type' ) ;
70
70
const pos = view . posAtCoords ( {
71
71
left : event . clientX ,
72
72
top : event . clientY ,
@@ -75,6 +75,7 @@ export const handleDrop = (
75
75
if ( ! isValidDropPosition ( view , event ) ) return false ;
76
76
77
77
if ( pos && editor ) {
78
+ if ( ! type || ! contentMap [ type ] ) return ;
78
79
if ( type === 'variable' ) {
79
80
handleVariableDrop ( view , event ) ;
80
81
} else
Original file line number Diff line number Diff line change 77
77
"ohash" : " ^1.1.4" ,
78
78
"prettier" : " ^3.3.3" ,
79
79
"prettier-plugin-tailwindcss" : " ^0.6.6" ,
80
- "prosemirror-state" : " ^1.4.3" ,
81
- "prosemirror-transform" : " ^1.10.2" ,
82
- "prosemirror-view" : " ^1.36.0" ,
83
80
"react" : " 19.0.0-rc-e740d4b1-20240919" ,
84
81
"react-dom" : " 19.0.0-rc-e740d4b1-20240919" ,
85
82
"rtl-detect" : " ^1.1.2" ,
You can’t perform that action at this time.
0 commit comments