Skip to content

Commit cecb551

Browse files
wxiaoguangGiteaBot
authored andcommitted
Fix upload file form (go-gitea#33230)
Fix go-gitea#33228
1 parent 2c47b06 commit cecb551

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

web_src/js/features/repo-editor.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ export function initRepoEditor() {
3838
const dropzoneUpload = document.querySelector<HTMLElement>('.page-content.repository.editor.upload .dropzone');
3939
if (dropzoneUpload) initDropzone(dropzoneUpload);
4040

41-
const editArea = document.querySelector<HTMLTextAreaElement>('.page-content.repository.editor textarea#edit_area');
42-
if (!editArea) return;
43-
4441
for (const el of queryElems<HTMLInputElement>(document, '.js-quick-pull-choice-option')) {
4542
el.addEventListener('input', () => {
4643
if (el.value === 'commit-to-new-branch') {
@@ -55,6 +52,7 @@ export function initRepoEditor() {
5552
}
5653

5754
const filenameInput = document.querySelector<HTMLInputElement>('#file-name');
55+
if (!filenameInput) return;
5856
function joinTreePath() {
5957
const parts = [];
6058
for (const el of document.querySelectorAll('.breadcrumb span.section')) {
@@ -144,6 +142,10 @@ export function initRepoEditor() {
144142
}
145143
});
146144

145+
// on the upload page, there is no editor(textarea)
146+
const editArea = document.querySelector<HTMLTextAreaElement>('.page-content.repository.editor textarea#edit_area');
147+
if (!editArea) return;
148+
147149
const elForm = document.querySelector<HTMLFormElement>('.repository.editor .edit.form');
148150
initEditPreviewTab(elForm);
149151

0 commit comments

Comments
 (0)