X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fflash%2Fdialogs%2Fflash.js;h=8cdf10e29b5845ea3d07d2de4fc3d86a4529450e;hb=refs%2Ftags%2Fv3.6.1;hp=4af379f8dda3dcaffb43b7547481365e80af6b49;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;p=ckeditor.git diff --git a/_source/plugins/flash/dialogs/flash.js b/_source/plugins/flash/dialogs/flash.js index 4af379f..8cdf10e 100644 --- a/_source/plugins/flash/dialogs/flash.js +++ b/_source/plugins/flash/dialogs/flash.js @@ -1,5 +1,5 @@ /* -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 */ @@ -28,7 +28,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license classid : [ { type : ATTRTYPE_OBJECT, name : 'classid' } ], codebase : [ { type : ATTRTYPE_OBJECT, name : 'codebase'} ], pluginspage : [ { type : ATTRTYPE_EMBED, name : 'pluginspage' } ], - src : [ { type : ATTRTYPE_PARAM, name : 'movie' }, { type : ATTRTYPE_EMBED, name : 'src' } ], + src : [ { type : ATTRTYPE_PARAM, name : 'movie' }, { type : ATTRTYPE_EMBED, name : 'src' }, { type : ATTRTYPE_OBJECT, name : 'data' } ], name : [ { type : ATTRTYPE_EMBED, name : 'name' } ], align : [ { type : ATTRTYPE_OBJECT, name : 'align' } ], title : [ { type : ATTRTYPE_OBJECT, name : 'title' }, { type : ATTRTYPE_EMBED, name : 'title' } ], @@ -49,6 +49,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license for ( i = 0 ; i < names.length ; i++ ) attributesMap[ names[i] ][0]['default'] = attributesMap[ names[i] ][1]['default'] = true; + var defaultToPixel = CKEDITOR.tools.cssLength; + function loadValue( objectNode, embedNode, paramMap ) { var attributes = attributesMap[ this.id ]; @@ -124,7 +126,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license switch ( attrDef.type ) { case ATTRTYPE_OBJECT: - if ( !objectNode ) + // Avoid applying the data attribute when not needed (#7733) + if ( !objectNode || ( attrDef.name == 'data' && embedNode && !objectNode.hasAttribute( 'data' ) ) ) continue; var value = this.getValue(); if ( isRemove || isCheckbox && value === attrDef[ 'default' ] ) @@ -173,9 +176,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var makeObjectTag = !editor.config.flashEmbedTagOnly, makeEmbedTag = editor.config.flashAddEmbedTag || editor.config.flashEmbedTagOnly; - var previewAreaHtml = '
' + CKEDITOR.tools.htmlEncode( editor.lang.image.preview ) +'
' + - '' + - '
'; + var previewPreloader, + previewAreaHtml = '
' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) +'
' + + '' + + '
'; return { title : editor.lang.flash.title, @@ -185,10 +189,11 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { // Clear previously saved elements. this.fakeImage = this.objectNode = this.embedNode = null; + previewPreloader = new CKEDITOR.dom.element( 'embed', editor.document ); // Try to detect any embed or object tag that has Flash parameters. var fakeImage = this.getSelectedElement(); - if ( fakeImage && fakeImage.getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'flash' ) + if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'flash' ) { this.fakeImage = fakeImage; @@ -263,12 +268,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license paramMap[ paramList.getItem( i ).getAttribute( 'name' ) ] = paramList.getItem( i ); } - // Apply or remove flash parameters. - var extraStyles = {}; - this.commitContent( objectNode, embedNode, paramMap, extraStyles ); + // A subset of the specified attributes/styles + // should also be applied on the fake element to + // have better visual effect. (#5240) + var extraStyles = {}, extraAttributes = {}; + this.commitContent( objectNode, embedNode, paramMap, extraStyles, extraAttributes ); // Refresh the fake image. var newFakeImage = editor.createFakeElement( objectNode || embedNode, 'cke_flash', 'flash', true ); + newFakeImage.setAttributes( extraAttributes ); newFakeImage.setStyles( extraStyles ); if ( this.fakeImage ) { @@ -298,10 +306,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license children : [ { - type : 'html', - html : '' + CKEDITOR.tools.htmlEncode( editor.lang.image.url ) + '' - }, - { type : 'hbox', widths : [ '280px', '110px' ], align : 'right', @@ -310,7 +314,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { id : 'src', type : 'text', - label : '', + label : editor.lang.common.url, + required : true, validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.flash.validateSrc ), setup : loadValue, commit : commitValue, @@ -318,9 +323,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var dialog = this.getDialog(), updatePreview = function( src ){ - + // Query the preloader to figure out the url impacted by based href. + previewPreloader.setAttribute( 'src', src ); dialog.preview.setHtml( '' ); }; // Preview element @@ -344,7 +350,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license id : 'browse', filebrowser : 'info:src', hidden : true, - align : 'center', + // v-align with the 'src' field. + // TODO: We need something better than a fixed size here. + style : 'display:inline-block;margin-top:10px;', label : editor.lang.common.browseServer } ] @@ -360,47 +368,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license type : 'text', id : 'width', style : 'width:95px', - label : editor.lang.flash.width, - validate : CKEDITOR.dialog.validate.integer( editor.lang.flash.validateWidth ), - setup : function( objectNode, embedNode, paramMap, fakeImage ) - { - loadValue.apply( this, arguments ); - if ( fakeImage ) - { - var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 ); - if ( !isNaN( fakeImageWidth ) ) - this.setValue( fakeImageWidth ); - } - }, - commit : function( objectNode, embedNode, paramMap, extraStyles ) - { - commitValue.apply( this, arguments ); - if ( this.getValue() ) - extraStyles.width = this.getValue() + 'px'; - } + label : editor.lang.common.width, + validate : CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.width ) ), + setup : loadValue, + commit : commitValue }, { type : 'text', id : 'height', style : 'width:95px', - label : editor.lang.flash.height, - validate : CKEDITOR.dialog.validate.integer( editor.lang.flash.validateHeight ), - setup : function( objectNode, embedNode, paramMap, fakeImage ) - { - loadValue.apply( this, arguments ); - if ( fakeImage ) - { - var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 ); - if ( !isNaN( fakeImageHeight ) ) - this.setValue( fakeImageHeight ); - } - }, - commit : function( objectNode, embedNode, paramMap, extraStyles ) - { - commitValue.apply( this, arguments ); - if ( this.getValue() ) - extraStyles.height = this.getValue() + 'px'; - } + label : editor.lang.common.height, + validate : CKEDITOR.dialog.validate.htmlLength( editor.lang.common.invalidHtmlLength.replace( '%1', editor.lang.common.height ) ), + setup : loadValue, + commit : commitValue }, { type : 'text', @@ -553,24 +533,29 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { id : 'align', type : 'select', - label : editor.lang.flash.align, + label : editor.lang.common.align, 'default' : '', style : 'width : 100%;', items : [ [ editor.lang.common.notSet , ''], - [ editor.lang.image.alignLeft , 'left'], - [ editor.lang.image.alignAbsBottom , 'absBottom'], - [ editor.lang.image.alignAbsMiddle , 'absMiddle'], - [ editor.lang.image.alignBaseline , 'baseline'], - [ editor.lang.image.alignBottom , 'bottom'], - [ editor.lang.image.alignMiddle , 'middle'], - [ editor.lang.image.alignRight , 'right'], - [ editor.lang.image.alignTextTop , 'textTop'], - [ editor.lang.image.alignTop , 'top'] + [ editor.lang.common.alignLeft , 'left'], + [ editor.lang.flash.alignAbsBottom , 'absBottom'], + [ editor.lang.flash.alignAbsMiddle , 'absMiddle'], + [ editor.lang.flash.alignBaseline , 'baseline'], + [ editor.lang.common.alignBottom , 'bottom'], + [ editor.lang.common.alignMiddle , 'middle'], + [ editor.lang.common.alignRight , 'right'], + [ editor.lang.flash.alignTextTop , 'textTop'], + [ editor.lang.common.alignTop , 'top'] ], setup : loadValue, - commit : commitValue + commit : function( objectNode, embedNode, paramMap, extraStyles, extraAttributes ) + { + var value = this.getValue(); + commitValue.apply( this, arguments ); + value && ( extraAttributes.align = value ); + } }, { type : 'html', @@ -579,45 +564,48 @@ For licensing, see LICENSE.html or http://ckeditor.com/license ] }, { - type : 'vbox', - padding : 0, + type : 'fieldset', + label : CKEDITOR.tools.htmlEncode( editor.lang.flash.flashvars ), children : [ { - type : 'html', - html : CKEDITOR.tools.htmlEncode( editor.lang.flash.flashvars ) - }, - { - type : 'checkbox', - id : 'menu', - label : editor.lang.flash.chkMenu, - 'default' : true, - setup : loadValue, - commit : commitValue - }, - { - type : 'checkbox', - id : 'play', - label : editor.lang.flash.chkPlay, - 'default' : true, - setup : loadValue, - commit : commitValue - }, - { - type : 'checkbox', - id : 'loop', - label : editor.lang.flash.chkLoop, - 'default' : true, - setup : loadValue, - commit : commitValue - }, - { - type : 'checkbox', - id : 'allowFullScreen', - label : editor.lang.flash.chkFull, - 'default' : true, - setup : loadValue, - commit : commitValue + type : 'vbox', + padding : 0, + children : + [ + { + type : 'checkbox', + id : 'menu', + label : editor.lang.flash.chkMenu, + 'default' : true, + setup : loadValue, + commit : commitValue + }, + { + type : 'checkbox', + id : 'play', + label : editor.lang.flash.chkPlay, + 'default' : true, + setup : loadValue, + commit : commitValue + }, + { + type : 'checkbox', + id : 'loop', + label : editor.lang.flash.chkLoop, + 'default' : true, + setup : loadValue, + commit : commitValue + }, + { + type : 'checkbox', + id : 'allowFullScreen', + label : editor.lang.flash.chkFull, + 'default' : true, + setup : loadValue, + commit : commitValue + } + ] } ] }