Fixed linter errors

This commit is contained in:
squidfunk
2021-02-12 13:38:18 +01:00
parent 02f6a1feab
commit f7907fc09c
5 changed files with 38 additions and 14 deletions

View File

@@ -46,3 +46,31 @@ export function resetFocusable(
): void {
el.removeAttribute("tabindex")
}
/**
* Set scroll lock
*
* @param el - Scrollable element
* @param value - Vertical offset
*/
export function setScrollLock(
el: HTMLElement, value: number
): void {
el.setAttribute("data-md-state", "lock")
el.style.top = `-${value}px`
}
/**
* Reset scroll lock
*
* @param el - Scrollable element
*/
export function resetScrollLock(
el: HTMLElement
): void {
const value = -1 * parseInt(el.style.top, 10)
el.removeAttribute("data-md-state")
el.style.top = ""
if (value)
window.scrollTo(0, value)
}

View File

@@ -24,7 +24,10 @@ import { Observable, merge } from "rxjs"
import { filter, sample, take } from "rxjs/operators"
import { configuration } from "~/_"
import { requestJSON, getElementOrThrow } from "~/browser"
import {
getElementOrThrow,
requestJSON
} from "~/browser"
import {
SearchIndex,
isSearchQueryMessage,