修复:网页端卡片模板上传图片(design2 使用 blob URL,与 design1 一致)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+6
-3
@@ -155,7 +155,9 @@ $('body').keydown(function (event) {
|
|||||||
$('#addPic').click(function () {
|
$('#addPic').click(function () {
|
||||||
OpenDialog()
|
OpenDialog()
|
||||||
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({
|
.showOpenDialog({
|
||||||
title: language_str('selectPic'), //请选择图片
|
title: language_str('selectPic'), //请选择图片
|
||||||
buttonLabel: language_str('comf'), //"确认"
|
buttonLabel: language_str('comf'), //"确认"
|
||||||
@@ -163,8 +165,9 @@ $('#addPic').click(function () {
|
|||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.canceled) return
|
if (result.canceled) return
|
||||||
//console.log(result.filePaths)
|
var url = (result.files && result.files[0]) ? URL.createObjectURL(result.files[0]) : (result.filePaths && result.filePaths[0]);
|
||||||
fabric.Image.fromURL(result.filePaths[0], function (image) {
|
if (!url) return
|
||||||
|
fabric.Image.fromURL(url, function (image) {
|
||||||
//image.left = pointer.x;
|
//image.left = pointer.x;
|
||||||
image.setSrc(image.toDataURL(), function (image) {
|
image.setSrc(image.toDataURL(), function (image) {
|
||||||
pre_add_image = image
|
pre_add_image = image
|
||||||
|
|||||||
Reference in New Issue
Block a user