Skip to content

Commit c48da2a

Browse files
committed
Improved prop types
1 parent 76877f8 commit c48da2a

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-prosemirror",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "ProseMirror for React",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/ProseMirror.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@ import React, {
55
forwardRef,
66
CSSProperties,
77
} from 'react';
8-
import {EditorView, DirectEditorProps} from 'prosemirror-view';
8+
import {
9+
EditorView,
10+
EditorProps,
11+
DirectEditorProps,
12+
} from 'prosemirror-view';
913
import {EditorState} from 'prosemirror-state';
1014
import {Schema} from 'prosemirror-model';
1115

1216
export interface Handle {
1317
view: EditorView;
1418
}
1519

16-
interface Props<S extends Schema = any>
17-
extends Partial<DirectEditorProps<S>> {
20+
interface Props<S extends Schema = any> extends EditorProps<S> {
1821
state: EditorState<S>;
1922
onChange: (state: EditorState) => void;
2023
style?: CSSProperties;
2124
className?: string;
2225
}
2326

2427
export default forwardRef<Handle, Props>(function ProseMirror(
25-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
26-
{dispatchTransaction, onChange, style, className, ...props},
28+
{onChange, style, className, ...props},
2729
ref,
2830
): JSX.Element {
2931
const root = useRef<HTMLDivElement>(null!);
@@ -48,7 +50,10 @@ export default forwardRef<Handle, Props>(function ProseMirror(
4850
},
4951
}));
5052
return <div ref={root} style={style} className={className} />;
51-
function buildProps(props: DirectEditorProps): DirectEditorProps {
53+
54+
function buildProps(
55+
props: Omit<DirectEditorProps, 'dispatchTransaction'>,
56+
): DirectEditorProps {
5257
return {
5358
...props,
5459
dispatchTransaction: transaction => {

0 commit comments

Comments
 (0)