var items = (event.clipboardData || event.originalEvent.clipboardData).items;
for (var index in items) {
var item = items[index];
if (item.kind === 'file') {
var blob = item.getAsFile();
var formData = new FormData();
formData.append('file', blob);
var xhr = new XMLHttpRequest();
xhr.open('POST', '/pic/upload', true);
xhr.onload = function () {
if (xhr.status === 200) {
var response = JSON.parse(xhr.responseText);
var markdown_url = "";
newText = oldText.substring(0, selectionStart) + markdown_url + oldText.substring(selectionStart);
editor.val(newText);
editor.trigger('keyup');
}
}
xhr.send(formData);
}
}
flask-pagedown 粘贴图片
flask相关文章
最近热门
最常浏览
- 016 推荐系统 | 排序学习(LTR - Learning To Rank)
- 偏微分符号
- i.i.d(又称IID)
- 利普希茨连续条件(Lipschitz continuity)
- (error) MOVED 原因和解决方案
- TextCNN详解
- 找不到com.google.protobuf.GeneratedMessageV3的类文件
- Deployment failed: repository element was not specified in the POM inside distributionManagement
- cannot access com.google.protobuf.GeneratedMessageV3 解决方案
- CLUSTERDOWN Hash slot not served 问题原因和解决办法
×