From 12e29d57b738e8f0b3224fd4fd708e8245f3aefc Mon Sep 17 00:00:00 2001 From: benji300 Date: Wed, 20 Jan 2021 22:20:07 +0100 Subject: [PATCH 1/6] Fix edited search query not saved --- src/helpers.ts | 19 ++++++++++++++----- src/index.ts | 10 ++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index bd9da08..426f87c 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -140,15 +140,24 @@ export class Favorites { } /** - * Changes the name of the handled favorite. + * Changes the title of the handled favorite. */ - async rename(value: string, newTitle: string) { + async changeValue(value: string, newValue: string) { + if (!newValue) return; const index: number = this.indexOf(value); if (index < 0) return; + this._favs[index].value = newValue; + await this.store(); + } - let favorite: any = this._favs[index]; - favorite.title = newTitle; - this._favs.splice(index, 1, favorite); + /** + * Changes the title of the handled favorite. + */ + async changeTitle(value: string, newTitle: string) { + if (!newTitle) return; + const index: number = this.indexOf(value); + if (index < 0) return; + this._favs[index].title = newTitle; await this.store(); } diff --git a/src/index.ts b/src/index.ts index ef4f862..0f691ff 100644 --- a/src/index.ts +++ b/src/index.ts @@ -236,7 +236,6 @@ joplin.plugins.register({ if (newType) { await favorites.changeType(favorite.value, newType); await updatePanelView(); - return; } } @@ -363,11 +362,10 @@ joplin.plugins.register({ const result: any = await DIALOGS.open(dialogEdit); // handle result - if (result.id == "ok") { - if (result.formData != null && result.formData.inputForm.title != '') { - await favorites.rename(value, result.formData.inputForm.title); - await updatePanelView(); - } + if (result.id == "ok" && result.formData != null) { + await favorites.changeTitle(value, result.formData.inputForm.title); + await favorites.changeValue(value, result.formData.inputForm.value); + await updatePanelView(); } else if (result.id == "delete") { await favorites.delete(value); await updatePanelView(); From 9bc408f4173ca58dac5456a43994acc12ddb8df6 Mon Sep 17 00:00:00 2001 From: benji300 Date: Wed, 20 Jan 2021 22:30:11 +0100 Subject: [PATCH 2/6] Fix reduced opactiy of dragging favorite --- CHANGELOG.md | 5 ++++- src/webview.css | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf80c2d..a3e12a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- None +### Fixed + +- Edited search queries not saved +- Reduced opactiy of dragging favorite ## [1.0.0] - 2020-01-18 diff --git a/src/webview.css b/src/webview.css index 171cdf6..09f3a25 100644 --- a/src/webview.css +++ b/src/webview.css @@ -83,7 +83,7 @@ span { -ms-user-select: none; } .dragging { - opacity: 0.4; + opacity: 0.4 !important; } /* VERCTICAL LAYOUT OVERWRITES */ From 372563026518df9e9ca9582db3ce8e4920803c07 Mon Sep 17 00:00:00 2001 From: benji300 Date: Wed, 20 Jan 2021 22:45:40 +0100 Subject: [PATCH 3/6] Prepared to drag note tabs onto FAVORITES title to add --- src/webview.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/webview.js b/src/webview.js index 8b8491e..7a1bd41 100644 --- a/src/webview.js +++ b/src/webview.js @@ -35,7 +35,7 @@ function dragStart(event) { const dataId = getDataId(event); if (dataId) { event.currentTarget.classList.add('dragging'); - event.dataTransfer.setData('text/favorite-id', dataId); + event.dataTransfer.setData('text/x-plugin-favorites-id', dataId); sourceId = dataId; } } @@ -75,7 +75,7 @@ function dragLeave(event) { function drop(event) { cancelDefault(event); - const dataSourceId = event.dataTransfer.getData('text/favorite-id'); + const dataSourceId = event.dataTransfer.getData('text/x-plugin-favorites-id'); if (dataSourceId) { const dataTargetId = getDataId(event); if (dataTargetId !== sourceId) { @@ -87,7 +87,7 @@ function drop(event) { function dropOnTitle(event) { cancelDefault(event); - // check whether folder was dragged from app onto the panel - trigger favsAddNote then + // check whether folder was dragged from app onto the panel - trigger favsAddFolder then const appDragFolderIds = event.dataTransfer.getData('text/x-jop-folder-ids'); if (appDragFolderIds) { const folderIds = JSON.parse(appDragFolderIds); @@ -105,4 +105,11 @@ function dropOnTitle(event) { } webviewApi.postMessage({ name: 'favsAddNote', id: ids }); } + + // check whether tab (from joplin.plugin.note.tabs plugin) was dragged onto the panel - trigger favsAddNote then + const appDragTabId = event.dataTransfer.getData('text/x-plugin-note-tabs-id'); // 'text/plain' + if (appDragTabId) { + const ids = new Array(appDragTabId); + webviewApi.postMessage({ name: 'favsAddNote', id: ids }); + } } From 39da137c840fe31e623d2c986e86e6860db7c543 Mon Sep 17 00:00:00 2001 From: benji300 Date: Wed, 20 Jan 2021 23:23:25 +0100 Subject: [PATCH 4/6] Improve style of scrollbar in vertical layout --- src/webview.css | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/webview.css b/src/webview.css index 09f3a25..c3d5913 100644 --- a/src/webview.css +++ b/src/webview.css @@ -28,15 +28,6 @@ span { overflow: initial; } -::-webkit-scrollbar { - height: 4px; - width: 4px; -} -::-webkit-scrollbar-thumb { - background: rgba(0, 0, 0, 0.2); - border-radius: 10px; -} - /* HORIZONTAL LAYOUT */ #container { height: 100%; @@ -86,6 +77,14 @@ span { opacity: 0.4 !important; } +::-webkit-scrollbar { + height: 4px; +} +::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.2); + border-radius: 5px; +} + /* VERCTICAL LAYOUT OVERWRITES */ @media screen and (max-width: 400px) { #container { @@ -111,4 +110,8 @@ span { padding-left: 24px; text-align: left; } + + ::-webkit-scrollbar { + width: 7px; + } } From 8be2052363878123a48676b97a63de87a2746328 Mon Sep 17 00:00:00 2001 From: benji300 Date: Wed, 20 Jan 2021 23:24:01 +0100 Subject: [PATCH 5/6] Improve style of scrollbar in vertical layout --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3e12a8..4fa3328 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Improve style of scrollbar in vertical layout + ### Fixed - Edited search queries not saved From 3f0daba462afee14177b3abff39b8d286e7f92cf Mon Sep 17 00:00:00 2001 From: benji300 Date: Wed, 20 Jan 2021 23:25:22 +0100 Subject: [PATCH 6/6] Release v1.1.0 --- CHANGELOG.md | 4 ++++ package-lock.json | 2 +- package.json | 2 +- src/manifest.json | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa3328..ddeacd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- None + +## [1.1.0] - 2021-01-21 + ### Changed - Improve style of scrollbar in vertical layout diff --git a/package-lock.json b/package-lock.json index bf29cd5..d0ad14b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "joplin-plugin-benji-favorites", - "version": "1.0.0", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d83dcc7..613d895 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "joplin-plugin-benji-favorites", - "version": "1.0.0", + "version": "1.1.0", "description": "Save any notebook, note, to-do, tag, or search as favorite in an extra panel view for quick access.", "author": "Benji300", "homepage": "https://github.com/benji300/joplin-favorites", diff --git a/src/manifest.json b/src/manifest.json index dab5682..ed17485 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,9 +2,9 @@ "manifest_version": 1, "id": "joplin.plugin.benji.favorites", "app_min_version": "1.6.5", - "version": "1.0.0", + "version": "1.1.0", "name": "Favorites", - "description": "Save any notebook, note, to-do, tag, or search as favorite in an extra panel view for quick access. (v1.0.0)", + "description": "Save any notebook, note, to-do, tag, or search as favorite in an extra panel view for quick access. (v1.1.0)", "author": "Benji300", "homepage_url": "https://github.com/benji300/joplin-favorites", "repository_url": "https://github.com/benji300/joplin-favorites"