260810_04_ENH: 컨택 화면 ui 변경 및 개별 발송시 미리보기에 치환 문자열 치환 돼서 보여지도록 수정
This commit is contained in:
@@ -2,3 +2,16 @@
|
||||
// 값이 없는 토큰은 빈 문자열로 치환한다.
|
||||
export const substituteVariables = (contents: string, values: Record<string, string>) =>
|
||||
contents.replace(/\[\$([^\]]+)\]/g, (_, key: string) => values[key] ?? "");
|
||||
|
||||
export const escapeHtml = (value: string) =>
|
||||
value.replace(
|
||||
/[&<>"']/g,
|
||||
(character) =>
|
||||
({
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
})[character] ?? character,
|
||||
);
|
||||
Reference in New Issue
Block a user