refactor: Improve GenericModal coloredContent function
Update the coloredContent function in GenericModal to ensure the input value is converted to a string before applying replacements. This change improves the reliability and consistency of the function.
This commit is contained in:
parent
40ce88b9ea
commit
ccb9ba3307
1 changed files with 1 additions and 0 deletions
|
|
@ -99,6 +99,7 @@ export default function GenericModal({
|
||||||
setInputValue(value);
|
setInputValue(value);
|
||||||
}, [value, modalOpen]);
|
}, [value, modalOpen]);
|
||||||
const coloredContent = (inputValue || "")
|
const coloredContent = (inputValue || "")
|
||||||
|
?.toString()
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
.replace(/>/g, ">")
|
.replace(/>/g, ">")
|
||||||
.replace(regexHighlight, (match, p1, p2) => {
|
.replace(regexHighlight, (match, p1, p2) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue