mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:07:06 +00:00
perf: 任务详细描述右键新增预览图片
This commit is contained in:
parent
b90b129d98
commit
4cbc5040a2
@ -235,7 +235,7 @@
|
|||||||
},
|
},
|
||||||
insert: {
|
insert: {
|
||||||
title: "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: [
|
codesample_languages: [
|
||||||
@ -262,13 +262,13 @@
|
|||||||
fetch: (callback) => {
|
fetch: (callback) => {
|
||||||
let items = [{
|
let items = [{
|
||||||
type: 'menuitem',
|
type: 'menuitem',
|
||||||
text: this.$L('上传图片'),
|
text: this.$L('上传本地图片'),
|
||||||
onAction: () => {
|
onAction: () => {
|
||||||
this.$refs.myUpload.handleClick();
|
this.$refs.myUpload.handleClick();
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
type: 'menuitem',
|
type: 'menuitem',
|
||||||
text: this.$L('图片空间'),
|
text: this.$L('浏览已上传图片'),
|
||||||
onAction: () => {
|
onAction: () => {
|
||||||
this.$refs.myUpload.browsePicture();
|
this.$refs.myUpload.browsePicture();
|
||||||
}
|
}
|
||||||
@ -276,16 +276,35 @@
|
|||||||
callback(items);
|
callback(items);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
editor.ui.registry.addMenuItem('uploadImages', {
|
editor.ui.registry.addNestedMenuItem('uploadImages', {
|
||||||
|
icon: 'image',
|
||||||
text: this.$L('上传图片'),
|
text: this.$L('上传图片'),
|
||||||
onAction: () => {
|
getSubmenuItems: () => {
|
||||||
this.$refs.myUpload.handleClick();
|
return [{
|
||||||
|
type: 'menuitem',
|
||||||
|
text: this.$L('上传本地图片'),
|
||||||
|
onAction: () => {
|
||||||
|
this.$refs.myUpload.handleClick();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: 'menuitem',
|
||||||
|
text: this.$L('浏览已上传图片'),
|
||||||
|
onAction: () => {
|
||||||
|
this.$refs.myUpload.browsePicture();
|
||||||
|
}
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
editor.ui.registry.addMenuItem('browseImages', {
|
editor.ui.registry.addMenuItem('imagePreview', {
|
||||||
text: this.$L('图片空间'),
|
text: this.$L('预览图片'),
|
||||||
onAction: () => {
|
onAction: () => {
|
||||||
this.$refs.myUpload.browsePicture();
|
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', {
|
editor.ui.registry.addButton('uploadFiles', {
|
||||||
@ -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) {
|
handleProgress(event, file) {
|
||||||
|
|||||||
@ -209,7 +209,7 @@ export default {
|
|||||||
autoresize_bottom_margin: 2,
|
autoresize_bottom_margin: 2,
|
||||||
min_height: 200,
|
min_height: 200,
|
||||||
max_height: 380,
|
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',
|
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
|
toolbar: false
|
||||||
},
|
},
|
||||||
|
|||||||
@ -512,7 +512,7 @@ export default {
|
|||||||
autoresize_bottom_margin: 2,
|
autoresize_bottom_margin: 2,
|
||||||
min_height: 200,
|
min_height: 200,
|
||||||
max_height: 380,
|
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',
|
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
|
toolbar: false
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user