mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-08 17:05:45 +02:00
no window var
This commit is contained in:
parent
31835f4638
commit
3bc3cd8ab5
@ -57,6 +57,7 @@ function reloadContentScript(sidebarEl: HTMLElement, contentEl: Element) {
|
||||
}
|
||||
|
||||
export function initViewFileTreeSidebar() {
|
||||
let popstateListenerForViewFilePageAdded = false;
|
||||
registerGlobalInitFunc('initViewFileTreeSidebar', async (el: HTMLElement) => {
|
||||
el.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
|
||||
toggleSidebar(el, false);
|
||||
@ -84,12 +85,12 @@ export function initViewFileTreeSidebar() {
|
||||
}});
|
||||
fileTreeView.mount(fileTree);
|
||||
|
||||
if (!window.popstateListenerForViewFilePageAdded) {
|
||||
if (!popstateListenerForViewFilePageAdded) {
|
||||
window.addEventListener('popstate', () => {
|
||||
selectedItem.value = getSelectedPath(refString);
|
||||
loadContent(el);
|
||||
});
|
||||
window.popstateListenerForViewFilePageAdded = true;
|
||||
popstateListenerForViewFilePageAdded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
1
web_src/js/globals.d.ts
vendored
1
web_src/js/globals.d.ts
vendored
@ -74,6 +74,5 @@ interface Window {
|
||||
turnstile: any,
|
||||
hcaptcha: any,
|
||||
codeEditors: any[],
|
||||
popstateListenerForViewFilePageAdded: boolean,
|
||||
updateCloneStates: () => void,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user