You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-27 23:28:38 +02:00
Electron: Resolves #144, Resolves #311: Highlight search results and search in real time. Associated Ctrl+F with searching.
This commit is contained in:
@ -426,11 +426,35 @@ const reducer = (state = defaultState, action) => {
|
||||
case 'SEARCH_ADD':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
let searches = newState.searches.slice();
|
||||
var searches = newState.searches.slice();
|
||||
searches.push(action.search);
|
||||
newState.searches = searches;
|
||||
break;
|
||||
|
||||
case 'SEARCH_UPDATE':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
var searches = newState.searches.slice();
|
||||
var found = false;
|
||||
for (let i = 0; i < searches.length; i++) {
|
||||
if (searches[i].id === action.search.id) {
|
||||
searches[i] = Object.assign({}, action.search);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) searches.push(action.search);
|
||||
|
||||
if (!action.search.query_pattern) {
|
||||
newState.notesParentType = defaultNotesParentType(state, 'Search');
|
||||
} else {
|
||||
newState.notesParentType = 'Search';
|
||||
}
|
||||
|
||||
newState.searches = searches;
|
||||
break;
|
||||
|
||||
case 'SEARCH_DELETE':
|
||||
|
||||
newState = handleItemDelete(state, action);
|
||||
|
Reference in New Issue
Block a user