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

Commit

Permalink
Docs: Minor tweak in a code sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Jan 11, 2018
1 parent a05c6b9 commit 14461bf
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/model/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,15 @@ export default class Document {
* const changes = document.differ.getChanges();
*
* // Check if the changes lead to an empty root in an editor.
* let applied = false;
*
* for ( const entry of changes ) {
* if ( entry.type == 'remove' && entry.position.root.isEmpty ) {
* writer.insertElement( 'paragraph', entry.position.root, 0 );
*
* applied = true;
* // It is fine to return early, even if multiple roots would need to be fixed.
* // All post-fixers will be fired again, so if there more empty roots, those will be fixed too.
* return true;
* }
* }
*
* return applied;
* } );
*
* @param {Function} postFixer
Expand Down

0 comments on commit 14461bf

Please sign in to comment.