diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f0814f..4c3b108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - URLs with certain characters entered through prompts causing invalid markdown (Thanks to [@Zignature], [#393]). +- Autofocus option not working properly ([#399]). ## [2.16.1] - 2022-01-14 ### Fixed @@ -228,6 +229,7 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown - Cursor not always showing in "text" mode over the edit field +[#399]: https://github.com/Ionaru/easy-markdown-editor/issues/399 [#252]: https://github.com/Ionaru/easy-markdown-editor/issues/252 [#251]: https://github.com/Ionaru/easy-markdown-editor/issues/251 [#239]: https://github.com/Ionaru/easy-markdown-editor/issues/239 diff --git a/src/js/easymde.js b/src/js/easymde.js index 1229a26..d5dfd21 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -2242,6 +2242,10 @@ EasyMDE.prototype.render = function (el) { this.gui.sideBySide = this.createSideBySide(); this._rendered = this.element; + if (options.autofocus === true || el.autofocus) { + this.codemirror.focus(); + } + // Fixes CodeMirror bug (#344) var temp_cm = this.codemirror; setTimeout(function () {