This commit is contained in:
pj committed 2026-06-27 09:32:22 -04:00
1 parent 11df8697b1
commit c090fb595f
61 files changed
+52534 -107

No files matched your search

+8 -1
View File
@@ -33,6 +33,7 @@ interface BookState {
setChapterContent: (id: string, content: JSONContent) => void;
setChapterTitle: (id: string, title: string) => void;
setChapterNoTitle: (id: string, noTitle: boolean) => void;
setChapterNoMargin: (id: string, noMargin: boolean) => void;
addChapter: () => void;
addPage: (group: "front" | "back", title: string) => void;
addPart: () => void;
@@ -87,7 +88,13 @@ export const useBook = create<BookState>((set, get) => ({
setChapterNoTitle: (id, noTitle) =>
set((s) =>
s.book
? { dirty: true, book: { ...s.book, chapters: s.book.chapters.map((c) => (c.id === id ? { ...c, noTitle, title: noTitle ? "" : c.title, updatedAt: Date.now() } : c)) } }
? { dirty: true, book: { ...s.book, chapters: s.book.chapters.map((c) => (c.id === id ? { ...c, noTitle, updatedAt: Date.now() } : c)) } }
: {}
),
setChapterNoMargin: (id, noMargin) =>
set((s) =>
s.book
? { dirty: true, book: { ...s.book, chapters: s.book.chapters.map((c) => (c.id === id ? { ...c, noMargin, updatedAt: Date.now() } : c)) } }
: {}
),
addChapter: () =>
+13
View File
@@ -0,0 +1,13 @@
import { create } from "zustand";
interface ExportPreviewState {
open: boolean;
openPreview: () => void;
close: () => void;
}
export const useExportPreview = create<ExportPreviewState>((set) => ({
open: false,
openPreview: () => set({ open: true }),
close: () => set({ open: false }),
}));