From 5814b7bc0ec503d9409ae27669bb3f2d960222d2 Mon Sep 17 00:00:00 2001 From: 24kycj <1637269896@qq.com> Date: Tue, 12 May 2026 18:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=BD=91=E9=A1=B5?= =?UTF-8?q?=E7=AB=AF=E5=8D=A1=E7=89=87=E6=A8=A1=E6=9D=BF=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=EF=BC=88design2=20=E4=BD=BF=E7=94=A8=20blob?= =?UTF-8?q?=20URL=EF=BC=8C=E4=B8=8E=20design1=20=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- lib/design2/ui.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/design2/ui.js b/lib/design2/ui.js index 7385c93..10c5ff9 100644 --- a/lib/design2/ui.js +++ b/lib/design2/ui.js @@ -155,7 +155,9 @@ $('body').keydown(function (event) { $('#addPic').click(function () { OpenDialog() function OpenDialog() { - dialog + var dialogApi = (typeof dialog !== 'undefined' && dialog) ? dialog : (window.platformBridge && window.platformBridge.showOpenDialog ? { showOpenDialog: function (opts) { return window.platformBridge.showOpenDialog(opts); } } : null); + if (!dialogApi) return; + dialogApi .showOpenDialog({ title: language_str('selectPic'), //请选择图片 buttonLabel: language_str('comf'), //"确认" @@ -163,8 +165,9 @@ $('#addPic').click(function () { }) .then((result) => { if (result.canceled) return - //console.log(result.filePaths) - fabric.Image.fromURL(result.filePaths[0], function (image) { + var url = (result.files && result.files[0]) ? URL.createObjectURL(result.files[0]) : (result.filePaths && result.filePaths[0]); + if (!url) return + fabric.Image.fromURL(url, function (image) { //image.left = pointer.x; image.setSrc(image.toDataURL(), function (image) { pre_add_image = image