Fix: query heights before set

This commit is contained in:
eight 2019-06-18 01:25:44 +08:00
parent 1cdb2e7e92
commit 0bec3f040b

View File

@ -107,10 +107,10 @@ function createSectionsEditor({style, onTitleChanged}) {
if (available <= 0) { if (available <= 0) {
return; return;
} }
for (const section of sections) { const cmHeights = sections.map(s => s.cm.getWrapperElement().offsetHeight);
const cmHeight = section.cm.getWrapperElement().offsetHeight; sections.forEach((section, i) => {
section.cm.setSize(null, cmHeight + Math.floor(available / sections.length)); section.cm.setSize(null, cmHeights[i] + Math.floor(available / sections.length));
} });
} }
function genId() { function genId() {