feat(training): rich-text lessons with inline images and 25 MB manuals
CI / build (push) Has been cancelled
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:
+1
-1
@@ -65,7 +65,7 @@ POSTMARK_FROM=media@localhost
|
|||||||
# Console transport directory (a named Docker volume in compose).
|
# Console transport directory (a named Docker volume in compose).
|
||||||
OUTBOX_DIR=/tmp/outbox
|
OUTBOX_DIR=/tmp/outbox
|
||||||
|
|
||||||
# Training attachments (metadata in Postgres, bytes on disk; max 5 MB each).
|
# Training attachments (metadata in Postgres, bytes on disk; max 25 MB each).
|
||||||
UPLOAD_DIR=/tmp/uploads
|
UPLOAD_DIR=/tmp/uploads
|
||||||
|
|
||||||
# NFS archive. Mount the export on the Docker host, then point
|
# NFS archive. Mount the export on the Docker host, then point
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ Built with Next.js 15, React 19, TypeScript, PostgreSQL 16, and Drizzle ORM. It
|
|||||||
- Volunteers record self-comfort; mentors/admins verify the real level. Every level change appends an assessment-history row.
|
- Volunteers record self-comfort; mentors/admins verify the real level. Every level change appends an assessment-history row.
|
||||||
- Per-skill mentor opt-in and persisted admin approval; trainee shadow seats require a paired, mentor-ready volunteer.
|
- Per-skill mentor opt-in and persisted admin approval; trainee shadow seats require a paired, mentor-ready volunteer.
|
||||||
- Skills matrix, readiness scoring, and growth-goal domain rules.
|
- Skills matrix, readiness scoring, and growth-goal domain rules.
|
||||||
- Training lessons with attachments (images, PDF, text, Markdown, Word; 5 MB max), draft/publish, and separate admin/volunteer guides.
|
- Rich-text training lessons with headings, lists, links, inline images (align, resize, drag to reorder), and PDF/Word/text manuals up to 25 MB, plus draft/publish controls and separate admin/volunteer guides.
|
||||||
|
|
||||||
### Events and media
|
### Events and media
|
||||||
|
|
||||||
|
|||||||
@@ -553,10 +553,10 @@ Still missing screens (APIs exist): volunteer profile + prefs, blackout calendar
|
|||||||
|
|
||||||
## 13. Training, uploads, settings
|
## 13. Training, uploads, settings
|
||||||
|
|
||||||
- Lessons: plain-text body, published flag, ordering. Volunteers see published; admins author/publish/delete. Two starter lessons seeded only when the table is empty.
|
- Lessons: sanitized rich-text HTML body (headings, lists, links, inline images with alignment/size/move controls), published flag, ordering. Volunteers see published; admins author/publish/delete. Two plain-text starter lessons seeded only when the table is empty and normalized to HTML on read.
|
||||||
- Attachments: images/PDF/plain text/Markdown/Word, ≤5 MB, random stored name, metadata in Postgres, bytes under `UPLOAD_DIR`.
|
- Attachments: images/PDF/plain text/Markdown/Word, ≤25 MB, random stored name, metadata in Postgres, bytes under `UPLOAD_DIR`.
|
||||||
- Uploads verify **magic bytes** against the declared MIME.
|
- Uploads verify **magic bytes** against the declared MIME; SVG is rejected because it can execute as a document.
|
||||||
- Serving requires a session; only images render inline, everything else is an attachment, with `nosniff`.
|
- Serving requires a session; images and PDFs render inline, everything else is a download, with `nosniff`.
|
||||||
- Any signed-in team member can fetch any attachment id (team-wide content by design).
|
- Any signed-in team member can fetch any attachment id (team-wide content by design).
|
||||||
- Delete removes bytes best-effort; there is no orphan-file sweep.
|
- Delete removes bytes best-effort; there is no orphan-file sweep.
|
||||||
- Runtime settings: `app_settings` holds sender/inbox and the Gmail address + AES-256-GCM app password. Blank password keeps the stored one; an empty address disconnects Gmail. Saves are audited without the secret.
|
- Runtime settings: `app_settings` holds sender/inbox and the Gmail address + AES-256-GCM app password. Blank password keeps the stored one; an empty address disconnects Gmail. Saves are audited without the secret.
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import { signInAs, resetDb, BASE } from "./dev";
|
|||||||
let lessonTitle: string;
|
let lessonTitle: string;
|
||||||
let lessonId: string;
|
let lessonId: string;
|
||||||
|
|
||||||
|
test.describe.configure({ mode: "serial" });
|
||||||
|
|
||||||
test.describe("training", () => {
|
test.describe("training", () => {
|
||||||
test.beforeAll(async ({ browser }) => {
|
test.beforeAll(async ({ browser }) => {
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
@@ -59,6 +61,57 @@ test.describe("training", () => {
|
|||||||
await expect(page.getByRole("link", { name: "guide.txt" })).toBeVisible();
|
await expect(page.getByRole("link", { name: "guide.txt" })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("admin adds a rich image and a PDF manual", async ({ page }) => {
|
||||||
|
await page.setViewportSize({ width: 1024, height: 900 });
|
||||||
|
await signInAs(page, "admin@glenloch.local");
|
||||||
|
await page.goto(`${BASE}/training`);
|
||||||
|
|
||||||
|
const lesson = page
|
||||||
|
.locator("li")
|
||||||
|
.filter({ has: page.getByRole("heading", { name: lessonTitle }) })
|
||||||
|
.first();
|
||||||
|
await lesson.getByRole("button", { name: "Edit" }).click();
|
||||||
|
|
||||||
|
// 1×1 PNG, but the upload route only needs a valid PNG signature here.
|
||||||
|
const png = Buffer.from(
|
||||||
|
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAusB9Y9Z7ZkAAAAASUVORK5CYII=",
|
||||||
|
"base64",
|
||||||
|
);
|
||||||
|
await page
|
||||||
|
.getByLabel("Upload an image for the lesson")
|
||||||
|
.setInputFiles({ name: "console.png", mimeType: "image/png", buffer: png });
|
||||||
|
|
||||||
|
const image = page.getByRole("img", { name: "console.png" });
|
||||||
|
await expect(image).toBeVisible();
|
||||||
|
await image.click();
|
||||||
|
await expect(
|
||||||
|
page.getByRole("toolbar", { name: "Selected image" }),
|
||||||
|
).toBeVisible();
|
||||||
|
await page.getByRole("button", { name: "Align image right" }).click();
|
||||||
|
await page
|
||||||
|
.getByRole("button", { name: "Set image width to 50%" })
|
||||||
|
.click();
|
||||||
|
await page.getByRole("button", { name: "Save lesson" }).click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
lesson.locator('img[data-align="right"][width="50%"]'),
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
const pdf = Buffer.from("%PDF-1.7\n% E2E manual\n");
|
||||||
|
await lesson
|
||||||
|
.getByLabel("Attach a manual or document")
|
||||||
|
.setInputFiles({ name: "audio-manual.pdf", mimeType: "application/pdf", buffer: pdf });
|
||||||
|
await lesson.getByRole("button", { name: "Attach", exact: true }).click();
|
||||||
|
|
||||||
|
const manual = lesson.getByRole("link", { name: "audio-manual.pdf" });
|
||||||
|
await expect(manual).toBeVisible();
|
||||||
|
const href = await manual.getAttribute("href");
|
||||||
|
expect(href).toBeTruthy();
|
||||||
|
const download = await page.request.get(`${BASE}${href}`);
|
||||||
|
expect(download.status()).toBe(200);
|
||||||
|
expect(download.headers()["content-disposition"]).toContain("inline");
|
||||||
|
});
|
||||||
|
|
||||||
test("volunteer sees published lessons but no authoring controls", async ({
|
test("volunteer sees published lessons but no authoring controls", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -73,5 +126,9 @@ test.describe("training", () => {
|
|||||||
page.getByRole("button", { name: "Create lesson" }),
|
page.getByRole("button", { name: "Create lesson" }),
|
||||||
).toHaveCount(0);
|
).toHaveCount(0);
|
||||||
await expect(page.getByRole("link", { name: "guide.txt" })).toBeVisible();
|
await expect(page.getByRole("link", { name: "guide.txt" })).toBeVisible();
|
||||||
|
await expect(page.getByRole("img", { name: "console.png" })).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.getByRole("link", { name: "audio-manual.pdf" }),
|
||||||
|
).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-label": "^2.1.17",
|
"@radix-ui/react-label": "^2.1.17",
|
||||||
"@radix-ui/react-slot": "^1.5.0",
|
"@radix-ui/react-slot": "^1.5.0",
|
||||||
|
"@tiptap/extension-image": "^3.34.0",
|
||||||
|
"@tiptap/pm": "^3.34.0",
|
||||||
|
"@tiptap/react": "^3.34.0",
|
||||||
|
"@tiptap/starter-kit": "^3.34.0",
|
||||||
"archiver": "^8.0.0",
|
"archiver": "^8.0.0",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
@@ -31,6 +35,7 @@
|
|||||||
"postgres": "^4.1.1",
|
"postgres": "^4.1.1",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
|
"sanitize-html": "^2.18.2",
|
||||||
"sharp": "0.34.5",
|
"sharp": "0.34.5",
|
||||||
"tailwind-merge": "^3.7.0",
|
"tailwind-merge": "^3.7.0",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
@@ -48,6 +53,7 @@
|
|||||||
"@types/nodemailer": "^8.0.2",
|
"@types/nodemailer": "^8.0.2",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
|
"@types/sanitize-html": "^2.16.2",
|
||||||
"dotenv": "^18.0.10",
|
"dotenv": "^18.0.10",
|
||||||
"drizzle-kit": "^0.31.11",
|
"drizzle-kit": "^0.31.11",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
|
|||||||
Generated
+620
@@ -14,6 +14,18 @@ importers:
|
|||||||
'@radix-ui/react-slot':
|
'@radix-ui/react-slot':
|
||||||
specifier: ^1.5.0
|
specifier: ^1.5.0
|
||||||
version: 1.5.0(@types/react@19.3.0)(react@19.1.0)
|
version: 1.5.0(@types/react@19.3.0)(react@19.1.0)
|
||||||
|
'@tiptap/extension-image':
|
||||||
|
specifier: ^3.34.0
|
||||||
|
version: 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/pm':
|
||||||
|
specifier: ^3.34.0
|
||||||
|
version: 3.34.0
|
||||||
|
'@tiptap/react':
|
||||||
|
specifier: ^3.34.0
|
||||||
|
version: 3.34.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||||
|
'@tiptap/starter-kit':
|
||||||
|
specifier: ^3.34.0
|
||||||
|
version: 3.34.0
|
||||||
archiver:
|
archiver:
|
||||||
specifier: ^8.0.0
|
specifier: ^8.0.0
|
||||||
version: 8.0.0(bare-buffer@3.7.3)
|
version: 8.0.0(bare-buffer@3.7.3)
|
||||||
@@ -50,6 +62,9 @@ importers:
|
|||||||
react-dom:
|
react-dom:
|
||||||
specifier: 19.1.0
|
specifier: 19.1.0
|
||||||
version: 19.1.0(react@19.1.0)
|
version: 19.1.0(react@19.1.0)
|
||||||
|
sanitize-html:
|
||||||
|
specifier: ^2.18.2
|
||||||
|
version: 2.18.2
|
||||||
sharp:
|
sharp:
|
||||||
specifier: 0.34.5
|
specifier: 0.34.5
|
||||||
version: 0.34.5
|
version: 0.34.5
|
||||||
@@ -96,6 +111,9 @@ importers:
|
|||||||
'@types/react-dom':
|
'@types/react-dom':
|
||||||
specifier: ^19
|
specifier: ^19
|
||||||
version: 19.3.0(@types/react@19.3.0)
|
version: 19.3.0(@types/react@19.3.0)
|
||||||
|
'@types/sanitize-html':
|
||||||
|
specifier: ^2.16.2
|
||||||
|
version: 2.16.2
|
||||||
dotenv:
|
dotenv:
|
||||||
specifier: ^18.0.10
|
specifier: ^18.0.10
|
||||||
version: 18.0.10
|
version: 18.0.10
|
||||||
@@ -804,6 +822,15 @@ packages:
|
|||||||
'@noble/hashes':
|
'@noble/hashes':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@floating-ui/core@1.8.0':
|
||||||
|
resolution: {integrity: sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==}
|
||||||
|
|
||||||
|
'@floating-ui/dom@1.8.0':
|
||||||
|
resolution: {integrity: sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==}
|
||||||
|
|
||||||
|
'@floating-ui/utils@0.2.12':
|
||||||
|
resolution: {integrity: sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==}
|
||||||
|
|
||||||
'@humanfs/core@0.19.2':
|
'@humanfs/core@0.19.2':
|
||||||
resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==}
|
resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==}
|
||||||
engines: {node: '>=18.18.0'}
|
engines: {node: '>=18.18.0'}
|
||||||
@@ -1360,6 +1387,161 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@testing-library/dom': '>=7.21.4'
|
'@testing-library/dom': '>=7.21.4'
|
||||||
|
|
||||||
|
'@tiptap/core@3.34.0':
|
||||||
|
resolution: {integrity: sha512-PwpE5MAXt586AxIO5bW2RyJ3OUXdPfG5M1M5v/LIMCkDwIgRKegx8uERlABoI6575mWqaH/P6Xm+tequJ5UUnw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-blockquote@3.34.0':
|
||||||
|
resolution: {integrity: sha512-mnqvP3WpE0HBoHE9q/R9fi+M103w7Bhw5C9bnA4OqMJ9buOdoOJquzFtfT+7YVBIphgkjRWDao1dgUdoYJgWjQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-bold@3.34.0':
|
||||||
|
resolution: {integrity: sha512-QvqHpxDe1vEnaOk88O28zsKD+jXTRWOYTBuoosLJzU+fNedC0z3uEXVqUUO4ljwJxj604mLuQBB4aVb+/7ObSg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-bubble-menu@3.34.0':
|
||||||
|
resolution: {integrity: sha512-Q6+/RxlaYLsF+hm9MFY//wwVFA4Apfjn2EAnbjaBlaiIs1LtB/s5t5fSjRwCBzadTf9ysMvGh7parpN1hT0tug==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-bullet-list@3.34.0':
|
||||||
|
resolution: {integrity: sha512-3xtzmtIMoqGa3fAcNmRiR1DHTBMiGr167mgt5ksK6a+m38tCl74W+kPf59HknGojbhI/pVM+Unf2htsOdijDNw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-code-block@3.34.0':
|
||||||
|
resolution: {integrity: sha512-PTwtNuuGtlqyDTGms8E3ou0918gbDmzdh68i2taIZ4cU5vPe0doaKbtcQ2emX8Te+IOnm80NdlNM1OxIry9mnA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-code@3.34.0':
|
||||||
|
resolution: {integrity: sha512-+97O+ao+wnKGMy13q7T+JUFDWsbPYvAzfPHMqo+vTMFGphiAVHnmXTQZ+4rx7V2KnWSYY1IvSpFVORb7n1sbWQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-document@3.34.0':
|
||||||
|
resolution: {integrity: sha512-Mvs7AUGJkUWI4HfsCNvWQF2f4YdVqR1UHKYnkFdxCifuGPwFBc8bT7rNMT6NBFjRZADbf4HrE/UIQqVQA5Gfyw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-dropcursor@3.34.0':
|
||||||
|
resolution: {integrity: sha512-U7dpUo1pcxWbVi11iJqWqE29GMdQOewwbO7ChD3J0CWqJ3ZPWo0s777dLTQIGr3ImxpZo6lTrWyXqzkNf0rHfw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/extensions': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-floating-menu@3.34.0':
|
||||||
|
resolution: {integrity: sha512-3D/cYVi4T5SzgMQR9A5cKSSDspVty92/o/+xnON5+buPSD/7+EVVa0XubCoRl/zNqo8jGapZX3JboslQO4Q7ng==}
|
||||||
|
peerDependencies:
|
||||||
|
'@floating-ui/dom': ^1.0.0
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-gapcursor@3.34.0':
|
||||||
|
resolution: {integrity: sha512-qA+1MLOun+q2njlh5Wjw2N6Wyuxaw8bIgU31abwPxhNwg2XNlfBr27O3zKO5GGxDyyc2waEymhSLjat6f97hUA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/extensions': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-hard-break@3.34.0':
|
||||||
|
resolution: {integrity: sha512-um2QJimgSKRpaUBVvAfRWItmcJEJPnv4bVz78FyOrpxvQuVSgV18giF7t9pLCMJPBJ/H+jTSPQ87t+A4Xn4whA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-heading@3.34.0':
|
||||||
|
resolution: {integrity: sha512-bm43fyQThYPmpkxHYy8EaGhtRiAXUSfp4Sn0DI6Z/ClvLEKGngogl883wUcqwdWCeViJwz1rte7z3+AqAigrCg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-horizontal-rule@3.34.0':
|
||||||
|
resolution: {integrity: sha512-gtKVypnxEccuoaQqZp7WFmjdlT/pNMGB+MxkTKPLi598Zw6xQaN+zJiqBaIVOmqIqu6l+jF0h1FaRyB69Tw8tA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-image@3.34.0':
|
||||||
|
resolution: {integrity: sha512-IC8PfiTKWnRE9USYM/gI9aZkrGsgJ3IhduQX1JceE5wMp3ce2QKzEkDkFZrjk2EYgCPNCuvIIg5L0nbmogcKsg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-italic@3.34.0':
|
||||||
|
resolution: {integrity: sha512-X6jRBt0bCwx2TJpNuAxPyfPw3KFyfAKdeW51iwHd44NVmYa5kK7R/RC/l+SUKMhyW8NyNh4Ia9TqeZjhZcgx7Q==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-link@3.34.0':
|
||||||
|
resolution: {integrity: sha512-yd/pHa4T/J/3oY4BMB4qHJHkde1z5V6c/2fY7OsG86R8oMrCim3Vo19yCHc7xsZC8RwjgWoCth1lAIdwvHNnLQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-list-item@3.34.0':
|
||||||
|
resolution: {integrity: sha512-NM0e2LjYoyaKMURMR8btBAbQ2KcUNxR2KiC7kTe+0b3GcGvaGArRUbZwgoWVmgHbi/QFSR63GxrU6WCiA+s8kg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-list-keymap@3.34.0':
|
||||||
|
resolution: {integrity: sha512-QG3gBIb9bbbfKNDw/ilJRl0urybJ1u+zzI5oTiDq4zVr86pROi7lPG0qj1bTW2uM3e519KLEYAJMhP6/m9SzkQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-list@3.34.0':
|
||||||
|
resolution: {integrity: sha512-PqYWtHzDQJMaJO0NdG7v2ngprY1YUE8bBKaG1shLBJrPGoo+8XiKrXCGI+mYrh5R/HHR9hkbK8n636txVd8dZw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-ordered-list@3.34.0':
|
||||||
|
resolution: {integrity: sha512-wFTfwBDKPowFwOH3VIXr1Oq3HbAa81OxslC9PW3ckEfAn9ckYXN/BWqGch87JLBPvLkW6NFYOwPD0OmwtnUBVA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-paragraph@3.34.0':
|
||||||
|
resolution: {integrity: sha512-hGoyXNl1xz7k+h5wNcSRY+UGe2uQE+YLf9iGuFPmzv2ub9XqRmuVc7MiTK6t+tDWdmPag4rH2c8waJ9GgmvzUQ==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-strike@3.34.0':
|
||||||
|
resolution: {integrity: sha512-rwzbX83SceQvdx/IcPqU5oF+7a7zB2SJFLAEkLUaXZkycCX//PC0abpaFC3KtUJ4EOCsGNxUNhXoddasgQRSKw==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-text@3.34.0':
|
||||||
|
resolution: {integrity: sha512-90gNJ24bsTrJVxfnnbXXFhsmPGUsk9ZGjwbbJ4OvqIoYX4BjmwuPBHL4NePL7kKwPtTKhcIHsm3C3ofZlVH/rg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-underline@3.34.0':
|
||||||
|
resolution: {integrity: sha512-4/Di2L96tCUo31SalwjeElOQC64bP2lIqXsruYNndo510fAkYEmzGHhfu4Eh0a4Z94lyA9BYI9zAgJS2yTdq8w==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extensions@3.34.0':
|
||||||
|
resolution: {integrity: sha512-VA5kMiyactt71jqyNrdVB8kyGeD35AvjhcL1bKf12+XTTXTtOJkhS2/IQhNYK4ooCW0bpmNiuBnrdFWaeXyUOg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/pm@3.34.0':
|
||||||
|
resolution: {integrity: sha512-/r64RekPVaLw/YUjGes8tH5voz5PYWLW6gahMf+nDZKs6nK4RtoZ4O6YFI+nV8XD1hygseQZPeJkT5OOkI4AdA==}
|
||||||
|
|
||||||
|
'@tiptap/react@3.34.0':
|
||||||
|
resolution: {integrity: sha512-DDqcnPZ0pVeU9E3hvQcK4rA5AWRe7PHDeFAGL6lW/aniYkJ1W2kKimjny3Lz43TxplvbH67f03Wey5l0GrKk8A==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': 3.34.0
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
'@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
'@types/react-dom': ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
react: ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
|
||||||
|
'@tiptap/starter-kit@3.34.0':
|
||||||
|
resolution: {integrity: sha512-SPlLjlGD8KpTBsUQJfNuRLprSCV8d69QACBloPZXCF0XGfpTmJWFzt1vGTfBzisRrI1iV/goXJJr8qw2SAIpiw==}
|
||||||
|
|
||||||
'@ts-morph/common@0.27.0':
|
'@ts-morph/common@0.27.0':
|
||||||
resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==}
|
resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==}
|
||||||
|
|
||||||
@@ -1404,6 +1586,12 @@ packages:
|
|||||||
'@types/readdir-glob@1.1.5':
|
'@types/readdir-glob@1.1.5':
|
||||||
resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==}
|
resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==}
|
||||||
|
|
||||||
|
'@types/sanitize-html@2.16.2':
|
||||||
|
resolution: {integrity: sha512-kuAbgDCFv418flrp3z4o/4ufLA/5ovmXRH0L419iZCPGO7w00znjeDI5Wy/KZWNIBpDQc7hucCK+J5almB6FyA==}
|
||||||
|
|
||||||
|
'@types/use-sync-external-store@0.0.6':
|
||||||
|
resolution: {integrity: sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==}
|
||||||
|
|
||||||
'@types/validate-npm-package-name@4.0.2':
|
'@types/validate-npm-package-name@4.0.2':
|
||||||
resolution: {integrity: sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw==}
|
resolution: {integrity: sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw==}
|
||||||
|
|
||||||
@@ -1944,6 +2132,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==}
|
resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
|
dayjs@1.11.23:
|
||||||
|
resolution: {integrity: sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==}
|
||||||
|
|
||||||
debounce-fn@4.0.0:
|
debounce-fn@4.0.0:
|
||||||
resolution: {integrity: sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==}
|
resolution: {integrity: sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -2029,6 +2220,22 @@ packages:
|
|||||||
dom-accessibility-api@0.6.3:
|
dom-accessibility-api@0.6.3:
|
||||||
resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}
|
resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==}
|
||||||
|
|
||||||
|
dom-serializer@3.1.1:
|
||||||
|
resolution: {integrity: sha512-4MEa38/QexBob6gFNwu+EGdWvhJ1OKuNwdYY3Y3NyeWDQfnGeDYQUDfIRzWu5B5gsv03so2Uxd28YC6zrsx3Lw==}
|
||||||
|
engines: {node: '>=20.19.0'}
|
||||||
|
|
||||||
|
domelementtype@3.0.0:
|
||||||
|
resolution: {integrity: sha512-umCQid3jKbDmVjx8jGaW7uUykm4DEUeyV21hPxNMo2nV955DhUThwqyOIDtreepP31hl84X7G5U9ZfsWvIB3Pg==}
|
||||||
|
engines: {node: '>=20.19.0'}
|
||||||
|
|
||||||
|
domhandler@6.0.1:
|
||||||
|
resolution: {integrity: sha512-gYzvtM72ZtxQO0T048kd6HWSbbGCNOUwcnfQ01cqIJ4X2IYKFFHZ5mKvrQETcFXxsRObZulDaKmy//R7TPtsBg==}
|
||||||
|
engines: {node: '>=20.19.0'}
|
||||||
|
|
||||||
|
domutils@4.0.2:
|
||||||
|
resolution: {integrity: sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA==}
|
||||||
|
engines: {node: '>=20.19.0'}
|
||||||
|
|
||||||
dot-prop@6.0.1:
|
dot-prop@6.0.1:
|
||||||
resolution: {integrity: sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==}
|
resolution: {integrity: sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
@@ -2162,6 +2369,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==}
|
resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==}
|
||||||
engines: {node: '>=8.6'}
|
engines: {node: '>=8.6'}
|
||||||
|
|
||||||
|
entities@8.1.0:
|
||||||
|
resolution: {integrity: sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==}
|
||||||
|
engines: {node: '>=20.19.0'}
|
||||||
|
|
||||||
entities@9.0.0:
|
entities@9.0.0:
|
||||||
resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==}
|
resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==}
|
||||||
engines: {node: '>=20.19.0'}
|
engines: {node: '>=20.19.0'}
|
||||||
@@ -2387,6 +2598,10 @@ packages:
|
|||||||
fast-deep-equal@3.1.3:
|
fast-deep-equal@3.1.3:
|
||||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||||
|
|
||||||
|
fast-equals@5.4.5:
|
||||||
|
resolution: {integrity: sha512-yKEpcFuRPu/pTQL2VB8YKE2yFldrLlIsoWtJeBnAdqEhvu21OgkFT0C8njf/xYc2LSZGEr3K9JGjthHJxnVLvQ==}
|
||||||
|
engines: {node: '>=6.0.0'}
|
||||||
|
|
||||||
fast-fifo@1.3.2:
|
fast-fifo@1.3.2:
|
||||||
resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
|
resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
|
||||||
|
|
||||||
@@ -2565,6 +2780,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==}
|
resolution: {integrity: sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==}
|
||||||
engines: {node: ^22.13.0 || >=24.0.0}
|
engines: {node: ^22.13.0 || >=24.0.0}
|
||||||
|
|
||||||
|
htmlparser2@12.0.0:
|
||||||
|
resolution: {integrity: sha512-Tz7u1i95/g2x2jz81+x0FBVhBhY5aRTvD3tXXdFaljuNdzDLJ8UGNRrTcj2cgQvAg3iW/h77Fz15nLW0L0CrZw==}
|
||||||
|
engines: {node: '>=20.19.0'}
|
||||||
|
|
||||||
human-signals@2.1.0:
|
human-signals@2.1.0:
|
||||||
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
|
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
|
||||||
engines: {node: '>=10.17.0'}
|
engines: {node: '>=10.17.0'}
|
||||||
@@ -2722,6 +2941,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}
|
resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
|
is-plain-object@5.1.0:
|
||||||
|
resolution: {integrity: sha512-bUi/yjmtKYcRVUtWRGr0UA6xEFh2I6zWUwMrUXB3s7bmYCaZ8a+0ZsTRkrawh/mzlSD1Y0Ph8bp/U+TvBpWDNw==}
|
||||||
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
is-potential-custom-element-name@1.0.1:
|
is-potential-custom-element-name@1.0.1:
|
||||||
resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}
|
resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}
|
||||||
|
|
||||||
@@ -2883,6 +3106,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==}
|
resolution: {integrity: sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==}
|
||||||
engines: {node: '>=0.10'}
|
engines: {node: '>=0.10'}
|
||||||
|
|
||||||
|
launder@1.7.2:
|
||||||
|
resolution: {integrity: sha512-DLg3HPnHUfBi5/MxMLmJD12dmlMpFEC2HgMW6vkZ/9JR0RU00kXoRGvDxAvFmdO0o610OA77i4FgNTLucmhDVg==}
|
||||||
|
|
||||||
lazystream@1.0.1:
|
lazystream@1.0.1:
|
||||||
resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==}
|
resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==}
|
||||||
engines: {node: '>= 0.6.3'}
|
engines: {node: '>= 0.6.3'}
|
||||||
@@ -2961,6 +3187,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==}
|
resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==}
|
||||||
engines: {node: '>= 12.0.0'}
|
engines: {node: '>= 12.0.0'}
|
||||||
|
|
||||||
|
linkifyjs@4.4.0:
|
||||||
|
resolution: {integrity: sha512-InTexvtbai+2c+dEVGcc6O6P2DMVIiwD9a/i4zFroazOIYLOS6FSVmAJ7kFeumnCMx6/gQqNAkbUvgMubV4+MA==}
|
||||||
|
|
||||||
locate-path@3.0.0:
|
locate-path@3.0.0:
|
||||||
resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==}
|
resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@@ -3192,6 +3421,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}
|
resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
orderedmap@2.1.1:
|
||||||
|
resolution: {integrity: sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==}
|
||||||
|
|
||||||
own-keys@1.0.2:
|
own-keys@1.0.2:
|
||||||
resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==}
|
resolution: {integrity: sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@@ -3224,6 +3456,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==}
|
resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
parse-srcset@1.0.2:
|
||||||
|
resolution: {integrity: sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==}
|
||||||
|
|
||||||
parse5-parser-stream@8.1.1:
|
parse5-parser-stream@8.1.1:
|
||||||
resolution: {integrity: sha512-hMcVbbUJcQmP8rURWUdYrT1flRiBiBVjq/RYGguJpDUgIXSqdYKlE0CxthmdMWoSlBAuL5bUBa73g0pttSy7Hw==}
|
resolution: {integrity: sha512-hMcVbbUJcQmP8rURWUdYrT1flRiBiBVjq/RYGguJpDUgIXSqdYKlE0CxthmdMWoSlBAuL5bUBa73g0pttSy7Hw==}
|
||||||
|
|
||||||
@@ -3335,6 +3570,45 @@ packages:
|
|||||||
prop-types@15.8.1:
|
prop-types@15.8.1:
|
||||||
resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}
|
resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}
|
||||||
|
|
||||||
|
prosemirror-changeset@2.4.6:
|
||||||
|
resolution: {integrity: sha512-P0cY3DSLm4M2boUOCmHDyaID5o6HgWmb21Bvs9p8lLqfJjKBBEHG5Ma5qW5SCmwOYamtWOLf2k+yvt6077zlTg==}
|
||||||
|
|
||||||
|
prosemirror-commands@1.7.2:
|
||||||
|
resolution: {integrity: sha512-q6Q6szxqdu9Xd6EcdKsqXghu5nQdZTpB4Q9yd04WRc7/jt763e/rT60Owh0L1GYY+T46o5rD+9lEN36dZS43tw==}
|
||||||
|
|
||||||
|
prosemirror-dropcursor@1.8.4:
|
||||||
|
resolution: {integrity: sha512-VmKxhcA6a+h5oPSYmfF1ZNeQqPbyYaIxqZsKqeYCyTlPtrjUgNaHL3P8vVaO19oqAV0zuaM/axkowZHrB1P3Tg==}
|
||||||
|
|
||||||
|
prosemirror-gapcursor@1.4.1:
|
||||||
|
resolution: {integrity: sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==}
|
||||||
|
|
||||||
|
prosemirror-history@1.5.2:
|
||||||
|
resolution: {integrity: sha512-/VCI9OUPT69PzzoKmLJ6xLTkMCXmpt/M6/tOlctR5DjSAinniYgjkw6Ao/Obmq/f5mG5csTQi6a9AWhwFVLSNA==}
|
||||||
|
|
||||||
|
prosemirror-inputrules@1.7.0:
|
||||||
|
resolution: {integrity: sha512-8osbijqTD9BtFWbtWbrJ47zvwwiC4/+Y993VzCKRYjPw3jK+CixvRlFu7UgT6mExqPnu12WOh+IF9l6921vqhA==}
|
||||||
|
|
||||||
|
prosemirror-keymap@1.2.3:
|
||||||
|
resolution: {integrity: sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==}
|
||||||
|
|
||||||
|
prosemirror-model@1.25.13:
|
||||||
|
resolution: {integrity: sha512-MlDMWGjYXaYOeCiO17jcybntCOzPnN+97U0809ke2QsgPtxW3n5/sD6ZKyJONUgMw1iP93ohZTjeKjnRJ7L6kQ==}
|
||||||
|
|
||||||
|
prosemirror-schema-list@1.6.1:
|
||||||
|
resolution: {integrity: sha512-QiL/QjgCWr+3Mhukm48E5d3XCC8lVEIanixGkXbWKUyxCUGy4ntVffFapmMwQ4vxhZw+8i7117W2N6FSyqyWfA==}
|
||||||
|
|
||||||
|
prosemirror-state@1.4.4:
|
||||||
|
resolution: {integrity: sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==}
|
||||||
|
|
||||||
|
prosemirror-tables@1.8.5:
|
||||||
|
resolution: {integrity: sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==}
|
||||||
|
|
||||||
|
prosemirror-transform@1.12.7:
|
||||||
|
resolution: {integrity: sha512-/e87cbxcM5WJOJrL1IrM9gJqO3EK8LdQoPvs+r4ss1lRO5t5QeqkU0SlmDvcitCSDUbm8s/MxbBB6ds4pY6Xlg==}
|
||||||
|
|
||||||
|
prosemirror-view@1.43.0:
|
||||||
|
resolution: {integrity: sha512-MZOUuhD+Gv7Cp7UlgvyhptUfb920NkLBgymhyhaM8xp+JXQyLhkssS2EXZvMI3ZU3vRoz5z7mRC32udVgNYHqg==}
|
||||||
|
|
||||||
punycode@2.3.1:
|
punycode@2.3.1:
|
||||||
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
@@ -3413,6 +3687,9 @@ packages:
|
|||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
rope-sequence@1.3.4:
|
||||||
|
resolution: {integrity: sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==}
|
||||||
|
|
||||||
run-applescript@7.1.0:
|
run-applescript@7.1.0:
|
||||||
resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==}
|
resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
@@ -3438,6 +3715,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==}
|
resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
|
sanitize-html@2.18.2:
|
||||||
|
resolution: {integrity: sha512-LTQVNHBeKB5qIae9x2J2Fw68ORnES++8vzYaG7DFT8P4GVCJFeHffHnRUzf5Mrxfx+4GweIvMRqkBPHHodaVNg==}
|
||||||
|
engines: {node: '>=22.12.0'}
|
||||||
|
|
||||||
saxes@6.0.0:
|
saxes@6.0.0:
|
||||||
resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}
|
resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}
|
||||||
engines: {node: '>=v12.22.7'}
|
engines: {node: '>=v12.22.7'}
|
||||||
@@ -3783,6 +4064,11 @@ packages:
|
|||||||
uri-js@4.4.1:
|
uri-js@4.4.1:
|
||||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||||
|
|
||||||
|
use-sync-external-store@1.7.0:
|
||||||
|
resolution: {integrity: sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==}
|
||||||
|
peerDependencies:
|
||||||
|
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
|
||||||
util-deprecate@1.0.2:
|
util-deprecate@1.0.2:
|
||||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
||||||
|
|
||||||
@@ -3874,6 +4160,9 @@ packages:
|
|||||||
jsdom:
|
jsdom:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
w3c-keyname@2.2.8:
|
||||||
|
resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
|
||||||
|
|
||||||
w3c-xmlserializer@6.0.0:
|
w3c-xmlserializer@6.0.0:
|
||||||
resolution: {integrity: sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==}
|
resolution: {integrity: sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==}
|
||||||
engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0}
|
engines: {node: ^22.22.2 || ^24.15.0 || >=26.0.0}
|
||||||
@@ -4487,6 +4776,20 @@ snapshots:
|
|||||||
|
|
||||||
'@exodus/bytes@1.16.0': {}
|
'@exodus/bytes@1.16.0': {}
|
||||||
|
|
||||||
|
'@floating-ui/core@1.8.0':
|
||||||
|
dependencies:
|
||||||
|
'@floating-ui/utils': 0.2.12
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@floating-ui/dom@1.8.0':
|
||||||
|
dependencies:
|
||||||
|
'@floating-ui/core': 1.8.0
|
||||||
|
'@floating-ui/utils': 0.2.12
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@floating-ui/utils@0.2.12':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@humanfs/core@0.19.2':
|
'@humanfs/core@0.19.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@humanfs/types': 0.15.0
|
'@humanfs/types': 0.15.0
|
||||||
@@ -4919,6 +5222,183 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@testing-library/dom': 10.4.2
|
'@testing-library/dom': 10.4.2
|
||||||
|
|
||||||
|
'@tiptap/core@3.34.0(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-blockquote@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-bold@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-bubble-menu@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@floating-ui/dom': 1.8.0
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@tiptap/extension-bullet-list@3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-code-block@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-code@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-document@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-dropcursor@3.34.0(@tiptap/extensions@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/extensions': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-floating-menu@3.34.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@floating-ui/dom': 1.8.0
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@tiptap/extension-gapcursor@3.34.0(@tiptap/extensions@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/extensions': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-hard-break@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-heading@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-horizontal-rule@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-image@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-italic@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-link@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
linkifyjs: 4.4.0
|
||||||
|
|
||||||
|
'@tiptap/extension-list-item@3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-list-keymap@3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/extension-ordered-list@3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/extension-list': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-paragraph@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-strike@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-text@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extension-underline@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
|
||||||
|
'@tiptap/extensions@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
|
'@tiptap/pm@3.34.0':
|
||||||
|
dependencies:
|
||||||
|
prosemirror-changeset: 2.4.6
|
||||||
|
prosemirror-commands: 1.7.2
|
||||||
|
prosemirror-dropcursor: 1.8.4
|
||||||
|
prosemirror-gapcursor: 1.4.1
|
||||||
|
prosemirror-history: 1.5.2
|
||||||
|
prosemirror-inputrules: 1.7.0
|
||||||
|
prosemirror-keymap: 1.2.3
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-schema-list: 1.6.1
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-tables: 1.8.5
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
prosemirror-view: 1.43.0
|
||||||
|
|
||||||
|
'@tiptap/react@3.34.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
'@types/react': 19.3.0
|
||||||
|
'@types/react-dom': 19.3.0(@types/react@19.3.0)
|
||||||
|
'@types/use-sync-external-store': 0.0.6
|
||||||
|
fast-equals: 5.4.5
|
||||||
|
react: 19.1.0
|
||||||
|
react-dom: 19.1.0(react@19.1.0)
|
||||||
|
use-sync-external-store: 1.7.0(react@19.1.0)
|
||||||
|
optionalDependencies:
|
||||||
|
'@tiptap/extension-bubble-menu': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-floating-menu': 3.34.0(@floating-ui/dom@1.8.0)(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@floating-ui/dom'
|
||||||
|
|
||||||
|
'@tiptap/starter-kit@3.34.0':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 3.34.0(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-blockquote': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-bold': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-bullet-list': 3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-code': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-code-block': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-document': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-dropcursor': 3.34.0(@tiptap/extensions@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-gapcursor': 3.34.0(@tiptap/extensions@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-hard-break': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-heading': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-horizontal-rule': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-italic': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-link': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-list': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/extension-list-item': 3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-list-keymap': 3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-ordered-list': 3.34.0(@tiptap/extension-list@3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-paragraph': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-strike': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-text': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extension-underline': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))
|
||||||
|
'@tiptap/extensions': 3.34.0(@tiptap/core@3.34.0(@tiptap/pm@3.34.0))(@tiptap/pm@3.34.0)
|
||||||
|
'@tiptap/pm': 3.34.0
|
||||||
|
|
||||||
'@ts-morph/common@0.27.0':
|
'@ts-morph/common@0.27.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
fast-glob: 3.3.3
|
fast-glob: 3.3.3
|
||||||
@@ -4970,6 +5450,12 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 20.19.43
|
'@types/node': 20.19.43
|
||||||
|
|
||||||
|
'@types/sanitize-html@2.16.2':
|
||||||
|
dependencies:
|
||||||
|
htmlparser2: 12.0.0
|
||||||
|
|
||||||
|
'@types/use-sync-external-store@0.0.6': {}
|
||||||
|
|
||||||
'@types/validate-npm-package-name@4.0.2': {}
|
'@types/validate-npm-package-name@4.0.2': {}
|
||||||
|
|
||||||
'@typescript-eslint/eslint-plugin@8.73.0(@typescript-eslint/parser@8.73.0(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3)':
|
'@typescript-eslint/eslint-plugin@8.73.0(@typescript-eslint/parser@8.73.0(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3)':
|
||||||
@@ -5510,6 +5996,8 @@ snapshots:
|
|||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
is-data-view: 1.0.2
|
is-data-view: 1.0.2
|
||||||
|
|
||||||
|
dayjs@1.11.23: {}
|
||||||
|
|
||||||
debounce-fn@4.0.0:
|
debounce-fn@4.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
mimic-fn: 3.1.0
|
mimic-fn: 3.1.0
|
||||||
@@ -5567,6 +6055,24 @@ snapshots:
|
|||||||
|
|
||||||
dom-accessibility-api@0.6.3: {}
|
dom-accessibility-api@0.6.3: {}
|
||||||
|
|
||||||
|
dom-serializer@3.1.1:
|
||||||
|
dependencies:
|
||||||
|
domelementtype: 3.0.0
|
||||||
|
domhandler: 6.0.1
|
||||||
|
entities: 8.1.0
|
||||||
|
|
||||||
|
domelementtype@3.0.0: {}
|
||||||
|
|
||||||
|
domhandler@6.0.1:
|
||||||
|
dependencies:
|
||||||
|
domelementtype: 3.0.0
|
||||||
|
|
||||||
|
domutils@4.0.2:
|
||||||
|
dependencies:
|
||||||
|
dom-serializer: 3.1.1
|
||||||
|
domelementtype: 3.0.0
|
||||||
|
domhandler: 6.0.1
|
||||||
|
|
||||||
dot-prop@6.0.1:
|
dot-prop@6.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-obj: 2.0.0
|
is-obj: 2.0.0
|
||||||
@@ -5608,6 +6114,8 @@ snapshots:
|
|||||||
ansi-colors: 4.1.3
|
ansi-colors: 4.1.3
|
||||||
strip-ansi: 6.0.1
|
strip-ansi: 6.0.1
|
||||||
|
|
||||||
|
entities@8.1.0: {}
|
||||||
|
|
||||||
entities@9.0.0: {}
|
entities@9.0.0: {}
|
||||||
|
|
||||||
env-paths@2.2.1: {}
|
env-paths@2.2.1: {}
|
||||||
@@ -6058,6 +6566,8 @@ snapshots:
|
|||||||
|
|
||||||
fast-deep-equal@3.1.3: {}
|
fast-deep-equal@3.1.3: {}
|
||||||
|
|
||||||
|
fast-equals@5.4.5: {}
|
||||||
|
|
||||||
fast-fifo@1.3.2: {}
|
fast-fifo@1.3.2: {}
|
||||||
|
|
||||||
fast-glob@3.3.1:
|
fast-glob@3.3.1:
|
||||||
@@ -6239,6 +6749,13 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@noble/hashes'
|
- '@noble/hashes'
|
||||||
|
|
||||||
|
htmlparser2@12.0.0:
|
||||||
|
dependencies:
|
||||||
|
domelementtype: 3.0.0
|
||||||
|
domhandler: 6.0.1
|
||||||
|
domutils: 4.0.2
|
||||||
|
entities: 8.1.0
|
||||||
|
|
||||||
human-signals@2.1.0: {}
|
human-signals@2.1.0: {}
|
||||||
|
|
||||||
human-signals@8.0.1: {}
|
human-signals@8.0.1: {}
|
||||||
@@ -6372,6 +6889,8 @@ snapshots:
|
|||||||
|
|
||||||
is-plain-obj@4.1.0: {}
|
is-plain-obj@4.1.0: {}
|
||||||
|
|
||||||
|
is-plain-object@5.1.0: {}
|
||||||
|
|
||||||
is-potential-custom-element-name@1.0.1: {}
|
is-potential-custom-element-name@1.0.1: {}
|
||||||
|
|
||||||
is-regex@1.2.1:
|
is-regex@1.2.1:
|
||||||
@@ -6526,6 +7045,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
language-subtag-registry: 0.3.23
|
language-subtag-registry: 0.3.23
|
||||||
|
|
||||||
|
launder@1.7.2:
|
||||||
|
dependencies:
|
||||||
|
dayjs: 1.11.23
|
||||||
|
|
||||||
lazystream@1.0.1:
|
lazystream@1.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
readable-stream: 2.3.8
|
readable-stream: 2.3.8
|
||||||
@@ -6584,6 +7107,8 @@ snapshots:
|
|||||||
lightningcss-win32-arm64-msvc: 1.33.0
|
lightningcss-win32-arm64-msvc: 1.33.0
|
||||||
lightningcss-win32-x64-msvc: 1.33.0
|
lightningcss-win32-x64-msvc: 1.33.0
|
||||||
|
|
||||||
|
linkifyjs@4.4.0: {}
|
||||||
|
|
||||||
locate-path@3.0.0:
|
locate-path@3.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
p-locate: 3.0.0
|
p-locate: 3.0.0
|
||||||
@@ -6810,6 +7335,8 @@ snapshots:
|
|||||||
string-width: 7.2.0
|
string-width: 7.2.0
|
||||||
strip-ansi: 7.2.0
|
strip-ansi: 7.2.0
|
||||||
|
|
||||||
|
orderedmap@2.1.1: {}
|
||||||
|
|
||||||
own-keys@1.0.2:
|
own-keys@1.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
call-bound: 1.0.4
|
call-bound: 1.0.4
|
||||||
@@ -6841,6 +7368,8 @@ snapshots:
|
|||||||
|
|
||||||
parse-ms@4.0.0: {}
|
parse-ms@4.0.0: {}
|
||||||
|
|
||||||
|
parse-srcset@1.0.2: {}
|
||||||
|
|
||||||
parse5-parser-stream@8.1.1:
|
parse5-parser-stream@8.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
parse5: 8.1.1
|
parse5: 8.1.1
|
||||||
@@ -6932,6 +7461,80 @@ snapshots:
|
|||||||
object-assign: 4.1.1
|
object-assign: 4.1.1
|
||||||
react-is: 16.13.1
|
react-is: 16.13.1
|
||||||
|
|
||||||
|
prosemirror-changeset@2.4.6:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
|
||||||
|
prosemirror-commands@1.7.2:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
|
||||||
|
prosemirror-dropcursor@1.8.4:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
prosemirror-view: 1.43.0
|
||||||
|
|
||||||
|
prosemirror-gapcursor@1.4.1:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-keymap: 1.2.3
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-view: 1.43.0
|
||||||
|
|
||||||
|
prosemirror-history@1.5.2:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
prosemirror-view: 1.43.0
|
||||||
|
rope-sequence: 1.3.4
|
||||||
|
|
||||||
|
prosemirror-inputrules@1.7.0:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
|
||||||
|
prosemirror-keymap@1.2.3:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
w3c-keyname: 2.2.8
|
||||||
|
|
||||||
|
prosemirror-model@1.25.13:
|
||||||
|
dependencies:
|
||||||
|
orderedmap: 2.1.1
|
||||||
|
|
||||||
|
prosemirror-schema-list@1.6.1:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
|
||||||
|
prosemirror-state@1.4.4:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
prosemirror-view: 1.43.0
|
||||||
|
|
||||||
|
prosemirror-tables@1.8.5:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-keymap: 1.2.3
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
prosemirror-view: 1.43.0
|
||||||
|
|
||||||
|
prosemirror-transform@1.12.7:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
|
||||||
|
prosemirror-view@1.43.0:
|
||||||
|
dependencies:
|
||||||
|
prosemirror-model: 1.25.13
|
||||||
|
prosemirror-state: 1.4.4
|
||||||
|
prosemirror-transform: 1.12.7
|
||||||
|
|
||||||
punycode@2.3.1: {}
|
punycode@2.3.1: {}
|
||||||
|
|
||||||
queue-microtask@1.2.3: {}
|
queue-microtask@1.2.3: {}
|
||||||
@@ -7046,6 +7649,8 @@ snapshots:
|
|||||||
'@rolldown/binding-win32-arm64-msvc': 1.2.19
|
'@rolldown/binding-win32-arm64-msvc': 1.2.19
|
||||||
'@rolldown/binding-win32-x64-msvc': 1.2.19
|
'@rolldown/binding-win32-x64-msvc': 1.2.19
|
||||||
|
|
||||||
|
rope-sequence@1.3.4: {}
|
||||||
|
|
||||||
run-applescript@7.1.0: {}
|
run-applescript@7.1.0: {}
|
||||||
|
|
||||||
run-parallel@1.2.0:
|
run-parallel@1.2.0:
|
||||||
@@ -7075,6 +7680,15 @@ snapshots:
|
|||||||
es-errors: 1.3.0
|
es-errors: 1.3.0
|
||||||
is-regex: 1.2.1
|
is-regex: 1.2.1
|
||||||
|
|
||||||
|
sanitize-html@2.18.2:
|
||||||
|
dependencies:
|
||||||
|
escape-string-regexp: 4.0.0
|
||||||
|
htmlparser2: 12.0.0
|
||||||
|
is-plain-object: 5.1.0
|
||||||
|
launder: 1.7.2
|
||||||
|
parse-srcset: 1.0.2
|
||||||
|
postcss: 8.5.33
|
||||||
|
|
||||||
saxes@6.0.0:
|
saxes@6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
xmlchars: 2.2.0
|
xmlchars: 2.2.0
|
||||||
@@ -7544,6 +8158,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
punycode: 2.3.1
|
punycode: 2.3.1
|
||||||
|
|
||||||
|
use-sync-external-store@1.7.0(react@19.1.0):
|
||||||
|
dependencies:
|
||||||
|
react: 19.1.0
|
||||||
|
|
||||||
util-deprecate@1.0.2: {}
|
util-deprecate@1.0.2: {}
|
||||||
|
|
||||||
validate-npm-package-name@7.0.2: {}
|
validate-npm-package-name@7.0.2: {}
|
||||||
@@ -7584,6 +8202,8 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- msw
|
- msw
|
||||||
|
|
||||||
|
w3c-keyname@2.2.8: {}
|
||||||
|
|
||||||
w3c-xmlserializer@6.0.0:
|
w3c-xmlserializer@6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
xml-name-validator: 5.0.0
|
xml-name-validator: 5.0.0
|
||||||
|
|||||||
@@ -677,20 +677,31 @@ export default function AdminGuidePage() {
|
|||||||
the published lessons.
|
the published lessons.
|
||||||
</GuideStep>
|
</GuideStep>
|
||||||
<GuideStep>
|
<GuideStep>
|
||||||
Add a title, one-line summary, and the lesson body. Line breaks are
|
Add a title and one-line summary, then build the lesson in the
|
||||||
preserved, so numbered steps stay readable.
|
content editor. Use headings for sections, numbered or bulleted
|
||||||
|
lists for procedures, and links for related pages.
|
||||||
|
</GuideStep>
|
||||||
|
<GuideStep>
|
||||||
|
Press the image button to upload a screenshot. Select the image to
|
||||||
|
align it left, center, or right, choose a width, edit its
|
||||||
|
description, or move it up and down. You can also drag the image to a
|
||||||
|
new position in the lesson.
|
||||||
</GuideStep>
|
</GuideStep>
|
||||||
<GuideStep>
|
<GuideStep>
|
||||||
Set a sort order to control the list position. Lower numbers appear
|
Set a sort order to control the list position. Lower numbers appear
|
||||||
first.
|
first.
|
||||||
</GuideStep>
|
</GuideStep>
|
||||||
<GuideStep>
|
<GuideStep>
|
||||||
Publish when ready. Drafts are visible only to admins.
|
Publish when ready. Drafts are visible only to admins. If you add an
|
||||||
|
image before the first save, the app creates an unpublished draft so
|
||||||
|
the file has a lesson to belong to; finish and save normally.
|
||||||
</GuideStep>
|
</GuideStep>
|
||||||
<GuideStep>
|
<GuideStep>
|
||||||
Attach a PDF, image, or document with the file control on the lesson,
|
Attach a PDF manual, Word document, Markdown file, or text file with
|
||||||
then <strong>Upload</strong>. Volunteers open attachments from the
|
the file control beneath the lesson, then press{" "}
|
||||||
lesson; admins can remove them.
|
<strong>Attach</strong>. PDFs open in the browser and the other
|
||||||
|
formats download. Volunteers see documents at the end of the lesson;
|
||||||
|
admins can remove them.
|
||||||
</GuideStep>
|
</GuideStep>
|
||||||
</GuideSteps>
|
</GuideSteps>
|
||||||
<GuideCallout title="The two long guides are built in" tone="tip">
|
<GuideCallout title="The two long guides are built in" tone="tip">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { auth } from "@/auth/config";
|
|||||||
import { hasPermission } from "@/auth/permissions";
|
import { hasPermission } from "@/auth/permissions";
|
||||||
import type { SystemRole } from "@/auth/roles";
|
import type { SystemRole } from "@/auth/roles";
|
||||||
import { listLessons } from "@/db/training";
|
import { listLessons } from "@/db/training";
|
||||||
|
import { trainingBodyToHtml } from "@/lib/rich-text";
|
||||||
import { TrainingPanel } from "@/components/app/training-panel";
|
import { TrainingPanel } from "@/components/app/training-panel";
|
||||||
import { BookOpenCheck, Download, ShieldCheck, UserRound } from "lucide-react";
|
import { BookOpenCheck, Download, ShieldCheck, UserRound } from "lucide-react";
|
||||||
|
|
||||||
@@ -17,7 +18,12 @@ export default async function TrainingPage() {
|
|||||||
const session = await auth();
|
const session = await auth();
|
||||||
const role = (session?.user as { systemRole?: SystemRole } | undefined)?.systemRole;
|
const role = (session?.user as { systemRole?: SystemRole } | undefined)?.systemRole;
|
||||||
const canEdit = hasPermission(role, "training.author");
|
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 (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
listResourceStoredNames,
|
listResourceStoredNames,
|
||||||
updateLesson,
|
updateLesson,
|
||||||
} from "@/db/training";
|
} from "@/db/training";
|
||||||
|
import { trainingBodyToHtml } from "@/lib/rich-text";
|
||||||
import { uploadPath } from "@/lib/uploads";
|
import { uploadPath } from "@/lib/uploads";
|
||||||
|
|
||||||
const JSON_HEADERS = { "content-type": "application/json" };
|
const JSON_HEADERS = { "content-type": "application/json" };
|
||||||
@@ -61,8 +62,14 @@ export const GET = async () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const canAuthor = hasPermission(user.systemRole, "training.author");
|
const canAuthor = hasPermission(user.systemRole, "training.author");
|
||||||
|
const lessons = await listLessons({ includeUnpublished: canAuthor });
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({ lessons: await listLessons({ includeUnpublished: canAuthor }) }),
|
JSON.stringify({
|
||||||
|
lessons: lessons.map((lesson) => ({
|
||||||
|
...lesson,
|
||||||
|
body: trainingBodyToHtml(lesson.body),
|
||||||
|
})),
|
||||||
|
}),
|
||||||
{ status: 200, headers: JSON_HEADERS },
|
{ status: 200, headers: JSON_HEADERS },
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -78,7 +85,13 @@ export const POST = async (req: NextRequest) => {
|
|||||||
headers: JSON_HEADERS,
|
headers: JSON_HEADERS,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const lesson = await createLesson(parsed.data);
|
const lesson = await createLesson({
|
||||||
|
...parsed.data,
|
||||||
|
body:
|
||||||
|
parsed.data.body === undefined
|
||||||
|
? undefined
|
||||||
|
: trainingBodyToHtml(parsed.data.body),
|
||||||
|
});
|
||||||
return new Response(JSON.stringify({ lesson }), {
|
return new Response(JSON.stringify({ lesson }), {
|
||||||
status: 201,
|
status: 201,
|
||||||
headers: JSON_HEADERS,
|
headers: JSON_HEADERS,
|
||||||
@@ -104,6 +117,9 @@ export const PATCH = async (req: NextRequest) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const { id, ...patch } = parsed.data;
|
const { id, ...patch } = parsed.data;
|
||||||
|
if (patch.body !== undefined) {
|
||||||
|
patch.body = trainingBodyToHtml(patch.body);
|
||||||
|
}
|
||||||
const lesson = await updateLesson(id, patch);
|
const lesson = await updateLesson(id, patch);
|
||||||
if (!lesson) {
|
if (!lesson) {
|
||||||
return new Response(JSON.stringify({ error: "unknown lesson" }), {
|
return new Response(JSON.stringify({ error: "unknown lesson" }), {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
MAX_UPLOAD_BYTES,
|
MAX_UPLOAD_BYTES,
|
||||||
ensureUploadDir,
|
ensureUploadDir,
|
||||||
isAllowedUpload,
|
isAllowedUpload,
|
||||||
|
resolveUploadMimeType,
|
||||||
storedNameFor,
|
storedNameFor,
|
||||||
uploadPath,
|
uploadPath,
|
||||||
uploadSignatureMatches,
|
uploadSignatureMatches,
|
||||||
@@ -65,12 +66,14 @@ export const POST = async (req: NextRequest) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (file.size > MAX_UPLOAD_BYTES) {
|
if (file.size > MAX_UPLOAD_BYTES) {
|
||||||
return new Response(JSON.stringify({ error: "file is larger than 5 MB" }), {
|
return new Response(
|
||||||
status: 400,
|
JSON.stringify({
|
||||||
headers: JSON_HEADERS,
|
error: `file is larger than ${Math.round(MAX_UPLOAD_BYTES / (1024 * 1024))} MB`,
|
||||||
});
|
}),
|
||||||
|
{ status: 400, headers: JSON_HEADERS },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const mimeType = file.type || "application/octet-stream";
|
const mimeType = resolveUploadMimeType(file.name, file.type);
|
||||||
if (!isAllowedUpload(mimeType)) {
|
if (!isAllowedUpload(mimeType)) {
|
||||||
return new Response(
|
return new Response(
|
||||||
JSON.stringify({ error: `file type not allowed: ${mimeType}` }),
|
JSON.stringify({ error: `file type not allowed: ${mimeType}` }),
|
||||||
|
|||||||
@@ -30,15 +30,18 @@ export const GET = async (
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await readFile(uploadPath(resource.storedName));
|
const data = await readFile(uploadPath(resource.storedName));
|
||||||
const safeName = resource.filename.replaceAll('"', "");
|
const safeName = resource.filename.replace(/[\r\n"\\]/g, "").trim() || "download";
|
||||||
|
const inline =
|
||||||
|
resource.mimeType.startsWith("image/") ||
|
||||||
|
resource.mimeType === "application/pdf";
|
||||||
return new Response(new Uint8Array(data), {
|
return new Response(new Uint8Array(data), {
|
||||||
status: 200,
|
status: 200,
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": resource.mimeType,
|
"content-type": resource.mimeType,
|
||||||
"content-length": String(data.length),
|
"content-length": String(data.length),
|
||||||
// Only images render inline; everything else is a download, so an
|
// Images and PDF manuals render in the browser; everything else is a
|
||||||
// uploaded HTML/SVG payload cannot execute in this origin.
|
// download, so an uploaded HTML/SVG payload cannot execute here.
|
||||||
"content-disposition": `${resource.mimeType.startsWith("image/") ? "inline" : "attachment"}; filename="${safeName}"; filename*=UTF-8''${encodeURIComponent(resource.filename)}`,
|
"content-disposition": `${inline ? "inline" : "attachment"}; filename="${safeName}"; filename*=UTF-8''${encodeURIComponent(resource.filename)}`,
|
||||||
"cache-control": "private, max-age=0, must-revalidate",
|
"cache-control": "private, max-age=0, must-revalidate",
|
||||||
"x-content-type-options": "nosniff",
|
"x-content-type-options": "nosniff",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -126,3 +126,134 @@
|
|||||||
color: var(--primary-foreground);
|
color: var(--primary-foreground);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Rendered training lessons and the authoring surface share one typography
|
||||||
|
scale. The sanitizer permits only these elements, so no prose plugin is
|
||||||
|
needed for content that came from the editor. */
|
||||||
|
.training-prose {
|
||||||
|
color: var(--foreground);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.7;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose > * + * {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose h2 {
|
||||||
|
margin-top: 1.5rem;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.3;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose h3 {
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
font-size: 1.05rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose h4 {
|
||||||
|
margin-top: 1rem;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose ul {
|
||||||
|
list-style: disc;
|
||||||
|
padding-left: 1.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose ol {
|
||||||
|
list-style: decimal;
|
||||||
|
padding-left: 1.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose li + li {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose li > p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose a {
|
||||||
|
color: var(--primary);
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose strong {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose blockquote {
|
||||||
|
border-left: 3px solid var(--primary);
|
||||||
|
padding-left: 0.85rem;
|
||||||
|
color: var(--muted-foreground);
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose code {
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
background: var(--muted);
|
||||||
|
padding: 0.1rem 0.3rem;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 0.83em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose pre {
|
||||||
|
overflow-x: auto;
|
||||||
|
border-radius: var(--radius);
|
||||||
|
background: var(--muted);
|
||||||
|
padding: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose pre code {
|
||||||
|
background: transparent;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose hr {
|
||||||
|
border-color: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
border-radius: calc(var(--radius) - 2px);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose img[data-align="left"] {
|
||||||
|
display: block;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose img[data-align="center"] {
|
||||||
|
display: block;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose img[data-align="right"] {
|
||||||
|
display: block;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose img.ProseMirror-selectednode {
|
||||||
|
outline: 3px solid var(--ring);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.training-prose p.is-editor-empty:first-child::before {
|
||||||
|
float: left;
|
||||||
|
height: 0;
|
||||||
|
color: var(--muted-foreground);
|
||||||
|
content: attr(data-placeholder);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import type { TrainingLessonRow } from "@/db/training";
|
import type { TrainingLessonRow } from "@/db/training";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
|
import { RichTextEditor } from "@/components/app/training/rich-text-editor";
|
||||||
const TEXTAREA_CLASS =
|
|
||||||
"min-h-40 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";
|
|
||||||
|
|
||||||
function formatBytes(bytes: number): string {
|
function formatBytes(bytes: number): string {
|
||||||
if (bytes < 1024) return `${bytes} B`;
|
if (bytes < 1024) return `${bytes} B`;
|
||||||
@@ -55,8 +53,9 @@ function UploadControl({ lessonId }: { lessonId: string }) {
|
|||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
<Input
|
<Input
|
||||||
type="file"
|
type="file"
|
||||||
aria-label="Attach a file"
|
aria-label="Attach a manual or document"
|
||||||
className="h-9 max-w-xs text-xs"
|
accept=".pdf,.doc,.docx,.txt,.md,.markdown,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,text/plain,text/markdown,image/*"
|
||||||
|
className="h-9 max-w-sm text-xs"
|
||||||
onChange={(e) => setFile(e.target.files?.[0] ?? null)}
|
onChange={(e) => setFile(e.target.files?.[0] ?? null)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@@ -66,9 +65,13 @@ function UploadControl({ lessonId }: { lessonId: string }) {
|
|||||||
disabled={!file || busy}
|
disabled={!file || busy}
|
||||||
onClick={upload}
|
onClick={upload}
|
||||||
>
|
>
|
||||||
{busy ? "Uploading…" : "Upload"}
|
{busy ? "Uploading…" : "Attach"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
PDF, Word, text, Markdown, or an image, up to 25 MB. PDFs open in the
|
||||||
|
browser; Word and text files download.
|
||||||
|
</p>
|
||||||
{error && (
|
{error && (
|
||||||
<p role="alert" className="text-xs text-destructive">
|
<p role="alert" className="text-xs text-destructive">
|
||||||
{error}
|
{error}
|
||||||
@@ -100,6 +103,8 @@ export function TrainingPanel({
|
|||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [message, setMessage] = useState<string | null>(null);
|
const [message, setMessage] = useState<string | null>(null);
|
||||||
|
const [editorSession, setEditorSession] = useState(0);
|
||||||
|
const creatingDraft = useRef(false);
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
setEditingId(null);
|
setEditingId(null);
|
||||||
@@ -108,6 +113,7 @@ export function TrainingPanel({
|
|||||||
setBody("");
|
setBody("");
|
||||||
setPublished(true);
|
setPublished(true);
|
||||||
setSortOrder("0");
|
setSortOrder("0");
|
||||||
|
setEditorSession((value) => value + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit(lesson: TrainingLessonRow) {
|
function edit(lesson: TrainingLessonRow) {
|
||||||
@@ -117,10 +123,57 @@ export function TrainingPanel({
|
|||||||
setBody(lesson.body);
|
setBody(lesson.body);
|
||||||
setPublished(lesson.published);
|
setPublished(lesson.published);
|
||||||
setSortOrder(String(lesson.sortOrder));
|
setSortOrder(String(lesson.sortOrder));
|
||||||
|
setEditorSession((value) => value + 1);
|
||||||
setError(null);
|
setError(null);
|
||||||
setMessage(null);
|
setMessage(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inline images need a lesson row before they can be stored. If the author
|
||||||
|
* inserts an image before the first save, create an unpublished draft with
|
||||||
|
* the current form values and keep the editor mounted.
|
||||||
|
*/
|
||||||
|
async function ensureLessonId(): Promise<string | null> {
|
||||||
|
if (editingId) return editingId;
|
||||||
|
if (!title.trim()) {
|
||||||
|
setError("Add a title before inserting images.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (creatingDraft.current) return null;
|
||||||
|
|
||||||
|
creatingDraft.current = true;
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/dev/training/lessons", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({
|
||||||
|
title: title.trim(),
|
||||||
|
summary: summary.trim() || null,
|
||||||
|
body,
|
||||||
|
published: false,
|
||||||
|
sortOrder: Number(sortOrder) || 0,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
const data = (await res.json().catch(() => ({}))) as {
|
||||||
|
error?: string;
|
||||||
|
lesson?: { id?: string };
|
||||||
|
};
|
||||||
|
if (!res.ok || !data.lesson?.id) {
|
||||||
|
setError(data.error ?? "Could not create the lesson draft.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
setEditingId(data.lesson.id);
|
||||||
|
setMessage("Draft saved so images can be attached. Save when you are finished.");
|
||||||
|
return data.lesson.id;
|
||||||
|
} catch {
|
||||||
|
setError("Network error.");
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
|
creatingDraft.current = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function save(e: React.FormEvent) {
|
async function save(e: React.FormEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
@@ -128,8 +181,8 @@ export function TrainingPanel({
|
|||||||
setMessage(null);
|
setMessage(null);
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
title,
|
title: title.trim(),
|
||||||
summary: summary || null,
|
summary: summary.trim() || null,
|
||||||
body,
|
body,
|
||||||
published,
|
published,
|
||||||
sortOrder: Number(sortOrder) || 0,
|
sortOrder: Number(sortOrder) || 0,
|
||||||
@@ -235,13 +288,17 @@ export function TrainingPanel({
|
|||||||
|
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<Label htmlFor="lesson-body">Content</Label>
|
<Label htmlFor="lesson-body">Content</Label>
|
||||||
<textarea
|
<RichTextEditor
|
||||||
id="lesson-body"
|
key={editorSession}
|
||||||
className={TEXTAREA_CLASS}
|
initialContent={body}
|
||||||
value={body}
|
onChange={setBody}
|
||||||
onChange={(e) => setBody(e.target.value)}
|
ensureLessonId={ensureLessonId}
|
||||||
placeholder="Steps, checklists, and notes. Line breaks are preserved."
|
|
||||||
/>
|
/>
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
Use headings, lists, links, and callouts to build a tutorial.
|
||||||
|
Images are stored with the lesson, so volunteers see them without
|
||||||
|
needing a public file server.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-wrap items-end gap-4">
|
<div className="flex flex-wrap items-end gap-4">
|
||||||
@@ -295,7 +352,15 @@ export function TrainingPanel({
|
|||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<ul className="space-y-4">
|
<ul className="space-y-4">
|
||||||
{lessons.map((lesson) => (
|
{lessons.map((lesson) => {
|
||||||
|
// Inline images are already visible in the body; only manuals,
|
||||||
|
// PDFs, and other documents belong in the attachment list.
|
||||||
|
const attachments = lesson.resources.filter(
|
||||||
|
(resource) =>
|
||||||
|
!lesson.body.includes(`/api/training/files/${resource.id}`),
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
<li key={lesson.id} className="rounded-md border border-border p-4">
|
<li key={lesson.id} className="rounded-md border border-border p-4">
|
||||||
<div className="flex flex-wrap items-start justify-between gap-2">
|
<div className="flex flex-wrap items-start justify-between gap-2">
|
||||||
<div>
|
<div>
|
||||||
@@ -332,14 +397,15 @@ export function TrainingPanel({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{lesson.body && (
|
{lesson.body && (
|
||||||
<p className="mt-3 whitespace-pre-wrap text-sm text-foreground">
|
<div
|
||||||
{lesson.body}
|
className="training-prose mt-3"
|
||||||
</p>
|
dangerouslySetInnerHTML={{ __html: lesson.body }}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{lesson.resources.length > 0 && (
|
{attachments.length > 0 && (
|
||||||
<ul className="mt-3 space-y-1">
|
<ul className="mt-4 space-y-1 border-t border-border pt-3">
|
||||||
{lesson.resources.map((resource) => (
|
{attachments.map((resource) => (
|
||||||
<li key={resource.id} className="flex flex-wrap items-center gap-2 text-sm">
|
<li key={resource.id} className="flex flex-wrap items-center gap-2 text-sm">
|
||||||
<a
|
<a
|
||||||
href={`/api/training/files/${resource.id}`}
|
href={`/api/training/files/${resource.id}`}
|
||||||
@@ -369,12 +435,13 @@ export function TrainingPanel({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{canEdit && (
|
{canEdit && (
|
||||||
<div className="mt-3">
|
<div className="mt-3 border-t border-border pt-3">
|
||||||
<UploadControl lessonId={lesson.id} />
|
<UploadControl lessonId={lesson.id} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,535 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useRef, useState } from "react";
|
||||||
|
import { EditorContent, useEditor, type Editor } from "@tiptap/react";
|
||||||
|
import StarterKit from "@tiptap/starter-kit";
|
||||||
|
import Image from "@tiptap/extension-image";
|
||||||
|
import { NodeSelection } from "@tiptap/pm/state";
|
||||||
|
import {
|
||||||
|
AlignCenter,
|
||||||
|
AlignLeft,
|
||||||
|
AlignRight,
|
||||||
|
ArrowDown,
|
||||||
|
ArrowUp,
|
||||||
|
Bold,
|
||||||
|
Code,
|
||||||
|
Heading2,
|
||||||
|
Heading3,
|
||||||
|
ImagePlus,
|
||||||
|
Italic,
|
||||||
|
Link2,
|
||||||
|
List,
|
||||||
|
ListOrdered,
|
||||||
|
Loader2,
|
||||||
|
Pilcrow,
|
||||||
|
Quote,
|
||||||
|
Redo2,
|
||||||
|
Strikethrough,
|
||||||
|
Trash2,
|
||||||
|
Underline,
|
||||||
|
Undo2,
|
||||||
|
} from "lucide-react";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The image node adds alignment to the stock image extension. Width is already
|
||||||
|
* a native attribute, so the toolbar can offer percentage presets without any
|
||||||
|
* inline styles (which the server sanitizer intentionally strips).
|
||||||
|
*/
|
||||||
|
const TrainingImage = Image.extend({
|
||||||
|
addAttributes() {
|
||||||
|
return {
|
||||||
|
...this.parent?.(),
|
||||||
|
align: {
|
||||||
|
default: "center",
|
||||||
|
parseHTML: (element) => element.getAttribute("data-align") ?? "center",
|
||||||
|
renderHTML: (attributes) => ({
|
||||||
|
"data-align": attributes.align ?? "center",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const IMAGE_WIDTHS = ["25%", "50%", "75%", "100%"] as const;
|
||||||
|
|
||||||
|
function ToolButton({
|
||||||
|
label,
|
||||||
|
active,
|
||||||
|
disabled,
|
||||||
|
onClick,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
label: string;
|
||||||
|
active?: boolean;
|
||||||
|
disabled?: boolean;
|
||||||
|
onClick: () => void;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
variant={active ? "secondary" : "ghost"}
|
||||||
|
className="h-8 min-w-8 gap-1 px-2"
|
||||||
|
aria-label={label}
|
||||||
|
aria-pressed={active}
|
||||||
|
title={label}
|
||||||
|
disabled={disabled}
|
||||||
|
onMouseDown={(event) => event.preventDefault()}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Separator() {
|
||||||
|
return <span className="mx-1 h-5 w-px bg-border" aria-hidden="true" />;
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectedImagePosition(editor: Editor): number | null {
|
||||||
|
const { selection } = editor.state;
|
||||||
|
if (selection instanceof NodeSelection && selection.node.type.name === "image") {
|
||||||
|
return selection.from;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { $from } = selection;
|
||||||
|
for (let depth = $from.depth; depth > 0; depth -= 1) {
|
||||||
|
if ($from.node(depth).type.name === "image") {
|
||||||
|
return $from.before(depth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Swap the selected image with its previous/next sibling block. */
|
||||||
|
function moveImage(editor: Editor, direction: -1 | 1) {
|
||||||
|
const pos = selectedImagePosition(editor);
|
||||||
|
if (pos === null) return;
|
||||||
|
|
||||||
|
const { state } = editor;
|
||||||
|
const node = state.doc.nodeAt(pos);
|
||||||
|
if (!node) return;
|
||||||
|
|
||||||
|
const $pos = state.doc.resolve(pos);
|
||||||
|
const parent = $pos.parent;
|
||||||
|
const index = $pos.index();
|
||||||
|
const tr = state.tr;
|
||||||
|
|
||||||
|
if (direction < 0) {
|
||||||
|
if (index === 0) return;
|
||||||
|
const previous = parent.child(index - 1);
|
||||||
|
const previousPos = pos - previous.nodeSize;
|
||||||
|
tr.replaceWith(previousPos, pos + node.nodeSize, [node, previous]);
|
||||||
|
tr.setSelection(NodeSelection.create(tr.doc, previousPos));
|
||||||
|
} else {
|
||||||
|
if (index >= parent.childCount - 1) return;
|
||||||
|
const next = parent.child(index + 1);
|
||||||
|
tr.replaceWith(pos, pos + node.nodeSize + next.nodeSize, [next, node]);
|
||||||
|
tr.setSelection(NodeSelection.create(tr.doc, pos + next.nodeSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.view.dispatch(tr);
|
||||||
|
editor.commands.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RichTextEditor({
|
||||||
|
initialContent,
|
||||||
|
onChange,
|
||||||
|
ensureLessonId,
|
||||||
|
}: {
|
||||||
|
initialContent: string;
|
||||||
|
onChange: (html: string) => void;
|
||||||
|
ensureLessonId: () => Promise<string | null>;
|
||||||
|
}) {
|
||||||
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
const [uploading, setUploading] = useState(false);
|
||||||
|
const [uploadError, setUploadError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const editor = useEditor({
|
||||||
|
immediatelyRender: false,
|
||||||
|
shouldRerenderOnTransaction: true,
|
||||||
|
extensions: [
|
||||||
|
StarterKit.configure({
|
||||||
|
heading: { levels: [2, 3, 4] },
|
||||||
|
link: {
|
||||||
|
openOnClick: false,
|
||||||
|
autolink: true,
|
||||||
|
defaultProtocol: "https",
|
||||||
|
HTMLAttributes: {
|
||||||
|
rel: "noopener noreferrer nofollow",
|
||||||
|
target: "_blank",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
TrainingImage.configure({
|
||||||
|
inline: false,
|
||||||
|
allowBase64: false,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
content: initialContent || "<p></p>",
|
||||||
|
editorProps: {
|
||||||
|
attributes: {
|
||||||
|
id: "lesson-body",
|
||||||
|
class:
|
||||||
|
"training-prose min-h-56 px-3 py-3 focus:outline-none sm:min-h-64",
|
||||||
|
"aria-label": "Content",
|
||||||
|
role: "textbox",
|
||||||
|
"aria-multiline": "true",
|
||||||
|
spellcheck: "true",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onUpdate: ({ editor: current }) => {
|
||||||
|
onChange(current.getHTML());
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const isImage = editor?.isActive("image") ?? false;
|
||||||
|
const imageAttributes = editor?.getAttributes("image") ?? {};
|
||||||
|
const imageAlign = (imageAttributes.align as string | undefined) ?? "center";
|
||||||
|
const imageWidth = imageAttributes.width
|
||||||
|
? String(imageAttributes.width)
|
||||||
|
: "";
|
||||||
|
const imageAlt = (imageAttributes.alt as string | undefined) ?? "";
|
||||||
|
|
||||||
|
function promptLink() {
|
||||||
|
if (!editor) return;
|
||||||
|
const previous = (editor.getAttributes("link").href as string | undefined) ?? "";
|
||||||
|
const entered = window.prompt("Link URL", previous || "https://");
|
||||||
|
if (entered === null) return;
|
||||||
|
|
||||||
|
const value = entered.trim();
|
||||||
|
if (!value) {
|
||||||
|
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const href = /^(https?:\/\/|mailto:|\/)/i.test(value)
|
||||||
|
? value
|
||||||
|
: `https://${value}`;
|
||||||
|
editor.chain().focus().extendMarkRange("link").setLink({ href }).run();
|
||||||
|
}
|
||||||
|
|
||||||
|
function promptImageAlt() {
|
||||||
|
if (!editor) return;
|
||||||
|
const entered = window.prompt(
|
||||||
|
"Describe the image for screen readers",
|
||||||
|
imageAlt,
|
||||||
|
);
|
||||||
|
if (entered === null) return;
|
||||||
|
editor
|
||||||
|
.chain()
|
||||||
|
.focus()
|
||||||
|
.updateAttributes("image", { alt: entered.trim() })
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function uploadImage(file: File) {
|
||||||
|
if (!editor) return;
|
||||||
|
if (!file.type.startsWith("image/")) {
|
||||||
|
setUploadError("Choose an image file.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setUploading(true);
|
||||||
|
setUploadError(null);
|
||||||
|
try {
|
||||||
|
const lessonId = await ensureLessonId();
|
||||||
|
if (!lessonId) {
|
||||||
|
setUploadError("Add a title before inserting an image.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const form = new FormData();
|
||||||
|
form.append("lessonId", lessonId);
|
||||||
|
form.append("file", file);
|
||||||
|
const response = await fetch("/api/dev/training/resources", {
|
||||||
|
method: "POST",
|
||||||
|
body: form,
|
||||||
|
});
|
||||||
|
const data = (await response.json().catch(() => ({}))) as {
|
||||||
|
error?: string;
|
||||||
|
resource?: { id: string; filename: string };
|
||||||
|
};
|
||||||
|
if (!response.ok || !data.resource) {
|
||||||
|
throw new Error(data.error ?? "Image upload failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
editor
|
||||||
|
.chain()
|
||||||
|
.focus()
|
||||||
|
.insertContent({
|
||||||
|
type: "image",
|
||||||
|
attrs: {
|
||||||
|
src: `/api/training/files/${data.resource.id}`,
|
||||||
|
alt: data.resource.filename,
|
||||||
|
title: data.resource.filename,
|
||||||
|
align: "center",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.run();
|
||||||
|
} catch (error) {
|
||||||
|
setUploadError(
|
||||||
|
error instanceof Error ? error.message : "Image upload failed.",
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
setUploading(false);
|
||||||
|
if (fileInputRef.current) fileInputRef.current.value = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="overflow-hidden rounded-md border border-input bg-background">
|
||||||
|
<input
|
||||||
|
ref={fileInputRef}
|
||||||
|
type="file"
|
||||||
|
accept="image/png,image/jpeg,image/gif,image/webp,image/avif"
|
||||||
|
className="sr-only"
|
||||||
|
aria-label="Upload an image for the lesson"
|
||||||
|
onChange={(event) => {
|
||||||
|
const file = event.target.files?.[0];
|
||||||
|
if (file) void uploadImage(file);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="flex flex-wrap items-center gap-0.5 border-b border-border bg-muted/30 p-1"
|
||||||
|
role="toolbar"
|
||||||
|
aria-label="Lesson formatting"
|
||||||
|
>
|
||||||
|
<ToolButton
|
||||||
|
label="Undo"
|
||||||
|
disabled={!editor?.can().undo()}
|
||||||
|
onClick={() => editor?.chain().focus().undo().run()}
|
||||||
|
>
|
||||||
|
<Undo2 aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Redo"
|
||||||
|
disabled={!editor?.can().redo()}
|
||||||
|
onClick={() => editor?.chain().focus().redo().run()}
|
||||||
|
>
|
||||||
|
<Redo2 aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<ToolButton
|
||||||
|
label="Paragraph"
|
||||||
|
active={editor?.isActive("paragraph")}
|
||||||
|
onClick={() => editor?.chain().focus().setParagraph().run()}
|
||||||
|
>
|
||||||
|
<Pilcrow aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Heading 2"
|
||||||
|
active={editor?.isActive("heading", { level: 2 })}
|
||||||
|
onClick={() => editor?.chain().focus().toggleHeading({ level: 2 }).run()}
|
||||||
|
>
|
||||||
|
<Heading2 aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Heading 3"
|
||||||
|
active={editor?.isActive("heading", { level: 3 })}
|
||||||
|
onClick={() => editor?.chain().focus().toggleHeading({ level: 3 }).run()}
|
||||||
|
>
|
||||||
|
<Heading3 aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<ToolButton
|
||||||
|
label="Bold"
|
||||||
|
active={editor?.isActive("bold")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleBold().run()}
|
||||||
|
>
|
||||||
|
<Bold aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Italic"
|
||||||
|
active={editor?.isActive("italic")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleItalic().run()}
|
||||||
|
>
|
||||||
|
<Italic aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Underline"
|
||||||
|
active={editor?.isActive("underline")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleUnderline().run()}
|
||||||
|
>
|
||||||
|
<Underline aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Strikethrough"
|
||||||
|
active={editor?.isActive("strike")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleStrike().run()}
|
||||||
|
>
|
||||||
|
<Strikethrough aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<ToolButton
|
||||||
|
label="Bulleted list"
|
||||||
|
active={editor?.isActive("bulletList")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleBulletList().run()}
|
||||||
|
>
|
||||||
|
<List aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Numbered list"
|
||||||
|
active={editor?.isActive("orderedList")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleOrderedList().run()}
|
||||||
|
>
|
||||||
|
<ListOrdered aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Quote"
|
||||||
|
active={editor?.isActive("blockquote")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleBlockquote().run()}
|
||||||
|
>
|
||||||
|
<Quote aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Inline code"
|
||||||
|
active={editor?.isActive("code")}
|
||||||
|
onClick={() => editor?.chain().focus().toggleCode().run()}
|
||||||
|
>
|
||||||
|
<Code aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<ToolButton
|
||||||
|
label={editor?.isActive("link") ? "Remove link" : "Add link"}
|
||||||
|
active={editor?.isActive("link")}
|
||||||
|
onClick={promptLink}
|
||||||
|
>
|
||||||
|
<Link2 aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Insert image"
|
||||||
|
disabled={!editor || uploading}
|
||||||
|
onClick={() => fileInputRef.current?.click()}
|
||||||
|
>
|
||||||
|
{uploading ? (
|
||||||
|
<Loader2 className="animate-spin" aria-hidden="true" />
|
||||||
|
) : (
|
||||||
|
<ImagePlus aria-hidden="true" />
|
||||||
|
)}
|
||||||
|
</ToolButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{isImage && (
|
||||||
|
<div
|
||||||
|
className="flex flex-wrap items-center gap-0.5 border-b border-border bg-background px-1 py-1"
|
||||||
|
role="toolbar"
|
||||||
|
aria-label="Selected image"
|
||||||
|
>
|
||||||
|
<span className="px-1 text-xs font-medium text-muted-foreground">
|
||||||
|
Image
|
||||||
|
</span>
|
||||||
|
<ToolButton
|
||||||
|
label="Align image left"
|
||||||
|
active={imageAlign === "left"}
|
||||||
|
onClick={() =>
|
||||||
|
editor?.chain().focus().updateAttributes("image", { align: "left" }).run()
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<AlignLeft aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Center image"
|
||||||
|
active={imageAlign === "center"}
|
||||||
|
onClick={() =>
|
||||||
|
editor
|
||||||
|
?.chain()
|
||||||
|
.focus()
|
||||||
|
.updateAttributes("image", { align: "center" })
|
||||||
|
.run()
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<AlignCenter aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Align image right"
|
||||||
|
active={imageAlign === "right"}
|
||||||
|
onClick={() =>
|
||||||
|
editor
|
||||||
|
?.chain()
|
||||||
|
.focus()
|
||||||
|
.updateAttributes("image", { align: "right" })
|
||||||
|
.run()
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<AlignRight aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
{IMAGE_WIDTHS.map((width) => (
|
||||||
|
<ToolButton
|
||||||
|
key={width}
|
||||||
|
label={`Set image width to ${width}`}
|
||||||
|
active={imageWidth === width}
|
||||||
|
onClick={() =>
|
||||||
|
editor
|
||||||
|
?.chain()
|
||||||
|
.focus()
|
||||||
|
.updateAttributes("image", { width })
|
||||||
|
.run()
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="text-[11px] font-medium">{width}</span>
|
||||||
|
</ToolButton>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<ToolButton label="Edit image description" onClick={promptImageAlt}>
|
||||||
|
<span className="text-[11px] font-semibold">ALT</span>
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Move image up"
|
||||||
|
onClick={() => editor && moveImage(editor, -1)}
|
||||||
|
>
|
||||||
|
<ArrowUp aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Move image down"
|
||||||
|
onClick={() => editor && moveImage(editor, 1)}
|
||||||
|
>
|
||||||
|
<ArrowDown aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
<ToolButton
|
||||||
|
label="Remove image"
|
||||||
|
onClick={() => editor?.chain().focus().deleteSelection().run()}
|
||||||
|
>
|
||||||
|
<Trash2 aria-hidden="true" />
|
||||||
|
</ToolButton>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<EditorContent editor={editor} />
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center justify-between gap-2 border-t border-border px-2 py-1.5 text-xs text-muted-foreground">
|
||||||
|
<span>
|
||||||
|
Insert images with the image button. Select an image to align, resize,
|
||||||
|
move, or describe it; you can also drag it to a new position.
|
||||||
|
</span>
|
||||||
|
{uploading && (
|
||||||
|
<span role="status" className="inline-flex items-center gap-1">
|
||||||
|
<Loader2 className="h-3 w-3 animate-spin" aria-hidden="true" />
|
||||||
|
Uploading image…
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{uploadError && (
|
||||||
|
<p role="alert" className="border-t border-border px-2 py-1.5 text-xs text-destructive">
|
||||||
|
{uploadError}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { sanitizeTrainingHtml, trainingBodyToHtml } from "./rich-text";
|
||||||
|
|
||||||
|
describe("sanitizeTrainingHtml", () => {
|
||||||
|
it("keeps editor formatting and removes scripts and event handlers", () => {
|
||||||
|
const html = sanitizeTrainingHtml(
|
||||||
|
'<h2 onclick="alert(1)">Gain staging</h2><p>Set <strong>gain</strong> before <em>the service</em>.</p><script>alert(1)</script>',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(html).toContain("<h2>Gain staging</h2>");
|
||||||
|
expect(html).toContain("<strong>gain</strong>");
|
||||||
|
expect(html).toContain("<em>the service</em>");
|
||||||
|
expect(html).not.toContain("onclick");
|
||||||
|
expect(html).not.toContain("<script");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps uploaded images but drops data URLs and inline handlers", () => {
|
||||||
|
const allowed = sanitizeTrainingHtml(
|
||||||
|
'<img src="/api/training/files/abc" alt="Board" width="50%" data-align="right" onerror="alert(1)">',
|
||||||
|
);
|
||||||
|
expect(allowed).toContain('src="/api/training/files/abc"');
|
||||||
|
expect(allowed).toContain('alt="Board"');
|
||||||
|
expect(allowed).toContain('width="50%"');
|
||||||
|
expect(allowed).toContain('data-align="right"');
|
||||||
|
expect(allowed).not.toContain("onerror");
|
||||||
|
|
||||||
|
const dataUrl = sanitizeTrainingHtml(
|
||||||
|
'<img src="data:image/png;base64,abc" alt="pasted">',
|
||||||
|
);
|
||||||
|
expect(dataUrl).not.toContain("<img");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("opens external links safely and keeps internal links local", () => {
|
||||||
|
const external = sanitizeTrainingHtml(
|
||||||
|
'<a href="https://example.com/manual">Manual</a>',
|
||||||
|
);
|
||||||
|
expect(external).toContain('target="_blank"');
|
||||||
|
expect(external).toContain('rel="noopener noreferrer nofollow"');
|
||||||
|
|
||||||
|
const internal = sanitizeTrainingHtml('<a href="/training">Training</a>');
|
||||||
|
expect(internal).toContain('href="/training"');
|
||||||
|
expect(internal).not.toContain('target="_blank"');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("trainingBodyToHtml", () => {
|
||||||
|
it("turns legacy plain text into paragraphs", () => {
|
||||||
|
expect(trainingBodyToHtml("Step one\nStep two")).toBe(
|
||||||
|
"<p>Step one</p><p>Step two</p>",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("escapes legacy text instead of interpreting it as markup", () => {
|
||||||
|
expect(trainingBodyToHtml("Use <b> carefully")).toBe(
|
||||||
|
"<p>Use <b> carefully</p>",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("sanitizes already-authored HTML", () => {
|
||||||
|
expect(trainingBodyToHtml("<p>Hello</p><script>alert(1)</script>")).toBe(
|
||||||
|
"<p>Hello</p>",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* Training rich-text normalization and sanitization.
|
||||||
|
*
|
||||||
|
* Lesson bodies are stored as HTML and rendered to volunteers, so every write
|
||||||
|
* and every read passes through `trainingBodyToHtml`. The allowlist covers only
|
||||||
|
* the structures the editor can produce; scripts, event handlers, styles and
|
||||||
|
* data-URL images are removed. Inline images must point at the authenticated
|
||||||
|
* training file endpoint or an explicit http(s) URL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import sanitizeHtml from "sanitize-html";
|
||||||
|
|
||||||
|
const ALLOWED_TAGS = [
|
||||||
|
"p",
|
||||||
|
"br",
|
||||||
|
"strong",
|
||||||
|
"b",
|
||||||
|
"em",
|
||||||
|
"i",
|
||||||
|
"u",
|
||||||
|
"s",
|
||||||
|
"strike",
|
||||||
|
"del",
|
||||||
|
"h2",
|
||||||
|
"h3",
|
||||||
|
"h4",
|
||||||
|
"ul",
|
||||||
|
"ol",
|
||||||
|
"li",
|
||||||
|
"blockquote",
|
||||||
|
"pre",
|
||||||
|
"code",
|
||||||
|
"a",
|
||||||
|
"img",
|
||||||
|
"hr",
|
||||||
|
];
|
||||||
|
|
||||||
|
const ALLOWED_ATTRIBUTES: sanitizeHtml.IOptions["allowedAttributes"] = {
|
||||||
|
a: ["href", "target", "rel", "title"],
|
||||||
|
img: ["src", "alt", "title", "width", "height", "data-align"],
|
||||||
|
};
|
||||||
|
|
||||||
|
function escapeHtml(value: string): string {
|
||||||
|
return value
|
||||||
|
.replaceAll("&", "&")
|
||||||
|
.replaceAll("<", "<")
|
||||||
|
.replaceAll(">", ">")
|
||||||
|
.replaceAll('"', """)
|
||||||
|
.replaceAll("'", "'");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True when the body already contains HTML markup from the editor. A closing
|
||||||
|
* tag or a known block/void element is required, so legacy prose that happens
|
||||||
|
* to mention a literal tag (for example "Use <b> carefully") stays text.
|
||||||
|
*/
|
||||||
|
function looksLikeHtml(value: string): boolean {
|
||||||
|
return (
|
||||||
|
/<\/[a-z][^>]*>/i.test(value) ||
|
||||||
|
/<(p|h[1-6]|ul|ol|li|blockquote|pre|img|hr|br|div)\b[^>]*>/i.test(value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize editor HTML. Links that leave the site open in a new tab with a
|
||||||
|
* no-referrer policy; every other tag/attribute combination is dropped.
|
||||||
|
*/
|
||||||
|
export function sanitizeTrainingHtml(html: string): string {
|
||||||
|
return sanitizeHtml(html, {
|
||||||
|
allowedTags: ALLOWED_TAGS,
|
||||||
|
allowedAttributes: ALLOWED_ATTRIBUTES,
|
||||||
|
allowedSchemes: ["http", "https", "mailto"],
|
||||||
|
allowedSchemesByTag: { img: ["http", "https"] },
|
||||||
|
allowProtocolRelative: false,
|
||||||
|
exclusiveFilter: (frame) => {
|
||||||
|
if (frame.tag !== "img") return false;
|
||||||
|
const src = frame.attribs?.src?.trim() ?? "";
|
||||||
|
return !(
|
||||||
|
src.startsWith("/api/training/files/") || /^https?:\/\//i.test(src)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
transformTags: {
|
||||||
|
a: (tagName, attribs) => {
|
||||||
|
const href = attribs.href?.trim() ?? "";
|
||||||
|
if (!/^https?:\/\//i.test(href)) {
|
||||||
|
return { tagName, attribs };
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
tagName,
|
||||||
|
attribs: {
|
||||||
|
...attribs,
|
||||||
|
target: "_blank",
|
||||||
|
rel: "noopener noreferrer nofollow",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert any stored body into safe HTML. Legacy lessons are plain text with
|
||||||
|
* meaningful line breaks, so each line becomes a paragraph before sanitizing;
|
||||||
|
* new lessons are already HTML and only need the allowlist pass.
|
||||||
|
*/
|
||||||
|
export function trainingBodyToHtml(body: string): string {
|
||||||
|
const source = body.trim();
|
||||||
|
if (!source) return "";
|
||||||
|
|
||||||
|
if (looksLikeHtml(source)) {
|
||||||
|
return sanitizeTrainingHtml(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
const paragraphs = source
|
||||||
|
.split(/\r?\n/)
|
||||||
|
.map((line) => line.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((line) => `<p>${escapeHtml(line)}</p>`)
|
||||||
|
.join("");
|
||||||
|
|
||||||
|
return sanitizeTrainingHtml(paragraphs);
|
||||||
|
}
|
||||||
+15
-1
@@ -1,5 +1,10 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { isAllowedUpload, storedNameFor, uploadSignatureMatches } from "./uploads";
|
import {
|
||||||
|
isAllowedUpload,
|
||||||
|
resolveUploadMimeType,
|
||||||
|
storedNameFor,
|
||||||
|
uploadSignatureMatches,
|
||||||
|
} from "./uploads";
|
||||||
|
|
||||||
function bytes(...values: number[]): Uint8Array {
|
function bytes(...values: number[]): Uint8Array {
|
||||||
return new Uint8Array(values);
|
return new Uint8Array(values);
|
||||||
@@ -68,10 +73,19 @@ describe("upload allowlist and stored names", () => {
|
|||||||
expect(isAllowedUpload("image/jpeg")).toBe(true);
|
expect(isAllowedUpload("image/jpeg")).toBe(true);
|
||||||
expect(isAllowedUpload("application/pdf")).toBe(true);
|
expect(isAllowedUpload("application/pdf")).toBe(true);
|
||||||
expect(isAllowedUpload("text/markdown")).toBe(true);
|
expect(isAllowedUpload("text/markdown")).toBe(true);
|
||||||
|
expect(isAllowedUpload("image/svg+xml")).toBe(false);
|
||||||
expect(isAllowedUpload("text/html")).toBe(false);
|
expect(isAllowedUpload("text/html")).toBe(false);
|
||||||
expect(isAllowedUpload("application/x-msdownload")).toBe(false);
|
expect(isAllowedUpload("application/x-msdownload")).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("recovers a MIME type from the filename when the browser omits it", () => {
|
||||||
|
expect(resolveUploadMimeType("Booth Manual.PDF", "")).toBe("application/pdf");
|
||||||
|
expect(resolveUploadMimeType("notes.md", "application/octet-stream")).toBe(
|
||||||
|
"text/markdown",
|
||||||
|
);
|
||||||
|
expect(resolveUploadMimeType("board.jpg", "image/jpeg")).toBe("image/jpeg");
|
||||||
|
});
|
||||||
|
|
||||||
it("derives the stored name from a sanitized extension only", () => {
|
it("derives the stored name from a sanitized extension only", () => {
|
||||||
expect(storedNameFor("../../Booth Notes.PDF", "id1")).toBe("id1.pdf");
|
expect(storedNameFor("../../Booth Notes.PDF", "id1")).toBe("id1.pdf");
|
||||||
expect(storedNameFor("no-extension", "id2")).toBe("id2");
|
expect(storedNameFor("no-extension", "id2")).toBe("id2");
|
||||||
|
|||||||
+31
-1
@@ -9,7 +9,22 @@ import { mkdir } from "node:fs/promises";
|
|||||||
|
|
||||||
export const UPLOAD_DIR = process.env.UPLOAD_DIR ?? "/tmp/uploads";
|
export const UPLOAD_DIR = process.env.UPLOAD_DIR ?? "/tmp/uploads";
|
||||||
|
|
||||||
export const MAX_UPLOAD_BYTES = 5 * 1024 * 1024;
|
export const MAX_UPLOAD_BYTES = 25 * 1024 * 1024;
|
||||||
|
|
||||||
|
const MIME_BY_EXTENSION: Record<string, string> = {
|
||||||
|
".pdf": "application/pdf",
|
||||||
|
".doc": "application/msword",
|
||||||
|
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
|
".txt": "text/plain",
|
||||||
|
".md": "text/markdown",
|
||||||
|
".markdown": "text/markdown",
|
||||||
|
".png": "image/png",
|
||||||
|
".jpg": "image/jpeg",
|
||||||
|
".jpeg": "image/jpeg",
|
||||||
|
".gif": "image/gif",
|
||||||
|
".webp": "image/webp",
|
||||||
|
".avif": "image/avif",
|
||||||
|
};
|
||||||
|
|
||||||
const ALLOWED_MIME_PREFIXES = ["image/"];
|
const ALLOWED_MIME_PREFIXES = ["image/"];
|
||||||
const ALLOWED_MIME_TYPES = [
|
const ALLOWED_MIME_TYPES = [
|
||||||
@@ -21,12 +36,27 @@ const ALLOWED_MIME_TYPES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export function isAllowedUpload(mimeType: string): boolean {
|
export function isAllowedUpload(mimeType: string): boolean {
|
||||||
|
// SVG is an active document: served inline it can run script in this origin.
|
||||||
|
if (mimeType === "image/svg+xml") return false;
|
||||||
return (
|
return (
|
||||||
ALLOWED_MIME_PREFIXES.some((prefix) => mimeType.startsWith(prefix)) ||
|
ALLOWED_MIME_PREFIXES.some((prefix) => mimeType.startsWith(prefix)) ||
|
||||||
ALLOWED_MIME_TYPES.includes(mimeType)
|
ALLOWED_MIME_TYPES.includes(mimeType)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browsers sometimes leave File.type empty for a PDF or document. Fall back to
|
||||||
|
* the extension so a legitimate manual is not rejected as octet-stream.
|
||||||
|
*/
|
||||||
|
export function resolveUploadMimeType(
|
||||||
|
filename: string,
|
||||||
|
declaredType: string,
|
||||||
|
): string {
|
||||||
|
const declared = declaredType.split(";")[0].trim().toLowerCase();
|
||||||
|
if (declared && declared !== "application/octet-stream") return declared;
|
||||||
|
return MIME_BY_EXTENSION[path.extname(filename).toLowerCase()] ?? "application/octet-stream";
|
||||||
|
}
|
||||||
|
|
||||||
function startsWith(bytes: Uint8Array, signature: number[]): boolean {
|
function startsWith(bytes: Uint8Array, signature: number[]): boolean {
|
||||||
return signature.every((value, index) => bytes[index] === value);
|
return signature.every((value, index) => bytes[index] === value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user