Skip to content

Commit

Permalink
fix toc_controller bug in reader.js converting nav/ncx rel paths to o…
Browse files Browse the repository at this point in the history
…pf rel
  • Loading branch information
kevinhendricks committed Jun 8, 2021
1 parent ff466a6 commit 8cf514b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 90 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v030
- bug fix to correct Toc navigation error as it needs opf relative paths

v020
- added in plugin icons from BeckyEbook

Expand Down
22 changes: 22 additions & 0 deletions epubjs_reader_bug_fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- reader/js/reader.js.orig 2021-06-08 09:45:16.000000000 -0400
+++ reader/js/reader.js 2021-06-08 09:51:48.000000000 -0400
@@ -4310,7 +4310,11 @@

$list.append(docfrag);
$list.find(".toc_link").on("click", function(event){
- var url = this.getAttribute('href');
+ // convert href to be relative to the opf not ncx or nav
+ var ahref = this.getAttribute('href');
+ var basePath = book.packaging.navPath || book.packaging.ncxPath
+ var base = 'https://example.invalid/'
+ var url = new URL(ahref, base + basePath).href.replace(base, '')

event.preventDefault();

@@ -4344,4 +4348,4 @@
};
};

-//# sourceMappingURL=reader.js.map
\ No newline at end of file
+//# sourceMappingURL=reader.js.map
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<author>Sigil</author>
<description>Provide a FuturePress EpubJS Reader to view the current epub being edited</description>
<engine>python3.4</engine>
<version>0.2.0</version>
<version>0.3.0</version>
<autostart>true</autostart>
<autoclose>true</autoclose>
<oslist>osx,win,unx</oslist>
Expand Down
8 changes: 6 additions & 2 deletions reader/js/reader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 0 additions & 85 deletions reader/js/reader.js.map

This file was deleted.

1 change: 0 additions & 1 deletion reader/js/reader.min.js

This file was deleted.

1 change: 0 additions & 1 deletion reader/js/reader.min.map

This file was deleted.

0 comments on commit 8cf514b

Please sign in to comment.