feat: Ref 호환 Tiptap 편집 기능 확장

국가 방침과 임관 권유 편집기에 글꼴, 크기, 색상, 정렬, 구분선과 sam-image 업로드를 추가한다. Ref Chromium 비교와 HTML 정화, 업로드 경계를 회귀 테스트로 고정한다.
This commit is contained in:
2026-08-19 16:53:11 +00:00
parent 9d45c8dd4c
commit 45ac97c839
7 changed files with 535 additions and 37 deletions
+19
View File
@@ -69,6 +69,25 @@ describe('nation HTML purification', () => {
expect(clean).toContain('https://player.vimeo.com/video/1234');
});
it('preserves the Tiptap font, color, background, alignment, rule, and uploaded image contract', () => {
const source = [
'<p style="text-align:center">',
'<span style="font-family:Pretendard, sans-serif;font-size:22px;color:#123456;background-color:#fedcba">방침</span>',
'</p><hr><img src="https://sam-image.hided.net/uploads/core2026/0123456789abcdef0123456789abcdef.webp" alt="방침.png">',
].join('');
const clean = purifyNationHtml(source);
expect(clean).toContain('style="text-align:center"');
expect(clean).toContain(
'style="font-family:Pretendard, sans-serif;font-size:22px;color:#123456;background-color:#fedcba"'
);
expect(clean).toContain('<hr />');
expect(clean).toContain(
'src="https://sam-image.hided.net/uploads/core2026/0123456789abcdef0123456789abcdef.webp"'
);
});
it('is idempotent for already-purified stored values', () => {
const first = purifyNationHtml('<p style="color:red"><b>방침</b></p>');
expect(purifyNationHtml(first)).toBe(first);