服务器上传后,Summernote无法调整大小或移动图像

时间:2019-05-29 13:22:01

标签: javascript jquery summernote

使用summernote作为我的所见即所得。当您将图像上传到summernote时,它将转换为base64。然后,您可以调整大小和移动它。但是,将其上传到服务器后,这些功能将不再可用。

upload.js

$('.summernote').summernote({
  height: 150,
  toolbar: [
    ['style',['style']],
    ['style', ['bold', 'italic', 'underline', 'clear']],
    ['font', ['strikethrough', 'superscript', 'subscript']],
    ['fontsize', ['fontsize']],
    ['color', ['color']],
    ['para', ['ul', 'ol', 'paragraph']],
    ["table", ["table"]],
    ['insert',['picture', 'link']],
    ["view", ["codeview", "help"]]
  ],
  callbacks: {
    onImageUpload: function(image) {
      var data = new FormData();
      data.append("image", image[0]);

      $.ajax({
        url: "/upload_images.php",
        cache: false,
        contentType: false,
        processData: false,
        data: data,
        type: "post",
        success: function(result) {
            var image = $('<img>').attr('src', result.url);
            $(this).summernote("insertNode", image[0]);
        }
      });
    }
  }
});

图片上传后,它会出现在summernote内容框中,但无法移动或调整其大小。有什么想法吗?

谢谢!

0 个答案:

没有答案