X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fimage%2Fdialogs%2Fimage.js;h=b194a5d5fd65857bc815509eebaf352276520010;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hp=d8eb5810c5cad17c75ad3e62db1cdddf8720027c;hpb=055b6b0792ce7dc53d47af606b367c04b927c2ab;p=ckeditor.git diff --git a/_source/plugins/image/dialogs/image.js b/_source/plugins/image/dialogs/image.js index d8eb581..b194a5d 100644 --- a/_source/plugins/image/dialogs/image.js +++ b/_source/plugins/image/dialogs/image.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, 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 */ @@ -250,7 +250,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license switchLockRatio( this, false ); // Unlock. }; - var numbering = function( id ){ return id + CKEDITOR.tools.getNextNumber(); }, + var numbering = function( id ) + { + return CKEDITOR.tools.getNextId() + '_' + id; + }, btnLockSizesId = numbering( 'btnLockSizes' ), btnResetSizeId = numbering( 'btnResetSize' ), imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ), @@ -259,9 +262,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license previewImageId = numbering( 'previewImage' ); return { - title : ( dialogType == 'image' ) ? editor.lang.image.title : editor.lang.image.titleButton, + title : editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ], minWidth : 420, - minHeight : 310, + minHeight : 360, onShow : function() { this.imageElement = false; @@ -316,7 +319,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license this.setupContent( LINK, link ); } - if ( element && element.getName() == 'img' && !element.getAttribute( '_cke_realelement' ) + if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' ) || element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' ) { this.imageEditMode = element.getName(); @@ -530,7 +533,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( type == IMAGE ) { - var url = element.getAttribute( '_cke_saved_src' ) || element.getAttribute( 'src' ); + var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' ); var field = this; this.getDialog().dontResetSize = true; @@ -538,15 +541,14 @@ For licensing, see LICENSE.html or http://ckeditor.com/license field.setValue( url ); // And call this.onChange() // Manually set the initial value.(#4191) field.setInitValue(); - field.focus(); } }, commit : function( type, element ) { if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) { - element.setAttribute( '_cke_saved_src', decodeURI( this.getValue() ) ); - element.setAttribute( 'src', decodeURI( this.getValue() ) ); + element.data( 'cke-saved-src', this.getValue() ); + element.setAttribute( 'src', this.getValue() ); } else if ( type == CLEANUP ) { @@ -605,17 +607,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }, { type : 'hbox', - widths : [ '140px', '240px' ], children : [ { type : 'vbox', - padding : 10, children : [ { type : 'hbox', - widths : [ '70%', '30%' ], + widths : [ '50%', '50%' ], children : [ { @@ -627,8 +627,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license type : 'text', width: '40px', id : 'txtWidth', - labelLayout : 'horizontal', - label : editor.lang.image.width, + label : editor.lang.common.width, onKeyUp : onSizeChange, onChange : function() { @@ -638,7 +637,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var aMatch = this.getValue().match( regexGetSizeOrEmpty ); if ( !aMatch ) - alert( editor.lang.image.validateWidth ); + alert( editor.lang.common.invalidWidth ); return !!aMatch; }, setup : setupDimension, @@ -677,8 +676,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license type : 'text', id : 'txtHeight', width: '40px', - labelLayout : 'horizontal', - label : editor.lang.image.height, + label : editor.lang.common.height, onKeyUp : onSizeChange, onChange : function() { @@ -688,7 +686,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var aMatch = this.getValue().match( regexGetSizeOrEmpty ); if ( !aMatch ) - alert( editor.lang.image.validateHeight ); + alert( editor.lang.common.invalidHeight ); return !!aMatch; }, setup : setupDimension, @@ -728,7 +726,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }, { type : 'html', - style : 'margin-top:10px;width:40px;height:40px;', + style : 'margin-top:30px;width:40px;height:40px;', onLoad : function() { // Activate Reset button @@ -798,7 +796,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license type : 'text', id : 'txtBorder', width: '60px', - labelLayout : 'horizontal', label : editor.lang.image.border, 'default' : '', onKeyUp : function() @@ -855,7 +852,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license type : 'text', id : 'txtHSpace', width: '60px', - labelLayout : 'horizontal', label : editor.lang.image.hSpace, 'default' : '', onKeyUp : function() @@ -919,7 +915,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license type : 'text', id : 'txtVSpace', width : '60px', - labelLayout : 'horizontal', label : editor.lang.image.vSpace, 'default' : '', onKeyUp : function() @@ -981,16 +976,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { id : 'cmbAlign', type : 'select', - labelLayout : 'horizontal', widths : [ '35%','65%' ], style : 'width:90px', - label : editor.lang.image.align, + label : editor.lang.common.align, 'default' : '', items : [ [ editor.lang.common.notSet , ''], - [ editor.lang.image.alignLeft , 'left'], - [ editor.lang.image.alignRight , 'right'] + [ editor.lang.common.alignLeft , 'left'], + [ editor.lang.common.alignRight , 'right'] // Backward compatible with v2 on setup when specified as attribute value, // while these values are no more available as select options. // [ editor.lang.image.alignAbsBottom , 'absBottom'], @@ -1096,7 +1090,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( type == LINK ) { - var href = element.getAttribute( '_cke_saved_href' ); + var href = element.data( 'cke-saved-href' ); if ( !href ) href = element.getAttribute( 'href' ); this.setValue( href ); @@ -1108,9 +1102,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( this.getValue() || this.isChanged() ) { - element.setAttribute( '_cke_saved_href', decodeURI( this.getValue() ) ); - element.setAttribute( 'href', 'javascript:void(0)/*' + - CKEDITOR.tools.getNextNumber() + '*/' ); + var url = decodeURI( this.getValue() ); + element.data( 'cke-saved-href', url ); + element.setAttribute( 'href', url ); if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL ) this.getDialog().addLink = true; @@ -1125,7 +1119,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { action : 'Browse', target: 'Link:txtUrl', - url: editor.config.filebrowserImageBrowseLinkUrl || editor.config.filebrowserBrowseUrl + url: editor.config.filebrowserImageBrowseLinkUrl }, style : 'float:right', hidden : true, @@ -1147,7 +1141,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license setup : function( type, element ) { if ( type == LINK ) - this.setValue( element.getAttribute( 'target' ) ); + this.setValue( element.getAttribute( 'target' ) || '' ); }, commit : function( type, element ) {