mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-02 10:47:30 +00:00
15 lines
404 B
TypeScript
15 lines
404 B
TypeScript
export function getHTMLEncodedText(htmlString: string) {
|
|
const div = document.createElement('div')
|
|
div.textContent = htmlString || ''
|
|
return div.innerHTML
|
|
}
|
|
|
|
export const truncateText = (text: string, maxLength: number = 50) => {
|
|
if (ncIsNullOrUndefined(text)) {
|
|
return ''
|
|
}
|
|
text = `${text}`
|
|
if (text.length <= maxLength) return text
|
|
return `${text.substring(0, maxLength - 3)}...`
|
|
}
|