change ckeditor iframe dialog url

喜欢而已 提交于 2019-12-24 10:28:02

问题


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?


回答1:


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

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



回答2:


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.



来源:https://stackoverflow.com/questions/12621681/change-ckeditor-iframe-dialog-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!