Skip to content

Commit

Permalink
Merge branch 't/10823' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Oct 25, 2013
2 parents 2d9c3ff + 0d256f0 commit fc83fe7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -33,6 +33,7 @@ Fixed Issues:
* [#10870](http://dev.ckeditor.com/ticket/10870): Fixed: `paste` command is not being disabled when clipboard is empty any more.
* [#10866](http://dev.ckeditor.com/ticket/10866): Fixed: Broken *Tab* key navigation in the Image2 dialog.
* [#10854](http://dev.ckeditor.com/ticket/10854): Fixed: Firefox prepends `<br>` to `<body>`, so it is stripped by the HTML data processor.
* [#10823](http://dev.ckeditor.com/ticket/10823): Fixed: Link plugin does not work with non-editable content.

## CKEditor 4.3 Beta

Expand Down
2 changes: 1 addition & 1 deletion core/selection.js
Expand Up @@ -1965,7 +1965,7 @@
var cache = this._.cache;

// Caches a range than holds the element.
var range = new CKEDITOR.dom.range( element.getDocument() );
var range = new CKEDITOR.dom.range( this.root );
range.setStartBefore( element );
range.setEndAfter( element );
cache.ranges = new CKEDITOR.dom.rangeList( range );
Expand Down
15 changes: 10 additions & 5 deletions plugins/link/dialogs/link.js
Expand Up @@ -1057,9 +1057,12 @@ CKEDITOR.dialog.add( 'link', function( editor ) {
element = null;

// Fill in all the relevant fields if there's already one link selected.
if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) )
selection.selectElement( element );
else
if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) ) {
// Don't change selection if some element is already selected.
// For example - don't destroy fake selection.
if ( !selection.getSelectedElement() )
selection.selectElement( element );
} else
element = null;

this.setupContent( parseLink.apply( this, [ editor, element ] ) );
Expand Down Expand Up @@ -1202,7 +1205,7 @@ CKEDITOR.dialog.add( 'link', function( editor ) {
attributes.href = attributes[ 'data-cke-saved-href' ];

if ( !this._.selectedElement ) {
var range = selection.getRanges( 1 )[ 0 ];
var range = selection.getRanges()[ 0 ];

// Use link URL as text with a collapsed cursor.
if ( range.collapsed ) {
Expand Down Expand Up @@ -1233,9 +1236,11 @@ CKEDITOR.dialog.add( 'link', function( editor ) {
if ( href == textView || data.type == 'email' && textView.indexOf( '@' ) != -1 ) {
// Short mailto link text view (#5736).
element.setHtml( data.type == 'email' ? data.email.address : attributes[ 'data-cke-saved-href' ] );

// We changed the content, so need to select it again.
selection.selectElement( element );
}

selection.selectElement( element );
delete this._.selectedElement;
}
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/link/plugin.js
Expand Up @@ -252,7 +252,7 @@ CKEDITOR.plugins.link = {
if ( selectedElement && selectedElement.is( 'a' ) )
return selectedElement;

var range = selection.getRanges( true )[ 0 ];
var range = selection.getRanges()[ 0 ];

if ( range ) {
range.shrink( CKEDITOR.SHRINK_TEXT );
Expand Down

0 comments on commit fc83fe7

Please sign in to comment.