260803_02_ENH: kri editor에서 preview에서도 줄바꿈 보여지게 수정
This commit is contained in:
9
registry/components/kri-editor/utils/emptyParagraph.ts
Normal file
9
registry/components/kri-editor/utils/emptyParagraph.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
const EMPTY_PARAGRAPH_PATTERN = /<p((?:\s+[^>]*)?)>\s*<\/p>/gi;
|
||||
|
||||
/**
|
||||
* TipTap이 빈 줄을 <p></p>로 직렬화하면 이메일 클라이언트에서 margin collapse로 사라진다.
|
||||
* 눈에 보이지 않는 콘텐츠( )를 채워 실제 발송 HTML에서도 빈 줄이 유지되게 한다.
|
||||
*/
|
||||
export function preserveEmptyParagraphs(html: string): string {
|
||||
return html.replace(EMPTY_PARAGRAPH_PATTERN, (_match, attrs: string) => `<p${attrs}> </p>`);
|
||||
}
|
||||
Reference in New Issue
Block a user