• fastadmin动态创建的编辑器,无法获取值


    为这些问题,博主做的努力。。。。感天动地

    30个小时,700次百度,500次console.log,终于搞定这个事

    1.动态创建的编辑器,无法获取值的问题?

    其实是可以获取值得,只是,在同步之前,nice validate就做了验证。所以,要重新发起一次验证

    2.使用kindeitor官网的this.sync也不行?

    这个,确实是可以的!确实是可以把编辑器的数据同步到对应的textarea里的。

    3.怎么办?

    首先,为了动态渲染编辑器,要定义好editor组件。参考上一篇文章
    https://www.cnblogs.com/cn-oldboy/p/12852656.html
    接着:在request-form.js编辑器editor:的配置后面,新增一个afterBlur事件

      items: [
                                        'source', 'undo', 'redo', 'preview', 'print', 'template', 'code', 'quote', 'cut', 'copy', 'paste',
                                        'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
                                        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                                        'superscript', 'clearhtml', 'quickformat', 'selectall',
                                        'formatblock', 'fontname', 'fontsize', 'forecolor', 'hilitecolor', 'bold',
                                        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', 'image', 'multiimage', 'graft',
                                        'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
                                        'anchor', 'link', 'unlink', 'remoteimage', 'about', 'fullscreen'
                                    ],
                                    afterBlur: function() {
                                        // 设置编辑器的同步
                                        var self = this;
                                        self.sync();
                                        // 重新触发validate事件,这样就会通过验证
                                        $(that).trigger("validate");
                                        // 触发changed事件,是为了fiedlist的同步监听
                                        $(that).closest(".myeditor").trigger("changed");
    
                                    },
    
  • 相关阅读:
    NFS
    Linux ISO镜像挂载
    Python3.6 提示 ModuleNotFoundError: No module named '_ssl' 模块问题
    mysql 5.7 ERROR 1054(42S22) Unknown column 'password' in ‘field list’ 报错
    Redis + keepalived 高可用行配置检测脚本
    Linux 文件大小查找排序
    查看 Centos 7 的MAC 地址
    Discuz 论坛 (LAMP环境)
    SVN
    systemctl
  • 原文地址:https://www.cnblogs.com/cn-oldboy/p/12854355.html
Copyright © 2020-2023  润新知