X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fflash%2Fplugin.js;h=7641a9ede575c93e8f5d2cf79c199e368aebede7;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=29117ba231d21f2126d4f410fa6295c2edf2080f;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/flash/plugin.js b/_source/plugins/flash/plugin.js index 29117ba..7641a9e 100644 --- a/_source/plugins/flash/plugin.js +++ b/_source/plugins/flash/plugin.js @@ -1,19 +1,13 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { - var flashFilenameRegex = /\.swf(?:$|\?)/i, - numberRegex = /^\d+(?:\.\d+)?$/; + var flashFilenameRegex = /\.swf(?:$|\?)/i; - function cssifyLength( length ) - { - if ( numberRegex.test( length ) ) - return length + 'px'; - return length; - } + var cssifyLength = CKEDITOR.tools.cssLength; function isFlashEmbed( element ) { @@ -77,12 +71,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }); } + editor.on( 'doubleclick', function( evt ) + { + var element = evt.data.element; + + if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'flash' ) + evt.data.dialog = 'flash'; + }); + // If the "contextmenu" plugin is loaded, register the listeners. if ( editor.contextMenu ) { editor.contextMenu.addListener( function( element, selection ) { - if ( element && element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' ) + if ( element && element.is( 'img' ) && !element.isReadOnly() + && element.data( 'cke-real-element-type' ) == 'flash' ) return { flash : CKEDITOR.TRISTATE_OFF }; }); } @@ -104,12 +107,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var attributes = element.attributes, classId = attributes.classid && String( attributes.classid ).toLowerCase(); - if ( !classId ) + if ( !classId && !isFlashEmbed( element ) ) { // Look for the inner for ( var i = 0 ; i < element.children.length ; i++ ) { - if ( element.children[ i ].name == 'embed' ) + if ( element.children[ i ].name == 'cke:embed' ) { if ( !isFlashEmbed( element.children[ i ] ) ) return null;