plugins: renamed event "afterHead" to "afterHeader", and added "beforeHeader"

Massimo Melina committed Feb 24, 2023 at 19:53 UTC f67c1e989bb8724e396ebeb0c36017332481fa47
2 files changed +7 -2
dev-plugins.md
+3
@@ -181,6 +181,9 @@ This is a list of available frontend-events, with respective object parameter an
181 - you receive each entry of the list, and optionally produce HTML code that will be added after the name of the entry.
182 - parameter `{ entry: Entry }` (refer above for Entry object)
183 - output `Html`
184 +- `beforeHeader` & `afterHeader`
185 + - use this to produce content that should go right before/after the `header` part
186 + - output `Html`
187
188 ## Publish your plug-in
189
frontend/src/BrowseFiles.ts
+4 -2
@@ -33,11 +33,13 @@ export type DirList = DirEntry[]
33 export function BrowseFiles() {
34 useFetchList()
35 const { error, list, serverConfig } = useSnapState()
36 - const afterHead = useCustomCode('afterHead')
36 + const afterHeader = useCustomCode('afterHeader')
37 + const beforeHeader = useCustomCode('beforeHeader')
38 return useAuthorized() && h(Fragment, {},
39 h(Html, { code: serverConfig?.custom_header }),
40 + beforeHeader,
41 h(Head),
40 - afterHead,
42 + afterHeader,
43 hError(error)
44 || h(list ? FilesList : Spinner))
45 }