From 1d07b7c4ce836c902b8619eb2edcee43ce1f2788 Mon Sep 17 00:00:00 2001 From: Javier Rodriguez Date: Wed, 3 May 2017 11:00:10 +0200 Subject: [PATCH] Checks if the composer is empty inside the asynchronous function --- src/views/composer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/composer.js b/src/views/composer.js index 17be2f8..ab6f14c 100644 --- a/src/views/composer.js +++ b/src/views/composer.js @@ -425,8 +425,8 @@ // Ensures when editor is empty and not line breaks mode, the inital state has a paragraph in it on focus with caret inside paragraph if (!this.config.useLineBreaks) { dom.observe(this.element, ["focus"], function() { - if (that.isEmpty()) { - setTimeout(function() { + setTimeout(function() { + if (that.isEmpty()) { var paragraph = that.doc.createElement("P"); that.element.innerHTML = ""; that.element.appendChild(paragraph); @@ -436,8 +436,8 @@ } else { that.selection.selectNode(paragraph, true); } - }, 0); - } + } + }, 0); }); }