Files
gitea/web_src/js/globals.d.ts
T
silverwindandwxiaoguang e645afbb3f refactor: replace Fomantic modal with native dialog (#39846)
Replace Fomantic's hard-forked jQuery modal with native `<dialog>`
elements, advancing https://github.com/go-gitea/gitea/issues/29849. The
UI is visually unchanged. Dialogs open with `show()` over an `inert`
page, so tooltips, popups and toasts mounted on `<body>` stay usable
above them, unlike with `showModal()`
(https://github.com/whatwg/html/issues/9936).

- Remove the Fomantic modal and dimmer, add `showModal` and `hideModal`
- Declare modals as `<dialog class="modal-dialog">`, shown inside a
`.modal-backdrop`, instead of `ui modal` with its unused size classes
- Remove two modals that could never be opened
- Block the page while a modal is open, close the topmost one on Escape
and restore focus to its opener
- Allow stacked modals, use a confirm modal instead of `window.confirm`
for deleting content history
- Hide popups and toasts when a modal opens or closes
- Keep the release notes modal open when generating notes fails

Fixes: https://github.com/go-gitea/gitea/issues/39643
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-10-20 12:32:27 +02:00

81 lines
2.3 KiB
TypeScript

interface JQuery {
fomanticExt: {
onDropdownAfterFiltered?: (this: HTMLElement) => void,
}; // fomantic extension
api: any, // fomantic
dropdown: any; // fomantic
transition: any, // fomantic
}
interface JQueryStatic {
api: any, // fomantic
}
interface Element {
_tippy: import('tippy.js').Instance;
}
interface Window {
config: {
appUrl: string,
appSubUrl: string,
assetUrlPrefix: string,
sharedWorkerUri: string,
runModeIsProd: boolean,
customEmojis: Record<string, string>,
pageData: {
adminUserListSearchForm?: {
SortType: string,
StatusFilterMap: Record<string, string>,
},
prReview?: {
numberOfFiles: number,
numberOfViewedFiles: number,
},
DiffFileTree?: import('./modules/diff-file.ts').DiffFileTreeData,
FolderIcon?: string,
FolderOpenIcon?: string,
repoLink?: string,
repoActivityTopAuthors?: Array<{
avatar_link: string,
commits: number,
home_link: string,
login: string,
name: string,
}>,
dashboardRepoList?: Record<string, unknown>,
},
notificationSettings: {
MinTimeout: number,
TimeoutStep: number,
MaxTimeout: number,
},
mermaidMaxSourceCharacters: number,
i18n: Record<string, string>,
frontendInited: boolean,
},
$: JQueryStatic,
jQuery: JQueryStatic,
_globalHandlerErrors: Array<ErrorEvent & PromiseRejectionEvent> & {
_inited: boolean,
push: (e: ErrorEvent & PromiseRejectionEvent) => void | number,
},
localUserSettings: typeof import('./modules/user-settings.ts').localUserSettings,
// various captcha plugins
grecaptcha: any,
turnstile: any,
hcaptcha: any,
// Make IIFE private functions can be managed by us in our scope, without exposing the IIFE module to global scope.
// Otherwise, when using "export" in IIFE code, the compiled JS will inject global "var externalRenderHelper = ..."
// which is not expected and may cause conflicts with other modules.
giteaExternalRenderHelper?: {
isValidCssColor(s: string | null): boolean,
queryParams: URLSearchParams,
postIframeMsg(cmd: 'resize' | 'open-link', data: Record<string, string | number | null>): void,
}
// do not add more properties here unless it is a must
}