mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-28 21:41:22 +08:00
Refactor language menu and dom utils (#32450)
1. Make `queryElem*` functions could correctly handle TS types 2. Remove some legacy jQuery $ calls (introduce fomanticQuery for Fomantic UI only) 3. Fix some TS typing problems
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import $ from 'jquery';
|
||||
let ariaIdCounter = 0;
|
||||
|
||||
export function generateAriaId() {
|
||||
@ -16,3 +17,6 @@ export function linkLabelAndInput(label, input) {
|
||||
label.setAttribute('for', id);
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-jquery/variable-pattern
|
||||
export const fomanticQuery = $;
|
||||
|
@ -179,11 +179,9 @@ export function initGlobalTooltips() {
|
||||
}
|
||||
|
||||
export function showTemporaryTooltip(target: Element, content: Content) {
|
||||
// if the target is inside a dropdown, don't show the tooltip because when the dropdown
|
||||
// closes, the tippy would be pushed unsightly to the top-left of the screen like seen
|
||||
// on the issue comment menu.
|
||||
if (target.closest('.ui.dropdown > .menu')) return;
|
||||
|
||||
// if the target is inside a dropdown, the menu will be hidden soon
|
||||
// so display the tooltip on the dropdown instead
|
||||
target = target.closest('.ui.dropdown') || target;
|
||||
const tippy = target._tippy ?? attachTooltip(target, content);
|
||||
tippy.setContent(content);
|
||||
if (!tippy.state.isShown) tippy.show();
|
||||
|
Reference in New Issue
Block a user