This commit is contained in:
pj committed 2026-06-22 09:56:20 -04:00
1 parent 78fff9b6f4
commit 7cc36e3e40
37 files changed
+55361 -103

No files matched your search

+6
View File
@@ -70,6 +70,7 @@ export interface Chapter {
content: JSONContent;
updatedAt: number;
kind?: ChapterKind;
noTitle?: boolean;
}
export interface PageType {
@@ -130,6 +131,11 @@ export function createPage(group: "front" | "back", title: string): Chapter {
return { id: crypto.randomUUID(), title, content: emptyDoc(), kind: group, updatedAt: Date.now() };
}
export function cloneChapter(chapter: Chapter): Chapter {
const title = chapter.noTitle || !chapter.title ? chapter.title : `${chapter.title} (copy)`;
return { ...chapter, id: crypto.randomUUID(), title, content: structuredClone(chapter.content), updatedAt: Date.now() };
}
export function createCover(): Cover {
return { kind: "default", image: "", bg: COVER_PALETTES[0].bg, ink: COVER_PALETTES[0].ink };
}