new html section: beforeLogin

Massimo Melina committed Apr 11, 2023 at 11:43 UTC 6046334579d5bdb46c8ae15ce86dc8558b514175
3 files changed +6 -1
dev-plugins.md
+3
@@ -190,6 +190,9 @@ This is a list of available frontend-events, with respective object parameter an
190 - `beforeHeader` & `afterHeader`
191 - use this to produce content that should go right before/after the `header` part
192 - output `Html`
193 +- `beforeLogin`
194 + - no parameter
195 + - output `Html`
196 - `fileMenu`
197 - add your entries to the menu.
198 - parameter `{ entry: Entry, menu: FileMenuEntry[], props: FileMenuProp[] }`
frontend/src/login.ts
+2
@@ -8,6 +8,7 @@ import { useNavigate } from 'react-router-dom'
8 import { createElement as h, Fragment, useEffect, useRef } from 'react'
9 import { t, useI18N } from './i18n'
10 import { reloadList } from './useFetchList'
11 +import { CustomCode } from './components'
12
13 async function login(username:string, password:string) {
14 const stopWorking = working()
@@ -76,6 +77,7 @@ export async function loginDialog(navigate: ReturnType<typeof useNavigate>) {
77 go()
78 }
79 },
80 + h(CustomCode, { name: 'beforeLogin' }),
81 h('div', { className: 'field' },
82 h('label', { htmlFor: 'username' }, t`Username`),
83 h('input', {
src/customHtml.ts
+1 -1
@@ -8,7 +8,7 @@ import Dict = NodeJS.Dict
8 import { writeFile } from 'fs/promises'
9
10 export const customHtmlSections: ReadonlyArray<string> = ['top', 'bottom', 'beforeHeader', 'afterHeader',
11 - 'afterMenuBar', 'afterEntryName', 'afterList']
11 + 'afterMenuBar', 'afterEntryName', 'afterList', 'beforeLogin']
12
13 export const customHtmlState = proxy<{
14 sections: Map<string,string>