Skip to content

Commit fd12b7c

Browse files
Check HTML function added
1 parent 02f95ec commit fd12b7c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

CheckHTML.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const WebpartFieldFillCheck = (tabsData) => {
2+
if (tabsData) {
3+
if (tabsData?.length === 0) {
4+
return false;
5+
} else {
6+
const values = Object.values(tabsData?.[0]);
7+
console.log(values, "ffff");
8+
9+
//! Function to check if a value contains HTML tags
10+
const isHTMLString = (value) => {
11+
//! Regular expression to detect HTML tags
12+
const htmlRegex = /<[^>]+>/g;
13+
return typeof value === "string" && htmlRegex.test(value);
14+
};
15+
16+
return values?.some(
17+
//! Return false if it's an HTML string
18+
(value) => value !== "" && !isHTMLString(value)
19+
);
20+
}
21+
}
22+
return false;
23+
};
24+
25+
26+
27+
28+
29+
30+
const WebpartFieldFillCheck = (tabsData) => {
31+
if (tabsData) {
32+
if (tabsData?.length === 0) {
33+
return false;
34+
} else {
35+
return Object.values(tabsData?.[0])?.some(
36+
(value) => value !== ""
37+
);
38+
}
39+
}
40+
};

0 commit comments

Comments
 (0)