ckeditor 初始化隐藏问题

https://ckeditor.com/ckeditor-4/ 官网地址

  • 翻看源码和api文档,发现没有隐藏和显示的功能,只能通过初始化和销毁来创建。
  $("#showCkEditor").click(function () {
                let self = $(this);
                if (self.data("lock")) { //防止重复创建
                    return;
                } else {
                    self.data("lock", true);
                }'
                
                if (CKEDITOR.env.ie && CKEDITOR.env.version < 9)
                    CKEDITOR.tools.enableHtml5Elements(document);

                try {
                    //CKEDITOR.instances.noticeEditorId.destroy();
                    //这块不太好用 销毁在重建就会报错``
                } catch (ex) {

                }

                CKEDITOR.config.height = 550;
                CKEDITOR.config.width = 'auto';
                CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
                CKEDITOR.config.shiftEnterMode = CKEDITOR.ENTER_P;
                CKEDITOR.config.linkDefaultProtocol = "https://"

                CKEDITOR.replace('noticeEditorId',
                    {
                        toolbarGroups: [
                            { name: 'document', groups: ['mode', 'document', 'doctools'] },
                            { name: 'basicstyles', groups: ['cleanup', 'basicstyles'] },
                            { name: 'clipboard', groups: ['undo', 'clipboard'] },
                            { name: 'editing', groups: ['find', 'selection', 'spellchecker', 'editing'] },
                            { name: 'links', groups: ['links'] },
                            { name: 'insert', groups: ['insert'] },
                            { name: 'tools', groups: ['tools'] },
                            '/',
                            { name: 'colors', groups: ['colors'] },
                            { name: 'styles', groups: ['styles'] },
                            { name: 'paragraph', groups: ['list', 'indent', 'align', 'blocks', 'bidi', 'paragraph'] },
                            { name: 'forms', groups: ['forms'] },
                            '/',
                            { name: 'others', groups: ['others'] },
                            { name: 'about', groups: ['about'] }
                        ],
                        removeButtons: 'Save,NewPage,ExportPdf,Preview,Print,About,Superscript,Subscript,Find,Replace,Scayt,Form,ImageButton,HiddenField,CreateDiv,BidiLtr,BidiRtl,Language,Iframe,PageBreak',
                     
                        filebrowserUploadUrl: '' 图片上传地址"
                    });
                try {
                    CKEDITOR.instances.noticeEditorId.setData(DataBody.Intro);
                } catch (ex) {
                    console.log(ex.message);
                }
            });
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值