mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
12 lines
445 B
JavaScript
12 lines
445 B
JavaScript
export function htmlNormalizer(htmlInput) {
|
|
const str = htmlInput;
|
|
// We are normalizing the input from contenteditable of each browser, also removing unnecesary html tags
|
|
// https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content#Differences_in_markup_generation
|
|
console.log(htmlInput);
|
|
return str
|
|
.replace(/<p>/g, '<br>')
|
|
.replace(/<\/p>/g, '')
|
|
.replace(/<div>/g, '<br>')
|
|
.replace(/<\/div>/g, '');
|
|
}
|