Added source code files which were left out
This commit is contained in:
parent
32f0e6bc98
commit
470157b672
12 changed files with 414 additions and 0 deletions
38
src/view.tsx
Normal file
38
src/view.tsx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { ItemView,WorkspaceLeaf } from "obsidian";
|
||||
import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
import ReactView from "./ReactView";
|
||||
import HabiticaSync from "./main";
|
||||
|
||||
|
||||
export const VIEW_TYPE = "example-view"
|
||||
|
||||
export class HabiticaSyncView extends ItemView {
|
||||
plugin: HabiticaSync;
|
||||
constructor(leaf: WorkspaceLeaf, plugin: HabiticaSync) {
|
||||
super(leaf)
|
||||
this.plugin = plugin
|
||||
}
|
||||
|
||||
getViewType() {
|
||||
return VIEW_TYPE
|
||||
}
|
||||
|
||||
getDisplayText() {
|
||||
return "Habitica Pane"
|
||||
}
|
||||
getIcon(): string {
|
||||
return "popup-open"
|
||||
}
|
||||
|
||||
async onOpen() {
|
||||
ReactDOM.render(
|
||||
<ReactView userID = {this.plugin.settings.userID} tokenAPI = {this.plugin.settings.apiToken} plugin={this.plugin}/>,
|
||||
this.containerEl.children[1]
|
||||
)
|
||||
}
|
||||
|
||||
async onClose(){
|
||||
ReactDOM.unmountComponentAtNode(this.containerEl.children[1]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue