mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
fix: 修复 markdown 上传图片功能没有回显链接问题
This commit is contained in:
parent
ac58ff0398
commit
1d420ba73f
@ -51,7 +51,7 @@
|
|||||||
"<label>" + imageLang.url + "</label>" +
|
"<label>" + imageLang.url + "</label>" +
|
||||||
"<input type=\"text\" data-url />" + (function() {
|
"<input type=\"text\" data-url />" + (function() {
|
||||||
return (settings.imageUpload) ? "<div class=\"" + classPrefix + "file-input\">" +
|
return (settings.imageUpload) ? "<div class=\"" + classPrefix + "file-input\">" +
|
||||||
// 3xxx 下行添加multiple=\"multiple\"
|
// 3xxx <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>multiple=\"multiple\"
|
||||||
"<input type=\"file\" name=\"" + classPrefix + "image-file\" accept=\"image/jpeg,image/png,image/gif,image/jpg\" multiple=\"multiple\" />" +
|
"<input type=\"file\" name=\"" + classPrefix + "image-file\" accept=\"image/jpeg,image/png,image/gif,image/jpg\" multiple=\"multiple\" />" +
|
||||||
"<input type=\"submit\" value=\"" + imageLang.uploadButton + "\" />" +
|
"<input type=\"submit\" value=\"" + imageLang.uploadButton + "\" />" +
|
||||||
"</div>" : "";
|
"</div>" : "";
|
||||||
@ -78,7 +78,7 @@
|
|||||||
opacity: settings.dialogMaskOpacity,
|
opacity: settings.dialogMaskOpacity,
|
||||||
backgroundColor: settings.dialogMaskBgColor
|
backgroundColor: settings.dialogMaskBgColor
|
||||||
},
|
},
|
||||||
// 这里将多图片地址改造后插入文档中
|
// <EFBFBD><EFBFBD><EFBFBD>ォ<EFBFBD><EFBFBD>ͼƬ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
buttons: {
|
buttons: {
|
||||||
enter: [lang.buttons.enter, function() {
|
enter: [lang.buttons.enter, function() {
|
||||||
var url = this.find("[data-url]").val();
|
var url = this.find("[data-url]").val();
|
||||||
@ -88,7 +88,7 @@
|
|||||||
alert(imageLang.imageURLEmpty);
|
alert(imageLang.imageURLEmpty);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 这里增加循环
|
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD>
|
||||||
let arr = url.split(";");
|
let arr = url.split(";");
|
||||||
var altAttr = (alt !== "") ? " \"" + alt + "\"" : "";
|
var altAttr = (alt !== "") ? " \"" + alt + "\"" : "";
|
||||||
for (let i = 0; i < arr.length; i++) {
|
for (let i = 0; i < arr.length; i++) {
|
||||||
@ -121,19 +121,19 @@
|
|||||||
fileInput.bind("change", function() {
|
fileInput.bind("change", function() {
|
||||||
// 3xxx 20240602
|
// 3xxx 20240602
|
||||||
// let formData = new FormData();
|
// let formData = new FormData();
|
||||||
// 获取文本框dom
|
// <EFBFBD><EFBFBD>ȡ<EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD>dom
|
||||||
// var doc = document.getElementById('doc');
|
// var doc = document.getElementById('doc');
|
||||||
// 获取上传控件dom
|
// <EFBFBD><EFBFBD>ȡ<EFBFBD>ϴ<EFBFBD><EFBFBD>ؼ<EFBFBD>dom
|
||||||
// var upload = document.getElementById('upload');
|
// var upload = document.getElementById('upload');
|
||||||
// let files = upload.files;
|
// let files = upload.files;
|
||||||
//遍历文件信息append到formData存储
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>Ϣappend<EFBFBD><EFBFBD>formData<EFBFBD>洢
|
||||||
// for (let i = 0; i < files.length; i++) {
|
// for (let i = 0; i < files.length; i++) {
|
||||||
// let file = files[i]
|
// let file = files[i]
|
||||||
// formData.append('files', file)
|
// formData.append('files', file)
|
||||||
// }
|
// }
|
||||||
// 获取文件名
|
// <EFBFBD><EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||||
// var fileName = upload.files[0].name;
|
// var fileName = upload.files[0].name;
|
||||||
// 获取文件路径
|
// <EFBFBD><EFBFBD>ȡ<EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>
|
||||||
// var filePath = upload.value;
|
// var filePath = upload.value;
|
||||||
// doc.value = fileName;
|
// doc.value = fileName;
|
||||||
// 3xxx
|
// 3xxx
|
||||||
@ -161,17 +161,11 @@
|
|||||||
var json = (body.innerText) ? body.innerText : ((body.textContent) ? body.textContent : null);
|
var json = (body.innerText) ? body.innerText : ((body.textContent) ? body.textContent : null);
|
||||||
json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
|
json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
|
||||||
var url="";
|
var url="";
|
||||||
for (let i = 0; i < json.length; i++) {
|
if (json.success === 1) {
|
||||||
if (json[i].success === 1) {
|
url=json.url;
|
||||||
if (i==0){
|
|
||||||
url=json[i].url;
|
|
||||||
}else{
|
|
||||||
url=url+";"+json[i].url;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
alert(json[i].message);
|
alert(json.message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
dialog.find("[data-url]").val(url)
|
dialog.find("[data-url]").val(url)
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user