-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.ts
58 lines (42 loc) · 1.43 KB
/
view.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { ItemView, WorkspaceLeaf } from "obsidian";
export const WIZARD_VIEW = "wizard-view";
export class WizardView extends ItemView {
constructor(leaf: WorkspaceLeaf) {
super(leaf);
this.icon = 'sun'
}
getViewType() {
return WIZARD_VIEW;
}
getDisplayText() {
return "Related Ideas";
}
async onOpen() {
const container = this.containerEl.children[1];
container.empty();
container.createEl("h4", {text: "Related Ideas", cls: "heading"});
}
async update(search_results: any){ //
const container = this.containerEl.children[1];
//container.createEl("div", {text: "Hello World"})
container.empty()
const outerDiv = container.createEl("h4", {text: "Related Ideas\n", cls: "heading"});
for (const key in search_results){
let source_name = key
let source_path = search_results[key]['source_path']
let text = search_results[key]['text']
const quote = container.createEl("blockquote", {text: text, cls: "quote"})
const link = quote.createEl("a", { href: source_path, attr: { "data-path": source_path } });
link.createEl("span", {
text: '\n--' + source_name
}
);
}
//container.createEl("div", {text: results.at(0)})
//outerDiv.createEl("div", { text: "" });
//outerDiv.createEl("div", { cls: "outgoing-link-header", text: "⛰" });
}
async onClose() {
// Nothing to clean up.
}
}