diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cf1aba98..ecb181cab2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to ### Added - ✨(backend) support creating subdoc from file #1987 +- ✨(y-provider) preserve callouts, PDFs, page breaks and interlinking + links on HTML/markdown export ### Fixed diff --git a/src/frontend/servers/y-provider/__tests__/convert.test.ts b/src/frontend/servers/y-provider/__tests__/convert.test.ts index 5acba31050..4ba627ba97 100644 --- a/src/frontend/servers/y-provider/__tests__/convert.test.ts +++ b/src/frontend/servers/y-provider/__tests__/convert.test.ts @@ -11,6 +11,7 @@ vi.mock('../src/env', async (importOriginal) => { }; }); +import { docsBlockNoteSchema } from '@/blockSpecs'; import { initApp } from '@/servers'; import { @@ -300,6 +301,314 @@ describe('Conversion Testing', () => { expect(response.body).toStrictEqual(expectedBlocks); }); + test('POST /api/convert Yjs to HTML with callout block', async () => { + const app = initApp(); + const editor = ServerBlockNoteEditor.create({ + schema: docsBlockNoteSchema, + }); + const blocks = [ + { + type: 'callout' as const, + props: { emoji: '⚠️', backgroundColor: 'yellow' }, + content: [{ type: 'text' as const, text: 'Be careful', styles: {} }], + }, + ]; + const yDocument = editor.blocksToYDoc(blocks, 'document-store'); + const yjsUpdate = Y.encodeStateAsUpdate(yDocument); + const response = await request(app) + .post('/api/convert') + .set('origin', origin) + .set('authorization', `Bearer ${apiKey}`) + .set('content-type', 'application/vnd.yjs.doc') + .set('accept', 'text/html') + .send(Buffer.from(yjsUpdate)); + + expect(response.status).toBe(200); + expect(response.text).toContain('). + expect(response.text).toContain( + '