diff --git a/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js b/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js
index 433edc1a9..10c1171d6 100644
--- a/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js
+++ b/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js
@@ -1,6 +1,7 @@
// 06/25/21 Eric Smith Added a Required attribute and increased the bottom margin to better match standard components
// 07/02/21 Eric Smith Added a Required * to the Input Label if Required is True
// 04/04/23 Clifford Beul Added disabled categories and optional overwrite of formats
+// 01/08/24 Declan Toohey Modified character count calculation to not include HTML characters in character count
import { LightningElement, api, track } from 'lwc';
@@ -18,6 +19,7 @@ export default class inputRichTextFSC_LWC extends LightningElement {
@api required = false;
@api disabledCategories = '';
@api enabledFormats;
+ @api excludeHTMLCharacterCount = false;
formats = ['font', 'size', 'bold', 'italic', 'underline',
'strike', 'list', 'indent', 'align', 'link',
@@ -193,7 +195,13 @@ export default class inputRichTextFSC_LWC extends LightningElement {
this.isValidCheck = true;
this.richText = event.target.value;
}
+
this.characterCount = this.richText.length;
+ if (this.excludeHTMLCharacterCount) {
+ //Regex <[^>]*> removes any HTML from the word count
+ this.characterCount = this.richText.replace(/<[^>]*>/ig, "").length;
+ }
+
if(this.characterCap && this.characterCount > this.characterLimit){
this.isValidCheck = false;
}
diff --git a/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js-meta.xml b/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js-meta.xml
index 672fcc25c..da482fd49 100644
--- a/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js-meta.xml
+++ b/flow_screen_components/richTextInputFSC/force-app/main/default/lwc/inputRichTextFSC/inputRichTextFSC.js-meta.xml
@@ -18,6 +18,7 @@
+
\ No newline at end of file