Ver código fonte

Docs: Use more human readable code examples for model.insertContent().

Maciej Gołaszewski 7 anos atrás
pai
commit
e7ceb7a8b8
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      packages/ckeditor5-engine/src/model/model.js

+ 3 - 3
packages/ckeditor5-engine/src/model/model.js

@@ -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.
@@ -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 );