mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-22 05:15:22 +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() {
|
export function initViewFileTreeSidebar() {
|
||||||
|
let popstateListenerForViewFilePageAdded = false;
|
||||||
registerGlobalInitFunc('initViewFileTreeSidebar', async (el: HTMLElement) => {
|
registerGlobalInitFunc('initViewFileTreeSidebar', async (el: HTMLElement) => {
|
||||||
el.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
|
el.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
|
||||||
toggleSidebar(el, false);
|
toggleSidebar(el, false);
|
||||||
@ -84,12 +85,12 @@ export function initViewFileTreeSidebar() {
|
|||||||
}});
|
}});
|
||||||
fileTreeView.mount(fileTree);
|
fileTreeView.mount(fileTree);
|
||||||
|
|
||||||
if (!window.popstateListenerForViewFilePageAdded) {
|
if (!popstateListenerForViewFilePageAdded) {
|
||||||
window.addEventListener('popstate', () => {
|
window.addEventListener('popstate', () => {
|
||||||
selectedItem.value = getSelectedPath(refString);
|
selectedItem.value = getSelectedPath(refString);
|
||||||
loadContent(el);
|
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,
|
turnstile: any,
|
||||||
hcaptcha: any,
|
hcaptcha: any,
|
||||||
codeEditors: any[],
|
codeEditors: any[],
|
||||||
popstateListenerForViewFilePageAdded: boolean,
|
|
||||||
updateCloneStates: () => void,
|
updateCloneStates: () => void,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user