mirror of
https://github.com/seejohnrun/haste-server
synced 2025-08-21 05:44:16 -07:00
Center scrolled view
This commit is contained in:
parent
2a0f809ca8
commit
2ffc0d9e6b
3 changed files with 11 additions and 10 deletions
|
@ -185,6 +185,16 @@ haste.prototype.addLineNumbers = function(lineCount) {
|
|||
div.appendChild(text);
|
||||
document.body.appendChild(div)
|
||||
}
|
||||
|
||||
if(window.location.hash) {
|
||||
const hash = window.location.hash.substring(1);
|
||||
highlightLine(hash)
|
||||
console.log("try to get to line" + hash);
|
||||
document.getElementById("line" + hash)[0].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
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
|
@ -21,15 +21,6 @@
|
|||
if (path === '/') { app.newDocument(true); }
|
||||
else { app.loadDocument(path.substring(1, path.length));
|
||||
}
|
||||
|
||||
if(window.location.hash) {
|
||||
const hash = window.location.hash.substring(1);
|
||||
highlightLine(hash)
|
||||
document.getElementById("line" + hash)[0].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
}
|
||||
};
|
||||
// Set up the pop state to handle loads, skipping the first load
|
||||
// to make chrome behave like others:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue