mirror of https://github.com/go-gitea/gitea.git
Fix cannot to paste text file
This commit is contained in:
parent
48cf2a5127
commit
5af777b5c9
|
@ -76,7 +76,7 @@ async function onEditContent(event) {
|
|||
|
||||
for (const attachment of data) {
|
||||
dz.emit('addedfile', attachment);
|
||||
if (/\.(jpg|jpeg|png|gif|bmp)$/i.test(attachment.name)) {
|
||||
if (/\.(jpg|jpeg|png|gif|bmp|svg)$/i.test(attachment.name)) {
|
||||
const imgSrc = `${dropzone.getAttribute('data-link-url')}/${attachment.uuid}`;
|
||||
dz.emit('thumbnail', attachment, imgSrc);
|
||||
dropzone.querySelector(`img[src='${imgSrc}']`).style.maxWidth = '100%';
|
||||
|
|
|
@ -269,7 +269,7 @@ export function getPastedContent(e) {
|
|||
const files = [];
|
||||
const data = e.clipboardData?.items || e.dataTransfer?.items;
|
||||
for (const item of data ?? []) {
|
||||
if (!item.type?.startsWith('text/')) {
|
||||
if (item?.kind === 'file') {
|
||||
const file = item.getAsFile();
|
||||
const extName = file.name.slice(file.name.lastIndexOf('.'), file.name.length);
|
||||
if (acceptedFiles.includes(extName)) {
|
||||
|
|
Loading…
Reference in New Issue