This commit is contained in:
Zef Hemel
2022-04-26 19:04:36 +02:00
parent cb2d3f8652
commit 76636dd9b1
41 changed files with 500 additions and 287 deletions
+12
View File
@@ -92,6 +92,18 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
type: "hide-lhs",
});
},
"editor.showBhs": (ctx, html: string, flex: number) => {
editor.viewDispatch({
type: "show-bhs",
flex,
html,
});
},
"editor.hideBhs": (ctx) => {
editor.viewDispatch({
type: "hide-bhs",
});
},
"editor.insertAtPos": (ctx, text: string, pos: number) => {
editor.editorView!.dispatch({
changes: {
+2 -2
View File
@@ -4,8 +4,8 @@ import { PageMeta } from "@silverbulletmd/common/types";
export function spaceSyscalls(editor: Editor): SysCallMapping {
return {
"space.listPages": async (): Promise<PageMeta[]> => {
return [...(await editor.space.listPages())];
"space.listPages": async (ctx, unfiltered = false): Promise<PageMeta[]> => {
return [...(await editor.space.listPages(unfiltered))];
},
"space.readPage": async (
ctx,
+6 -3
View File
@@ -1,7 +1,7 @@
import { SysCallMapping } from "@plugos/plugos/system";
import { Space } from "@silverbulletmd/common/spaces/space";
import type { Editor } from "../editor";
export function systemSyscalls(space: Space): SysCallMapping {
export function systemSyscalls(editor: Editor): SysCallMapping {
return {
"system.invokeFunction": async (
ctx,
@@ -17,7 +17,10 @@ export function systemSyscalls(space: Space): SysCallMapping {
return ctx.plug.invoke(name, args);
}
return space.invokeFunction(ctx.plug, env, name, args);
return editor.space.invokeFunction(ctx.plug, env, name, args);
},
"system.reloadPlugs": async () => {
return editor.reloadPlugs();
},
};
}