Skip to content
Permalink
Browse files

Merge branch 't/13351'

  • Loading branch information...
Reinmar committed Jun 10, 2015
2 parents 0e4f412 + 8f4afe1 commit 7e5367f90da1979454940c15e41dcb55776b65df
@@ -23,6 +23,7 @@ Fixed Issues:
* [#9086](http://dev.ckeditor.com/ticket/9086): Fixed: Invalid ARIA property used on paste area `<iframe>`.
* [#13164](http://dev.ckeditor.com/ticket/13164): Fixed: Error when inserting a hidden field.
* [#13155](http://dev.ckeditor.com/ticket/13155): Fixed: Incorrect [Line Utilities](http://ckeditor.com/addon/lineutils) positioning when `<body>` has a margin.
* [#13351](http://dev.ckeditor.com/ticket/13351): Fixed: Link lost when editing linked image with the link tab disabled. Also, fixed a bug when inserting an image into fully selected link would throw an error.

Other Changes:

@@ -2533,6 +2533,7 @@ CKEDITOR.dom.range = function( root ) {

if ( !isRootAscendantOrSelf ) {
window.console && console.log && console.log( 'Element', startContainer, 'is not a descendant of root', this.root ); // jshint ignore:line
throw new Error( 1 );
}
// %REMOVE_END%
this.startContainer = startContainer;
@@ -2551,6 +2552,7 @@ CKEDITOR.dom.range = function( root ) {

if ( !isRootAscendantOrSelf ) {
window.console && console.log && console.log( 'Element', endContainer, 'is not a descendant of root', this.root ); // jshint ignore:line
throw new Error( 2 );
}
// %REMOVE_END%
this.endContainer = endContainer;
@@ -296,16 +296,23 @@
this.linkElement = link;
this.linkEditMode = true;

// If there is an existing link, by default keep it (true).
// It will be removed if certain conditions are met and Link tab is enabled. (#13351)
this.addLink = true;

// Look for Image element.
var linkChildren = link.getChildren();
if ( linkChildren.count() == 1 ) {
var childTagName = linkChildren.getItem( 0 ).getName();
if ( childTagName == 'img' || childTagName == 'input' ) {
this.imageElement = linkChildren.getItem( 0 );
if ( this.imageElement.getName() == 'img' )
this.imageEditMode = 'img';
else if ( this.imageElement.getName() == 'input' )
this.imageEditMode = 'input';
var childTag = linkChildren.getItem( 0 );

if ( childTag.type == CKEDITOR.NODE_ELEMENT ) {
if ( childTag.is( 'img' ) || childTag.is( 'input' ) ) {
this.imageElement = linkChildren.getItem( 0 );
if ( this.imageElement.is( 'img' ) )
this.imageEditMode = 'img';
else if ( this.imageElement.is( 'input' ) )
this.imageEditMode = 'input';
}
}
}
// Fill out all fields.
@@ -333,8 +340,6 @@

// Fill out all fields.
this.setupContent( IMAGE, this.imageElement );
} else {
this.imageElement = editor.document.createElement( 'img' );
}

// Refresh LockRatio button
@@ -402,12 +407,21 @@
// Insert a new Image.
if ( !this.imageEditMode ) {
if ( this.addLink ) {
//Insert a new Link.
if ( !this.linkEditMode ) {
// Insert a new link.
editor.insertElement( this.linkElement );
this.linkElement.append( this.imageElement, false );
} else //Link already exists, image not.
editor.insertElement( this.imageElement );
} else {
// We already have a link in editor.
if ( this.linkElement.equals( editor.getSelection().getSelectedElement() ) ) {
// If the link is selected outside, replace it's content rather than the link itself. ([<a>foo</a>])
this.linkElement.setHtml( '' );
this.linkElement.append( this.imageElement, false );
} else {
// Only inside of the link is selected, so replace it with image. (<a>[foo]</a>, <a>[f]oo</a>)
editor.insertElement( this.imageElement );
}
}
} else {
editor.insertElement( this.imageElement );
}
@@ -978,6 +992,8 @@

if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL )
this.getDialog().addLink = true;
else
this.getDialog().addLink = false;
}
}
}
@@ -1 +1 @@
<textarea id="test_create_link_editor"></textarea>
<textarea id="test_create_link_editor"></textarea>
Oops, something went wrong.

0 comments on commit 7e5367f

Please sign in to comment.
You can’t perform that action at this time.