Ticket #6462: 6462_2.patch
File 6462_2.patch, 9.9 KB (added by , 13 years ago) |
---|
-
_source/plugins/iframe/dialogs/iframe.js
123 123 style : 'width:100%', 124 124 labelLayout : 'vertical', 125 125 label : commonLang.width, 126 validate : CKEDITOR.dialog.validate. integer( commonLang.invalidWidth ),126 validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength ), 127 127 setup : function( iframeNode, fakeImage ) 128 128 { 129 129 loadValue.apply( this, arguments ); 130 130 if ( fakeImage ) 131 { 132 var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 ); 133 if ( !isNaN( fakeImageWidth ) ) 134 this.setValue( fakeImageWidth ); 135 } 131 this.setValue( fakeImage.$.style.width ); 136 132 }, 137 133 commit : function( iframeNode, extraStyles ) 138 134 { 139 135 commitValue.apply( this, arguments ); 140 if ( this.getValue() )141 extraStyles.width = this.getValue() + 'px';136 var val = this.getValue(); 137 val && ( extraStyles.width = val ); 142 138 } 143 139 }, 144 140 { … … 147 143 style : 'width:100%', 148 144 labelLayout : 'vertical', 149 145 label : commonLang.height, 150 validate : CKEDITOR.dialog.validate. integer( commonLang.invalidHeight),146 validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength ), 151 147 setup : function( iframeNode, fakeImage ) 152 148 { 153 149 loadValue.apply( this, arguments ); 154 150 if ( fakeImage ) 155 { 156 var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 ); 157 if ( !isNaN( fakeImageHeight ) ) 158 this.setValue( fakeImageHeight ); 159 } 151 this.setValue( fakeImage.$.style.height ); 160 152 }, 161 153 commit : function( iframeNode, extraStyles ) 162 154 { 163 155 commitValue.apply( this, arguments ); 164 if ( this.getValue() )165 extraStyles.height = this.getValue() + 'px';156 var val = this.getValue(); 157 val && ( extraStyles.height = val ); 166 158 } 167 159 }, 168 160 { -
_source/plugins/table/dialogs/table.js
548 548 style : 'width:3em', 549 549 label : editor.lang.table.cellSpace, 550 550 'default' : 1, 551 validate : CKEDITOR.dialog.validate ['number']( editor.lang.table.invalidCellSpacing),551 validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength ), 552 552 setup : function( selectedTable ) 553 553 { 554 554 this.setValue( selectedTable.getAttribute( 'cellSpacing' ) || '' ); … … 567 567 style : 'width:3em', 568 568 label : editor.lang.table.cellPad, 569 569 'default' : 1, 570 validate : CKEDITOR.dialog.validate ['number']( editor.lang.table.invalidCellPadding),570 validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength ), 571 571 setup : function( selectedTable ) 572 572 { 573 573 this.setValue( selectedTable.getAttribute( 'cellPadding' ) || '' ); -
_source/plugins/dialog/plugin.js
2874 2874 { 2875 2875 var notEmptyRegex = /^([a]|[^a])+$/, 2876 2876 integerRegex = /^\d*$/, 2877 numberRegex = /^\d*(?:\.\d+)?$/; 2877 numberRegex = /^\d*(?:\.\d+)?$/, 2878 cssLengthRegex = /(^[+-]?\d+(px|em|ex|in|cm|mm|pt|pc|\%)?$)|^$/i; 2878 2879 2879 2880 CKEDITOR.VALIDATE_OR = 1; 2880 2881 CKEDITOR.VALIDATE_AND = 2; … … 2883 2884 { 2884 2885 functions : function() 2885 2886 { 2887 var args = arguments; 2886 2888 return function() 2887 2889 { 2888 2890 /** … … 2891 2893 * combine validate functions together to make more sophisticated 2892 2894 * validators. 2893 2895 */ 2894 var value = this && this.getValue ? this.getValue() : arg uments[0];2896 var value = this && this.getValue ? this.getValue() : args[ 0 ]; 2895 2897 2896 2898 var msg = undefined, 2897 2899 relation = CKEDITOR.VALIDATE_AND, 2898 2900 functions = [], i; 2899 2901 2900 for ( i = 0 ; i < arg uments.length ; i++ )2902 for ( i = 0 ; i < args.length ; i++ ) 2901 2903 { 2902 if ( typeof( arg uments[i] ) == 'function' )2903 functions.push( arg uments[i] );2904 if ( typeof( args[i] ) == 'function' ) 2905 functions.push( args[i] ); 2904 2906 else 2905 2907 break; 2906 2908 } 2907 2909 2908 if ( i < arg uments.length && typeof( arguments[i] ) == 'string' )2910 if ( i < args.length && typeof( args[i] ) == 'string' ) 2909 2911 { 2910 msg = arg uments[i];2912 msg = args[i]; 2911 2913 i++; 2912 2914 } 2913 2915 2914 if ( i < arg uments.length && typeof( arguments[i]) == 'number' )2915 relation = arg uments[i];2916 if ( i < args.length && typeof( args[i]) == 'number' ) 2917 relation = args[i]; 2916 2918 2917 2919 var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false ); 2918 2920 for ( i = 0 ; i < functions.length ; i++ ) … … 2927 2929 { 2928 2930 if ( msg !== undefined ) 2929 2931 alert( msg ); 2930 if ( this && ( this.select || this.focus ) ) 2931 ( this.select || this.focus )(); 2932 if ( this.select || this.focus ) 2933 { 2934 if ( this.select ) 2935 this.select(); 2936 else 2937 this.focus(); 2938 } 2939 2932 2940 return false; 2933 2941 } 2934 2942 … … 2977 2985 return this.regex( numberRegex, msg ); 2978 2986 }, 2979 2987 2988 'cssLength' : function( msg ) 2989 { 2990 return this.functions( function( val ){ return cssLengthRegex.test( CKEDITOR.tools.trim( val ) ); }, msg ); 2991 }, 2992 2980 2993 equals : function( value, msg ) 2981 2994 { 2982 2995 return this.functions( function( val ){ return val == value; }, msg ); -
_source/lang/en.js
121 121 alignBottom : 'Bottom', 122 122 invalidHeight : 'Height must be a number.', 123 123 invalidWidth : 'Width must be a number.', 124 invalidCssLength : 'Value must be in CSS length unit.', 124 125 125 126 // Put the voice-only part of the label in the span. 126 127 unavailable : '%1<span class="cke_accessibility">, unavailable</span>' … … 271 272 invalidBorder : 'Border size must be a number.', 272 273 invalidWidth : 'Table width must be a number.', 273 274 invalidHeight : 'Table height must be a number.', 274 invalidCellSpacing : 'Cell spacing must be a number.',275 invalidCellPadding : 'Cell padding must be a number.',276 275 277 276 cell : 278 277 { -
_source/plugins/flash/dialogs/flash.js
367 367 id : 'width', 368 368 style : 'width:95px', 369 369 label : editor.lang.common.width, 370 validate : CKEDITOR.dialog.validate. integer( editor.lang.common.invalidWidth ),370 validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength ), 371 371 setup : function( objectNode, embedNode, paramMap, fakeImage ) 372 372 { 373 373 loadValue.apply( this, arguments ); 374 374 if ( fakeImage ) 375 { 376 var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 ); 377 if ( !isNaN( fakeImageWidth ) ) 378 this.setValue( fakeImageWidth ); 379 } 375 this.setValue( fakeImage.$.style.width ); 380 376 }, 381 377 commit : function( objectNode, embedNode, paramMap, extraStyles ) 382 378 { 383 379 commitValue.apply( this, arguments ); 384 if ( this.getValue() )385 extraStyles.width = this.getValue() + 'px';380 var val = this.getValue(); 381 val && ( extraStyles.width = val ); 386 382 } 387 383 }, 388 384 { … … 390 386 id : 'height', 391 387 style : 'width:95px', 392 388 label : editor.lang.common.height, 393 validate : CKEDITOR.dialog.validate. integer( editor.lang.common.invalidHeight),389 validate : CKEDITOR.dialog.validate.cssLength( editor.lang.common.invalidCssLength ), 394 390 setup : function( objectNode, embedNode, paramMap, fakeImage ) 395 391 { 396 392 loadValue.apply( this, arguments ); 397 393 if ( fakeImage ) 398 { 399 var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 ); 400 if ( !isNaN( fakeImageHeight ) ) 401 this.setValue( fakeImageHeight ); 402 } 394 this.setValue( fakeImage.$.style.height ); 403 395 }, 404 396 commit : function( objectNode, embedNode, paramMap, extraStyles ) 405 397 { 406 398 commitValue.apply( this, arguments ); 407 if ( this.getValue() )408 extraStyles.height = this.getValue() + 'px';399 var val = this.getValue(); 400 val && ( extraStyles.height = val ); 409 401 } 410 402 }, 411 403 { -
_source/plugins/fakeobjects/plugin.js
25 25 if ( style ) 26 26 { 27 27 // Get the width from the style. 28 var match = /(?:^|\s)width\s*:\s*( \d+)/i.exec( style ),28 var match = /(?:^|\s)width\s*:\s*(.*?)(:?;|$)/i.exec( style ), 29 29 width = match && match[1]; 30 30 31 31 // Get the height from the style. 32 match = /(?:^|\s)height\s*:\s*( \d+)/i.exec( style );32 match = /(?:^|\s)height\s*:\s*(.*?)(:?;|$)/i.exec( style ); 33 33 var height = match && match[1]; 34 34 35 35 if ( width )