1
0

Changed how data is stored quite a bit with nice query capabilities

This commit is contained in:
Zef Hemel
2022-05-17 15:54:55 +02:00
parent 9a6a86f8b5
commit dfd820cc25
21 changed files with 256 additions and 132 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
import type { ParseTree } from "@silverbulletmd/common/tree";
export type AppEvent = "page:click" | "page:complete";
export type AppEvent = "page:click" | "page:complete" | "page:load";
export type ClickEvent = {
page: string;
+4 -1
View File
@@ -509,6 +509,7 @@ export class Editor {
}
async loadPage(pageName: string) {
const loadingDifferentPage = pageName !== this.currentPage;
const editorView = this.editorView;
if (!editorView) {
return;
@@ -547,7 +548,9 @@ export class Editor {
meta: doc.meta,
});
await this.eventHook.dispatchEvent("editor:pageSwitched");
if (loadingDifferentPage) {
await this.eventHook.dispatchEvent("editor:pageLoaded", pageName);
}
}
tweakEditorDOM(contentDOM: HTMLElement, readOnly: boolean) {
-7
View File
@@ -31,13 +31,6 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
"editor.getCurrentPage": (): string => {
return editor.currentPage!;
},
// sets the current page name, without changing the content
"editor.setPage": (ctx, newName: string) => {
return editor.viewDispatch({
type: "page-loaded",
name: newName,
});
},
"editor.getText": () => {
return editor.editorView?.state.sliceDoc();
},
+1 -2
View File
@@ -5,8 +5,7 @@ import { Space } from "@silverbulletmd/common/spaces/space";
export function indexerSyscalls(space: Space): SysCallMapping {
return proxySyscalls(
[
"index.scanPrefixForPage",
"index.scanPrefixGlobal",
"index.queryPrefix",
"index.get",
"index.set",
"index.batchSet",