JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.6.1
[ckeditor.git] / _source / plugins / flash / dialogs / flash.js
index 861cc34..20bec0d 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -28,10 +28,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                classid : [ { type : ATTRTYPE_OBJECT, name : 'classid' } ],\r
                codebase : [ { type : ATTRTYPE_OBJECT, name : 'codebase'} ],\r
                pluginspage : [ { type : ATTRTYPE_EMBED, name : 'pluginspage' } ],\r
-               src : [ { type : ATTRTYPE_PARAM, name : 'movie' }, { type : ATTRTYPE_EMBED, name : 'src' } ],\r
+               src : [ { type : ATTRTYPE_PARAM, name : 'movie' }, { type : ATTRTYPE_EMBED, name : 'src' }, { type : ATTRTYPE_OBJECT, name :  'data' } ],\r
                name : [ { type : ATTRTYPE_EMBED, name : 'name' } ],\r
                align : [ { type : ATTRTYPE_OBJECT, name : 'align' } ],\r
-               title : [ { type : ATTRTYPE_OBJECT, name : 'title' }, { type : ATTRTYPE_EMBED, name : 'title' } ],\r
                'class' : [ { type : ATTRTYPE_OBJECT, name : 'class' }, { type : ATTRTYPE_EMBED, name : 'class'} ],\r
                width : [ { type : ATTRTYPE_OBJECT, name : 'width' }, { type : ATTRTYPE_EMBED, name : 'width' } ],\r
                height : [ { type : ATTRTYPE_OBJECT, name : 'height' }, { type : ATTRTYPE_EMBED, name : 'height' } ],\r
@@ -49,6 +48,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 +125,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
@@ -190,7 +192,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                // Try to detect any embed or object tag that has Flash parameters.\r
                                var fakeImage = this.getSelectedElement();\r
-                               if ( fakeImage && fakeImage.getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'flash' )\r
+                               if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'flash' )\r
                                {\r
                                        this.fakeImage = fakeImage;\r
 \r
@@ -365,47 +367,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                        type : 'text',\r
                                                                        id : 'width',\r
                                                                        style : 'width:95px',\r
-                                                                       label : editor.lang.flash.width,\r
-                                                                       validate : CKEDITOR.dialog.validate.integer( editor.lang.flash.validateWidth ),\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
+                                                                       label : editor.lang.common.width,\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.flash.height,\r
-                                                                       validate : CKEDITOR.dialog.validate.integer( editor.lang.flash.validateHeight ),\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
+                                                                       label : editor.lang.common.height,\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
@@ -558,21 +532,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                {\r
                                                                        id : 'align',\r
                                                                        type : 'select',\r
-                                                                       label : editor.lang.flash.align,\r
+                                                                       label : editor.lang.common.align,\r
                                                                        'default' : '',\r
                                                                        style : 'width : 100%;',\r
                                                                        items :\r
                                                                        [\r
                                                                                [ editor.lang.common.notSet , ''],\r
-                                                                               [ editor.lang.flash.alignLeft , 'left'],\r
+                                                                               [ editor.lang.common.alignLeft , 'left'],\r
                                                                                [ editor.lang.flash.alignAbsBottom , 'absBottom'],\r
                                                                                [ editor.lang.flash.alignAbsMiddle , 'absMiddle'],\r
                                                                                [ editor.lang.flash.alignBaseline , 'baseline'],\r
-                                                                               [ editor.lang.flash.alignBottom , 'bottom'],\r
-                                                                               [ editor.lang.flash.alignMiddle , 'middle'],\r
-                                                                               [ editor.lang.flash.alignRight , 'right'],\r
+                                                                               [ editor.lang.common.alignBottom , 'bottom'],\r
+                                                                               [ editor.lang.common.alignMiddle , 'middle'],\r
+                                                                               [ editor.lang.common.alignRight , 'right'],\r
                                                                                [ editor.lang.flash.alignTextTop , 'textTop'],\r
-                                                                               [ editor.lang.flash.alignTop , 'top']\r
+                                                                               [ editor.lang.common.alignTop , 'top']\r
                                                                        ],\r
                                                                        setup : loadValue,\r
                                                                        commit : function( objectNode, embedNode, paramMap, extraStyles, extraAttributes )\r
@@ -643,7 +617,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        [\r
                                                {\r
                                                        type : 'hbox',\r
-                                                       widths : [ '45%', '55%' ],\r
                                                        children :\r
                                                        [\r
                                                                {\r
@@ -652,13 +625,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                        label : editor.lang.common.id,\r
                                                                        setup : loadValue,\r
                                                                        commit : commitValue\r
-                                                               },\r
-                                                               {\r
-                                                                       type : 'text',\r
-                                                                       id : 'title',\r
-                                                                       label : editor.lang.common.advisoryTitle,\r
-                                                                       setup : loadValue,\r
-                                                                       commit : commitValue\r
                                                                }\r
                                                        ]\r
                                                },\r
@@ -686,6 +652,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                {\r
                                                        type : 'text',\r
                                                        id : 'style',\r
+                                                       validate : CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),\r
                                                        label : editor.lang.common.cssStyle,\r
                                                        setup : loadValue,\r
                                                        commit : commitValue\r