Bladeren bron

Docs: Fixed example.

Szymon Cofalik 6 jaren geleden
bovenliggende
commit
e665c2d150
1 gewijzigde bestanden met toevoegingen van 4 en 11 verwijderingen
  1. 4 11
      packages/ckeditor5-typing/src/utils/getlasttextline.js

+ 4 - 11
packages/ckeditor5-typing/src/utils/getlasttextline.js

@@ -13,27 +13,20 @@
  * "The last text line" is understood as text (from one or more text nodes) which is limited either by a parent block
  * or by inline elements (e.g. `<softBreak>`).
  *
- * This method can be used to evaluate text from a block in which user sets cursor:
- *
- *		const selection = model.document.selection;
- *
- *		// Evaluate text in from selection parent up to the cursor:
  *		const rangeToCheck = model.createRange(
  *			model.createPositionAt( paragraph, 0 ),
  *			model.createPositionAt( paragraph, 'end' )
  *		);
  *
- *		const { text, range } = getLastTextLine( range, model );
+ *		const { text, range } = getLastTextLine( rangeToCheck, model );
  *
- * The returned text will consist "Foo bar baz" for a model below:
+ * For model below, the returned `text` will be "Foo bar baz" and `range` will be set on whole `<paragraph>` content:
  *
  *		<paragraph>Foo bar baz<paragraph>
  *
- * However, it will return only "baz" if there's a `<softBreak>` before "baz" text node:
- *
- *		<paragraph>Foo<softBreak>bar<softBreak>baz<paragraph>
+ * However, in below case, `text` will be set to "baz" and `range` will be set only on "baz".
  *
- * In the above example `range` will be set only "baz".
+ *		<paragraph>Foo<softBreak></softBreak>bar<softBreak></softBreak>baz<paragraph>
  *
  * @protected
  * @param {module:engine/model/range~Range} range