Implement WYSIWYG newsletter editor with live preview, import, Supabase auto-save and Brevo export
This commit is contained in:
1 parent
8763c5bace
commit
538f2ccae3
10 files changed
+2252
-62
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import juice from 'juice';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const { html } = await req.json();
|
||||
|
||||
if (!html) {
|
||||
return NextResponse.json({ error: 'HTML obsah je povinný.' }, { status: 400 });
|
||||
}
|
||||
|
||||
const inlined = juice(html, {
|
||||
preserveMediaQueries: true,
|
||||
removeStyleTags: false,
|
||||
applyWidthAttributes: true,
|
||||
applyHeightAttributes: true
|
||||
});
|
||||
|
||||
return NextResponse.json({ html: inlined });
|
||||
} catch (err: any) {
|
||||
console.error('Inlining error:', err);
|
||||
return NextResponse.json({ error: err.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user