/*\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
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
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
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( 'advStyles', 'style' );\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
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