mlibrary / cozy-sun-bear

EPUB widgets and support based around and with code from epub.js
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Add title attribute to epub.js iframe #81

Open jmcglone opened 6 years ago

jmcglone commented 6 years ago

<iframe id="epubjs-view-f834724f-c9f5-4b2e-b4c6-e87254fe0b2e" scrolling="no" style="overflow: hidden; border: medium none; visibility: visible; width: 1668px; height: 270px;" srcdoc="<html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:epub=&quot;http://www.idpf.org/2007/ops&quot;>

Fix any of the following:

respinos commented 6 years ago

Note: we can solve this inside cozy-sun-bear with hooks. Vaguely:

this._rendition.on("rendered", function(section, view) {
  var index = this._book.navigation.tocByHref[section.href];
  var label = this._book.toc[index].label;
  view.iframe.setAttribute("title", label);
}).bind(this);

...and taking into account when this section is not found in the table-of-contents.

@jmcglone - should the title have a particular prefix? Contents of 4 From Sermon to Scripture?