Initial Commit

This commit is contained in:
Leoh 2021-10-08 10:23:06 +05:30
parent b2d4fecec3
commit 59cb8f1d70
7 changed files with 101 additions and 7 deletions

15
view.ts
View file

@ -1,4 +1,8 @@
import { ItemView,WorkspaceLeaf } from "obsidian";
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ReactView } from "./ReactView";
export const VIEW_TYPE_EXAMPLE = "example-view"
@ -16,12 +20,13 @@ export class ExampleView extends ItemView {
}
async onOpen() {
const container = this.containerEl.children[1];
container.empty()
container.createEl("h4", {text: "Example View"});
ReactDOM.render(
React.createElement(ReactView),
this.containerEl.children[1]
)
}
async onClose(){
ReactDOM.unmountComponentAtNode(this.containerEl.children[1]);
}
}