fix(desktop): search highlight on pagination

Referencing issue standardnotes/bounties#20
This commit is contained in:
jh-code
2018-12-09 21:11:40 -06:00
parent a656918332
commit c2ffe0102a

View File

@@ -34,6 +34,7 @@ angular.module('app')
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager, desktopManager) { .controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager, desktopManager) {
this.panelController = {}; this.panelController = {};
this.searchEntered = false;
$rootScope.$on("user-preferences-changed", () => { $rootScope.$on("user-preferences-changed", () => {
this.loadPreferences(); this.loadPreferences();
@@ -106,6 +107,10 @@ angular.module('app')
this.DefaultNotesToDisplayValue = (document.documentElement.clientHeight / MinNoteHeight) || 20; this.DefaultNotesToDisplayValue = (document.documentElement.clientHeight / MinNoteHeight) || 20;
this.paginate = function() { this.paginate = function() {
if (this.searchEntered) {
desktopManager.searchText(this.noteFilter.text);
}
this.notesToDisplay += this.DefaultNotesToDisplayValue this.notesToDisplay += this.DefaultNotesToDisplayValue
} }
@@ -262,6 +267,7 @@ angular.module('app')
this.onFilterEnter = function() { this.onFilterEnter = function() {
// For Desktop, performing a search right away causes input to lose focus. // For Desktop, performing a search right away causes input to lose focus.
// We wait until user explicity hits enter before highlighting desktop search results. // We wait until user explicity hits enter before highlighting desktop search results.
this.searchEntered = true;
desktopManager.searchText(this.noteFilter.text); desktopManager.searchText(this.noteFilter.text);
} }
@@ -275,6 +281,10 @@ angular.module('app')
} }
this.filterTextChanged = function() { this.filterTextChanged = function() {
if (this.searchEntered) {
this.searchEntered = false;
}
$timeout(function(){ $timeout(function(){
if(!this.selectedNote.visible) { if(!this.selectedNote.visible) {
this.selectFirstNote(false); this.selectFirstNote(false);