mirror of
https://github.com/moeyua/obsidian-heti.git
synced 2026-07-22 10:10:26 +00:00
26 lines
557 B
TypeScript
26 lines
557 B
TypeScript
import { MarkdownView, Plugin } from "obsidian";
|
|
|
|
export default class ObsidianHeti extends Plugin {
|
|
async onload() {
|
|
// styles in style.css
|
|
this.addLayoutChangeListener();
|
|
}
|
|
|
|
onunload() {}
|
|
|
|
addLayoutChangeListener() {
|
|
this.registerEvent(
|
|
this.app.workspace.on("active-leaf-change", () => {
|
|
this.applyStyles();
|
|
})
|
|
);
|
|
}
|
|
|
|
applyStyles() {
|
|
const markdownView =
|
|
this.app.workspace.getActiveViewOfType(MarkdownView);
|
|
if (!markdownView) return;
|
|
const contentView = markdownView.contentEl;
|
|
contentView.classList.add("heti");
|
|
}
|
|
}
|