Fixed an error when previewing the first line with Markdown extension (#43835)

This commit is contained in:
Keisuke KATO 2018-02-17 05:59:33 +09:00 committed by Matt Bierner
parent c168e385ef
commit d17652218a

View file

@ -155,9 +155,10 @@
if (previous) {
if (next) {
const betweenProgress = (offset - window.scrollY - previous.element.getBoundingClientRect().top) / (next.element.getBoundingClientRect().top - previous.element.getBoundingClientRect().top);
return previous.line + betweenProgress * (next.line - previous.line);
const line = previous.line + betweenProgress * (next.line - previous.line);
return (0 <= line) ? line : 0;
} else {
return previous.line;
return (0 <= previous.line) ? previous.line : 0;
}
}
return null;