Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Docs: Added some inline code.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Mar 25, 2019
1 parent c0d3b40 commit cbad3e9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/conversion/upcastdispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,19 @@ export default class UpcastDispatcher {
// Split element to allowed parent.
const splitResult = this.conversionApi.writer.split( modelCursor, allowedParent );

// Using the range returned by `model.Writer#split`, pair original elements with their split parts.
// The range returned from the writer spans "between" the split or precisely saying, from the end of the split element
// to the beginning of the other part of the split element:
//
// <limit><a><b><c>X[]Y</c></b><a></limit> ->
// <limit><a><b><c>X[</c></b></a><a><b><c>]Y</c></b></a>
//
// After the split no meaningful content can be between the positions in `splitRange` - they have to be touching.
// Also, because of how splitting works, it is easy to notice, that "closing tags" are in the reverse order than "opening tags".
// Also, since we split all those elements, each of them has to have the other part.
//
// With those observations in mind, we will pair the original elements with their split parts by saving "closing tags" and matching
// them with "opening tags" in the reverse order. For that we can use a stack.
const stack = [];

for ( const treeWalkerValue of splitResult.range.getWalker() ) {
Expand Down

0 comments on commit cbad3e9

Please sign in to comment.