mirror of
https://github.com/seejohnrun/haste-server
synced 2025-08-21 00:03:09 -07:00
Center scrolled view
This commit is contained in:
parent
440b6e75bf
commit
2a0f809ca8
3 changed files with 3 additions and 4 deletions
|
@ -176,6 +176,7 @@ haste.prototype.addLineNumbers = function(lineCount) {
|
|||
div.classList.add('linenumber');
|
||||
div.style.marginTop = i * 16 + 'px';
|
||||
let line = i + 1;
|
||||
div.id = 'line' + line;
|
||||
div.href = '#' + line;
|
||||
div.onclick = function() {
|
||||
highlightLine(line);
|
||||
|
|
2
static/application.min.js
vendored
2
static/application.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -25,12 +25,10 @@
|
|||
if(window.location.hash) {
|
||||
const hash = window.location.hash.substring(1);
|
||||
highlightLine(hash)
|
||||
document.getElementsByClassName("highlight")[0].scrollIntoView({
|
||||
document.getElementById("line" + hash)[0].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
|
||||
document.getElementById("box").scrollLeft = 0
|
||||
}
|
||||
};
|
||||
// Set up the pop state to handle loads, skipping the first load
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue