Skip to content

Commit

Permalink
fix(desktop): search highlight on pagination
Browse files Browse the repository at this point in the history
Referencing issue standardnotes/bounties#20
  • Loading branch information
jh-code committed Dec 10, 2018
1 parent a656918 commit c2ffe01
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/assets/javascripts/app/controllers/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ angular.module('app')
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager, desktopManager) {

this.panelController = {};
this.searchEntered = false;

$rootScope.$on("user-preferences-changed", () => {
this.loadPreferences();
Expand Down Expand Up @@ -106,6 +107,10 @@ angular.module('app')
this.DefaultNotesToDisplayValue = (document.documentElement.clientHeight / MinNoteHeight) || 20;

this.paginate = function() {
if (this.searchEntered) {
desktopManager.searchText(this.noteFilter.text);
}

this.notesToDisplay += this.DefaultNotesToDisplayValue
}

Expand Down Expand Up @@ -262,6 +267,7 @@ angular.module('app')
this.onFilterEnter = function() {
// For Desktop, performing a search right away causes input to lose focus.
// We wait until user explicity hits enter before highlighting desktop search results.
this.searchEntered = true;
desktopManager.searchText(this.noteFilter.text);
}

Expand All @@ -275,6 +281,10 @@ angular.module('app')
}

this.filterTextChanged = function() {
if (this.searchEntered) {
this.searchEntered = false;
}

$timeout(function(){
if(!this.selectedNote.visible) {
this.selectFirstNote(false);
Expand Down

0 comments on commit c2ffe01

Please sign in to comment.