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) {
|
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
|
// this is a dev-mode hot-reload, ignore it
|
||||||
console.log("allowing hot-reload of index.html");
|
console.log("allowing hot-reload of index.html");
|
||||||
return;
|
return;
|
||||||
@ -153,7 +153,10 @@ function shFrameNavHandler(event: Electron.Event<Electron.WebContentsWillFrameNa
|
|||||||
electron.shell.openExternal(url);
|
electron.shell.openExternal(url);
|
||||||
return;
|
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
|
// allowed
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -148,11 +148,11 @@ function useBlockAtom<T>(blockId: string, name: string, makeFn: () => jotai.Atom
|
|||||||
|
|
||||||
function getBackendHostPort(): string {
|
function getBackendHostPort(): string {
|
||||||
// TODO deal with dev/production
|
// TODO deal with dev/production
|
||||||
return "http://localhost:8190";
|
return "http://127.0.0.1:8190";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBackendWSHostPort(): string {
|
function getBackendWSHostPort(): string {
|
||||||
return "ws://localhost:8191";
|
return "ws://127.0.0.1:8191";
|
||||||
}
|
}
|
||||||
|
|
||||||
let globalWS: WSControl = null;
|
let globalWS: WSControl = null;
|
||||||
|
@ -76,7 +76,7 @@ function StreamingPreview({ fileInfo }: { fileInfo: FileInfo }) {
|
|||||||
if (fileInfo.mimetype == "application/pdf") {
|
if (fileInfo.mimetype == "application/pdf") {
|
||||||
return (
|
return (
|
||||||
<div className="view-preview view-preview-pdf">
|
<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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
margin: 5px;
|
||||||
|
|
||||||
&.view-preview-markdown {
|
&.view-preview-markdown {
|
||||||
align-items: start;
|
align-items: start;
|
||||||
@ -143,12 +144,12 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-nav {
|
.view-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 0.2rem 0 0.2rem 0;
|
padding: 0.2rem 0 0.2rem 0;
|
||||||
border-bottom: 1px solid var(--border-color);
|
|
||||||
|
|
||||||
.view-nav-item {
|
.view-nav-item {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
Loading…
Reference in New Issue
Block a user