@@ -98,7 +98,7 @@ function isReact19Plus(): boolean {
9898 return false
9999}
100100
101- export interface ReactRendererOptions {
101+ export interface ReactRendererOptions < P extends Record < string , any > = object > {
102102 /**
103103 * The editor instance.
104104 * @type {Editor }
@@ -110,7 +110,7 @@ export interface ReactRendererOptions {
110110 * @type {Record<string, any> }
111111 * @default {}
112112 */
113- props ?: Record < string , any >
113+ props ?: P
114114
115115 /**
116116 * The tag name of the element.
@@ -164,12 +164,12 @@ export class ReactRenderer<R = unknown, P extends Record<string, any> = object>
164164 */
165165 constructor (
166166 component : ComponentType < R , P > ,
167- { editor, props = { } , as = 'div' , className = '' } : ReactRendererOptions ,
167+ { editor, props, as = 'div' , className = '' } : ReactRendererOptions < Omit < P , 'ref' > > ,
168168 ) {
169169 this . id = Math . floor ( Math . random ( ) * 0xffffffff ) . toString ( )
170170 this . component = component
171171 this . editor = editor as EditorWithContentComponent
172- this . props = props as P
172+ this . props = ( props ?? { } ) as P
173173 this . element = document . createElement ( as )
174174 this . element . classList . add ( 'react-renderer' )
175175
@@ -226,7 +226,7 @@ export class ReactRenderer<R = unknown, P extends Record<string, any> = object>
226226 /**
227227 * Re-renders the React component with new props.
228228 */
229- updateProps ( props : Record < string , any > = { } ) : void {
229+ updateProps ( props : Partial < Omit < P , 'ref' > > = { } ) : void {
230230 this . props = {
231231 ...this . props ,
232232 ...props ,
0 commit comments