Skip to content

Commit 9e9d510

Browse files
authored
Set Cover Page Title in Epub 3 (2) (#2293)
* Make sure that the title of generated cover pages is set for epub 3 * hardcode the value of the title for the epub to Cover
1 parent b446321 commit 9e9d510

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

plugin/js/EpubItemSupplier.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ class EpubItemSupplier { // eslint-disable-line no-unused-vars
3939
}
4040
}
4141

42-
makeCoverImageXhtmlFile(emptyDocFactory) {
42+
makeCoverImageXhtmlFile(emptyDocFactory, title) {
4343
let doc = emptyDocFactory();
4444
let body = doc.getElementsByTagName("body")[0];
4545
let userPreferences = this.imageCollector.userPreferences;
4646
body.appendChild(this.coverImageInfo.createImageElement(userPreferences));
47+
48+
if (title) {
49+
doc.querySelector("title").text = title;
50+
}
51+
4752
return util.xmlToString(doc);
4853
}
4954

plugin/js/EpubPacker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ class EpubPacker {
345345
file.packInEpub(zipWriter, this.emptyDocFactory, this.contentValidator);
346346
}
347347
if (epubItemSupplier.hasCoverImageFile()) {
348-
let fileContent = epubItemSupplier.makeCoverImageXhtmlFile(this.emptyDocFactory);
348+
let fileContent = epubItemSupplier.makeCoverImageXhtmlFile(this.emptyDocFactory, "Cover");
349349
zipWriter.add(EpubPacker.coverImageXhtmlHref(), new zip.TextReader(fileContent));
350350
}
351351
}

0 commit comments

Comments
 (0)