JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / plugins / flash / plugin.js
index 21772f3..97f8a12 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -7,8 +7,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 {\r
        var flashFilenameRegex = /\.swf(?:$|\?)/i;\r
 \r
-       var cssifyLength = CKEDITOR.tools.cssLength;\r
-\r
        function isFlashEmbed( element )\r
        {\r
                var attributes = element.attributes;\r
@@ -18,19 +16,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
        function createFakeElement( editor, realElement )\r
        {\r
-               var fakeElement = editor.createFakeParserElement( realElement, 'cke_flash', 'flash', true ),\r
-                       fakeStyle = fakeElement.attributes.style || '';\r
-\r
-               var width = realElement.attributes.width,\r
-                       height = realElement.attributes.height;\r
-\r
-               if ( typeof width != 'undefined' )\r
-                       fakeStyle = fakeElement.attributes.style = fakeStyle + 'width:' + cssifyLength( width ) + ';';\r
-\r
-               if ( typeof height != 'undefined' )\r
-                       fakeStyle = fakeElement.attributes.style = fakeStyle + 'height:' + cssifyLength( height ) + ';';\r
-\r
-               return fakeElement;\r
+               return editor.createFakeParserElement( realElement, 'cke_flash', 'flash', true );\r
        }\r
 \r
        CKEDITOR.plugins.add( 'flash',\r
@@ -75,7 +61,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                {\r
                                        var element = evt.data.element;\r
 \r
-                                       if ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' )\r
+                                       if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'flash' )\r
                                                evt.data.dialog = 'flash';\r
                                });\r
 \r
@@ -85,7 +71,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                editor.contextMenu.addListener( function( element, selection )\r
                                        {\r
                                                if ( element && element.is( 'img' ) && !element.isReadOnly()\r
-                                                               && element.getAttribute( '_cke_real_element_type' ) == 'flash' )\r
+                                                               && element.data( 'cke-real-element-type' ) == 'flash' )\r
                                                        return { flash : CKEDITOR.TRISTATE_OFF };\r
                                        });\r
                        }\r
@@ -107,7 +93,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                var attributes = element.attributes,\r
                                                                        classId = attributes.classid && String( attributes.classid ).toLowerCase();\r
 \r
-                                                               if ( !classId )\r
+                                                               if ( !classId && !isFlashEmbed( element ) )\r
                                                                {\r
                                                                        // Look for the inner <embed>\r
                                                                        for ( var i = 0 ; i < element.children.length ; i++ )\r