make customHtml.htmlHead have access to HFS object
Massimo Melina committed
Sep 1, 2024 at 10:05 UTC
b22bd73886a9ccc02c7dd44fc33695c3d2c4da77
2 files changed
+5
-6
frontend/src/fileMenu.ts
+1
-2
@@ -85,8 +85,7 @@ export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (Falsy
85
},
86
]
87
const res = hfsEvent('fileMenu', { entry, menu, props })
88
- if (res)
89
- menu.push(...res.flat())
88
+ menu.push(...res.flat()) // flat because each plugin may return an array of entries
89
const ico = getEntryIcon(entry)
90
const { close } = newDialog({
91
title: isFolder ? t`Folder menu` : t`File menu`,
src/serveGuiFiles.ts
+4
-4
@@ -96,10 +96,6 @@ async function treatIndex(ctx: Koa.Context, filesUri: string, body: string) {
96
const isOpen = !isClose
97
if (isHead && isOpen)
98
return all + `
99
- ${isFrontend && `
100
- <title>${title.get()}</title>
101
- <link rel="shortcut icon" href="/favicon.ico?${timestamp}" />
102
- ` + getSection('htmlHead')}
99
<script>
100
HFS = ${JSON.stringify({
101
VERSION,
@@ -117,6 +113,10 @@ async function treatIndex(ctx: Koa.Context, filesUri: string, body: string) {
113
}, null, 4).replace(/<(\/script)/g, '<"+"$1') /*avoid breaking our script container*/}
114
document.documentElement.setAttribute('ver', HFS.VERSION.split('-')[0])
115
</script>
116
+ ${isFrontend && `
117
+ <title>${title.get()}</title>
118
+ <link rel="shortcut icon" href="/favicon.ico?${timestamp}" />
119
+ ${getSection('htmlHead')}`}
120
`
121
if (isBody && isOpen)
122
return `${all}