mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-02 19:17:03 +00:00
changes
This commit is contained in:
1 parent
11df8697b1
commit
c090fb595f
61 files changed
+52534
-107
No files matched your search
@@ -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: () =>
|
||||
|
||||
@@ -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 }),
|
||||
}));
|
||||
Reference in new issue
Block a user