我有编辑器 Summernote 的问题。我想将图像上传到服务器上的目录中。我有一些脚本:
<script type="text/javascript">
  $(function () {
    $(\'.summernote\').summernote({
      height: 200
    });
    $(\'.summernote\').summernote({
     height:300,
     onImageUpload: function(files, editor, welEditable) {
      sendFile(files[0],editor,welEditable);
    }
  });
  });
</script>
<script type="text/javascript">
  function sendFile(file, editor, welEditable) {
    data = new FormData();
    data.append("file", file);
    url = "http://localhost/spichlerz/uploads";
    $.ajax({
      data: data,
      type: "POST",
      url: url,
      cache: false,
      contentType: false,
      processData: false,
      success: function (url) {
        editor.insertImage(welEditable, url);
      }
    });
  }
</script>
<td><textarea class="summernote" rows="10" cols="100" name="tekst"></textarea></td>
当然,我有所有的 js 和 CSS 文件。我做错了什么?如果我单击图像上传并转到编辑器,则图像不在 textarea 中。
如果我删除 sendFile 函数和 onImageUpload:图像保存在 base64 上。
链接到summernote:http ://hackerwins.github.io/summernote/