﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12255	Anchor dialog does not display existing anchor name when dialog was opened by doubleclick	Henning		"1. In CKEditor 4.3.5 and Chrome
1. edit a new text
1. enter the following in source mode
1.  {{{<a id=""anchorId"" name=""anchorName"">anchorText</a>}}}
1. switch to wysiwyg mode
1. doubleclick on anchorText
1. in the anchor dialog, the anchor name is not displayed.

If you just click into the text ""anchorText"" and open the anchor dialog via the toolbar, the anchor name is displayed in the dialog.

Debugging the code in link plugin's anchor.js, I found that the method tryRestoreFakeAnchor did not detect a fake anchor, but was trusted nevertheless such that the existing real anchor was not used. Only if the element was ""fullySelected"". The following code change resolved the issue:

Existing code:
{{{
if ( CKEDITOR.plugins.otmslink.fakeAnchor ) {
	var realElement = CKEDITOR.plugins.otmslink.tryRestoreFakeAnchor( editor, fullySelected );
	realElement && loadElements.call( this, realElement );
	this._.selectedElement = fullySelected;
} else if ( fullySelected.is( 'a' ) && fullySelected.hasAttribute( 'name' ) )
}}}

Changed code
{{{
var realElement;
if ( CKEDITOR.plugins.otmslink.fakeAnchor ) {
    realElement = CKEDITOR.plugins.otmslink.tryRestoreFakeAnchor( editor, fullySelected );
    realElement && loadElements.call( this, realElement );
    this._.selectedElement = fullySelected;
}
if (!realElement && fullySelected.is('a') && fullySelected.hasAttribute('name')) {
    loadElements.call(this, fullySelected);
}
}}}"	Bug	closed	Normal		General	3.6.6	fixed		
