h-sphere_sql-seal/src/codeblockHandler/SqlSealCodeblockHandler.ts

34 lines
1 KiB
TypeScript
Raw Normal View History

2025-01-09 12:32:24 +00:00
import { App, MarkdownPostProcessorContext } from "obsidian"
import { SqlSealDatabase } from "../database/database"
import { RendererRegistry } from "../renderer/rendererRegistry"
import { Sync } from "../datamodel/sync"
import { CodeblockProcessor } from "./CodeblockProcessor"
import SqlSealPlugin from "../main"
2025-01-09 12:32:24 +00:00
export class SqlSealCodeblockHandler {
constructor(
private readonly app: App,
private readonly db: SqlSealDatabase,
private readonly plugin: SqlSealPlugin,
2025-01-09 12:32:24 +00:00
private sync: Sync,
private rendererRegistry: RendererRegistry
) {
}
getHandler() {
return async (source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) => {
const processor = new CodeblockProcessor(
el,
source,
ctx,
this.rendererRegistry,
this.db,
this.plugin,
2025-01-09 12:32:24 +00:00
this.app,
this.sync
)
ctx.addChild(processor)
}
}
}