繁体   English   中英

ckEditor插件iframe对话框设置html输入

[英]ckEditor plugin iframe dialog set html input

我第一次为ckeditor写一些插件。 我有iframe对话框,其提示并显示我的内容。

现在,在加载iframe之后,我想获取我的编辑器代码,并将其导出到iframe中的div中。 但是问题是,我不知道如何在iframe中查找元素。

CKEDITOR.dialog.addIframe(
        'dragboxDialog',
        'dragbox',
        'mydialog.html', 1295, 850,
        function() {
            this.getElement().hide(); //It s hide the iframe
            this.getElement().find('#box'); //Show error... Find function undefined.
        },
        function() { alert('aaaa'); }
    );

我需要将我的html从编辑器获取到iframe中的#box div中。 然后单击确定,我想将HTML从#box放入ckeditor。

有人可以帮助我吗? 谢谢!

试试看,似乎是处理它的方法:

CKEDITOR.dialog.addIframe(
        'dragboxDialog',
        'dragbox',
        'mydialog.html', 1295, 850,
        function() {
            iframeid=this._.frameId;/*get the iframe*/
        },
        {   
            onOk : function()// Dialog onOk callback.
            {
                texttoadd=$('#return', $('#' + iframeid).contents()).html();/*get the html contents of the element with the id of "return" in the iframe*/
                this._.editor.insertHtml(texttoadd);/*Add that HTML to the editor*/
            },
        }
    );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM