🐛 (editor) Fix text bubble regex not compatible with Safari
This commit is contained in:
@ -10,7 +10,6 @@ export const isWriteTypebotForbidden = async (
|
||||
user: Pick<User, 'email' | 'id'>
|
||||
) => {
|
||||
if (
|
||||
process.env.ADMIN_EMAIL === user.email ||
|
||||
typebot.collaborators.find(
|
||||
(collaborator) => collaborator.userId === user.id
|
||||
)?.type === CollaborationType.WRITE
|
||||
|
@ -48,9 +48,8 @@ export const blockHasOptions = (block: Block) => 'options' in block
|
||||
|
||||
export const parseVariableHighlight = (content: string, typebot: Typebot) => {
|
||||
const varNames = typebot.variables.map((v) => v.name)
|
||||
return content.replace(
|
||||
new RegExp(`(?<!href="){{(${varNames.join('|')})}}`, 'g'),
|
||||
(fullMatch, foundVar) => {
|
||||
return content.replace(/\{\{(.*?)\}\}/g, (fullMatch, foundVar) => {
|
||||
if (content.includes(`href="{{${foundVar}}}"`)) return fullMatch
|
||||
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(
|
||||
/{{|}}/g,
|
||||
@ -58,8 +57,7 @@ export const parseVariableHighlight = (content: string, typebot: Typebot) => {
|
||||
)}</span>`
|
||||
}
|
||||
return fullMatch
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
export const setMultipleRefs =
|
||||
|
Reference in New Issue
Block a user