From a5594eb7f16e52795aa1754dc9dfa183bac23ae2 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 12 Mar 2015 20:59:45 +0300 Subject: [PATCH] fixup: actually autofocus the added section --- edit.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edit.js b/edit.js index 40a3ec54..b79cc315 100644 --- a/edit.js +++ b/edit.js @@ -216,10 +216,11 @@ function addSection(event, section) { } else { sections.appendChild(div); } - var cm = setupCodeMirror(div.querySelector('.code')); + setupCodeMirror(div.querySelector('.code')); if (section) { var index = Array.prototype.indexOf.call(sections.children, section); - editors.splice(index, 0, editors.pop()); + var cm = editors.pop(); + editors.splice(index, 0, cm); cm.focus(); } }