Skip to content

Commit

Permalink
a better fix that uses internal resolveUrl routine
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Jun 8, 2021
1 parent 1c272f0 commit 777eb90
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v031
- simplify bug fix to use existing functions in reader.js

v030
- bug fix to correct Toc navigation error as it needs opf relative paths

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Updated: June 8, 2021

Current Version: "0.3.0"
Current Version: "0.3.1"

This plugin implements an epub3 reader for the epub currently being edited in Sigil.
It uses PyQt5 and PyQtWebengine to create a browser like main window and then loads
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
--- 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 @@
--- reader.js.orig 2021-06-08 10:17:52.000000000 -0400
+++ reader.js 2021-06-08 13:47:16.000000000 -0400
@@ -4310,7 +4310,10 @@

$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, '')
+ var url = EPUBJS.core.resolveUrl(basePath, ahref)

event.preventDefault();

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

Expand Down
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.3.0</version>
<version>0.3.1</version>
<autostart>true</autostart>
<autoclose>true</autoclose>
<oslist>osx,win,unx</oslist>
Expand Down
3 changes: 1 addition & 2 deletions reader/js/reader.js

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

0 comments on commit 777eb90

Please sign in to comment.