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

Commit

Permalink
Add testCallback ref docs
Browse files Browse the repository at this point in the history
  • Loading branch information
panr committed Mar 3, 2020
1 parent 9dcd938 commit 22e6de7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/texttransformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export default class TextTransformation extends Plugin {
const match = from.test( text );

if ( match ) {
// See {module:typing/textwatcher~TextWatcher#testCallback}
return {
match,
data: {
Expand Down
11 changes: 10 additions & 1 deletion src/textwatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,19 @@ 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.
* @param {module:typing/textwatcher~TextWatcher#testCallback} testCallback
*/
constructor( model, testCallback ) {
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.hasMatch = false;

Expand Down

0 comments on commit 22e6de7

Please sign in to comment.