From e1eb5f91a5e94346e9018c1afe2b1bd1ffc4b65c Mon Sep 17 00:00:00 2001 From: Kombie Date: Sat, 16 Mar 2019 20:46:28 +0000 Subject: [PATCH] [bug] fix edit state not setting to false when last link is removed --- js/keyboard.js | 2 +- js/link.js | 11 +++++++++++ js/version.js | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/js/keyboard.js b/js/keyboard.js index 9a006587..95f3ab94 100644 --- a/js/keyboard.js +++ b/js/keyboard.js @@ -36,7 +36,7 @@ var keyboard = (function() { }; // ctrl+alt+e if (event.ctrlKey && event.altKey && event.keyCode == 69) { - if (state.get().bookmarks.show.link) { + if (state.get().bookmarks.show.link && bookmarks.get().length > 0) { if (state.get().bookmarks.edit) { helper.setObject({ object: state.get(), diff --git a/js/link.js b/js/link.js index 49fd820d..186ff6d7 100644 --- a/js/link.js +++ b/js/link.js @@ -101,11 +101,22 @@ var link = (function() { var remove = function(bookmarkData) { bookmarks.remove(bookmarkData.timeStamp); + _checkCount(); data.save(); clear(); render(); }; + var _checkCount = function() { + if (bookmarks.get().length <= 0) { + helper.setObject({ + object: state.get(), + path: "bookmarks.edit", + newValue: false + }); + }; + }; + var _makeLinkForm = function() { var form = helper.makeNode({ tag: "form", diff --git a/js/version.js b/js/version.js index 40055148..e909842d 100644 --- a/js/version.js +++ b/js/version.js @@ -1,7 +1,7 @@ var version = (function() { // version is normally bumped when the state needs changing or any new functionality is added - var current = "2.9.4"; + var current = "2.9.5"; var get = function() { var number = current.split(".");