Tweaks and panel updates
This commit is contained in:
parent
4518476c77
commit
8c974161c3
@ -123,3 +123,7 @@ parentPort.on("message", (data: any) => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
console.error("Uncaught error", e);
|
||||
});
|
||||
|
@ -105,6 +105,8 @@ functions:
|
||||
name: "Debug: Show Logs"
|
||||
key: "Ctrl-Alt-l"
|
||||
mac: "Cmd-Alt-l"
|
||||
events:
|
||||
- log:reload
|
||||
hideBhsCommand:
|
||||
path: ./debug.ts:hideBhsCommand
|
||||
command:
|
||||
|
@ -73,6 +73,12 @@ export async function showLogsCommand() {
|
||||
clientDiv.scrollTop = clientDiv.scrollHeight;
|
||||
var serverDiv = document.getElementById("server-log");
|
||||
serverDiv.scrollTop = serverDiv.scrollHeight;
|
||||
if(window.reloadInterval) {
|
||||
clearInterval(window.reloadInterval);
|
||||
}
|
||||
window.reloadInterval = setInterval(() => {
|
||||
sendEvent("log:reload");
|
||||
}, 1000);
|
||||
`
|
||||
);
|
||||
}
|
||||
|
@ -1,15 +1,20 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
// @ts-ignore
|
||||
import iframeHtml from "bundle-text:./panel.html";
|
||||
import { System } from "@plugos/plugos/system";
|
||||
import { SilverBulletHooks } from "@silverbulletmd/common/manifest";
|
||||
import { Editor } from "../editor";
|
||||
|
||||
export function Panel({
|
||||
html,
|
||||
script,
|
||||
flex,
|
||||
editor,
|
||||
}: {
|
||||
html: string;
|
||||
script?: string;
|
||||
flex: number;
|
||||
editor: Editor;
|
||||
}) {
|
||||
const iFrameRef = useRef<HTMLIFrameElement>(null);
|
||||
useEffect(() => {
|
||||
@ -40,7 +45,9 @@ export function Panel({
|
||||
}
|
||||
let data = evt.data;
|
||||
if (!data) return;
|
||||
console.log("Got message from panel", data);
|
||||
if (data.type === "event") {
|
||||
editor.dispatchAppEvent(data.name, data.args);
|
||||
}
|
||||
};
|
||||
window.addEventListener("message", messageListener);
|
||||
return () => {
|
||||
|
@ -1,3 +1,8 @@
|
||||
declare global {
|
||||
function syscall(name: string, ...args: any[]): Promise<any>;
|
||||
// function require(moduleName: string): any;
|
||||
}
|
||||
|
||||
window.addEventListener("message", (message) => {
|
||||
const data = message.data;
|
||||
switch (data.type) {
|
||||
@ -14,11 +19,12 @@ window.addEventListener("message", (message) => {
|
||||
}
|
||||
});
|
||||
|
||||
function sendEvent(data: any) {
|
||||
function sendEvent(name: string, ...args: any[]) {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: "event",
|
||||
data: data,
|
||||
name,
|
||||
args,
|
||||
},
|
||||
"*"
|
||||
);
|
||||
|
@ -642,6 +642,7 @@ export class Editor {
|
||||
html={viewState.lhsHTML}
|
||||
script={viewState.lhsScript}
|
||||
flex={viewState.showLHS}
|
||||
editor={editor}
|
||||
/>
|
||||
)}
|
||||
<div id="editor" />
|
||||
@ -650,6 +651,7 @@ export class Editor {
|
||||
html={viewState.rhsHTML}
|
||||
script={viewState.rhsScript}
|
||||
flex={viewState.showRHS}
|
||||
editor={editor}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
@ -659,6 +661,7 @@ export class Editor {
|
||||
html={viewState.bhsHTML}
|
||||
script={viewState.bhsScript}
|
||||
flex={1}
|
||||
editor={editor}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
@ -110,7 +110,8 @@
|
||||
color: #038138;
|
||||
}
|
||||
|
||||
.string,.string2 {
|
||||
.string,
|
||||
.string2 {
|
||||
color: #440377;
|
||||
}
|
||||
|
||||
@ -118,7 +119,6 @@
|
||||
// background: black;
|
||||
// border-radius: 3px;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
.meta {
|
||||
@ -140,6 +140,10 @@
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.link {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.link:not(.meta, .url) {
|
||||
color: #0330cb;
|
||||
text-decoration: underline;
|
||||
@ -152,6 +156,7 @@
|
||||
.url:not(.link) {
|
||||
color: #0330cb;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.atom {
|
||||
@ -160,18 +165,15 @@
|
||||
|
||||
.wiki-link-page {
|
||||
color: #0330cb;
|
||||
background-color: rgba(77,141,255,0.07);
|
||||
background-color: rgba(77, 141, 255, 0.07);
|
||||
border-radius: 5px;
|
||||
padding: 0 5px;
|
||||
//text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
.wiki-link {
|
||||
color: #a8abbd;
|
||||
//background-color: rgba(77,141,255,0.07);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Indentation of follow-up lines
|
||||
@mixin lineOverflow($baseIndent) {
|
||||
text-indent: -1 * ($baseIndent + 2ch);
|
||||
|
Loading…
Reference in New Issue
Block a user