#2220: Encode email "mailto:"; links
---------------------------+------------------------------------------------
  Reporter:  asuter        |       Owner:                            
      Type:  New Feature   |      Status:  new                       
  Priority:  Normal        |   Milestone:  FCKeditor 2.6.3           
 Component:  UI : Dialogs  |     Version:  FCKeditor 2.6             
Resolution:                |    Keywords:  Confirmed HasPatch Review-
---------------------------+------------------------------------------------
Changes (by martinkou):

  * keywords:  Confirmed HasPatch Review? => Confirmed HasPatch Review-

Comment:

 The patch is almost perfect but it still has a minor bug, and some of the
 code can be simplified.

  1. With FCKConfig.EMailProtection='function', if I enter a email message
 body with two single quotes, e.g. "Hi there, have you seen the movie
 'Indiana Jones'?", and save the link; then the second single quote would
 be broken when you examine that link again. (e.g. the above example would
 turn to "Hi there, have you seen them movie 'Indiana
 Jones###SINGLE_QUOTE###?" when you open the link dialog again).
  1. The lines 144-154 can be condensed to:
 {{{
 func = func.replace( /([/^$*+.?()\[\]])/g, '\\$1' ) ;
 }}}
  1. The lines 240-248 can be simplified a bit with
 [http://www.w3schools.com/jsref/jsref_split.asp String::split()].
  1. The lines 257-276 can be simplified to something like the following,
 because you can eliminate some "if" statements by liberal use of
 Array::join(); also a "break" is not needed after "return":
 {{{
         case 'encode' :
             var aParams = [] ;
             var aAddressCode = [] ;

             if ( subject.length > 0 )
                 aParams.push( 'subject='+ encodeURIComponent( subject ) )
 ;
             if ( body.length > 0 )
                 aParams.push( 'body=' + encodeURIComponent( body ) ) ;
             for ( var i = 0 ; i < address.length ; i++ )
                 aAddressCode.push( adress.charCodeAt( i ) ) ;

             return
 'javascript:location.href="mailto:"+String.fromCharCode(' +
 aAddressCode.join( ',' ) + ')+"?' + aParams.join( '&' ) + '"' ;
 }}}

 Still, the patch is excellent, good job. ;)

-- 
Ticket URL: <https://dev.fckeditor.net/ticket/2220#comment:11>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to