【问题标题】:Summernote: .summernote with ('code') removes initialization optionsSummernote:带有 ('code') 的 .summernote 删除了初始化选项
【发布时间】:2018-01-09 14:47:25
【问题描述】:

我将summernote初始化为:

$('.summernote').summernote({
            height: ($(window).height() - 300),
            callbacks: {
                onImageUpload: function (image) {
                    alert("image");

                }
            }
        }); 

当我调用函数时

lastAppendedObj.find("textarea[name='html1']").summernote("code", value.html1);

在名为 html1 的 textarea 上,对于该 textarea,onImageUplaod 函数不再被覆盖。这可能是什么原因?谢谢。

【问题讨论】:

    标签: javascript image-uploading summernote


    【解决方案1】:

    当你调用 .summernote("code",anything) 时,它会用默认值覆盖当前的summernote。

    如果你想要带有定义选项的 Summernote,只需在 json 中获取上述参数并传递相同的参数。例如:

    var testJson={
                height: ($(window).height() - 300),
                callbacks: {
                    onImageUpload: function (image) {
                        alert("image");
    
                    }
                }
            }
    
    $('.summernote').summernote(testJson);
    
    lastAppendedObj.find("textarea[name='html1']").summernote(testJson, value.html1);
    

    【讨论】:

    • 它没有填充
    猜你喜欢
    • 2019-01-24
    • 2014-12-19
    • 2017-06-26
    • 1970-01-01
    • 2016-03-29
    • 2018-04-29
    • 2015-08-07
    • 2017-04-02
    • 2018-07-22
    相关资源
    最近更新 更多