From a38ecc39a8635c9fe3283d26fb5a169d571ef779 Mon Sep 17 00:00:00 2001 From: kaiiiz Date: Sat, 25 May 2024 16:05:47 +0800 Subject: [PATCH 1/3] fix: sync single file command not work bug --- src/main.ts | 1 + src/sync.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 4313c07..64b6383 100644 --- a/src/main.ts +++ b/src/main.ts @@ -51,6 +51,7 @@ export default class RaindropPlugin extends Plugin { name: "Sync this bookmark", callback: async () => { const file = app.workspace.getActiveFile(); + await this.raindropSync.syncSingle({ file: file }); }, }); diff --git a/src/sync.ts b/src/sync.ts index e804c93..cba8072 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -36,7 +36,7 @@ export default class RaindropSync { } } - async syncSingle({ file }: { file: TFile }) { + async syncSingle({ file }: { file: TFile | null }) { let raindropId: number; if (file) { const fmc = this.app.metadataCache.getFileCache(file)?.frontmatter; @@ -55,6 +55,7 @@ export default class RaindropSync { await this.updateFileContent(file, bookmark); // Do not perform path sync here! // Since we do not know which collection sync this bookmark (e.g. bookmark "b1" in "Collection 1" may also be synced if you enable "All Bookmarks" collection), which leads to ambiguity. + new Notice(`Sync ${bookmark.title} completed`); } private getSyncFolder(collection: SyncCollection) { From ca3592710a6f9be50e56ba5eb405d19e50d61102 Mon Sep 17 00:00:00 2001 From: kaiiiz Date: Sat, 25 May 2024 16:12:08 +0800 Subject: [PATCH 2/3] feat: support raindrop_url in template --- src/renderer.ts | 3 +++ src/templates/templateInstructions.html | 1 + 2 files changed, 4 insertions(+) diff --git a/src/renderer.ts b/src/renderer.ts index 1ec59d5..5f48f70 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -39,6 +39,7 @@ type RenderTemplate = { important: boolean; creator: RenderCreator; now: moment.Moment; + raindropUrl: string; }; const FAKE_RENDER_CONTEXT: RenderTemplate = { @@ -71,6 +72,7 @@ const FAKE_RENDER_CONTEXT: RenderTemplate = { id: 10000, }, now: Moment(), + raindropUrl: "https://example.com" }; export default class Renderer { @@ -171,6 +173,7 @@ ${fakeContent}`; important: bookmark.important, creator: bookmark.creator, now: Moment(), + raindropUrl: `https://app.raindrop.io/my/${bookmark.collectionId}/item/${bookmark.id}/edit`, }; const env = this.createEnv(); diff --git a/src/templates/templateInstructions.html b/src/templates/templateInstructions.html index 6fd3bb8..687ef16 100644 --- a/src/templates/templateInstructions.html +++ b/src/templates/templateInstructions.html @@ -26,6 +26,7 @@
  • {{created}} (Moment) - Created on
  • {{type}} (string) - Article type
  • {{important}} (bool) - Favorite article
  • +
  • {{raindropUrl}} (string) - Link to raindrop page
  • Creator From 5ca6dcefc380ee6093bc57cfc367ba2f63e02834 Mon Sep 17 00:00:00 2001 From: kaiiiz Date: Sat, 25 May 2024 16:21:48 +0800 Subject: [PATCH 3/3] chore: bump version to 0.0.22 --- manifest.json | 2 +- package.json | 2 +- src/constants.ts | 2 +- versions.json | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 9d052b5..993299a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-raindrop-highlights", "name": "Raindrop Highlights", - "version": "0.0.21", + "version": "0.0.22", "minAppVersion": "0.14.0", "description": "Sync your Raindrop.io highlights.", "author": "kaiiiz", diff --git a/package.json b/package.json index d0a97a6..33b74c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-raindrop-highlights", - "version": "0.0.21", + "version": "0.0.22", "description": "Sync your Raindrop.io highlights.", "main": "main.js", "scripts": { diff --git a/src/constants.ts b/src/constants.ts index ac8287c..494ae9d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,7 +1,7 @@ import DEFAULT_TEMPLATE from "./assets/defaultTemplate.njk"; import type { RaindropPluginSettings } from "./types"; -export const VERSION = "0.0.21"; +export const VERSION = "0.0.22"; export const DEFAULT_SETTINGS: RaindropPluginSettings = { version: VERSION, diff --git a/versions.json b/versions.json index 71eea23..f738c2f 100644 --- a/versions.json +++ b/versions.json @@ -19,5 +19,6 @@ "0.0.18": "0.14.0", "0.0.19": "0.14.0", "0.0.20": "0.14.0", - "0.0.21": "0.14.0" + "0.0.21": "0.14.0", + "0.0.22": "0.14.0" }