mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-07-02 18:00:03 +02:00
Merge branch 'forgejo' into upload_with_path_structure
This commit is contained in:
commit
be3c659b51
97 changed files with 1621 additions and 911 deletions
|
@ -391,7 +391,7 @@ export default {
|
|||
<div class="ui top attached header tw-flex tw-flex-1">
|
||||
<b class="ui right">#{{ index + 1 }}</b>
|
||||
<a :href="contributor.home_link">
|
||||
<img class="ui avatar tw-align-middle" height="40" width="40" :src="contributor.avatar_link" alt="">
|
||||
<img class="ui avatar tw-align-middle" height="40" width="40" :src="contributor.avatar_link" alt="" loading="lazy">
|
||||
</a>
|
||||
<div class="tw-ml-2">
|
||||
<a v-if="contributor.home_link !== ''" :href="contributor.home_link"><h4>{{ contributor.name }}</h4></a>
|
||||
|
|
|
@ -167,6 +167,7 @@ export function initRepoIssueSidebarList() {
|
|||
});
|
||||
});
|
||||
|
||||
// FIXME: this is broken, see discussion https://codeberg.org/forgejo/forgejo/pulls/8199
|
||||
$('.menu .ui.dropdown.label-filter').on('keydown', (e) => {
|
||||
if (e.altKey && e.keyCode === 13) {
|
||||
const selectedItem = document.querySelector('.menu .ui.dropdown.label-filter .menu .item.selected');
|
||||
|
|
|
@ -75,6 +75,7 @@ import {initCopyContent} from './features/copycontent.js';
|
|||
import {initCaptcha} from './features/captcha.js';
|
||||
import {initRepositoryActionView} from './components/RepoActionView.vue';
|
||||
import {initGlobalTooltips} from './modules/tippy.js';
|
||||
import {initDropdowns} from './modules/dropdown.ts';
|
||||
import {initGiteaFomantic} from './modules/fomantic.js';
|
||||
import {onDomReady} from './utils/dom.js';
|
||||
import {initRepoIssueList} from './features/repo-issue-list.js';
|
||||
|
@ -103,6 +104,7 @@ onDomReady(() => {
|
|||
initGlobalEnterQuickSubmit();
|
||||
initGlobalFormDirtyLeaveConfirm();
|
||||
initGlobalLinkActions();
|
||||
initDropdowns();
|
||||
|
||||
initCommonOrganization();
|
||||
initCommonIssueListQuickGoto();
|
||||
|
@ -191,4 +193,7 @@ onDomReady(() => {
|
|||
initGltfViewer();
|
||||
initScopedAccessTokenCategories();
|
||||
initColorPickers();
|
||||
|
||||
// Deactivate CSS-only noJS usability supplements
|
||||
document.body.classList.remove('no-js');
|
||||
});
|
||||
|
|
35
web_src/js/modules/dropdown.ts
Normal file
35
web_src/js/modules/dropdown.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// Details can be opened by clicking summary or by pressing Space or Enter while
|
||||
// being focused on summary. But without JS options for closing it are limited.
|
||||
// Event listeners in this file provide more convenient options for that:
|
||||
// click iteration with anything on the page and pressing Escape.
|
||||
|
||||
export function initDropdowns() {
|
||||
document.addEventListener('click', (event) => {
|
||||
const dropdown = document.querySelector<HTMLDetailsElement>('details.dropdown[open]');
|
||||
// No open dropdowns on page, nothing to do.
|
||||
if (dropdown === null) return;
|
||||
|
||||
const target = event.target as HTMLElement;
|
||||
// User clicked something in the open dropdown, don't interfere.
|
||||
if (dropdown.contains(target)) return;
|
||||
|
||||
// User clicked something that isn't the open dropdown, so close it.
|
||||
dropdown.removeAttribute('open');
|
||||
});
|
||||
|
||||
// Close open dropdowns on Escape press
|
||||
document.addEventListener('keydown', (event) => {
|
||||
// This press wasn't escape, nothing to do.
|
||||
if (event.key !== 'Escape') return;
|
||||
|
||||
const dropdown = document.querySelector<HTMLDetailsElement>('details.dropdown[open]');
|
||||
// No open dropdowns on page, nothing to do.
|
||||
if (dropdown === null) return;
|
||||
|
||||
// User pressed Escape while having an open dropdown, probably wants it be closed.
|
||||
dropdown.removeAttribute('open');
|
||||
});
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
import {expect, test} from 'vitest';
|
||||
import {
|
||||
basename, extname, isObject, stripTags, parseIssueHref,
|
||||
parseUrl, translateMonth, translateDay, blobToDataURI,
|
||||
|
@ -182,5 +183,5 @@ async function testSleep(ms) {
|
|||
await sleep(ms);
|
||||
const endTime = Date.now(); // Record the end time
|
||||
const actualSleepTime = endTime - startTime;
|
||||
expect(actualSleepTime >= ms).toBeTruthy();
|
||||
expect(actualSleepTime).toBeGreaterThanOrEqual(ms);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue