mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-03 03:27:03 +00:00
changes
This commit is contained in:
1 parent
78fff9b6f4
commit
7cc36e3e40
37 files changed
+55361
-103
No files matched your search
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user