Initial Commit
This commit is contained in:
parent
b2d4fecec3
commit
59cb8f1d70
7 changed files with 101 additions and 7 deletions
15
view.ts
15
view.ts
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue