Skip to content

Commit ecad634

Browse files
committed
Add epub.
1 parent 77e30f2 commit ecad634

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

WebpagePanel.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ namespace QuickLook.Plugin.WebViewPlus
4646
public class WebpagePanel : UserControl
4747
{
4848
public static readonly string DefaultExtensions =
49-
"html,htm,mht,mhtml,pdf,csv,xlsx,svg,md,markdown,gltf,glb,c++,h++,bat,c,cmake,cpp,cs,css,d,go,h,hpp,java,js,json,jsx,kt,lua,m,mm,makefile,pas,perl,php,pl,ps1,psm1,py,r,rb,rs,sass,scala,scss,sh,sql,swift,tex,ts,tsx,txt,webp,xml,yaml,yml";
49+
"html,htm,mht,mhtml,pdf,epub,csv,xlsx,svg,md,markdown,gltf,glb,c++,h++,bat,c,cmake,cpp,cs,css,d,go,h,hpp,java,js,json,jsx,kt,lua,m,mm,makefile,pas,perl,php,pl,ps1,psm1,py,r,rb,rs,sass,scala,scss,sh,sql,swift,tex,ts,tsx,txt,webp,xml,yaml,yml";
5050
public string[] Extensions = { };
5151

5252
// These should match the ones in the web app openFile.ts:BINARY_EXTENSIONS
53-
private static readonly string[] _binExtensions = "pdf,xlsx,xls,ods,gltf,glb,fbx,obj,webp,jpg,jpeg,png,apng,gif,bmp,avif,ttf,otf,woff,woff2".Split(',');
53+
private static readonly string[] _binExtensions = "pdf,epub,xlsx,xls,ods,gltf,glb,fbx,obj,webp,jpg,jpeg,png,apng,gif,bmp,avif,ttf,otf,woff,woff2".Split(',');
5454
private Uri _currentUri;
5555
private WebView2 _webView;
5656
private bool _webAppReady = false;
@@ -182,7 +182,9 @@ void sendFileData()
182182
}
183183
);
184184

185-
_webView.CoreWebView2.PostSharedBufferToScript(_sharedBuffer, CoreWebView2SharedBufferAccess.ReadOnly, json);
185+
// read-write access needed for epub/jszip. ArrayReader writes to itself.
186+
// See https://github.com/Stuk/jszip/blob/v3.10.1/lib/reader/ArrayReader.js#L8
187+
_webView.CoreWebView2.PostSharedBufferToScript(_sharedBuffer, CoreWebView2SharedBufferAccess.ReadWrite, json);
186188
}
187189

188190
void WebMessageReceived(object sender, CoreWebView2WebMessageReceivedEventArgs args)

0 commit comments

Comments
 (0)