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);`,
|
`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(
|
await db.execute(
|
||||||
`CREATE TABLE ${tableName} (key STRING PRIMARY KEY, value TEXT);`,
|
`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 editor.navigate("PLUGS");
|
||||||
await system.invokeFunction("server", "updatePlugs");
|
await system.invokeFunction("server", "updatePlugs");
|
||||||
await editor.flashNotification("Plug added!");
|
await editor.flashNotification("Plug added!");
|
||||||
|
system.reloadPlugs();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updatePlugs() {
|
export async function updatePlugs() {
|
||||||
|
@ -28,7 +28,7 @@ export async function ensureTable(db: AsyncSQLite): Promise<void> {
|
|||||||
await db.execute(
|
await db.execute(
|
||||||
`CREATE INDEX ${tableName}_idx ON ${tableName}(key);`,
|
`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
|
// deno-lint-ignore no-this-alias
|
||||||
const editor = this;
|
const editor = this;
|
||||||
|
|
||||||
return EditorState.create({
|
return EditorState.create({
|
||||||
doc: this.collabState ? this.collabState.ytext.toString() : text,
|
doc: this.collabState ? this.collabState.ytext.toString() : text,
|
||||||
extensions: [
|
extensions: [
|
||||||
@ -577,16 +578,17 @@ export class Editor {
|
|||||||
rebuildEditorState() {
|
rebuildEditorState() {
|
||||||
const editorView = this.editorView;
|
const editorView = this.editorView;
|
||||||
console.log("Rebuilding editor state");
|
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) {
|
if (editorView && this.currentPage) {
|
||||||
console.log("Getting all syntax extensions");
|
// And update the editor if a page is loaded
|
||||||
this.mdExtensions = loadMarkdownExtensions(this.system);
|
|
||||||
|
|
||||||
// And reload the syscalls to use the new syntax extensions
|
|
||||||
this.system.registerSyscalls(
|
|
||||||
[],
|
|
||||||
markdownSyscalls(buildMarkdown(this.mdExtensions)),
|
|
||||||
);
|
|
||||||
|
|
||||||
this.saveState(this.currentPage);
|
this.saveState(this.currentPage);
|
||||||
|
|
||||||
editorView.setState(
|
editorView.setState(
|
||||||
|
Loading…
Reference in New Issue
Block a user