From 2774a0fcc63b03834e4d095593c812c70545e6c1 Mon Sep 17 00:00:00 2001 From: Kenox Date: Thu, 3 Nov 2022 18:41:21 +0100 Subject: [PATCH] Center scrolled view --- static/application.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/application.js b/static/application.js index 0bb886f..409e67c 100644 --- a/static/application.js +++ b/static/application.js @@ -233,7 +233,11 @@ haste.prototype.loadDocument = function(key) { if(window.location.hash) { const hash = window.location.hash.substring(1); highlightLine(hash) - document.getElementsByClassName("highlight")[0].scrollIntoView(); + document.getElementsByClassName("highlight")[0].scrollIntoView({ + behavior: 'auto', + block: 'center', + inline: 'center' + }); } } else {