#3367: Introduce range iterator API
-----------------------+----------------------------------------------------
 Reporter:  garry.yao  |       Owner:  fredck      
     Type:  Bug        |      Status:  new         
 Priority:  Normal     |   Milestone:  CKEditor 3.0
Component:  General    |     Version:              
 Keywords:  Confirmed  |  
-----------------------+----------------------------------------------------

Old description:

> There're many cases when we need to traverse the range from the start
> boundary node to the end boundary node, it's archiveable by the following
> codes:
> {{{
> var boundaryNodes = range.getBoundaryNodes();
>                 var firstNode = boundaryNodes.startNode;
>                 var lastNode = boundaryNodes.endNode.getNextSourceNode(
> true );
> var node = firstNode.getNextSourceNode();
> while( node )
> {
>         if ( node.getName() == 'span'  && currentNode.getAttribute(
> '_fck_bookmark' ) )
>         {
>                 node = node.getNextSourceNode();
>                 continue;
>         }
>         // Processing logic...
>         node = node.getNextSourceNode();
> }
> }}}
> It's cumbersome due to at least two reasons:
>  1. The collapsed range problem reported at #3292;
>  1. It make code DUP at every plugin for the same logic;
> It's necessary to introduce an API for this feature with  '''dom
> iterator''', which already holds a method for iterating over paragraphs.
> So after the API, other plugins should walking through the range as easy
> as using the iterator.

New description:

 There're many cases when we need to traverse the range from the start
 boundary node to the end boundary node, it's archiveable by the following
 codes:
 {{{
 var boundaryNodes = range.getBoundaryNodes();
                 var firstNode = boundaryNodes.startNode;
                 var lastNode = boundaryNodes.endNode.getNextSourceNode(
 true );
 var node = firstNode.getNextSourceNode();
 while( node )
 {
         if ( node.getName() == 'span'  && currentNode.getAttribute(
 '_fck_bookmark' ) )
         {
                 node = node.getNextSourceNode();
                 continue;
         }
         // Processing logic...
         node = node.getNextSourceNode();
 }
 }}}
 It's cumbersome due to at least two reasons:
  1. The collapsed range problem reported at #3292;
  1. It make code DUP at every plugin for the same logic;
 It's necessary to introduce an API for this feature with  '''dom
 iterator''', which already holds a method for iterating over paragraphs.
 So after the API, other plugins should walking through the range as easy
 as using the iterator.

--

Comment(by garry.yao):

 Fred said he'll take care this ticket and refacting task after this fix
 will be handled by other new  opening tickets.

-- 
Ticket URL: <http://dev.fckeditor.net/ticket/3367#comment:1>
FCKeditor <http://www.fckeditor.net/>
The text editor for Internet
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to