Changed how data is stored quite a bit with nice query capabilities
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user