fix(core): update types to match prosemirror-view #5867

This commit is contained in:
Nick the Sick 2024-11-26 10:51:04 +01:00
parent ea2fa82c4f
commit d464dca5d4
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
4 changed files with 17 additions and 5 deletions

13
package-lock.json generated
View File

@ -20500,7 +20500,7 @@
"prosemirror-tables": "^1.6.1", "prosemirror-tables": "^1.6.1",
"prosemirror-trailing-node": "^3.0.0", "prosemirror-trailing-node": "^3.0.0",
"prosemirror-transform": "^1.10.2", "prosemirror-transform": "^1.10.2",
"prosemirror-view": "^1.36.0" "prosemirror-view": "^1.37.0"
}, },
"funding": { "funding": {
"type": "github", "type": "github",
@ -20531,6 +20531,17 @@
"prosemirror-view": "^1.13.3" "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": { "packages/react": {
"name": "@tiptap/react", "name": "@tiptap/react",
"version": "2.10.0", "version": "2.10.0",

View File

@ -1,5 +1,5 @@
import { NodeSelection } from '@tiptap/pm/state' 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 { Editor as CoreEditor } from './Editor.js'
import { DecorationWithType, NodeViewRendererOptions, NodeViewRendererProps } from './types.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 `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. * @return `true` if it can safely be ignored.
*/ */
ignoreMutation(mutation: MutationRecord | { type: 'selection'; target: Element }) { ignoreMutation(mutation: ViewMutationRecord) {
if (!this.dom || !this.contentDOM) { if (!this.dom || !this.contentDOM) {
return true return true
} }

View File

@ -13,6 +13,7 @@ import {
EditorView, EditorView,
NodeView, NodeView,
NodeViewConstructor, NodeViewConstructor,
ViewMutationRecord,
} from '@tiptap/pm/view' } from '@tiptap/pm/view'
import { Editor } from './Editor.js' import { Editor } from './Editor.js'
@ -259,7 +260,7 @@ export interface NodeViewProps extends NodeViewRendererProps {
export interface NodeViewRendererOptions { export interface NodeViewRendererOptions {
stopEvent: ((props: { event: Event }) => boolean) | null; stopEvent: ((props: { event: Event }) => boolean) | null;
ignoreMutation: ignoreMutation:
| ((props: { mutation: MutationRecord | { type: 'selection'; target: Element } }) => boolean) | ((props: { mutation: ViewMutationRecord }) => boolean)
| null; | null;
contentDOMElementTag: string; contentDOMElementTag: string;
} }

View File

@ -143,7 +143,7 @@
"prosemirror-tables": "^1.6.1", "prosemirror-tables": "^1.6.1",
"prosemirror-trailing-node": "^3.0.0", "prosemirror-trailing-node": "^3.0.0",
"prosemirror-transform": "^1.10.2", "prosemirror-transform": "^1.10.2",
"prosemirror-view": "^1.36.0" "prosemirror-view": "^1.37.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",