refactor: Improve handling of template_dicts inputs in Vertex class
This commit is contained in:
parent
6f0ddc78c7
commit
3f8e6f0c46
1 changed files with 4 additions and 11 deletions
|
|
@ -83,7 +83,7 @@ export default function GenericModal({
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredWordsHighlight = matches.filter(
|
const filteredWordsHighlight = matches.filter(
|
||||||
(word) => !invalid_chars.includes(word)
|
(word) => !invalid_chars.includes(word),
|
||||||
);
|
);
|
||||||
|
|
||||||
setWordsHighlight(filteredWordsHighlight);
|
setWordsHighlight(filteredWordsHighlight);
|
||||||
|
|
@ -98,14 +98,7 @@ export default function GenericModal({
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setInputValue(value);
|
setInputValue(value);
|
||||||
}, [value, modalOpen]);
|
}, [value, modalOpen]);
|
||||||
let coloredContent = inputValue || "";
|
const coloredContent = (inputValue || "")
|
||||||
// Check if coloredContent is a string
|
|
||||||
// calling toString on undefined will throw an error
|
|
||||||
// so we need to check if it is a string first
|
|
||||||
if (typeof coloredContent !== "string") {
|
|
||||||
coloredContent = "";
|
|
||||||
}
|
|
||||||
coloredContent
|
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
.replace(/>/g, ">")
|
.replace(/>/g, ">")
|
||||||
.replace(regexHighlight, (match, p1, p2) => {
|
.replace(regexHighlight, (match, p1, p2) => {
|
||||||
|
|
@ -141,7 +134,7 @@ export default function GenericModal({
|
||||||
// to the first key of the custom_fields object
|
// to the first key of the custom_fields object
|
||||||
if (field_name === "") {
|
if (field_name === "") {
|
||||||
field_name = Array.isArray(
|
field_name = Array.isArray(
|
||||||
apiReturn.data?.frontend_node?.custom_fields?.[""]
|
apiReturn.data?.frontend_node?.custom_fields?.[""],
|
||||||
)
|
)
|
||||||
? apiReturn.data?.frontend_node?.custom_fields?.[""][0] ?? ""
|
? apiReturn.data?.frontend_node?.custom_fields?.[""][0] ?? ""
|
||||||
: apiReturn.data?.frontend_node?.custom_fields?.[""] ?? "";
|
: apiReturn.data?.frontend_node?.custom_fields?.[""] ?? "";
|
||||||
|
|
@ -216,7 +209,7 @@ export default function GenericModal({
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
!isEdit ? "rounded-lg border" : "",
|
!isEdit ? "rounded-lg border" : "",
|
||||||
"flex h-full max-h-[85%] w-full"
|
"flex h-full max-h-[85%] w-full",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{type === TypeModal.PROMPT && isEdit && !readonly ? (
|
{type === TypeModal.PROMPT && isEdit && !readonly ? (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue