janwirth / vue-medium-editor

✍️ A MediumEditor component for Vue 2. Demo:
https://franzskuffka.github.io/vue-medium-editor/
MIT License
405 stars 64 forks source link

Trigger focus #96

Open hschhhwwwo0o opened 8 months ago

hschhhwwwo0o commented 8 months ago

How do I call the focus method? Please show a sample code

janwirth commented 8 months ago

I can not write this code for you, but:

You can see here, that you can access the MediumEditor instance through the api prop on the component: https://github.com/janwirth/vue-medium-editor/blob/master/interactive.js#L35C1-L36C1

This is how you access a prop on a component: https://stackoverflow.com/a/37521683/3934396

Here seems to be someone that already did manage to programmatically focus the medium editor element: https://github.com/yabwe/medium-editor/issues/850#issuecomment-441412572

good luck!