Skip to content

Commit aeb3353

Browse files
fix: restore flow action to strip HTML tags safely
1 parent 76ba1c9 commit aeb3353

File tree

1 file changed

+21
-4
lines changed
  • Specialized Areas/Flow Actions/Remove HTML Tags from a String in a Flow

1 file changed

+21
-4
lines changed
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
(function execute(inputs, outputs) {
2-
var htmlString = inputs.htmlValue || '';
3-
outputs.plainString = htmlString.replace(/<[^>]+>/g, '').trim();
4-
})(inputs, outputs);
1+
function removeHtmlTags(value) {
2+
if (value === null || value === undefined) {
3+
return '';
4+
}
5+
6+
var stringValue = String(value);
7+
var withoutTags = stringValue.replace(/<[^>]+>/g, ' ');
8+
9+
return withoutTags.replace(/\s+/g, ' ').trim();
10+
}
11+
12+
if (typeof module !== 'undefined') {
13+
module.exports = removeHtmlTags;
14+
}
15+
16+
if (typeof inputs !== 'undefined' && typeof outputs !== 'undefined') {
17+
(function execute(inputs, outputs) {
18+
var htmlString = inputs.htmlValue || '';
19+
outputs.plainString = removeHtmlTags(htmlString);
20+
})(inputs, outputs);
21+
}

0 commit comments

Comments
 (0)