Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13064 closed Bug (invalid)

getById() dont work wint anchors

Reported by: Denis Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

I want move cursor to anchors from script. To do this, need select anchor by getById. But getById for anchors always null. Maybe because the anchor fake element?

For reproduce:

1) Go to http://ckeditor.com/demo[[BR]]

2) In browser console run:

console.log(CKEDITOR.instances['editor1'].document.getById('quotes'))

3) Got null, but in source we have:

<h2>Broadcasting and <em>quotes</em> <a id="quotes" name="quotes"></a></h2>

How to move cursor an anchor?

Change History (2)

comment:1 Changed 5 years ago by Piotrek Koszuliński

Keywords: getById anchors null fake removed
Resolution: invalid
Status: newclosed
Version: 4.4.7

Maybe because the anchor fake element

Yes - empty anchors are converted into "fake elements" (i.e. images with special attributes). You need to find other way to find a proper fake element representing anchor that you look for in the DOM. E.g. document.find( 'img.cke_anchor' ) and then you can either take a shortcut and try to husk an id from data-cke-realelement, or use http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.link-method-tryRestoreFakeAnchor to get the anchors.

But it's not a bug - it's simply how it works.

comment:2 Changed 5 years ago by Denis

If you (developers) set id and name to fake img from anchor all be fine and don't need to reinvent the wheel.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy