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