[bugfix] Config Page: To reset scroll position to top when the tabs are changed.
This commit is contained in:
@@ -9,19 +9,25 @@ export const useSettingBoxScrollPosition = () => {
|
||||
}
|
||||
};
|
||||
const restoreScrollPosition = () => {
|
||||
|
||||
if (store.setting_box_scroll_container.current) {
|
||||
updateSettingBoxScrollPosition((pre) => {
|
||||
store.setting_box_scroll_container.current.scrollTop = pre.data;
|
||||
return pre.data;
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const resetScrollPosition = () => {
|
||||
if (store.setting_box_scroll_container.current) {
|
||||
store.setting_box_scroll_container.current.scrollTop = 0;
|
||||
updateSettingBoxScrollPosition(0);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
saveScrollPosition,
|
||||
restoreScrollPosition,
|
||||
resetScrollPosition,
|
||||
currentSettingBoxScrollPosition,
|
||||
updateSettingBoxScrollPosition,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user