97f8a1242d98f1c18071e94b5e516c119b0aa0ab
2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3 For licensing, see LICENSE.html or http://ckeditor.com/license
8 var flashFilenameRegex
= /\.swf(?:$|\?)/i;
10 function isFlashEmbed( element
)
12 var attributes
= element
.attributes
;
14 return ( attributes
.type
== 'application/x-shockwave-flash' || flashFilenameRegex
.test( attributes
.src
|| '' ) );
17 function createFakeElement( editor
, realElement
)
19 return editor
.createFakeParserElement( realElement
, 'cke_flash', 'flash', true );
22 CKEDITOR
.plugins
.add( 'flash',
24 init : function( editor
)
26 editor
.addCommand( 'flash', new CKEDITOR
.dialogCommand( 'flash' ) );
27 editor
.ui
.addButton( 'Flash',
29 label
: editor
.lang
.common
.flash
,
32 CKEDITOR
.dialog
.add( 'flash', this.path
+ 'dialogs/flash.js' );
37 'background-image: url(' + CKEDITOR
.getUrl( this.path
+ 'images/placeholder.png' ) + ');' +
38 'background-position: center center;' +
39 'background-repeat: no-repeat;' +
40 'border: 1px solid #a9a9a9;' +
46 // If the "menu" plugin is loaded, register the menu items.
47 if ( editor
.addMenuItems
)
53 label
: editor
.lang
.flash
.properties
,
60 editor
.on( 'doubleclick', function( evt
)
62 var element
= evt
.data
.element
;
64 if ( element
.is( 'img' ) && element
.data( 'cke-real-element-type' ) == 'flash' )
65 evt
.data
.dialog
= 'flash';
68 // If the "contextmenu" plugin is loaded, register the listeners.
69 if ( editor
.contextMenu
)
71 editor
.contextMenu
.addListener( function( element
, selection
)
73 if ( element
&& element
.is( 'img' ) && !element
.isReadOnly()
74 && element
.data( 'cke-real-element-type' ) == 'flash' )
75 return { flash
: CKEDITOR
.TRISTATE_OFF
};
80 afterInit : function( editor
)
82 var dataProcessor
= editor
.dataProcessor
,
83 dataFilter
= dataProcessor
&& dataProcessor
.dataFilter
;
91 'cke:object' : function( element
)
93 var attributes
= element
.attributes
,
94 classId
= attributes
.classid
&& String( attributes
.classid
).toLowerCase();
96 if ( !classId
&& !isFlashEmbed( element
) )
98 // Look for the inner <embed>
99 for ( var i
= 0 ; i
< element
.children
.length
; i
++ )
101 if ( element
.children
[ i
].name
== 'cke:embed' )
103 if ( !isFlashEmbed( element
.children
[ i
] ) )
106 return createFakeElement( editor
, element
);
112 return createFakeElement( editor
, element
);
115 'cke:embed' : function( element
)
117 if ( !isFlashEmbed( element
) )
120 return createFakeElement( editor
, element
);
128 requires
: [ 'fakeobjects' ]
132 CKEDITOR
.tools
.extend( CKEDITOR
.config
,
135 * Save as EMBED tag only. This tag is unrecommended.
139 flashEmbedTagOnly
: false,
142 * Add EMBED tag as alternative: <object><embed></embed></object>
146 flashAddEmbedTag
: true,
149 * Use embedTagOnly and addEmbedTag values on edit.
153 flashConvertOnEdit
: false