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

Commit

Permalink
Docs: Added docs to new methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Feb 21, 2018
1 parent 90459c5 commit 3b4bb2e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/model/differ.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,13 @@ export default class Differ {
return diffs;
}

/**
* Checks whether given element or any of its parents is an element that is buffered as an inserted element.
*
* @private
* @param {module:engine/model/element~Element} element Element to check.
* @returns {Boolean}
*/
_isInInsertedElement( element ) {
const parent = element.parent;

Expand All @@ -820,21 +827,27 @@ export default class Differ {
return this._isInInsertedElement( parent );
}

/**
* Removes deeply all buffered changes that are registered in elements from range specified by `parent`, `offset`
* and `howMany`.
*
* @private
* @param {module:engine/model/element~Element} parent
* @param {Number} offset
* @param {Number} howMany
*/
_removeAllNestedChanges( parent, offset, howMany ) {
const range = Range.createFromParentsAndOffsets( parent, offset, parent, offset + howMany );

for ( const item of range.getItems( { shallow: true } ) ) {
if ( item.is( 'element' ) ) {
this._removeChangesInElement( item );
this._elementSnapshots.delete( item );
this._changesInElement.delete( item );

this._removeAllNestedChanges( item, 0, item.maxOffset );
}
}
}

_removeChangesInElement( element ) {
this._elementSnapshots.delete( element );
this._changesInElement.delete( element );
}
}

// Returns an array that is a copy of passed child list with the exception that text nodes are split to one or more
Expand Down

0 comments on commit 3b4bb2e

Please sign in to comment.