In CK Editor 3.x when you put an ID on an element, it does not show up in the link by element id dropdown box. The anchor name dropdown works, but not the element ID. This actually isn't working in the demo either...has this been addressed yet?
Thanks!
Thanks!

Re: Link by Element ID Does Not Work
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: Link by Element ID Does Not Work
Switch to source view, add an id to element. Highlight some text, hit the link button, choose link type of "link to anchor in the text." There is nothing there. If you add an anchor, then there are two drop down boxes, one for "by anchor name" and one for "by element id." The anchor box will have your anchor in it, the element ID box is empty.
Re: Link by Element ID Does Not Work
extracted from link.js
// Find out whether we have any anchors in the editor. var anchors = retval.anchors = [], 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' ); for ( i = 0, count = links.count(); i < count; i++ ) { item = links.getItem( i ); if ( item.data( 'cke-saved-name' ) || item.hasAttribute( 'name' ) ) anchors.push( { name : item.data( 'cke-saved-name' ) || item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) } ); } } else { var anchorList = new CKEDITOR.dom.nodeList( editor.document.$.anchors ); for ( i = 0, count = anchorList.count(); i < count; i++ ) { item = anchorList.getItem( i ); anchors[ i ] = { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) }; } } if ( CKEDITOR.plugins.link.fakeAnchor ) { var imgs = editor.document.getElementsByTag( 'img' ); for ( i = 0, count = imgs.count(); i < count; i++ ) { if ( ( item = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, imgs.getItem( i ) ) ) ) anchors.push( { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) } ); } }Of course it would be better to provide all the elements with an id or remove that select box if it's not meant to be used.
This works for modern browsers:
var doc = editor.document.$; if ( doc.querySelectorAll ) { var elements = doc.querySelectorAll('[id]'); for ( i = 0, count = elements.length; i < count; i++ ) { item = elements[ i ]; if ( item.nodeName != 'A' ) anchors.push( { name : item.getAttribute( 'name' ), id : item.getAttribute( 'id' ) } ); } }Re: Link by Element ID Does Not Work
Re: Link by Element ID Does Not Work