mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
get pdf preview working
This commit is contained in:
parent
29c2b6bc7f
commit
f0fb70ef9c
@ -124,7 +124,7 @@ function mainResizeHandler(_: any, win: Electron.BrowserWindow) {
|
||||
}
|
||||
|
||||
function shNavHandler(event: Electron.Event<Electron.WebContentsWillNavigateEventParams>, url: string) {
|
||||
if (url.startsWith("http://localhost:5173/index.html")) {
|
||||
if (url.startsWith("http://127.0.0.1:5173/index.html")) {
|
||||
// this is a dev-mode hot-reload, ignore it
|
||||
console.log("allowing hot-reload of index.html");
|
||||
return;
|
||||
@ -153,7 +153,10 @@ function shFrameNavHandler(event: Electron.Event<Electron.WebContentsWillFrameNa
|
||||
electron.shell.openExternal(url);
|
||||
return;
|
||||
}
|
||||
if (event.frame.name == "pdfview" && url.startsWith("blob:file:///")) {
|
||||
if (
|
||||
event.frame.name == "pdfview" &&
|
||||
(url.startsWith("blob:file:///") || url.startsWith(getBaseHostPort() + "/wave/stream-file?"))
|
||||
) {
|
||||
// allowed
|
||||
return;
|
||||
}
|
||||
|
@ -148,11 +148,11 @@ function useBlockAtom<T>(blockId: string, name: string, makeFn: () => jotai.Atom
|
||||
|
||||
function getBackendHostPort(): string {
|
||||
// TODO deal with dev/production
|
||||
return "http://localhost:8190";
|
||||
return "http://127.0.0.1:8190";
|
||||
}
|
||||
|
||||
function getBackendWSHostPort(): string {
|
||||
return "ws://localhost:8191";
|
||||
return "ws://127.0.0.1:8191";
|
||||
}
|
||||
|
||||
let globalWS: WSControl = null;
|
||||
|
@ -76,7 +76,7 @@ function StreamingPreview({ fileInfo }: { fileInfo: FileInfo }) {
|
||||
if (fileInfo.mimetype == "application/pdf") {
|
||||
return (
|
||||
<div className="view-preview view-preview-pdf">
|
||||
<iframe src={streamingUrl} width="100%" height="100%" name="pdfview" />
|
||||
<iframe src={streamingUrl} width="95%" height="95%" name="pdfview" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -105,6 +105,7 @@
|
||||
overflow: hidden;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 5px;
|
||||
|
||||
&.view-preview-markdown {
|
||||
align-items: start;
|
||||
@ -143,12 +144,12 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.view-nav {
|
||||
display: flex;
|
||||
padding: 0.2rem 0 0.2rem 0;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
|
||||
.view-nav-item {
|
||||
border-radius: 3px;
|
||||
|
Loading…
Reference in New Issue
Block a user