1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-18 21:54:27 +00:00

Fix upload file form (#33230) (#33233)

Backport #33230 by @wxiaoguang

Fix #33228

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot 2025-01-13 07:49:56 +08:00 committed by GitHub
parent 2c47b06869
commit 10b6047498
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,9 +38,6 @@ export function initRepoEditor() {
const dropzoneUpload = document.querySelector<HTMLElement>('.page-content.repository.editor.upload .dropzone');
if (dropzoneUpload) initDropzone(dropzoneUpload);
const editArea = document.querySelector<HTMLTextAreaElement>('.page-content.repository.editor textarea#edit_area');
if (!editArea) return;
for (const el of queryElems<HTMLInputElement>(document, '.js-quick-pull-choice-option')) {
el.addEventListener('input', () => {
if (el.value === 'commit-to-new-branch') {
@ -55,6 +52,7 @@ export function initRepoEditor() {
}
const filenameInput = document.querySelector<HTMLInputElement>('#file-name');
if (!filenameInput) return;
function joinTreePath() {
const parts = [];
for (const el of document.querySelectorAll('.breadcrumb span.section')) {
@ -144,6 +142,10 @@ export function initRepoEditor() {
}
});
// on the upload page, there is no editor(textarea)
const editArea = document.querySelector<HTMLTextAreaElement>('.page-content.repository.editor textarea#edit_area');
if (!editArea) return;
const elForm = document.querySelector<HTMLFormElement>('.repository.editor .edit.form');
initEditPreviewTab(elForm);