🐛 (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'>
|
user: Pick<User, 'email' | 'id'>
|
||||||
) => {
|
) => {
|
||||||
if (
|
if (
|
||||||
process.env.ADMIN_EMAIL === user.email ||
|
|
||||||
typebot.collaborators.find(
|
typebot.collaborators.find(
|
||||||
(collaborator) => collaborator.userId === user.id
|
(collaborator) => collaborator.userId === user.id
|
||||||
)?.type === CollaborationType.WRITE
|
)?.type === CollaborationType.WRITE
|
||||||
|
@ -48,18 +48,16 @@ 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(
|
return content.replace(/\{\{(.*?)\}\}/g, (fullMatch, foundVar) => {
|
||||||
new RegExp(`(?<!href="){{(${varNames.join('|')})}}`, 'g'),
|
if (content.includes(`href="{{${foundVar}}}"`)) return fullMatch
|
||||||
(fullMatch, foundVar) => {
|
if (varNames.some((val) => foundVar === 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,
|
''
|
||||||
''
|
)}</span>`
|
||||||
)}</span>`
|
|
||||||
}
|
|
||||||
return fullMatch
|
|
||||||
}
|
}
|
||||||
)
|
return fullMatch
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setMultipleRefs =
|
export const setMultipleRefs =
|
||||||
|
Reference in New Issue
Block a user