🎨 Display a confirmation prompt when inserting large assets 256MB https://github.com/siyuan-note/siyuan/issues/16685

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-01-09 11:40:06 +08:00
parent 2162a43a61
commit 8801b7e933
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 4 additions and 4 deletions

View file

@ -743,7 +743,7 @@ const copyAnno = (idPath: string, fileName: string, pdf: any) => {
const imageName = content + ".png";
let msg = "";
if (Constants.SIZE_UPLOAD_TIP_SIZE <= blob.size) {
msg = window.siyuan.languages.uploadFileTooLarge.replace("${x}", imageName).replace("${y}", filesize(blob.size, {standard: "jedec"}));
msg = window.siyuan.languages.uploadFileTooLarge.replace("${x}", imageName).replace("${y}", filesize(blob.size, {standard: "iec"}));
}
confirmDialog(msg ? window.siyuan.languages.upload : "", msg, () => {
const formData = new FormData();

View file

@ -427,7 +427,7 @@ export const dragUpload = (files: ILocalFiles[], protyle: IProtyle, cellElement:
const assetPaths: string[] = [];
files.forEach(item => {
if (item.size && Constants.SIZE_UPLOAD_TIP_SIZE <= item.size) {
msg += window.siyuan.languages.uploadFileTooLarge.replace("${x}", item.path).replace("${y}", filesize(item.size, {standard: "jedec"})) + "<br>";
msg += window.siyuan.languages.uploadFileTooLarge.replace("${x}", item.path).replace("${y}", filesize(item.size, {standard: "iec"})) + "<br>";
}
assetPaths.push(item.path);
});

View file

@ -220,7 +220,7 @@ export const uploadLocalFiles = (files: ILocalFiles[], protyle: IProtyle, isUplo
const assetPaths: string[] = [];
files.forEach(item => {
if (item.size && Constants.SIZE_UPLOAD_TIP_SIZE <= item.size) {
msg += window.siyuan.languages.uploadFileTooLarge.replace("${x}", item.path).replace("${y}", filesize(item.size, {standard: "jedec"})) + "<br>";
msg += window.siyuan.languages.uploadFileTooLarge.replace("${x}", item.path).replace("${y}", filesize(item.size, {standard: "iec"})) + "<br>";
}
assetPaths.push(item.path);
});
@ -311,7 +311,7 @@ export const uploadFiles = (protyle: IProtyle, files: FileList | DataTransferIte
for (let i = 0, iMax = validateResult.files.length; i < iMax; i++) {
formData.append(protyle.options.upload.fieldName, validateResult.files[i]);
if (Constants.SIZE_UPLOAD_TIP_SIZE <= validateResult.files[i].size) {
msg += window.siyuan.languages.uploadFileTooLarge.replace("${x}", validateResult.files[i].name).replace("${y}", filesize(validateResult.files[i].size, {standard: "jedec"})) + "<br>";
msg += window.siyuan.languages.uploadFileTooLarge.replace("${x}", validateResult.files[i].name).replace("${y}", filesize(validateResult.files[i].size, {standard: "iec"})) + "<br>";
}
}