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

Commit

Permalink
Docs: Use more human readable code examples for model.insertContent().
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Sep 17, 2018
1 parent 6e779db commit 63e4f18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export default class Model {
* Using `insertContent()` with HTML string converted to a model document fragment (similar to the pasting mechanism):
*
* // You can create your own HtmlDataProcessor instance or use editor.data.processor
* // if you haven't overriden the default one (which is HtmlDataProcessor instance).
* // if you haven't overridden the default one (which is HtmlDataProcessor instance).
* const htmlDP = new HtmlDataProcessor();
*
* // Convert an HTML string to a view document fragment.
Expand All @@ -307,14 +307,14 @@ export default class Model {
*
* // Insert text at given position - document selection will not be modified.
* editor.model.change( writer => {
* editor.model.insertContent( writer.createText( 'x' ), new Position( doc.getRoot(), [ 2 ] ) );
* editor.model.insertContent( writer.createText( 'x' ), Position.createAt( doc.getRoot(), 2 ) );
* } );
*
* If an instance of {module:engine/model/selection~Selection} is passed as `selectable`
* it will be moved to the target position (where the document selection should be moved after the insertion).
*
* // Insert text replacing given selection instance.
* const selection = new Selection( new Position( doc.getRoot(), [ 2 ] ), new Position( doc.getRoot(), [ 5 ] ) );
* const selection = new Selection( paragraph, 'in' );
*
* editor.model.change( writer => {
* editor.model.insertContent( writer.createText( 'x' ), selection );
Expand Down

0 comments on commit 63e4f18

Please sign in to comment.