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