tinymce / tinymce-react

Offical TinyMCE React component
MIT License
937 stars 152 forks source link

Selector type doesn't support string in react. #523

Closed SreekuttanPS closed 2 months ago

SreekuttanPS commented 2 months ago

Hi, I have a tinymce editor in my react project (Self hosted - version 6.8.2). So I was looking through the docs and trying out some stuffs and I saw this 'selector' which can be used inside init. But when I try to add it like this :

selector: 'textarea', Then the typescript error shows :

Type 'string' is not assignable to type 'undefined'. So when I checked I found out that the type the gave to the selector is:

selector?: undefined Does anyone know anything about this? Or is there any workaround for this?

TheSpyder commented 2 months ago

I suspect that's because you aren't supposed to use the selector option in our React integration, you use the <Editor> component instead - but I'll transfer this to the react repository so that can be confirmed.

danoaky-tiny commented 2 months ago

Yes, the selector option is purposely overriden by the Editor component. See https://www.tiny.cloud/docs/tinymce/latest/react-ref/#init