aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2025-01-13 03:39:15 +0800
committerGitHub <noreply@github.com>2025-01-13 03:39:15 +0800
commitc0751ef116642a8074b2d8f124f18b24c89447cc (patch)
tree4967fe9deaaa687a0a98e1c2643fcd0a4a3a8f8e /web_src/js
parentbe4e961240883778c44d9651eaaf9ab8723bbbb0 (diff)
downloadgitea-c0751ef116642a8074b2d8f124f18b24c89447cc.tar.gz
gitea-c0751ef116642a8074b2d8f124f18b24c89447cc.zip
Fix upload file form (#33230)
Fix #33228
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 64d0402d84..d7097787d2 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);