diff --git a/CHANGELOG.md b/CHANGELOG.md index cf80c2d..ddeacd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - None +## [1.1.0] - 2021-01-21 + +### Changed + +- Improve style of scrollbar in vertical layout + +### Fixed + +- Edited search queries not saved +- Reduced opactiy of dragging favorite + ## [1.0.0] - 2020-01-18 - Initial Release 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/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(); 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" diff --git a/src/webview.css b/src/webview.css index 171cdf6..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%; @@ -83,7 +74,15 @@ span { -ms-user-select: none; } .dragging { - opacity: 0.4; + opacity: 0.4 !important; +} + +::-webkit-scrollbar { + height: 4px; +} +::-webkit-scrollbar-thumb { + background: rgba(0, 0, 0, 0.2); + border-radius: 5px; } /* VERCTICAL LAYOUT OVERWRITES */ @@ -111,4 +110,8 @@ span { padding-left: 24px; text-align: left; } + + ::-webkit-scrollbar { + width: 7px; + } } 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 }); + } }