From 205b16ddd514bffa3fb6fc00be6bb2263b1d9270 Mon Sep 17 00:00:00 2001 From: Mayank Raj Date: Thu, 27 May 2021 09:10:51 +0530 Subject: [PATCH] Added getMatches method --- src/ParsedText.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ParsedText.js b/src/ParsedText.js index d8a0cc5..3aa5fb7 100644 --- a/src/ParsedText.js +++ b/src/ParsedText.js @@ -94,6 +94,10 @@ class ParsedText extends React.Component { }); } + getMatches() { + return this.textExtraction.parse() + } + getParsedText() { if (!this.props.parse) { return this.props.children; @@ -102,12 +106,12 @@ class ParsedText extends React.Component { return this.props.children; } - const textExtraction = new TextExtraction( + this.textExtraction = new TextExtraction( this.props.children, this.getPatterns(), ); - return textExtraction.parse().map((props, index) => { + return this.textExtraction.parse().map((props, index) => { const { style: parentStyle } = this.props; const { style, ...remainder } = props; return (