aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2025-01-13 07:49:56 +0800
committerGitHub <noreply@github.com>2025-01-13 01:49:56 +0200
commit10b604749897bab87724035f67a1155741985994 (patch)
tree4be508a188e2924538208046e31e763334229629 /web_src/js
parent2c47b0686933a2339474b6676a8411fb9e0fc0db (diff)
downloadgitea-10b604749897bab87724035f67a1155741985994.tar.gz
gitea-10b604749897bab87724035f67a1155741985994.zip
Fix upload file form (#33230) (#33233)
Backport #33230 by @wxiaoguang Fix #33228 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/features/repo-editor.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/web_src/js/features/repo-editor.ts b/web_src/js/features/repo-editor.ts
index 32d0b84f4c..239035b3fe 100644
--- a/web_src/js/features/repo-editor.ts
+++ b/web_src/js/features/repo-editor.ts
@@ -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);