Feature Request: Allow react props to be passed to inner div of EditorContent #5586
pownkel
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
EditorContent is rendered as two nested divs, with the internal one having the
contenteditable
attribute and any other attributes that were specified on theEditor
instance, and the outer one receiving whatever additional props were passed toEditorContent
. For example, the element created by this function:renders as:
We can pass React props to the external div through
EditorContent
, buteditorProps
only allows us to add dom attributes to the internal div. We can add event listeners withhandleDomEvents
, but again, these are DOM event handlers that accept DOM events, not React event handlers. Also, while theinnerRef
prop allows us to pass a ref to the external div, there is no convenient way to get a ref to the internal div.It would be useful if there was a way to pass React props and event listeners to the internal div. Is this something that it would be feasible to add?
Use Case
I'm trying to use
EditorContent
with a third-party combobox from ariakit following this example, usingEditorContent
instead of atextarea
as the custom render component. Ariakit requires custom components to be open to extension so that we can pass through additional props, event listeners, and refs from ariakit.Right now, we can pass these props to
EditorContent
, which passes them to the outer div, but ariakit expects the value of the ref and the target of the events to be thecontenteditable
element (the inner div), so the combobox doesn't work as expected. We can't pass these event listeners to the inner div witheditorProps
because they expect React events, and break when they receive DOM events instead. The ability to pass react props to the inner div would allow us to use the combobox with the rich text editor, and other components that have similar requirements.Type
New feature
Beta Was this translation helpful? Give feedback.
All reactions