From d02aa31c23e942f4f84746f45eff5fa0afc22571 Mon Sep 17 00:00:00 2001 From: Fernando Mendes Date: Tue, 11 Aug 2015 09:25:29 +0100 Subject: [PATCH] Small fix --- src/js/simplemde.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/simplemde.js b/src/js/simplemde.js index b4c0969..420cd1a 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -467,10 +467,17 @@ function SimpleMDE(options) { options.status = ['autosave', 'lines', 'words', 'cursor']; } - this.options = options; + this.options = options; // If user has passed an element, it should auto rendered this.render(); + + // The codemirror component is only available after rendering + // so, the setter for the defaultValue can only run after + // the element has been rendered + if (options.defaultValue) { + this.value(options.defaultValue); + } } /**