From 4abcb546e60017214fcaef78b6eca33f5c7b8999 Mon Sep 17 00:00:00 2001 From: Michael Kiessling Date: Thu, 4 Jan 2024 18:56:22 +0100 Subject: [PATCH] change: consume only a single line in obsidian, allows to indent and move-around the generated code much easier! --- main.ts | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/main.ts b/main.ts index 818f0b5..4737007 100644 --- a/main.ts +++ b/main.ts @@ -64,36 +64,21 @@ export default class ObsidianRichLinksPlugin extends Plugin { }).then((res) => { const data = JSON.parse(res); const imageLink = data.links.find((value: { type: string; }) => value.type.startsWith("image/")).href || ''; - - editor.replaceSelection(` - - -`); - }); - } else { - new Notice("Select a URL to convert to rich link."); + editor.replaceSelection(``); + }); + } + else { + new obsidian.Notice("Select a URL to convert to rich link."); + } + } + loadSettings() { + return __awaiter(this, void 0, void 0, function* () { + this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData()); + }); + } + saveSettings() { + return __awaiter(this, void 0, void 0, function* () { + yield this.saveData(this.settings); + }); } - } - - async loadSettings() { - this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); - } - - async saveSettings() { - await this.saveData(this.settings); - } }