0
votes

im writing some plugin for ckeditor, its my first time. I have iframe dialog, its apears and show my content.

Now after iframe load, i want to get my editor code, and export it to div in my iframe. But the problem is, I dont know how to find element in 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'); }
    );

I need get my html from editor into #box div in my iframe. And then on click ok, i want to get html from #box into ckeditor.

Anybody can help me? Thanks!

1

1 Answers

0
votes

Try this, seems to be the way to handle it:

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*/
            },
        }
    );