/*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
\r
// Find out whether we have any anchors in the editor.\r
var anchors = retval.anchors = [],\r
- item;\r
+ i, count, item;\r
\r
// For some browsers we set contenteditable="false" on anchors, making document.anchors not to include them, so we must traverse the links manually (#7893).\r
if ( CKEDITOR.plugins.link.emptyAnchorFix )\r
else\r
{\r
var anchorList = new CKEDITOR.dom.nodeList( editor.document.$.anchors );\r
- for ( var i = 0, count = anchorList.count(); i < count; i++ )\r
+ for ( i = 0, count = anchorList.count(); i < count; i++ )\r
{\r
item = anchorList.getItem( i );\r
anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) };\r
dialog.getValueOf( 'info', 'linkType' ) != 'url' )\r
return true;\r
\r
+ if ( (/javascript\:/).test( this.getValue() ) ) {\r
+ alert( commonLang.invalidValue );\r
+ return false;\r
+ }\r
+\r
if ( this.getDialog().fakeObj ) // Edit Anchor.\r
return true;\r
\r
type : 'html',\r
id : 'noAnchors',\r
style : 'text-align: center;',\r
- html : '<div role="label" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( linkLang.noAnchors ) + '</div>',\r
+ html : '<div role="note" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( linkLang.noAnchors ) + '</div>',\r
// Focus the first element defined in above html.\r
focus : true,\r
setup : function( data )\r
}\r
\r
\r
+ var selection = editor.getSelection();\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 selection = editor.getSelection(),\r
- ranges = selection.getRanges( true );\r
+ var ranges = selection.getRanges( true );\r
if ( ranges.length == 1 && ranges[0].collapsed )\r
{\r
// Short mailto link text view (#5736).\r
data.email.address : attributes[ 'data-cke-saved-href' ] );\r
}\r
\r
+ selection.selectElement( element );\r
delete this._.selectedElement;\r
}\r
},\r