浏览代码

Add testCallback ref docs

panr 5 年之前
父节点
当前提交
b889e41622
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 1 0
      packages/ckeditor5-typing/src/texttransformation.js
  2. 10 1
      packages/ckeditor5-typing/src/textwatcher.js

+ 1 - 0
packages/ckeditor5-typing/src/texttransformation.js

@@ -134,6 +134,7 @@ export default class TextTransformation extends Plugin {
 				const match = from.test( text );
 				const match = from.test( text );
 
 
 				if ( match ) {
 				if ( match ) {
+					// See {module:typing/textwatcher~TextWatcher#testCallback}
 					return {
 					return {
 						match,
 						match,
 						data: {
 						data: {

+ 10 - 1
packages/ckeditor5-typing/src/textwatcher.js

@@ -26,10 +26,19 @@ export default class TextWatcher {
 	 * Creates a text watcher instance.
 	 * Creates a text watcher instance.
 	 *
 	 *
 	 * @param {module:engine/model/model~Model} model
 	 * @param {module:engine/model/model~Model} model
-	 * @param {Function} testCallback The function used to match the text.
+	 * @param {module:typing/textwatcher~TextWatcher#testCallback} testCallback
 	 */
 	 */
 	constructor( model, testCallback ) {
 	constructor( model, testCallback ) {
 		this.model = model;
 		this.model = model;
+
+		/**
+		 * The function used to match the text.
+		 *
+		 * @member {Function} #testCallback
+		 * @returns {Object} textMatcher
+		 * @returns {Boolean} textMatcher.match The value indicates if text matches the pattern.
+		 * @returns {Any} [textMatcher.data] Additional data that can be returned from the callback.
+		 */
 		this.testCallback = testCallback;
 		this.testCallback = testCallback;
 		this.hasMatch = false;
 		this.hasMatch = false;