Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.44k stars 318 forks source link

Options `autofocus` does not work #399

Closed WolfgangKluge closed 2 years ago

WolfgangKluge commented 2 years ago

Describe the bug In my tests, both of these options have no effect.

To Reproduce

  1. Use the code, save as file
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
      <script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
    </head>
    <body>
      <textarea></textarea>
      <script>
          const easyMDE = new EasyMDE({
              autofocus: true
          });
      </script>
    </body>
    </html>
  2. load the page
  3. The element is not focused (try start typing)
  4. If the textarea has a autofocus property it will also not work as expected

Expected behavior The focus should be set.. (or my expectation is wrong)