|
3 | 3 | ConfluenceUploadSettings, |
4 | 4 | Publisher, |
5 | 5 | ConfluencePageConfig, |
| 6 | + StaticSettingsLoader, |
| 7 | + renderADFDoc, |
6 | 8 | } from "@markdown-confluence/lib"; |
7 | 9 | import { ElectronMermaidRenderer } from "@markdown-confluence/mermaid-electron-renderer"; |
8 | 10 | import { ConfluenceSettingTab } from "./ConfluenceSettingTab"; |
@@ -67,8 +69,7 @@ export default class ConfluencePlugin extends Plugin { |
67 | 69 | }, |
68 | 70 | }); |
69 | 71 |
|
70 | | - const settingsLoader = |
71 | | - new ConfluenceUploadSettings.StaticSettingsLoader(this.settings); |
| 72 | + const settingsLoader = new StaticSettingsLoader(this.settings); |
72 | 73 | this.publisher = new Publisher( |
73 | 74 | this.adaptor, |
74 | 75 | settingsLoader, |
@@ -175,6 +176,38 @@ export default class ConfluencePlugin extends Plugin { |
175 | 176 | } |
176 | 177 | }); |
177 | 178 |
|
| 179 | + this.addCommand({ |
| 180 | + id: "adf-to-markdown", |
| 181 | + name: "ADF To Markdown", |
| 182 | + callback: async () => { |
| 183 | + console.log("HMMMM"); |
| 184 | + const json = JSON.parse( |
| 185 | + '{"type":"doc","content":[{"type":"paragraph","content":[{"text":"Testing","type":"text"}]}],"version":1}' |
| 186 | + ); |
| 187 | + console.log({ json }); |
| 188 | + |
| 189 | + const confluenceClient = new ObsidianConfluenceClient({ |
| 190 | + host: this.settings.confluenceBaseUrl, |
| 191 | + authentication: { |
| 192 | + basic: { |
| 193 | + email: this.settings.atlassianUserName, |
| 194 | + apiToken: this.settings.atlassianApiToken, |
| 195 | + }, |
| 196 | + }, |
| 197 | + }); |
| 198 | + const testingPage = |
| 199 | + await confluenceClient.content.getContentById({ |
| 200 | + id: "9732097", |
| 201 | + expand: ["body.atlas_doc_format", "space"], |
| 202 | + }); |
| 203 | + const adf = JSON.parse( |
| 204 | + testingPage.body?.atlas_doc_format?.value || |
| 205 | + '{type: "doc", content:[]}' |
| 206 | + ); |
| 207 | + renderADFDoc(adf); |
| 208 | + }, |
| 209 | + }); |
| 210 | + |
178 | 211 | this.addCommand({ |
179 | 212 | id: "publish-current", |
180 | 213 | name: "Publish Current File to Confluence", |
|
0 commit comments