2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
8 // Map 'true' and 'false' values to match W3C's specifications
9 // http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5
12 scrolling
: { 'true' : 'yes', 'false' : 'no' },
13 frameborder
: { 'true' : '1', 'false' : '0' }
16 function loadValue( iframeNode
)
18 var isCheckbox
= this instanceof CKEDITOR
.ui
.dialog
.checkbox
;
19 if ( iframeNode
.hasAttribute( this.id
) )
21 var value
= iframeNode
.getAttribute( this.id
);
23 this.setValue( checkboxValues
[ this.id
][ 'true' ] == value
.toLowerCase() );
25 this.setValue( value
);
29 function commitValue( iframeNode
)
31 var isRemove
= this.getValue() === '',
32 isCheckbox
= this instanceof CKEDITOR
.ui
.dialog
.checkbox
,
33 value
= this.getValue();
35 iframeNode
.removeAttribute( this.att
|| this.id
);
36 else if ( isCheckbox
)
37 iframeNode
.setAttribute( this.id
, checkboxValues
[ this.id
][ value
] );
39 iframeNode
.setAttribute( this.att
|| this.id
, value
);
42 CKEDITOR
.dialog
.add( 'iframe', function( editor
)
44 var iframeLang
= editor
.lang
.iframe
,
45 commonLang
= editor
.lang
.common
,
46 dialogadvtab
= editor
.plugins
.dialogadvtab
;
48 title
: iframeLang
.title
,
53 // Clear previously saved elements.
54 this.fakeImage
= this.iframeNode
= null;
56 var fakeImage
= this.getSelectedElement();
57 if ( fakeImage
&& fakeImage
.data( 'cke-real-element-type' ) && fakeImage
.data( 'cke-real-element-type' ) == 'iframe' )
59 this.fakeImage
= fakeImage
;
61 var iframeNode
= editor
.restoreRealElement( fakeImage
);
62 this.iframeNode
= iframeNode
;
64 this.setupContent( iframeNode
);
70 if ( !this.fakeImage
)
71 iframeNode
= new CKEDITOR
.dom
.element( 'iframe' );
73 iframeNode
= this.iframeNode
;
75 // A subset of the specified attributes/styles
76 // should also be applied on the fake element to
77 // have better visual effect. (#5240)
78 var extraStyles
= {}, extraAttributes
= {};
79 this.commitContent( iframeNode
, extraStyles
, extraAttributes
);
81 // Refresh the fake image.
82 var newFakeImage
= editor
.createFakeElement( iframeNode
, 'cke_iframe', 'iframe', true );
83 newFakeImage
.setAttributes( extraAttributes
);
84 newFakeImage
.setStyles( extraStyles
);
87 newFakeImage
.replace( this.fakeImage
);
88 editor
.getSelection().selectElement( newFakeImage
);
91 editor
.insertElement( newFakeImage
);
96 label
: commonLang
.generalTab
,
108 label
: commonLang
.url
,
110 validate
: CKEDITOR
.dialog
.validate
.notEmpty( iframeLang
.noUrl
),
123 style
: 'width:100%',
124 labelLayout
: 'vertical',
125 label
: commonLang
.width
,
126 validate
: CKEDITOR
.dialog
.validate
.htmlLength( commonLang
.invalidHtmlLength
.replace( '%1', commonLang
.width
) ),
133 style
: 'width:100%',
134 labelLayout
: 'vertical',
135 label
: commonLang
.height
,
136 validate
: CKEDITOR
.dialog
.validate
.htmlLength( commonLang
.invalidHtmlLength
.replace( '%1', commonLang
.height
) ),
146 [ commonLang
.notSet
, '' ],
147 [ commonLang
.alignLeft
, 'left' ],
148 [ commonLang
.alignRight
, 'right' ],
149 [ commonLang
.alignTop
, 'top' ],
150 [ commonLang
.alignMiddle
, 'middle' ],
151 [ commonLang
.alignBottom
, 'bottom' ]
153 style
: 'width:100%',
154 labelLayout
: 'vertical',
155 label
: commonLang
.align
,
156 setup : function( iframeNode
, fakeImage
)
158 loadValue
.apply( this, arguments
);
161 var fakeImageAlign
= fakeImage
.getAttribute( 'align' );
162 this.setValue( fakeImageAlign
&& fakeImageAlign
.toLowerCase() || '' );
165 commit : function( iframeNode
, extraStyles
, extraAttributes
)
167 commitValue
.apply( this, arguments
);
168 if ( this.getValue() )
169 extraAttributes
.align
= this.getValue();
176 widths
: [ '50%', '50%' ],
182 label
: iframeLang
.scrolling
,
189 label
: iframeLang
.border
,
197 widths
: [ '50%', '50%' ],
203 label
: commonLang
.name
,
210 label
: commonLang
.advisoryTitle
,
219 label
: commonLang
.longDescr
,
225 dialogadvtab
&& dialogadvtab
.createAdvancedTab( editor
, { id
:1, classes
:1, styles
:1 })