mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-02 19:17:03 +00:00
feat(model): give each book an id
This commit is contained in:
1 parent
709dd46f1c
commit
4896e10aba
1 file changed
+3
@@ -24,6 +24,7 @@ export interface Chapter {
|
|||||||
|
|
||||||
export interface Book {
|
export interface Book {
|
||||||
schema: "margin/1";
|
schema: "margin/1";
|
||||||
|
id: string;
|
||||||
metadata: BookMetadata;
|
metadata: BookMetadata;
|
||||||
theme: string;
|
theme: string;
|
||||||
settings: BookSettings;
|
settings: BookSettings;
|
||||||
@@ -45,6 +46,7 @@ export function createChapter(title = "Untitled chapter"): Chapter {
|
|||||||
export function createBook(): Book {
|
export function createBook(): Book {
|
||||||
return {
|
return {
|
||||||
schema: "margin/1",
|
schema: "margin/1",
|
||||||
|
id: crypto.randomUUID(),
|
||||||
metadata: { title: "Untitled", subtitle: "", author: "", isbn: "", language: "en" },
|
metadata: { title: "Untitled", subtitle: "", author: "", isbn: "", language: "en" },
|
||||||
theme: "quiet-press",
|
theme: "quiet-press",
|
||||||
settings: { trim: "6x9", bleed: true },
|
settings: { trim: "6x9", bleed: true },
|
||||||
@@ -54,6 +56,7 @@ export function createBook(): Book {
|
|||||||
|
|
||||||
export function starterBook(): Book {
|
export function starterBook(): Book {
|
||||||
const book = createBook();
|
const book = createBook();
|
||||||
|
book.metadata.title = "The Lighthouse";
|
||||||
book.chapters = [
|
book.chapters = [
|
||||||
{
|
{
|
||||||
id: crypto.randomUUID(),
|
id: crypto.randomUUID(),
|
||||||
|
|||||||
Reference in new issue
Block a user