From 7125043dcd2846b5454d434824db9f4078464215 Mon Sep 17 00:00:00 2001 From: wzh425 Date: Thu, 12 May 2022 16:04:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9AFile=20names=20are=20not=20processe?= =?UTF-8?q?d=20by=20default=20when=20uploading=20(#457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Masa.Blazor/wwwroot/js/vditor/vditor-helper.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Masa.Blazor/wwwroot/js/vditor/vditor-helper.js b/src/Masa.Blazor/wwwroot/js/vditor/vditor-helper.js index eaefe5140d..e5db6b343d 100644 --- a/src/Masa.Blazor/wwwroot/js/vditor/vditor-helper.js +++ b/src/Masa.Blazor/wwwroot/js/vditor/vditor-helper.js @@ -8,7 +8,7 @@ cache: { enable: false, }, - icon:'material' + icon: 'material' } @@ -33,6 +33,7 @@ export function init(domRef, obj, value, options, isUploadHandler) { } } } + SetDefaultFileNameHandle(vditorOptions); domRef.Vditor = new Vditor(domRef, { ...vditorOptions, value, @@ -74,3 +75,7 @@ export function insertValue(domRef, value, render = true) { export function destroy(domRef) { domRef.Vditor.destroy(); } +function SetDefaultFileNameHandle(vditorOptions) { + let { upload } = vditorOptions; + if (upload) upload.filename || (upload.filename = (name) => name); +}