PageSourceSearch

https://spacestudio.com.br/Components/Admin/Layout/IrPara.ahcgv6886g.razor.js

js spacestudio.com.br collected 2026-10-05 20:43:31 UTC 1,189 bytes, 34 lines download raw bytes

1// "Ir para…" (IrPara.razor): foco no campo ao abrir e de volta a quem estava com ele ao fechar, as teclas que o campo não
2// deve tratar (as setas moveriam o cursor, o Enter não tem formulário e o Tab sairia da paleta) e a opção escolhida à vista.
3// Quem decide o que cada tecla faz é o componente (@onkeydown): aqui só se evita o comportamento padrão do navegador.
4
5let anterior = null;
6
7function segurarTeclas(e) {
8    if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter' || e.key === 'Tab') {
9        e.preventDefault();
10    }
11}
12
13export function abrir(campo) {
14    anterior = document.activeElement instanceof HTMLElement && document.activeElement !== document.body ? document.activeElement : null;
15    if (!campo) {
16        return;
17    }
18
19    campo.addEventListener('keydown', segurarTeclas);
20    campo.focus();
21}
22
23export function fechar(devolverFoco) {
24    const volta = anterior;
25    anterior = null;
26    if (devolverFoco && volta?.isConnected) {
27        volta.focus();
28    }
29}
30
31export function mostrar(id) {
32    const opcao = id ? document.getElementById(id) : null;
33    opcao?.scrollIntoView({ block: 'nearest' });
34}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.