editor: highlight style entry upon "back to manage"

This commit is contained in:
tophf 2017-06-27 23:01:17 +03:00
parent dc846aa7dd
commit 9299972a34
2 changed files with 11 additions and 1 deletions

View File

@ -477,6 +477,8 @@ function goBackToManage(event) {
event.stopPropagation();
event.preventDefault();
history.back();
} else if (styleId) {
sessionStorage.justEditedStyleId = styleId;
}
}

View File

@ -117,7 +117,7 @@ function showStyles(styles = []) {
.sort((a, b) => (a.name < b.name ? -1 : a.name == b.name ? 0 : 1));
let index = 0;
const scrollY = (history.state || {}).scrollY;
const shouldRenderAll = scrollY > window.innerHeight;
const shouldRenderAll = scrollY > window.innerHeight || sessionStorage.justEditedStyleId;
const renderBin = document.createDocumentFragment();
if (scrollY) {
renderStyles();
@ -143,7 +143,15 @@ function showStyles(styles = []) {
if (newUI.enabled && newUI.favicons) {
debounce(handleEvent.loadFavicons, 16);
}
if (sessionStorage.justEditedStyleId) {
const entry = $(ENTRY_ID_PREFIX + sessionStorage.justEditedStyleId);
delete sessionStorage.justEditedStyleId;
if (entry) {
animateElement(entry);
scrollElementIntoView(entry);
}
}
}
}