瀏覽代碼

Docs improvements for TextWatcher#isEnabled.

Maciej Gołaszewski 5 年之前
父節點
當前提交
722b26e6c3
共有 1 個文件被更改,包括 6 次插入7 次删除
  1. 6 7
      packages/ckeditor5-typing/src/textwatcher.js

+ 6 - 7
packages/ckeditor5-typing/src/textwatcher.js

@@ -19,14 +19,14 @@ import getLastTextLine from './utils/getlasttextline';
  * {@link module:typing/textwatcher~TextWatcher#event:unmatched `unmatched`} events on typing or selection changes.
  *
  * @private
+ * @mixes module:utils/observablemixin~ObservableMixin
  */
 export default class TextWatcher {
 	/**
 	 * Creates a text watcher instance.
+	 *
 	 * @param {module:engine/model/model~Model} model
 	 * @param {Function} testCallback The function used to match the text.
-	 *
-	 * @mixes module:utils/observablemixin~ObservableMixin
 	 */
 	constructor( model, testCallback ) {
 		this.model = model;
@@ -37,15 +37,14 @@ export default class TextWatcher {
 		 * Flag indicating whether the TextWatcher is enabled or disabled.
 		 * A disabled TextWatcher will not evaluate text.
 		 *
-		 * TextWatcher can be simply disabled like that:
+		 * To disable TextWatcher:
 		 *
-		 *		// Disable the TextWatcher so that it doesn't evaluate text.
-		 *		const watcher = new TextWatcher( editor.model, text => from.test( text ) );
-		 *		watcher.isEnabled = false;
+		 *		const watcher = new TextWatcher( editor.model, testCallback );
 		 *
+		 *		// After this a testCallback will not be called.
+		 *		watcher.isEnabled = false;
 		 *
 		 * @observable
-		 * @readonly
 		 * @member {Boolean} #isEnabled
 		 */
 		this.set( 'isEnabled', true );