imzbf / md-editor-rt

Markdown editor for react, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
https://imzbf.github.io/md-editor-rt
MIT License
318 stars 44 forks source link

Add `textareaRef` prop to `<MdEditor/>` #166

Closed Ibadichan closed 2 months ago

Ibadichan commented 3 months ago

A great idea

Can you add textareaRef: func | reactRef prop to <MdEditor/>? I am using react-hook-form for form validation and i need to pass input ref to the textarea in order to focus textarea after form submit (if field is invalid).

imzbf commented 3 months ago

This could be useful; I will make a decision after delving into the workings of this library.

imzbf commented 2 months ago

I tried to use this lib. Except that the border highlighting needs to be adapted by myself, we can use the existing API to focus textarea:

https://imzbf.github.io/md-editor-rt/en-US/docs#%F0%9F%8E%AF%20focus