0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-11 07:05:21 +02:00
This commit is contained in:
Lunny Xiao 2025-12-12 13:26:50 -08:00
parent cd8130ed5c
commit cf809d3dd7
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 3 additions and 7 deletions

View File

@ -252,12 +252,6 @@ function handleDiffLineNumberClick(cell: HTMLElement, e: MouseEvent) {
export function initDiffLineSelection() {
addDelegatedEventListener<HTMLElement, MouseEvent>(document, 'click', diffLineNumberCellSelector, (cell, e) => {
if (e.defaultPrevented) return;
// Ignore clicks on or inside code-expander-buttons
const target = e.target as HTMLElement;
if (target.closest('.code-expander-button') || target.closest('.code-expander-buttons') ||
target.closest('button, a, input, select, textarea, summary, [role="button"]')) {
return;
}
handleDiffLineNumberClick(cell, e);
});
window.addEventListener('hashchange', () => {

View File

@ -170,9 +170,11 @@ async function loadMoreFiles(btn: Element): Promise<boolean> {
const resp = await response.text();
const respDoc = parseDom(resp, 'text/html');
const respFileBoxes = respDoc.querySelector('#diff-file-boxes')!;
const respFileBoxesChildren = Array.from(respFileBoxes.children); // respFileBoxes.children will be empty after replaceWith
// the response is a full HTML page, we need to extract the relevant contents:
// * append the newly loaded file list items to the existing list
document.querySelector('#diff-incomplete')!.replaceWith(...Array.from(respFileBoxes.children));
document.querySelector('#diff-incomplete')!.replaceWith(...respFileBoxesChildren);
for (const el of respFileBoxesChildren) window.htmx.process(el);
onShowMoreFiles();
return true;
} catch (error) {