fixup: actually autofocus the added section

This commit is contained in:
tophf 2015-03-12 20:59:45 +03:00
parent 0be6f6dfe4
commit a5594eb7f1

View File

@ -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();
}
}