From c48da2afea60b4d80335a806295ea946e3c41391 Mon Sep 17 00:00:00 2001 From: Dmitry Minkovsky Date: Sun, 30 Aug 2020 11:58:48 -0400 Subject: [PATCH] Improved prop types --- package.json | 2 +- src/ProseMirror.tsx | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0134bf8..ecca1ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "use-prosemirror", - "version": "1.1.4", + "version": "1.1.5", "description": "ProseMirror for React", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/ProseMirror.tsx b/src/ProseMirror.tsx index c6c68d2..c84b5f1 100644 --- a/src/ProseMirror.tsx +++ b/src/ProseMirror.tsx @@ -5,7 +5,11 @@ import React, { forwardRef, CSSProperties, } from 'react'; -import {EditorView, DirectEditorProps} from 'prosemirror-view'; +import { + EditorView, + EditorProps, + DirectEditorProps, +} from 'prosemirror-view'; import {EditorState} from 'prosemirror-state'; import {Schema} from 'prosemirror-model'; @@ -13,8 +17,7 @@ export interface Handle { view: EditorView; } -interface Props - extends Partial> { +interface Props extends EditorProps { state: EditorState; onChange: (state: EditorState) => void; style?: CSSProperties; @@ -22,8 +25,7 @@ interface Props } export default forwardRef(function ProseMirror( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - {dispatchTransaction, onChange, style, className, ...props}, + {onChange, style, className, ...props}, ref, ): JSX.Element { const root = useRef(null!); @@ -48,7 +50,10 @@ export default forwardRef(function ProseMirror( }, })); return
; - function buildProps(props: DirectEditorProps): DirectEditorProps { + + function buildProps( + props: Omit, + ): DirectEditorProps { return { ...props, dispatchTransaction: transaction => {