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
17fa8d400e
commit
440b6e75bf
3 changed files with 14 additions and 11 deletions
|
@ -229,15 +229,6 @@ haste.prototype.loadDocument = function(key) {
|
|||
_this.$textarea.val('').hide();
|
||||
_this.$box.show().focus();
|
||||
_this.addLineNumbers(ret.lineCount);
|
||||
|
||||
if(window.location.hash) {
|
||||
const hash = window.location.hash.substring(1);
|
||||
highlightLine(hash)
|
||||
document.getElementsByClassName("highlight")[0].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
_this.newDocument();
|
||||
|
|
2
static/application.min.js
vendored
2
static/application.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,19 @@
|
|||
var handlePop = function(evt) {
|
||||
var path = evt.target.location.pathname;
|
||||
if (path === '/') { app.newDocument(true); }
|
||||
else { app.loadDocument(path.substring(1, path.length)); }
|
||||
else { app.loadDocument(path.substring(1, path.length));
|
||||
}
|
||||
|
||||
if(window.location.hash) {
|
||||
const hash = window.location.hash.substring(1);
|
||||
highlightLine(hash)
|
||||
document.getElementsByClassName("highlight")[0].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center'
|
||||
});
|
||||
|
||||
document.getElementById("box").scrollLeft = 0
|
||||
}
|
||||
};
|
||||
// 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