You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Electron: search
This commit is contained in:
@@ -20,6 +20,16 @@ shared.renderTags = function(props, renderItem) {
|
||||
return tagItems;
|
||||
}
|
||||
|
||||
shared.renderSearches = function(props, renderItem) {
|
||||
let searches = props.searches.slice();
|
||||
let searchItems = [];
|
||||
for (let i = 0; i < searches.length; i++) {
|
||||
const search = searches[i];
|
||||
searchItems.push(renderItem(search, props.selectedSearchId == search.id && props.notesParentType == 'Search'));
|
||||
}
|
||||
return searchItems;
|
||||
}
|
||||
|
||||
shared.synchronize_press = async function(comp) {
|
||||
const { Setting } = require('lib/models/setting.js');
|
||||
const { reg } = require('lib/registry.js');
|
||||
|
||||
@@ -35,6 +35,7 @@ function handleItemDelete(state, action) {
|
||||
'FOLDER_DELETE': ['folders', 'selectedFolderId'],
|
||||
'NOTE_DELETE': ['notes', 'selectedNoteId'],
|
||||
'TAG_DELETE': ['tags', 'selectedTagId'],
|
||||
'SEARCH_DELETE': ['searches', 'selectedSearchId'],
|
||||
};
|
||||
|
||||
const listKey = map[action.type][0];
|
||||
@@ -291,22 +292,9 @@ const reducer = (state = defaultState, action) => {
|
||||
newState.searches = searches;
|
||||
break;
|
||||
|
||||
case 'SEARCH_REMOVE':
|
||||
|
||||
let foundIndex = -1;
|
||||
for (let i = 0; i < state.searches.length; i++) {
|
||||
if (state.searches[i].id === action.id) {
|
||||
foundIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 'SEARCH_DELETE':
|
||||
|
||||
if (foundIndex >= 0) {
|
||||
newState = Object.assign({}, state);
|
||||
let newSearches = newState.searches.slice();
|
||||
newSearches.splice(foundIndex, 1);
|
||||
newState.searches = newSearches;
|
||||
}
|
||||
newState = handleItemDelete(state, action);
|
||||
break;
|
||||
|
||||
case 'SEARCH_SELECT':
|
||||
|
||||
Reference in New Issue
Block a user