I am using a contenteditable div and while pasting any text with line breaks. it is adding multiple \n. Please refer below code and suggest a solution:
Sample Text Below:
Hi Sir,
This is for the testing Purpose only. Username: <> Password: <>
Best, DEMO USER
Current Output in innerText:
Hi Sir,\n\n\n\n\n\nThis is for the testing Purpose only.\nUsername: <>\nPassword: <>\n\n\n\n\nBest,\nDEMO USER
Expected Output in innerText:
Hi Sir,\nThis is for the testing Purpose only.\nUsername: <>\nPassword: <>\nBest,\nDEMO USER