X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fimage%2Fdialogs%2Fimage.js;h=9c4ceecfc4b4ad3f570e39e80a34aa4259037447;hp=9b127c983e9cdfc08d10baddc78c30a905a81e6d;hb=c6e377a02b54abc07129d72b632763c727476a15;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6 diff --git a/_source/plugins/image/dialogs/image.js b/_source/plugins/image/dialogs/image.js index 9b127c9..9c4ceec 100644 --- a/_source/plugins/image/dialogs/image.js +++ b/_source/plugins/image/dialogs/image.js @@ -85,14 +85,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // size change should alter inline-style text as well. function commitInternally( targetFields ) { - if( incommit ) + if ( incommit ) return; incommit = 1; var dialog = this.getDialog(), element = dialog.imageElement; - if( element ) + if ( element ) { // Commit this field and broadcast to target fields. this.commit( IMAGE, element ); @@ -385,7 +385,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license this.commitContent( LINK, this.linkElement ); // Remove empty style attribute. - if( !this.imageElement.getAttribute( 'style' ) ) + if ( !this.imageElement.getAttribute( 'style' ) ) this.imageElement.removeAttribute( 'style' ); // Insert a new Image. @@ -682,7 +682,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license else if ( !value && this.isChanged( ) ) element.removeStyle( 'height' ); - if( !internalCommit && type == IMAGE ) + if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'height' ); } else if ( type == PREVIEW ) @@ -716,9 +716,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license ratioButton = CKEDITOR.document.getById( 'btnLockSizes' ); if ( resetButton ) { - resetButton.on( 'click', function() + resetButton.on( 'click', function(evt) { resetSize( this ); + evt.data.preventDefault(); }, this.getDialog() ); resetButton.on( 'mouseover', function() { @@ -732,7 +733,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Activate (Un)LockRatio button if ( ratioButton ) { - ratioButton.on( 'click', function() + ratioButton.on( 'click', function(evt) { var locked = switchLockRatio( this ), oImageOriginal = this.originalElement, @@ -747,6 +748,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license updatePreview( this ); } } + evt.data.preventDefault(); }, this.getDialog() ); ratioButton.on( 'mouseover', function() { @@ -798,11 +800,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var value, borderStyle = element.getStyle( 'border-width' ); - borderStyle = borderStyle && borderStyle.match( /^(\d+px)(?: \1 \1 \1)?$/ ); value = borderStyle && parseInt( borderStyle[ 1 ], 10 ); - !value && ( value = element.getAttribute( 'border' ) ); - + isNaN ( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'border' ) ); this.setValue( value ); } }, @@ -811,7 +811,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var value = parseInt( this.getValue(), 10 ); if ( type == IMAGE || type == PREVIEW ) { - if ( value ) + if ( !isNaN( value ) ) { element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) ); element.setStyle( 'border-style', 'solid' ); @@ -823,7 +823,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license element.removeStyle( 'border-color' ); } - if( !internalCommit && type == IMAGE ) + if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'border' ); } else if ( type == CLEANUP ) @@ -871,7 +871,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license marginRightPx = parseInt( marginRightStyle, 10 ); value = ( marginLeftPx == marginRightPx ) && marginLeftPx; - !value && ( value = element.getAttribute( 'hspace' ) ); + isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'hspace' ) ); this.setValue( value ); } @@ -881,7 +881,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var value = parseInt( this.getValue(), 10 ); if ( type == IMAGE || type == PREVIEW ) { - if ( value ) + if ( !isNaN( value ) ) { element.setStyle( 'margin-left', CKEDITOR.tools.cssLength( value ) ); element.setStyle( 'margin-right', CKEDITOR.tools.cssLength( value ) ); @@ -892,7 +892,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license element.removeStyle( 'margin-right' ); } - if( !internalCommit && type == IMAGE ) + if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'hspace' ); } else if ( type == CLEANUP ) @@ -939,7 +939,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license marginBottomPx = parseInt( marginBottomStyle, 10 ); value = ( marginTopPx == marginBottomPx ) && marginTopPx; - !value && ( value = element.getAttribute( 'vspace' ) ); + isNaN ( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'vspace' ) ); this.setValue( value ); } }, @@ -948,7 +948,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var value = parseInt( this.getValue(), 10 ); if ( type == IMAGE || type == PREVIEW ) { - if ( value ) + if ( !isNaN( value ) ) { element.setStyle( 'margin-top', CKEDITOR.tools.cssLength( value ) ); element.setStyle( 'margin-bottom', CKEDITOR.tools.cssLength( value ) ); @@ -959,7 +959,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license element.removeStyle( 'margin-bottom' ); } - if( !internalCommit && type == IMAGE ) + if ( !internalCommit && type == IMAGE ) element.removeAttribute( 'vspace' ); } else if ( type == CLEANUP ) @@ -1022,10 +1022,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( value ) element.setStyle( 'float', value ); - else if ( !value && this.isChanged( ) ) + else element.removeStyle( 'float' ); - if( !internalCommit && type == IMAGE ) + if ( !internalCommit && type == IMAGE ) { value = ( element.getAttribute( 'align' ) || '' ).toLowerCase(); switch( value ) @@ -1111,7 +1111,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { type : 'button', id : 'browse', - filebrowser : 'Link:txtUrl', + filebrowser : + { + action : 'Browse', + target: 'Link:txtUrl', + url: editor.config.filebrowserImageBrowseLinkUrl || editor.config.filebrowserBrowseUrl + }, style : 'float:right', hidden : true, label : editor.lang.common.browseServer