Conversation
sshakndr
left a comment
There was a problem hiding this comment.
-
The modal window is too narrow in desktop mode, in my opinion.
-
Two scrollbars on desktop (the page switching buttons are pushed off-screen).
-
Is it possible to create proper pages, instead of just one chapter per page?
-
If this is the only way to implement pages, maybe you should try improving the bookmarks so they remember where the user scrolled? Using scrollTop / scrollHeight / clientHeight.
| } | ||
| }, | ||
| fileType: [FilesType.file], | ||
| fileExt: [".djvu", ".djv", ".epub", ".fb2", ".zip"], |
There was a problem hiding this comment.
Problem with ZIP without books:
ZIP does not contain a recognised book format. Supported: EPUB (with META-INF/container.xml), .fb2, or .djvu inside a ZIP.
Even if there is some book format based on the archive, all zip archives should not be associated with the book format.
Try opening it first, and if an error occurs, it's better to report it through iToast, instead of the console and a broken modal window.
In any case, I don't see the point in maintaining the archive, since it takes time to unpack it each time. If this is common practice among e-book readers, then of course this functionality could be retained.
| }, | ||
| }; | ||
|
|
||
| export const zipFileItem: IFileItem = { |
There was a problem hiding this comment.
This file item shouldn't exist. Clicking on the archive should open it first (there's a plugin for that), rather than attempting to find and open books.
| } from "@onlyoffice/docspace-plugin-sdk"; | ||
| import { createReaderModal } from "../Modal"; | ||
|
|
||
| export const epubFileItem: IFileItem = { |
There was a problem hiding this comment.
All file items can be dynamicaly defined and strored in one array like in Codemirror plugin for less code
|
|
||
| export const epubFileItem: IFileItem = { | ||
| extension: ".epub", | ||
| fileTypeName: "EPUB Book", |
There was a problem hiding this comment.
You don't need to specify the format, as DocSpace will show it for you. You can just leave it as "Book." Also, for most, if not all, formats, DocSpace will automatically set the type to "Document."
| fileTileIcon: "icon-16.png", | ||
| devices: [Devices.desktop, Devices.mobile, Devices.tablet], | ||
| onClick: (item: File): IMessage => { | ||
| console.log("Opening EPUB file in reader:", item.id); |
| console.log("Context menu clicked, File ID:", id); | ||
|
|
||
| try { | ||
| console.log("Fetching file metadata..."); | ||
| const response = await fetch(`/api/2.0/files/file/${id}`, { | ||
| method: "GET", | ||
| headers: { | ||
| Accept: "application/json", | ||
| }, | ||
| }); | ||
|
|
||
| const fileData = await response.json(); | ||
| const fileInfo = fileData.response; | ||
|
|
||
| console.log("File info loaded:", fileInfo.title, fileInfo.fileExst); | ||
|
|
There was a problem hiding this comment.
This piece of code can be moved to createReaderModal() and there you can check whether a File or a number has arrived.
remove unnecessary console.logs
| console.error("Error in reader:", error); | ||
|
|
||
| const errorModal = createReaderModal(id); | ||
| return { | ||
| actions: [Actions.showModal], | ||
| modalDialogProps: errorModal, | ||
| }; |
There was a problem hiding this comment.
use IToast to show errors
book-reader plugin added