1

我在我的web应用程序中放入了summernote编辑器。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); 
      } 
     } 
    }); 

回答

1

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

+0

感谢从开发一个答案! –