diff --git a/src/plugins/bookPlayer/style.scss b/src/plugins/bookPlayer/style.scss index 5348e9d3c6..7bf9901b9b 100644 --- a/src/plugins/bookPlayer/style.scss +++ b/src/plugins/bookPlayer/style.scss @@ -57,7 +57,11 @@ margin-bottom: 5px; list-style-type: none; - font-size: 120%; + font-size: 1.2rem; + + ul { + padding-left: 1.5rem; + } a:link { color: #000; diff --git a/src/plugins/bookPlayer/tableOfContents.js b/src/plugins/bookPlayer/tableOfContents.js index 2da57b9229..15c19e89d0 100644 --- a/src/plugins/bookPlayer/tableOfContents.js +++ b/src/plugins/bookPlayer/tableOfContents.js @@ -51,6 +51,25 @@ export default class TableOfContents { }); } + chapterTocItem(book, chapter) { + let itemHtml = '
  • '; + + // remove parent directory reference from href to fix certain books + const link = chapter.href.startsWith('../') ? chapter.href.slice(3) : chapter.href; + itemHtml += `${chapter.label}`; + + if (chapter.subitems?.length) { + const subHtml = chapter.subitems + .map((nestedChapter) => this.chapterTocItem(book, nestedChapter)) + .join(''); + + itemHtml += ``; + } + + itemHtml += '
  • '; + return itemHtml; + } + createMediaElement() { const rendition = this.rendition; @@ -67,12 +86,7 @@ export default class TableOfContents { tocHtml += ''; tocHtml += '';