From fccda3c8005d87ce714cc2f84fead41eec995c10 Mon Sep 17 00:00:00 2001 From: "Federico \"Edo\" Granata" <3602209+Edo78@users.noreply.github.com> Date: Thu, 27 Jan 2022 10:01:00 +0100 Subject: [PATCH] fix: a bug while getting the page number Close 25 --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/main.ts | 4 ++-- versions.json | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index f4423c0..d64c4cf 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-koreader-plugin", "name": "KOReader Highlights", - "version": "0.2.1", + "version": "0.2.2", "minAppVersion": "0.12.0", "description": "This is a plugin for Obsidian. This plugin syncs highlights and notes taken in KOReader.", "author": "Federico \"Edo\" Granata", diff --git a/package-lock.json b/package-lock.json index 5d44e71..30935b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-koreader-plugin", - "version": "0.2.1", + "version": "0.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "obsidian-koreader-plugin", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "dependencies": { "eta": "^1.12.3", diff --git a/package.json b/package.json index 562fd92..ecb2782 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-koreader-plugin", - "version": "0.2.1", + "version": "0.2.2", "description": "This is a plugin for Obsidian. This plugin syncs highlights and notes taken in KOReader.", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 924df50..3a6c9c6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -112,8 +112,8 @@ export default class KOReader extends Plugin { }) { const { path, uniqueId, bookmark, managedBookTitle, book, keepInSync } = note; - // the page is always the first number in the bookmark's text (eg. 'Pagine 12 foo bar') - const page = parseInt(bookmark.text.match(/\d+/g)[0]); + // the page is always the first number in the bookmark's text (eg. 'Pagina 12 foo bar') + const page = bookmark.text ? parseInt(bookmark.text.match(/\d+/g)[0]) : -1; const noteItself = bookmark.text ? bookmark.text.split(bookmark.datetime)[1].replace(/^\s+|\s+$/g, '') : ''; diff --git a/versions.json b/versions.json index 04843c0..8262fac 100644 --- a/versions.json +++ b/versions.json @@ -9,5 +9,6 @@ "0.1.1": "0.12.0", "0.1.2": "0.12.0", "0.2.0": "0.12.0", - "0.2.1": "0.12.0" + "0.2.1": "0.12.0", + "0.2.2": "0.12.0" }