/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
var featureMatch;\r
while ( ( featureMatch = popupFeaturesRegex.exec( onclickMatch[2] ) ) )\r
{\r
- if ( featureMatch[2] == 'yes' || featureMatch[2] == '1' )\r
+ // Some values should remain numbers (#7300)\r
+ if ( ( featureMatch[2] == 'yes' || featureMatch[2] == '1' ) && !( featureMatch[1] in { height:1, width:1, top:1, left:1 } ) )\r
retval.target[ featureMatch[1] ] = true;\r
else if ( isFinite( featureMatch[2] ) )\r
retval.target[ featureMatch[1] ] = featureMatch[2];\r
advAttr( 'advId', 'id' );\r
advAttr( 'advLangDir', 'dir' );\r
advAttr( 'advAccessKey', 'accessKey' );\r
- advAttr( 'advName', 'name' );\r
+\r
+ retval.adv.advName =\r
+ element.data( 'cke-saved-name' )\r
+ || element.getAttribute( 'name' )\r
+ || '';\r
advAttr( 'advLangCode', 'lang' );\r
advAttr( 'advTabIndex', 'tabindex' );\r
advAttr( 'advTitle', 'title' );\r
advAttr( 'advCSSClasses', 'class' );\r
advAttr( 'advCharset', 'charset' );\r
advAttr( 'advStyles', 'style' );\r
+ advAttr( 'advRel', 'rel' );\r
}\r
\r
// Find out whether we have any anchors in the editor.\r
this.allowOnChange = false;\r
var protocolCmb = this.getDialog().getContentElement( 'info', 'protocol' ),\r
url = this.getValue(),\r
- urlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/gi,\r
- urlOnChangeTestOther = /^((javascript:)|[#\/\.\?])/gi;\r
+ urlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/i,\r
+ urlOnChangeTestOther = /^((javascript:)|[#\/\.\?])/i;\r
\r
var protocol = urlOnChangeProtocol.exec( url );\r
if ( protocol )\r
setup : function( data )\r
{\r
if ( data.target )\r
- this.setValue( data.target.type );\r
+ this.setValue( data.target.type || 'notSet' );\r
targetChanged.call( this );\r
},\r
commit : function( data )\r
},\r
{\r
type : 'hbox',\r
+ widths : [ '45%', '55%' ],\r
children :\r
[\r
{\r
type : 'text',\r
+ label : linkLang.rel,\r
+ 'default' : '',\r
+ id : 'advRel',\r
+ setup : setupAdvParams,\r
+ commit : commitAdvParams\r
+ },\r
+ {\r
+ type : 'text',\r
label : linkLang.styles,\r
'default' : '',\r
id : 'advStyles',\r
setup : setupAdvParams,\r
commit : commitAdvParams\r
-\r
}\r
]\r
}\r
},\r
onOk : function()\r
{\r
- var attributes = { href : 'javascript:void(0)/*' + CKEDITOR.tools.getNextNumber() + '*/' },\r
+ var attributes = {},\r
removeAttributes = [],\r
- data = { href : attributes.href },\r
+ data = {},\r
me = this,\r
editor = this.getParentEditor();\r
\r
removeAttributes.push( attrName );\r
};\r
\r
- if ( this._.selectedElement )\r
- advAttr( 'advId', 'id' );\r
+ advAttr( 'advId', 'id' );\r
advAttr( 'advLangDir', 'dir' );\r
advAttr( 'advAccessKey', 'accessKey' );\r
- advAttr( 'advName', 'name' );\r
+\r
+ if ( data.adv[ 'advName' ] )\r
+ {\r
+ attributes[ 'name' ] = attributes[ 'data-cke-saved-name' ] = data.adv[ 'advName' ];\r
+ attributes[ 'class' ] = ( attributes[ 'class' ] ? attributes[ 'class' ] + ' ' : '' ) + 'cke_anchor';\r
+ }\r
+ else\r
+ removeAttributes = removeAttributes.concat( [ 'data-cke-saved-name', 'name' ] );\r
+\r
advAttr( 'advLangCode', 'lang' );\r
advAttr( 'advTabIndex', 'tabindex' );\r
advAttr( 'advTitle', 'title' );\r
advAttr( 'advCSSClasses', 'class' );\r
advAttr( 'advCharset', 'charset' );\r
advAttr( 'advStyles', 'style' );\r
+ advAttr( 'advRel', 'rel' );\r
}\r
\r
+\r
+ // Browser need the "href" fro copy/paste link to work. (#6641)\r
+ attributes.href = attributes[ 'data-cke-saved-href' ];\r
+\r
if ( !this._.selectedElement )\r
{\r
// Create element if current selection is collapsed.\r
var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );\r
style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why.\r
style.apply( editor.document );\r
-\r
- // Id. Apply only to the first link.\r
- if ( data.adv && data.adv.advId )\r
- {\r
- var links = this.getParentEditor().document.$.getElementsByTagName( 'a' );\r
- for ( i = 0 ; i < links.length ; i++ )\r
- {\r
- if ( links[i].href == attributes.href )\r
- {\r
- links[i].id = data.adv.advId;\r
- break;\r
- }\r
- }\r
- }\r
}\r
else\r
{\r
\r
// IE BUG: Setting the name attribute to an existing link doesn't work.\r
// Must re-create the link from weired syntax to workaround.\r
- if ( CKEDITOR.env.ie && attributes.name != element.getAttribute( 'name' ) )\r
+ if ( CKEDITOR.env.ie && !( CKEDITOR.document.$.documentMode >= 8 ) && attributes.name != element.getAttribute( 'name' ) )\r
{\r
var newElement = new CKEDITOR.dom.element( '<a name="' + CKEDITOR.tools.htmlEncode( attributes.name ) + '">',\r
editor.document );\r
\r
selection = editor.getSelection();\r
\r
- element.moveChildren( newElement );\r
element.copyAttributes( newElement, { name : 1 } );\r
+ element.moveChildren( newElement );\r
newElement.replace( element );\r
element = newElement;\r
\r