使用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内容框中,但无法移动或调整其大小。有什么想法吗?
谢谢!