h-sphere_sql-seal/src/modules/syntaxHighlight/init.ts
Kacper Kula 285684dfc4
Refactoring Project to use proper Inversion of Control (#171)
* chore: reworking plugin internals into modules

* feat: settings module is now working, added debug module, enabled new api module

* chore: restoring external API

* feat: refactoring project to use proper inversion of control

* feat: plugins can now be loaded in any order

* chore: final file migration, all typescript is in modules now

* chore: fixing dependencies of cellParser

* feat: csv and json views are only registered when they are not colliding with other plugins

* feat: fixed library behaviour on canvas
2025-08-10 09:34:54 +01:00

23 lines
No EOL
819 B
TypeScript

import { makeInjector } from "@hypersphere/dity"
import { SyntaxHighlightModule } from "./module"
import { EditorView, ViewPlugin } from "@codemirror/view";
import { App, Plugin } from "obsidian";
import { RendererRegistry } from "../editor/renderer/rendererRegistry";
import { SQLSealViewPlugin } from "./editorExtension/syntaxHighlight";
@(makeInjector<SyntaxHighlightModule, 'factory'>()([
'app', 'rendererRegistry', 'plugin'
]))
export class SyntaxHighlightInit {
make(app: App, rendererRegistry: RendererRegistry, plugin: Plugin) {
return () => {
// FIXME: settings here.
plugin.registerEditorExtension([
ViewPlugin.define(
(view: EditorView) => new SQLSealViewPlugin(view, app, rendererRegistry),
{ decorations: v => v.decorations }
)
]);
}
}
}