1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Guard against empty contents

This commit is contained in:
Fred Chasen 2017-08-28 11:05:09 -04:00
parent 576a5b81dc
commit cc0110a58c
3 changed files with 14 additions and 10 deletions

View file

@ -23,7 +23,8 @@
var book = ePub("https://s3.amazonaws.com/epubjs/books/alice/OPS/package.opf"); var book = ePub("https://s3.amazonaws.com/epubjs/books/alice/OPS/package.opf");
var rendition = book.renderTo("viewer", { var rendition = book.renderTo("viewer", {
width: "100%", width: "100%",
height: 600 height: 600,
manager: "continuous"
}); });
rendition.display("chapter_007.xhtml"); rendition.display("chapter_007.xhtml");
@ -90,11 +91,11 @@
console.log(location); console.log(location);
}); });
/*
rendition.themes.register("dark", "theme.css"); rendition.themes.register("dark", "themes.css");
rendition.themes.register("light", "theme.css"); rendition.themes.register("light", "themes.css");
rendition.themes.register("tan", "theme.css"); rendition.themes.register("tan", "themes.css");
*/
rendition.themes.default({ rendition.themes.default({
@ -107,8 +108,8 @@
} }
}); });
// rendition.themes.select("tan"); rendition.themes.select("tan");
// rendition.themes.fontSize("140%"); rendition.themes.fontSize("140%");
</script> </script>

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "epubjs", "name": "epubjs",
"version": "0.3.41", "version": "0.3.46",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

@ -757,7 +757,10 @@ class DefaultViewManager {
getContents(){ getContents(){
var contents = []; var contents = [];
this.views.each(function(view){ this.views.each(function(view){
contents.push(view.contents); const viewContents = view.contents;
if (viewContents) {
contents.push(viewContents);
}
}); });
return contents; return contents;
} }