Attempt to implement settings syncing

This commit is contained in:
ransurf 2021-10-10 21:08:13 -07:00
parent b53b8758ba
commit 9824d2ba31
10 changed files with 118 additions and 10 deletions

34
view.tsx Normal file
View file

@ -0,0 +1,34 @@
import { ItemView,WorkspaceLeaf } from "obsidian";
import * as React from "react";
import * as ReactDOM from "react-dom";
import ReactView from "./ReactView";
import ExamplePlugin from "main";
export const VIEW_TYPE_EXAMPLE = "example-view"
export class ExampleView extends ItemView {
plugin: ExamplePlugin;
constructor(leaf: WorkspaceLeaf) {
super(leaf)
console.log(this.plugin.settings) }
getViewType() {
return VIEW_TYPE_EXAMPLE
}
getDisplayText() {
return "Example View"
}
async onOpen() {
ReactDOM.render(
<ReactView userID = {this.plugin.settings.userID} tokenAPI = {this.plugin.settings.apiToken}/>,
this.containerEl.children[1]
)
}
async onClose(){
ReactDOM.unmountComponentAtNode(this.containerEl.children[1]);
}
}