0
大家晚上好。CollectionFS流星,所见即所得,Summernote,图片上传
我一直在努力使用WYSIWYG编辑器和collectionFS将文件上传到Meteor工作。我一直在使用Summernote,但我不介意使用Redactor或Froala。
我不够熟练,连接WYSIWYG编辑器和CollectionFS上传文件到本地路径。
这是我的代码。
Template.postSubmit.rendered = function(){
$('#edit').summernote();
};
Template.postSubmit.events({
'submit #postSubmit':function(event, template) {
FS.Utility.eachFile(event, function(file) {
Images.insert(file, function (err, fileObj) {
//Inserted new doc with ID fileObj._id, and kicked off the data upload using HTTP
});
});
}
});
Images = new FS.Collection("images", {
stores: [new FS.Store.FileSystem("images", {path: "img2"})]
});
Images.allow({
insert: function() {
return true;
},
update: function() {
return true;
},
remove: function() {
return true;
},
download: function() {
return true;
}
});
从我短的知识,我在summernote脚本中添加
onImageUpload: function(files, editor, welEditable) {
sendFile(files[0],editor,welEditable);
}
(我知道吗?)。
我似乎无法完成这项工作!指针,指导和帮助,将不胜感激...
EDIT1:
Template.postSubmit.rendered = function(){
$('#edit').summernote({
onImageUpload: function(file) {
FS.Utility.eachFile(event, function(file) {
Images.insert(file, function (err, fileObj) {
//Inserted new doc with ID fileObj._id, and kicked off the data upload using HTTP
});
});
}
});
};
所以我已经编辑我的代码这一点,而现在它是工作!它将文件上传到指定的路径。现在的问题是, 1.它会立即上传图像(只要我点击添加图像,而不是当我提交表单时)。 2.上传的图片不会显示在编辑器中。
http://stackoverflow.com/questions/21628222/summernote-image-upload 希望这有助于。 – Ironic 2015-01-04 06:00:40
这个问题接缝是重复的: https://stackoverflow.com/questions/27449455/collectionfs-meteor-js-summernotewysiwyg-and-file-upload/31512800#31512800我们还没有工作解决方案呢! – daslicht 2015-07-20 09:19:21