Fix js error in edit issue and improve image type check

This commit is contained in:
Tyrone Yeh 2024-04-16 12:04:49 +08:00
parent ce5745233c
commit 48cf2a5127
No known key found for this signature in database
GPG Key ID: A0725352B993FBDD
2 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ async function handleClipboardFiles(editor, dropzone, files, e) {
file.uuid = uuid;
dropzone.dropzone.emit('addedfile', file);
if (/\.(jpg|jpeg|png|gif|bmp)$/i.test(file.name)) {
if (file.type?.startsWith('image/')) {
const imgSrc = `/attachments/${file.uuid}`;
dropzone.dropzone.emit('thumbnail', file, imgSrc);
dropzone.querySelector(`img[src='${imgSrc}']`).style.maxWidth = '100%';

View File

@ -259,7 +259,7 @@ export function isElemVisible(element) {
}
export function getComboMarkdownEditor(el) {
if (el.jquery) el = el[0];
if (el?.jquery) el = el[0];
return el?._giteaComboMarkdownEditor;
}