Fix syntax extensions not loading at b oot
This commit is contained in:
parent
dd34805071
commit
aee071be6a
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user