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