首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >summernote拖放选项不工作

summernote拖放选项不工作
EN

Stack Overflow用户
提问于 2016-02-12 13:13:17
回答 1查看 5.8K关注 0票数 4

我在我的web应用程序中添加了summernote编辑器。

我发现它仍然可以拖放图像到编辑区域。当然,我用下面的代码阻止了summernote输入。(下面的方法在summernote官方站点中提供)

代码语言:javascript
复制
summernote.summernote('disable');
summernote.summernote({
    disableDragAndDrop : true
});

我还能尝试什么?

我已经初始化了我的暑期笔记就像..。

代码语言:javascript
复制
    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);
            } 
        }
    }); 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-16 12:38:09

Summernote不会动态更新它的选项。在创建编辑器时,应该传递disableDragAndDrop选项。例如..。

代码语言:javascript
复制
// 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

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35363534

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档