mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-30 23:09:52 +00:00
Extend the issue context popup beyond markdown. Any link rendered with the `ref-issue` class now gets the popup, which covers commit titles and issue titles everywhere they appear (repo home, commits list, blame, branches, graph, PR commits, issue/PR pages, compare, …). For surfaces that synthesize links without markdown autolinking (dashboard activity feed, pulse page, commit merged-PR line), opt in by adding `data-ref-issue-container` on a parent (or `ref-issue` on the link). - Use `html_url` from the backend payload instead of synthesizing links client-side - Fetch outside the component, stateless, with a per-URL cache - Small hover delay so passing over a link doesn't fire a request - Drop the loading state (shifted layout) - Make both links in the tooltip work; prevent nested tooltips - Fix feed title `<a>` width so the tooltip only shows on link hover Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
import {initMarkupCodeMermaid} from './mermaid.ts';
|
|
import {initMarkupCodeMath} from './math.ts';
|
|
import {initMarkupCodeCopy} from './codecopy.ts';
|
|
import {initMarkupRenderAsciicast} from './asciicast.ts';
|
|
import {initMarkupTasklist} from './tasklist.ts';
|
|
import {registerGlobalInitFunc, registerGlobalSelectorFunc} from '../modules/observer.ts';
|
|
import {initExternalRenderIframe} from './render-iframe.ts';
|
|
import {toggleElemClass} from '../utils/dom.ts';
|
|
|
|
// code that runs for all markup content
|
|
export function initMarkupContent(): void {
|
|
registerGlobalInitFunc('initExternalRenderIframe', initExternalRenderIframe);
|
|
registerGlobalSelectorFunc('.markup', (el: HTMLElement) => {
|
|
if (el.matches('.truncated-markup')) {
|
|
// when the rendered markup is truncated (e.g.: user's home activity feed)
|
|
// we should not initialize any of the features (e.g.: code copy button), due to:
|
|
// * truncated markup already means that the container doesn't want to show complex contents
|
|
// * truncated markup may contain incomplete HTML/mermaid elements
|
|
// so the only thing we need to do is to remove the "is-loading" class added by the backend render.
|
|
toggleElemClass(el.querySelectorAll('.is-loading'), 'is-loading', false);
|
|
return;
|
|
}
|
|
initMarkupCodeCopy(el);
|
|
initMarkupTasklist(el);
|
|
initMarkupCodeMermaid(el);
|
|
initMarkupCodeMath(el);
|
|
initMarkupRenderAsciicast(el);
|
|
});
|
|
}
|