Opened 15 years ago

Last modified 15 years ago

#3367 closed New Feature

Introduce range iterator API — at Version 1

Reported by: Garry Yao Owned by: Frederico Caldeira Knabben
Priority: Normal Milestone: CKEditor 3.0
Component: General Version:
Keywords: Confirmed Review+ Cc:

Description (last modified by Garry Yao)

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;
  2. 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.

Change History (1)

comment:1 Changed 15 years ago by Garry Yao

Description: modified (diff)

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

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