有没有更好的方法让HTML5 与tinyMCE一起使用?

我的目标是使用tinyMCE图像插件将图像文件直接上传到html内容区域。 由于安全性和跨浏览器function,我希望这使用文件上传控件。

我这样设置TinyMCE:

tinyMCE.init({ selector: '.html-content', menubar: false, statusbar: false, toolbar: 'undo redo | image', plugins: 'image', file_browser_callback: this.getSystemFile }); 

并且getSystemFile的函数定义如下:

  function getSystemFile(field_name, url, type, win) { function upload($fileField, toUpload) { var self = this; var formData = new FormData($fileField.find('form')[0]); $.ajax({ url: '/storage/creator_upload', type: 'POST', data: formData, processData: false, cache: false, contentType: false, dataType: 'json', success: function(json) { if (json.errors) { console.log(json.errors); } else { for (var i = 0; i  0) { $fileField.find('form .form-image-upload')[0].reset(); } else { $fileField.html('
'); var toUpload = []; $fileField.change(':file', function(event) { var fileSelection = event.target.files; for (var i = 0; i BcoreGlobal.maximumUploadSize) { console.log('File exceeds the maximum upload size'); return false; } toUpload.push(file); } return upload($fileField, toUpload); }); } $fileField.find(':file').click(); }

虽然这很有效,而且我能够上传文件,但我希望有更好的方法可以在tinyMCE中使用内置的filepicker类型而不是附加新的表单。