@fiduswriter/books-document 0.1.27 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ui/book_dialog/dialog.d.ts +98 -0
- package/dist/ui/book_dialog/dialog.d.ts.map +1 -0
- package/dist/ui/book_dialog/dialog.js +590 -0
- package/dist/ui/book_dialog/dialog.js.map +1 -0
- package/dist/ui/book_dialog/export.d.ts +81 -0
- package/dist/ui/book_dialog/export.d.ts.map +1 -0
- package/dist/ui/book_dialog/export.js +184 -0
- package/dist/ui/book_dialog/export.js.map +1 -0
- package/dist/ui/book_dialog/index.d.ts +38 -0
- package/dist/ui/book_dialog/index.d.ts.map +1 -0
- package/dist/ui/book_dialog/index.js +36 -0
- package/dist/ui/book_dialog/index.js.map +1 -0
- package/dist/ui/book_dialog/sanity_check.d.ts +22 -0
- package/dist/ui/book_dialog/sanity_check.d.ts.map +1 -0
- package/dist/ui/book_dialog/sanity_check.js +109 -0
- package/dist/ui/book_dialog/sanity_check.js.map +1 -0
- package/dist/ui/book_dialog/templates.d.ts +74 -0
- package/dist/ui/book_dialog/templates.d.ts.map +1 -0
- package/dist/ui/book_dialog/templates.js +526 -0
- package/dist/ui/book_dialog/templates.js.map +1 -0
- package/dist/ui/book_dialog/types.d.ts +165 -0
- package/dist/ui/book_dialog/types.d.ts.map +1 -0
- package/dist/ui/book_dialog/types.js +15 -0
- package/dist/ui/book_dialog/types.js.map +1 -0
- package/package.json +20 -16
- package/src/ui/book_dialog/dialog.ts +765 -0
- package/src/ui/book_dialog/export.ts +398 -0
- package/src/ui/book_dialog/index.ts +81 -0
- package/src/ui/book_dialog/sanity_check.ts +208 -0
- package/src/ui/book_dialog/templates.ts +705 -0
- package/src/ui/book_dialog/types.ts +180 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://git.fiduswriter.org/fiduswriter/fiduswriter-books-
|
|
2
|
+
<img src="https://git.fiduswriter.org/fiduswriter/fiduswriter-books-ts/raw/branch/main/logo.svg" alt="@fiduswriter/books-document" width="100" height="100">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">@fiduswriter/books-document</h1>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The book edit dialog.
|
|
3
|
+
*
|
|
4
|
+
* A tabbed dialog that edits a book's metadata and settings, manages its
|
|
5
|
+
* chapter list (add/remove/reorder, part grouping and per-chapter part
|
|
6
|
+
* titles), picks the cover image, triggers a sanity check and starts an
|
|
7
|
+
* export.
|
|
8
|
+
*
|
|
9
|
+
* Everything host-specific is injected: see `./types.js`. The book *overview*
|
|
10
|
+
* page -- its datatable, bulk actions, sharing, copy and delete -- is not
|
|
11
|
+
* part of this component and stays with the host.
|
|
12
|
+
*/
|
|
13
|
+
import type { Book, Chapter } from "../../types.js";
|
|
14
|
+
import { Dialog, FileSelector } from "fwtoolkit";
|
|
15
|
+
import type { BookExportMenu } from "./export.js";
|
|
16
|
+
import type { BookDialogImageDB, BookDialogInfo, BookDialogOptions, BookDialogPart } from "./types.js";
|
|
17
|
+
/** The tabbed book editor. */
|
|
18
|
+
export declare class BookDialog {
|
|
19
|
+
options: BookDialogOptions;
|
|
20
|
+
/** Whether this dialog creates a new book or edits an existing one. */
|
|
21
|
+
isNew: boolean;
|
|
22
|
+
/** The book being edited. A working copy, not the host's own record. */
|
|
23
|
+
book: Book;
|
|
24
|
+
documentList: BookDialogOptions["documentList"];
|
|
25
|
+
exportMenu: BookExportMenu;
|
|
26
|
+
/** Callbacks invoked after the book has been saved. */
|
|
27
|
+
onSave: Array<(book: Book) => Promise<unknown> | unknown>;
|
|
28
|
+
dialogParts: BookDialogPart[];
|
|
29
|
+
/** Cover images that are not part of the host's image database. */
|
|
30
|
+
bookImageDB: BookDialogImageDB;
|
|
31
|
+
dialog: Dialog | null;
|
|
32
|
+
constructor(options: BookDialogOptions);
|
|
33
|
+
/** The image database the dialog renders cover previews from. */
|
|
34
|
+
imageDB(): BookDialogImageDB;
|
|
35
|
+
/** The dialog's root element, or the document before it is opened. */
|
|
36
|
+
root(): ParentNode;
|
|
37
|
+
/** The bundle the tab templates are rendered from. */
|
|
38
|
+
bookInfo(): BookDialogInfo;
|
|
39
|
+
/** A brand new book with the dialog's default metadata and settings. */
|
|
40
|
+
createEmptyBook(): Book;
|
|
41
|
+
/**
|
|
42
|
+
* The dialog's working copy of an existing book.
|
|
43
|
+
*
|
|
44
|
+
* The record is copied shallowly -- the `chapters` array stays shared with
|
|
45
|
+
* the host's record, exactly as the Django backend's dialog behaved -- and
|
|
46
|
+
* the metadata block is merged onto a complete one so every form field
|
|
47
|
+
* has something to read back.
|
|
48
|
+
*/
|
|
49
|
+
workingCopy(book: Book): Book;
|
|
50
|
+
/** Render and open the dialog. */
|
|
51
|
+
open(): void;
|
|
52
|
+
/** Whether the book is only readable, i.e. not editable. */
|
|
53
|
+
readOnly(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Let the user pick a DOCX/ODT template file and hand it to the host.
|
|
56
|
+
*
|
|
57
|
+
* The book is saved first, because a freshly created book has no id the
|
|
58
|
+
* host could attach a template to.
|
|
59
|
+
*/
|
|
60
|
+
bindTemplateInput(dialog: Dialog, inputId: string, rowId: string, applyTemplate: (book: Book, template: string) => void, saveTemplate?: (book: Book, file: File) => Promise<string | null>): void;
|
|
61
|
+
/** Replace the markup of one of the dialog's rows. */
|
|
62
|
+
refreshRow(rowId: string, html: string): void;
|
|
63
|
+
/** Re-render the chapter list. */
|
|
64
|
+
refreshChapterList(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Add or remove the encrypted-chapters notice that lives alongside the
|
|
67
|
+
* chapter list. Called after any operation that changes book.chapters so
|
|
68
|
+
* the notice stays in sync.
|
|
69
|
+
*/
|
|
70
|
+
updateChapterNotice(): void;
|
|
71
|
+
/** Open a sub-dialog to edit a chapter's part title. */
|
|
72
|
+
editChapterDialog(chapter: Chapter): void;
|
|
73
|
+
/** Let the user pick the cover image through the host's image picker. */
|
|
74
|
+
selectCoverImage(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Persist the edited book through the host and notify the save callbacks.
|
|
77
|
+
*
|
|
78
|
+
* Reads the metadata form fields back into the book, so it must only be
|
|
79
|
+
* called while the dialog is open.
|
|
80
|
+
*/
|
|
81
|
+
saveBook(): Promise<unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* Move a chapter one position up or down the list.
|
|
84
|
+
*
|
|
85
|
+
* @param docId - Id of the chapter document to move.
|
|
86
|
+
* @param offset - `-1` to move up, `1` to move down.
|
|
87
|
+
*/
|
|
88
|
+
moveChapter(docId: number, offset: number): void;
|
|
89
|
+
/** Remove a chapter from the book and close the numbering gap. */
|
|
90
|
+
removeChapter(docId: number): void;
|
|
91
|
+
/** Append the documents selected in the file selector as new chapters. */
|
|
92
|
+
addChapters(fileSelector: FileSelector): void;
|
|
93
|
+
/** Handle a click anywhere inside the dialog. */
|
|
94
|
+
handleDialogClick(event: Event, fileSelector?: FileSelector): void;
|
|
95
|
+
/** Save the book and render its sanity check report in place. */
|
|
96
|
+
performSanityCheck(): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/ui/book_dialog/dialog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAgB,OAAO,EAAC,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAEH,MAAM,EACN,YAAY,EAIf,MAAM,WAAW,CAAA;AAGlB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAkB/C,OAAO,KAAK,EACR,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACjB,MAAM,YAAY,CAAA;AA8Bn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