app/assets/javascripts/ckeditor/_source/plugins/link/dialogs/link.js in refinerycms-ckeditor-0.1.4 vs app/assets/javascripts/ckeditor/_source/plugins/link/dialogs/link.js in refinerycms-ckeditor-0.2.0

- old
+ new

@@ -1,7 +1,7 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'link', function( editor ) { @@ -243,11 +243,11 @@ advAttr( 'advRel', 'rel' ); } // Find out whether we have any anchors in the editor. var anchors = retval.anchors = [], - item; + i, count, item; // For some browsers we set contenteditable="false" on anchors, making document.anchors not to include them, so we must traverse the links manually (#7893). if ( CKEDITOR.plugins.link.emptyAnchorFix ) { var links = editor.document.getElementsByTag( 'a' ); @@ -259,11 +259,11 @@ } } else { var anchorList = new CKEDITOR.dom.nodeList( editor.document.$.anchors ); - for ( var i = 0, count = anchorList.count(); i < count; i++ ) + for ( i = 0, count = anchorList.count(); i < count; i++ ) { item = anchorList.getItem( i ); anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) }; } } @@ -651,11 +651,11 @@ }, { type : 'html', id : 'noAnchors', style : 'text-align: center;', - html : '<div role="label" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( linkLang.noAnchors ) + '</div>', + html : '<div role="note" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( linkLang.noAnchors ) + '</div>', // Focus the first element defined in above html. focus : true, setup : function( data ) { if ( data.anchors.length < 1 ) @@ -1326,18 +1326,19 @@ advAttr( 'advStyles', 'style' ); advAttr( 'advRel', 'rel' ); } + var selection = editor.getSelection(); + // Browser need the "href" fro copy/paste link to work. (#6641) attributes.href = attributes[ 'data-cke-saved-href' ]; if ( !this._.selectedElement ) { // Create element if current selection is collapsed. - var selection = editor.getSelection(), - ranges = selection.getRanges( true ); + var ranges = selection.getRanges( true ); if ( ranges.length == 1 && ranges[0].collapsed ) { // Short mailto link text view (#5736). var text = new CKEDITOR.dom.text( data.type == 'email' ? data.email.address : attributes[ 'data-cke-saved-href' ], editor.document ); @@ -1370,9 +1371,10 @@ // Short mailto link text view (#5736). element.setHtml( data.type == 'email' ? data.email.address : attributes[ 'data-cke-saved-href' ] ); } + selection.selectElement( element ); delete this._.selectedElement; } }, onLoad : function() {