Lots of tweaks

This commit is contained in:
Zef Hemel
2022-05-09 14:59:12 +02:00
parent 35dc75d94e
commit f6758dbbaf
25 changed files with 336 additions and 62 deletions
+6 -6
View File
@@ -232,20 +232,20 @@ function $11a7e2bff790f35a$export$4f02334034b5dd8c(message) {
function $11a7e2bff790f35a$export$83b9d7a71bc0a208(label, options, helpText = "", placeHolder = "") {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.filterBox", label, options, helpText, placeHolder);
}
function $11a7e2bff790f35a$export$53ed0b99a5f8822e(html, flex = 1) {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.showRhs", html, flex);
function $11a7e2bff790f35a$export$53ed0b99a5f8822e(html, script, flex = 1) {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.showRhs", html, script, flex);
}
function $11a7e2bff790f35a$export$f19f28e8a128fabe() {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.hideRhs");
}
function $11a7e2bff790f35a$export$dcf0ace441f4b3a4(html, flex = 1) {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.showLhs", html, flex);
function $11a7e2bff790f35a$export$dcf0ace441f4b3a4(html, script, flex = 1) {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.showLhs", html, script, flex);
}
function $11a7e2bff790f35a$export$1be2ad20c6324dcf() {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.hideLhs");
}
function $11a7e2bff790f35a$export$6ebe231c70cc6efb(html, flex = 1) {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.showBhs", html, flex);
function $11a7e2bff790f35a$export$6ebe231c70cc6efb(html, script, flex = 1) {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.showBhs", html, script, flex);
}
function $11a7e2bff790f35a$export$a7a5aa8ba1cd9dc3() {
return $4ba3510c824e3aea$export$c5be9092dbf465c("editor.hideBhs");
File diff suppressed because one or more lines are too long
+17 -6
View File
@@ -67,9 +67,6 @@ functions:
name: "Page: Rename"
mac: Cmd-Alt-r
key: Ctrl-Alt-r
button:
label: "📝"
tooltip: "Rename page"
pageComplete:
path: "./page.ts:pageComplete"
events:
@@ -93,15 +90,27 @@ functions:
slashCommand:
name: tomorrow
parseServerCommand:
path: ./page.ts:parseServerPageCommand
path: ./debug.ts:parseServerPageCommand
command:
name: "Debug: Parse Document on Server"
parsePage:
path: ./page.ts:parsePage
path: ./debug.ts:parsePage
parseCommand:
path: ./page.ts:parsePageCommand
path: ./debug.ts:parsePageCommand
command:
name: "Debug: Parse Document"
showLogsCommand:
path: ./debug.ts:showLogsCommand
command:
name: "Debug: Show Logs"
key: "Ctrl-Alt-l"
mac: "Cmd-Alt-l"
hideBhsCommand:
path: ./debug.ts:hideBhsCommand
command:
name: "UI: Hide BHS"
key: "Ctrl-Alt-b"
mac: "Cmd-Alt-b"
insertPageMeta:
path: "./page.ts:insertPageMeta"
slashCommand:
@@ -111,6 +120,8 @@ functions:
command:
name: "Template: Quick Note"
key: "Alt-Shift-n"
button:
label: "🗒"
quickTaskCommand:
path: ./template.ts:quickTaskCommand
command:
+82
View File
@@ -0,0 +1,82 @@
import { getLogs } from "@plugos/plugos-syscall/sandbox";
import { LogEntry } from "@plugos/plugos/sandbox";
import {
getText,
hideBhs,
showBhs,
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
import { getServerLogs } from "@silverbulletmd/plugos-silverbullet-syscall/sandbox";
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
export async function parseServerPageCommand() {
console.log(await invokeFunction("server", "parsePage", await getText()));
}
export async function parsePageCommand() {
parsePage(await getText());
}
export async function parsePage(text: string) {
console.log("AST", JSON.stringify(await parseMarkdown(text), null, 2));
}
export async function showLogsCommand() {
let clientLogs = await getLogs();
let serverLogs = await getServerLogs();
await showBhs(
`
<style>
#client-log-header {
position: absolute;
left: 0;
top: 5px;
}
#server-log-header {
position: absolute;
right: 0;
top: 5px;
width: 50%;
}
#client-log {
position: absolute;
left: 0;
top: 30px;
bottom: 0;
width: 50%;
overflow: scroll;
}
#server-log {
position: absolute;
right: 0;
top: 30px;
bottom: 0;
width: 50%;
overflow: scroll;
}
</style>
<div id="client-log-header">Client logs (max 100)</div>
<div id="client-log">
<pre>${clientLogs
.map((le) => `[${le.level}] ${le.message}`)
.join("\n")}</pre>
</div>
<div id="server-log-header">Server logs (max 100)</div>
<div id="server-log">
<pre>${serverLogs
.map((le) => `[${le.level}] ${le.message}`)
.join("\n")}</pre>
</div>`,
`
var clientDiv = document.getElementById("client-log");
clientDiv.scrollTop = clientDiv.scrollHeight;
var serverDiv = document.getElementById("server-log");
serverDiv.scrollTop = serverDiv.scrollHeight;
`
);
}
export async function hideBhsCommand() {
await hideBhs();
}
-12
View File
@@ -239,18 +239,6 @@ export async function parseIndexTextRepublish({ name, text }: IndexEvent) {
});
}
export async function parseServerPageCommand() {
console.log(await invokeFunction("server", "parsePage", await getText()));
}
export async function parsePageCommand() {
parsePage(await getText());
}
export async function parsePage(text: string) {
console.log("AST", JSON.stringify(await parseMarkdown(text), null, 2));
}
export async function insertPageMeta() {
let cursorPos = await getCursor();
await insertAtCursor("```meta\n\n```");
+1
View File
@@ -78,6 +78,7 @@ export async function updateMarkdownPreview() {
let cleanMd = await cleanMarkdown(text);
await showRhs(
`<html><head>${css}</head><body>${md.render(cleanMd)}</body></html>`,
undefined,
2
);
}
@@ -28,7 +28,6 @@ export async function updateMaterializedQueriesCommand() {
currentPage
);
await reloadPage();
await flashNotification("Updated materialized queries");
}
export async function whiteOutQueriesCommand() {