Opened 15 years ago

Closed 12 years ago

#3901 closed Bug (wontfix)

Find scrollIntoView incorrect

Reported by: Davey Shafik Owned by:
Priority: Normal Milestone:
Component: General Version: FCKeditor 2.6.4
Keywords: Cc:


An issue similar to #3692 for CKEditor 3.0, also exists in FCKEditor 2.6.x.

When doing a Find, it will not scroll to the first item found, but the items thereafter are fine.

When doing a Replace, it will not scroll to the first or second item found.

I tested this using the demo on the FCK website.

To replicate the find issue:

1) put some text at the top of the editor 2) hit enter enough times to scroll off the page 3) Search for the text at the top

To replicate the replace issue: 1) Put some text at the top of the editor 2) Hit enter enough times to scroll off the page 3) enter the SAME text 4) Hit enter again enough times to scroll off the page 5) enter the SAME text a third time 6) then do a replace of that text.

Looking into it, it seems that the first iteration, inside _Find, you don't have a FindRange, so you do this:

if ( !FindRange )
                FindRange = new CharacterRange( new CharacterCursor( EditorDocument ), searchString.length ) ;}

Then, in CharacterRange.Highlight the line:

HighlightStyle.ApplyToRange( domRange, false, true ) ;

Seems to unset the domRange.StartNode (becomes undefined). This means that this throws an exception:

var charRange = CharacterRange.CreateFromDomRange( domRange ) ;

However, even if you capture the StartNode and put it back in place doing something like this:

Highlight : function()
        if ( this._cursors.length < 1 )
                return ;

        var domRange = this.ToDomRange() ;
        // First time through, the StartNode is lost
        this._highlightRange = domRange ;
        t = domRange.StartNode;
        HighlightStyle.ApplyToRange( domRange, false, true ) ;

        if (!domRange.StartNode) {
                domRange.StartNode = t;
        var charRange = CharacterRange.CreateFromDomRange( domRange ) ;
        var focusNode = domRange.StartNode ;

        if ( focusNode.nodeType != 1 )
                focusNode = focusNode.parentNode ;
        FCKDomTools.ScrollIntoView( focusNode, false ) ;
        this._cursors = charRange._cursors ;

While it stops the exception, it still doesn't scroll.

  • Davey

Change History (1)

comment:1 Changed 12 years ago by Jakub Ś

Resolution: wontfix
Status: newclosed

FCKeditor was retired and is no longer supported. All active development was moved to its successor, CKEditor 3.x, that is a fully mature and far superior product. We recommend you upgrade as soon as possible since this issue is no longer a problem in current code base.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy