loics2
loics2

Reputation: 646

change ckeditor iframe dialog url

I'm developing a ckeditor plugin. I have a iframe dialog like this:

CKEDITOR.dialog.add( 'imageDialog', function ()
            {
               return {
                  title : 'add image',
                  minWidth : 700,
                  minHeight : 360,
                  contents :
                        [
                           {
                              id : 'iframe',
                              label : 'Lien',
                              expand : true,
                              elements :
                                    [
                                       {
                                          type : 'iframe',
                                          src : 'index.php',
                                          width : '100%',
                                          height : '100%',
                                          onContentLoad : function() {
                                          }
                                       }
                                    ]
                           }
                        ],
                  buttons: {disabled:true}
               };
            } );

and I want to change the src url each time the dialog opens. How can I do this?

Upvotes: 1

Views: 2836

Answers (2)

ASeymour
ASeymour

Reputation: 3

I would assume the previous correct answer works for version 3 but anyone using version 4 - I found that this works;

this.definition.dialog.definition.contents[0].elements[0].src = iframeurl;

That line in the onShow : function() { } works at changing the iframe url. There may be a better way to do it but I didn't find it.

Upvotes: 0

loics2
loics2

Reputation: 646

I succeeded to do what I want! I added a onShow function to my dialog, containing:

this.definition.getContents('iframe').elements[0].src = iframeurl;

Upvotes: 1

Related Questions