restore scrollInfo focus for first CM
This commit is contained in:
parent
7ff1f17772
commit
9d8f9ec5a2
|
@ -507,6 +507,8 @@ define(require => function SectionsEditor() {
|
||||||
si.scrollY2 = si.scrollY + window.innerHeight;
|
si.scrollY2 = si.scrollY + window.innerHeight;
|
||||||
container.style.height = si.scrollY2 + 'px';
|
container.style.height = si.scrollY2 + 'px';
|
||||||
scrollTo(0, si.scrollY);
|
scrollTo(0, si.scrollY);
|
||||||
|
// only restore focus if it's the first CM to avoid derpy quirks
|
||||||
|
focusOn = si.cms[0].focus && 0;
|
||||||
rerouteHotkeys(true);
|
rerouteHotkeys(true);
|
||||||
} else {
|
} else {
|
||||||
si = null;
|
si = null;
|
||||||
|
@ -527,7 +529,7 @@ define(require => function SectionsEditor() {
|
||||||
insertSectionAfter(src[i], null, forceRefresh, si && si.cms[i]);
|
insertSectionAfter(src[i], null, forceRefresh, si && si.cms[i]);
|
||||||
setGlobalProgress(i, src.length);
|
setGlobalProgress(i, src.length);
|
||||||
if (pristine) dirty.clear();
|
if (pristine) dirty.clear();
|
||||||
if (i === focusOn && !si) sections[i].cm.focus();
|
if (i === focusOn) sections[i].cm.focus();
|
||||||
}
|
}
|
||||||
if (!si) requestAnimationFrame(fitToAvailableSpace);
|
if (!si) requestAnimationFrame(fitToAvailableSpace);
|
||||||
container.style.removeProperty('height');
|
container.style.removeProperty('height');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user