Center scrolled view

This commit is contained in:
Kenox 2022-11-03 19:04:51 +01:00
commit 17c01ec5bb
2 changed files with 2 additions and 3 deletions

View file

@ -189,8 +189,7 @@ haste.prototype.addLineNumbers = function(lineCount) {
if(window.location.hash) { if(window.location.hash) {
const hash = window.location.hash.substring(1); const hash = window.location.hash.substring(1);
highlightLine(hash) highlightLine(hash)
console.log("try to get to line" + hash); document.getElementById('line' + hash).scrollIntoView({
document.getElementById("line" + hash)[0].scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'center' block: 'center'
}); });

File diff suppressed because one or more lines are too long