Skip to content

Commit fc83fe7

Browse files
committed
Merge branch 't/10823' into major
2 parents 2d9c3ff + 0d256f0 commit fc83fe7

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Fixed Issues:
3333
* [#10870](http://dev.ckeditor.com/ticket/10870): Fixed: `paste` command is not being disabled when clipboard is empty any more.
3434
* [#10866](http://dev.ckeditor.com/ticket/10866): Fixed: Broken *Tab* key navigation in the Image2 dialog.
3535
* [#10854](http://dev.ckeditor.com/ticket/10854): Fixed: Firefox prepends `<br>` to `<body>`, so it is stripped by the HTML data processor.
36+
* [#10823](http://dev.ckeditor.com/ticket/10823): Fixed: Link plugin does not work with non-editable content.
3637

3738
## CKEditor 4.3 Beta
3839

core/selection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1965,7 +1965,7 @@
19651965
var cache = this._.cache;
19661966

19671967
// Caches a range than holds the element.
1968-
var range = new CKEDITOR.dom.range( element.getDocument() );
1968+
var range = new CKEDITOR.dom.range( this.root );
19691969
range.setStartBefore( element );
19701970
range.setEndAfter( element );
19711971
cache.ranges = new CKEDITOR.dom.rangeList( range );

plugins/link/dialogs/link.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,12 @@ CKEDITOR.dialog.add( 'link', function( editor ) {
10571057
element = null;
10581058

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

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

12041207
if ( !this._.selectedElement ) {
1205-
var range = selection.getRanges( 1 )[ 0 ];
1208+
var range = selection.getRanges()[ 0 ];
12061209

12071210
// Use link URL as text with a collapsed cursor.
12081211
if ( range.collapsed ) {
@@ -1233,9 +1236,11 @@ CKEDITOR.dialog.add( 'link', function( editor ) {
12331236
if ( href == textView || data.type == 'email' && textView.indexOf( '@' ) != -1 ) {
12341237
// Short mailto link text view (#5736).
12351238
element.setHtml( data.type == 'email' ? data.email.address : attributes[ 'data-cke-saved-href' ] );
1239+
1240+
// We changed the content, so need to select it again.
1241+
selection.selectElement( element );
12361242
}
12371243

1238-
selection.selectElement( element );
12391244
delete this._.selectedElement;
12401245
}
12411246
},

plugins/link/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ CKEDITOR.plugins.link = {
252252
if ( selectedElement && selectedElement.is( 'a' ) )
253253
return selectedElement;
254254

255-
var range = selection.getRanges( true )[ 0 ];
255+
var range = selection.getRanges()[ 0 ];
256256

257257
if ( range ) {
258258
range.shrink( CKEDITOR.SHRINK_TEXT );

0 commit comments

Comments
 (0)