🐛 (editor) Show variable highlight only when strictly equal
This commit is contained in:
@ -49,7 +49,7 @@ export const blockHasOptions = (block: Block) => 'options' in block
|
|||||||
export const parseVariableHighlight = (content: string, typebot: Typebot) => {
|
export const parseVariableHighlight = (content: string, typebot: Typebot) => {
|
||||||
const varNames = typebot.variables.map((v) => v.name)
|
const varNames = typebot.variables.map((v) => v.name)
|
||||||
return content.replace(/\{\{(.*?)\}\}/g, (fullMatch, foundVar) => {
|
return content.replace(/\{\{(.*?)\}\}/g, (fullMatch, foundVar) => {
|
||||||
if (varNames.some((val) => foundVar.includes(val))) {
|
if (varNames.some((val) => foundVar === val)) {
|
||||||
return `<span style="background-color:#ff8b1a; color:#ffffff; padding: 0.125rem 0.25rem; border-radius: 0.35rem">${fullMatch.replace(
|
return `<span style="background-color:#ff8b1a; color:#ffffff; padding: 0.125rem 0.25rem; border-radius: 0.35rem">${fullMatch.replace(
|
||||||
/{{|}}/g,
|
/{{|}}/g,
|
||||||
''
|
''
|
||||||
|
Reference in New Issue
Block a user