From 01ee5475c27786c41845176a79c7cfb39f93a787 Mon Sep 17 00:00:00 2001 From: Nick the Sick Date: Tue, 26 Nov 2024 10:51:04 +0100 Subject: [PATCH] fix(core): update types to match prosemirror-view #5867 --- package-lock.json | 13 ++++++++++++- packages/core/src/NodeView.ts | 4 ++-- packages/core/src/types.ts | 3 ++- packages/pm/package.json | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 869d5bd3ce..109967de76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20500,7 +20500,7 @@ "prosemirror-tables": "^1.6.1", "prosemirror-trailing-node": "^3.0.0", "prosemirror-transform": "^1.10.2", - "prosemirror-view": "^1.36.0" + "prosemirror-view": "^1.37.0" }, "funding": { "type": "github", @@ -20531,6 +20531,17 @@ "prosemirror-view": "^1.13.3" } }, + "packages/pm/node_modules/prosemirror-view": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.37.0.tgz", + "integrity": "sha512-z2nkKI1sJzyi7T47Ji/ewBPuIma1RNvQCCYVdV+MqWBV7o4Sa1n94UJCJJ1aQRF/xRkFfyqLGlGFWitIcCOtbg==", + "license": "MIT", + "dependencies": { + "prosemirror-model": "^1.20.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0" + } + }, "packages/react": { "name": "@tiptap/react", "version": "2.10.2", diff --git a/packages/core/src/NodeView.ts b/packages/core/src/NodeView.ts index 9631b5f598..857d25ccc6 100644 --- a/packages/core/src/NodeView.ts +++ b/packages/core/src/NodeView.ts @@ -1,5 +1,5 @@ import { NodeSelection } from '@tiptap/pm/state' -import { NodeView as ProseMirrorNodeView } from '@tiptap/pm/view' +import { NodeView as ProseMirrorNodeView, ViewMutationRecord } from '@tiptap/pm/view' import { Editor as CoreEditor } from './Editor.js' import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.js' @@ -214,7 +214,7 @@ export class NodeView< * @return `false` if the editor should re-read the selection or re-parse the range around the mutation * @return `true` if it can safely be ignored. */ - ignoreMutation(mutation: MutationRecord | { type: 'selection'; target: Element }) { + ignoreMutation(mutation: ViewMutationRecord) { if (!this.dom || !this.contentDOM) { return true } diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 3077058d72..4a14a3b083 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -13,6 +13,7 @@ import { EditorView, NodeView, NodeViewConstructor, + ViewMutationRecord, } from '@tiptap/pm/view' import { Editor } from './Editor.js' @@ -259,7 +260,7 @@ export interface NodeViewProps extends NodeViewRendererProps { export interface NodeViewRendererOptions { stopEvent: ((props: { event: Event }) => boolean) | null; ignoreMutation: - | ((props: { mutation: MutationRecord | { type: 'selection'; target: Element } }) => boolean) + | ((props: { mutation: ViewMutationRecord }) => boolean) | null; contentDOMElementTag: string; } diff --git a/packages/pm/package.json b/packages/pm/package.json index 0bddb9ce8a..b91570c691 100644 --- a/packages/pm/package.json +++ b/packages/pm/package.json @@ -143,7 +143,7 @@ "prosemirror-tables": "^1.6.1", "prosemirror-trailing-node": "^3.0.0", "prosemirror-transform": "^1.10.2", - "prosemirror-view": "^1.36.0" + "prosemirror-view": "^1.37.0" }, "repository": { "type": "git",