refactor: Add CreateForm to write comments
This commit is contained in:
@@ -24,3 +24,17 @@ export function formatDate(date, formatStr = 'PP') {
|
||||
locale: fr
|
||||
})
|
||||
}
|
||||
|
||||
export function hasRestrictedChar(text) {
|
||||
const regex = /[<>&"]/g
|
||||
|
||||
return Boolean(regex.test(text))
|
||||
}
|
||||
|
||||
export function formatFormContent(currentTarget) {
|
||||
const formData = new FormData(currentTarget)
|
||||
const formJson = Object.fromEntries(formData.entries())
|
||||
const {content} = formJson
|
||||
|
||||
return content.replaceAll('\'', '’')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user