mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
perf: 任务详细描述右键新增预览图片
This commit is contained in:
parent
b90b129d98
commit
4cbc5040a2
@ -235,7 +235,7 @@
|
||||
},
|
||||
insert: {
|
||||
title: "Insert",
|
||||
items: "image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime | uploadImages browseImages | uploadFiles"
|
||||
items: "image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime | uploadImages | uploadFiles"
|
||||
}
|
||||
},
|
||||
codesample_languages: [
|
||||
@ -262,13 +262,13 @@
|
||||
fetch: (callback) => {
|
||||
let items = [{
|
||||
type: 'menuitem',
|
||||
text: this.$L('上传图片'),
|
||||
text: this.$L('上传本地图片'),
|
||||
onAction: () => {
|
||||
this.$refs.myUpload.handleClick();
|
||||
}
|
||||
}, {
|
||||
type: 'menuitem',
|
||||
text: this.$L('图片空间'),
|
||||
text: this.$L('浏览已上传图片'),
|
||||
onAction: () => {
|
||||
this.$refs.myUpload.browsePicture();
|
||||
}
|
||||
@ -276,17 +276,36 @@
|
||||
callback(items);
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('uploadImages', {
|
||||
editor.ui.registry.addNestedMenuItem('uploadImages', {
|
||||
icon: 'image',
|
||||
text: this.$L('上传图片'),
|
||||
getSubmenuItems: () => {
|
||||
return [{
|
||||
type: 'menuitem',
|
||||
text: this.$L('上传本地图片'),
|
||||
onAction: () => {
|
||||
this.$refs.myUpload.handleClick();
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('browseImages', {
|
||||
text: this.$L('图片空间'),
|
||||
}, {
|
||||
type: 'menuitem',
|
||||
text: this.$L('浏览已上传图片'),
|
||||
onAction: () => {
|
||||
this.$refs.myUpload.browsePicture();
|
||||
}
|
||||
}];
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addMenuItem('imagePreview', {
|
||||
text: this.$L('预览图片'),
|
||||
onAction: () => {
|
||||
const array = this.getValueImages();
|
||||
if (array.length === 0) {
|
||||
$A.messageWarning("没有可预览的图片")
|
||||
return;
|
||||
}
|
||||
this.$store.state.previewImageIndex = 0;
|
||||
this.$store.state.previewImageList = array;
|
||||
}
|
||||
});
|
||||
editor.ui.registry.addButton('uploadFiles', {
|
||||
text: this.$L('文件'),
|
||||
@ -483,6 +502,22 @@
|
||||
}
|
||||
},
|
||||
|
||||
getValueImages() {
|
||||
let imgs = [];
|
||||
let imgReg = /<img.*?(?:>|\/>)/gi;
|
||||
let srcReg = /src=['"]?([^'"]*)['"]?/i;
|
||||
let array = (this.getContent() + "").match(imgReg);
|
||||
if (array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let src = array[i].match(srcReg);
|
||||
if(src[1]){
|
||||
imgs.push(src[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return imgs;
|
||||
},
|
||||
|
||||
/********************文件上传部分************************/
|
||||
|
||||
handleProgress(event, file) {
|
||||
|
||||
@ -209,7 +209,7 @@ export default {
|
||||
autoresize_bottom_margin: 2,
|
||||
min_height: 200,
|
||||
max_height: 380,
|
||||
contextmenu: 'bold italic underline forecolor backcolor | codesample | uploadImages browseImages | preview screenload',
|
||||
contextmenu: 'bold italic underline forecolor backcolor | codesample | uploadImages imagePreview | preview screenload',
|
||||
valid_elements : 'a[href|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code',
|
||||
toolbar: false
|
||||
},
|
||||
|
||||
@ -512,7 +512,7 @@ export default {
|
||||
autoresize_bottom_margin: 2,
|
||||
min_height: 200,
|
||||
max_height: 380,
|
||||
contextmenu: 'bold italic underline forecolor backcolor | codesample | uploadImages browseImages | preview screenload',
|
||||
contextmenu: 'bold italic underline forecolor backcolor | codesample | uploadImages imagePreview | preview screenload',
|
||||
valid_elements : 'a[href|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code',
|
||||
toolbar: false
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user