sparksuite / simplemde-markdown-editor

A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://simplemde.com
MIT License
9.79k stars 1.12k forks source link

How to scroll to bottom of editor? #846

Open byronpendason opened 6 months ago

byronpendason commented 6 months ago

I am working on an app where the editor is in one "tab" (the tabs are just buttons that set the display on all other tabs as "none" and sets the display on the current tab as "block"). The editor is the default open tab. When someone goes to another tab, and then returns to the editor tab, I want to set the editor as the focus and place the cursor at the bottom of the editor textarea.

How do I set the editor as the focus and set the cursor at the bottom of the editor?

Edit: I know the autofocus sets it to focus at the editor's creation, but I'm trying to autofocus to it after changing the display from "none" to "block" when switching back to that tab.