Prevent javascript error: "TypeError: can't access property "scrollIntoView", line is undefined" (#776)

This commit is contained in:
Markus Staab
2025-06-03 20:56:14 +02:00
committed by GitHub
parent 25a7aedae3
commit 8fcc6a862f
+5 -2
View File
@@ -43,8 +43,11 @@ Zepto(function($) {
});
var line = $activeFrame.find('.code-block .line-highlight').first()[0];
line.scrollIntoView();
line.parentElement.scrollTop -= 180;
// [internal] frames might not contain a code-block
if (line) {
line.scrollIntoView();
line.parentElement.scrollTop -= 180;
}
$container.scrollTop(0);
}