我在我的web应用程序中添加了summernote编辑器。
我发现它仍然可以拖放图像到编辑区域。当然,我用下面的代码阻止了summernote输入。(下面的方法在summernote官方站点中提供)
summernote.summernote('disable');
summernote.summernote({
disableDragAndDrop : true
});我还能尝试什么?
我已经初始化了我的暑期笔记就像..。
var s_note = $('#${id}_summernote');
var summernote = s_note.summernote({
height : 200
, dialogsInBody : true
, toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture', 'hr']],
['view', ['fullscreen', 'codeview']],
['help', ['help']]
]
, callbacks : {
onImageUpload : function(files){
console.log(files);
var img = document.createElement('img');
img.src='http://summernote.org/img/icons/1200x630.png';
uploadWYSIWYGFile(files);
s_note.summernote('insertNode', img);
}
, onChange : function(){
console.log(1);
var richValue = s_note.summernote('code');
valueHolder.val(richValue);
}
}
}); 发布于 2016-02-16 12:38:09
Summernote不会动态更新它的选项。在创建编辑器时,应该传递disableDragAndDrop选项。例如..。
// 01. create editor with options.
$('#summernote').summernote({
disableDragAndDrop:true,
height: 200
});
// 02. then call disable API
$('#summernote').summernote('disable');有关选项的更多细节..。
http://summernote.org/deep-dive/#initialization-options
https://stackoverflow.com/questions/35363534
复制相似问题