Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html (revision 5013)
+++ /CKEditor/trunk/CHANGES.html (revision 5014)
@@ -76,4 +76,5 @@
#4851 : [IE] Delete table rows with context-menu may cause error.
#4951 : Replacing patterns into empty string throws errors.
+ #4963 : Link dialog doesn't open properly for e-mail type links.
Updated the following language files:
- #5006 : Dutch;
Index: /CKEditor/trunk/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/link.js (revision 5013)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/link.js (revision 5014)
@@ -78,9 +78,10 @@
// Loads the parameters in a selected link to the link dialog fields.
- var emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/,
+ var javascriptProtocolRegex = /^javascript:/,
+ emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/,
emailSubjectRegex = /subject=([^;?:@&=$,\/]*)/,
emailBodyRegex = /body=([^;?:@&=$,\/]*)/,
anchorRegex = /^#(.*)$/,
- urlRegex = /^(?!javascript)((?:http|https|ftp|news):\/\/)?(.*)$/,
+ urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/,
selectableTargets = /^(_(?:self|top|parent|blank))$/,
encodedEmailLinkRegex = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,
@@ -94,4 +95,5 @@
{
var href = element ? ( element.getAttribute( '_cke_saved_href' ) || element.getAttribute( 'href' ) ) : '',
+ javascriptMatch,
emailMatch,
anchorMatch,
@@ -99,20 +101,5 @@
retval = {};
- if ( ( anchorMatch = href.match( anchorRegex ) ) )
- {
- retval.type = 'anchor';
- retval.anchor = {};
- retval.anchor.name = retval.anchor.id = anchorMatch[1];
- }
- // urlRegex matches empty strings, so need to check for href as well.
- else if ( href && ( urlMatch = href.match( urlRegex ) ) )
- {
- retval.type = 'url';
- retval.url = {};
- retval.url.protocol = urlMatch[1];
- retval.url.url = urlMatch[2];
- }
- // Protected email link as encoded string.
- else if ( !emailProtection || emailProtection == 'encode' )
+ if( javascriptMatch = href.match( javascriptProtocolRegex ) )
{
if( emailProtection == 'encode' )
@@ -126,8 +113,43 @@
} );
}
-
- emailMatch = href.match( emailRegex );
-
- if( emailMatch )
+ // Protected email link as function call.
+ else if( emailProtection )
+ {
+ href.replace( functionCallProtectedEmailLinkRegex, function( match, funcName, funcArgs )
+ {
+ if( funcName == compiledProtectionFunction.name )
+ {
+ retval.type = 'email';
+ var email = retval.email = {};
+
+ var paramRegex = /[^,\s]+/g,
+ paramQuoteRegex = /(^')|('$)/g,
+ paramsMatch = funcArgs.match( paramRegex ),
+ paramsMatchLength = paramsMatch.length,
+ paramName,
+ paramVal;
+
+ for ( var i = 0; i < paramsMatchLength; i++ )
+ {
+ paramVal = decodeURIComponent( unescapeSingleQuote( paramsMatch[ i ].replace( paramQuoteRegex, '' ) ) );
+ paramName = compiledProtectionFunction.params[ i ].toLowerCase();
+ email[ paramName ] = paramVal;
+ }
+ email.address = [ email.name, email.domain ].join( '@' );
+ }
+ } );
+ }
+ }
+
+ if( !retval.type )
+ {
+ if ( ( anchorMatch = href.match( anchorRegex ) ) )
+ {
+ retval.type = 'anchor';
+ retval.anchor = {};
+ retval.anchor.name = retval.anchor.id = anchorMatch[1];
+ }
+ // Protected email link as encoded string.
+ else if ( emailMatch = href.match( emailRegex ) )
{
var subjectMatch = href.match( emailSubjectRegex ),
@@ -140,34 +162,15 @@
bodyMatch && ( email.body = decodeURIComponent( bodyMatch[ 1 ] ) );
}
+ // urlRegex matches empty strings, so need to check for href as well.
+ else if ( href && ( urlMatch = href.match( urlRegex ) ) )
+ {
+ retval.type = 'url';
+ retval.url = {};
+ retval.url.protocol = urlMatch[1];
+ retval.url.url = urlMatch[2];
+ }
+ else
+ retval.type = 'url';
}
- // Protected email link as function call.
- else if( emailProtection )
- {
- href.replace( functionCallProtectedEmailLinkRegex, function( match, funcName, funcArgs )
- {
- if( funcName == compiledProtectionFunction.name )
- {
- retval.type = 'email';
- var email = retval.email = {};
-
- var paramRegex = /[^,\s]+/g,
- paramQuoteRegex = /(^')|('$)/g,
- paramsMatch = funcArgs.match( paramRegex ),
- paramsMatchLength = paramsMatch.length,
- paramName,
- paramVal;
-
- for ( var i = 0; i < paramsMatchLength; i++ )
- {
- paramVal = decodeURIComponent( unescapeSingleQuote( paramsMatch[ i ].replace( paramQuoteRegex, '' ) ) );
- paramName = compiledProtectionFunction.params[ i ].toLowerCase();
- email[ paramName ] = paramVal;
- }
- email.address = [ email.name, email.domain ].join( '@' );
- }
- } );
- }
- else
- retval.type = 'url';
// Load target and popup settings.