Editor: make newly added section visible

This commit is contained in:
tophf 2015-04-22 23:47:29 +03:00
parent b6444c86ec
commit 62ec9e1c9e

View File

@ -426,7 +426,9 @@ function addSection(event, section) {
var clickedSection = event.target.parentNode; var clickedSection = event.target.parentNode;
sections.insertBefore(div, clickedSection.nextElementSibling); sections.insertBefore(div, clickedSection.nextElementSibling);
var newIndex = document.querySelectorAll("#sections > div").indexOf(clickedSection) + 1; var newIndex = document.querySelectorAll("#sections > div").indexOf(clickedSection) + 1;
setupCodeMirror(codeElement, newIndex).focus(); var cm = setupCodeMirror(codeElement, newIndex);
makeSectionVisible(cm);
cm.focus()
} else { } else {
sections.appendChild(div); sections.appendChild(div);
setupCodeMirror(codeElement); setupCodeMirror(codeElement);