refac: do NOT change default behaviour in a PR

This commit is contained in:
Timothy J. Baek 2024-08-27 15:56:47 +02:00
parent 69c4687a53
commit ef28330c1a
2 changed files with 22 additions and 14 deletions

View File

@ -233,8 +233,8 @@
tikaServerUrl = res.content_extraction.tika_server_url; tikaServerUrl = res.content_extraction.tika_server_url;
showTikaServerUrl = contentExtractionEngine === 'tika'; showTikaServerUrl = contentExtractionEngine === 'tika';
fileMaxSize = res.file.file_max_size; fileMaxSize = res.file.max_size;
fileMaxCount = res.file.file_max_count; fileMaxCount = res.file.max_count;
} }
}); });
</script> </script>

View File

@ -364,7 +364,8 @@
multiple multiple
on:change={async () => { on:change={async () => {
if (inputFiles && inputFiles.length > 0) { if (inputFiles && inputFiles.length > 0) {
inputFilesHandler(inputFiles); const _inputFiles = Array.from(inputFiles);
inputFilesHandler(_inputFiles);
} else { } else {
toast.error($i18n.t(`File not found.`)); toast.error($i18n.t(`File not found.`));
} }
@ -667,19 +668,26 @@
}} }}
on:paste={async (e) => { on:paste={async (e) => {
const clipboardData = e.clipboardData || window.clipboardData; const clipboardData = e.clipboardData || window.clipboardData;
try {
if (clipboardData && clipboardData.items) {
const inputFiles = Array.from(clipboardData.items)
.map((item) => item.getAsFile())
.filter((file) => file);
inputFilesHandler(inputFiles); if (clipboardData && clipboardData.items) {
} else { for (const item of clipboardData.items) {
toast.error($i18n.t(`File not found.`)); if (item.type.indexOf('image') !== -1) {
const blob = item.getAsFile();
const reader = new FileReader();
reader.onload = function (e) {
files = [
...files,
{
type: 'image',
url: `${e.target.result}`
}
];
};
reader.readAsDataURL(blob);
}
} }
} catch (error) {
console.error('Error processing files:', error);
toast.error($i18n.t(`An error occurred while processing files.`));
} }
}} }}
/> />