Search handling for Desktop
This commit is contained in:
@@ -31,7 +31,7 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager) {
|
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager, desktopManager) {
|
||||||
|
|
||||||
this.panelController = {};
|
this.panelController = {};
|
||||||
|
|
||||||
@@ -225,6 +225,18 @@ angular.module('app')
|
|||||||
return note.visible;
|
return note.visible;
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
||||||
|
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.
|
||||||
|
desktopManager.searchText(this.noteFilter.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clearFilterText = function() {
|
||||||
|
this.noteFilter.text = '';
|
||||||
|
this.onFilterEnter();
|
||||||
|
this.filterTextChanged();
|
||||||
|
}
|
||||||
|
|
||||||
this.filterTextChanged = function() {
|
this.filterTextChanged = function() {
|
||||||
$timeout(function(){
|
$timeout(function(){
|
||||||
if(!this.selectedNote.visible) {
|
if(!this.selectedNote.visible) {
|
||||||
|
|||||||
@@ -57,10 +57,23 @@ class DesktopManager {
|
|||||||
return observer;
|
return observer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchText(text) {
|
||||||
|
if(!this.isDesktop) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.searchHandler(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
deregisterUpdateObserver(observer) {
|
deregisterUpdateObserver(observer) {
|
||||||
_.pull(this.updateObservers, observer);
|
_.pull(this.updateObservers, observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pass null to cancel search
|
||||||
|
desktop_setSearchHandler(handler) {
|
||||||
|
this.searchHandler = handler;
|
||||||
|
}
|
||||||
|
|
||||||
desktop_onComponentInstallationComplete(componentData, error) {
|
desktop_onComponentInstallationComplete(componentData, error) {
|
||||||
console.log("Web|Component Installation/Update Complete", componentData, error);
|
console.log("Web|Component Installation/Update Complete", componentData, error);
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,9 @@
|
|||||||
.title {{ctrl.panelTitle()}}
|
.title {{ctrl.panelTitle()}}
|
||||||
.add-button#notes-add-button{"ng-click" => "ctrl.createNewNote()"} +
|
.add-button#notes-add-button{"ng-click" => "ctrl.createNewNote()"} +
|
||||||
.filter-section
|
.filter-section
|
||||||
%input.filter-bar#search-bar.mousetrap{"select-on-click" => "true", "ng-model" => "ctrl.noteFilter.text", "placeholder" => "Search", "ng-change" => "ctrl.filterTextChanged()", "lowercase" => "true"}
|
%input.filter-bar#search-bar.mousetrap{"select-on-click" => "true", "ng-model" => "ctrl.noteFilter.text", "placeholder" => "Search",
|
||||||
#search-clear-button{"ng-if" => "ctrl.noteFilter.text", "ng-click" => "ctrl.noteFilter.text = ''; ctrl.filterTextChanged()"} ✕
|
"ng-change" => "ctrl.filterTextChanged()", "lowercase" => "true", "ng-blur" => "ctrl.onFilterEnter()", "ng-keyup" => "$event.keyCode == 13 && ctrl.onFilterEnter();"}
|
||||||
|
#search-clear-button{"ng-if" => "ctrl.noteFilter.text", "ng-click" => "ctrl.clearFilterText();"} ✕
|
||||||
.sn-component#notes-menu-bar
|
.sn-component#notes-menu-bar
|
||||||
.app-bar.no-edges
|
.app-bar.no-edges
|
||||||
.left
|
.left
|
||||||
|
|||||||
Reference in New Issue
Block a user