Skip to content

Commit 5550ad4

Browse files
committed
replace prosemirror packages with @tiptap/pm
1 parent d7114ac commit 5550ad4

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

lib/block-editor/extensions/Dropcursor/pmDropcursorReplacement.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// adapted from prosemirror-dropcursor
22
// https://github.com/ProseMirror/prosemirror-dropcursor
33

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';
77
import { isValidDropPosition } from '~/lib/block-editor/utils';
88

99
type DropCursorOptions = {

lib/block-editor/extensions/Group/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { Editor, Node } from '@tiptap/react';
1+
import { type Node } from '@tiptap/pm/model';
2+
import type { Editor } from '@tiptap/react';
23

34
export function toggleGroupRequired(editor: Editor) {
45
if (!editor) return;

lib/block-editor/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { type EditorView } from '@tiptap/pm/view';
12
import { type Editor } from '@tiptap/react';
2-
import { type EditorView } from 'prosemirror-view';
33
import type { TVariableDefinition } from '~/schemas/protocol/variables';
44
import { contentMap, type TiptapContent } from './contentTypes';
55
import { handleVariableDrop } from './extensions/Variable/utils';
@@ -63,10 +63,10 @@ export const handleDrag = (
6363

6464
export const handleDrop = (
6565
view: EditorView,
66-
event: React.DragEvent,
66+
event: DragEvent,
6767
editor: Editor,
6868
) => {
69-
const type = event.dataTransfer.getData('application/x-content-type');
69+
const type = event?.dataTransfer?.getData('application/x-content-type');
7070
const pos = view.posAtCoords({
7171
left: event.clientX,
7272
top: event.clientY,
@@ -75,6 +75,7 @@ export const handleDrop = (
7575
if (!isValidDropPosition(view, event)) return false;
7676

7777
if (pos && editor) {
78+
if (!type || !contentMap[type]) return;
7879
if (type === 'variable') {
7980
handleVariableDrop(view, event);
8081
} else

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@
7777
"ohash": "^1.1.4",
7878
"prettier": "^3.3.3",
7979
"prettier-plugin-tailwindcss": "^0.6.6",
80-
"prosemirror-state": "^1.4.3",
81-
"prosemirror-transform": "^1.10.2",
82-
"prosemirror-view": "^1.36.0",
8380
"react": "19.0.0-rc-e740d4b1-20240919",
8481
"react-dom": "19.0.0-rc-e740d4b1-20240919",
8582
"rtl-detect": "^1.1.2",

pnpm-lock.yaml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)