Ticket #3004: 3004.patch
File 3004.patch, 2.7 KB (added by , 16 years ago) |
---|
-
_source/plugins/link/dialogs/link.js
289 289 items : 290 290 [ 291 291 [ 'http://' ], 292 [ 'https //' ],292 [ 'https://' ], 293 293 [ 'ftp://' ], 294 294 [ 'news://' ], 295 295 [ '<other>', '' ] … … 311 311 type : 'text', 312 312 id : 'url', 313 313 label : editor.lang.common.url, 314 onLoad : function () 315 { 316 this.allowOnChange = true; 317 }, 318 onKeyUp : function() 319 { 320 this.allowOnChange = false; 321 var protocolCmb = this.getDialog().getContentElement( 'info', 'protocol' ), 322 url = this.getValue(), 323 urlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/gi, 324 urlOnChangeTestOther = /^((javascript:)|[#\/\.])/gi; 325 326 var protocol = urlOnChangeProtocol.exec( url ); 327 if ( protocol ) 328 { 329 this.setValue( url.substr( protocol[ 0 ].length ) ); 330 protocolCmb.setValue( protocol[ 0 ].toLowerCase() ); 331 } 332 else if ( urlOnChangeTestOther.test( url ) ) 333 protocolCmb.setValue( '' ); 334 335 this.allowOnChange = true; 336 }, 337 onChange : function() 338 { 339 if ( this.allowOnChange ) // Dont't call on dialog load. 340 this.onKeyUp(); 341 }, 314 342 validate : function() 315 343 { 316 344 var dialog = this.getDialog(); … … 327 355 }, 328 356 setup : function( data ) 329 357 { 358 this.allowOnChange = false; 330 359 if ( data.url ) 331 360 this.setValue( data.url.url ); 361 this.allowOnChange = true; 332 362 333 363 var linkType = this.getDialog().getContentElement( 'info', 'linkType' ); 334 364 if ( linkType && linkType.getValue() == 'url' ) 335 365 this.select(); 366 336 367 }, 337 368 commit : function( data ) 338 369 { … … 340 371 data.url = {}; 341 372 342 373 data.url.url = this.getValue(); 374 this.allowOnChange = false; 343 375 } 344 376 } 345 377 ], … … 1006 1038 switch ( data.type || 'url' ) 1007 1039 { 1008 1040 case 'url': 1009 var protocol = ( data.url && data.url.protocol ) ||'http://',1041 var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://', 1010 1042 url = ( data.url && data.url.url ) || ''; 1011 1043 attributes._cke_saved_href = protocol + url; 1012 1044 break;