Various AT Protocol integrations with obsidian
1// import { ok } from "@atcute/client";
2// import { createNoteCard } from "lib";
3// import AtmospherePlugin from "main";
4// import { Modal, Notice } from "obsidian";
5//
6// export class CreateCardModal extends Modal {
7// plugin: AtmospherePlugin;
8// content: string | undefined;
9//
10//
11// constructor(plugin: AtmospherePlugin, content?: string) {
12// super(plugin.app);
13// this.plugin = plugin;
14// this.content = content;
15// }
16//
17// onOpen() {
18// const { contentEl } = this;
19// contentEl.createEl("h2", { text: "Create new card" });
20//
21// // Add form elements here
22// contentEl.createEl("label", { text: "Card title" });
23// contentEl.createEl("input", { type: "text" });
24// contentEl.createEl("br");
25//
26//
27// let contentInput: HTMLTextAreaElement | null = null;
28// if (!this.content) {
29// contentEl.createEl("label", { text: "Card content" });
30// contentInput = contentEl.createEl("textarea");
31// contentEl.createEl("br");
32// } else {
33// // fill textarea with this.content and make it read-only
34// contentInput = contentEl.createEl("textarea");
35// contentInput.value = this.content;
36// contentInput.readOnly = true;
37// contentEl.createEl("br");
38// }
39//
40//
41//
42//
43// const createButton = contentEl.createEl("button", { text: "Create card" });
44// createButton.onclick = async () => {
45// let text = this.content;
46// if (contentInput) {
47// text = contentInput.value || this.content;
48// }
49// if (!text) {
50// new Notice("Please enter some text");
51// return;
52// }
53// await ok(createNoteCard(this.plugin.client!, this.plugin.settings.did!, text));
54// new Notice("Card created successfully!");
55// this.close();
56// };
57// }
58//
59// onClose() {
60// const { contentEl } = this;
61// contentEl.empty();
62// }
63// }