feat(training): rich-text lessons with inline images and 25 MB manuals
CI / build (push) Has been cancelled

Admins were authoring plain-text lessons, which made illustrated tutorials
and reordering images impossible. Lesson bodies are now sanitized HTML from a
Tiptap editor with alignment, sizing, drag-reorder and alt text, and inline
images reuse the training_resources table so no migration is needed.
Attachments grow to 25 MB, PDFs stream inline, and SVG is rejected because it
can execute as a document. Legacy plain-text bodies are normalized on read.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-20 12:18:24 +00:00
parent e8759cdee8
commit cb5976edb2
18 changed files with 1799 additions and 114 deletions
+7 -1
View File
@@ -3,6 +3,7 @@ import { auth } from "@/auth/config";
import { hasPermission } from "@/auth/permissions";
import type { SystemRole } from "@/auth/roles";
import { listLessons } from "@/db/training";
import { trainingBodyToHtml } from "@/lib/rich-text";
import { TrainingPanel } from "@/components/app/training-panel";
import { BookOpenCheck, Download, ShieldCheck, UserRound } from "lucide-react";
@@ -17,7 +18,12 @@ export default async function TrainingPage() {
const session = await auth();
const role = (session?.user as { systemRole?: SystemRole } | undefined)?.systemRole;
const canEdit = hasPermission(role, "training.author");
const lessons = await listLessons({ includeUnpublished: canEdit });
const lessons = (await listLessons({ includeUnpublished: canEdit })).map(
(lesson) => ({
...lesson,
body: trainingBodyToHtml(lesson.body),
}),
);
return (
<div className="space-y-4">