Files
nocodb/packages/nc-gui/utils/stringUtils.ts
DarkPhoenix2704 0f49ada4ea fix: ui breaking
2025-08-28 14:52:06 +00:00

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)}...`
}