JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / plugins / flash / dialogs / flash.js
index 997ced0..8cdf10e 100644 (file)
@@ -49,6 +49,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
        for ( i = 0 ; i < names.length ; i++ )\r
                attributesMap[ names[i] ][0]['default'] = attributesMap[ names[i] ][1]['default'] = true;\r
 \r
+       var defaultToPixel = CKEDITOR.tools.cssLength;\r
+\r
        function loadValue( objectNode, embedNode, paramMap )\r
        {\r
                var attributes = attributesMap[ this.id ];\r
@@ -124,7 +126,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        switch ( attrDef.type )\r
                        {\r
                                case ATTRTYPE_OBJECT:\r
-                                       if ( !objectNode )\r
+                                       // Avoid applying the data attribute when not needed (#7733)\r
+                                       if ( !objectNode || ( attrDef.name == 'data' && embedNode && !objectNode.hasAttribute( 'data' ) ) )\r
                                                continue;\r
                                        var value = this.getValue();\r
                                        if ( isRemove || isCheckbox && value === attrDef[ 'default' ] )\r
@@ -366,46 +369,18 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                        id : 'width',\r
                                                                        style : 'width:95px',\r
                                                                        label : editor.lang.common.width,\r
-                                                                       validate : CKEDITOR.dialog.validate.integer( editor.lang.common.invalidWidth ),\r
-                                                                       setup : function( objectNode, embedNode, paramMap, fakeImage )\r
-                                                                       {\r
-                                                                               loadValue.apply( this, arguments );\r
-                                                                               if ( fakeImage )\r
-                                                                               {\r
-                                                                                       var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 );\r
-                                                                                       if ( !isNaN( fakeImageWidth ) )\r
-                                                                                               this.setValue( fakeImageWidth );\r
-                                                                               }\r
-                                                                       },\r
-                                                                       commit : function( objectNode, embedNode, paramMap, extraStyles )\r
-                                                                       {\r
-                                                                               commitValue.apply( this, arguments );\r
-                                                                               if ( this.getValue() )\r
-                                                                                       extraStyles.width = this.getValue() + 'px';\r
-                                                                       }\r
+                                                                       validate : CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.width ) ),\r
+                                                                       setup : loadValue,\r
+                                                                       commit : commitValue\r
                                                                },\r
                                                                {\r
                                                                        type : 'text',\r
                                                                        id : 'height',\r
                                                                        style : 'width:95px',\r
                                                                        label : editor.lang.common.height,\r
-                                                                       validate : CKEDITOR.dialog.validate.integer( editor.lang.common.invalidHeight ),\r
-                                                                       setup : function( objectNode, embedNode, paramMap, fakeImage )\r
-                                                                       {\r
-                                                                               loadValue.apply( this, arguments );\r
-                                                                               if ( fakeImage )\r
-                                                                               {\r
-                                                                                       var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 );\r
-                                                                                       if ( !isNaN( fakeImageHeight ) )\r
-                                                                                               this.setValue( fakeImageHeight );\r
-                                                                               }\r
-                                                                       },\r
-                                                                       commit : function( objectNode, embedNode, paramMap, extraStyles )\r
-                                                                       {\r
-                                                                               commitValue.apply( this, arguments );\r
-                                                                               if ( this.getValue() )\r
-                                                                                       extraStyles.height = this.getValue() + 'px';\r
-                                                                       }\r
+                                                                       validate : CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.height ) ),\r
+                                                                       setup : loadValue,\r
+                                                                       commit : commitValue\r
                                                                },\r
                                                                {\r
                                                                        type : 'text',\r