2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
8 function createFakeElement( editor, realElement )
10 var fakeElement = editor.createFakeParserElement( realElement, 'cke_iframe', 'iframe', true ),
11 fakeStyle = fakeElement.attributes.style || '';
13 var width = realElement.attributes.width,
14 height = realElement.attributes.height;
16 if ( typeof width != 'undefined' )
17 fakeStyle += 'width:' + CKEDITOR.tools.cssLength( width ) + ';';
19 if ( typeof height != 'undefined' )
20 fakeStyle += 'height:' + CKEDITOR.tools.cssLength( height ) + ';';
22 fakeElement.attributes.style = fakeStyle;
27 CKEDITOR.plugins.add( 'iframe',
29 requires : [ 'dialog', 'fakeobjects' ],
30 init : function( editor )
32 var pluginName = 'iframe',
33 lang = editor.lang.iframe;
35 CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/iframe.js' );
36 editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) );
41 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.png' ) + ');' +
42 'background-position: center center;' +
43 'background-repeat: no-repeat;' +
44 'border: 1px solid #a9a9a9;' +
50 editor.ui.addButton( 'Iframe',
56 editor.on( 'doubleclick', function( evt )
58 var element = evt.data.element;
59 if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' )
60 evt.data.dialog = 'iframe';
63 if ( editor.addMenuItems )
76 // If the "contextmenu" plugin is loaded, register the listeners.
77 if ( editor.contextMenu )
79 editor.contextMenu.addListener( function( element, selection )
81 if ( element && element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'iframe' )
82 return { iframe : CKEDITOR.TRISTATE_OFF };
86 afterInit : function( editor )
88 var dataProcessor = editor.dataProcessor,
89 dataFilter = dataProcessor && dataProcessor.dataFilter;
97 iframe : function( element )
99 return createFakeElement( editor, element );