From 815cb2f40490907a43cf394d2aabb960e7ec6df1 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Wed, 2 May 2018 13:46:17 +0200 Subject: [PALEMOON] [frontend vs backend] Places - Fix: "Keyword" reset (to an empty value) does not work Issue #121 --- .../places/content/editBookmarkOverlay.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'application/palemoon') diff --git a/application/palemoon/components/places/content/editBookmarkOverlay.js b/application/palemoon/components/places/content/editBookmarkOverlay.js index 43645cc73..1b9765bb4 100644 --- a/application/palemoon/components/places/content/editBookmarkOverlay.js +++ b/application/palemoon/components/places/content/editBookmarkOverlay.js @@ -12,6 +12,7 @@ var gEditItemOverlay = { _uris: [], _tags: [], _allTags: [], + _keyword: null, _multiEdit: false, _itemType: -1, _readOnly: false, @@ -139,9 +140,8 @@ var gEditItemOverlay = { this._itemType = PlacesUtils.bookmarks.getItemType(this._itemId); if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) { this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId); - this._initTextField("keywordField", - PlacesUtils.bookmarks - .getKeywordForBookmark(this._itemId)); + this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId); + this._initTextField("keywordField", this._keyword); this._element("loadInSidebarCheckbox").checked = PlacesUtils.annotations.itemHasAnnotation(this._itemId, PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO); @@ -610,9 +610,13 @@ var gEditItemOverlay = { }, onKeywordFieldBlur: function EIO_onKeywordFieldBlur() { - var keyword = this._element("keywordField").value; - if (keyword != PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId)) { - var txn = new PlacesEditBookmarkKeywordTransaction(this._itemId, keyword); + let oldKeyword = this._keyword; + let keyword = this._keyword = this._element("keywordField").value; + if (keyword != oldKeyword) { + var txn = new PlacesEditBookmarkKeywordTransaction(this._itemId, + keyword, + null, + oldKeyword); PlacesUtils.transactionManager.doTransaction(txn); } }, @@ -1004,9 +1008,8 @@ var gEditItemOverlay = { } break; case "keyword": - this._initTextField("keywordField", - PlacesUtils.bookmarks - .getKeywordForBookmark(this._itemId)); + this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId); + this._initTextField("keywordField", this._keyword); break; case PlacesUIUtils.DESCRIPTION_ANNO: this._initTextField("descriptionField", -- cgit v1.2.3 From 39902d8998da806c833f6cc67465a869fc40f116 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Wed, 2 May 2018 14:09:55 +0200 Subject: [PALEMOON] [frontend vs backend] Places - use "let" instead of "var" for the entire function "onKeywordFieldBlur" Issue #121 --- application/palemoon/components/places/content/editBookmarkOverlay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'application/palemoon') diff --git a/application/palemoon/components/places/content/editBookmarkOverlay.js b/application/palemoon/components/places/content/editBookmarkOverlay.js index 1b9765bb4..69d7d32eb 100644 --- a/application/palemoon/components/places/content/editBookmarkOverlay.js +++ b/application/palemoon/components/places/content/editBookmarkOverlay.js @@ -613,7 +613,7 @@ var gEditItemOverlay = { let oldKeyword = this._keyword; let keyword = this._keyword = this._element("keywordField").value; if (keyword != oldKeyword) { - var txn = new PlacesEditBookmarkKeywordTransaction(this._itemId, + let txn = new PlacesEditBookmarkKeywordTransaction(this._itemId, keyword, null, oldKeyword); -- cgit v1.2.3