Fix various UI problems (#34243)

Also fix #34242
This commit is contained in:
wxiaoguang authored and GitHub committed 2025-04-19 08:43:22 +00:00
1 parent eda6d65818
commit c9aa9068b3
12 files changed
+43 -59

No files matched your search

+1
View File
@@ -224,6 +224,7 @@ progress::-moz-progress-bar {
}
.unselectable,
.btn,
.button,
.lines-num,
.lines-commit,
-14
View File
@@ -529,20 +529,6 @@
margin: 0 0.25em;
}
.file-revisions-btn {
display: block;
float: left;
margin-bottom: 2px !important;
padding: 11px !important;
margin-right: 10px !important;
}
.file-revisions-btn i {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}
.markup-content-iframe {
display: block;
border: none;
+8
View File
@@ -352,6 +352,14 @@ a.btn:hover {
color: inherit;
}
.btn.tiny {
font-size: 12px;
}
.btn.small {
font-size: 13px;
}
/* By default, Fomantic UI doesn't support "bordered" buttons group, but Gitea would like to use it.
And the default buttons always have borders now (not the same as Fomantic UI's default buttons, see above).
It needs some tricks to tweak the left/right borders with active state */
+4
View File
@@ -92,6 +92,10 @@
}
.tippy-box[data-theme="menu"] .item:focus {
background: var(--color-hover);
}
.tippy-box[data-theme="menu"] .item.active {
background: var(--color-active);
}
+6 -6
View File
@@ -1784,12 +1784,12 @@ tbody.commit-list {
.resolved-placeholder {
display: flex;
align-items: center;
font-size: 14px !important;
padding: 8px !important;
font-weight: var(--font-weight-normal) !important;
border: 1px solid var(--color-secondary) !important;
border-radius: var(--border-radius) !important;
margin: 4px !important;
justify-content: space-between;
margin: 4px;
padding: 8px;
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius);
background: var(--color-box-header);
}
.resolved-placeholder + .comment-code-cloud {
-13
View File
@@ -1,11 +1,3 @@
.show-outdated,
.hide-outdated {
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
margin-right: 0 !important;
}
.ui.button.add-code-comment {
padding: 2px;
position: absolute;
@@ -59,11 +51,6 @@
margin-bottom: 0.5em;
}
.show-outdated:hover,
.hide-outdated:hover {
text-decoration: underline;
}
.comment-code-cloud {
padding: 0.5rem 1rem !important;
position: relative;
+2 -6
View File
@@ -1,6 +1,5 @@
import {svg} from '../svg.ts';
import {createTippy} from '../modules/tippy.ts';
import {clippie} from 'clippie';
import {toAbsoluteUrl} from '../utils.ts';
import {addDelegatedEventListener} from '../utils/dom.ts';
@@ -43,7 +42,8 @@ function selectRange(range: string): Element {
if (!copyPermalink) return;
let link = copyPermalink.getAttribute('data-url');
link = `${link.replace(/#L\d+$|#L\d+-L\d+$/, '')}#${anchor}`;
copyPermalink.setAttribute('data-url', link);
copyPermalink.setAttribute('data-clipboard-text', link);
copyPermalink.setAttribute('data-clipboard-text-type', 'url');
};
const rangeFields = range ? range.split('-') : [];
@@ -138,8 +138,4 @@ export function initRepoCodeView() {
};
onHashChange();
window.addEventListener('hashchange', onHashChange);
addDelegatedEventListener(document, 'click', '.copy-line-permalink', (el) => {
clippie(toAbsoluteUrl(el.getAttribute('data-url')));
});
}
+5 -1
View File
@@ -360,7 +360,11 @@ export function querySingleVisibleElem<T extends HTMLElement>(parent: Element, s
export function addDelegatedEventListener<T extends HTMLElement, E extends Event>(parent: Node, type: string, selector: string, listener: (elem: T, e: E) => Promisable<void>, options?: boolean | AddEventListenerOptions) {
parent.addEventListener(type, (e: Event) => {
const elem = (e.target as HTMLElement).closest(selector);
if (!elem || !parent.contains(elem)) return;
// It strictly checks "parent contains the target elem" to avoid side effects of selector running on outside the parent.
// Keep in mind that the elem could have been removed from parent by other event handlers before this event handler is called.
// For example: tippy popup item, the tippy popup could be hidden and removed from DOM before this.
// It is caller's responsibility make sure the elem is still in parent's DOM when this event handler is called.
if (!elem || (parent !== document && !parent.contains(elem))) return;
listener(elem as T, e as E);
}, options);
}