mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-05 14:48:07 +00:00
Fix various bugs (#37096)
* Fix #36001 * Fix #35498 * Fix #35395 * Fix #35160 * Fix #35058 * Fix #35445
This commit is contained in:
@@ -381,7 +381,7 @@ function toggleTimeDisplay(type: 'seconds' | 'stamp') {
|
||||
|
||||
function toggleFullScreenMode() {
|
||||
isFullScreen.value = !isFullScreen.value;
|
||||
toggleFullScreen('.action-view-right', isFullScreen.value, '.action-view-body');
|
||||
toggleFullScreen(document.querySelector('.action-view-right')!, isFullScreen.value, '.action-view-body');
|
||||
}
|
||||
|
||||
async function hashChangeListener() {
|
||||
|
||||
@@ -5,6 +5,8 @@ import {fomanticQuery} from '../modules/fomantic/base.ts';
|
||||
import {queryElemChildren, queryElems, toggleElem} from '../utils/dom.ts';
|
||||
import type {SortableEvent} from 'sortablejs';
|
||||
import {toggleFullScreen} from '../utils.ts';
|
||||
import {registerGlobalInitFunc} from '../modules/observer.ts';
|
||||
import {localUserSettings} from '../modules/user-settings.ts';
|
||||
|
||||
function updateIssueCount(card: HTMLElement): void {
|
||||
const parent = card.parentElement!;
|
||||
@@ -143,27 +145,42 @@ function initRepoProjectColumnEdit(writableProjectBoard: Element): void {
|
||||
});
|
||||
}
|
||||
|
||||
function initRepoProjectToggleFullScreen(): void {
|
||||
function initRepoProjectToggleFullScreen(elProjectsView: HTMLElement): void {
|
||||
const enterFullscreenBtn = document.querySelector('.screen-full');
|
||||
const exitFullscreenBtn = document.querySelector('.screen-normal');
|
||||
if (!enterFullscreenBtn || !exitFullscreenBtn) return;
|
||||
|
||||
const settingKey = 'projects-view-options';
|
||||
type ProjectsViewOptions = {
|
||||
fullScreen: boolean;
|
||||
};
|
||||
const opts = localUserSettings.getJsonObject<ProjectsViewOptions>(settingKey, {fullScreen: false});
|
||||
const toggleFullscreenState = (isFullScreen: boolean) => {
|
||||
toggleFullScreen('.projects-view', isFullScreen);
|
||||
toggleFullScreen(elProjectsView, isFullScreen);
|
||||
toggleElem(enterFullscreenBtn, !isFullScreen);
|
||||
toggleElem(exitFullscreenBtn, isFullScreen);
|
||||
|
||||
opts.fullScreen = isFullScreen;
|
||||
localUserSettings.setJsonObject(settingKey, opts);
|
||||
};
|
||||
|
||||
enterFullscreenBtn.addEventListener('click', () => toggleFullscreenState(true));
|
||||
exitFullscreenBtn.addEventListener('click', () => toggleFullscreenState(false));
|
||||
if (opts.fullScreen) {
|
||||
// a temporary solution to remember the full screen state, not perfect,
|
||||
// just make UX better than before, especially for users who need to change the label filter frequently and want to keep full screen mode.
|
||||
toggleFullscreenState(true);
|
||||
}
|
||||
}
|
||||
|
||||
export function initRepoProject(): void {
|
||||
initRepoProjectToggleFullScreen();
|
||||
export function initRepoProjectsView(): void {
|
||||
registerGlobalInitFunc('initRepoProjectsView', (elProjectsView) => {
|
||||
initRepoProjectToggleFullScreen(elProjectsView);
|
||||
|
||||
const writableProjectBoard = document.querySelector('#project-board[data-project-board-writable="true"]');
|
||||
if (!writableProjectBoard) return;
|
||||
const writableProjectBoard = document.querySelector('#project-board[data-project-board-writable="true"]');
|
||||
if (!writableProjectBoard) return;
|
||||
|
||||
initRepoProjectSortable(); // no await
|
||||
initRepoProjectColumnEdit(writableProjectBoard);
|
||||
initRepoProjectSortable(); // no await
|
||||
initRepoProjectColumnEdit(writableProjectBoard);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import {initRepoGraphGit} from './features/repo-graph.ts';
|
||||
import {initHeatmap} from './features/heatmap.ts';
|
||||
import {initImageDiff} from './features/imagediff.ts';
|
||||
import {initRepoMigration} from './features/repo-migration.ts';
|
||||
import {initRepoProject} from './features/repo-projects.ts';
|
||||
import {initRepoProjectsView} from './features/repo-projects.ts';
|
||||
import {initTableSort} from './features/tablesort.ts';
|
||||
import {initAdminUserListSearchForm} from './features/admin/users.ts';
|
||||
import {initAdminConfigs} from './features/admin/config.ts';
|
||||
@@ -132,7 +132,7 @@ const initPerformanceTracer = callInitFunctions([
|
||||
initRepoIssueFilterItemLabel,
|
||||
initRepoMigration,
|
||||
initRepoMigrationStatusChecker,
|
||||
initRepoProject,
|
||||
initRepoProjectsView,
|
||||
initRepoPullRequestReview,
|
||||
initRepoReleaseNew,
|
||||
initRepoTopicBar,
|
||||
|
||||
@@ -208,7 +208,7 @@ export function isVideoFile({name, type}: {name?: string, type?: string}): boole
|
||||
return Boolean(/\.(mpe?g|mp4|mkv|webm)$/i.test(name || '') || type?.startsWith('video/'));
|
||||
}
|
||||
|
||||
export function toggleFullScreen(fullscreenElementsSelector: string, isFullScreen: boolean, sourceParentSelector?: string): void {
|
||||
export function toggleFullScreen(fullScreenEl: HTMLElement, isFullScreen: boolean, sourceParentSelector?: string): void {
|
||||
// hide other elements
|
||||
const headerEl = document.querySelector('#navbar')!;
|
||||
const contentEl = document.querySelector('.page-content')!;
|
||||
@@ -218,9 +218,8 @@ export function toggleFullScreen(fullscreenElementsSelector: string, isFullScree
|
||||
toggleElem(footerEl, !isFullScreen);
|
||||
|
||||
const sourceParentEl = sourceParentSelector ? document.querySelector(sourceParentSelector)! : contentEl;
|
||||
const fullScreenEl = document.querySelector(fullscreenElementsSelector)!;
|
||||
const outerEl = document.querySelector('.full.height')!;
|
||||
toggleElemClass(fullscreenElementsSelector, 'fullscreen', isFullScreen);
|
||||
toggleElemClass(fullScreenEl, 'fullscreen', isFullScreen);
|
||||
if (isFullScreen) {
|
||||
outerEl.append(fullScreenEl);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user