1
0

Fix syntax extensions not loading at b oot

This commit is contained in:
Zef Hemel 2022-11-25 13:05:41 +01:00
parent dd34805071
commit aee071be6a
5 changed files with 15 additions and 12 deletions

View File

@ -15,7 +15,7 @@ export async function ensureFTSTable(
`CREATE VIRTUAL TABLE ${tableName} USING fts5(key, value);`,
);
console.log(`Created fts5 table ${tableName}`);
// console.log(`Created fts5 table ${tableName}`);
}
}

View File

@ -21,7 +21,7 @@ export async function ensureTable(db: AsyncSQLite, tableName: string) {
await db.execute(
`CREATE TABLE ${tableName} (key STRING PRIMARY KEY, value TEXT);`,
);
console.log(`Created table ${tableName}`);
// console.log(`Created table ${tableName}`);
}
}

View File

@ -49,6 +49,7 @@ export async function addPlugCommand() {
await editor.navigate("PLUGS");
await system.invokeFunction("server", "updatePlugs");
await editor.flashNotification("Plug added!");
system.reloadPlugs();
}
export async function updatePlugs() {

View File

@ -28,7 +28,7 @@ export async function ensureTable(db: AsyncSQLite): Promise<void> {
await db.execute(
`CREATE INDEX ${tableName}_idx ON ${tableName}(key);`,
);
console.log(`Created table ${tableName}`);
// console.log(`Created table ${tableName}`);
}
}

View File

@ -439,6 +439,7 @@ export class Editor {
}
// deno-lint-ignore no-this-alias
const editor = this;
return EditorState.create({
doc: this.collabState ? this.collabState.ytext.toString() : text,
extensions: [
@ -577,16 +578,17 @@ export class Editor {
rebuildEditorState() {
const editorView = this.editorView;
console.log("Rebuilding editor state");
// Load all syntax extensions
this.mdExtensions = loadMarkdownExtensions(this.system);
// And reload the syscalls to use the new syntax extensions
this.system.registerSyscalls(
[],
markdownSyscalls(buildMarkdown(this.mdExtensions)),
);
if (editorView && this.currentPage) {
console.log("Getting all syntax extensions");
this.mdExtensions = loadMarkdownExtensions(this.system);
// And reload the syscalls to use the new syntax extensions
this.system.registerSyscalls(
[],
markdownSyscalls(buildMarkdown(this.mdExtensions)),
);
// And update the editor if a page is loaded
this.saveState(this.currentPage);
editorView.setState(