Skip to content

Commit

Permalink
Fix for issue #68: Always switch current book when opening a single b…
Browse files Browse the repository at this point in the history
…ook.
  • Loading branch information
codedread committed Nov 17, 2023
1 parent b86e151 commit ad1eb72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/kthoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -956,11 +956,13 @@ export class KthoomApp {
// Else, assume the file is a single book and try to load the first one.
const handleOrFile = evt.handles ? evt.handles[fileNum] : theFile;
const singleBook = new Book(theFile.name, handleOrFile);
// If we have no books open, then always switch to the first one.
if (this.readingStack_.getNumberOfBooks() === 0) {
this.loadBooksFromPromises_([singleBook.load()]);
this.readingStack_.addBook(singleBook, true);
} else {
this.readingStack_.addBook(singleBook, false);
// If it was only one book, then switch to it, even if the reading stack is populated.
this.readingStack_.addBook(singleBook, filelist.length === 1);
}
}
}
Expand Down

0 comments on commit ad1eb72

Please sign in to comment.