mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Scroll to the current item when going back from detail
The list view now supports an item id that will be scrolled to and is highlighted with a shadow. When going back from detail view this is now used to scroll to the currently viewed item.
This commit is contained in:
@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
.default-layout .main-content {
|
||||
margin-top: 44px;
|
||||
padding-top: 44px;
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
@ -97,6 +97,10 @@
|
||||
.default-layout .ui.cards .ui.card .content.search-highlight .ui.list .item .content .description strong > em {
|
||||
background: rgba(220, 255, 71, 0.6);
|
||||
}
|
||||
.default-layout .ui.cards .ui.card.current {
|
||||
/* semantic-ui purple */
|
||||
box-shadow: 0 0 6px rgba(0,0,0,0.55);
|
||||
}
|
||||
|
||||
.default-layout .qr-code svg {
|
||||
width: 200px;
|
||||
|
@ -32,20 +32,36 @@ elmApp.ports.setAllProgress.subscribe(function(input) {
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// elmApp.ports.scrollToElem.subscribe(function(id) {
|
||||
// if (id && id != "") {
|
||||
// window.setTimeout(function() {
|
||||
// var el = document.getElementById(id);
|
||||
// if (el) {
|
||||
// if (el["scrollIntoViewIfNeeded"]) {
|
||||
// el.scrollIntoViewIfNeeded();
|
||||
// } else {
|
||||
// el.scrollIntoView();
|
||||
// }
|
||||
// }
|
||||
// }, 20);
|
||||
// }
|
||||
// });
|
||||
elmApp.ports.scrollToTop.subscribe(function() {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
|
||||
elmApp.ports.scrollToElem.subscribe(function(argList) {
|
||||
var id = argList && argList.length >= 1
|
||||
? argList[0] : null;
|
||||
var offset = argList && argList.length >= 2
|
||||
? argList[1] : null;
|
||||
|
||||
if (id && id != "") {
|
||||
window.setTimeout(function() {
|
||||
var el = document.getElementById(id);
|
||||
if (el) {
|
||||
if (el["scrollIntoViewIfNeeded"]) {
|
||||
el.scrollIntoViewIfNeeded();
|
||||
} else {
|
||||
el.scrollIntoView({
|
||||
behavior: "auto",
|
||||
block: "center",
|
||||
inline: "nearest"
|
||||
});
|
||||
}
|
||||
if (offset && offset != 0) {
|
||||
window.scrollBy(0, offset);
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
});
|
||||
|
||||
elmApp.ports.saveUiSettings.subscribe(function(args) {
|
||||
if (Array.isArray(args) && args.length == 2) {
|
||||
|
Reference in New Issue
Block a user